Crate pallet_transaction_payment
source ·Expand description
§Transaction Payment Pallet
This pallet provides the basic logic needed to pay the absolute minimum amount needed for a transaction to be included. This includes:
- 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
. - weight fee: A fee proportional to amount of weight a transaction consumes.
- length fee: A fee proportional to the encoded length of the transaction.
- tip: An optional tip. Tip increases the priority of the transaction, giving it a higher chance to be included by the transaction queue.
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.
The formula of final fee:
ⓘ
inclusion_fee = base_fee + length_fee + [targeted_fee_adjustment * weight_fee];
final_fee = inclusion_fee + tip;
targeted_fee_adjustment
: This is a multiplier that can tune the final fee based on the congestion of the network.
Additionally, this pallet allows one to configure:
- The mapping between one unit of weight to one unit of fee via
Config::WeightToFee
. - A means of updating the fee for the next block, via defining a multiplier, based on the
final state of the chain at the end of the previous block. This can be configured via
Config::FeeMultiplierUpdate
- How the fees are paid via
Config::OnChargeTransaction
.
Re-exports§
pub use weights::WeightInfo;
pub use pallet::*;
Modules§
- The
pallet
module in each FRAME pallet hosts the most important items needed to construct this pallet. - Autogenerated weights for
pallet_transaction_payment
Structs§
- Require the transactor pay for themselves and maybe include a tip to gain additional priority in the queue.
- A struct to make the fee multiplier a constant
- CurrencyAdapterDeprecatedImplements the transaction payment for a pallet implementing the [
Currency
] trait (eg. the pallet_balances) using an unbalance handler (implementing [OnUnbalanced
]). - The
FeeDetails
is composed of: - Implements transaction payment for a pallet implementing the [
frame_support::traits::fungible
] trait (eg. pallet_balances) using an unbalance handler (implementing [OnUnbalanced
]). - The base fee and adjusted weight and length fees constitute the inclusion fee.
- Information related to a dispatchable’s class, weight, and fee that can be queried from the runtime.
- A struct to update the weight multiplier per block. It implements
Convert<Multiplier, Multiplier>
, meaning that it can convert the previous multiplier to the next one. This should be called onon_finalize
of a block, prior to potentially cleaning the weight data from the system pallet.
Enums§
- The info passed between the prepare and post-dispatch steps for the
ChargeAssetTxPayment
extension. - Storage releases of the pallet.
- The info passed between the validate and prepare steps for the
ChargeAssetTxPayment
extension.
Traits§
- Something that can convert the current multiplier to the next one.
- Handle withdrawing, refunding and depositing of transaction fees.
Type Aliases§
- Fee multiplier.