pub trait PrecompileHandle {
// 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 is_static(&self) -> bool;
fn gas_limit(&self) -> Option<u64>;
}Expand description
Handle provided to a precompile to interact with the EVM.
Required Methods§
Sourcefn call(
&mut self,
to: H160,
transfer: Option<Transfer>,
input: Vec<u8>,
gas_limit: Option<u64>,
is_static: bool,
context: &Context,
) -> (ExitReason, Vec<u8>)
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.
Sourcefn record_external_cost(
&mut self,
ref_time: Option<u64>,
proof_size: Option<u64>,
storage_growth: Option<u64>,
) -> Result<(), ExitError>
fn record_external_cost( &mut self, ref_time: Option<u64>, proof_size: Option<u64>, storage_growth: Option<u64>, ) -> Result<(), ExitError>
Sourcefn refund_external_cost(
&mut self,
ref_time: Option<u64>,
proof_size: Option<u64>,
)
fn refund_external_cost( &mut self, ref_time: Option<u64>, proof_size: Option<u64>, )
Refund Substrate specific cost.
Sourcefn remaining_gas(&self) -> u64
fn remaining_gas(&self) -> u64
Retreive the remaining gas.
Sourcefn log(
&mut self,
address: H160,
topics: Vec<H256>,
data: Vec<u8>,
) -> Result<(), ExitError>
fn log( &mut self, address: H160, topics: Vec<H256>, data: Vec<u8>, ) -> Result<(), ExitError>
Sourcefn code_address(&self) -> H160
fn code_address(&self) -> H160
Retreive the code address (what is the address of the precompile being called).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".