Trait elrond_wasm::api::ContractBase[][src]

pub trait ContractBase: Sized {
    type BigUint: BigUintApi + 'static;
    type BigInt: BigIntApi + 'static;
    type Storage: StorageReadApi + StorageWriteApi + ErrorApi + Clone + 'static;
    type CallValue: CallValueApi<AmountType = Self::BigUint> + ErrorApi + Clone + 'static;
    type SendApi: SendApi<AmountType = Self::BigUint, ProxyBigInt = Self::BigInt, ProxyStorage = Self::Storage> + Clone + 'static;
    type BlockchainApi: BlockchainApi<BalanceType = Self::BigUint> + Clone + 'static;
    type CryptoApi: CryptoApi + Clone + 'static;
    type LogApi: LogApi + ErrorApi + Clone + 'static;
    type ErrorApi: ErrorApi + Clone + 'static;
    fn get_storage_raw(&self) -> Self::Storage;
fn call_value(&self) -> Self::CallValue;
fn send(&self) -> Self::SendApi;
fn blockchain(&self) -> Self::BlockchainApi;
fn crypto(&self) -> Self::CryptoApi;
fn log_api_raw(&self) -> Self::LogApi;
fn error_api(&self) -> Self::ErrorApi; fn proxy<P: ProxyObjApi<SendApi = Self::SendApi>>(
        &self,
        address: Address
    ) -> P { ... } }
Expand description

Interface to be used by the actual smart contract code.

Note: contracts and the api are not mutable. They simply pass on/retrieve data to/from the protocol. When mocking the blockchain state, we use the Rc/RefCell pattern to isolate mock state mutability from the contract interface.

Associated Types

type BigUint: BigUintApi + 'static[src]

type BigInt: BigIntApi + 'static[src]

type Storage: StorageReadApi + StorageWriteApi + ErrorApi + Clone + 'static[src]

Expand description

Abstracts the lower-level storage functionality.

type CallValue: CallValueApi<AmountType = Self::BigUint> + ErrorApi + Clone + 'static[src]

Expand description

Abstracts the call value handling at the beginning of a function call.

type SendApi: SendApi<AmountType = Self::BigUint, ProxyBigInt = Self::BigInt, ProxyStorage = Self::Storage> + Clone + 'static[src]

Expand description

Abstracts the sending of EGLD & ESDT transactions, as well as async calls.

type BlockchainApi: BlockchainApi<BalanceType = Self::BigUint> + Clone + 'static[src]

type CryptoApi: CryptoApi + Clone + 'static[src]

type LogApi: LogApi + ErrorApi + Clone + 'static[src]

type ErrorApi: ErrorApi + Clone + 'static[src]

Required methods

fn get_storage_raw(&self) -> Self::Storage[src]

Expand description

Gateway into the lower-level storage functionality. Storage related annotations make use of this. Using it directly is not recommended.

fn call_value(&self) -> Self::CallValue[src]

Expand description

Gateway into the call value retrieval functionality. The payment annotations should normally be the ones to handle this, but the developer is also given direct access to the API.

fn send(&self) -> Self::SendApi[src]

Expand description

Gateway to the functionality related to sending transactions from the current contract.

fn blockchain(&self) -> Self::BlockchainApi[src]

Expand description

Gateway blockchain info related to the current transaction and to accounts.

fn crypto(&self) -> Self::CryptoApi[src]

Expand description

Stateless crypto functions provided by the Arwen VM.

fn log_api_raw(&self) -> Self::LogApi[src]

Expand description

Gateway into the lower-level event log functionality. Gets called in auto-generated Using it directly is not recommended. TODO: consider moving to ContractPrivateApi.

fn error_api(&self) -> Self::ErrorApi[src]

Expand description

Currently for some auto-generated code involving callbacks. Please avoid using it directly. TODO: find a way to hide this API.

Provided methods

fn proxy<P: ProxyObjApi<SendApi = Self::SendApi>>(&self, address: Address) -> P[src]

Implementors