difftreelog
fix unit tests
in: master
6 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -12926,8 +12926,8 @@
"frame-support",
"frame-system",
"pallet-balances",
+ "pallet-balances-adapter",
"pallet-common",
- "pallet-configuration",
"pallet-ethereum",
"pallet-evm",
"pallet-evm-coder-substrate",
@@ -12938,7 +12938,6 @@
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-unique",
- "pallet-xcm",
"parity-scale-codec",
"scale-info",
"sp-core",
pallets/balances-adapter/src/common.rsdiffbeforeafterboth1use alloc::{vec, vec::Vec};2use core::marker::PhantomData;3use crate::{Config, NativeFungibleHandle, Pallet};4use frame_support::{fail, traits::Currency, weights::Weight};5use pallet_balances::{weights::SubstrateWeight as BalancesWeight, WeightInfo};6use pallet_common::{erc::CrossAccountId, CommonCollectionOperations, CommonWeightInfo};7use up_data_structs::TokenId;89pub struct CommonWeights<T: Config>(PhantomData<T>);10impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {11 fn create_multiple_items(_amount: &[up_data_structs::CreateItemData]) -> Weight {12 Weight::default()13 }1415 fn create_multiple_items_ex(16 _cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,17 ) -> Weight {18 Weight::default()19 }2021 fn burn_item() -> Weight {22 Weight::default()23 }2425 fn set_collection_properties(_amount: u32) -> Weight {26 Weight::default()27 }2829 fn delete_collection_properties(_amount: u32) -> Weight {30 Weight::default()31 }3233 fn set_token_properties(_amount: u32) -> Weight {34 Weight::default()35 }3637 fn delete_token_properties(_amount: u32) -> Weight {38 Weight::default()39 }4041 fn set_token_property_permissions(_amount: u32) -> Weight {42 Weight::default()43 }4445 fn transfer() -> Weight {46 <BalancesWeight<T> as WeightInfo>::transfer()47 }4849 fn approve() -> Weight {50 Weight::default()51 }5253 fn approve_from() -> Weight {54 Weight::default()55 }5657 fn transfer_from() -> Weight {58 <BalancesWeight<T> as WeightInfo>::transfer()59 }6061 fn burn_from() -> Weight {62 Weight::default()63 }6465 fn burn_recursively_self_raw() -> Weight {66 Weight::default()67 }6869 fn burn_recursively_breadth_raw(_amount: u32) -> Weight {70 Weight::default()71 }7273 fn token_owner() -> Weight {74 Weight::default()75 }7677 fn set_allowance_for_all() -> Weight {78 Weight::default()79 }8081 fn force_repair_item() -> Weight {82 Weight::default()83 }84}8586/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallete87/// methods and adds weight info.88impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {89 fn create_item(90 &self,91 _sender: <T>::CrossAccountId,92 _to: <T>::CrossAccountId,93 _data: up_data_structs::CreateItemData,94 _nesting_budget: &dyn up_data_structs::budget::Budget,95 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {96 fail!(<pallet_common::Error<T>>::UnsupportedOperation);97 }9899 fn create_multiple_items(100 &self,101 _sender: <T>::CrossAccountId,102 _to: <T>::CrossAccountId,103 _data: Vec<up_data_structs::CreateItemData>,104 _nesting_budget: &dyn up_data_structs::budget::Budget,105 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {106 fail!(<pallet_common::Error<T>>::UnsupportedOperation);107 }108109 fn create_multiple_items_ex(110 &self,111 _sender: <T>::CrossAccountId,112 _data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,113 _nesting_budget: &dyn up_data_structs::budget::Budget,114 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {115 fail!(<pallet_common::Error<T>>::UnsupportedOperation);116 }117118 fn burn_item(119 &self,120 _sender: <T>::CrossAccountId,121 _token: TokenId,122 _amount: u128,123 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {124 fail!(<pallet_common::Error<T>>::UnsupportedOperation);125 }126127 fn burn_item_recursively(128 &self,129 _sender: <T>::CrossAccountId,130 _token: TokenId,131 _self_budget: &dyn up_data_structs::budget::Budget,132 _breadth_budget: &dyn up_data_structs::budget::Budget,133 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {134 fail!(<pallet_common::Error<T>>::UnsupportedOperation);135 }136137 fn set_collection_properties(138 &self,139 _sender: <T>::CrossAccountId,140 _properties: Vec<up_data_structs::Property>,141 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {142 fail!(<pallet_common::Error<T>>::UnsupportedOperation);143 }144145 fn delete_collection_properties(146 &self,147 _sender: &<T>::CrossAccountId,148 _property_keys: Vec<up_data_structs::PropertyKey>,149 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {150 fail!(<pallet_common::Error<T>>::UnsupportedOperation);151 }152153 fn set_token_properties(154 &self,155 _sender: <T>::CrossAccountId,156 _token_id: TokenId,157 _properties: Vec<up_data_structs::Property>,158 _budget: &dyn up_data_structs::budget::Budget,159 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {160 fail!(<pallet_common::Error<T>>::UnsupportedOperation);161 }162163 fn delete_token_properties(164 &self,165 _sender: <T>::CrossAccountId,166 _token_id: TokenId,167 _property_keys: Vec<up_data_structs::PropertyKey>,168 _budget: &dyn up_data_structs::budget::Budget,169 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {170 fail!(<pallet_common::Error<T>>::UnsupportedOperation);171 }172173 fn set_token_property_permissions(174 &self,175 _sender: &<T>::CrossAccountId,176 _property_permissions: Vec<up_data_structs::PropertyKeyPermission>,177 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {178 fail!(<pallet_common::Error<T>>::UnsupportedOperation);179 }180181 fn transfer(182 &self,183 sender: <T>::CrossAccountId,184 to: <T>::CrossAccountId,185 _token: TokenId,186 amount: u128,187 budget: &dyn up_data_structs::budget::Budget,188 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {189 <Pallet<T>>::transfer(self, &sender, &to, amount, budget)190 }191192 fn approve(193 &self,194 _sender: <T>::CrossAccountId,195 _spender: <T>::CrossAccountId,196 _token: TokenId,197 _amount: u128,198 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {199 fail!(<pallet_common::Error<T>>::UnsupportedOperation);200 }201202 fn approve_from(203 &self,204 _sender: <T>::CrossAccountId,205 _from: <T>::CrossAccountId,206 _to: <T>::CrossAccountId,207 _token: TokenId,208 _amount: u128,209 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {210 fail!(<pallet_common::Error<T>>::UnsupportedOperation);211 }212213 fn transfer_from(214 &self,215 sender: <T>::CrossAccountId,216 from: <T>::CrossAccountId,217 to: <T>::CrossAccountId,218 _token: TokenId,219 amount: u128,220 budget: &dyn up_data_structs::budget::Budget,221 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {222 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, budget)223 }224225 fn burn_from(226 &self,227 _sender: <T>::CrossAccountId,228 _from: <T>::CrossAccountId,229 _token: TokenId,230 _amount: u128,231 _budget: &dyn up_data_structs::budget::Budget,232 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {233 fail!(<pallet_common::Error<T>>::UnsupportedOperation);234 }235236 fn check_nesting(237 &self,238 _sender: <T>::CrossAccountId,239 _from: (up_data_structs::CollectionId, TokenId),240 _under: TokenId,241 _budget: &dyn up_data_structs::budget::Budget,242 ) -> frame_support::sp_runtime::DispatchResult {243 fail!(<pallet_common::Error<T>>::UnsupportedOperation);244 }245246 fn nest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}247248 fn unnest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}249250 fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {251 let balance = <T as Config>::Currency::total_balance(account.as_sub());252 if balance != 0 {253 vec![TokenId::default()]254 } else {255 vec![]256 }257 }258259 fn collection_tokens(&self) -> Vec<TokenId> {260 vec![TokenId::default()]261 }262263 fn token_exists(&self, token: TokenId) -> bool {264 token == TokenId::default()265 }266267 fn last_token_id(&self) -> TokenId {268 TokenId::default()269 }270271 fn token_owner(272 &self,273 _token: TokenId,274 ) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {275 Err(up_data_structs::TokenOwnerError::MultipleOwners)276 }277278 fn token_owners(&self, _token: TokenId) -> Vec<<T>::CrossAccountId> {279 vec![]280 }281282 fn token_property(283 &self,284 _token_id: TokenId,285 _key: &up_data_structs::PropertyKey,286 ) -> Option<up_data_structs::PropertyValue> {287 None288 }289290 fn token_properties(291 &self,292 _token: TokenId,293 _keys: Option<Vec<up_data_structs::PropertyKey>>,294 ) -> Vec<up_data_structs::Property> {295 vec![]296 }297298 fn total_supply(&self) -> u32 {299 1300 }301302 fn account_balance(&self, account: <T>::CrossAccountId) -> u32 {303 let balance: u128 = <T as Config>::Currency::free_balance(account.as_sub()).into();304 (balance != 0).into()305 }306307 fn balance(&self, account: <T>::CrossAccountId, token: TokenId) -> u128 {308 if token != TokenId::default() {309 return 0;310 }311 <T as Config>::Currency::free_balance(account.as_sub()).into()312 }313314 fn total_pieces(&self, token: TokenId) -> Option<u128> {315 if token != TokenId::default() {316 return None;317 }318 let total = <T as Config>::Currency::total_issuance();319 Some(total.into())320 }321322 fn allowance(323 &self,324 _sender: <T>::CrossAccountId,325 _spender: <T>::CrossAccountId,326 _token: TokenId,327 ) -> u128 {328 0329 }330331 fn refungible_extensions(&self) -> Option<&dyn pallet_common::RefungibleExtensions<T>> {332 None333 }334335 fn set_allowance_for_all(336 &self,337 _owner: <T>::CrossAccountId,338 _operator: <T>::CrossAccountId,339 _approve: bool,340 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {341 fail!(<pallet_common::Error<T>>::UnsupportedOperation);342 }343344 fn allowance_for_all(345 &self,346 _owner: <T>::CrossAccountId,347 _operator: <T>::CrossAccountId,348 ) -> bool {349 false350 }351352 fn repair_item(353 &self,354 _token: TokenId,355 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {356 fail!(<pallet_common::Error<T>>::UnsupportedOperation);357 }358}1use alloc::{vec, vec::Vec};2use core::marker::PhantomData;3use crate::{Config, NativeFungibleHandle, Pallet};4use frame_support::{fail, traits::Currency, weights::Weight};5use pallet_balances::{weights::SubstrateWeight as BalancesWeight, WeightInfo};6use pallet_common::{erc::CrossAccountId, CommonCollectionOperations, CommonWeightInfo};7use up_data_structs::TokenId;89pub struct CommonWeights<T: Config>(PhantomData<T>);10impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {11 fn create_multiple_items(_amount: &[up_data_structs::CreateItemData]) -> Weight {12 Weight::default()13 }1415 fn create_multiple_items_ex(16 _cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,17 ) -> Weight {18 Weight::default()19 }2021 fn burn_item() -> Weight {22 Weight::default()23 }2425 fn set_collection_properties(_amount: u32) -> Weight {26 Weight::default()27 }2829 fn delete_collection_properties(_amount: u32) -> Weight {30 Weight::default()31 }3233 fn set_token_properties(_amount: u32) -> Weight {34 Weight::default()35 }3637 fn delete_token_properties(_amount: u32) -> Weight {38 Weight::default()39 }4041 fn set_token_property_permissions(_amount: u32) -> Weight {42 Weight::default()43 }4445 fn transfer() -> Weight {46 <BalancesWeight<T> as WeightInfo>::transfer()47 }4849 fn approve() -> Weight {50 Weight::default()51 }5253 fn approve_from() -> Weight {54 Weight::default()55 }5657 fn transfer_from() -> Weight {58 <BalancesWeight<T> as WeightInfo>::transfer()59 }6061 fn burn_from() -> Weight {62 Weight::default()63 }6465 fn burn_recursively_self_raw() -> Weight {66 Weight::default()67 }6869 fn burn_recursively_breadth_raw(_amount: u32) -> Weight {70 Weight::default()71 }7273 fn token_owner() -> Weight {74 Weight::default()75 }7677 fn set_allowance_for_all() -> Weight {78 Weight::default()79 }8081 fn force_repair_item() -> Weight {82 Weight::default()83 }84}8586/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallete87/// methods and adds weight info.88impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {89 fn create_item(90 &self,91 _sender: <T>::CrossAccountId,92 _to: <T>::CrossAccountId,93 _data: up_data_structs::CreateItemData,94 _nesting_budget: &dyn up_data_structs::budget::Budget,95 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {96 fail!(<pallet_common::Error<T>>::UnsupportedOperation);97 }9899 fn create_multiple_items(100 &self,101 _sender: <T>::CrossAccountId,102 _to: <T>::CrossAccountId,103 _data: Vec<up_data_structs::CreateItemData>,104 _nesting_budget: &dyn up_data_structs::budget::Budget,105 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {106 fail!(<pallet_common::Error<T>>::UnsupportedOperation);107 }108109 fn create_multiple_items_ex(110 &self,111 _sender: <T>::CrossAccountId,112 _data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,113 _nesting_budget: &dyn up_data_structs::budget::Budget,114 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {115 fail!(<pallet_common::Error<T>>::UnsupportedOperation);116 }117118 fn burn_item(119 &self,120 _sender: <T>::CrossAccountId,121 _token: TokenId,122 _amount: u128,123 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {124 fail!(<pallet_common::Error<T>>::UnsupportedOperation);125 }126127 fn burn_item_recursively(128 &self,129 _sender: <T>::CrossAccountId,130 _token: TokenId,131 _self_budget: &dyn up_data_structs::budget::Budget,132 _breadth_budget: &dyn up_data_structs::budget::Budget,133 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {134 fail!(<pallet_common::Error<T>>::UnsupportedOperation);135 }136137 fn set_collection_properties(138 &self,139 _sender: <T>::CrossAccountId,140 _properties: Vec<up_data_structs::Property>,141 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {142 fail!(<pallet_common::Error<T>>::UnsupportedOperation);143 }144145 fn delete_collection_properties(146 &self,147 _sender: &<T>::CrossAccountId,148 _property_keys: Vec<up_data_structs::PropertyKey>,149 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {150 fail!(<pallet_common::Error<T>>::UnsupportedOperation);151 }152153 fn set_token_properties(154 &self,155 _sender: <T>::CrossAccountId,156 _token_id: TokenId,157 _properties: Vec<up_data_structs::Property>,158 _budget: &dyn up_data_structs::budget::Budget,159 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {160 fail!(<pallet_common::Error<T>>::UnsupportedOperation);161 }162163 fn delete_token_properties(164 &self,165 _sender: <T>::CrossAccountId,166 _token_id: TokenId,167 _property_keys: Vec<up_data_structs::PropertyKey>,168 _budget: &dyn up_data_structs::budget::Budget,169 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {170 fail!(<pallet_common::Error<T>>::UnsupportedOperation);171 }172173 fn set_token_property_permissions(174 &self,175 _sender: &<T>::CrossAccountId,176 _property_permissions: Vec<up_data_structs::PropertyKeyPermission>,177 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {178 fail!(<pallet_common::Error<T>>::UnsupportedOperation);179 }180181 fn transfer(182 &self,183 sender: <T>::CrossAccountId,184 to: <T>::CrossAccountId,185 _token: TokenId,186 amount: u128,187 budget: &dyn up_data_structs::budget::Budget,188 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {189 <Pallet<T>>::transfer(self, &sender, &to, amount, budget)190 }191192 fn approve(193 &self,194 _sender: <T>::CrossAccountId,195 _spender: <T>::CrossAccountId,196 _token: TokenId,197 _amount: u128,198 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {199 fail!(<pallet_common::Error<T>>::UnsupportedOperation);200 }201202 fn approve_from(203 &self,204 _sender: <T>::CrossAccountId,205 _from: <T>::CrossAccountId,206 _to: <T>::CrossAccountId,207 _token: TokenId,208 _amount: u128,209 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {210 fail!(<pallet_common::Error<T>>::UnsupportedOperation);211 }212213 fn transfer_from(214 &self,215 sender: <T>::CrossAccountId,216 from: <T>::CrossAccountId,217 to: <T>::CrossAccountId,218 _token: TokenId,219 amount: u128,220 budget: &dyn up_data_structs::budget::Budget,221 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {222 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, budget)223 }224225 fn burn_from(226 &self,227 _sender: <T>::CrossAccountId,228 _from: <T>::CrossAccountId,229 _token: TokenId,230 _amount: u128,231 _budget: &dyn up_data_structs::budget::Budget,232 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {233 fail!(<pallet_common::Error<T>>::UnsupportedOperation);234 }235236 fn check_nesting(237 &self,238 _sender: <T>::CrossAccountId,239 _from: (up_data_structs::CollectionId, TokenId),240 _under: TokenId,241 _budget: &dyn up_data_structs::budget::Budget,242 ) -> frame_support::sp_runtime::DispatchResult {243 fail!(<pallet_common::Error<T>>::UnsupportedOperation);244 }245246 fn nest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}247248 fn unnest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}249250 fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {251 let balance = <T as Config>::Currency::total_balance(account.as_sub());252 let balance: u128 = balance.into();253 if balance != 0 {254 vec![TokenId::default()]255 } else {256 vec![]257 }258 }259260 fn collection_tokens(&self) -> Vec<TokenId> {261 vec![TokenId::default()]262 }263264 fn token_exists(&self, token: TokenId) -> bool {265 token == TokenId::default()266 }267268 fn last_token_id(&self) -> TokenId {269 TokenId::default()270 }271272 fn token_owner(273 &self,274 _token: TokenId,275 ) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {276 Err(up_data_structs::TokenOwnerError::MultipleOwners)277 }278279 fn token_owners(&self, _token: TokenId) -> Vec<<T>::CrossAccountId> {280 vec![]281 }282283 fn token_property(284 &self,285 _token_id: TokenId,286 _key: &up_data_structs::PropertyKey,287 ) -> Option<up_data_structs::PropertyValue> {288 None289 }290291 fn token_properties(292 &self,293 _token: TokenId,294 _keys: Option<Vec<up_data_structs::PropertyKey>>,295 ) -> Vec<up_data_structs::Property> {296 vec![]297 }298299 fn total_supply(&self) -> u32 {300 1301 }302303 fn account_balance(&self, account: <T>::CrossAccountId) -> u32 {304 let balance: u128 = <T as Config>::Currency::free_balance(account.as_sub()).into();305 (balance != 0).into()306 }307308 fn balance(&self, account: <T>::CrossAccountId, token: TokenId) -> u128 {309 if token != TokenId::default() {310 return 0;311 }312 <T as Config>::Currency::free_balance(account.as_sub()).into()313 }314315 fn total_pieces(&self, token: TokenId) -> Option<u128> {316 if token != TokenId::default() {317 return None;318 }319 let total = <T as Config>::Currency::total_issuance();320 Some(total.into())321 }322323 fn allowance(324 &self,325 _sender: <T>::CrossAccountId,326 _spender: <T>::CrossAccountId,327 _token: TokenId,328 ) -> u128 {329 0330 }331332 fn refungible_extensions(&self) -> Option<&dyn pallet_common::RefungibleExtensions<T>> {333 None334 }335336 fn set_allowance_for_all(337 &self,338 _owner: <T>::CrossAccountId,339 _operator: <T>::CrossAccountId,340 _approve: bool,341 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {342 fail!(<pallet_common::Error<T>>::UnsupportedOperation);343 }344345 fn allowance_for_all(346 &self,347 _owner: <T>::CrossAccountId,348 _operator: <T>::CrossAccountId,349 ) -> bool {350 false351 }352353 fn repair_item(354 &self,355 _token: TokenId,356 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {357 fail!(<pallet_common::Error<T>>::UnsupportedOperation);358 }359}pallets/balances-adapter/src/lib.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/lib.rs
+++ b/pallets/balances-adapter/src/lib.rs
@@ -76,7 +76,7 @@
Balance = Self::CurrencyBalance,
>;
/// Balance type of chain
- type CurrencyBalance: Into<U256> + TryFrom<U256> + PartialEq<u128> + From<u128> + Into<u128>;
+ type CurrencyBalance: Into<U256> + TryFrom<U256> + TryFrom<u128> + Into<u128>;
/// Decimals of balance
type Decimals: Get<u8>;
@@ -144,7 +144,9 @@
<T as Config>::Currency::transfer(
from.as_sub(),
to.as_sub(),
- amount.into(),
+ amount
+ .try_into()
+ .map_err(|_| sp_runtime::ArithmeticError::Overflow)?,
ExistenceRequirement::KeepAlive,
)?;
runtime/common/config/pallets/mod.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -54,10 +54,7 @@
parameter_types! {
pub const CollectionCreationPrice: Balance = 2 * UNIQUE;
- pub const Decimals: u8 = DECIMALS;
pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account_truncating();
- pub Name: String = RUNTIME_NAME.to_string();
- pub Symbol: String = TOKEN_SYMBOL.to_string();
}
impl pallet_common::Config for Runtime {
@@ -88,6 +85,12 @@
impl pallet_nonfungible::Config for Runtime {
type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
}
+
+parameter_types! {
+ pub const Decimals: u8 = DECIMALS;
+ pub Name: String = RUNTIME_NAME.to_string();
+ pub Symbol: String = TOKEN_SYMBOL.to_string();
+}
impl pallet_balances_adapter::Config for Runtime {
type Currency = Balances;
type CurrencyBalance = <Balances as Currency<Self::AccountId>>::Balance;
runtime/tests/Cargo.tomldiffbeforeafterboth--- a/runtime/tests/Cargo.toml
+++ b/runtime/tests/Cargo.toml
@@ -26,6 +26,7 @@
pallet-ethereum = { workspace = true }
pallet-evm = { workspace = true }
+pallet-balances-adapter = { workspace = true }
pallet-common = { workspace = true }
pallet-fungible = { workspace = true }
pallet-nonfungible = { workspace = true }
@@ -41,5 +42,3 @@
evm-coder = { workspace = true }
up-sponsorship = { workspace = true }
xcm = { workspace = true }
-pallet-xcm = { workspace = true }
-pallet-configuration = { workspace = true }
runtime/tests/src/lib.rsdiffbeforeafterboth--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -19,7 +19,7 @@
use sp_core::{H160, H256, U256};
use frame_support::{
parameter_types,
- traits::{Everything, ConstU32, ConstU64},
+ traits::{Everything, ConstU32, ConstU64, Currency},
weights::IdentityFee,
pallet_prelude::Weight,
};
@@ -266,6 +266,19 @@
impl pallet_nonfungible::Config for Test {
type WeightInfo = ();
}
+parameter_types! {
+ pub const Decimals: u8 = 18;
+ pub Name: String = "Test".to_string();
+ pub Symbol: String = "TST".to_string();
+}
+impl pallet_balances_adapter::Config for Test {
+ type Currency = Balances;
+ type CurrencyBalance = <Balances as Currency<Self::AccountId>>::Balance;
+ type Decimals = Decimals;
+ type Name = Name;
+ type Symbol = Symbol;
+ type WeightInfo = ();
+}
parameter_types! {
// 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f