pub type Module<T, I = ()> = Pallet<T, I>;
Pallet
insteadExpand description
Type alias to Pallet
, to be used by construct_runtime
.
Generated by pallet
attribute macro.
Aliased Type§
struct Module<T, I = ()>(/* private fields */);
Implementations
Source§impl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
Sourcepub fn propose_bounty(
origin: OriginFor<T>,
value: BalanceOf<T, I>,
description: Vec<u8>,
) -> DispatchResult
pub fn propose_bounty( origin: OriginFor<T>, value: BalanceOf<T, I>, description: Vec<u8>, ) -> DispatchResult
Propose a new bounty.
The dispatch origin for this call must be Signed.
Payment: TipReportDepositBase
will be reserved from the origin account, as well as
DataDepositPerByte
for each byte in reason
. It will be unreserved upon approval,
or slashed when rejected.
curator
: The curator account whom will manage this bounty.fee
: The curator fee.value
: The total payment amount of this bounty, curator fee included.description
: The description of this bounty.
Sourcepub fn approve_bounty(
origin: OriginFor<T>,
bounty_id: BountyIndex,
) -> DispatchResult
pub fn approve_bounty( origin: OriginFor<T>, bounty_id: BountyIndex, ) -> DispatchResult
Approve a bounty proposal. At a later time, the bounty will be funded and become active and the original deposit will be returned.
May only be called from T::SpendOrigin
.
§Complexity
- O(1).
Sourcepub fn propose_curator(
origin: OriginFor<T>,
bounty_id: BountyIndex,
curator: <<T as Config>::Lookup as StaticLookup>::Source,
fee: BalanceOf<T, I>,
) -> DispatchResult
pub fn propose_curator( origin: OriginFor<T>, bounty_id: BountyIndex, curator: <<T as Config>::Lookup as StaticLookup>::Source, fee: BalanceOf<T, I>, ) -> DispatchResult
Sourcepub fn unassign_curator(
origin: OriginFor<T>,
bounty_id: BountyIndex,
) -> DispatchResult
pub fn unassign_curator( origin: OriginFor<T>, bounty_id: BountyIndex, ) -> DispatchResult
Unassign curator from a bounty.
This function can only be called by the RejectOrigin
a signed origin.
If this function is called by the RejectOrigin
, we assume that the curator is
malicious or inactive. As a result, we will slash the curator when possible.
If the origin is the curator, we take this as a sign they are unable to do their job and they willingly give up. We could slash them, but for now we allow them to recover their deposit and exit without issue. (We may want to change this if it is abused.)
Finally, the origin can be anyone if and only if the curator is “inactive”. This allows anyone in the community to call out that a curator is not doing their due diligence, and we should pick a new curator. In this case the curator should also be slashed.
§Complexity
- O(1).
Sourcepub fn accept_curator(
origin: OriginFor<T>,
bounty_id: BountyIndex,
) -> DispatchResult
pub fn accept_curator( origin: OriginFor<T>, bounty_id: BountyIndex, ) -> DispatchResult
Accept the curator role for a bounty. A deposit will be reserved from curator and refund upon successful payout.
May only be called from the curator.
§Complexity
- O(1).
Sourcepub fn award_bounty(
origin: OriginFor<T>,
bounty_id: BountyIndex,
beneficiary: <<T as Config>::Lookup as StaticLookup>::Source,
) -> DispatchResult
pub fn award_bounty( origin: OriginFor<T>, bounty_id: BountyIndex, beneficiary: <<T as Config>::Lookup as StaticLookup>::Source, ) -> DispatchResult
Award bounty to a beneficiary account. The beneficiary will be able to claim the funds after a delay.
The dispatch origin for this call must be the curator of this bounty.
bounty_id
: Bounty ID to award.beneficiary
: The beneficiary account whom will receive the payout.
§Complexity
- O(1).
Sourcepub fn claim_bounty(
origin: OriginFor<T>,
bounty_id: BountyIndex,
) -> DispatchResult
pub fn claim_bounty( origin: OriginFor<T>, bounty_id: BountyIndex, ) -> DispatchResult
Claim the payout from an awarded bounty after payout delay.
The dispatch origin for this call must be the beneficiary of this bounty.
bounty_id
: Bounty ID to claim.
§Complexity
- O(1).
Sourcepub fn close_bounty(
origin: OriginFor<T>,
bounty_id: BountyIndex,
) -> DispatchResultWithPostInfo
pub fn close_bounty( origin: OriginFor<T>, bounty_id: BountyIndex, ) -> DispatchResultWithPostInfo
Cancel a proposed or active bounty. All the funds will be sent to treasury and the curator deposit will be unreserved if possible.
Only T::RejectOrigin
is able to cancel a bounty.
bounty_id
: Bounty ID to cancel.
§Complexity
- O(1).
Sourcepub fn extend_bounty_expiry(
origin: OriginFor<T>,
bounty_id: BountyIndex,
_remark: Vec<u8>,
) -> DispatchResult
pub fn extend_bounty_expiry( origin: OriginFor<T>, bounty_id: BountyIndex, _remark: Vec<u8>, ) -> DispatchResult
Extend the expiry time of an active bounty.
The dispatch origin for this call must be the curator of this bounty.
bounty_id
: Bounty ID to extend.remark
: additional information.
§Complexity
- O(1).
Sourcepub fn approve_bounty_with_curator(
origin: OriginFor<T>,
bounty_id: BountyIndex,
curator: <<T as Config>::Lookup as StaticLookup>::Source,
fee: BalanceOf<T, I>,
) -> DispatchResult
pub fn approve_bounty_with_curator( origin: OriginFor<T>, bounty_id: BountyIndex, curator: <<T as Config>::Lookup as StaticLookup>::Source, fee: BalanceOf<T, I>, ) -> DispatchResult
Approve bountry and propose a curator simultaneously.
This call is a shortcut to calling approve_bounty
and propose_curator
separately.
May only be called from T::SpendOrigin
.
bounty_id
: Bounty ID to approve.curator
: The curator account whom will manage this bounty.fee
: The curator fee.
§Complexity
- O(1).
Source§impl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
Sourcepub fn do_try_state() -> Result<(), TryRuntimeError>
pub fn do_try_state() -> Result<(), TryRuntimeError>
Ensure the correctness of the state of this pallet.
This should be valid before or after each state transition of this pallet.
Source§impl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
Sourcepub fn treasury_block_number() -> <<T as Config<I>>::BlockNumberProvider as BlockNumberProvider>::BlockNumber
pub fn treasury_block_number() -> <<T as Config<I>>::BlockNumberProvider as BlockNumberProvider>::BlockNumber
Get the block number used in the treasury pallet.
It may be configured to use the relay chain block number on a parachain.
Sourcepub fn calculate_curator_deposit(fee: &BalanceOf<T, I>) -> BalanceOf<T, I>
pub fn calculate_curator_deposit(fee: &BalanceOf<T, I>) -> BalanceOf<T, I>
Calculate the deposit required for a curator.
Sourcepub fn account_id() -> T::AccountId
pub fn account_id() -> T::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.
Sourcepub fn bounty_account_id(id: BountyIndex) -> T::AccountId
pub fn bounty_account_id(id: BountyIndex) -> T::AccountId
The account ID of a bounty account
Trait Implementations
Source§impl<T: Config<I>, I: 'static> BeforeAllRuntimeMigrations for Pallet<T, I>
impl<T: Config<I>, I: 'static> BeforeAllRuntimeMigrations for Pallet<T, I>
Source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
Source§impl<T, I: 'static> Benchmarking for Pallet<T, I>where
T: Config + Config<I>,
impl<T, I: 'static> Benchmarking for Pallet<T, I>where
T: Config + Config<I>,
Source§impl<T: Config<I>, I: 'static> Callable<T> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Callable<T> for Pallet<T, I>
type RuntimeCall = Call<T, I>
Source§impl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>
impl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>
Source§type InCodeStorageVersion = StorageVersion
type InCodeStorageVersion = StorageVersion
Source§fn in_code_storage_version() -> Self::InCodeStorageVersion
fn in_code_storage_version() -> Self::InCodeStorageVersion
storage_version
attribute, or
[NoStorageVersionSet
] if the attribute is missing.Source§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 moreSource§impl<T: Config<I>, I: 'static> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn try_state(_n: SystemBlockNumberFor<T>) -> Result<(), TryRuntimeError>
fn try_state(_n: SystemBlockNumberFor<T>) -> Result<(), TryRuntimeError>
§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
§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 pre_upgrade() -> Result<Vec<u8>, DispatchError>
fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
§fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>
fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>
§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
§fn integrity_test()
fn integrity_test()
Source§impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
Source§fn integrity_test()
fn integrity_test()
Hooks::integrity_test
].Source§impl<T: Config<I>, I: 'static> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
Source§impl<T: Config<I>, I: 'static> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize
].Source§impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
Source§fn on_genesis()
fn on_genesis()
Source§impl<T: Config<I>, I: 'static> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize
].Source§impl<T: Config<I>, I: 'static> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
Source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade
].§fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
pre_upgrade
->
on_runtime_upgrade
-> post_upgrade
hooks for a migration. Read moreSource§impl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>
impl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>
Source§fn module_name() -> &'static str
fn module_name() -> &'static str
Source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
Source§impl<T: Config<I>, I: 'static> SpendFunds<T, I> for Pallet<T, I>
impl<T: Config<I>, I: 'static> SpendFunds<T, I> for Pallet<T, I>
fn spend_funds( budget_remaining: &mut BalanceOf<T, I>, imbalance: &mut PositiveImbalanceOf<T, I>, total_weight: &mut Weight, missed_any: &mut bool, )
Source§impl<T: Config<I>, I: 'static> StorageInfoTrait for Pallet<T, I>
impl<T: Config<I>, I: 'static> StorageInfoTrait for Pallet<T, I>
fn storage_info() -> Vec<StorageInfo>
Source§impl<T: Config<I>, I: 'static> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> WhitelistedStorageKeys for Pallet<T, I>
impl<T: Config<I>, I: 'static> WhitelistedStorageKeys for Pallet<T, I>
Source§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.