Trait InternalContractTrait

Source
pub trait InternalContractTrait:
    Send
    + Sync
    + IsActive {
    // Required methods
    fn address(&self) -> &Address;
    fn initialize_block(&self, params: &CommonParams) -> BlockNumber;
    fn get_func_table(
        &self,
    ) -> &HashMap<[u8; 4], Box<dyn SolidityFunctionTrait>>;

    // Provided methods
    fn execute(
        &self,
        params: &ActionParams,
        context: &mut InternalRefContext<'_>,
    ) -> InternalTrapResult<GasLeft> { ... }
    fn code(&self) -> Arc<Bytes> { ... }
    fn code_hash(&self) -> H256 { ... }
    fn code_size(&self) -> usize { ... }
}
Expand description

Native implementation of an internal contract.

Required Methods§

Source

fn address(&self) -> &Address

Address of the internal contract

Source

fn initialize_block(&self, params: &CommonParams) -> BlockNumber

Time point to run new_contract_with_admin for such a internal contract

Source

fn get_func_table(&self) -> &HashMap<[u8; 4], Box<dyn SolidityFunctionTrait>>

A hash-map for solidity function sig and execution handler.

Provided Methods§

Source

fn execute( &self, params: &ActionParams, context: &mut InternalRefContext<'_>, ) -> InternalTrapResult<GasLeft>

execute this internal contract on the given parameters.

Source

fn code(&self) -> Arc<Bytes>

Source

fn code_hash(&self) -> H256

Source

fn code_size(&self) -> usize

Implementors§