1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
mod dummy_host;
use crate::primitives::Bytecode;
use crate::{
primitives::{Bytes, Env, B160, B256, U256},
CallInputs, CreateInputs, Gas, InstructionResult, Interpreter, SelfDestructResult,
};
pub use dummy_host::DummyHost;
pub trait Host {
fn step(&mut self, interpreter: &mut Interpreter, is_static: bool) -> InstructionResult;
fn step_end(
&mut self,
interpreter: &mut Interpreter,
is_static: bool,
ret: InstructionResult,
) -> InstructionResult;
fn env(&mut self) -> &mut Env;
fn load_account(&mut self, address: B160) -> Option<(bool, bool)>;
fn block_hash(&mut self, number: U256) -> Option<B256>;
fn balance(&mut self, address: B160) -> Option<(U256, bool)>;
fn code(&mut self, address: B160) -> Option<(Bytecode, bool)>;
fn code_hash(&mut self, address: B160) -> Option<(B256, bool)>;
fn sload(&mut self, address: B160, index: U256) -> Option<(U256, bool)>;
fn sstore(
&mut self,
address: B160,
index: U256,
value: U256,
) -> Option<(U256, U256, U256, bool)>;
fn log(&mut self, address: B160, topics: Vec<B256>, data: Bytes);
fn selfdestruct(&mut self, address: B160, target: B160) -> Option<SelfDestructResult>;
fn create(
&mut self,
inputs: &mut CreateInputs,
) -> (InstructionResult, Option<B160>, Gas, Bytes);
fn call(&mut self, input: &mut CallInputs) -> (InstructionResult, Gas, Bytes);
}