mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
Add ConstFeeMultiplier to the transaction payment pallet (#12222)
* fix: FeeMultiplierUpdate * fix: cargo fmt * fix: rustdoc * Revert "fix: rustdoc" This reverts commit 96b6ad80a4cd4d856cf5a830889858c4dd4c385b. * Revert "fix: cargo fmt" This reverts commit 13016527bdbc53d9484642d6b52430550c0efc55. * Revert "fix: FeeMultiplierUpdate" This reverts commit 2cbddd0b85e0293d0eeda859807ddf70cee29067. * feat: add ConstFeeMultiplier * fix: use cConstFeeMultiplier in the template node
This commit is contained in:
@@ -226,6 +226,30 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// A struct to make the fee multiplier a constant
|
||||
pub struct ConstFeeMultiplier<M: Get<Multiplier>>(sp_std::marker::PhantomData<M>);
|
||||
|
||||
impl<M: Get<Multiplier>> MultiplierUpdate for ConstFeeMultiplier<M> {
|
||||
fn min() -> Multiplier {
|
||||
M::get()
|
||||
}
|
||||
fn target() -> Perquintill {
|
||||
Default::default()
|
||||
}
|
||||
fn variability() -> Multiplier {
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl<M> Convert<Multiplier, Multiplier> for ConstFeeMultiplier<M>
|
||||
where
|
||||
M: Get<Multiplier>,
|
||||
{
|
||||
fn convert(_previous: Multiplier) -> Multiplier {
|
||||
Self::min()
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage releases of the pallet.
|
||||
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
|
||||
enum Releases {
|
||||
@@ -371,7 +395,8 @@ pub mod pallet {
|
||||
// add 1 percent;
|
||||
let addition = target / 100;
|
||||
if addition == Weight::zero() {
|
||||
// this is most likely because in a test setup we set everything to ().
|
||||
// this is most likely because in a test setup we set everything to ()
|
||||
// or to `ConstFeeMultiplier`.
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user