mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 11:21:07 +00:00
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:
@@ -20,7 +20,7 @@ use primitives::Balance;
|
|||||||
use sp_runtime::traits::{Convert, Saturating};
|
use sp_runtime::traits::{Convert, Saturating};
|
||||||
use sp_runtime::{Fixed64, Perbill};
|
use sp_runtime::{Fixed64, Perbill};
|
||||||
use frame_support::weights::Weight;
|
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};
|
use crate::{Balances, System, Authorship, MaximumBlockWeight, NegativeImbalance};
|
||||||
|
|
||||||
/// Logic for the author to get a portion of fees.
|
/// Logic for the author to get a portion of fees.
|
||||||
@@ -28,7 +28,10 @@ pub struct ToAuthor;
|
|||||||
|
|
||||||
impl OnUnbalanced<NegativeImbalance> for ToAuthor {
|
impl OnUnbalanced<NegativeImbalance> for ToAuthor {
|
||||||
fn on_nonzero_unbalanced(amount: NegativeImbalance) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user