evm_runtime/context.rs
1use primitive_types::{H160, H256, U256};
2
3/// Create scheme.
4#[derive(Clone, Copy, Eq, PartialEq, Debug)]
5pub enum CreateScheme {
6 /// Legacy create scheme of `CREATE`.
7 Legacy {
8 /// Caller of the create.
9 caller: H160,
10 },
11 /// Create scheme of `CREATE2`.
12 Create2 {
13 /// Caller of the create.
14 caller: H160,
15 /// Code hash.
16 code_hash: H256,
17 /// Salt.
18 salt: H256,
19 },
20 /// Create at a fixed location.
21 Fixed(H160),
22}
23
24/// Call scheme.
25#[derive(Clone, Copy, Eq, PartialEq, Debug)]
26pub enum CallScheme {
27 /// `CALL`
28 Call,
29 /// `CALLCODE`
30 CallCode,
31 /// `DELEGATECALL`
32 DelegateCall,
33 /// `STATICCALL`
34 StaticCall,
35}
36
37/// Context of the runtime.
38#[derive(Clone, Debug)]
39pub struct Context {
40 /// Execution address.
41 pub address: H160,
42 /// Caller of the EVM.
43 pub caller: H160,
44 /// Apparent value of the EVM.
45 pub apparent_value: U256,
46}