git.delta.rocks / unique-network / refs/commits / a4e6c79aaf40

difftreelog

feat Rewrite tuple to named structures for CollectionLimits.

Trubnikov Sergey2022-12-20parent: #8298cf8.patch.diff
in: master

21 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -36,7 +36,7 @@
 	Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf,
 	eth::{
 		Property as PropertyStruct, EthCrossAccount, CollectionPermissions as EvmPermissions,
-		CollectionLimits as EvmCollectionLimits,
+		CollectionLimitField as EvmCollectionLimits, self,
 	},
 	weights::WeightInfo,
 };
@@ -299,52 +299,16 @@
 
 	/// Get current collection limits.
 	///
-	/// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// Return `false` if a limit not set.
-	fn collection_limits(&self) -> Result<Vec<(EvmCollectionLimits, bool, uint256)>> {
-		let convert_value_limit = |limit: EvmCollectionLimits,
-		                           value: Option<u32>|
-		 -> (EvmCollectionLimits, bool, uint256) {
-			value
-				.map(|v| (limit, true, v.into()))
-				.unwrap_or((limit, false, Default::default()))
-		};
-
-		let convert_bool_limit = |limit: EvmCollectionLimits,
-		                          value: Option<bool>|
-		 -> (EvmCollectionLimits, bool, uint256) {
-			value
-				.map(|v| {
-					(
-						limit,
-						true,
-						if v {
-							uint256::from(1)
-						} else {
-							Default::default()
-						},
-					)
-				})
-				.unwrap_or((limit, false, Default::default()))
-		};
-
+	/// @return Array of collection limits
+	fn collection_limits(&self) -> Result<Vec<eth::CollectionLimit>> {
 		let limits = &self.collection.limits;
 
 		Ok(vec![
-			convert_value_limit(
+			eth::CollectionLimit::from_opt_int(
 				EvmCollectionLimits::AccountTokenOwnership,
 				limits.account_token_ownership_limit,
 			),
-			convert_value_limit(
+			eth::CollectionLimit::from_opt_int(
 				EvmCollectionLimits::SponsoredDataSize,
 				limits.sponsored_data_size,
 			),
@@ -352,38 +316,36 @@
 				.sponsored_data_rate_limit
 				.and_then(|limit| {
 					if let SponsoringRateLimit::Blocks(blocks) = limit {
-						Some((
+						Some(eth::CollectionLimit::from_int(
 							EvmCollectionLimits::SponsoredDataRateLimit,
-							true,
-							blocks.into(),
+							blocks,
 						))
 					} else {
 						None
 					}
 				})
-				.unwrap_or((
+				.unwrap_or(eth::CollectionLimit::from_int(
 					EvmCollectionLimits::SponsoredDataRateLimit,
-					false,
 					Default::default(),
 				)),
-			convert_value_limit(EvmCollectionLimits::TokenLimit, limits.token_limit),
-			convert_value_limit(
+			eth::CollectionLimit::from_opt_int(EvmCollectionLimits::TokenLimit, limits.token_limit),
+			eth::CollectionLimit::from_opt_int(
 				EvmCollectionLimits::SponsorTransferTimeout,
 				limits.sponsor_transfer_timeout,
 			),
-			convert_value_limit(
+			eth::CollectionLimit::from_opt_int(
 				EvmCollectionLimits::SponsorApproveTimeout,
 				limits.sponsor_approve_timeout,
 			),
-			convert_bool_limit(
+			eth::CollectionLimit::from_opt_bool(
 				EvmCollectionLimits::OwnerCanTransfer,
 				limits.owner_can_transfer,
 			),
-			convert_bool_limit(
+			eth::CollectionLimit::from_opt_bool(
 				EvmCollectionLimits::OwnerCanDestroy,
 				limits.owner_can_destroy,
 			),
-			convert_bool_limit(
+			eth::CollectionLimit::from_opt_bool(
 				EvmCollectionLimits::TransferEnabled,
 				limits.transfers_enabled,
 			),
@@ -392,82 +354,17 @@
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
-	/// @param limit Name of the limit. Valid names:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// @param status enable\disable limit. Works only with `true`.
-	/// @param value Value of the limit.
+	/// @param limit Some limit.
 	#[solidity(rename_selector = "setCollectionLimit")]
 	fn set_collection_limit(
 		&mut self,
 		caller: caller,
-		limit: EvmCollectionLimits,
-		status: bool,
-		value: uint256,
+		limit: eth::CollectionLimit,
 	) -> Result<void> {
 		self.consume_store_reads_and_writes(1, 1)?;
-
-		if !status {
-			return Err(Error::Revert("user can't disable limits".into()));
-		}
-
-		let value = value
-			.try_into()
-			.map_err(|_| Error::Revert(format!("can't convert value to u32 \"{}\"", value)))?;
-
-		let convert_value_to_bool = || match value {
-			0 => Ok(false),
-			1 => Ok(true),
-			_ => {
-				return Err(Error::Revert(format!(
-					"can't convert value to boolean \"{}\"",
-					value
-				)))
-			}
-		};
-
-		let mut limits = self.limits.clone();
-
-		match limit {
-			EvmCollectionLimits::AccountTokenOwnership => {
-				limits.account_token_ownership_limit = Some(value);
-			}
-			EvmCollectionLimits::SponsoredDataSize => {
-				limits.sponsored_data_size = Some(value);
-			}
-			EvmCollectionLimits::SponsoredDataRateLimit => {
-				limits.sponsored_data_rate_limit = Some(SponsoringRateLimit::Blocks(value));
-			}
-			EvmCollectionLimits::TokenLimit => {
-				limits.token_limit = Some(value);
-			}
-			EvmCollectionLimits::SponsorTransferTimeout => {
-				limits.sponsor_transfer_timeout = Some(value);
-			}
-			EvmCollectionLimits::SponsorApproveTimeout => {
-				limits.sponsor_approve_timeout = Some(value);
-			}
-			EvmCollectionLimits::OwnerCanTransfer => {
-				limits.owner_can_transfer = Some(convert_value_to_bool()?);
-			}
-			EvmCollectionLimits::OwnerCanDestroy => {
-				limits.owner_can_destroy = Some(convert_value_to_bool()?);
-			}
-			EvmCollectionLimits::TransferEnabled => {
-				limits.transfers_enabled = Some(convert_value_to_bool()?);
-			}
-			_ => return Err(Error::Revert(format!("unknown limit \"{:?}\"", limit))),
-		}
 
 		let caller = T::CrossAccountId::from_eth(caller);
-		<Pallet<T>>::update_limits(&caller, self, limits).map_err(dispatch_to_evm::<T>)
+		<Pallet<T>>::update_limits(&caller, self, limit.try_into()?).map_err(dispatch_to_evm::<T>)
 	}
 
 	/// Get contract address.
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
before · pallets/common/src/eth.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/>.1617//! The module contains a number of functions for converting and checking ethereum identifiers.1819use sp_std::{vec, vec::Vec};20use evm_coder::{21	AbiCoder,22	types::{uint256, address},23};24pub use pallet_evm::{Config, account::CrossAccountId};25use sp_core::H160;26use up_data_structs::CollectionId;2728// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 129// TODO: Unhardcode prefix30const ETH_COLLECTION_PREFIX: [u8; 16] = [31	0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,32];3334/// Maps the ethereum address of the collection in substrate.35pub fn map_eth_to_id(eth: &H160) -> Option<CollectionId> {36	if eth[0..16] != ETH_COLLECTION_PREFIX {37		return None;38	}39	let mut id_bytes = [0; 4];40	id_bytes.copy_from_slice(&eth[16..20]);41	Some(CollectionId(u32::from_be_bytes(id_bytes)))42}4344/// Maps the substrate collection id in ethereum.45pub fn collection_id_to_address(id: CollectionId) -> H160 {46	let mut out = [0; 20];47	out[0..16].copy_from_slice(&ETH_COLLECTION_PREFIX);48	out[16..20].copy_from_slice(&u32::to_be_bytes(id.0));49	H160(out)50}5152/// Check if the ethereum address is a collection.53pub fn is_collection(address: &H160) -> bool {54	address[0..16] == ETH_COLLECTION_PREFIX55}5657/// Convert `uint256` to `CrossAccountId`.58pub fn convert_uint256_to_cross_account<T: Config>(from: uint256) -> T::CrossAccountId59where60	T::AccountId: From<[u8; 32]>,61{62	let mut new_admin_arr = [0_u8; 32];63	from.to_big_endian(&mut new_admin_arr);64	let account_id = T::AccountId::from(new_admin_arr);65	T::CrossAccountId::from_sub(account_id)66}6768/// Cross account struct69#[derive(Debug, Default, AbiCoder)]70pub struct EthCrossAccount {71	pub(crate) eth: address,72	pub(crate) sub: uint256,73}7475impl EthCrossAccount {76	/// Converts `CrossAccountId` to `EthCrossAccountId`77	pub fn from_sub_cross_account<T>(cross_account_id: &T::CrossAccountId) -> Self78	where79		T: pallet_evm::Config,80		T::AccountId: AsRef<[u8; 32]>,81	{82		if cross_account_id.is_canonical_substrate() {83			Self::from_sub::<T>(cross_account_id.as_sub())84		} else {85			Self {86				eth: *cross_account_id.as_eth(),87				sub: Default::default(),88			}89		}90	}91	/// Creates `EthCrossAccount` from substrate account92	pub fn from_sub<T>(account_id: &T::AccountId) -> Self93	where94		T: pallet_evm::Config,95		T::AccountId: AsRef<[u8; 32]>,96	{97		Self {98			eth: Default::default(),99			sub: uint256::from_big_endian(account_id.as_ref()),100		}101	}102	/// Converts `EthCrossAccount` to `CrossAccountId`103	pub fn into_sub_cross_account<T>(&self) -> evm_coder::execution::Result<T::CrossAccountId>104	where105		T: pallet_evm::Config,106		T::AccountId: From<[u8; 32]>,107	{108		if self.eth == Default::default() && self.sub == Default::default() {109			Err("All fields of cross account is zeroed".into())110		} else if self.eth == Default::default() {111			Ok(convert_uint256_to_cross_account::<T>(self.sub))112		} else if self.sub == Default::default() {113			Ok(T::CrossAccountId::from_eth(self.eth))114		} else {115			Err("All fields of cross account is non zeroed".into())116		}117	}118}119120/// Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).121#[derive(Debug, Default, AbiCoder)]122pub struct Property {123	/// Property key.124	pub key: evm_coder::types::string,125	/// Property value.126	pub value: evm_coder::types::bytes,127}128129/// [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.130#[derive(Debug, Default, Clone, Copy, AbiCoder)]131#[repr(u8)]132pub enum CollectionLimits {133	/// How many tokens can a user have on one account.134	#[default]135	AccountTokenOwnership,136137	/// How many bytes of data are available for sponsorship.138	SponsoredDataSize,139140	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]141	SponsoredDataRateLimit,142143	/// How many tokens can be mined into this collection.144	TokenLimit,145146	/// Timeouts for transfer sponsoring.147	SponsorTransferTimeout,148149	/// Timeout for sponsoring an approval in passed blocks.150	SponsorApproveTimeout,151152	/// Whether the collection owner of the collection can send tokens (which belong to other users).153	OwnerCanTransfer,154155	/// Can the collection owner burn other people's tokens.156	OwnerCanDestroy,157158	/// Is it possible to send tokens from this collection between users.159	TransferEnabled,160}161/// Ethereum representation of `NestingPermissions` (see [`up_data_structs::NestingPermissions`]) fields as an enumeration.162#[derive(Default, Debug, Clone, Copy, AbiCoder)]163#[repr(u8)]164pub enum CollectionPermissions {165	/// Owner of token can nest tokens under it.166	#[default]167	TokenOwner,168169	/// Admin of token collection can nest tokens under token.170	CollectionAdmin,171}172173/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.174#[derive(AbiCoder, Copy, Clone, Default, Debug)]175#[repr(u8)]176pub enum EthTokenPermissions {177	/// Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]178	#[default]179	Mutable,180181	/// Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]182	TokenOwner,183184	/// Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]185	CollectionAdmin,186}187188/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.189#[derive(Debug, Default, AbiCoder)]190pub struct PropertyPermission {191	/// TokenPermission field.192	code: EthTokenPermissions,193	/// TokenPermission value.194	value: bool,195}196197impl PropertyPermission {198	pub fn into_vec(pp: up_data_structs::PropertyPermission) -> Vec<Self> {199		vec![200			PropertyPermission {201				code: EthTokenPermissions::Mutable,202				value: pp.mutable,203			},204			PropertyPermission {205				code: EthTokenPermissions::TokenOwner,206				value: pp.token_owner,207			},208			PropertyPermission {209				code: EthTokenPermissions::CollectionAdmin,210				value: pp.collection_admin,211			},212		]213	}214215	pub fn from_vec(permission: Vec<Self>) -> up_data_structs::PropertyPermission {216		let mut token_permission = up_data_structs::PropertyPermission::default();217218		for PropertyPermission { code, value } in permission {219			match code {220				EthTokenPermissions::Mutable => token_permission.mutable = value,221				EthTokenPermissions::TokenOwner => token_permission.token_owner = value,222				EthTokenPermissions::CollectionAdmin => token_permission.collection_admin = value,223			}224		}225		token_permission226	}227}228229/// Ethereum representation of Token Property Permissions.230#[derive(Debug, Default, AbiCoder)]231pub struct TokenPropertyPermission {232	/// Token property key.233	key: evm_coder::types::string,234	/// Token property permissions.235	permissions: Vec<PropertyPermission>,236}237238impl239	From<(240		up_data_structs::PropertyKey,241		up_data_structs::PropertyPermission,242	)> for TokenPropertyPermission243{244	fn from(245		value: (246			up_data_structs::PropertyKey,247			up_data_structs::PropertyPermission,248		),249	) -> Self {250		let (key, permission) = value;251		let key = evm_coder::types::string::from_utf8(key.into_inner())252			.expect("Stored key must be valid");253		let permissions = PropertyPermission::into_vec(permission);254		Self { key, permissions }255	}256}257258impl TokenPropertyPermission {259	pub fn into_property_key_permissions(260		permissions: Vec<TokenPropertyPermission>,261	) -> evm_coder::execution::Result<Vec<up_data_structs::PropertyKeyPermission>> {262		let mut perms = Vec::new();263264		for TokenPropertyPermission { key, permissions } in permissions {265			if permissions.len() > <EthTokenPermissions as evm_coder::abi::AbiType>::FIELDS_COUNT {266				return Err(alloc::format!(267					"Actual number of fields {} for {}, which exceeds the maximum value of {}",268					permissions.len(),269					stringify!(EthTokenPermissions),270					<EthTokenPermissions as evm_coder::abi::AbiType>::FIELDS_COUNT271				)272				.as_str()273				.into());274			}275276			let token_permission = PropertyPermission::from_vec(permissions);277278			perms.push(up_data_structs::PropertyKeyPermission {279				key: key.into_bytes().try_into().map_err(|_| "too long key")?,280				permission: token_permission,281			});282		}283		Ok(perms)284	}285}
after · pallets/common/src/eth.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/>.1617//! The module contains a number of functions for converting and checking ethereum identifiers.1819use alloc::format;20use sp_std::{vec, vec::Vec};21use evm_coder::{22	AbiCoder,23	types::{uint256, address},24};25pub use pallet_evm::{Config, account::CrossAccountId};26use sp_core::H160;27use up_data_structs::CollectionId;2829// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 130// TODO: Unhardcode prefix31const ETH_COLLECTION_PREFIX: [u8; 16] = [32	0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,33];3435/// Maps the ethereum address of the collection in substrate.36pub fn map_eth_to_id(eth: &H160) -> Option<CollectionId> {37	if eth[0..16] != ETH_COLLECTION_PREFIX {38		return None;39	}40	let mut id_bytes = [0; 4];41	id_bytes.copy_from_slice(&eth[16..20]);42	Some(CollectionId(u32::from_be_bytes(id_bytes)))43}4445/// Maps the substrate collection id in ethereum.46pub fn collection_id_to_address(id: CollectionId) -> H160 {47	let mut out = [0; 20];48	out[0..16].copy_from_slice(&ETH_COLLECTION_PREFIX);49	out[16..20].copy_from_slice(&u32::to_be_bytes(id.0));50	H160(out)51}5253/// Check if the ethereum address is a collection.54pub fn is_collection(address: &H160) -> bool {55	address[0..16] == ETH_COLLECTION_PREFIX56}5758/// Convert `uint256` to `CrossAccountId`.59pub fn convert_uint256_to_cross_account<T: Config>(from: uint256) -> T::CrossAccountId60where61	T::AccountId: From<[u8; 32]>,62{63	let mut new_admin_arr = [0_u8; 32];64	from.to_big_endian(&mut new_admin_arr);65	let account_id = T::AccountId::from(new_admin_arr);66	T::CrossAccountId::from_sub(account_id)67}6869/// Cross account struct70#[derive(Debug, Default, AbiCoder)]71pub struct EthCrossAccount {72	pub(crate) eth: address,73	pub(crate) sub: uint256,74}7576impl EthCrossAccount {77	/// Converts `CrossAccountId` to `EthCrossAccountId`78	pub fn from_sub_cross_account<T>(cross_account_id: &T::CrossAccountId) -> Self79	where80		T: pallet_evm::Config,81		T::AccountId: AsRef<[u8; 32]>,82	{83		if cross_account_id.is_canonical_substrate() {84			Self::from_sub::<T>(cross_account_id.as_sub())85		} else {86			Self {87				eth: *cross_account_id.as_eth(),88				sub: Default::default(),89			}90		}91	}92	/// Creates `EthCrossAccount` from substrate account93	pub fn from_sub<T>(account_id: &T::AccountId) -> Self94	where95		T: pallet_evm::Config,96		T::AccountId: AsRef<[u8; 32]>,97	{98		Self {99			eth: Default::default(),100			sub: uint256::from_big_endian(account_id.as_ref()),101		}102	}103	/// Converts `EthCrossAccount` to `CrossAccountId`104	pub fn into_sub_cross_account<T>(&self) -> evm_coder::execution::Result<T::CrossAccountId>105	where106		T: pallet_evm::Config,107		T::AccountId: From<[u8; 32]>,108	{109		if self.eth == Default::default() && self.sub == Default::default() {110			Err("All fields of cross account is zeroed".into())111		} else if self.eth == Default::default() {112			Ok(convert_uint256_to_cross_account::<T>(self.sub))113		} else if self.sub == Default::default() {114			Ok(T::CrossAccountId::from_eth(self.eth))115		} else {116			Err("All fields of cross account is non zeroed".into())117		}118	}119}120121/// Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).122#[derive(Debug, Default, AbiCoder)]123pub struct Property {124	/// Property key.125	pub key: evm_coder::types::string,126	/// Property value.127	pub value: evm_coder::types::bytes,128}129130/// [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.131#[derive(Debug, Default, Clone, Copy, AbiCoder)]132#[repr(u8)]133pub enum CollectionLimitField {134	/// How many tokens can a user have on one account.135	#[default]136	AccountTokenOwnership,137138	/// How many bytes of data are available for sponsorship.139	SponsoredDataSize,140141	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]142	SponsoredDataRateLimit,143144	/// How many tokens can be mined into this collection.145	TokenLimit,146147	/// Timeouts for transfer sponsoring.148	SponsorTransferTimeout,149150	/// Timeout for sponsoring an approval in passed blocks.151	SponsorApproveTimeout,152153	/// Whether the collection owner of the collection can send tokens (which belong to other users).154	OwnerCanTransfer,155156	/// Can the collection owner burn other people's tokens.157	OwnerCanDestroy,158159	/// Is it possible to send tokens from this collection between users.160	TransferEnabled,161}162163#[derive(Debug, Default, AbiCoder)]164pub struct CollectionLimit {165	field: CollectionLimitField,166	status: bool,167	value: uint256,168}169170impl CollectionLimit {171	pub fn from_int(field: CollectionLimitField, value: u32) -> Self {172		Self {173			field,174			status: true,175			value: value.into(),176		}177	}178179	pub fn from_opt_int(field: CollectionLimitField, value: Option<u32>) -> Self {180		value181			.map(|v| Self {182				field,183				status: true,184				value: v.into(),185			})186			.unwrap_or(Self {187				field,188				status: false,189				value: Default::default(),190			})191	}192193	pub fn from_opt_bool(field: CollectionLimitField, value: Option<bool>) -> Self {194		value195			.map(|v| Self {196				field,197				status: true,198				value: if v {199					uint256::from(1)200				} else {201					Default::default()202				},203			})204			.unwrap_or(Self {205				field,206				status: false,207				value: Default::default(),208			})209	}210}211212impl TryInto<up_data_structs::CollectionLimits> for CollectionLimit {213	type Error = evm_coder::execution::Error;214215	fn try_into(self) -> Result<up_data_structs::CollectionLimits, Self::Error> {216		if !self.status {217			return Err(Self::Error::Revert("user can't disable limits".into()));218		}219220		let value = self.value.try_into().map_err(|error| {221			Self::Error::Revert(format!(222				"can't convert value to u32 \"{}\" because: \"{error}\"",223				self.value224			))225		})?;226227		let convert_value_to_bool = || match value {228			0 => Ok(false),229			1 => Ok(true),230			_ => {231				return Err(Self::Error::Revert(format!(232					"can't convert value to boolean \"{value}\""233				)))234			}235		};236237		let mut limits = up_data_structs::CollectionLimits::default();238		match self.field {239			CollectionLimitField::AccountTokenOwnership => {240				limits.account_token_ownership_limit = Some(value);241			}242			CollectionLimitField::SponsoredDataSize => {243				limits.sponsored_data_size = Some(value);244			}245			CollectionLimitField::SponsoredDataRateLimit => {246				limits.sponsored_data_rate_limit =247					Some(up_data_structs::SponsoringRateLimit::Blocks(value));248			}249			CollectionLimitField::TokenLimit => {250				limits.token_limit = Some(value);251			}252			CollectionLimitField::SponsorTransferTimeout => {253				limits.sponsor_transfer_timeout = Some(value);254			}255			CollectionLimitField::SponsorApproveTimeout => {256				limits.sponsor_approve_timeout = Some(value);257			}258			CollectionLimitField::OwnerCanTransfer => {259				limits.owner_can_transfer = Some(convert_value_to_bool()?);260			}261			CollectionLimitField::OwnerCanDestroy => {262				limits.owner_can_destroy = Some(convert_value_to_bool()?);263			}264			CollectionLimitField::TransferEnabled => {265				limits.transfers_enabled = Some(convert_value_to_bool()?);266			}267		};268		Ok(limits)269	}270}271272/// Ethereum representation of `NestingPermissions` (see [`up_data_structs::NestingPermissions`]) fields as an enumeration.273#[derive(Default, Debug, Clone, Copy, AbiCoder)]274#[repr(u8)]275pub enum CollectionPermissions {276	/// Owner of token can nest tokens under it.277	#[default]278	TokenOwner,279280	/// Admin of token collection can nest tokens under token.281	CollectionAdmin,282}283284/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.285#[derive(AbiCoder, Copy, Clone, Default, Debug)]286#[repr(u8)]287pub enum TokenPermissionField {288	/// Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]289	#[default]290	Mutable,291292	/// Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]293	TokenOwner,294295	/// Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]296	CollectionAdmin,297}298299/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.300#[derive(Debug, Default, AbiCoder)]301pub struct PropertyPermission {302	/// TokenPermission field.303	code: TokenPermissionField,304	/// TokenPermission value.305	value: bool,306}307308impl PropertyPermission {309	pub fn into_vec(pp: up_data_structs::PropertyPermission) -> Vec<Self> {310		vec![311			PropertyPermission {312				code: TokenPermissionField::Mutable,313				value: pp.mutable,314			},315			PropertyPermission {316				code: TokenPermissionField::TokenOwner,317				value: pp.token_owner,318			},319			PropertyPermission {320				code: TokenPermissionField::CollectionAdmin,321				value: pp.collection_admin,322			},323		]324	}325326	pub fn from_vec(permission: Vec<Self>) -> up_data_structs::PropertyPermission {327		let mut token_permission = up_data_structs::PropertyPermission::default();328329		for PropertyPermission { code, value } in permission {330			match code {331				TokenPermissionField::Mutable => token_permission.mutable = value,332				TokenPermissionField::TokenOwner => token_permission.token_owner = value,333				TokenPermissionField::CollectionAdmin => token_permission.collection_admin = value,334			}335		}336		token_permission337	}338}339340/// Ethereum representation of Token Property Permissions.341#[derive(Debug, Default, AbiCoder)]342pub struct TokenPropertyPermission {343	/// Token property key.344	key: evm_coder::types::string,345	/// Token property permissions.346	permissions: Vec<PropertyPermission>,347}348349impl350	From<(351		up_data_structs::PropertyKey,352		up_data_structs::PropertyPermission,353	)> for TokenPropertyPermission354{355	fn from(356		value: (357			up_data_structs::PropertyKey,358			up_data_structs::PropertyPermission,359		),360	) -> Self {361		let (key, permission) = value;362		let key = evm_coder::types::string::from_utf8(key.into_inner())363			.expect("Stored key must be valid");364		let permissions = PropertyPermission::into_vec(permission);365		Self { key, permissions }366	}367}368369impl TokenPropertyPermission {370	pub fn into_property_key_permissions(371		permissions: Vec<TokenPropertyPermission>,372	) -> evm_coder::execution::Result<Vec<up_data_structs::PropertyKeyPermission>> {373		let mut perms = Vec::new();374375		for TokenPropertyPermission { key, permissions } in permissions {376			if permissions.len() > <TokenPermissionField as evm_coder::abi::AbiType>::FIELDS_COUNT {377				return Err(alloc::format!(378					"Actual number of fields {} for {}, which exceeds the maximum value of {}",379					permissions.len(),380					stringify!(EthTokenPermissions),381					<TokenPermissionField as evm_coder::abi::AbiType>::FIELDS_COUNT382				)383				.as_str()384				.into());385			}386387			let token_permission = PropertyPermission::from_vec(permissions);388389			perms.push(up_data_structs::PropertyKeyPermission {390				key: key.into_bytes().try_into().map_err(|_| "too long key")?,391				permission: token_permission,392			});393		}394		Ok(perms)395	}396}
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -18,7 +18,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x81172a75
+/// @dev the ERC-165 identifier for this interface is 0x23201442
 contract Collection is Dummy, ERC165 {
 	// /// Set collection property.
 	// ///
@@ -160,50 +160,23 @@
 
 	/// Get current collection limits.
 	///
-	/// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// Return `false` if a limit not set.
+	/// @return Array of collection limits
 	/// @dev EVM selector for this function is: 0xf63bc572,
 	///  or in textual repr: collectionLimits()
-	function collectionLimits() public view returns (Tuple23[] memory) {
+	function collectionLimits() public view returns (CollectionLimit[] memory) {
 		require(false, stub_error);
 		dummy;
-		return new Tuple23[](0);
+		return new CollectionLimit[](0);
 	}
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
-	/// @param limit Name of the limit. Valid names:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// @param status enable\disable limit. Works only with `true`.
-	/// @param value Value of the limit.
-	/// @dev EVM selector for this function is: 0x88150bd0,
-	///  or in textual repr: setCollectionLimit(uint8,bool,uint256)
-	function setCollectionLimit(
-		CollectionLimits limit,
-		bool status,
-		uint256 value
-	) public {
+	/// @param limit Some limit.
+	/// @dev EVM selector for this function is: 0x2a2235e7,
+	///  or in textual repr: setCollectionLimit((uint8,bool,uint256))
+	function setCollectionLimit(CollectionLimit memory limit) public {
 		require(false, stub_error);
 		limit;
-		status;
-		value;
 		dummy = 0;
 	}
 
@@ -284,19 +257,19 @@
 	/// Returns nesting for a collection
 	/// @dev EVM selector for this function is: 0x22d25bfe,
 	///  or in textual repr: collectionNestingRestrictedCollectionIds()
-	function collectionNestingRestrictedCollectionIds() public view returns (Tuple29 memory) {
+	function collectionNestingRestrictedCollectionIds() public view returns (Tuple30 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple29(false, new uint256[](0));
+		return Tuple30(false, new uint256[](0));
 	}
 
 	/// Returns permissions for a collection
 	/// @dev EVM selector for this function is: 0x5b2eaf4b,
 	///  or in textual repr: collectionNestingPermissions()
-	function collectionNestingPermissions() public view returns (Tuple32[] memory) {
+	function collectionNestingPermissions() public view returns (Tuple33[] memory) {
 		require(false, stub_error);
 		dummy;
-		return new Tuple32[](0);
+		return new Tuple33[](0);
 	}
 
 	/// Set the collection access method.
@@ -479,19 +452,25 @@
 }
 
 /// @dev anonymous struct
-struct Tuple32 {
+struct Tuple33 {
 	CollectionPermissions field_0;
 	bool field_1;
 }
 
 /// @dev anonymous struct
-struct Tuple29 {
+struct Tuple30 {
 	bool field_0;
 	uint256[] field_1;
 }
 
+struct CollectionLimit {
+	CollectionLimitField field;
+	bool status;
+	uint256 value;
+}
+
 /// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
-enum CollectionLimits {
+enum CollectionLimitField {
 	/// @dev How many tokens can a user have on one account.
 	AccountTokenOwnership,
 	/// @dev How many bytes of data are available for sponsorship.
@@ -510,13 +489,6 @@
 	OwnerCanDestroy,
 	/// @dev Is it possible to send tokens from this collection between users.
 	TransferEnabled
-}
-
-/// @dev anonymous struct
-struct Tuple23 {
-	CollectionLimits field_0;
-	bool field_1;
-	uint256 field_2;
 }
 
 /// @dev Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -146,13 +146,13 @@
 /// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.
 struct PropertyPermission {
 	/// @dev TokenPermission field.
-	EthTokenPermissions code;
+	TokenPermissionField code;
 	/// @dev TokenPermission value.
 	bool value;
 }
 
 /// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.
-enum EthTokenPermissions {
+enum TokenPermissionField {
 	/// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]
 	Mutable,
 	/// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]
@@ -162,7 +162,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x81172a75
+/// @dev the ERC-165 identifier for this interface is 0x23201442
 contract Collection is Dummy, ERC165 {
 	// /// Set collection property.
 	// ///
@@ -304,50 +304,23 @@
 
 	/// Get current collection limits.
 	///
-	/// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// Return `false` if a limit not set.
+	/// @return Array of collection limits
 	/// @dev EVM selector for this function is: 0xf63bc572,
 	///  or in textual repr: collectionLimits()
-	function collectionLimits() public view returns (Tuple35[] memory) {
+	function collectionLimits() public view returns (CollectionLimit[] memory) {
 		require(false, stub_error);
 		dummy;
-		return new Tuple35[](0);
+		return new CollectionLimit[](0);
 	}
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
-	/// @param limit Name of the limit. Valid names:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// @param status enable\disable limit. Works only with `true`.
-	/// @param value Value of the limit.
-	/// @dev EVM selector for this function is: 0x88150bd0,
-	///  or in textual repr: setCollectionLimit(uint8,bool,uint256)
-	function setCollectionLimit(
-		CollectionLimits limit,
-		bool status,
-		uint256 value
-	) public {
+	/// @param limit Some limit.
+	/// @dev EVM selector for this function is: 0x2a2235e7,
+	///  or in textual repr: setCollectionLimit((uint8,bool,uint256))
+	function setCollectionLimit(CollectionLimit memory limit) public {
 		require(false, stub_error);
 		limit;
-		status;
-		value;
 		dummy = 0;
 	}
 
@@ -428,19 +401,19 @@
 	/// Returns nesting for a collection
 	/// @dev EVM selector for this function is: 0x22d25bfe,
 	///  or in textual repr: collectionNestingRestrictedCollectionIds()
-	function collectionNestingRestrictedCollectionIds() public view returns (Tuple41 memory) {
+	function collectionNestingRestrictedCollectionIds() public view returns (Tuple42 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple41(false, new uint256[](0));
+		return Tuple42(false, new uint256[](0));
 	}
 
 	/// Returns permissions for a collection
 	/// @dev EVM selector for this function is: 0x5b2eaf4b,
 	///  or in textual repr: collectionNestingPermissions()
-	function collectionNestingPermissions() public view returns (Tuple44[] memory) {
+	function collectionNestingPermissions() public view returns (Tuple45[] memory) {
 		require(false, stub_error);
 		dummy;
-		return new Tuple44[](0);
+		return new Tuple45[](0);
 	}
 
 	/// Set the collection access method.
@@ -623,19 +596,25 @@
 }
 
 /// @dev anonymous struct
-struct Tuple44 {
+struct Tuple45 {
 	CollectionPermissions field_0;
 	bool field_1;
 }
 
 /// @dev anonymous struct
-struct Tuple41 {
+struct Tuple42 {
 	bool field_0;
 	uint256[] field_1;
 }
 
+struct CollectionLimit {
+	CollectionLimitField field;
+	bool status;
+	uint256 value;
+}
+
 /// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
-enum CollectionLimits {
+enum CollectionLimitField {
 	/// @dev How many tokens can a user have on one account.
 	AccountTokenOwnership,
 	/// @dev How many bytes of data are available for sponsorship.
@@ -654,13 +633,6 @@
 	OwnerCanDestroy,
 	/// @dev Is it possible to send tokens from this collection between users.
 	TransferEnabled
-}
-
-/// @dev anonymous struct
-struct Tuple35 {
-	CollectionLimits field_0;
-	bool field_1;
-	uint256 field_2;
 }
 
 /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -146,13 +146,13 @@
 /// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.
 struct PropertyPermission {
 	/// @dev TokenPermission field.
-	EthTokenPermissions code;
+	TokenPermissionField code;
 	/// @dev TokenPermission value.
 	bool value;
 }
 
 /// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.
-enum EthTokenPermissions {
+enum TokenPermissionField {
 	/// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]
 	Mutable,
 	/// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]
@@ -162,7 +162,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x81172a75
+/// @dev the ERC-165 identifier for this interface is 0x23201442
 contract Collection is Dummy, ERC165 {
 	// /// Set collection property.
 	// ///
@@ -304,50 +304,23 @@
 
 	/// Get current collection limits.
 	///
-	/// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// Return `false` if a limit not set.
+	/// @return Array of collection limits
 	/// @dev EVM selector for this function is: 0xf63bc572,
 	///  or in textual repr: collectionLimits()
-	function collectionLimits() public view returns (Tuple34[] memory) {
+	function collectionLimits() public view returns (CollectionLimit[] memory) {
 		require(false, stub_error);
 		dummy;
-		return new Tuple34[](0);
+		return new CollectionLimit[](0);
 	}
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
-	/// @param limit Name of the limit. Valid names:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// @param status enable\disable limit. Works only with `true`.
-	/// @param value Value of the limit.
-	/// @dev EVM selector for this function is: 0x88150bd0,
-	///  or in textual repr: setCollectionLimit(uint8,bool,uint256)
-	function setCollectionLimit(
-		CollectionLimits limit,
-		bool status,
-		uint256 value
-	) public {
+	/// @param limit Some limit.
+	/// @dev EVM selector for this function is: 0x2a2235e7,
+	///  or in textual repr: setCollectionLimit((uint8,bool,uint256))
+	function setCollectionLimit(CollectionLimit memory limit) public {
 		require(false, stub_error);
 		limit;
-		status;
-		value;
 		dummy = 0;
 	}
 
@@ -428,19 +401,19 @@
 	/// Returns nesting for a collection
 	/// @dev EVM selector for this function is: 0x22d25bfe,
 	///  or in textual repr: collectionNestingRestrictedCollectionIds()
-	function collectionNestingRestrictedCollectionIds() public view returns (Tuple40 memory) {
+	function collectionNestingRestrictedCollectionIds() public view returns (Tuple41 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple40(false, new uint256[](0));
+		return Tuple41(false, new uint256[](0));
 	}
 
 	/// Returns permissions for a collection
 	/// @dev EVM selector for this function is: 0x5b2eaf4b,
 	///  or in textual repr: collectionNestingPermissions()
-	function collectionNestingPermissions() public view returns (Tuple43[] memory) {
+	function collectionNestingPermissions() public view returns (Tuple44[] memory) {
 		require(false, stub_error);
 		dummy;
-		return new Tuple43[](0);
+		return new Tuple44[](0);
 	}
 
 	/// Set the collection access method.
@@ -623,19 +596,25 @@
 }
 
 /// @dev anonymous struct
-struct Tuple43 {
+struct Tuple44 {
 	CollectionPermissions field_0;
 	bool field_1;
 }
 
 /// @dev anonymous struct
-struct Tuple40 {
+struct Tuple41 {
 	bool field_0;
 	uint256[] field_1;
 }
 
+struct CollectionLimit {
+	CollectionLimitField field;
+	bool status;
+	uint256 value;
+}
+
 /// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
-enum CollectionLimits {
+enum CollectionLimitField {
 	/// @dev How many tokens can a user have on one account.
 	AccountTokenOwnership,
 	/// @dev How many bytes of data are available for sponsorship.
@@ -654,13 +633,6 @@
 	OwnerCanDestroy,
 	/// @dev Is it possible to send tokens from this collection between users.
 	TransferEnabled
-}
-
-/// @dev anonymous struct
-struct Tuple34 {
-	CollectionLimits field_0;
-	bool field_1;
-	uint256 field_2;
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f
modifiedtests/src/eth/abi/fungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/fungible.json
+++ b/tests/src/eth/abi/fungible.json
@@ -213,14 +213,14 @@
       {
         "components": [
           {
-            "internalType": "enum CollectionLimits",
-            "name": "field_0",
+            "internalType": "enum CollectionLimitField",
+            "name": "field",
             "type": "uint8"
           },
-          { "internalType": "bool", "name": "field_1", "type": "bool" },
-          { "internalType": "uint256", "name": "field_2", "type": "uint256" }
+          { "internalType": "bool", "name": "status", "type": "bool" },
+          { "internalType": "uint256", "name": "value", "type": "uint256" }
         ],
-        "internalType": "struct Tuple23[]",
+        "internalType": "struct CollectionLimit[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -241,7 +241,7 @@
           },
           { "internalType": "bool", "name": "field_1", "type": "bool" }
         ],
-        "internalType": "struct Tuple32[]",
+        "internalType": "struct Tuple33[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -262,7 +262,7 @@
             "type": "uint256[]"
           }
         ],
-        "internalType": "struct Tuple29",
+        "internalType": "struct Tuple30",
         "name": "",
         "type": "tuple"
       }
@@ -494,12 +494,19 @@
   {
     "inputs": [
       {
-        "internalType": "enum CollectionLimits",
+        "components": [
+          {
+            "internalType": "enum CollectionLimitField",
+            "name": "field",
+            "type": "uint8"
+          },
+          { "internalType": "bool", "name": "status", "type": "bool" },
+          { "internalType": "uint256", "name": "value", "type": "uint256" }
+        ],
+        "internalType": "struct CollectionLimit",
         "name": "limit",
-        "type": "uint8"
-      },
-      { "internalType": "bool", "name": "status", "type": "bool" },
-      { "internalType": "uint256", "name": "value", "type": "uint256" }
+        "type": "tuple"
+      }
     ],
     "name": "setCollectionLimit",
     "outputs": [],
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -243,14 +243,14 @@
       {
         "components": [
           {
-            "internalType": "enum CollectionLimits",
-            "name": "field_0",
+            "internalType": "enum CollectionLimitField",
+            "name": "field",
             "type": "uint8"
           },
-          { "internalType": "bool", "name": "field_1", "type": "bool" },
-          { "internalType": "uint256", "name": "field_2", "type": "uint256" }
+          { "internalType": "bool", "name": "status", "type": "bool" },
+          { "internalType": "uint256", "name": "value", "type": "uint256" }
         ],
-        "internalType": "struct Tuple35[]",
+        "internalType": "struct CollectionLimit[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -271,7 +271,7 @@
           },
           { "internalType": "bool", "name": "field_1", "type": "bool" }
         ],
-        "internalType": "struct Tuple44[]",
+        "internalType": "struct Tuple45[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -292,7 +292,7 @@
             "type": "uint256[]"
           }
         ],
-        "internalType": "struct Tuple41",
+        "internalType": "struct Tuple42",
         "name": "",
         "type": "tuple"
       }
@@ -656,12 +656,19 @@
   {
     "inputs": [
       {
-        "internalType": "enum CollectionLimits",
+        "components": [
+          {
+            "internalType": "enum CollectionLimitField",
+            "name": "field",
+            "type": "uint8"
+          },
+          { "internalType": "bool", "name": "status", "type": "bool" },
+          { "internalType": "uint256", "name": "value", "type": "uint256" }
+        ],
+        "internalType": "struct CollectionLimit",
         "name": "limit",
-        "type": "uint8"
-      },
-      { "internalType": "bool", "name": "status", "type": "bool" },
-      { "internalType": "uint256", "name": "value", "type": "uint256" }
+        "type": "tuple"
+      }
     ],
     "name": "setCollectionLimit",
     "outputs": [],
@@ -756,7 +763,7 @@
           {
             "components": [
               {
-                "internalType": "enum EthTokenPermissions",
+                "internalType": "enum TokenPermissionField",
                 "name": "code",
                 "type": "uint8"
               },
@@ -822,7 +829,7 @@
           {
             "components": [
               {
-                "internalType": "enum EthTokenPermissions",
+                "internalType": "enum TokenPermissionField",
                 "name": "code",
                 "type": "uint8"
               },
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/reFungible.json
+++ b/tests/src/eth/abi/reFungible.json
@@ -225,14 +225,14 @@
       {
         "components": [
           {
-            "internalType": "enum CollectionLimits",
-            "name": "field_0",
+            "internalType": "enum CollectionLimitField",
+            "name": "field",
             "type": "uint8"
           },
-          { "internalType": "bool", "name": "field_1", "type": "bool" },
-          { "internalType": "uint256", "name": "field_2", "type": "uint256" }
+          { "internalType": "bool", "name": "status", "type": "bool" },
+          { "internalType": "uint256", "name": "value", "type": "uint256" }
         ],
-        "internalType": "struct Tuple34[]",
+        "internalType": "struct CollectionLimit[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -253,7 +253,7 @@
           },
           { "internalType": "bool", "name": "field_1", "type": "bool" }
         ],
-        "internalType": "struct Tuple43[]",
+        "internalType": "struct Tuple44[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -274,7 +274,7 @@
             "type": "uint256[]"
           }
         ],
-        "internalType": "struct Tuple40",
+        "internalType": "struct Tuple41",
         "name": "",
         "type": "tuple"
       }
@@ -638,12 +638,19 @@
   {
     "inputs": [
       {
-        "internalType": "enum CollectionLimits",
+        "components": [
+          {
+            "internalType": "enum CollectionLimitField",
+            "name": "field",
+            "type": "uint8"
+          },
+          { "internalType": "bool", "name": "status", "type": "bool" },
+          { "internalType": "uint256", "name": "value", "type": "uint256" }
+        ],
+        "internalType": "struct CollectionLimit",
         "name": "limit",
-        "type": "uint8"
-      },
-      { "internalType": "bool", "name": "status", "type": "bool" },
-      { "internalType": "uint256", "name": "value", "type": "uint256" }
+        "type": "tuple"
+      }
     ],
     "name": "setCollectionLimit",
     "outputs": [],
@@ -738,7 +745,7 @@
           {
             "components": [
               {
-                "internalType": "enum EthTokenPermissions",
+                "internalType": "enum TokenPermissionField",
                 "name": "code",
                 "type": "uint8"
               },
@@ -813,7 +820,7 @@
           {
             "components": [
               {
-                "internalType": "enum EthTokenPermissions",
+                "internalType": "enum TokenPermissionField",
                 "name": "code",
                 "type": "uint8"
               },
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -13,7 +13,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x81172a75
+/// @dev the ERC-165 identifier for this interface is 0x23201442
 interface Collection is Dummy, ERC165 {
 	// /// Set collection property.
 	// ///
@@ -106,42 +106,17 @@
 
 	/// Get current collection limits.
 	///
-	/// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// Return `false` if a limit not set.
+	/// @return Array of collection limits
 	/// @dev EVM selector for this function is: 0xf63bc572,
 	///  or in textual repr: collectionLimits()
-	function collectionLimits() external view returns (Tuple21[] memory);
+	function collectionLimits() external view returns (CollectionLimit[] memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
-	/// @param limit Name of the limit. Valid names:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// @param status enable\disable limit. Works only with `true`.
-	/// @param value Value of the limit.
-	/// @dev EVM selector for this function is: 0x88150bd0,
-	///  or in textual repr: setCollectionLimit(uint8,bool,uint256)
-	function setCollectionLimit(
-		CollectionLimits limit,
-		bool status,
-		uint256 value
-	) external;
+	/// @param limit Some limit.
+	/// @dev EVM selector for this function is: 0x2a2235e7,
+	///  or in textual repr: setCollectionLimit((uint8,bool,uint256))
+	function setCollectionLimit(CollectionLimit memory limit) external;
 
 	/// Get contract address.
 	/// @dev EVM selector for this function is: 0xf6b4dfb4,
@@ -330,8 +305,14 @@
 	uint256[] field_1;
 }
 
+struct CollectionLimit {
+	CollectionLimitField field;
+	bool status;
+	uint256 value;
+}
+
 /// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
-enum CollectionLimits {
+enum CollectionLimitField {
 	/// @dev How many tokens can a user have on one account.
 	AccountTokenOwnership,
 	/// @dev How many bytes of data are available for sponsorship.
@@ -350,13 +331,6 @@
 	OwnerCanDestroy,
 	/// @dev Is it possible to send tokens from this collection between users.
 	TransferEnabled
-}
-
-/// @dev anonymous struct
-struct Tuple21 {
-	CollectionLimits field_0;
-	bool field_1;
-	uint256 field_2;
 }
 
 /// @dev Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -99,13 +99,13 @@
 /// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.
 struct PropertyPermission {
 	/// @dev TokenPermission field.
-	EthTokenPermissions code;
+	TokenPermissionField code;
 	/// @dev TokenPermission value.
 	bool value;
 }
 
 /// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.
-enum EthTokenPermissions {
+enum TokenPermissionField {
 	/// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]
 	Mutable,
 	/// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]
@@ -115,7 +115,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x81172a75
+/// @dev the ERC-165 identifier for this interface is 0x23201442
 interface Collection is Dummy, ERC165 {
 	// /// Set collection property.
 	// ///
@@ -208,42 +208,17 @@
 
 	/// Get current collection limits.
 	///
-	/// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// Return `false` if a limit not set.
+	/// @return Array of collection limits
 	/// @dev EVM selector for this function is: 0xf63bc572,
 	///  or in textual repr: collectionLimits()
-	function collectionLimits() external view returns (Tuple31[] memory);
+	function collectionLimits() external view returns (CollectionLimit[] memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
-	/// @param limit Name of the limit. Valid names:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// @param status enable\disable limit. Works only with `true`.
-	/// @param value Value of the limit.
-	/// @dev EVM selector for this function is: 0x88150bd0,
-	///  or in textual repr: setCollectionLimit(uint8,bool,uint256)
-	function setCollectionLimit(
-		CollectionLimits limit,
-		bool status,
-		uint256 value
-	) external;
+	/// @param limit Some limit.
+	/// @dev EVM selector for this function is: 0x2a2235e7,
+	///  or in textual repr: setCollectionLimit((uint8,bool,uint256))
+	function setCollectionLimit(CollectionLimit memory limit) external;
 
 	/// Get contract address.
 	/// @dev EVM selector for this function is: 0xf6b4dfb4,
@@ -432,8 +407,14 @@
 	uint256[] field_1;
 }
 
+struct CollectionLimit {
+	CollectionLimitField field;
+	bool status;
+	uint256 value;
+}
+
 /// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
-enum CollectionLimits {
+enum CollectionLimitField {
 	/// @dev How many tokens can a user have on one account.
 	AccountTokenOwnership,
 	/// @dev How many bytes of data are available for sponsorship.
@@ -452,13 +433,6 @@
 	OwnerCanDestroy,
 	/// @dev Is it possible to send tokens from this collection between users.
 	TransferEnabled
-}
-
-/// @dev anonymous struct
-struct Tuple31 {
-	CollectionLimits field_0;
-	bool field_1;
-	uint256 field_2;
 }
 
 /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -99,13 +99,13 @@
 /// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.
 struct PropertyPermission {
 	/// @dev TokenPermission field.
-	EthTokenPermissions code;
+	TokenPermissionField code;
 	/// @dev TokenPermission value.
 	bool value;
 }
 
 /// @dev Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.
-enum EthTokenPermissions {
+enum TokenPermissionField {
 	/// @dev Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]
 	Mutable,
 	/// @dev Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]
@@ -115,7 +115,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x81172a75
+/// @dev the ERC-165 identifier for this interface is 0x23201442
 interface Collection is Dummy, ERC165 {
 	// /// Set collection property.
 	// ///
@@ -208,42 +208,17 @@
 
 	/// Get current collection limits.
 	///
-	/// @return Array of tuples (byte, bool, uint256) with limits and their values. Order of limits:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// Return `false` if a limit not set.
+	/// @return Array of collection limits
 	/// @dev EVM selector for this function is: 0xf63bc572,
 	///  or in textual repr: collectionLimits()
-	function collectionLimits() external view returns (Tuple30[] memory);
+	function collectionLimits() external view returns (CollectionLimit[] memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
-	/// @param limit Name of the limit. Valid names:
-	/// 	"accountTokenOwnershipLimit",
-	/// 	"sponsoredDataSize",
-	/// 	"sponsoredDataRateLimit",
-	/// 	"tokenLimit",
-	/// 	"sponsorTransferTimeout",
-	/// 	"sponsorApproveTimeout"
-	///  	"ownerCanTransfer",
-	/// 	"ownerCanDestroy",
-	/// 	"transfersEnabled"
-	/// @param status enable\disable limit. Works only with `true`.
-	/// @param value Value of the limit.
-	/// @dev EVM selector for this function is: 0x88150bd0,
-	///  or in textual repr: setCollectionLimit(uint8,bool,uint256)
-	function setCollectionLimit(
-		CollectionLimits limit,
-		bool status,
-		uint256 value
-	) external;
+	/// @param limit Some limit.
+	/// @dev EVM selector for this function is: 0x2a2235e7,
+	///  or in textual repr: setCollectionLimit((uint8,bool,uint256))
+	function setCollectionLimit(CollectionLimit memory limit) external;
 
 	/// Get contract address.
 	/// @dev EVM selector for this function is: 0xf6b4dfb4,
@@ -432,8 +407,14 @@
 	uint256[] field_1;
 }
 
+struct CollectionLimit {
+	CollectionLimitField field;
+	bool status;
+	uint256 value;
+}
+
 /// @dev [`CollectionLimits`](up_data_structs::CollectionLimits) representation for EVM.
-enum CollectionLimits {
+enum CollectionLimitField {
 	/// @dev How many tokens can a user have on one account.
 	AccountTokenOwnership,
 	/// @dev How many bytes of data are available for sponsorship.
@@ -452,13 +433,6 @@
 	OwnerCanDestroy,
 	/// @dev Is it possible to send tokens from this collection between users.
 	TransferEnabled
-}
-
-/// @dev anonymous struct
-struct Tuple30 {
-	CollectionLimits field_0;
-	bool field_1;
-	uint256 field_2;
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f
modifiedtests/src/eth/collectionLimits.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionLimits.test.ts
+++ b/tests/src/eth/collectionLimits.test.ts
@@ -1,7 +1,7 @@
 import {IKeyringPair} from '@polkadot/types/types';
 import {Pallets} from '../util';
 import {expect, itEth, usingEthPlaygrounds} from './util';
-import {CollectionLimits} from './util/playgrounds/types';
+import {CollectionLimitField} from './util/playgrounds/types';
 
 
 describe('Can set collection limits', () => {
@@ -46,15 +46,15 @@
       };
      
       const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, limits.accountTokenOwnershipLimit).send();
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsoredDataSize, true, limits.sponsoredDataSize).send();
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsoredDataRateLimit, true, limits.sponsoredDataRateLimit).send();
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.TokenLimit, true, limits.tokenLimit).send();
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsorTransferTimeout, true, limits.sponsorTransferTimeout).send();
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.SponsorApproveTimeout, true, limits.sponsorApproveTimeout).send();
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.OwnerCanTransfer, true, limits.ownerCanTransfer).send();
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.OwnerCanDestroy, true, limits.ownerCanDestroy).send();
-      await collectionEvm.methods.setCollectionLimit(CollectionLimits.TransferEnabled, true, limits.transfersEnabled).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: limits.accountTokenOwnershipLimit}).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.SponsoredDataSize, status: true, value: limits.sponsoredDataSize}).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.SponsoredDataRateLimit, status: true, value: limits.sponsoredDataRateLimit}).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.TokenLimit, status: true, value: limits.tokenLimit}).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.SponsorTransferTimeout, status: true, value: limits.sponsorTransferTimeout}).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.SponsorApproveTimeout, status: true, value: limits.sponsorApproveTimeout}).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.OwnerCanTransfer, status: true, value: limits.ownerCanTransfer}).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.OwnerCanDestroy, status: true, value: limits.ownerCanDestroy}).send();
+      await collectionEvm.methods.setCollectionLimit({field: CollectionLimitField.TransferEnabled, status: true, value: limits.transfersEnabled}).send();
       
       // Check limits from sub:
       const data = (await helper.rft.getData(collectionId))!;
@@ -63,15 +63,15 @@
       // Check limits from eth:
       const limitsEvm = await collectionEvm.methods.collectionLimits().call({from: owner});
       expect(limitsEvm).to.have.length(9);
-      expect(limitsEvm[0]).to.deep.eq([CollectionLimits.AccountTokenOwnership.toString(), true, limits.accountTokenOwnershipLimit.toString()]);
-      expect(limitsEvm[1]).to.deep.eq([CollectionLimits.SponsoredDataSize.toString(), true, limits.sponsoredDataSize.toString()]);
-      expect(limitsEvm[2]).to.deep.eq([CollectionLimits.SponsoredDataRateLimit.toString(), true, limits.sponsoredDataRateLimit.toString()]);
-      expect(limitsEvm[3]).to.deep.eq([CollectionLimits.TokenLimit.toString(), true, limits.tokenLimit.toString()]);
-      expect(limitsEvm[4]).to.deep.eq([CollectionLimits.SponsorTransferTimeout.toString(), true, limits.sponsorTransferTimeout.toString()]);
-      expect(limitsEvm[5]).to.deep.eq([CollectionLimits.SponsorApproveTimeout.toString(), true, limits.sponsorApproveTimeout.toString()]);
-      expect(limitsEvm[6]).to.deep.eq([CollectionLimits.OwnerCanTransfer.toString(), true, limits.ownerCanTransfer.toString()]);
-      expect(limitsEvm[7]).to.deep.eq([CollectionLimits.OwnerCanDestroy.toString(), true, limits.ownerCanDestroy.toString()]);
-      expect(limitsEvm[8]).to.deep.eq([CollectionLimits.TransferEnabled.toString(), true, limits.transfersEnabled.toString()]);
+      expect(limitsEvm[0]).to.deep.eq([CollectionLimitField.AccountTokenOwnership.toString(), true, limits.accountTokenOwnershipLimit.toString()]);
+      expect(limitsEvm[1]).to.deep.eq([CollectionLimitField.SponsoredDataSize.toString(), true, limits.sponsoredDataSize.toString()]);
+      expect(limitsEvm[2]).to.deep.eq([CollectionLimitField.SponsoredDataRateLimit.toString(), true, limits.sponsoredDataRateLimit.toString()]);
+      expect(limitsEvm[3]).to.deep.eq([CollectionLimitField.TokenLimit.toString(), true, limits.tokenLimit.toString()]);
+      expect(limitsEvm[4]).to.deep.eq([CollectionLimitField.SponsorTransferTimeout.toString(), true, limits.sponsorTransferTimeout.toString()]);
+      expect(limitsEvm[5]).to.deep.eq([CollectionLimitField.SponsorApproveTimeout.toString(), true, limits.sponsorApproveTimeout.toString()]);
+      expect(limitsEvm[6]).to.deep.eq([CollectionLimitField.OwnerCanTransfer.toString(), true, limits.ownerCanTransfer.toString()]);
+      expect(limitsEvm[7]).to.deep.eq([CollectionLimitField.OwnerCanDestroy.toString(), true, limits.ownerCanDestroy.toString()]);
+      expect(limitsEvm[8]).to.deep.eq([CollectionLimitField.TransferEnabled.toString(), true, limits.transfersEnabled.toString()]);
     }));
 });
 
@@ -101,24 +101,24 @@
 
       // Cannot set non-existing limit
       await expect(collectionEvm.methods
-        .setCollectionLimit(9, true, 1)
-        .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert Value not convertible into enum "CollectionLimits"');      
+        .setCollectionLimit({field: 9, status: true, value: 1})
+        .call()).to.be.rejectedWith('Value not convertible into enum "CollectionLimitField"');      
         
       // Cannot disable limits
       await expect(collectionEvm.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, false, 200)
-        .call()).to.be.rejectedWith('Returned error: VM Exception while processing transaction: revert user can\'t disable limits');
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: false, value: 200})
+        .call()).to.be.rejectedWith('user can\'t disable limits');
 
       await expect(collectionEvm.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, invalidLimits.accountTokenOwnershipLimit)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: invalidLimits.accountTokenOwnershipLimit})
         .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);
  
       await expect(collectionEvm.methods
-        .setCollectionLimit(CollectionLimits.TransferEnabled, true, 3)
+        .setCollectionLimit({field: CollectionLimitField.TransferEnabled, status: true, value: 3})
         .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);
 
       expect(() => collectionEvm.methods
-        .setCollectionLimit(CollectionLimits.SponsoredDataSize, true, -1).send()).to.throw('value out-of-bounds');
+        .setCollectionLimit({field: CollectionLimitField.SponsoredDataSize, status: true, value: -1}).send()).to.throw('value out-of-bounds');
     }));
 
   [
@@ -133,12 +133,12 @@
 
       const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
       await expect(collectionEvm.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: 1000})
         .call({from: nonOwner}))
         .to.be.rejectedWith('NoPermission');
 
       await expect(collectionEvm.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: 1000})
         .send({from: nonOwner}))
         .to.be.rejected;
     }));
modifiedtests/src/eth/createFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -18,7 +18,7 @@
 import {evmToAddress} from '@polkadot/util-crypto';
 import {Pallets, requirePalletsOrSkip} from '../util';
 import {expect, itEth, usingEthPlaygrounds} from './util';
-import { CollectionLimits } from './util/playgrounds/types';
+import {CollectionLimitField} from './util/playgrounds/types';
 
 const DECIMALS = 18;
 
@@ -197,7 +197,7 @@
     }
     {
       await expect(peasantCollection.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: 1000})
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
   });
