git.delta.rocks / unique-network / refs/commits / 88bdff8cd1db

difftreelog

Merge pull request #681 from UniqueNetwork/eth_temp_develop

Yaroslav Bolyukin2022-10-26parents: #bb1e6df #157c26f.patch.diff
in: master
Eth temp develop

59 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -746,7 +746,9 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
 dependencies = [
+ "lazy_static",
  "memchr",
+ "regex-automata",
 ]
 
 [[package]]
@@ -1055,6 +1057,16 @@
 ]
 
 [[package]]
+name = "concat-idents"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4b6f90860248d75014b7b103db8fee4f291c07bfb41306cdf77a0a5ab7a10d2f"
+dependencies = [
+ "quote",
+ "syn",
+]
+
+[[package]]
 name = "concurrent-queue"
 version = "1.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1064,6 +1076,19 @@
 ]
 
 [[package]]
+name = "console"
+version = "0.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c"
+dependencies = [
+ "encode_unicode",
+ "lazy_static",
+ "libc",
+ "terminal_size",
+ "winapi",
+]
+
+[[package]]
 name = "const-oid"
 version = "0.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1846,9 +1871,9 @@
 
 [[package]]
 name = "cxx"
-version = "1.0.79"
+version = "1.0.78"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8"
+checksum = "19f39818dcfc97d45b03953c1292efc4e80954e1583c4aa770bac1383e2310a4"
 dependencies = [
  "cc",
  "cxxbridge-flags",
@@ -1858,9 +1883,9 @@
 
 [[package]]
 name = "cxx-build"
-version = "1.0.79"
+version = "1.0.78"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86"
+checksum = "3e580d70777c116df50c390d1211993f62d40302881e54d4b79727acb83d0199"
 dependencies = [
  "cc",
  "codespan-reporting",
@@ -1873,15 +1898,15 @@
 
 [[package]]
 name = "cxxbridge-flags"
-version = "1.0.79"
+version = "1.0.78"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78"
+checksum = "56a46460b88d1cec95112c8c363f0e2c39afdb237f60583b0b36343bf627ea9c"
 
 [[package]]
 name = "cxxbridge-macro"
-version = "1.0.79"
+version = "1.0.78"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f"
+checksum = "747b608fecf06b0d72d440f27acc99288207324b793be2c17991839f3d4995ea"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -2140,6 +2165,12 @@
 ]
 
 [[package]]
+name = "encode_unicode"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
+
+[[package]]
 name = "enum-as-inner"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2302,6 +2333,7 @@
 name = "evm-coder"
 version = "0.1.3"
 dependencies = [
+ "concat-idents",
  "ethereum",
  "evm-coder-procedural",
  "evm-core",
@@ -2310,6 +2342,7 @@
  "hex-literal",
  "impl-trait-for-tuples",
  "primitive-types",
+ "similar-asserts",
  "sp-std",
 ]
 
@@ -3528,9 +3561,9 @@
 
 [[package]]
 name = "iana-time-zone-haiku"
-version = "0.1.1"
+version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
+checksum = "fde6edd6cef363e9359ed3c98ba64590ba9eecba2293eb5a723ab32aee8926aa"
 dependencies = [
  "cxx",
  "cxx-build",
@@ -5792,7 +5825,7 @@
 
 [[package]]
 name = "pallet-common"
-version = "0.1.8"
+version = "0.1.9"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -6325,7 +6358,7 @@
 
 [[package]]
 name = "pallet-nonfungible"
-version = "0.1.5"
+version = "0.1.6"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -6447,7 +6480,7 @@
 
 [[package]]
 name = "pallet-refungible"
-version = "0.2.4"
+version = "0.2.5"
 dependencies = [
  "derivative",
  "ethereum",
@@ -6766,7 +6799,7 @@
 
 [[package]]
 name = "pallet-unique"
-version = "0.2.0"
+version = "0.2.1"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -10741,9 +10774,9 @@
 
 [[package]]
 name = "serde_json"
-version = "1.0.87"
+version = "1.0.86"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
+checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074"
 dependencies = [
  "itoa",
  "ryu",
@@ -10886,6 +10919,26 @@
 ]
 
 [[package]]
+name = "similar"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62ac7f900db32bf3fd12e0117dd3dc4da74bc52ebaac97f39668446d89694803"
+dependencies = [
+ "bstr",
+ "unicode-segmentation",
+]
+
+[[package]]
+name = "similar-asserts"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbf644ad016b75129f01a34a355dcb8d66a5bc803e417c7a77cc5d5ee9fa0f18"
+dependencies = [
+ "console",
+ "similar",
+]
+
+[[package]]
 name = "slab"
 version = "0.4.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -12002,9 +12055,9 @@
 
 [[package]]
 name = "syn"
-version = "1.0.103"
+version = "1.0.102"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
+checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -12080,6 +12133,16 @@
 ]
 
 [[package]]
+name = "terminal_size"
+version = "0.1.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
+dependencies = [
+ "libc",
+ "winapi",
+]
+
+[[package]]
 name = "test-runtime-constants"
 version = "0.9.30"
 source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a"
@@ -12660,6 +12723,12 @@
 ]
 
 [[package]]
+name = "unicode-segmentation"
+version = "1.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
+
+[[package]]
 name = "unicode-width"
 version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
modifiedcrates/evm-coder/Cargo.tomldiffbeforeafterboth
--- a/crates/evm-coder/Cargo.toml
+++ b/crates/evm-coder/Cargo.toml
@@ -14,7 +14,7 @@
 sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
 frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
 # Error types for execution
-evm-core = { default-features = false , git = "https://github.com/uniquenetwork/evm", branch = "unique-polkadot-v0.9.30" }
+evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm", branch = "unique-polkadot-v0.9.30" }
 # We have tuple-heavy code in solidity.rs
 impl-trait-for-tuples = "0.2.2"
 
@@ -22,7 +22,14 @@
 # We want to assert some large binary blobs equality in tests
 hex = "0.4.3"
 hex-literal = "0.3.4"
+similar-asserts = "1.4.2"
+concat-idents = "1.1.3"
 
 [features]
 default = ["std"]
-std = ["ethereum/std", "primitive-types/std", "evm-core/std", "frame-support/std"]
+std = [
+    "ethereum/std",
+    "primitive-types/std",
+    "evm-core/std",
+    "frame-support/std",
+]
modifiedcrates/evm-coder/src/abi.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -25,14 +25,18 @@
 
 use crate::{
 	execution::{Error, ResultWithPostInfo, WithPostDispatchInfo},
-	types::{string, self},
+	types::*,
 };
 use crate::execution::Result;
 
 const ABI_ALIGNMENT: usize = 32;
 
 trait TypeHelper {
+	/// Is type dynamic sized.
 	fn is_dynamic() -> bool;
+
+	/// Size for type aligned to [`ABI_ALIGNMENT`].
+	fn size() -> usize;
 }
 
 /// View into RLP data, which provides method to read typed items from it
@@ -52,7 +56,7 @@
 		}
 	}
 	/// Start reading RLP buffer, parsing first 4 bytes as selector
-	pub fn new_call(buf: &'i [u8]) -> Result<(types::bytes4, Self)> {
+	pub fn new_call(buf: &'i [u8]) -> Result<(bytes4, Self)> {
 		if buf.len() < 4 {
 			return Err(Error::Error(ExitError::OutOfOffset));
 		}
@@ -218,12 +222,21 @@
 	static_part: Vec<u8>,
 	dynamic_part: Vec<(usize, AbiWriter)>,
 	had_call: bool,
+	is_dynamic: bool,
 }
 impl AbiWriter {
 	/// Initialize internal buffers for output data, assuming no padding required
 	pub fn new() -> Self {
 		Self::default()
 	}
+
+	/// Initialize internal buffers with data size
+	pub fn new_dynamic(is_dynamic: bool) -> Self {
+		Self {
+			is_dynamic,
+			..Default::default()
+		}
+	}
 	/// Initialize internal buffers, inserting method selector at beginning
 	pub fn new_call(method_id: u32) -> Self {
 		let mut val = Self::new();
@@ -239,11 +252,11 @@
 		self.static_part.extend(block);
 	}
 
-	fn write_padright(&mut self, bytes: &[u8]) {
-		assert!(bytes.len() <= ABI_ALIGNMENT);
-		self.static_part.extend(bytes);
+	fn write_padright(&mut self, block: &[u8]) {
+		assert!(block.len() <= ABI_ALIGNMENT);
+		self.static_part.extend(block);
 		self.static_part
-			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - bytes.len()]);
+			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - block.len()]);
 	}
 
 	/// Write [`H160`] to end of buffer
@@ -313,12 +326,14 @@
 	/// Finish writer, concatenating all internal buffers
 	pub fn finish(mut self) -> Vec<u8> {
 		for (static_offset, part) in self.dynamic_part {
-			let part_offset = self.static_part.len() - if self.had_call { 4 } else { 0 };
+			let part_offset = self.static_part.len()
+				- if self.had_call { 4 } else { 0 }
+				- if self.is_dynamic { ABI_ALIGNMENT } else { 0 };
 
 			let encoded_dynamic_offset = usize::to_be_bytes(part_offset);
-			self.static_part[static_offset + ABI_ALIGNMENT - encoded_dynamic_offset.len()
-				..static_offset + ABI_ALIGNMENT]
-				.copy_from_slice(&encoded_dynamic_offset);
+			let start = static_offset + ABI_ALIGNMENT - encoded_dynamic_offset.len();
+			let stop = static_offset + ABI_ALIGNMENT;
+			self.static_part[start..stop].copy_from_slice(&encoded_dynamic_offset);
 			self.static_part.extend(part.finish())
 		}
 		self.static_part
@@ -333,9 +348,6 @@
 pub trait AbiRead<T> {
 	/// Read item from current position, advanding decoder
 	fn abi_read(&mut self) -> Result<T>;
-
-	/// Size for type aligned to [`ABI_ALIGNMENT`].
-	fn size() -> usize;
 }
 
 macro_rules! impl_abi_readable {
@@ -344,29 +356,43 @@
 			fn is_dynamic() -> bool {
 				$dynamic
 			}
+
+			fn size() -> usize {
+				ABI_ALIGNMENT
+			}
 		}
 		impl AbiRead<$ty> for AbiReader<'_> {
 			fn abi_read(&mut self) -> Result<$ty> {
 				self.$method()
-			}
-
-			fn size() -> usize {
-				ABI_ALIGNMENT
 			}
 		}
 	};
 }
 
-impl_abi_readable!(u8, uint8, false);
-impl_abi_readable!(u32, uint32, false);
-impl_abi_readable!(u64, uint64, false);
-impl_abi_readable!(u128, uint128, false);
-impl_abi_readable!(U256, uint256, false);
-impl_abi_readable!([u8; 4], bytes4, false);
-impl_abi_readable!(H160, address, false);
-impl_abi_readable!(Vec<u8>, bytes, true);
-impl_abi_readable!(bool, bool, true);
+impl_abi_readable!(bool, bool, false);
+impl_abi_readable!(uint8, uint8, false);
+impl_abi_readable!(uint32, uint32, false);
+impl_abi_readable!(uint64, uint64, false);
+impl_abi_readable!(uint128, uint128, false);
+impl_abi_readable!(uint256, uint256, false);
+impl_abi_readable!(bytes4, bytes4, false);
+impl_abi_readable!(address, address, false);
 impl_abi_readable!(string, string, true);
+// impl_abi_readable!(bytes, bytes, true);
+
+impl TypeHelper for bytes {
+	fn is_dynamic() -> bool {
+		true
+	}
+	fn size() -> usize {
+		ABI_ALIGNMENT
+	}
+}
+impl AbiRead<bytes> for AbiReader<'_> {
+	fn abi_read(&mut self) -> Result<bytes> {
+		Ok(bytes(self.bytes()?))
+	}
+}
 
 mod sealed {
 	/// Not all types can be placed in vec, i.e `Vec<u8>` is restricted, `bytes` should be used instead
@@ -390,22 +416,27 @@
 			out.push(<Self as AbiRead<R>>::abi_read(&mut sub)?);
 		}
 		Ok(out)
-	}
-
-	fn size() -> usize {
-		ABI_ALIGNMENT
 	}
 }
 
 macro_rules! impl_tuples {
 	($($ident:ident)+) => {
-		impl<$($ident: TypeHelper,)+> TypeHelper for ($($ident,)+) {
+		impl<$($ident: TypeHelper,)+> TypeHelper for ($($ident,)+)
+		where
+			$(
+				$ident: TypeHelper,
+			)+
+		{
 			fn is_dynamic() -> bool {
 				false
 				$(
 					|| <$ident>::is_dynamic()
 				)*
 			}
+
+			fn size() -> usize {
+				0 $(+ <$ident>::size())+
+			}
 		}
 		impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}
 		impl<$($ident),+> AbiRead<($($ident,)+)> for AbiReader<'_>
@@ -416,25 +447,27 @@
 			($($ident,)+): TypeHelper,
 		{
 			fn abi_read(&mut self) -> Result<($($ident,)+)> {
-				let size = if !<($($ident,)+)>::is_dynamic() { Some(<Self as AbiRead<($($ident,)+)>>::size()) } else { None };
+				let size = if !<($($ident,)+)>::is_dynamic() { Some(<($($ident,)+)>::size()) } else { None };
 				let mut subresult = self.subresult(size)?;
 				Ok((
 					$(<Self as AbiRead<$ident>>::abi_read(&mut subresult)?,)+
 				))
-			}
-
-			fn size() -> usize {
-				0 $(+ <AbiReader<'_> as AbiRead<$ident>>::size())+
 			}
 		}
 		#[allow(non_snake_case)]
-		impl<$($ident),+> AbiWrite for &($($ident,)+)
+		impl<$($ident),+> AbiWrite for ($($ident,)+)
 		where
 			$($ident: AbiWrite,)+
 		{
 			fn abi_write(&self, writer: &mut AbiWriter) {
 				let ($($ident,)+) = self;
-				$($ident.abi_write(writer);)+
+				if writer.is_dynamic {
+					let mut sub = AbiWriter::new();
+					$($ident.abi_write(&mut sub);)+
+					writer.write_subresult(sub);
+				} else {
+					$($ident.abi_write(writer);)+
+				}
 			}
 		}
 	};
@@ -505,14 +538,35 @@
 impl_abi_writeable!(H160, address);
 impl_abi_writeable!(bool, bool);
 impl_abi_writeable!(&str, string);
-impl AbiWrite for &string {
+
+impl AbiWrite for string {
 	fn abi_write(&self, writer: &mut AbiWriter) {
 		writer.string(self)
 	}
 }
-impl AbiWrite for &Vec<u8> {
+
+impl AbiWrite for bytes {
+	fn abi_write(&self, writer: &mut AbiWriter) {
+		writer.bytes(self.0.as_slice())
+	}
+}
+
+impl<T: AbiWrite + TypeHelper> AbiWrite for Vec<T> {
 	fn abi_write(&self, writer: &mut AbiWriter) {
-		writer.bytes(self)
+		let is_dynamic = T::is_dynamic();
+		let mut sub = if is_dynamic {
+			AbiWriter::new_dynamic(is_dynamic)
+		} else {
+			AbiWriter::new()
+		};
+
+		// Write items count
+		(self.len() as u32).abi_write(&mut sub);
+
+		for item in self {
+			item.abi_write(&mut sub);
+		}
+		writer.write_subresult(sub);
 	}
 }
 
@@ -556,13 +610,145 @@
 #[cfg(test)]
 pub mod test {
 	use crate::{
-		abi::AbiRead,
-		types::{string, uint256},
+		abi::{AbiRead, AbiWrite},
+		types::*,
 	};
 
 	use super::{AbiReader, AbiWriter};
 	use hex_literal::hex;
+	use primitive_types::{H160, U256};
+	use concat_idents::concat_idents;
+
+	macro_rules! test_impl {
+		($name:ident, $type:ty, $function_identifier:expr, $decoded_data:expr, $encoded_data:expr) => {
+			concat_idents!(test_name = encode_decode_, $name {
+				#[test]
+				fn test_name() {
+					let function_identifier: u32 = $function_identifier;
+					let decoded_data = $decoded_data;
+					let encoded_data = $encoded_data;
+
+					let (call, mut decoder) = AbiReader::new_call(encoded_data).unwrap();
+					assert_eq!(call, u32::to_be_bytes(function_identifier));
+					let data = <AbiReader<'_> as AbiRead<$type>>::abi_read(&mut decoder).unwrap();
+					assert_eq!(data, decoded_data);
+
+					let mut writer = AbiWriter::new_call(function_identifier);
+					decoded_data.abi_write(&mut writer);
+					let ed = writer.finish();
+					similar_asserts::assert_eq!(encoded_data, ed.as_slice());
+				}
+			});
+		};
+	}
+
+	macro_rules! test_impl_uint {
+		($type:ident) => {
+			test_impl!(
+				$type,
+				$type,
+				0xdeadbeef,
+				255 as $type,
+				&hex!(
+					"
+						deadbeef
+						00000000000000000000000000000000000000000000000000000000000000ff
+					"
+				)
+			);
+		};
+	}
+
+	test_impl_uint!(uint8);
+	test_impl_uint!(uint32);
+	test_impl_uint!(uint128);
+
+	test_impl!(
+		uint256,
+		uint256,
+		0xdeadbeef,
+		U256([255, 0, 0, 0]),
+		&hex!(
+			"
+				deadbeef
+				00000000000000000000000000000000000000000000000000000000000000ff
+			"
+		)
+	);
+
+	test_impl!(
+		vec_tuple_address_uint256,
+		Vec<(address, uint256)>,
+		0x1ACF2D55,
+		vec![
+			(
+				H160(hex!("2D2FF76104B7BACB2E8F6731D5BFC184EBECDDBC")),
+				U256([10, 0, 0, 0]),
+			),
+			(
+				H160(hex!("AB8E3D9134955566483B11E6825C9223B6737B10")),
+				U256([20, 0, 0, 0]),
+			),
+			(
+				H160(hex!("8C582BDF2953046705FC56F189385255EFC1BE18")),
+				U256([30, 0, 0, 0]),
+			),
+		],
+		&hex!(
+			"
+				1ACF2D55
+				0000000000000000000000000000000000000000000000000000000000000020 // offset of (address, uint256)[]
+				0000000000000000000000000000000000000000000000000000000000000003 // length of (address, uint256)[]
+	
+				0000000000000000000000002D2FF76104B7BACB2E8F6731D5BFC184EBECDDBC // address
+				000000000000000000000000000000000000000000000000000000000000000A // uint256
+	
+				000000000000000000000000AB8E3D9134955566483B11E6825C9223B6737B10 // address
+				0000000000000000000000000000000000000000000000000000000000000014 // uint256
+	
+				0000000000000000000000008C582BDF2953046705FC56F189385255EFC1BE18 // address
+				000000000000000000000000000000000000000000000000000000000000001E // uint256
+			"
+		)
+	);
+
+	test_impl!(
+		vec_tuple_uint256_string,
+		Vec<(uint256, string)>,
+		0xdeadbeef,
+		vec![
+			(1.into(), "Test URI 0".to_string()),
+			(11.into(), "Test URI 1".to_string()),
+			(12.into(), "Test URI 2".to_string()),
+		],
+		&hex!(
+			"
+				deadbeef
+				0000000000000000000000000000000000000000000000000000000000000020 // offset of (uint256, string)[]
+				0000000000000000000000000000000000000000000000000000000000000003 // length of (uint256, string)[]
+
+				0000000000000000000000000000000000000000000000000000000000000060 // offset of first elem
+				00000000000000000000000000000000000000000000000000000000000000e0 // offset of second elem
+				0000000000000000000000000000000000000000000000000000000000000160 // offset of third elem
+
+				0000000000000000000000000000000000000000000000000000000000000001 // first token id?   					#60
+				0000000000000000000000000000000000000000000000000000000000000040 // offset of string
+				000000000000000000000000000000000000000000000000000000000000000a // size of string
+				5465737420555249203000000000000000000000000000000000000000000000 // string
+
+				000000000000000000000000000000000000000000000000000000000000000b // second token id? Why ==11?			#e0
+				0000000000000000000000000000000000000000000000000000000000000040 // offset of string
+				000000000000000000000000000000000000000000000000000000000000000a // size of string
+				5465737420555249203100000000000000000000000000000000000000000000 // string
 
+				000000000000000000000000000000000000000000000000000000000000000c // third token id?  Why ==12?			#160
+				0000000000000000000000000000000000000000000000000000000000000040 // offset of string
+				000000000000000000000000000000000000000000000000000000000000000a // size of string
+				5465737420555249203200000000000000000000000000000000000000000000 // string
+			"
+		)
+	);
+
 	#[test]
 	fn dynamic_after_static() {
 		let mut encoder = AbiWriter::new();
@@ -609,8 +795,17 @@
 	}
 
 	#[test]
-	fn mint_bulk() {
-		let (call, mut decoder) = AbiReader::new_call(&hex!(
+	fn parse_vec_with_dynamic_type() {
+		let decoded_data = (
+			0x36543006,
+			vec![
+				(1.into(), "Test URI 0".to_string()),
+				(11.into(), "Test URI 1".to_string()),
+				(12.into(), "Test URI 2".to_string()),
+			],
+		);
+
+		let encoded_data = &hex!(
 			"
 				36543006
 				00000000000000000000000053744e6da587ba10b32a2554d2efdcd985bc27a3 // address
@@ -636,64 +831,19 @@
 				000000000000000000000000000000000000000000000000000000000000000a // size of string
 				5465737420555249203200000000000000000000000000000000000000000000 // string
 			"
-		))
-		.unwrap();
-		assert_eq!(call, u32::to_be_bytes(0x36543006));
-		let _ = decoder.address().unwrap();
+		);
+
+		let (call, mut decoder) = AbiReader::new_call(encoded_data).unwrap();
+		assert_eq!(call, u32::to_be_bytes(decoded_data.0));
+		let address = decoder.address().unwrap();
 		let data =
 			<AbiReader<'_> as AbiRead<Vec<(uint256, string)>>>::abi_read(&mut decoder).unwrap();
-		assert_eq!(
-			data,
-			vec![
-				(1.into(), "Test URI 0".to_string()),
-				(11.into(), "Test URI 1".to_string()),
-				(12.into(), "Test URI 2".to_string())
-			]
-		);
-	}
+		assert_eq!(data, decoded_data.1);
 
-	#[test]
-	fn parse_vec_with_simple_type() {
-		use crate::types::address;
-		use primitive_types::{H160, U256};
-
-		let (call, mut decoder) = AbiReader::new_call(&hex!(
-			"
-				1ACF2D55
-				0000000000000000000000000000000000000000000000000000000000000020 // offset of (address, uint256)[]
-				0000000000000000000000000000000000000000000000000000000000000003 // length of (address, uint256)[]
-
-				0000000000000000000000002D2FF76104B7BACB2E8F6731D5BFC184EBECDDBC // address
-				000000000000000000000000000000000000000000000000000000000000000A // uint256
-
-				000000000000000000000000AB8E3D9134955566483B11E6825C9223B6737B10 // address
-				0000000000000000000000000000000000000000000000000000000000000014 // uint256
-
-				0000000000000000000000008C582BDF2953046705FC56F189385255EFC1BE18 // address
-				000000000000000000000000000000000000000000000000000000000000001E // uint256
-			"
-		))
-		.unwrap();
-		assert_eq!(call, u32::to_be_bytes(0x1ACF2D55));
-		let data =
-			<AbiReader<'_> as AbiRead<Vec<(address, uint256)>>>::abi_read(&mut decoder).unwrap();
-		assert_eq!(data.len(), 3);
-		assert_eq!(
-			data,
-			vec![
-				(
-					H160(hex!("2D2FF76104B7BACB2E8F6731D5BFC184EBECDDBC")),
-					U256([10, 0, 0, 0])
-				),
-				(
-					H160(hex!("AB8E3D9134955566483B11E6825C9223B6737B10")),
-					U256([20, 0, 0, 0])
-				),
-				(
-					H160(hex!("8C582BDF2953046705FC56F189385255EFC1BE18")),
-					U256([30, 0, 0, 0])
-				),
-			]
-		);
+		let mut writer = AbiWriter::new_call(decoded_data.0);
+		address.abi_write(&mut writer);
+		decoded_data.1.abi_write(&mut writer);
+		let ed = writer.finish();
+		similar_asserts::assert_eq!(encoded_data, ed.as_slice());
 	}
 }
modifiedcrates/evm-coder/src/lib.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/lib.rs
+++ b/crates/evm-coder/src/lib.rs
@@ -133,8 +133,10 @@
 	pub type string = ::alloc::string::String;
 	#[cfg(feature = "std")]
 	pub type string = ::std::string::String;
-	pub type bytes = Vec<u8>;
 
+	#[derive(Default, Debug)]
+	pub struct bytes(pub Vec<u8>);
+
 	/// Solidity doesn't have `void` type, however we have special implementation
 	/// for empty tuple return type
 	pub type void = ();
@@ -157,6 +159,30 @@
 		/// and there is no `receiver()` function defined.
 		pub value: U256,
 	}
+
+	impl From<Vec<u8>> for bytes {
+		fn from(src: Vec<u8>) -> Self {
+			Self(src)
+		}
+	}
+
+	impl Into<Vec<u8>> for bytes {
+		fn into(self) -> Vec<u8> {
+			self.0
+		}
+	}
+
+	impl bytes {
+		#[must_use]
+		pub fn len(&self) -> usize {
+			self.0.len()
+		}
+
+		#[must_use]
+		pub fn is_empty(&self) -> bool {
+			self.len() == 0
+		}
+	}
 }
 
 /// Parseable EVM call, this trait should be implemented with [`solidity_interface`] macro
modifiedcrates/evm-coder/src/solidity.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -154,8 +154,10 @@
 	fn is_simple() -> bool {
 		false
 	}
-	fn solidity_default(writer: &mut impl fmt::Write, _tc: &TypeCollector) -> fmt::Result {
-		write!(writer, "[]")
+	fn solidity_default(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result {
+		write!(writer, "new ")?;
+		T::solidity_name(writer, tc)?;
+		write!(writer, "[](0)")
 	}
 }
 
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -33,12 +33,12 @@
 // limitations under the License.
 
 use crate::{
-	chain_spec::{
-		self, RuntimeId, RuntimeIdentification, ServiceId, ServiceIdentification, default_runtime,
-	},
+	chain_spec::{self, RuntimeId, RuntimeIdentification, ServiceId, ServiceIdentification},
 	cli::{Cli, RelayChainCli, Subcommand},
 	service::{new_partial, start_node, start_dev_node},
 };
+#[cfg(feature = "runtime-benchmarks")]
+use crate::chain_spec::default_runtime;
 
 #[cfg(feature = "unique-runtime")]
 use crate::service::UniqueRuntimeExecutor;
@@ -46,7 +46,10 @@
 #[cfg(feature = "quartz-runtime")]
 use crate::service::QuartzRuntimeExecutor;
 
-use crate::service::{OpalRuntimeExecutor, DefaultRuntimeExecutor};
+use crate::service::OpalRuntimeExecutor;
+
+#[cfg(feature = "runtime-benchmarks")]
+use crate::service::DefaultRuntimeExecutor;
 
 use codec::Encode;
 use cumulus_primitives_core::ParaId;
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -46,7 +46,6 @@
 use cumulus_relay_chain_rpc_interface::{RelayChainRpcInterface, create_client_and_start_worker};
 
 // Substrate Imports
-use sc_client_api::ExecutorProvider;
 use sc_executor::NativeElseWasmExecutor;
 use sc_executor::NativeExecutionDispatch;
 use sc_network::{NetworkService, NetworkBlock};
@@ -84,13 +83,21 @@
 /// Opal native executor instance.
 pub struct OpalRuntimeExecutor;
 
-#[cfg(feature = "unique-runtime")]
+#[cfg(all(feature = "unique-runtime", feature = "runtime-benchmarks"))]
 pub type DefaultRuntimeExecutor = UniqueRuntimeExecutor;
 
-#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]
+#[cfg(all(
+	not(feature = "unique-runtime"),
+	feature = "quartz-runtime",
+	feature = "runtime-benchmarks"
+))]
 pub type DefaultRuntimeExecutor = QuartzRuntimeExecutor;
 
-#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]
+#[cfg(all(
+	not(feature = "unique-runtime"),
+	not(feature = "quartz-runtime"),
+	feature = "runtime-benchmarks"
+))]
 pub type DefaultRuntimeExecutor = OpalRuntimeExecutor;
 
 #[cfg(feature = "unique-runtime")]
modifiedpallets/common/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/common/CHANGELOG.md
+++ b/pallets/common/CHANGELOG.md
@@ -2,29 +2,37 @@
 
 All notable changes to this project will be documented in this file.
 
+## [0.1.9] - 2022-10-13
+
+## Added
+
+- EVM event for `destroy_collection`.
+
 ## [0.1.8] - 2022-08-24
 
 ## Added
- - Eth methods for collection
-    + set_collection_sponsor_substrate
-    + has_collection_pending_sponsor
-    + remove_collection_sponsor
-    + get_collection_sponsor
+
+- Eth methods for collection
+  - set_collection_sponsor_substrate
+  - has_collection_pending_sponsor
+  - remove_collection_sponsor
+  - get_collection_sponsor
 - Add convert function from `uint256` to `CrossAccountId`.
 
 ## [0.1.7] - 2022-08-19
 
 ### Added
 
