[][src]Struct ethereumvm::AccountState

pub struct AccountState<'a, A: AccountPatch> { /* fields omitted */ }

A struct that manages the current account state for one EVM.

Methods

impl<'a, A: AccountPatch> AccountState<'a, A>[src]

pub fn new(account_patch: &'a A) -> Self[src]

Create new AccountState configured with AccountPatch

pub fn derive_from<'b>(account_patch: &'a A, prev: &AccountState<'b, A>) -> Self[src]

Clone with new AccountPatch

impl<'a, A: AccountPatch> AccountState<'a, A>[src]

pub fn used_addresses(&self) -> Set<Address>[src]

Returns all fetched or modified addresses.

pub fn accounts(&self) -> Values<Address, AccountChange>[src]

Returns all accounts right now in this account state.

pub fn require(&self, address: Address) -> Result<(), RequireError>[src]

Returns Ok(()) if a full account is in this account state. Otherwise raise a RequireError.

pub fn require_code(&self, address: Address) -> Result<(), RequireError>[src]

Returns Ok(()) if either a full account or a partial code account is in this account state. Otherwise raise a RequireError.

pub fn require_storage(
    &self,
    address: Address,
    index: U256
) -> Result<(), RequireError>
[src]

Returns Ok(()) if the storage exists in the VM. Otherwise raise a RequireError.

pub fn commit(
    &mut self,
    commitment: AccountCommitment
) -> Result<(), CommitError>
[src]

Commit an account commitment into this account state.

pub fn exists(&self, address: Address) -> Result<bool, RequireError>[src]

Test whether an account at given address is considered existing.

pub fn code(&self, address: Address) -> Result<Rc<Vec<u8>>, RequireError>[src]

Find code by its address in this account state. If the search failed, returns a RequireError.

pub fn code_opt_nonexist(
    &self,
    address: Address
) -> Result<Option<Rc<Vec<u8>>>, RequireError>
[src]

Find code of account that may not exist. If search failed, returns a RequireError

pub fn nonce(&self, address: Address) -> Result<U256, RequireError>[src]

Find nonce by its address in this account state. If the search failed, returns a RequireError.

pub fn balance(&self, address: Address) -> Result<U256, RequireError>[src]

Find balance by its address in this account state. If the search failed, returns a RequireError.

pub fn storage_read(
    &self,
    address: Address,
    index: U256
) -> Result<M256, RequireError>
[src]

Read a value from an account storage.

pub fn storage_read_orig(
    &self,
    address: Address,
    index: U256
) -> Result<M256, RequireError>
[src]

Read an original (pre-execution) value from an account storage

pub fn storage_write(
    &mut self,
    address: Address,
    index: U256,
    value: M256
) -> Result<(), RequireError>
[src]

Write a value from an account storage. The account will be created if it is nonexist.

pub fn create(
    &mut self,
    address: Address,
    topup: U256
) -> Result<(), RequireError>
[src]

Create a new account (that should not yet have existed before).

pub fn code_deposit(&mut self, address: Address, new_code: Rc<Vec<u8>>)[src]

Deposit code in to a created account. Only usable in a newly created account.

pub fn increase_balance(&mut self, address: Address, topup: U256)[src]

Increase the balance of an account. The account will be created if it is nonexist in the beginning.

pub fn decrease_balance(&mut self, address: Address, withdraw: U256)[src]

Decrease the balance of an account. The account will be created if it is nonexist in the beginning.

pub fn set_nonce(
    &mut self,
    address: Address,
    new_nonce: U256
) -> Result<(), RequireError>
[src]

Set nonce of an account. If the account is not already commited, returns a RequireError. The account will be created if it is nonexist in the beginning.

pub fn remove(&mut self, address: Address) -> Result<(), RequireError>[src]

Delete an account from this account state. The account is set to null.

Trait Implementations

impl<'a, A: AccountPatch> Clone for AccountState<'a, A>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a, A: Debug + AccountPatch> Debug for AccountState<'a, A>[src]

Auto Trait Implementations

impl<'a, A> !Send for AccountState<'a, A>

impl<'a, A> Unpin for AccountState<'a, A>

impl<'a, A> !Sync for AccountState<'a, A>

impl<'a, A> !UnwindSafe for AccountState<'a, A>

impl<'a, A> !RefUnwindSafe for AccountState<'a, A>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self