Skip to content

Commit

Permalink
[stable2409] Backport #7243 (#7526)
Browse files Browse the repository at this point in the history
Backport #7243 into `stable2409` 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>
  • Loading branch information
1 parent 4d2e9c9 commit 93bd61e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 2 additions & 6 deletions polkadot/xcm/xcm-builder/src/fungible_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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())
}
Expand Down
7 changes: 2 additions & 5 deletions polkadot/xcm/xcm-builder/src/fungibles_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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())
}
Expand Down
13 changes: 13 additions & 0 deletions prdoc/pr_7243.prdoc
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 93bd61e

Please sign in to comment.