- - Add convert funtion from `CrossAccountId` to eth `uint256`.
+- Add convert funtion from `CrossAccountId` to eth `uint256`.
 
- 
 ## [0.1.6] - 2022-08-16
 
 ### Added
--   New Ethereum API methods: changeOwner, changeOwner(Substrate) and verifyOwnerOrAdmin(Substrate).
 
+- New Ethereum API methods: changeOwner, changeOwner(Substrate) and verifyOwnerOrAdmin(Substrate).
+
 <!-- bureaucrate goes here -->
+
 ## [v0.1.5] 2022-08-16
 
 ### Other changes
@@ -45,19 +53,21 @@
 - build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
 
 ## [0.1.3] - 2022-07-25
+
 ### Add
--   Some static property keys and values.
 
+- Some static property keys and values.
+
 ## [0.1.2] - 2022-07-20
 
 ### Fixed
 
--   Some methods in `#[solidity_interface]` for `CollectionHandle` had invalid
-    mutability modifiers, causing invalid stub/abi generation.
+- Some methods in `#[solidity_interface]` for `CollectionHandle` had invalid
+  mutability modifiers, causing invalid stub/abi generation.
 
 ## [0.1.1] - 2022-07-14
 
 ### Added
 
- - Implementation of RPC method `token_owners` returning 10 owners in no particular order.
-    This was an internal request to improve the web interface and support fractionalization event.
+- Implementation of RPC method `token_owners` returning 10 owners in no particular order.
+  This was an internal request to improve the web interface and support fractionalization event.
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pallet-common"
-version = "0.1.8"
+version = "0.1.9"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -34,8 +34,8 @@
 use crate::{
 	Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf,
 	eth::{
-		convert_cross_account_to_uint256, convert_uint256_to_cross_account,
-		convert_cross_account_to_tuple,
+		convert_cross_account_to_uint256, convert_cross_account_to_tuple,
+		convert_tuple_to_cross_account,
 	},
 	weights::WeightInfo,
 };
@@ -53,6 +53,12 @@
 		#[indexed]
 		collection_id: address,
 	},
+	/// The collection has been destroyed.
+	CollectionDestroyed {
+		/// Collection ID.
+		#[indexed]
+		collection_id: address,
+	},
 }
 
 /// Does not always represent a full collection, for RFT it is either
@@ -85,19 +91,45 @@
 		let key = <Vec<u8>>::from(key)
 			.try_into()
 			.map_err(|_| "key too large")?;
-		let value = value.try_into().map_err(|_| "value too large")?;
+		let value = value.0.try_into().map_err(|_| "value too large")?;
 
 		<Pallet<T>>::set_collection_property(self, &caller, Property { key, value })
 			.map_err(dispatch_to_evm::<T>)
 	}
 
+	/// Set collection properties.
+	///
+	/// @param properties Vector of properties key/value pair.
+	#[weight(<SelfWeightOf<T>>::set_collection_properties(properties.len() as u32))]
+	fn set_collection_properties(
+		&mut self,
+		caller: caller,
+		properties: Vec<(string, bytes)>,
+	) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+
+		let properties = properties
+			.into_iter()
+			.map(|(key, value)| {
+				let key = <Vec<u8>>::from(key)
+					.try_into()
+					.map_err(|_| "key too large")?;
+
+				let value = value.0.try_into().map_err(|_| "value too large")?;
+
+				Ok(Property { key, value })
+			})
+			.collect::<Result<Vec<_>>>()?;
+
+		<Pallet<T>>::set_collection_properties(self, &caller, properties)
+			.map_err(dispatch_to_evm::<T>)
+	}
+
 	/// Delete collection property.
 	///
 	/// @param key Property key.
 	#[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]
 	fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> {
-		self.consume_store_reads_and_writes(1, 1)?;
-
 		let caller = T::CrossAccountId::from_eth(caller);
 		let key = <Vec<u8>>::from(key)
 			.try_into()
@@ -106,6 +138,24 @@
 		<Pallet<T>>::delete_collection_property(self, &caller, key).map_err(dispatch_to_evm::<T>)
 	}
 
+	/// Delete collection properties.
+	///
+	/// @param keys Properties keys.
+	#[weight(<SelfWeightOf<T>>::delete_collection_properties(keys.len() as u32))]
+	fn delete_collection_properties(&mut self, caller: caller, keys: Vec<string>) -> Result<()> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let keys = keys
+			.into_iter()
+			.map(|key| {
+				<Vec<u8>>::from(key)
+					.try_into()
+					.map_err(|_| Error::Revert("key too large".into()))
+			})
+			.collect::<Result<Vec<_>>>()?;
+
+		<Pallet<T>>::delete_collection_properties(self, &caller, keys).map_err(dispatch_to_evm::<T>)
+	}
+
 	/// Get collection property.
 	///
 	/// @dev Throws error if key not found.
@@ -117,12 +167,44 @@
 			.try_into()
 			.map_err(|_| "key too large")?;
 
-		let props = <CollectionProperties<T>>::get(self.id);
+		let props = CollectionProperties::<T>::get(self.id);
 		let prop = props.get(&key).ok_or("key not found")?;
 
-		Ok(prop.to_vec())
+		Ok(bytes(prop.to_vec()))
 	}
 
+	/// Get collection properties.
+	///
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<(string, bytes)>> {
+		let keys = keys
+			.into_iter()
+			.map(|key| {
+				<Vec<u8>>::from(key)
+					.try_into()
+					.map_err(|_| Error::Revert("key too large".into()))
+			})
+			.collect::<Result<Vec<_>>>()?;
+
+		let properties = Pallet::<T>::filter_collection_properties(
+			self.id,
+			if keys.is_empty() { None } else { Some(keys) },
+		)
+		.map_err(dispatch_to_evm::<T>)?;
+
+		let properties = properties
+			.into_iter()
+			.map(|p| {
+				let key =
+					string::from_utf8(p.key.into()).map_err(|e| Error::Revert(format!("{}", e)))?;
+				let value = bytes(p.value.to_vec());
+				Ok((key, value))
+			})
+			.collect::<Result<Vec<_>>>()?;
+		Ok(properties)
+	}
+
 	/// Set the sponsor of the collection.
 	///
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -139,26 +221,25 @@
 		save(self)
 	}
 
-	// TODO: Temprorary off. Need refactor
-	// /// Set the substrate sponsor of the collection.
-	// ///
-	// /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
-	// ///
-	// /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.
-	// fn set_collection_sponsor_substrate(
-	// 	&mut self,
-	// 	caller: caller,
-	// 	sponsor: uint256,
-	// ) -> Result<void> {
-	// 	self.consume_store_reads_and_writes(1, 1)?;
+	/// Set the sponsor of the collection.
+	///
+	/// @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.
+	fn set_collection_sponsor_cross(
+		&mut self,
+		caller: caller,
+		sponsor: (address, uint256),
+	) -> Result<void> {
+		self.consume_store_reads_and_writes(1, 1)?;
 
-	// 	check_is_owner_or_admin(caller, self)?;
+		check_is_owner_or_admin(caller, self)?;
 
-	// 	let sponsor = convert_uint256_to_cross_account::<T>(sponsor);
-	// 	self.set_sponsor(sponsor.as_sub().clone())
-	// 		.map_err(dispatch_to_evm::<T>)?;
-	// 	save(self)
-	// }
+		let sponsor = convert_tuple_to_cross_account::<T>(sponsor)?;
+		self.set_sponsor(sponsor.as_sub().clone())
+			.map_err(dispatch_to_evm::<T>)?;
+		save(self)
+	}
 
 	/// Whether there is a pending sponsor.
 	fn has_collection_pending_sponsor(&self) -> Result<bool> {
@@ -300,37 +381,35 @@
 		Ok(crate::eth::collection_id_to_address(self.id))
 	}
 
-	// TODO: Temprorary off. Need refactor
-	// /// Add collection admin by substrate address.
-	// /// @param newAdmin Substrate administrator address.
-	// fn add_collection_admin_substrate(
-	// 	&mut self,
-	// 	caller: caller,
-	// 	new_admin: uint256,
-	// ) -> Result<void> {
-	// 	self.consume_store_writes(2)?;
+	/// Add collection admin.
+	/// @param newAdmin Cross account administrator address.
+	fn add_collection_admin_cross(
+		&mut self,
+		caller: caller,
+		new_admin: (address, uint256),
+	) -> Result<void> {
+		self.consume_store_writes(2)?;
 
-	// 	let caller = T::CrossAccountId::from_eth(caller);
-	// 	let new_admin = convert_uint256_to_cross_account::<T>(new_admin);
-	// 	<Pallet<T>>::toggle_admin(self, &caller, &new_admin, true).map_err(dispatch_to_evm::<T>)?;
-	// 	Ok(())
-	// }
+		let caller = T::CrossAccountId::from_eth(caller);
+		let new_admin = convert_tuple_to_cross_account::<T>(new_admin)?;
+		<Pallet<T>>::toggle_admin(self, &caller, &new_admin, true).map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
 
-	// TODO: Temprorary off. Need refactor
-	// /// Remove collection admin by substrate address.
-	// /// @param admin Substrate administrator address.
-	// fn remove_collection_admin_substrate(
-	// 	&mut self,
-	// 	caller: caller,
-	// 	admin: uint256,
-	// ) -> Result<void> {
-	// 	self.consume_store_writes(2)?;
+	/// Remove collection admin.
+	/// @param admin Cross account administrator address.
+	fn remove_collection_admin_cross(
+		&mut self,
+		caller: caller,
+		admin: (address, uint256),
+	) -> Result<void> {
+		self.consume_store_writes(2)?;
 
-	// 	let caller = T::CrossAccountId::from_eth(caller);
-	// 	let admin = convert_uint256_to_cross_account::<T>(admin);
-	// 	<Pallet<T>>::toggle_admin(self, &caller, &admin, false).map_err(dispatch_to_evm::<T>)?;
-	// 	Ok(())
-	// }
+		let caller = T::CrossAccountId::from_eth(caller);
+		let admin = convert_tuple_to_cross_account::<T>(admin)?;
+		<Pallet<T>>::toggle_admin(self, &caller, &admin, false).map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
 
 	/// Add collection admin.
 	/// @param newAdmin Address of the added administrator.
@@ -479,22 +558,21 @@
 		Ok(())
 	}
 
-	// TODO: Temprorary off. Need refactor
-	// /// Add substrate user to allowed list.
-	// ///
-	// /// @param user User substrate address.
-	// fn add_to_collection_allow_list_substrate(
-	// 	&mut self,
-	// 	caller: caller,
-	// 	user: uint256,
-	// ) -> Result<void> {
-	// 	self.consume_store_writes(1)?;
+	/// Add user to allowed list.
+	///
+	/// @param user User cross account address.
+	fn add_to_collection_allow_list_cross(
+		&mut self,
+		caller: caller,
+		user: (address, uint256),
+	) -> Result<void> {
+		self.consume_store_writes(1)?;
 
-	// 	let caller = T::CrossAccountId::from_eth(caller);
-	// 	let user = convert_uint256_to_cross_account::<T>(user);
-	// 	Pallet::<T>::toggle_allowlist(self, &caller, &user, true).map_err(dispatch_to_evm::<T>)?;
-	// 	Ok(())
-	// }
+		let caller = T::CrossAccountId::from_eth(caller);
+		let user = convert_tuple_to_cross_account::<T>(user)?;
+		Pallet::<T>::toggle_allowlist(self, &caller, &user, true).map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
 
 	/// Remove the user from the allowed list.
 	///
@@ -508,22 +586,21 @@
 		Ok(())
 	}
 
-	// TODO: Temprorary off. Need refactor
-	// /// Remove substrate user from allowed list.
-	// ///
-	// /// @param user User substrate address.
-	// fn remove_from_collection_allow_list_substrate(
-	// 	&mut self,
-	// 	caller: caller,
-	// 	user: uint256,
-	// ) -> Result<void> {
-	// 	self.consume_store_writes(1)?;
+	/// Remove user from allowed list.
+	///
+	/// @param user User cross account address.
+	fn remove_from_collection_allow_list_cross(
+		&mut self,
+		caller: caller,
+		user: (address, uint256),
+	) -> Result<void> {
+		self.consume_store_writes(1)?;
 
-	// 	let caller = T::CrossAccountId::from_eth(caller);
-	// 	let user = convert_uint256_to_cross_account::<T>(user);
-	// 	Pallet::<T>::toggle_allowlist(self, &caller, &user, false).map_err(dispatch_to_evm::<T>)?;
-	// 	Ok(())
-	// }
+		let caller = T::CrossAccountId::from_eth(caller);
+		let user = convert_tuple_to_cross_account::<T>(user)?;
+		Pallet::<T>::toggle_allowlist(self, &caller, &user, false).map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
 
 	/// Switch permission for minting.
 	///
@@ -556,15 +633,14 @@
 		Ok(self.is_owner_or_admin(&user))
 	}
 
-	// TODO: Temprorary off. Need refactor
-	// /// Check that substrate account is the owner or admin of the collection
-	// ///
-	// /// @param user account to verify
-	// /// @return "true" if account is the owner or admin
-	// fn is_owner_or_admin_substrate(&self, user: uint256) -> Result<bool> {
-	// 	let user = convert_uint256_to_cross_account::<T>(user);
-	// 	Ok(self.is_owner_or_admin(&user))
-	// }
+	/// Check that account is the owner or admin of the collection
+	///
+	/// @param user User cross account to verify
+	/// @return "true" if account is the owner or admin
+	fn is_owner_or_admin_cross(&self, user: (address, uint256)) -> Result<bool> {
+		let user = convert_tuple_to_cross_account::<T>(user)?;
+		Ok(self.is_owner_or_admin(&user))
+	}
 
 	/// Returns collection type
 	///
@@ -580,7 +656,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	fn collection_owner(&self) -> Result<(address, uint256)> {
 		Ok(convert_cross_account_to_tuple::<T>(
@@ -602,27 +678,29 @@
 			.map_err(dispatch_to_evm::<T>)
 	}
 
-	// TODO: Temprorary off. Need refactor
-	// /// Changes collection owner to another substrate account
-	// ///
-	// /// @dev Owner can be changed only by current owner
-	// /// @param newOwner new owner substrate account
-	// fn set_owner_substrate(&mut self, caller: caller, new_owner: uint256) -> Result<void> {
-	// 	self.consume_store_writes(1)?;
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	fn collection_admins(&self) -> Result<Vec<(address, uint256)>> {
+		let result = crate::IsAdmin::<T>::iter_prefix((self.id,))
+			.map(|(admin, _)| crate::eth::convert_cross_account_to_tuple::<T>(&admin))
+			.collect();
+		Ok(result)
+	}
 
-	// 	let caller = T::CrossAccountId::from_eth(caller);
-	// 	let new_owner = convert_uint256_to_cross_account::<T>(new_owner);
-	// 	self.set_owner_internal(caller, new_owner)
-	// 		.map_err(dispatch_to_evm::<T>)
-	// }
+	/// Changes collection owner to another account
+	///
+	/// @dev Owner can be changed only by current owner
+	/// @param newOwner new owner cross account
+	fn set_owner_cross(&mut self, caller: caller, new_owner: (address, uint256)) -> Result<void> {
+		self.consume_store_writes(1)?;
 
-	// TODO: need implement AbiWriter for &Vec<T>
-	// fn collection_admins(&self) -> Result<Vec<(address, uint256)>> {
-	// 	let result = pallet_common::IsAdmin::<T>::iter_prefix((self.id,))
-	// 		.map(|(admin, _)| pallet_common::eth::convert_cross_account_to_tuple::<T>(&admin))
-	// 		.collect();
-	// 	Ok(result)
-	// }
+		let caller = T::CrossAccountId::from_eth(caller);
+		let new_owner = convert_tuple_to_cross_account::<T>(new_owner)?;
+		self.set_owner_internal(caller, new_owner)
+			.map_err(dispatch_to_evm::<T>)
+	}
 }
 
 /// ### Note
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -85,3 +85,27 @@
 		(eth, Default::default())
 	}
 }
+
+/// Convert tuple `(address, uint256)` to `CrossAccountId`.
+///
+/// If `address` in the tuple has *default* value, then the canonical form is substrate,
+/// if `uint256` has *default* value, then the ethereum form is canonical,
+/// if both values are *default* or *non default*, then this is considered an invalid address and `Error` is returned.
+pub fn convert_tuple_to_cross_account<T: Config>(
+	eth_cross_account_id: (address, uint256),
+) -> evm_coder::execution::Result<T::CrossAccountId>
+where
+	T::AccountId: From<[u8; 32]>,
+{
+	if eth_cross_account_id == Default::default() {
+		Err("All fields of cross account is zeroed".into())
+	} else if eth_cross_account_id.0 == Default::default() {
+		Ok(convert_uint256_to_cross_account::<T>(
+			eth_cross_account_id.1,
+		))
+	} else if eth_cross_account_id.1 == Default::default() {
+		Ok(T::CrossAccountId::from_eth(eth_cross_account_id.0))
+	} else {
+		Err("All fields of cross account is non zeroed".into())
+	}
+}
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -999,6 +999,13 @@
 		<CollectionProperties<T>>::remove(collection.id);
 
 		<Pallet<T>>::deposit_event(Event::CollectionDestroyed(collection.id));
+
+		<PalletEvm<T>>::deposit_log(
+			erc::CollectionHelpersEvents::CollectionDestroyed {
+				collection_id: eth::collection_id_to_address(collection.id),
+			}
+			.to_log(T::ContractAddress::get()),
+		);
 		Ok(())
 	}
 
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -19,6 +19,7 @@
 use core::char::{REPLACEMENT_CHARACTER, decode_utf16};
 use core::convert::TryInto;
 use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
+use pallet_common::eth::convert_tuple_to_cross_account;
 use up_data_structs::CollectionMode;
 use pallet_common::erc::{CommonEvmHandler, PrecompileResult};
 use sp_std::vec::Vec;
@@ -149,7 +150,26 @@
 }
 
 #[solidity_interface(name = ERC20UniqueExtensions)]
-impl<T: Config> FungibleHandle<T> {
+impl<T: Config> FungibleHandle<T>
+where
+	T::AccountId: From<[u8; 32]>,
+{
+	#[weight(<SelfWeightOf<T>>::approve())]
+	fn approve_cross(
+		&mut self,
+		caller: caller,
+		spender: (address, uint256),
+		amount: uint256,
+	) -> Result<bool> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let spender = convert_tuple_to_cross_account::<T>(spender)?;
+		let amount = amount.try_into().map_err(|_| "amount overflow")?;
+
+		<Pallet<T>>::set_allowance(self, &caller, &spender, amount)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(true)
+	}
+
 	/// Burn tokens from account
 	/// @dev Function that burns an `amount` of the tokens of a given account,
 	/// deducting from the sender's allowance for said account.
@@ -169,6 +189,30 @@
 		Ok(true)
 	}
 
+	/// Burn tokens from account
+	/// @dev Function that burns an `amount` of the tokens of a given account,
+	/// deducting from the sender's allowance for said account.
+	/// @param from The account whose tokens will be burnt.
+	/// @param amount The amount that will be burnt.
+	#[weight(<SelfWeightOf<T>>::burn_from())]
+	fn burn_from_cross(
+		&mut self,
+		caller: caller,
+		from: (address, uint256),
+		amount: uint256,
+	) -> Result<bool> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let from = convert_tuple_to_cross_account::<T>(from)?;
+		let amount = amount.try_into().map_err(|_| "amount overflow")?;
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+		<Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(true)
+	}
+
 	/// Mint tokens for multiple accounts.
 	/// @param amounts array of pairs of account address and amount
 	#[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]
@@ -191,6 +235,27 @@
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
+
+	#[weight(<SelfWeightOf<T>>::transfer_from())]
+	fn transfer_from_cross(
+		&mut self,
+		caller: caller,
+		from: (address, uint256),
+		to: (address, uint256),
+		amount: uint256,
+	) -> Result<bool> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let from = convert_tuple_to_cross_account::<T>(from)?;
+		let to = convert_tuple_to_cross_account::<T>(to)?;
+		let amount = amount.try_into().map_err(|_| "amount overflow")?;
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+		<Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(true)
+	}
 }
 
 #[solidity_interface(
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 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -33,6 +33,17 @@
 		dummy = 0;
 	}
 
+	/// Set collection properties.
+	///
+	/// @param properties Vector of properties key/value pair.
+	/// @dev EVM selector for this function is: 0x50b26b2a,
+	///  or in textual repr: setCollectionProperties((string,bytes)[])
+	function setCollectionProperties(Tuple10[] memory properties) public {
+		require(false, stub_error);
+		properties;
+		dummy = 0;
+	}
+
 	/// Delete collection property.
 	///
 	/// @param key Property key.
@@ -44,6 +55,17 @@
 		dummy = 0;
 	}
 
+	/// Delete collection properties.
+	///
+	/// @param keys Properties keys.
+	/// @dev EVM selector for this function is: 0xee206ee3,
+	///  or in textual repr: deleteCollectionProperties(string[])
+	function deleteCollectionProperties(string[] memory keys) public {
+		require(false, stub_error);
+		keys;
+		dummy = 0;
+	}
+
 	/// Get collection property.
 	///
 	/// @dev Throws error if key not found.
@@ -59,6 +81,19 @@
 		return hex"";
 	}
 
+	/// Get collection properties.
+	///
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0x285fb8e6,
+	///  or in textual repr: collectionProperties(string[])
+	function collectionProperties(string[] memory keys) public view returns (Tuple10[] memory) {
+		require(false, stub_error);
+		keys;
+		dummy;
+		return new Tuple10[](0);
+	}
+
 	/// Set the sponsor of the collection.
 	///
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -72,6 +107,19 @@
 		dummy = 0;
 	}
 
+	/// Set the sponsor of the collection.
+	///
+	/// @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,
+	///  or in textual repr: setCollectionSponsorCross((address,uint256))
+	function setCollectionSponsorCross(Tuple6 memory sponsor) public {
+		require(false, stub_error);
+		sponsor;
+		dummy = 0;
+	}
+
 	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
@@ -155,6 +203,26 @@
 	}
 
 	/// Add collection admin.
+	/// @param newAdmin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x859aa7d6,
+	///  or in textual repr: addCollectionAdminCross((address,uint256))
+	function addCollectionAdminCross(Tuple6 memory newAdmin) public {
+		require(false, stub_error);
+		newAdmin;
+		dummy = 0;
+	}
+
+	/// Remove collection admin.
+	/// @param admin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x6c0cd173,
+	///  or in textual repr: removeCollectionAdminCross((address,uint256))
+	function removeCollectionAdminCross(Tuple6 memory admin) public {
+		require(false, stub_error);
+		admin;
+		dummy = 0;
+	}
+
+	/// Add collection admin.
 	/// @param newAdmin Address of the added administrator.
 	/// @dev EVM selector for this function is: 0x92e462c7,
 	///  or in textual repr: addCollectionAdmin(address)
@@ -234,6 +302,17 @@
 		dummy = 0;
 	}
 
+	/// Add user to allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0xa0184a3a,
+	///  or in textual repr: addToCollectionAllowListCross((address,uint256))
+	function addToCollectionAllowListCross(Tuple6 memory user) public {
+		require(false, stub_error);
+		user;
+		dummy = 0;
+	}
+
 	/// Remove the user from the allowed list.
 	///
 	/// @param user Address of a removed user.
@@ -245,6 +324,17 @@
 		dummy = 0;
 	}
 
+	/// Remove user from allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0x09ba452a,
+	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))
+	function removeFromCollectionAllowListCross(Tuple6 memory user) public {
+		require(false, stub_error);
+		user;
+		dummy = 0;
+	}
+
 	/// Switch permission for minting.
 	///
 	/// @param mode Enable if "true".
@@ -269,6 +359,19 @@
 		return false;
 	}
 
+	/// Check that account is the owner or admin of the collection
+	///
+	/// @param user User cross account to verify
+	/// @return "true" if account is the owner or admin
+	/// @dev EVM selector for this function is: 0x3e75a905,
+	///  or in textual repr: isOwnerOrAdminCross((address,uint256))
+	function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {
+		require(false, stub_error);
+		user;
+		dummy;
+		return false;
+	}
+
 	/// Returns collection type
 	///
 	/// @return `Fungible` or `NFT` or `ReFungible`
@@ -282,7 +385,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
@@ -303,10 +406,50 @@
 		newOwner;
 		dummy = 0;
 	}
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() public view returns (Tuple6[] memory) {
+		require(false, stub_error);
+		dummy;
+		return new Tuple6[](0);
+	}
+
+	/// Changes collection owner to another account
+	///
+	/// @dev Owner can be changed only by current owner
+	/// @param newOwner new owner cross account
+	/// @dev EVM selector for this function is: 0xe5c9913f,
+	///  or in textual repr: setOwnerCross((address,uint256))
+	function setOwnerCross(Tuple6 memory newOwner) public {
+		require(false, stub_error);
+		newOwner;
+		dummy = 0;
+	}
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x63034ac5
+/// @dev anonymous struct
+struct Tuple10 {
+	string field_0;
+	bytes field_1;
+}
+
+/// @dev the ERC-165 identifier for this interface is 0x032e5926
 contract ERC20UniqueExtensions is Dummy, ERC165 {
+	/// @dev EVM selector for this function is: 0x0ecd0ab0,
+	///  or in textual repr: approveCross((address,uint256),uint256)
+	function approveCross(Tuple6 memory spender, uint256 amount) public returns (bool) {
+		require(false, stub_error);
+		spender;
+		amount;
+		dummy = 0;
+		return false;
+	}
+
 	/// Burn tokens from account
 	/// @dev Function that burns an `amount` of the tokens of a given account,
 	/// deducting from the sender's allowance for said account.
@@ -322,6 +465,21 @@
 		return false;
 	}
 
+	/// Burn tokens from account
+	/// @dev Function that burns an `amount` of the tokens of a given account,
+	/// deducting from the sender's allowance for said account.
+	/// @param from The account whose tokens will be burnt.
+	/// @param amount The amount that will be burnt.
+	/// @dev EVM selector for this function is: 0xbb2f5a58,
+	///  or in textual repr: burnFromCross((address,uint256),uint256)
+	function burnFromCross(Tuple6 memory from, uint256 amount) public returns (bool) {
+		require(false, stub_error);
+		from;
+		amount;
+		dummy = 0;
+		return false;
+	}
+
 	/// Mint tokens for multiple accounts.
 	/// @param amounts array of pairs of account address and amount
 	/// @dev EVM selector for this function is: 0x1acf2d55,
@@ -332,6 +490,21 @@
 		dummy = 0;
 		return false;
 	}
+
+	/// @dev EVM selector for this function is: 0xd5cf430b,
+	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
+	function transferFromCross(
+		Tuple6 memory from,
+		Tuple6 memory to,
+		uint256 amount
+	) public returns (bool) {
+		require(false, stub_error);
+		from;
+		to;
+		amount;
+		dummy = 0;
+		return false;
+	}
 }
 
 /// @dev anonymous struct
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/nonfungible/CHANGELOG.md
+++ b/pallets/nonfungible/CHANGELOG.md
@@ -2,12 +2,20 @@
 
 All notable changes to this project will be documented in this file.
 
+<!-- bureaucrate goes here -->
+
+## [v0.1.6] - 2022-20-10
+
+### Change
+
+- Added `set_properties` method for `TokenProperties` interface.
+
 ## [v0.1.5] - 2022-08-24
 
 ### Change
- - Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
 
-<!-- bureaucrate goes here -->
+- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
+
 ## [v0.1.4] 2022-08-16
 
 ### Other changes
@@ -28,7 +36,9 @@
 - build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
 
 ## [0.1.2] - 2022-07-25
+
 ### Changed
+
 - New `token_uri` retrieval logic:
 
       If the collection has a `url` property and it is not empty, it is returned.
@@ -39,8 +49,9 @@
       otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).
 
 ## [0.1.1] - 2022-07-14
+
 ### Added
 
 - Implementation of RPC method `token_owners`.
-   For reasons of compatibility with this pallet, returns only one owner if token exists.
-   This was an internal request to improve the web interface and support fractionalization event.
+  For reasons of compatibility with this pallet, returns only one owner if token exists.
+  This was an internal request to improve the web interface and support fractionalization event.
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pallet-nonfungible"
-version = "0.1.5"
+version = "0.1.6"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -35,6 +35,7 @@
 use pallet_common::{
 	erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},
 	CollectionHandle, CollectionPropertyPermissions,
+	eth::convert_tuple_to_cross_account,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::call;
@@ -97,7 +98,7 @@
 		let key = <Vec<u8>>::from(key)
 			.try_into()
 			.map_err(|_| "key too long")?;
-		let value = value.try_into().map_err(|_| "value too long")?;
+		let value = value.0.try_into().map_err(|_| "value too long")?;
 
 		let nesting_budget = self
 			.recorder
@@ -113,6 +114,48 @@
 		.map_err(dispatch_to_evm::<T>)
 	}
 
