mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
Add slashing events to elections-phragmen. (#7543)
* Add slashing events to elections-phragmen. * Fix build * Apply suggestions from code review * Update frame/elections-phragmen/src/lib.rs * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -682,6 +682,10 @@ decl_event!(
|
||||
/// A \[member\] has been removed. This should always be followed by either `NewTerm` or
|
||||
/// `EmptyTerm`.
|
||||
MemberKicked(AccountId),
|
||||
/// A candidate was slashed due to failing to obtain a seat as member or runner-up
|
||||
CandidateSlashed(AccountId, Balance),
|
||||
/// A seat holder (member or runner-up) was slashed due to failing to retaining their position.
|
||||
SeatHolderSlashed(AccountId, Balance),
|
||||
/// A \[member\] has renounced their candidacy.
|
||||
MemberRenounced(AccountId),
|
||||
/// A voter was reported with the the report being successful or not.
|
||||
@@ -995,6 +999,7 @@ impl<T: Trait> Module<T> {
|
||||
new_runners_up_ids_sorted.binary_search(&c).is_err()
|
||||
{
|
||||
let (imbalance, _) = T::Currency::slash_reserved(&c, T::CandidacyBond::get());
|
||||
Self::deposit_event(RawEvent::CandidateSlashed(c, T::CandidacyBond::get()));
|
||||
T::LoserCandidate::on_unbalanced(imbalance);
|
||||
}
|
||||
});
|
||||
@@ -1002,6 +1007,7 @@ impl<T: Trait> Module<T> {
|
||||
// Burn outgoing bonds
|
||||
to_burn_bond.into_iter().for_each(|x| {
|
||||
let (imbalance, _) = T::Currency::slash_reserved(&x, T::CandidacyBond::get());
|
||||
Self::deposit_event(RawEvent::SeatHolderSlashed(x, T::CandidacyBond::get()));
|
||||
T::LoserCandidate::on_unbalanced(imbalance);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user