Skip to content

Commit

Permalink
Add view modifier to envOr
Browse files Browse the repository at this point in the history
  • Loading branch information
anikaraghu committed Jan 10, 2024
1 parent 68c3663 commit d55c90e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,14 +1061,14 @@ impl Backend {
}

let gas_price =
gas_price.map(|g| g).or(max_fee_per_gas.map(|g| g)).unwrap_or_else(|| self.gas_price());
gas_price.or(max_fee_per_gas).unwrap_or_else(|| self.gas_price());
let caller = from.unwrap_or_default();

env.tx = TxEnv {
caller: caller.to_alloy(),
gas_limit: gas_limit.as_u64(),
gas_price,
gas_priority_fee: max_priority_fee_per_gas.map(|f| f),
gas_priority_fee: max_priority_fee_per_gas,
transact_to: match to {
Some(addr) => TransactTo::Call(addr.to_alloy()),
None => TransactTo::Create(CreateScheme::Create),
Expand Down
56 changes: 28 additions & 28 deletions crates/cheatcodes/assets/cheatcodes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions crates/cheatcodes/spec/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,86 +895,86 @@ interface Vm {
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, bool defaultValue) external returns (bool value);
function envOr(string calldata name, bool defaultValue) external view returns (bool value);
/// Gets the environment variable `name` and parses it as `uint256`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, uint256 defaultValue) external returns (uint256 value);
function envOr(string calldata name, uint256 defaultValue) external view returns (uint256 value);
/// Gets the environment variable `name` and parses it as `int256`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, int256 defaultValue) external returns (int256 value);
function envOr(string calldata name, int256 defaultValue) external view returns (int256 value);
/// Gets the environment variable `name` and parses it as `address`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, address defaultValue) external returns (address value);
function envOr(string calldata name, address defaultValue) external view returns (address value);
/// Gets the environment variable `name` and parses it as `bytes32`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, bytes32 defaultValue) external returns (bytes32 value);
function envOr(string calldata name, bytes32 defaultValue) external view returns (bytes32 value);
/// Gets the environment variable `name` and parses it as `string`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, string calldata defaultValue) external returns (string memory value);
function envOr(string calldata name, string calldata defaultValue) external view returns (string memory value);
/// Gets the environment variable `name` and parses it as `bytes`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, bytes calldata defaultValue) external returns (bytes memory value);
function envOr(string calldata name, bytes calldata defaultValue) external view returns (bytes memory value);

/// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue)
external
external view
returns (bool[] memory value);
/// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue)
external
external view
returns (uint256[] memory value);
/// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue)
external
external view
returns (int256[] memory value);
/// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, string calldata delim, address[] calldata defaultValue)
external
external view
returns (address[] memory value);
/// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue)
external
external view
returns (bytes32[] memory value);
/// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, string calldata delim, string[] calldata defaultValue)
external
external view
returns (string[] memory value);
/// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`.
/// Reverts if the variable could not be parsed.
/// Returns `defaultValue` if the variable was not found.
#[cheatcode(group = Environment)]
function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue)
external
external view
returns (bytes[] memory value);

// ======== Scripts ========
Expand Down
Loading

0 comments on commit d55c90e

Please sign in to comment.