PrecompileSet

Trait PrecompileSet 

Source
pub trait PrecompileSet {
    // Required methods
    fn execute(
        &self,
        address: H160,
        input: &[u8],
        context: &Context,
        is_static: bool,
    ) -> Option<Result<PrecompileOutput, PrecompileFailure>>;
    fn is_precompile(&self, address: H160) -> bool;
}
Expand description

A set of precompiles. Checks of the provided address being in the precompile set should be as cheap as possible since it may be called often.

Required Methods§

Source

fn execute( &self, address: H160, input: &[u8], context: &Context, is_static: bool, ) -> 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) -> bool

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§

Source§

impl PrecompileSet for ()

Source§

impl PrecompileSet for BTreeMap<H160, PrecompileFn>

Source§

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

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, address: H160, input: &[u8], context: &Context, is_static: bool, ) -> Option<Result<PrecompileOutput, PrecompileFailure>>

Implementors§