Is .openzeppelin transferable from a Truffle to a Hardhat project?

Hello here,

I have been developing my contracts using truffle until now.

I would like to migrate an existing project, that uses UpgradeableContracts and the "@openzeppelin/truffle-upgrades": "^1.5.0" package, to hardhat.

However I would like the addresses of my already deployed proxies, logic, etc… to be kept in the migration of tool, so if I want to deploy a new logic contract for a proxy OR a new proxy for an already deployed Logic contract, it still uses the one that were already deployed using truffle.

Is this something possible by copying the .openzeppelin directory “as-is” from the truffle project to the hardhat one?
I would imagine what is used under the hood is the same for both so the format of the files should be the same, and that there is only a “provider” that transform the content of .openzeppelin as required in both tools.

If it’s not possible, is there maybe a known tool that could actually do that?

Thank you in advance,

Simon / dievardump

Hello @dievardump.

I’d love @frangio expert opinion on this, but as far as I know, the .openzeppelin directory contains the manifest of deployments, which is produced by the common core which is shared by the truffle and hardhat plugins.
The consequence is that just copying it should work transparently.

In any case, you may want to save a copy of this directory, just to be sure.

If you have any issue with this migration, please let us now!

1 Like

Hi @dievardump,

I moved your question to a new topic and replied there: Migrate to HardHat (deployed upgradable contracts with Truffle) - #2 by abcoathup

I believe this should work as long as you’re not using libraries with unsafeAllowLinkedLibraries.

1 Like