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§

source

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.

source

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PrecompileSet for ()

source§

impl PrecompileSet for BTreeMap<H160, PrecompileFn>

source§

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.

source§

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

Implementors§