Skip to content

Commit 11043e9

Browse files
committed
Add support for programmatic verification in Sourcify
1 parent b626dc1 commit 11043e9

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.changeset/twelve-mails-heal.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nomicfoundation/hardhat-verify": patch
3+
---
4+
5+
Added support for programmatic verification in Sourcify

packages/hardhat-verify/src/index.ts

+17-7
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ subtask(TASK_VERIFY_VERIFY)
271271
.setAction(
272272
async (
273273
{ address, constructorArguments, libraries, contract }: VerifySubtaskArgs,
274-
{ run }
274+
{ run, config }
275275
) => {
276276
// This can only happen if the subtask is invoked from within Hardhat by a user script or another task.
277277
if (!Array.isArray(constructorArguments)) {
@@ -282,11 +282,21 @@ subtask(TASK_VERIFY_VERIFY)
282282
throw new InvalidLibrariesError();
283283
}
284284

285-
await run(TASK_VERIFY_ETHERSCAN, {
286-
address,
287-
constructorArgsParams: constructorArguments,
288-
libraries,
289-
contract,
290-
});
285+
if (config.etherscan.enabled) {
286+
await run(TASK_VERIFY_ETHERSCAN, {
287+
address,
288+
constructorArgsParams: constructorArguments,
289+
libraries,
290+
contract,
291+
});
292+
}
293+
294+
if (config.sourcify.enabled) {
295+
await run(TASK_VERIFY_SOURCIFY, {
296+
address,
297+
libraries,
298+
contract,
299+
});
300+
}
291301
}
292302
);

0 commit comments

Comments
 (0)