How to Verify Contract on Etherscan Using Github Imports Via Remix

Hello Community just read through another post about converting imports and verifying when using Github. I made the mistake of not compiling now I need to get this sorted.

I tried what was in here however could not get it to verify:

Any help would be greatly appreciated.

:computer: Environment
Deployed using remix and 0.6.12 & OpenZepplin v3.2.0

Trying to flatten using truffle like in the post but threw Multiple SPX errors after removing got this:

myc:2103:1: DeclarationError: Identifier already declared.
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
^ (Relevant source part starts here and spans across multiple lines).
myc:1628:1: The previous declaration is here:
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
^ (Relevant source part starts here and spans across multiple lines).
myc:2271:25: TypeError: Cannot call function via contract type name.
        address owner = ERC721.ownerOf(tokenId)

:1234: Code to reproduce

I converted imports to these :

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol";
1 Like

So you want to verify this contract: wizard-deVv/mythic-finance/blob/main/creepsv2.sol, right?
What is your contract address?

1 Like

Hey there, I am currently interacting using web 3 but would like it to be publicly verified but struggling to get it, will never use github imports again now that see how easy truffle is…

1 Like

Hi @wizard-deVv,

Welcome to the community :wave:

When converting to npm imports, you need to install the same version of OpenZeppelin Contracts.

In your case you were importing OpenZeppelin Contracts 3.2 via GitHub so need to install npm install @openzepplin/contracts@3.2.0

Using Binance Smart Chain I am not sure if Hardhat verify supports bscscan, so flattening is likely to be the easiest way to do this. You would need to remove the duplicate SPDX-License-Idetifier’s, though as you are using MIT, this is fairly straight forward.

1 Like


Yes i did install the 3.2 Version, BSC is the exact same as ETH from my experience so far. Not sure why like i stated above after flattening and removing duplicate License I got a really weird error.

1 Like

2 posts were split to a new topic: Verify contract on Etherscan deployed via Remix

Bro make a new post why did you hijack mine?

1 Like

Hi @wizard-deVv,

Just wanted to check if you were able to verify?

No not yet, I tried all those things and unfortunately still getting the same errors

1 Like

Hi @wizard-deVv,

I verified your contract doing the followng:

  • Create a simple Truffle project, installed OpenZeppelin Contracts 3.2 and Truffle Flattener.
  • Converted GitHub imports to npm imports on the contract
  • Ran Truffle Flattener
$ npx truffle-flattener ./contracts/creepsv2.sol > ./contracts/FlatCreepsV2.sol
  • Manually removed duplicate SPDX License Identifiers
  • Encoded your constructor arguments using
  • Verified on BSCScan with Optimization enabled and runs 200, with compiler set to 0.6.12

Looks like this was the step i was missing here :slight_smile:

You are a legend thank you for all you do here!

1 Like

A post was split to a new topic: How do I verify my contract?