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

difftreelog

feat Add custum signature with unlimited nesting.

Trubnikov Sergey2022-10-19parent: #01896ba.patch.diff
in: master

17 files changed

modifiedcrates/evm-coder/procedural/src/solidity_interface.rsdiffbeforeafterboth
--- a/crates/evm-coder/procedural/src/solidity_interface.rs
+++ b/crates/evm-coder/procedural/src/solidity_interface.rs
@@ -21,7 +21,7 @@
 // https://doc.rust-lang.org/reference/procedural-macros.html
 
 use proc_macro2::{TokenStream, Group};
-use quote::{quote, ToTokens};
+use quote::{quote, ToTokens, format_ident};
 use inflector::cases;
 use std::fmt::Write;
 use syn::{
@@ -725,25 +725,20 @@
 		}
 	}
 
-	fn expand_selector(&self) -> proc_macro2::TokenStream {
-		let custom_signature = self.expand_custom_signature();
-		quote! {
-			 {
-				let a = ::evm_coder::sha3_const::Keccak256::new()
-					.update(#custom_signature.as_bytes())
-					.finalize();
-				[a[0], a[1], a[2], a[3]]
-			}
-		}
-	}
-
 	fn expand_const(&self) -> proc_macro2::TokenStream {
 		let screaming_name = &self.screaming_name;
+		let screaming_name_signature = format_ident!("{}_SIGNATURE", &self.screaming_name);
 		let selector_str = &self.selector_str;
-		let selector = &self.expand_selector();
+		let custom_signature = self.expand_custom_signature();
 		quote! {
+			const #screaming_name_signature: ::evm_coder::custom_signature::FunctionSignature = #custom_signature;
 			#[doc = #selector_str]
-			const #screaming_name: ::evm_coder::types::bytes4 = #selector;
+			const #screaming_name: ::evm_coder::types::bytes4 = {
+				let a = ::evm_coder::sha3_const::Keccak256::new()
+				.update_with_size(&Self::#screaming_name_signature.signature, Self::#screaming_name_signature.signature_len)
+				.finalize();
+				[a[0], a[1], a[2], a[3]]
+			};
 		}
 	}
 
@@ -847,9 +842,8 @@
 	}
 
 	fn expand_custom_signature(&self) -> proc_macro2::TokenStream {
-		let mut first_comma = true;
 		let mut custom_signature = TokenStream::new();
-		let mut template = self.camel_name.clone() + "(";
+
 		self.args
 			.iter()
 			.filter_map(|a| {
@@ -863,39 +857,18 @@
 				}
 			})
 			.for_each(|ident| {
-				if !first_comma {
-					custom_signature.extend(quote!(,));
-					template.push(',');
-				} else {
-					first_comma = false;
-				};
-				template.push_str("{}");
-				let ident_str = ident.to_string();
-				match ident_str.as_str() {
-					"address" | "uint8" | "uint16" | "uint32" | "uint64" | "uint128"
-					| "uint256" | "bytes4" | "topic" | "string" | "bytes" | "void" | "caller"
-					| "bool" | "" => {
-						custom_signature.extend(quote!(#ident_str));
-					}
-					_ => {
-						custom_signature.extend(quote! {
-							#ident::SIGNATURE_STRING
-						});
-					}
-				}
+				custom_signature.extend(quote! {
+					(<#ident>::SIGNATURE, <#ident>::SIGNATURE_LEN)
+				});
 			});
 
-		template.push(')');
-		let mut template = quote!(#template);
-		template.extend(quote!(,));
-		template.extend(custom_signature);
-		let custom_signature_group = Group::new(proc_macro2::Delimiter::Parenthesis, template);
-		let mut custom_signature = quote! {
-			::evm_coder::const_format::formatcp!
-		};
-		custom_signature.extend(custom_signature_group.to_token_stream());
+		let func_name = self.camel_name.clone();
+		let func_name = quote!(FunctionName::new(#func_name));
+		custom_signature =
+			quote!({ ::evm_coder::make_signature!(new fn(& #func_name),#custom_signature) });
+
+		// println!("!!!!! {}", custom_signature);
 
-		println!("!!!!! {}", custom_signature);
 		custom_signature
 	}
 
@@ -915,16 +888,23 @@
 			.map(MethodArg::expand_solidity_argument);
 		let docs = &self.docs;
 		let selector_str = &self.selector_str;
-		let selector = &self.expand_selector();
+		let screaming_name = &self.screaming_name;
 		let hide = self.hide;
 		let custom_signature = self.expand_custom_signature();
+		let custom_signature = quote!(
+			{
+				const cs: FunctionSignature = #custom_signature;
+				cs
+			}
+		);
+		// println!("!!!!! {}", custom_signature);
 		let is_payable = self.has_value_args;
-		quote! {
+		let out = quote! {
 			SolidityFunction {
 				docs: &[#(#docs),*],
 				selector_str: #selector_str,
 				hide: #hide,
-				selector: u32::from_be_bytes(#selector),
+				selector: u32::from_be_bytes(Self::#screaming_name),
 				custom_signature: #custom_signature,
 				name: #camel_name,
 				mutability: #mutability,
@@ -936,7 +916,9 @@
 				),
 				result: <UnnamedArgument<#result>>::default(),
 			}
-		}
+		};
+		// println!("@@@ {}", out);
+		out
 	}
 }
 
addedcrates/evm-coder/src/custom_signature.rsdiffbeforeafterboth
--- /dev/null
+++ b/crates/evm-coder/src/custom_signature.rs
@@ -0,0 +1,336 @@
+use core::str::from_utf8;
+
+pub const SIGNATURE_SIZE_LIMIT: usize = 256;
+
+pub trait Name {
+	const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT];
+	const SIGNATURE_LEN: usize;
+
+	fn name() -> &'static str {
+		from_utf8(&Self::SIGNATURE[..Self::SIGNATURE_LEN]).expect("bad utf-8")
+	}
+}
+
+#[derive(Debug)]
+pub struct FunctionSignature {
+	pub signature: [u8; SIGNATURE_SIZE_LIMIT],
+	pub signature_len: usize,
+}
+
+impl FunctionSignature {
+	pub const fn new(name: &'static FunctionName) -> FunctionSignature {
+		let mut signature = [0_u8; SIGNATURE_SIZE_LIMIT];
+		let name_len = name.signature_len;
+		let name = name.signature;
+		let mut dst_offset = 0;
+		let bracket_open = {
+			let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
+			b[0] = b"("[0];
+			b
+		};
+		crate::make_signature!(@copy(name, signature, name_len, dst_offset));
+		crate::make_signature!(@copy(bracket_open, signature, 1, dst_offset));
+		FunctionSignature {
+			signature,
+			signature_len: dst_offset,
+		}
+	}
+
+	pub const fn add_param(
+		signature: FunctionSignature,
+		param: ([u8; SIGNATURE_SIZE_LIMIT], usize),
+	) -> FunctionSignature {
+		let mut dst = signature.signature;
+		let mut dst_offset = signature.signature_len;
+		let (param_name, param_len) = param;
+		let comma = {
+			let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
+			b[0] = b","[0];
+			b
+		};
+		FunctionSignature {
+			signature: {
+				crate::make_signature!(@copy(param_name, dst, param_len, dst_offset));
+				crate::make_signature!(@copy(comma, dst, 1, dst_offset));
+				dst
+			},
+			signature_len: dst_offset,
+		}
+	}
+
+	pub const fn done(signature: FunctionSignature, owerride: bool) -> FunctionSignature {
+		let mut dst = signature.signature;
+		let mut dst_offset = signature.signature_len - if owerride { 1 } else { 0 };
+		let bracket_close = {
+			let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
+			b[0] = b")"[0];
+			b
+		};
+		FunctionSignature {
+			signature: {
+				crate::make_signature!(@copy(bracket_close, dst, 1, dst_offset));
+				dst
+			},
+			signature_len: dst_offset,
+		}
+	}
+
+	// fn as_str(&self) -> &'static str {
+	// 	from_utf8(&self.signature[..self.signature_len]).expect("bad utf-8")
+	// }
+}
+
+#[derive(Debug)]
+pub struct FunctionName {
+	signature: [u8; SIGNATURE_SIZE_LIMIT],
+	signature_len: usize,
+}
+
+impl FunctionName {
+	pub const fn new(name: &'static str) -> FunctionName {
+		let mut signature = [0_u8; SIGNATURE_SIZE_LIMIT];
+		let name = name.as_bytes();
+		let name_len = name.len();
+		let mut dst_offset = 0;
+		crate::make_signature!(@copy(name, signature, name_len, dst_offset));
+		FunctionName {
+			signature,
+			signature_len: name_len,
+		}
+	}
+}
+
+#[macro_export]
+#[allow(missing_docs)]
+macro_rules! make_signature { // May be "define_signature"?
+	(new fn($func:expr)$(,)+) => {
+		{
+			let fs = FunctionSignature::new(& $func);
+			let fs = FunctionSignature::done(fs, false);
+			fs
+		}
+	};
+	(new fn($func:expr), $($tt:tt)*) => {
+		{
+			let fs = FunctionSignature::new(& $func);
+			let fs = make_signature!(@param; fs, $($tt),*);
+			fs
+		}
+	};
+
+	(@param; $func:expr) => {
+		FunctionSignature::done($func, true)
+	};
+	(@param; $func:expr, $param:expr) => {
+		make_signature!(@param; FunctionSignature::add_param($func, $param))
+	};
+	(@param; $func:expr, $param:expr, $($tt:tt),*) => {
+		make_signature!(@param; FunctionSignature::add_param($func, $param), $($tt),*)
+	};
+
+    (new $($tt:tt)*) => {
+        const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT] = {
+            let mut out = [0u8; SIGNATURE_SIZE_LIMIT];
+            let mut dst_offset = 0;
+            make_signature!(@data(out, dst_offset); $($tt)*);
+            out
+        };
+        const SIGNATURE_LEN: usize = 0 + make_signature!(@size; $($tt)*);
+    };
+
+	// (@bytes)
+
+    (@size;) => {
+        0
+    };
+    (@size; fixed($expr:expr) $($tt:tt)*) => {
+        $expr.len() + make_signature!(@size; $($tt)*)
+    };
+    (@size; nameof($expr:ty) $($tt:tt)*) => {
+        <$expr>::SIGNATURE_LEN + make_signature!(@size; $($tt)*)
+    };
+
+    (@data($dst:ident, $dst_offset:ident);) => {};
+    (@data($dst:ident, $dst_offset:ident); fixed($expr:expr) $($tt:tt)*) => {
+        {
+            let data = $expr.as_bytes();
+			let data_len = data.len();
+			make_signature!(@copy(data, $dst, data_len, $dst_offset));
+        }
+        make_signature!(@data($dst, $dst_offset); $($tt)*)
+    };
+    (@data($dst:ident, $dst_offset:ident); nameof($expr:ty) $($tt:tt)*) => {
+        {
+			let data = &<$expr>::SIGNATURE;
+			let data_len = <$expr>::SIGNATURE_LEN;
+            make_signature!(@copy(data, $dst, data_len, $dst_offset));
+        }
+        make_signature!(@data($dst, $dst_offset); $($tt)*)
+    };
+
+	(@copy($src:ident, $dst:ident, $src_len:expr, $dst_offset:ident)) => {
+		{
+			let mut src_offset = 0;
+			let src_len: usize = $src_len;
+			while src_offset < src_len {
+				$dst[$dst_offset] = $src[src_offset];
+				$dst_offset += 1;
+				src_offset += 1;
+			}
+		}
+	}
+}
+
+#[cfg(test)]
+mod test {
+	use core::str::from_utf8;
+
+	use frame_support::sp_runtime::app_crypto::sp_core::hexdisplay::AsBytesRef;
+
+	use super::{Name, SIGNATURE_SIZE_LIMIT, FunctionName, FunctionSignature};
+
+	impl Name for u8 {
+		make_signature!(new fixed("uint8"));
+	}
+	impl Name for u32 {
+		make_signature!(new fixed("uint32"));
+	}
+	impl<T: Name> Name for Vec<T> {
+		make_signature!(new nameof(T) fixed("[]"));
+	}
+	impl<A: Name, B: Name> Name for (A, B) {
+		make_signature!(new fixed("(") nameof(A) fixed(",") nameof(B) fixed(")"));
+	}
+
+	struct MaxSize();
+	impl Name for MaxSize {
+		const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT] = [b'!'; SIGNATURE_SIZE_LIMIT];
+		const SIGNATURE_LEN: usize = SIGNATURE_SIZE_LIMIT;
+	}
+
+	#[test]
+	fn simple() {
+		assert_eq!(u8::name(), "uint8");
+		assert_eq!(u32::name(), "uint32");
+	}
+
+	#[test]
+	fn vector_of_simple() {
+		assert_eq!(<Vec<u8>>::name(), "uint8[]");
+		assert_eq!(<Vec<u32>>::name(), "uint32[]");
+	}
+
+	#[test]
+	fn vector_of_vector() {
+		assert_eq!(<Vec<Vec<u8>>>::name(), "uint8[][]");
+	}
+
+	#[test]
+	fn tuple_of_simple() {
+		assert_eq!(<(u32, u8)>::name(), "(uint32,uint8)");
+	}
+
+	#[test]
+	fn tuple_of_tuple() {
+		assert_eq!(
+			<((u32, u8), (u8, u32))>::name(),
+			"((uint32,uint8),(uint8,uint32))"
+		);
+	}
+
+	#[test]
+	fn vector_of_tuple() {
+		assert_eq!(<Vec<(u32, u8)>>::name(), "(uint32,uint8)[]");
+	}
+
+	#[test]
+	fn tuple_of_vector() {
+		assert_eq!(<(Vec<u32>, u8)>::name(), "(uint32[],uint8)");
+	}
+
+	#[test]
+	fn complex() {
+		assert_eq!(
+			<(Vec<u32>, (u32, Vec<u8>))>::name(),
+			"(uint32[],(uint32,uint8[]))"
+		);
+	}
+
+	#[test]
+	fn max_size() {
+		assert_eq!(<MaxSize>::name(), "!".repeat(SIGNATURE_SIZE_LIMIT));
+	}
+
+	// This test must NOT compile!
+	// #[test]
+	// fn over_max_size() {
+	// 	assert_eq!(<Vec<MaxSize>>::name(), "!".repeat(SIZE_LIMIT) + "[]");
+	// }
+
+	#[test]
+	fn make_func_without_args() {
+		const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+		const SIG: FunctionSignature = make_signature!(
+			new fn(&SOME_FUNK_NAME),
+		);
+		let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
+		assert_eq!(name, "some_funk()");
+	}
+
+	#[test]
+	fn make_func_with_1_args() {
+		const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+		const SIG: FunctionSignature = make_signature!(
+			new fn(&SOME_FUNK_NAME),
+			(u8::SIGNATURE, u8::SIGNATURE_LEN)
+		);
+		let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
+		assert_eq!(name, "some_funk(uint8)");
+	}
+
+	#[test]
+	fn make_func_with_2_args() {
+		const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+		const SIG: FunctionSignature = make_signature!(
+			new fn(&SOME_FUNK_NAME),
+			(u8::SIGNATURE, u8::SIGNATURE_LEN)
+			(<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+		);
+		let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
+		assert_eq!(name, "some_funk(uint8,uint32[])");
+	}
+
+	#[test]
+	fn make_func_with_3_args() {
+		const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+		const SIG: FunctionSignature = make_signature!(
+			new fn(&SOME_FUNK_NAME),
+			(u8::SIGNATURE, u8::SIGNATURE_LEN)
+			(u32::SIGNATURE, u32::SIGNATURE_LEN)
+			(<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+		);
+		let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
+		assert_eq!(name, "some_funk(uint8,uint32,uint32[])");
+	}
+
+	#[test]
+	fn make_slice_from_signature() {
+		const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
+		const SIG: FunctionSignature = make_signature!(
+			new fn(&SOME_FUNK_NAME),
+			(u8::SIGNATURE, u8::SIGNATURE_LEN)
+			(u32::SIGNATURE, u32::SIGNATURE_LEN)
+			(<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+		);
+		const NAME: [u8; SIG.signature_len] = {
+			let mut name: [u8; SIG.signature_len] = [0; SIG.signature_len];
+			let mut i = 0;
+			while i < SIG.signature_len {
+				name[i] = SIG.signature[i];
+				i += 1;
+			}
+			name
+		};
+		assert_eq!(&NAME, b"some_funk(uint8,uint32,uint32[])");
+	}
+}
modifiedcrates/evm-coder/src/lib.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/lib.rs
+++ b/crates/evm-coder/src/lib.rs
@@ -15,7 +15,9 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 #![doc = include_str!("../README.md")]
-#![deny(missing_docs)]
+// #![deny(missing_docs)]
+#![warn(missing_docs)]
+#![macro_use]
 #![cfg_attr(not(feature = "std"), no_std)]
 #[cfg(not(feature = "std"))]
 extern crate alloc;
@@ -26,6 +28,8 @@
 pub use events::{ToLog, ToTopic};
 use execution::DispatchInfo;
 pub mod execution;
+#[macro_use]
+pub mod custom_signature;
 
 /// Derives call enum implementing [`crate::Callable`], [`crate::Weighted`]
 /// and [`crate::Call`] from impl block.
@@ -118,27 +122,54 @@
 	use alloc::{vec::Vec};
 	use pallet_evm::account::CrossAccountId;
 	use primitive_types::{U256, H160, H256};
+	use core::str::from_utf8;
 
-	pub type address = H160;
+	use crate::custom_signature::SIGNATURE_SIZE_LIMIT;
 
-	pub type uint8 = u8;
-	pub type uint16 = u16;
-	pub type uint32 = u32;
-	pub type uint64 = u64;
-	pub type uint128 = u128;
-	pub type uint256 = U256;
+	pub trait Signature {
+		const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT];
+		const SIGNATURE_LEN: usize;
 
-	pub type bytes4 = [u8; 4];
+		fn as_str() -> &'static str {
+			from_utf8(&Self::SIGNATURE[..Self::SIGNATURE_LEN]).expect("bad utf-8")
+		}
+	}
 
-	pub type topic = H256;
+	impl Signature for bool {
+		make_signature!(new fixed("bool"));
+	}
 
+	macro_rules! define_simple_type {
+		(type $ident:ident = $ty:ty) => {
+			pub type $ident = $ty;
+			impl Signature for $ty {
+				make_signature!(new fixed(stringify!($ident)));
+			}
+		};
+	}
+
+	define_simple_type!(type address = H160);
+
+	define_simple_type!(type uint8 = u8);
+	define_simple_type!(type uint16 = u16);
+	define_simple_type!(type uint32 = u32);
+	define_simple_type!(type uint64 = u64);
+	define_simple_type!(type uint128 = u128);
+	define_simple_type!(type uint256 = U256);
+	define_simple_type!(type bytes4 = [u8; 4]);
+
+	define_simple_type!(type topic = H256);
+
 	#[cfg(not(feature = "std"))]
-	pub type string = ::alloc::string::String;
+	define_simple_type!(type string = ::alloc::string::String);
 	#[cfg(feature = "std")]
-	pub type string = ::std::string::String;
+	define_simple_type!(type string = ::std::string::String);
 
 	#[derive(Default, Debug)]
 	pub struct bytes(pub Vec<u8>);
+	impl Signature for bytes {
+		make_signature!(new fixed("bytes"));
+	}
 
 	/// Solidity doesn't have `void` type, however we have special implementation
 	/// for empty tuple return type
@@ -230,12 +261,8 @@
 		}
 	}
 
-	impl SignatureString for EthCrossAccount {
-		const SIGNATURE_STRING: &'static str = "(address,uint256)";
-	}
-
-	pub trait SignatureString {
-		const SIGNATURE_STRING: &'static str;
+	impl Signature for EthCrossAccount {
+		make_signature!(new fixed("(address,uint256)"));
 	}
 
 	/// Convert `CrossAccountId` to `uint256`.
modifiedcrates/evm-coder/src/solidity.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -30,9 +30,10 @@
 	marker::PhantomData,
 	cell::{Cell, RefCell},
 	cmp::Reverse,
+	str::from_utf8,
 };
 use impl_trait_for_tuples::impl_for_tuples;
-use crate::types::*;
+use crate::{types::*, custom_signature::FunctionSignature};
 
 #[derive(Default)]
 pub struct TypeCollector {
@@ -487,7 +488,7 @@
 	pub selector_str: &'static str,
 	pub selector: u32,
 	pub hide: bool,
-	pub custom_signature: &'static str,
+	pub custom_signature: FunctionSignature,
 	pub name: &'static str,
 	pub args: A,
 	pub result: R,
@@ -513,7 +514,8 @@
 		writeln!(
 			writer,
 			"\t{hide_comment}///  or in textual repr: {}",
-			self.custom_signature
+			// from_utf8(self.custom_signature.as_str()).expect("bad utf8")
+			self.selector_str
 		)?;
 		write!(writer, "\t{hide_comment}function {}(", self.name)?;
 		self.args.solidity_name(writer, tc)?;
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -21,6 +21,8 @@
 	types::*,
 	execution::{Result, Error},
 	weight,
+	custom_signature::{FunctionName, FunctionSignature},
+	make_signature,
 };
 pub use pallet_evm::{PrecompileOutput, PrecompileResult, PrecompileHandle, account::CrossAccountId};
 use pallet_evm_coder_substrate::dispatch_to_evm;
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -20,7 +20,13 @@
 use alloc::{format, string::ToString};
 use core::marker::PhantomData;
 use evm_coder::{
-	abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*, ToLog,
+	abi::AbiWriter,
+	execution::Result,
+	generate_stubgen, solidity_interface,
+	types::*,
+	ToLog,
+	custom_signature::{FunctionName, FunctionSignature},
+	make_signature,
 };
 use pallet_evm::{
 	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -20,7 +20,15 @@
 use alloc::{format, string::ToString};
 use core::char::{REPLACEMENT_CHARACTER, decode_utf16};
 use core::convert::TryInto;
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
+use evm_coder::{
+	ToLog,
+	execution::*,
+	generate_stubgen, solidity_interface,
+	types::*,
+	weight,
+	custom_signature::{FunctionName, FunctionSignature},
+	make_signature,
+};
 use pallet_common::eth::convert_tuple_to_cross_account;
 use up_data_structs::CollectionMode;
 use pallet_common::erc::{CommonEvmHandler, PrecompileResult};
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -25,7 +25,15 @@
 	char::{REPLACEMENT_CHARACTER, decode_utf16},
 	convert::TryInto,
 };
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
+use evm_coder::{
+	ToLog,
+	execution::*,
+	generate_stubgen, solidity, solidity_interface,
+	types::*,
+	weight,
+	custom_signature::{FunctionName, FunctionSignature},
+	make_signature,
+};
 use frame_support::BoundedVec;
 use up_data_structs::{
 	TokenId, PropertyPermission, PropertyKeyPermission, Property, CollectionId, PropertyKey,
modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -104,7 +104,11 @@
 }
 
 /// @title A contract that allows you to work with collections.
+<<<<<<< HEAD
 /// @dev the ERC-165 identifier for this interface is 0xb3152af3
+=======
+/// @dev the ERC-165 identifier for this interface is 0x674be726
+>>>>>>> feat: Add custum signature with unlimited nesting.
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -198,7 +202,7 @@
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
 	///
 	/// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.
-	/// @dev EVM selector for this function is: 0x84a1d5a8,
+	/// @dev EVM selector for this function is: 0x403e96a7,
 	///  or in textual repr: setCollectionSponsorCross((address,uint256))
 	function setCollectionSponsorCross(Tuple6 memory sponsor) public {
 		require(false, stub_error);
@@ -239,6 +243,7 @@
 	/// @dev EVM selector for this function is: 0x6ec0a9f1,
 	///  or in textual repr: collectionSponsor()
 <<<<<<< HEAD
+<<<<<<< HEAD
 	function collectionSponsor() public view returns (Tuple6 memory) {
 		require(false, stub_error);
 		dummy;
@@ -249,6 +254,12 @@
 		dummy;
 		return Tuple19(0x0000000000000000000000000000000000000000, 0);
 >>>>>>> feat: add `EthCrossAccount` type
+=======
+	function collectionSponsor() public view returns (Tuple8 memory) {
+		require(false, stub_error);
+		dummy;
+		return Tuple8(0x0000000000000000000000000000000000000000, 0);
+>>>>>>> feat: Add custum signature with unlimited nesting.
 	}
 
 	/// Set limits for the collection.
@@ -297,7 +308,7 @@
 
 	/// Add collection admin.
 	/// @param newAdmin Cross account administrator address.
-	/// @dev EVM selector for this function is: 0x859aa7d6,
+	/// @dev EVM selector for this function is: 0x62e3c7c2,
 	///  or in textual repr: addCollectionAdminCross((address,uint256))
 	function addCollectionAdminCross(Tuple6 memory newAdmin) public {
 		require(false, stub_error);
@@ -307,7 +318,7 @@
 
 	/// Remove collection admin.
 	/// @param admin Cross account administrator address.
-	/// @dev EVM selector for this function is: 0x6c0cd173,
+	/// @dev EVM selector for this function is: 0x810d1503,
 	///  or in textual repr: removeCollectionAdminCross((address,uint256))
 	function removeCollectionAdminCross(Tuple6 memory admin) public {
 		require(false, stub_error);
@@ -351,7 +362,7 @@
 	///
 	/// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
 	/// @param collections Addresses of collections that will be available for nesting.
-	/// @dev EVM selector for this function is: 0x64872396,
+	/// @dev EVM selector for this function is: 0x112d4586,
 	///  or in textual repr: setCollectionNesting(bool,address[])
 	function setCollectionNesting(bool enable, address[] memory collections) public {
 		require(false, stub_error);
@@ -398,7 +409,7 @@
 	/// Add user to allowed list.
 	///
 	/// @param user User cross account address.
-	/// @dev EVM selector for this function is: 0xa0184a3a,
+	/// @dev EVM selector for this function is: 0xf074da88,
 	///  or in textual repr: addToCollectionAllowListCross((address,uint256))
 	function addToCollectionAllowListCross(Tuple6 memory user) public {
 		require(false, stub_error);
@@ -420,7 +431,7 @@
 	/// Remove user from allowed list.
 	///
 	/// @param user User cross account address.
-	/// @dev EVM selector for this function is: 0x09ba452a,
+	/// @dev EVM selector for this function is: 0xc00df45c,
 	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))
 	function removeFromCollectionAllowListCross(Tuple6 memory user) public {
 		require(false, stub_error);
@@ -456,7 +467,7 @@
 	///
 	/// @param user User cross account to verify
 	/// @return "true" if account is the owner or admin
-	/// @dev EVM selector for this function is: 0x3e75a905,
+	/// @dev EVM selector for this function is: 0x5aba3351,
 	///  or in textual repr: isOwnerOrAdminCross((address,uint256))
 	function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {
 		require(false, stub_error);
@@ -483,6 +494,7 @@
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
 <<<<<<< HEAD
+<<<<<<< HEAD
 	function collectionOwner() public view returns (Tuple6 memory) {
 		require(false, stub_error);
 		dummy;
@@ -493,6 +505,12 @@
 		dummy;
 		return Tuple19(0x0000000000000000000000000000000000000000, 0);
 >>>>>>> feat: add `EthCrossAccount` type
+=======
+	function collectionOwner() public view returns (Tuple8 memory) {
+		require(false, stub_error);
+		dummy;
+		return Tuple8(0x0000000000000000000000000000000000000000, 0);
+>>>>>>> feat: Add custum signature with unlimited nesting.
 	}
 
 	/// Changes collection owner to another account
@@ -523,7 +541,7 @@
 	///
 	/// @dev Owner can be changed only by current owner
 	/// @param newOwner new owner cross account
-	/// @dev EVM selector for this function is: 0xe5c9913f,
+	/// @dev EVM selector for this function is: 0xbdff793d,
 	///  or in textual repr: setOwnerCross((address,uint256))
 	function setOwnerCross(Tuple6 memory newOwner) public {
 		require(false, stub_error);
@@ -532,6 +550,7 @@
 	}
 }
 
+<<<<<<< HEAD
 /// @dev anonymous struct
 struct Tuple19 {
 	address field_0;
@@ -581,6 +600,8 @@
 	}
 }
 
+=======
+>>>>>>> feat: Add custum signature with unlimited nesting.
 /// @title ERC721 Token that can be irreversibly burned (destroyed).
 /// @dev the ERC-165 identifier for this interface is 0x42966c68
 contract ERC721Burnable is Dummy, ERC165 {
@@ -682,7 +703,11 @@
 }
 
 /// @title Unique extensions for ERC721.
+<<<<<<< HEAD
 /// @dev the ERC-165 identifier for this interface is 0x244543ee
+=======
+/// @dev the ERC-165 identifier for this interface is 0xcc97cb35
+>>>>>>> feat: Add custum signature with unlimited nesting.
 contract ERC721UniqueExtensions is Dummy, ERC165 {
 	/// @notice A descriptive name for a collection of NFTs in this contract
 	/// @dev EVM selector for this function is: 0x06fdde03,
@@ -708,7 +733,7 @@
 	///  operator of the current owner.
 	/// @param approved The new substrate address approved NFT controller
 	/// @param tokenId The NFT to approve
-	/// @dev EVM selector for this function is: 0x0ecd0ab0,
+	/// @dev EVM selector for this function is: 0x106fdb59,
 	///  or in textual repr: approveCross((address,uint256),uint256)
 	function approveCross(Tuple6 memory approved, uint256 tokenId) public {
 		require(false, stub_error);
@@ -738,10 +763,15 @@
 	/// @param to Cross acccount address of new owner
 	/// @param tokenId The NFT to transfer
 	/// @dev EVM selector for this function is: 0xd5cf430b,
-	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
+	///  or in textual repr: transferFromCross(EthCrossAccount,EthCrossAccount,uint256)
 	function transferFromCross(
+<<<<<<< HEAD
 		Tuple6 memory from,
 		Tuple6 memory to,
+=======
+		EthCrossAccount memory from,
+		EthCrossAccount memory to,
+>>>>>>> feat: Add custum signature with unlimited nesting.
 		uint256 tokenId
 	) public {
 		require(false, stub_error);
@@ -772,7 +802,7 @@
 	///  if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
 	/// @param from The current owner of the NFT
 	/// @param tokenId The NFT to transfer
-	/// @dev EVM selector for this function is: 0xbb2f5a58,
+	/// @dev EVM selector for this function is: 0xa8106d4a,
 	///  or in textual repr: burnFromCross((address,uint256),uint256)
 	function burnFromCross(Tuple6 memory from, uint256 tokenId) public {
 		require(false, stub_error);
@@ -819,10 +849,46 @@
 	// 	return false;
 	// }
 
+<<<<<<< HEAD
 }
 
 /// @dev anonymous struct
 struct Tuple8 {
+=======
+	/// @notice Function to mint multiple tokens.
+	/// @dev `tokenIds` should be an array of consecutive numbers and first number
+	///  should be obtained with `nextTokenId` method
+	/// @param to The new owner
+	/// @param tokenIds IDs of the minted NFTs
+	/// @dev EVM selector for this function is: 0xf9d9a5a3,
+	///  or in textual repr: mintBulk(address,uint256[])
+	function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {
+		require(false, stub_error);
+		to;
+		tokenIds;
+		dummy = 0;
+		return false;
+	}
+
+	/// @notice Function to mint multiple tokens with the given tokenUris.
+	/// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
+	///  numbers and first number should be obtained with `nextTokenId` method
+	/// @param to The new owner
+	/// @param tokens array of pairs of token ID and token URI for minted tokens
+	/// @dev EVM selector for this function is: 0xfd4e2a99,
+	///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
+	function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) public returns (bool) {
+		require(false, stub_error);
+		to;
+		tokens;
+		dummy = 0;
+		return false;
+	}
+}
+
+/// @dev anonymous struct
+struct Tuple12 {
+>>>>>>> feat: Add custum signature with unlimited nesting.
 	uint256 field_0;
 	string field_1;
 }
@@ -840,6 +906,12 @@
 >>>>>>> feat: add `EthCrossAccount` type
 }
 
+/// @dev anonymous struct
+struct Tuple8 {
+	address field_0;
+	uint256 field_1;
+}
+
 /// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 /// @dev See https://eips.ethereum.org/EIPS/eip-721
 /// @dev the ERC-165 identifier for this interface is 0x780e9d63
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -26,7 +26,15 @@
 	char::{REPLACEMENT_CHARACTER, decode_utf16},
 	convert::TryInto,
 };
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
+use evm_coder::{
+	ToLog,
+	execution::*,
+	generate_stubgen, solidity, solidity_interface,
+	types::*,
+	weight,
+	custom_signature::{FunctionName, FunctionSignature},
+	make_signature,
+};
 use frame_support::{BoundedBTreeMap, BoundedVec};
 use pallet_common::{
 	CollectionHandle, CollectionPropertyPermissions,
modifiedpallets/refungible/src/erc_token.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -29,7 +29,15 @@
 	convert::TryInto,
 	ops::Deref,
 };
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
+use evm_coder::{
+	ToLog,
+	execution::*,
+	generate_stubgen, solidity_interface,
+	types::*,
+	weight,
+	custom_signature::{FunctionName, FunctionSignature},
+	make_signature,
+};
 use pallet_common::{
 	CommonWeightInfo,
 	erc::{CommonEvmHandler, PrecompileResult},
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -18,7 +18,13 @@
 
 use core::marker::PhantomData;
 use ethereum as _;
-use evm_coder::{execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
+use evm_coder::{
+	execution::*,
+	generate_stubgen, solidity, solidity_interface,
+	types::*,
+	custom_signature::{FunctionName, FunctionSignature},
+	make_signature,
+, weight};
 use frame_support::{traits::Get, storage::StorageNMap};
 use crate::sp_api_hidden_includes_decl_storage::hidden_include::StorageDoubleMap;
 use crate::Pallet;
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -70,7 +70,11 @@
 }
 
 /// @title A contract that allows you to work with collections.
+<<<<<<< HEAD
 /// @dev the ERC-165 identifier for this interface is 0xb3152af3
+=======
+/// @dev the ERC-165 identifier for this interface is 0x674be726
+>>>>>>> feat: Add custum signature with unlimited nesting.
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -133,7 +137,7 @@
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
 	///
 	/// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.
-	/// @dev EVM selector for this function is: 0x84a1d5a8,
+	/// @dev EVM selector for this function is: 0x403e96a7,
 	///  or in textual repr: setCollectionSponsorCross((address,uint256))
 	function setCollectionSponsorCross(Tuple6 memory sponsor) external;
 
@@ -193,13 +197,13 @@
 
 	/// Add collection admin.
 	/// @param newAdmin Cross account administrator address.
-	/// @dev EVM selector for this function is: 0x859aa7d6,
+	/// @dev EVM selector for this function is: 0x62e3c7c2,
 	///  or in textual repr: addCollectionAdminCross((address,uint256))
 	function addCollectionAdminCross(Tuple6 memory newAdmin) external;
 
 	/// Remove collection admin.
 	/// @param admin Cross account administrator address.
-	/// @dev EVM selector for this function is: 0x6c0cd173,
+	/// @dev EVM selector for this function is: 0x810d1503,
 	///  or in textual repr: removeCollectionAdminCross((address,uint256))
 	function removeCollectionAdminCross(Tuple6 memory admin) external;
 
@@ -227,7 +231,7 @@
 	///
 	/// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
 	/// @param collections Addresses of collections that will be available for nesting.
-	/// @dev EVM selector for this function is: 0x64872396,
+	/// @dev EVM selector for this function is: 0x112d4586,
 	///  or in textual repr: setCollectionNesting(bool,address[])
 	function setCollectionNesting(bool enable, address[] memory collections) external;
 
@@ -256,7 +260,7 @@
 	/// Add user to allowed list.
 	///
 	/// @param user User cross account address.
-	/// @dev EVM selector for this function is: 0xa0184a3a,
+	/// @dev EVM selector for this function is: 0xf074da88,
 	///  or in textual repr: addToCollectionAllowListCross((address,uint256))
 	function addToCollectionAllowListCross(Tuple6 memory user) external;
 
@@ -270,7 +274,7 @@
 	/// Remove user from allowed list.
 	///
 	/// @param user User cross account address.
-	/// @dev EVM selector for this function is: 0x09ba452a,
+	/// @dev EVM selector for this function is: 0xc00df45c,
 	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))
 	function removeFromCollectionAllowListCross(Tuple6 memory user) external;
 
@@ -293,7 +297,7 @@
 	///
 	/// @param user User cross account to verify
 	/// @return "true" if account is the owner or admin
-	/// @dev EVM selector for this function is: 0x3e75a905,
+	/// @dev EVM selector for this function is: 0x5aba3351,
 	///  or in textual repr: isOwnerOrAdminCross((address,uint256))
 	function isOwnerOrAdminCross(Tuple6 memory user) external view returns (bool);
 
@@ -332,11 +336,12 @@
 	///
 	/// @dev Owner can be changed only by current owner
 	/// @param newOwner new owner cross account
-	/// @dev EVM selector for this function is: 0xe5c9913f,
+	/// @dev EVM selector for this function is: 0xbdff793d,
 	///  or in textual repr: setOwnerCross((address,uint256))
 	function setOwnerCross(Tuple6 memory newOwner) external;
 }
 
+<<<<<<< HEAD
 /// @dev anonymous struct
 struct Tuple19 {
 	address field_0;
@@ -373,6 +378,8 @@
 	function tokenURI(uint256 tokenId) external view returns (string memory);
 }
 
+=======
+>>>>>>> feat: Add custum signature with unlimited nesting.
 /// @title ERC721 Token that can be irreversibly burned (destroyed).
 /// @dev the ERC-165 identifier for this interface is 0x42966c68
 interface ERC721Burnable is Dummy, ERC165 {
@@ -438,7 +445,11 @@
 }
 
 /// @title Unique extensions for ERC721.
+<<<<<<< HEAD
 /// @dev the ERC-165 identifier for this interface is 0x244543ee
+=======
+/// @dev the ERC-165 identifier for this interface is 0xcc97cb35
+>>>>>>> feat: Add custum signature with unlimited nesting.
 interface ERC721UniqueExtensions is Dummy, ERC165 {
 	/// @notice A descriptive name for a collection of NFTs in this contract
 	/// @dev EVM selector for this function is: 0x06fdde03,
@@ -456,7 +467,7 @@
 	///  operator of the current owner.
 	/// @param approved The new substrate address approved NFT controller
 	/// @param tokenId The NFT to approve
-	/// @dev EVM selector for this function is: 0x0ecd0ab0,
+	/// @dev EVM selector for this function is: 0x106fdb59,
 	///  or in textual repr: approveCross((address,uint256),uint256)
 	function approveCross(Tuple6 memory approved, uint256 tokenId) external;
 
@@ -476,10 +487,15 @@
 	/// @param to Cross acccount address of new owner
 	/// @param tokenId The NFT to transfer
 	/// @dev EVM selector for this function is: 0xd5cf430b,
-	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
+	///  or in textual repr: transferFromCross(EthCrossAccount,EthCrossAccount,uint256)
 	function transferFromCross(
+<<<<<<< HEAD
 		Tuple6 memory from,
 		Tuple6 memory to,
+=======
+		EthCrossAccount memory from,
+		EthCrossAccount memory to,
+>>>>>>> feat: Add custum signature with unlimited nesting.
 		uint256 tokenId
 	) external;
 
@@ -499,7 +515,7 @@
 	///  if `to` is the zero address. Throws if `tokenId` is not a valid NFT.
 	/// @param from The current owner of the NFT
 	/// @param tokenId The NFT to transfer
-	/// @dev EVM selector for this function is: 0xbb2f5a58,
+	/// @dev EVM selector for this function is: 0xa8106d4a,
 	///  or in textual repr: burnFromCross((address,uint256),uint256)
 	function burnFromCross(Tuple6 memory from, uint256 tokenId) external;
 
@@ -507,6 +523,7 @@
 	/// @dev EVM selector for this function is: 0x75794a3c,
 	///  or in textual repr: nextTokenId()
 	function nextTokenId() external view returns (uint256);
+<<<<<<< HEAD
 	// /// @notice Function to mint multiple tokens.
 	// /// @dev `tokenIds` should be an array of consecutive numbers and first number
 	// ///  should be obtained with `nextTokenId` method
@@ -528,6 +545,30 @@
 
 /// @dev anonymous struct
 struct Tuple8 {
+=======
+
+	/// @notice Function to mint multiple tokens.
+	/// @dev `tokenIds` should be an array of consecutive numbers and first number
+	///  should be obtained with `nextTokenId` method
+	/// @param to The new owner
+	/// @param tokenIds IDs of the minted NFTs
+	/// @dev EVM selector for this function is: 0xf9d9a5a3,
+	///  or in textual repr: mintBulk(address,uint256[])
+	function mintBulk(address to, uint256[] memory tokenIds) external returns (bool);
+
+	/// @notice Function to mint multiple tokens with the given tokenUris.
+	/// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
+	///  numbers and first number should be obtained with `nextTokenId` method
+	/// @param to The new owner
+	/// @param tokens array of pairs of token ID and token URI for minted tokens
+	/// @dev EVM selector for this function is: 0xfd4e2a99,
+	///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
+	function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) external returns (bool);
+}
+
+/// @dev anonymous struct
+struct Tuple12 {
+>>>>>>> feat: Add custum signature with unlimited nesting.
 	uint256 field_0;
 	string field_1;
 }
@@ -538,6 +579,12 @@
 	uint256 field_1;
 }
 
+/// @dev anonymous struct
+struct Tuple8 {
+	address field_0;
+	uint256 field_1;
+}
+
 /// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 /// @dev See https://eips.ethereum.org/EIPS/eip-721
 /// @dev the ERC-165 identifier for this interface is 0x780e9d63
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -409,7 +409,7 @@
     expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));
   });
 
-  itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
+  itEth.only('Can perform transferFromCross()', async ({helper, privateKey}) => {
     const alice = privateKey('//Alice');
     const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
before · tests/src/eth/nonFungibleAbi.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "owner",9        "type": "address"10      },11      {12        "indexed": true,13        "internalType": "address",14        "name": "approved",15        "type": "address"16      },17      {18        "indexed": true,19        "internalType": "uint256",20        "name": "tokenId",21        "type": "uint256"22      }23    ],24    "name": "Approval",25    "type": "event"26  },27  {28    "anonymous": false,29    "inputs": [30      {31        "indexed": true,32        "internalType": "address",33        "name": "owner",34        "type": "address"35      },36      {37        "indexed": true,38        "internalType": "address",39        "name": "operator",40        "type": "address"41      },42      {43        "indexed": false,44        "internalType": "bool",45        "name": "approved",46        "type": "bool"47      }48    ],49    "name": "ApprovalForAll",50    "type": "event"51  },52  {53    "anonymous": false,54    "inputs": [],55    "name": "MintingFinished",56    "type": "event"57  },58  {59    "anonymous": false,60    "inputs": [61      {62        "indexed": true,63        "internalType": "address",64        "name": "from",65        "type": "address"66      },67      {68        "indexed": true,69        "internalType": "address",70        "name": "to",71        "type": "address"72      },73      {74        "indexed": true,75        "internalType": "uint256",76        "name": "tokenId",77        "type": "uint256"78      }79    ],80    "name": "Transfer",81    "type": "event"82  },83  {84    "inputs": [85      { "internalType": "address", "name": "newAdmin", "type": "address" }86    ],87    "name": "addCollectionAdmin",88    "outputs": [],89    "stateMutability": "nonpayable",90    "type": "function"91  },92  {93    "inputs": [94      {95        "components": [96          { "internalType": "address", "name": "field_0", "type": "address" },97          { "internalType": "uint256", "name": "field_1", "type": "uint256" }98        ],99        "internalType": "struct Tuple6",100        "name": "newAdmin",101        "type": "tuple"102      }103    ],104    "name": "addCollectionAdminCross",105    "outputs": [],106    "stateMutability": "nonpayable",107    "type": "function"108  },109  {110    "inputs": [111      { "internalType": "address", "name": "user", "type": "address" }112    ],113    "name": "addToCollectionAllowList",114    "outputs": [],115    "stateMutability": "nonpayable",116    "type": "function"117  },118  {119    "inputs": [120      {121        "components": [122          { "internalType": "address", "name": "field_0", "type": "address" },123          { "internalType": "uint256", "name": "field_1", "type": "uint256" }124        ],125        "internalType": "struct Tuple6",126        "name": "user",127        "type": "tuple"128      }129    ],130    "name": "addToCollectionAllowListCross",131    "outputs": [],132    "stateMutability": "nonpayable",133    "type": "function"134  },135  {136    "inputs": [137      { "internalType": "address", "name": "user", "type": "address" }138    ],139    "name": "allowed",140    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],141    "stateMutability": "view",142    "type": "function"143  },144  {145    "inputs": [146      { "internalType": "address", "name": "approved", "type": "address" },147      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }148    ],149    "name": "approve",150    "outputs": [],151    "stateMutability": "nonpayable",152    "type": "function"153  },154  {155    "inputs": [156      {157        "components": [158          { "internalType": "address", "name": "field_0", "type": "address" },159          { "internalType": "uint256", "name": "field_1", "type": "uint256" }160        ],161        "internalType": "struct Tuple6",162        "name": "approved",163        "type": "tuple"164      },165      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }166    ],167    "name": "approveCross",168    "outputs": [],169    "stateMutability": "nonpayable",170    "type": "function"171  },172  {173    "inputs": [174      { "internalType": "address", "name": "owner", "type": "address" }175    ],176    "name": "balanceOf",177    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],178    "stateMutability": "view",179    "type": "function"180  },181  {182    "inputs": [183      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }184    ],185    "name": "burn",186    "outputs": [],187    "stateMutability": "nonpayable",188    "type": "function"189  },190  {191    "inputs": [192      { "internalType": "address", "name": "from", "type": "address" },193      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }194    ],195    "name": "burnFrom",196    "outputs": [],197    "stateMutability": "nonpayable",198    "type": "function"199  },200  {201    "inputs": [202      {203        "components": [204          { "internalType": "address", "name": "field_0", "type": "address" },205          { "internalType": "uint256", "name": "field_1", "type": "uint256" }206        ],207        "internalType": "struct Tuple6",208        "name": "from",209        "type": "tuple"210      },211      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }212    ],213    "name": "burnFromCross",214    "outputs": [],215    "stateMutability": "nonpayable",216    "type": "function"217  },218  {219    "inputs": [220      { "internalType": "address", "name": "newOwner", "type": "address" }221    ],222    "name": "changeCollectionOwner",223    "outputs": [],224    "stateMutability": "nonpayable",225    "type": "function"226  },227  {228    "inputs": [],229    "name": "collectionAdmins",230    "outputs": [231      {232        "components": [233          { "internalType": "address", "name": "field_0", "type": "address" },234          { "internalType": "uint256", "name": "field_1", "type": "uint256" }235        ],236        "internalType": "struct Tuple6[]",237        "name": "",238        "type": "tuple[]"239      }240    ],241    "stateMutability": "view",242    "type": "function"243  },244  {245    "inputs": [],246    "name": "collectionOwner",247    "outputs": [248      {249        "components": [250          { "internalType": "address", "name": "field_0", "type": "address" },251          { "internalType": "uint256", "name": "field_1", "type": "uint256" }252        ],253<<<<<<< HEAD254        "internalType": "struct Tuple6",255=======256        "internalType": "struct Tuple19",257>>>>>>> feat: add `EthCrossAccount` type258        "name": "",259        "type": "tuple"260      }261    ],262    "stateMutability": "view",263    "type": "function"264  },265  {266    "inputs": [267      { "internalType": "string[]", "name": "keys", "type": "string[]" }268    ],269    "name": "collectionProperties",270    "outputs": [271      {272        "components": [273          { "internalType": "string", "name": "field_0", "type": "string" },274          { "internalType": "bytes", "name": "field_1", "type": "bytes" }275        ],276        "internalType": "struct Tuple19[]",277        "name": "",278        "type": "tuple[]"279      }280    ],281    "stateMutability": "view",282    "type": "function"283  },284  {285    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],286    "name": "collectionProperty",287    "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],288    "stateMutability": "view",289    "type": "function"290  },291  {292    "inputs": [],293    "name": "collectionSponsor",294    "outputs": [295      {296        "components": [297          { "internalType": "address", "name": "field_0", "type": "address" },298          { "internalType": "uint256", "name": "field_1", "type": "uint256" }299        ],300<<<<<<< HEAD301        "internalType": "struct Tuple6",302=======303        "internalType": "struct Tuple19",304>>>>>>> feat: add `EthCrossAccount` type305        "name": "",306        "type": "tuple"307      }308    ],309    "stateMutability": "view",310    "type": "function"311  },312  {313    "inputs": [],314    "name": "confirmCollectionSponsorship",315    "outputs": [],316    "stateMutability": "nonpayable",317    "type": "function"318  },319  {320    "inputs": [],321    "name": "contractAddress",322    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],323    "stateMutability": "view",324    "type": "function"325  },326  {327    "inputs": [328      { "internalType": "string[]", "name": "keys", "type": "string[]" }329    ],330    "name": "deleteCollectionProperties",331    "outputs": [],332    "stateMutability": "nonpayable",333    "type": "function"334  },335  {336    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],337    "name": "deleteCollectionProperty",338    "outputs": [],339    "stateMutability": "nonpayable",340    "type": "function"341  },342  {343    "inputs": [344      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },345      { "internalType": "string", "name": "key", "type": "string" }346    ],347    "name": "deleteProperty",348    "outputs": [],349    "stateMutability": "nonpayable",350    "type": "function"351  },352  {353    "inputs": [],354    "name": "finishMinting",355    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],356    "stateMutability": "nonpayable",357    "type": "function"358  },359  {360    "inputs": [361      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }362    ],363    "name": "getApproved",364    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],365    "stateMutability": "view",366    "type": "function"367  },368  {369    "inputs": [],370    "name": "hasCollectionPendingSponsor",371    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],372    "stateMutability": "view",373    "type": "function"374  },375  {376    "inputs": [377      { "internalType": "address", "name": "owner", "type": "address" },378      { "internalType": "address", "name": "operator", "type": "address" }379    ],380    "name": "isApprovedForAll",381    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],382    "stateMutability": "view",383    "type": "function"384  },385  {386    "inputs": [387      { "internalType": "address", "name": "user", "type": "address" }388    ],389    "name": "isOwnerOrAdmin",390    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],391    "stateMutability": "view",392    "type": "function"393  },394  {395    "inputs": [396      {397        "components": [398          { "internalType": "address", "name": "field_0", "type": "address" },399          { "internalType": "uint256", "name": "field_1", "type": "uint256" }400        ],401        "internalType": "struct Tuple6",402        "name": "user",403        "type": "tuple"404      }405    ],406    "name": "isOwnerOrAdminCross",407    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],408    "stateMutability": "view",409    "type": "function"410  },411  {412    "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],413    "name": "mint",414    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],415    "stateMutability": "nonpayable",416    "type": "function"417  },418  {419    "inputs": [420      { "internalType": "address", "name": "to", "type": "address" },421      { "internalType": "string", "name": "tokenUri", "type": "string" }422    ],423    "name": "mintWithTokenURI",424    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],425    "stateMutability": "nonpayable",426    "type": "function"427  },428  {429    "inputs": [],430    "name": "mintingFinished",431    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],432    "stateMutability": "view",433    "type": "function"434  },435  {436    "inputs": [],437    "name": "name",438    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],439    "stateMutability": "view",440    "type": "function"441  },442  {443    "inputs": [],444    "name": "nextTokenId",445    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],446    "stateMutability": "view",447    "type": "function"448  },449  {450    "inputs": [451      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }452    ],453    "name": "ownerOf",454    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],455    "stateMutability": "view",456    "type": "function"457  },458  {459    "inputs": [460      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },461      { "internalType": "string", "name": "key", "type": "string" }462    ],463    "name": "property",464    "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],465    "stateMutability": "view",466    "type": "function"467  },468  {469    "inputs": [470      { "internalType": "address", "name": "admin", "type": "address" }471    ],472    "name": "removeCollectionAdmin",473    "outputs": [],474    "stateMutability": "nonpayable",475    "type": "function"476  },477  {478    "inputs": [479      {480        "components": [481          { "internalType": "address", "name": "field_0", "type": "address" },482          { "internalType": "uint256", "name": "field_1", "type": "uint256" }483        ],484        "internalType": "struct Tuple6",485        "name": "admin",486        "type": "tuple"487      }488    ],489    "name": "removeCollectionAdminCross",490    "outputs": [],491    "stateMutability": "nonpayable",492    "type": "function"493  },494  {495    "inputs": [],496    "name": "removeCollectionSponsor",497    "outputs": [],498    "stateMutability": "nonpayable",499    "type": "function"500  },501  {502    "inputs": [503      { "internalType": "address", "name": "user", "type": "address" }504    ],505    "name": "removeFromCollectionAllowList",506    "outputs": [],507    "stateMutability": "nonpayable",508    "type": "function"509  },510  {511    "inputs": [512      {513        "components": [514          { "internalType": "address", "name": "field_0", "type": "address" },515          { "internalType": "uint256", "name": "field_1", "type": "uint256" }516        ],517        "internalType": "struct Tuple6",518        "name": "user",519        "type": "tuple"520      }521    ],522    "name": "removeFromCollectionAllowListCross",523    "outputs": [],524    "stateMutability": "nonpayable",525    "type": "function"526  },527  {528    "inputs": [529      { "internalType": "address", "name": "from", "type": "address" },530      { "internalType": "address", "name": "to", "type": "address" },531      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }532    ],533    "name": "safeTransferFrom",534    "outputs": [],535    "stateMutability": "nonpayable",536    "type": "function"537  },538  {539    "inputs": [540      { "internalType": "address", "name": "from", "type": "address" },541      { "internalType": "address", "name": "to", "type": "address" },542      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },543      { "internalType": "bytes", "name": "data", "type": "bytes" }544    ],545    "name": "safeTransferFrom",546    "outputs": [],547    "stateMutability": "nonpayable",548    "type": "function"549  },550  {551    "inputs": [552      { "internalType": "address", "name": "operator", "type": "address" },553      { "internalType": "bool", "name": "approved", "type": "bool" }554    ],555    "name": "setApprovalForAll",556    "outputs": [],557    "stateMutability": "nonpayable",558    "type": "function"559  },560  {561    "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],562    "name": "setCollectionAccess",563    "outputs": [],564    "stateMutability": "nonpayable",565    "type": "function"566  },567  {568    "inputs": [569      { "internalType": "string", "name": "limit", "type": "string" },570      { "internalType": "uint32", "name": "value", "type": "uint32" }571    ],572    "name": "setCollectionLimit",573    "outputs": [],574    "stateMutability": "nonpayable",575    "type": "function"576  },577  {578    "inputs": [579      { "internalType": "string", "name": "limit", "type": "string" },580      { "internalType": "bool", "name": "value", "type": "bool" }581    ],582    "name": "setCollectionLimit",583    "outputs": [],584    "stateMutability": "nonpayable",585    "type": "function"586  },587  {588    "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],589    "name": "setCollectionMintMode",590    "outputs": [],591    "stateMutability": "nonpayable",592    "type": "function"593  },594  {595    "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],596    "name": "setCollectionNesting",597    "outputs": [],598    "stateMutability": "nonpayable",599    "type": "function"600  },601  {602    "inputs": [603      { "internalType": "bool", "name": "enable", "type": "bool" },604      {605        "internalType": "address[]",606        "name": "collections",607        "type": "address[]"608      }609    ],610    "name": "setCollectionNesting",611    "outputs": [],612    "stateMutability": "nonpayable",613    "type": "function"614  },615  {616    "inputs": [617      {618        "components": [619          { "internalType": "string", "name": "field_0", "type": "string" },620          { "internalType": "bytes", "name": "field_1", "type": "bytes" }621        ],622        "internalType": "struct Tuple19[]",623        "name": "properties",624        "type": "tuple[]"625      }626    ],627    "name": "setCollectionProperties",628    "outputs": [],629    "stateMutability": "nonpayable",630    "type": "function"631  },632  {633    "inputs": [634      { "internalType": "string", "name": "key", "type": "string" },635      { "internalType": "bytes", "name": "value", "type": "bytes" }636    ],637    "name": "setCollectionProperty",638    "outputs": [],639    "stateMutability": "nonpayable",640    "type": "function"641  },642  {643    "inputs": [644      { "internalType": "address", "name": "sponsor", "type": "address" }645    ],646    "name": "setCollectionSponsor",647    "outputs": [],648    "stateMutability": "nonpayable",649    "type": "function"650  },651  {652    "inputs": [653      {654        "components": [655          { "internalType": "address", "name": "field_0", "type": "address" },656          { "internalType": "uint256", "name": "field_1", "type": "uint256" }657        ],658        "internalType": "struct Tuple6",659        "name": "sponsor",660        "type": "tuple"661      }662    ],663    "name": "setCollectionSponsorCross",664    "outputs": [],665    "stateMutability": "nonpayable",666    "type": "function"667  },668  {669    "inputs": [670      {671        "components": [672          { "internalType": "address", "name": "field_0", "type": "address" },673          { "internalType": "uint256", "name": "field_1", "type": "uint256" }674        ],675        "internalType": "struct Tuple6",676        "name": "newOwner",677        "type": "tuple"678      }679    ],680    "name": "setOwnerCross",681    "outputs": [],682    "stateMutability": "nonpayable",683    "type": "function"684  },685  {686    "inputs": [687      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },688      {689        "components": [690          { "internalType": "string", "name": "field_0", "type": "string" },691          { "internalType": "bytes", "name": "field_1", "type": "bytes" }692        ],693        "internalType": "struct Tuple19[]",694        "name": "properties",695        "type": "tuple[]"696      }697    ],698    "name": "setProperties",699    "outputs": [],700    "stateMutability": "nonpayable",701    "type": "function"702  },703  {704    "inputs": [705      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },706      { "internalType": "string", "name": "key", "type": "string" },707      { "internalType": "bytes", "name": "value", "type": "bytes" }708    ],709    "name": "setProperty",710    "outputs": [],711    "stateMutability": "nonpayable",712    "type": "function"713  },714  {715    "inputs": [716      { "internalType": "string", "name": "key", "type": "string" },717      { "internalType": "bool", "name": "isMutable", "type": "bool" },718      { "internalType": "bool", "name": "collectionAdmin", "type": "bool" },719      { "internalType": "bool", "name": "tokenOwner", "type": "bool" }720    ],721    "name": "setTokenPropertyPermission",722    "outputs": [],723    "stateMutability": "nonpayable",724    "type": "function"725  },726  {727    "inputs": [728      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }729    ],730    "name": "supportsInterface",731    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],732    "stateMutability": "view",733    "type": "function"734  },735  {736    "inputs": [],737    "name": "symbol",738    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],739    "stateMutability": "view",740    "type": "function"741  },742  {743    "inputs": [744      { "internalType": "uint256", "name": "index", "type": "uint256" }745    ],746    "name": "tokenByIndex",747    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],748    "stateMutability": "view",749    "type": "function"750  },751  {752    "inputs": [753      { "internalType": "address", "name": "owner", "type": "address" },754      { "internalType": "uint256", "name": "index", "type": "uint256" }755    ],756    "name": "tokenOfOwnerByIndex",757    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],758    "stateMutability": "view",759    "type": "function"760  },761  {762    "inputs": [763      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }764    ],765    "name": "tokenURI",766    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],767    "stateMutability": "view",768    "type": "function"769  },770  {771    "inputs": [],772    "name": "totalSupply",773    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],774    "stateMutability": "view",775    "type": "function"776  },777  {778    "inputs": [779      { "internalType": "address", "name": "to", "type": "address" },780      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }781    ],782    "name": "transfer",783    "outputs": [],784    "stateMutability": "nonpayable",785    "type": "function"786  },787  {788    "inputs": [789      { "internalType": "address", "name": "from", "type": "address" },790      { "internalType": "address", "name": "to", "type": "address" },791      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }792    ],793    "name": "transferFrom",794    "outputs": [],795    "stateMutability": "nonpayable",796    "type": "function"797  },798  {799    "inputs": [800      {801        "components": [802          { "internalType": "address", "name": "field_0", "type": "address" },803          { "internalType": "uint256", "name": "field_1", "type": "uint256" }804        ],805<<<<<<< HEAD806        "internalType": "struct Tuple6",807=======808        "internalType": "struct EthCrossAccount",809>>>>>>> feat: add `EthCrossAccount` type810        "name": "from",811        "type": "tuple"812      },813      {814        "components": [815          { "internalType": "address", "name": "field_0", "type": "address" },816          { "internalType": "uint256", "name": "field_1", "type": "uint256" }817        ],818<<<<<<< HEAD819        "internalType": "struct Tuple6",820=======821        "internalType": "struct EthCrossAccount",822>>>>>>> feat: add `EthCrossAccount` type823        "name": "to",824        "type": "tuple"825      },826      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }827    ],828    "name": "transferFromCross",829    "outputs": [],830    "stateMutability": "nonpayable",831    "type": "function"832  },833  {834    "inputs": [],835    "name": "uniqueCollectionType",836    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],837    "stateMutability": "view",838    "type": "function"839  }840]
modifiedtests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -14,10 +14,8 @@
   args: { [key: string]: string }
 };
 export interface TEthCrossAccount {
-  readonly 0: string,
-  readonly 1: string | Uint8Array,
-  readonly field_0: string,
-  readonly field_1: string | Uint8Array,
+  readonly eth: string,
+  readonly sub: string | Uint8Array,
 }
 
 export type EthProperty = string[];
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -364,19 +364,15 @@
 export class EthCrossAccountGroup extends EthGroupBase {
   fromAddress(address: TEthereumAccount): TEthCrossAccount {
     return {
-      0: address,
-      1: '0',
-      field_0: address,
-      field_1: '0',
+      eth: address,
+      sub: '0',
     };
   }
 
   fromKeyringPair(keyring: IKeyringPair): TEthCrossAccount {
     return {
-      0: '0x0000000000000000000000000000000000000000',
-      1: keyring.addressRaw,
-      field_0: '0x0000000000000000000000000000000000000000',
-      field_1: keyring.addressRaw,
+      eth: '0x0000000000000000000000000000000000000000',
+      sub: keyring.addressRaw,
     };
   }
 }
@@ -429,7 +425,6 @@
   ethAddress: EthAddressGroup;
   ethNativeContract: NativeContractGroup;
   ethContract: ContractGroup;
-  ethCrossAccount: EthCrossAccountGroup;
   ethProperty: EthPropertyGroup;
 
   constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {