hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

hardhat-verify fails if called with constructor arguments but the contract doesn't have constructor arguments

Open schaable opened this issue 6 months ago • 0 comments

Feedback

When running hardhat-verify and passing constructor arguments for a contract that does not define any constructor parameters, the verification fails.

❯ npx hardhat verify 0x87C9f9FaeAEdc0aDDD1f13d12d74368Bcde07BF4 5 --network sepolia
An unexpected error occurred:

TypeError: Cannot read properties of undefined (reading 'type')
    at <anonymous> (/root/playground/verify/node_modules/@nomicfoundation/hardhat-verify/dist/src/internal/constructor-args.js:32:29)
    at Array.forEach (<anonymous>)
    at encodeConstructorArgs (/root/playground/verify/node_modules/@nomicfoundation/hardhat-verify/dist/src/internal/constructor-args.js:30:25)
    at async verifyContract (/root/playground/verify/node_modules/@nomicfoundation/hardhat-verify/src/internal/verification.ts:194:34)
    at async verifyEtherscanAction (/root/playground/verify/node_modules/@nomicfoundation/hardhat-verify/src/internal/tasks/verify/etherscan/task-action.ts:29:3)      
    at async Promise.all (index 0)
    at async main (/root/playground/verify/node_modules/hardhat/src/internal/cli/main.ts:196:5)

If you think this is a bug in Hardhat, please report it here: https://hardhat.org/report-bug

schaable avatar Jun 04 '25 15:06 schaable