git.delta.rocks / unique-network / refs/commits / 11719c8f16e9

difftreelog

feat replace Currency with fungible traits

Trubnikov Sergey2023-05-24parent: #2c6fa32.patch.diff
in: master

4 files changed

modifiedpallets/balances-adapter/src/common.rsdiffbeforeafterboth
before · pallets/balances-adapter/src/common.rs
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>);1011// All implementations with `Weight::default` used in methods that return error `UnsupportedOperation`.12impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {13	fn create_multiple_items(_amount: &[up_data_structs::CreateItemData]) -> Weight {14		Weight::default()15	}1617	fn create_multiple_items_ex(18		_cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,19	) -> Weight {20		Weight::default()21	}2223	fn burn_item() -> Weight {24		Weight::default()25	}2627	fn set_collection_properties(_amount: u32) -> Weight {28		Weight::default()29	}3031	fn delete_collection_properties(_amount: u32) -> Weight {32		Weight::default()33	}3435	fn set_token_properties(_amount: u32) -> Weight {36		Weight::default()37	}3839	fn delete_token_properties(_amount: u32) -> Weight {40		Weight::default()41	}4243	fn set_token_property_permissions(_amount: u32) -> Weight {44		Weight::default()45	}4647	fn transfer() -> Weight {48		<BalancesWeight<T> as WeightInfo>::transfer_allow_death()49	}5051	fn approve() -> Weight {52		Weight::default()53	}5455	fn approve_from() -> Weight {56		Weight::default()57	}5859	fn transfer_from() -> Weight {60		<BalancesWeight<T> as WeightInfo>::transfer_allow_death()61	}6263	fn burn_from() -> Weight {64		Weight::default()65	}6667	fn burn_recursively_self_raw() -> Weight {68		Weight::default()69	}7071	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {72		Weight::default()73	}7475	fn token_owner() -> Weight {76		Weight::default()77	}7879	fn set_allowance_for_all() -> Weight {80		Weight::default()81	}8283	fn force_repair_item() -> Weight {84		Weight::default()85	}86}8788/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallet89/// methods and adds weight info.90impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {91	fn create_item(92		&self,93		_sender: <T>::CrossAccountId,94		_to: <T>::CrossAccountId,95		_data: up_data_structs::CreateItemData,96		_nesting_budget: &dyn up_data_structs::budget::Budget,97	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {98		fail!(<pallet_common::Error<T>>::UnsupportedOperation);99	}100101	fn create_multiple_items(102		&self,103		_sender: <T>::CrossAccountId,104		_to: <T>::CrossAccountId,105		_data: Vec<up_data_structs::CreateItemData>,106		_nesting_budget: &dyn up_data_structs::budget::Budget,107	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {108		fail!(<pallet_common::Error<T>>::UnsupportedOperation);109	}110111	fn create_multiple_items_ex(112		&self,113		_sender: <T>::CrossAccountId,114		_data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,115		_nesting_budget: &dyn up_data_structs::budget::Budget,116	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {117		fail!(<pallet_common::Error<T>>::UnsupportedOperation);118	}119120	fn burn_item(121		&self,122		_sender: <T>::CrossAccountId,123		_token: TokenId,124		_amount: u128,125	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {126		fail!(<pallet_common::Error<T>>::UnsupportedOperation);127	}128129	fn burn_item_recursively(130		&self,131		_sender: <T>::CrossAccountId,132		_token: TokenId,133		_self_budget: &dyn up_data_structs::budget::Budget,134		_breadth_budget: &dyn up_data_structs::budget::Budget,135	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {136		fail!(<pallet_common::Error<T>>::UnsupportedOperation);137	}138139	fn set_collection_properties(140		&self,141		_sender: <T>::CrossAccountId,142		_properties: Vec<up_data_structs::Property>,143	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {144		fail!(<pallet_common::Error<T>>::UnsupportedOperation);145	}146147	fn delete_collection_properties(148		&self,149		_sender: &<T>::CrossAccountId,150		_property_keys: Vec<up_data_structs::PropertyKey>,151	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {152		fail!(<pallet_common::Error<T>>::UnsupportedOperation);153	}154155	fn set_token_properties(156		&self,157		_sender: <T>::CrossAccountId,158		_token_id: TokenId,159		_properties: Vec<up_data_structs::Property>,160		_budget: &dyn up_data_structs::budget::Budget,161	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {162		fail!(<pallet_common::Error<T>>::UnsupportedOperation);163	}164165	fn delete_token_properties(166		&self,167		_sender: <T>::CrossAccountId,168		_token_id: TokenId,169		_property_keys: Vec<up_data_structs::PropertyKey>,170		_budget: &dyn up_data_structs::budget::Budget,171	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {172		fail!(<pallet_common::Error<T>>::UnsupportedOperation);173	}174175	fn set_token_property_permissions(176		&self,177		_sender: &<T>::CrossAccountId,178		_property_permissions: Vec<up_data_structs::PropertyKeyPermission>,179	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {180		fail!(<pallet_common::Error<T>>::UnsupportedOperation);181	}182183	fn transfer(184		&self,185		sender: <T>::CrossAccountId,186		to: <T>::CrossAccountId,187		_token: TokenId,188		amount: u128,189		budget: &dyn up_data_structs::budget::Budget,190	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {191		<Pallet<T>>::transfer(self, &sender, &to, amount, budget)192	}193194	fn approve(195		&self,196		_sender: <T>::CrossAccountId,197		_spender: <T>::CrossAccountId,198		_token: TokenId,199		_amount: u128,200	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {201		fail!(<pallet_common::Error<T>>::UnsupportedOperation);202	}203204	fn approve_from(205		&self,206		_sender: <T>::CrossAccountId,207		_from: <T>::CrossAccountId,208		_to: <T>::CrossAccountId,209		_token: TokenId,210		_amount: u128,211	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {212		fail!(<pallet_common::Error<T>>::UnsupportedOperation);213	}214215	fn transfer_from(216		&self,217		sender: <T>::CrossAccountId,218		from: <T>::CrossAccountId,219		to: <T>::CrossAccountId,220		_token: TokenId,221		amount: u128,222		budget: &dyn up_data_structs::budget::Budget,223	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {224		<Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, budget)225	}226227	fn burn_from(228		&self,229		_sender: <T>::CrossAccountId,230		_from: <T>::CrossAccountId,231		_token: TokenId,232		_amount: u128,233		_budget: &dyn up_data_structs::budget::Budget,234	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {235		fail!(<pallet_common::Error<T>>::UnsupportedOperation);236	}237238	fn check_nesting(239		&self,240		_sender: <T>::CrossAccountId,241		_from: (up_data_structs::CollectionId, TokenId),242		_under: TokenId,243		_budget: &dyn up_data_structs::budget::Budget,244	) -> frame_support::sp_runtime::DispatchResult {245		fail!(<pallet_common::Error<T>>::UnsupportedOperation);246	}247248	fn nest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}249250	fn unnest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}251252	fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {253		let balance = <T as Config>::Currency::total_balance(account.as_sub());254		let balance: u128 = balance.into();255		if balance != 0 {256			vec![TokenId::default()]257		} else {258			vec![]259		}260	}261262	fn collection_tokens(&self) -> Vec<TokenId> {263		vec![TokenId::default()]264	}265266	fn token_exists(&self, token: TokenId) -> bool {267		token == TokenId::default()268	}269270	fn last_token_id(&self) -> TokenId {271		TokenId::default()272	}273274	fn token_owner(275		&self,276		_token: TokenId,277	) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {278		Err(up_data_structs::TokenOwnerError::MultipleOwners)279	}280281	fn token_owners(&self, _token: TokenId) -> Vec<<T>::CrossAccountId> {282		vec![]283	}284285	fn token_property(286		&self,287		_token_id: TokenId,288		_key: &up_data_structs::PropertyKey,289	) -> Option<up_data_structs::PropertyValue> {290		None291	}292293	fn token_properties(294		&self,295		_token: TokenId,296		_keys: Option<Vec<up_data_structs::PropertyKey>>,297	) -> Vec<up_data_structs::Property> {298		vec![]299	}300301	fn total_supply(&self) -> u32 {302		1303	}304305	fn account_balance(&self, account: <T>::CrossAccountId) -> u32 {306		let balance: u128 = <T as Config>::Currency::free_balance(account.as_sub()).into();307		(balance != 0).into()308	}309310	fn balance(&self, account: <T>::CrossAccountId, token: TokenId) -> u128 {311		if token != TokenId::default() {312			return 0;313		}314		<T as Config>::Currency::free_balance(account.as_sub()).into()315	}316317	fn total_pieces(&self, token: TokenId) -> Option<u128> {318		if token != TokenId::default() {319			return None;320		}321		let total = <T as Config>::Currency::total_issuance();322		Some(total.into())323	}324325	fn allowance(326		&self,327		_sender: <T>::CrossAccountId,328		_spender: <T>::CrossAccountId,329		_token: TokenId,330	) -> u128 {331		0332	}333334	fn refungible_extensions(&self) -> Option<&dyn pallet_common::RefungibleExtensions<T>> {335		None336	}337338	fn set_allowance_for_all(339		&self,340		_owner: <T>::CrossAccountId,341		_operator: <T>::CrossAccountId,342		_approve: bool,343	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {344		fail!(<pallet_common::Error<T>>::UnsupportedOperation);345	}346347	fn allowance_for_all(348		&self,349		_owner: <T>::CrossAccountId,350		_operator: <T>::CrossAccountId,351	) -> bool {352		false353	}354355	fn repair_item(356		&self,357		_token: TokenId,358	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {359		fail!(<pallet_common::Error<T>>::UnsupportedOperation);360	}361}
after · pallets/balances-adapter/src/common.rs
1use alloc::{vec, vec::Vec};2use core::marker::PhantomData;3use crate::{Config, NativeFungibleHandle, Pallet};4use frame_support::{fail, weights::Weight};5use pallet_balances::{weights::SubstrateWeight as BalancesWeight, WeightInfo};6use pallet_common::{CommonCollectionOperations, CommonWeightInfo};7use up_data_structs::TokenId;89pub struct CommonWeights<T: Config>(PhantomData<T>);1011// All implementations with `Weight::default` used in methods that return error `UnsupportedOperation`.12impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {13	fn create_multiple_items(_amount: &[up_data_structs::CreateItemData]) -> Weight {14		Weight::default()15	}1617	fn create_multiple_items_ex(18		_cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,19	) -> Weight {20		Weight::default()21	}2223	fn burn_item() -> Weight {24		Weight::default()25	}2627	fn set_collection_properties(_amount: u32) -> Weight {28		Weight::default()29	}3031	fn delete_collection_properties(_amount: u32) -> Weight {32		Weight::default()33	}3435	fn set_token_properties(_amount: u32) -> Weight {36		Weight::default()37	}3839	fn delete_token_properties(_amount: u32) -> Weight {40		Weight::default()41	}4243	fn set_token_property_permissions(_amount: u32) -> Weight {44		Weight::default()45	}4647	fn transfer() -> Weight {48		<BalancesWeight<T> as WeightInfo>::transfer_allow_death()49	}5051	fn approve() -> Weight {52		Weight::default()53	}5455	fn approve_from() -> Weight {56		Weight::default()57	}5859	fn transfer_from() -> Weight {60		<BalancesWeight<T> as WeightInfo>::transfer_allow_death()61	}6263	fn burn_from() -> Weight {64		Weight::default()65	}6667	fn burn_recursively_self_raw() -> Weight {68		Weight::default()69	}7071	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {72		Weight::default()73	}7475	fn token_owner() -> Weight {76		Weight::default()77	}7879	fn set_allowance_for_all() -> Weight {80		Weight::default()81	}8283	fn force_repair_item() -> Weight {84		Weight::default()85	}86}8788/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallet89/// methods and adds weight info.90impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {91	fn create_item(92		&self,93		_sender: <T>::CrossAccountId,94		_to: <T>::CrossAccountId,95		_data: up_data_structs::CreateItemData,96		_nesting_budget: &dyn up_data_structs::budget::Budget,97	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {98		fail!(<pallet_common::Error<T>>::UnsupportedOperation);99	}100101	fn create_multiple_items(102		&self,103		_sender: <T>::CrossAccountId,104		_to: <T>::CrossAccountId,105		_data: Vec<up_data_structs::CreateItemData>,106		_nesting_budget: &dyn up_data_structs::budget::Budget,107	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {108		fail!(<pallet_common::Error<T>>::UnsupportedOperation);109	}110111	fn create_multiple_items_ex(112		&self,113		_sender: <T>::CrossAccountId,114		_data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,115		_nesting_budget: &dyn up_data_structs::budget::Budget,116	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {117		fail!(<pallet_common::Error<T>>::UnsupportedOperation);118	}119120	fn burn_item(121		&self,122		_sender: <T>::CrossAccountId,123		_token: TokenId,124		_amount: u128,125	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {126		fail!(<pallet_common::Error<T>>::UnsupportedOperation);127	}128129	fn burn_item_recursively(130		&self,131		_sender: <T>::CrossAccountId,132		_token: TokenId,133		_self_budget: &dyn up_data_structs::budget::Budget,134		_breadth_budget: &dyn up_data_structs::budget::Budget,135	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {136		fail!(<pallet_common::Error<T>>::UnsupportedOperation);137	}138139	fn set_collection_properties(140		&self,141		_sender: <T>::CrossAccountId,142		_properties: Vec<up_data_structs::Property>,143	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {144		fail!(<pallet_common::Error<T>>::UnsupportedOperation);145	}146147	fn delete_collection_properties(148		&self,149		_sender: &<T>::CrossAccountId,150		_property_keys: Vec<up_data_structs::PropertyKey>,151	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {152		fail!(<pallet_common::Error<T>>::UnsupportedOperation);153	}154155	fn set_token_properties(156		&self,157		_sender: <T>::CrossAccountId,158		_token_id: TokenId,159		_properties: Vec<up_data_structs::Property>,160		_budget: &dyn up_data_structs::budget::Budget,161	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {162		fail!(<pallet_common::Error<T>>::UnsupportedOperation);163	}164165	fn delete_token_properties(166		&self,167		_sender: <T>::CrossAccountId,168		_token_id: TokenId,169		_property_keys: Vec<up_data_structs::PropertyKey>,170		_budget: &dyn up_data_structs::budget::Budget,171	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {172		fail!(<pallet_common::Error<T>>::UnsupportedOperation);173	}174175	fn set_token_property_permissions(176		&self,177		_sender: &<T>::CrossAccountId,178		_property_permissions: Vec<up_data_structs::PropertyKeyPermission>,179	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {180		fail!(<pallet_common::Error<T>>::UnsupportedOperation);181	}182183	fn transfer(184		&self,185		sender: <T>::CrossAccountId,186		to: <T>::CrossAccountId,187		_token: TokenId,188		amount: u128,189		budget: &dyn up_data_structs::budget::Budget,190	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {191		<Pallet<T>>::transfer(self, &sender, &to, amount, budget)192	}193194	fn approve(195		&self,196		_sender: <T>::CrossAccountId,197		_spender: <T>::CrossAccountId,198		_token: TokenId,199		_amount: u128,200	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {201		fail!(<pallet_common::Error<T>>::UnsupportedOperation);202	}203204	fn approve_from(205		&self,206		_sender: <T>::CrossAccountId,207		_from: <T>::CrossAccountId,208		_to: <T>::CrossAccountId,209		_token: TokenId,210		_amount: u128,211	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {212		fail!(<pallet_common::Error<T>>::UnsupportedOperation);213	}214215	fn transfer_from(216		&self,217		sender: <T>::CrossAccountId,218		from: <T>::CrossAccountId,219		to: <T>::CrossAccountId,220		_token: TokenId,221		amount: u128,222		budget: &dyn up_data_structs::budget::Budget,223	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {224		<Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, budget)225	}226227	fn burn_from(228		&self,229		_sender: <T>::CrossAccountId,230		_from: <T>::CrossAccountId,231		_token: TokenId,232		_amount: u128,233		_budget: &dyn up_data_structs::budget::Budget,234	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {235		fail!(<pallet_common::Error<T>>::UnsupportedOperation);236	}237238	fn check_nesting(239		&self,240		_sender: <T>::CrossAccountId,241		_from: (up_data_structs::CollectionId, TokenId),242		_under: TokenId,243		_budget: &dyn up_data_structs::budget::Budget,244	) -> frame_support::sp_runtime::DispatchResult {245		fail!(<pallet_common::Error<T>>::UnsupportedOperation);246	}247248	fn nest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}249250	fn unnest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}251252	fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {253		let balance = <Pallet<T>>::total_balance(&account);254		if balance != 0 {255			vec![TokenId::default()]256		} else {257			vec![]258		}259	}260261	fn collection_tokens(&self) -> Vec<TokenId> {262		vec![TokenId::default()]263	}264265	fn token_exists(&self, token: TokenId) -> bool {266		token == TokenId::default()267	}268269	fn last_token_id(&self) -> TokenId {270		TokenId::default()271	}272273	fn token_owner(274		&self,275		_token: TokenId,276	) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {277		Err(up_data_structs::TokenOwnerError::MultipleOwners)278	}279280	fn token_owners(&self, _token: TokenId) -> Vec<<T>::CrossAccountId> {281		vec![]282	}283284	fn token_property(285		&self,286		_token_id: TokenId,287		_key: &up_data_structs::PropertyKey,288	) -> Option<up_data_structs::PropertyValue> {289		None290	}291292	fn token_properties(293		&self,294		_token: TokenId,295		_keys: Option<Vec<up_data_structs::PropertyKey>>,296	) -> Vec<up_data_structs::Property> {297		vec![]298	}299300	fn total_supply(&self) -> u32 {301		1302	}303304	fn account_balance(&self, account: T::CrossAccountId) -> u32 {305		let balance = <Pallet<T>>::balance_of(&account);306		(balance != 0).into()307	}308309	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {310		if token != TokenId::default() {311			return 0;312		}313		<Pallet<T>>::balance_of(&account)314	}315316	fn total_pieces(&self, token: TokenId) -> Option<u128> {317		if token != TokenId::default() {318			return None;319		}320		Some(<Pallet<T>>::total_issuance())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}
modifiedpallets/balances-adapter/src/erc.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/erc.rs
+++ b/pallets/balances-adapter/src/erc.rs
@@ -1,6 +1,5 @@
 use crate::{Config, NativeFungibleHandle, Pallet, SelfWeightOf};
 use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*};
