Skip to content

Commit

Permalink
[xcm-builder] Replaced deprecated CurrencyAdapter with FungibleAdapter (
Browse files Browse the repository at this point in the history
paritytech#3287)

I found out during the cleanup of this deprecation message in the
`polkadot-fellows` repository that we deprecated `CurrencyAdapter`
without making the recommended changes.


## TODO
- [ ] fix `polkadot-fellows` bump to 1.6.0
polkadot-fellows/runtimes#159

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
  • Loading branch information
bkontur and franciscoaguirre authored Feb 13, 2024
1 parent 6ea9431 commit 3e65142
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 3 additions & 6 deletions substrate/frame/contracts/mock-network/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ use sp_runtime::traits::{Get, IdentityLookup, MaybeEquivalence};

use sp_std::prelude::*;
use xcm::latest::prelude::*;
#[allow(deprecated)]
use xcm_builder::CurrencyAdapter as XcmCurrencyAdapter;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
ConvertedConcreteId, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds,
FrameTransactionalProcessor, FungiblesAdapter, IsConcrete, NativeAsset, NoChecking,
ParentAsSuperuser, ParentIsPreset, SignedAccountId32AsNative, SignedToAccountId32,
FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, IsConcrete, NativeAsset,
NoChecking, ParentAsSuperuser, ParentIsPreset, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, WithComputedOrigin,
};
use xcm_executor::{traits::JustTry, Config, XcmExecutor};
Expand Down Expand Up @@ -184,9 +182,8 @@ pub fn estimate_fee_for_weight(weight: Weight) -> u128 {
units_per_mb * (weight.proof_size() as u128) / (WEIGHT_PROOF_SIZE_PER_MB as u128)
}

#[allow(deprecated)]
pub type LocalBalancesTransactor =
XcmCurrencyAdapter<Balances, IsConcrete<TokenLocation>, SovereignAccountOf, AccountId, ()>;
FungibleAdapter<Balances, IsConcrete<TokenLocation>, SovereignAccountOf, AccountId, ()>;

pub struct FromLocationToAsset<Location, AssetId>(PhantomData<(Location, AssetId)>);
impl MaybeEquivalence<Location, AssetIdForAssets>
Expand Down
7 changes: 2 additions & 5 deletions substrate/frame/contracts/mock-network/src/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ use sp_runtime::traits::IdentityLookup;
use polkadot_parachain_primitives::primitives::Id as ParaId;
use polkadot_runtime_parachains::{configuration, origin, shared};
use xcm::latest::prelude::*;
#[allow(deprecated)]
use xcm_builder::CurrencyAdapter as XcmCurrencyAdapter;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia,
ChildSystemParachainAsSuperuser, DescribeAllTerminal, DescribeFamily, FixedRateOfFungible,
FixedWeightBounds, FrameTransactionalProcessor, HashedDescription, IsConcrete,
FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, WithComputedOrigin,
};
use xcm_executor::{Config, XcmExecutor};
Expand Down Expand Up @@ -119,9 +117,8 @@ pub type SovereignAccountOf = (
ChildParachainConvertsVia<ParaId, AccountId>,
);

#[allow(deprecated)]
pub type LocalBalancesTransactor =
XcmCurrencyAdapter<Balances, IsConcrete<TokenLocation>, SovereignAccountOf, AccountId, ()>;
FungibleAdapter<Balances, IsConcrete<TokenLocation>, SovereignAccountOf, AccountId, ()>;

pub type AssetTransactors = LocalBalancesTransactor;

Expand Down

0 comments on commit 3e65142

Please sign in to comment.