Truffle Contract Verification fails for ERC20 extending OpenZeppelin Contracts

Hi,

as suggested read the topic:

Tried to verify contracts on ropsten and mainnet and they fail:

truffle run verify NNNToken --network ropsten
or
truffle run verify NNNToken --network mainnet

all the code and configuration can be found here:
https://github.com/overqint/erc20_nnn

This is the deployed contract:

If we click on the contract address the proxy contract is verified:

Contract Source Code Verified (Similar Match)

Also tried to verify it manually, more info here:

And tried also this, with no success:

How can we also verify the NNNToken Contract?

1 Like

Hi @intoverq,

I verified your implementation contract on mainnet using the following method: Verify smart contract inheriting from OpenZeppelin Contracts

I modified your imports in EnhancedMinterPauser to not be relative:

import "@openzeppelin/contracts-upgradeable/presets/ERC20PresetMinterPauserUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";

Using Hardhat Etherscan plugin I was able to verify

$ npx hardhat verify --network mainnet 0x8f8350fd36b1da9cc1e92744c8d8186ae0215d3c
Nothing to compile
Successfully submitted source code for contract
contracts/NNNToken.sol:NNNToken at 0x8f8350fd36b1da9cc1e92744c8d8186ae0215d3c
for verification on etherscan. Waiting for verification result...
Successfully verified contract on etherscan

On Etherscan, I then marked your proxy as a proxy, and as the implementation contract was now verified, you can now interact with your upgradeable contract via the proxy on Etherscan.


As an aside, your mainnet.json file isn’t under version control. I recommend including this, see the documentation for details: https://docs.openzeppelin.com/upgrades-plugins/1.x/network-files#configuration-files-in-version-control

1 Like

Thank you very much @abcoathup for your help and a happy new year.
Uploaded also mainnet.json to github as suggested

1 Like