Skip to content

Commit dd3fd1e

Browse files
authored
Merge pull request #2409 from nijoe1/main
Restructure smart contract verification documentation
2 parents 4aaa801 + 7afcf3f commit dd3fd1e

13 files changed

+678
-286
lines changed
234 KB
Loading
161 KB
Loading
231 KB
Loading

SUMMARY.md

Lines changed: 190 additions & 184 deletions
Large diffs are not rendered by default.

smart-contracts/developing-contracts/foundry.md

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ The template repository contains submodules and remappings for ds-test assertion
1313

1414
You must have the following installed:
1515

16-
* [Git](https://git-scm.com/)
17-
* [Yarn](https://yarnpkg.com/)
16+
- [Git](https://git-scm.com/)
17+
- [Yarn](https://yarnpkg.com/)
1818

1919
You should also have an address on the Filecoin Calibration testnet. See the [MetaMask setup page](../../basics/assets/metamask-setup.md) for information on how to get an address. You also need test `tFIL` in your wallet.
2020

2121
## Steps
2222

23-
1. Clone the `xBalbinus/fevm-foundry-kit` repository and move into the `fevm-foundry-kit` directory:
23+
1. Clone the `filecoin-project/fevm-foundry-kit` repository and move into the `fevm-foundry-kit` directory:
2424

2525
```
26-
git clone https://github.com/xBalbinus/fevm-foundry-kit/tree/main.git
26+
git clone https://github.com/filecoin-project/fevm-foundry-kit/tree/main.git
2727
cd fevm-foundry-kit
2828
```
2929

@@ -34,37 +34,29 @@ yarn install
3434
```
3535

3636
3. Export your private key from MetaMask. See the [MetaMask documentation](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key) to find out how to export your private key.
37-
4. In your `.env.example`, create an environment variable called `PRIVATE_KEY` and paste in the private key from MetaMask. Also, do the same for the `HYPERSPACE_RPC_URL`. Then rename the file to `.env`:
37+
38+
4. Create your env file by running
3839

3940
```
40-
PRIVATE_KEY=eed8e9d727a647f7302bab440d405ea87d36726e7d9f233ab3ff88036cfbce9c
41-
HYPERSPACE_RPC_URL=https://api.calibration.node.glif.io/rpc/v1
41+
cp .env.example .env
4242
```
4343

44-
5. Inside the `src` folder in a contract called `SimpleCoin.sol`. Deploy this contract using Foundry:
45-
46-
```shell
47-
forge build
48-
forge script script/SimpleCoin.s.sol:MyScript --rpc-url https://api.calibration.node.glif.io/rpc/v1 --broadcast --verify -vvvv
44+
5. In your newly created`.env` replace `PRIVATE_KEY` with the one gathered from MetaMask. Also, do the same for the `CALIBRATIONNET_RPC_URL`.:
4945

50-
# ...
51-
#
52-
# Script ran successfully.
53-
# Gas used: 234642
46+
```bash
47+
PRIVATE_KEY=eed8e9d727a647f7302bab440d405ea87d36726e7d9f233ab3ff88036cfbce9c
48+
CALIBRATIONNET_RPC_URL=https://api.calibration.node.glif.io/rpc/v1
5449
```
5550

56-
6. Alternatively, you can do the same using the `forge create` command:
51+
6. Inside the `src` folder in a contract called `SimpleCoin.sol`. Deploy this contract using Foundry:
5752

58-
```
53+
```shell
5954
forge build
60-
61-
forge create --rpc-url https://api.calibration.node.glif.io/rpc/v1 --private-key $PRIVATE_KEY src/SimpleCoin.sol:SimpleCoin
55+
forge create --rpc-url https://api.calibration.node.glif.io/rpc/v1 --private-key $PRIVATE_KEY src/SimpleCoin.sol:SimpleCoin --broadcast
6256
```
6357

6458
7. You can now interact with your contract using the contract address given by Foundry.
6559

6660
Done! For more information, see the [Foundry book](https://book.getfoundry.sh/).
6761

68-
69-
70-
[Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill\_Page+URL=https://docs.filecoin.io/smart-contracts/developing-contracts/foundry)
62+
[Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/smart-contracts/developing-contracts/foundry)

smart-contracts/developing-contracts/verify-a-contract.md

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
description: >-
3+
This section provides comprehensive guides for verifying smart contracts
4+
on the Filecoin network using various tools and methods.
5+
---
6+
7+
# Contract Verification
8+
9+
Contract verification is essential for transparency and trust in the Filecoin ecosystem. It allows users to inspect the source code of deployed contracts and ensures they function as intended.
10+
11+
## Available Verification Tools
12+
13+
The following FEVM-compatible chain explorers offer contract verification capabilities:
14+
15+
- [Blockscout](https://filecoin.blockscout.com/contract-verification) - Multi-chain explorer with advanced verification options
16+
- [Filfox](https://filfox.info/en/contract) - Native Filecoin explorer with comprehensive verification features
17+
- [Starboard](https://fvm.starboard.ventures/explorer/verifier) - FVM-focused verification platform
18+
- [Beryx](https://beryx.zondax.ch/contract_verifier) - Developer-friendly verification interface
19+
- [Sourcify](https://docs.sourcify.dev/docs/how-to-verify/) - Multi-chain contract repository with verification tools
20+
21+
## Verification Methods
22+
23+
There are two primary approaches to verify your smart contracts:
24+
25+
### Programmatic Verification
26+
27+
Automate contract verification directly from your development environment:
28+
29+
- [Hardhat verification guide](/smart-contracts/developing-contracts/verify-a-contract/programmatic/hardhat.md)
30+
- [Foundry verification guide](/smart-contracts/developing-contracts/verify-a-contract/programmatic/foundry.md)
31+
32+
### Web Interface Verification
33+
34+
Verify contracts through explorer user interfaces:
35+
36+
- [Blockscout web interface guide](/smart-contracts/developing-contracts/verify-a-contract/web-interface/blockscout.md)
37+
- [Filfox web interface guide](/smart-contracts/developing-contracts/verify-a-contract/web-interface/filfox.md)
38+
39+
[Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/smart-contracts/developing-contracts/verify-a-contract)
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
description: >-
3+
Learn how to verify smart contracts on the Filecoin network using Foundry
4+
with various verification services including Blockscout, Sourcify, and Filfox.
5+
---
6+
7+
# Contract Verification with Foundry
8+
9+
This guide shows you how to verify your smart contracts using Foundry on the Filecoin network.
10+
11+
## Prerequisites
12+
13+
- A Foundry project set up for Filecoin development
14+
- If you don't have a Foundry project, check out the [FEVM Foundry Kit](/smart-contracts/developing-contracts/foundry.md)
15+
- A deployed contract address
16+
- Contract constructor arguments (if any)
17+
18+
## Verification Methods
19+
20+
### Blockscout Verification
21+
22+
Blockscout is a popular blockchain explorer that supports contract verification.
23+
24+
**Verify on Calibration Testnet:**
25+
26+
```bash
27+
forge verify-contract \
28+
--verifier blockscout \
29+
--verifier-url 'https://filecoin-testnet.blockscout.com/api/' \
30+
--force \
31+
--skip-is-verified-check \
32+
0xYourContractAddress \
33+
src/MyContract.sol:MyContract
34+
```
35+
36+
**Verify on Filecoin Mainnet:**
37+
38+
```bash
39+
forge verify-contract \
40+
--verifier blockscout \
41+
--verifier-url 'https://filecoin.blockscout.com/api/' \
42+
--force \
43+
--skip-is-verified-check \
44+
0xYourContractAddress \
45+
src/MyContract.sol:MyContract
46+
```
47+
48+
### Sourcify Verification
49+
50+
Sourceify provides decentralized contract verification.
51+
52+
**Verify on Filecoin Mainnet:**
53+
54+
```bash
55+
forge verify-contract 0xYourContractAddress \
56+
src/MyToken.sol:MyToken \
57+
--chain-id 314 \
58+
--verifier sourcify \
59+
--verifier-url https://sourcify.dev/server/ \
60+
--guess-constructor-args
61+
```
62+
63+
**Verify on Calibration Testnet:**
64+
65+
```bash
66+
forge verify-contract 0xYourContractAddress \
67+
src/MyToken.sol:MyToken \
68+
--chain-id 314159 \
69+
--verifier sourcify \
70+
--verifier-url https://sourcify.dev/server/ \
71+
--guess-constructor-args
72+
```
73+
74+
For more information, see the [Sourcify documentation](https://docs.sourcify.dev/docs/how-to-verify/).
75+
76+
### Filfox Verification
77+
78+
Filfox is the native Filecoin explorer with dedicated verification support.
79+
80+
**Installation:**
81+
82+
```bash
83+
npm install -g @fil-b/filfox-verifier
84+
```
85+
86+
**Usage:**
87+
88+
```bash
89+
filfox-verifier forge <address> <contract-path> --chain <chainId>
90+
```
91+
92+
**Examples:**
93+
94+
```bash
95+
# Verify on Filecoin Mainnet
96+
filfox-verifier forge 0xYourContractAddress src/MyContract.sol:MyContract --chain 314
97+
98+
# Verify on Calibration Testnet
99+
filfox-verifier forge 0xYourContractAddress src/MyContract.sol:MyContract --chain 314159
100+
```
101+
102+
For detailed information, see the [@fil-b/filfox-verifier documentation](https://www.npmjs.com/package/@fil-b/filfox-verifier).
103+
104+
[Was this page helpful?](https://airtable.com/apppq4inOe4gmSSlk/pagoZHC2i1iqgphgl/form?prefill_Page+URL=https://docs.filecoin.io/smart-contracts/developing-contracts/verify-a-contract/programmatic/foundry)

0 commit comments

Comments
 (0)