OpenZeppelin Contracts verification on Etherscan

Hi there,

Here is an old problem: how can a smart contract importing OZ contracts be verified easily on Etherscan?

I’ve found three approaches so far:

  1. Verifying using Hardhat: Verify smart contract inheriting from OpenZeppelin Contracts. This is definitely working, but would require learning/using Hardhat, which can be an overhead.

  2. Flattening contracts using a truffle-flatten tool, which somehow never worked on my machine.

  3. Manually copy and paste importing contracts into one. This worked fine but it’s not too hard to imagine the amount of manual effort.

Wondering if the Etherscan team can integrate importing OZ contracts on Etherscan once for all. That would be so great to use OZ contracts down the road.


1 Like

I highly recommend learning hardhat. I moved from Truffle to hardhat in an afternoon and it was worth it.

You can also use a truffle verify plugin

1 Like

Thanks for your advice. I gave it a shot and it did beat my expectations.

1 Like