git.delta.rocks / unique-network / refs/commits / 6bf8d7b241a9

difftreelog

Merge pull request #728 from UniqueNetwork/feature/newCallMethods

Yaroslav Bolyukin2022-11-24parents: #074bf74 #d64c3f7.patch.diff
in: master
Added new call functions

31 files changed

modifiedcrates/evm-coder/src/abi/impls.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi/impls.rs
+++ b/crates/evm-coder/src/abi/impls.rs
@@ -184,8 +184,7 @@
 
 impl AbiWrite for Property {
 	fn abi_write(&self, writer: &mut AbiWriter) {
-		self.key.abi_write(writer);
-		self.value.abi_write(writer);
+		(&self.key, &self.value).abi_write(writer);
 	}
 }
 
modifiedcrates/evm-coder/src/abi/traits.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi/traits.rs
+++ b/crates/evm-coder/src/abi/traits.rs
@@ -49,3 +49,9 @@
 		Ok(writer.into())
 	}
 }
+
+impl<T: AbiWrite> AbiWrite for &T {
+	fn abi_write(&self, writer: &mut AbiWriter) {
+		T::abi_write(self, writer);
+	}
+}
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -178,7 +178,7 @@
 	///
 	/// @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)>> {
+	fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<PropertyStruct>> {
 		let keys = keys
 			.into_iter()
 			.map(|key| {
@@ -200,7 +200,7 @@
 				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))
+				Ok(PropertyStruct { key, value })
 			})
 			.collect::<Result<Vec<_>>>()?;
 		Ok(properties)
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/fungible/CHANGELOG.md
+++ b/pallets/fungible/CHANGELOG.md
@@ -4,12 +4,22 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.1.8] - 2022-11-18
+
+### Added
+
+- The function `description` to `ERC20UniqueExtensions` interface.
+
 ## [0.1.7] - 2022-11-14
 
 ### Changed
 
 - Added `transfer_cross` in eth functions.
 
+### Changed
+
+- Use named structure `EthCrossAccount` in eth functions.
+
 ## [0.1.6] - 2022-11-02
 
 ### Changed
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -158,6 +158,13 @@
 where
 	T::AccountId: From<[u8; 32]>,
 {
+	/// @notice A description for the collection.
+	fn description(&self) -> Result<string> {
+		Ok(decode_utf16(self.description.iter().copied())
+			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
+			.collect::<string>())
+	}
+
 	#[weight(<SelfWeightOf<T>>::approve())]
 	fn approve_cross(
 		&mut self,
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
@@ -87,11 +87,11 @@
 	/// @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 (Tuple16[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple16[](0);
+		return new Property[](0);
 	}
 
 	// /// Set the sponsor of the collection.
@@ -425,20 +425,23 @@
 	uint256 sub;
 }
 
