Skip to content

Commit 5f5b8ea

Browse files
gavofyorkbkchr
andauthored
Introduce an event for when transaction fees are paid (paritytech#702)
* Introduce an event for when transaction fees are paid * Fix Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
1 parent 7f1881c commit 5f5b8ea

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

runtime/src/impls.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ use primitives::Balance;
2020
use sp_runtime::traits::{Convert, Saturating};
2121
use sp_runtime::{Fixed64, Perbill};
2222
use frame_support::weights::Weight;
23-
use frame_support::traits::{OnUnbalanced, Currency, Get};
23+
use frame_support::traits::{OnUnbalanced, Imbalance, Currency, Get};
2424
use crate::{Balances, System, Authorship, MaximumBlockWeight, NegativeImbalance};
2525

2626
/// Logic for the author to get a portion of fees.
2727
pub struct ToAuthor;
2828

2929
impl OnUnbalanced<NegativeImbalance> for ToAuthor {
3030
fn on_nonzero_unbalanced(amount: NegativeImbalance) {
31-
Balances::resolve_creating(&Authorship::author(), amount);
31+
let numeric_amount = amount.peek();
32+
let author = Authorship::author();
33+
Balances::resolve_creating(&author, amount);
34+
System::deposit_event(balances::RawEvent::Deposit(author, numeric_amount));
3235
}
3336
}
3437

0 commit comments

Comments
 (0)