difftreelog
fix make pallets build on 0.9.42
in: master
9 files changed
pallets/app-promotion/Cargo.tomldiffbeforeafterboth--- a/pallets/app-promotion/Cargo.toml
+++ b/pallets/app-promotion/Cargo.toml
@@ -48,7 +48,7 @@
frame-benchmarking = { workspace = true, optional = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
-pallet-balances = { workspace = true }
+pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
pallet-evm = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
pallets/collator-selection/Cargo.tomldiffbeforeafterboth--- a/pallets/collator-selection/Cargo.toml
+++ b/pallets/collator-selection/Cargo.toml
@@ -33,7 +33,7 @@
[dev-dependencies]
pallet-aura = { workspace = true }
-pallet-balances = { workspace = true }
+pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
pallet-timestamp = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-core = { workspace = true }
pallets/foreign-assets/Cargo.tomldiffbeforeafterboth--- a/pallets/foreign-assets/Cargo.toml
+++ b/pallets/foreign-assets/Cargo.toml
@@ -15,7 +15,7 @@
frame-system = { workspace = true }
log = { workspace = true }
orml-tokens = { workspace = true }
-pallet-balances = { workspace = true }
+pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
pallet-common = { workspace = true }
pallet-fungible = { workspace = true }
serde = { workspace = true, optional = true }
pallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth--- a/pallets/foreign-assets/src/impl_fungibles.rs
+++ b/pallets/foreign-assets/src/impl_fungibles.rs
@@ -19,7 +19,9 @@
use super::*;
use frame_system::Config as SystemConfig;
-use frame_support::traits::tokens::{DepositConsequence, WithdrawConsequence};
+use frame_support::traits::tokens::{
+ DepositConsequence, WithdrawConsequence, Preservation, Fortitude, Provenance, Precision,
+};
use pallet_common::CollectionHandle;
use pallet_fungible::FungibleHandle;
use pallet_common::CommonCollectionOperations;
@@ -118,17 +120,24 @@
}
}
+ fn total_balance(asset: Self::AssetId, who: &<T as SystemConfig>::AccountId) -> Self::Balance {
+ Self::balance(asset, who)
+ }
+
fn reducible_balance(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
- keep_alive: bool,
+ preservation: Preservation,
+ fortitude: Fortitude,
) -> Self::Balance {
log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible reducible_balance");
match asset {
AssetIds::NativeAssetId(NativeCurrency::Here) => {
<pallet_balances::Pallet<T> as fungible::Inspect<T::AccountId>>::reducible_balance(
- who, keep_alive,
+ who,
+ preservation,
+ fortitude,
)
.into()
}
@@ -136,7 +145,8 @@
<orml_tokens::Pallet<T> as fungibles::Inspect<T::AccountId>>::reducible_balance(
AssetIds::NativeAssetId(NativeCurrency::Parent),
who,
- keep_alive,
+ preservation,
+ fortitude,
)
.into()
}
@@ -148,7 +158,7 @@
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance,
- mint: bool,
+ provenance: Provenance,
) -> DepositConsequence {
log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible can_deposit");
@@ -157,7 +167,7 @@
<pallet_balances::Pallet<T> as fungible::Inspect<T::AccountId>>::can_deposit(
who,
amount.into(),
- mint,
+ provenance,
)
}
AssetIds::NativeAssetId(NativeCurrency::Parent) => {
@@ -165,7 +175,7 @@
AssetIds::NativeAssetId(NativeCurrency::Parent),
who,
amount.into(),
- mint,
+ provenance,
)
}
_ => {
@@ -220,14 +230,14 @@
who,
this_amount,
) {
- WithdrawConsequence::NoFunds => WithdrawConsequence::NoFunds,
+ WithdrawConsequence::BalanceLow => WithdrawConsequence::BalanceLow,
WithdrawConsequence::WouldDie => WithdrawConsequence::WouldDie,
WithdrawConsequence::UnknownAsset => WithdrawConsequence::UnknownAsset,
WithdrawConsequence::Underflow => WithdrawConsequence::Underflow,
WithdrawConsequence::Overflow => WithdrawConsequence::Overflow,
WithdrawConsequence::Frozen => WithdrawConsequence::Frozen,
WithdrawConsequence::Success => WithdrawConsequence::Success,
- _ => WithdrawConsequence::NoFunds,
+ _ => WithdrawConsequence::BalanceLow,
}
}
AssetIds::NativeAssetId(NativeCurrency::Parent) => {
@@ -242,19 +252,19 @@
who,
parent_amount,
) {
- WithdrawConsequence::NoFunds => WithdrawConsequence::NoFunds,
+ WithdrawConsequence::BalanceLow => WithdrawConsequence::BalanceLow,
WithdrawConsequence::WouldDie => WithdrawConsequence::WouldDie,
WithdrawConsequence::UnknownAsset => WithdrawConsequence::UnknownAsset,
WithdrawConsequence::Underflow => WithdrawConsequence::Underflow,
WithdrawConsequence::Overflow => WithdrawConsequence::Overflow,
WithdrawConsequence::Frozen => WithdrawConsequence::Frozen,
WithdrawConsequence::Success => WithdrawConsequence::Success,
- _ => WithdrawConsequence::NoFunds,
+ _ => WithdrawConsequence::BalanceLow,
}
}
_ => match Self::balance(asset, who).checked_sub(&amount) {
Some(_) => WithdrawConsequence::Success,
- None => WithdrawConsequence::NoFunds,
+ None => WithdrawConsequence::BalanceLow,
},
}
}
@@ -280,7 +290,7 @@
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance,
- ) -> DispatchResult {
+ ) -> Result<BalanceOf<T>, DispatchError> {
//Self::do_mint(asset, who, amount, None)
log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible mint_into {:?}", asset);
@@ -290,7 +300,7 @@
who,
amount.into(),
)
- .into()
+ .map(Into::into)
}
AssetIds::NativeAssetId(NativeCurrency::Parent) => {
<orml_tokens::Pallet<T> as fungibles::Mutate<T::AccountId>>::mint_into(
@@ -298,7 +308,7 @@
who,
amount.into(),
)
- .into()
+ .map(Into::into)
}
AssetIds::ForeignAssetId(fid) => {
let target_collection_id = match <AssetBinding<T>>::get(fid) {
@@ -323,7 +333,7 @@
&Value::new(0),
)?;
- Ok(())
+ Ok(amount.into())
}
}
}
@@ -332,29 +342,31 @@
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance,
+ precision: Precision,
+ fortitude: Fortitude,
) -> Result<Self::Balance, DispatchError> {
// let f = DebitFlags { keep_alive: false, best_effort: false };
log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible burn_from");
match asset {
AssetIds::NativeAssetId(NativeCurrency::Here) => {
- match <pallet_balances::Pallet<T> as fungible::Mutate<T::AccountId>>::burn_from(
+ <pallet_balances::Pallet<T> as fungible::Mutate<T::AccountId>>::burn_from(
who,
amount.into(),
- ) {
- Ok(v) => Ok(v.into()),
- Err(e) => Err(e),
- }
+ precision,
+ fortitude,
+ )
+ .map(Into::into)
}
AssetIds::NativeAssetId(NativeCurrency::Parent) => {
- match <orml_tokens::Pallet<T> as fungibles::Mutate<T::AccountId>>::burn_from(
+ <orml_tokens::Pallet<T> as fungibles::Mutate<T::AccountId>>::burn_from(
AssetIds::NativeAssetId(NativeCurrency::Parent),
who,
amount.into(),
- ) {
- Ok(v) => Ok(v.into()),
- Err(e) => Err(e),
- }
+ precision,
+ fortitude,
+ )
+ .map(Into::into)
}
AssetIds::ForeignAssetId(fid) => {
let target_collection_id = match <AssetBinding<T>>::get(fid) {
@@ -376,45 +388,25 @@
Ok(amount)
}
}
- }
-
- fn slash(
- asset: Self::AssetId,
- who: &<T as SystemConfig>::AccountId,
- amount: Self::Balance,
- ) -> Result<Self::Balance, DispatchError> {
- // let f = DebitFlags { keep_alive: false, best_effort: true };
- log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible slash");
- Ok(Self::burn_from(asset, who, amount)?)
}
-}
-impl<T: Config> fungibles::Transfer<T::AccountId> for Pallet<T>
-where
- T: orml_tokens::Config<CurrencyId = AssetIds>,
- BalanceOf<T>: From<<T as pallet_balances::Config>::Balance>,
- BalanceOf<T>: From<<T as orml_tokens::Config>::Balance>,
- <T as pallet_balances::Config>::Balance: From<BalanceOf<T>>,
- <T as orml_tokens::Config>::Balance: From<BalanceOf<T>>,
- u128: From<BalanceOf<T>>,
-{
fn transfer(
asset: Self::AssetId,
source: &<T as SystemConfig>::AccountId,
dest: &<T as SystemConfig>::AccountId,
amount: Self::Balance,
- keep_alive: bool,
+ preservation: Preservation,
) -> Result<Self::Balance, DispatchError> {
// let f = TransferFlags { keep_alive, best_effort: false, burn_dust: false };
log::trace!(target: "fassets::impl_foreign_assets", "impl_fungible transfer");
match asset {
AssetIds::NativeAssetId(NativeCurrency::Here) => {
- match <pallet_balances::Pallet<T> as fungible::Transfer<T::AccountId>>::transfer(
+ match <pallet_balances::Pallet<T> as fungible::Mutate<T::AccountId>>::transfer(
source,
dest,
amount.into(),
- keep_alive,
+ preservation,
) {
Ok(_) => Ok(amount),
Err(_) => Err(DispatchError::Other(
@@ -423,12 +415,12 @@
}
}
AssetIds::NativeAssetId(NativeCurrency::Parent) => {
- match <orml_tokens::Pallet<T> as fungibles::Transfer<T::AccountId>>::transfer(
+ match <orml_tokens::Pallet<T> as fungibles::Mutate<T::AccountId>>::transfer(
AssetIds::NativeAssetId(NativeCurrency::Parent),
source,
dest,
amount.into(),
- keep_alive,
+ preservation,
) {
Ok(_) => Ok(amount),
Err(e) => Err(e),
@@ -460,3 +452,51 @@
}
}
}
+
+#[cfg(not(debug_assertions))]
+extern "C" {
+ // This function does not exists, thus compilation will fail, if its call is
+ // not optimized away, which is only possible if it's not called at all.
+ //
+ // not(debug_assertions) is used to ensure compiler is dropping unused functions, as
+ // this option is enabled in release by defailt
+ //
+ // FIXME: maybe use build.rs, to ensure it will fail even in release with debug_assertions
+ // enabled?
+ fn unbalanced_fungible_is_called();
+}
+macro_rules! ensure_balanced {
+ () => {{
+ #[cfg(debug_assertions)]
+ panic!("unbalanced fungible methods should not be used");
+ #[cfg(not(debug_assertions))]
+ {
+ unsafe { unbalanced_fungible_is_called() };
+ unreachable!();
+ }
+ }};
+}
+
+impl<T: Config> fungibles::Unbalanced<<T as SystemConfig>::AccountId> for Pallet<T>
+where
+ T: orml_tokens::Config<CurrencyId = AssetIds>,
+ BalanceOf<T>: From<<T as pallet_balances::Config>::Balance>,
+ BalanceOf<T>: From<<T as orml_tokens::Config>::Balance>,
+ <T as pallet_balances::Config>::Balance: From<BalanceOf<T>>,
+ <T as orml_tokens::Config>::Balance: From<BalanceOf<T>>,
+ u128: From<BalanceOf<T>>,
+{
+ fn handle_dust(_dust: fungibles::Dust<<T as SystemConfig>::AccountId, Self>) {
+ ensure_balanced!();
+ }
+ fn write_balance(
+ _asset: Self::AssetId,
+ _who: &<T as SystemConfig>::AccountId,
+ _amount: Self::Balance,
+ ) -> Result<Option<Self::Balance>, DispatchError> {
+ ensure_balanced!();
+ }
+ fn set_total_issuance(_asset: Self::AssetId, _amount: Self::Balance) {
+ ensure_balanced!();
+ }
+}
pallets/foreign-assets/src/lib.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/>.1617//! # Foreign assets18//!19//! - [`Config`]20//! - [`Call`]21//! - [`Pallet`]22//!23//! ## Overview24//!25//! The foreign assests pallet provides functions for:26//!27//! - Local and foreign assets management. The foreign assets can be updated without runtime upgrade.28//! - Bounds between asset and target collection for cross chain transfer and inner transfers.29//!30//! ## Overview31//!32//! Under construction3334#![cfg_attr(not(feature = "std"), no_std)]35#![allow(clippy::unused_unit)]3637use frame_support::{38 dispatch::DispatchResult,39 ensure,40 pallet_prelude::*,41 traits::{fungible, fungibles, Currency, EnsureOrigin},42 RuntimeDebug,43};44use frame_system::pallet_prelude::*;45use up_data_structs::{CollectionMode};46use pallet_fungible::{Pallet as PalletFungible};47use scale_info::{TypeInfo};48use sp_runtime::{49 traits::{One, Zero},50 ArithmeticError,51};52use sp_std::{boxed::Box, vec::Vec};53use up_data_structs::{CollectionId, TokenId, CreateCollectionData};5455// NOTE: MultiLocation is used in storages, we will need to do migration if upgrade the56// MultiLocation to the XCM v3.57use xcm::opaque::latest::{prelude::XcmError, Weight};58use xcm::{latest::MultiLocation, VersionedMultiLocation};59use xcm_executor::{traits::WeightTrader, Assets};6061use pallet_common::erc::CrossAccountId;6263#[cfg(feature = "std")]64use serde::{Deserialize, Serialize};6566// TODO: Move to primitives67// Id of native currency.68// 0 - QTZ\UNQ69// 1 - KSM\DOT70#[derive(71 Clone,72 Copy,73 Eq,74 PartialEq,75 PartialOrd,76 Ord,77 MaxEncodedLen,78 RuntimeDebug,79 Encode,80 Decode,81 TypeInfo,82)]83#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]84pub enum NativeCurrency {85 Here = 0,86 Parent = 1,87}8889#[derive(90 Clone,91 Copy,92 Eq,93 PartialEq,94 PartialOrd,95 Ord,96 MaxEncodedLen,97 RuntimeDebug,98 Encode,99 Decode,100 TypeInfo,101)]102#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]103pub enum AssetIds {104 ForeignAssetId(ForeignAssetId),105 NativeAssetId(NativeCurrency),106}107108pub trait TryAsForeign<T, F> {109 fn try_as_foreign(asset: T) -> Option<F>;110}111112impl TryAsForeign<AssetIds, ForeignAssetId> for AssetIds {113 fn try_as_foreign(asset: AssetIds) -> Option<ForeignAssetId> {114 match asset {115 AssetIds::ForeignAssetId(id) => Some(id),116 _ => None,117 }118 }119}120121pub type ForeignAssetId = u32;122pub type CurrencyId = AssetIds;123124mod impl_fungibles;125pub mod weights;126127#[cfg(feature = "runtime-benchmarks")]128mod benchmarking;129130pub use module::*;131pub use weights::WeightInfo;132133/// Type alias for currency balance.134pub type BalanceOf<T> =135 <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;136137/// A mapping between ForeignAssetId and AssetMetadata.138pub trait AssetIdMapping<ForeignAssetId, MultiLocation, AssetMetadata> {139 /// Returns the AssetMetadata associated with a given ForeignAssetId.140 fn get_asset_metadata(foreign_asset_id: ForeignAssetId) -> Option<AssetMetadata>;141 /// Returns the MultiLocation associated with a given ForeignAssetId.142 fn get_multi_location(foreign_asset_id: ForeignAssetId) -> Option<MultiLocation>;143 /// Returns the CurrencyId associated with a given MultiLocation.144 fn get_currency_id(multi_location: MultiLocation) -> Option<CurrencyId>;145}146147pub struct XcmForeignAssetIdMapping<T>(sp_std::marker::PhantomData<T>);148149impl<T: Config> AssetIdMapping<ForeignAssetId, MultiLocation, AssetMetadata<BalanceOf<T>>>150 for XcmForeignAssetIdMapping<T>151{152 fn get_asset_metadata(foreign_asset_id: ForeignAssetId) -> Option<AssetMetadata<BalanceOf<T>>> {153 log::trace!(target: "fassets::asset_metadatas", "call");154 Pallet::<T>::asset_metadatas(AssetIds::ForeignAssetId(foreign_asset_id))155 }156157 fn get_multi_location(foreign_asset_id: ForeignAssetId) -> Option<MultiLocation> {158 log::trace!(target: "fassets::get_multi_location", "call");159 Pallet::<T>::foreign_asset_locations(foreign_asset_id)160 }161162 fn get_currency_id(multi_location: MultiLocation) -> Option<CurrencyId> {163 log::trace!(target: "fassets::get_currency_id", "call");164 Pallet::<T>::location_to_currency_ids(multi_location).map(|id| AssetIds::ForeignAssetId(id))165 }166}167168#[frame_support::pallet]169pub mod module {170 use super::*;171172 #[pallet::config]173 pub trait Config:174 frame_system::Config175 + pallet_common::Config176 + pallet_fungible::Config177 + orml_tokens::Config178 + pallet_balances::Config179 {180 /// The overarching event type.181 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;182183 /// Currency type for withdraw and balance storage.184 type Currency: Currency<Self::AccountId>;185186 /// Required origin for registering asset.187 type RegisterOrigin: EnsureOrigin<Self::RuntimeOrigin>;188189 /// Weight information for the extrinsics in this module.190 type WeightInfo: WeightInfo;191 }192193 pub type AssetName = BoundedVec<u8, ConstU32<32>>;194 pub type AssetSymbol = BoundedVec<u8, ConstU32<7>>;195196 #[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, TypeInfo, MaxEncodedLen)]197 pub struct AssetMetadata<Balance> {198 pub name: AssetName,199 pub symbol: AssetSymbol,200 pub decimals: u8,201 pub minimal_balance: Balance,202 }203204 #[pallet::error]205 pub enum Error<T> {206 /// The given location could not be used (e.g. because it cannot be expressed in the207 /// desired version of XCM).208 BadLocation,209 /// MultiLocation existed210 MultiLocationExisted,211 /// AssetId not exists212 AssetIdNotExists,213 /// AssetId exists214 AssetIdExisted,215 }216217 #[pallet::event]218 #[pallet::generate_deposit(fn deposit_event)]219 pub enum Event<T: Config> {220 /// The foreign asset registered.221 ForeignAssetRegistered {222 asset_id: ForeignAssetId,223 asset_address: MultiLocation,224 metadata: AssetMetadata<BalanceOf<T>>,225 },226 /// The foreign asset updated.227 ForeignAssetUpdated {228 asset_id: ForeignAssetId,229 asset_address: MultiLocation,230 metadata: AssetMetadata<BalanceOf<T>>,231 },232 /// The asset registered.233 AssetRegistered {234 asset_id: AssetIds,235 metadata: AssetMetadata<BalanceOf<T>>,236 },237 /// The asset updated.238 AssetUpdated {239 asset_id: AssetIds,240 metadata: AssetMetadata<BalanceOf<T>>,241 },242 }243244 /// Next available Foreign AssetId ID.245 ///246 /// NextForeignAssetId: ForeignAssetId247 #[pallet::storage]248 #[pallet::getter(fn next_foreign_asset_id)]249 pub type NextForeignAssetId<T: Config> = StorageValue<_, ForeignAssetId, ValueQuery>;250 /// The storages for MultiLocations.251 ///252 /// ForeignAssetLocations: map ForeignAssetId => Option<MultiLocation>253 #[pallet::storage]254 #[pallet::getter(fn foreign_asset_locations)]255 pub type ForeignAssetLocations<T: Config> =256 StorageMap<_, Twox64Concat, ForeignAssetId, xcm::v3::MultiLocation, OptionQuery>;257258 /// The storages for CurrencyIds.259 ///260 /// LocationToCurrencyIds: map MultiLocation => Option<ForeignAssetId>261 #[pallet::storage]262 #[pallet::getter(fn location_to_currency_ids)]263 pub type LocationToCurrencyIds<T: Config> =264 StorageMap<_, Twox64Concat, xcm::v3::MultiLocation, ForeignAssetId, OptionQuery>;265266 /// The storages for AssetMetadatas.267 ///268 /// AssetMetadatas: map AssetIds => Option<AssetMetadata>269 #[pallet::storage]270 #[pallet::getter(fn asset_metadatas)]271 pub type AssetMetadatas<T: Config> =272 StorageMap<_, Twox64Concat, AssetIds, AssetMetadata<BalanceOf<T>>, OptionQuery>;273274 /// The storages for assets to fungible collection binding275 ///276 #[pallet::storage]277 #[pallet::getter(fn asset_binding)]278 pub type AssetBinding<T: Config> =279 StorageMap<_, Twox64Concat, ForeignAssetId, CollectionId, OptionQuery>;280281 #[pallet::pallet]282 pub struct Pallet<T>(_);283284 #[pallet::call]285 impl<T: Config> Pallet<T> {286 #[pallet::call_index(0)]287 #[pallet::weight(<T as Config>::WeightInfo::register_foreign_asset())]288 pub fn register_foreign_asset(289 origin: OriginFor<T>,290 owner: T::AccountId,291 location: Box<VersionedMultiLocation>,292 metadata: Box<AssetMetadata<BalanceOf<T>>>,293 ) -> DispatchResult {294 T::RegisterOrigin::ensure_origin(origin.clone())?;295296 let location: MultiLocation = (*location)297 .try_into()298 .map_err(|()| Error::<T>::BadLocation)?;299300 let md = metadata.clone();301 let name: Vec<u16> = md.name.into_iter().map(|x| x as u16).collect::<Vec<u16>>();302 let mut description: Vec<u16> = "Foreign assets collection for "303 .encode_utf16()304 .collect::<Vec<u16>>();305 description.append(&mut name.clone());306307 let data: CreateCollectionData<T::AccountId> = CreateCollectionData {308 name: name.try_into().unwrap(),309 description: description.try_into().unwrap(),310 mode: CollectionMode::Fungible(md.decimals),311 ..Default::default()312 };313 let owner = T::CrossAccountId::from_sub(owner);314 let bounded_collection_id =315 <PalletFungible<T>>::init_foreign_collection(owner.clone(), owner, data)?;316 let foreign_asset_id =317 Self::do_register_foreign_asset(&location, &metadata, bounded_collection_id)?;318319 Self::deposit_event(Event::<T>::ForeignAssetRegistered {320 asset_id: foreign_asset_id,321 asset_address: location,322 metadata: *metadata,323 });324 Ok(())325 }326327 #[pallet::call_index(1)]328 #[pallet::weight(<T as Config>::WeightInfo::update_foreign_asset())]329 pub fn update_foreign_asset(330 origin: OriginFor<T>,331 foreign_asset_id: ForeignAssetId,332 location: Box<VersionedMultiLocation>,333 metadata: Box<AssetMetadata<BalanceOf<T>>>,334 ) -> DispatchResult {335 T::RegisterOrigin::ensure_origin(origin)?;336337 let location: MultiLocation = (*location)338 .try_into()339 .map_err(|()| Error::<T>::BadLocation)?;340 Self::do_update_foreign_asset(foreign_asset_id, &location, &metadata)?;341342 Self::deposit_event(Event::<T>::ForeignAssetUpdated {343 asset_id: foreign_asset_id,344 asset_address: location,345 metadata: *metadata,346 });347 Ok(())348 }349 }350}351352impl<T: Config> Pallet<T> {353 fn get_next_foreign_asset_id() -> Result<ForeignAssetId, DispatchError> {354 NextForeignAssetId::<T>::try_mutate(|current| -> Result<ForeignAssetId, DispatchError> {355 let id = *current;356 *current = current357 .checked_add(One::one())358 .ok_or(ArithmeticError::Overflow)?;359 Ok(id)360 })361 }362363 fn do_register_foreign_asset(364 location: &MultiLocation,365 metadata: &AssetMetadata<BalanceOf<T>>,366 bounded_collection_id: CollectionId,367 ) -> Result<ForeignAssetId, DispatchError> {368 let foreign_asset_id = Self::get_next_foreign_asset_id()?;369 LocationToCurrencyIds::<T>::try_mutate(location, |maybe_currency_ids| -> DispatchResult {370 ensure!(371 maybe_currency_ids.is_none(),372 Error::<T>::MultiLocationExisted373 );374 *maybe_currency_ids = Some(foreign_asset_id);375 // *maybe_currency_ids = Some(CurrencyId::ForeignAsset(foreign_asset_id));376377 ForeignAssetLocations::<T>::try_mutate(378 foreign_asset_id,379 |maybe_location| -> DispatchResult {380 ensure!(maybe_location.is_none(), Error::<T>::MultiLocationExisted);381 *maybe_location = Some(location.clone());382383 AssetMetadatas::<T>::try_mutate(384 AssetIds::ForeignAssetId(foreign_asset_id),385 |maybe_asset_metadatas| -> DispatchResult {386 ensure!(maybe_asset_metadatas.is_none(), Error::<T>::AssetIdExisted);387 *maybe_asset_metadatas = Some(metadata.clone());388 Ok(())389 },390 )391 },392 )?;393394 AssetBinding::<T>::try_mutate(foreign_asset_id, |collection_id| -> DispatchResult {395 *collection_id = Some(bounded_collection_id);396 Ok(())397 })398 })?;399400 Ok(foreign_asset_id)401 }402403 fn do_update_foreign_asset(404 foreign_asset_id: ForeignAssetId,405 location: &MultiLocation,406 metadata: &AssetMetadata<BalanceOf<T>>,407 ) -> DispatchResult {408 ForeignAssetLocations::<T>::try_mutate(409 foreign_asset_id,410 |maybe_multi_locations| -> DispatchResult {411 let old_multi_locations = maybe_multi_locations412 .as_mut()413 .ok_or(Error::<T>::AssetIdNotExists)?;414415 AssetMetadatas::<T>::try_mutate(416 AssetIds::ForeignAssetId(foreign_asset_id),417 |maybe_asset_metadatas| -> DispatchResult {418 ensure!(419 maybe_asset_metadatas.is_some(),420 Error::<T>::AssetIdNotExists421 );422423 // modify location424 if location != old_multi_locations {425 LocationToCurrencyIds::<T>::remove(old_multi_locations.clone());426 LocationToCurrencyIds::<T>::try_mutate(427 location,428 |maybe_currency_ids| -> DispatchResult {429 ensure!(430 maybe_currency_ids.is_none(),431 Error::<T>::MultiLocationExisted432 );433 // *maybe_currency_ids = Some(CurrencyId::ForeignAsset(foreign_asset_id));434 *maybe_currency_ids = Some(foreign_asset_id);435 Ok(())436 },437 )?;438 }439 *maybe_asset_metadatas = Some(metadata.clone());440 *old_multi_locations = location.clone();441 Ok(())442 },443 )444 },445 )446 }447}448449pub use frame_support::{450 traits::{451 fungibles::{Balanced, CreditOf},452 tokens::currency::Currency as CurrencyT,453 OnUnbalanced as OnUnbalancedT,454 },455 weights::{WeightToFeePolynomial, WeightToFee},456};457458pub struct FreeForAll<459 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,460 AssetId: Get<MultiLocation>,461 AccountId,462 Currency: CurrencyT<AccountId>,463 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,464>(465 Weight,466 Currency::Balance,467 PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,468);469470impl<471 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,472 AssetId: Get<MultiLocation>,473 AccountId,474 Currency: CurrencyT<AccountId>,475 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,476 > WeightTrader for FreeForAll<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>477{478 fn new() -> Self {479 Self(Weight::default(), Zero::zero(), PhantomData)480 }481482 fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {483 log::trace!(target: "fassets::weight", "buy_weight weight: {:?}, payment: {:?}", weight, payment);484 Ok(payment)485 }486}487impl<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced> Drop488 for FreeForAll<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>489where490 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,491 AssetId: Get<MultiLocation>,492 Currency: CurrencyT<AccountId>,493 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,494{495 fn drop(&mut self) {496 OnUnbalanced::on_unbalanced(Currency::issue(self.1));497 }498}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/>.1617//! # Foreign assets18//!19//! - [`Config`]20//! - [`Call`]21//! - [`Pallet`]22//!23//! ## Overview24//!25//! The foreign assests pallet provides functions for:26//!27//! - Local and foreign assets management. The foreign assets can be updated without runtime upgrade.28//! - Bounds between asset and target collection for cross chain transfer and inner transfers.29//!30//! ## Overview31//!32//! Under construction3334#![cfg_attr(not(feature = "std"), no_std)]35#![allow(clippy::unused_unit)]3637use frame_support::{38 dispatch::DispatchResult,39 ensure,40 pallet_prelude::*,41 traits::{fungible, fungibles, Currency, EnsureOrigin},42 RuntimeDebug,43};44use frame_system::pallet_prelude::*;45use up_data_structs::{CollectionMode};46use pallet_fungible::{Pallet as PalletFungible};47use scale_info::{TypeInfo};48use sp_runtime::{49 traits::{One, Zero},50 ArithmeticError,51};52use sp_std::{boxed::Box, vec::Vec};53use up_data_structs::{CollectionId, TokenId, CreateCollectionData};5455// NOTE: MultiLocation is used in storages, we will need to do migration if upgrade the56// MultiLocation to the XCM v3.57use xcm::opaque::latest::{prelude::XcmError, Weight};58use xcm::{latest::MultiLocation, VersionedMultiLocation};59use xcm_executor::{traits::WeightTrader, Assets};6061use pallet_common::erc::CrossAccountId;6263#[cfg(feature = "std")]64use serde::{Deserialize, Serialize};6566// TODO: Move to primitives67// Id of native currency.68// 0 - QTZ\UNQ69// 1 - KSM\DOT70#[derive(71 Clone,72 Copy,73 Eq,74 PartialEq,75 PartialOrd,76 Ord,77 MaxEncodedLen,78 RuntimeDebug,79 Encode,80 Decode,81 TypeInfo,82)]83#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]84pub enum NativeCurrency {85 Here = 0,86 Parent = 1,87}8889#[derive(90 Clone,91 Copy,92 Eq,93 PartialEq,94 PartialOrd,95 Ord,96 MaxEncodedLen,97 RuntimeDebug,98 Encode,99 Decode,100 TypeInfo,101)]102#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]103pub enum AssetIds {104 ForeignAssetId(ForeignAssetId),105 NativeAssetId(NativeCurrency),106}107108pub trait TryAsForeign<T, F> {109 fn try_as_foreign(asset: T) -> Option<F>;110}111112impl TryAsForeign<AssetIds, ForeignAssetId> for AssetIds {113 fn try_as_foreign(asset: AssetIds) -> Option<ForeignAssetId> {114 match asset {115 AssetIds::ForeignAssetId(id) => Some(id),116 _ => None,117 }118 }119}120121pub type ForeignAssetId = u32;122pub type CurrencyId = AssetIds;123124mod impl_fungibles;125pub mod weights;126127#[cfg(feature = "runtime-benchmarks")]128mod benchmarking;129130pub use module::*;131pub use weights::WeightInfo;132133/// Type alias for currency balance.134pub type BalanceOf<T> =135 <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;136137/// A mapping between ForeignAssetId and AssetMetadata.138pub trait AssetIdMapping<ForeignAssetId, MultiLocation, AssetMetadata> {139 /// Returns the AssetMetadata associated with a given ForeignAssetId.140 fn get_asset_metadata(foreign_asset_id: ForeignAssetId) -> Option<AssetMetadata>;141 /// Returns the MultiLocation associated with a given ForeignAssetId.142 fn get_multi_location(foreign_asset_id: ForeignAssetId) -> Option<MultiLocation>;143 /// Returns the CurrencyId associated with a given MultiLocation.144 fn get_currency_id(multi_location: MultiLocation) -> Option<CurrencyId>;145}146147pub struct XcmForeignAssetIdMapping<T>(sp_std::marker::PhantomData<T>);148149impl<T: Config> AssetIdMapping<ForeignAssetId, MultiLocation, AssetMetadata<BalanceOf<T>>>150 for XcmForeignAssetIdMapping<T>151{152 fn get_asset_metadata(foreign_asset_id: ForeignAssetId) -> Option<AssetMetadata<BalanceOf<T>>> {153 log::trace!(target: "fassets::asset_metadatas", "call");154 Pallet::<T>::asset_metadatas(AssetIds::ForeignAssetId(foreign_asset_id))155 }156157 fn get_multi_location(foreign_asset_id: ForeignAssetId) -> Option<MultiLocation> {158 log::trace!(target: "fassets::get_multi_location", "call");159 Pallet::<T>::foreign_asset_locations(foreign_asset_id)160 }161162 fn get_currency_id(multi_location: MultiLocation) -> Option<CurrencyId> {163 log::trace!(target: "fassets::get_currency_id", "call");164 Pallet::<T>::location_to_currency_ids(multi_location).map(|id| AssetIds::ForeignAssetId(id))165 }166}167168#[frame_support::pallet]169pub mod module {170 use super::*;171172 #[pallet::config]173 pub trait Config:174 frame_system::Config175 + pallet_common::Config176 + pallet_fungible::Config177 + orml_tokens::Config178 + pallet_balances::Config179 {180 /// The overarching event type.181 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;182183 /// Currency type for withdraw and balance storage.184 type Currency: Currency<Self::AccountId>;185186 /// Required origin for registering asset.187 type RegisterOrigin: EnsureOrigin<Self::RuntimeOrigin>;188189 /// Weight information for the extrinsics in this module.190 type WeightInfo: WeightInfo;191 }192193 pub type AssetName = BoundedVec<u8, ConstU32<32>>;194 pub type AssetSymbol = BoundedVec<u8, ConstU32<7>>;195196 #[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, TypeInfo, MaxEncodedLen)]197 pub struct AssetMetadata<Balance> {198 pub name: AssetName,199 pub symbol: AssetSymbol,200 pub decimals: u8,201 pub minimal_balance: Balance,202 }203204 #[pallet::error]205 pub enum Error<T> {206 /// The given location could not be used (e.g. because it cannot be expressed in the207 /// desired version of XCM).208 BadLocation,209 /// MultiLocation existed210 MultiLocationExisted,211 /// AssetId not exists212 AssetIdNotExists,213 /// AssetId exists214 AssetIdExisted,215 }216217 #[pallet::event]218 #[pallet::generate_deposit(fn deposit_event)]219 pub enum Event<T: Config> {220 /// The foreign asset registered.221 ForeignAssetRegistered {222 asset_id: ForeignAssetId,223 asset_address: MultiLocation,224 metadata: AssetMetadata<BalanceOf<T>>,225 },226 /// The foreign asset updated.227 ForeignAssetUpdated {228 asset_id: ForeignAssetId,229 asset_address: MultiLocation,230 metadata: AssetMetadata<BalanceOf<T>>,231 },232 /// The asset registered.233 AssetRegistered {234 asset_id: AssetIds,235 metadata: AssetMetadata<BalanceOf<T>>,236 },237 /// The asset updated.238 AssetUpdated {239 asset_id: AssetIds,240 metadata: AssetMetadata<BalanceOf<T>>,241 },242 }243244 /// Next available Foreign AssetId ID.245 ///246 /// NextForeignAssetId: ForeignAssetId247 #[pallet::storage]248 #[pallet::getter(fn next_foreign_asset_id)]249 pub type NextForeignAssetId<T: Config> = StorageValue<_, ForeignAssetId, ValueQuery>;250 /// The storages for MultiLocations.251 ///252 /// ForeignAssetLocations: map ForeignAssetId => Option<MultiLocation>253 #[pallet::storage]254 #[pallet::getter(fn foreign_asset_locations)]255 pub type ForeignAssetLocations<T: Config> =256 StorageMap<_, Twox64Concat, ForeignAssetId, xcm::v3::MultiLocation, OptionQuery>;257258 /// The storages for CurrencyIds.259 ///260 /// LocationToCurrencyIds: map MultiLocation => Option<ForeignAssetId>261 #[pallet::storage]262 #[pallet::getter(fn location_to_currency_ids)]263 pub type LocationToCurrencyIds<T: Config> =264 StorageMap<_, Twox64Concat, xcm::v3::MultiLocation, ForeignAssetId, OptionQuery>;265266 /// The storages for AssetMetadatas.267 ///268 /// AssetMetadatas: map AssetIds => Option<AssetMetadata>269 #[pallet::storage]270 #[pallet::getter(fn asset_metadatas)]271 pub type AssetMetadatas<T: Config> =272 StorageMap<_, Twox64Concat, AssetIds, AssetMetadata<BalanceOf<T>>, OptionQuery>;273274 /// The storages for assets to fungible collection binding275 ///276 #[pallet::storage]277 #[pallet::getter(fn asset_binding)]278 pub type AssetBinding<T: Config> =279 StorageMap<_, Twox64Concat, ForeignAssetId, CollectionId, OptionQuery>;280281 #[pallet::pallet]282 pub struct Pallet<T>(_);283284 #[pallet::call]285 impl<T: Config> Pallet<T> {286 #[pallet::call_index(0)]287 #[pallet::weight(<T as Config>::WeightInfo::register_foreign_asset())]288 pub fn register_foreign_asset(289 origin: OriginFor<T>,290 owner: T::AccountId,291 location: Box<VersionedMultiLocation>,292 metadata: Box<AssetMetadata<BalanceOf<T>>>,293 ) -> DispatchResult {294 T::RegisterOrigin::ensure_origin(origin.clone())?;295296 let location: MultiLocation = (*location)297 .try_into()298 .map_err(|()| Error::<T>::BadLocation)?;299300 let md = metadata.clone();301 let name: Vec<u16> = md.name.into_iter().map(|x| x as u16).collect::<Vec<u16>>();302 let mut description: Vec<u16> = "Foreign assets collection for "303 .encode_utf16()304 .collect::<Vec<u16>>();305 description.append(&mut name.clone());306307 let data: CreateCollectionData<T::AccountId> = CreateCollectionData {308 name: name.try_into().unwrap(),309 description: description.try_into().unwrap(),310 mode: CollectionMode::Fungible(md.decimals),311 ..Default::default()312 };313 let owner = T::CrossAccountId::from_sub(owner);314 let bounded_collection_id =315 <PalletFungible<T>>::init_foreign_collection(owner.clone(), owner, data)?;316 let foreign_asset_id =317 Self::do_register_foreign_asset(&location, &metadata, bounded_collection_id)?;318319 Self::deposit_event(Event::<T>::ForeignAssetRegistered {320 asset_id: foreign_asset_id,321 asset_address: location,322 metadata: *metadata,323 });324 Ok(())325 }326327 #[pallet::call_index(1)]328 #[pallet::weight(<T as Config>::WeightInfo::update_foreign_asset())]329 pub fn update_foreign_asset(330 origin: OriginFor<T>,331 foreign_asset_id: ForeignAssetId,332 location: Box<VersionedMultiLocation>,333 metadata: Box<AssetMetadata<BalanceOf<T>>>,334 ) -> DispatchResult {335 T::RegisterOrigin::ensure_origin(origin)?;336337 let location: MultiLocation = (*location)338 .try_into()339 .map_err(|()| Error::<T>::BadLocation)?;340 Self::do_update_foreign_asset(foreign_asset_id, &location, &metadata)?;341342 Self::deposit_event(Event::<T>::ForeignAssetUpdated {343 asset_id: foreign_asset_id,344 asset_address: location,345 metadata: *metadata,346 });347 Ok(())348 }349 }350}351352impl<T: Config> Pallet<T> {353 fn get_next_foreign_asset_id() -> Result<ForeignAssetId, DispatchError> {354 NextForeignAssetId::<T>::try_mutate(|current| -> Result<ForeignAssetId, DispatchError> {355 let id = *current;356 *current = current357 .checked_add(One::one())358 .ok_or(ArithmeticError::Overflow)?;359 Ok(id)360 })361 }362363 fn do_register_foreign_asset(364 location: &MultiLocation,365 metadata: &AssetMetadata<BalanceOf<T>>,366 bounded_collection_id: CollectionId,367 ) -> Result<ForeignAssetId, DispatchError> {368 let foreign_asset_id = Self::get_next_foreign_asset_id()?;369 LocationToCurrencyIds::<T>::try_mutate(location, |maybe_currency_ids| -> DispatchResult {370 ensure!(371 maybe_currency_ids.is_none(),372 Error::<T>::MultiLocationExisted373 );374 *maybe_currency_ids = Some(foreign_asset_id);375 // *maybe_currency_ids = Some(CurrencyId::ForeignAsset(foreign_asset_id));376377 ForeignAssetLocations::<T>::try_mutate(378 foreign_asset_id,379 |maybe_location| -> DispatchResult {380 ensure!(maybe_location.is_none(), Error::<T>::MultiLocationExisted);381 *maybe_location = Some(location.clone());382383 AssetMetadatas::<T>::try_mutate(384 AssetIds::ForeignAssetId(foreign_asset_id),385 |maybe_asset_metadatas| -> DispatchResult {386 ensure!(maybe_asset_metadatas.is_none(), Error::<T>::AssetIdExisted);387 *maybe_asset_metadatas = Some(metadata.clone());388 Ok(())389 },390 )391 },392 )?;393394 AssetBinding::<T>::try_mutate(foreign_asset_id, |collection_id| -> DispatchResult {395 *collection_id = Some(bounded_collection_id);396 Ok(())397 })398 })?;399400 Ok(foreign_asset_id)401 }402403 fn do_update_foreign_asset(404 foreign_asset_id: ForeignAssetId,405 location: &MultiLocation,406 metadata: &AssetMetadata<BalanceOf<T>>,407 ) -> DispatchResult {408 ForeignAssetLocations::<T>::try_mutate(409 foreign_asset_id,410 |maybe_multi_locations| -> DispatchResult {411 let old_multi_locations = maybe_multi_locations412 .as_mut()413 .ok_or(Error::<T>::AssetIdNotExists)?;414415 AssetMetadatas::<T>::try_mutate(416 AssetIds::ForeignAssetId(foreign_asset_id),417 |maybe_asset_metadatas| -> DispatchResult {418 ensure!(419 maybe_asset_metadatas.is_some(),420 Error::<T>::AssetIdNotExists421 );422423 // modify location424 if location != old_multi_locations {425 LocationToCurrencyIds::<T>::remove(old_multi_locations.clone());426 LocationToCurrencyIds::<T>::try_mutate(427 location,428 |maybe_currency_ids| -> DispatchResult {429 ensure!(430 maybe_currency_ids.is_none(),431 Error::<T>::MultiLocationExisted432 );433 // *maybe_currency_ids = Some(CurrencyId::ForeignAsset(foreign_asset_id));434 *maybe_currency_ids = Some(foreign_asset_id);435 Ok(())436 },437 )?;438 }439 *maybe_asset_metadatas = Some(metadata.clone());440 *old_multi_locations = location.clone();441 Ok(())442 },443 )444 },445 )446 }447}448449pub use frame_support::{450 traits::{451 fungibles::Balanced, tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT,452 },453 weights::{WeightToFeePolynomial, WeightToFee},454};455456pub struct FreeForAll<457 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,458 AssetId: Get<MultiLocation>,459 AccountId,460 Currency: CurrencyT<AccountId>,461 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,462>(463 Weight,464 Currency::Balance,465 PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,466);467468impl<469 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,470 AssetId: Get<MultiLocation>,471 AccountId,472 Currency: CurrencyT<AccountId>,473 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,474 > WeightTrader for FreeForAll<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>475{476 fn new() -> Self {477 Self(Weight::default(), Zero::zero(), PhantomData)478 }479480 fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {481 log::trace!(target: "fassets::weight", "buy_weight weight: {:?}, payment: {:?}", weight, payment);482 Ok(payment)483 }484}485impl<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced> Drop486 for FreeForAll<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>487where488 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,489 AssetId: Get<MultiLocation>,490 Currency: CurrencyT<AccountId>,491 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,492{493 fn drop(&mut self) {494 OnUnbalanced::on_unbalanced(Currency::issue(self.1));495 }496}pallets/identity/Cargo.tomldiffbeforeafterboth--- a/pallets/identity/Cargo.toml
+++ b/pallets/identity/Cargo.toml
@@ -26,7 +26,7 @@
sp-std = { workspace = true }
[dev-dependencies]
-pallet-balances = { workspace = true }
+pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
sp-core = { workspace = true }
[features]
pallets/inflation/Cargo.tomldiffbeforeafterboth--- a/pallets/inflation/Cargo.toml
+++ b/pallets/inflation/Cargo.toml
@@ -37,7 +37,7 @@
frame-benchmarking = { workspace = true, optional = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
-pallet-balances = { workspace = true }
+pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
runtime/common/config/xcm/mod.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -114,12 +114,26 @@
);
pub trait TryPass {
+<<<<<<< HEAD
fn try_pass<Call>(origin: &MultiLocation, message: &mut [Instruction<Call>]) -> Result<(), ()>;
+=======
+ fn try_pass<Call>(
+ origin: &MultiLocation,
+ message: &mut [Instruction<Call>],
+ ) -> Result<(), ProcessMessageError>;
+>>>>>>> fd33b0ac (fixup pallets)
}
#[impl_trait_for_tuples::impl_for_tuples(30)]
impl TryPass for Tuple {
+<<<<<<< HEAD
fn try_pass<Call>(origin: &MultiLocation, message: &mut [Instruction<Call>]) -> Result<(), ()> {
+=======
+ fn try_pass<Call>(
+ origin: &MultiLocation,
+ message: &mut [Instruction<Call>],
+ ) -> Result<(), ProcessMessageError> {
+>>>>>>> fd33b0ac (fixup pallets)
for_tuples!( #(
Tuple::try_pass(origin, message)?;
)* );
test-pallets/utils/src/lib.rsdiffbeforeafterboth--- a/test-pallets/utils/src/lib.rs
+++ b/test-pallets/utils/src/lib.rs
@@ -20,7 +20,7 @@
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
-#[frame_support::pallet]
+#[frame_support::pallet(dev_mode)]
pub mod pallet {
use frame_support::{
pallet_prelude::*,