@@ -222,7 +222,7 @@
     }
     {
       await expect(peasantCollection.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: 1000})
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
   });    
modifiedtests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -17,7 +17,7 @@
 import {evmToAddress} from '@polkadot/util-crypto';
 import {IKeyringPair} from '@polkadot/types/types';
 import {expect, itEth, usingEthPlaygrounds} from './util';
-import { CollectionLimits } from './util/playgrounds/types';
+import {CollectionLimitField} from './util/playgrounds/types';
 
 
 describe('Create NFT collection from EVM', () => {
@@ -208,7 +208,7 @@
     }
     {
       await expect(malfeasantCollection.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: 1000})
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
   });
@@ -233,7 +233,7 @@
     }
     {
       await expect(malfeasantCollection.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: 1000})
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
   });
modifiedtests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -18,7 +18,7 @@
 import {IKeyringPair} from '@polkadot/types/types';
 import {Pallets, requirePalletsOrSkip} from '../util';
 import {expect, itEth, usingEthPlaygrounds} from './util';
-import {CollectionLimits} from './util/playgrounds/types';
+import {CollectionLimitField} from './util/playgrounds/types';
 
 
 describe('Create RFT collection from EVM', () => {
@@ -240,7 +240,7 @@
     }
     {
       await expect(peasantCollection.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: 1000})
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
   });
