revm_interpreter/interpreter/
input.rs

1use crate::{interpreter_types::InputsTr, CallInput};
2use primitives::{Address, U256};
3#[cfg(feature = "serde")]
4use serde::{Deserialize, Serialize};
5
6/// Inputs for the interpreter that are used for execution of the call.
7#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
8#[derive(Clone, Debug, Default, PartialEq, Eq)]
9pub struct InputsImpl {
10    /// Storage of this account address is being used.
11    pub target_address: Address,
12    /// Address of the bytecode that is being executed. This field is not used inside Interpreter but it is used
13    /// by dependent projects that would need to know the address of the bytecode.
14    pub bytecode_address: Option<Address>,
15    /// Address of the caller of the call.
16    pub caller_address: Address,
17    /// Input data for the call.
18    pub input: CallInput,
19    /// Value of the call.
20    pub call_value: U256,
21}
22
23impl InputsTr for InputsImpl {
24    fn target_address(&self) -> Address {
25        self.target_address
26    }
27
28    fn caller_address(&self) -> Address {
29        self.caller_address
30    }
31
32    fn bytecode_address(&self) -> Option<&Address> {
33        self.bytecode_address.as_ref()
34    }
35
36    fn input(&self) -> &CallInput {
37        &self.input
38    }
39
40    fn call_value(&self) -> U256 {
41        self.call_value
42    }
43}