0

I am trying to verify a deployed smart contract on etherscan (goerli testnet) using the command:

npx hardhat verify --contract contracts/Contract.sol:Contract --constructor-args scripts/arguments.js --network goerli DEPLOYED_CONTRACT_ADDRESS

But I am getting this result:

Nothing to compile

Successfully submitted source code for contract contracts/Contract.sol:Contract at DEPLOYED_CONTRACT_ADDRESS for verification on the block explorer. Waiting for verification result...

We tried verifying your contract Stock without including any unrelated one, but it failed. Trying again with the full solc input used to compile and deploy it. This means that unrelated contracts may be displayed on Etherscan... Successfully submitted source code for contract contracts/Contract.sol:Contract at DEPLOYED_CONTRACT_ADDRESS for verification on the block explorer. Waiting for verification result...

Error in plugin @nomiclabs/hardhat-etherscan: The contract verification failed. Reason: Fail - Unable to verify

I managed to verify a contract with one constructor argument, and that was pretty straightforward. However, for this one that has multiple arguments, I had to first create a module that's shown in the command above (arguments.js) that exports all the constructor arguments that were passed to the contract during deployment according to the instructions in the hardhat docs ( https://hardhat.org/hardhat-runner/plugins/nomiclabs-hardhat-etherscan ), but for some reason this is failing. Woulg highly appreciate anyone's assistance.

1 Answer 1

0

I do not know much about the hardhat verification extenstion, however I will share with you the easiest way I have found to verify contracts on etherscan.

in your artifacts folder under build info will be the build info for the compiled contract. Step One

Copy the Input JSON from here into a .JSON file on your computer. If You're using VSCode you can collapse the object with the arrow to make it easier to copy. Step Two

When verifying on etherscan, select Standard JSON Input Step Three

Then Upload the JSON file that you copied the input data into and click verify! Step Four

1

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.