foundry: Error verifying contract on arb sepolia

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

0.2.0

What command(s) is the bug in?

forge verify-contract

Operating System

macOS (Apple Silicon)

Describe the bug

I cannot verify contract that has been deployed on arbitrum sepolia. I have tried using the cli arg and the environment variable for the etherscan api key.

I think it may have something to do with foundry not having the chain config for arbitrum sepolia yet which is now on the master branch of ethers-rs after my PR was merged yesterday


forge verify-contract --etherscan-api-key xxx --chain-id 421614 0x8d4CCBaa194ED721AC3e231a1A3863966c2D7921 Simple1271AccountFactory
Start verifying contract `0x8d4CCBaa194ED721AC3e231a1A3863966c2D7921` deployed on 421614
Error:
ETHERSCAN_API_KEY must be set. 

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Command that worked for me forge 0.3.0 (5a8bd89 2024-12-20T08:46:21.555250780Z):

forge verify-contract \
  --etherscan-api-key API_KEY \
  --watch \
  --chain-id 421614 \
  --verifier-url https://api-sepolia.arbiscan.io/api \
  --constructor-args $(cast abi-encode "constructor(address,address)" 0x549Ebba8036Ab746611B4fFA1423eb0A4Df61440 0x6CC14824Ea2918f5De5C2f75A9Da968ad4BD6344) \
  CONTRACT_ADDRESS \
  src/Contract.sol:Contract

Notes:

  • --etherscan-api-key is generated by an account on mainnet arbitrum: https://arbiscan.io/myapikey
  • --constructor-args if you deployed contract with constructor args you have to provide them as well

Actually I installed the wrong one. The error is gone now in nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe (1 hour ago) https://github.com/foundry-rs/foundry/releases/tag/nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe

Still some more testing to do but this is good progress. Thanks!