[][src]Struct pallet_transaction_payment::Module

pub struct Module<T: Trait>(_);

Implementations

impl<T: Trait + 'static> Module<T>[src]

pub fn next_fee_multiplier() -> Multiplier[src]

impl<T: Trait> Module<T> where
    <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance: FixedPointOperand
[src]

pub fn query_info<Extrinsic: GetDispatchInfo>(
    unchecked_extrinsic: Extrinsic,
    len: u32
) -> RuntimeDispatchInfo<<<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance> where
    T: Send + Sync,
    <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance: Send + Sync,
    T::Call: Dispatchable<Info = DispatchInfo>, 
[src]

Query the data that we know about the fee of a given call.

This module is not and cannot be aware of the internals of a signed extension, for example a tip. It only interprets the extrinsic as some encoded value and accounts for its weight and length, the runtime's extrinsic base weight, and the current fee multiplier.

All dispatchables must be annotated with weight and will have some fee info. This function always returns.

pub fn compute_fee(
    len: u32,
    info: &DispatchInfoOf<T::Call>,
    tip: <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance
) -> <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance where
    T::Call: Dispatchable<Info = DispatchInfo>, 
[src]

Compute the final fee value for a particular transaction.

The final fee is composed of:

  • base_fee: This is the minimum amount a user pays for a transaction. It is declared as a base weight in the runtime and converted to a fee using WeightToFee.
  • len_fee: The length fee, the amount paid for the encoded length (in bytes) of the transaction.
  • weight_fee: This amount is computed based on the weight of the transaction. Weight accounts for the execution time of a transaction.
  • targeted_fee_adjustment: This is a multiplier that can tune the final fee based on the congestion of the network.
  • (Optional) tip: If included in the transaction, the tip will be added on top. Only signed transactions can have a tip.

The base fee and adjusted weight and length fees constitute the inclusion fee, which is the minimum fee for a transaction to be included in a block.

This example is not tested
inclusion_fee = base_fee + len_fee + [targeted_fee_adjustment * weight_fee];
final_fee = inclusion_fee + tip;

pub fn compute_actual_fee(
    len: u32,
    info: &DispatchInfoOf<T::Call>,
    post_info: &PostDispatchInfoOf<T::Call>,
    tip: <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance
) -> <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance where
    T::Call: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>, 
[src]

Compute the actual post dispatch fee for a particular transaction.

Identical to compute_fee with the only difference that the post dispatch corrected weight is used for the weight fee calculation.

Trait Implementations

impl<T: Trait> Callable<T> for Module<T>[src]

type Call = Call<T>

impl<T: Clone + Trait> Clone for Module<T>[src]

impl<T> Convert<u64, <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance> for Module<T> where
    T: Trait,
    <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance: FixedPointOperand
[src]

fn convert(
    weight: Weight
) -> <<T as Trait>::Currency as Currency<<T as Trait>::AccountId>>::Balance
[src]

Compute the fee for the specified weight.

This fee is already adjusted by the per block fee adjustment factor and is therefore the share that the weight contributes to the overall fee of a transaction. It is mainly for informational purposes and not used in the actual fee calculation.

impl<T: Copy + Trait> Copy for Module<T>[src]

impl<T: Trait> Debug for Module<T> where
    T: Debug
[src]

impl<T: Eq + Trait> Eq for Module<T>[src]

impl<T: Trait> IntegrityTest for Module<T>[src]

impl<T: Trait> ModuleErrorMetadata for Module<T>[src]

impl<T: Trait> OffchainWorker<<T as Trait>::BlockNumber> for Module<T>[src]

impl<T: Trait> OnFinalize<<T as Trait>::BlockNumber> for Module<T>[src]

impl<T: Trait> OnInitialize<<T as Trait>::BlockNumber> for Module<T>[src]

impl<T: Trait> OnRuntimeUpgrade for Module<T>[src]

impl<T: PartialEq + Trait> PartialEq<Module<T>> for Module<T>[src]

impl<T: Trait> StructuralEq for Module<T>[src]

impl<T: Trait> StructuralPartialEq for Module<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Module<T> where
    T: RefUnwindSafe

impl<T> Send for Module<T> where
    T: Send

impl<T> Sync for Module<T> where
    T: Sync

impl<T> Unpin for Module<T> where
    T: Unpin

impl<T> UnwindSafe for Module<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe
[src]

impl<T> Member for T where
    T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> SaturatedConversion for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]