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

difftreelog

fix PR

Trubnikov Sergey2022-12-22parent: #a22e53f.patch.diff
in: master

10 files changed

modifiedcrates/evm-coder/procedural/src/abi_derive/derive_enum.rsdiffbeforeafterboth
--- a/crates/evm-coder/procedural/src/abi_derive/derive_enum.rs
+++ b/crates/evm-coder/procedural/src/abi_derive/derive_enum.rs
@@ -47,11 +47,10 @@
 	)
 }
 
-pub fn impl_enum_abi_type(name: &syn::Ident, option_count: usize) -> proc_macro2::TokenStream {
+pub fn impl_enum_abi_type(name: &syn::Ident) -> proc_macro2::TokenStream {
 	quote! {
 		impl ::evm_coder::abi::AbiType for #name {
 			const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <u8 as ::evm_coder::abi::AbiType>::SIGNATURE;
-			const FIELDS_COUNT: usize = #option_count;
 
 			fn is_dynamic() -> bool {
 				<u8 as ::evm_coder::abi::AbiType>::is_dynamic()
modifiedcrates/evm-coder/procedural/src/abi_derive/derive_struct.rsdiffbeforeafterboth
--- a/crates/evm-coder/procedural/src/abi_derive/derive_struct.rs
+++ b/crates/evm-coder/procedural/src/abi_derive/derive_struct.rs
@@ -100,12 +100,10 @@
 pub fn impl_struct_abi_type(
 	name: &syn::Ident,
 	tuple_type: proc_macro2::TokenStream,
-	fields_count: usize,
 ) -> proc_macro2::TokenStream {
 	quote! {
 		impl ::evm_coder::abi::AbiType for #name {
 			const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <#tuple_type as ::evm_coder::abi::AbiType>::SIGNATURE;
-			const FIELDS_COUNT: usize = #fields_count;
 			fn is_dynamic() -> bool {
 				<#tuple_type as ::evm_coder::abi::AbiType>::is_dynamic()
 			}
modifiedcrates/evm-coder/procedural/src/abi_derive/mod.rsdiffbeforeafterboth
before · crates/evm-coder/procedural/src/abi_derive/mod.rs
1mod derive_enum;2mod derive_struct;34use quote::quote;5use derive_struct::*;6use derive_enum::*;78pub(crate) fn impl_abi_macro(ast: &syn::DeriveInput) -> syn::Result<proc_macro2::TokenStream> {9	let name = &ast.ident;10	match &ast.data {11		syn::Data::Struct(ds) => expand_struct(ds, ast),12		syn::Data::Enum(de) => expand_enum(de, ast),13		syn::Data::Union(_) => Err(syn::Error::new(name.span(), "Unions not supported")),14	}15}1617fn expand_struct(18	ds: &syn::DataStruct,19	ast: &syn::DeriveInput,20) -> syn::Result<proc_macro2::TokenStream> {21	let name = &ast.ident;22	let docs = extract_docs(&ast.attrs, false)?;23	let (is_named_fields, field_names, field_types, field_docs, params_count) = match ds.fields {24		syn::Fields::Named(ref fields) => Ok((25			true,26			fields.named.iter().enumerate().map(map_field_to_name),27			fields.named.iter().map(map_field_to_type),28			fields.named.iter().map(map_field_to_doc),29			fields.named.len(),30		)),31		syn::Fields::Unnamed(ref fields) => Ok((32			false,33			fields.unnamed.iter().enumerate().map(map_field_to_name),34			fields.unnamed.iter().map(map_field_to_type),35			fields.unnamed.iter().map(map_field_to_doc),36			fields.unnamed.len(),37		)),38		syn::Fields::Unit => Err(syn::Error::new(name.span(), "Unit structs not supported")),39	}?;4041	if params_count == 0 {42		return Err(syn::Error::new(name.span(), "Empty structs not supported"));43	};4445	let tuple_type = tuple_type(field_types.clone());46	let tuple_ref_type = tuple_ref_type(field_types.clone());47	let tuple_data = tuple_data_as_ref(is_named_fields, field_names.clone());48	let tuple_names = tuple_names(is_named_fields, field_names.clone());49	let struct_from_tuple = struct_from_tuple(name, is_named_fields, field_names.clone());5051	let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);52	let abi_type = impl_struct_abi_type(name, tuple_type.clone(), params_count);53	let abi_read = impl_struct_abi_read(name, tuple_type, tuple_names, struct_from_tuple);54	let abi_write = impl_struct_abi_write(name, is_named_fields, tuple_ref_type, tuple_data);55	let solidity_type = impl_struct_solidity_type(name, field_types.clone(), params_count);56	let solidity_type_name =57		impl_struct_solidity_type_name(name, field_types.clone(), params_count);58	let solidity_struct_collect =59		impl_struct_solidity_struct_collect(name, field_names, field_types, field_docs, &docs)?;6061	Ok(quote! {62		#can_be_plcaed_in_vec63		#abi_type64		#abi_read65		#abi_write66		#solidity_type67		#solidity_type_name68		#solidity_struct_collect69	})70}7172fn expand_enum(73	de: &syn::DataEnum,74	ast: &syn::DeriveInput,75) -> syn::Result<proc_macro2::TokenStream> {76	let name = &ast.ident;77	check_repr_u8(name, &ast.attrs)?;78	let docs = extract_docs(&ast.attrs, false)?;79	let option_count = check_and_count_options(de)?;80	let enum_options = de.variants.iter().map(|v| &v.ident);81	let enum_options_docs = de.variants.iter().map(|v| extract_docs(&v.attrs, true));8283	let from = impl_enum_from_u8(name, enum_options.clone());84	let solidity_option = impl_solidity_option(name, enum_options.clone());85	let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);86	let abi_type = impl_enum_abi_type(name, option_count);87	let abi_read = impl_enum_abi_read(name);88	let abi_write = impl_enum_abi_write(name);89	let solidity_type = impl_enum_solidity_type(name);90	let solidity_type_name = impl_enum_solidity_type_name(name);91	let solidity_struct_collect = impl_enum_solidity_struct_collect(92		name,93		enum_options,94		option_count,95		enum_options_docs,96		&docs,97	);9899	Ok(quote! {100		#from101		#solidity_option102		#can_be_plcaed_in_vec103		#abi_type104		#abi_read105		#abi_write106		#solidity_type107		#solidity_type_name108		#solidity_struct_collect109	})110}111112fn extract_docs(113	attrs: &[syn::Attribute],114	is_field_doc: bool,115) -> syn::Result<Vec<proc_macro2::TokenStream>> {116	attrs117		.iter()118		.filter_map(|attr| {119			if let Some(ps) = attr.path.segments.first() {120				if ps.ident == "doc" {121					let meta = match attr.parse_meta() {122						Ok(meta) => meta,123						Err(e) => return Some(Err(e)),124					};125					match meta {126						syn::Meta::NameValue(mnv) => match &mnv.lit {127							syn::Lit::Str(ls) => return Some(Ok(ls.value())),128							_ => unreachable!(),129						},130						_ => unreachable!(),131					}132				}133			}134			None135		})136		.enumerate()137		.map(|(i, doc)| {138			let doc = doc?;139			let doc = doc.trim();140			let dev = if i == 0 { " @dev" } else { "" };141			let tab = if is_field_doc { "\t" } else { "" };142			Ok(quote! {143				writeln!(str, "{}///{} {}", #tab, #dev, #doc).unwrap();144			})145		})146		.collect()147}
after · crates/evm-coder/procedural/src/abi_derive/mod.rs
1mod derive_enum;2mod derive_struct;34use quote::quote;5use derive_struct::*;6use derive_enum::*;78pub(crate) fn impl_abi_macro(ast: &syn::DeriveInput) -> syn::Result<proc_macro2::TokenStream> {9	let name = &ast.ident;10	match &ast.data {11		syn::Data::Struct(ds) => expand_struct(ds, ast),12		syn::Data::Enum(de) => expand_enum(de, ast),13		syn::Data::Union(_) => Err(syn::Error::new(name.span(), "Unions not supported")),14	}15}1617fn expand_struct(18	ds: &syn::DataStruct,19	ast: &syn::DeriveInput,20) -> syn::Result<proc_macro2::TokenStream> {21	let name = &ast.ident;22	let docs = extract_docs(&ast.attrs, false)?;23	let (is_named_fields, field_names, field_types, field_docs, params_count) = match ds.fields {24		syn::Fields::Named(ref fields) => Ok((25			true,26			fields.named.iter().enumerate().map(map_field_to_name),27			fields.named.iter().map(map_field_to_type),28			fields.named.iter().map(map_field_to_doc),29			fields.named.len(),30		)),31		syn::Fields::Unnamed(ref fields) => Ok((32			false,33			fields.unnamed.iter().enumerate().map(map_field_to_name),34			fields.unnamed.iter().map(map_field_to_type),35			fields.unnamed.iter().map(map_field_to_doc),36			fields.unnamed.len(),37		)),38		syn::Fields::Unit => Err(syn::Error::new(name.span(), "Unit structs not supported")),39	}?;4041	if params_count == 0 {42		return Err(syn::Error::new(name.span(), "Empty structs not supported"));43	};4445	let tuple_type = tuple_type(field_types.clone());46	let tuple_ref_type = tuple_ref_type(field_types.clone());47	let tuple_data = tuple_data_as_ref(is_named_fields, field_names.clone());48	let tuple_names = tuple_names(is_named_fields, field_names.clone());49	let struct_from_tuple = struct_from_tuple(name, is_named_fields, field_names.clone());5051	let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);52	let abi_type = impl_struct_abi_type(name, tuple_type.clone());53	let abi_read = impl_struct_abi_read(name, tuple_type, tuple_names, struct_from_tuple);54	let abi_write = impl_struct_abi_write(name, is_named_fields, tuple_ref_type, tuple_data);55	let solidity_type = impl_struct_solidity_type(name, field_types.clone(), params_count);56	let solidity_type_name =57		impl_struct_solidity_type_name(name, field_types.clone(), params_count);58	let solidity_struct_collect =59		impl_struct_solidity_struct_collect(name, field_names, field_types, field_docs, &docs)?;6061	Ok(quote! {62		#can_be_plcaed_in_vec63		#abi_type64		#abi_read65		#abi_write66		#solidity_type67		#solidity_type_name68		#solidity_struct_collect69	})70}7172fn expand_enum(73	de: &syn::DataEnum,74	ast: &syn::DeriveInput,75) -> syn::Result<proc_macro2::TokenStream> {76	let name = &ast.ident;77	check_repr_u8(name, &ast.attrs)?;78	let docs = extract_docs(&ast.attrs, false)?;79	let option_count = check_and_count_options(de)?;80	let enum_options = de.variants.iter().map(|v| &v.ident);81	let enum_options_docs = de.variants.iter().map(|v| extract_docs(&v.attrs, true));8283	let from = impl_enum_from_u8(name, enum_options.clone());84	let solidity_option = impl_solidity_option(name, enum_options.clone());85	let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);86	let abi_type = impl_enum_abi_type(name);87	let abi_read = impl_enum_abi_read(name);88	let abi_write = impl_enum_abi_write(name);89	let solidity_type = impl_enum_solidity_type(name);90	let solidity_type_name = impl_enum_solidity_type_name(name);91	let solidity_struct_collect = impl_enum_solidity_struct_collect(92		name,93		enum_options,94		option_count,95		enum_options_docs,96		&docs,97	);9899	Ok(quote! {100		#from101		#solidity_option102		#can_be_plcaed_in_vec103		#abi_type104		#abi_read105		#abi_write106		#solidity_type107		#solidity_type_name108		#solidity_struct_collect109	})110}111112fn extract_docs(113	attrs: &[syn::Attribute],114	is_field_doc: bool,115) -> syn::Result<Vec<proc_macro2::TokenStream>> {116	attrs117		.iter()118		.filter_map(|attr| {119			if let Some(ps) = attr.path.segments.first() {120				if ps.ident == "doc" {121					let meta = match attr.parse_meta() {122						Ok(meta) => meta,123						Err(e) => return Some(Err(e)),124					};125					match meta {126						syn::Meta::NameValue(mnv) => match &mnv.lit {127							syn::Lit::Str(ls) => return Some(Ok(ls.value())),128							_ => unreachable!(),129						},130						_ => unreachable!(),131					}132				}133			}134			None135		})136		.enumerate()137		.map(|(i, doc)| {138			let doc = doc?;139			let doc = doc.trim();140			let dev = if i == 0 { " @dev" } else { "" };141			let tab = if is_field_doc { "\t" } else { "" };142			Ok(quote! {143				writeln!(str, "{}///{} {}", #tab, #dev, #doc).unwrap();144			})145		})146		.collect()147}
modifiedcrates/evm-coder/src/abi/impls.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi/impls.rs
+++ b/crates/evm-coder/src/abi/impls.rs
@@ -16,7 +16,6 @@
 
 		impl AbiType for $ty {
 			const SIGNATURE: SignatureUnit = make_signature!(new fixed(stringify!($name)));
-			const FIELDS_COUNT: usize = 1;
 
 			fn is_dynamic() -> bool {
 				$dynamic
@@ -97,7 +96,6 @@
 
 impl<T: AbiType> AbiType for &T {
 	const SIGNATURE: SignatureUnit = T::SIGNATURE;
-	const FIELDS_COUNT: usize = T::FIELDS_COUNT;
 
 	fn is_dynamic() -> bool {
 		T::is_dynamic()
@@ -127,7 +125,6 @@
 
 impl<T: AbiType> AbiType for Vec<T> {
 	const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));
-	const FIELDS_COUNT: usize = 1;
 
 	fn is_dynamic() -> bool {
 		true
@@ -203,7 +200,6 @@
                 shift_left(1)
                 fixed(")")
             );
-			const FIELDS_COUNT: usize = count!($($ident)*);
 
 			fn is_dynamic() -> bool {
 				false
modifiedcrates/evm-coder/src/abi/traits.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi/traits.rs
+++ b/crates/evm-coder/src/abi/traits.rs
@@ -10,9 +10,6 @@
 	/// Signature for Etherium ABI.
 	const SIGNATURE: SignatureUnit;
 
-	/// Count of enum variants or struct fields.
-	const FIELDS_COUNT: usize;
-
 	/// Signature as str.
 	fn as_str() -> &'static str {
 		from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")
modifiedcrates/evm-coder/tests/abi_derive_generation.rsdiffbeforeafterboth
--- a/crates/evm-coder/tests/abi_derive_generation.rs
+++ b/crates/evm-coder/tests/abi_derive_generation.rs
@@ -173,50 +173,6 @@
 	}
 
 	#[test]
-	fn impl_abi_type_fields_count() {
-		assert_eq!(
-			<TypeStruct1SimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			1
-		);
-		assert_eq!(
-			<TypeStruct1DynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			1
-		);
-		assert_eq!(
-			<TypeStruct2SimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct2DynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct2MixedParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct1DerivedSimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			1
-		);
-		assert_eq!(
-			<TypeStruct2DerivedSimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct1DerivedDynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			1
-		);
-		assert_eq!(
-			<TypeStruct2DerivedDynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct3DerivedMixedParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			3
-		);
-	}
-
-	#[test]
 	fn impl_abi_type_is_dynamic() {
 		assert_eq!(
 			<TypeStruct1SimpleParam as evm_coder::abi::AbiType>::is_dynamic(),
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -347,6 +347,10 @@
 	) -> Result<void> {
 		self.consume_store_reads_and_writes(1, 1)?;
 
+		if !limit.has_value() {
+			return Err(Error::Revert("user can't disable limits".into()));
+		}
+
 		let caller = T::CrossAccountId::from_eth(caller);
 		<Pallet<T>>::update_limits(&caller, self, limit.try_into()?).map_err(dispatch_to_evm::<T>)
 	}
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -264,16 +264,17 @@
 			value: value.into(),
 		}
 	}
+
+	/// Whether the field contains a value.
+	pub fn has_value(&self) -> bool {
+		self.value.status
+	}
 }
 
 impl TryInto<up_data_structs::CollectionLimits> for CollectionLimit {
 	type Error = evm_coder::execution::Error;
 
 	fn try_into(self) -> Result<up_data_structs::CollectionLimits, Self::Error> {
-		if !self.value.status {
-			return Err(Self::Error::Revert("user can't disable limits".into()));
-		}
-
 		let value = self.value.value.try_into().map_err(|error| {
 			Self::Error::Revert(format!(
 				"can't convert value to u32 \"{}\" because: \"{error}\"",
@@ -433,17 +434,6 @@
 		let mut perms = Vec::new();
 
 		for TokenPropertyPermission { key, permissions } in permissions {
-			if permissions.len() > <TokenPermissionField as evm_coder::abi::AbiType>::FIELDS_COUNT {
-				return Err(alloc::format!(
-					"Actual number of fields {} for {}, which exceeds the maximum value of {}",
-					permissions.len(),
-					stringify!(EthTokenPermissions),
-					<TokenPermissionField as evm_coder::abi::AbiType>::FIELDS_COUNT
-				)
-				.as_str()
-				.into());
-			}
-
 			let token_permission = PropertyPermission::from_vec(permissions);
 
 			perms.push(up_data_structs::PropertyKeyPermission {
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -38,6 +38,7 @@
 use pallet_common::{
 	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
 	erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},
+	eth,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::call;
@@ -93,25 +94,21 @@
 	fn set_token_property_permissions(
 		&mut self,
 		caller: caller,
-		permissions: Vec<pallet_common::eth::TokenPropertyPermission>,
+		permissions: Vec<eth::TokenPropertyPermission>,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
-		let perms = pallet_common::eth::TokenPropertyPermission::into_property_key_permissions(
-			permissions,
-		)?;
+		let perms = eth::TokenPropertyPermission::into_property_key_permissions(permissions)?;
 
 		<Pallet<T>>::set_token_property_permissions(self, &caller, perms)
 			.map_err(dispatch_to_evm::<T>)
 	}
 
 	/// @notice Get permissions for token properties.
-	fn token_property_permissions(
-		&self,
-	) -> Result<Vec<pallet_common::eth::TokenPropertyPermission>> {
+	fn token_property_permissions(&self) -> Result<Vec<eth::TokenPropertyPermission>> {
 		let perms = <Pallet<T>>::token_property_permission(self.id);
 		Ok(perms
 			.into_iter()
-			.map(pallet_common::eth::TokenPropertyPermission::from)
+			.map(eth::TokenPropertyPermission::from)
 			.collect())
 	}
 
@@ -159,7 +156,7 @@
 		&mut self,
 		caller: caller,
 		token_id: uint256,
-		properties: Vec<pallet_common::eth::Property>,
+		properties: Vec<eth::Property>,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -170,7 +167,7 @@
 
 		let properties = properties
 			.into_iter()
-			.map(pallet_common::eth::Property::try_into)
+			.map(eth::Property::try_into)
 			.collect::<Result<Vec<_>>>()?;
 
 		<Pallet<T>>::set_token_properties(
@@ -753,9 +750,9 @@
 	/// Returns the owner (in cross format) of the token.
 	///
 	/// @param tokenId Id for the token.
-	fn cross_owner_of(&self, token_id: uint256) -> Result<pallet_common::eth::CrossAddress> {
+	fn cross_owner_of(&self, token_id: uint256) -> Result<eth::CrossAddress> {
 		Self::token_owner(&self, token_id.try_into()?)
-			.map(|o| pallet_common::eth::CrossAddress::from_sub_cross_account::<T>(&o))
+			.map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
 			.ok_or(Error::Revert("key too large".into()))
 	}
 
@@ -764,11 +761,7 @@
 	/// @param tokenId Id for the token.
 	/// @param keys Properties keys. Empty keys for all propertyes.
 	/// @return Vector of properties key/value pairs.
-	fn properties(
-		&self,
-		token_id: uint256,
-		keys: Vec<string>,
-	) -> Result<Vec<pallet_common::eth::Property>> {
+	fn properties(&self, token_id: uint256, keys: Vec<string>) -> Result<Vec<eth::Property>> {
 		let keys = keys
 			.into_iter()
 			.map(|key| {
@@ -784,7 +777,7 @@
 			if keys.is_empty() { None } else { Some(keys) },
 		)
 		.into_iter()
-		.map(pallet_common::eth::Property::try_from)
+		.map(eth::Property::try_from)
 		.collect::<Result<Vec<_>>>()
 	}
 
@@ -798,7 +791,7 @@
 	fn approve_cross(
 		&mut self,
 		caller: caller,
-		approved: pallet_common::eth::CrossAddress,
+		approved: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -837,7 +830,7 @@
 	fn transfer_cross(
 		&mut self,
 		caller: caller,
-		to: pallet_common::eth::CrossAddress,
+		to: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -861,8 +854,8 @@
 	fn transfer_from_cross(
 		&mut self,
 		caller: caller,
-		from: pallet_common::eth::CrossAddress,
-		to: pallet_common::eth::CrossAddress,
+		from: eth::CrossAddress,
+		to: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -908,7 +901,7 @@
 	fn burn_from_cross(
 		&mut self,
 		caller: caller,
-		from: pallet_common::eth::CrossAddress,
+		from: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -1030,8 +1023,8 @@
 	fn mint_cross(
 		&mut self,
 		caller: caller,
-		to: pallet_common::eth::CrossAddress,
-		properties: Vec<pallet_common::eth::Property>,
+		to: eth::CrossAddress,
+		properties: Vec<eth::Property>,
 	) -> Result<uint256> {
 		let token_id = <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
@@ -1041,7 +1034,7 @@
 
 		let properties = properties
 			.into_iter()
-			.map(pallet_common::eth::Property::try_into)
+			.map(eth::Property::try_into)
 			.collect::<Result<Vec<_>>>()?
 			.try_into()
 			.map_err(|_| Error::Revert(alloc::format!("too many properties")))?;
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -32,8 +32,9 @@
 use frame_support::{BoundedBTreeMap, BoundedVec};
 use pallet_common::{
 	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
+	Error as CommonError,
 	erc::{CommonEvmHandler, CollectionCall, static_property::key},
-	Error as CommonError,
+	eth,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{call, dispatch_to_evm};
@@ -96,25 +97,21 @@
 	fn set_token_property_permissions(
 		&mut self,
 		caller: caller,
-		permissions: Vec<pallet_common::eth::TokenPropertyPermission>,
+		permissions: Vec<eth::TokenPropertyPermission>,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
-		let perms = pallet_common::eth::TokenPropertyPermission::into_property_key_permissions(
-			permissions,
-		)?;
+		let perms = eth::TokenPropertyPermission::into_property_key_permissions(permissions)?;
 
 		<Pallet<T>>::set_token_property_permissions(self, &caller, perms)
 			.map_err(dispatch_to_evm::<T>)
 	}
 
 	/// @notice Get permissions for token properties.
-	fn token_property_permissions(
-		&self,
-	) -> Result<Vec<pallet_common::eth::TokenPropertyPermission>> {
+	fn token_property_permissions(&self) -> Result<Vec<eth::TokenPropertyPermission>> {
 		let perms = <Pallet<T>>::token_property_permission(self.id);
 		Ok(perms
 			.into_iter()
-			.map(pallet_common::eth::TokenPropertyPermission::from)
+			.map(eth::TokenPropertyPermission::from)
 			.collect())
 	}
 
@@ -162,7 +159,7 @@
 		&mut self,
 		caller: caller,
 		token_id: uint256,
-		properties: Vec<pallet_common::eth::Property>,
+		properties: Vec<eth::Property>,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -173,7 +170,7 @@
 
 		let properties = properties
 			.into_iter()
-			.map(pallet_common::eth::Property::try_into)
+			.map(eth::Property::try_into)
 			.collect::<Result<Vec<_>>>()?;
 
 		<Pallet<T>>::set_token_properties(
@@ -788,9 +785,9 @@
 	/// Returns the owner (in cross format) of the token.
 	///
 	/// @param tokenId Id for the token.
-	fn cross_owner_of(&self, token_id: uint256) -> Result<pallet_common::eth::CrossAddress> {
+	fn cross_owner_of(&self, token_id: uint256) -> Result<eth::CrossAddress> {
 		Self::token_owner(&self, token_id.try_into()?)
-			.map(|o| pallet_common::eth::CrossAddress::from_sub_cross_account::<T>(&o))
+			.map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
 			.ok_or(Error::Revert("key too large".into()))
 	}
 
@@ -799,11 +796,7 @@
 	/// @param tokenId Id for the token.
 	/// @param keys Properties keys. Empty keys for all propertyes.
 	/// @return Vector of properties key/value pairs.
-	fn properties(
-		&self,
-		token_id: uint256,
-		keys: Vec<string>,
-	) -> Result<Vec<pallet_common::eth::Property>> {
+	fn properties(&self, token_id: uint256, keys: Vec<string>) -> Result<Vec<eth::Property>> {
 		let keys = keys
 			.into_iter()
 			.map(|key| {
@@ -819,7 +812,7 @@
 			if keys.is_empty() { None } else { Some(keys) },
 		)
 		.into_iter()
-		.map(pallet_common::eth::Property::try_from)
+		.map(eth::Property::try_from)
 		.collect::<Result<Vec<_>>>()
 	}
 	/// @notice Transfer ownership of an RFT
@@ -855,7 +848,7 @@
 	fn transfer_cross(
 		&mut self,
 		caller: caller,
-		to: pallet_common::eth::CrossAddress,
+		to: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -883,8 +876,8 @@
 	fn transfer_from_cross(
 		&mut self,
 		caller: caller,
-		from: pallet_common::eth::CrossAddress,
-		to: pallet_common::eth::CrossAddress,
+		from: eth::CrossAddress,
+		to: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -939,7 +932,7 @@
 	fn burn_from_cross(
 		&mut self,
 		caller: caller,
-		from: pallet_common::eth::CrossAddress,
+		from: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -1076,8 +1069,8 @@
 	fn mint_cross(
 		&mut self,
 		caller: caller,
-		to: pallet_common::eth::CrossAddress,
-		properties: Vec<pallet_common::eth::Property>,
+		to: eth::CrossAddress,
+		properties: Vec<eth::Property>,
 	) -> Result<uint256> {
 		let token_id = <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
@@ -1087,7 +1080,7 @@
 
 		let properties = properties
 			.into_iter()
-			.map(pallet_common::eth::Property::try_into)
+			.map(eth::Property::try_into)
 			.collect::<Result<Vec<_>>>()?
 			.try_into()
 			.map_err(|_| Error::Revert(alloc::format!("too many properties")))?;