diff --git a/contracts/README.md b/contracts/README.md index d158c996..4dc07d66 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -12,6 +12,46 @@ The genesis builder (`contracts/scripts/ArtifactHelper.s.sol`), all CREATE2-sens tests (`tests/localdev/genesis.test.ts`) all read from `contracts/out/forge/`. Hardhat's compile output is **not** consumed for any CREATE2-sensitive path. +## Verifying contracts on Arcscan + +Arc Testnet's explorer ([testnet.arcscan.app](https://testnet.arcscan.app)) exposes an +**Etherscan-compatible** contract verification API at `https://testnet.arcscan.app/api`. +Blockscout-native field names (`addressHash`, `name`, `contractSourceCode`, …) are **not** +accepted and return a misleading `Missing codeformat field` error even when `codeformat` is +present — that is the failure mode reported in #210. Use Etherscan V1 field names +(`contractaddress`, `contractname`, `sourceCode`, `codeformat`, …) or a tool that already +speaks that dialect. + +### Foundry + +Arcscan ignores the API key value but Foundry still requires a non-empty key: + +```bash +export ARC_TESTNET_RPC_URL=https://rpc.testnet.arc.io +forge verify-contract
path/to/Contract.sol:ContractName \ + --chain 5042002 \ + --verifier custom \ + --verifier-url https://testnet.arcscan.app/api \ + --verifier-api-key empty \ + --watch +``` + +Pass constructor args with `--constructor-args` / `--constructor-args-path` when needed. +`foundry.toml` also registers an `arc_testnet` Etherscan entry so `--chain arc-testnet` (or `5042002`) works +once `ETHERSCAN_API_KEY` (any non-empty string) is set. + +### Hardhat + +```bash +export ARC_TESTNET_RPC_URL=https://rpc.testnet.arc.io +npx hardhat verify --network testnet [constructorArgs...] +``` + +This requires `@nomicfoundation/hardhat-verify` with an Arc Testnet `customChains` / +`etherscan` entry for chain ID `5042002` pointing at `https://testnet.arcscan.app/api` +(see open wiring in related PRs if it is not yet on `main`). Disable Sourcify so it does not +race Arcscan. + ## Foundry **Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** diff --git a/foundry.toml b/foundry.toml index 7c82ac71..8b6fa1a8 100644 --- a/foundry.toml +++ b/foundry.toml @@ -30,3 +30,8 @@ fs_permissions = [ [lint] ignore = ["contracts/test/scripts/*.t.sol"] # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options + +# Arcscan is Blockscout-backed but speaks the Etherscan V1 verify API (see #210). +# A non-empty key is required by Foundry; Arcscan ignores the value. +[etherscan] +arc_testnet = { key = "${ETHERSCAN_API_KEY}", chain = 5042002, url = "https://testnet.arcscan.app/api" }