example_my_evm/
handler.rs1use revm::{
2 context::result::{EVMError, HaltReason, InvalidTransaction},
3 context_interface::{ContextTr, JournalTr},
4 handler::{
5 evm::FrameTr, instructions::InstructionProvider, EvmTr, FrameResult, Handler,
6 PrecompileProvider,
7 },
8 inspector::{Inspector, InspectorEvmTr, InspectorHandler},
9 interpreter::{interpreter::EthInterpreter, interpreter_action::FrameInit, InterpreterResult},
10 state::EvmState,
11 Database,
12};
13
14#[derive(Debug)]
21pub struct MyHandler<EVM> {
22 pub _phantom: core::marker::PhantomData<EVM>,
26}
27
28impl<EVM> Default for MyHandler<EVM> {
29 fn default() -> Self {
30 Self {
31 _phantom: core::marker::PhantomData,
32 }
33 }
34}
35
36impl<EVM> Handler for MyHandler<EVM>
37where
38 EVM: EvmTr<
39 Context: ContextTr<Journal: JournalTr<State = EvmState>>,
40 Precompiles: PrecompileProvider<EVM::Context, Output = InterpreterResult>,
41 Instructions: InstructionProvider<
42 Context = EVM::Context,
43 InterpreterTypes = EthInterpreter,
44 >,
45 Frame: FrameTr<FrameResult = FrameResult, FrameInit = FrameInit>,
46 >,
47{
48 type Evm = EVM;
49 type Error = EVMError<<<EVM::Context as ContextTr>::Db as Database>::Error, InvalidTransaction>;
50 type HaltReason = HaltReason;
51
52 fn reward_beneficiary(
53 &self,
54 _evm: &mut Self::Evm,
55 _exec_result: &mut FrameResult,
56 ) -> Result<(), Self::Error> {
57 Ok(())
59 }
60}
61
62impl<EVM> InspectorHandler for MyHandler<EVM>
63where
64 EVM: InspectorEvmTr<
65 Inspector: Inspector<<<Self as Handler>::Evm as EvmTr>::Context, EthInterpreter>,
66 Context: ContextTr<Journal: JournalTr<State = EvmState>>,
67 Precompiles: PrecompileProvider<EVM::Context, Output = InterpreterResult>,
68 Instructions: InstructionProvider<
69 Context = EVM::Context,
70 InterpreterTypes = EthInterpreter,
71 >,
72 >,
73{
74 type IT = EthInterpreter;
75}