Expand description
§foundry-common
Common utilities for building and using foundry’s tools.
Re-exports§
pub use io::Shell;
pub use io::shell;
pub use io::stdin;
pub use foundry_common_fmt as fmt;
pub use constants::*;
pub use contracts::*;
pub use traits::*;
pub use transactions::*;
Modules§
- abi
- ABI related helper functions.
- calc
- Commonly used calculations.
- comments
- compile
- Support for compiling [foundry_compilers::Project]
- constants
- Commonly used constants.
- contracts
- Commonly used contract types and functions.
- errors
- Commonly used errors
- fs
- Contains various
std::fs
wrapper functions that also contain the target path in their errors. - io
- Utilities for working with standard input, output, and error.
- iter
- mapping_
slots - preprocessor 🔒
- provider
- Provider-related instantiation and usage utilities.
- retry
- Retry utilities.
- selectors
- Support for handling/identifying selectors.
- serde_
helpers - Misc Serde helpers for foundry crates.
- slot_
identifier - Storage slot identification and decoding utilities for Solidity storage layouts.
- term
- terminal utils
- traits
- Commonly used traits.
- transactions
- Wrappers for transactions.
- utils 🔒
- Uncategorised utilities.
- version
- Foundry version information.
Macros§
- prompt
- Prints a message to
stdout
and reads a line from stdin into a String. - sh_
eprint - Prints a raw formatted message to stderr.
- sh_
eprintln - Prints a raw formatted message to stderr, with a trailing newline.
- sh_err
- Prints a formatted error to stderr.
- sh_
print - Prints a raw formatted message to stdout.
- sh_
println - Prints a raw formatted message to stdout, with a trailing newline.
- sh_warn
- Prints a formatted warning to stderr.
Functions§
- block_
on - Block on a future using the current tokio runtime on the current thread.
- block_
on_ handle - Block on a future using the current tokio runtime on the current thread with the given handle.
- erc7201
- Computes the storage slot as specified by
ERC-7201
, using theerc7201
formula ID. - find_
metadata_ start - Utility function to find the start of the metadata in the bytecode. This assumes that the metadata is at the end of the bytecode.
- flatten
- Flattens the given target of the project. Falls back to the old flattening implementation if the target cannot be compiled successfully. This would be the case if the target has invalid syntax. (e.g. Solang)
- ignore_
metadata_ hash - Utility function to ignore metadata hash of the given bytecode. This assumes that the metadata is at the end of the bytecode.
- strip_
bytecode_ placeholders - Strips all $xxx$ placeholders from the bytecode if it’s an unlinked bytecode. by replacing them with 20 zero bytes. This is useful for matching bytecodes to a contract source, and for the source map, in which the actual address of the placeholder isn’t important.