pub trait ContractBase: Sized {
type Api: VMApi;
// Provided methods
fn call_value(&self) -> CallValueWrapper<Self::Api> { ... }
fn send(&self) -> SendWrapper<Self::Api> { ... }
fn tx(&self) -> Tx<TxScEnv<Self::Api>, (), (), (), (), (), ()> { ... }
fn send_raw(&self) -> SendRawWrapper<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 storage_raw(&self) -> StorageRawWrapper<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§
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 tx(&self) -> Tx<TxScEnv<Self::Api>, (), (), (), (), (), ()>
fn tx(&self) -> Tx<TxScEnv<Self::Api>, (), (), (), (), (), ()>
Starts the declaration of a new transaction.
Sourcefn send_raw(&self) -> SendRawWrapper<Self::Api>
fn send_raw(&self) -> SendRawWrapper<Self::Api>
Low-level functionality related to sending transactions from the current contract.
For almost all cases contracts should instead use self.send()
and ContractCall
.
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.
fn error(&self) -> ErrorHelper<Self::Api>
fn storage_raw(&self) -> StorageRawWrapper<Self::Api>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.