Expand description

Asset Conversion Transaction Payment Pallet

This pallet allows runtimes that include it to pay for transactions in assets other than the chain’s native asset.

Overview

This pallet provides a SignedExtension with an optional AssetId that specifies the asset to be used for payment (defaulting to the native token on None). It expects an OnChargeAssetTransaction implementation analogous to [pallet-transaction-payment]. The included AssetConversionAdapter (implementing OnChargeAssetTransaction) determines the fee amount by converting the fee calculated by [pallet-transaction-payment] in the native asset into the amount required of the specified asset.

Pallet API

This pallet does not have any dispatchable calls or storage. It 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 SignedExtension (ChargeAssetTxPayment).

Terminology

  • Native Asset or Native Currency: The asset that a chain considers native, as in its default for transaction fee payment, deposits, inflation, etc.
  • Other assets: Other assets that may exist on chain, for example under the Assets pallet.

Re-exports

Modules

  • The pallet module in each FRAME pallet hosts the most important items needed to construct this pallet.

Structs

  • Implements the asset transaction for a balance to asset converter (implementing [Swap]).
  • Require payment for transaction inclusion and optionally include a tip to gain additional priority in the queue. Allows paying via both Currency as well as fungibles::Balanced.

Enums

  • Used to pass the initial payment info from pre- to post-dispatch.

Traits