Trait revm::interpreter::Host
source · pub trait Host {
Show 13 methods
// Required methods
fn env(&self) -> &Env;
fn env_mut(&mut self) -> &mut Env;
fn load_account(&mut self, address: Address) -> Option<LoadAccountResult>;
fn block_hash(&mut self, number: Uint<256, 4>) -> Option<FixedBytes<32>>;
fn balance(&mut self, address: Address) -> Option<(Uint<256, 4>, bool)>;
fn code(&mut self, address: Address) -> Option<(Bytecode, bool)>;
fn code_hash(&mut self, address: Address) -> Option<(FixedBytes<32>, bool)>;
fn sload(
&mut self,
address: Address,
index: Uint<256, 4>
) -> Option<(Uint<256, 4>, bool)>;
fn sstore(
&mut self,
address: Address,
index: Uint<256, 4>,
value: Uint<256, 4>
) -> Option<SStoreResult>;
fn tload(&mut self, address: Address, index: Uint<256, 4>) -> Uint<256, 4>;
fn tstore(
&mut self,
address: Address,
index: Uint<256, 4>,
value: Uint<256, 4>
);
fn log(&mut self, log: Log);
fn selfdestruct(
&mut self,
address: Address,
target: Address
) -> Option<SelfDestructResult>;
}
Expand description
EVM context host.
Required Methods§
sourcefn load_account(&mut self, address: Address) -> Option<LoadAccountResult>
fn load_account(&mut self, address: Address) -> Option<LoadAccountResult>
Load an account.
Returns (is_cold, is_new_account)
sourcefn block_hash(&mut self, number: Uint<256, 4>) -> Option<FixedBytes<32>>
fn block_hash(&mut self, number: Uint<256, 4>) -> Option<FixedBytes<32>>
Get the block hash of the given block number
.
sourcefn balance(&mut self, address: Address) -> Option<(Uint<256, 4>, bool)>
fn balance(&mut self, address: Address) -> Option<(Uint<256, 4>, bool)>
Get balance of address
and if the account is cold.
sourcefn code(&mut self, address: Address) -> Option<(Bytecode, bool)>
fn code(&mut self, address: Address) -> Option<(Bytecode, bool)>
Get code of address
and if the account is cold.
sourcefn code_hash(&mut self, address: Address) -> Option<(FixedBytes<32>, bool)>
fn code_hash(&mut self, address: Address) -> Option<(FixedBytes<32>, bool)>
Get code hash of address
and if the account is cold.
sourcefn sload(
&mut self,
address: Address,
index: Uint<256, 4>
) -> Option<(Uint<256, 4>, bool)>
fn sload( &mut self, address: Address, index: Uint<256, 4> ) -> Option<(Uint<256, 4>, bool)>
Get storage value of address
at index
and if the account is cold.
sourcefn sstore(
&mut self,
address: Address,
index: Uint<256, 4>,
value: Uint<256, 4>
) -> Option<SStoreResult>
fn sstore( &mut self, address: Address, index: Uint<256, 4>, value: Uint<256, 4> ) -> Option<SStoreResult>
Set storage value of account address at index.
Returns (original, present, new, is_cold).
sourcefn tload(&mut self, address: Address, index: Uint<256, 4>) -> Uint<256, 4>
fn tload(&mut self, address: Address, index: Uint<256, 4>) -> Uint<256, 4>
Get the transient storage value of address
at index
.
sourcefn tstore(&mut self, address: Address, index: Uint<256, 4>, value: Uint<256, 4>)
fn tstore(&mut self, address: Address, index: Uint<256, 4>, value: Uint<256, 4>)
Set the transient storage value of address
at index
.
sourcefn selfdestruct(
&mut self,
address: Address,
target: Address
) -> Option<SelfDestructResult>
fn selfdestruct( &mut self, address: Address, target: Address ) -> Option<SelfDestructResult>
Mark address
to be deleted, with funds transferred to target
.