Trait odra::host::HostRef

source ·
pub trait HostRef {
    // Required methods
    fn new(address: Address, env: HostEnv) -> Self;
    fn with_tokens(&self, tokens: U512) -> Self;
    fn address(&self) -> &Address;
    fn env(&self) -> &HostEnv;
    fn get_event<T>(&self, index: i32) -> Result<T, EventError>
       where T: 'static + FromBytes + EventInstance;
    fn last_call(&self) -> ContractCallResult;
}
Expand description

A host side reference to a contract.

Required Methods§

source

fn new(address: Address, env: HostEnv) -> Self

Creates a new host side reference to a contract.

source

fn with_tokens(&self, tokens: U512) -> Self

Creates a new host reference with attached tokens, based on the current instance.

If there are tokens attached to the current instance, the tokens will be attached to the next contract call.

source

fn address(&self) -> &Address

Returns the address of the contract.

source

fn env(&self) -> &HostEnv

Returns the host environment.

source

fn get_event<T>(&self, index: i32) -> Result<T, EventError>
where T: 'static + FromBytes + EventInstance,

Returns the n-th event emitted by the contract.

If the event is not found or the type does not match, returns EventError::EventNotFound.

source

fn last_call(&self) -> ContractCallResult

Returns a detailed information about the last call of the contract.

Object Safety§

This trait is not object safe.

Implementors§