+	/// @notice Set token properties value.
+	/// @dev Throws error if `msg.sender` has no permission to edit the property.
+	/// @param tokenId ID of the token.
+	/// @param properties settable properties
+	#[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+	fn set_properties(
+		&mut self,
+		caller: caller,
+		token_id: uint256,
+		properties: Vec<(string, bytes)>,
+	) -> Result<()> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
+
+		let nesting_budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+		let properties = properties
+			.into_iter()
+			.map(|(key, value)| {
+				let key = <Vec<u8>>::from(key)
+					.try_into()
+					.map_err(|_| "key too large")?;
+
+				let value = value.0.try_into().map_err(|_| "value too large")?;
+
+				Ok(Property { key, value })
+			})
+			.collect::<Result<Vec<_>>>()?;
+
+		<Pallet<T>>::set_token_properties(
+			self,
+			&caller,
+			TokenId(token_id),
+			properties.into_iter(),
+			<Pallet<T>>::token_exists(&self, TokenId(token_id)),
+			&nesting_budget,
+		)
+		.map_err(dispatch_to_evm::<T>)
+	}
+
 	/// @notice Delete token property value.
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
@@ -146,7 +189,7 @@
 		let props = <TokenProperties<T>>::get((self.id, token_id));
 		let prop = props.get(&key).ok_or("key not found")?;
 
-		Ok(prop.to_vec())
+		Ok(prop.to_vec().into())
 	}
 }
 
@@ -198,7 +241,10 @@
 /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 /// @dev See https://eips.ethereum.org/EIPS/eip-721
 #[solidity_interface(name = ERC721Metadata, expect_selector = 0x5b5e139f)]
-impl<T: Config> NonfungibleHandle<T> {
+impl<T: Config> NonfungibleHandle<T>
+where
+	T::AccountId: From<[u8; 32]>,
+{
 	/// @notice A descriptive name for a collection of NFTs in this contract
 	/// @dev real implementation of this function lies in `ERC721UniqueExtensions`
 	#[solidity(hide, rename_selector = "name")]
@@ -603,7 +649,10 @@
 
 /// @title Unique extensions for ERC721.
 #[solidity_interface(name = ERC721UniqueExtensions)]
-impl<T: Config> NonfungibleHandle<T> {
+impl<T: Config> NonfungibleHandle<T>
+where
+	T::AccountId: From<[u8; 32]>,
+{
 	/// @notice A descriptive name for a collection of NFTs in this contract
 	fn name(&self) -> Result<string> {
 		Ok(decode_utf16(self.name.iter().copied())
@@ -616,6 +665,28 @@
 		Ok(string::from_utf8_lossy(&self.token_prefix).into())
 	}
 
+	/// @notice Set or reaffirm the approved address for an NFT
+	/// @dev The zero address indicates there is no approved address.
+	/// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
+	///  operator of the current owner.
+	/// @param approved The new substrate address approved NFT controller
+	/// @param tokenId The NFT to approve
+	#[weight(<SelfWeightOf<T>>::approve())]
+	fn approve_cross(
+		&mut self,
+		caller: caller,
+		approved: (address, uint256),
+		token_id: uint256,
+	) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let approved = convert_tuple_to_cross_account::<T>(approved)?;
+		let token = token_id.try_into()?;
+
+		<Pallet<T>>::set_allowance(self, &caller, token, Some(&approved))
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
+
 	/// @notice Transfer ownership of an NFT
 	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
 	///  is the zero address. Throws if `tokenId` is not a valid NFT.
@@ -634,6 +705,32 @@
 		Ok(())
 	}
 
+	/// @notice Transfer ownership of an NFT from cross account address to cross account address
+	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
+	///  is the zero address. Throws if `tokenId` is not a valid NFT.
+	/// @param from Cross acccount address of current owner
+	/// @param to Cross acccount address of new owner
+	/// @param tokenId The NFT to transfer
+	#[weight(<SelfWeightOf<T>>::transfer())]
+	fn transfer_from_cross(
+		&mut self,
+		caller: caller,
+		from: (address, uint256),
+		to: (address, uint256),
+		token_id: uint256,
+	) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let from = convert_tuple_to_cross_account::<T>(from)?;
+		let to = convert_tuple_to_cross_account::<T>(to)?;
+		let token_id = token_id.try_into()?;
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+		Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
+
 	/// @notice Burns a specific ERC721 token.
 	/// @dev Throws unless `msg.sender` is the current owner or an authorized
 	///  operator for this NFT. Throws if `from` is not the current owner. Throws
@@ -654,6 +751,31 @@
 		Ok(())
 	}
 
+	/// @notice Burns a specific ERC721 token.
+	/// @dev Throws unless `msg.sender` is the current owner or an authorized
+	///  operator for this NFT. Throws if `from` is not the current owner. Throws
+	///  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
+	#[weight(<SelfWeightOf<T>>::burn_from())]
+	fn burn_from_cross(
+		&mut self,
+		caller: caller,
+		from: (address, uint256),
+		token_id: uint256,
+	) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let from = convert_tuple_to_cross_account::<T>(from)?;
+		let token = token_id.try_into()?;
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+		<Pallet<T>>::burn_from(self, &caller, &from, token, &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
+
 	/// @notice Returns next free NFT ID.
 	fn next_token_id(&self) -> Result<uint256> {
 		self.consume_store_reads(1)?;
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
@@ -18,7 +18,7 @@
 }
 
 /// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x41369377
+/// @dev the ERC-165 identifier for this interface is 0x55dba919
 contract TokenProperties is Dummy, ERC165 {
 	/// @notice Set permissions for token property.
 	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -61,6 +61,19 @@
 		dummy = 0;
 	}
 
+	/// @notice Set token properties value.
+	/// @dev Throws error if `msg.sender` has no permission to edit the property.
+	/// @param tokenId ID of the token.
+	/// @param properties settable properties
+	/// @dev EVM selector for this function is: 0x14ed3a6e,
+	///  or in textual repr: setProperties(uint256,(string,bytes)[])
+	function setProperties(uint256 tokenId, Tuple19[] memory properties) public {
+		require(false, stub_error);
+		tokenId;
+		properties;
+		dummy = 0;
+	}
+
 	/// @notice Delete token property value.
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
@@ -91,7 +104,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -106,6 +119,17 @@
 		dummy = 0;
 	}
 
+	/// Set collection properties.
+	///
+	/// @param properties Vector of properties key/value pair.
+	/// @dev EVM selector for this function is: 0x50b26b2a,
+	///  or in textual repr: setCollectionProperties((string,bytes)[])
+	function setCollectionProperties(Tuple19[] memory properties) public {
+		require(false, stub_error);
+		properties;
+		dummy = 0;
+	}
+
 	/// Delete collection property.
 	///
 	/// @param key Property key.
@@ -117,6 +141,17 @@
 		dummy = 0;
 	}
 
+	/// Delete collection properties.
+	///
+	/// @param keys Properties keys.
+	/// @dev EVM selector for this function is: 0xee206ee3,
+	///  or in textual repr: deleteCollectionProperties(string[])
+	function deleteCollectionProperties(string[] memory keys) public {
+		require(false, stub_error);
+		keys;
+		dummy = 0;
+	}
+
 	/// Get collection property.
 	///
 	/// @dev Throws error if key not found.
@@ -132,6 +167,19 @@
 		return hex"";
 	}
 
+	/// Get collection properties.
+	///
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0x285fb8e6,
+	///  or in textual repr: collectionProperties(string[])
+	function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {
+		require(false, stub_error);
+		keys;
+		dummy;
+		return new Tuple19[](0);
+	}
+
 	/// Set the sponsor of the collection.
 	///
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -145,6 +193,19 @@
 		dummy = 0;
 	}
 
+	/// Set the sponsor of the collection.
+	///
+	/// @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,
+	///  or in textual repr: setCollectionSponsorCross((address,uint256))
+	function setCollectionSponsorCross(Tuple6 memory sponsor) public {
+		require(false, stub_error);
+		sponsor;
+		dummy = 0;
+	}
+
 	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
@@ -177,10 +238,10 @@
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
 	/// @dev EVM selector for this function is: 0x6ec0a9f1,
 	///  or in textual repr: collectionSponsor()
-	function collectionSponsor() public view returns (Tuple17 memory) {
+	function collectionSponsor() public view returns (Tuple6 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple17(0x0000000000000000000000000000000000000000, 0);
+		return Tuple6(0x0000000000000000000000000000000000000000, 0);
 	}
 
 	/// Set limits for the collection.
@@ -228,6 +289,26 @@
 	}
 
 	/// Add collection admin.
+	/// @param newAdmin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x859aa7d6,
+	///  or in textual repr: addCollectionAdminCross((address,uint256))
+	function addCollectionAdminCross(Tuple6 memory newAdmin) public {
+		require(false, stub_error);
+		newAdmin;
+		dummy = 0;
+	}
+
+	/// Remove collection admin.
+	/// @param admin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x6c0cd173,
+	///  or in textual repr: removeCollectionAdminCross((address,uint256))
+	function removeCollectionAdminCross(Tuple6 memory admin) public {
+		require(false, stub_error);
+		admin;
+		dummy = 0;
+	}
+
+	/// Add collection admin.
 	/// @param newAdmin Address of the added administrator.
 	/// @dev EVM selector for this function is: 0x92e462c7,
 	///  or in textual repr: addCollectionAdmin(address)
@@ -307,6 +388,17 @@
 		dummy = 0;
 	}
 
+	/// Add user to allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0xa0184a3a,
+	///  or in textual repr: addToCollectionAllowListCross((address,uint256))
+	function addToCollectionAllowListCross(Tuple6 memory user) public {
+		require(false, stub_error);
+		user;
+		dummy = 0;
+	}
+
 	/// Remove the user from the allowed list.
 	///
 	/// @param user Address of a removed user.
@@ -318,6 +410,17 @@
 		dummy = 0;
 	}
 
+	/// Remove user from allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0x09ba452a,
+	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))
+	function removeFromCollectionAllowListCross(Tuple6 memory user) public {
+		require(false, stub_error);
+		user;
+		dummy = 0;
+	}
+
 	/// Switch permission for minting.
 	///
 	/// @param mode Enable if "true".
@@ -342,6 +445,19 @@
 		return false;
 	}
 
+	/// Check that account is the owner or admin of the collection
+	///
+	/// @param user User cross account to verify
+	/// @return "true" if account is the owner or admin
+	/// @dev EVM selector for this function is: 0x3e75a905,
+	///  or in textual repr: isOwnerOrAdminCross((address,uint256))
+	function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {
+		require(false, stub_error);
+		user;
+		dummy;
+		return false;
+	}
+
 	/// Returns collection type
 	///
 	/// @return `Fungible` or `NFT` or `ReFungible`
@@ -355,14 +471,14 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
-	function collectionOwner() public view returns (Tuple17 memory) {
+	function collectionOwner() public view returns (Tuple6 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple17(0x0000000000000000000000000000000000000000, 0);
+		return Tuple6(0x0000000000000000000000000000000000000000, 0);
 	}
 
 	/// Changes collection owner to another account
@@ -376,12 +492,36 @@
 		newOwner;
 		dummy = 0;
 	}
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() public view returns (Tuple6[] memory) {
+		require(false, stub_error);
+		dummy;
+		return new Tuple6[](0);
+	}
+
+	/// Changes collection owner to another account
+	///
+	/// @dev Owner can be changed only by current owner
+	/// @param newOwner new owner cross account
+	/// @dev EVM selector for this function is: 0xe5c9913f,
+	///  or in textual repr: setOwnerCross((address,uint256))
+	function setOwnerCross(Tuple6 memory newOwner) public {
+		require(false, stub_error);
+		newOwner;
+		dummy = 0;
+	}
 }
 
 /// @dev anonymous struct
-struct Tuple17 {
-	address field_0;
-	uint256 field_1;
+struct Tuple19 {
+	string field_0;
+	bytes field_1;
 }
 
 /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
@@ -528,7 +668,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x4468500d
+/// @dev the ERC-165 identifier for this interface is 0x244543ee
 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,
@@ -548,6 +688,21 @@
 		return "";
 	}
 
+	/// @notice Set or reaffirm the approved address for an NFT
+	/// @dev The zero address indicates there is no approved address.
+	/// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
+	///  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,
+	///  or in textual repr: approveCross((address,uint256),uint256)
+	function approveCross(Tuple6 memory approved, uint256 tokenId) public {
+		require(false, stub_error);
+		approved;
+		tokenId;
+		dummy = 0;
+	}
+
 	/// @notice Transfer ownership of an NFT
 	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
 	///  is the zero address. Throws if `tokenId` is not a valid NFT.
@@ -562,6 +717,26 @@
 		dummy = 0;
 	}
 
+	/// @notice Transfer ownership of an NFT from cross account address to cross account address
+	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
+	///  is the zero address. Throws if `tokenId` is not a valid NFT.
+	/// @param from Cross acccount address of current owner
+	/// @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)
+	function transferFromCross(
+		Tuple6 memory from,
+		Tuple6 memory to,
+		uint256 tokenId
+	) public {
+		require(false, stub_error);
+		from;
+		to;
+		tokenId;
+		dummy = 0;
+	}
+
 	/// @notice Burns a specific ERC721 token.
 	/// @dev Throws unless `msg.sender` is the current owner or an authorized
 	///  operator for this NFT. Throws if `from` is not the current owner. Throws
@@ -577,6 +752,21 @@
 		dummy = 0;
 	}
 
+	/// @notice Burns a specific ERC721 token.
+	/// @dev Throws unless `msg.sender` is the current owner or an authorized
+	///  operator for this NFT. Throws if `from` is not the current owner. Throws
+	///  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,
+	///  or in textual repr: burnFromCross((address,uint256),uint256)
+	function burnFromCross(Tuple6 memory from, uint256 tokenId) public {
+		require(false, stub_error);
+		from;
+		tokenId;
+		dummy = 0;
+	}
+
 	/// @notice Returns next free NFT ID.
 	/// @dev EVM selector for this function is: 0x75794a3c,
 	///  or in textual repr: nextTokenId()
@@ -607,7 +797,7 @@
 	// /// @param tokens array of pairs of token ID and token URI for minted tokens
 	// /// @dev EVM selector for this function is: 0x36543006,
 	// ///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
-	// function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) public returns (bool) {
+	// function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {
 	// 	require(false, stub_error);
 	// 	to;
 	// 	tokens;
@@ -618,11 +808,17 @@
 }
 
 /// @dev anonymous struct
