mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
[pallet-xcm] fix transport fees for remote reserve transfers (#3792)
Currently `transfer_assets` from pallet-xcm covers 4 main different transfer types: - `localReserve` - `DestinationReserve` - `Teleport` - `RemoteReserve` For the first three, the local execution and the remote message sending are separated, and fees are deducted in pallet-xcm itself: https://github.com/paritytech/polkadot-sdk/blob/3410dfb3929462da88be2da813f121d8b1cf46b3/polkadot/xcm/pallet-xcm/src/lib.rs#L1758. For the 4th case `RemoteReserve`, pallet-xcm is still relying on the xcm-executor itself to send the message (through the `initiateReserveWithdraw` instruction). In this case, if delivery fees need to be charged, it is not possible to do so because the `jit_withdraw` mode has not being set. This PR proposes to still use the `initiateReserveWithdraw` but prepending a `setFeesMode { jit_withdraw: true }` to make sure delivery fees can be paid. A test-case is also added to present the aforementioned case --------- Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
@@ -186,7 +186,7 @@ pub fn teleports_for_native_asset_works<
|
||||
|
||||
// Mint funds into account to ensure it has enough balance to pay delivery fees
|
||||
let delivery_fees =
|
||||
xcm_helpers::transfer_assets_delivery_fees::<XcmConfig::XcmSender>(
|
||||
xcm_helpers::teleport_assets_delivery_fees::<XcmConfig::XcmSender>(
|
||||
(native_asset_id.clone(), native_asset_to_teleport_away.into()).into(),
|
||||
0,
|
||||
Unlimited,
|
||||
@@ -579,7 +579,7 @@ pub fn teleports_for_foreign_assets_works<
|
||||
|
||||
// Make sure the target account has enough native asset to pay for delivery fees
|
||||
let delivery_fees =
|
||||
xcm_helpers::transfer_assets_delivery_fees::<XcmConfig::XcmSender>(
|
||||
xcm_helpers::teleport_assets_delivery_fees::<XcmConfig::XcmSender>(
|
||||
(foreign_asset_id_location_latest.clone(), asset_to_teleport_away).into(),
|
||||
0,
|
||||
Unlimited,
|
||||
|
||||
@@ -18,11 +18,10 @@
|
||||
|
||||
use xcm::latest::prelude::*;
|
||||
|
||||
/// Returns the delivery fees amount for pallet xcm's `teleport_assets` and
|
||||
/// `reserve_transfer_assets` extrinsics.
|
||||
/// Returns the delivery fees amount for pallet xcm's `teleport_assets` extrinsics.
|
||||
/// Because it returns only a `u128`, it assumes delivery fees are only paid
|
||||
/// in one asset and that asset is known.
|
||||
pub fn transfer_assets_delivery_fees<S: SendXcm>(
|
||||
pub fn teleport_assets_delivery_fees<S: SendXcm>(
|
||||
assets: Assets,
|
||||
fee_asset_item: u32,
|
||||
weight_limit: WeightLimit,
|
||||
|
||||
Reference in New Issue
Block a user