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§
sourcefn new(address: Address, env: HostEnv) -> Self
fn new(address: Address, env: HostEnv) -> Self
Creates a new host side reference to a contract.
sourcefn with_tokens(&self, tokens: U512) -> Self
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.
sourcefn get_event<T>(&self, index: i32) -> Result<T, EventError>where
T: 'static + FromBytes + EventInstance,
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
.
sourcefn last_call(&self) -> ContractCallResult
fn last_call(&self) -> ContractCallResult
Returns a detailed information about the last call of the contract.
Object Safety§
This trait is not object safe.