difftreelog
fix use latest xcm version in imports
in: master
11 files changed
pallets/configuration/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/configuration/src/benchmarking.rs
+++ b/pallets/configuration/src/benchmarking.rs
@@ -20,7 +20,7 @@
use frame_benchmarking::benchmarks;
use frame_system::{EventRecord, RawOrigin};
use frame_support::{assert_ok, BoundedVec, traits::Currency};
-use xcm::v1::MultiLocation;
+use xcm::latest::MultiLocation;
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events();
pallets/configuration/src/lib.rsdiffbeforeafterboth--- a/pallets/configuration/src/lib.rs
+++ b/pallets/configuration/src/lib.rs
@@ -47,7 +47,7 @@
BoundedVec, log,
};
use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};
- use xcm::v1::MultiLocation;
+ use xcm::latest::MultiLocation;
pub use crate::weights::WeightInfo;
pub type BalanceOf<T> =
pallets/foreign-assets/src/lib.rsdiffbeforeafterboth--- a/pallets/foreign-assets/src/lib.rs
+++ b/pallets/foreign-assets/src/lib.rs
@@ -52,10 +52,10 @@
use sp_std::{boxed::Box, vec::Vec};
use up_data_structs::{CollectionId, TokenId, CreateCollectionData};
-// NOTE:v1::MultiLocation is used in storages, we would need to do migration if upgrade the
-// MultiLocation in the future.
+// NOTE: MultiLocation is used in storages, we will need to do migration if upgrade the
+// MultiLocation to the XCM v3.
use xcm::opaque::latest::{prelude::XcmError, Weight};
-use xcm::{v1::MultiLocation, VersionedMultiLocation};
+use xcm::{latest::MultiLocation, VersionedMultiLocation};
use xcm_executor::{traits::WeightTrader, Assets};
use pallet_common::erc::CrossAccountId;
runtime/common/config/orml.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{18 parameter_types,19 traits::{Contains, Everything},20};21use frame_system::EnsureSigned;22use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};23use sp_runtime::traits::Convert;24use xcm::v1::{Junction::*, Junctions::*, MultiLocation, NetworkId};25use xcm::latest::Weight;26use xcm_builder::LocationInverter;27use xcm_executor::XcmExecutor;28use sp_std::{vec, vec::Vec};29use pallet_foreign_assets::{CurrencyId, NativeCurrency};30use crate::{31 Runtime, RuntimeEvent, RelayChainBlockNumberProvider,32 runtime_common::config::{33 xcm::{34 SelfLocation, Weigher, XcmConfig, Ancestry,35 xcm_assets::{CurrencyIdConvert},36 },37 pallets::TreasuryAccountId,38 substrate::{MaxLocks, MaxReserves},39 },40};4142use up_common::{43 types::{AccountId, Balance},44 constants::*,45};4647// Signed version of balance48pub type Amount = i128;4950parameter_types! {51 pub const MinVestedTransfer: Balance = 10 * UNIQUE;52 pub const MaxVestingSchedules: u32 = 28;5354 pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this55 pub const MaxAssetsForTransfer: usize = 2;56}5758parameter_type_with_key! {59 pub ParachainMinFee: |_location: MultiLocation| -> Option<u128> {60 Some(100_000_000_000)61 };62}6364parameter_type_with_key! {65 pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {66 match currency_id {67 CurrencyId::NativeAssetId(symbol) => match symbol {68 NativeCurrency::Here => 0,69 NativeCurrency::Parent=> 0,70 },71 _ => 100_00072 }73 };74}7576pub fn get_all_module_accounts() -> Vec<AccountId> {77 vec![TreasuryAccountId::get()]78}7980pub struct DustRemovalWhitelist;81impl Contains<AccountId> for DustRemovalWhitelist {82 fn contains(a: &AccountId) -> bool {83 get_all_module_accounts().contains(a)84 }85}8687pub struct AccountIdToMultiLocation;88impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {89 fn convert(account: AccountId) -> MultiLocation {90 X1(AccountId32 {91 network: NetworkId::Any,92 id: account.into(),93 })94 .into()95 }96}9798pub struct CurrencyHooks;99impl orml_traits::currency::MutationHooks<AccountId, CurrencyId, Balance> for CurrencyHooks {100 type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccountId>;101 type OnSlash = ();102 type PreTransfer = ();103 type PostTransfer = ();104 type PreDeposit = ();105 type PostDeposit = ();106 type OnNewTokenAccount = ();107 type OnKilledTokenAccount = ();108}109110impl orml_vesting::Config for Runtime {111 type RuntimeEvent = RuntimeEvent;112 type Currency = pallet_balances::Pallet<Runtime>;113 type MinVestedTransfer = MinVestedTransfer;114 type VestedTransferOrigin = EnsureSigned<AccountId>;115 type WeightInfo = ();116 type MaxVestingSchedules = MaxVestingSchedules;117 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;118}119120impl orml_tokens::Config for Runtime {121 type RuntimeEvent = RuntimeEvent;122 type Balance = Balance;123 type Amount = Amount;124 type CurrencyId = CurrencyId;125 type WeightInfo = ();126 type ExistentialDeposits = ExistentialDeposits;127 type CurrencyHooks = CurrencyHooks;128 type MaxLocks = MaxLocks;129 type MaxReserves = MaxReserves;130 // TODO: Add all module accounts131 type DustRemovalWhitelist = DustRemovalWhitelist;132 /// The id type for named reserves.133 type ReserveIdentifier = ();134}135136impl orml_xtokens::Config for Runtime {137 type RuntimeEvent = RuntimeEvent;138 type Balance = Balance;139 type CurrencyId = CurrencyId;140 type CurrencyIdConvert = CurrencyIdConvert;141 type AccountIdToMultiLocation = AccountIdToMultiLocation;142 type SelfLocation = SelfLocation;143 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;144 type Weigher = Weigher;145 type BaseXcmWeight = BaseXcmWeight;146 type LocationInverter = LocationInverter<Ancestry>;147 type MaxAssetsForTransfer = MaxAssetsForTransfer;148 type MinXcmFee = ParachainMinFee;149 type MultiLocationsFilter = Everything;150 type ReserveProvider = AbsoluteReserveProvider;151}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{18 parameter_types,19 traits::{Contains, Everything},20};21use frame_system::EnsureSigned;22use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};23use sp_runtime::traits::Convert;24use xcm::latest::{Weight, Junction::*, Junctions::*, MultiLocation, NetworkId};25use xcm_builder::LocationInverter;26use xcm_executor::XcmExecutor;27use sp_std::{vec, vec::Vec};28use pallet_foreign_assets::{CurrencyId, NativeCurrency};29use crate::{30 Runtime, RuntimeEvent, RelayChainBlockNumberProvider,31 runtime_common::config::{32 xcm::{33 SelfLocation, Weigher, XcmConfig, Ancestry,34 xcm_assets::{CurrencyIdConvert},35 },36 pallets::TreasuryAccountId,37 substrate::{MaxLocks, MaxReserves},38 },39};4041use up_common::{42 types::{AccountId, Balance},43 constants::*,44};4546// Signed version of balance47pub type Amount = i128;4849parameter_types! {50 pub const MinVestedTransfer: Balance = 10 * UNIQUE;51 pub const MaxVestingSchedules: u32 = 28;5253 pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this54 pub const MaxAssetsForTransfer: usize = 2;55}5657parameter_type_with_key! {58 pub ParachainMinFee: |_location: MultiLocation| -> Option<u128> {59 Some(100_000_000_000)60 };61}6263parameter_type_with_key! {64 pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {65 match currency_id {66 CurrencyId::NativeAssetId(symbol) => match symbol {67 NativeCurrency::Here => 0,68 NativeCurrency::Parent=> 0,69 },70 _ => 100_00071 }72 };73}7475pub fn get_all_module_accounts() -> Vec<AccountId> {76 vec![TreasuryAccountId::get()]77}7879pub struct DustRemovalWhitelist;80impl Contains<AccountId> for DustRemovalWhitelist {81 fn contains(a: &AccountId) -> bool {82 get_all_module_accounts().contains(a)83 }84}8586pub struct AccountIdToMultiLocation;87impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {88 fn convert(account: AccountId) -> MultiLocation {89 X1(AccountId32 {90 network: NetworkId::Any,91 id: account.into(),92 })93 .into()94 }95}9697pub struct CurrencyHooks;98impl orml_traits::currency::MutationHooks<AccountId, CurrencyId, Balance> for CurrencyHooks {99 type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccountId>;100 type OnSlash = ();101 type PreTransfer = ();102 type PostTransfer = ();103 type PreDeposit = ();104 type PostDeposit = ();105 type OnNewTokenAccount = ();106 type OnKilledTokenAccount = ();107}108109impl orml_vesting::Config for Runtime {110 type RuntimeEvent = RuntimeEvent;111 type Currency = pallet_balances::Pallet<Runtime>;112 type MinVestedTransfer = MinVestedTransfer;113 type VestedTransferOrigin = EnsureSigned<AccountId>;114 type WeightInfo = ();115 type MaxVestingSchedules = MaxVestingSchedules;116 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;117}118119impl orml_tokens::Config for Runtime {120 type RuntimeEvent = RuntimeEvent;121 type Balance = Balance;122 type Amount = Amount;123 type CurrencyId = CurrencyId;124 type WeightInfo = ();125 type ExistentialDeposits = ExistentialDeposits;126 type CurrencyHooks = CurrencyHooks;127 type MaxLocks = MaxLocks;128 type MaxReserves = MaxReserves;129 // TODO: Add all module accounts130 type DustRemovalWhitelist = DustRemovalWhitelist;131 /// The id type for named reserves.132 type ReserveIdentifier = ();133}134135impl orml_xtokens::Config for Runtime {136 type RuntimeEvent = RuntimeEvent;137 type Balance = Balance;138 type CurrencyId = CurrencyId;139 type CurrencyIdConvert = CurrencyIdConvert;140 type AccountIdToMultiLocation = AccountIdToMultiLocation;141 type SelfLocation = SelfLocation;142 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;143 type Weigher = Weigher;144 type BaseXcmWeight = BaseXcmWeight;145 type LocationInverter = LocationInverter<Ancestry>;146 type MaxAssetsForTransfer = MaxAssetsForTransfer;147 type MinXcmFee = ParachainMinFee;148 type MultiLocationsFilter = Everything;149 type ReserveProvider = AbsoluteReserveProvider;150}runtime/common/config/xcm/foreignassets.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -19,8 +19,7 @@
parameter_types,
};
use sp_runtime::traits::Convert;
-use xcm::v1::{Junction::*, MultiLocation, Junctions::*};
-use xcm::latest::MultiAsset;
+use xcm::latest::{MultiAsset, Junction::*, MultiLocation, Junctions::*};
use xcm_builder::{FungiblesAdapter, ConvertedConcreteAssetId};
use xcm_executor::traits::{Convert as ConvertXcm, JustTry, FilterAssetLocation};
use pallet_foreign_assets::{
runtime/common/config/xcm/mod.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -21,8 +21,7 @@
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use polkadot_parachain::primitives::Sibling;
-use xcm::v1::{Junction::*, MultiLocation, NetworkId};
-use xcm::latest::{prelude::*, Weight};
+use xcm::latest::{prelude::*, Weight, MultiLocation, NetworkId};
use xcm_builder::{
AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, ParentAsSuperuser,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
runtime/common/config/xcm/nativeassets.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/nativeassets.rs
+++ b/runtime/common/config/xcm/nativeassets.rs
@@ -19,11 +19,13 @@
weights::WeightToFeePolynomial,
};
use sp_runtime::traits::{CheckedConversion, Zero, Convert};
-use xcm::v1::{Junction::*, MultiLocation, Junctions::*};
use xcm::latest::{
AssetId::{Concrete},
Fungibility::Fungible as XcmFungible,
MultiAsset, Error as XcmError, Weight,
+ Junction::*,
+ MultiLocation,
+ Junctions::*,
};
use xcm_builder::{CurrencyAdapter, NativeAsset};
use xcm_executor::{
runtime/common/xcm.rsdiffbeforeafterboth--- a/runtime/common/xcm.rs
+++ b/runtime/common/xcm.rs
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use sp_std::{vec::Vec, marker::PhantomData};
-use xcm::v1::MultiLocation;
+use xcm::latest::MultiLocation;
use frame_support::traits::Get;
pub struct OverridableAllowedLocations<T, L>(PhantomData<(T, L)>)
runtime/opal/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/opal/src/xcm_barrier.rs
+++ b/runtime/opal/src/xcm_barrier.rs
@@ -15,10 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use frame_support::traits::Everything;
-use xcm::{
- latest::{Xcm, Weight},
- v1::MultiLocation,
-};
+use xcm::latest::{Xcm, Weight, MultiLocation};
use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit};
use xcm_executor::traits::ShouldExecute;
runtime/quartz/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/quartz/src/xcm_barrier.rs
+++ b/runtime/quartz/src/xcm_barrier.rs
@@ -19,7 +19,7 @@
traits::{Get, Everything},
};
use sp_std::{vec, vec::Vec};
-use xcm::v1::{Junction::*, Junctions::*, MultiLocation};
+use xcm::latest::{Junction::*, Junctions::*, MultiLocation};
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
AllowTopLevelPaidExecutionFrom,
runtime/unique/src/xcm_barrier.rsdiffbeforeafterboth--- a/runtime/unique/src/xcm_barrier.rs
+++ b/runtime/unique/src/xcm_barrier.rs
@@ -19,7 +19,7 @@
traits::{Get, Everything},
};
use sp_std::{vec, vec::Vec};
-use xcm::v1::{Junction::*, Junctions::*, MultiLocation};
+use xcm::latest::{Junction::*, Junctions::*, MultiLocation};
use xcm_builder::{
AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
AllowTopLevelPaidExecutionFrom,