Skip to main content

Crate foundry_cheatcodes

Crate foundry_cheatcodes 

Source
Expand description

Β§foundry-cheatcodes

Foundry cheatcodes implementations.

Re-exportsΒ§

pub extern crate foundry_cheatcodes_spec as spec;

Re-exportsΒ§

pub(crate) use Address; πŸ”’
pub(crate) use B256; πŸ”’
pub(crate) use U256; πŸ”’
pub(crate) use evm2::interpreter::GasTracker; πŸ”’
pub(crate) use Backend; πŸ”’
pub(crate) use CowBackend; πŸ”’
pub(crate) use LocalForkId; πŸ”’
pub(crate) use BlockEnvFor; πŸ”’
pub(crate) use EvmEnvFor; πŸ”’
pub(crate) use EvmFactoryFor; πŸ”’
pub(crate) use FoundryEvmFactory; πŸ”’
pub(crate) use FoundryEvmFor; πŸ”’
pub(crate) use FoundryEvmNetwork; πŸ”’
pub(crate) use SpecFor; πŸ”’
pub(crate) use evm_env; πŸ”’
pub(crate) use fork::CreateFork; πŸ”’

ModulesΒ§

Vm
Foundry cheatcodes interface.
base64 πŸ”’
config πŸ”’
crypto πŸ”’
Implementations of Crypto Cheatcodes.
env πŸ”’
Implementations of Environment cheatcodes.
error πŸ”’
evm πŸ”’
Implementations of Evm cheatcodes.
expected_emit πŸ”’
Engine-free matching for the expectEmit cheatcodes.
external_storage πŸ”’
Storage layouts for contracts that aren’t part of the local project.
fs πŸ”’
Implementations of Filesystem cheatcodes.
inspector πŸ”’
Cheatcode EVM inspector.
json πŸ”’
Implementations of Json cheatcodes.
monad πŸ”’ monad
Monad staking cheatcodes.
script πŸ”’
Implementations of Scripting cheatcodes.
state πŸ”’
Cheatcode state shared by both execution engines.
string πŸ”’
Implementations of String cheatcodes.
tempo πŸ”’
Cheatcodes that delegate to the imported Tempo precompile crates.
test πŸ”’
Implementations of Testing cheatcodes.
toml πŸ”’
Implementations of Toml cheatcodes.
utils πŸ”’
Implementations of Utilities cheatcodes.
version πŸ”’

StructsΒ§

BroadcastableTransaction
Helps collecting transactions from different forks.
CheatcodeAnalysis
Provides cached, on-demand syntactic and semantic analysis of a completed Compiler instance.
Cheatcodes
An EVM inspector that handles calls to various cheatcodes, each with their own behavior.
CheatcodesCore
Cheatcode state that does not depend on the execution engine.
CheatsConfig
Additional, configurable context the Cheatcodes inspector has access to
CheatsCtxt
The cheatcode context.
Error
Error thrown by cheatcodes.
Prank
Prank information.
RecordAccess
Records storage slots reads and writes.
StorageHook
A callback registered for a storage access hook.
Wallets
Cloneable wrapper around WalletsInner.
WalletsInner
Contains context for wallet management.

EnumsΒ§

ErrorKind
Kind of cheatcode errors.
ExpectedCallType
The type of expected call.
ForgeContext
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 πŸ”’
Cheatcode implementation.
CheatcodeDef
Cheatcode definition trait. Implemented by all Vm functions.
CheatcodesBackend
Backend access of the cheatcode inspector while an execution runs.
CheatcodesExecutor
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 Vm interface mismatch.
expect_revert_mismatch
Returns the error that a call reverting with retdata, first failing in reverted_by, ends with when it does not meet a vm.expectRevert of reason from reverter, or None when it meets it. With partial_match, only the first 4 bytes of reason are compared.
message_result
Returns the result of a message that did not execute, keeping its whole execution gas.
parse_value
Parses s as ty like the vm.parse* cheatcodes, with Forge’s lenient fallbacks and error message.
precompile_error πŸ”’
revert_frame
Stops the running frame with a revert carrying output, before its current instruction runs or after it ran.
set_execution_context
Set forge command 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Β§

BroadcastableTransactions
List of transactions that can be broadcasted.
ExpectedCallTracker
Tracks the expected calls per address.
Result
Cheatcode result type.