foundry-rs/foundry

foundry config error: invalid type: found string "ETHERSCAN_API_KEY", expected struct EtherscanConfig for setting `etherscan.api_key`

Closed this issue · 1 comments

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (a79dfae 2024-11-16T00:21:53.964085000Z)

What command(s) is the bug in?

forge verify

Operating System

macOS (Apple Silicon)

Describe the bug

[etherscan]
api_key = "ETHERSCAN_API_KEY"

The writing style seems correct, but there might be an error in recognition, and I'm not sure why.

Hi @t-o-wayn3

See: https://book.getfoundry.sh/reference/config/etherscan#etherscan

The correct format for the [etherscan] block is as follows:

[etherscan]
mainnet = { key = "${ETHERSCAN_MAINNET_KEY}" }
mainnet2 = { key = "ABCDEFG", chain = "mainnet" }
optimism = { key = "1234567" }
unknown_chain = { key = "ABCDEFG", url = "<etherscan api url for this chain>" }