Skip to content
Snippets Groups Projects
Commit 677bb624 authored by Éloïs's avatar Éloïs
Browse files

feat(runtimes): distribute tips to block author

parent fda1710c
Branches
Tags
No related merge requests found
......@@ -17,7 +17,7 @@
pub use frame_support::weights::{
Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
};
use sp_arithmetic::traits::{BaseArithmetic, Unsigned};
use sp_arithmetic::traits::{BaseArithmetic, Unsigned, Zero};
pub struct WeightToFeeImpl<T>(sp_std::marker::PhantomData<T>);
......@@ -36,7 +36,7 @@ where
})
}
// Force disable fees
fn calc(weight: &Weight) -> Self::Balance {
fn calc(_weight: &Weight) -> Self::Balance {
Zero::zero()
}
}
......@@ -163,8 +163,19 @@ macro_rules! pallets_config {
type WeightInfo = common_runtime::weights::pallet_balances::WeightInfo<Runtime>;
}
pub struct HandleFees;
type NegativeImbalance = <Balances as frame_support::traits::Currency<AccountId>>::NegativeImbalance;
impl frame_support::traits::OnUnbalanced<NegativeImbalance> for HandleFees {
fn on_nonzero_unbalanced(amount: NegativeImbalance) {
use frame_support::traits::Currency as _;
if let Some(author) = Authorship::author() {
Balances::resolve_creating(&author, amount);
}
}
}
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type OnChargeTransaction = CurrencyAdapter<Balances, HandleFees>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>;
type WeightToFee = common_runtime::fees::WeightToFeeImpl<Balance>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment