ethereumsoliditysmartcontractshardhatetherscan

'Unrecognized task verify' while verifying smart contract


verify task not found in hardhat pre-defined tasks in hardhat package.

Error HH303: Unrecognized task verify

HardhatError: HH303: Unrecognized task verify
    at main (/home/oem/Documents/final-rain-sdk/rain-sdk/node_modules/hardhat/src/internal/cli/cli.ts:226:15)

hardhat.config.ts $ the command i ran: npx hardhat verify --network eth 0x5f140EA4e08D1aF9F41fA4cf935FC7a98EF4FfF8 --show-stack-traces

I tried to verify using task with

     await hre.run("verify:verify", {
       address: "0x5f140EA4e08D1aF9F41fA4cf935FC7a98EF4FfF8",
       contract: "contracts/stake/StakeFactory.sol:StakeFactory",
       constructorArguments: [],
     });

I tried using the cli as well. nothing works. while all the env variables are attaching correctly in the config file


Solution

  • Ok, resolved it at my end the thing is, I imported @nomiclabs/hardhat-etherscan in hardhat.config and the task in created in my deploy.ts file. So you need to import @nomiclabs/hardhat-etherscan plugin into your deploy.ts file where the verify task is created.