Trait frame_support::traits::tokens::imbalance::OnUnbalanced

source ·
pub trait OnUnbalanced<Imbalance: TryDrop> {
    // Provided methods
    fn on_unbalanceds(amounts: impl Iterator<Item = Imbalance>)
       where Imbalance: TryMerge { ... }
    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§

source

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

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.

source

fn on_unbalanced(amount: Imbalance)

Handler for some imbalance. Infallible.

source

fn on_nonzero_unbalanced(amount: Imbalance)

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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

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

Implementors§

source§

impl<A: TypedGet, F: Balanced<A::Type>> OnUnbalanced<Imbalance<<F as Inspect<<A as TypedGet>::Type>>::Balance, <F as Balanced<<A as TypedGet>::Type>>::OnDropCredit, <F as Balanced<<A as TypedGet>::Type>>::OnDropDebt>> for ResolveTo<A, F>

source§

impl<A: TypedGet, F: Balanced<A::Type>> OnUnbalanced<Imbalance<<F as Inspect<<A as TypedGet>::Type>>::AssetId, <F as Inspect<<A as TypedGet>::Type>>::Balance, <F as Balanced<<A as TypedGet>::Type>>::OnDropCredit, <F as Balanced<<A as TypedGet>::Type>>::OnDropDebt>> for ResolveAssetTo<A, F>

source§

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