diff --git a/bin/node/runtime/pangolin/src/lib.rs b/bin/node/runtime/pangolin/src/lib.rs index 6f3af97bb6..206d4b5dec 100644 --- a/bin/node/runtime/pangolin/src/lib.rs +++ b/bin/node/runtime/pangolin/src/lib.rs @@ -133,25 +133,31 @@ pub mod impls { } } - pub struct Author; - impl OnUnbalanced for Author { - fn on_nonzero_unbalanced(amount: NegativeImbalance) { + pub struct ToAuthor; + impl OnUnbalanced for ToAuthor { + fn on_nonzero_unbalanced(amount: RingNegativeImbalance) { + let numeric_amount = amount.peek(); + let author = Authorship::author(); Ring::resolve_creating(&Authorship::author(), amount); + System::deposit_event(>::Deposit( + author, + numeric_amount, + )); } } pub struct DealWithFees; - impl OnUnbalanced for DealWithFees { - fn on_unbalanceds(mut fees_then_tips: impl Iterator) { + impl OnUnbalanced for DealWithFees { + fn on_unbalanceds(mut fees_then_tips: impl Iterator) { if let Some(fees) = fees_then_tips.next() { // for fees, 80% to treasury, 20% to author let mut split = fees.ration(80, 20); if let Some(tips) = fees_then_tips.next() { - // for tips, if any, 80% to treasury, 20% to author (though this can be anything) - tips.ration_merge_into(80, 20, &mut split); + // for tips, if any, 100% to author + tips.merge_into(&mut split.1); } Treasury::on_unbalanced(split.0); - Author::on_unbalanced(split.1); + ToAuthor::on_unbalanced(split.1); } } } diff --git a/bin/node/runtime/pangolin/src/pallets/balances.rs b/bin/node/runtime/pangolin/src/pallets/balances.rs index 7915fc91bc..989e4c24d2 100644 --- a/bin/node/runtime/pangolin/src/pallets/balances.rs +++ b/bin/node/runtime/pangolin/src/pallets/balances.rs @@ -8,7 +8,7 @@ use frame_system::Config as SystemConfig; use crate::*; use darwinia_balances::{weights::SubstrateWeight, Config, Pallet}; -pub type NegativeImbalance = as Currency< +pub type RingNegativeImbalance = as Currency< ::AccountId, >>::NegativeImbalance;