[xcm-builder] Replaced deprecated CurrencyAdapter with FungibleAdapter (#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
https://github.com/polkadot-fellows/runtimes/pull/159

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
This commit is contained in:
Branislav Kontur
2024-02-13 20:22:53 +01:00
committed by GitHub
parent b79bf4fb1f
commit e0c902e3df
41 changed files with 198 additions and 259 deletions
@@ -54,16 +54,14 @@ use sp_runtime::traits::AccountIdConversion;
use sp_std::marker::PhantomData;
use testnet_parachains_constants::rococo::snowbridge::EthereumNetwork;
use xcm::latest::prelude::*;
#[allow(deprecated)]
use xcm_builder::{
deposit_or_burn_fee, AccountId32Aliases, AllowExplicitUnpaidExecutionFrom,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin,
FrameTransactionalProcessor, HandleFee, IsConcrete, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeToAccount,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor,
FungibleAdapter, HandleFee, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeToAccount,
};
use xcm_executor::{
traits::{FeeManager, FeeReason, FeeReason::Export, TransactAsset, WithOriginFilter},
@@ -96,8 +94,7 @@ pub type LocationToAccountId = (
);
/// Means for transacting the native currency on this chain.
#[allow(deprecated)]
pub type CurrencyTransactor = CurrencyAdapter<
pub type FungibleTransactor = FungibleAdapter<
// Use this currency:
Balances,
// Use this currency when it is a fungible asset matching the given location or name:
@@ -285,7 +282,7 @@ pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter;
type AssetTransactor = CurrencyTransactor;
type AssetTransactor = FungibleTransactor;
type OriginConverter = XcmOriginToTransactDispatchOrigin;
// BridgeHub does not recognize a reserve location for any asset. Users must teleport Native
// token where allowed (e.g. with the Relay Chain).
@@ -102,7 +102,7 @@ pub fn transfer_token_to_ethereum_insufficient_fund() {
H160::random(),
H160::random(),
DefaultBridgeHubEthereumBaseFee::get(),
FailedToTransactAsset("InsufficientBalance"),
FailedToTransactAsset("Funds are unavailable"),
)
}