-use frame_support::traits::{Currency};
 use pallet_balances::WeightInfo;
 use pallet_common::{
 	erc::{CommonEvmHandler, CrossAccountId, PrecompileHandle, PrecompileResult},
@@ -32,7 +31,7 @@
 	fn balance_of(&self, owner: Address) -> Result<U256> {
 		self.consume_store_reads(1)?;
 		let owner = T::CrossAccountId::from_eth(owner);
-		let balance = <T as Config>::Currency::free_balance(owner.as_sub());
+		let balance = <Pallet<T>>::balance_of(&owner);
 		Ok(balance.into())
 	}
 
@@ -50,8 +49,7 @@
 
 	fn total_supply(&self) -> Result<U256> {
 		self.consume_store_reads(1)?;
-		let total = <T as Config>::Currency::total_issuance();
-		Ok(total.into())
+		Ok(<Pallet<T>>::total_issuance().into())
 	}
 
 	#[weight(<SelfWeightOf<T>>::transfer_allow_death())]
@@ -98,7 +96,7 @@
 	fn balance_of_cross(&self, owner: CrossAddress) -> Result<U256> {
 		self.consume_store_reads(1)?;
 		let owner = owner.into_sub_cross_account::<T>()?;
-		let balance = <T as Config>::Currency::free_balance(owner.as_sub());
+		let balance = <Pallet<T>>::balance_of(&owner);
 		Ok(balance.into())
 	}
 
modifiedpallets/balances-adapter/src/lib.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/lib.rs
+++ b/pallets/balances-adapter/src/lib.rs
@@ -55,7 +55,11 @@
 		dispatch::PostDispatchInfo,
 		ensure,
 		pallet_prelude::{DispatchResultWithPostInfo, Pays},
-		traits::{Currency, ExistenceRequirement, Get},
+		traits::{
+			Get,
+			fungible::{Inspect, Mutate},
+			tokens::Preservation,
+		},
 	};
 	use pallet_balances::WeightInfo;
 	use pallet_common::{erc::CrossAccountId, Error as CommonError, Pallet as PalletCommon};
