Unverified Commit 5f5b8eac 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 7f1881c5
Pipeline #72680 passed with stages
in 19 minutes and 5 seconds
......@@ -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));
}
}
......
Supports Markdown
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