mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Treasury burning can be directed (#6671)
* Treasury burning can be directed Also, Society is a imbalance handler * Build * Introduce from_permill in perthings. * Rename to from_perthousand to avoid confusion with Permill * Fixes
This commit is contained in:
@@ -184,6 +184,9 @@ pub trait Trait: frame_system::Trait {
|
||||
/// Percentage of spare funds (if any) that are burnt per spend period.
|
||||
type Burn: Get<Permill>;
|
||||
|
||||
/// Handler for the unbalanced decrease when treasury funds are burned.
|
||||
type BurnDestination: OnUnbalanced<NegativeImbalanceOf<Self>>;
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
@@ -771,7 +774,10 @@ impl<T: Trait> Module<T> {
|
||||
// burn some proportion of the remaining budget if we run a surplus.
|
||||
let burn = (T::Burn::get() * budget_remaining).min(budget_remaining);
|
||||
budget_remaining -= burn;
|
||||
imbalance.subsume(T::Currency::burn(burn));
|
||||
|
||||
let (debit, credit) = T::Currency::pair(burn);
|
||||
imbalance.subsume(debit);
|
||||
T::BurnDestination::on_unbalanced(credit);
|
||||
Self::deposit_event(RawEvent::Burnt(burn))
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ impl Trait for Test {
|
||||
type ProposalBondMinimum = ProposalBondMinimum;
|
||||
type SpendPeriod = SpendPeriod;
|
||||
type Burn = Burn;
|
||||
type BurnDestination = (); // Just gets burned.
|
||||
type WeightInfo = ();
|
||||
}
|
||||
type System = frame_system::Module<Test>;
|
||||
|
||||
Reference in New Issue
Block a user