Trait evmodin::host::Host [−][src]
pub trait Host {
Show 14 methods
fn account_exists(&self, address: Address) -> bool;
fn get_storage(&self, address: Address, key: U256) -> U256;
fn set_storage(
&mut self,
address: Address,
key: U256,
value: U256
) -> StorageStatus;
fn get_balance(&self, address: Address) -> U256;
fn get_code_size(&self, address: Address) -> U256;
fn get_code_hash(&self, address: Address) -> U256;
fn copy_code(
&self,
address: Address,
offset: usize,
buffer: &mut [u8]
) -> usize;
fn selfdestruct(&mut self, address: Address, beneficiary: Address);
fn call(&mut self, msg: &Message) -> Output;
fn get_tx_context(&self) -> TxContext;
fn get_block_hash(&self, block_number: u64) -> U256;
fn emit_log(&mut self, address: Address, data: &[u8], topics: &[U256]);
fn access_account(&mut self, address: Address) -> AccessStatus;
fn access_storage(&mut self, address: Address, key: U256) -> AccessStatus;
}
Expand description
Abstraction that exposes host context to EVM.
Required methods
fn account_exists(&self, address: Address) -> bool
fn account_exists(&self, address: Address) -> bool
Check if an account exists.
fn get_storage(&self, address: Address, key: U256) -> U256
fn get_storage(&self, address: Address, key: U256) -> U256
Get value of a storage key.
Returns Ok(U256::zero())
if does not exist.
fn set_storage(
&mut self,
address: Address,
key: U256,
value: U256
) -> StorageStatus
fn set_storage(
&mut self,
address: Address,
key: U256,
value: U256
) -> StorageStatus
Set value of a storage key.
fn get_balance(&self, address: Address) -> U256
fn get_balance(&self, address: Address) -> U256
Get balance of an account.
Returns Ok(0)
if account does not exist.
fn get_code_size(&self, address: Address) -> U256
fn get_code_size(&self, address: Address) -> U256
Get code size of an account.
Returns Ok(0)
if account does not exist.
fn get_code_hash(&self, address: Address) -> U256
fn get_code_hash(&self, address: Address) -> U256
Get code hash of an account.
Returns Ok(0)
if account does not exist.
Copy code of an account.
Returns Ok(0)
if offset is invalid.
fn selfdestruct(&mut self, address: Address, beneficiary: Address)
fn selfdestruct(&mut self, address: Address, beneficiary: Address)
Self-destruct account.
fn get_tx_context(&self) -> TxContext
fn get_tx_context(&self) -> TxContext
Retrieve transaction context.
fn get_block_hash(&self, block_number: u64) -> U256
fn get_block_hash(&self, block_number: u64) -> U256
Get block hash.
Returns Ok(U256::zero())
if block does not exist.
fn access_account(&mut self, address: Address) -> AccessStatus
fn access_account(&mut self, address: Address) -> AccessStatus
Mark account as warm, return previous access status.
Returns Ok(AccessStatus::Cold)
if account does not exist.
fn access_storage(&mut self, address: Address, key: U256) -> AccessStatus
fn access_storage(&mut self, address: Address, key: U256) -> AccessStatus
Mark storage key as warm, return previous access status.
Returns Ok(AccessStatus::Cold)
if account does not exist.