Expand description
§foundry-cheatcodes
Foundry cheatcodes implementations.
Modules§
- spec
- Cheatcode specification for Foundry.
Structs§
- Broadcastable
Transaction - Helps collecting transactions from different forks.
- Cheatcode
Analysis - Provides cached, on-demand syntactic and semantic analysis of a completed
Compilerinstance. - Cheatcodes
- An EVM inspector that handles calls to various cheatcodes, each with their own behavior.
- Cheatcodes
Core - Cheatcode state that does not depend on the execution engine.
- Cheats
Config - Additional, configurable context the
Cheatcodesinspector has access to - Cheats
Ctxt - The cheatcode context.
- Error
- Error thrown by cheatcodes.
- Prank
- Prank information.
- Record
Access - Records storage slots reads and writes.
- Storage
Hook - A callback registered for a storage access hook.
- Wallets
- Cloneable wrapper around
WalletsInner. - Wallets
Inner - Contains context for wallet management.
Enums§
- Error
Kind - Kind of cheatcode errors.
- Expected
Call Type - The type of expected call.
- Forge
Context - Forge execution contexts.
Constants§
- DUMMY_
CREATE_ ADDRESS - Same reasoning as DUMMY_CALL_OUTPUT, but for creates.
Statics§
- DUMMY_
CALL_ OUTPUT - For some cheatcodes we may internally change the status of the call, i.e. in
expectRevert. Solidity will see a successful call and attempt to decode the return data. Therefore, we need to populate the return with dummy bytes so the decode doesn’t fail.
Traits§
- Cheatcode
Def - Cheatcode definition trait. Implemented by all
Vmfunctions. - Cheatcodes
Backend - Backend access of the cheatcode inspector while an execution runs.
- Cheatcodes
Executor - Runs nested executions on behalf of cheatcodes.
Functions§
- current_
execution_ context - Returns the current forge execution context, if it has been set.
- decode_
cheatcode_ call - Decodes a cheatcode call, reporting an unknown selector as a
Vminterface mismatch. - expect_
revert_ mismatch - Returns the error that a call reverting with
retdata, first failing inreverted_by, ends with when it does not meet avm.expectRevertofreasonfromreverter, orNonewhen it meets it. Withpartial_match, only the first 4 bytes ofreasonare compared. - message_
result - Returns the result of a message that did not execute, keeping its whole execution gas.
- parse_
value - Parses
sastylike thevm.parse*cheatcodes, with Forge’s lenient fallbacks and error message. - revert_
frame - Stops the running frame with a revert carrying
output, before its current instruction runs or after it ran. - set_
execution_ context - Set
forgecommand current execution context for the duration of the program. Execution context is immutable, subsequent calls of this function won’t change the context.
Type Aliases§
- Broadcastable
Transactions - List of transactions that can be broadcasted.
- Expected
Call Tracker - Tracks the expected calls per address.
- Result
- Cheatcode result type.