Trait Block

Source
pub trait Block {
    // Required methods
    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§

Source

fn height(&self) -> u64

Returns the height of this block.

Source

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).

Source

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

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

Source

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.

Source

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

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

Source

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

Returns the events emitted during the course of this block.

Source

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

Returns the receipts of transactions executed in this block.

Implementors§