foundry_cheatcodes::inspector

Trait CheatcodesExecutor

Source
pub trait CheatcodesExecutor {
    // Required method
    fn get_inspector<'a>(
        &'a mut self,
        cheats: &'a mut Cheatcodes,
    ) -> Box<dyn InspectorExt + 'a>;

    // Provided methods
    fn exec_create(
        &mut self,
        inputs: CreateInputs,
        ccx: &mut CheatsCtxt<'_, '_, '_, '_>,
    ) -> Result<CreateOutcome, EVMError<DatabaseError>> { ... }
    fn console_log(
        &mut self,
        ccx: &mut CheatsCtxt<'_, '_, '_, '_>,
        message: String,
    ) { ... }
    fn tracing_inspector(&mut self) -> Option<&mut Option<TracingInspector>> { ... }
}
Expand description

Helper trait for obtaining complete [revm::Inspector] instance from mutable reference to Cheatcodes.

This is needed for cases when inspector itself needs mutable access to Cheatcodes state and allows us to correctly execute arbitrary EVM frames from inside cheatcode implementations.

Required Methods§

Source

fn get_inspector<'a>( &'a mut self, cheats: &'a mut Cheatcodes, ) -> Box<dyn InspectorExt + 'a>

Core trait method accepting mutable reference to Cheatcodes and returning [revm::Inspector].

Provided Methods§

Source

fn exec_create( &mut self, inputs: CreateInputs, ccx: &mut CheatsCtxt<'_, '_, '_, '_>, ) -> Result<CreateOutcome, EVMError<DatabaseError>>

Obtains [revm::Evm] instance and executes the given CREATE frame.

Source

fn console_log(&mut self, ccx: &mut CheatsCtxt<'_, '_, '_, '_>, message: String)

Source

fn tracing_inspector(&mut self) -> Option<&mut Option<TracingInspector>>

Returns a mutable reference to the tracing inspector if it is available.

Implementors§