2
if !missed_any {
    // 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;

    let (debit, credit) = T::Currency::pair(burn);
    imbalance.subsume(debit);
    T::BurnDestination::on_unbalanced(credit);
    Self::deposit_event(Event::Burnt { burnt_funds: burn })
}

Upper code is taken from treasury pallet. I checked the balances pallet, but can not find the pair call. Can anyone explain how this pair call works? I'll be appreciated if anyone can point out the source of this function. Thanks in advance.

1 Answer 1

1

In the treasury pallet the Currency trait is imported from the frame support pallet (see import here).

If you go to the source code of the FRAME support pallet, you can check the Currency trait and associated types, and the pair():

    /// Produce a pair of imbalances that cancel each other out exactly.
    ///
    /// This is just the same as burning and issuing the same amount and has no effect on the
    /// total issuance.
    fn pair(amount: Self::Balance) -> (Self::PositiveImbalance, Self::NegativeImbalance) {
        (Self::burn(amount), Self::issue(amount))
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.