[][src]Trait blockchain_traits::Block

pub trait Block {
    fn height(&self) -> u64;
fn transact(
        &mut self,
        caller: Address,
        callee: Address,
        payer: Address,
        value: u128,
        input: &[u8],
        gas: u64,
        gas_price: u64
    ) -> Box<dyn Receipt>;
fn code_at(&self, addr: &Address) -> Option<&[u8]>;
fn account_meta_at(&self, addr: &Address) -> Option<AccountMeta>;
fn state_at(&self, addr: &Address) -> Option<&dyn KVStore>;
fn events(&self) -> Vec<&Event>;
fn receipts(&self) -> Vec<&dyn Receipt>; }

Required methods

fn height(&self) -> u64

Returns the height of this block.

fn transact(
    &mut self,
    caller: Address,
    callee: Address,
    payer: Address,
    value: u128,
    input: &[u8],
    gas: u64,
    gas_price: u64
) -> Box<dyn Receipt>

Executes a RPC to callee with provided input and gas computational resources. value tokens will be transferred from the caller to the callee. The caller is charged gas * gas_price for the computation. A transaction that aborts (panics) will have its changes rolled back. This transact should be called by an Externally Owned Account (EOA).

fn code_at(&self, addr: &Address) -> Option<&[u8]>

Returns the bytecode stored at addr or None if the account does not exist.

fn account_meta_at(&self, addr: &Address) -> Option<AccountMeta>

Returns the metadata of the account stored at addr, or None if the account does not exist.

fn state_at(&self, addr: &Address) -> Option<&dyn KVStore>

Returns the state of the acount at addr, if it exists.

fn events(&self) -> Vec<&Event>

Returns the events emitted during the course of this block.

fn receipts(&self) -> Vec<&dyn Receipt>

Returns the receipts of transactions executed in this block.

Loading content...

Implementors

Loading content...