1

Here's the lines:

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "hardhat/console.sol";

Here's the polyscan parse error when trying to verify my contract at https://polygonscan.com/verifyContract

arserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File import callback not supported
 --> myc:5:1:
  |
5 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

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

ParserError: Source "hardhat/console.sol" not found: File import callback not supported
 --> myc:8:1:
  |
8 | import "hardhat/console.sol"
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 Answer 1

1

To verify your contract on any of the Etherscan based platforms via the web UI you need to flatten the contracts. Hardhat has a command for this (see https://hardhat.org/getting-started/#running-tasks).

The easier way to do this is to use the Etherscan API with hardhat. There is a plugin for this: https://hardhat.org/plugins/nomiclabs-hardhat-etherscan.html

Note: There are quite some questions around this topic already which should be helpful. Also Polygon might behave different in detail than Ethereum, for this you would have to reach out to them.

1
  • I get an error due to multiple license identifiers.
    – chovy
    Dec 27, 2021 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.