pub enum Call<T: Config> {
batch {
calls: Vec<<T as Config>::RuntimeCall>,
},
as_derivative {
index: u16,
call: Box<<T as Config>::RuntimeCall>,
},
batch_all {
calls: Vec<<T as Config>::RuntimeCall>,
},
dispatch_as {
as_origin: Box<T::PalletsOrigin>,
call: Box<<T as Config>::RuntimeCall>,
},
force_batch {
calls: Vec<<T as Config>::RuntimeCall>,
},
with_weight {
call: Box<<T as Config>::RuntimeCall>,
weight: Weight,
},
if_else {
main: Box<<T as Config>::RuntimeCall>,
fallback: Box<<T as Config>::RuntimeCall>,
},
dispatch_as_fallible {
as_origin: Box<T::PalletsOrigin>,
call: Box<<T as Config>::RuntimeCall>,
},
// some variants omitted
}
Expand description
Contains a variant per dispatchable extrinsic that this pallet has.
Variants§
batch
Send a batch of dispatch calls.
May be called from any origin except None
.
calls
: The calls to be dispatched from the same origin. The number of call must not exceed the constant:batched_calls_limit
(available in constant metadata).
If origin is root then the calls are dispatched without checking origin filter. (This
includes bypassing frame_system::Config::BaseCallFilter
).
§Complexity
- O(C) where C is the number of calls to be batched.
This will return Ok
in all circumstances. To determine the success of the batch, an
event is deposited. If a call failed and the batch was interrupted, then the
BatchInterrupted
event is deposited, along with the number of successful calls made
and the error of the failed call. If all were successful, then the BatchCompleted
event is deposited.
Fields
calls: Vec<<T as Config>::RuntimeCall>
as_derivative
Send a call through an indexed pseudonym of the sender.
Filter from origin are passed along. The call will be dispatched with an origin which use the same filter as the origin of this call.
NOTE: If you need to ensure that any account-based filtering is not honored (i.e.
because you expect proxy
to have been used prior in the call stack and you do not want
the call restrictions to apply to any sub-accounts), then use as_multi_threshold_1
in the Multisig pallet instead.
NOTE: Prior to version *12, this was called as_limited_sub
.
The dispatch origin for this call must be Signed.
batch_all
Send a batch of dispatch calls and atomically execute them. The whole transaction will rollback and fail if any of the calls failed.
May be called from any origin except None
.
calls
: The calls to be dispatched from the same origin. The number of call must not exceed the constant:batched_calls_limit
(available in constant metadata).
If origin is root then the calls are dispatched without checking origin filter. (This
includes bypassing frame_system::Config::BaseCallFilter
).
§Complexity
- O(C) where C is the number of calls to be batched.
Fields
calls: Vec<<T as Config>::RuntimeCall>
dispatch_as
Dispatches a function call with a provided origin.
The dispatch origin for this call must be Root.
§Complexity
- O(1).
force_batch
Send a batch of dispatch calls.
Unlike batch
, it allows errors and won’t interrupt.
May be called from any origin except None
.
calls
: The calls to be dispatched from the same origin. The number of call must not exceed the constant:batched_calls_limit
(available in constant metadata).
If origin is root then the calls are dispatch without checking origin filter. (This
includes bypassing frame_system::Config::BaseCallFilter
).
§Complexity
- O(C) where C is the number of calls to be batched.
Fields
calls: Vec<<T as Config>::RuntimeCall>
with_weight
Dispatch a function call with a specified weight.
This function does not check the weight of the call, and instead allows the Root origin to specify the weight of the call.
The dispatch origin for this call must be Root.
if_else
Dispatch a fallback call in the event the main call fails to execute.
May be called from any origin except None
.
This function first attempts to dispatch the main
call.
If the main
call fails, the fallback
is attemted.
if the fallback is successfully dispatched, the weights of both calls
are accumulated and an event containing the main call error is deposited.
In the event of a fallback failure the whole call fails with the weights returned.
main
: The main call to be dispatched. This is the primary action to execute.fallback
: The fallback call to be dispatched in case themain
call fails.
§Dispatch Logic
- If the origin is
root
, both the main and fallback calls are executed without applying any origin filters. - If the origin is not
root
, the origin filter is applied to both themain
andfallback
calls.
§Use Case
- Some use cases might involve submitting a
batch
type call in either main, fallback or both.
dispatch_as_fallible
Dispatches a function call with a provided origin.
Almost the same as Pallet::dispatch_as
but forwards any error of the inner call.
The dispatch origin for this call must be Root.
Implementations§
Source§impl<T: Config> Call<T>
impl<T: Config> Call<T>
Sourcepub fn new_call_variant_batch(calls: Vec<<T as Config>::RuntimeCall>) -> Self
pub fn new_call_variant_batch(calls: Vec<<T as Config>::RuntimeCall>) -> Self
Create a call with the variant batch
.
Sourcepub fn new_call_variant_as_derivative(
index: u16,
call: Box<<T as Config>::RuntimeCall>,
) -> Self
pub fn new_call_variant_as_derivative( index: u16, call: Box<<T as Config>::RuntimeCall>, ) -> Self
Create a call with the variant as_derivative
.
Sourcepub fn new_call_variant_batch_all(
calls: Vec<<T as Config>::RuntimeCall>,
) -> Self
pub fn new_call_variant_batch_all( calls: Vec<<T as Config>::RuntimeCall>, ) -> Self
Create a call with the variant batch_all
.
Sourcepub fn new_call_variant_dispatch_as(
as_origin: Box<T::PalletsOrigin>,
call: Box<<T as Config>::RuntimeCall>,
) -> Self
pub fn new_call_variant_dispatch_as( as_origin: Box<T::PalletsOrigin>, call: Box<<T as Config>::RuntimeCall>, ) -> Self
Create a call with the variant dispatch_as
.
Sourcepub fn new_call_variant_force_batch(
calls: Vec<<T as Config>::RuntimeCall>,
) -> Self
pub fn new_call_variant_force_batch( calls: Vec<<T as Config>::RuntimeCall>, ) -> Self
Create a call with the variant force_batch
.
Sourcepub fn new_call_variant_with_weight(
call: Box<<T as Config>::RuntimeCall>,
weight: Weight,
) -> Self
pub fn new_call_variant_with_weight( call: Box<<T as Config>::RuntimeCall>, weight: Weight, ) -> Self
Create a call with the variant with_weight
.
Sourcepub fn new_call_variant_if_else(
main: Box<<T as Config>::RuntimeCall>,
fallback: Box<<T as Config>::RuntimeCall>,
) -> Self
pub fn new_call_variant_if_else( main: Box<<T as Config>::RuntimeCall>, fallback: Box<<T as Config>::RuntimeCall>, ) -> Self
Create a call with the variant if_else
.
Sourcepub fn new_call_variant_dispatch_as_fallible(
as_origin: Box<T::PalletsOrigin>,
call: Box<<T as Config>::RuntimeCall>,
) -> Self
pub fn new_call_variant_dispatch_as_fallible( as_origin: Box<T::PalletsOrigin>, call: Box<<T as Config>::RuntimeCall>, ) -> Self
Create a call with the variant dispatch_as_fallible
.
Trait Implementations§
Source§impl<T: Config> Authorize for Call<T>
impl<T: Config> Authorize for Call<T>
Source§impl<T: Config> CheckIfFeeless for Call<T>
impl<T: Config> CheckIfFeeless for Call<T>
Source§type Origin = <T as Config>::RuntimeOrigin
type Origin = <T as Config>::RuntimeOrigin
Source§fn is_feeless(&self, origin: &Self::Origin) -> bool
fn is_feeless(&self, origin: &Self::Origin) -> bool
#[pallet::feeless_if]
Source§impl<T: Config> Decode for Call<T>
impl<T: Config> Decode for Call<T>
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl<T: Config> Encode for Call<T>
impl<T: Config> Encode for Call<T>
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl<T: Config> GetCallIndex for Call<T>
impl<T: Config> GetCallIndex for Call<T>
Source§fn get_call_index(&self) -> u8
fn get_call_index(&self) -> u8
Source§fn get_call_indices() -> &'static [u8] ⓘ
fn get_call_indices() -> &'static [u8] ⓘ
GetCallName
.Source§impl<T: Config> GetCallName for Call<T>
impl<T: Config> GetCallName for Call<T>
Source§fn get_call_name(&self) -> &'static str
fn get_call_name(&self) -> &'static str
Source§fn get_call_names() -> &'static [&'static str]
fn get_call_names() -> &'static [&'static str]
GetCallIndex
.Source§impl<T: Config> GetDispatchInfo for Call<T>
impl<T: Config> GetDispatchInfo for Call<T>
Source§fn get_dispatch_info(&self) -> DispatchInfo
fn get_dispatch_info(&self) -> DispatchInfo
DispatchInfo
, containing relevant information of this dispatch. Read moreSource§impl<T> TypeInfo for Call<T>where
PhantomData<(T,)>: TypeInfo + 'static,
Vec<<T as Config>::RuntimeCall>: TypeInfo + 'static,
Box<<T as Config>::RuntimeCall>: TypeInfo + 'static,
Box<T::PalletsOrigin>: TypeInfo + 'static,
T: Config + 'static,
impl<T> TypeInfo for Call<T>where
PhantomData<(T,)>: TypeInfo + 'static,
Vec<<T as Config>::RuntimeCall>: TypeInfo + 'static,
Box<<T as Config>::RuntimeCall>: TypeInfo + 'static,
Box<T::PalletsOrigin>: TypeInfo + 'static,
T: Config + 'static,
Source§impl<T: Config> UnfilteredDispatchable for Call<T>
impl<T: Config> UnfilteredDispatchable for Call<T>
Source§type RuntimeOrigin = <T as Config>::RuntimeOrigin
type RuntimeOrigin = <T as Config>::RuntimeOrigin
frame_system::Config::RuntimeOrigin
).Source§fn dispatch_bypass_filter(
self,
origin: Self::RuntimeOrigin,
) -> DispatchResultWithPostInfo
fn dispatch_bypass_filter( self, origin: Self::RuntimeOrigin, ) -> DispatchResultWithPostInfo
impl<T: Config> DecodeWithMemTracking for Call<T>where
Vec<<T as Config>::RuntimeCall>: DecodeWithMemTracking,
Box<<T as Config>::RuntimeCall>: DecodeWithMemTracking,
Box<T::PalletsOrigin>: DecodeWithMemTracking,
impl<T: Config> EncodeLike for Call<T>
impl<T: Config> Eq for Call<T>
Auto Trait Implementations§
impl<T> Freeze for Call<T>
impl<T> RefUnwindSafe for Call<T>where
<T as Config>::RuntimeEvent: Sized,
T: RefUnwindSafe,
<T as Config>::RuntimeCall: RefUnwindSafe,
<T as Config>::PalletsOrigin: RefUnwindSafe,
impl<T> Send for Call<T>where
<T as Config>::RuntimeEvent: Sized,
T: Send,
<T as Config>::RuntimeCall: Send,
<T as Config>::PalletsOrigin: Send,
impl<T> Sync for Call<T>where
<T as Config>::RuntimeEvent: Sized,
T: Sync,
<T as Config>::RuntimeCall: Sync,
<T as Config>::PalletsOrigin: Sync,
impl<T> Unpin for Call<T>
impl<T> UnwindSafe for Call<T>where
<T as Config>::RuntimeEvent: Sized,
T: UnwindSafe,
<T as Config>::RuntimeCall: UnwindSafe,
<T as Config>::PalletsOrigin: 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
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> DecodeWithMemLimit for Twhere
T: DecodeWithMemTracking,
impl<T> DecodeWithMemLimit for Twhere
T: DecodeWithMemTracking,
Source§impl<T, U> DefensiveTruncateInto<U> for Twhere
U: DefensiveTruncateFrom<T>,
impl<T, U> DefensiveTruncateInto<U> for Twhere
U: DefensiveTruncateFrom<T>,
Source§fn defensive_truncate_into(self) -> U
fn defensive_truncate_into(self) -> U
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§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>
Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.