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.
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.