1

I recently used hardhat as a compiler for deploying SC and feel it really efficient. However, when I try to verify the SC using

npx hardhat verify --network bsc_testnet 0x....

I got the following error

Error in plugin @nomiclabs/hardhat-etherscan: More than one contract was found to match the deployed bytecode. Please use the contract parameter with one of the following contracts:

  • @openzeppelin/contracts/MyTest.sol:MyTest
  • contracts/MyTest.sol: MyTest

For example:

hardhat verify --contract contracts/Example.sol:ExampleContract

If you are running the verify subtask from within Hardhat instead:

await run("verify:verify", { , contract: "contracts/Example.sol:ExampleContract" };

Please help me. Thank much everyone

2 Answers 2

1

The error occurs because you have multiple contract with the same name of MyTest. You can easily obtain it from the artifacts/ folder after

npx hardhat compile

In order to fix the error, you just need to pass the right contract instance as

npx hardhat verify ---contract "contracts/MyTest.sol:MyTest" --network bsc_testnet "your_contract_address" "argument_if_have"

Hope it helps.

1

It occurs because of multiple presences of the same contract. As mentioned in the error message itself, try running this command instead.

npx hardhat verify --contract "contracts/MyTest.sol:MyTest" --network bsc_testnet 0x....

This command will tell hardhat the exact file to verify, which is I assume MyTest.sol inside the contract folder.

Your Answer

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

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