Trait BuiltinFunction

Source
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_dcdt_transfers(
        &self,
        tx_input: &TxInput,
    ) -> BuiltinFunctionDcdtTransferInfo { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Function name corresponding the builtin function implementation.

Currently not used.

Source

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 DCDT) 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§

Source

fn extract_dcdt_transfers( &self, tx_input: &TxInput, ) -> BuiltinFunctionDcdtTransferInfo

Extracts data relating DCDT 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.

Implementors§