Solidity – How to Resolve ‘ERC20.sol’ Not Found: File Import Callback Not Supported

solidity

Hello i am trying to verify my test token on binance testnet and getting error about importing erc20 .

 --> myc:4:1:
  |
4 | import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

code :

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";

contract TestC is ERC20{
    constructor(uint256 initialSupply) ERC20("TestC", "ALPH") {
        _mint(msg.sender, initialSupply);
    }
    
}

remix compiler compiles with no errors or warnings at all . but when y try to verify source code on bncscan it returns this error

Best Answer

This is a classic issue when verifying source code from block explorer's UI. Copy contents from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; create new file named ERC20.sol; paste copied code in this file and change your import statement to import ./ERC20.sol;

Related Topic