File import callback not supported Context.sol

Sorry, I am not familiar with the BSC-Chain, maybe you should ask for help in their forum: Home | Binance Chain Forum

And they have a documentation about how to verify contracts, maybe you can have a look at it: Truffle Verify - Binance Chain Docs

You should flatten your contract to verify the code.

I suggest looking at the following Step by Step Tutorials:

1 Like

Hi @Skyge.

Thank you. I'll have a look at all the options you presented.

I've posted on the Binance Chain Forum regarding the verification process. No reply as yet.

Also, the OpenZeppelin step by step Hardhat tutorial is great. It's definitely better than the others I've read. I'm still stuck though. I'll share with you guys my most recent attempt at verification using Hardhat. Below:

935782@auth MINGW64 ~
$ mkdir my_contract && cd my_contract

935782@auth MINGW64 ~/my_contract
$ npm init -y
Wrote to C:\Users\935782\my_contract\package.json:

{
"name": "my_contract",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"keywords": ,
"author": "",
"license": "ISC"
}

935782@auth MINGW64 ~/my_contract
$ npm install --save-dev hardhat
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npx hardhat
888 888 888 888 888
888 888 888 888 888
888 888 888 888 888
8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888
888 888 "88b 888P" d88" 888 888 "88b "88b 888
888 888 .d888888 888 888 888 888 888 .d888888 888
888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.
888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888

Welcome to Hardhat v2.0.3

:heavy_check_mark: What do you want to do? · Create an empty hardhat.config.js
Config file created

added 309 packages, and audited 310 packages in 5m

39 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

935782@auth MINGW64 ~/my_contract
$ npx hardhat
Error HH1: You are not inside a Hardhat project.

For more info go to https://hardhat.org/HH1 or run Hardhat with --show-stack-traces

935782@auth MINGW64 ~/my_contract
$ 888 888 888 888 888
bash: 888: command not found

935782@auth MINGW64 ~/my_contract
$ 888 888 888 888 888
bash: 888: command not found

935782@auth MINGW64 ~/my_contract
$ 888 888 888 888 888
bash: 888: command not found

935782@auth MINGW64 ~/my_contract
$ 8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888
bash: 8888888888: command not found

935782@auth MINGW64 ~/my_contract
$ 888 888 "88b 888P" d88" 888 888 "88b "88b 888

888 888 .d888888 888 888 888 888 888 .d888888 888
888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.
888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888

Welcome to Hardhat v2.0.3

:heavy_check_mark: What do you want to do? · Create an empty hardhat.config.js
Config file created
npm install --save-dev @openzeppelin/hardhat-upgrades

npm install --save-dev @nomiclabs/hardhat-ethers ethers

npx hardhat verify --network Mainnet 0xa4072b6Bb0664098ef129DA2bD181848862345C8
Nothing to compile
Compiling 1 file with 0.8.0
Successfully submitted source code for contract
contracts/Ehmetcoin.sol:BEP20Token at 0xa4072b6Bb0664098ef129DA2bD181848862345C8
for verification on Etherscan. Waiting for verification result...

New Edit: I attempted to verify the token using the instruction found here:

https://docs.binance.org/smart-chain/developer/deploy/truffle-verify.html

I got the "command not found" error message 17 times when using that. Also, I did edit the truffle code before I used it (mainnet replacing testnet -- added the bscscan api key and, of course, the contract address).

1 Like

What would you want to do by this line?

1 Like

Hi @Skyge.

Thanks for your response.
I’m not sure what to do with that line. It’s troubling. I’d like to know how to overcome that or make it not be there. I really need your help with all of this.

I think the common commands are:

npm install --save-dev hardhat             // install hardhat
npx hardhat                                // create your own Hardhat project
npx hardhat compile                        // compile contracts
npx hardhat test                           // run test case
npx hardhat run scripts/sample-script.js.  // deploy contracts

And for more details, I think you can have a look at their documentation: https://hardhat.org/getting-started/

1 Like

Hi @935782,

For instructions on how to setup a node project please see:
https://docs.openzeppelin.com/learn/setting-up-a-node-project

I made a starter kit. Maybe you will have more luck with it?

It’s purely educational.

1 Like

Hi @Skyge @abcoathup @madeindreams.

