Can't verify token contract developed with OpenZeppelin Contracts

Hello,

I developed an ERC-20 token using openzeppelin. I successfully deployed the contract on Ethereum main network. I tried to verify the contract using truffle-flattener and I get the following error:

Error! Unable to generate Contract ByteCode and ABI
Found the following ContractName(s) in source code : ColaToken , Context , ERC20 , IERC20 , SafeMath
But we were unable to locate a matching bytecode (err_code_2)

I also tried using the “Verify smart contract inheriting from OpenZeppelin Contracts” but failed. Please help! Thank you.

Token contract ID: 0x19E98c4921aAb7E3f5FD2aDca36CFb669c63E926
Source: https://github.com/jalapenosensei/ColaToken

:computer: Environment

  "devDependencies": {
    "openzeppelin-solidity": "^3.3.0",
    "truffle-flattener": "^1.5.0",
    "truffle-plugin-verify": "^0.5.4"
compilers: {
    solc: {
     version: "0.7.0", 
    settings: {       
      optimizer: {
        enabled: false,
        runs: 200
      },
      evmVersion: "byzantium"
     }
    }
1 Like

Hi @jalasensei,

Welcome to the community :wave:

To encode constructor parameters for verifying on Etherscan you can use: https://abi.hashex.org/

I am not sure why you used an older EVM version: byzantium. See: https://docs.soliditylang.org/en/v0.8.0/using-the-compiler.html#target-options
You will need to make sure when verifying that you specify that you used this EVM version.


You could try using the Truffle Plugin Verify as you deployed using Truffle: Verify smart contract inheriting from OpenZeppelin Contracts