mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
emit TipClosed event on success tip payout (#5656)
* emit TipClosed event on success tip payout * test for events * bump version
This commit is contained in:
@@ -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 {
|
||||
@@ -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);
|
||||
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user