Trait dharitri_wasm::contract_base::ContractBase
source · pub trait ContractBase: Sized {
type Api: VMApi;
// Required method
fn raw_vm_api(&self) -> Self::Api;
// Provided methods
fn call_value(&self) -> CallValueWrapper<Self::Api> { ... }
fn send(&self) -> SendWrapper<Self::Api> { ... }
fn type_manager(&self) -> Self::Api { ... }
fn types(&self) -> ManagedTypeHelper<Self::Api> { ... }
fn blockchain(&self) -> BlockchainWrapper<Self::Api> { ... }
fn crypto(&self) -> CryptoWrapper<Self::Api> { ... }
fn serializer(&self) -> ManagedSerializer<Self::Api> { ... }
fn error(&self) -> ErrorHelper<Self::Api> { ... }
fn print(&self) -> PrintHelper<Self::Api> { ... }
}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§
Required Methods§
sourcefn raw_vm_api(&self) -> Self::Api
fn raw_vm_api(&self) -> Self::Api
Grants direct access to the underlying VM API. Avoid using it directly.
Provided Methods§
sourcefn call_value(&self) -> CallValueWrapper<Self::Api>
fn call_value(&self) -> CallValueWrapper<Self::Api>
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) -> SendWrapper<Self::Api>
fn send(&self) -> SendWrapper<Self::Api>
Gateway to the functionality related to sending transactions from the current contract.
sourcefn type_manager(&self) -> Self::Api
fn type_manager(&self) -> Self::Api
Managed types API. Required to create new instances of managed types.
sourcefn types(&self) -> ManagedTypeHelper<Self::Api>
fn types(&self) -> ManagedTypeHelper<Self::Api>
Helps create new instances of managed types
sourcefn blockchain(&self) -> BlockchainWrapper<Self::Api>
fn blockchain(&self) -> BlockchainWrapper<Self::Api>
Gateway blockchain info related to the current transaction and to accounts.
sourcefn crypto(&self) -> CryptoWrapper<Self::Api>
fn crypto(&self) -> CryptoWrapper<Self::Api>
Stateless crypto functions provided by the Arwen VM.
sourcefn serializer(&self) -> ManagedSerializer<Self::Api>
fn serializer(&self) -> ManagedSerializer<Self::Api>
Component that provides contract developers access to highly optimized manual serialization and deserialization.