tuple to struct event variants (#10206)

* update sudo pallet

* Update mock.rs

* cargo +nightly fmt

* frame-support remote-externalities

* AFNPEV tips

* AFNPEV bin & update sudo

* cargo +nightly fmt

* optional dependency remote-test feature

* fmt

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Doordashcon
2021-11-12 00:48:37 +01:00
committed by GitHub
parent 4aae801ccf
commit 112b7dac47
7 changed files with 51 additions and 41 deletions
+20 -16
View File
@@ -179,16 +179,16 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A new tip suggestion has been opened. \[tip_hash\]
NewTip(T::Hash),
/// A tip suggestion has reached threshold and is closing. \[tip_hash\]
TipClosing(T::Hash),
/// A tip suggestion has been closed. \[tip_hash, who, payout\]
TipClosed(T::Hash, T::AccountId, BalanceOf<T>),
/// A tip suggestion has been retracted. \[tip_hash\]
TipRetracted(T::Hash),
/// A tip suggestion has been slashed. \[tip_hash, finder, deposit\]
TipSlashed(T::Hash, T::AccountId, BalanceOf<T>),
/// A new tip suggestion has been opened.
NewTip { tip_hash: T::Hash },
/// A tip suggestion has reached threshold and is closing.
TipClosing { tip_hash: T::Hash },
/// A tip suggestion has been closed.
TipClosed { tip_hash: T::Hash, who: T::AccountId, payout: BalanceOf<T> },
/// A tip suggestion has been retracted.
TipRetracted { tip_hash: T::Hash },
/// A tip suggestion has been slashed.
TipSlashed { tip_hash: T::Hash, finder: T::AccountId, deposit: BalanceOf<T> },
}
/// Old name generated by `decl_event`.
@@ -265,7 +265,7 @@ pub mod pallet {
finders_fee: true,
};
Tips::<T>::insert(&hash, tip);
Self::deposit_event(Event::NewTip(hash));
Self::deposit_event(Event::NewTip { tip_hash: hash });
Ok(())
}
@@ -300,7 +300,7 @@ pub mod pallet {
let err_amount = T::Currency::unreserve(&who, tip.deposit);
debug_assert!(err_amount.is_zero());
}
Self::deposit_event(Event::TipRetracted(hash));
Self::deposit_event(Event::TipRetracted { tip_hash: hash });
Ok(())
}
@@ -340,7 +340,7 @@ pub mod pallet {
let hash = T::Hashing::hash_of(&(&reason_hash, &who));
Reasons::<T>::insert(&reason_hash, &reason);
Self::deposit_event(Event::NewTip(hash.clone()));
Self::deposit_event(Event::NewTip { tip_hash: hash.clone() });
let tips = vec![(tipper.clone(), tip_value)];
let tip = OpenTip {
reason: reason_hash,
@@ -390,7 +390,7 @@ pub mod pallet {
let mut tip = Tips::<T>::get(hash).ok_or(Error::<T>::UnknownTip)?;
if Self::insert_tip_and_check_closing(&mut tip, tipper, tip_value) {
Self::deposit_event(Event::TipClosing(hash.clone()));
Self::deposit_event(Event::TipClosing { tip_hash: hash.clone() });
}
Tips::<T>::insert(&hash, tip);
Ok(())
@@ -449,7 +449,11 @@ pub mod pallet {
T::OnSlash::on_unbalanced(imbalance);
}
Reasons::<T>::remove(&tip.reason);
Self::deposit_event(Event::TipSlashed(hash, tip.finder, tip.deposit));
Self::deposit_event(Event::TipSlashed {
tip_hash: hash,
finder: tip.finder,
deposit: tip.deposit,
});
Ok(())
}
}
@@ -544,7 +548,7 @@ impl<T: Config> Pallet<T> {
// same as above: best-effort only.
let res = T::Currency::transfer(&treasury, &tip.who, payout, KeepAlive);
debug_assert!(res.is_ok());
Self::deposit_event(Event::TipClosed(hash, tip.who, payout));
Self::deposit_event(Event::TipClosed { tip_hash: hash, who: tip.who, payout });
}
pub fn migrate_retract_tip_for_tip_new(module: &[u8], item: &[u8]) {