pub trait OnChargeTransaction<T: Config> {
    type Balance: AtLeast32BitUnsigned + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default + TypeInfo;
    type LiquidityInfo: Default;
    fn withdraw_fee(
        who: &T::AccountId,
        call: &T::Call,
        dispatch_info: &DispatchInfoOf<T::Call>,
        fee: Self::Balance,
        tip: Self::Balance
    ) -> Result<Self::LiquidityInfo, TransactionValidityError>;
fn correct_and_deposit_fee(
        who: &T::AccountId,
        dispatch_info: &DispatchInfoOf<T::Call>,
        post_info: &PostDispatchInfoOf<T::Call>,
        corrected_fee: Self::Balance,
        tip: Self::Balance,
        already_withdrawn: Self::LiquidityInfo
    ) -> Result<(), TransactionValidityError>; }
Expand description

Handle withdrawing, refunding and depositing of transaction fees.

Associated Types

The underlying integer type in which fees are calculated.

Required methods

Before the transaction is executed the payment of the transaction fees need to be secured.

Note: The fee already includes the tip.

After the transaction was executed the actual fee can be calculated. This function should refund any overpaid fees and optionally deposit the corrected amount.

Note: The fee already includes the tip.

Implementors

Default implementation for a Currency and an OnUnbalanced handler.

The unbalance handler is given 2 unbalanceds in OnUnbalanced::on_unbalanceds: fee and then tip.