git.delta.rocks / unique-network / refs/commits / 12dc7ebeba3c

difftreelog

remove warnings

Trubnikov Sergey2023-04-28parent: #5a3127a.patch.diff
in: master

8 files changed

modifiedpallets/balances-adapter/src/common.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/common.rs
+++ b/pallets/balances-adapter/src/common.rs
@@ -12,12 +12,12 @@
 
 pub struct CommonWeights<T: Config>(PhantomData<T>);
 impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {
-	fn create_multiple_items(amount: &[up_data_structs::CreateItemData]) -> Weight {
+	fn create_multiple_items(_amount: &[up_data_structs::CreateItemData]) -> Weight {
 		Weight::default()
 	}
 
 	fn create_multiple_items_ex(
-		cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,
+		_cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,
 	) -> Weight {
 		Weight::default()
 	}
@@ -26,23 +26,23 @@
 		Weight::default()
 	}
 
-	fn set_collection_properties(amount: u32) -> Weight {
+	fn set_collection_properties(_amount: u32) -> Weight {
 		Weight::default()
 	}
 
-	fn delete_collection_properties(amount: u32) -> Weight {
+	fn delete_collection_properties(_amount: u32) -> Weight {
 		Weight::default()
 	}
 
-	fn set_token_properties(amount: u32) -> Weight {
+	fn set_token_properties(_amount: u32) -> Weight {
 		Weight::default()
 	}
 
-	fn delete_token_properties(amount: u32) -> Weight {
+	fn delete_token_properties(_amount: u32) -> Weight {
 		Weight::default()
 	}
 
-	fn set_token_property_permissions(amount: u32) -> Weight {
+	fn set_token_property_permissions(_amount: u32) -> Weight {
 		Weight::default()
 	}
 
@@ -70,7 +70,7 @@
 		Weight::default()
 	}
 
-	fn burn_recursively_breadth_raw(amount: u32) -> Weight {
+	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {
 		Weight::default()
 	}
 
@@ -92,92 +92,92 @@
 impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {
 	fn create_item(
 		&self,
-		sender: <T>::CrossAccountId,
-		to: <T>::CrossAccountId,
-		data: up_data_structs::CreateItemData,
-		nesting_budget: &dyn up_data_structs::budget::Budget,
+		_sender: <T>::CrossAccountId,
+		_to: <T>::CrossAccountId,
+		_data: up_data_structs::CreateItemData,
+		_nesting_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn create_multiple_items(
 		&self,
-		sender: <T>::CrossAccountId,
-		to: <T>::CrossAccountId,
-		data: Vec<up_data_structs::CreateItemData>,
-		nesting_budget: &dyn up_data_structs::budget::Budget,
+		_sender: <T>::CrossAccountId,
+		_to: <T>::CrossAccountId,
+		_data: Vec<up_data_structs::CreateItemData>,
+		_nesting_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn create_multiple_items_ex(
 		&self,
-		sender: <T>::CrossAccountId,
-		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,
-		nesting_budget: &dyn up_data_structs::budget::Budget,
+		_sender: <T>::CrossAccountId,
+		_data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,
+		_nesting_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn burn_item(
 		&self,
-		sender: <T>::CrossAccountId,
-		token: TokenId,
-		amount: u128,
+		_sender: <T>::CrossAccountId,
+		_token: TokenId,
+		_amount: u128,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn burn_item_recursively(
 		&self,
-		sender: <T>::CrossAccountId,
-		token: TokenId,
-		self_budget: &dyn up_data_structs::budget::Budget,
-		breadth_budget: &dyn up_data_structs::budget::Budget,
+		_sender: <T>::CrossAccountId,
+		_token: TokenId,
+		_self_budget: &dyn up_data_structs::budget::Budget,
+		_breadth_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn set_collection_properties(
 		&self,
-		sender: <T>::CrossAccountId,
-		properties: Vec<up_data_structs::Property>,
+		_sender: <T>::CrossAccountId,
+		_properties: Vec<up_data_structs::Property>,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn delete_collection_properties(
 		&self,
-		sender: &<T>::CrossAccountId,
-		property_keys: Vec<up_data_structs::PropertyKey>,
+		_sender: &<T>::CrossAccountId,
+		_property_keys: Vec<up_data_structs::PropertyKey>,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn set_token_properties(
 		&self,
-		sender: <T>::CrossAccountId,
-		token_id: TokenId,
-		properties: Vec<up_data_structs::Property>,
-		budget: &dyn up_data_structs::budget::Budget,
+		_sender: <T>::CrossAccountId,
+		_token_id: TokenId,
+		_properties: Vec<up_data_structs::Property>,
+		_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn delete_token_properties(
 		&self,
-		sender: <T>::CrossAccountId,
-		token_id: TokenId,
-		property_keys: Vec<up_data_structs::PropertyKey>,
-		budget: &dyn up_data_structs::budget::Budget,
+		_sender: <T>::CrossAccountId,
+		_token_id: TokenId,
+		_property_keys: Vec<up_data_structs::PropertyKey>,
+		_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn set_token_property_permissions(
 		&self,
-		sender: &<T>::CrossAccountId,
-		property_permissions: Vec<up_data_structs::PropertyKeyPermission>,
+		_sender: &<T>::CrossAccountId,
+		_property_permissions: Vec<up_data_structs::PropertyKeyPermission>,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
@@ -186,9 +186,9 @@
 		&self,
 		sender: <T>::CrossAccountId,
 		to: <T>::CrossAccountId,
-		token: TokenId,
+		_token: TokenId,
 		amount: u128,
-		budget: &dyn up_data_structs::budget::Budget,
+		_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		with_weight(
 			<T as Config>::Currency::transfer(
@@ -203,21 +203,21 @@
 
 	fn approve(
 		&self,
-		sender: <T>::CrossAccountId,
-		spender: <T>::CrossAccountId,
-		token: TokenId,
-		amount: u128,
+		_sender: <T>::CrossAccountId,
+		_spender: <T>::CrossAccountId,
+		_token: TokenId,
+		_amount: u128,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn approve_from(
 		&self,
-		sender: <T>::CrossAccountId,
-		from: <T>::CrossAccountId,
-		to: <T>::CrossAccountId,
-		token: TokenId,
-		amount: u128,
+		_sender: <T>::CrossAccountId,
+		_from: <T>::CrossAccountId,
+		_to: <T>::CrossAccountId,
+		_token: TokenId,
+		_amount: u128,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
@@ -227,9 +227,9 @@
 		sender: <T>::CrossAccountId,
 		from: <T>::CrossAccountId,
 		to: <T>::CrossAccountId,
-		token: TokenId,
+		_token: TokenId,
 		amount: u128,
-		budget: &dyn up_data_structs::budget::Budget,
+		_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		if sender != from {
 			fail!(<pallet_common::Error<T>>::NoPermission);
@@ -247,28 +247,28 @@
 
 	fn burn_from(
 		&self,
-		sender: <T>::CrossAccountId,
-		from: <T>::CrossAccountId,
-		token: TokenId,
-		amount: u128,
-		budget: &dyn up_data_structs::budget::Budget,
+		_sender: <T>::CrossAccountId,
+		_from: <T>::CrossAccountId,
+		_token: TokenId,
+		_amount: u128,
+		_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
 	fn check_nesting(
 		&self,
-		sender: <T>::CrossAccountId,
-		from: (up_data_structs::CollectionId, TokenId),
-		under: TokenId,
-		budget: &dyn up_data_structs::budget::Budget,
+		_sender: <T>::CrossAccountId,
+		_from: (up_data_structs::CollectionId, TokenId),
+		_under: TokenId,
+		_budget: &dyn up_data_structs::budget::Budget,
 	) -> frame_support::sp_runtime::DispatchResult {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
-	fn nest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}
+	fn nest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}
 
-	fn unnest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}
+	fn unnest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}
 
 	fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {
 		let balance = <T as Config>::Currency::total_balance(account.as_sub());
@@ -293,27 +293,27 @@
 
 	fn token_owner(
 		&self,
-		token: TokenId,
+		_token: TokenId,
 	) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {
 		Err(up_data_structs::TokenOwnerError::MultipleOwners)
 	}
 
-	fn token_owners(&self, token: TokenId) -> Vec<<T>::CrossAccountId> {
+	fn token_owners(&self, _token: TokenId) -> Vec<<T>::CrossAccountId> {
 		vec![]
 	}
 
 	fn token_property(
 		&self,
-		token_id: TokenId,
-		key: &up_data_structs::PropertyKey,
+		_token_id: TokenId,
+		_key: &up_data_structs::PropertyKey,
 	) -> Option<up_data_structs::PropertyValue> {
 		None
 	}
 
 	fn token_properties(
 		&self,
-		token: TokenId,
-		keys: Option<Vec<up_data_structs::PropertyKey>>,
+		_token: TokenId,
+		_keys: Option<Vec<up_data_structs::PropertyKey>>,
 	) -> Vec<up_data_structs::Property> {
 		vec![]
 	}
@@ -344,9 +344,9 @@
 
 	fn allowance(
 		&self,
-		sender: <T>::CrossAccountId,
-		spender: <T>::CrossAccountId,
-		token: TokenId,
+		_sender: <T>::CrossAccountId,
+		_spender: <T>::CrossAccountId,
+		_token: TokenId,
 	) -> u128 {
 		0
 	}
@@ -357,20 +357,24 @@
 
 	fn set_allowance_for_all(
 		&self,
-		owner: <T>::CrossAccountId,
-		operator: <T>::CrossAccountId,
-		approve: bool,
+		_owner: <T>::CrossAccountId,
+		_operator: <T>::CrossAccountId,
+		_approve: bool,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
 
-	fn allowance_for_all(&self, owner: <T>::CrossAccountId, operator: <T>::CrossAccountId) -> bool {
+	fn allowance_for_all(
+		&self,
+		_owner: <T>::CrossAccountId,
+		_operator: <T>::CrossAccountId,
+	) -> bool {
 		false
 	}
 
 	fn repair_item(
 		&self,
-		token: TokenId,
+		_token: TokenId,
 	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
 		fail!(<pallet_common::Error<T>>::UnsupportedOperation);
 	}
modifiedpallets/balances-adapter/src/erc.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/erc.rs
+++ b/pallets/balances-adapter/src/erc.rs
@@ -9,7 +9,7 @@
 use pallet_evm_coder_substrate::{
 	call, dispatch_to_evm,
 	execution::{PreDispatch, Result},
-	frontier_contract, WithRecorder, SubstrateRecorder,
+	frontier_contract,
 };
 use sp_core::{U256, Get};
 use sp_std::vec::Vec;
@@ -26,13 +26,6 @@
 		from: Address,
 		#[indexed]
 		to: Address,
-		value: U256,
-	},
-	Approval {
-		#[indexed]
-		owner: Address,
-		#[indexed]
-		spender: Address,
 		value: U256,
 	},
 }
modifiedpallets/balances-adapter/src/lib.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/lib.rs
+++ b/pallets/balances-adapter/src/lib.rs
@@ -1,11 +1,9 @@
 // #![doc = include_str!("../README.md")]
 #![cfg_attr(not(feature = "std"), no_std)]
-#![warn(missing_docs)]
 
 extern crate alloc;
 use frame_support::sp_runtime::DispatchResult;
 pub use pallet::*;
-use pallet_common::CollectionHandle;
 use pallet_evm_coder_substrate::{WithRecorder, SubstrateRecorder};
 
 pub mod common;
@@ -13,12 +11,15 @@
 
 pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
 
+/// Handle for native fungible collection
 pub struct NativeFungibleHandle<T: Config>(SubstrateRecorder<T>);
 impl<T: Config> NativeFungibleHandle<T> {
+	/// Creates a handle
 	pub fn new() -> NativeFungibleHandle<T> {
 		Self(SubstrateRecorder::new(u64::MAX))
 	}
 
+	/// Check if the collection is internal
 	pub fn check_is_internal(&self) -> DispatchResult {
 		Ok(())
 	}
@@ -35,7 +36,7 @@
 #[frame_support::pallet]
 pub mod pallet {
 	use alloc::string::String;
-	use frame_support::{traits::Get, sp_runtime::DispatchResult};
+	use frame_support::{traits::Get};
 	use pallet_balances::WeightInfo;
 	use sp_core::U256;
 
@@ -43,25 +44,24 @@
 	pub trait Config:
 		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_common::Config
 	{
+		/// Currency from `pallet_balances`
 		type Currency: frame_support::traits::Currency<
 			Self::AccountId,
 			Balance = Self::CurrencyBalance,
 		>;
+		/// Balance type of chain
 		type CurrencyBalance: Into<U256> + TryFrom<U256> + PartialEq<u128> + From<u128> + Into<u128>;
 
+		/// Decimals of balance
 		type Decimals: Get<u8>;
+		/// Collection name
 		type Name: Get<String>;
+		/// Collection symbol
 		type Symbol: Get<String>;
 
+		/// Weight information
 		type WeightInfo: WeightInfo;
 	}
 	#[pallet::pallet]
 	pub struct Pallet<T>(_);
-
-	// #[pallet::call]
-	impl<T: Config> Pallet<T> {
-		pub fn dummy() -> DispatchResult {
-			Ok(())
-		}
-	}
 }
modifiedpallets/common/src/dispatch.rsdiffbeforeafterboth
--- a/pallets/common/src/dispatch.rs
+++ b/pallets/common/src/dispatch.rs
@@ -11,7 +11,7 @@
 use sp_runtime::DispatchError;
 use up_data_structs::{CollectionId, CreateCollectionData, CollectionFlags};
 
-use crate::{pallet::Config, CommonCollectionOperations, CollectionHandle};
+use crate::{pallet::Config, CommonCollectionOperations};
 
 // TODO: move to benchmarking
 /// Price of [`dispatch_tx`] call with noop `call` argument
@@ -66,6 +66,7 @@
 
 /// Interface for working with different collections through the dispatcher.
 pub trait CollectionDispatch<T: Config> {
+	/// Check if the collection is internal.
 	fn check_is_internal(&self) -> DispatchResult;
 
 	/// Create a collection. The collection will be created according to the value of [`data.mode`](CreateCollectionData::mode).
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -80,7 +80,7 @@
 impl CommonEvmHandler for () {
 	const CODE: &'static [u8] = &[];
 
-	fn call(self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
+	fn call(self, _handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
 		None
 	}
 }
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -462,6 +462,7 @@
 	}
 
 	const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
+	/// Collection id for native fungible collction.
 	pub const NATIVE_FINGIBLE_COLLECTION_ID: CollectionId = CollectionId(0);
 
 	#[pallet::pallet]
modifiedpallets/structure/src/lib.rsdiffbeforeafterboth
--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -60,7 +60,7 @@
 use frame_support::dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo};
 use frame_support::fail;
 pub use pallet::*;
-use pallet_common::{dispatch::CollectionDispatch, CollectionHandle};
+use pallet_common::{dispatch::CollectionDispatch};
 use up_data_structs::{
 	CollectionId, TokenId, mapping::TokenAddressMapping, budget::Budget, TokenOwnerError,
 };
modifiedruntime/common/dispatch.rsdiffbeforeafterboth
before · runtime/common/dispatch.rs
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::{dispatch::DispatchResult, ensure, fail};18use pallet_evm::{PrecompileHandle, PrecompileResult};19use sp_core::H160;20use sp_runtime::DispatchError;21use sp_std::{borrow::ToOwned, vec::Vec};22use pallet_common::{23	CollectionById, CollectionHandle, CommonCollectionOperations, erc::CommonEvmHandler,24	eth::map_eth_to_id,25};26pub use pallet_common::dispatch::CollectionDispatch;27use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};28use pallet_balances_adapter::{Pallet as PalletNativeFungible, NativeFungibleHandle};29use pallet_nonfungible::{Pallet as PalletNonfungible, NonfungibleHandle};30use pallet_refungible::{31	Pallet as PalletRefungible, RefungibleHandle, erc_token::RefungibleTokenHandle,32};33use up_data_structs::{34	CollectionMode, CreateCollectionData, MAX_DECIMAL_POINTS, mapping::TokenAddressMapping,35	CollectionId, CollectionFlags,36};3738#[cfg(not(feature = "refungible"))]39use pallet_common::unsupported;4041pub enum CollectionDispatchT<T>42where43	T: pallet_fungible::Config44		+ pallet_nonfungible::Config45		+ pallet_refungible::Config46		+ pallet_balances_adapter::Config,47{48	Fungible(FungibleHandle<T>),49	Nonfungible(NonfungibleHandle<T>),50	Refungible(RefungibleHandle<T>),51	NativeFungible(NativeFungibleHandle<T>),52}5354impl<T> CollectionDispatch<T> for CollectionDispatchT<T>55where56	T: pallet_common::Config57		+ pallet_unique::Config58		+ pallet_fungible::Config59		+ pallet_nonfungible::Config60		+ pallet_refungible::Config61		+ pallet_balances_adapter::Config,62{63	fn check_is_internal(&self) -> DispatchResult {64		match self {65			Self::Fungible(h) => h.check_is_internal(),66			Self::Nonfungible(h) => h.check_is_internal(),67			Self::Refungible(h) => h.check_is_internal(),68			Self::NativeFungible(h) => h.check_is_internal(),69		}70	}7172	fn create(73		sender: T::CrossAccountId,74		payer: T::CrossAccountId,75		data: CreateCollectionData<T::AccountId>,76		flags: CollectionFlags,77	) -> Result<CollectionId, DispatchError> {78		let id = match data.mode {79			CollectionMode::NFT => {80				<PalletNonfungible<T>>::init_collection(sender, payer, data, flags)?81			}82			CollectionMode::Fungible(decimal_points) => {83				// check params84				ensure!(85					decimal_points <= MAX_DECIMAL_POINTS,86					pallet_unique::Error::<T>::CollectionDecimalPointLimitExceeded87				);88				<PalletFungible<T>>::init_collection(sender, payer, data, flags)?89			}9091			#[cfg(feature = "refungible")]92			CollectionMode::ReFungible => {93				<PalletRefungible<T>>::init_collection(sender, payer, data, flags)?94			}9596			#[cfg(not(feature = "refungible"))]97			CollectionMode::ReFungible => return unsupported!(T),98		};99		Ok(id)100	}101102	fn destroy(sender: T::CrossAccountId, collection_id: CollectionId) -> DispatchResult {103		if collection_id == pallet_common::NATIVE_FINGIBLE_COLLECTION_ID {104			fail!(<pallet_common::Error<T>>::UnsupportedOperation);105		}106107		let collection = <CollectionHandle<T>>::try_get(collection_id)?;108		collection.check_is_internal()?;109110		match collection.mode {111			CollectionMode::ReFungible => {112				PalletRefungible::destroy_collection(RefungibleHandle::cast(collection), &sender)?113			}114			CollectionMode::Fungible(_) => {115				PalletFungible::destroy_collection(FungibleHandle::cast(collection), &sender)?116			}117			CollectionMode::NFT => {118				PalletNonfungible::destroy_collection(NonfungibleHandle::cast(collection), &sender)?119			}120		}121		Ok(())122	}123124	fn dispatch(collection_id: CollectionId) -> Result<Self, DispatchError> {125		if collection_id == CollectionId(0) {126			return Ok(Self::NativeFungible(NativeFungibleHandle::new()));127		}128129		let handle = <CollectionHandle<T>>::try_get(collection_id)?;130		Ok(match handle.mode {131			CollectionMode::Fungible(_) => Self::Fungible(FungibleHandle::cast(handle)),132			CollectionMode::NFT => Self::Nonfungible(NonfungibleHandle::cast(handle)),133			CollectionMode::ReFungible => Self::Refungible(RefungibleHandle::cast(handle)),134		})135	}136137	fn as_dyn(&self) -> &dyn CommonCollectionOperations<T> {138		match self {139			Self::Fungible(h) => h,140			Self::Nonfungible(h) => h,141			Self::Refungible(h) => h,142			Self::NativeFungible(h) => h,143		}144	}145}146147impl<T> pallet_evm::OnMethodCall<T> for CollectionDispatchT<T>148where149	T: pallet_common::Config150		+ pallet_unique::Config151		+ pallet_fungible::Config152		+ pallet_nonfungible::Config153		+ pallet_refungible::Config154		+ pallet_balances_adapter::Config,155	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,156{157	fn is_reserved(target: &H160) -> bool {158		map_eth_to_id(target).is_some()159	}160	fn is_used(target: &H160) -> bool {161		map_eth_to_id(target)162			.map(<CollectionById<T>>::contains_key)163			.unwrap_or(false)164	}165	fn get_code(target: &H160) -> Option<Vec<u8>> {166		if let Some(collection_id) = map_eth_to_id(target) {167			let collection = <CollectionById<T>>::get(collection_id)?;168			Some(169				match collection.mode {170					CollectionMode::NFT => <NonfungibleHandle<T>>::CODE,171					CollectionMode::Fungible(_) => <FungibleHandle<T>>::CODE,172					CollectionMode::ReFungible => <RefungibleHandle<T>>::CODE,173				}174				.to_owned(),175			)176		} else if let Some((collection_id, _token_id)) =177			<T as pallet_common::Config>::EvmTokenAddressMapping::address_to_token(target)178		{179			let collection = <CollectionById<T>>::get(collection_id)?;180			if collection.mode != CollectionMode::ReFungible {181				return None;182			}183			// TODO: check token existence184			Some(<RefungibleTokenHandle<T>>::CODE.to_owned())185		} else {186			None187		}188	}189	fn call(handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {190		if let Some(collection_id) = map_eth_to_id(&handle.code_address()) {191			if collection_id == CollectionId(0) {192				<NativeFungibleHandle<T>>::new().call(handle)193			} else {194				let collection = <CollectionHandle<T>>::new_with_gas_limit(195					collection_id,196					handle.remaining_gas(),197				)?;198199				match collection.mode {200					CollectionMode::Fungible(_) => FungibleHandle::cast(collection).call(handle),201					CollectionMode::NFT => NonfungibleHandle::cast(collection).call(handle),202					CollectionMode::ReFungible => RefungibleHandle::cast(collection).call(handle),203				}204			}205		} else if let Some((collection_id, token_id)) =206			<T as pallet_common::Config>::EvmTokenAddressMapping::address_to_token(207				&handle.code_address(),208			) {209			let collection =210				<CollectionHandle<T>>::new_with_gas_limit(collection_id, handle.remaining_gas())?;211			if collection.mode != CollectionMode::ReFungible {212				return None;213			}214215			let h = RefungibleHandle::cast(collection);216			// TODO: check token existence217			RefungibleTokenHandle(h, token_id).call(handle)218		} else {219			None220		}221	}222}