pub trait WeightToFeePolynomial {
    type Balance: BaseArithmetic + From<u32> + Copy + Unsigned;

    // Required method
    fn polynomial() -> SmallVec<[WeightToFeeCoefficient<Self::Balance>; 4]>;
}
Expand description

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

An implementor should only implement the polynomial function.

Required Associated Types§

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

The type that is returned as result from polynomial evaluation.

Required Methods§

fn polynomial() -> SmallVec<[WeightToFeeCoefficient<Self::Balance>; 4]>

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> WeightToFeePolynomial for WeightToFeeImpl<T>
where T: BaseArithmetic + From<u64> + Copy + Unsigned + From<u32> + MultiplyRational,

Implementors§