Trait Host
pub trait Host {
Show 13 methods
// Required methods
fn env(&self) -> &Env;
fn env_mut(&mut self) -> &mut Env;
fn load_account_delegated(
&mut self,
address: Address,
) -> Option<AccountLoad>;
fn block_hash(&mut self, number: u64) -> Option<FixedBytes<32>>;
fn balance(&mut self, address: Address) -> Option<StateLoad<Uint<256, 4>>>;
fn code(&mut self, address: Address) -> Option<Eip7702CodeLoad<Bytes>>;
fn code_hash(
&mut self,
address: Address,
) -> Option<Eip7702CodeLoad<FixedBytes<32>>>;
fn sload(
&mut self,
address: Address,
index: Uint<256, 4>,
) -> Option<StateLoad<Uint<256, 4>>>;
fn sstore(
&mut self,
address: Address,
index: Uint<256, 4>,
value: Uint<256, 4>,
) -> Option<StateLoad<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<StateLoad<SelfDestructResult>>;
}
Expand description
EVM context host.
Required Methods§
fn load_account_delegated(&mut self, address: Address) -> Option<AccountLoad>
fn load_account_delegated(&mut self, address: Address) -> Option<AccountLoad>
Load an account code.
fn block_hash(&mut self, number: u64) -> Option<FixedBytes<32>>
fn block_hash(&mut self, number: u64) -> Option<FixedBytes<32>>
Get the block hash of the given block number
.
fn balance(&mut self, address: Address) -> Option<StateLoad<Uint<256, 4>>>
fn balance(&mut self, address: Address) -> Option<StateLoad<Uint<256, 4>>>
Get balance of address
and if the account is cold.
fn code(&mut self, address: Address) -> Option<Eip7702CodeLoad<Bytes>>
fn code(&mut self, address: Address) -> Option<Eip7702CodeLoad<Bytes>>
Get code of address
and if the account is cold.
fn code_hash(
&mut self,
address: Address,
) -> Option<Eip7702CodeLoad<FixedBytes<32>>>
fn code_hash( &mut self, address: Address, ) -> Option<Eip7702CodeLoad<FixedBytes<32>>>
Get code hash of address
and if the account is cold.
fn sload(
&mut self,
address: Address,
index: Uint<256, 4>,
) -> Option<StateLoad<Uint<256, 4>>>
fn sload( &mut self, address: Address, index: Uint<256, 4>, ) -> Option<StateLoad<Uint<256, 4>>>
Get storage value of address
at index
and if the account is cold.
fn sstore(
&mut self,
address: Address,
index: Uint<256, 4>,
value: Uint<256, 4>,
) -> Option<StateLoad<SStoreResult>>
fn sstore( &mut self, address: Address, index: Uint<256, 4>, value: Uint<256, 4>, ) -> Option<StateLoad<SStoreResult>>
Set storage value of account address at index.
Returns StateLoad
with SStoreResult
that contains original/new/old storage value.
fn 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
.
fn 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
.
fn selfdestruct(
&mut self,
address: Address,
target: Address,
) -> Option<StateLoad<SelfDestructResult>>
fn selfdestruct( &mut self, address: Address, target: Address, ) -> Option<StateLoad<SelfDestructResult>>
Mark address
to be deleted, with funds transferred to target
.