@@ -265,7 +265,7 @@
     }
     {
       await expect(peasantCollection.methods
-        .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)
+        .setCollectionLimit({field: CollectionLimitField.AccountTokenOwnership, status: true, value: 1000})
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
     }
   });
modifiedtests/src/eth/events.test.tsdiffbeforeafterboth
--- a/tests/src/eth/events.test.ts
+++ b/tests/src/eth/events.test.ts
@@ -19,7 +19,7 @@
 import {EthUniqueHelper, itEth, usingEthPlaygrounds} from './util';
 import {IEvent, TCollectionMode} from '../util/playgrounds/types';
 import {Pallets, requirePalletsOrSkip} from '../util';
-import {CollectionLimits, EthTokenPermissions, NormalizedEvent} from './util/playgrounds/types';
+import {CollectionLimitField, TokenPermissionField, NormalizedEvent} from './util/playgrounds/types';
 
 let donor: IKeyringPair;
   
@@ -121,9 +121,9 @@
   const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['PropertyPermissionSet']}]);
   await collection.methods.setTokenPropertyPermissions([
     ['A', [
-      [EthTokenPermissions.Mutable, true], 
-      [EthTokenPermissions.TokenOwner, true], 
-      [EthTokenPermissions.CollectionAdmin, true]],
+      [TokenPermissionField.Mutable, true], 
+      [TokenPermissionField.TokenOwner, true], 
+      [TokenPermissionField.CollectionAdmin, true]],
     ],
   ]).send({from: owner});
   await helper.wait.newBlocks(1);
