pub trait BuiltinFunction {
// Required methods
fn name(&self) -> &str;
fn execute<F>(
&self,
tx_input: TxInput,
tx_cache: TxCache,
vm: &BlockchainVMRef,
lambda: F
) -> (TxResult, BlockchainUpdate)
where F: FnOnce();
// Provided method
fn extract_esdt_transfers(
&self,
tx_input: &TxInput
) -> BuiltinFunctionEsdtTransferInfo { ... }
}Required Methods§
sourcefn name(&self) -> &str
fn name(&self) -> &str
Function name corresponding the builtin function implementation.
Currently not used.
sourcefn execute<F>(
&self,
tx_input: TxInput,
tx_cache: TxCache,
vm: &BlockchainVMRef,
lambda: F
) -> (TxResult, BlockchainUpdate)where
F: FnOnce(),
fn execute<F>( &self, tx_input: TxInput, tx_cache: TxCache, vm: &BlockchainVMRef, lambda: F ) -> (TxResult, BlockchainUpdate)where F: FnOnce(),
Executes builtin function for the givn TxInput and with access to the underlying contracts states via the TxCache.
A few builtin functions (the ones transferring ESDT) can also call the VM after they finish, so they are given the extra reference to the VM and a lambda closure to execute on the VM
Provided Methods§
sourcefn extract_esdt_transfers(
&self,
tx_input: &TxInput
) -> BuiltinFunctionEsdtTransferInfo
fn extract_esdt_transfers( &self, tx_input: &TxInput ) -> BuiltinFunctionEsdtTransferInfo
Extracts data relating ESDT transfers handled by the builtin function, if applicable.
Object Safety§
This trait is not object safe.