Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Introduce an event for when transaction fees are paid #702

Merged
merged 3 commits into from
Dec 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ 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.
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));
}
}

Expand Down