Skip to content
Snippets Groups Projects
Commit be9d1daf authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

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


* Introduce an event for when transaction fees are paid

* Fix

Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
parent 96f24d4f
No related merge requests found
......@@ -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));
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment