pub trait OnUnbalanced<Imbalance>where
    Imbalance: TryDrop,{
    // Provided methods
    fn on_unbalanceds<B>(amounts: impl Iterator<Item = Imbalance>)
       where Imbalance: Imbalance<B> { ... }
    fn on_unbalanced(amount: Imbalance) { ... }
    fn on_nonzero_unbalanced(amount: Imbalance) { ... }
}
Expand description

Handler for when some currency “account” decreased in balance for some reason.

The only reason at present for an increase would be for validator rewards, but there may be other reasons in the future or for other chains.

Reasons for decreases include:

  • Someone got slashed.
  • Someone paid for a transaction to be included.

Provided Methods§

fn on_unbalanceds<B>(amounts: impl Iterator<Item = Imbalance>)where Imbalance: Imbalance<B>,

Handler for some imbalances. The different imbalances might have different origins or meanings, dependent on the context. Will default to simply calling on_unbalanced for all of them. Infallible.

fn on_unbalanced(amount: Imbalance)

Handler for some imbalance. Infallible.

fn on_nonzero_unbalanced(amount: Imbalance)

Actually handle a non-zero imbalance. You probably want to implement this rather than on_unbalanced.

Implementations on Foreign Types§

§

impl<Imbalance> OnUnbalanced<Imbalance> for ()where Imbalance: TryDrop,

§

impl<R> OnUnbalanced<<Pallet<R, ()> as Currency<<R as Config>::AccountId>>::NegativeImbalance> for ToAuthor<R>where R: Config<()> + Config, <R as Config>::AccountId: From<<<MultiSignature as Verify>::Signer as IdentifyAccount>::AccountId> + Into<<<MultiSignature as Verify>::Signer as IdentifyAccount>::AccountId>,

§

fn on_nonzero_unbalanced( amount: <Pallet<R, ()> as Currency<<R as Config>::AccountId>>::NegativeImbalance )

§

impl<R> OnUnbalanced<<Pallet<R, ()> as Currency<<R as Config>::AccountId>>::NegativeImbalance> for DealWithFees<R>where R: Config<()> + Config<()> + Config, Pallet<R, ()>: OnUnbalanced<<Pallet<R, ()> as Currency<<R as Config>::AccountId>>::NegativeImbalance>, <R as Config>::AccountId: From<<<MultiSignature as Verify>::Signer as IdentifyAccount>::AccountId> + Into<<<MultiSignature as Verify>::Signer as IdentifyAccount>::AccountId>,

§

fn on_unbalanceds<B>( fees_then_tips: impl Iterator<Item = <Pallet<R, ()> as Currency<<R as Config>::AccountId>>::NegativeImbalance> )

§

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 )

§

impl<T, C> OnUnbalanced<ImbalanceBeneficiary<T, C>> for ImbalanceToBeneficiary<T>where T: Config<Currency = C>, C: Currency<<T as Config>::AccountId>,

§

fn on_unbalanceds<B>( fees_then_tips: impl Iterator<Item = ImbalanceBeneficiary<T, C>> )

§

fn on_nonzero_unbalanced(amount: ImbalanceBeneficiary<T, C>)

Implementors§

source§

impl OnUnbalanced<<Pallet<Runtime, ()> as Currency<<<MultiSignature as Verify>::Signer as IdentifyAccount>::AccountId>>::NegativeImbalance> for ToStakingPot

§

impl<Balance, I, Target1, Target2, const PART1: u32, const PART2: u32> OnUnbalanced<I> for SplitTwoWays<Balance, I, Target1, Target2, PART1, PART2>where Balance: From<u32> + Saturating + Div<Balance, Output = Balance>, I: Imbalance<Balance>, Target1: OnUnbalanced<I>, Target2: OnUnbalanced<I>,