-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: envWithDefault cheatcode initial implementation #3732 #3810
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful - pending CI fixes
evm/src/executor/abi/mod.rs
Outdated
@@ -41,6 +41,20 @@ ethers::contract::abigen!( | |||
envBytes32(string,string)(bytes32[]) | |||
envString(string,string)(string[]) | |||
envBytes(string,string)(bytes[]) | |||
envWithDefault(string,bool)(bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to suggest an alternative name here:
envOr
or even variants for all types like envStringOr
imo Default
is not really fitting here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with envOr
, just originally chose envWithDefault
cause it felt more explicit, though envOr
is more aligned with rust-like syntax
|
full send - thanks @slvDev |
Implementation of Issue #3732
That is my first PR to Foundry - please correct me if I got anything wrong.
Motivation
As noted by @vicnaum, there is a demand for non-reverting cheatcode for reading from Environment
Solution
Based on @mds1 suggestion: a new cheatcode was created named
vm.envWithDefault(string name, <defaultVal>)
, where type determines the type and encoding of the Environment Variable