Skip to content

Commit 1f43da8

Browse files
authored
Merge pull request #5504 from 3commascapital/main
Adds logic for forcing through verification when is verified check fails
2 parents 0826378 + 2f8ec7b commit 1f43da8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changeset/fuzzy-eyes-collect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nomicfoundation/hardhat-verify": patch
3+
---
4+
5+
Make the `--force` flag override the check of any existing verification, even in the presence of errors.

packages/hardhat-verify/src/internal/tasks/etherscan.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
UnexpectedNumberOfFilesError,
2828
VerificationAPIUnexpectedMessageError,
2929
ContractAlreadyVerifiedError,
30+
NetworkRequestError,
3031
} from "../errors";
3132
import { Etherscan } from "../etherscan";
3233
import { Bytecode } from "../solc/bytecode";
@@ -102,7 +103,15 @@ subtask(TASK_VERIFY_ETHERSCAN)
102103
chainConfig
103104
);
104105

105-
const isVerified = await etherscan.isVerified(address);
106+
let isVerified = false;
107+
try {
108+
isVerified = await etherscan.isVerified(address);
109+
} catch (err) {
110+
if (!force || err instanceof NetworkRequestError) {
111+
throw err;
112+
}
113+
// https://github.com/blockscout/blockscout/issues/9001
114+
}
106115
if (!force && isVerified) {
107116
const contractURL = etherscan.getContractUrl(address);
108117
console.log(`The contract ${address} has already been verified on the block explorer. If you're trying to verify a partially verified contract, please use the --force flag.

0 commit comments

Comments
 (0)