Struct precompile_utils::substrate::RuntimeHelper
source · pub struct RuntimeHelper<Runtime>(/* private fields */);
Expand description
Helper functions requiring a Substrate runtime.
This runtime must of course implement pallet_evm::Config
.
Implementations§
source§impl<Runtime> RuntimeHelper<Runtime>where
Runtime: Config,
Runtime::RuntimeCall: Dispatchable<PostInfo = PostDispatchInfo> + GetDispatchInfo,
impl<Runtime> RuntimeHelper<Runtime>where
Runtime: Config,
Runtime::RuntimeCall: Dispatchable<PostInfo = PostDispatchInfo> + GetDispatchInfo,
pub fn record_weight_v2_cost( handle: &mut impl PrecompileHandle, weight: Weight ) -> Result<(), ExitError>
pub fn refund_weight_v2_cost( handle: &mut impl PrecompileHandle, weight: Weight, maybe_actual_weight: Option<Weight> ) -> Result<u64, ExitError>
sourcepub fn try_dispatch<Call>(
handle: &mut impl PrecompileHandle,
origin: <Runtime::RuntimeCall as Dispatchable>::RuntimeOrigin,
call: Call
) -> Result<PostDispatchInfo, TryDispatchError>where
Runtime::RuntimeCall: From<Call>,
pub fn try_dispatch<Call>(
handle: &mut impl PrecompileHandle,
origin: <Runtime::RuntimeCall as Dispatchable>::RuntimeOrigin,
call: Call
) -> Result<PostDispatchInfo, TryDispatchError>where
Runtime::RuntimeCall: From<Call>,
Try to dispatch a Substrate call. Return an error if there are not enough gas, or if the call fails. If successful returns the used gas using the Runtime GasWeightMapping.
source§impl<Runtime> RuntimeHelper<Runtime>where
Runtime: Config,
impl<Runtime> RuntimeHelper<Runtime>where
Runtime: Config,
sourcepub fn db_write_gas_cost() -> u64
pub fn db_write_gas_cost() -> u64
Cost of a Substrate DB write in gas.
sourcepub fn db_read_gas_cost() -> u64
pub fn db_read_gas_cost() -> u64
Cost of a Substrate DB read in gas.
Trait Implementations§
source§impl<Runtime: Clone> Clone for RuntimeHelper<Runtime>
impl<Runtime: Clone> Clone for RuntimeHelper<Runtime>
source§fn clone(&self) -> RuntimeHelper<Runtime>
fn clone(&self) -> RuntimeHelper<Runtime>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Runtime: Debug> Debug for RuntimeHelper<Runtime>
impl<Runtime: Debug> Debug for RuntimeHelper<Runtime>
impl<Runtime: Copy> Copy for RuntimeHelper<Runtime>
Auto Trait Implementations§
impl<Runtime> RefUnwindSafe for RuntimeHelper<Runtime>where
Runtime: RefUnwindSafe,
impl<Runtime> Send for RuntimeHelper<Runtime>where
Runtime: Send,
impl<Runtime> Sync for RuntimeHelper<Runtime>where
Runtime: Sync,
impl<Runtime> Unpin for RuntimeHelper<Runtime>where
Runtime: Unpin,
impl<Runtime> UnwindSafe for RuntimeHelper<Runtime>where
Runtime: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read more§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.