-struct Tuple6 {
+struct Tuple8 {
 	uint256 field_0;
 	string field_1;
 }
 
+/// @dev anonymous struct
+struct Tuple6 {
+	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/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/refungible/CHANGELOG.md
+++ b/pallets/refungible/CHANGELOG.md
@@ -2,12 +2,20 @@
 
 All notable changes to this project will be documented in this file.
 
+## [v0.2.5] - 2022-20-10
+
+### Change
+
+- Added `set_properties` method for `TokenProperties` interface.
+
 ## [v0.2.4] - 2022-08-24
 
 ### Change
- - Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
 
+- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
+
 <!-- bureaucrate goes here -->
+
 ## [v0.2.3] 2022-08-16
 
 ### Other changes
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/refungible/Cargo.toml
+++ b/pallets/refungible/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pallet-refungible"
-version = "0.2.4"
+version = "0.2.5"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
before · pallets/refungible/src/erc.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//! # Refungible Pallet EVM API for tokens18//!19//! Provides ERC-721 standart support implementation and EVM API for unique extensions for Refungible Pallet.20//! Method implementations are mostly doing parameter conversion and calling Refungible Pallet methods.2122extern crate alloc;2324use core::{25	char::{REPLACEMENT_CHARACTER, decode_utf16},26	convert::TryInto,27};28use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};29use frame_support::{BoundedBTreeMap, BoundedVec};30use pallet_common::{31	CollectionHandle, CollectionPropertyPermissions,32	erc::{CommonEvmHandler, CollectionCall, static_property::key},33};34use pallet_evm::{account::CrossAccountId, PrecompileHandle};35use pallet_evm_coder_substrate::{call, dispatch_to_evm};36use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};37use sp_core::H160;38use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};39use up_data_structs::{40	CollectionId, CollectionPropertiesVec, mapping::TokenAddressMapping, Property, PropertyKey,41	PropertyKeyPermission, PropertyPermission, TokenId,42};4344use crate::{45	AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle, SelfWeightOf,46	TokenProperties, TokensMinted, TotalSupply, weights::WeightInfo,47};4849pub const ADDRESS_FOR_PARTIALLY_OWNED_TOKENS: H160 = H160::repeat_byte(0xff);5051/// @title A contract that allows to set and delete token properties and change token property permissions.52#[solidity_interface(name = TokenProperties)]53impl<T: Config> RefungibleHandle<T> {54	/// @notice Set permissions for token property.55	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.56	/// @param key Property key.57	/// @param isMutable Permission to mutate property.58	/// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.59	/// @param tokenOwner Permission to mutate property by token owner if property is mutable.60	fn set_token_property_permission(61		&mut self,62		caller: caller,63		key: string,64		is_mutable: bool,65		collection_admin: bool,66		token_owner: bool,67	) -> Result<()> {68		let caller = T::CrossAccountId::from_eth(caller);69		<Pallet<T>>::set_token_property_permissions(70			self,71			&caller,72			vec![PropertyKeyPermission {73				key: <Vec<u8>>::from(key)74					.try_into()75					.map_err(|_| "too long key")?,76				permission: PropertyPermission {77					mutable: is_mutable,78					collection_admin,79					token_owner,80				},81			}],82		)83		.map_err(dispatch_to_evm::<T>)84	}8586	/// @notice Set token property value.87	/// @dev Throws error if `msg.sender` has no permission to edit the property.88	/// @param tokenId ID of the token.89	/// @param key Property key.90	/// @param value Property value.91	fn set_property(92		&mut self,93		caller: caller,94		token_id: uint256,95		key: string,96		value: bytes,97	) -> Result<()> {98		let caller = T::CrossAccountId::from_eth(caller);99		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;100		let key = <Vec<u8>>::from(key)101			.try_into()102			.map_err(|_| "key too long")?;103		let value = value.try_into().map_err(|_| "value too long")?;104105		let nesting_budget = self106			.recorder107			.weight_calls_budget(<StructureWeight<T>>::find_parent());108109		<Pallet<T>>::set_token_property(110			self,111			&caller,112			TokenId(token_id),113			Property { key, value },114			&nesting_budget,115		)116		.map_err(dispatch_to_evm::<T>)117	}118119	/// @notice Delete token property value.120	/// @dev Throws error if `msg.sender` has no permission to edit the property.121	/// @param tokenId ID of the token.122	/// @param key Property key.123	fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {124		let caller = T::CrossAccountId::from_eth(caller);125		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;126		let key = <Vec<u8>>::from(key)127			.try_into()128			.map_err(|_| "key too long")?;129130		let nesting_budget = self131			.recorder132			.weight_calls_budget(<StructureWeight<T>>::find_parent());133134		<Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key, &nesting_budget)135			.map_err(dispatch_to_evm::<T>)136	}137138	/// @notice Get token property value.139	/// @dev Throws error if key not found140	/// @param tokenId ID of the token.141	/// @param key Property key.142	/// @return Property value bytes143	fn property(&self, token_id: uint256, key: string) -> Result<bytes> {144		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;145		let key = <Vec<u8>>::from(key)146			.try_into()147			.map_err(|_| "key too long")?;148149		let props = <TokenProperties<T>>::get((self.id, token_id));150		let prop = props.get(&key).ok_or("key not found")?;151152		Ok(prop.to_vec())153	}154}155156#[derive(ToLog)]157pub enum ERC721Events {158	/// @dev This event emits when NFTs are created (`from` == 0) and destroyed159	///  (`to` == 0). Exception: during contract creation, any number of RFTs160	///  may be created and assigned without emitting Transfer.161	Transfer {162		#[indexed]163		from: address,164		#[indexed]165		to: address,166		#[indexed]167		token_id: uint256,168	},169	/// @dev Not supported170	Approval {171		#[indexed]172		owner: address,173		#[indexed]174		approved: address,175		#[indexed]176		token_id: uint256,177	},178	/// @dev Not supported179	#[allow(dead_code)]180	ApprovalForAll {181		#[indexed]182		owner: address,183		#[indexed]184		operator: address,185		approved: bool,186	},187}188189#[derive(ToLog)]190pub enum ERC721UniqueMintableEvents {191	/// @dev Not supported192	#[allow(dead_code)]193	MintingFinished {},194}195196#[solidity_interface(name = ERC721Metadata)]197impl<T: Config> RefungibleHandle<T> {198	/// @notice A descriptive name for a collection of NFTs in this contract199	/// @dev real implementation of this function lies in `ERC721UniqueExtensions`200	#[solidity(hide, rename_selector = "name")]201	fn name_proxy(&self) -> Result<string> {202		self.name()203	}204205	/// @notice An abbreviated name for NFTs in this contract206	/// @dev real implementation of this function lies in `ERC721UniqueExtensions`207	#[solidity(hide, rename_selector = "symbol")]208	fn symbol_proxy(&self) -> Result<string> {209		self.symbol()210	}211212	/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.213	///214	/// @dev If the token has a `url` property and it is not empty, it is returned.215	///  Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.216	///  If the collection property `baseURI` is empty or absent, return "" (empty string)217	///  otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix218	///  otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).219	///220	/// @return token's const_metadata221	#[solidity(rename_selector = "tokenURI")]222	fn token_uri(&self, token_id: uint256) -> Result<string> {223		let token_id_u32: u32 = token_id.try_into().map_err(|_| "token id overflow")?;224225		match get_token_property(self, token_id_u32, &key::url()).as_deref() {226			Err(_) | Ok("") => (),227			Ok(url) => {228				return Ok(url.into());229			}230		};231232		let base_uri =233			pallet_common::Pallet::<T>::get_collection_property(self.id, &key::base_uri())234				.map(BoundedVec::into_inner)235				.map(string::from_utf8)236				.transpose()237				.map_err(|e| {238					Error::Revert(alloc::format!(239						"Can not convert value \"baseURI\" to string with error \"{}\"",240						e241					))242				})?;243244		let base_uri = match base_uri.as_deref() {245			None | Some("") => {246				return Ok("".into());247			}248			Some(base_uri) => base_uri.into(),249		};250251		Ok(252			match get_token_property(self, token_id_u32, &key::suffix()).as_deref() {253				Err(_) | Ok("") => base_uri,254				Ok(suffix) => base_uri + suffix,255			},256		)257	}258}259260/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension261/// @dev See https://eips.ethereum.org/EIPS/eip-721262#[solidity_interface(name = ERC721Enumerable)]263impl<T: Config> RefungibleHandle<T> {264	/// @notice Enumerate valid RFTs265	/// @param index A counter less than `totalSupply()`266	/// @return The token identifier for the `index`th NFT,267	///  (sort order not specified)268	fn token_by_index(&self, index: uint256) -> Result<uint256> {269		Ok(index)270	}271272	/// Not implemented273	fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {274		// TODO: Not implemetable275		Err("not implemented".into())276	}277278	/// @notice Count RFTs tracked by this contract279	/// @return A count of valid RFTs tracked by this contract, where each one of280	///  them has an assigned and queryable owner not equal to the zero address281	fn total_supply(&self) -> Result<uint256> {282		self.consume_store_reads(1)?;283		Ok(<Pallet<T>>::total_supply(self).into())284	}285}286287/// @title ERC-721 Non-Fungible Token Standard288/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md289#[solidity_interface(name = ERC721, events(ERC721Events))]290impl<T: Config> RefungibleHandle<T> {291	/// @notice Count all RFTs assigned to an owner292	/// @dev RFTs assigned to the zero address are considered invalid, and this293	///  function throws for queries about the zero address.294	/// @param owner An address for whom to query the balance295	/// @return The number of RFTs owned by `owner`, possibly zero296	fn balance_of(&self, owner: address) -> Result<uint256> {297		self.consume_store_reads(1)?;298		let owner = T::CrossAccountId::from_eth(owner);299		let balance = <AccountBalance<T>>::get((self.id, owner));300		Ok(balance.into())301	}302303	/// @notice Find the owner of an RFT304	/// @dev RFTs assigned to zero address are considered invalid, and queries305	///  about them do throw.306	///  Returns special 0xffffffffffffffffffffffffffffffffffffffff address for307	///  the tokens that are partially owned.308	/// @param tokenId The identifier for an RFT309	/// @return The address of the owner of the RFT310	fn owner_of(&self, token_id: uint256) -> Result<address> {311		self.consume_store_reads(2)?;312		let token = token_id.try_into()?;313		let owner = <Pallet<T>>::token_owner(self.id, token);314		Ok(owner315			.map(|address| *address.as_eth())316			.unwrap_or_else(|| ADDRESS_FOR_PARTIALLY_OWNED_TOKENS))317	}318319	/// @dev Not implemented320	fn safe_transfer_from_with_data(321		&mut self,322		_from: address,323		_to: address,324		_token_id: uint256,325		_data: bytes,326	) -> Result<void> {327		// TODO: Not implemetable328		Err("not implemented".into())329	}330331	/// @dev Not implemented332	fn safe_transfer_from(333		&mut self,334		_from: address,335		_to: address,336		_token_id: uint256,337	) -> Result<void> {338		// TODO: Not implemetable339		Err("not implemented".into())340	}341342	/// @notice Transfer ownership of an RFT -- THE CALLER IS RESPONSIBLE343	///  TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE344	///  THEY MAY BE PERMANENTLY LOST345	/// @dev Throws unless `msg.sender` is the current owner or an authorized346	///  operator for this RFT. Throws if `from` is not the current owner. Throws347	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.348	///  Throws if RFT pieces have multiple owners.349	/// @param from The current owner of the NFT350	/// @param to The new owner351	/// @param tokenId The NFT to transfer352	#[weight(<SelfWeightOf<T>>::transfer_from_creating_removing())]353	fn transfer_from(354		&mut self,355		caller: caller,356		from: address,357		to: address,358		token_id: uint256,359	) -> Result<void> {360		let caller = T::CrossAccountId::from_eth(caller);361		let from = T::CrossAccountId::from_eth(from);362		let to = T::CrossAccountId::from_eth(to);363		let token = token_id.try_into()?;364		let budget = self365			.recorder366			.weight_calls_budget(<StructureWeight<T>>::find_parent());367368		let balance = balance(&self, token, &from)?;369		ensure_single_owner(&self, token, balance)?;370371		<Pallet<T>>::transfer_from(self, &caller, &from, &to, token, balance, &budget)372			.map_err(dispatch_to_evm::<T>)?;373374		Ok(())375	}376377	/// @dev Not implemented378	fn approve(&mut self, _caller: caller, _approved: address, _token_id: uint256) -> Result<void> {379		Err("not implemented".into())380	}381382	/// @dev Not implemented383	fn set_approval_for_all(384		&mut self,385		_caller: caller,386		_operator: address,387		_approved: bool,388	) -> Result<void> {389		// TODO: Not implemetable390		Err("not implemented".into())391	}392393	/// @dev Not implemented394	fn get_approved(&self, _token_id: uint256) -> Result<address> {395		// TODO: Not implemetable396		Err("not implemented".into())397	}398399	/// @dev Not implemented400	fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {401		// TODO: Not implemetable402		Err("not implemented".into())403	}404}405406/// Returns amount of pieces of `token` that `owner` have407pub fn balance<T: Config>(408	collection: &RefungibleHandle<T>,409	token: TokenId,410	owner: &T::CrossAccountId,411) -> Result<u128> {412	collection.consume_store_reads(1)?;413	let balance = <Balance<T>>::get((collection.id, token, &owner));414	Ok(balance)415}416417/// Throws if `owner_balance` is lower than total amount of `token` pieces418pub fn ensure_single_owner<T: Config>(419	collection: &RefungibleHandle<T>,420	token: TokenId,421	owner_balance: u128,422) -> Result<()> {423	collection.consume_store_reads(1)?;424	let total_supply = <TotalSupply<T>>::get((collection.id, token));425	if total_supply != owner_balance {426		return Err("token has multiple owners".into());427	}428	Ok(())429}430431/// @title ERC721 Token that can be irreversibly burned (destroyed).432#[solidity_interface(name = ERC721Burnable)]433impl<T: Config> RefungibleHandle<T> {434	/// @notice Burns a specific ERC721 token.435	/// @dev Throws unless `msg.sender` is the current RFT owner, or an authorized436	///  operator of the current owner.437	/// @param tokenId The RFT to approve438	#[weight(<SelfWeightOf<T>>::burn_item_fully())]439	fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {440		let caller = T::CrossAccountId::from_eth(caller);441		let token = token_id.try_into()?;442443		let balance = balance(&self, token, &caller)?;444		ensure_single_owner(&self, token, balance)?;445446		<Pallet<T>>::burn(self, &caller, token, balance).map_err(dispatch_to_evm::<T>)?;447		Ok(())448	}449}450451/// @title ERC721 minting logic.452#[solidity_interface(name = ERC721UniqueMintable, events(ERC721UniqueMintableEvents))]453impl<T: Config> RefungibleHandle<T> {454	fn minting_finished(&self) -> Result<bool> {455		Ok(false)456	}457458	/// @notice Function to mint token.459	/// @param to The new owner460	/// @return uint256 The id of the newly minted token461	#[weight(<SelfWeightOf<T>>::create_item())]462	fn mint(&mut self, caller: caller, to: address) -> Result<uint256> {463		let token_id: uint256 = <TokensMinted<T>>::get(self.id)464			.checked_add(1)465			.ok_or("item id overflow")?466			.into();467		self.mint_check_id(caller, to, token_id)?;468		Ok(token_id)469	}470471	/// @notice Function to mint token.472	/// @dev `tokenId` should be obtained with `nextTokenId` method,473	///  unlike standard, you can't specify it manually474	/// @param to The new owner475	/// @param tokenId ID of the minted RFT476	#[solidity(hide, rename_selector = "mint")]477	#[weight(<SelfWeightOf<T>>::create_item())]478	fn mint_check_id(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {479		let caller = T::CrossAccountId::from_eth(caller);480		let to = T::CrossAccountId::from_eth(to);481		let token_id: u32 = token_id.try_into()?;482		let budget = self483			.recorder484			.weight_calls_budget(<StructureWeight<T>>::find_parent());485486		if <TokensMinted<T>>::get(self.id)487			.checked_add(1)488			.ok_or("item id overflow")?489			!= token_id490		{491			return Err("item id should be next".into());492		}493494		let users = [(to.clone(), 1)]495			.into_iter()496			.collect::<BTreeMap<_, _>>()497			.try_into()498			.unwrap();499		<Pallet<T>>::create_item(500			self,501			&caller,502			CreateItemData::<T::CrossAccountId> {503				users,504				properties: CollectionPropertiesVec::default(),505			},506			&budget,507		)508		.map_err(dispatch_to_evm::<T>)?;509510		Ok(true)511	}512513	/// @notice Function to mint token with the given tokenUri.514	/// @param to The new owner515	/// @param tokenUri Token URI that would be stored in the NFT properties516	/// @return uint256 The id of the newly minted token517	#[solidity(rename_selector = "mintWithTokenURI")]518	#[weight(<SelfWeightOf<T>>::create_item())]519	fn mint_with_token_uri(520		&mut self,521		caller: caller,522		to: address,523		token_uri: string,524	) -> Result<uint256> {525		let token_id: uint256 = <TokensMinted<T>>::get(self.id)526			.checked_add(1)527			.ok_or("item id overflow")?528			.into();529		self.mint_with_token_uri_check_id(caller, to, token_id, token_uri)?;530		Ok(token_id)531	}532533	/// @notice Function to mint token with the given tokenUri.534	/// @dev `tokenId` should be obtained with `nextTokenId` method,535	///  unlike standard, you can't specify it manually536	/// @param to The new owner537	/// @param tokenId ID of the minted RFT538	/// @param tokenUri Token URI that would be stored in the RFT properties539	#[solidity(hide, rename_selector = "mintWithTokenURI")]540	#[weight(<SelfWeightOf<T>>::create_item())]541	fn mint_with_token_uri_check_id(542		&mut self,543		caller: caller,544		to: address,545		token_id: uint256,546		token_uri: string,547	) -> Result<bool> {548		let key = key::url();549		let permission = get_token_permission::<T>(self.id, &key)?;550		if !permission.collection_admin {551			return Err("Operation is not allowed".into());552		}553554		let caller = T::CrossAccountId::from_eth(caller);555		let to = T::CrossAccountId::from_eth(to);556		let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;557		let budget = self558			.recorder559			.weight_calls_budget(<StructureWeight<T>>::find_parent());560561		if <TokensMinted<T>>::get(self.id)562			.checked_add(1)563			.ok_or("item id overflow")?564			!= token_id565		{566			return Err("item id should be next".into());567		}568569		let mut properties = CollectionPropertiesVec::default();570		properties571			.try_push(Property {572				key,573				value: token_uri574					.into_bytes()575					.try_into()576					.map_err(|_| "token uri is too long")?,577			})578			.map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;579580		let users = [(to.clone(), 1)]581			.into_iter()582			.collect::<BTreeMap<_, _>>()583			.try_into()584			.unwrap();585		<Pallet<T>>::create_item(586			self,587			&caller,588			CreateItemData::<T::CrossAccountId> { users, properties },589			&budget,590		)591		.map_err(dispatch_to_evm::<T>)?;592		Ok(true)593	}594595	/// @dev Not implemented596	fn finish_minting(&mut self, _caller: caller) -> Result<bool> {597		Err("not implementable".into())598	}599}600601fn get_token_property<T: Config>(602	collection: &CollectionHandle<T>,603	token_id: u32,604	key: &up_data_structs::PropertyKey,605) -> Result<string> {606	collection.consume_store_reads(1)?;607	let properties = <TokenProperties<T>>::try_get((collection.id, token_id))608		.map_err(|_| Error::Revert("Token properties not found".into()))?;609	if let Some(property) = properties.get(key) {610		return Ok(string::from_utf8_lossy(property).into());611	}612613	Err("Property tokenURI not found".into())614}615616fn get_token_permission<T: Config>(617	collection_id: CollectionId,618	key: &PropertyKey,619) -> Result<PropertyPermission> {620	let token_property_permissions = CollectionPropertyPermissions::<T>::try_get(collection_id)621		.map_err(|_| Error::Revert("No permissions for collection".into()))?;622	let a = token_property_permissions623		.get(key)624		.map(Clone::clone)625		.ok_or_else(|| {626			let key = string::from_utf8(key.clone().into_inner()).unwrap_or_default();627			Error::Revert(alloc::format!("No permission for key {}", key))628		})?;629	Ok(a)630}631632/// @title Unique extensions for ERC721.633#[solidity_interface(name = ERC721UniqueExtensions)]634impl<T: Config> RefungibleHandle<T> {635	/// @notice A descriptive name for a collection of NFTs in this contract636	fn name(&self) -> Result<string> {637		Ok(decode_utf16(self.name.iter().copied())638			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))639			.collect::<string>())640	}641642	/// @notice An abbreviated name for NFTs in this contract643	fn symbol(&self) -> Result<string> {644		Ok(string::from_utf8_lossy(&self.token_prefix).into())645	}646647	/// @notice Transfer ownership of an RFT648	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`649	///  is the zero address. Throws if `tokenId` is not a valid RFT.650	///  Throws if RFT pieces have multiple owners.651	/// @param to The new owner652	/// @param tokenId The RFT to transfer653	#[weight(<SelfWeightOf<T>>::transfer_creating_removing())]654	fn transfer(&mut self, caller: caller, to: address, token_id: uint256) -> Result<void> {655		let caller = T::CrossAccountId::from_eth(caller);656		let to = T::CrossAccountId::from_eth(to);657		let token = token_id.try_into()?;658		let budget = self659			.recorder660			.weight_calls_budget(<StructureWeight<T>>::find_parent());661662		let balance = balance(&self, token, &caller)?;663		ensure_single_owner(&self, token, balance)?;664665		<Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)666			.map_err(dispatch_to_evm::<T>)?;667		Ok(())668	}669670	/// @notice Burns a specific ERC721 token.671	/// @dev Throws unless `msg.sender` is the current owner or an authorized672	///  operator for this RFT. Throws if `from` is not the current owner. Throws673	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.674	///  Throws if RFT pieces have multiple owners.675	/// @param from The current owner of the RFT676	/// @param tokenId The RFT to transfer677	#[weight(<SelfWeightOf<T>>::burn_from())]678	fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {679		let caller = T::CrossAccountId::from_eth(caller);680		let from = T::CrossAccountId::from_eth(from);681		let token = token_id.try_into()?;682		let budget = self683			.recorder684			.weight_calls_budget(<StructureWeight<T>>::find_parent());685686		let balance = balance(&self, token, &caller)?;687		ensure_single_owner(&self, token, balance)?;688689		<Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)690			.map_err(dispatch_to_evm::<T>)?;691		Ok(())692	}693694	/// @notice Returns next free RFT ID.695	fn next_token_id(&self) -> Result<uint256> {696		self.consume_store_reads(1)?;697		Ok(<TokensMinted<T>>::get(self.id)698			.checked_add(1)699			.ok_or("item id overflow")?700			.into())701	}702703	/// @notice Function to mint multiple tokens.704	/// @dev `tokenIds` should be an array of consecutive numbers and first number705	///  should be obtained with `nextTokenId` method706	/// @param to The new owner707	/// @param tokenIds IDs of the minted RFTs708	#[solidity(hide)]709	#[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]710	fn mint_bulk(&mut self, caller: caller, to: address, token_ids: Vec<uint256>) -> Result<bool> {711		let caller = T::CrossAccountId::from_eth(caller);712		let to = T::CrossAccountId::from_eth(to);713		let mut expected_index = <TokensMinted<T>>::get(self.id)714			.checked_add(1)715			.ok_or("item id overflow")?;716		let budget = self717			.recorder718			.weight_calls_budget(<StructureWeight<T>>::find_parent());719720		let total_tokens = token_ids.len();721		for id in token_ids.into_iter() {722			let id: u32 = id.try_into().map_err(|_| "token id overflow")?;723			if id != expected_index {724				return Err("item id should be next".into());725			}726			expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;727		}728		let users = [(to.clone(), 1)]729			.into_iter()730			.collect::<BTreeMap<_, _>>()731			.try_into()732			.unwrap();733		let create_item_data = CreateItemData::<T::CrossAccountId> {734			users,735			properties: CollectionPropertiesVec::default(),736		};737		let data = (0..total_tokens)738			.map(|_| create_item_data.clone())739			.collect();740741		<Pallet<T>>::create_multiple_items(self, &caller, data, &budget)742			.map_err(dispatch_to_evm::<T>)?;743		Ok(true)744	}745746	/// @notice Function to mint multiple tokens with the given tokenUris.747	/// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive748	///  numbers and first number should be obtained with `nextTokenId` method749	/// @param to The new owner750	/// @param tokens array of pairs of token ID and token URI for minted tokens751	#[solidity(hide, rename_selector = "mintBulkWithTokenURI")]752	#[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]753	fn mint_bulk_with_token_uri(754		&mut self,755		caller: caller,756		to: address,757		tokens: Vec<(uint256, string)>,758	) -> Result<bool> {759		let key = key::url();760		let caller = T::CrossAccountId::from_eth(caller);761		let to = T::CrossAccountId::from_eth(to);762		let mut expected_index = <TokensMinted<T>>::get(self.id)763			.checked_add(1)764			.ok_or("item id overflow")?;765		let budget = self766			.recorder767			.weight_calls_budget(<StructureWeight<T>>::find_parent());768769		let mut data = Vec::with_capacity(tokens.len());770		let users: BoundedBTreeMap<_, _, _> = [(to.clone(), 1)]771			.into_iter()772			.collect::<BTreeMap<_, _>>()773			.try_into()774			.unwrap();775		for (id, token_uri) in tokens {776			let id: u32 = id.try_into().map_err(|_| "token id overflow")?;777			if id != expected_index {778				return Err("item id should be next".into());779			}780			expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;781782			let mut properties = CollectionPropertiesVec::default();783			properties784				.try_push(Property {785					key: key.clone(),786					value: token_uri787						.into_bytes()788						.try_into()789						.map_err(|_| "token uri is too long")?,790				})791				.map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;792793			let create_item_data = CreateItemData::<T::CrossAccountId> {794				users: users.clone(),795				properties,796			};797			data.push(create_item_data);798		}799800		<Pallet<T>>::create_multiple_items(self, &caller, data, &budget)801			.map_err(dispatch_to_evm::<T>)?;802		Ok(true)803	}804805	/// Returns EVM address for refungible token806	///807	/// @param token ID of the token808	fn token_contract_address(&self, token: uint256) -> Result<address> {809		Ok(T::EvmTokenAddressMapping::token_to_address(810			self.id,811			token.try_into().map_err(|_| "token id overflow")?,812		))813	}814}815816#[solidity_interface(817	name = UniqueRefungible,818	is(819		ERC721,820		ERC721Enumerable,821		ERC721UniqueExtensions,822		ERC721UniqueMintable,823		ERC721Burnable,824		ERC721Metadata(if(this.flags.erc721metadata)),825		Collection(via(common_mut returns CollectionHandle<T>)),826		TokenProperties,827	)828)]829impl<T: Config> RefungibleHandle<T> where T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]> {}830831// Not a tests, but code generators832generate_stubgen!(gen_impl, UniqueRefungibleCall<()>, true);833generate_stubgen!(gen_iface, UniqueRefungibleCall<()>, false);834835impl<T: Config> CommonEvmHandler for RefungibleHandle<T>836where837	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,838{839	const CODE: &'static [u8] = include_bytes!("./stubs/UniqueRefungible.raw");840	fn call(841		self,842		handle: &mut impl PrecompileHandle,843	) -> Option<pallet_common::erc::PrecompileResult> {844		call::<T, UniqueRefungibleCall<T>, _, _>(handle, self)845	}846}
after · pallets/refungible/src/erc.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//! # Refungible Pallet EVM API for tokens18//!19//! Provides ERC-721 standart support implementation and EVM API for unique extensions for Refungible Pallet.20//! Method implementations are mostly doing parameter conversion and calling Refungible Pallet methods.2122extern crate alloc;2324use core::{25	char::{REPLACEMENT_CHARACTER, decode_utf16},26	convert::TryInto,27};28use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};29use frame_support::{BoundedBTreeMap, BoundedVec};30use pallet_common::{31	CollectionHandle, CollectionPropertyPermissions,32	erc::{CommonEvmHandler, CollectionCall, static_property::key},33	eth::convert_tuple_to_cross_account,34};35use pallet_evm::{account::CrossAccountId, PrecompileHandle};36use pallet_evm_coder_substrate::{call, dispatch_to_evm};37use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};38use sp_core::H160;39use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};40use up_data_structs::{41	CollectionId, CollectionPropertiesVec, mapping::TokenAddressMapping, Property, PropertyKey,42	PropertyKeyPermission, PropertyPermission, TokenId,43};4445use crate::{46	AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle, SelfWeightOf,47	TokenProperties, TokensMinted, TotalSupply, weights::WeightInfo,48};4950pub const ADDRESS_FOR_PARTIALLY_OWNED_TOKENS: H160 = H160::repeat_byte(0xff);5152/// @title A contract that allows to set and delete token properties and change token property permissions.53#[solidity_interface(name = TokenProperties)]54impl<T: Config> RefungibleHandle<T> {55	/// @notice Set permissions for token property.56	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.57	/// @param key Property key.58	/// @param isMutable Permission to mutate property.59	/// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.60	/// @param tokenOwner Permission to mutate property by token owner if property is mutable.61	fn set_token_property_permission(62		&mut self,63		caller: caller,64		key: string,65		is_mutable: bool,66		collection_admin: bool,67		token_owner: bool,68	) -> Result<()> {69		let caller = T::CrossAccountId::from_eth(caller);70		<Pallet<T>>::set_token_property_permissions(71			self,72			&caller,73			vec![PropertyKeyPermission {74				key: <Vec<u8>>::from(key)75					.try_into()76					.map_err(|_| "too long key")?,77				permission: PropertyPermission {78					mutable: is_mutable,79					collection_admin,80					token_owner,81				},82			}],83		)84		.map_err(dispatch_to_evm::<T>)85	}8687	/// @notice Set token property value.88	/// @dev Throws error if `msg.sender` has no permission to edit the property.89	/// @param tokenId ID of the token.90	/// @param key Property key.91	/// @param value Property value.92	fn set_property(93		&mut self,94		caller: caller,95		token_id: uint256,96		key: string,97		value: bytes,98	) -> Result<()> {99		let caller = T::CrossAccountId::from_eth(caller);100		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;101		let key = <Vec<u8>>::from(key)102			.try_into()103			.map_err(|_| "key too long")?;104		let value = value.0.try_into().map_err(|_| "value too long")?;105106		let nesting_budget = self107			.recorder108			.weight_calls_budget(<StructureWeight<T>>::find_parent());109110		<Pallet<T>>::set_token_property(111			self,112			&caller,113			TokenId(token_id),114			Property { key, value },115			&nesting_budget,116		)117		.map_err(dispatch_to_evm::<T>)118	}119120	/// @notice Set token properties value.121	/// @dev Throws error if `msg.sender` has no permission to edit the property.122	/// @param tokenId ID of the token.123	/// @param properties settable properties124	fn set_properties(125		&mut self,126		caller: caller,127		token_id: uint256,128		properties: Vec<(string, bytes)>,129	) -> Result<()> {130		let caller = T::CrossAccountId::from_eth(caller);131		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;132133		let nesting_budget = self134			.recorder135			.weight_calls_budget(<StructureWeight<T>>::find_parent());136137		let properties = properties138			.into_iter()139			.map(|(key, value)| {140				let key = <Vec<u8>>::from(key)141					.try_into()142					.map_err(|_| "key too large")?;143144				let value = value.0.try_into().map_err(|_| "value too large")?;145146				Ok(Property { key, value })147			})148			.collect::<Result<Vec<_>>>()?;149150		<Pallet<T>>::set_token_properties(151			self,152			&caller,153			TokenId(token_id),154			properties.into_iter(),155			<Pallet<T>>::token_exists(&self, TokenId(token_id)),156			&nesting_budget,157		)158		.map_err(dispatch_to_evm::<T>)159	}160161	/// @notice Delete token property value.162	/// @dev Throws error if `msg.sender` has no permission to edit the property.163	/// @param tokenId ID of the token.164	/// @param key Property key.165	fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {166		let caller = T::CrossAccountId::from_eth(caller);167		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;168		let key = <Vec<u8>>::from(key)169			.try_into()170			.map_err(|_| "key too long")?;171172		let nesting_budget = self173			.recorder174			.weight_calls_budget(<StructureWeight<T>>::find_parent());175176		<Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key, &nesting_budget)177			.map_err(dispatch_to_evm::<T>)178	}179180	/// @notice Get token property value.181	/// @dev Throws error if key not found182	/// @param tokenId ID of the token.183	/// @param key Property key.184	/// @return Property value bytes185	fn property(&self, token_id: uint256, key: string) -> Result<bytes> {186		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;187		let key = <Vec<u8>>::from(key)188			.try_into()189			.map_err(|_| "key too long")?;190191		let props = <TokenProperties<T>>::get((self.id, token_id));192		let prop = props.get(&key).ok_or("key not found")?;193194		Ok(prop.to_vec().into())195	}196}197198#[derive(ToLog)]199pub enum ERC721Events {200	/// @dev This event emits when NFTs are created (`from` == 0) and destroyed201	///  (`to` == 0). Exception: during contract creation, any number of RFTs202	///  may be created and assigned without emitting Transfer.203	Transfer {204		#[indexed]205		from: address,206		#[indexed]207		to: address,208		#[indexed]209		token_id: uint256,210	},211	/// @dev Not supported212	Approval {213		#[indexed]214		owner: address,215		#[indexed]216		approved: address,217		#[indexed]218		token_id: uint256,219	},220	/// @dev Not supported221	#[allow(dead_code)]222	ApprovalForAll {223		#[indexed]224		owner: address,225		#[indexed]226		operator: address,227		approved: bool,228	},229}230231#[derive(ToLog)]232pub enum ERC721UniqueMintableEvents {233	/// @dev Not supported234	#[allow(dead_code)]235	MintingFinished {},236}237238#[solidity_interface(name = ERC721Metadata)]239impl<T: Config> RefungibleHandle<T>240where241	T::AccountId: From<[u8; 32]>,242{243	/// @notice A descriptive name for a collection of NFTs in this contract244	/// @dev real implementation of this function lies in `ERC721UniqueExtensions`245	#[solidity(hide, rename_selector = "name")]246	fn name_proxy(&self) -> Result<string> {247		self.name()248	}249250	/// @notice An abbreviated name for NFTs in this contract251	/// @dev real implementation of this function lies in `ERC721UniqueExtensions`252	#[solidity(hide, rename_selector = "symbol")]253	fn symbol_proxy(&self) -> Result<string> {254		self.symbol()255	}256257	/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.258	///259	/// @dev If the token has a `url` property and it is not empty, it is returned.260	///  Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.261	///  If the collection property `baseURI` is empty or absent, return "" (empty string)262	///  otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix263	///  otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).264	///265	/// @return token's const_metadata266	#[solidity(rename_selector = "tokenURI")]267	fn token_uri(&self, token_id: uint256) -> Result<string> {268		let token_id_u32: u32 = token_id.try_into().map_err(|_| "token id overflow")?;269270		match get_token_property(self, token_id_u32, &key::url()).as_deref() {271			Err(_) | Ok("") => (),272			Ok(url) => {273				return Ok(url.into());274			}275		};276277		let base_uri =278			pallet_common::Pallet::<T>::get_collection_property(self.id, &key::base_uri())279				.map(BoundedVec::into_inner)280				.map(string::from_utf8)281				.transpose()282				.map_err(|e| {283					Error::Revert(alloc::format!(284						"Can not convert value \"baseURI\" to string with error \"{}\"",285						e286					))287				})?;288289		let base_uri = match base_uri.as_deref() {290			None | Some("") => {291				return Ok("".into());292			}293			Some(base_uri) => base_uri.into(),294		};295296		Ok(297			match get_token_property(self, token_id_u32, &key::suffix()).as_deref() {298				Err(_) | Ok("") => base_uri,299				Ok(suffix) => base_uri + suffix,300			},301		)302	}303}304305/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension306/// @dev See https://eips.ethereum.org/EIPS/eip-721307#[solidity_interface(name = ERC721Enumerable)]308impl<T: Config> RefungibleHandle<T> {309	/// @notice Enumerate valid RFTs310	/// @param index A counter less than `totalSupply()`311	/// @return The token identifier for the `index`th NFT,312	///  (sort order not specified)313	fn token_by_index(&self, index: uint256) -> Result<uint256> {314		Ok(index)315	}316317	/// Not implemented318	fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {319		// TODO: Not implemetable320		Err("not implemented".into())321	}322323	/// @notice Count RFTs tracked by this contract324	/// @return A count of valid RFTs tracked by this contract, where each one of325	///  them has an assigned and queryable owner not equal to the zero address326	fn total_supply(&self) -> Result<uint256> {327		self.consume_store_reads(1)?;328		Ok(<Pallet<T>>::total_supply(self).into())329	}330}331332/// @title ERC-721 Non-Fungible Token Standard333/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md334#[solidity_interface(name = ERC721, events(ERC721Events))]335impl<T: Config> RefungibleHandle<T> {336	/// @notice Count all RFTs assigned to an owner337	/// @dev RFTs assigned to the zero address are considered invalid, and this338	///  function throws for queries about the zero address.339	/// @param owner An address for whom to query the balance340	/// @return The number of RFTs owned by `owner`, possibly zero341	fn balance_of(&self, owner: address) -> Result<uint256> {342		self.consume_store_reads(1)?;343		let owner = T::CrossAccountId::from_eth(owner);344		let balance = <AccountBalance<T>>::get((self.id, owner));345		Ok(balance.into())346	}347348	/// @notice Find the owner of an RFT349	/// @dev RFTs assigned to zero address are considered invalid, and queries350	///  about them do throw.351	///  Returns special 0xffffffffffffffffffffffffffffffffffffffff address for352	///  the tokens that are partially owned.353	/// @param tokenId The identifier for an RFT354	/// @return The address of the owner of the RFT355	fn owner_of(&self, token_id: uint256) -> Result<address> {356		self.consume_store_reads(2)?;357		let token = token_id.try_into()?;358		let owner = <Pallet<T>>::token_owner(self.id, token);359		Ok(owner360			.map(|address| *address.as_eth())361			.unwrap_or_else(|| ADDRESS_FOR_PARTIALLY_OWNED_TOKENS))362	}363364	/// @dev Not implemented365	fn safe_transfer_from_with_data(366		&mut self,367		_from: address,368		_to: address,369		_token_id: uint256,370		_data: bytes,371	) -> Result<void> {372		// TODO: Not implemetable373		Err("not implemented".into())374	}375376	/// @dev Not implemented377	fn safe_transfer_from(378		&mut self,379		_from: address,380		_to: address,381		_token_id: uint256,382	) -> Result<void> {383		// TODO: Not implemetable384		Err("not implemented".into())385	}386387	/// @notice Transfer ownership of an RFT -- THE CALLER IS RESPONSIBLE388	///  TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE389	///  THEY MAY BE PERMANENTLY LOST390	/// @dev Throws unless `msg.sender` is the current owner or an authorized391	///  operator for this RFT. Throws if `from` is not the current owner. Throws392	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.393	///  Throws if RFT pieces have multiple owners.394	/// @param from The current owner of the NFT395	/// @param to The new owner396	/// @param tokenId The NFT to transfer397	#[weight(<SelfWeightOf<T>>::transfer_from_creating_removing())]398	fn transfer_from(399		&mut self,400		caller: caller,401		from: address,402		to: address,403		token_id: uint256,404	) -> Result<void> {405		let caller = T::CrossAccountId::from_eth(caller);406		let from = T::CrossAccountId::from_eth(from);407		let to = T::CrossAccountId::from_eth(to);408		let token = token_id.try_into()?;409		let budget = self410			.recorder411			.weight_calls_budget(<StructureWeight<T>>::find_parent());412413		let balance = balance(&self, token, &from)?;414		ensure_single_owner(&self, token, balance)?;415416		<Pallet<T>>::transfer_from(self, &caller, &from, &to, token, balance, &budget)417			.map_err(dispatch_to_evm::<T>)?;418419		Ok(())420	}421422	/// @dev Not implemented423	fn approve(&mut self, _caller: caller, _approved: address, _token_id: uint256) -> Result<void> {424		Err("not implemented".into())425	}426427	/// @dev Not implemented428	fn set_approval_for_all(429		&mut self,430		_caller: caller,431		_operator: address,432		_approved: bool,433	) -> Result<void> {434		// TODO: Not implemetable435		Err("not implemented".into())436	}437438	/// @dev Not implemented439	fn get_approved(&self, _token_id: uint256) -> Result<address> {440		// TODO: Not implemetable441		Err("not implemented".into())442	}443444	/// @dev Not implemented445	fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {446		// TODO: Not implemetable447		Err("not implemented".into())448	}449}450451/// Returns amount of pieces of `token` that `owner` have452pub fn balance<T: Config>(453	collection: &RefungibleHandle<T>,454	token: TokenId,455	owner: &T::CrossAccountId,456) -> Result<u128> {457	collection.consume_store_reads(1)?;458	let balance = <Balance<T>>::get((collection.id, token, &owner));459	Ok(balance)460}461462/// Throws if `owner_balance` is lower than total amount of `token` pieces463pub fn ensure_single_owner<T: Config>(464	collection: &RefungibleHandle<T>,465	token: TokenId,466	owner_balance: u128,467) -> Result<()> {468	collection.consume_store_reads(1)?;469	let total_supply = <TotalSupply<T>>::get((collection.id, token));470	if total_supply != owner_balance {471		return Err("token has multiple owners".into());472	}473	Ok(())474}475476/// @title ERC721 Token that can be irreversibly burned (destroyed).477#[solidity_interface(name = ERC721Burnable)]478impl<T: Config> RefungibleHandle<T> {479	/// @notice Burns a specific ERC721 token.480	/// @dev Throws unless `msg.sender` is the current RFT owner, or an authorized481	///  operator of the current owner.482	/// @param tokenId The RFT to approve483	#[weight(<SelfWeightOf<T>>::burn_item_fully())]484	fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {485		let caller = T::CrossAccountId::from_eth(caller);486		let token = token_id.try_into()?;487488		let balance = balance(&self, token, &caller)?;489		ensure_single_owner(&self, token, balance)?;490491		<Pallet<T>>::burn(self, &caller, token, balance).map_err(dispatch_to_evm::<T>)?;492		Ok(())493	}494}495496/// @title ERC721 minting logic.497#[solidity_interface(name = ERC721UniqueMintable, events(ERC721UniqueMintableEvents))]498impl<T: Config> RefungibleHandle<T> {499	fn minting_finished(&self) -> Result<bool> {500		Ok(false)501	}502503	/// @notice Function to mint token.504	/// @param to The new owner505	/// @return uint256 The id of the newly minted token506	#[weight(<SelfWeightOf<T>>::create_item())]507	fn mint(&mut self, caller: caller, to: address) -> Result<uint256> {508		let token_id: uint256 = <TokensMinted<T>>::get(self.id)509			.checked_add(1)510			.ok_or("item id overflow")?511			.into();512		self.mint_check_id(caller, to, token_id)?;513		Ok(token_id)514	}515516	/// @notice Function to mint token.517	/// @dev `tokenId` should be obtained with `nextTokenId` method,518	///  unlike standard, you can't specify it manually519	/// @param to The new owner520	/// @param tokenId ID of the minted RFT521	#[solidity(hide, rename_selector = "mint")]522	#[weight(<SelfWeightOf<T>>::create_item())]523	fn mint_check_id(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {524		let caller = T::CrossAccountId::from_eth(caller);525		let to = T::CrossAccountId::from_eth(to);526		let token_id: u32 = token_id.try_into()?;527		let budget = self528			.recorder529			.weight_calls_budget(<StructureWeight<T>>::find_parent());530531		if <TokensMinted<T>>::get(self.id)532			.checked_add(1)533			.ok_or("item id overflow")?534			!= token_id535		{536			return Err("item id should be next".into());537		}538539		let users = [(to.clone(), 1)]540			.into_iter()541			.collect::<BTreeMap<_, _>>()542			.try_into()543			.unwrap();544		<Pallet<T>>::create_item(545			self,546			&caller,547			CreateItemData::<T::CrossAccountId> {548				users,549				properties: CollectionPropertiesVec::default(),550			},551			&budget,552		)553		.map_err(dispatch_to_evm::<T>)?;554555		Ok(true)556	}557558	/// @notice Function to mint token with the given tokenUri.559	/// @param to The new owner560	/// @param tokenUri Token URI that would be stored in the NFT properties561	/// @return uint256 The id of the newly minted token562	#[solidity(rename_selector = "mintWithTokenURI")]563	#[weight(<SelfWeightOf<T>>::create_item())]564	fn mint_with_token_uri(565		&mut self,566		caller: caller,567		to: address,568		token_uri: string,569	) -> Result<uint256> {570		let token_id: uint256 = <TokensMinted<T>>::get(self.id)571			.checked_add(1)572			.ok_or("item id overflow")?573			.into();574		self.mint_with_token_uri_check_id(caller, to, token_id, token_uri)?;575		Ok(token_id)576	}577578	/// @notice Function to mint token with the given tokenUri.579	/// @dev `tokenId` should be obtained with `nextTokenId` method,580	///  unlike standard, you can't specify it manually581	/// @param to The new owner582	/// @param tokenId ID of the minted RFT583	/// @param tokenUri Token URI that would be stored in the RFT properties584	#[solidity(hide, rename_selector = "mintWithTokenURI")]585	#[weight(<SelfWeightOf<T>>::create_item())]586	fn mint_with_token_uri_check_id(587		&mut self,588		caller: caller,589		to: address,590		token_id: uint256,591		token_uri: string,592	) -> Result<bool> {593		let key = key::url();594		let permission = get_token_permission::<T>(self.id, &key)?;595		if !permission.collection_admin {596			return Err("Operation is not allowed".into());597		}598599		let caller = T::CrossAccountId::from_eth(caller);600		let to = T::CrossAccountId::from_eth(to);601		let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;602		let budget = self603			.recorder604			.weight_calls_budget(<StructureWeight<T>>::find_parent());605606		if <TokensMinted<T>>::get(self.id)607			.checked_add(1)608			.ok_or("item id overflow")?609			!= token_id610		{611			return Err("item id should be next".into());612		}613614		let mut properties = CollectionPropertiesVec::default();615		properties616			.try_push(Property {617				key,618				value: token_uri619					.into_bytes()620					.try_into()621					.map_err(|_| "token uri is too long")?,622			})623			.map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;624625		let users = [(to.clone(), 1)]626			.into_iter()627			.collect::<BTreeMap<_, _>>()628			.try_into()629			.unwrap();630		<Pallet<T>>::create_item(631			self,632			&caller,633			CreateItemData::<T::CrossAccountId> { users, properties },634			&budget,635		)636		.map_err(dispatch_to_evm::<T>)?;637		Ok(true)638	}639640	/// @dev Not implemented641	fn finish_minting(&mut self, _caller: caller) -> Result<bool> {642		Err("not implementable".into())643	}644}645646fn get_token_property<T: Config>(647	collection: &CollectionHandle<T>,648	token_id: u32,649	key: &up_data_structs::PropertyKey,650) -> Result<string> {651	collection.consume_store_reads(1)?;652	let properties = <TokenProperties<T>>::try_get((collection.id, token_id))653		.map_err(|_| Error::Revert("Token properties not found".into()))?;654	if let Some(property) = properties.get(key) {655		return Ok(string::from_utf8_lossy(property).into());656	}657658	Err("Property tokenURI not found".into())659}660661fn get_token_permission<T: Config>(662	collection_id: CollectionId,663	key: &PropertyKey,664) -> Result<PropertyPermission> {665	let token_property_permissions = CollectionPropertyPermissions::<T>::try_get(collection_id)666		.map_err(|_| Error::Revert("No permissions for collection".into()))?;667	let a = token_property_permissions668		.get(key)669		.map(Clone::clone)670		.ok_or_else(|| {671			let key = string::from_utf8(key.clone().into_inner()).unwrap_or_default();672			Error::Revert(alloc::format!("No permission for key {}", key))673		})?;674	Ok(a)675}676677/// @title Unique extensions for ERC721.678#[solidity_interface(name = ERC721UniqueExtensions)]679impl<T: Config> RefungibleHandle<T>680where681	T::AccountId: From<[u8; 32]>,682{683	/// @notice A descriptive name for a collection of NFTs in this contract684	fn name(&self) -> Result<string> {685		Ok(decode_utf16(self.name.iter().copied())686			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))687			.collect::<string>())688	}689690	/// @notice An abbreviated name for NFTs in this contract691	fn symbol(&self) -> Result<string> {692		Ok(string::from_utf8_lossy(&self.token_prefix).into())693	}694695	/// @notice Transfer ownership of an RFT696	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`697	///  is the zero address. Throws if `tokenId` is not a valid RFT.698	///  Throws if RFT pieces have multiple owners.699	/// @param to The new owner700	/// @param tokenId The RFT to transfer701	#[weight(<SelfWeightOf<T>>::transfer_creating_removing())]702	fn transfer(&mut self, caller: caller, to: address, token_id: uint256) -> Result<void> {703		let caller = T::CrossAccountId::from_eth(caller);704		let to = T::CrossAccountId::from_eth(to);705		let token = token_id.try_into()?;706		let budget = self707			.recorder708			.weight_calls_budget(<StructureWeight<T>>::find_parent());709710		let balance = balance(self, token, &caller)?;711		ensure_single_owner(self, token, balance)?;712713		<Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)714			.map_err(dispatch_to_evm::<T>)?;715		Ok(())716	}717718	/// @notice Transfer ownership of an RFT719	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`720	///  is the zero address. Throws if `tokenId` is not a valid RFT.721	///  Throws if RFT pieces have multiple owners.722	/// @param to The new owner723	/// @param tokenId The RFT to transfer724	#[weight(<SelfWeightOf<T>>::transfer_creating_removing())]725	fn transfer_from_cross(726		&mut self,727		caller: caller,728		from: (address, uint256),729		to: (address, uint256),730		token_id: uint256,731	) -> Result<void> {732		let caller = T::CrossAccountId::from_eth(caller);733		let from = convert_tuple_to_cross_account::<T>(from)?;734		let to = convert_tuple_to_cross_account::<T>(to)?;735		let token_id = token_id.try_into()?;736		let budget = self737			.recorder738			.weight_calls_budget(<StructureWeight<T>>::find_parent());739740		let balance = balance(self, token_id, &from)?;741		ensure_single_owner(self, token_id, balance)?;742743		Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, balance, &budget)744			.map_err(dispatch_to_evm::<T>)?;745		Ok(())746	}747748	/// @notice Burns a specific ERC721 token.749	/// @dev Throws unless `msg.sender` is the current owner or an authorized750	///  operator for this RFT. Throws if `from` is not the current owner. Throws751	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.752	///  Throws if RFT pieces have multiple owners.753	/// @param from The current owner of the RFT754	/// @param tokenId The RFT to transfer755	#[weight(<SelfWeightOf<T>>::burn_from())]756	fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {757		let caller = T::CrossAccountId::from_eth(caller);758		let from = T::CrossAccountId::from_eth(from);759		let token = token_id.try_into()?;760		let budget = self761			.recorder762			.weight_calls_budget(<StructureWeight<T>>::find_parent());763764		let balance = balance(self, token, &from)?;765		ensure_single_owner(self, token, balance)?;766767		<Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)768			.map_err(dispatch_to_evm::<T>)?;769		Ok(())770	}771772	/// @notice Burns a specific ERC721 token.773	/// @dev Throws unless `msg.sender` is the current owner or an authorized774	///  operator for this RFT. Throws if `from` is not the current owner. Throws775	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.776	///  Throws if RFT pieces have multiple owners.777	/// @param from The current owner of the RFT778	/// @param tokenId The RFT to transfer779	#[weight(<SelfWeightOf<T>>::burn_from())]780	fn burn_from_cross(781		&mut self,782		caller: caller,783		from: (address, uint256),784		token_id: uint256,785	) -> Result<void> {786		let caller = T::CrossAccountId::from_eth(caller);787		let from = convert_tuple_to_cross_account::<T>(from)?;788		let token = token_id.try_into()?;789		let budget = self790			.recorder791			.weight_calls_budget(<StructureWeight<T>>::find_parent());792793		let balance = balance(self, token, &from)?;794		ensure_single_owner(self, token, balance)?;795796		<Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)797			.map_err(dispatch_to_evm::<T>)?;798		Ok(())799	}800801	/// @notice Returns next free RFT ID.802	fn next_token_id(&self) -> Result<uint256> {803		self.consume_store_reads(1)?;804		Ok(<TokensMinted<T>>::get(self.id)805			.checked_add(1)806			.ok_or("item id overflow")?807			.into())808	}809810	/// @notice Function to mint multiple tokens.811	/// @dev `tokenIds` should be an array of consecutive numbers and first number812	///  should be obtained with `nextTokenId` method813	/// @param to The new owner814	/// @param tokenIds IDs of the minted RFTs815	#[solidity(hide)]816	#[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]817	fn mint_bulk(&mut self, caller: caller, to: address, token_ids: Vec<uint256>) -> Result<bool> {818		let caller = T::CrossAccountId::from_eth(caller);819		let to = T::CrossAccountId::from_eth(to);820		let mut expected_index = <TokensMinted<T>>::get(self.id)821			.checked_add(1)822			.ok_or("item id overflow")?;823		let budget = self824			.recorder825			.weight_calls_budget(<StructureWeight<T>>::find_parent());826827		let total_tokens = token_ids.len();828		for id in token_ids.into_iter() {829			let id: u32 = id.try_into().map_err(|_| "token id overflow")?;830			if id != expected_index {831				return Err("item id should be next".into());832			}833			expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;834		}835		let users = [(to.clone(), 1)]836			.into_iter()837			.collect::<BTreeMap<_, _>>()838			.try_into()839			.unwrap();840		let create_item_data = CreateItemData::<T::CrossAccountId> {841			users,842			properties: CollectionPropertiesVec::default(),843		};844		let data = (0..total_tokens)845			.map(|_| create_item_data.clone())846			.collect();847848		<Pallet<T>>::create_multiple_items(self, &caller, data, &budget)849			.map_err(dispatch_to_evm::<T>)?;850		Ok(true)851	}852853	/// @notice Function to mint multiple tokens with the given tokenUris.854	/// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive855	///  numbers and first number should be obtained with `nextTokenId` method856	/// @param to The new owner857	/// @param tokens array of pairs of token ID and token URI for minted tokens858	#[solidity(hide, rename_selector = "mintBulkWithTokenURI")]859	#[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]860	fn mint_bulk_with_token_uri(861		&mut self,862		caller: caller,863		to: address,864		tokens: Vec<(uint256, string)>,865	) -> Result<bool> {866		let key = key::url();867		let caller = T::CrossAccountId::from_eth(caller);868		let to = T::CrossAccountId::from_eth(to);869		let mut expected_index = <TokensMinted<T>>::get(self.id)870			.checked_add(1)871			.ok_or("item id overflow")?;872		let budget = self873			.recorder874			.weight_calls_budget(<StructureWeight<T>>::find_parent());875876		let mut data = Vec::with_capacity(tokens.len());877		let users: BoundedBTreeMap<_, _, _> = [(to.clone(), 1)]878			.into_iter()879			.collect::<BTreeMap<_, _>>()880			.try_into()881			.unwrap();882		for (id, token_uri) in tokens {883			let id: u32 = id.try_into().map_err(|_| "token id overflow")?;884			if id != expected_index {885				return Err("item id should be next".into());886			}887			expected_index = expected_index.checked_add(1).ok_or("item id overflow")?;888889			let mut properties = CollectionPropertiesVec::default();890			properties891				.try_push(Property {892					key: key.clone(),893					value: token_uri894						.into_bytes()895						.try_into()896						.map_err(|_| "token uri is too long")?,897				})898				.map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;899900			let create_item_data = CreateItemData::<T::CrossAccountId> {901				users: users.clone(),902				properties,903			};904			data.push(create_item_data);905		}906907		<Pallet<T>>::create_multiple_items(self, &caller, data, &budget)908			.map_err(dispatch_to_evm::<T>)?;909		Ok(true)910	}911912	/// Returns EVM address for refungible token913	///914	/// @param token ID of the token915	fn token_contract_address(&self, token: uint256) -> Result<address> {916		Ok(T::EvmTokenAddressMapping::token_to_address(917			self.id,918			token.try_into().map_err(|_| "token id overflow")?,919		))920	}921}922923#[solidity_interface(924	name = UniqueRefungible,925	is(926		ERC721,927		ERC721Enumerable,928		ERC721UniqueExtensions,929		ERC721UniqueMintable,930		ERC721Burnable,931		ERC721Metadata(if(this.flags.erc721metadata)),932		Collection(via(common_mut returns CollectionHandle<T>)),933		TokenProperties,934	)935)]936impl<T: Config> RefungibleHandle<T> where T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]> {}937938// Not a tests, but code generators939generate_stubgen!(gen_impl, UniqueRefungibleCall<()>, true);940generate_stubgen!(gen_iface, UniqueRefungibleCall<()>, false);941942impl<T: Config> CommonEvmHandler for RefungibleHandle<T>943where944	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,945{946	const CODE: &'static [u8] = include_bytes!("./stubs/UniqueRefungible.raw");947	fn call(948		self,949		handle: &mut impl PrecompileHandle,950	) -> Option<pallet_common::erc::PrecompileResult> {951		call::<T, UniqueRefungibleCall<T>, _, _>(handle, self)952	}953}
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
@@ -18,7 +18,7 @@
 }
 
 /// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x41369377
+/// @dev the ERC-165 identifier for this interface is 0x55dba919
 contract TokenProperties is Dummy, ERC165 {
 	/// @notice Set permissions for token property.
 	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -61,6 +61,19 @@
 		dummy = 0;
 	}
 
+	/// @notice Set token properties value.
+	/// @dev Throws error if `msg.sender` has no permission to edit the property.
+	/// @param tokenId ID of the token.
+	/// @param properties settable properties
+	/// @dev EVM selector for this function is: 0x14ed3a6e,
+	///  or in textual repr: setProperties(uint256,(string,bytes)[])
+	function setProperties(uint256 tokenId, Tuple19[] memory properties) public {
+		require(false, stub_error);
+		tokenId;
+		properties;
+		dummy = 0;
+	}
+
 	/// @notice Delete token property value.
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
@@ -91,7 +104,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -106,6 +119,17 @@
 		dummy = 0;
 	}
 
