Trait dharitri_wasm::api::ContractSelfApi
source · pub trait ContractSelfApi<BigInt, BigUint>: Sizedwhere
BigInt: BigIntApi<BigUint> + 'static,
BigUint: BigUintApi + 'static,{
type Storage: StorageReadApi + StorageWriteApi + ErrorApi + Clone + 'static;
type CallValue: CallValueApi<BigUint> + ErrorApi + Clone + 'static;
type SendApi: SendApi<BigUint> + Clone + 'static;
type BlockchainApi: BlockchainApi<BigUint> + Clone + 'static;
type CryptoApi: CryptoApi + Clone + 'static;
// Required methods
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;
// Provided method
fn storage_load_cumulated_validator_reward(&self) -> BigUint { ... }
}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.
Required Associated Types§
sourcetype Storage: StorageReadApi + StorageWriteApi + ErrorApi + Clone + 'static
type Storage: StorageReadApi + StorageWriteApi + ErrorApi + Clone + 'static
Abstracts the lower-level storage functionality.
sourcetype CallValue: CallValueApi<BigUint> + ErrorApi + Clone + 'static
type CallValue: CallValueApi<BigUint> + ErrorApi + Clone + 'static
Abstracts the call value handling at the beginning of a function call.
sourcetype SendApi: SendApi<BigUint> + Clone + 'static
type SendApi: SendApi<BigUint> + Clone + 'static
Abstracts the sending of MOAX & DCT transactions, as well as async calls.
type BlockchainApi: BlockchainApi<BigUint> + Clone + 'static
type CryptoApi: CryptoApi + Clone + 'static
Required Methods§
sourcefn get_storage_raw(&self) -> Self::Storage
fn get_storage_raw(&self) -> Self::Storage
Gateway into the lower-level storage functionality. Storage related annotations make use of this. Using it directly is not recommended.
sourcefn call_value(&self) -> Self::CallValue
fn call_value(&self) -> Self::CallValue
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.
sourcefn send(&self) -> Self::SendApi
fn send(&self) -> Self::SendApi
Gateway to the functionality related to sending transactions from the current contract.
sourcefn blockchain(&self) -> Self::BlockchainApi
fn blockchain(&self) -> Self::BlockchainApi
Gateway blockchain info related to the current transaction and to accounts.
Provided Methods§
sourcefn storage_load_cumulated_validator_reward(&self) -> BigUint
fn storage_load_cumulated_validator_reward(&self) -> BigUint
Retrieves validator rewards, as set by the protocol. TODO: move to the storage API, once BigUint gets refactored