Trait noble_transaction_payment::OnChargeTransaction[][src]

pub trait OnChargeTransaction<T: Config> {
    type Balance: AtLeast32BitUnsigned + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default;
    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>; }

Handle withdrawing, refunding and depositing of transaction fees.

Associated Types

type Balance: AtLeast32BitUnsigned + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default[src]

The underlying integer type in which fees are calculated.

type LiquidityInfo: Default[src]

Loading content...

Required methods

fn withdraw_fee(
    who: &T::AccountId,
    call: &T::Call,
    dispatch_info: &DispatchInfoOf<T::Call>,
    fee: Self::Balance,
    tip: Self::Balance
) -> Result<Self::LiquidityInfo, TransactionValidityError>
[src]

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

Note: The fee already includes the tip.

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>
[src]

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.

Loading content...

Implementors

impl<T, C, OU> OnChargeTransaction<T> for CurrencyAdapter<C, OU> where
    T: Config,
    T::TransactionByteFee: Get<<C as Currency<<T as Config>::AccountId>>::Balance>,
    C: Currency<<T as Config>::AccountId>,
    C::PositiveImbalance: Imbalance<<C as Currency<<T as Config>::AccountId>>::Balance, Opposite = C::NegativeImbalance>,
    C::NegativeImbalance: Imbalance<<C as Currency<<T as Config>::AccountId>>::Balance, Opposite = C::PositiveImbalance>,
    OU: OnUnbalanced<<C as Currency<<T as Config>::AccountId>>::NegativeImbalance>, 
[src]

Default implementation for a Currency and an OnUnbalanced handler.

type LiquidityInfo = Option<<C as Currency<<T as Config>::AccountId>>::NegativeImbalance>

type Balance = <C as Currency<<T as Config>::AccountId>>::Balance

fn withdraw_fee(
    who: &T::AccountId,
    _call: &T::Call,
    _info: &DispatchInfoOf<T::Call>,
    fee: Self::Balance,
    tip: Self::Balance
) -> Result<Self::LiquidityInfo, TransactionValidityError>
[src]

Withdraw the predicted fee from the transaction origin.

Note: The fee already includes the tip.

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>
[src]

Hand the fee and the tip over to the [OnUnbalanced] implementation. Since the predicted fee might have been too high, parts of the fee may be refunded.

Note: The fee already includes the tip.

Loading content...