+	/// Set collection properties.
+	///
+	/// @param properties Vector of properties key/value pair.
+	/// @dev EVM selector for this function is: 0x50b26b2a,
+	///  or in textual repr: setCollectionProperties((string,bytes)[])
+	function setCollectionProperties(Tuple19[] memory properties) public {
+		require(false, stub_error);
+		properties;
+		dummy = 0;
+	}
+
 	/// Delete collection property.
 	///
 	/// @param key Property key.
@@ -117,6 +141,17 @@
 		dummy = 0;
 	}
 
+	/// Delete collection properties.
+	///
+	/// @param keys Properties keys.
+	/// @dev EVM selector for this function is: 0xee206ee3,
+	///  or in textual repr: deleteCollectionProperties(string[])
+	function deleteCollectionProperties(string[] memory keys) public {
+		require(false, stub_error);
+		keys;
+		dummy = 0;
+	}
+
 	/// Get collection property.
 	///
 	/// @dev Throws error if key not found.
@@ -132,6 +167,19 @@
 		return hex"";
 	}
 
+	/// Get collection properties.
+	///
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0x285fb8e6,
+	///  or in textual repr: collectionProperties(string[])
+	function collectionProperties(string[] memory keys) public view returns (Tuple19[] memory) {
+		require(false, stub_error);
+		keys;
+		dummy;
+		return new Tuple19[](0);
+	}
+
 	/// Set the sponsor of the collection.
 	///
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -145,6 +193,19 @@
 		dummy = 0;
 	}
 
+	/// Set the sponsor of the collection.
+	///
+	/// @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,
+	///  or in textual repr: setCollectionSponsorCross((address,uint256))
+	function setCollectionSponsorCross(Tuple6 memory sponsor) public {
+		require(false, stub_error);
+		sponsor;
+		dummy = 0;
+	}
+
 	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
@@ -177,10 +238,10 @@
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
 	/// @dev EVM selector for this function is: 0x6ec0a9f1,
 	///  or in textual repr: collectionSponsor()
-	function collectionSponsor() public view returns (Tuple17 memory) {
+	function collectionSponsor() public view returns (Tuple6 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple17(0x0000000000000000000000000000000000000000, 0);
+		return Tuple6(0x0000000000000000000000000000000000000000, 0);
 	}
 
 	/// Set limits for the collection.
@@ -228,6 +289,26 @@
 	}
 
 	/// Add collection admin.
+	/// @param newAdmin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x859aa7d6,
+	///  or in textual repr: addCollectionAdminCross((address,uint256))
+	function addCollectionAdminCross(Tuple6 memory newAdmin) public {
+		require(false, stub_error);
+		newAdmin;
+		dummy = 0;
+	}
+
+	/// Remove collection admin.
+	/// @param admin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x6c0cd173,
+	///  or in textual repr: removeCollectionAdminCross((address,uint256))
+	function removeCollectionAdminCross(Tuple6 memory admin) public {
+		require(false, stub_error);
+		admin;
+		dummy = 0;
+	}
+
+	/// Add collection admin.
 	/// @param newAdmin Address of the added administrator.
 	/// @dev EVM selector for this function is: 0x92e462c7,
 	///  or in textual repr: addCollectionAdmin(address)
@@ -307,6 +388,17 @@
 		dummy = 0;
 	}
 
+	/// Add user to allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0xa0184a3a,
+	///  or in textual repr: addToCollectionAllowListCross((address,uint256))
+	function addToCollectionAllowListCross(Tuple6 memory user) public {
+		require(false, stub_error);
+		user;
+		dummy = 0;
+	}
+
 	/// Remove the user from the allowed list.
 	///
 	/// @param user Address of a removed user.
@@ -318,6 +410,17 @@
 		dummy = 0;
 	}
 
+	/// Remove user from allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0x09ba452a,
+	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))
+	function removeFromCollectionAllowListCross(Tuple6 memory user) public {
+		require(false, stub_error);
+		user;
+		dummy = 0;
+	}
+
 	/// Switch permission for minting.
 	///
 	/// @param mode Enable if "true".
@@ -342,6 +445,19 @@
 		return false;
 	}
 
+	/// Check that account is the owner or admin of the collection
+	///
+	/// @param user User cross account to verify
+	/// @return "true" if account is the owner or admin
+	/// @dev EVM selector for this function is: 0x3e75a905,
+	///  or in textual repr: isOwnerOrAdminCross((address,uint256))
+	function isOwnerOrAdminCross(Tuple6 memory user) public view returns (bool) {
+		require(false, stub_error);
+		user;
+		dummy;
+		return false;
+	}
+
 	/// Returns collection type
 	///
 	/// @return `Fungible` or `NFT` or `ReFungible`
@@ -355,14 +471,14 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
-	function collectionOwner() public view returns (Tuple17 memory) {
+	function collectionOwner() public view returns (Tuple6 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple17(0x0000000000000000000000000000000000000000, 0);
+		return Tuple6(0x0000000000000000000000000000000000000000, 0);
 	}
 
 	/// Changes collection owner to another account
@@ -376,12 +492,36 @@
 		newOwner;
 		dummy = 0;
 	}
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() public view returns (Tuple6[] memory) {
+		require(false, stub_error);
+		dummy;
+		return new Tuple6[](0);
+	}
+
+	/// Changes collection owner to another account
+	///
+	/// @dev Owner can be changed only by current owner
+	/// @param newOwner new owner cross account
+	/// @dev EVM selector for this function is: 0xe5c9913f,
+	///  or in textual repr: setOwnerCross((address,uint256))
+	function setOwnerCross(Tuple6 memory newOwner) public {
+		require(false, stub_error);
+		newOwner;
+		dummy = 0;
+	}
 }
 
 /// @dev anonymous struct
-struct Tuple17 {
-	address field_0;
-	uint256 field_1;
+struct Tuple19 {
+	string field_0;
+	bytes field_1;
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f
@@ -526,7 +666,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0xef1eaacb
+/// @dev the ERC-165 identifier for this interface is 0x81feb398
 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,
@@ -561,6 +701,26 @@
 		dummy = 0;
 	}
 
+	/// @notice Transfer ownership of an RFT
+	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
+	///  is the zero address. Throws if `tokenId` is not a valid RFT.
+	///  Throws if RFT pieces have multiple owners.
+	/// @param to The new owner
+	/// @param tokenId The RFT to transfer
+	/// @dev EVM selector for this function is: 0xd5cf430b,
+	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
+	function transferFromCross(
+		Tuple6 memory from,
+		Tuple6 memory to,
+		uint256 tokenId
+	) public {
+		require(false, stub_error);
+		from;
+		to;
+		tokenId;
+		dummy = 0;
+	}
+
 	/// @notice Burns a specific ERC721 token.
 	/// @dev Throws unless `msg.sender` is the current owner or an authorized
 	///  operator for this RFT. Throws if `from` is not the current owner. Throws
@@ -577,6 +737,22 @@
 		dummy = 0;
 	}
 
+	/// @notice Burns a specific ERC721 token.
+	/// @dev Throws unless `msg.sender` is the current owner or an authorized
+	///  operator for this RFT. Throws if `from` is not the current owner. Throws
+	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.
+	///  Throws if RFT pieces have multiple owners.
+	/// @param from The current owner of the RFT
+	/// @param tokenId The RFT to transfer
+	/// @dev EVM selector for this function is: 0xbb2f5a58,
+	///  or in textual repr: burnFromCross((address,uint256),uint256)
+	function burnFromCross(Tuple6 memory from, uint256 tokenId) public {
+		require(false, stub_error);
+		from;
+		tokenId;
+		dummy = 0;
+	}
+
 	/// @notice Returns next free RFT ID.
 	/// @dev EVM selector for this function is: 0x75794a3c,
 	///  or in textual repr: nextTokenId()
@@ -608,7 +784,7 @@
 	// /// @param tokens array of pairs of token ID and token URI for minted tokens
 	// /// @dev EVM selector for this function is: 0x36543006,
 	// ///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
-	// function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) public returns (bool) {
+	// function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) public returns (bool) {
 	// 	require(false, stub_error);
 	// 	to;
 	// 	tokens;
@@ -630,11 +806,17 @@
 }
 
 /// @dev anonymous struct
-struct Tuple6 {
+struct Tuple8 {
 	uint256 field_0;
 	string field_1;
 }
 
+/// @dev anonymous struct
+struct Tuple6 {
+	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/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/unique/CHANGELOG.md
+++ b/pallets/unique/CHANGELOG.md
@@ -4,33 +4,40 @@
 
 <!-- bureaucrate goes here -->
 
+## [v0.2.1] 2022-10-10
+
+### Changes
+
+- Added `destroyCollection` and `createFTCollection` methods to **CollectionHelpers**.
+
 ## [v0.2.0] 2022-09-13
 
 ### Changes
--   Change **collectionHelper** method `createRefungibleCollection` to `createRFTCollection`,
 
+- Change **collectionHelper** method `createRefungibleCollection` to `createRFTCollection`,
+
 ## [v0.1.4] 2022-09-05
 
 ### Added
 
--   Methods `force_set_sponsor` , `force_remove_collection_sponsor` to be able to administer sponsorships with other pallets. Added to implement `AppPromotion` pallet logic.
+- Methods `force_set_sponsor` , `force_remove_collection_sponsor` to be able to administer sponsorships with other pallets. Added to implement `AppPromotion` pallet logic.
 
 ## [v0.1.3] 2022-08-16
 
 ### Other changes
 
--   build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a
+- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a
 
--   build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf8
+- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf8
 
--   refactor: Remove `#[transactional]` from extrinsics 7fd36cea2f6e00c02c67ccc1de9649ae404efd31
+- refactor: Remove `#[transactional]` from extrinsics 7fd36cea2f6e00c02c67ccc1de9649ae404efd31
 
 Every extrinsic now runs in transaction implicitly, and
 `#[transactional]` on pallet dispatchable is now meaningless
 
 Upstream-Change: https://github.com/paritytech/substrate/issues/10806
 
--   refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d975
+- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d975
 
 New methods allows to call `remove_prefix` with limit multiple times
 in the same block
@@ -39,12 +46,12 @@
 
 Upstream-Change: https://github.com/paritytech/substrate/pull/11490
 
--   build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
+- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
 
 ## [v0.1.1] - 2022-07-25
 
 ### Added
 
--   Method for creating `ERC721Metadata` compatible NFT collection.
--   Method for creating `ERC721Metadata` compatible ReFungible collection.
--   Method for creating ReFungible collection.
+- Method for creating `ERC721Metadata` compatible NFT collection.
+- Method for creating `ERC721Metadata` compatible ReFungible collection.
+- Method for creating ReFungible collection.
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
--- a/pallets/unique/Cargo.toml
+++ b/pallets/unique/Cargo.toml
@@ -9,7 +9,7 @@
 license = 'GPLv3'
 name = 'pallet-unique'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = "0.2.0"
+version = "0.2.1"
 
 [package.metadata.docs.rs]
 targets = ['x86_64-unknown-linux-gnu']
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -18,29 +18,29 @@
 
 use core::marker::PhantomData;
 use ethereum as _;
-use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};
+use evm_coder::{execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
 use frame_support::traits::Get;
+
+use crate::Pallet;
+
 use pallet_common::{
 	CollectionById,
 	dispatch::CollectionDispatch,
-	erc::{
-		CollectionHelpersEvents,
-		static_property::{key},
-	},
+	erc::{static_property::key, CollectionHelpersEvents},
 	Pallet as PalletCommon,
 };
+use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};
 use pallet_evm_coder_substrate::{dispatch_to_evm, SubstrateRecorder, WithRecorder};
-use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};
 use sp_std::vec;
 use up_data_structs::{
-	CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,
-	CollectionMode, PropertyValue, CollectionFlags,
+	CollectionDescription, CollectionMode, CollectionName, CollectionTokenPrefix,
+	CreateCollectionData,
 };
 
-use crate::{Config, SelfWeightOf, weights::WeightInfo};
+use crate::{weights::WeightInfo, Config, SelfWeightOf};
 
+use alloc::format;
 use sp_std::vec::Vec;
-use alloc::format;
 
 /// See [`CollectionHelpersCall`]
 pub struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);
@@ -84,12 +84,12 @@
 	Ok((caller, name, description, token_prefix))
 }
 
-fn create_refungible_collection_internal<
-	T: Config + pallet_nonfungible::Config + pallet_refungible::Config,
->(
+#[inline(always)]
+fn create_collection_internal<T: Config>(
 	caller: caller,
 	value: value,
 	name: string,
+	collection_mode: CollectionMode,
 	description: string,
 	token_prefix: string,
 ) -> Result<address> {
@@ -97,7 +97,7 @@
 		convert_data::<T>(caller, name, description, token_prefix)?;
 	let data = CreateCollectionData {
 		name,
-		mode: CollectionMode::ReFungible,
+		mode: collection_mode,
 		description,
 		token_prefix,
 		..Default::default()
@@ -193,7 +193,14 @@
 		description: string,
 		token_prefix: string,
 	) -> Result<address> {
-		self.create_nft_collection(caller, value, name, description, token_prefix)
+		create_collection_internal::<T>(
+			caller,
+			value,
+			name,
+			CollectionMode::NFT,
+			description,
+			token_prefix,
+		)
 	}
 
 	#[weight(<SelfWeightOf<T>>::create_collection())]
@@ -206,7 +213,35 @@
 		description: string,
 		token_prefix: string,
 	) -> Result<address> {
-		create_refungible_collection_internal::<T>(caller, value, name, description, token_prefix)
+		create_collection_internal::<T>(
+			caller,
+			value,
+			name,
+			CollectionMode::ReFungible,
+			description,
+			token_prefix,
+		)
+	}
+
+	#[weight(<SelfWeightOf<T>>::create_collection())]
+	#[solidity(rename_selector = "createFTCollection")]
+	fn create_fungible_collection(
+		&mut self,
+		caller: caller,
+		value: value,
+		name: string,
+		decimals: uint8,
+		description: string,
+		token_prefix: string,
+	) -> Result<address> {
+		create_collection_internal::<T>(
+			caller,
+			value,
+			name,
+			CollectionMode::Fungible(decimals),
+			description,
+			token_prefix,
+		)
 	}
 
 	#[solidity(rename_selector = "makeCollectionERC721MetadataCompatible")]
@@ -296,6 +331,16 @@
 		Ok(())
 	}
 
+	#[weight(<SelfWeightOf<T>>::destroy_collection())]
+	fn destroy_collection(&mut self, caller: caller, collection_address: address) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+
+		let collection_id = pallet_common::eth::map_eth_to_id(&collection_address)
+			.ok_or("Invalid collection address format")?;
+		<Pallet<T>>::destroy_collection_internal(caller, collection_id)
+			.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)
+	}
+
 	/// Check if a collection exists
 	/// @param collectionAddress Address of the collection in question
 	/// @return bool Does the collection exist?
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
--- a/pallets/unique/src/eth/stubs/CollectionHelpers.sol
+++ b/pallets/unique/src/eth/stubs/CollectionHelpers.sol
@@ -20,10 +20,11 @@
 /// @dev inlined interface
 contract CollectionHelpersEvents {
 	event CollectionCreated(address indexed owner, address indexed collectionId);
+	event CollectionDestroyed(address indexed collectionId);
 }
 
 /// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x58918631
