Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
emit TipClosed event on success tip payout
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc committed Apr 16, 2020
1 parent 9209998 commit f05650d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions frame/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ decl_module! {
// closed.
Reasons::<T>::remove(&tip.reason);
Tips::<T>::remove(hash);
Self::payout_tip(tip);
Self::payout_tip(hash, tip);
}

fn on_initialize(n: T::BlockNumber) -> Weight {
Expand Down Expand Up @@ -627,7 +627,7 @@ impl<T: Trait> Module<T> {
///
/// Up to three balance operations.
/// Plus `O(T)` (`T` is Tippers length).
fn payout_tip(tip: OpenTip<T::AccountId, BalanceOf<T>, T::BlockNumber, T::Hash>) {
fn payout_tip(hash: T::Hash, tip: OpenTip<T::AccountId, BalanceOf<T>, T::BlockNumber, T::Hash>) {
let mut tips = tip.tips;
Self::retain_active_tips(&mut tips);
tips.sort_by_key(|i| i.1);
Expand All @@ -647,6 +647,7 @@ impl<T: Trait> Module<T> {
}
// same as above: best-effort only.
let _ = T::Currency::transfer(&treasury, &tip.who, payout, KeepAlive);
Self::deposit_event(RawEvent::TipClosed(hash, tip.who, payout));
}

// Spend some money!
Expand Down

0 comments on commit f05650d

Please sign in to comment.