ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File import callback not supported

Hello.

Just starting out trying to learn contracts and how they work. Found an example from your wizard and ran it fine in remix, compiled and deployed fine. When I went to etherscan.io to compile the code I received this error :

........
Error! Unable to generate Contract ByteCode and ABI (General Exception, unable to get compiled [bytecode])
........

The Compiler Warning(s) game me this :
........
ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File import callback not supported
--> myc:8:1:
|
8 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
........

I am not 100% sure what is going on with this error, have googled it and found that the @open statement is supposed to be used but that did not help as shown in code below. I did however notice in MyContract_metadata.json the "version": "0.5.17+commit.d19bba13" is show, do not know if this would have to be changed to the ^0.8.2 version or if it matters?

Any help would be greatly appreciated for your time.
Thank you.

:1234: Code to reproduce

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.2;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract CoreToken is ERC20 {
    constructor() ERC20("Core Token", "CMN") {
        _mint(msg.sender, 1000000000 * 10 ** decimals());
    }
}

:computer: Environment

Used the wizard to create the contract here on OpenZeppelin
Used remix solidity ^0.8.2

1 Like

"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol" not found: File import callback not supported

you should create a folder named contracts and inside have a folder named token, and inside the folder token you should leav a ERC20 smartcontract, you can found one on the git of openzeppelin

Hi, welcome! :wave:

Thanks for using Wizard and enjoying it!
It seems like you are trying to verify the contract, I think you can have a look at this tutorial: