git.delta.rocks / unique-network / refs/commits / 7a034de544fd

difftreelog

refactor move ChainLimits to constants

Yaroslav Bolyukin2021-08-10parent: #fb1ebd6.patch.diff
in: master

5 files changed

modifiedpallets/nft/src/eth/sponsoring.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/sponsoring.rs
+++ b/pallets/nft/src/eth/sponsoring.rs
@@ -2,12 +2,11 @@
 
 use crate::{
 	Collection, CollectionById, Config, FungibleTransferBasket, NftTransferBasket,
-	eth::{account::EvmBackwardsAddressMapping, map_eth_to_id}, limit,
+	eth::{account::EvmBackwardsAddressMapping, map_eth_to_id},
 };
 use evm_coder::{Call, abi::AbiReader};
 use frame_support::{
 	storage::{StorageMap, StorageDoubleMap},
-	traits::Get,
 };
 use sp_core::H160;
 use sp_std::prelude::*;
@@ -18,6 +17,7 @@
 };
 use core::convert::TryInto;
 use core::marker::PhantomData;
+use nft_data_structs::{NFT_SPONSOR_TRANSFER_TIMEOUT, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT};
 
 struct AnyError;
 
@@ -44,7 +44,7 @@
 					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
 						collection_limits.sponsor_transfer_timeout
 					} else {
-						<limit!(T, NftSponsorTransferTimeout)>::get()
+						NFT_SPONSOR_TRANSFER_TIMEOUT
 					};
 
 					let mut sponsor = true;
@@ -75,7 +75,7 @@
 					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
 						collection_limits.sponsor_transfer_timeout
 					} else {
-						<limit!(T, FungibleSponsorTransferTimeout)>::get()
+						FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
 					};
 
 					let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
