From 41b8d5434e059218dbbaa088b6abc2294414b8c9 Mon Sep 17 00:00:00 2001 From: "paritytech-cmd-bot-polkadot-sdk[bot]" <179002856+paritytech-cmd-bot-polkadot-sdk[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2025 12:25:14 +0100 Subject: [PATCH] [stable2412] Backport #7243 (#7527) Backport #7243 into `stable2412` from dhirajs0. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> Co-authored-by: Dhiraj Sah <dhiraj.kumar2990@gmail.com> --- polkadot/xcm/xcm-builder/src/fungible_adapter.rs | 8 ++------ polkadot/xcm/xcm-builder/src/fungibles_adapter.rs | 7 ++----- prdoc/pr_7243.prdoc | 13 +++++++++++++ 3 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 prdoc/pr_7243.prdoc diff --git a/polkadot/xcm/xcm-builder/src/fungible_adapter.rs b/polkadot/xcm/xcm-builder/src/fungible_adapter.rs index 25a705a39eb..2da772deb0e 100644 --- a/polkadot/xcm/xcm-builder/src/fungible_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/fungible_adapter.rs @@ -20,11 +20,7 @@ use super::MintLocation; use core::{marker::PhantomData, result}; use frame_support::traits::{ tokens::{ - fungible, - Fortitude::Polite, - Precision::Exact, - Preservation::{Expendable, Preserve}, - Provenance::Minted, + fungible, Fortitude::Polite, Precision::Exact, Preservation::Expendable, Provenance::Minted, }, Get, }; @@ -64,7 +60,7 @@ impl< .ok_or(MatchError::AccountIdConversionFailed)?; let dest = AccountIdConverter::convert_location(to) .ok_or(MatchError::AccountIdConversionFailed)?; - Fungible::transfer(&source, &dest, amount, Preserve) + Fungible::transfer(&source, &dest, amount, Expendable) .map_err(|error| XcmError::FailedToTransactAsset(error.into()))?; Ok(what.clone().into()) } diff --git a/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs b/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs index a259afc6e68..59b4ccb13d0 100644 --- a/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs @@ -19,10 +19,7 @@ use core::{marker::PhantomData, result}; use frame_support::traits::{ tokens::{ - fungibles, - Fortitude::Polite, - Precision::Exact, - Preservation::{Expendable, Preserve}, + fungibles, Fortitude::Polite, Precision::Exact, Preservation::Expendable, Provenance::Minted, }, Contains, Get, @@ -58,7 +55,7 @@ impl< .ok_or(MatchError::AccountIdConversionFailed)?; let dest = AccountIdConverter::convert_location(to) .ok_or(MatchError::AccountIdConversionFailed)?; - Assets::transfer(asset_id, &source, &dest, amount, Preserve) + Assets::transfer(asset_id, &source, &dest, amount, Expendable) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; Ok(what.clone().into()) } diff --git a/prdoc/pr_7243.prdoc b/prdoc/pr_7243.prdoc new file mode 100644 index 00000000000..c04017c29ce --- /dev/null +++ b/prdoc/pr_7243.prdoc @@ -0,0 +1,13 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: 'transfer function Preservation is changed to Expendable in fungible and fungibles adapter' + +doc: + - audience: Runtime Dev + description: | + The Preservation of transfer method of fungible and fungibles adapters is changed from Preserve to Expendable. So the behavior of the TransferAsset will be consistent with the WithdrawAsset function, as in fungible and fungibles adapter. + +crates: +- name: staging-xcm-builder + bump: patch \ No newline at end of file -- GitLab