@@ -233,7 +233,7 @@
   });
   const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionLimitSet']}]);
   {
-    await collection.methods.setCollectionLimit(CollectionLimits.OwnerCanTransfer, true, 0).send({from: owner});
+    await collection.methods.setCollectionLimit({field: CollectionLimitField.OwnerCanTransfer, status: true, value: 0}).send({from: owner});
     await helper.wait.newBlocks(1);
     expect(ethEvents).to.containSubset([
       {
@@ -379,9 +379,9 @@
   const tokenId = result.events.Transfer.returnValues.tokenId;
   await collection.methods.setTokenPropertyPermissions([
     ['A', [
-      [EthTokenPermissions.Mutable, true], 
-      [EthTokenPermissions.TokenOwner, true], 
-      [EthTokenPermissions.CollectionAdmin, true]],
+      [TokenPermissionField.Mutable, true], 
+      [TokenPermissionField.TokenOwner, true], 
+      [TokenPermissionField.CollectionAdmin, true]],
     ],
   ]).send({from: owner});
 
modifiedtests/src/eth/tokenProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -20,7 +20,7 @@
 import {ITokenPropertyPermission} from '../util/playgrounds/types';
 import {Pallets} from '../util';
 import {UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection} from '../util/playgrounds/unique';
-import {EthTokenPermissions} from './util/playgrounds/types';
+import {TokenPermissionField} from './util/playgrounds/types';
 
 describe('EVM token properties', () => {
   let donor: IKeyringPair;
@@ -47,9 +47,9 @@
 
         await collection.methods.setTokenPropertyPermissions([
           ['testKey', [
-            [EthTokenPermissions.Mutable, mutable], 
-            [EthTokenPermissions.TokenOwner, tokenOwner], 
-            [EthTokenPermissions.CollectionAdmin, collectionAdmin]],
+            [TokenPermissionField.Mutable, mutable], 
+            [TokenPermissionField.TokenOwner, tokenOwner], 
+            [TokenPermissionField.CollectionAdmin, collectionAdmin]],
           ],
         ]).send({from: caller.eth});
       
@@ -60,9 +60,9 @@
 
         expect(await collection.methods.tokenPropertyPermissions().call({from: caller.eth})).to.be.like([
           ['testKey', [
-            [EthTokenPermissions.Mutable.toString(), mutable], 
-            [EthTokenPermissions.TokenOwner.toString(), tokenOwner], 
-            [EthTokenPermissions.CollectionAdmin.toString(), collectionAdmin]],
+            [TokenPermissionField.Mutable.toString(), mutable], 
+            [TokenPermissionField.TokenOwner.toString(), tokenOwner], 
+            [TokenPermissionField.CollectionAdmin.toString(), collectionAdmin]],
           ],
         ]);
       }
@@ -80,19 +80,19 @@
 
       await collection.methods.setTokenPropertyPermissions([
         ['testKey_0', [
-          [EthTokenPermissions.Mutable, true], 
-          [EthTokenPermissions.TokenOwner, true], 
-          [EthTokenPermissions.CollectionAdmin, true]],
+          [TokenPermissionField.Mutable, true], 
+          [TokenPermissionField.TokenOwner, true], 
+          [TokenPermissionField.CollectionAdmin, true]],
         ],
         ['testKey_1', [
-          [EthTokenPermissions.Mutable, true], 
-          [EthTokenPermissions.TokenOwner, false], 
-          [EthTokenPermissions.CollectionAdmin, true]],
+          [TokenPermissionField.Mutable, true], 
+          [TokenPermissionField.TokenOwner, false], 
+          [TokenPermissionField.CollectionAdmin, true]],
         ],
         ['testKey_2', [
-          [EthTokenPermissions.Mutable, false], 
-          [EthTokenPermissions.TokenOwner, true], 
-          [EthTokenPermissions.CollectionAdmin, false]],
+          [TokenPermissionField.Mutable, false], 
+          [TokenPermissionField.TokenOwner, true], 
+          [TokenPermissionField.CollectionAdmin, false]],
         ],
       ]).send({from: owner});
       
