hardhat-deploy: etherscan-verify cannot verify a contract while hardhat-etherscan can
Describe the bug
The etherscan-verify task fails with or without the --solc-input flag but using hardhat verify address args with the address and args found in the deployments/rinkeby does work.
To Reproduce
Contract is here: https://rinkeby.etherscan.io/address/0x6FA9f768110182eebB4fD086074C5b460BFE103E
This is the error message:
verifying DreamersRenderer (0x6FA9f768110182eebB4fD086074C5b460BFE103E) ...
waiting for result...
Failed to verify contract DreamersRenderer: NOTOK, Fail - Unable to verify
{
"apikey": "XXXXXX",
"module": "contract",
"action": "verifysourcecode",
"contractaddress": "0x6FA9f768110182eebB4fD086074C5b460BFE103E",
"sourceCode": "...",
"codeformat": "solidity-standard-json-input",
"contractname": "contracts/dreamers/DreamersRenderer.sol:DreamersRenderer",
"compilerversion": "v0.8.4+commit.c7e474f2",
"constructorArguements": "00000000000000000000000079cfaa14901045e4564a5dadb34de81dc9efb871000000000000000000000000651534a85763beb8b6d04b86c96be724a2d3b8cf",
"licenseType": 3
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying DreamersRenderer (0x6FA9f768110182eebB4fD086074C5b460BFE103E) ...
waiting for result...
Failed to verify contract DreamersRenderer: NOTOK, Fail - Unable to verify
{
"apikey": "XXXXXX",
"module": "contract",
"action": "verifysourcecode",
"contractaddress": "0x6FA9f768110182eebB4fD086074C5b460BFE103E",
"sourceCode": "...",
"codeformat": "solidity-standard-json-input",
"contractname": "contracts/dreamers/DreamersRenderer.sol:DreamersRenderer",
"compilerversion": "v0.8.4+commit.c7e474f2",
"constructorArguements": "00000000000000000000000079cfaa14901045e4564a5dadb34de81dc9efb871000000000000000000000000651534a85763beb8b6d04b86c96be724a2d3b8cf",
"licenseType": 3
}
Etherscan sometime fails to verify when only metadata sources are given. See https://github.com/ethereum/solidity/issues/9573. You can add the option --solc-input to try with full solc-input sources. This will include all contract source in the etherscan result, even the one not relevant to the contract being verified
Using hardhat-etherscan I am able to verify:
npx hardhat --network rinkeby verify 0x6FA9f768110182eebB4fD086074C5b460BFE103E 0x79cfaa14901045e4564A5DAdb34DE81dC9efB871 0x651534a85763beB8b6D04b86C96BE724a2D3b8cf
Nothing to compile
No need to generate any newer typings.
Compiling 1 file with 0.8.4
Successfully submitted source code for contract
contracts/dreamers/DreamersRenderer.sol:DreamersRenderer at 0x6FA9f768110182eebB4fD086074C5b460BFE103E
for verification on Etherscan. Waiting for verification result...
Successfully verified contract DreamersRenderer on Etherscan.
https://rinkeby.etherscan.io/address/0x6FA9f768110182eebB4fD086074C5b460BFE103E#code
versions hardhat-deploy [e.g. 0.9.14] : 0.9.24 hardhat : 2.8.0 nodejs : v17.3.0 @nomiclabs/hardhat-etherscan : 2.1.8
Additional context
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 16 (2 by maintainers)
The verification is working when setting the optimizer runs to a lower number. Thanks!
Please find attached the file used when verifying the contract Bank:
032b0ad4389193ad4474f59592602137.txt