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§
sourcefn recursion_limit() -> Option<Option<u16>>
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).
sourcefn accept_delegate_call() -> Option<bool>
fn accept_delegate_call() -> Option<bool>
Does this precompile supports being called with DELEGATECALL or CALLCODE?
If all checks return None, defaults to false
.
sourcefn callable_by_smart_contract(
_caller: H160,
_called_selector: Option<u32>
) -> Option<bool>
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
.
sourcefn callable_by_precompile(
_caller: H160,
_called_selector: Option<u32>
) -> Option<bool>
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
.
sourcefn allow_subcalls() -> Option<bool>
fn allow_subcalls() -> Option<bool>
Is this precompile able to do subcalls?
If all checks return None, defaults to false
.
sourcefn callable_by_smart_contract_summary() -> Option<String>
fn callable_by_smart_contract_summary() -> Option<String>
Summarize the checks when being called by a smart contract.
sourcefn callable_by_precompile_summary() -> Option<String>
fn callable_by_precompile_summary() -> Option<String>
Summarize the checks when being called by a precompile.