+/// @dev the ERC-165 identifier for this interface is 0x7dea03b1
 contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
 	/// Create an NFT collection
 	/// @param name Name of the collection
@@ -76,6 +77,23 @@
 		return 0x0000000000000000000000000000000000000000;
 	}
 
+	/// @dev EVM selector for this function is: 0x7335b79f,
+	///  or in textual repr: createFTCollection(string,uint8,string,string)
+	function createFTCollection(
+		string memory name,
+		uint8 decimals,
+		string memory description,
+		string memory tokenPrefix
+	) public payable returns (address) {
+		require(false, stub_error);
+		name;
+		decimals;
+		description;
+		tokenPrefix;
+		dummy = 0;
+		return 0x0000000000000000000000000000000000000000;
+	}
+
 	/// @dev EVM selector for this function is: 0x85624258,
 	///  or in textual repr: makeCollectionERC721MetadataCompatible(address,string)
 	function makeCollectionERC721MetadataCompatible(address collection, string memory baseUri) public {
@@ -85,6 +103,14 @@
 		dummy = 0;
 	}
 
+	/// @dev EVM selector for this function is: 0x564e321f,
+	///  or in textual repr: destroyCollection(address)
+	function destroyCollection(address collectionAddress) public {
+		require(false, stub_error);
+		collectionAddress;
+		dummy = 0;
+	}
+
 	/// Check if a collection exists
 	/// @param collectionAddress Address of the collection in question
 	/// @return bool Does the collection exist?
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -362,25 +362,8 @@
 		#[weight = <SelfWeightOf<T>>::destroy_collection()]
 		pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
-			let collection = <CollectionHandle<T>>::try_get(collection_id)?;
-			collection.check_is_internal()?;
-
-			// =========
-
-			T::CollectionDispatch::destroy(sender, collection)?;
 
-			// TODO: basket cleanup should be moved elsewhere
-			// Maybe runtime dispatch.rs should perform it?
-
-			let _ = <NftTransferBasket<T>>::clear_prefix(collection_id, u32::MAX, None);
-			let _ = <FungibleTransferBasket<T>>::clear_prefix(collection_id, u32::MAX, None);
-			let _ = <ReFungibleTransferBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);
-
-			let _ = <NftApproveBasket<T>>::clear_prefix(collection_id, u32::MAX, None);
-			let _ = <FungibleApproveBasket<T>>::clear_prefix(collection_id, u32::MAX, None);
-			let _ = <RefungibleApproveBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);
-
-			Ok(())
+			Self::destroy_collection_internal(sender, collection_id)
 		}
 
 		/// Add an address to allow list.
@@ -1151,4 +1134,28 @@
 
 		target_collection.save()
 	}
+
+	#[inline(always)]
+	pub(crate) fn destroy_collection_internal(
+		sender: T::CrossAccountId,
+		collection_id: CollectionId,
+	) -> DispatchResult {
+		let collection = <CollectionHandle<T>>::try_get(collection_id)?;
+		collection.check_is_internal()?;
+
+		T::CollectionDispatch::destroy(sender, collection)?;
+
+		// TODO: basket cleanup should be moved elsewhere
+		// Maybe runtime dispatch.rs should perform it?
+
+		let _ = <NftTransferBasket<T>>::clear_prefix(collection_id, u32::MAX, None);
+		let _ = <FungibleTransferBasket<T>>::clear_prefix(collection_id, u32::MAX, None);
+		let _ = <ReFungibleTransferBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);
+
+		let _ = <NftApproveBasket<T>>::clear_prefix(collection_id, u32::MAX, None);
+		let _ = <FungibleApproveBasket<T>>::clear_prefix(collection_id, u32::MAX, None);
+		let _ = <RefungibleApproveBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);
+
+		Ok(())
+	}
 }
modifiedtests/.vscode/settings.jsondiffbeforeafterboth
--- a/tests/.vscode/settings.json
+++ b/tests/.vscode/settings.json
@@ -1,5 +1,12 @@
 {
-    "mocha.enabled": true,
-    "mochaExplorer.files": "**/*.test.ts",
-    "mochaExplorer.require": "ts-node/register"
+	"mocha.enabled": true,
+	"mochaExplorer.files": "**/*.test.ts",
+	"mochaExplorer.require": "ts-node/register",
+	"eslint.format.enable": true,
+	"[javascript]": {
+		"editor.defaultFormatter": "dbaeumer.vscode-eslint"
+	},
+	"[typescript]": {
+		"editor.defaultFormatter": "dbaeumer.vscode-eslint"
+	}
 }
modifiedtests/src/eth/allowlist.test.tsdiffbeforeafterboth
--- a/tests/src/eth/allowlist.test.ts
+++ b/tests/src/eth/allowlist.test.ts
@@ -89,22 +89,22 @@
     expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;
   });
 
-  // TODO: Temprorary off. Need refactor
-  // itEth('Collection allowlist can be added and removed by [sub] address', async ({helper}) => {
-  //   const owner = await helper.eth.createAccountWithBalance(donor);
-  //   const user = donor;
-
-  //   const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
-  //   const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
-
-  //   expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
-  //   await collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).send({from: owner});
-  //   expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
+  //itEth('Collection allowlist can be added and removed by [cross] address', async ({helper}) => {
+  //  const owner = await helper.eth.createAccountWithBalance(donor);
+  //  const user = donor;
+  //  
+  //  const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+  //  const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+  //  const userCross = helper.ethCrossAccount.fromKeyringPair(user);
+  //  
+  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
+  //  await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});
+  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
+  //  
+  //  await collectionEvm.methods.removeFromCollectionAllowListCross(userCross).send({from: owner});
+  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
+  //});
 
-  //   await collectionEvm.methods.removeFromCollectionAllowListSubstrate(user.addressRaw).send({from: owner});
-  //   expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
-  // });
-
   itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const notOwner = await helper.eth.createAccountWithBalance(donor);
@@ -117,28 +117,27 @@
     await expect(collectionEvm.methods.addToCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');
     expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;
     await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});
-
     expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.true;
     await expect(collectionEvm.methods.removeFromCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');
     expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.true;
   });
 
-  // TODO: Temprorary off. Need refactor
-  // itEth('Collection allowlist can not be add and remove [sub] address by not owner', async ({helper}) => {
-  //   const owner = await helper.eth.createAccountWithBalance(donor);
-  //   const notOwner = await helper.eth.createAccountWithBalance(donor);
-  //   const user = donor;
-
-  //   const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
-  //   const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
-
-  //   expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
-  //   await expect(collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).call({from: notOwner})).to.be.rejectedWith('NoPermission');
-  //   expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
-  //   await collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).send({from: owner});
-
-  //   expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
-  //   await expect(collectionEvm.methods.removeFromCollectionAllowListSubstrate(user.addressRaw).call({from: notOwner})).to.be.rejectedWith('NoPermission');
-  //   expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
-  // });
+  //itEth('Collection allowlist can not be add and remove [cross] address by not owner', async ({helper}) => {
+  //  const owner = await helper.eth.createAccountWithBalance(donor);
+  //  const notOwner = await helper.eth.createAccountWithBalance(donor);
+  //  const user = donor;
+  //  
+  //  const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+  //  const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+  //  
+  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
+  //  const userCross = helper.ethCrossAccount.fromKeyringPair(user);
+  //  await expect(collectionEvm.methods.addToCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');
+  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
+  //  await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});
+  //  
+  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
+  //  await expect(collectionEvm.methods.removeFromCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');
+  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
+  //});
 });
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/CollectionHelpers.sol
+++ b/tests/src/eth/api/CollectionHelpers.sol
@@ -15,10 +15,11 @@
 /// @dev inlined interface
 interface CollectionHelpersEvents {
 	event CollectionCreated(address indexed owner, address indexed collectionId);
+	event CollectionDestroyed(address indexed collectionId);
 }
 
 /// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x58918631
+/// @dev the ERC-165 identifier for this interface is 0x7dea03b1
 interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
 	/// Create an NFT collection
 	/// @param name Name of the collection
@@ -50,10 +51,23 @@
 		string memory tokenPrefix
 	) external payable returns (address);
 
+	/// @dev EVM selector for this function is: 0x7335b79f,
+	///  or in textual repr: createFTCollection(string,uint8,string,string)
+	function createFTCollection(
+		string memory name,
+		uint8 decimals,
+		string memory description,
+		string memory tokenPrefix
+	) external payable returns (address);
+
 	/// @dev EVM selector for this function is: 0x85624258,
 	///  or in textual repr: makeCollectionERC721MetadataCompatible(address,string)
 	function makeCollectionERC721MetadataCompatible(address collection, string memory baseUri) external;
 
+	/// @dev EVM selector for this function is: 0x564e321f,
+	///  or in textual repr: destroyCollection(address)
+	function destroyCollection(address collectionAddress) external;
+
 	/// Check if a collection exists
 	/// @param collectionAddress Address of the collection in question
 	/// @return bool Does the collection exist?
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 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -23,6 +23,13 @@
 	///  or in textual repr: setCollectionProperty(string,bytes)
 	function setCollectionProperty(string memory key, bytes memory value) external;
 
+	/// Set collection properties.
+	///
+	/// @param properties Vector of properties key/value pair.
+	/// @dev EVM selector for this function is: 0x50b26b2a,
+	///  or in textual repr: setCollectionProperties((string,bytes)[])
+	function setCollectionProperties(Tuple10[] memory properties) external;
+
 	/// Delete collection property.
 	///
 	/// @param key Property key.
@@ -30,6 +37,13 @@
 	///  or in textual repr: deleteCollectionProperty(string)
 	function deleteCollectionProperty(string memory key) external;
 
+	/// Delete collection properties.
+	///
+	/// @param keys Properties keys.
+	/// @dev EVM selector for this function is: 0xee206ee3,
+	///  or in textual repr: deleteCollectionProperties(string[])
+	function deleteCollectionProperties(string[] memory keys) external;
+
 	/// Get collection property.
 	///
 	/// @dev Throws error if key not found.
@@ -40,6 +54,14 @@
 	///  or in textual repr: collectionProperty(string)
 	function collectionProperty(string memory key) external view returns (bytes memory);
 
+	/// Get collection properties.
+	///
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0x285fb8e6,
+	///  or in textual repr: collectionProperties(string[])
+	function collectionProperties(string[] memory keys) external view returns (Tuple10[] memory);
+
 	/// Set the sponsor of the collection.
 	///
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -49,6 +71,15 @@
 	///  or in textual repr: setCollectionSponsor(address)
 	function setCollectionSponsor(address sponsor) external;
 
+	/// Set the sponsor of the collection.
+	///
+	/// @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,
+	///  or in textual repr: setCollectionSponsorCross((address,uint256))
+	function setCollectionSponsorCross(Tuple6 memory sponsor) external;
+
 	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
@@ -104,6 +135,18 @@
 	function contractAddress() external view returns (address);
 
 	/// Add collection admin.
+	/// @param newAdmin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x859aa7d6,
+	///  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,
+	///  or in textual repr: removeCollectionAdminCross((address,uint256))
+	function removeCollectionAdminCross(Tuple6 memory admin) external;
+
+	/// Add collection admin.
 	/// @param newAdmin Address of the added administrator.
 	/// @dev EVM selector for this function is: 0x92e462c7,
 	///  or in textual repr: addCollectionAdmin(address)
@@ -153,6 +196,13 @@
 	///  or in textual repr: addToCollectionAllowList(address)
 	function addToCollectionAllowList(address user) external;
 
+	/// Add user to allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0xa0184a3a,
+	///  or in textual repr: addToCollectionAllowListCross((address,uint256))
+	function addToCollectionAllowListCross(Tuple6 memory user) external;
+
 	/// Remove the user from the allowed list.
 	///
 	/// @param user Address of a removed user.
@@ -160,6 +210,13 @@
 	///  or in textual repr: removeFromCollectionAllowList(address)
 	function removeFromCollectionAllowList(address user) external;
 
+	/// Remove user from allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0x09ba452a,
+	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))
+	function removeFromCollectionAllowListCross(Tuple6 memory user) external;
+
 	/// Switch permission for minting.
 	///
 	/// @param mode Enable if "true".
@@ -175,6 +232,14 @@
 	///  or in textual repr: isOwnerOrAdmin(address)
 	function isOwnerOrAdmin(address user) external view returns (bool);
 
+	/// Check that account is the owner or admin of the collection
+	///
+	/// @param user User cross account to verify
+	/// @return "true" if account is the owner or admin
+	/// @dev EVM selector for this function is: 0x3e75a905,
+	///  or in textual repr: isOwnerOrAdminCross((address,uint256))
+	function isOwnerOrAdminCross(Tuple6 memory user) external view returns (bool);
+
 	/// Returns collection type
 	///
 	/// @return `Fungible` or `NFT` or `ReFungible`
@@ -184,7 +249,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
@@ -197,10 +262,36 @@
 	/// @dev EVM selector for this function is: 0x4f53e226,
 	///  or in textual repr: changeCollectionOwner(address)
 	function changeCollectionOwner(address newOwner) external;
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() external view returns (Tuple6[] memory);
+
+	/// Changes collection owner to another account
+	///
+	/// @dev Owner can be changed only by current owner
+	/// @param newOwner new owner cross account
+	/// @dev EVM selector for this function is: 0xe5c9913f,
+	///  or in textual repr: setOwnerCross((address,uint256))
+	function setOwnerCross(Tuple6 memory newOwner) external;
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x63034ac5
+/// @dev anonymous struct
+struct Tuple10 {
+	string field_0;
+	bytes field_1;
+}
+
+/// @dev the ERC-165 identifier for this interface is 0x032e5926
 interface ERC20UniqueExtensions is Dummy, ERC165 {
+	/// @dev EVM selector for this function is: 0x0ecd0ab0,
+	///  or in textual repr: approveCross((address,uint256),uint256)
+	function approveCross(Tuple6 memory spender, uint256 amount) external returns (bool);
+
 	/// Burn tokens from account
 	/// @dev Function that burns an `amount` of the tokens of a given account,
 	/// deducting from the sender's allowance for said account.
@@ -210,11 +301,28 @@
 	///  or in textual repr: burnFrom(address,uint256)
 	function burnFrom(address from, uint256 amount) external returns (bool);
 
+	/// Burn tokens from account
+	/// @dev Function that burns an `amount` of the tokens of a given account,
+	/// deducting from the sender's allowance for said account.
+	/// @param from The account whose tokens will be burnt.
+	/// @param amount The amount that will be burnt.
+	/// @dev EVM selector for this function is: 0xbb2f5a58,
+	///  or in textual repr: burnFromCross((address,uint256),uint256)
+	function burnFromCross(Tuple6 memory from, uint256 amount) external returns (bool);
+
 	/// Mint tokens for multiple accounts.
 	/// @param amounts array of pairs of account address and amount
 	/// @dev EVM selector for this function is: 0x1acf2d55,
 	///  or in textual repr: mintBulk((address,uint256)[])
 	function mintBulk(Tuple6[] memory amounts) external returns (bool);
+
+	/// @dev EVM selector for this function is: 0xd5cf430b,
+	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
+	function transferFromCross(
+		Tuple6 memory from,
+		Tuple6 memory to,
+		uint256 amount
+	) external returns (bool);
 }
 
 /// @dev anonymous struct
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -13,7 +13,7 @@
 }
 
 /// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x41369377
+/// @dev the ERC-165 identifier for this interface is 0x55dba919
 interface TokenProperties is Dummy, ERC165 {
 	/// @notice Set permissions for token property.
 	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -43,6 +43,14 @@
 		bytes memory value
 	) external;
 
+	/// @notice Set token properties value.
+	/// @dev Throws error if `msg.sender` has no permission to edit the property.
+	/// @param tokenId ID of the token.
+	/// @param properties settable properties
+	/// @dev EVM selector for this function is: 0x14ed3a6e,
+	///  or in textual repr: setProperties(uint256,(string,bytes)[])
+	function setProperties(uint256 tokenId, Tuple19[] memory properties) external;
+
 	/// @notice Delete token property value.
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
@@ -62,7 +70,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -72,6 +80,13 @@
 	///  or in textual repr: setCollectionProperty(string,bytes)
 	function setCollectionProperty(string memory key, bytes memory value) external;
 
+	/// Set collection properties.
+	///
+	/// @param properties Vector of properties key/value pair.
+	/// @dev EVM selector for this function is: 0x50b26b2a,
+	///  or in textual repr: setCollectionProperties((string,bytes)[])
+	function setCollectionProperties(Tuple19[] memory properties) external;
+
 	/// Delete collection property.
 	///
 	/// @param key Property key.
@@ -79,6 +94,13 @@
 	///  or in textual repr: deleteCollectionProperty(string)
 	function deleteCollectionProperty(string memory key) external;
 
+	/// Delete collection properties.
+	///
+	/// @param keys Properties keys.
+	/// @dev EVM selector for this function is: 0xee206ee3,
+	///  or in textual repr: deleteCollectionProperties(string[])
+	function deleteCollectionProperties(string[] memory keys) external;
+
 	/// Get collection property.
 	///
 	/// @dev Throws error if key not found.
@@ -89,6 +111,14 @@
 	///  or in textual repr: collectionProperty(string)
 	function collectionProperty(string memory key) external view returns (bytes memory);
 
+	/// Get collection properties.
+	///
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0x285fb8e6,
+	///  or in textual repr: collectionProperties(string[])
+	function collectionProperties(string[] memory keys) external view returns (Tuple19[] memory);
+
 	/// Set the sponsor of the collection.
 	///
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -98,6 +128,15 @@
 	///  or in textual repr: setCollectionSponsor(address)
 	function setCollectionSponsor(address sponsor) external;
 
+	/// Set the sponsor of the collection.
+	///
+	/// @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,
+	///  or in textual repr: setCollectionSponsorCross((address,uint256))
+	function setCollectionSponsorCross(Tuple6 memory sponsor) external;
+
 	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
@@ -120,7 +159,7 @@
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
 	/// @dev EVM selector for this function is: 0x6ec0a9f1,
 	///  or in textual repr: collectionSponsor()
-	function collectionSponsor() external view returns (Tuple17 memory);
+	function collectionSponsor() external view returns (Tuple6 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -153,6 +192,18 @@
 	function contractAddress() external view returns (address);
 
 	/// Add collection admin.
+	/// @param newAdmin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x859aa7d6,
+	///  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,
+	///  or in textual repr: removeCollectionAdminCross((address,uint256))
+	function removeCollectionAdminCross(Tuple6 memory admin) external;
+
+	/// Add collection admin.
 	/// @param newAdmin Address of the added administrator.
 	/// @dev EVM selector for this function is: 0x92e462c7,
 	///  or in textual repr: addCollectionAdmin(address)
@@ -202,6 +253,13 @@
 	///  or in textual repr: addToCollectionAllowList(address)
 	function addToCollectionAllowList(address user) external;
 
+	/// Add user to allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0xa0184a3a,
+	///  or in textual repr: addToCollectionAllowListCross((address,uint256))
+	function addToCollectionAllowListCross(Tuple6 memory user) external;
+
 	/// Remove the user from the allowed list.
 	///
 	/// @param user Address of a removed user.
@@ -209,6 +267,13 @@
 	///  or in textual repr: removeFromCollectionAllowList(address)
 	function removeFromCollectionAllowList(address user) external;
 
+	/// Remove user from allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0x09ba452a,
+	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))
+	function removeFromCollectionAllowListCross(Tuple6 memory user) external;
+
 	/// Switch permission for minting.
 	///
 	/// @param mode Enable if "true".
@@ -224,6 +289,14 @@
 	///  or in textual repr: isOwnerOrAdmin(address)
 	function isOwnerOrAdmin(address user) external view returns (bool);
 
+	/// Check that account is the owner or admin of the collection
+	///
+	/// @param user User cross account to verify
+	/// @return "true" if account is the owner or admin
+	/// @dev EVM selector for this function is: 0x3e75a905,
+	///  or in textual repr: isOwnerOrAdminCross((address,uint256))
+	function isOwnerOrAdminCross(Tuple6 memory user) external view returns (bool);
+
 	/// Returns collection type
 	///
 	/// @return `Fungible` or `NFT` or `ReFungible`
@@ -233,11 +306,11 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
-	function collectionOwner() external view returns (Tuple17 memory);
+	function collectionOwner() external view returns (Tuple6 memory);
 
 	/// Changes collection owner to another account
 	///
@@ -246,12 +319,28 @@
 	/// @dev EVM selector for this function is: 0x4f53e226,
 	///  or in textual repr: changeCollectionOwner(address)
 	function changeCollectionOwner(address newOwner) external;
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() external view returns (Tuple6[] memory);
+
+	/// Changes collection owner to another account
+	///
+	/// @dev Owner can be changed only by current owner
+	/// @param newOwner new owner cross account
+	/// @dev EVM selector for this function is: 0xe5c9913f,
+	///  or in textual repr: setOwnerCross((address,uint256))
+	function setOwnerCross(Tuple6 memory newOwner) external;
 }
 
 /// @dev anonymous struct
-struct Tuple17 {
-	address field_0;
-	uint256 field_1;
+struct Tuple19 {
+	string field_0;
+	bytes field_1;
 }
 
 /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
@@ -349,7 +438,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x4468500d
+/// @dev the ERC-165 identifier for this interface is 0x244543ee
 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,
@@ -361,6 +450,16 @@
 	///  or in textual repr: symbol()
 	function symbol() external view returns (string memory);
 
+	/// @notice Set or reaffirm the approved address for an NFT
+	/// @dev The zero address indicates there is no approved address.
+	/// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized
+	///  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,
+	///  or in textual repr: approveCross((address,uint256),uint256)
+	function approveCross(Tuple6 memory approved, uint256 tokenId) external;
+
 	/// @notice Transfer ownership of an NFT
 	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
 	///  is the zero address. Throws if `tokenId` is not a valid NFT.
@@ -370,6 +469,20 @@
 	///  or in textual repr: transfer(address,uint256)
 	function transfer(address to, uint256 tokenId) external;
 
+	/// @notice Transfer ownership of an NFT from cross account address to cross account address
+	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
+	///  is the zero address. Throws if `tokenId` is not a valid NFT.
+	/// @param from Cross acccount address of current owner
+	/// @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)
+	function transferFromCross(
+		Tuple6 memory from,
+		Tuple6 memory to,
+		uint256 tokenId
+	) external;
+
 	/// @notice Burns a specific ERC721 token.
 	/// @dev Throws unless `msg.sender` is the current owner or an authorized
 	///  operator for this NFT. Throws if `from` is not the current owner. Throws
@@ -380,6 +493,16 @@
 	///  or in textual repr: burnFrom(address,uint256)
 	function burnFrom(address from, uint256 tokenId) external;
 
+	/// @notice Burns a specific ERC721 token.
+	/// @dev Throws unless `msg.sender` is the current owner or an authorized
+	///  operator for this NFT. Throws if `from` is not the current owner. Throws
+	///  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,
+	///  or in textual repr: burnFromCross((address,uint256),uint256)
+	function burnFromCross(Tuple6 memory from, uint256 tokenId) external;
+
 	/// @notice Returns next free NFT ID.
 	/// @dev EVM selector for this function is: 0x75794a3c,
 	///  or in textual repr: nextTokenId()
@@ -400,16 +523,22 @@
 	// /// @param tokens array of pairs of token ID and token URI for minted tokens
 	// /// @dev EVM selector for this function is: 0x36543006,
 	// ///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
-	// function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) external returns (bool);
+	// function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) external returns (bool);
 
 }
 
 /// @dev anonymous struct
-struct Tuple6 {
+struct Tuple8 {
 	uint256 field_0;
 	string field_1;
 }
 
+/// @dev anonymous struct
+struct Tuple6 {
+	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/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -13,7 +13,7 @@
 }
 
 /// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x41369377
+/// @dev the ERC-165 identifier for this interface is 0x55dba919
 interface TokenProperties is Dummy, ERC165 {
 	/// @notice Set permissions for token property.
 	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -43,6 +43,14 @@
 		bytes memory value
 	) external;
 
+	/// @notice Set token properties value.
+	/// @dev Throws error if `msg.sender` has no permission to edit the property.
+	/// @param tokenId ID of the token.
+	/// @param properties settable properties
+	/// @dev EVM selector for this function is: 0x14ed3a6e,
+	///  or in textual repr: setProperties(uint256,(string,bytes)[])
+	function setProperties(uint256 tokenId, Tuple19[] memory properties) external;
+
 	/// @notice Delete token property value.
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
@@ -62,7 +70,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0xb3152af3
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -72,6 +80,13 @@
 	///  or in textual repr: setCollectionProperty(string,bytes)
 	function setCollectionProperty(string memory key, bytes memory value) external;
 
+	/// Set collection properties.
+	///
+	/// @param properties Vector of properties key/value pair.
+	/// @dev EVM selector for this function is: 0x50b26b2a,
+	///  or in textual repr: setCollectionProperties((string,bytes)[])
+	function setCollectionProperties(Tuple19[] memory properties) external;
+
 	/// Delete collection property.
 	///
 	/// @param key Property key.
@@ -79,6 +94,13 @@
 	///  or in textual repr: deleteCollectionProperty(string)
 	function deleteCollectionProperty(string memory key) external;
 
+	/// Delete collection properties.
+	///
+	/// @param keys Properties keys.
+	/// @dev EVM selector for this function is: 0xee206ee3,
+	///  or in textual repr: deleteCollectionProperties(string[])
+	function deleteCollectionProperties(string[] memory keys) external;
+
 	/// Get collection property.
 	///
 	/// @dev Throws error if key not found.
@@ -89,6 +111,14 @@
 	///  or in textual repr: collectionProperty(string)
 	function collectionProperty(string memory key) external view returns (bytes memory);
 
+	/// Get collection properties.
+	///
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0x285fb8e6,
+	///  or in textual repr: collectionProperties(string[])
+	function collectionProperties(string[] memory keys) external view returns (Tuple19[] memory);
+
 	/// Set the sponsor of the collection.
 	///
 	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
@@ -98,6 +128,15 @@
 	///  or in textual repr: setCollectionSponsor(address)
 	function setCollectionSponsor(address sponsor) external;
 
+	/// Set the sponsor of the collection.
+	///
+	/// @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,
+	///  or in textual repr: setCollectionSponsorCross((address,uint256))
+	function setCollectionSponsorCross(Tuple6 memory sponsor) external;
+
 	/// Whether there is a pending sponsor.
 	/// @dev EVM selector for this function is: 0x058ac185,
 	///  or in textual repr: hasCollectionPendingSponsor()
@@ -120,7 +159,7 @@
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
 	/// @dev EVM selector for this function is: 0x6ec0a9f1,
 	///  or in textual repr: collectionSponsor()
-	function collectionSponsor() external view returns (Tuple17 memory);
+	function collectionSponsor() external view returns (Tuple6 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -153,6 +192,18 @@
 	function contractAddress() external view returns (address);
 
 	/// Add collection admin.
+	/// @param newAdmin Cross account administrator address.
+	/// @dev EVM selector for this function is: 0x859aa7d6,
+	///  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,
+	///  or in textual repr: removeCollectionAdminCross((address,uint256))
+	function removeCollectionAdminCross(Tuple6 memory admin) external;
+
+	/// Add collection admin.
 	/// @param newAdmin Address of the added administrator.
 	/// @dev EVM selector for this function is: 0x92e462c7,
 	///  or in textual repr: addCollectionAdmin(address)
@@ -202,6 +253,13 @@
 	///  or in textual repr: addToCollectionAllowList(address)
 	function addToCollectionAllowList(address user) external;
 
+	/// Add user to allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0xa0184a3a,
+	///  or in textual repr: addToCollectionAllowListCross((address,uint256))
+	function addToCollectionAllowListCross(Tuple6 memory user) external;
+
 	/// Remove the user from the allowed list.
 	///
 	/// @param user Address of a removed user.
@@ -209,6 +267,13 @@
 	///  or in textual repr: removeFromCollectionAllowList(address)
 	function removeFromCollectionAllowList(address user) external;
 
+	/// Remove user from allowed list.
+	///
+	/// @param user User cross account address.
+	/// @dev EVM selector for this function is: 0x09ba452a,
+	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))
+	function removeFromCollectionAllowListCross(Tuple6 memory user) external;
+
 	/// Switch permission for minting.
 	///
 	/// @param mode Enable if "true".
@@ -224,6 +289,14 @@
 	///  or in textual repr: isOwnerOrAdmin(address)
 	function isOwnerOrAdmin(address user) external view returns (bool);
 
+	/// Check that account is the owner or admin of the collection
+	///
+	/// @param user User cross account to verify
+	/// @return "true" if account is the owner or admin
+	/// @dev EVM selector for this function is: 0x3e75a905,
+	///  or in textual repr: isOwnerOrAdminCross((address,uint256))
+	function isOwnerOrAdminCross(Tuple6 memory user) external view returns (bool);
+
 	/// Returns collection type
 	///
 	/// @return `Fungible` or `NFT` or `ReFungible`
@@ -233,11 +306,11 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
-	function collectionOwner() external view returns (Tuple17 memory);
+	function collectionOwner() external view returns (Tuple6 memory);
 
 	/// Changes collection owner to another account
 	///
