revm_interpreter/
interpreter_action.rs1mod call_inputs;
2mod call_outcome;
3mod create_inputs;
4mod create_outcome;
5mod eof_create_inputs;
6
7pub use call_inputs::{CallInputs, CallScheme, CallValue};
8pub use call_outcome::CallOutcome;
9pub use create_inputs::CreateInputs;
10pub use create_outcome::CreateOutcome;
11pub use eof_create_inputs::{EOFCreateInputs, EOFCreateKind};
12
13use crate::InterpreterResult;
14use std::boxed::Box;
15
16#[derive(Clone, Debug, PartialEq, Eq)]
17#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
18pub enum FrameInput {
19 Call(Box<CallInputs>),
22 Create(Box<CreateInputs>),
24 EOFCreate(Box<EOFCreateInputs>),
26}
27
28impl AsMut<Self> for FrameInput {
29 fn as_mut(&mut self) -> &mut Self {
30 self
31 }
32}
33
34#[derive(Clone, Debug, Default, PartialEq, Eq)]
35#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
36pub enum InterpreterAction {
37 NewFrame(FrameInput),
39 Return { result: InterpreterResult },
41 #[default]
43 None,
44}
45
46impl InterpreterAction {
47 pub fn is_call(&self) -> bool {
49 matches!(self, InterpreterAction::NewFrame(FrameInput::Call(..)))
50 }
51
52 pub fn is_create(&self) -> bool {
54 matches!(self, InterpreterAction::NewFrame(FrameInput::Create(..)))
55 }
56
57 pub fn is_return(&self) -> bool {
59 matches!(self, InterpreterAction::Return { .. })
60 }
61
62 pub fn is_none(&self) -> bool {
64 matches!(self, InterpreterAction::None)
65 }
66
67 pub fn is_some(&self) -> bool {
69 !self.is_none()
70 }
71
72 pub fn into_result_return(self) -> Option<InterpreterResult> {
76 match self {
77 InterpreterAction::Return { result } => Some(result),
78 _ => None,
79 }
80 }
81}