Type Alias moonriver_runtime::Treasury
source · pub type Treasury = Pallet<Runtime>;
Aliased Type§
struct Treasury(/* private fields */);
Implementations
§impl<T, I> Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> Pallet<T, I>where
T: Config<I>,
I: 'static,
pub fn spend_local(
origin: <T as Config>::RuntimeOrigin,
amount: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance,
beneficiary: <<T as Config>::Lookup as StaticLookup>::Source
) -> Result<(), DispatchError>
pub fn spend_local( origin: <T as Config>::RuntimeOrigin, amount: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, beneficiary: <<T as Config>::Lookup as StaticLookup>::Source ) -> Result<(), DispatchError>
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.
pub fn remove_approval(
origin: <T as Config>::RuntimeOrigin,
proposal_id: u32
) -> Result<(), DispatchError>
pub fn remove_approval( origin: <T as Config>::RuntimeOrigin, proposal_id: u32 ) -> Result<(), DispatchError>
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.
pub fn spend(
origin: <T as Config>::RuntimeOrigin,
asset_kind: Box<<T as Config<I>>::AssetKind>,
amount: <<T as Config<I>>::Paymaster as Pay>::Balance,
beneficiary: Box<<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source>,
valid_from: Option<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>
) -> Result<(), DispatchError>
pub fn spend( origin: <T as Config>::RuntimeOrigin, asset_kind: Box<<T as Config<I>>::AssetKind>, amount: <<T as Config<I>>::Paymaster as Pay>::Balance, beneficiary: Box<<<T as Config<I>>::BeneficiaryLookup as StaticLookup>::Source>, valid_from: Option<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> ) -> Result<(), DispatchError>
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 the [Config::PayoutPeriod
]. IfNone
, the spend can be claimed immediately after approval.
§Events
Emits [Event::AssetSpendApproved
] if successful.
pub fn payout(
origin: <T as Config>::RuntimeOrigin,
index: u32
) -> Result<(), DispatchError>
pub fn payout( origin: <T as Config>::RuntimeOrigin, index: u32 ) -> Result<(), DispatchError>
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.
pub fn check_status(
origin: <T as Config>::RuntimeOrigin,
index: u32
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn check_status( origin: <T as Config>::RuntimeOrigin, index: u32 ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
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.
pub fn void_spend(
origin: <T as Config>::RuntimeOrigin,
index: u32
) -> Result<(), DispatchError>
pub fn void_spend( origin: <T as Config>::RuntimeOrigin, index: u32 ) -> Result<(), DispatchError>
§impl<T, I> Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> Pallet<T, I>where
T: Config<I>,
I: 'static,
pub fn account_id() -> <T as Config>::AccountId
pub fn account_id() -> <T as Config>::AccountId
The account ID of the treasury pot.
This actually does computation. If you need to keep using it, then make sure you cache the value and only call this once.
pub fn proposal_count() -> u32
pub fn proposal_count() -> u32
Public function to proposal_count storage.
pub fn proposals(
index: u32
) -> Option<Proposal<<T as Config>::AccountId, <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance>>
pub fn proposals( index: u32 ) -> Option<Proposal<<T as Config>::AccountId, <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance>>
Public function to proposals storage.
pub fn approvals() -> BoundedVec<u32, <T as Config<I>>::MaxApprovals>
pub fn approvals() -> BoundedVec<u32, <T as Config<I>>::MaxApprovals>
Public function to approvals storage.
pub fn spend_funds() -> Weight
pub fn spend_funds() -> Weight
Spend some money! returns number of approvals before spend.
pub fn pot(
) -> <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance
pub fn pot( ) -> <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance
Return the amount of money in the pot.
Trait Implementations
§impl<T, I> StorageInfoTrait for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> StorageInfoTrait for Pallet<T, I>where
T: Config<I>,
I: 'static,
fn storage_info() -> Vec<StorageInfo>
§impl<T, I> PalletInfoAccess for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> PalletInfoAccess for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn module_name() -> &'static str
fn module_name() -> &'static str
§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
§impl<T, I> WhitelistedStorageKeys for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> WhitelistedStorageKeys for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.§impl<T, I> GetStorageVersion for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> GetStorageVersion for Pallet<T, I>where
T: Config<I>,
I: 'static,
§type InCodeStorageVersion = NoStorageVersionSet
type InCodeStorageVersion = NoStorageVersionSet
§fn in_code_storage_version(
) -> <Pallet<T, I> as GetStorageVersion>::InCodeStorageVersion
fn in_code_storage_version( ) -> <Pallet<T, I> as GetStorageVersion>::InCodeStorageVersion
storage_version
attribute, or
[NoStorageVersionSet
] if the attribute is missing.§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
§fn current_storage_version() -> Self::InCodeStorageVersion
fn current_storage_version() -> Self::InCodeStorageVersion
in_code_storage_version
and will be removed after March 2024.Self::current_storage_version
] instead. Read more§impl<T, I> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn offchain_worker(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
)
fn offchain_worker( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number )
§impl<T, I> OnRuntimeUpgrade for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnRuntimeUpgrade for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade
].§impl<T, I> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§impl<T, I> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_initialize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
) -> Weight
fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number ) -> Weight
§Complexity
O(A)
whereA
is the number of approvals
§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
]). Read more§fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executive
pallet. Read more§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
§fn integrity_test()
fn integrity_test()
§impl<T, I> PalletsInfoAccess for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> PalletsInfoAccess for Pallet<T, I>where
T: Config<I>,
I: 'static,
§impl<T, I> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_initialize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
) -> Weight
fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number ) -> Weight
Hooks::on_initialize
].§impl<T, I> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_finalize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
)
fn on_finalize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number )
Hooks::on_finalize
].§impl<T, I> Callable<T> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> Callable<T> for Pallet<T, I>where
T: Config<I>,
I: 'static,
type RuntimeCall = Call<T, I>
§impl<T, I> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§impl<T, I> OnGenesis for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnGenesis for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_genesis()
fn on_genesis()
§impl<T, I> OnUnbalanced<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::NegativeImbalance> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnUnbalanced<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::NegativeImbalance> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_nonzero_unbalanced(
amount: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::NegativeImbalance
)
fn on_nonzero_unbalanced( amount: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::NegativeImbalance )
on_unbalanced
.§fn on_unbalanceds(amounts: impl Iterator<Item = Imbalance>)where
Imbalance: TryMerge,
fn on_unbalanceds(amounts: impl Iterator<Item = Imbalance>)where
Imbalance: TryMerge,
§fn on_unbalanced(amount: Imbalance)
fn on_unbalanced(amount: Imbalance)
§impl<T, I> PartialEq for Pallet<T, I>
impl<T, I> PartialEq for Pallet<T, I>
impl<T, I> Eq for Pallet<T, I>
§impl<T, I> BeforeAllRuntimeMigrations for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> BeforeAllRuntimeMigrations for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
§impl<T, I> IntegrityTest for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> IntegrityTest for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn integrity_test()
fn integrity_test()
Hooks::integrity_test
].