foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.29k stars 1.75k forks source link

feat(`config`): add `[labels]` section to `foundry.toml` #8843

Open yenchihliao opened 1 month ago

yenchihliao commented 1 month ago

Component

Other (please describe)

Describe the feature you would like

By giving alias to frequently interacted contracts in foundry.toml, say [labels], could facilitate development even more. Imagine this feature as a combination of two existing feature. The first is giving alias to rpc_endpoints by [rpc_endpoint] field in foundry.toml; the second is giving alias to addresses by vm.label in scripts and tests.

Being able to use the label in cast commands, say cast send -r eth MAINNET_CONTRACT_I_CARE ..., could already save some time copy and pasting. It also helps the readability.

A further step could be extending the configured labels to all the tests and scripts as if it's in function setup(), saving the time of repeatedly using of vm.label

Additional context

No response

DaniPopes commented 1 month ago

Related: https://github.com/foundry-rs/foundry/issues/8834#issuecomment-2340052279