Unable to verify simple ERC20 on Rinkeby

Hi Team,

I created a simple contract for ERC-20 token using openzeppelin library.

The contract works perfectly on the local ganache network and I can perform all the necessary operations.

I have also implemented the same contract on the rinkeby network and that contract is working as expected.

But when I tried to access the portion of the read contract at https://rinkeby.etherscan.io/ it shows me the following:

So, I tried two different ways to upload and verify my contract:

  1. I had uploaded a parsed Json file of the existing contract from the /build directory.
  2. I uploaded the solidity file of my contract.

But in both cases I have the similar error that the imported openzeppelin .sol file was not found.
In my contract i’ve used the below import statements:
import “@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol”;
import “@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol”;

So, i’ve tried another way by importing it directly from git repository as follow:
import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/token/ERC20/ERC20Detailed.sol”;
import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/token/ERC20/ERC20Mintable.sol”;

In below image as you can see the contract compiled successfully on remix IDE:

Also it automatically downloaded the required .sol files.

According to the rinkeby site, they said that If the contract compiles correctly at REMIX, it should also compile correctly here.

But in my case that won’t happen.

At the time of the contract verification, I also saw that we can provide the contract library address, but I am confused where to find the Openzeppelin library address.

Could you guys please provide any solution on this issue.

1 Like

Hi @Nikunj,

I suggest using the following method: Verify smart contract inheriting from OpenZeppelin Contracts

You would need to convert your imports from via GitHub to via node packages and npm install @openzeppelin/contracts@2.5.1

Let me know if you need help with this.

As an aside, you may want to use the latest version of OpenZeppelin Contracts for your token.

1 Like

Thanks @abcoathup for your suggestion :slight_smile:

1 Like