Skip to content

pallet-xcm transfer_assets should take fees separately instead of using the index in assets #3847

Open
@franciscoaguirre

Description

transfer_assets' signature looks like this:

pub fn transfer_assets(
	origin: OriginFor<T>,
	dest: Box<VersionedLocation>,
	beneficiary: Box<VersionedLocation>,
	assets: Box<VersionedAssets>,
	fee_asset_item: u32,
	weight_limit: WeightLimit,
) -> DispatchResult;

The idea of passing the fee_asset_item index is not going to cut it anymore, because of various reasons:

  • Assets are ordered when converted from a vector, so the index might be wrong
  • We want users to specify the max assets they're willing to spend for fees only, this means it's preferable to separate assets even if they are the same one. If passing only one assets instance, two instances of the same asset will be merged into one.
  • Fees are something completely different from the assets that the user wants to transfer, so they should be clearly separated.

The solution is to change the fee_asset_item parameter with a new parameter of type Assets. The signature would look like so:

pub fn transfer_assets(
	origin: OriginFor<T>,
	dest: Box<VersionedLocation>,
	beneficiary: Box<VersionedLocation>,
	assets: Box<VersionedAssets>,
	fees: Box<VersionedAssets>,
	weight_limit: WeightLimit,
) -> DispatchResult;

This is clearly a breaking change, so a new extrinsic would have to be created and this one deprecated.
The same situation happens with limited_reserve_asset_transfer and limited_teleport_assets.

Metadata

Assignees

No one assigned

    Labels

    C1-mentorA task where a mentor is available. Please indicate in the issue who the mentor could be.T6-XCMThis PR/Issue is related to XCM.

    Type

    No type

    Projects

    • Status

      Next to pick up

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions