Foundry cheatcodes definitions and implementations.
assets/
: JSON interface and specificationspec/
: Defines common traits and structssrc/
: Rust implementations of the cheatcodes
All cheatcodes are defined in a single sol!
macro call in spec/src/vm.rs
.
This, combined with the use of an internal Cheatcode
derive macro,
allows us to generate both the Rust definitions and the JSON specification of the cheatcodes.
Cheatcodes are manually implemented through the Cheatcode
trait, which is called in the
Cheatcodes
inspector implementation.
See the cheatcodes dev documentation for more details.
The JSON interface is guaranteed to be stable, and can be used by third-party tools to interact with the Foundry cheatcodes externally.
For example, here are some tools that make use of the JSON interface:
- Internally, this is used to generate a simple Solidity interface for testing
- (WIP) Used by
forge-std
to generate user-friendly Solidity interfaces - (WIP) Used by the Foundry book to generate the cheatcodes reference
- ...
If you are making use of the JSON interface, please don't hesitate to open a PR to add your project to this list!
Please see the cheatcodes dev documentation on how to add new cheatcodes.