[][src]Trait frame_support::weights::WeightToFeePolynomial

pub trait WeightToFeePolynomial {
    type Balance: BaseArithmetic + From<u32> + Copy + Unsigned;
    fn polynomial() -> WeightToFeeCoefficients<Self::Balance>;

    fn calc(weight: &Weight) -> Self::Balance { ... }
}

A trait that describes the weight to fee calculation as polynomial.

An implementor should only implement the polynomial function.

Associated Types

type Balance: BaseArithmetic + From<u32> + Copy + Unsigned

The type that is returned as result from polynomial evaluation.

Loading content...

Required methods

fn polynomial() -> WeightToFeeCoefficients<Self::Balance>

Returns a polynomial that describes the weight to fee conversion.

This is the only function that should be manually implemented. Please note that all calculation is done in the probably unsigned Balance type. This means that the order of coefficients is important as putting the negative coefficients first will most likely saturate the result to zero mid evaluation.

Loading content...

Provided methods

fn calc(weight: &Weight) -> Self::Balance

Calculates the fee from the passed weight according to the polynomial.

This should not be overriden in most circumstances. Calculation is done in the Balance type and never overflows. All evaluation is saturating.

Loading content...

Implementors

impl<T> WeightToFeePolynomial for IdentityFee<T> where
    T: BaseArithmetic + From<u32> + Copy + Unsigned
[src]

Loading content...