Skip to content

Commit

Permalink
Merge pull request #5504 from 3commascapital/main
Browse files Browse the repository at this point in the history
Adds logic for forcing through verification when is verified check fails
  • Loading branch information
alcuadrado authored Jul 10, 2024
2 parents 0826378 + 2f8ec7b commit 1f43da8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-eyes-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/hardhat-verify": patch
---

Make the `--force` flag override the check of any existing verification, even in the presence of errors.
11 changes: 10 additions & 1 deletion packages/hardhat-verify/src/internal/tasks/etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
UnexpectedNumberOfFilesError,
VerificationAPIUnexpectedMessageError,
ContractAlreadyVerifiedError,
NetworkRequestError,
} from "../errors";
import { Etherscan } from "../etherscan";
import { Bytecode } from "../solc/bytecode";
Expand Down Expand Up @@ -102,7 +103,15 @@ subtask(TASK_VERIFY_ETHERSCAN)
chainConfig
);

const isVerified = await etherscan.isVerified(address);
let isVerified = false;
try {
isVerified = await etherscan.isVerified(address);
} catch (err) {
if (!force || err instanceof NetworkRequestError) {
throw err;
}
// https://github.com/blockscout/blockscout/issues/9001
}
if (!force && isVerified) {
const contractURL = etherscan.getContractUrl(address);
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.
Expand Down

0 comments on commit 1f43da8

Please sign in to comment.