@@ -113,19 +113,19 @@
 
       expect(await collection.methods.tokenPropertyPermissions().call({from: owner})).to.be.like([
         ['testKey_0', [
-          [EthTokenPermissions.Mutable.toString(), true], 
-          [EthTokenPermissions.TokenOwner.toString(), true], 
-          [EthTokenPermissions.CollectionAdmin.toString(), true]],
+          [TokenPermissionField.Mutable.toString(), true], 
+          [TokenPermissionField.TokenOwner.toString(), true], 
+          [TokenPermissionField.CollectionAdmin.toString(), true]],
         ],
         ['testKey_1', [
-          [EthTokenPermissions.Mutable.toString(), true], 
-          [EthTokenPermissions.TokenOwner.toString(), false], 
-          [EthTokenPermissions.CollectionAdmin.toString(), true]],
+          [TokenPermissionField.Mutable.toString(), true], 
+          [TokenPermissionField.TokenOwner.toString(), false], 
+          [TokenPermissionField.CollectionAdmin.toString(), true]],
         ],
         ['testKey_2', [
-          [EthTokenPermissions.Mutable.toString(), false], 
-          [EthTokenPermissions.TokenOwner.toString(), true], 
-          [EthTokenPermissions.CollectionAdmin.toString(), false]],
+          [TokenPermissionField.Mutable.toString(), false], 
+          [TokenPermissionField.TokenOwner.toString(), true], 
+          [TokenPermissionField.CollectionAdmin.toString(), false]],
         ],
       ]);
     }));
