Skip to content
Closed
Show file tree
Hide file tree
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
25 changes: 23 additions & 2 deletions runtime/moonbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub mod currency {
pub const UNIT: Balance = 1_000_000_000_000_000_000;
pub const KILOUNIT: Balance = 1_000_000_000_000_000_000_000;

pub const TRANSACTION_BYTE_FEE: Balance = 10 * MICROUNIT * SUPPLY_FACTOR;
pub const TRANSACTION_BYTE_FEE: Balance = 1 * GIGAWEI * SUPPLY_FACTOR; // TODO: review
pub const STORAGE_BYTE_FEE: Balance = 100 * MICROUNIT * SUPPLY_FACTOR;
pub const WEIGHT_FEE: Balance = 50 * KILOWEI * SUPPLY_FACTOR;

Expand Down Expand Up @@ -327,11 +327,32 @@ impl WeightToFeePolynomial for WeightToFee {
}
}

pub struct LengthToFee;
impl WeightToFeePolynomial for LengthToFee {
type Balance = Balance;

fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
smallvec![
WeightToFeeCoefficients {
degree: 1,
coeff_frac: Perbill::zero(),
coeff_integer: currency::TRANSACTION_BYTE_FEE,
negative: false,
},
WeightToFeeCoefficients {
degree: 3,
coeff_frac: Perbill::zero(),
coeff_integer: 1,
negative: false,
},
}
};

impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = IdentityFee<Balance>;
type LengthToFee = LengthToFee;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Runtime>;
}

Expand Down
4 changes: 2 additions & 2 deletions runtime/moonbeam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use frame_support::{
},
weights::{
constants::{RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, GetDispatchInfo, IdentityFee, Weight,
DispatchClass, GetDispatchInfo, IdentityFee, ConstantModifierFee, Weight,
},
PalletId,
};
Expand Down Expand Up @@ -304,9 +304,9 @@ parameter_types! {

impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = IdentityFee<Balance>;
type LengthToFee = ConstantModifierFee<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Runtime>;
}

Expand Down
4 changes: 2 additions & 2 deletions runtime/moonriver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use frame_support::{
},
weights::{
constants::{RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, GetDispatchInfo, IdentityFee, Weight, WeightToFeeCoefficient,
DispatchClass, GetDispatchInfo, IdentityFee, ConstantModifierFee, Weight, WeightToFeeCoefficient,
WeightToFeeCoefficients, WeightToFeePolynomial,
},
PalletId,
Expand Down Expand Up @@ -325,9 +325,9 @@ impl WeightToFeePolynomial for WeightToFee {

impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = IdentityFee<Balance>;
type LengthToFee = ConstantModifierFee<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Runtime>;
}

Expand Down