revm_interpreter/
interpreter_action.rs
1mod 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, CreateScheme};
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, Default, PartialEq, Eq)]
17#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
18pub enum InterpreterAction {
19 Call { inputs: Box<CallInputs> },
22 Create { inputs: Box<CreateInputs> },
24 EOFCreate { inputs: Box<EOFCreateInputs> },
26 Return { result: InterpreterResult },
28 #[default]
30 None,
31}
32
33impl InterpreterAction {
34 pub fn is_call(&self) -> bool {
36 matches!(self, InterpreterAction::Call { .. })
37 }
38
39 pub fn is_create(&self) -> bool {
41 matches!(self, InterpreterAction::Create { .. })
42 }
43
44 pub fn is_return(&self) -> bool {
46 matches!(self, InterpreterAction::Return { .. })
47 }
48
49 pub fn is_none(&self) -> bool {
51 matches!(self, InterpreterAction::None)
52 }
53
54 pub fn is_some(&self) -> bool {
56 !self.is_none()
57 }
58
59 pub fn into_result_return(self) -> Option<InterpreterResult> {
61 match self {
62 InterpreterAction::Return { result } => Some(result),
63 _ => None,
64 }
65 }
66}