@@ -144,19 +144,19 @@
 
       await collection.methods.setTokenPropertyPermissions([
         ['testKey_0', [
-          [EthTokenPermissions.Mutable, true], 
-          [EthTokenPermissions.TokenOwner, true], 
-          [EthTokenPermissions.CollectionAdmin, true]],
+          [TokenPermissionField.Mutable, true], 
+          [TokenPermissionField.TokenOwner, true], 
+          [TokenPermissionField.CollectionAdmin, true]],
         ],
         ['testKey_1', [
-          [EthTokenPermissions.Mutable, true], 
-          [EthTokenPermissions.TokenOwner, false], 
-          [EthTokenPermissions.CollectionAdmin, true]],
+          [TokenPermissionField.Mutable, true], 
+          [TokenPermissionField.TokenOwner, false], 
+          [TokenPermissionField.CollectionAdmin, true]],
         ],
         ['testKey_2', [
-          [EthTokenPermissions.Mutable, false], 
-          [EthTokenPermissions.TokenOwner, true], 
-          [EthTokenPermissions.CollectionAdmin, false]],
+          [TokenPermissionField.Mutable, false], 
+          [TokenPermissionField.TokenOwner, true], 
+          [TokenPermissionField.CollectionAdmin, false]],
         ],
       ]).send({from: caller.eth});
       