@@ -71,11 +75,18 @@
 		+ pallet_common::Config
 		+ pallet_structure::Config
 	{
-		/// Currency from `pallet_balances`
-		type Currency: frame_support::traits::Currency<
+		/// Inspect from `pallet_balances`
+		type Inspect: frame_support::traits::tokens::fungible::Inspect<
+			Self::AccountId,
+			Balance = Self::CurrencyBalance,
+		>;
+
+		/// Mutate from `pallet_balances`
+		type Mutate: frame_support::traits::tokens::fungible::Mutate<
 			Self::AccountId,
 			Balance = Self::CurrencyBalance,
 		>;
+
 		/// Balance type of chain
 		type CurrencyBalance: Into<U256> + TryFrom<U256> + TryFrom<u128> + Into<u128>;
 
@@ -93,6 +104,18 @@
 	pub struct Pallet<T>(_);
 
 	impl<T: Config> Pallet<T> {
+		pub fn balance_of(account: &T::CrossAccountId) -> u128 {
+			T::Inspect::balance(account.as_sub()).into()
+		}
+
+		pub fn total_balance(account: &T::CrossAccountId) -> u128 {
+			T::Inspect::total_balance(account.as_sub()).into()
+		}
+
+		pub fn total_issuance() -> u128 {
+			T::Inspect::total_issuance().into()
+		}
+
 		/// Checks if a non-owner has (enough) allowance from the owner to perform operations on the tokens.
 		/// Returns the expected remaining allowance - it should be set manually if the transaction proceeds.
 		///
@@ -121,7 +144,7 @@
 				return Ok(0);
 			}
 
-			Ok(<T as Config>::Currency::free_balance(from.as_sub()).into())
+			Ok(Self::balance_of(from))
 		}
 
 		/// Transfers the specified amount of tokens. Will check that
@@ -142,14 +165,10 @@
 			<PalletCommon<T>>::ensure_correct_receiver(to)?;
 
 			if from != to && amount != 0 {
-				<T as Config>::Currency::transfer(
-					from.as_sub(),
-					to.as_sub(),
-					amount
-						.try_into()
-						.map_err(|_| sp_runtime::ArithmeticError::Overflow)?,
-					ExistenceRequirement::AllowDeath,
-				)?;
+				let amount = amount
+					.try_into()
+					.map_err(|_| sp_runtime::ArithmeticError::Overflow)?;
+				T::Mutate::transfer(from.as_sub(), to.as_sub(), amount, Preservation::Expendable)?;
 			};
 
 			Ok(PostDispatchInfo {
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -92,7 +92,8 @@
 	pub Symbol: String = TOKEN_SYMBOL.to_string();
 }
 impl pallet_balances_adapter::Config for Runtime {
-	type Currency = Balances;
+	type Inspect = Balances;
+	type Mutate = Balances;
 	type CurrencyBalance = <Balances as Currency<Self::AccountId>>::Balance;
 	type Decimals = Decimals;
 	type Name = Name;