cast etherscan-source not respecting [etherscan] config
Closed this issue ยท 4 comments
Component
Cast
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.2.0 (805d7ce 2024-12-04T00:23:29.410361000Z)
What command(s) is the bug in?
cast etherscan-source
Operating System
macOS (Apple Silicon)
Describe the bug
In my foundry.toml i have a setup like:
[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY_MAINNET}", chain = 1 }
optimism = { key = "${ETHERSCAN_API_KEY_OPTIMISM}", chain = 10 }
avalanche = { key = "${ETHERSCAN_API_KEY_AVALANCHE}", chain = 43114 }
polygon = { key = "${ETHERSCAN_API_KEY_POLYGON}", chain = 137 }
arbitrum = { key = "${ETHERSCAN_API_KEY_ARBITRUM}", chain = 42161 }
fantom = { key = "${ETHERSCAN_API_KEY_FANTOM}", chain = 250 }
Which when running forge script ... --verify
is recognized and works appropriately.
When I run cast etherscan-source --chain alias|id
though, cast
will always try to use the ETHERSCAN_API_KEY
and does not consider the etherscan
setup in the toml. Therefore cast always fails with invalid api key as it's trying to use the wrong api key. As a fix one can manually supply the correct one via --etherscan-api-key, but that obviously is suboptimal.
I think this should be part of #4776 resolution @zerosnacks wdyt? also mind that cast doesn't have configs to read from
I think so as well, it should be covered by #4776
As stated, it is currently not expected behavior for cast
to read from the Foundry configuration file depending on where you run cast
from as it is meant to be a standalone utility.
Marking as won't fix
/ duplicate
, given the above
Added a note to #4776:
Note: cast will always try to use the ETHERSCAN_API_KEY, when compatibility is added this should not be the case
oh sorry i completely forgot i faced this before and didn't find on search :/
But yah, i guess also etherscan v2 support would help ๐