Trait drt_chain_vm::tx_execution::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.

Object Safety§

This trait is not object safe.

Implementors§