@@ -177,19 +177,19 @@
 
       expect(await collection.methods.tokenPropertyPermissions().call({from: caller.eth})).to.be.like([
         ['testKey_0', [
-          [EthTokenPermissions.Mutable.toString(), true], 
-          [EthTokenPermissions.TokenOwner.toString(), true], 
-          [EthTokenPermissions.CollectionAdmin.toString(), true]],
+          [TokenPermissionField.Mutable.toString(), true], 
+          [TokenPermissionField.TokenOwner.toString(), true], 
+          [TokenPermissionField.CollectionAdmin.toString(), true]],
         ],
         ['testKey_1', [
-          [EthTokenPermissions.Mutable.toString(), true], 
-          [EthTokenPermissions.TokenOwner.toString(), false], 
-          [EthTokenPermissions.CollectionAdmin.toString(), true]],
+          [TokenPermissionField.Mutable.toString(), true], 
+          [TokenPermissionField.TokenOwner.toString(), false], 
+          [TokenPermissionField.CollectionAdmin.toString(), true]],
         ],
         ['testKey_2', [
-          [EthTokenPermissions.Mutable.toString(), false], 
-          [EthTokenPermissions.TokenOwner.toString(), true], 
-          [EthTokenPermissions.CollectionAdmin.toString(), false]],
+          [TokenPermissionField.Mutable.toString(), false], 
+          [TokenPermissionField.TokenOwner.toString(), true], 
+          [TokenPermissionField.CollectionAdmin.toString(), false]],
         ],
       ]);
       
