Migrate to HardHat (deployed upgradable contracts with Truffle)

Hello, coming a long time after but I guess I’m not the only one in this situation so I will continue on this thread:

You said:

I just deployed an upgradeable contract using Truffle Upgrades Plugins, and then installed Hardhat and then did an update using Hardhat Upgrades Plugins. I didn’t have any issues.

You mean you installed in the same directory that was existing? Are Truffle artifacts recognized by Hardhat out of the box?

This would sure make things a lot easier.

For a matter of fact:

I am trying to come back to a project, to deploy several new proxies on the same already deployed logic. But I want to use hardhat for it.
But I can’t seem to find a function that allows this. It’s either deployProxy or updateProxy, but if I want to deploy a proxy on a logic that was already deployed a few weeks ago, is this something I could do with this?

1 Like

Hi @dievardump,

First add your configuration files to version control: https://docs.openzeppelin.com/upgrades-plugins/1.x/network-files#configuration-files-in-version-control

I installed Hardhat in the existing project that deployed using Truffle.

Upgrades Plugins uses their own Network Files (https://docs.openzeppelin.com/upgrades-plugins/1.x/network-files#network.json), so these are the files we need to focus on rather than Truffle artifacts.

deployProxy should only deploy a new implementation contract if the bytecode has changed, but I would check this on a public testnet first when migrating from Truffle to Hardhat. In case you are changing anything which results in a bytecode change.

An upgradeable contract has an implementation contract, a ProxyAdmin and a proxy. ProxyAdmin is per project and per network, so if the implementation contract hasn’t changed, then only a proxy should be deployed.

Thank you very much! This is perfect.

I just tried that and tested on rinkeby and the hardhat script deployed only the proxy, pointing to the implementation that was deployed a few weeks ago with truffle. This is awesome!

Thank you very much!

1 Like