Module utils

Module utils 

Source
Expand description

Utility functions

Enumsยง

Numeric
Helper type to parse both u64 and U256

Functionsยง

deserialize_stringified_percent ๐Ÿ”’
Deserialize stringified percent. The value must be between 0 and 100 inclusive.
deserialize_u64_or_max ๐Ÿ”’
Deserialize a u64 or โ€œmaxโ€ for u64::MAX.
deserialize_u64_to_u256
Deserialize into U256 from either a u64 or a U256 hex string.
deserialize_usize_or_max ๐Ÿ”’
Deserialize a usize or โ€œmaxโ€ for usize::MAX.
evm_spec_id
Returns the [SpecId] derived from [EvmVersion]
find_git_root
Returns the path of the top-level directory of the working git tree.
find_project_root
Returns the root path to set for the project root.
foundry_toml_dirs
Returns a list of unique paths to all folders under root that contain a foundry.toml file
get_dir_remapping ๐Ÿ”’
Returns a remapping for the given dir
load_config
Loads the config for the current project workspace.
load_config_with_root
Loads the config for the current project workspace or the provided root path.
remappings_from_env_var
Returns the remappings from the given var
remappings_from_newline
Returns all [Remapping]s contained in the remappings str separated by newlines
serialize_u64_or_u256
Serialize U256 as u64 if it fits, otherwise as a hex string. If the number fits into a i64, serialize it as number without quotation marks. If the number fits into a u64, serialize it as a stringified number with quotation marks. Otherwise, serialize it as a hex string with quotation marks.
to_array_value
Converts the val into a figment::Value::Array