Skip to content

Commit

Permalink
Merge pull request #4513 from NomicFoundation/hardhat-verify-add-sour…
Browse files Browse the repository at this point in the history
…cify-boilerplate

Add basic support for verification on Sourcify
  • Loading branch information
fvictorio authored Oct 24, 2023
2 parents 114171e + c3368da commit 15642ce
Show file tree
Hide file tree
Showing 25 changed files with 1,683 additions and 658 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-gorillas-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/hardhat-verify": major
---

- Added Sourcify as a verification provider.
41 changes: 26 additions & 15 deletions packages/hardhat-verify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@

[Hardhat](https://hardhat.org) plugin to verify the source of code of deployed contracts.

1. [What](#what)
2. [Installation](#installation)
3. [Tasks](#tasks)
4. [Environment extensions](#environment-extensions)
5. [Usage](#usage)
1. [Complex arguments](#complex-arguments)
2. [Libraries with undetectable addresses](#libraries-with-undetectable-addresses)
3. [Multiple API keys and alternative block explorers](#multiple-api-keys-and-alternative-block-explorers)
4. [Adding support for other networks](#adding-support-for-other-networks)
5. [Using programmatically](#using-programmatically)
1. [Providing libraries from a script or task](#providing-libraries-from-a-script-or-task)
2. [Advanced Usage: Using the Etherscan class from another plugin](#advanced-usage-using-the-etherscan-class-from-another-plugin)
6. [How it works](#how-it-works)
7. [Known limitations](#known-limitations)

## What

This plugin helps you verify the source code for your Solidity contracts. At the moment, it supports [Etherscan](https://etherscan.io)-based explorers and explorers compatible with its API like [Blockscout](https://www.blockscout.com/).
Expand Down Expand Up @@ -189,6 +174,32 @@ Keep in mind that the name you are giving to the network in `customChains` is th

To see which custom chains are supported, run `npx hardhat verify --list-networks`.

### Verifying on Sourcify

To verify a contract using Sourcify, you need to add to your Hardhat config:

```js
sourcify: {
enabled: true,
}
```

and then run the `verify` task, passing the address of the contract and the network where it's deployed:

```bash
npx hardhat verify --network mainnet DEPLOYED_CONTRACT_ADDRESS
```

**Note:** Constructor arguments are not required for Sourcify verification, but you'll need to provide them if you also have Etherscan verification enabled.

To disable Sourcify verification and suppress related messages, set `enabled` to `false`:

```js
sourcify: {
enabled: false,
}
```

### Using programmatically

To call the verification task from within a Hardhat task or script, use the `"verify:verify"` subtask. Assuming the same contract as [above](#complex-arguments), you can run the subtask like this:
Expand Down
Loading

0 comments on commit 15642ce

Please sign in to comment.