referrerpolicy=no-referrer-when-downgrade
pallet_transaction_payment

Type Alias Multiplier

Source
pub type Multiplier = FixedU128;
Expand description

Fee multiplier.

Aliased Type§

struct Multiplier(/* private fields */);

Implementations

§

impl FixedU128

pub const fn from_inner(inner: u128) -> FixedU128

Create a new instance from the given inner value.

const version of FixedPointNumber::from_inner.

pub const fn into_inner(self) -> u128

Return the instance’s inner value.

const version of FixedPointNumber::into_inner.

pub const fn from_u32(n: u32) -> FixedU128

Creates self from a u32.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub fn from_float(x: f64) -> FixedU128

Convert from a float value.

pub const fn from_perbill(n: Perbill) -> FixedU128

Convert from a Perbill value.

pub const fn into_perbill(self) -> Perbill

Convert into a Perbill value. Will saturate if above one or below zero.

pub fn to_float(self) -> f64

Convert into a float value.

pub fn try_into_perthing<P>(self) -> Result<P, P>
where P: PerThing,

Attempt to convert into a PerThing. This will succeed iff self is at least zero and at most one. If it is out of bounds, it will result in an error returning the clamped value.

pub fn into_clamped_perthing<P>(self) -> P
where P: PerThing,

Attempt to convert into a PerThing. This will always succeed resulting in a clamped value if self is less than zero or greater than one.

pub const fn neg(self) -> FixedU128

Negate the value.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub const fn sqrt(self) -> FixedU128

Take the square root of a positive value.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub const fn try_sqrt(self) -> Option<FixedU128>

👎Deprecated: try_sqrt will be removed after October 2025. Use checked_sqrt instead.

pub const fn checked_sqrt(self) -> Option<FixedU128>

Compute the square root. If it overflows or is negative, then None is returned.

pub const fn add(self, rhs: FixedU128) -> FixedU128

Add a value and return the result.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub const fn sub(self, rhs: FixedU128) -> FixedU128

Subtract a value and return the result.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub const fn mul(self, rhs: FixedU128) -> FixedU128

Multiply by a value and return the result.

Result will be rounded to the nearest representable value, rounding down if it is equidistant between two neighbours.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub const fn div(self, rhs: FixedU128) -> FixedU128

Divide by a value and return the result.

Result will be rounded to the nearest representable value, rounding down if it is equidistant between two neighbours.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub const fn from_rational(a: u128, b: u128) -> FixedU128

Calculate an approximation of a rational.

Result will be rounded to the nearest representable value, rounding down if it is equidistant between two neighbours.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub const fn from_rational_with_rounding( a: u128, b: u128, rounding: Rounding, ) -> FixedU128

Calculate an approximation of a rational with custom rounding.

WARNING: This is a const function designed for convenient use at build time and will panic on overflow. Ensure that any inputs are sensible.

pub const fn const_checked_mul(self, other: FixedU128) -> Option<FixedU128>

Multiply by another value, returning None in the case of an error.

Result will be rounded to the nearest representable value, rounding down if it is equidistant between two neighbours.

pub const fn const_checked_mul_with_rounding( self, other: FixedU128, rounding: SignedRounding, ) -> Option<FixedU128>

Multiply by another value with custom rounding, returning None in the case of an error.

Result will be rounded to the nearest representable value, rounding down if it is equidistant between two neighbours.

pub const fn const_checked_div(self, other: FixedU128) -> Option<FixedU128>

Divide by another value, returning None in the case of an error.

Result will be rounded to the nearest representable value, rounding down if it is equidistant between two neighbours.

pub const fn checked_rounding_div( self, other: FixedU128, rounding: SignedRounding, ) -> Option<FixedU128>

Divide by another value with custom rounding, returning None in the case of an error.

Result will be rounded to the nearest representable value, rounding down if it is equidistant between two neighbours.

Trait Implementations

§

impl Add for FixedU128

§

type Output = FixedU128

The resulting type after applying the + operator.
§

fn add(self, rhs: FixedU128) -> <FixedU128 as Add>::Output

Performs the + operation. Read more
§

impl Bounded for FixedU128

§

fn min_value() -> FixedU128

Returns the smallest finite number this type can represent
§

fn max_value() -> FixedU128

Returns the largest finite number this type can represent
§

impl CheckedAdd for FixedU128

§

fn checked_add(&self, rhs: &FixedU128) -> Option<FixedU128>

