From c7c8d36b698586aee98ec864043dcec0198d955b Mon Sep 17 00:00:00 2001 From: isabelle Date: Fri, 17 Nov 2023 18:18:54 +0900 Subject: [PATCH 1/3] update foundry verification for etherscan and mainnet --- .../developers/verifying-smart-contracts.mdx | 65 +++++++++++++++---- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/src/content/docs/en/developers/verifying-smart-contracts.mdx b/src/content/docs/en/developers/verifying-smart-contracts.mdx index 400d78f22..e3c4231c8 100644 --- a/src/content/docs/en/developers/verifying-smart-contracts.mdx +++ b/src/content/docs/en/developers/verifying-smart-contracts.mdx @@ -5,7 +5,7 @@ title: "Verifying Smart Contracts" lang: "en" permalink: "developers/verifying-smart-contracts" whatsnext: { "Scroll Contracts": "/developers/scroll-contracts" } -excerpt: "Easily verify your smart contracts with Scroll-supported developer tooling or the Blockscout Web API" +excerpt: "Easily verify your smart contracts with Scroll-supported developer tooling" --- import Aside from "../../../../components/Aside.astro" @@ -13,18 +13,21 @@ import ClickToZoom from "../../../../components/ClickToZoom.astro" import verify1 from "./_images/verify1.png" import CodeSample from "../../../../components/CodeSample/CodeSample.astro" -After deploying your smart contracts, it's important to verify your code on [our block explorer](https://scrollscan.com/) or the [Sepolia block explorer](https://sepolia-blockscout.scroll.io). +After deploying your smart contracts, it's important to verify your code on our block explorers. This can be done in an automated way using your developer tooling or the Web UI. -This can be done in an automated way using your developer tooling or using Blockscout's Web UI. - - */} ## Using Developer Tools -Most smart contract tooling has plugins for verifying your contracts easily on Etherscan. Blockscout supports Etherscan's contract verification APIs, and it's straightforward to use these tools with the Scroll Sepolia Testnet. +Most smart contract tooling has plugins for verifying your contracts easily on Etherscan. Blockscout supports Etherscan's contract verification APIs, so it's straightforward to use these tools using the APIs of either of these block explorers. + +| Network | Scroll Scroll | Sepolia | +| ---------- | -------------------------------- | ---------------------------------------- | +| Scrollscan | https://api.scrollscan.com/api | https://api-sepolia.scrollscan.com/api | +| Blockscout | https://blockscout.scroll.io/api | https://sepolia-blockscout.scroll.io/api | ### Hardhat @@ -82,18 +85,54 @@ npx hardhat verify --network scrollSepolia 0xD9880690bd717189cC3Fbe7B9020F27fae7 ### Foundry - */} -When using Foundry, the `verify-contract` helps automate the process of verifying contracts. +Specify the verification provider as `blockscout`. +##### Scroll ```bash -forge verify-contract : --chain-id 534351 --verifier-url https://sepolia-blockscout.scroll.io/api\? --verifier blockscout +forge verify-contract \ + --verifier-url https://blockscout.scroll.io/api\? \ + --verifier blockscout \ + --constructor-args +``` + +##### Scroll Sepolia +```bash +forge verify-contract \ + --verifier-url https://sepolia-blockscout.scroll.io/api\? \ + --verifier blockscout \ + --constructor-args ``` + Notice we add `\?` at the end of the verifier URL otherwise verification would fail. (Last tested on forge v0.2.0). + \ No newline at end of file From 017ae81152c3a34be7f5713dbd850955e844b2b1 Mon Sep 17 00:00:00 2001 From: isabelle Date: Fri, 17 Nov 2023 18:30:13 +0900 Subject: [PATCH 2/3] update hardhat instructions --- .../docs/en/developers/verifying-smart-contracts.mdx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/content/docs/en/developers/verifying-smart-contracts.mdx b/src/content/docs/en/developers/verifying-smart-contracts.mdx index e3c4231c8..b76b2d1b4 100644 --- a/src/content/docs/en/developers/verifying-smart-contracts.mdx +++ b/src/content/docs/en/developers/verifying-smart-contracts.mdx @@ -29,10 +29,15 @@ Most smart contract tooling has plugins for verifying your contracts easily on E | Scrollscan | https://api.scrollscan.com/api | https://api-sepolia.scrollscan.com/api | | Blockscout | https://blockscout.scroll.io/api | https://sepolia-blockscout.scroll.io/api | + + ### Hardhat -First, modify `hardhat.config.ts` to point to Scroll's RPC and `sepolia-blockscout.scroll.io/api`. A dummy `apiKey` value is required, but anything works for its value. +Modify `hardhat.config.ts` to point to Scroll's RPC and block explorer API. For Blockscout, a dummy `apiKey` value is required, but anything works for its value. For Scrollscan, use your own API key. +For example, if you are using Scroll Sepolia on Blockscout, your config will look like this: ```javascript ... @@ -95,8 +100,6 @@ Refer to the [Foundry documentation](https://book.getfoundry.sh/reference/forge/ #### Scrollscan -You will need to [register an account](https://scrollscan.com/register) to create an API key. The same key can be used for both Scroll Sepolia and mainnet. After creating your API key, please wait a few minutes before it comes into effect. - ```bash forge verify-contract \ --verifier-url https://api-sepolia.scrollscan.com/api \ From 111ec7667be3d225f6775f93a3d6d1ca7e5f8fde Mon Sep 17 00:00:00 2001 From: Daniel Helm Date: Fri, 17 Nov 2023 14:24:19 -0600 Subject: [PATCH 3/3] fix: nits --- .../en/developers/verifying-smart-contracts.mdx | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/content/docs/en/developers/verifying-smart-contracts.mdx b/src/content/docs/en/developers/verifying-smart-contracts.mdx index b76b2d1b4..be119ed8c 100644 --- a/src/content/docs/en/developers/verifying-smart-contracts.mdx +++ b/src/content/docs/en/developers/verifying-smart-contracts.mdx @@ -13,18 +13,13 @@ import ClickToZoom from "../../../../components/ClickToZoom.astro" import verify1 from "./_images/verify1.png" import CodeSample from "../../../../components/CodeSample/CodeSample.astro" -After deploying your smart contracts, it's important to verify your code on our block explorers. This can be done in an automated way using your developer tooling or the Web UI. - -{/* */} +After deploying your smart contracts, it's important to verify your code on a block explorer. This can be done in an automated way using your developer tooling or the Web UI. ## Using Developer Tools Most smart contract tooling has plugins for verifying your contracts easily on Etherscan. Blockscout supports Etherscan's contract verification APIs, so it's straightforward to use these tools using the APIs of either of these block explorers. -| Network | Scroll Scroll | Sepolia | +| Network | Scroll | Scroll Sepolia | | ---------- | -------------------------------- | ---------------------------------------- | | Scrollscan | https://api.scrollscan.com/api | https://api-sepolia.scrollscan.com/api | | Blockscout | https://blockscout.scroll.io/api | https://sepolia-blockscout.scroll.io/api | @@ -112,12 +107,6 @@ forge verify-contract \ #### Blockscout -{/* */} - Specify the verification provider as `blockscout`. ##### Scroll