How to verify ERC20 deployed via Remix on Etherscan?

Hello, my first time in the community.

I deployed this simple burnable erc20 token inheriting from the openzeppelin contract but I am unable to verify it on etherscan. I have tried to use the truffle flattener but I am not familiar with the truffle framework on cmd with my system.

I have also used the API key verification with remix and it didn’t verify on etherscan though it showed verified correctly!

Is there another way I can do the verification with remix or any other interface?

here is my token contract
Contract: https://ropsten.etherscan.io/address/0x68015963eb2f54ed4d46d6ec4bebb8eb8faf05cd

Source:

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.7/contracts/token/ERC20/ERC20.sol";

contract CodeWithPaul5 is ERC20 {
    constructor() ERC20("CodeWithPaul5", "CWP5") { }
       
}

Please how do I complete this?

Thanks

1 Like

What is your compile config?

1 Like

Hi @DeSaint,

Welcome to the community :wave:

:warning: We should only use an official release of OpenZeppelin Contracts. When using GitHub imports we can specify a release tag. The following is for OpenZeppelin Contracts 3.4 Solidity 0.7 version.

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0-solc-0.7/contracts/token/ERC20/ERC20.sol

The code you provided is importing Solidity 0.7 branch which is subject to change and is not part of an official release. As the code can change, this can make verification difficult too.

An example ERC20 can be found in: Deploy a simple ERC20 token in Remix

Also, the code provided isn’t burnable, it appears to be different to what is actually deployed. The code above has a supply of zero, but the contract linked on Etherscan has minted tokens. I assume you are only showing a cut down version of your contract?

I use the following process to verify using Hardhat by converting GitHub imports to npm imports: Verify smart contract inheriting from OpenZeppelin Contracts

As @skyge said, to verify you will need to know the Solidity compiler version used and whether optimization was enabled.

1 Like

Thanks @abcoathup and @Skyge for your contribution. I have been able to rewrite it in a single file and contract got verified easily. However, I have a little concern that the write contract tab doesn’t show any functions. Is this normal or could it be network or I missed something in my script?

Contract Address: 0x52D9fDBfE991290164D6b51DB1A00fEBd622313F

Please help and advise.

Thanks

1 Like

Maybe there is something wrong with your network, I can get functions correctly as following:

1 Like

Thanks @Skyge for the prompt response and check. It’s clear my ISP is down here as many other sites and disconnecting now.

I noticed the burn function didn’t show up in the write contract tab screenshot you sent me. I have a function written for it in my source code but it seems to be silent and uncallable. What do you think I didn’t get right?

I am sorry I am doing this reply with my phone because my network is down.

Could you help me take a look at it please?

Thank you

1 Like

You can have a look at your code:

function _burn(address account, uint256 value) internal {
        require(account != address(0), "CodeWithPaul9: burn from the zero address");

        _totalSupply = _totalSupply - value;
        _balances[account] = _balances[account] - value;
        emit Transfer(account, address(0), value);
    }

You defined the _burn as an internal function, so you can not access to it outside the contract.

1 Like

Oh, Thank you. Will run through again once my network is restored. Thanks @Skyge

1 Like