1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use smallvec::smallvec;
use frame_support::weights::{
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
};
use pallet_transaction_payment::{Config, CurrencyAdapter};
use sp_runtime::Perbill;
use crate::*;
pub struct WeightToFee;
impl WeightToFeePolynomial for WeightToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
let p = 100 * MILLI;
let q = Balance::from(ExtrinsicBaseWeight::get());
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
}
frame_support::parameter_types! {
pub const TransactionByteFee: Balance = 5 * MILLI;
pub const OperationalFeeMultiplier: u8 = 5;
}
impl Config for Runtime {
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type OnChargeTransaction = CurrencyAdapter<Ring, DealWithFees<Self>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
}