Error when verifying smart contract on etherscan that imports multiple OpenZeppelin files

Hi I successfully compiled and deployed my contract to the Ethereum mainnet using remix. I compiled with 8.0 and optimization disabled. With all settings correct and uploading all 10 solidity files to Etherscan (including the ones imported from OpenZeppelin) I’m running into multiple errors when verifying.

Here are the compiler warnings it lists:

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use “SPDX-License-Identifier: UNLICENSED” for non-open-source code.
→ Token.sol

ParserError: Source “@openzeppelin/contracts/utils/Address.sol” not found: File import callback not supported
→ Token.sol:3:1:
|
3 | import ‘@openzeppelin/contracts/utils/Address.sol’
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source “@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol” not found: File import callback not supported
→ Token.sol:4:1:
|
4 | import ‘@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol’
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source “@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol” not found: File import callback not supported
→ Token.sol:5:1:
|
5 | import ‘@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol’
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source “@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol” not found: File import callback not supported
→ Token.sol:6:1:
|
6 | import ‘@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol’
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source “@openzeppelin/contracts/token/ERC20/IERC20.sol” not found: File import callback not supported
→ ERC20.sol:5:1:
|
5 | import “@openzeppelin/contracts/token/ERC20/IERC20.sol”
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source “@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol” not found: File import callback not supported
→ ERC20.sol:6:1:
|
6 | import “@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol”
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source “@openzeppelin/contracts/utils/Context.sol” not found: File import callback not supported
→ ERC20.sol:7:1:
|
7 | import “@openzeppelin/contracts/utils/Context.sol”
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use “SPDX-License-Identifier: UNLICENSED” for non-open-source code.
→ IUniswapV2Factory.sol

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use “SPDX-License-Identifier: UNLICENSED” for non-open-source code.
→ IUniswapV2Pair.sol

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use “SPDX-License-Identifier: UNLICENSED” for non-open-source code.
→ IUniswapV2Router01.sol

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use “SPDX-License-Identifier: UNLICENSED” for non-open-source code. Please see https://spdx.org for more information.
→ IUniswapV2Router02.sol

Any suggestions would be appreciated and would be willing to pay someone to walk me through the entire process if they are familiar with verifying contracts that include multiple OpenZep imports, thanks.

can you post the command you used to verify your contract, that resulted in this error?

1 Like

Hi, welcome! :wave:

Have a look at this tutorial:

Contracts deployed with Remix are difficult to verify on Etherscan. Try How to verify a contract deployed using Remix importing OpenZeppelin via GitHub? - #3 by abcoathup