38use core::ops::{Deref, DerefMut};38use core::ops::{Deref, DerefMut};
39use nft_data_structs::{39use nft_data_structs::{
40 MAX_DECIMAL_POINTS, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP, MAX_REFUNGIBLE_PIECES,40 MAX_DECIMAL_POINTS, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP, MAX_REFUNGIBLE_PIECES,
41 CUSTOM_DATA_LIMIT, COLLECTION_NUMBER_LIMIT, ACCOUNT_TOKEN_OWNERSHIP_LIMIT,
42 VARIABLE_ON_CHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT, COLLECTION_ADMINS_LIMIT,
41 AccessMode, ChainLimits, Collection, CreateItemData, CollectionLimits, CollectionId,43 OFFCHAIN_SCHEMA_LIMIT, AccessMode, Collection, CreateItemData, CollectionLimits, CollectionId,
42 CollectionMode, TokenId, SchemaVersion, SponsorshipState, Ownership, NftItemType,44 CollectionMode, TokenId, SchemaVersion, SponsorshipState, Ownership, NftItemType,
43 FungibleItemType, ReFungibleItemType,45 FungibleItemType, ReFungibleItemType,
44};46};
243 <<Self as Config>::Currency as Currency<Self::AccountId>>::Balance,245 <<Self as Config>::Currency as Currency<Self::AccountId>>::Balance,
244 >;246 >;
245 type TreasuryAccountId: Get<Self::AccountId>;247 type TreasuryAccountId: Get<Self::AccountId>;
246 type ChainLimits: ChainLimits;
247}248}
248
249pub type ChainLimitsOf<T> = <T as Config>::ChainLimits;
250#[macro_export]
251macro_rules! limit {
252 ($config:ty, $limit:ident) => {
253 <$crate::ChainLimitsOf<$config> as nft_data_structs::ChainLimits>::$limit
254 }
255}
256249
257// # Used definitions250// # Used definitions
258//251//
495 let destroyed_count = DestroyedCollectionCount::get();488 let destroyed_count = DestroyedCollectionCount::get();
496489
497 // bound Total number of collections490 // bound Total number of collections
498 ensure!(created_count - destroyed_count < <limit!(T, CollectionNumberLimit)>::get(), Error::<T>::TotalCollectionsLimitExceeded);491 ensure!(created_count - destroyed_count < COLLECTION_NUMBER_LIMIT, Error::<T>::TotalCollectionsLimitExceeded);
499492
500 // check params493 // check params
501 ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::<T>::CollectionDecimalPointLimitExceeded);494 ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::<T>::CollectionDecimalPointLimitExceeded);
511 CreatedCollectionCount::put(next_id);504 CreatedCollectionCount::put(next_id);
512505
513 let limits = CollectionLimits {506 let limits = CollectionLimits {
514 sponsored_data_size: <limit!(T, CustomDataLimit)>::get(),507 sponsored_data_size: CUSTOM_DATA_LIMIT,
515 ..Default::default()508 ..Default::default()
516 };509 };
517510
740 match admin_arr.binary_search(&new_admin_id) {733 match admin_arr.binary_search(&new_admin_id) {
741 Ok(_) => {},734 Ok(_) => {},
742 Err(idx) => {735 Err(idx) => {
743 ensure!(admin_arr.len() < <limit!(T, CollectionAdminsLimit)>::get() as usize, Error::<T>::CollectionAdminsLimitExceeded);736 ensure!(admin_arr.len() < COLLECTION_ADMINS_LIMIT as usize, Error::<T>::CollectionAdminsLimitExceeded);
744 admin_arr.insert(idx, new_admin_id);737 admin_arr.insert(idx, new_admin_id);
745 <AdminList<T>>::insert(collection_id, admin_arr);738 <AdminList<T>>::insert(collection_id, admin_arr);
746 }739 }
864857
865 #[weight = <T as Config>::WeightInfo::create_item(data.data_size())]858 #[weight = <T as Config>::WeightInfo::create_item(data.data_size())]
866 #[transactional]859 #[transactional]
867 pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData<ChainLimitsOf<T>>) -> DispatchResult {860 pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResult {
868 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);861 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
869 let collection = Self::get_collection(collection_id)?;862 let collection = Self::get_collection(collection_id)?;
870863
895 .map(|data| { data.data_size() })888 .map(|data| { data.data_size() })
896 .sum())]889 .sum())]
897 #[transactional]890 #[transactional]
898 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData<ChainLimitsOf<T>>>) -> DispatchResult {891 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {
899892
900 ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);893 ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
901 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);894 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
1140 Self::check_owner_or_admin_permissions(&target_collection, &sender)?;1133 Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
11411134
1142 // check schema limit1135 // check schema limit
1143 ensure!(schema.len() as u32 <= <limit!(T, OffchainSchemaLimit)>::get(), "");1136 ensure!(schema.len() as u32 <= OFFCHAIN_SCHEMA_LIMIT, "");
11441137
1145 target_collection.offchain_schema = schema;1138 target_collection.offchain_schema = schema;
1146 target_collection.save()1139 target_collection.save()
1170 Self::check_owner_or_admin_permissions(&target_collection, &sender)?;1163 Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
11711164
1172 // check schema limit1165 // check schema limit
1173 ensure!(schema.len() as u32 <= <limit!(T, ConstOnChainSchemaLimit)>::get(), "");1166 ensure!(schema.len() as u32 <= CONST_ON_CHAIN_SCHEMA_LIMIT, "");
11741167
1175 target_collection.const_on_chain_schema = schema;1168 target_collection.const_on_chain_schema = schema;
1176 target_collection.save()1169 target_collection.save()
1200 Self::check_owner_or_admin_permissions(&target_collection, &sender)?;1193 Self::check_owner_or_admin_permissions(&target_collection, &sender)?;
12011194
1202 // check schema limit1195 // check schema limit
1203 ensure!(schema.len() as u32 <= <limit!(T, VariableOnChainSchemaLimit)>::get(), "");1196 ensure!(schema.len() as u32 <= VARIABLE_ON_CHAIN_SCHEMA_LIMIT, "");
12041197
1205 target_collection.variable_on_chain_schema = schema;1198 target_collection.variable_on_chain_schema = schema;
1206 target_collection.save()1199 target_collection.save()
1221 // collection bounds1214 // collection bounds
1222 ensure!(new_limits.sponsor_transfer_timeout <= MAX_SPONSOR_TIMEOUT &&1215 ensure!(new_limits.sponsor_transfer_timeout <= MAX_SPONSOR_TIMEOUT &&
1223 new_limits.account_token_ownership_limit <= MAX_TOKEN_OWNERSHIP &&1216 new_limits.account_token_ownership_limit <= MAX_TOKEN_OWNERSHIP &&
1224 new_limits.sponsored_data_size <= <ChainLimitsOf<T> as ChainLimits>::CustomDataLimit::get(),1217 new_limits.sponsored_data_size <= CUSTOM_DATA_LIMIT,
1225 Error::<T>::CollectionLimitBoundsExceeded);1218 Error::<T>::CollectionLimitBoundsExceeded);
12261219
1227 // token_limit check prev1220 // token_limit check prev
1246 sender: &T::CrossAccountId,1239 sender: &T::CrossAccountId,
1247 collection: &CollectionHandle<T>,1240 collection: &CollectionHandle<T>,
1248 owner: &T::CrossAccountId,1241 owner: &T::CrossAccountId,
1249 data: CreateItemData<ChainLimitsOf<T>>,1242 data: CreateItemData,
1250 ) -> DispatchResult {1243 ) -> DispatchResult {
1251 Self::can_create_items_in_collection(collection, sender, owner, 1)?;1244 Self::can_create_items_in_collection(collection, sender, owner, 1)?;
1252 Self::validate_create_item_args(collection, &data)?;1245 Self::validate_create_item_args(collection, &data)?;
1457 Self::token_exists(collection, item_id)?;1450 Self::token_exists(collection, item_id)?;
14581451
1459 ensure!(1452 ensure!(
1460 <limit!(T, CustomDataLimit)>::get() >= data.len() as u32,1453 CUSTOM_DATA_LIMIT >= data.len() as u32,
1461 Error::<T>::TokenVariableDataLimitExceeded1454 Error::<T>::TokenVariableDataLimitExceeded
1462 );1455 );
14631456
1484 sender: &T::CrossAccountId,1477 sender: &T::CrossAccountId,
1485 collection: &CollectionHandle<T>,1478 collection: &CollectionHandle<T>,
1486 owner: &T::CrossAccountId,1479 owner: &T::CrossAccountId,
1487 items_data: Vec<CreateItemData<ChainLimitsOf<T>>>,1480 items_data: Vec<CreateItemData>,
1488 ) -> DispatchResult {1481 ) -> DispatchResult {
1489 Self::can_create_items_in_collection(collection, sender, owner, items_data.len() as u32)?;1482 Self::can_create_items_in_collection(collection, sender, owner, items_data.len() as u32)?;
14901483
15981591
1599 fn validate_create_item_args(1592 fn validate_create_item_args(
1600 target_collection: &CollectionHandle<T>,1593 target_collection: &CollectionHandle<T>,
1601 data: &CreateItemData<ChainLimitsOf<T>>,1594 data: &CreateItemData,
1602 ) -> DispatchResult {1595 ) -> DispatchResult {
1603 match target_collection.mode {1596 match target_collection.mode {
1604 CollectionMode::NFT => {1597 CollectionMode::NFT => {
1605 if let CreateItemData::NFT(data) = data {1598 if let CreateItemData::NFT(data) = data {
1606 // check sizes1599 // check sizes
1607 ensure!(1600 ensure!(
1608 <limit!(T, CustomDataLimit)>::get() >= data.const_data.len() as u32,1601 CUSTOM_DATA_LIMIT >= data.const_data.len() as u32,
1609 Error::<T>::TokenConstDataLimitExceeded1602 Error::<T>::TokenConstDataLimitExceeded
1610 );1603 );
1611 ensure!(1604 ensure!(
1612 <limit!(T, CustomDataLimit)>::get() >= data.variable_data.len() as u32,1605 CUSTOM_DATA_LIMIT >= data.variable_data.len() as u32,
1613 Error::<T>::TokenVariableDataLimitExceeded1606 Error::<T>::TokenVariableDataLimitExceeded
1614 );1607 );
1615 } else {1608 } else {
1626 if let CreateItemData::ReFungible(data) = data {1619 if let CreateItemData::ReFungible(data) = data {
1627 // check sizes1620 // check sizes
1628 ensure!(1621 ensure!(
1629 <limit!(T, CustomDataLimit)>::get() >= data.const_data.len() as u32,1622 CUSTOM_DATA_LIMIT >= data.const_data.len() as u32,
1630 Error::<T>::TokenConstDataLimitExceeded1623 Error::<T>::TokenConstDataLimitExceeded
1631 );1624 );
1632 ensure!(1625 ensure!(
1633 <limit!(T, CustomDataLimit)>::get() >= data.variable_data.len() as u32,1626 CUSTOM_DATA_LIMIT >= data.variable_data.len() as u32,
1634 Error::<T>::TokenVariableDataLimitExceeded1627 Error::<T>::TokenVariableDataLimitExceeded
1635 );1628 );
16361629
1655 fn create_item_no_validation(1648 fn create_item_no_validation(
1656 collection: &CollectionHandle<T>,1649 collection: &CollectionHandle<T>,
1657 owner: &T::CrossAccountId,1650 owner: &T::CrossAccountId,
1658 data: CreateItemData<ChainLimitsOf<T>>,1651 data: CreateItemData,
1659 ) -> DispatchResult {1652 ) -> DispatchResult {
1660 match data {1653 match data {
1661 CreateItemData::NFT(data) => {1654 CreateItemData::NFT(data) => {
2278 // bound Owned tokens by a single address2271 // bound Owned tokens by a single address
2279 let count = <AccountItemCount<T>>::get(owner.as_sub());2272 let count = <AccountItemCount<T>>::get(owner.as_sub());
2280 ensure!(2273 ensure!(
2281 count < <limit!(T, AccountTokenOwnershipLimit)>::get(),2274 count < ACCOUNT_TOKEN_OWNERSHIP_LIMIT,
2282 Error::<T>::AddressOwnershipLimitExceeded2275 Error::<T>::AddressOwnershipLimitExceeded
2283 );2276 );
22842277
modifiedpallets/nft/src/sponsorship.rsdiffbeforeafterboth
--- a/pallets/nft/src/sponsorship.rs
+++ b/pallets/nft/src/sponsorship.rs
@@ -1,22 +1,25 @@
 use crate::{
 	Config, Call, CollectionById, CreateItemBasket, VariableMetaDataBasket,
-	ReFungibleTransferBasket, FungibleTransferBasket, NftTransferBasket,
-	CreateItemData, CollectionMode, limit,
+	ReFungibleTransferBasket, FungibleTransferBasket, NftTransferBasket, CreateItemData,
+	CollectionMode,
 };
 use core::marker::PhantomData;
 use up_sponsorship::SponsorshipHandler;
 use frame_support::{
-	traits::{IsSubType, Get},
+	traits::{IsSubType},
 	storage::{StorageMap, StorageDoubleMap},
 };
-use nft_data_structs::{TokenId, CollectionId};
+use nft_data_structs::{
+	TokenId, CollectionId, NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
+	FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
+};
 
 pub struct NftSponsorshipHandler<T>(PhantomData<T>);
 impl<T: Config> NftSponsorshipHandler<T> {
 	pub fn withdraw_create_item(
 		who: &T::AccountId,
 		collection_id: &CollectionId,
-		_properties: &CreateItemData<T::ChainLimits>,
+		_properties: &CreateItemData,
 	) -> Option<T::AccountId> {
 		let collection = CollectionById::<T>::get(collection_id)?;
 
@@ -61,7 +64,7 @@
 					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
 						collection_limits.sponsor_transfer_timeout
 					} else {
-						<limit!(T, NftSponsorTransferTimeout)>::get()
+						NFT_SPONSOR_TRANSFER_TIMEOUT
 					};
 
 					let mut sponsored = true;
@@ -83,7 +86,7 @@
 					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
 						collection_limits.sponsor_transfer_timeout
 					} else {
-						<limit!(T, FungibleSponsorTransferTimeout)>::get()
+						FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
 					};
 
 					let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
@@ -106,7 +109,7 @@
 					let limit: u32 = if collection_limits.sponsor_transfer_timeout > 0 {
 						collection_limits.sponsor_transfer_timeout
 					} else {
-						<limit!(T, ReFungibleSponsorTransferTimeout)>::get()
+						REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT
 					};
 
 					let mut sponsored = true;
modifiedprimitives/nft/src/lib.rsdiffbeforeafterboth
--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -28,6 +28,29 @@
 pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;
 pub const MAX_TOKEN_OWNERSHIP: u32 = 10_000_000;
 
+pub const COLLECTION_NUMBER_LIMIT: u32 = 100000;
+pub const CUSTOM_DATA_LIMIT: u32 = 2048;
+pub const COLLECTION_ADMINS_LIMIT: u64 = 5;
+pub const ACCOUNT_TOKEN_OWNERSHIP_LIMIT: u32 = 1000000;
+
+// Timeouts for item types in passed blocks
+pub const NFT_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;
+pub const FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;
+pub const REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;
+
+// Schema limits
+pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 1024;
+pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 1024;
+pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 1024;
+
+/// How much items can be created per single
+/// create_many call
+pub const MAX_ITEMS_PER_BATCH: u32 = 200;
+
+parameter_types! {
+	pub const CustomDataLimit: u32 = CUSTOM_DATA_LIMIT;
+}
+
 pub type CollectionId = u32;
 pub type TokenId = u32;
 pub type DecimalPoints = u8;
@@ -203,27 +226,6 @@
 	}
 }
 
-pub trait ChainLimits {
-	type CollectionNumberLimit: Get<u32>;
-	type AccountTokenOwnershipLimit: Get<u32>;
-	type CollectionAdminsLimit: Get<u64>;
-	type CustomDataLimit: Get<u32>;
-
-	// Timeouts for item types in passed blocks
-	type NftSponsorTransferTimeout: Get<u32>;
-	type FungibleSponsorTransferTimeout: Get<u32>;
-	type ReFungibleSponsorTransferTimeout: Get<u32>;
-
-	// Schema limits
-	type OffchainSchemaLimit: Get<u32>;
-	type VariableOnChainSchemaLimit: Get<u32>;
-	type ConstOnChainSchemaLimit: Get<u32>;
-
-	/// How much items can be created per single
-	/// create_many call
-	type MaxItemsPerBatch: Get<u32>;
-}
-
 /// BoundedVec doesn't supports serde
 #[cfg(feature = "serde1")]
 mod bounded_serde {
@@ -257,16 +259,16 @@
 	}
 }
 
-#[derive(Encode, Decode, MaxEncodedLen, Default, Derivative)]
+#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative)]
 #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
-#[derivative(Debug(bound = ""), PartialEq(bound = ""), Clone(bound = ""))]
-pub struct CreateNftData<T: ChainLimits> {
+#[derivative(Debug)]
+pub struct CreateNftData {
 	#[cfg_attr(feature = "serde1", serde(with = "bounded_serde"))]
 	#[derivative(Debug = "ignore")]
-	pub const_data: BoundedVec<u8, T::CustomDataLimit>,
+	pub const_data: BoundedVec<u8, CustomDataLimit>,
 	#[cfg_attr(feature = "serde1", serde(with = "bounded_serde"))]
 	#[derivative(Debug = "ignore")]
-	pub variable_data: BoundedVec<u8, T::CustomDataLimit>,
+	pub variable_data: BoundedVec<u8, CustomDataLimit>,
 }
 
 #[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq)]
@@ -275,29 +277,28 @@
 	pub value: u128,
 }
 
-#[derive(Encode, Decode, MaxEncodedLen, Default, Derivative)]
+#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative)]
 #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
-#[derivative(Debug(bound = ""), PartialEq(bound = ""), Clone(bound = ""))]
-pub struct CreateReFungibleData<T: ChainLimits> {
+#[derivative(Debug)]
+pub struct CreateReFungibleData {
 	#[cfg_attr(feature = "serde1", serde(with = "bounded_serde"))]
 	#[derivative(Debug = "ignore")]
-	pub const_data: BoundedVec<u8, T::CustomDataLimit>,
+	pub const_data: BoundedVec<u8, CustomDataLimit>,
 	#[cfg_attr(feature = "serde1", serde(with = "bounded_serde"))]
 	#[derivative(Debug = "ignore")]
-	pub variable_data: BoundedVec<u8, T::CustomDataLimit>,
+	pub variable_data: BoundedVec<u8, CustomDataLimit>,
 	pub pieces: u128,
 }
 
-#[derive(Encode, Decode, MaxEncodedLen, Derivative)]
+#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug)]
 #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
-#[derivative(Debug(bound = ""), PartialEq(bound = ""), Clone(bound = ""))]
-pub enum CreateItemData<T: ChainLimits> {
-	NFT(CreateNftData<T>),
+pub enum CreateItemData {
+	NFT(CreateNftData),
 	Fungible(CreateFungibleData),
-	ReFungible(CreateReFungibleData<T>),
+	ReFungible(CreateReFungibleData),
 }
 
-impl<T: ChainLimits> CreateItemData<T> {
+impl CreateItemData {
 	pub fn data_size(&self) -> usize {
 		match self {
 			CreateItemData::NFT(data) => data.variable_data.len() + data.const_data.len(),
@@ -307,19 +308,19 @@
 	}
 }
 
-impl<T: ChainLimits> From<CreateNftData<T>> for CreateItemData<T> {
-	fn from(item: CreateNftData<T>) -> Self {
+impl From<CreateNftData> for CreateItemData {
+	fn from(item: CreateNftData) -> Self {
 		CreateItemData::NFT(item)
 	}
 }
 
-impl<T: ChainLimits> From<CreateReFungibleData<T>> for CreateItemData<T> {
-	fn from(item: CreateReFungibleData<T>) -> Self {
+impl From<CreateReFungibleData> for CreateItemData {
+	fn from(item: CreateReFungibleData) -> Self {
 		CreateItemData::ReFungible(item)
 	}
 }
 
-impl<T: ChainLimits> From<CreateFungibleData> for CreateItemData<T> {
+impl From<CreateFungibleData> for CreateItemData {
 	fn from(item: CreateFungibleData) -> Self {
 		CreateItemData::Fungible(item)
 	}
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -683,35 +683,6 @@
 }
 
 parameter_types! {
-	pub const CollectionNumberLimit: u32 = 100000;
-	pub const AccountTokenOwnershipLimit: u32 = 1000000;
-	pub const CollectionAdminsLimit: u64 = 5;
-	pub const CustomDataLimit: u32 = 2048;
-	pub const NftSponsorTransferTimeout: u32 = 5;
-	pub const FungibleSponsorTransferTimeout: u32 = 5;
-	pub const ReFungibleSponsorTransferTimeout: u32 = 5;
-	pub const OffchainSchemaLimit: u32 = 1024;
-	pub const VariableOnChainSchemaLimit: u32 = 1024;
-	pub const ConstOnChainSchemaLimit: u32 = 1024;
-	pub const MaxItemsPerBatch: u32 = 200;
-}
-
-pub struct ChainLimits;
-impl nft_data_structs::ChainLimits for ChainLimits {
-    type CollectionNumberLimit = CollectionNumberLimit;
-    type AccountTokenOwnershipLimit = AccountTokenOwnershipLimit;
-    type CollectionAdminsLimit = CollectionAdminsLimit;
-    type CustomDataLimit = CustomDataLimit;
-    type NftSponsorTransferTimeout = NftSponsorTransferTimeout;
-    type FungibleSponsorTransferTimeout = FungibleSponsorTransferTimeout;
-    type ReFungibleSponsorTransferTimeout = ReFungibleSponsorTransferTimeout;
-    type OffchainSchemaLimit = OffchainSchemaLimit;
-    type VariableOnChainSchemaLimit = VariableOnChainSchemaLimit;
-    type ConstOnChainSchemaLimit = ConstOnChainSchemaLimit;
-    type MaxItemsPerBatch = MaxItemsPerBatch;
-}
-
-parameter_types! {
 	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();
 	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;
 }
@@ -728,7 +699,6 @@
 	type Currency = Balances;
 	type CollectionCreationPrice = CollectionCreationPrice;
 	type TreasuryAccountId = TreasuryAccountId;
-	type ChainLimits = ChainLimits;
 }
 
 parameter_types! {