@@ -246,12 +319,28 @@
 	/// @dev EVM selector for this function is: 0x4f53e226,
 	///  or in textual repr: changeCollectionOwner(address)
 	function changeCollectionOwner(address newOwner) external;
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() external view returns (Tuple6[] memory);
+
+	/// Changes collection owner to another account
+	///
+	/// @dev Owner can be changed only by current owner
+	/// @param newOwner new owner cross account
+	/// @dev EVM selector for this function is: 0xe5c9913f,
+	///  or in textual repr: setOwnerCross((address,uint256))
+	function setOwnerCross(Tuple6 memory newOwner) external;
 }
 
 /// @dev anonymous struct
-struct Tuple17 {
-	address field_0;
-	uint256 field_1;
+struct Tuple19 {
+	string field_0;
+	bytes field_1;
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f
@@ -347,7 +436,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0xef1eaacb
+/// @dev the ERC-165 identifier for this interface is 0x81feb398
 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,
@@ -369,6 +458,20 @@
 	///  or in textual repr: transfer(address,uint256)
 	function transfer(address to, uint256 tokenId) external;
 
+	/// @notice Transfer ownership of an RFT
+	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
+	///  is the zero address. Throws if `tokenId` is not a valid RFT.
+	///  Throws if RFT pieces have multiple owners.
+	/// @param to The new owner
+	/// @param tokenId The RFT to transfer
+	/// @dev EVM selector for this function is: 0xd5cf430b,
+	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
+	function transferFromCross(
+		Tuple6 memory from,
+		Tuple6 memory to,
+		uint256 tokenId
+	) external;
+
 	/// @notice Burns a specific ERC721 token.
 	/// @dev Throws unless `msg.sender` is the current owner or an authorized
 	///  operator for this RFT. Throws if `from` is not the current owner. Throws
@@ -380,6 +483,17 @@
 	///  or in textual repr: burnFrom(address,uint256)
 	function burnFrom(address from, uint256 tokenId) external;
 
+	/// @notice Burns a specific ERC721 token.
+	/// @dev Throws unless `msg.sender` is the current owner or an authorized
+	///  operator for this RFT. Throws if `from` is not the current owner. Throws
+	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.
+	///  Throws if RFT pieces have multiple owners.
+	/// @param from The current owner of the RFT
+	/// @param tokenId The RFT to transfer
+	/// @dev EVM selector for this function is: 0xbb2f5a58,
+	///  or in textual repr: burnFromCross((address,uint256),uint256)
+	function burnFromCross(Tuple6 memory from, uint256 tokenId) external;
+
 	/// @notice Returns next free RFT ID.
 	/// @dev EVM selector for this function is: 0x75794a3c,
 	///  or in textual repr: nextTokenId()
@@ -401,7 +515,7 @@
 	// /// @param tokens array of pairs of token ID and token URI for minted tokens
 	// /// @dev EVM selector for this function is: 0x36543006,
 	// ///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
-	// function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) external returns (bool);
+	// function mintBulkWithTokenURI(address to, Tuple8[] memory tokens) external returns (bool);
 
 	/// Returns EVM address for refungible token
 	///
@@ -412,11 +526,17 @@
 }
 
 /// @dev anonymous struct
-struct Tuple6 {
+struct Tuple8 {
 	uint256 field_0;
 	string field_1;
 }
 
+/// @dev anonymous struct
+struct Tuple6 {
+	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/base.test.tsdiffbeforeafterboth
--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -116,8 +116,8 @@
     await checkInterface(helper, '0x780e9d63', true, true);
   });
 
-  itEth('ERC721UniqueExtensions - 0x4468500d - support', async ({helper}) => {
-    await checkInterface(helper, '0x4468500d', true, true);
+  itEth('ERC721UniqueExtensions - 0x244543ee - support', async ({helper}) => {
+    await checkInterface(helper, '0x244543ee', true, true);
   });
 
   itEth('ERC721Burnable - 0x42966c68 - support', async ({helper}) => {
modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -49,18 +49,38 @@
       .to.be.eq(newAdmin.toLocaleLowerCase());
   });
 
-  itEth.skip('Add substrate admin by owner', async ({helper}) => {
+  itEth('Add cross account admin by owner', async ({helper, privateKey}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
+        
     const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
     const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+    
+    const newAdmin = await privateKey('//Bob');
+    const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);
+    await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();
 
-    const [newAdmin] = await helper.arrange.createAccounts([10n], donor);
-    await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();
+    const adminList = await helper.collection.getAdmins(collectionId);
+    expect(adminList).to.be.like([{Substrate: newAdmin.address}]);
+  });
 
-    const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);
-    expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())
-      .to.be.eq(newAdmin.address.toLocaleLowerCase());
-  });
+  // itEth('Check adminlist', async ({helper, privateKey}) => {
+  //   const owner = await helper.eth.createAccountWithBalance(donor);
+        
+  //   const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+  //   const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+
+  //   const admin1 = helper.eth.createAccount();
+  //   const admin2 = await privateKey('admin');
+  //   await collectionEvm.methods.addCollectionAdmin(admin1).send();
+  //   await collectionEvm.methods.addCollectionAdminCross(helper.ethCrossAccount.fromKeyringPair(admin2)).send();
+
+  //   const adminListRpc = await helper.collection.getAdmins(collectionId);
+  //   let adminListEth = await collectionEvm.methods.collectionAdmins().call();
+  //   adminListEth = adminListEth.map((element: IEthCrossAccountId) => {
+  //     return helper.address.convertCrossAccountFromEthCrossAcoount(element);
+  //   });
+  //   expect(adminListRpc).to.be.like(adminListEth);
+  // });
 
   itEth('Verify owner or admin', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
@@ -68,11 +88,31 @@
 
     const newAdmin = helper.eth.createAccount();
     const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+  
     expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.false;
     await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
     expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.true;
   });
 
+  // itEth.skip('Check adminlist', async ({helper, privateKey}) => {
+  //   const owner = await helper.eth.createAccountWithBalance(donor);
+        
+  //   const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+  //   const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+
+  //   const admin1 = helper.eth.createAccount();
+  //   const admin2 = await privateKey('admin');
+  //   await collectionEvm.methods.addCollectionAdmin(admin1).send();
+  //   await collectionEvm.methods.addCollectionAdminSubstrate(admin2.addressRaw).send();
+
+  //   const adminListRpc = await helper.collection.getAdmins(collectionId);
+  //   let adminListEth = await collectionEvm.methods.collectionAdmins().call();
+  //   adminListEth = adminListEth.map((element: IEthCrossAccountId) => {
+  //     return helper.address.convertCrossAccountFromEthCrossAcoount(element);
+  //   });
+  //   expect(adminListRpc).to.be.like(adminListEth);
+  // });
+    
   itEth('(!negative tests!) Add admin by ADMIN is not allowed', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
modifiedtests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/collectionHelpersAbi.json
+++ b/tests/src/eth/collectionHelpersAbi.json
@@ -19,6 +19,19 @@
     "type": "event"
   },
   {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": true,
+        "internalType": "address",
+        "name": "collectionId",
+        "type": "address"
+      }
+    ],
+    "name": "CollectionDestroyed",
+    "type": "event"
+  },
+  {
     "inputs": [],
     "name": "collectionCreationFee",
     "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
@@ -28,6 +41,18 @@
   {
     "inputs": [
       { "internalType": "string", "name": "name", "type": "string" },
+      { "internalType": "uint8", "name": "decimals", "type": "uint8" },
+      { "internalType": "string", "name": "description", "type": "string" },
+      { "internalType": "string", "name": "tokenPrefix", "type": "string" }
+    ],
+    "name": "createFTCollection",
+    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      { "internalType": "string", "name": "name", "type": "string" },
       { "internalType": "string", "name": "description", "type": "string" },
       { "internalType": "string", "name": "tokenPrefix", "type": "string" }
     ],
@@ -55,6 +80,19 @@
         "type": "address"
       }
     ],
+    "name": "destroyCollection",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "collectionAddress",
+        "type": "address"
+      }
+    ],
     "name": "isCollectionExist",
     "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
     "stateMutability": "view",
modifiedtests/src/eth/collectionProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -18,6 +18,7 @@
 import {Pallets} from '../util';
 import {IProperty, ITokenPropertyPermission} from '../util/playgrounds/types';
 import {IKeyringPair} from '@polkadot/types/types';
+import {TCollectionMode} from '../util/playgrounds/types';
 
 describe('EVM collection properties', () => {
   let donor: IKeyringPair;
@@ -161,3 +162,91 @@
     await checkERC721Metadata(helper, 'rft');
   });
 });
+
+describe('EVM collection property', () => {
+  let donor: IKeyringPair;
+
+  before(async function() {
+    await usingEthPlaygrounds(async (_helper, privateKey) => {
+      donor = await privateKey({filename: __filename});
+    });
+  });
+
+  async function testSetReadProperties(helper: EthUniqueHelper, mode: TCollectionMode) {
+    const collection = await helper[mode].mintCollection(donor, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+    const sender = await helper.eth.createAccountWithBalance(donor, 100n);
+    await collection.addAdmin(donor, {Ethereum: sender});
+
+    const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(collectionAddress, mode, sender);
+
+    const keys = ['key0', 'key1'];
+
+    const writeProperties = [
+      helper.ethProperty.property(keys[0], 'value0'),
+      helper.ethProperty.property(keys[1], 'value1'),
+    ];
+
+    await contract.methods.setCollectionProperties(writeProperties).send();
+    const readProperties = await contract.methods.collectionProperties([keys[0], keys[1]]).call();
+    expect(readProperties).to.be.like(writeProperties);
+  }
+
+  itEth('Set/read properties ft', async ({helper}) => {
+    await testSetReadProperties(helper, 'ft');
+  });
+  itEth.ifWithPallets('Set/read properties rft', [Pallets.ReFungible], async ({helper}) => {
+    await testSetReadProperties(helper, 'rft');
+  });
+  itEth('Set/read properties nft', async ({helper}) => {
+    await testSetReadProperties(helper, 'nft');
+  });
+
+  async function testDeleteProperties(helper: EthUniqueHelper, mode: TCollectionMode) {
+    const collection = await helper[mode].mintCollection(donor, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+    const sender = await helper.eth.createAccountWithBalance(donor, 100n);
+    await collection.addAdmin(donor, {Ethereum: sender});
+
+    const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(collectionAddress, mode, sender);
+
+    const keys = ['key0', 'key1', 'key2', 'key3'];
+
+    {
+      const writeProperties = [
+        helper.ethProperty.property(keys[0], 'value0'),
+        helper.ethProperty.property(keys[1], 'value1'),
+        helper.ethProperty.property(keys[2], 'value2'),
+        helper.ethProperty.property(keys[3], 'value3'),
+      ];
+
+      await contract.methods.setCollectionProperties(writeProperties).send();
+      const readProperties = await contract.methods.collectionProperties([keys[0], keys[1], keys[2], keys[3]]).call();
+      expect(readProperties).to.be.like(writeProperties);
+    }
+
+    {
+      const expectProperties = [
+        helper.ethProperty.property(keys[0], 'value0'),
+        helper.ethProperty.property(keys[1], 'value1'),
+      ];
+
+      await contract.methods.deleteCollectionProperties([keys[2], keys[3]]).send();
+      const readProperties = await contract.methods.collectionProperties([]).call();
+      expect(readProperties).to.be.like(expectProperties);
+    }
+  }
+  
+  itEth('Delete properties ft', async ({helper}) => {
+    await testDeleteProperties(helper, 'ft');
+  });
+  itEth.ifWithPallets('Delete properties rft', [Pallets.ReFungible], async ({helper}) => {
+    await testDeleteProperties(helper, 'rft');
+  });
+  itEth('Delete properties nft', async ({helper}) => {
+    await testDeleteProperties(helper, 'nft');
+  });
+    
+});
addedtests/src/eth/createFTCollection.test.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -0,0 +1,262 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {IKeyringPair} from '@polkadot/types/types';
+import {evmToAddress} from '@polkadot/util-crypto';
+import {Pallets, requirePalletsOrSkip} from '../util';
+import {expect, itEth, usingEthPlaygrounds} from './util';
+
+const DECIMALS = 18;
+
+describe('Create FT collection from EVM', () => {
+  let donor: IKeyringPair;
+
+  before(async function() {
+    await usingEthPlaygrounds(async (helper, privateKey) => {
+      requirePalletsOrSkip(this, helper, [Pallets.Fungible]);
+      donor = await privateKey({filename: __filename});
+    });
+  });
+
+  itEth('Create collection', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    
+    const name = 'CollectionEVM';
+    const description = 'Some description';
+    const prefix = 'token prefix';
+  
+    // todo:playgrounds this might fail when in async environment.
+    const collectionCountBefore = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;
+
+    const {collectionId} = await helper.eth.createFungibleCollection(owner, name, DECIMALS, description, prefix);
+    
+    const collectionCountAfter = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;
+    const data = (await helper.ft.getData(collectionId))!;
+
+    expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);
+    expect(collectionId).to.be.eq(collectionCountAfter);
+    expect(data.name).to.be.eq(name);
+    expect(data.description).to.be.eq(description);
+    expect(data.raw.tokenPrefix).to.be.eq(prefix);
+    expect(data.raw.mode).to.be.deep.eq({Fungible: DECIMALS.toString()});
+  });
+
+  // todo:playgrounds this test will fail when in async environment.
+  itEth('Check collection address exist', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+
+    const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;
+    const expectedCollectionAddress = helper.ethAddress.fromCollectionId(expectedCollectionId);
+    const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
+
+    expect(await collectionHelpers.methods
+      .isCollectionExist(expectedCollectionAddress)
+      .call()).to.be.false;
+
+    
+    await helper.eth.createFungibleCollection(owner, 'A', DECIMALS, 'A', 'A');
+
+    
+    expect(await collectionHelpers.methods
+      .isCollectionExist(expectedCollectionAddress)
+      .call()).to.be.true;
+  });
+  
+  itEth('Set sponsorship', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const sponsor = await helper.eth.createAccountWithBalance(donor);
+    const ss58Format = helper.chain.getChainProperties().ss58Format;
+    const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, 'absolutely anything', 'ENVY');
+
+    const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
+    await collection.methods.setCollectionSponsor(sponsor).send();
+
+    let data = (await helper.rft.getData(collectionId))!;
+    expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+
+    await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+
+    const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);
+    await sponsorCollection.methods.confirmCollectionSponsorship().send();
+
+    data = (await helper.rft.getData(collectionId))!;
+    expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+  });
+
+  itEth('Set limits', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Limits', DECIMALS, 'absolutely anything', 'INSI');
+    const limits = {
+      accountTokenOwnershipLimit: 1000,
+      sponsoredDataSize: 1024,
+      sponsoredDataRateLimit: 30,
+      tokenLimit: 1000000,
+      sponsorTransferTimeout: 6,
+      sponsorApproveTimeout: 6,
+      ownerCanTransfer: false,
+      ownerCanDestroy: false,
+      transfersEnabled: false,
+    };
+
+    const collection = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
+    await collection.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();
+    await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();
+    await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();
+    await collection.methods['setCollectionLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();
+    await collection.methods['setCollectionLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();
+    await collection.methods['setCollectionLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();
+    await collection.methods['setCollectionLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();
+    await collection.methods['setCollectionLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();
+    await collection.methods['setCollectionLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();
+    
+    const data = (await helper.rft.getData(collectionId))!;
+    expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(limits.accountTokenOwnershipLimit);
+    expect(data.raw.limits.sponsoredDataSize).to.be.eq(limits.sponsoredDataSize);
+    expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(limits.sponsoredDataRateLimit);
+    expect(data.raw.limits.tokenLimit).to.be.eq(limits.tokenLimit);
+    expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(limits.sponsorTransferTimeout);
+    expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(limits.sponsorApproveTimeout);
+    expect(data.raw.limits.ownerCanTransfer).to.be.eq(limits.ownerCanTransfer);
+    expect(data.raw.limits.ownerCanDestroy).to.be.eq(limits.ownerCanDestroy);
+    expect(data.raw.limits.transfersEnabled).to.be.eq(limits.transfersEnabled);
+  });
+
+  itEth('Collection address exist', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';
+    expect(await helper.ethNativeContract.collectionHelpers(collectionAddressForNonexistentCollection)
+      .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())
+      .to.be.false;
+    
+    const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');
+    expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)
+      .methods.isCollectionExist(collectionAddress).call())
+      .to.be.true;
+  });
+  
+  itEth('destroyCollection', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');
+    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
+
+    const result = await collectionHelper.methods
+      .destroyCollection(collectionAddress)
+      .send({from: owner});
+
+    const events = helper.eth.normalizeEvents(result.events);
+    
+    expect(events).to.be.deep.equal([
+      {
+        address: collectionHelper.options.address,
+        event: 'CollectionDestroyed',
+        args: {
+          collectionId: collectionAddress,
+        },
+      },
+    ]);
+
+    expect(await collectionHelper.methods
+      .isCollectionExist(collectionAddress)
+      .call()).to.be.false;
+  });
+});
+
+describe('(!negative tests!) Create FT collection from EVM', () => {
+  let donor: IKeyringPair;
+  let nominal: bigint;
+
+  before(async function() {
+    await usingEthPlaygrounds(async (helper, privateKey) => {
+      requirePalletsOrSkip(this, helper, [Pallets.Fungible]);
+      donor = await privateKey({filename: __filename});
+      nominal = helper.balance.getOneTokenNominal();
+    });
+  });
+
+  itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
+    {
+      const MAX_NAME_LENGTH = 64;
+      const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);
+      const description = 'A';
+      const tokenPrefix = 'A';
+
+      await expect(collectionHelper.methods
+        .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)
+        .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);
+    }
+    {
+      const MAX_DESCRIPTION_LENGTH = 256;
+      const collectionName = 'A';
+      const description = 'A'.repeat(MAX_DESCRIPTION_LENGTH + 1);
+      const tokenPrefix = 'A';
+      await expect(collectionHelper.methods
+        .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)
+        .call({value: Number(2n * nominal)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);
+    }
+    {
+      const MAX_TOKEN_PREFIX_LENGTH = 16;
+      const collectionName = 'A';
+      const description = 'A';
+      const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);
+      await expect(collectionHelper.methods
+        .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)
+        .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);
+    }
+  });
+  
+  itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
+    await expect(collectionHelper.methods
+      .createFTCollection('Peasantry', DECIMALS, 'absolutely anything', 'TWIW')
+      .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');
+  });
+
+  itEth('(!negative test!) Check owner', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const peasant = helper.eth.createAccount();
+    const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');
+    const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant);
+    const EXPECTED_ERROR = 'NoPermission';
+    {
+      const sponsor = await helper.eth.createAccountWithBalance(donor);
+      await expect(peasantCollection.methods
+        .setCollectionSponsor(sponsor)
+        .call()).to.be.rejectedWith(EXPECTED_ERROR);
+      
+      const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor);
+      await expect(sponsorCollection.methods
+        .confirmCollectionSponsorship()
+        .call()).to.be.rejectedWith('caller is not set as sponsor');
+    }
+    {
+      await expect(peasantCollection.methods
+        .setCollectionLimit('account_token_ownership_limit', '1000')
+        .call()).to.be.rejectedWith(EXPECTED_ERROR);
+    }
+  });
+
+  itEth('(!negative test!) Set limits', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Limits', DECIMALS, 'absolutely anything', 'ISNI');
+    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
+    await expect(collectionEvm.methods
+      .setCollectionLimit('badLimit', 'true')
+      .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');
+  });
+});
modifiedtests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -22,7 +22,7 @@
 describe('Create NFT collection from EVM', () => {
   let donor: IKeyringPair;
 
-  before(async function() {
+  before(async function () {
     await usingEthPlaygrounds(async (_helper, privateKey) => {
       donor = await privateKey({filename: __filename});
     });
@@ -35,10 +35,28 @@
     const description = 'Some description';
     const prefix = 'token prefix';
 
-    const {collectionId} = await helper.eth.createNFTCollection(owner, name, description, prefix);
-    const data = (await helper.rft.getData(collectionId))!;
+    // todo:playgrounds this might fail when in async environment.
+    const collectionCountBefore = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;
+    const {collectionId, collectionAddress, events} = await helper.eth.createNFTCollection(owner, name, description, prefix);
+    
+    expect(events).to.be.deep.equal([
+      {
+        address: '0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F',
+        event: 'CollectionCreated',
+        args: {
+          owner: owner,
+          collectionId: collectionAddress,
+        },
+      },
+    ]);
+    
+    const collectionCountAfter = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;
+
     const collection = helper.nft.getCollectionObject(collectionId);
-    
+    const data = (await collection.getData())!;
+
+    expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);
+    expect(collectionId).to.be.eq(collectionCountAfter);
     expect(data.name).to.be.eq(name);
     expect(data.description).to.be.eq(description);
     expect(data.raw.tokenPrefix).to.be.eq(prefix);
@@ -57,8 +75,19 @@
     const prefix = 'token prefix';
     const baseUri = 'BaseURI';
 
-    const {collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, name, description, prefix, baseUri);
+    const {collectionId, collectionAddress, events} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, name, description, prefix, baseUri);
 
+    expect(events).to.be.deep.equal([
+      {
+        address: '0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F',
+        event: 'CollectionCreated',
+        args: {
+          owner: owner,
+          collectionId: collectionAddress,
+        },
+      },
+    ]);
+
     const collection = helper.nft.getCollectionObject(collectionId);
     const data = (await collection.getData())!;
     
@@ -95,12 +124,12 @@
     await collectionHelpers.methods
       .createNFTCollection('A', 'A', 'A')
       .send({value: Number(2n * helper.balance.getOneTokenNominal())});
-    
+
     expect(await collectionHelpers.methods
       .isCollectionExist(expectedCollectionAddress)
       .call()).to.be.true;
   });
-  
+
   itEth('Set sponsorship', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const sponsor = await helper.eth.createAccountWithBalance(donor);
@@ -147,7 +176,7 @@
     await collection.methods['setCollectionLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();
     await collection.methods['setCollectionLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();
     await collection.methods['setCollectionLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();
-    
+
     const data = (await helper.nft.getData(collectionId))!;
     expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(limits.accountTokenOwnershipLimit);
     expect(data.raw.limits.sponsoredDataSize).to.be.eq(limits.sponsoredDataSize);
@@ -166,7 +195,7 @@
     expect(await helper.ethNativeContract.collectionHelpers(collectionAddressForNonexistentCollection)
       .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())
       .to.be.false;
-    
+
     const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Exister', 'absolutely anything', 'EVC');
     expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)
       .methods.isCollectionExist(collectionAddress).call())
@@ -178,7 +207,7 @@
   let donor: IKeyringPair;
   let nominal: bigint;
 
-  before(async function() {
+  before(async function () {
     await usingEthPlaygrounds(async (helper, privateKey) => {
       donor = await privateKey({filename: __filename});
       nominal = helper.balance.getOneTokenNominal();
@@ -197,7 +226,7 @@
       await expect(collectionHelper.methods
         .createNFTCollection(collectionName, description, tokenPrefix)
         .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);
-      
+
     }
     {
       const MAX_DESCRIPTION_LENGTH = 256;
@@ -218,7 +247,7 @@
         .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);
     }
   });
-  
+
   itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
@@ -238,7 +267,7 @@
       await expect(malfeasantCollection.methods
         .setCollectionSponsor(sponsor)
         .call()).to.be.rejectedWith(EXPECTED_ERROR);
-      
+
       const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);
       await expect(sponsorCollection.methods
         .confirmCollectionSponsorship()
@@ -259,4 +288,31 @@
       .setCollectionLimit('badLimit', 'true')
       .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');
   });
-});
+
+  itEth('destroyCollection', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
+    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
+
+
+    const result = await collectionHelper.methods
+      .destroyCollection(collectionAddress)
+      .send({from: owner});
+
+    const events = helper.eth.normalizeEvents(result.events);
+    
+    expect(events).to.be.deep.equal([
+      {
+        address: collectionHelper.options.address,
+        event: 'CollectionDestroyed',
+        args: {
+          collectionId: collectionAddress,
+        },
+      },
+    ]);
+
+    expect(await collectionHelper.methods
+      .isCollectionExist(collectionAddress)
+      .call()).to.be.false;
+  });
+});
\ No newline at end of file
modifiedtests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -263,4 +263,18 @@
       .setCollectionLimit('badLimit', 'true')
       .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');
   });
+  
+  itEth('destroyCollection', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
+    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
+    
+    await expect(collectionHelper.methods
+      .destroyCollection(collectionAddress)
+      .send({from: owner})).to.be.fulfilled;
+    
+    expect(await collectionHelper.methods
+      .isCollectionExist(collectionAddress)
+      .call()).to.be.false;  
+  });
 });
addedtests/src/eth/destroyCollection.test.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/destroyCollection.test.ts
@@ -0,0 +1,76 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {IKeyringPair} from '@polkadot/types/types';
+import {Pallets, requirePalletsOrSkip} from '../util';
+import {expect, itEth, usingEthPlaygrounds} from './util';
+
+
+describe('Destroy Collection from EVM', () => {
+  let donor: IKeyringPair;
+
+  before(async function() {
+    await usingEthPlaygrounds(async (helper, privateKey) => {
+      requirePalletsOrSkip(this, helper, [Pallets.ReFungible, Pallets.NFT]);
+      donor = await privateKey({filename: __filename});
+    });
+  });
+
+  
+  itEth('(!negative test!) RFT', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const signer = await helper.eth.createAccountWithBalance(donor);
+    
+    const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);
+    
+    const {collectionAddress} = await helper.eth.createRFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
+    const collectionHelper = helper.ethNativeContract.collectionHelpers(signer);
+    
+    await expect(collectionHelper.methods
+      .destroyCollection(collectionAddress)
+      .send({from: signer})).to.be.rejected;
+    
+    await expect(collectionHelper.methods
+      .destroyCollection(unexistedCollection)
+      .send({from: signer})).to.be.rejected;
+    
+    expect(await collectionHelper.methods
+      .isCollectionExist(unexistedCollection)
+      .call()).to.be.false;
+  });
+  
+  itEth('(!negative test!) NFT', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const signer = await helper.eth.createAccountWithBalance(donor);
+    
+    const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);
+    
+    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');
+    const collectionHelper = helper.ethNativeContract.collectionHelpers(signer);
+    
+    await expect(collectionHelper.methods
+      .destroyCollection(collectionAddress)
+      .send({from: signer})).to.be.rejected;
+    
+    await expect(collectionHelper.methods
+      .destroyCollection(unexistedCollection)
+      .send({from: signer})).to.be.rejected;
+    
+    expect(await collectionHelper.methods
+      .isCollectionExist(unexistedCollection)
+      .call()).to.be.false;
+  });
+});
modifiedtests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth
--- a/tests/src/eth/fractionalizer/Fractionalizer.sol
+++ b/tests/src/eth/fractionalizer/Fractionalizer.sol
@@ -84,7 +84,11 @@
 	) external payable onlyOwner {
 		require(rftCollection == address(0), "RFT collection is already set");
 		address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;
-		rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection{value: msg.value}(_name, _description, _tokenPrefix);
+		rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection{value: msg.value}(
+			_name,
+			_description,
+			_tokenPrefix
+		);
 		emit RFTCollectionSet(rftCollection);
 	}
 
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -148,6 +148,49 @@
     }
   });
 
+  itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const sender = await helper.eth.createAccountWithBalance(alice, 100n);
+
+    const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
+
+    await collection.mint(alice, 200n, {Substrate: alice.address});
+    await collection.approveTokens(alice, {Ethereum: sender}, 100n);
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'ft');
+
+    const fromBalanceBefore = await collection.getBalance({Substrate: alice.address});
+    
+    const ownerCross = helper.ethCrossAccount.fromKeyringPair(alice);
+    const result = await contract.methods.burnFromCross(ownerCross, 49).send({from: sender});
+    const events = result.events;
+
+    expect(events).to.be.like({
+      Transfer: {
+        address: helper.ethAddress.fromCollectionId(collection.collectionId),
+        event: 'Transfer',
+        returnValues: {
+          from: helper.address.substrateToEth(alice.address),
+          to: '0x0000000000000000000000000000000000000000',
+          value: '49',
+        },
+      },
+      Approval: {
+        address: helper.ethAddress.fromCollectionId(collection.collectionId),
+        returnValues: {
+          owner: helper.address.substrateToEth(alice.address),
+          spender: sender,
+          value: '51',
+        },
+        event: 'Approval',
+      },
+    });
+
+    const fromBalanceAfter = await collection.getBalance({Substrate: alice.address});
+    expect(fromBalanceBefore - fromBalanceAfter).to.be.eq(49n);
+  });
+
   itEth('Can perform transferFrom()', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const spender = await helper.eth.createAccountWithBalance(donor);
@@ -216,6 +259,54 @@
       expect(+balance).to.equal(50);
     }
   });