Wow!

Many thanks to all of you for your kind assistance. At this moment, I’m reading your new messages for the first time and I know that the information that you’ve provided is going to help me. I just have this very strong and positive feeling about what you’ve sent.

Thank you all very much!

Everything you posted is quite useful and enlightening, particularly the information about the .env and the .gitignore files. I was successful in creating those two items. Thanks much for that.

Two things that are hindering my process here: 1) no matter what I’ve attempted to do with Hardhat, I always get the error message: “Error HH1: You are not inside a Hardhat project”. 2) Truffle seemingly is so deprecated that with just about every command I’ve attempted with it, I get the error message saying “Command not found”. Either there are certain things I’m doing terribly wrong or these programs are not functioning as they should. At this point, I’m not sure what the answer is. On another note I opened a support ticket with the bscscan support staff two days ago. No reply from them as yet.

I’m enjoying learning about npm’s and everything else here. Again, to the three of you, many thanks for your kind assistance, your time and your efforts to help me solve this issue.

At the moment, I’m trying Hardhat again…

Same result.

3 Likes

Below are the Solidity, the address, compiler version, the constructor parameters for my token: ehmetcoin:

Remix IDE: Solidity
Contract address: 0xa4072b6Bb0664098ef129DA2bD181848862345C8
Compiler version: 0.8.0
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 EhmetCoin is ERC20 {
    constructor(uint256 initialSupply) ERC20("EhmetCoin", "EHMET") {
        _mint(msg.sender, initialSupply);
        
           }
        
    }

The code above compiled and deployed with no errors and no warnings in Remix.

Great, after so many attempts, you finally succeeded.

Hi @935782,

Which network is this? Please include an Etherscan link.
Also what value was used for initialSupply?

Hi @abcoathup.

Binance Smart Network. bscscan.com.

Initial supply is 170000000000.

Thank you @abcoathup.

Hi @Skyge, my apologies that you misunderstood. The compilation and deployment was never the problem. All of that was error-free from the beginning. The problem has been verifying the token on bscscan.com.

Hi @935782,

Verified.

Converted GitHub imports to npm imports. If using GitHub imports you need to use the release tag (not the branch) of an official OpenZeppelin Contracts release, otherwise you are importing the master branch which is subject to change.

EhmetCoin.sol

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

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

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

arguments.js

// arguments.js
module.exports = [
    "170000000000000000000000000000"
  ];

verify

$ npx hardhat verify --contract contracts/EhmetCoin.sol:EhmetCoin --const
ructor-args arguments.js --network bsc 0xa4072b6bb0664098ef129da2bd181848862345c8
Nothing to compile
Compiling 1 file with 0.8.3
Successfully submitted source code for contract
contracts/EhmetCoin.sol:EhmetCoin at 0xa4072b6bb0664098ef129da2bd181848862345c8
for verification on Etherscan. Waiting for verification result...

Successfully verified contract EhmetCoin on Etherscan.
https://bscscan.com/address/0xa4072b6bb0664098ef129da2bd181848862345c8#code
1 Like

@abcoathup.

Thank you so much.
I simply wasn’t able to get there based on my limited knowledge of these things.
You have helped me greatly. Immensely.
Much gratitude to you.

2 Likes

A post was split to a new topic: Can’t verify contracts on the BSC-Chain

10 posts were split to a new topic: Can’t verify contracts on the BSC-Chain

Hi @abcoathup

I am struck on kinda same problem can you check whats the problem and verify it as well . Thanks in advance.

Remix IDE: Solidity
Contract address: 0xcc520a06986db2350224d8e128ab4e08cd94e549
Compiler version: 0.8.1
Total Supply: 10,000,000,000
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 messengerToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Messenger Token", "MSG") {
_mint(msg.sender, initialSupply);

       }
    
}

bro same problem here also posted before but no reply!!!!! HELP ME TOO to verify it on bsc scan bro @935782 @madeindreams 4039570092 :canada: to whatsapp anyone guys

Hi i have created a new token which is approved with pancake and liquidity supply also done

Now the token need to verify with bscscan
So getting error

In constructor and spdx license how do i solve this issue

I need help immediately i need response
How to verify also


I am facing the same problem using the suggestion from here.