After paritytech/polkadot#6843 and paritytech/polkadot#7005 have been merged, we will need to look for a place to inform the user of the delivery fees to collect for the XCM executor to send an outgoing XCM.
This new delivery fee is not included in the weight of the extrinsic and is collected separately. The formula for calculating the delivery fee is:
delivery_fee_factor * (base_fee + encoded_msg_len * per_byte_fee)
The base_fee is a set constant in every chain, and is defined as CENTS * 3. The encoded_msg_len can be determined simply by encoding the XCM and checking the resulting encoded blob size in bytes, and the per_byte_fee is just the TransactionByteFee which is defined as 10 * MILLICENTS on every chain.
The only weird one is delivery_fee_factor, but that is also easily fetched by checking the chain state on the DMP pallet (the XCMP queue pallet if on HRMP) via the DeliveryFeeFactor storage map. This map is keyed on the destination's ParaId, and if no entries exist yet for the given parachain, then the delivery fee factor would just be 1.
After paritytech/polkadot#6843 and paritytech/polkadot#7005 have been merged, we will need to look for a place to inform the user of the delivery fees to collect for the XCM executor to send an outgoing XCM.
This new delivery fee is not included in the weight of the extrinsic and is collected separately. The formula for calculating the delivery fee is:
The
base_feeis a set constant in every chain, and is defined asCENTS * 3. Theencoded_msg_lencan be determined simply by encoding the XCM and checking the resulting encoded blob size in bytes, and theper_byte_feeis just theTransactionByteFeewhich is defined as10 * MILLICENTSon every chain.The only weird one is
delivery_fee_factor, but that is also easily fetched by checking the chain state on the DMP pallet (the XCMP queue pallet if on HRMP) via theDeliveryFeeFactorstorage map. This map is keyed on the destination'sParaId, and if no entries exist yet for the given parachain, then the delivery fee factor would just be1.