foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Associate `chain` parameter with RPC url in scripts

Open gas1cent opened this issue 10 months ago • 0 comments

Component

Forge

Describe the feature you would like

Heyo! I'd like to be able to configure RPC urls and Etherscan API keys in the foundry.toml file and then execute forge scripts without having to pass these values as arguments. For example, given the following configuration:

[rpc_endpoints]
mainnet = '${MAINNET_RPC}'

[etherscan]
mainnet = { key = "${ETHERSCAN_MAINNET_KEY}" }

I'd like to run just:

forge script Deploy --broadcast --verify --chain mainnet

Note that no --rpc-url or --etherscan-key arguments are provided, and they're unnecessary because we already have the configuration in the foundry.toml file. Only chain is required in this case.

Would something like that be possible? Thanks!

Additional context

No response

gas1cent avatar Apr 19 '24 11:04 gas1cent