pub trait PrecompileSet {
    // Required methods
    fn execute(
        &self,
        handle: &mut impl PrecompileHandle
    ) -> Option<Result<PrecompileOutput, PrecompileFailure>>;
    fn is_precompile(
        &self,
        address: H160,
        remaining_gas: u64
    ) -> IsPrecompileResult;
}
Expand description

A set of precompiles.

Checks if the provided address is in the precompile set. This should be as cheap as possible since it may be called often.

Required Methods§

fn execute( &self, handle: &mut impl PrecompileHandle ) -> Option<Result<PrecompileOutput, PrecompileFailure>>

Tries to execute a precompile in the precompile set. If the provided address is not a precompile, returns None.

fn is_precompile(&self, address: H160, remaining_gas: u64) -> IsPrecompileResult

Check if the given address is a precompile. Should only be called to perform the check while not executing the precompile afterward, since execute already performs a check internally.

Implementations on Foreign Types§

§

impl PrecompileSet for BTreeMap<H160, fn(_: &[u8], _: Option<u64>, _: &Context, _: bool) -> Result<(PrecompileOutput, u64), PrecompileFailure>, Global>

§

fn is_precompile(&self, address: H160, _: u64) -> IsPrecompileResult

Check if the given address is a precompile. Should only be called to perform the check while not executing the precompile afterward, since execute already performs a check internally.

§

fn execute( &self, handle: &mut impl PrecompileHandle ) -> Option<Result<PrecompileOutput, PrecompileFailure>>

§

impl PrecompileSet for ()

§

fn execute( &self, _: &mut impl PrecompileHandle ) -> Option<Result<PrecompileOutput, PrecompileFailure>>

§

fn is_precompile(&self, _: H160, _: u64) -> IsPrecompileResult

§

impl<R, P> PrecompileSet for PrecompileSetBuilder<R, P>where P: PrecompileSetFragment,

§

fn execute( &self, handle: &mut impl PrecompileHandle ) -> Option<Result<PrecompileOutput, PrecompileFailure>>

§

fn is_precompile(&self, address: H160, remaining_gas: u64) -> IsPrecompileResult

Implementors§

source§

impl<T> PrecompileSet for T3rnPrecompiles<T>where T: Config + Config + Config + Config, <T as Config>::AssetId: From<u32>, <T as Config>::AssetIdParameter: From<u32>, <T as Config>::Balance: EvmData, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: EvmData, U256: From<<T as Config>::Balance> + From<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>, TokensPrecompile<T>: Precompile, PortalPrecompile<T>: Precompile, VacuumPrecompile<T>: Precompile,

source§

impl<T: Config + Config + Config> PrecompileSet for MockPrecompileSet<T>where <T as Config>::AssetId: From<u32>, <T as Config>::AssetIdParameter: From<u32>, <T as Config>::Balance: EvmData, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance: EvmData, U256: From<<T as Config>::Balance> + From<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>,