ExecutionContext

Struct ExecutionContext 

Source
pub struct ExecutionContext<'a> { /* private fields */ }
Expand description

EVMC context structure. Exposes the EVMC host functions, message data, and transaction context to the executing VM.

Implementations§

Source§

impl<'a> ExecutionContext<'a>

Source

pub fn new( host: &'a evmc_host_interface, _context: *mut evmc_host_context, ) -> Self

Source

pub fn get_tx_context(&self) -> &ExecutionTxContext

Retrieve the transaction context.

Source

pub fn account_exists(&self, address: &Address) -> bool

Check if an account exists.

Source

pub fn get_storage(&self, address: &Address, key: &Bytes32) -> Bytes32

Read from a storage key.

Source

pub fn set_storage( &mut self, address: &Address, key: &Bytes32, value: &Bytes32, ) -> StorageStatus

Set value of a storage key.

Source

pub fn get_balance(&self, address: &Address) -> Uint256

Get balance of an account.

Source

pub fn get_code_size(&self, address: &Address) -> usize

Get code size of an account.

Source

pub fn get_code_hash(&self, address: &Address) -> Bytes32

Get code hash of an account.

Source

pub fn copy_code( &self, address: &Address, code_offset: usize, buffer: &mut [u8], ) -> usize

Copy code of an account.

Source

pub fn selfdestruct(&mut self, address: &Address, beneficiary: &Address)

Self-destruct the current account.

Source

pub fn call(&mut self, message: &ExecutionMessage) -> ExecutionResult

Call to another account.

Source

pub fn get_block_hash(&self, num: i64) -> Bytes32

Get block hash of an account.

Source

pub fn emit_log(&mut self, address: &Address, data: &[u8], topics: &[Bytes32])

Emit a log.

Source

pub fn access_account(&mut self, address: &Address) -> AccessStatus

Access an account.

Source

pub fn access_storage( &mut self, address: &Address, key: &Bytes32, ) -> AccessStatus

Access a storage key.

Auto Trait Implementations§

§

impl<'a> Freeze for ExecutionContext<'a>

§

impl<'a> RefUnwindSafe for ExecutionContext<'a>

§

impl<'a> !Send for ExecutionContext<'a>

§

impl<'a> !Sync for ExecutionContext<'a>

§

impl<'a> Unpin for ExecutionContext<'a>

§

impl<'a> UnwindSafe for ExecutionContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.