mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 07:31:08 +00:00
Pallet staking events to named enum (#12342)
* Pallet staking events to named enum * fmt * update np staking tests * update remaining events * update benchmarks * Update frame/nomination-pools/test-staking/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/staking/src/pallet/mod.rs * Update frame/staking/src/pallet/mod.rs * Update frame/staking/src/lib.rs * Update frame/staking/src/pallet/impls.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: parity-processbot <> Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
This commit is contained in:
@@ -181,14 +181,20 @@ impl<T: Config> Pallet<T> {
|
||||
let validator_exposure_part = Perbill::from_rational(exposure.own, exposure.total);
|
||||
let validator_staking_payout = validator_exposure_part * validator_leftover_payout;
|
||||
|
||||
Self::deposit_event(Event::<T>::PayoutStarted(era, ledger.stash.clone()));
|
||||
Self::deposit_event(Event::<T>::PayoutStarted {
|
||||
era_index: era,
|
||||
validator_stash: ledger.stash.clone(),
|
||||
});
|
||||
|
||||
let mut total_imbalance = PositiveImbalanceOf::<T>::zero();
|
||||
// We can now make total validator payout:
|
||||
if let Some(imbalance) =
|
||||
Self::make_payout(&ledger.stash, validator_staking_payout + validator_commission_payout)
|
||||
{
|
||||
Self::deposit_event(Event::<T>::Rewarded(ledger.stash, imbalance.peek()));
|
||||
Self::deposit_event(Event::<T>::Rewarded {
|
||||
stash: ledger.stash,
|
||||
amount: imbalance.peek(),
|
||||
});
|
||||
total_imbalance.subsume(imbalance);
|
||||
}
|
||||
|
||||
@@ -208,7 +214,8 @@ impl<T: Config> Pallet<T> {
|
||||
if let Some(imbalance) = Self::make_payout(&nominator.who, nominator_reward) {
|
||||
// Note: this logic does not count payouts for `RewardDestination::None`.
|
||||
nominator_payout_count += 1;
|
||||
let e = Event::<T>::Rewarded(nominator.who.clone(), imbalance.peek());
|
||||
let e =
|
||||
Event::<T>::Rewarded { stash: nominator.who.clone(), amount: imbalance.peek() };
|
||||
Self::deposit_event(e);
|
||||
total_imbalance.subsume(imbalance);
|
||||
}
|
||||
@@ -232,7 +239,7 @@ impl<T: Config> Pallet<T> {
|
||||
let chilled_as_validator = Self::do_remove_validator(stash);
|
||||
let chilled_as_nominator = Self::do_remove_nominator(stash);
|
||||
if chilled_as_validator || chilled_as_nominator {
|
||||
Self::deposit_event(Event::<T>::Chilled(stash.clone()));
|
||||
Self::deposit_event(Event::<T>::Chilled { stash: stash.clone() });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,13 +398,18 @@ impl<T: Config> Pallet<T> {
|
||||
let era_duration = (now_as_millis_u64 - active_era_start).saturated_into::<u64>();
|
||||
let staked = Self::eras_total_stake(&active_era.index);
|
||||
let issuance = T::Currency::total_issuance();
|
||||
let (validator_payout, rest) = T::EraPayout::era_payout(staked, issuance, era_duration);
|
||||
let (validator_payout, remainder) =
|
||||
T::EraPayout::era_payout(staked, issuance, era_duration);
|
||||
|
||||
Self::deposit_event(Event::<T>::EraPaid(active_era.index, validator_payout, rest));
|
||||
Self::deposit_event(Event::<T>::EraPaid {
|
||||
era_index: active_era.index,
|
||||
validator_payout,
|
||||
remainder,
|
||||
});
|
||||
|
||||
// Set ending era reward.
|
||||
<ErasValidatorReward<T>>::insert(&active_era.index, validator_payout);
|
||||
T::RewardRemainder::on_unbalanced(T::Currency::issue(rest));
|
||||
T::RewardRemainder::on_unbalanced(T::Currency::issue(remainder));
|
||||
|
||||
// Clear offending validators.
|
||||
<OffendingValidators<T>>::kill();
|
||||
|
||||
Reference in New Issue
Block a user