mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +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:
@@ -264,11 +264,12 @@ use frame_support::{decl_error, decl_module, decl_storage, decl_event, ensure, d
|
||||
use frame_support::weights::Weight;
|
||||
use frame_support::traits::{
|
||||
Currency, ReservableCurrency, Randomness, Get, ChangeMembers, BalanceStatus,
|
||||
ExistenceRequirement::AllowDeath, EnsureOrigin
|
||||
ExistenceRequirement::AllowDeath, EnsureOrigin, OnUnbalanced, Imbalance
|
||||
};
|
||||
use frame_system::{self as system, ensure_signed, ensure_root};
|
||||
|
||||
type BalanceOf<T, I> = <<T as Trait<I>>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
|
||||
type NegativeImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
|
||||
|
||||
/// The module's configuration trait.
|
||||
pub trait Trait<I=DefaultInstance>: system::Trait {
|
||||
@@ -1143,6 +1144,8 @@ decl_event! {
|
||||
NewMaxMembers(u32),
|
||||
/// Society is unfounded.
|
||||
Unfounded(AccountId),
|
||||
/// Some funds were deposited into the society account.
|
||||
Deposit(Balance),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1665,3 +1668,14 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> OnUnbalanced<NegativeImbalanceOf<T>> for Module<T> {
|
||||
fn on_nonzero_unbalanced(amount: NegativeImbalanceOf<T>) {
|
||||
let numeric_amount = amount.peek();
|
||||
|
||||
// Must resolve into existing but better to be safe.
|
||||
let _ = T::Currency::resolve_creating(&Self::account_id(), amount);
|
||||
|
||||
Self::deposit_event(RawEvent::Deposit(numeric_amount));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user