cast::inspectors::cheatcodes

Trait CheatcodesExecutor

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§

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§

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

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

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

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

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

Implementors§