pub trait PrecompileChecks {
    // Provided methods
    fn recursion_limit() -> Option<Option<u16>> { ... }
    fn accept_delegate_call() -> Option<bool> { ... }
    fn callable_by_smart_contract(
        _caller: H160,
        _called_selector: Option<u32>
    ) -> Option<bool> { ... }
    fn callable_by_precompile(
        _caller: H160,
        _called_selector: Option<u32>
    ) -> Option<bool> { ... }
    fn allow_subcalls() -> Option<bool> { ... }
    fn callable_by_smart_contract_summary() -> Option<String> { ... }
    fn callable_by_precompile_summary() -> Option<String> { ... }
}
Expand description

Trait representing checks that can be made on a precompile call. Types implementing this trait are made to be chained in a tuple.

For that reason every method returns an Option, None meaning that the implementor have no constraint and the decision is left to latter elements in the chain. If None is returned by all elements of the chain then sensible defaults are used.

Both PrecompileAt and PrecompileSetStartingWith have a type parameter that must implement this trait to configure the checks of the precompile(set) it represents.

Provided Methods§

source

fn recursion_limit() -> Option<Option<u16>>

Is there a limit to the amount of recursions this precompile can make using subcalls? 0 means this specific precompile will not be callable as a subcall of itself, 1 will allow one level of recursion, etc…

If all checks return None, defaults to Some(0) (no recursion allowed).

source

fn accept_delegate_call() -> Option<bool>

Does this precompile supports being called with DELEGATECALL or CALLCODE?

If all checks return None, defaults to false.

source

fn callable_by_smart_contract( _caller: H160, _called_selector: Option<u32> ) -> Option<bool>

Is this precompile callable by a smart contract?

If all checks return None, defaults to false.

source

fn callable_by_precompile( _caller: H160, _called_selector: Option<u32> ) -> Option<bool>

Is this precompile callable by a precompile?

If all checks return None, defaults to false.

source

fn allow_subcalls() -> Option<bool>

Is this precompile able to do subcalls?

If all checks return None, defaults to false.

source

fn callable_by_smart_contract_summary() -> Option<String>

Summarize the checks when being called by a smart contract.

source

fn callable_by_precompile_summary() -> Option<String>

Summarize the checks when being called by a precompile.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PrecompileChecks for ()

source§

impl<TupleElement0: PrecompileChecks> PrecompileChecks for (TupleElement0,)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks, TupleElement12: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11, TupleElement12)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks, TupleElement12: PrecompileChecks, TupleElement13: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11, TupleElement12, TupleElement13)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks, TupleElement12: PrecompileChecks, TupleElement13: PrecompileChecks, TupleElement14: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11, TupleElement12, TupleElement13, TupleElement14)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks, TupleElement12: PrecompileChecks, TupleElement13: PrecompileChecks, TupleElement14: PrecompileChecks, TupleElement15: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11, TupleElement12, TupleElement13, TupleElement14, TupleElement15)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks, TupleElement12: PrecompileChecks, TupleElement13: PrecompileChecks, TupleElement14: PrecompileChecks, TupleElement15: PrecompileChecks, TupleElement16: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11, TupleElement12, TupleElement13, TupleElement14, TupleElement15, TupleElement16)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks, TupleElement12: PrecompileChecks, TupleElement13: PrecompileChecks, TupleElement14: PrecompileChecks, TupleElement15: PrecompileChecks, TupleElement16: PrecompileChecks, TupleElement17: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11, TupleElement12, TupleElement13, TupleElement14, TupleElement15, TupleElement16, TupleElement17)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks, TupleElement12: PrecompileChecks, TupleElement13: PrecompileChecks, TupleElement14: PrecompileChecks, TupleElement15: PrecompileChecks, TupleElement16: PrecompileChecks, TupleElement17: PrecompileChecks, TupleElement18: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11, TupleElement12, TupleElement13, TupleElement14, TupleElement15, TupleElement16, TupleElement17, TupleElement18)

source§

impl<TupleElement0: PrecompileChecks, TupleElement1: PrecompileChecks, TupleElement2: PrecompileChecks, TupleElement3: PrecompileChecks, TupleElement4: PrecompileChecks, TupleElement5: PrecompileChecks, TupleElement6: PrecompileChecks, TupleElement7: PrecompileChecks, TupleElement8: PrecompileChecks, TupleElement9: PrecompileChecks, TupleElement10: PrecompileChecks, TupleElement11: PrecompileChecks, TupleElement12: PrecompileChecks, TupleElement13: PrecompileChecks, TupleElement14: PrecompileChecks, TupleElement15: PrecompileChecks, TupleElement16: PrecompileChecks, TupleElement17: PrecompileChecks, TupleElement18: PrecompileChecks, TupleElement19: PrecompileChecks> PrecompileChecks for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11, TupleElement12, TupleElement13, TupleElement14, TupleElement15, TupleElement16, TupleElement17, TupleElement18, TupleElement19)

Implementors§