0

I have a smart contract that imports from open zeppelin contracts. I have having some trouble verifying the contract through Hardhat. The contract compiles and is deployed on goerli testnet but i get this error when running this command:

Hardhat Command:

npx hardhat verify --network goerli 0x70adB5B0A27da42CE765B44d638b7475aAb8Cf97

Error Message:

An unexpected error occurred:

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

Here is my smart contract:

SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";

// inherit from ERC721 openzep contracts
contract OneOfAKind is ERC721 {

    constructor(string memory name, string memory symbol) 
        ERC721(name, symbol) {

            console.log("Token Name:", name); // show when tests run
            console.log("Token Symbol:", symbol); // show when tests run
            console.log("Sender's Address:", msg.sender); // shows sender address
    }
}

Here is my Hardhat.config.js file script:

require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-etherscan");
require("dotenv").config();

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.17",
  networks: {
    goerli: {
      url: process.env.NODE_ENDPOINT,
      accounts: [process.env.PRIVATE_KEY]
    }
  },
  etherscan: {
    apiKey: process.env.API_KEY
  }
};

1 Answer 1

1

First make sure you have the plugin to do this properly installed, f its not installed use this command to do so: npm install --save-dev @nomiclabs/hardhat-etherscan If that was properly installed follow the next steps:

  1. Delete the artifacts by using npx hardhat clean
  2. Compile to regenerate the artifacts npx hardhat compile
  3. Try to verify again.

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.