Enum pallet_treasury::pallet::Call
source · pub enum Call<T: Config<I>, I: 'static = ()> {
propose_spend {
value: BalanceOf<T, I>,
beneficiary: <<T as Config>::Lookup as StaticLookup>::Source,
},
reject_proposal {
proposal_id: ProposalIndex,
},
approve_proposal {
proposal_id: ProposalIndex,
},
spend_local {
amount: BalanceOf<T, I>,
beneficiary: <<T as Config>::Lookup as StaticLookup>::Source,
},
remove_approval {
proposal_id: ProposalIndex,
},
spend {
asset_kind: Box<T::AssetKind>,
amount: AssetBalanceOf<T, I>,
beneficiary: Box<<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source>,
valid_from: Option<BlockNumberFor<T>>,
},
payout {
index: SpendIndex,
},
check_status {
index: SpendIndex,
},
void_spend {
index: SpendIndex,
},
// some variants omitted
}
Expand description
Contains a variant per dispatchable extrinsic that this pallet has.
Variants§
propose_spend
Put forward a suggestion for spending.
§Dispatch Origin
Must be signed.
§Details
A deposit proportional to the value is reserved and slashed if the proposal is rejected. It is returned once the proposal is awarded.
§Complexity
- O(1)
§Events
Emits Event::Proposed
if successful.
reject_proposal
Fields
proposal_id: ProposalIndex
Reject a proposed spend.
§Dispatch Origin
Must be Config::RejectOrigin
.
§Details
The original deposit will be slashed.
§Complexity
- O(1)
§Events
Emits Event::Rejected
if successful.
approve_proposal
Fields
proposal_id: ProposalIndex
Approve a proposal.
§Dispatch Origin
Must be Config::ApproveOrigin
.
§Details
At a later time, the proposal will be allocated to the beneficiary and the original deposit will be returned.
§Complexity
- O(1).
§Events
No events are emitted from this dispatch.
spend_local
Propose and approve a spend of treasury funds.
§Dispatch Origin
Must be Config::SpendOrigin
with the Success
value being at least amount
.
§Details
NOTE: For record-keeping purposes, the proposer is deemed to be equivalent to the beneficiary.
§Parameters
amount
: The amount to be transferred from the treasury to thebeneficiary
.beneficiary
: The destination account for the transfer.
§Events
Emits Event::SpendApproved
if successful.
remove_approval
Fields
proposal_id: ProposalIndex
Force a previously approved proposal to be removed from the approval queue.
§Dispatch Origin
Must be Config::RejectOrigin
.
§Details
The original deposit will no longer be returned.
§Parameters
proposal_id
: The index of a proposal
§Complexity
- O(A) where
A
is the number of approvals
§Errors
Error::ProposalNotApproved
: Theproposal_id
supplied was not found in the approval queue, i.e., the proposal has not been approved. This could also mean the proposal does not exist altogether, thus there is no way it would have been approved in the first place.
spend
Fields
amount: AssetBalanceOf<T, I>
beneficiary: Box<<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source>
Propose and approve a spend of treasury funds.
§Dispatch Origin
Must be Config::SpendOrigin
with the Success
value being at least
amount
of asset_kind
in the native asset. The amount of asset_kind
is converted
for assertion using the Config::BalanceConverter
.
§Details
Create an approved spend for transferring a specific amount
of asset_kind
to a
designated beneficiary. The spend must be claimed using the payout
dispatchable within
the Config::PayoutPeriod
.
§Parameters
asset_kind
: An indicator of the specific asset class to be spent.amount
: The amount to be transferred from the treasury to thebeneficiary
.beneficiary
: The beneficiary of the spend.valid_from
: The block number from which the spend can be claimed. It can refer to the past if the resulting spend has not yet expired according to theConfig::PayoutPeriod
. IfNone
, the spend can be claimed immediately after approval.
§Events
Emits Event::AssetSpendApproved
if successful.
payout
Fields
index: SpendIndex
Claim a spend.
§Dispatch Origin
Must be signed.
§Details
Spends must be claimed within some temporal bounds. A spend may be claimed within one
Config::PayoutPeriod
from the valid_from
block.
In case of a payout failure, the spend status must be updated with the check_status
dispatchable before retrying with the current function.
§Parameters
index
: The spend index.
§Events
Emits Event::Paid
if successful.
check_status
Fields
index: SpendIndex
Check the status of the spend and remove it from the storage if processed.
§Dispatch Origin
Must be signed.
§Details
The status check is a prerequisite for retrying a failed payout. If a spend has either succeeded or expired, it is removed from the storage by this function. In such instances, transaction fees are refunded.
§Parameters
index
: The spend index.
§Events
Emits Event::PaymentFailed
if the spend payout has failed.
Emits Event::SpendProcessed
if the spend payout has succeed.
void_spend
Fields
index: SpendIndex
Void previously approved spend.
§Dispatch Origin
Must be Config::RejectOrigin
.
§Details
A spend void is only possible if the payout has not been attempted yet.
§Parameters
index
: The spend index.
§Events
Emits Event::AssetSpendVoided
if successful.
Implementations§
source§impl<T: Config<I>, I: 'static> Call<T, I>
impl<T: Config<I>, I: 'static> Call<T, I>
sourcepub fn new_call_variant_propose_spend(
value: BalanceOf<T, I>,
beneficiary: <<T as Config>::Lookup as StaticLookup>::Source
) -> Self
pub fn new_call_variant_propose_spend( value: BalanceOf<T, I>, beneficiary: <<T as Config>::Lookup as StaticLookup>::Source ) -> Self
Create a call with the variant propose_spend
.
sourcepub fn new_call_variant_reject_proposal(proposal_id: ProposalIndex) -> Self
pub fn new_call_variant_reject_proposal(proposal_id: ProposalIndex) -> Self
Create a call with the variant reject_proposal
.
sourcepub fn new_call_variant_approve_proposal(proposal_id: ProposalIndex) -> Self
pub fn new_call_variant_approve_proposal(proposal_id: ProposalIndex) -> Self
Create a call with the variant approve_proposal
.
sourcepub fn new_call_variant_spend_local(
amount: BalanceOf<T, I>,
beneficiary: <<T as Config>::Lookup as StaticLookup>::Source
) -> Self
pub fn new_call_variant_spend_local( amount: BalanceOf<T, I>, beneficiary: <<T as Config>::Lookup as StaticLookup>::Source ) -> Self
Create a call with the variant spend_local
.
sourcepub fn new_call_variant_remove_approval(proposal_id: ProposalIndex) -> Self
pub fn new_call_variant_remove_approval(proposal_id: ProposalIndex) -> Self
Create a call with the variant remove_approval
.
sourcepub fn new_call_variant_spend(
asset_kind: Box<T::AssetKind>,
amount: AssetBalanceOf<T, I>,
beneficiary: Box<<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source>,
valid_from: Option<BlockNumberFor<T>>
) -> Self
pub fn new_call_variant_spend( asset_kind: Box<T::AssetKind>, amount: AssetBalanceOf<T, I>, beneficiary: Box<<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source>, valid_from: Option<BlockNumberFor<T>> ) -> Self
Create a call with the variant spend
.
sourcepub fn new_call_variant_payout(index: SpendIndex) -> Self
pub fn new_call_variant_payout(index: SpendIndex) -> Self
Create a call with the variant payout
.
sourcepub fn new_call_variant_check_status(index: SpendIndex) -> Self
pub fn new_call_variant_check_status(index: SpendIndex) -> Self
Create a call with the variant check_status
.
sourcepub fn new_call_variant_void_spend(index: SpendIndex) -> Self
pub fn new_call_variant_void_spend(index: SpendIndex) -> Self
Create a call with the variant void_spend
.
Trait Implementations§
source§impl<T: Config<I>, I: 'static> CheckIfFeeless for Call<T, I>
impl<T: Config<I>, I: 'static> CheckIfFeeless for Call<T, I>
source§fn is_feeless(&self, origin: &Self::Origin) -> bool
fn is_feeless(&self, origin: &Self::Origin) -> bool
#[pallet::feeless_if]
source§impl<T: Config<I>, I: 'static> Decode for Call<T, I>
impl<T: Config<I>, I: 'static> Decode for Call<T, I>
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>
§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,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
source§impl<T: Config<I>, I: 'static> Encode for Call<T, I>
impl<T: Config<I>, I: 'static> Encode for Call<T, I>
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 )
§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
source§impl<T: Config<I>, I: 'static> GetCallIndex for Call<T, I>
impl<T: Config<I>, I: 'static> GetCallIndex for Call<T, I>
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<I>, I: 'static> GetCallName for Call<T, I>
impl<T: Config<I>, I: 'static> GetCallName for Call<T, I>
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<I>, I: 'static> GetDispatchInfo for Call<T, I>
impl<T: Config<I>, I: 'static> GetDispatchInfo for Call<T, I>
source§fn get_dispatch_info(&self) -> DispatchInfo
fn get_dispatch_info(&self) -> DispatchInfo
DispatchInfo
, containing relevant information of this dispatch. Read moresource§impl<T: Config<I>, I: 'static> PartialEq for Call<T, I>
impl<T: Config<I>, I: 'static> PartialEq for Call<T, I>
source§impl<T, I> TypeInfo for Call<T, I>where
PhantomData<(T, I)>: TypeInfo + 'static,
BalanceOf<T, I>: HasCompact,
<<T as Config>::Lookup as StaticLookup>::Source: TypeInfo + 'static,
Box<T::AssetKind>: TypeInfo + 'static,
AssetBalanceOf<T, I>: HasCompact,
Box<<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source>: TypeInfo + 'static,
Option<BlockNumberFor<T>>: TypeInfo + 'static,
T: Config<I> + 'static,
I: 'static,
impl<T, I> TypeInfo for Call<T, I>where
PhantomData<(T, I)>: TypeInfo + 'static,
BalanceOf<T, I>: HasCompact,
<<T as Config>::Lookup as StaticLookup>::Source: TypeInfo + 'static,
Box<T::AssetKind>: TypeInfo + 'static,
AssetBalanceOf<T, I>: HasCompact,
Box<<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source>: TypeInfo + 'static,
Option<BlockNumberFor<T>>: TypeInfo + 'static,
T: Config<I> + 'static,
I: 'static,
source§impl<T: Config<I>, I: 'static> UnfilteredDispatchable for Call<T, I>
impl<T: Config<I>, I: 'static> UnfilteredDispatchable for Call<T, I>
§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<I>, I: 'static> EncodeLike for Call<T, I>
impl<T: Config<I>, I: 'static> Eq for Call<T, I>
Auto Trait Implementations§
impl<T, I> Freeze for Call<T, I>
impl<T, I> RefUnwindSafe for Call<T, I>where
I: RefUnwindSafe,
T: RefUnwindSafe,
<T as Config<I>>::AssetKind: RefUnwindSafe,
<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance: RefUnwindSafe,
<<T as Config<I>>::Paymaster as Pay>::Balance: RefUnwindSafe,
<<<T as Config>::Block as Block>::Header as Header>::Number: RefUnwindSafe,
<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source: RefUnwindSafe,
<<T as Config>::Lookup as StaticLookup>::Source: RefUnwindSafe,
impl<T, I> Send for Call<T, I>
impl<T, I> Sync for Call<T, I>
impl<T, I> Unpin for Call<T, I>
impl<T, I> UnwindSafe for Call<T, I>where
I: UnwindSafe,
T: UnwindSafe,
<T as Config<I>>::AssetKind: UnwindSafe,
<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance: UnwindSafe,
<<T as Config<I>>::Paymaster as Pay>::Balance: UnwindSafe,
<<<T as Config>::Block as Block>::Header as Header>::Number: UnwindSafe,
<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source: UnwindSafe,
<<T as Config>::Lookup as StaticLookup>::Source: 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
§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>,
§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere
T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
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.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Hashable for Twhere
T: Codec,
impl<T> Hashable for Twhere
T: Codec,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§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> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere
T: Codec,
§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>,
T
. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.§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
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
T
.