From be9d1dafb98becc4cdc757b0ecd14a98a5a9fb17 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Fri, 20 Dec 2019 13:32:34 +0100 Subject: [PATCH] Introduce an event for when transaction fees are paid (#702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Introduce an event for when transaction fees are paid * Fix Co-authored-by: Bastian Köcher --- polkadot/runtime/src/impls.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/polkadot/runtime/src/impls.rs b/polkadot/runtime/src/impls.rs index 3a88b76191..a3ca44d2b2 100644 --- a/polkadot/runtime/src/impls.rs +++ b/polkadot/runtime/src/impls.rs @@ -20,7 +20,7 @@ use primitives::Balance; use sp_runtime::traits::{Convert, Saturating}; use sp_runtime::{Fixed64, Perbill}; use frame_support::weights::Weight; -use frame_support::traits::{OnUnbalanced, Currency, Get}; +use frame_support::traits::{OnUnbalanced, Imbalance, Currency, Get}; use crate::{Balances, System, Authorship, MaximumBlockWeight, NegativeImbalance}; /// Logic for the author to get a portion of fees. @@ -28,7 +28,10 @@ pub struct ToAuthor; impl OnUnbalanced for ToAuthor { fn on_nonzero_unbalanced(amount: NegativeImbalance) { - Balances::resolve_creating(&Authorship::author(), amount); + let numeric_amount = amount.peek(); + let author = Authorship::author(); + Balances::resolve_creating(&author, amount); + System::deposit_event(balances::RawEvent::Deposit(author, numeric_amount)); } }