Skip to content

Commit 7435364

Browse files
Adds logic for forcing through verification when is verified check fails in backend
1 parent 0826378 commit 7435364

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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)