Adds two numbers, checking for overflow. If overflow happens, None is returned.
§

impl CheckedDiv for FixedU128

§

fn checked_div(&self, other: &FixedU128) -> Option<FixedU128>

Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned.
§

impl CheckedMul for FixedU128

§

fn checked_mul(&self, other: &FixedU128) -> Option<FixedU128>

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.
§

impl CheckedSub for FixedU128

§

fn checked_sub(&self, rhs: &FixedU128) -> Option<FixedU128>

Subtracts two numbers, checking for underflow. If underflow happens, None is returned.
§

impl Clone for FixedU128

§

fn clone(&self) -> FixedU128

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl CompactAs for FixedU128

§

type As = u128

A compact-encodable type that should be used as the encoding.
§

fn encode_as(&self) -> &u128

Returns the compact-encodable type.
§

fn decode_from(x: u128) -> Result<FixedU128, Error>

Decode Self from the compact-decoded type.
§

impl Debug for FixedU128

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Decode for FixedU128

§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<FixedU128, Error>
where __CodecInputEdqy: Input,

Attempt to deserialise the value from input.
§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
§

impl Default for FixedU128

§

fn default() -> FixedU128

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for FixedU128

§

fn deserialize<D>( deserializer: D, ) -> Result<FixedU128, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for FixedU128

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Div for FixedU128

§

type Output = FixedU128

The resulting type after applying the / operator.
§

fn div(self, rhs: FixedU128) -> <FixedU128 as Div>::Output

Performs the / operation. Read more
§

impl Encode for FixedU128

§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
§

fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
where __CodecOutputEdqy: Output + ?Sized,

Convert self to a slice and append it to the destination.
§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
§

fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
where __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn,

Convert self to a slice and then invoke the given closure with it.
§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
§

impl FixedPointNumber for FixedU128

§

const DIV: <FixedU128 as FixedPointNumber>::Inner = {transmute(0x00000000000000000de0b6b3a7640000): <sp_runtime::FixedU128 as sp_runtime::FixedPointNumber>::Inner}

Precision of this fixed point implementation. It should be a power of 10.
§

const SIGNED: bool = false

Indicates if this fixed point implementation is signed or not.
§

type Inner = u128

The underlying data type used for this fixed point number.
§

fn from_inner(inner: <FixedU128 as FixedPointNumber>::Inner) -> FixedU128

Builds this type from an integer number.
§

fn into_inner(self) -> <FixedU128 as FixedPointNumber>::Inner

Consumes self and returns the inner raw value.
§

fn checked_sqrt(self) -> Option<FixedU128>

Compute the square root. If it overflows or is negative, then None is returned.
§

fn accuracy() -> Self::Inner

Precision of this fixed point implementation.
§

fn saturating_from_integer<N>(int: N) -> Self
where N: FixedPointOperand,

Creates self from an integer number int. Read more
§

fn checked_from_integer<N>(int: N) -> Option<Self>
where N: Into<Self::Inner>,

Creates self from an integer number int. Read more
§

fn saturating_from_rational<N, D>(n: N, d: D) -> Self
where N: FixedPointOperand, D: FixedPointOperand,

Creates self from a rational number. Equal to n / d. Read more
§

fn checked_from_rational<N, D>(n: N, d: D) -> Option<Self>
where N: FixedPointOperand, D: FixedPointOperand,

Creates self from a rational number. Equal to n / d. Read more
§

fn checked_mul_int<N>(self, n: N) -> Option<N>
where N: FixedPointOperand,

Checked multiplication for integer type N. Equal to self * n. Read more
§

fn saturating_mul_int<N>(self, n: N) -> N
where N: FixedPointOperand,

Saturating multiplication for integer type N. Equal to self * n. Read more
§

fn checked_div_int<N>(self, d: N) -> Option<N>
where N: FixedPointOperand,

Checked division for integer type N. Equal to self / d. Read more
§

fn saturating_div_int<N>(self, d: N) -> N
where N: FixedPointOperand,

Saturating division for integer type N. Equal to self / d. Read more
§

fn saturating_mul_acc_int<N>(self, n: N) -> N
where N: FixedPointOperand,

Saturating multiplication for integer type N, adding the result back. Equal to self * n + n. Read more
§

fn saturating_abs(self) -> Self

Saturating absolute value. Read more
§

fn reciprocal(self) -> Option<Self>

Takes the reciprocal (inverse). Equal to 1 / self. Read more
§

fn is_one(&self) -> bool

Checks if the number is one.
§