@@ -460,9 +460,9 @@
   
       await expect(collection.methods.setTokenPropertyPermissions([
         ['testKey_0', [
-          [EthTokenPermissions.Mutable, true], 
-          [EthTokenPermissions.TokenOwner, true], 
-          [EthTokenPermissions.CollectionAdmin, true]],
+          [TokenPermissionField.Mutable, true], 
+          [TokenPermissionField.TokenOwner, true], 
+          [TokenPermissionField.CollectionAdmin, true]],
         ],
       ]).call({from: caller})).to.be.rejectedWith('NoPermission');  
     }));
@@ -480,9 +480,9 @@
       await expect(collection.methods.setTokenPropertyPermissions([
         // "Space" is invalid character
         ['testKey 0', [
-          [EthTokenPermissions.Mutable, true], 
-          [EthTokenPermissions.TokenOwner, true], 
-          [EthTokenPermissions.CollectionAdmin, true]],
+          [TokenPermissionField.Mutable, true], 
+          [TokenPermissionField.TokenOwner, true], 
+          [TokenPermissionField.CollectionAdmin, true]],
         ],
       ]).call({from: owner})).to.be.rejectedWith('InvalidCharacterInPropertyKey');  
     }));
modifiedtests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -20,12 +20,12 @@
 
 export type EthProperty = string[];
 
-export enum EthTokenPermissions {
+export enum TokenPermissionField {
   Mutable,
   TokenOwner,
   CollectionAdmin
 }
-export enum CollectionLimits {
+export enum CollectionLimitField {
   AccountTokenOwnership,
 	SponsoredDataSize,
 	SponsoredDataRateLimit,
@@ -36,3 +36,9 @@
 	OwnerCanDestroy,
 	TransferEnabled
 }
+
+export interface EthCollectionLimit {
+  field: CollectionLimitField,
+  status: boolean,
+  value: bigint,
+}