diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 4db5e2249..85416bdaf 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -132,7 +132,12 @@ pub mod pallet { /// A payout has been made for the staker. Payout { staker: T::AccountId, - ring_amount: Balance, + amount: Balance, + }, + /// Unable to pay the staker's reward. + Unpaied { + staker: T::AccountId, + amount: Balance, }, /// A new collator set has been elected. Elected { @@ -814,7 +819,12 @@ pub mod pallet { Self::deposit_event(Event::Payout { staker: n_exposure.who, - ring_amount: n_payout, + amount: n_payout, + }); + } else { + Self::deposit_event(Event::Unpaied { + staker: n_exposure.who, + amount: n_payout, }); } } @@ -822,7 +832,9 @@ pub mod pallet { if T::OnSessionEnd::reward(&c, c_payout).is_ok() { actual_payout += c_payout; - Self::deposit_event(Event::Payout { staker: c, ring_amount: c_payout }); + Self::deposit_event(Event::Payout { staker: c, amount: c_payout }); + } else { + Self::deposit_event(Event::Unpaied { staker: c, amount: c_payout }); } } diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index 1a208a7fb..7fafe2ffc 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -79,17 +79,12 @@ impl darwinia_staking::OnSessionEnd for OnCrabSessionEnd { } fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - if let Err(e) = >::transfer( + >::transfer( &Treasury::account_id(), who, amount, frame_support::traits::ExistenceRequirement::KeepAlive, - ) { - // TODO: log - // log::error!("[runtime::staking] reward error: {:?}", e); - } - - Ok(()) + ) } } diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 288b87444..9e2398355 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -95,10 +95,7 @@ impl darwinia_staking::OnSessionEnd for OnDarwiniaSessionEnd { } fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - if let Err(e) = Balances::deposit_into_existing(who, amount) { - // TODO: log - // log::error!("[runtime::staking] reward error: {:?}", e); - } + let _ = Balances::deposit_into_existing(who, amount)?; Ok(()) } diff --git a/runtime/pangolin/src/pallets/staking.rs b/runtime/pangolin/src/pallets/staking.rs index c32927151..fe78c2833 100644 --- a/runtime/pangolin/src/pallets/staking.rs +++ b/runtime/pangolin/src/pallets/staking.rs @@ -73,17 +73,12 @@ impl darwinia_staking::OnSessionEnd for OnPangolinSessionEnd { } fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - if let Err(e) = >::transfer( + >::transfer( &Treasury::account_id(), who, amount, frame_support::traits::ExistenceRequirement::KeepAlive, - ) { - // TODO: log - // log::error!("[runtime::staking] reward error: {:?}", e); - } - - Ok(()) + ) } } diff --git a/runtime/pangoro/src/pallets/staking.rs b/runtime/pangoro/src/pallets/staking.rs index 80ac35445..8deddfaa9 100644 --- a/runtime/pangoro/src/pallets/staking.rs +++ b/runtime/pangoro/src/pallets/staking.rs @@ -91,10 +91,7 @@ impl darwinia_staking::OnSessionEnd for OnPangoroSessionEnd { } fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - if let Err(e) = Balances::deposit_into_existing(who, amount) { - // TODO: log - // log::error!("[runtime::staking] reward error: {:?}", e); - } + let _ = Balances::deposit_into_existing(who, amount)?; Ok(()) }