0

I've successfully deployed an ERC721 contract to GOERLI using Hardhat - and the contract is working perfectly, but when I try to verify the contract, I keep getting errors.

I'm wondering if it has something to do with the arguments being passed during the contract's deployment.

Here's the deployment code:

  constructor() ERC721("FunNFTs!", "Funs") {   
      // code goes here...
   }

Sine the contract works, I tried to verify it, and ran this from Terminal:

npx hardhat verify --network goerli 0x0123...789 "FunNFTs!" "Funs"

But that gives me the following:

An unexpected error occurred:

[Error: ENOENT: no such file or directory, open '/Users/johnsmith/Desktop/MyFunNFTProject/artifacts/build-info/faab804f0b89fb637a395cffcbbb44b8.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/johnsmith/Desktop/MyFunNFTProject/artifacts/build-info/faab804f0b89fb637a395cffcbbb44b8.json'
}

I should note that I have no idea why its asking me for this file: "faab804f0b89fb637a395cffcbbb44b8.json"

Cause that file doesn't seems to exist anywhere on my computer.

Otherwise, I tried separating those 2 arguments with a comma, like so:

"FunNFTs!", "Funs"

as well as putting them in " ( ) " or "[ ]" - but I get the same error every time.

So I'm pretty much stuck.

Any ideas on what might be happening here?

2 Answers 2

1

Ensure you have npm install --save-dev @nomiclabs/hardhat-etherscan plugin installed. Then you may have to:

  1. Delete artifacts and cache folders
  2. Run npx hardhat compile
  3. Verify again
1

There is a different way when you have more than one argument. enter image description here

You can find that here https://github.com/NomicFoundation/hardhat/tree/main/packages/hardhat-etherscan#complex-arguments

1
  • You're totally right - and I completely forgot (literally have it in my notes!) about needing that arguments.js file because of the multiple constructor arguments. HOWEVER, when I included it in my verify statement, the compiler then pointed out - correctly - that my constructor actually does NOT have any arguments in it. And that's true. It does not. It instantiates an ERC721 contract, which DOES have arguments, but the "main" constructor does not. So the solution was simply clearing out the cache and artifacts folders and deploying everything anew...🤷‍♂️🙏
    – Mark55
    Nov 23 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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