Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds logic for forcing through verification when is verified check fails #5504

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
---

Makes force flag comprehensive enough to cover failing optional calls
alcuadrado marked this conversation as resolved.
Show resolved Hide resolved
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
Loading