+
+  itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const sender = await helper.eth.createAccountWithBalance(alice, 100n);
+
+    const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
+
+    const receiver = helper.eth.createAccount();
+
+    await collection.mint(alice, 200n, {Substrate: alice.address});
+    await collection.approveTokens(alice, {Ethereum: sender}, 100n);
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'ft');
+
+    const from = helper.ethCrossAccount.fromKeyringPair(alice);
+    const to = helper.ethCrossAccount.fromAddress(receiver);
+
+    const fromBalanceBefore = await collection.getBalance({Substrate: alice.address});
+    const toBalanceBefore = await collection.getBalance({Ethereum: receiver});
+    
+    const result = await contract.methods.transferFromCross(from, to, 51).send({from: sender});
+
+    expect(result.events).to.be.like({
+      Transfer: {
+        address,
+        event: 'Transfer',
+        returnValues: {
+          from: helper.address.substrateToEth(alice.address),
+          to: receiver,
+          value: '51',
+        },
+      },
+      Approval: {
+        address,
+        event: 'Approval',
+        returnValues: {
+          owner: helper.address.substrateToEth(alice.address),
+          spender: sender,
+          value: '49',
+        },
+      }});
+
+    const fromBalanceAfter = await collection.getBalance({Substrate: alice.address});
+    expect(fromBalanceBefore - fromBalanceAfter).to.be.eq(51n);
+    const toBalanceAfter = await collection.getBalance({Ethereum: receiver});
+    expect(toBalanceAfter - toBalanceBefore).to.be.eq(51n);
+  });
 });
 
 describe('Fungible: Fees', () => {
@@ -362,4 +453,44 @@
     expect(event.returnValues.to).to.be.equal(receiver);
     expect(event.returnValues.value).to.be.equal('51');
   });
+
+  itEth('Events emitted for transferFromCross()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const sender = await helper.eth.createAccountWithBalance(alice, 100n);
+
+    const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
+
+    const receiver = helper.eth.createAccount();
+
+    await collection.mint(alice, 200n, {Substrate: alice.address});
+    await collection.approveTokens(alice, {Ethereum: sender}, 100n);
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'ft');
+
+    const from = helper.ethCrossAccount.fromKeyringPair(alice);
+    const to = helper.ethCrossAccount.fromAddress(receiver);
+    
+    const result = await contract.methods.transferFromCross(from, to, 51).send({from: sender});
+
+    expect(result.events).to.be.like({
+      Transfer: {
+        address,
+        event: 'Transfer',
+        returnValues: {
+          from: helper.address.substrateToEth(alice.address),
+          to: receiver,
+          value: '51',
+        },
+      },
+      Approval: {
+        address,
+        event: 'Approval',
+        returnValues: {
+          owner: helper.address.substrateToEth(alice.address),
+          spender: sender,
+          value: '49',
+        },
+      }});
+  });
 });
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/fungibleAbi.json
+++ b/tests/src/eth/fungibleAbi.json
@@ -60,6 +60,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "newAdmin",
+        "type": "tuple"
+      }
+    ],
+    "name": "addCollectionAdminCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "user", "type": "address" }
     ],
     "name": "addToCollectionAllowList",
@@ -69,6 +86,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "addToCollectionAllowListCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "owner", "type": "address" },
       { "internalType": "address", "name": "spender", "type": "address" }
     ],
@@ -98,6 +132,24 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "spender",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "amount", "type": "uint256" }
+    ],
+    "name": "approveCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "owner", "type": "address" }
     ],
     "name": "balanceOf",
@@ -117,6 +169,24 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "from",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "amount", "type": "uint256" }
+    ],
+    "name": "burnFromCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "newOwner", "type": "address" }
     ],
     "name": "changeCollectionOwner",
@@ -126,6 +196,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionAdmins",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "collectionOwner",
     "outputs": [
       {
@@ -142,6 +229,25 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "string[]", "name": "keys", "type": "string[]" }
+    ],
+    "name": "collectionProperties",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "string", "name": "field_0", "type": "string" },
+          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+        ],
+        "internalType": "struct Tuple10[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "collectionProperty",
     "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
@@ -187,6 +293,15 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "string[]", "name": "keys", "type": "string[]" }
+    ],
+    "name": "deleteCollectionProperties",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "deleteCollectionProperty",
     "outputs": [],
@@ -211,6 +326,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "isOwnerOrAdminCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "to", "type": "address" },
       { "internalType": "uint256", "name": "amount", "type": "uint256" }
     ],
@@ -253,6 +385,23 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "admin",
+        "type": "tuple"
+      }
+    ],
+    "name": "removeCollectionAdminCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [],
     "name": "removeCollectionSponsor",
     "outputs": [],
@@ -269,6 +418,23 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "removeFromCollectionAllowListCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
     "name": "setCollectionAccess",
     "outputs": [],
@@ -325,6 +491,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "string", "name": "field_0", "type": "string" },
+          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+        ],
+        "internalType": "struct Tuple10[]",
+        "name": "properties",
+        "type": "tuple[]"
+      }
+    ],
+    "name": "setCollectionProperties",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "string", "name": "key", "type": "string" },
       { "internalType": "bytes", "name": "value", "type": "bytes" }
     ],
@@ -344,6 +527,40 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "sponsor",
+        "type": "tuple"
+      }
+    ],
+    "name": "setCollectionSponsorCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "newOwner",
+        "type": "tuple"
+      }
+    ],
+    "name": "setOwnerCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
     ],
     "name": "supportsInterface",
@@ -387,6 +604,33 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "from",
+        "type": "tuple"
+      },
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "to",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "amount", "type": "uint256" }
+    ],
+    "name": "transferFromCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [],
     "name": "uniqueCollectionType",
     "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -246,6 +246,64 @@
     }
   });
 
+  itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+    const owner = await privateKey('//Bob');
+    const spender = await helper.eth.createAccountWithBalance(alice, 100n);
+
+    const token = await collection.mintToken(alice, {Substrate: owner.address});
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'nft');
+
+    {
+      await token.approve(owner, {Ethereum: spender});
+      const ownerCross = helper.ethCrossAccount.fromKeyringPair(owner);
+      const result = await contract.methods.burnFromCross(ownerCross, token.tokenId).send({from: spender});
+      const events = result.events.Transfer;
+
+      expect(events).to.be.like({
+        address,
+        event: 'Transfer',
+        returnValues: {
+          from: helper.address.substrateToEth(owner.address),
+          to: '0x0000000000000000000000000000000000000000',
+          tokenId: token.tokenId.toString(),
+        },
+      });
+    }
+  });
+
+  itEth('Can perform approveCross()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+    const owner = await helper.eth.createAccountWithBalance(alice, 100n);
+    const receiver = await privateKey('//Charlie');
+
+    const token = await collection.mintToken(alice, {Ethereum: owner});
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'nft');
+
+    {
+      const recieverCross = helper.ethCrossAccount.fromKeyringPair(receiver);
+      const result = await contract.methods.approveCross(recieverCross, token.tokenId).send({from: owner});
+      const event = result.events.Approval;
+      expect(event).to.be.like({
+        address: helper.ethAddress.fromCollectionId(collection.collectionId),
+        event: 'Approval',
+        returnValues: {
+          owner,
+          approved: helper.address.substrateToEth(receiver.address),
+          tokenId: token.tokenId.toString(),
+        },
+      });
+    }
+  });
+
   itEth('Can perform transferFrom()', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const spender = await helper.eth.createAccountWithBalance(donor);
@@ -351,6 +409,40 @@
     expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));
   });
 
+  itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+    const owner = await privateKey('//Bob');
+    const spender = await helper.eth.createAccountWithBalance(alice, 100n);
+    const receiver = await privateKey('//Charlie');
+
+    const token = await collection.mintToken(alice, {Substrate: owner.address});
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'nft');
+
+    await token.approve(owner, {Ethereum: spender});
+
+    {
+      const ownerCross = helper.ethCrossAccount.fromKeyringPair(owner);
+      const recieverCross = helper.ethCrossAccount.fromKeyringPair(receiver);
+      const result = await contract.methods.transferFromCross(ownerCross, recieverCross, token.tokenId).send({from: spender});
+      const event = result.events.Transfer;
+      expect(event).to.be.like({
+        address: helper.ethAddress.fromCollectionId(collection.collectionId),
+        event: 'Transfer',
+        returnValues: {
+          from: helper.address.substrateToEth(owner.address),
+          to: helper.address.substrateToEth(receiver.address),
+          tokenId: token.tokenId.toString(),
+        },
+      });
+    }
+
+    expect(await token.getOwner()).to.be.like({Substrate: receiver.address});
+  });
+
   itEth('transfer() call fee is less than 0.2UNQ', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const receiver = helper.eth.createAccount();
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -91,6 +91,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "newAdmin",
+        "type": "tuple"
+      }
+    ],
+    "name": "addCollectionAdminCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "user", "type": "address" }
     ],
     "name": "addToCollectionAllowList",
@@ -100,6 +117,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "addToCollectionAllowListCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "user", "type": "address" }
     ],
     "name": "allowed",
@@ -119,6 +153,24 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "approved",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "approveCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "owner", "type": "address" }
     ],
     "name": "balanceOf",
@@ -147,6 +199,24 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "from",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "burnFromCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "newOwner", "type": "address" }
     ],
     "name": "changeCollectionOwner",
@@ -156,6 +226,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionAdmins",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "collectionOwner",
     "outputs": [
       {
@@ -163,7 +250,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple17",
+        "internalType": "struct Tuple6",
         "name": "",
         "type": "tuple"
       }
@@ -172,6 +259,25 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "string[]", "name": "keys", "type": "string[]" }
+    ],
+    "name": "collectionProperties",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "string", "name": "field_0", "type": "string" },
+          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+        ],
+        "internalType": "struct Tuple19[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "collectionProperty",
     "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
@@ -187,7 +293,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple17",
+        "internalType": "struct Tuple6",
         "name": "",
         "type": "tuple"
       }
@@ -210,6 +316,15 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "string[]", "name": "keys", "type": "string[]" }
+    ],
+    "name": "deleteCollectionProperties",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "deleteCollectionProperty",
     "outputs": [],
@@ -269,6 +384,23 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "isOwnerOrAdminCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
     "name": "mint",
     "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
@@ -335,6 +467,23 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "admin",
+        "type": "tuple"
+      }
+    ],
+    "name": "removeCollectionAdminCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [],
     "name": "removeCollectionSponsor",
     "outputs": [],
@@ -352,6 +501,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "removeFromCollectionAllowListCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "from", "type": "address" },
       { "internalType": "address", "name": "to", "type": "address" },
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
@@ -440,6 +606,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "string", "name": "field_0", "type": "string" },
+          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+        ],
+        "internalType": "struct Tuple19[]",
+        "name": "properties",
+        "type": "tuple[]"
+      }
+    ],
+    "name": "setCollectionProperties",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "string", "name": "key", "type": "string" },
       { "internalType": "bytes", "name": "value", "type": "bytes" }
     ],
@@ -459,6 +642,58 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "sponsor",
+        "type": "tuple"
+      }
+    ],
+    "name": "setCollectionSponsorCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "newOwner",
+        "type": "tuple"
+      }
+    ],
+    "name": "setOwnerCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+      {
+        "components": [
+          { "internalType": "string", "name": "field_0", "type": "string" },
+          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+        ],
+        "internalType": "struct Tuple19[]",
+        "name": "properties",
+        "type": "tuple[]"
+      }
+    ],
+    "name": "setProperties",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
       { "internalType": "string", "name": "key", "type": "string" },
       { "internalType": "bytes", "name": "value", "type": "bytes" }
@@ -553,6 +788,33 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "from",
+        "type": "tuple"
+      },
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "to",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "transferFromCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [],
     "name": "uniqueCollectionType",
     "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -227,6 +227,108 @@
     }
   });
 
+  itEth('Can perform burnFrom()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+    const owner = await helper.eth.createAccountWithBalance(alice, 100n);
+    const spender = await helper.eth.createAccountWithBalance(alice, 100n);
+
+    const token = await collection.mintToken(alice, 100n, {Ethereum: owner});
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'rft');
+
+    const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, token.tokenId);
+    const tokenContract = helper.ethNativeContract.rftToken(tokenAddress, owner);
+    await tokenContract.methods.repartition(15).send();
+    await tokenContract.methods.approve(spender, 15).send();
+
+    {
+      const result = await contract.methods.burnFrom(owner, token.tokenId).send({from: spender});
+      const event = result.events.Transfer;
+      expect(event).to.be.like({
+        address: helper.ethAddress.fromCollectionId(collection.collectionId),
+        event: 'Transfer',
+        returnValues: {
+          from: owner,
+          to: '0x0000000000000000000000000000000000000000',
+          tokenId: token.tokenId.toString(),
+        },
+      });
+    }
+
+    expect(await collection.getTokenBalance(token.tokenId, {Ethereum: owner})).to.be.eq(0n);
+  });
+
+  itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+    const owner = await privateKey('//Bob');
+    const spender = await helper.eth.createAccountWithBalance(alice, 100n);
+
+    const token = await collection.mintToken(alice, 100n, {Substrate: owner.address});
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'rft');
+
+    await token.repartition(owner, 15n);
+    await token.approve(owner, {Ethereum: spender}, 15n);
+
+    {
+      const ownerCross = helper.ethCrossAccount.fromKeyringPair(owner);
+      const result = await contract.methods.burnFromCross(ownerCross, token.tokenId).send({from: spender});
+      const event = result.events.Transfer;
+      expect(event).to.be.like({
+        address: helper.ethAddress.fromCollectionId(collection.collectionId),
+        event: 'Transfer',
+        returnValues: {
+          from: helper.address.substrateToEth(owner.address),
+          to: '0x0000000000000000000000000000000000000000',
+          tokenId: token.tokenId.toString(),
+        },
+      });
+    }
+
+    expect(await collection.getTokenBalance(token.tokenId, {Substrate: owner.address})).to.be.eq(0n);
+  });
+
+  itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
+    const alice = await privateKey('//Alice');
+    const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
+
+    const owner = await privateKey('//Bob');
+    const spender = await helper.eth.createAccountWithBalance(alice, 100n);
+    const receiver = await privateKey('//Charlie');
+
+    const token = await collection.mintToken(alice, 100n, {Substrate: owner.address});
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'rft');
+
+    await token.repartition(owner, 15n);
+    await token.approve(owner, {Ethereum: spender}, 15n);
+
+    {
+      const ownerCross = helper.ethCrossAccount.fromKeyringPair(owner);
+      const recieverCross = helper.ethCrossAccount.fromKeyringPair(receiver);
+      const result = await contract.methods.transferFromCross(ownerCross, recieverCross, token.tokenId).send({from: spender});
+      const event = result.events.Transfer;
+      expect(event).to.be.like({
+        address: helper.ethAddress.fromCollectionId(collection.collectionId),
+        event: 'Transfer',
+        returnValues: {
+          from: helper.address.substrateToEth(owner.address),
+          to: helper.address.substrateToEth(receiver.address),
+          tokenId: token.tokenId.toString(),
+        },
+      });
+    }
+
+    expect(await token.getTop10Owners()).to.be.like([{Substrate: receiver.address}]);
+  });
+
   itEth('Can perform transfer()', async ({helper}) => {
     const caller = await helper.eth.createAccountWithBalance(donor);
     const receiver = helper.eth.createAccount();
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/reFungibleAbi.json
+++ b/tests/src/eth/reFungibleAbi.json
@@ -91,6 +91,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "newAdmin",
+        "type": "tuple"
+      }
+    ],
+    "name": "addCollectionAdminCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "user", "type": "address" }
     ],
     "name": "addToCollectionAllowList",
@@ -100,6 +117,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "addToCollectionAllowListCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "user", "type": "address" }
     ],
     "name": "allowed",
@@ -147,6 +181,24 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "from",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "burnFromCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "newOwner", "type": "address" }
     ],
     "name": "changeCollectionOwner",
@@ -156,6 +208,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionAdmins",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "collectionOwner",
     "outputs": [
       {
@@ -163,7 +232,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple17",
+        "internalType": "struct Tuple6",
         "name": "",
         "type": "tuple"
       }
@@ -172,6 +241,25 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "string[]", "name": "keys", "type": "string[]" }
+    ],
+    "name": "collectionProperties",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "string", "name": "field_0", "type": "string" },
+          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+        ],
+        "internalType": "struct Tuple19[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "collectionProperty",
     "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
@@ -187,7 +275,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple17",
+        "internalType": "struct Tuple6",
         "name": "",
         "type": "tuple"
       }
@@ -210,6 +298,15 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "string[]", "name": "keys", "type": "string[]" }
+    ],
+    "name": "deleteCollectionProperties",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "deleteCollectionProperty",
     "outputs": [],
@@ -269,6 +366,23 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "isOwnerOrAdminCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
     "name": "mint",
     "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
@@ -335,6 +449,23 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "admin",
+        "type": "tuple"
+      }
+    ],
+    "name": "removeCollectionAdminCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [],
     "name": "removeCollectionSponsor",
     "outputs": [],
@@ -352,6 +483,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "user",
+        "type": "tuple"
+      }
+    ],
+    "name": "removeFromCollectionAllowListCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "from", "type": "address" },
       { "internalType": "address", "name": "to", "type": "address" },
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
@@ -440,6 +588,23 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "string", "name": "field_0", "type": "string" },
+          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+        ],
+        "internalType": "struct Tuple19[]",
+        "name": "properties",
+        "type": "tuple[]"
+      }
+    ],
+    "name": "setCollectionProperties",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "string", "name": "key", "type": "string" },
       { "internalType": "bytes", "name": "value", "type": "bytes" }
     ],
@@ -459,6 +624,58 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "sponsor",
+        "type": "tuple"
+      }
+    ],
+    "name": "setCollectionSponsorCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "newOwner",
+        "type": "tuple"
+      }
+    ],
+    "name": "setOwnerCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+      {
+        "components": [
+          { "internalType": "string", "name": "field_0", "type": "string" },
+          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+        ],
+        "internalType": "struct Tuple19[]",
+        "name": "properties",
+        "type": "tuple[]"
+      }
+    ],
+    "name": "setProperties",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
       { "internalType": "string", "name": "key", "type": "string" },
       { "internalType": "bytes", "name": "value", "type": "bytes" }
@@ -562,6 +779,33 @@
     "type": "function"
   },
   {
+    "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "from",
+        "type": "tuple"
+      },
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6",
+        "name": "to",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "transferFromCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [],
     "name": "uniqueCollectionType",
     "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
modifiedtests/src/eth/tokenProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -16,6 +16,8 @@
 
 import {itEth, usingEthPlaygrounds, expect} from './util';
 import {IKeyringPair} from '@polkadot/types/types';
+import {ITokenPropertyPermission} from '../util/playgrounds/types';
+import {Pallets} from '../util';
 
 describe('EVM token properties', () => {
   let donor: IKeyringPair;
@@ -68,6 +70,64 @@
     const [{value}] = await token.getProperties(['testKey']);
     expect(value).to.equal('testValue');
   });
+  
+  itEth('Can be multiple set for NFT ', async({helper}) => {
+    const caller = await helper.eth.createAccountWithBalance(donor);
+    
+    const properties = Array(5).fill(0).map((_, i) => { return {field_0: `key_${i}`, field_1: Buffer.from(`value_${i}`)}; });
+    const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.field_0, permission: {tokenOwner: true,
+      collectionAdmin: true,
+      mutable: true}}; });
+    
+    const collection = await helper.nft.mintCollection(alice, {
+      tokenPrefix: 'ethp',
+      tokenPropertyPermissions: permissions,
+    });
+    
+    const token = await collection.mintToken(alice);
+    
+    const valuesBefore = await token.getProperties(properties.map(p => p.field_0));
+    expect(valuesBefore).to.be.deep.equal([]);
+    
+    await collection.addAdmin(alice, {Ethereum: caller});
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'nft', caller);
+
+    await contract.methods.setProperties(token.tokenId, properties).send({from: caller});
+
+    const values = await token.getProperties(properties.map(p => p.field_0));
+    expect(values).to.be.deep.equal(properties.map(p => { return {key: p.field_0, value: p.field_1.toString()}; }));
+  });
+  
+  itEth.ifWithPallets('Can be multiple set for RFT ', [Pallets.ReFungible], async({helper}) => {
+    const caller = await helper.eth.createAccountWithBalance(donor);
+    
+    const properties = Array(5).fill(0).map((_, i) => { return {field_0: `key_${i}`, field_1: Buffer.from(`value_${i}`)}; });
+    const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.field_0, permission: {tokenOwner: true,
+      collectionAdmin: true,
+      mutable: true}}; });
+    
+    const collection = await helper.rft.mintCollection(alice, {
+      tokenPrefix: 'ethp',
+      tokenPropertyPermissions: permissions,
+    });
+        
+    const token = await collection.mintToken(alice);
+    
+    const valuesBefore = await token.getProperties(properties.map(p => p.field_0));
+    expect(valuesBefore).to.be.deep.equal([]);
+    
+    await collection.addAdmin(alice, {Ethereum: caller});
+
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(address, 'rft', caller);
+
+    await contract.methods.setProperties(token.tokenId, properties).send({from: caller});
+
+    const values = await token.getProperties(properties.map(p => p.field_0));
+    expect(values).to.be.deep.equal(properties.map(p => { return {key: p.field_0, value: p.field_1.toString()}; }));
+  });
 
   itEth('Can be deleted', async({helper}) => {
     const caller = await helper.eth.createAccountWithBalance(donor);
modifiedtests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -13,3 +13,12 @@
   event: string,
   args: { [key: string]: string }
 };
+export interface TEthCrossAccount {
+  readonly 0: string,
+  readonly 1: string | Uint8Array,
+  readonly field_0: string,
+  readonly field_1: 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
@@ -18,7 +18,7 @@
 
 import {DevUniqueHelper} from '../../../util/playgrounds/unique.dev';
 
-import {ContractImports, CompiledContract, NormalizedEvent} from './types';
+import {ContractImports, CompiledContract, TEthCrossAccount, NormalizedEvent, EthProperty} from './types';
 
 // Native contracts ABI
 import collectionHelpersAbi from '../../collectionHelpersAbi.json';
@@ -28,6 +28,7 @@
 import refungibleTokenAbi from '../../reFungibleTokenAbi.json';
 import contractHelpersAbi from './../contractHelpersAbi.json';
 import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';
+import {TCollectionMode} from '../../../util/playgrounds/types';
 
 class EthGroupBase {
   helper: EthUniqueHelper;
@@ -107,7 +108,7 @@
     return new web3.eth.Contract(collectionHelpersAbi as any, '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f', {from: caller, gas: this.helper.eth.DEFAULT_GAS});
   }
 
-  collection(address: string, mode: 'nft' | 'rft' | 'ft', caller?: string): Contract {
+  collection(address: string, mode: TCollectionMode, caller?: string): Contract {
     const abi = {
       'nft': nonFungibleAbi,
       'rft': refungibleAbi,
@@ -173,49 +174,59 @@
   async callEVM(signer: TEthereumAccount, contractAddress: string, abi: string) {
     return await this.helper.callRpc('api.rpc.eth.call', [{from: signer, to: contractAddress, data: abi}]);
   }
-
-  async createNFTCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string}> {
+  
+  async createCollecion(functionName: string, signer: string, name: string, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
     const collectionCreationPrice = this.helper.balance.getCollectionCreationPrice();
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
+        
+    const result = await collectionHelper.methods[functionName](name, description, tokenPrefix).send({value: Number(collectionCreationPrice)});
 
-    const result = await collectionHelper.methods.createNFTCollection(name, description, tokenPrefix).send({value: Number(collectionCreationPrice)});
-
     const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
     const collectionId = this.helper.ethAddress.extractCollectionId(collectionAddress);
-
-    return {collectionId, collectionAddress};
+    const events = this.helper.eth.normalizeEvents(result.events);
+    
+    return {collectionId, collectionAddress, events};
+  }
+  
+  async createNFTCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
+    return this.createCollecion('createNFTCollection', signer, name, description, tokenPrefix);
   }
 
-  async createERC721MetadataCompatibleNFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string}> {
+  async createERC721MetadataCompatibleNFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
 
-    const {collectionId, collectionAddress} = await this.createNFTCollection(signer, name, description, tokenPrefix);
+    const {collectionId, collectionAddress, events} = await this.createCollecion('createNFTCollection', signer, name, description, tokenPrefix);
 
     await collectionHelper.methods.makeCollectionERC721MetadataCompatible(collectionAddress, baseUri).send();
 
-    return {collectionId, collectionAddress};
+    return {collectionId, collectionAddress, events};
   }
 
-  async createRFTCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string}> {
+  async createRFTCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[]}> {
+    return this.createCollecion('createRFTCollection', signer, name, description, tokenPrefix);
+  }
+  
+  async createFungibleCollection(signer: string, name: string, decimals: number, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[]}> {
     const collectionCreationPrice = this.helper.balance.getCollectionCreationPrice();
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
-
-    const result = await collectionHelper.methods.createRFTCollection(name, description, tokenPrefix).send({value: Number(collectionCreationPrice)});
-
+        
+    const result = await collectionHelper.methods.createFTCollection(name, decimals, description, tokenPrefix).send({value: Number(collectionCreationPrice)});
     const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
     const collectionId = this.helper.ethAddress.extractCollectionId(collectionAddress);
-
-    return {collectionId, collectionAddress};
+    
+    const events = this.helper.eth.normalizeEvents(result.events);
+    
+    return {collectionId, collectionAddress, events};
   }
-
-  async createERC721MetadataCompatibleRFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string}> {
+  
+  async createERC721MetadataCompatibleRFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
 
-    const {collectionId, collectionAddress} = await this.createRFTCollection(signer, name, description, tokenPrefix);
+    const {collectionId, collectionAddress, events} = await this.createCollecion('createRFTCollection', signer, name, description, tokenPrefix);
 
     await collectionHelper.methods.makeCollectionERC721MetadataCompatible(collectionAddress, baseUri).send();
 
-    return {collectionId, collectionAddress};
+    return {collectionId, collectionAddress, events};
   }
 
   async deployCollectorContract(signer: string): Promise<Contract> {
@@ -339,10 +350,38 @@
   normalizeAddress(address: string): string {
     return '0x' + address.substring(address.length - 40);
   }
+}  
+
+export class EthPropertyGroup extends EthGroupBase {
+  property(key: string, value: string): EthProperty {
+    return [
+      key, 
+      '0x'+Buffer.from(value).toString('hex'),
+    ];
+  }
 }
-
 export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;
 
+export class EthCrossAccountGroup extends EthGroupBase {
+  fromAddress(address: TEthereumAccount): TEthCrossAccount {
+    return {
+      0: address,
+      1: '0',
+      field_0: address,
+      field_1: '0',
+    };
+  }
+
+  fromKeyringPair(keyring: IKeyringPair): TEthCrossAccount {
+    return {
+      0: '0x0000000000000000000000000000000000000000',
+      1: keyring.addressRaw,
+      field_0: '0x0000000000000000000000000000000000000000',
+      field_1: keyring.addressRaw,
+    };
+  }
+}
+
 export class EthUniqueHelper extends DevUniqueHelper {
   web3: Web3 | null = null;
   web3Provider: WebsocketProvider | null = null;
@@ -351,6 +390,8 @@
   ethAddress: EthAddressGroup;
   ethNativeContract: NativeContractGroup;
   ethContract: ContractGroup;
+  ethCrossAccount: EthCrossAccountGroup;
+  ethProperty: EthPropertyGroup;
 
   constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {
     options.helperBase = options.helperBase ?? EthUniqueHelper;
@@ -358,8 +399,10 @@
     super(logger, options);
     this.eth = new EthGroup(this);
     this.ethAddress = new EthAddressGroup(this);
+    this.ethCrossAccount = new EthCrossAccountGroup(this);
     this.ethNativeContract = new NativeContractGroup(this);
     this.ethContract = new ContractGroup(this);
+    this.ethProperty = new EthPropertyGroup(this);
   }
 
   getWeb3(): Web3 {
modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -70,6 +70,13 @@
   ethereum?: TEthereumAccount;
 }
 
+export interface IEthCrossAccountId {
+  0: TEthereumAccount;
+  1: TSubstrateAccount;
+  field_0: TEthereumAccount;
+  field_1: TSubstrateAccount;
+}
+
 export interface ICollectionLimits {
   accountTokenOwnershipLimit?: number | null;
   sponsoredDataSize?: number | null;
@@ -217,3 +224,4 @@
 export type TRelayNetworks = 'rococo' | 'westend';
 export type TNetworks = TUniqueNetworks | TSiblingNetworkds | TRelayNetworks;
 export type TSigner = IKeyringPair; // | 'string'
+export type TCollectionMode = 'nft' | 'rft' | 'ft';
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -9,7 +9,36 @@
 import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';
 import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';
 import {IKeyringPair} from '@polkadot/types/types';
-import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISchedulerOptions, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, IForeignAssetMetadata, TNetworks, MoonbeamAssetInfo, DemocracyStandardAccountVote, AcalaAssetMetadata} from './types';
+import {
+  IApiListeners,
+  IBlock,
+  IEvent,
+  IChainProperties,
+  ICollectionCreationOptions,
+  ICollectionLimits,
+  ICollectionPermissions,
+  ICrossAccountId,
+  ICrossAccountIdLower,
+  ILogger,
+  INestingPermissions,
+  IProperty,
+  IStakingInfo,
+  ISchedulerOptions,
+  ISubstrateBalance,
+  IToken,
+  ITokenPropertyPermission,
+  ITransactionResult,
+  IUniqueHelperLog,
+  TApiAllowedListeners,
+  TEthereumAccount,
+  TSigner,
+  TSubstrateAccount,
+  TNetworks,
+  IForeignAssetMetadata,
+  AcalaAssetMetadata,
+  MoonbeamAssetInfo,
+  DemocracyStandardAccountVote,
+} from './types';
 
 export class CrossAccountId implements ICrossAccountId {
   Substrate?: TSubstrateAccount;