Verify with OpenZeppelin CLI

Is there any way to verify with oz command line. I’ve tried with npx oz verify but look like it doesn’t work. I couldn’t get symbol(), totalSupply() as well as other functions.

Here is step by step what i did with oz command line.

$ npx oz create
The create command is deprecated. Use deploy instead.
Nothing to compile, all contracts are up to date.
? Pick a contract to instantiate TOKENERC20UpgradeSafe
? Pick a network ropsten
✓ Linked dependency @openzeppelin/contracts-ethereum-package 3.0.0
✓ Contract TOKENERC20UpgradeSafe deployed
All implementations have been deployed
? Call a function to initialize the instance after creating it? Yes
? Select which function * initialize(escrow: address)
? escrow: address: 0xDc63C389e72d9f803f5c8fDe241A11e66E8D6531
✓ Setting everything up to create contract instances
✓ Instance created at 0xDb050b5eb8232e9f61694BA7c553A141712CE5cE
To upgrade this instance run 'oz upgrade'
0xDb050b5eb8232e9f61694BA7c553A141712CE5cE
$ npx oz verify
? Pick a network ropsten
? Was your contract compiled with optimizations enabled? No
? Choose a remote endpoint etherscan
? Enter your Etherscan API key (get one at https://etherscan.io/myapikey) EtherscanKey
? Pick a contract to verify TOKENERC20UpgradeSafe
(node:36046) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:36046) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
✓ Contract source code of TOKENERC20UpgradeSafe verified and published successfully. You can check it here: https://ropsten.etherscan.io/address/0x5c1cc30CaCF74d29052cb37C9Fb952F7269E7760#code
1 Like

Hi @Quoc_Le,

We’ve decided it’s best to focus our upgradeability efforts on the Upgrades Plugins exclusively, and have halted development on the OpenZeppelin CLI. See: Building for interoperability: why we’re focusing on Upgrades Plugins

I recommend using OpenZeppelin Upgrades Plugins to deploy and test upgradeable contracts.
See: https://docs.openzeppelin.com/upgrades-plugins/1.x/

You could try either of the following tutorials:

To verify the implementation contract we can do the following: Verify smart contract inheriting from OpenZeppelin Contracts

The proxy and ProxyAdmin contracts should be verified on public networks, let us know if you need these verified on any network.

Finally Etherscan supports proxy contracts: https://medium.com/etherscan-blog/and-finally-proxy-contract-support-on-etherscan-693e3da0714b

Hi @Quoc_Le,

Were you able to verify your contract?

No, not yet. I’ve tried with hardhat. but it shows the error something like the contract code mismatch with a deployed address. I will show you the detailed steps that I did with hardhat soon

1 Like

Hi @Quoc_Le,

If you can share the error, I may be able to guide you.

If you get stuck verifying, you can post your address, Solidity code, parameters and whether optimization was enabled and someone may be able to help you verify.

Finally, I can verify the code with hardhat configuration. but it has another issue. it seems that etherescan couldn’t read the state data when i 've tried to read name, symbol, decimals of token contract.

Could you pls help me?

My implementation contract : https://ropsten.etherscan.io/address/0xd859864F6c88f45b2831c25092798d91Bd91028b#readContract

Here is my code:

Here is my step by step:

  1. npx hardhat run --network ropsten scripts/deploy.js
    Compilation finished successfully
    Deploying Contract…
    Proxy deployed to: 0x3E35067F41dE1Eb952B5C3DEA87d377Ab1449D06

  2. Go to ethescan here and click verify to get implementation contract

  3. $ npx hardhat verify --network ropsten 0xd859864F6c88f45b2831c25092798d91Bd91028b
    Successfully submitted source code for contract
    contracts/QUOCERC20.sol:QUOCERC20UpgradeSafe at 0xd859864F6c88f45b2831c25092798d91Bd91028b
    for verification on Etherscan. Waiting for verification result…
    Successfully verified contract QUOCERC20UpgradeSafe on Etherscan

I forget to click Save button on the verify page in etherscan. It works fine now

1 Like

Hi @Quoc_Le,

Great that you have been able to verify your contract!!