Crate pallet_asset_tx_payment

Source
Expand description

§Asset Transaction Payment Pallet

This pallet allows runtimes that include it to pay for transactions in assets other than the main token of the chain.

§Overview

It does this by extending transactions to include an optional AssetId that specifies the asset to be used for payment (defaulting to the native token on None). It expects an OnChargeAssetTransaction implementation analogously to [pallet-transaction-payment]. The included FungiblesAdapter (implementing OnChargeAssetTransaction) determines the fee amount by converting the fee calculated by [pallet-transaction-payment] into the desired asset.

§Integration

This pallet wraps FRAME’s transaction payment pallet and functions as a replacement. This means you should include both pallets in your construct_runtime macro, but only include this pallet’s TransactionExtension (ChargeAssetTxPayment).

Re-exports§

pub use weights::WeightInfo;
pub use pallet::*;

Modules§

pallet
The pallet module in each FRAME pallet hosts the most important items needed to construct this pallet.
weights
Autogenerated weights for pallet_asset_tx_payment

Structs§

ChargeAssetTxPayment
Require the transactor pay for themselves and maybe include a tip to gain additional priority in the queue. Allows paying via both Currency as well as fungibles::Balanced.
FungiblesAdapter
Implements the asset transaction for a balance to asset converter (implementing ConversionToAssetBalance) and a credit handler (implementing HandleCredit).

Enums§

InitialPayment
Used to pass the initial payment info from pre- to post-dispatch.
Pre
The info passed between the prepare and post-dispatch steps for the ChargeAssetTxPayment extension.
Val
The info passed between the validate and prepare steps for the ChargeAssetTxPayment extension.

Traits§

HandleCredit
Allows specifying what to do with the withdrawn asset fees.
OnChargeAssetTransaction
Handle withdrawing, refunding and depositing of transaction fees.