-/// @dev anonymous struct
-struct Tuple16 {
-	string field_0;
-	bytes field_1;
-}
-
 /// @dev Property struct
 struct Property {
 	string key;
 	bytes value;
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9
+/// @dev the ERC-165 identifier for this interface is 0x5b7038cf
 contract ERC20UniqueExtensions is Dummy, ERC165 {
+	/// @notice A description for the collection.
+	/// @dev EVM selector for this function is: 0x7284e416,
+	///  or in textual repr: description()
+	function description() public view returns (string memory) {
+		require(false, stub_error);
+		dummy;
+		return "";
+	}
+
 	/// @dev EVM selector for this function is: 0x0ecd0ab0,
 	///  or in textual repr: approveCross((address,uint256),uint256)
 	function approveCross(EthCrossAccount memory spender, uint256 amount) public returns (bool) {
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/nonfungible/CHANGELOG.md
+++ b/pallets/nonfungible/CHANGELOG.md
@@ -4,6 +4,12 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.1.10] - 2022-11-18
+
+### Added
+
+- The functions `description`, `crossOwnerOf`, `tokenProperties` to `ERC721UniqueExtensions` interface.
+
 ## [0.1.9] - 2022-11-14
 
 ### Changed
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -37,7 +37,7 @@
 use sp_std::vec::Vec;
 use pallet_common::{
 	erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},
-	CollectionHandle, CollectionPropertyPermissions,
+	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::call;
@@ -278,7 +278,7 @@
 #[solidity_interface(name = ERC721Metadata, expect_selector = 0x5b5e139f)]
 impl<T: Config> NonfungibleHandle<T>
 where
-	T::AccountId: From<[u8; 32]>,
+	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,
 {
 	/// @notice A descriptive name for a collection of NFTs in this contract
 	/// @dev real implementation of this function lies in `ERC721UniqueExtensions`
@@ -686,7 +686,7 @@
 #[solidity_interface(name = ERC721UniqueExtensions)]
 impl<T: Config> NonfungibleHandle<T>
 where
-	T::AccountId: From<[u8; 32]>,
+	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,
 {
 	/// @notice A descriptive name for a collection of NFTs in this contract
 	fn name(&self) -> Result<string> {
@@ -700,6 +700,56 @@
 		Ok(string::from_utf8_lossy(&self.token_prefix).into())
 	}
 
+	/// @notice A description for the collection.
+	fn description(&self) -> Result<string> {
+		Ok(decode_utf16(self.description.iter().copied())
+			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
+			.collect::<string>())
+	}
+
+	/// Returns the owner (in cross format) of the token.
+	///
+	/// @param tokenId Id for the token.
+	fn cross_owner_of(&self, token_id: uint256) -> Result<EthCrossAccount> {
+		Self::token_owner(&self, token_id.try_into()?)
+			.map(|o| EthCrossAccount::from_sub_cross_account::<T>(&o))
+			.ok_or(Error::Revert("key too large".into()))
+	}
+
+	/// Returns the token properties.
+	///
+	/// @param tokenId Id for the token.
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	fn token_properties(
+		&self,
+		token_id: uint256,
+		keys: Vec<string>,
+	) -> Result<Vec<PropertyStruct>> {
+		let keys = keys
+			.into_iter()
+			.map(|key| {
+				<Vec<u8>>::from(key)
+					.try_into()
+					.map_err(|_| Error::Revert("key too large".into()))
+			})
+			.collect::<Result<Vec<_>>>()?;
+
+		<Self as CommonCollectionOperations<T>>::token_properties(
+			&self,
+			token_id.try_into()?,
+			if keys.is_empty() { None } else { Some(keys) },
+		)
+		.into_iter()
+		.map(|p| {
+			let key = string::from_utf8(p.key.to_vec())
+				.map_err(|e| Error::Revert(alloc::format!("{}", e)))?;
+			let value = bytes(p.value.to_vec());
+			Ok(PropertyStruct { key, value })
+		})
+		.collect::<Result<Vec<_>>>()
+	}
+
 	/// @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
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
@@ -188,11 +188,11 @@
 	/// @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 (Tuple23[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple23[](0);
+		return new Property[](0);
 	}
 
 	// /// Set the sponsor of the collection.
@@ -253,10 +253,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 (Tuple26 memory) {
+	function collectionSponsor() public view returns (Tuple30 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple26(0x0000000000000000000000000000000000000000, 0);
+		return Tuple30(0x0000000000000000000000000000000000000000, 0);
 	}
 
 	/// Set limits for the collection.
@@ -527,17 +527,11 @@
 }
 
 /// @dev anonymous struct
-struct Tuple26 {
+struct Tuple30 {
 	address field_0;
 	uint256 field_1;
 }
 
-/// @dev anonymous struct
-struct Tuple23 {
-	string field_0;
-	bytes field_1;
-}
-
 /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 /// @dev See https://eips.ethereum.org/EIPS/eip-721
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f
@@ -682,7 +676,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x0e9fc611
+/// @dev the ERC-165 identifier for this interface is 0xb8f094a0
 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,
@@ -702,6 +696,42 @@
 		return "";
 	}
 
+	/// @notice A description for the collection.
+	/// @dev EVM selector for this function is: 0x7284e416,
+	///  or in textual repr: description()
+	function description() public view returns (string memory) {
+		require(false, stub_error);
+		dummy;
+		return "";
+	}
+
+	/// Returns the owner (in cross format) of the token.
+	///
+	/// @param tokenId Id for the token.
+	/// @dev EVM selector for this function is: 0x2b29dace,
+	///  or in textual repr: crossOwnerOf(uint256)
+	function crossOwnerOf(uint256 tokenId) public view returns (EthCrossAccount memory) {
+		require(false, stub_error);
+		tokenId;
+		dummy;
+		return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);
+	}
+
+	/// Returns the token properties.
+	///
+	/// @param tokenId Id for the token.
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0xefc26c69,
+	///  or in textual repr: tokenProperties(uint256,string[])
+	function tokenProperties(uint256 tokenId, string[] memory keys) public view returns (Property[] memory) {
+		require(false, stub_error);
+		tokenId;
+		keys;
+		dummy;
+		return new Property[](0);
+	}
+
 	/// @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
@@ -825,7 +855,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, Tuple11[] memory tokens) public returns (bool) {
+	// function mintBulkWithTokenURI(address to, Tuple15[] memory tokens) public returns (bool) {
 	// 	require(false, stub_error);
 	// 	to;
 	// 	tokens;
@@ -836,7 +866,7 @@
 }
 
 /// @dev anonymous struct
-struct Tuple11 {
+struct Tuple15 {
 	uint256 field_0;
 	string field_1;
 }
modifiedpallets/refungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/refungible/CHANGELOG.md
+++ b/pallets/refungible/CHANGELOG.md
@@ -4,6 +4,12 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.2.9] - 2022-11-18
+
+### Added
+
+- The functions `description`, `crossOwnerOf`, `tokenProperties` to `ERC721UniqueExtensions` interface.
+
 ## [0.2.8] - 2022-11-14
 
 ### Changed
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -33,6 +33,7 @@
 use pallet_common::{
 	CollectionHandle, CollectionPropertyPermissions,
 	erc::{CommonEvmHandler, CollectionCall, static_property::key},
+	CommonCollectionOperations,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{call, dispatch_to_evm};
@@ -273,7 +274,7 @@
 #[solidity_interface(name = ERC721Metadata)]
 impl<T: Config> RefungibleHandle<T>
 where
-	T::AccountId: From<[u8; 32]>,
+	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,
 {
 	/// @notice A descriptive name for a collection of NFTs in this contract
 	/// @dev real implementation of this function lies in `ERC721UniqueExtensions`
@@ -713,7 +714,7 @@
 #[solidity_interface(name = ERC721UniqueExtensions)]
 impl<T: Config> RefungibleHandle<T>
 where
-	T::AccountId: From<[u8; 32]>,
+	T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,
 {
 	/// @notice A descriptive name for a collection of NFTs in this contract
 	fn name(&self) -> Result<string> {
@@ -727,6 +728,55 @@
 		Ok(string::from_utf8_lossy(&self.token_prefix).into())
 	}
 
+	/// @notice A description for the collection.
+	fn description(&self) -> Result<string> {
+		Ok(decode_utf16(self.description.iter().copied())
+			.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
+			.collect::<string>())
+	}
+
+	/// Returns the owner (in cross format) of the token.
+	///
+	/// @param tokenId Id for the token.
+	fn cross_owner_of(&self, token_id: uint256) -> Result<EthCrossAccount> {
+		Self::token_owner(&self, token_id.try_into()?)
+			.map(|o| EthCrossAccount::from_sub_cross_account::<T>(&o))
+			.ok_or(Error::Revert("key too large".into()))
+	}
+
+	/// Returns the token properties.
+	///
+	/// @param tokenId Id for the token.
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	fn token_properties(
+		&self,
+		token_id: uint256,
+		keys: Vec<string>,
+	) -> Result<Vec<PropertyStruct>> {
+		let keys = keys
+			.into_iter()
+			.map(|key| {
+				<Vec<u8>>::from(key)
+					.try_into()
+					.map_err(|_| Error::Revert("key too large".into()))
+			})
+			.collect::<Result<Vec<_>>>()?;
+
+		<Self as CommonCollectionOperations<T>>::token_properties(
+			&self,
+			token_id.try_into()?,
+			if keys.is_empty() { None } else { Some(keys) },
+		)
+		.into_iter()
+		.map(|p| {
+			let key = string::from_utf8(p.key.to_vec())
+				.map_err(|e| Error::Revert(alloc::format!("{}", e)))?;
+			let value = bytes(p.value.to_vec());
+			Ok(PropertyStruct { key, value })
+		})
+		.collect::<Result<Vec<_>>>()
+	}
 	/// @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.
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
@@ -188,11 +188,11 @@
 	/// @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 (Tuple22[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple22[](0);
+		return new Property[](0);
 	}
 
 	// /// Set the sponsor of the collection.
@@ -253,10 +253,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 (Tuple25 memory) {
+	function collectionSponsor() public view returns (Tuple29 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple25(0x0000000000000000000000000000000000000000, 0);
+		return Tuple29(0x0000000000000000000000000000000000000000, 0);
 	}
 
 	/// Set limits for the collection.
@@ -527,17 +527,11 @@
 }
 
 /// @dev anonymous struct
-struct Tuple25 {
+struct Tuple29 {
 	address field_0;
 	uint256 field_1;
 }
 
-/// @dev anonymous struct
-struct Tuple22 {
-	string field_0;
-	bytes field_1;
-}
-
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f
 contract ERC721Metadata is Dummy, ERC165 {
 	// /// @notice A descriptive name for a collection of NFTs in this contract
@@ -680,7 +674,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0xab243667
+/// @dev the ERC-165 identifier for this interface is 0x1d4b64d6
 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,
@@ -700,6 +694,42 @@
 		return "";
 	}
 
+	/// @notice A description for the collection.
+	/// @dev EVM selector for this function is: 0x7284e416,
+	///  or in textual repr: description()
+	function description() public view returns (string memory) {
+		require(false, stub_error);
+		dummy;
+		return "";
+	}
+
+	/// Returns the owner (in cross format) of the token.
+	///
+	/// @param tokenId Id for the token.
+	/// @dev EVM selector for this function is: 0x2b29dace,
+	///  or in textual repr: crossOwnerOf(uint256)
+	function crossOwnerOf(uint256 tokenId) public view returns (EthCrossAccount memory) {
+		require(false, stub_error);
+		tokenId;
+		dummy;
+		return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);
+	}
+
+	/// Returns the token properties.
+	///
+	/// @param tokenId Id for the token.
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0xefc26c69,
+	///  or in textual repr: tokenProperties(uint256,string[])
+	function tokenProperties(uint256 tokenId, string[] memory keys) public view returns (Property[] memory) {
+		require(false, stub_error);
+		tokenId;
+		keys;
+		dummy;
+		return new Property[](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.
@@ -813,7 +843,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, Tuple10[] memory tokens) public returns (bool) {
+	// function mintBulkWithTokenURI(address to, Tuple14[] memory tokens) public returns (bool) {
 	// 	require(false, stub_error);
 	// 	to;
 	// 	tokens;
@@ -835,7 +865,7 @@
 }
 
 /// @dev anonymous struct
-struct Tuple10 {
+struct Tuple14 {
 	uint256 field_0;
 	string field_1;
 }
modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedtests/src/eth/abi/fungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/fungible.json
+++ b/tests/src/eth/abi/fungible.json
@@ -216,10 +216,10 @@
     "outputs": [
       {
         "components": [
-          { "internalType": "string", "name": "field_0", "type": "string" },
-          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+          { "internalType": "string", "name": "key", "type": "string" },
+          { "internalType": "bytes", "name": "value", "type": "bytes" }
         ],
-        "internalType": "struct Tuple16[]",
+        "internalType": "struct Property[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -283,6 +283,13 @@
   },
   {
     "inputs": [],
+    "name": "description",
+    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "hasCollectionPendingSponsor",
     "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
     "stateMutability": "view",
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -246,10 +246,10 @@
     "outputs": [
       {
         "components": [
-          { "internalType": "string", "name": "field_0", "type": "string" },
-          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+          { "internalType": "string", "name": "key", "type": "string" },
+          { "internalType": "bytes", "name": "value", "type": "bytes" }
         ],
-        "internalType": "struct Tuple23[]",
+        "internalType": "struct Property[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -273,7 +273,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple26",
+        "internalType": "struct Tuple30",
         "name": "",
         "type": "tuple"
       }
@@ -297,6 +297,25 @@
   },
   {
     "inputs": [
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "crossOwnerOf",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct EthCrossAccount",
+        "name": "",
+        "type": "tuple"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "string[]", "name": "keys", "type": "string[]" }
     ],
     "name": "deleteCollectionProperties",
@@ -316,6 +335,13 @@
   },
   {
     "inputs": [],
+    "name": "description",
+    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "finishMinting",
     "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
     "stateMutability": "nonpayable",
@@ -641,6 +667,26 @@
   },
   {
     "inputs": [
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+      { "internalType": "string[]", "name": "keys", "type": "string[]" }
+    ],
+    "name": "tokenProperties",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "string", "name": "key", "type": "string" },
+          { "internalType": "bytes", "name": "value", "type": "bytes" }
+        ],
+        "internalType": "struct Property[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
     ],
     "name": "tokenURI",
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/reFungible.json
+++ b/tests/src/eth/abi/reFungible.json
@@ -228,10 +228,10 @@
     "outputs": [
       {
         "components": [
-          { "internalType": "string", "name": "field_0", "type": "string" },
-          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+          { "internalType": "string", "name": "key", "type": "string" },
+          { "internalType": "bytes", "name": "value", "type": "bytes" }
         ],
-        "internalType": "struct Tuple22[]",
+        "internalType": "struct Property[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -255,7 +255,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple25",
+        "internalType": "struct Tuple29",
         "name": "",
         "type": "tuple"
       }
@@ -279,6 +279,25 @@
   },
   {
     "inputs": [
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "crossOwnerOf",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct EthCrossAccount",
+        "name": "",
+        "type": "tuple"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "string[]", "name": "keys", "type": "string[]" }
     ],
     "name": "deleteCollectionProperties",
@@ -298,6 +317,13 @@
   },
   {
     "inputs": [],
+    "name": "description",
+    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "finishMinting",
     "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
     "stateMutability": "nonpayable",
@@ -632,6 +658,26 @@
   },
   {
     "inputs": [
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
+      { "internalType": "string[]", "name": "keys", "type": "string[]" }
+    ],
+    "name": "tokenProperties",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "string", "name": "key", "type": "string" },
+          { "internalType": "bytes", "name": "value", "type": "bytes" }
+        ],
+        "internalType": "struct Property[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
     ],
     "name": "tokenURI",
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -60,7 +60,7 @@
 	/// @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 (Tuple16[] memory);
+	function collectionProperties(string[] memory keys) external view returns (Property[] memory);
 
 	// /// Set the sponsor of the collection.
 	// ///
@@ -276,12 +276,6 @@
 struct EthCrossAccount {
 	address eth;
 	uint256 sub;
-}
-
-/// @dev anonymous struct
-struct Tuple16 {
-	string field_0;
-	bytes field_1;
 }
 
 /// @dev Property struct
@@ -290,8 +284,13 @@
 	bytes value;
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9
+/// @dev the ERC-165 identifier for this interface is 0x5b7038cf
 interface ERC20UniqueExtensions is Dummy, ERC165 {
+	/// @notice A description for the collection.
+	/// @dev EVM selector for this function is: 0x7284e416,
+	///  or in textual repr: description()
+	function description() external view returns (string memory);
+
 	/// @dev EVM selector for this function is: 0x0ecd0ab0,
 	///  or in textual repr: approveCross((address,uint256),uint256)
 	function approveCross(EthCrossAccount memory spender, uint256 amount) external returns (bool);
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -127,7 +127,7 @@
 	/// @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 (Tuple23[] memory);
+	function collectionProperties(string[] memory keys) external view returns (Property[] memory);
 
 	// /// Set the sponsor of the collection.
 	// ///
@@ -169,7 +169,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 (Tuple26 memory);
+	function collectionSponsor() external view returns (Tuple27 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -346,15 +346,9 @@
 }
 
 /// @dev anonymous struct
-struct Tuple26 {
+struct Tuple27 {
 	address field_0;
 	uint256 field_1;
-}
-
-/// @dev anonymous struct
-struct Tuple23 {
-	string field_0;
-	bytes field_1;
 }
 
 /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
@@ -452,7 +446,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x0e9fc611
+/// @dev the ERC-165 identifier for this interface is 0xb8f094a0
 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,
@@ -464,6 +458,27 @@
 	///  or in textual repr: symbol()
 	function symbol() external view returns (string memory);
 
+	/// @notice A description for the collection.
+	/// @dev EVM selector for this function is: 0x7284e416,
+	///  or in textual repr: description()
+	function description() external view returns (string memory);
+
+	/// Returns the owner (in cross format) of the token.
+	///
+	/// @param tokenId Id for the token.
+	/// @dev EVM selector for this function is: 0x2b29dace,
+	///  or in textual repr: crossOwnerOf(uint256)
+	function crossOwnerOf(uint256 tokenId) external view returns (EthCrossAccount memory);
+
+	/// Returns the token properties.
+	///
+	/// @param tokenId Id for the token.
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0xefc26c69,
+	///  or in textual repr: tokenProperties(uint256,string[])
+	function tokenProperties(uint256 tokenId, string[] memory keys) external view returns (Property[] 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
@@ -546,12 +561,12 @@
 	// /// @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, Tuple11[] memory tokens) external returns (bool);
+	// function mintBulkWithTokenURI(address to, Tuple13[] memory tokens) external returns (bool);
 
 }
 
 /// @dev anonymous struct
-struct Tuple11 {
+struct Tuple13 {
 	uint256 field_0;
 	string field_1;
 }
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -127,7 +127,7 @@
 	/// @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 (Tuple22[] memory);
+	function collectionProperties(string[] memory keys) external view returns (Property[] memory);
 
 	// /// Set the sponsor of the collection.
 	// ///
@@ -169,7 +169,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 (Tuple25 memory);
+	function collectionSponsor() external view returns (Tuple26 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -346,15 +346,9 @@
 }
 
 /// @dev anonymous struct
-struct Tuple25 {
+struct Tuple26 {
 	address field_0;
 	uint256 field_1;
-}
-
-/// @dev anonymous struct
-struct Tuple22 {
-	string field_0;
-	bytes field_1;
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f
@@ -450,7 +444,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0xab243667
+/// @dev the ERC-165 identifier for this interface is 0x1d4b64d6
 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,
@@ -462,6 +456,27 @@
 	///  or in textual repr: symbol()
 	function symbol() external view returns (string memory);
 
+	/// @notice A description for the collection.
+	/// @dev EVM selector for this function is: 0x7284e416,
+	///  or in textual repr: description()
+	function description() external view returns (string memory);
+
+	/// Returns the owner (in cross format) of the token.
+	///
+	/// @param tokenId Id for the token.
+	/// @dev EVM selector for this function is: 0x2b29dace,
+	///  or in textual repr: crossOwnerOf(uint256)
+	function crossOwnerOf(uint256 tokenId) external view returns (EthCrossAccount memory);
+
+	/// Returns the token properties.
+	///
+	/// @param tokenId Id for the token.
+	/// @param keys Properties keys. Empty keys for all propertyes.
+	/// @return Vector of properties key/value pairs.
+	/// @dev EVM selector for this function is: 0xefc26c69,
+	///  or in textual repr: tokenProperties(uint256,string[])
+	function tokenProperties(uint256 tokenId, string[] memory keys) external view returns (Property[] memory);
+
 	/// @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.
@@ -539,7 +554,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, Tuple10[] memory tokens) external returns (bool);
+	// function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) external returns (bool);
 
 	/// Returns EVM address for refungible token
 	///
@@ -550,7 +565,7 @@
 }
 
 /// @dev anonymous struct
-struct Tuple10 {
+struct Tuple12 {
 	uint256 field_0;
 	string field_1;
 }
modifiedtests/src/eth/base.test.tsdiffbeforeafterboth
--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -117,7 +117,7 @@
   });
 
   itEth('ERC721UniqueExtensions support', async ({helper}) => {
-    await checkInterface(helper, '0x0e9fc611', true, true);
+    await checkInterface(helper, '0xb8f094a0', true, true);
   });
 
   itEth('ERC721Burnable - 0x42966c68 - support', async ({helper}) => {
modifiedtests/src/eth/createFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -36,9 +36,11 @@
     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 description = 'absolutely anything';
+    
+    const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');
 
-    const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);
+    const collection = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
     await collection.methods.setCollectionSponsor(sponsor).send();
 
     let data = (await helper.rft.getData(collectionId))!;
@@ -57,8 +59,9 @@
     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 description = 'absolutely anything';
+    const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');
+    
     const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
     const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);
     await collection.methods.setCollectionSponsorCross(sponsorCross).send();
@@ -73,6 +76,7 @@
 
     data = (await helper.rft.getData(collectionId))!;
     expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));
+    expect(await collection.methods.description().call()).to.deep.equal(description);
   });
 
   itEth('Set limits', async ({helper}) => {
modifiedtests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth
before · tests/src/eth/createNFTCollection.test.ts
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.8//9// 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/>.1617import {evmToAddress} from '@polkadot/util-crypto';18import {IKeyringPair} from '@polkadot/types/types';19import {expect, itEth, usingEthPlaygrounds} from './util';202122describe('Create NFT collection from EVM', () => {23  let donor: IKeyringPair;2425  before(async function () {26    await usingEthPlaygrounds(async (_helper, privateKey) => {27      donor = await privateKey({filename: __filename});28    });29  });3031  itEth('Create collection with properties', async ({helper}) => {32    const owner = await helper.eth.createAccountWithBalance(donor);3334    const name = 'CollectionEVM';35    const description = 'Some description';36    const prefix = 'token prefix';37    const baseUri = 'BaseURI';3839    const {collectionId, collectionAddress, events} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, name, description, prefix, baseUri);4041    expect(events).to.be.deep.equal([42      {43        address: '0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F',44        event: 'CollectionCreated',45        args: {46          owner: owner,47          collectionId: collectionAddress,48        },49      },50    ]);5152    const collection = helper.nft.getCollectionObject(collectionId);53    const data = (await collection.getData())!;54    55    expect(data.name).to.be.eq(name);56    expect(data.description).to.be.eq(description);57    expect(data.raw.tokenPrefix).to.be.eq(prefix);58    expect(data.raw.mode).to.be.eq('NFT');5960    const options = await collection.getOptions();61    expect(options.tokenPropertyPermissions).to.be.deep.equal([62      {63        key: 'URI',64        permission: {mutable: true, collectionAdmin: true, tokenOwner: false},65      },66      {67        key: 'URISuffix',68        permission: {mutable: true, collectionAdmin: true, tokenOwner: false},69      },70    ]);71  });7273  // Soft-deprecated74  itEth('[eth] Set sponsorship', async ({helper}) => {75    const owner = await helper.eth.createAccountWithBalance(donor);76    const sponsor = await helper.eth.createAccountWithBalance(donor);77    const ss58Format = helper.chain.getChainProperties().ss58Format;78    const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');7980    const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);81    await collection.methods.setCollectionSponsor(sponsor).send();8283    let data = (await helper.nft.getData(collectionId))!;84    expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));8586    await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');8788    const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);89    await sponsorCollection.methods.confirmCollectionSponsorship().send();9091    data = (await helper.nft.getData(collectionId))!;92    expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));93  });9495  itEth('[cross] Set sponsorship', async ({helper}) => {96    const owner = await helper.eth.createAccountWithBalance(donor);97    const sponsor = await helper.eth.createAccountWithBalance(donor);98    const ss58Format = helper.chain.getChainProperties().ss58Format;99    const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');100101    const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);102    const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);103    await collection.methods.setCollectionSponsorCross(sponsorCross).send();104105    let data = (await helper.nft.getData(collectionId))!;106    expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));107108    await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');109110    const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);111    await sponsorCollection.methods.confirmCollectionSponsorship().send();112113    data = (await helper.nft.getData(collectionId))!;114    expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));115  });116117  itEth('Set limits', async ({helper}) => {118    const owner = await helper.eth.createAccountWithBalance(donor);119    const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'FLO');120    const limits = {121      accountTokenOwnershipLimit: 1000,122      sponsoredDataSize: 1024,123      sponsoredDataRateLimit: 30,124      tokenLimit: 1000000,125      sponsorTransferTimeout: 6,126      sponsorApproveTimeout: 6,127      ownerCanTransfer: 0,128      ownerCanDestroy: 0,129      transfersEnabled: 0,130    };131    132    const expectedLimits = {133      accountTokenOwnershipLimit: 1000,134      sponsoredDataSize: 1024,135      sponsoredDataRateLimit: 30,136      tokenLimit: 1000000,137      sponsorTransferTimeout: 6,138      sponsorApproveTimeout: 6,139      ownerCanTransfer: false,140      ownerCanDestroy: false,141      transfersEnabled: false,142    };143144    const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);145    await collection.methods.setCollectionLimit('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();146    await collection.methods.setCollectionLimit('sponsoredDataSize', limits.sponsoredDataSize).send();147    await collection.methods.setCollectionLimit('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();148    await collection.methods.setCollectionLimit('tokenLimit', limits.tokenLimit).send();149    await collection.methods.setCollectionLimit('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();150    await collection.methods.setCollectionLimit('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();151    await collection.methods.setCollectionLimit('ownerCanTransfer', limits.ownerCanTransfer).send();152    await collection.methods.setCollectionLimit('ownerCanDestroy', limits.ownerCanDestroy).send();153    await collection.methods.setCollectionLimit('transfersEnabled', limits.transfersEnabled).send();154155    const data = (await helper.rft.getData(collectionId))!;156    expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(expectedLimits.accountTokenOwnershipLimit);157    expect(data.raw.limits.sponsoredDataSize).to.be.eq(expectedLimits.sponsoredDataSize);158    expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(expectedLimits.sponsoredDataRateLimit);159    expect(data.raw.limits.tokenLimit).to.be.eq(expectedLimits.tokenLimit);160    expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(expectedLimits.sponsorTransferTimeout);161    expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(expectedLimits.sponsorApproveTimeout);162    expect(data.raw.limits.ownerCanTransfer).to.be.eq(expectedLimits.ownerCanTransfer);163    expect(data.raw.limits.ownerCanDestroy).to.be.eq(expectedLimits.ownerCanDestroy);164    expect(data.raw.limits.transfersEnabled).to.be.eq(expectedLimits.transfersEnabled);165  });166167  itEth('Collection address exist', async ({helper}) => {168    const owner = await helper.eth.createAccountWithBalance(donor);169    const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';170    expect(await helper.ethNativeContract.collectionHelpers(collectionAddressForNonexistentCollection)171      .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())172      .to.be.false;173174    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Exister', 'absolutely anything', 'EVC');175    expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)176      .methods.isCollectionExist(collectionAddress).call())177      .to.be.true;178  });179});180181describe('(!negative tests!) Create NFT collection from EVM', () => {182  let donor: IKeyringPair;183  let nominal: bigint;184185  before(async function () {186    await usingEthPlaygrounds(async (helper, privateKey) => {187      donor = await privateKey({filename: __filename});188      nominal = helper.balance.getOneTokenNominal();189    });190  });191192  itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {193    const owner = await helper.eth.createAccountWithBalance(donor);194    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);195    {196      const MAX_NAME_LENGTH = 64;197      const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);198      const description = 'A';199      const tokenPrefix = 'A';200201      await expect(collectionHelper.methods202        .createNFTCollection(collectionName, description, tokenPrefix)203        .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);204205    }206    {207      const MAX_DESCRIPTION_LENGTH = 256;208      const collectionName = 'A';209      const description = 'A'.repeat(MAX_DESCRIPTION_LENGTH + 1);210      const tokenPrefix = 'A';211      await expect(collectionHelper.methods212        .createNFTCollection(collectionName, description, tokenPrefix)213        .call({value: Number(2n * nominal)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);214    }215    {216      const MAX_TOKEN_PREFIX_LENGTH = 16;217      const collectionName = 'A';218      const description = 'A';219      const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);220      await expect(collectionHelper.methods221        .createNFTCollection(collectionName, description, tokenPrefix)222        .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);223    }224  });225226  itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {227    const owner = await helper.eth.createAccountWithBalance(donor);228    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);229    await expect(collectionHelper.methods230      .createNFTCollection('Peasantry', 'absolutely anything', 'CVE')231      .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');232  });233234  // Soft-deprecated235  itEth('(!negative test!) [eth] Check owner', async ({helper}) => {236    const owner = await helper.eth.createAccountWithBalance(donor);237    const malfeasant = helper.eth.createAccount();238    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');239    const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant, true);240    const EXPECTED_ERROR = 'NoPermission';241    {242      const sponsor = await helper.eth.createAccountWithBalance(donor);243      await expect(malfeasantCollection.methods244        .setCollectionSponsor(sponsor)245        .call()).to.be.rejectedWith(EXPECTED_ERROR);246247      const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);248      await expect(sponsorCollection.methods249        .confirmCollectionSponsorship()250        .call()).to.be.rejectedWith('caller is not set as sponsor');251    }252    {253      await expect(malfeasantCollection.methods254        .setCollectionLimit('account_token_ownership_limit', '1000')255        .call()).to.be.rejectedWith(EXPECTED_ERROR);256    }257  });258259  itEth('(!negative test!) [cross] Check owner', async ({helper}) => {260    const owner = await helper.eth.createAccountWithBalance(donor);261    const malfeasant = helper.eth.createAccount();262    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');263    const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant);264    const EXPECTED_ERROR = 'NoPermission';265    {266      const sponsor = await helper.eth.createAccountWithBalance(donor);267      const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);268      await expect(malfeasantCollection.methods269        .setCollectionSponsorCross(sponsorCross)270        .call()).to.be.rejectedWith(EXPECTED_ERROR);271272      const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);273      await expect(sponsorCollection.methods274        .confirmCollectionSponsorship()275        .call()).to.be.rejectedWith('caller is not set as sponsor');276    }277    {278      await expect(malfeasantCollection.methods279        .setCollectionLimit('account_token_ownership_limit', '1000')280        .call()).to.be.rejectedWith(EXPECTED_ERROR);281    }282  });283284  itEth('(!negative test!) Set limits', async ({helper}) => {285    const invalidLimits = {286      accountTokenOwnershipLimit: BigInt(Number.MAX_SAFE_INTEGER),287      transfersEnabled: 3,288    };289290    const owner = await helper.eth.createAccountWithBalance(donor);291    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');292    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);293    294    await expect(collectionEvm.methods295      .setCollectionLimit(Object.keys(invalidLimits)[0], invalidLimits.accountTokenOwnershipLimit)296      .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);297    298    await expect(collectionEvm.methods299      .setCollectionLimit(Object.keys(invalidLimits)[1], invalidLimits.transfersEnabled)300      .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);301  });302303  itEth('destroyCollection', async ({helper}) => {304    const owner = await helper.eth.createAccountWithBalance(donor);305    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');306    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);307308309    const result = await collectionHelper.methods310      .destroyCollection(collectionAddress)311      .send({from: owner});312313    const events = helper.eth.normalizeEvents(result.events);314    315    expect(events).to.be.deep.equal([316      {317        address: collectionHelper.options.address,318        event: 'CollectionDestroyed',319        args: {320          collectionId: collectionAddress,321        },322      },323    ]);324325    expect(await collectionHelper.methods326      .isCollectionExist(collectionAddress)327      .call()).to.be.false;328  });329});
after · tests/src/eth/createNFTCollection.test.ts
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.8//9// 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/>.1617import {evmToAddress} from '@polkadot/util-crypto';18import {IKeyringPair} from '@polkadot/types/types';19import {expect, itEth, usingEthPlaygrounds} from './util';202122describe('Create NFT collection from EVM', () => {23  let donor: IKeyringPair;2425  before(async function () {26    await usingEthPlaygrounds(async (_helper, privateKey) => {27      donor = await privateKey({filename: __filename});28    });29  });3031  itEth('Create collection with properties & get desctription', async ({helper}) => {32    const owner = await helper.eth.createAccountWithBalance(donor);3334    const name = 'CollectionEVM';35    const description = 'Some description';36    const prefix = 'token prefix';37    const baseUri = 'BaseURI';3839    const {collectionId, collectionAddress, events} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, name, description, prefix, baseUri);40    const contract = helper.ethNativeContract.collection(collectionAddress, 'nft');41    42    expect(events).to.be.deep.equal([43      {44        address: '0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F',45        event: 'CollectionCreated',46        args: {47          owner: owner,48          collectionId: collectionAddress,49        },50      },51    ]);5253    const collection = helper.nft.getCollectionObject(collectionId);54    const data = (await collection.getData())!;55    56    expect(data.name).to.be.eq(name);57    expect(data.description).to.be.eq(description);58    expect(data.raw.tokenPrefix).to.be.eq(prefix);59    expect(data.raw.mode).to.be.eq('NFT');60    61    expect(await contract.methods.description().call()).to.deep.equal(description);62    63    const options = await collection.getOptions();64    expect(options.tokenPropertyPermissions).to.be.deep.equal([65      {66        key: 'URI',67        permission: {mutable: true, collectionAdmin: true, tokenOwner: false},68      },69      {70        key: 'URISuffix',71        permission: {mutable: true, collectionAdmin: true, tokenOwner: false},72      },73    ]);74  });7576  // Soft-deprecated77  itEth('[eth] Set sponsorship', async ({helper}) => {78    const owner = await helper.eth.createAccountWithBalance(donor);79    const sponsor = await helper.eth.createAccountWithBalance(donor);80    const ss58Format = helper.chain.getChainProperties().ss58Format;81    const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');8283    const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);84    await collection.methods.setCollectionSponsor(sponsor).send();8586    let data = (await helper.nft.getData(collectionId))!;87    expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));8889    await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');9091    const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);92    await sponsorCollection.methods.confirmCollectionSponsorship().send();9394    data = (await helper.nft.getData(collectionId))!;95    expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));96  });9798  itEth('[cross] Set sponsorship & get description', async ({helper}) => {99    const owner = await helper.eth.createAccountWithBalance(donor);100    const sponsor = await helper.eth.createAccountWithBalance(donor);101    const ss58Format = helper.chain.getChainProperties().ss58Format;102    const description = 'absolutely anything';103    const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', description, 'ROC');104105    const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);106    const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);107    await collection.methods.setCollectionSponsorCross(sponsorCross).send();108109    let data = (await helper.nft.getData(collectionId))!;110    expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));111112    await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');113114    const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);115    await sponsorCollection.methods.confirmCollectionSponsorship().send();116117    data = (await helper.nft.getData(collectionId))!;118    expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));119    120    expect(await sponsorCollection.methods.description().call()).to.deep.equal(description);121  });122123  itEth('Set limits', async ({helper}) => {124    const owner = await helper.eth.createAccountWithBalance(donor);125    const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'FLO');126    const limits = {127      accountTokenOwnershipLimit: 1000,128      sponsoredDataSize: 1024,129      sponsoredDataRateLimit: 30,130      tokenLimit: 1000000,131      sponsorTransferTimeout: 6,132      sponsorApproveTimeout: 6,133      ownerCanTransfer: 0,134      ownerCanDestroy: 0,135      transfersEnabled: 0,136    };137    138    const expectedLimits = {139      accountTokenOwnershipLimit: 1000,140      sponsoredDataSize: 1024,141      sponsoredDataRateLimit: 30,142      tokenLimit: 1000000,143      sponsorTransferTimeout: 6,144      sponsorApproveTimeout: 6,145      ownerCanTransfer: false,146      ownerCanDestroy: false,147      transfersEnabled: false,148    };149150    const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);151    await collection.methods.setCollectionLimit('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();152    await collection.methods.setCollectionLimit('sponsoredDataSize', limits.sponsoredDataSize).send();153    await collection.methods.setCollectionLimit('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();154    await collection.methods.setCollectionLimit('tokenLimit', limits.tokenLimit).send();155    await collection.methods.setCollectionLimit('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();156    await collection.methods.setCollectionLimit('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();157    await collection.methods.setCollectionLimit('ownerCanTransfer', limits.ownerCanTransfer).send();158    await collection.methods.setCollectionLimit('ownerCanDestroy', limits.ownerCanDestroy).send();159    await collection.methods.setCollectionLimit('transfersEnabled', limits.transfersEnabled).send();160161    const data = (await helper.rft.getData(collectionId))!;162    expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(expectedLimits.accountTokenOwnershipLimit);163    expect(data.raw.limits.sponsoredDataSize).to.be.eq(expectedLimits.sponsoredDataSize);164    expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(expectedLimits.sponsoredDataRateLimit);165    expect(data.raw.limits.tokenLimit).to.be.eq(expectedLimits.tokenLimit);166    expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(expectedLimits.sponsorTransferTimeout);167    expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(expectedLimits.sponsorApproveTimeout);168    expect(data.raw.limits.ownerCanTransfer).to.be.eq(expectedLimits.ownerCanTransfer);169    expect(data.raw.limits.ownerCanDestroy).to.be.eq(expectedLimits.ownerCanDestroy);170    expect(data.raw.limits.transfersEnabled).to.be.eq(expectedLimits.transfersEnabled);171  });172173  itEth('Collection address exist', async ({helper}) => {174    const owner = await helper.eth.createAccountWithBalance(donor);175    const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';176    expect(await helper.ethNativeContract.collectionHelpers(collectionAddressForNonexistentCollection)177      .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())178      .to.be.false;179180    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Exister', 'absolutely anything', 'EVC');181    expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)182      .methods.isCollectionExist(collectionAddress).call())183      .to.be.true;184  });185});186187describe('(!negative tests!) Create NFT collection from EVM', () => {188  let donor: IKeyringPair;189  let nominal: bigint;190191  before(async function () {192    await usingEthPlaygrounds(async (helper, privateKey) => {193      donor = await privateKey({filename: __filename});194      nominal = helper.balance.getOneTokenNominal();195    });196  });197198  itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {199    const owner = await helper.eth.createAccountWithBalance(donor);200    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);201    {202      const MAX_NAME_LENGTH = 64;203      const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);204      const description = 'A';205      const tokenPrefix = 'A';206207      await expect(collectionHelper.methods208        .createNFTCollection(collectionName, description, tokenPrefix)209        .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);210211    }212    {213      const MAX_DESCRIPTION_LENGTH = 256;214      const collectionName = 'A';215      const description = 'A'.repeat(MAX_DESCRIPTION_LENGTH + 1);216      const tokenPrefix = 'A';217      await expect(collectionHelper.methods218        .createNFTCollection(collectionName, description, tokenPrefix)219        .call({value: Number(2n * nominal)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);220    }221    {222      const MAX_TOKEN_PREFIX_LENGTH = 16;223      const collectionName = 'A';224      const description = 'A';225      const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);226      await expect(collectionHelper.methods227        .createNFTCollection(collectionName, description, tokenPrefix)228        .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);229    }230  });231232  itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {233    const owner = await helper.eth.createAccountWithBalance(donor);234    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);235    await expect(collectionHelper.methods236      .createNFTCollection('Peasantry', 'absolutely anything', 'CVE')237      .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');238  });239240  // Soft-deprecated241  itEth('(!negative test!) [eth] Check owner', async ({helper}) => {242    const owner = await helper.eth.createAccountWithBalance(donor);243    const malfeasant = helper.eth.createAccount();244    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');245    const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant, true);246    const EXPECTED_ERROR = 'NoPermission';247    {248      const sponsor = await helper.eth.createAccountWithBalance(donor);249      await expect(malfeasantCollection.methods250        .setCollectionSponsor(sponsor)251        .call()).to.be.rejectedWith(EXPECTED_ERROR);252253      const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor, true);254      await expect(sponsorCollection.methods255        .confirmCollectionSponsorship()256        .call()).to.be.rejectedWith('caller is not set as sponsor');257    }258    {259      await expect(malfeasantCollection.methods260        .setCollectionLimit('account_token_ownership_limit', '1000')261        .call()).to.be.rejectedWith(EXPECTED_ERROR);262    }263  });264265  itEth('(!negative test!) [cross] Check owner', async ({helper}) => {266    const owner = await helper.eth.createAccountWithBalance(donor);267    const malfeasant = helper.eth.createAccount();268    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');269    const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant);270    const EXPECTED_ERROR = 'NoPermission';271    {272      const sponsor = await helper.eth.createAccountWithBalance(donor);273      const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);274      await expect(malfeasantCollection.methods275        .setCollectionSponsorCross(sponsorCross)276        .call()).to.be.rejectedWith(EXPECTED_ERROR);277278      const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);279      await expect(sponsorCollection.methods280        .confirmCollectionSponsorship()281        .call()).to.be.rejectedWith('caller is not set as sponsor');282    }283    {284      await expect(malfeasantCollection.methods285        .setCollectionLimit('account_token_ownership_limit', '1000')286        .call()).to.be.rejectedWith(EXPECTED_ERROR);287    }288  });289290  itEth('(!negative test!) Set limits', async ({helper}) => {291    const invalidLimits = {292      accountTokenOwnershipLimit: BigInt(Number.MAX_SAFE_INTEGER),293      transfersEnabled: 3,294    };295296    const owner = await helper.eth.createAccountWithBalance(donor);297    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');298    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);299    300    await expect(collectionEvm.methods301      .setCollectionLimit(Object.keys(invalidLimits)[0], invalidLimits.accountTokenOwnershipLimit)302      .call()).to.be.rejectedWith(`can't convert value to u32 "${invalidLimits.accountTokenOwnershipLimit}"`);303    304    await expect(collectionEvm.methods305      .setCollectionLimit(Object.keys(invalidLimits)[1], invalidLimits.transfersEnabled)306      .call()).to.be.rejectedWith(`can't convert value to boolean "${invalidLimits.transfersEnabled}"`);307  });308309  itEth('destroyCollection', async ({helper}) => {310    const owner = await helper.eth.createAccountWithBalance(donor);311    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Limits', 'absolutely anything', 'OLF');312    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);313314315    const result = await collectionHelper.methods316      .destroyCollection(collectionAddress)317      .send({from: owner});318319    const events = helper.eth.normalizeEvents(result.events);320    321    expect(events).to.be.deep.equal([322      {323        address: collectionHelper.options.address,324        event: 'CollectionDestroyed',325        args: {326          collectionId: collectionAddress,327        },328      },329    ]);330331    expect(await collectionHelper.methods332      .isCollectionExist(collectionAddress)333      .call()).to.be.false;334  });335});
modifiedtests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -53,7 +53,7 @@
 
   
 
-  itEth('Create collection with properties', async ({helper}) => {
+  itEth('Create collection with properties & get description', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
 
     const name = 'CollectionEVM';
@@ -61,7 +61,8 @@
     const prefix = 'token prefix';
     const baseUri = 'BaseURI';
 
-    const {collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, name, description, prefix, baseUri);
+    const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, name, description, prefix, baseUri);
+    const contract = helper.ethNativeContract.collection(collectionAddress, 'nft');
 
     const collection = helper.rft.getCollectionObject(collectionId);
     const data = (await collection.getData())!;
@@ -71,6 +72,8 @@
     expect(data.raw.tokenPrefix).to.be.eq(prefix);
     expect(data.raw.mode).to.be.eq('ReFungible');
 
+    expect(await contract.methods.description().call()).to.deep.equal(description);
+
     const options = await collection.getOptions();
     expect(options.tokenPropertyPermissions).to.be.deep.equal([
       {
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -17,6 +17,7 @@
 import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';
 import {IKeyringPair} from '@polkadot/types/types';
 import {Contract} from 'web3-eth-contract';
+import exp from 'constants';
 
 
 describe('NFT: Information getting', () => {
@@ -149,7 +150,7 @@
     });
   });
 
-  itEth('Can perform mint()', async ({helper}) => {
+  itEth('Can perform mint() & get crossOwner()', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const receiver = helper.eth.createAccount();
 
@@ -166,7 +167,8 @@
     expect(event.returnValues.to).to.be.equal(receiver);
 
     expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
-
+    console.log(await contract.methods.crossOwnerOf(tokenId).call());
+    expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
     // TODO: this wont work right now, need release 919000 first
     // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
     // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -117,7 +117,7 @@
     });
   });
 
-  itEth('Can perform mint()', async ({helper}) => {
+  itEth('Can perform mint() & crossOwnerOf()', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const receiver = helper.eth.createAccount();
     const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Minty', '6', '6', '');
@@ -132,6 +132,7 @@
     const tokenId = event.returnValues.tokenId;
     expect(tokenId).to.be.equal('1');
 
+    expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
     expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
   });
 
modifiedtests/src/eth/tokenProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -14,10 +14,11 @@
 // 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 {itEth, usingEthPlaygrounds, expect} from './util';
+import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';
 import {IKeyringPair} from '@polkadot/types/types';
-import {ITokenPropertyPermission} from '../util/playgrounds/types';
+import {ITokenPropertyPermission, TCollectionMode} from '../util/playgrounds/types';
 import {Pallets} from '../util';
+import {UniqueNFTCollection, UniqueRFTCollection} from '../util/playgrounds/unique';
 
 describe('EVM token properties', () => {
   let donor: IKeyringPair;
@@ -95,7 +96,7 @@
     expect(value).to.equal('testValue');
   });
   
-  itEth('Can be multiple set for NFT ', async({helper}) => {
+  async function checkProps(helper: EthUniqueHelper, mode: TCollectionMode) {
     const caller = await helper.eth.createAccountWithBalance(donor);
     
     const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });
@@ -103,56 +104,44 @@
       collectionAdmin: true,
       mutable: true}}; });
     
-    const collection = await helper.nft.mintCollection(alice, {
+    const collection = await helper[mode].mintCollection(alice, {
       tokenPrefix: 'ethp',
       tokenPropertyPermissions: permissions,
-    });
+    }) as UniqueNFTCollection | UniqueRFTCollection;
     
     const token = await collection.mintToken(alice);
     
     const valuesBefore = await token.getProperties(properties.map(p => p.key));
     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);
+    const contract = helper.ethNativeContract.collection(address, mode, caller);
+    
+    expect(await contract.methods.tokenProperties(token.tokenId, []).call()).to.be.deep.equal([]);
 
     await contract.methods.setProperties(token.tokenId, properties).send({from: caller});
 
     const values = await token.getProperties(properties.map(p => p.key));
     expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.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 {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });
-    const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, 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.key));
-    expect(valuesBefore).to.be.deep.equal([]);
+    expect(await contract.methods.tokenProperties(token.tokenId, []).call()).to.be.like(properties
+      .map(p => { return helper.ethProperty.property(p.key, p.value.toString()); }));
     
-    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.key));
-    expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.toString()}; }));
+    expect(await contract.methods.tokenProperties(token.tokenId, [properties[0].key]).call())
+      .to.be.like([helper.ethProperty.property(properties[0].key, properties[0].value.toString())]);
+  }
+  
+  itEth('Can be multiple set/read for NFT ', async({helper}) => {
+    await checkProps(helper, 'nft');
+  });
+  
+  itEth.ifWithPallets('Can be multiple set/read for RFT ', [Pallets.ReFungible], async({helper}) => {
+    await checkProps(helper, 'rft');
   });
-
+  
   itEth('Can be deleted', async({helper}) => {
     const caller = await helper.eth.createAccountWithBalance(donor);
     const collection = await helper.nft.mintCollection(alice, {