Enforce contract verification
Description
On contract verification, blockscout differentiates source codes on partial and full matches. In case of partially verified contracts re-verification of such contracts is allowed. But it is not possible to re-verify such contracts via Hardhat rn, as it always returns "The contract {contract_address} has already been verified on Etherscan."
Suggestion
We suggest to add a new flag on verify:verify subtask - --skip-is-verified-check. That should disable the if(isVerified) condition to prevent verification attempt.
A kind of similar approach has been adopted by foundry - https://github.com/foundry-rs/foundry/pull/6461.
I may try to create a PR with corresponding changes. Just would like to ensure that you are fine with suggested approach.
Minimal Reproducible Steps
- Create a new template project and update
Lock.solcontract to have a contract namedModifiedMetadataHashLock. - config hardhat network:
const config: HardhatUserConfig = {
solidity: "0.8.24",
networks: {
sepolia: {
url: 'https://endpoints.omniatech.io/v1/eth/sepolia/public',
accounts: [PRIVATE_KEY],
},
},
etherscan: {
apiKey: 'ETHERSCAN_API_KEY',
customChains: [
{
network: "sepolia",
chainId: 11155111,
urls: {
apiURL: "https://eth-sepolia.blockscout.com/api",
browserURL: "https://eth-sepolia.blockscout.com/",
// apiURL: "https://api-sepolia.etherscan.io/api",
// browserURL: "https://sepolia.etherscan.io/",
}
}
]
}
};
npx hardhat verify 0xcA30DBB0Cb79cef0194f6e212B49fa1EB7246b61 --network sepolia 123- Output (even though the contract has been verified only partially and can be re-verified):
The contract 0xcA30DBB0Cb79cef0194f6e212B49fa1EB7246b61 has already been verified on Etherscan.
https://eth-sepolia.blockscout.com/address/0xcA30DBB0Cb79cef0194f6e212B49fa1EB7246b61#code
Search terms
No response
This is a feature we want to see, though we would suggest --force instead of --skip-is-verified-check as the flag.