Verify Issue On Etherscan import "@openzeppelin

Hello openzeppelin community.

I cannot seem to get my contract verified on etherscan.
Here is the following error:

ParserError: Source "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol" not found: File import callback not supported
--> myc:5:1:
5 | import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
--> myc:6:1:
6 | import "@openzeppelin/contracts/access/Ownable.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I understand that it has something to do with the location of openzeppelin imports, however I have read the tutorials and have had very limited success.

Is there an updated tutorial for September 2021 that someone can point me towards?

Hash: 0xbcaf5a119db1ea474f4ca0a24300765035ab8fef

Any info you could provide I appreciate.

1 Like

Etherscan doesn't know what "@openzeppelin" is so you need to manually include these files either as a single monolithic file or multiple separate files.

The simplest solution to this is to flatten the entire contract with something like truffle-flattener. If you're using hardhat, you can follow this tutorial.

1 Like

Thank you, I'll try that. Fingers crossed!

I am trying to flatten it, but it still wont work. This time remix has a compile error when I flatten. That doesn't seem right. I'll keep looking but so far no success.

Can you share with me the flattened contract and the variables that you used to deploy it. I will try to deploy an instance of it on ropsten and verify it on ropsten.etherscan.

1 Like

Any update on figuring this out? We are having the same problem verifying, after fixing the ABI constructor arg issue