fn is_positive(self) -> bool

Returns true if self is positive and false if the number is zero or negative.
§

fn is_negative(self) -> bool

Returns true if self is negative and false if the number is zero or positive.
§

fn trunc(self) -> Self

Returns the integer part.
§

fn frac(self) -> Self

Returns the fractional part. Read more
§

fn ceil(self) -> Self

Returns the smallest integer greater than or equal to a number. Read more
§

fn floor(self) -> Self

Returns the largest integer less than or equal to a number. Read more
§

fn round(self) -> Self

Returns the number rounded to the nearest integer. Rounds half-way cases away from 0.0. Read more
§

impl<N, D> From<(N, D)> for FixedU128
where N: FixedPointOperand, D: FixedPointOperand,

§

fn from(r: (N, D)) -> FixedU128

Converts to this type from the input type.
§

impl From<Compact<FixedU128>> for FixedU128

§

fn from(x: Compact<FixedU128>) -> FixedU128

Converts to this type from the input type.
§

impl<P> From<P> for FixedU128
where P: PerThing, <P as PerThing>::Inner: FixedPointOperand,

§

fn from(p: P) -> FixedU128

Converts to this type from the input type.
§

impl From<u128> for FixedU128

§

fn from(int: u128) -> FixedU128

Converts to this type from the input type.
§

impl FromStr for FixedU128

§

type Err = &'static str

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<FixedU128, <FixedU128 as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl MaxEncodedLen for FixedU128

§

fn max_encoded_len() -> usize

Upper bound, in bytes, of the maximum encoded size of this item.
§

impl Mul for FixedU128

§

type Output = FixedU128

The resulting type after applying the * operator.
§

fn mul(self, rhs: FixedU128) -> <FixedU128 as Mul>::Output

Performs the * operation. Read more
§

impl Neg for FixedU128

§

type Output = FixedU128

The resulting type after applying the - operator.
§

fn neg(self) -> <FixedU128 as Neg>::Output

Performs the unary - operation. Read more
§

impl One for FixedU128

§

fn one() -> FixedU128

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
§

impl Ord for FixedU128

§

fn cmp(&self, other: &FixedU128) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl PartialEq for FixedU128

§

fn eq(&self, other: &FixedU128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd for FixedU128

§

fn partial_cmp(&self, other: &FixedU128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl Saturating for FixedU128

§

fn saturating_add(self, rhs: FixedU128) -> FixedU128

Saturating addition. Compute self + rhs, saturating at the numeric bounds instead of overflowing.
§

fn saturating_sub(self, rhs: FixedU128) -> FixedU128

Saturating subtraction. Compute self - rhs, saturating at the numeric bounds instead of overflowing.
§

fn saturating_mul(self, rhs: FixedU128) -> FixedU128

Saturating multiply. Compute self * rhs, saturating at the numeric bounds instead of overflowing.
§

fn saturating_pow(self, exp: usize) -> FixedU128

Saturating exponentiation. Compute self.pow(exp), saturating at the numeric bounds instead of overflowing.
§

fn saturating_less_one(self) -> Self
where Self: One,

Decrement self by one, saturating at zero.
§

fn saturating_plus_one(self) -> Self
where Self: One,

Increment self by one, saturating at the numeric bounds instead of overflowing.
§

fn saturating_inc(&mut self)
where Self: One,

Increment self by one, saturating.
§

fn saturating_dec(&mut self)
where Self: One,

Decrement self by one, saturating at zero.
§

fn saturating_accrue(&mut self, amount: Self)
where Self: One,

Increment self by some amount, saturating.
§

fn saturating_reduce(&mut self, amount: Self)
where Self: One,

Decrement self by some amount, saturating at zero.
§

impl Serialize for FixedU128

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Sub for FixedU128

§

type Output = FixedU128

The resulting type after applying the - operator.
§

fn sub(self, rhs: FixedU128) -> <FixedU128 as Sub>::Output

Performs the - operation. Read more
§

impl TypeInfo for FixedU128

§

type Identity = FixedU128

The type identifying for which type info is provided. Read more
§

fn type_info() -> Type

Returns the static type identifier for Self.
§

impl Zero for FixedU128

§

fn zero() -> FixedU128

Returns the additive identity element of Self, 0. Read more
§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
§

impl Copy for FixedU128

§

impl DecodeWithMemTracking for FixedU128

§

impl EncodeLike for FixedU128

§

impl Eq for FixedU128

§

impl StructuralPartialEq for FixedU128