[][src]Trait blockchain_traits::PendingTransaction

pub trait PendingTransaction {
    fn address(&self) -> &Address;
fn sender(&self) -> &Address;
fn value(&self) -> u128;
fn input(&self) -> &[u8];
fn create(&mut self, value: u128, code: &[u8]) -> Box<dyn Receipt>;
fn transact(
        &mut self,
        callee: Address,
        value: u128,
        input: &[u8]
    ) -> Box<dyn Receipt>;
fn ret(&mut self, data: &[u8]);
fn err(&mut self, data: &[u8]);
fn emit(&mut self, topics: &[&[u8]], data: &[u8]);
fn state(&self) -> &dyn KVStore;
fn state_mut(&mut self) -> &mut dyn KVStoreMut;
fn code_at(&self, addr: &Address) -> Option<&[u8]>;
fn account_meta_at(&self, addr: &Address) -> Option<AccountMeta>; }

Represents the data and functionality available to a smart contract execution.

Required methods

fn address(&self) -> &Address

Returns the address of the current contract instance.

fn sender(&self) -> &Address

Returns the address of the sender of the transaction.

fn value(&self) -> u128

Returns the value sent to the current transaction.

fn input(&self) -> &[u8]

Returns the input provided by the calling context.

fn create(&mut self, value: u128, code: &[u8]) -> Box<dyn Receipt>

Creates a new contract with the provided code and initial value. The new transaction will inherit the gas parameters and gas payer of the top level transaction. The current account will be set as the sender.

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

Executes a balance-transferring RPC to callee with provided input and value. The new transaction will inherit the gas parameters and gas payer of the top level transaction. The current account will be set as the sender.

fn ret(&mut self, data: &[u8])

Returns data to the calling transaction.

fn err(&mut self, data: &[u8])

Returns error data to the calling context.

fn emit(&mut self, topics: &[&[u8]], data: &[u8])

Publishes a broadcast message in this block.

fn state(&self) -> &dyn KVStore

Returns the state of the current account.

fn state_mut(&mut self) -> &mut dyn KVStoreMut

Returns the mutable state of the current account.

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.

Loading content...

Implementors

Loading content...