Trait precompile_utils::prelude::PrecompileHandle

pub trait PrecompileHandle {
Show 13 methods // Required methods fn call( &mut self, to: H160, transfer: Option<Transfer>, input: Vec<u8>, gas_limit: Option<u64>, is_static: bool, context: &Context, ) -> (ExitReason, Vec<u8>); fn record_cost(&mut self, cost: u64) -> Result<(), ExitError>; fn record_external_cost( &mut self, ref_time: Option<u64>, proof_size: Option<u64>, storage_growth: Option<u64>, ) -> Result<(), ExitError>; fn refund_external_cost( &mut self, ref_time: Option<u64>, proof_size: Option<u64>, ); fn remaining_gas(&self) -> u64; fn log( &mut self, address: H160, topics: Vec<H256>, data: Vec<u8>, ) -> Result<(), ExitError>; fn code_address(&self) -> H160; fn input(&self) -> &[u8] ; fn context(&self) -> &Context; fn origin(&self) -> H160; fn is_static(&self) -> bool; fn gas_limit(&self) -> Option<u64>; fn is_contract_being_constructed(&self, address: H160) -> bool;
}
Expand description

Handle provided to a precompile to interact with the EVM.

Required Methods§

fn call( &mut self, to: H160, transfer: Option<Transfer>, input: Vec<u8>, gas_limit: Option<u64>, is_static: bool, context: &Context, ) -> (ExitReason, Vec<u8>)

Perform subcall in provided context. Precompile specifies in which context the subcall is executed.

fn record_cost(&mut self, cost: u64) -> Result<(), ExitError>

Record cost to the Runtime gasometer.

fn record_external_cost( &mut self, ref_time: Option<u64>, proof_size: Option<u64>, storage_growth: Option<u64>, ) -> Result<(), ExitError>

Record Substrate specific cost.

fn refund_external_cost( &mut self, ref_time: Option<u64>, proof_size: Option<u64>, )

Refund Substrate specific cost.

fn remaining_gas(&self) -> u64

Retreive the remaining gas.

fn log( &mut self, address: H160, topics: Vec<H256>, data: Vec<u8>, ) -> Result<(), ExitError>

Record a log.

fn code_address(&self) -> H160

Retreive the code address (what is the address of the precompile being called).

fn input(&self) -> &[u8]

Retreive the input data the precompile is called with.

fn context(&self) -> &Context

Retreive the context in which the precompile is executed.

fn origin(&self) -> H160

Retreive the address of the EOA that originated the transaction.

fn is_static(&self) -> bool

Is the precompile call is done statically.

fn gas_limit(&self) -> Option<u64>

Retreive the gas limit of this call.

fn is_contract_being_constructed(&self, address: H160) -> bool

Check if a given address is a contract being constructed

Implementors§