0
Verifying contract...
    Nothing to compile
    Successfully submitted source code for contract
    contracts/Raffle.sol:Raffle at 0x2d47dB0600dcef1B269e7960D627ee4dc777914b
    for verification on the block explorer. Waiting for verification result...
    
    We tried verifying your contract Raffle 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/Raffle.sol:Raffle at 0x2d47dB0600dcef1B269e7960D627ee4dc777914b
    for verification on the block explorer. Waiting for verification result...
    
    NomicLabsHardhatPluginError: The contract verification failed.
    Reason: Fail - Unable to verify 

This is what my terminal returns after I try to run yarn hardhat test --network goerli

My deploy script passes the same arguments variable to the contract when deploying it and to the verify function when trying to verify so I know the args are the same.

const arguments = [
        vrfCoordinatorV2Address,
        subscriptionId,
        networkConfig[chainId]["gasLane"],
        networkConfig[chainId]["keepersUpdateInterval"],
        networkConfig[chainId]["raffleEntranceFee"],
        networkConfig[chainId]["callbackGasLimit"],
    ]
    log("Deploying Raffle Contract...")
    const raffle = await deploy("Raffle", {
        from: deployer,
        args: arguments,
        log: true,
        waitConfirmations: waitBlockConfirmations,
    })
    log("Raffle Deployed!")
    log("----------------------------------------------------------")

    // Verify the deployment
    if (
        !developmentChains.includes(network.name) &&
        process.env.ETHERSCAN_API_KEY
    ) {
        await verify(raffle.address, arguments)
    }


1 Answer 1

1

Please make sure when you verify you have supplied the deployed contract address and your constructor has the required arguments and run: yarn hardhat verify --network <NETWORK> <CONTRACT_ADDRESS> <CONSTRUCTOR_PARAMETERS>.

Ex: yarn hardhat verify --network goerli 0x9279791897f112a41FfDa267ff7DbBC46b96c296 "0x9326BFA02ADD2366b30bacB125260Af641031331"

See: https://github.com/smartcontractkit/hardhat-starter-kit/blob/main/README.md

1
  • the 'await verify(raffle.address, arguments)' line passes in my deployed contract address and the arguments variable is literally the same variable that I used to deploy the contract so the constructor args should be identical.
    – Rohan Nero
    Commented Sep 26, 2022 at 16:54

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.