Introduce an event for when transaction fees are paid (#702)

* Introduce an event for when transaction fees are paid

* Fix

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Gavin Wood
2019-12-20 13:32:34 +01:00
committed by GitHub
parent 96f24d4fe7
commit be9d1dafb9
+5 -2
View File
@@ -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<NegativeImbalance> 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));
}
}