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

difftreelog

feature: Added `transfer_cross` in eth functions.

PraetorP2022-11-14parent: #20c695f.patch.diff
in: master

22 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6121,7 +6121,7 @@
 
 [[package]]
 name = "pallet-fungible"
-version = "0.1.6"
+version = "0.1.7"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -6376,7 +6376,7 @@
 
 [[package]]
 name = "pallet-nonfungible"
-version = "0.1.8"
+version = "0.1.9"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -6498,7 +6498,7 @@
 
 [[package]]
 name = "pallet-refungible"
-version = "0.2.7"
+version = "0.2.8"
 dependencies = [
  "derivative",
  "ethereum",
modifiedpallets/fungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/fungible/CHANGELOG.md
+++ b/pallets/fungible/CHANGELOG.md
@@ -2,22 +2,32 @@
 
 All notable changes to this project will be documented in this file.
 
+<!-- bureaucrate goes here -->
+
+## [0.1.7] - 2022-11-14
+
+### Changed
+
+- Added `transfer_cross` in eth functions.
+
 ## [0.1.6] - 2022-11-02
+
 ### Changed
- - Use named structure `EthCrossAccount` in eth functions.
 
+- Use named structure `EthCrossAccount` in eth functions.
+
 ## [0.1.5] - 2022-08-29
 
 ### Added
 
- - Implementation of `mint` and `mint_bulk` methods for ERC20 API.
+- Implementation of `mint` and `mint_bulk` methods for ERC20 API.
 
 ## [v0.1.4] - 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.3] 2022-08-16
 
 ### Other changes
@@ -41,11 +51,11 @@
 
 ### Fixed
 
- - Issue with ItemCreated event containing total supply of tokens instead minted amount
+- Issue with ItemCreated event containing total supply of tokens instead minted amount
 
 ## [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/fungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/fungible/Cargo.toml
+++ b/pallets/fungible/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pallet-fungible"
-version = "0.1.6"
+version = "0.1.7"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -93,6 +93,7 @@
 		<Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;
 		Ok(true)
 	}
+
 	#[weight(<SelfWeightOf<T>>::transfer_from())]
 	fn transfer_from(
 		&mut self,
@@ -238,6 +239,24 @@
 		Ok(true)
 	}
 
+	#[weight(<SelfWeightOf<T>>::transfer())]
+	fn transfer_cross(
+		&mut self,
+		caller: caller,
+		to: EthCrossAccount,
+		amount: uint256,
+	) -> Result<bool> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let to = to.into_sub_cross_account::<T>()?;
+		let amount = amount.try_into().map_err(|_| "amount overflow")?;
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+		<Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;
+		Ok(true)
+	}
+
 	#[weight(<SelfWeightOf<T>>::transfer_from())]
 	fn transfer_from_cross(
 		&mut self,
modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -38,7 +38,7 @@
 	/// @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(Tuple14[] memory properties) public {
+	function setCollectionProperties(Tuple15[] memory properties) public {
 		require(false, stub_error);
 		properties;
 		dummy = 0;
@@ -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 (Tuple14[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Tuple15[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple14[](0);
+		return new Tuple15[](0);
 	}
 
 	/// Set the sponsor of the collection.
@@ -439,12 +439,12 @@
 }
 
 /// @dev anonymous struct
-struct Tuple14 {
+struct Tuple15 {
 	string field_0;
 	bytes field_1;
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x032e5926
+/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9
 contract ERC20UniqueExtensions is Dummy, ERC165 {
 	/// @dev EVM selector for this function is: 0x0ecd0ab0,
 	///  or in textual repr: approveCross((address,uint256),uint256)
@@ -497,6 +497,16 @@
 		return false;
 	}
 
+	/// @dev EVM selector for this function is: 0x2ada85ff,
+	///  or in textual repr: transferCross((address,uint256),uint256)
+	function transferCross(EthCrossAccount memory to, uint256 amount) public returns (bool) {
+		require(false, stub_error);
+		to;
+		amount;
+		dummy = 0;
+		return false;
+	}
+
 	/// @dev EVM selector for this function is: 0xd5cf430b,
 	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
 	function transferFromCross(
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/nonfungible/CHANGELOG.md
+++ b/pallets/nonfungible/CHANGELOG.md
@@ -4,6 +4,12 @@
 
 <!-- bureaucrate goes here -->
 
+## [0.1.9] - 2022-11-14
+
+### Changed
+
+- Added `transfer_cross` in eth functions.
+
 ## [v0.1.8] - 2022-11-11
 
 ### Changed
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.8"
+version = "0.1.9"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -738,7 +738,25 @@
 		<Pallet<T>>::transfer(self, &caller, &to, token, &budget).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.
+	/// @param to The new owner
+	/// @param tokenId The NFT to transfer
+	#[weight(<SelfWeightOf<T>>::transfer())]
+	fn transfer_cross(&mut self, caller: caller, to: EthCrossAccount, token_id: uint256) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let to = to.into_sub_cross_account::<T>()?;
+		let token = token_id.try_into()?;
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
 
+		<Pallet<T>>::transfer(self, &caller, &to, token, &budget).map_err(dispatch_to_evm::<T>)?;
+		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.
modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -67,7 +67,7 @@
 	/// @param properties settable properties
 	/// @dev EVM selector for this function is: 0x14ed3a6e,
 	///  or in textual repr: setProperties(uint256,(string,bytes)[])
-	function setProperties(uint256 tokenId, Tuple21[] memory properties) public {
+	function setProperties(uint256 tokenId, Tuple22[] memory properties) public {
 		require(false, stub_error);
 		tokenId;
 		properties;
@@ -137,7 +137,7 @@
 	/// @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(Tuple21[] memory properties) public {
+	function setCollectionProperties(Tuple22[] memory properties) public {
 		require(false, stub_error);
 		properties;
 		dummy = 0;
@@ -186,11 +186,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 (Tuple21[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Tuple22[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple21[](0);
+		return new Tuple22[](0);
 	}
 
 	/// Set the sponsor of the collection.
@@ -251,10 +251,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 (Tuple24 memory) {
+	function collectionSponsor() public view returns (Tuple25 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple24(0x0000000000000000000000000000000000000000, 0);
+		return Tuple25(0x0000000000000000000000000000000000000000, 0);
 	}
 
 	/// Set limits for the collection.
@@ -538,13 +538,13 @@
 }
 
 /// @dev anonymous struct
-struct Tuple24 {
+struct Tuple25 {
 	address field_0;
 	uint256 field_1;
 }
 
 /// @dev anonymous struct
-struct Tuple21 {
+struct Tuple22 {
 	string field_0;
 	bytes field_1;
 }
@@ -693,7 +693,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x244543ee
+/// @dev the ERC-165 identifier for this interface is 0x0e9fc611
 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,
@@ -742,6 +742,20 @@
 		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.
+	/// @param to The new owner
+	/// @param tokenId The NFT to transfer
+	/// @dev EVM selector for this function is: 0x2ada85ff,
+	///  or in textual repr: transferCross((address,uint256),uint256)
+	function transferCross(EthCrossAccount memory to, uint256 tokenId) public {
+		require(false, stub_error);
+		to;
+		tokenId;
+		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.
@@ -822,7 +836,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, Tuple11[] memory tokens) public returns (bool) {
 	// 	require(false, stub_error);
 	// 	to;
 	// 	tokens;
@@ -833,7 +847,7 @@
 }
 
 /// @dev anonymous struct
-struct Tuple10 {
+struct Tuple11 {
 	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.8] - 2022-11-14
+
+### Changed
+
+- Added `transfer_cross` in eth functions.
+
 ## [v0.2.7] - 2022-11-11
 
 ### Changed
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.7"
+version = "0.2.8"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -756,6 +756,29 @@
 	/// @param to The new owner
 	/// @param tokenId The RFT to transfer
 	#[weight(<SelfWeightOf<T>>::transfer_creating_removing())]
+	fn transfer_cross(&mut self, caller: caller, to: EthCrossAccount, token_id: uint256) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let to = to.into_sub_cross_account::<T>()?;
+		let token = token_id.try_into()?;
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+		let balance = balance(self, token, &caller)?;
+		ensure_single_owner(self, token, balance)?;
+
+		<Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(())
+	}
+
+	/// @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
+	#[weight(<SelfWeightOf<T>>::transfer_creating_removing())]
 	fn transfer_from_cross(
 		&mut self,
 		caller: caller,
modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -67,7 +67,7 @@
 	/// @param properties settable properties
 	/// @dev EVM selector for this function is: 0x14ed3a6e,
 	///  or in textual repr: setProperties(uint256,(string,bytes)[])
-	function setProperties(uint256 tokenId, Tuple20[] memory properties) public {
+	function setProperties(uint256 tokenId, Tuple21[] memory properties) public {
 		require(false, stub_error);
 		tokenId;
 		properties;
@@ -137,7 +137,7 @@
 	/// @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(Tuple20[] memory properties) public {
+	function setCollectionProperties(Tuple21[] memory properties) public {
 		require(false, stub_error);
 		properties;
 		dummy = 0;
@@ -186,11 +186,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 (Tuple20[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Tuple21[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple20[](0);
+		return new Tuple21[](0);
 	}
 
 	/// Set the sponsor of the collection.
@@ -251,10 +251,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 (Tuple23 memory) {
+	function collectionSponsor() public view returns (Tuple24 memory) {
 		require(false, stub_error);
 		dummy;
-		return Tuple23(0x0000000000000000000000000000000000000000, 0);
+		return Tuple24(0x0000000000000000000000000000000000000000, 0);
 	}
 
 	/// Set limits for the collection.
@@ -538,13 +538,13 @@
 }
 
 /// @dev anonymous struct
-struct Tuple23 {
+struct Tuple24 {
 	address field_0;
 	uint256 field_1;
 }
 
 /// @dev anonymous struct
-struct Tuple20 {
+struct Tuple21 {
 	string field_0;
 	bytes field_1;
 }
@@ -691,7 +691,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x81feb398
+/// @dev the ERC-165 identifier for this interface is 0xab243667
 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,
@@ -732,6 +732,21 @@
 	///  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: 0x2ada85ff,
+	///  or in textual repr: transferCross((address,uint256),uint256)
+	function transferCross(EthCrossAccount memory to, uint256 tokenId) public {
+		require(false, stub_error);
+		to;
+		tokenId;
+		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(
@@ -809,7 +824,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, Tuple9[] memory tokens) public returns (bool) {
+	// function mintBulkWithTokenURI(address to, Tuple10[] memory tokens) public returns (bool) {
 	// 	require(false, stub_error);
 	// 	to;
 	// 	tokens;
@@ -831,7 +846,7 @@
 }
 
 /// @dev anonymous struct
-struct Tuple9 {
+struct Tuple10 {
 	uint256 field_0;
 	string field_1;
 }
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -28,7 +28,7 @@
 	/// @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(Tuple14[] memory properties) external;
+	function setCollectionProperties(Tuple15[] memory properties) external;
 
 	/// Delete collection property.
 	///
@@ -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 (Tuple14[] memory);
+	function collectionProperties(string[] memory keys) external view returns (Tuple15[] memory);
 
 	/// Set the sponsor of the collection.
 	///
@@ -287,12 +287,12 @@
 }
 
 /// @dev anonymous struct
-struct Tuple14 {
+struct Tuple15 {
 	string field_0;
 	bytes field_1;
 }
 
-/// @dev the ERC-165 identifier for this interface is 0x032e5926
+/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9
 interface ERC20UniqueExtensions is Dummy, ERC165 {
 	/// @dev EVM selector for this function is: 0x0ecd0ab0,
 	///  or in textual repr: approveCross((address,uint256),uint256)
@@ -322,6 +322,10 @@
 	///  or in textual repr: mintBulk((address,uint256)[])
 	function mintBulk(Tuple8[] memory amounts) external returns (bool);
 
+	/// @dev EVM selector for this function is: 0x2ada85ff,
+	///  or in textual repr: transferCross((address,uint256),uint256)
+	function transferCross(EthCrossAccount memory to, uint256 amount) external returns (bool);
+
 	/// @dev EVM selector for this function is: 0xd5cf430b,
 	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
 	function transferFromCross(
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -49,7 +49,7 @@
 	/// @param properties settable properties
 	/// @dev EVM selector for this function is: 0x14ed3a6e,
 	///  or in textual repr: setProperties(uint256,(string,bytes)[])
-	function setProperties(uint256 tokenId, Tuple21[] memory properties) external;
+	function setProperties(uint256 tokenId, Tuple22[] memory properties) external;
 
 	// /// @notice Delete token property value.
 	// /// @dev Throws error if `msg.sender` has no permission to edit the property.
@@ -93,7 +93,7 @@
 	/// @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(Tuple21[] memory properties) external;
+	function setCollectionProperties(Tuple22[] memory properties) external;
 
 	/// Delete collection property.
 	///
@@ -125,7 +125,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 (Tuple21[] memory);
+	function collectionProperties(string[] memory keys) external view returns (Tuple22[] memory);
 
 	/// Set the sponsor of the collection.
 	///
@@ -167,7 +167,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 (Tuple24 memory);
+	function collectionSponsor() external view returns (Tuple25 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -352,13 +352,13 @@
 }
 
 /// @dev anonymous struct
-struct Tuple24 {
+struct Tuple25 {
 	address field_0;
 	uint256 field_1;
 }
 
 /// @dev anonymous struct
-struct Tuple21 {
+struct Tuple22 {
 	string field_0;
 	bytes field_1;
 }
@@ -458,7 +458,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x244543ee
+/// @dev the ERC-165 identifier for this interface is 0x0e9fc611
 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,
@@ -489,6 +489,15 @@
 	///  or in textual repr: transfer(address,uint256)
 	function transfer(address to, 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.
+	/// @param to The new owner
+	/// @param tokenId The NFT to transfer
+	/// @dev EVM selector for this function is: 0x2ada85ff,
+	///  or in textual repr: transferCross((address,uint256),uint256)
+	function transferCross(EthCrossAccount memory 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.
@@ -543,12 +552,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, Tuple10[] memory tokens) external returns (bool);
+	// function mintBulkWithTokenURI(address to, Tuple11[] memory tokens) external returns (bool);
 
 }
 
 /// @dev anonymous struct
-struct Tuple10 {
+struct Tuple11 {
 	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
@@ -49,7 +49,7 @@
 	/// @param properties settable properties
 	/// @dev EVM selector for this function is: 0x14ed3a6e,
 	///  or in textual repr: setProperties(uint256,(string,bytes)[])
-	function setProperties(uint256 tokenId, Tuple20[] memory properties) external;
+	function setProperties(uint256 tokenId, Tuple21[] memory properties) external;
 
 	// /// @notice Delete token property value.
 	// /// @dev Throws error if `msg.sender` has no permission to edit the property.
@@ -93,7 +93,7 @@
 	/// @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(Tuple20[] memory properties) external;
+	function setCollectionProperties(Tuple21[] memory properties) external;
 
 	/// Delete collection property.
 	///
@@ -125,7 +125,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 (Tuple20[] memory);
+	function collectionProperties(string[] memory keys) external view returns (Tuple21[] memory);
 
 	/// Set the sponsor of the collection.
 	///
@@ -167,7 +167,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 (Tuple23 memory);
+	function collectionSponsor() external view returns (Tuple24 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -352,13 +352,13 @@
 }
 
 /// @dev anonymous struct
-struct Tuple23 {
+struct Tuple24 {
 	address field_0;
 	uint256 field_1;
 }
 
 /// @dev anonymous struct
-struct Tuple20 {
+struct Tuple21 {
 	string field_0;
 	bytes field_1;
 }
@@ -456,7 +456,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x81feb398
+/// @dev the ERC-165 identifier for this interface is 0xab243667
 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,
@@ -484,6 +484,16 @@
 	///  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: 0x2ada85ff,
+	///  or in textual repr: transferCross((address,uint256),uint256)
+	function transferCross(EthCrossAccount memory 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(
@@ -535,7 +545,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, Tuple9[] memory tokens) external returns (bool);
+	// function mintBulkWithTokenURI(address to, Tuple10[] memory tokens) external returns (bool);
 
 	/// Returns EVM address for refungible token
 	///
@@ -546,7 +556,7 @@
 }
 
 /// @dev anonymous struct
-struct Tuple9 {
+struct Tuple10 {
 	uint256 field_0;
 	string field_1;
 }
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -230,6 +230,37 @@
     }
   });
 
+  itEth('Can perform transferCross()', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const receiver = await helper.eth.createAccountWithBalance(donor);
+    const to = helper.ethCrossAccount.fromAddress(receiver);
+    const collection = await helper.ft.mintCollection(alice);
+    await collection.mint(alice, 200n, {Ethereum: owner});
+
+    const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
+
+    {
+      const result = await contract.methods.transferCross(to, 50).send({from: owner});
+      
+      const event = result.events.Transfer;
+      expect(event.address).to.be.equal(collectionAddress);
+      expect(event.returnValues.from).to.be.equal(owner);
+      expect(event.returnValues.to).to.be.equal(receiver);
+      expect(event.returnValues.value).to.be.equal('50');
+    }
+
+    {
+      const balance = await contract.methods.balanceOf(owner).call();
+      expect(+balance).to.equal(150);
+    }
+
+    {
+      const balance = await contract.methods.balanceOf(receiver).call();
+      expect(+balance).to.equal(50);
+    }
+  });
+  
   itEth('Can perform transfer()', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const receiver = await helper.eth.createAccountWithBalance(donor);
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/fungibleAbi.json
+++ b/tests/src/eth/fungibleAbi.json
@@ -239,7 +239,7 @@
           { "internalType": "string", "name": "field_0", "type": "string" },
           { "internalType": "bytes", "name": "field_1", "type": "bytes" }
         ],
-        "internalType": "struct Tuple14[]",
+        "internalType": "struct Tuple15[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -496,7 +496,7 @@
           { "internalType": "string", "name": "field_0", "type": "string" },
           { "internalType": "bytes", "name": "field_1", "type": "bytes" }
         ],
-        "internalType": "struct Tuple14[]",
+        "internalType": "struct Tuple15[]",
         "name": "properties",
         "type": "tuple[]"
       }
@@ -594,6 +594,24 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct EthCrossAccount",
+        "name": "to",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "amount", "type": "uint256" }
+    ],
+    "name": "transferCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "from", "type": "address" },
       { "internalType": "address", "name": "to", "type": "address" },
       { "internalType": "uint256", "name": "amount", "type": "uint256" }
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -402,6 +402,37 @@
       expect(+balance).to.equal(1);
     }
   });
+  
+  itEth('Can perform transferCross()', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(minter, {});
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const receiver = helper.eth.createAccount();
+    const to = helper.ethCrossAccount.fromAddress(receiver);
+    const {tokenId} = await collection.mintToken(minter, {Ethereum: owner});
+
+    const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+
+    {
+      const result = await contract.methods.transferCross(to, tokenId).send({from: owner});
+
+      const event = result.events.Transfer;
+      expect(event.address).to.be.equal(collectionAddress);
+      expect(event.returnValues.from).to.be.equal(owner);
+      expect(event.returnValues.to).to.be.equal(receiver);
+      expect(event.returnValues.tokenId).to.be.equal(`${tokenId}`);
+    }
+
+    {
+      const balance = await contract.methods.balanceOf(owner).call();
+      expect(+balance).to.equal(0);
+    }
+
+    {
+      const balance = await contract.methods.balanceOf(receiver).call();
+      expect(+balance).to.equal(1);
+    }
+  });
 });
 
 describe('NFT: Fees', () => {
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -269,7 +269,7 @@
           { "internalType": "string", "name": "field_0", "type": "string" },
           { "internalType": "bytes", "name": "field_1", "type": "bytes" }
         ],
-        "internalType": "struct Tuple21[]",
+        "internalType": "struct Tuple22[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -293,7 +293,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple24",
+        "internalType": "struct Tuple25",
         "name": "",
         "type": "tuple"
       }
@@ -611,7 +611,7 @@
           { "internalType": "string", "name": "field_0", "type": "string" },
           { "internalType": "bytes", "name": "field_1", "type": "bytes" }
         ],
-        "internalType": "struct Tuple21[]",
+        "internalType": "struct Tuple22[]",
         "name": "properties",
         "type": "tuple[]"
       }
@@ -682,7 +682,7 @@
           { "internalType": "string", "name": "field_0", "type": "string" },
           { "internalType": "bytes", "name": "field_1", "type": "bytes" }
         ],
-        "internalType": "struct Tuple21[]",
+        "internalType": "struct Tuple22[]",
         "name": "properties",
         "type": "tuple[]"
       }
@@ -778,6 +778,24 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct EthCrossAccount",
+        "name": "to",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "transferCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "from", "type": "address" },
       { "internalType": "address", "name": "to", "type": "address" },
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
before · tests/src/eth/reFungible.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.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/>.1617import {Pallets, requirePalletsOrSkip} from '../util';18import {expect, itEth, usingEthPlaygrounds} from './util';19import {IKeyringPair} from '@polkadot/types/types';2021describe('Refungible: Information getting', () => {22  let donor: IKeyringPair;2324  before(async function() {25    await usingEthPlaygrounds(async (helper, privateKey) => {26      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);2728      donor = await privateKey({filename: __filename});29    });30  });3132  itEth('totalSupply', async ({helper}) => {33    const caller = await helper.eth.createAccountWithBalance(donor);34    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'TotalSupply', '6', '6');35    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);3637    await contract.methods.mint(caller).send();3839    const totalSupply = await contract.methods.totalSupply().call();40    expect(totalSupply).to.equal('1');41  });4243  itEth('balanceOf', async ({helper}) => {44    const caller = await helper.eth.createAccountWithBalance(donor);45    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'BalanceOf', '6', '6');46    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);4748    await contract.methods.mint(caller).send();49    await contract.methods.mint(caller).send();50    await contract.methods.mint(caller).send();5152    const balance = await contract.methods.balanceOf(caller).call();53    expect(balance).to.equal('3');54  });5556  itEth('ownerOf', async ({helper}) => {57    const caller = await helper.eth.createAccountWithBalance(donor);58    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'OwnerOf', '6', '6');59    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);6061    const result = await contract.methods.mint(caller).send();62    const tokenId = result.events.Transfer.returnValues.tokenId;6364    const owner = await contract.methods.ownerOf(tokenId).call();65    expect(owner).to.equal(caller);66  });6768  itEth('ownerOf after burn', async ({helper}) => {69    const caller = await helper.eth.createAccountWithBalance(donor);70    const receiver = helper.eth.createAccount();71    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'OwnerOf-AfterBurn', '6', '6');72    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);7374    const result = await contract.methods.mint(caller).send();75    const tokenId = result.events.Transfer.returnValues.tokenId;76    const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);7778    await tokenContract.methods.repartition(2).send();79    await tokenContract.methods.transfer(receiver, 1).send();8081    await tokenContract.methods.burnFrom(caller, 1).send();8283    const owner = await contract.methods.ownerOf(tokenId).call();84    expect(owner).to.equal(receiver);85  });8687  itEth('ownerOf for partial ownership', async ({helper}) => {88    const caller = await helper.eth.createAccountWithBalance(donor);89    const receiver = helper.eth.createAccount();90    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'Partial-OwnerOf', '6', '6');91    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);9293    const result = await contract.methods.mint(caller).send();94    const tokenId = result.events.Transfer.returnValues.tokenId;95    const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);9697    await tokenContract.methods.repartition(2).send();98    await tokenContract.methods.transfer(receiver, 1).send();99100    const owner = await contract.methods.ownerOf(tokenId).call();101    expect(owner).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');102  });103});104105describe('Refungible: Plain calls', () => {106  let donor: IKeyringPair;107  let minter: IKeyringPair;108  let bob: IKeyringPair;109  let charlie: IKeyringPair;110111  before(async function() {112    await usingEthPlaygrounds(async (helper, privateKey) => {113      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);114115      donor = await privateKey({filename: __filename});116      [minter, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);117    });118  });119120  itEth('Can perform mint()', async ({helper}) => {121    const owner = await helper.eth.createAccountWithBalance(donor);122    const receiver = helper.eth.createAccount();123    const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Minty', '6', '6', '');124    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);125126    const result = await contract.methods.mintWithTokenURI(receiver, 'Test URI').send();127128    const event = result.events.Transfer;129    expect(event.address).to.equal(collectionAddress);130    expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');131    expect(event.returnValues.to).to.equal(receiver);132    const tokenId = event.returnValues.tokenId;133    expect(tokenId).to.be.equal('1');134135    expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');136  });137138  itEth.skip('Can perform mintBulk()', async ({helper}) => {139    const owner = await helper.eth.createAccountWithBalance(donor);140    const receiver = helper.eth.createAccount();141    const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'MintBulky', '6', '6', '');142    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);143144    {145      const nextTokenId = await contract.methods.nextTokenId().call();146      expect(nextTokenId).to.be.equal('1');147      const result = await contract.methods.mintBulkWithTokenURI(148        receiver,149        [150          [nextTokenId, 'Test URI 0'],151          [+nextTokenId + 1, 'Test URI 1'],152          [+nextTokenId + 2, 'Test URI 2'],153        ],154      ).send();155156      const events = result.events.Transfer;157      for (let i = 0; i < 2; i++) {158        const event = events[i];159        expect(event.address).to.equal(collectionAddress);160        expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');161        expect(event.returnValues.to).to.equal(receiver);162        expect(event.returnValues.tokenId).to.equal(String(+nextTokenId + i));163      }164165      expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');166      expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');167      expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');168    }169  });170171  itEth('Can perform burn()', async ({helper}) => {172    const caller = await helper.eth.createAccountWithBalance(donor);173    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Burny', '6', '6');174    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);175176    const result = await contract.methods.mint(caller).send();177    const tokenId = result.events.Transfer.returnValues.tokenId;178    {179      const result = await contract.methods.burn(tokenId).send();180      const event = result.events.Transfer;181      expect(event.address).to.equal(collectionAddress);182      expect(event.returnValues.from).to.equal(caller);183      expect(event.returnValues.to).to.equal('0x0000000000000000000000000000000000000000');184      expect(event.returnValues.tokenId).to.equal(tokenId.toString());185    }186  });187188  itEth('Can perform transferFrom()', async ({helper}) => {189    const caller = await helper.eth.createAccountWithBalance(donor);190    const receiver = helper.eth.createAccount();191    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'TransferFromy', '6', '6');192    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);193194    const result = await contract.methods.mint(caller).send();195    const tokenId = result.events.Transfer.returnValues.tokenId;196197    const tokenAddress = helper.ethAddress.fromTokenId(collectionId, tokenId);198199    const tokenContract = helper.ethNativeContract.rftToken(tokenAddress, caller);200    await tokenContract.methods.repartition(15).send();201202    {203      const tokenEvents: any = [];204      tokenContract.events.allEvents((_: any, event: any) => {205        tokenEvents.push(event);206      });207      const result = await contract.methods.transferFrom(caller, receiver, tokenId).send();208      if (tokenEvents.length == 0) await helper.wait.newBlocks(1);209210      let event = result.events.Transfer;211      expect(event.address).to.equal(collectionAddress);212      expect(event.returnValues.from).to.equal(caller);213      expect(event.returnValues.to).to.equal(receiver);214      expect(event.returnValues.tokenId).to.equal(tokenId.toString());215216      event = tokenEvents[0];217      expect(event.address).to.equal(tokenAddress);218      expect(event.returnValues.from).to.equal(caller);219      expect(event.returnValues.to).to.equal(receiver);220      expect(event.returnValues.value).to.equal('15');221    }222223    {224      const balance = await contract.methods.balanceOf(receiver).call();225      expect(+balance).to.equal(1);226    }227228    {229      const balance = await contract.methods.balanceOf(caller).call();230      expect(+balance).to.equal(0);231    }232  });233234  itEth('Can perform burnFrom()', async ({helper}) => {235    const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});236237    const owner = await helper.eth.createAccountWithBalance(donor, 100n);238    const spender = await helper.eth.createAccountWithBalance(donor, 100n);239240    const token = await collection.mintToken(minter, 100n, {Ethereum: owner});241242    const address = helper.ethAddress.fromCollectionId(collection.collectionId);243    const contract = helper.ethNativeContract.collection(address, 'rft');244245    const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, token.tokenId);246    const tokenContract = helper.ethNativeContract.rftToken(tokenAddress, owner);247    await tokenContract.methods.repartition(15).send();248    await tokenContract.methods.approve(spender, 15).send();249250    {251      const result = await contract.methods.burnFrom(owner, token.tokenId).send({from: spender});252      const event = result.events.Transfer;253      expect(event).to.be.like({254        address: helper.ethAddress.fromCollectionId(collection.collectionId),255        event: 'Transfer',256        returnValues: {257          from: owner,258          to: '0x0000000000000000000000000000000000000000',259          tokenId: token.tokenId.toString(),260        },261      });262    }263264    expect(await collection.getTokenBalance(token.tokenId, {Ethereum: owner})).to.be.eq(0n);265  });266267  itEth('Can perform burnFromCross()', async ({helper}) => {268    const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});269    270    const owner = bob;271    const spender = await helper.eth.createAccountWithBalance(donor, 100n);272273    const token = await collection.mintToken(minter, 100n, {Substrate: owner.address});274275    const address = helper.ethAddress.fromCollectionId(collection.collectionId);276    const contract = helper.ethNativeContract.collection(address, 'rft');277278    await token.repartition(owner, 15n);279    await token.approve(owner, {Ethereum: spender}, 15n);280281    {282      const ownerCross = helper.ethCrossAccount.fromKeyringPair(owner);283      const result = await contract.methods.burnFromCross(ownerCross, token.tokenId).send({from: spender});284      const event = result.events.Transfer;285      expect(event).to.be.like({286        address: helper.ethAddress.fromCollectionId(collection.collectionId),287        event: 'Transfer',288        returnValues: {289          from: helper.address.substrateToEth(owner.address),290          to: '0x0000000000000000000000000000000000000000',291          tokenId: token.tokenId.toString(),292        },293      });294    }295296    expect(await collection.getTokenBalance(token.tokenId, {Substrate: owner.address})).to.be.eq(0n);297  });298299  itEth('Can perform transferFromCross()', async ({helper}) => {300    const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});301302    const owner = bob;303    const spender = await helper.eth.createAccountWithBalance(donor, 100n);304    const receiver = charlie;305306    const token = await collection.mintToken(minter, 100n, {Substrate: owner.address});307308    const address = helper.ethAddress.fromCollectionId(collection.collectionId);309    const contract = helper.ethNativeContract.collection(address, 'rft');310311    await token.repartition(owner, 15n);312    await token.approve(owner, {Ethereum: spender}, 15n);313314    {315      const ownerCross = helper.ethCrossAccount.fromKeyringPair(owner);316      const recieverCross = helper.ethCrossAccount.fromKeyringPair(receiver);317      const result = await contract.methods.transferFromCross(ownerCross, recieverCross, token.tokenId).send({from: spender});318      const event = result.events.Transfer;319      expect(event).to.be.like({320        address: helper.ethAddress.fromCollectionId(collection.collectionId),321        event: 'Transfer',322        returnValues: {323          from: helper.address.substrateToEth(owner.address),324          to: helper.address.substrateToEth(receiver.address),325          tokenId: token.tokenId.toString(),326        },327      });328    }329330    expect(await token.getTop10Owners()).to.be.like([{Substrate: receiver.address}]);331  });332333  itEth('Can perform transfer()', async ({helper}) => {334    const caller = await helper.eth.createAccountWithBalance(donor);335    const receiver = helper.eth.createAccount();336    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Transferry', '6', '6');337    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);338339    const result = await contract.methods.mint(caller).send();340    const tokenId = result.events.Transfer.returnValues.tokenId;341342    {343      const result = await contract.methods.transfer(receiver, tokenId).send();344345      const event = result.events.Transfer;346      expect(event.address).to.equal(collectionAddress);347      expect(event.returnValues.from).to.equal(caller);348      expect(event.returnValues.to).to.equal(receiver);349      expect(event.returnValues.tokenId).to.equal(tokenId.toString());350    }351352    {353      const balance = await contract.methods.balanceOf(caller).call();354      expect(+balance).to.equal(0);355    }356357    {358      const balance = await contract.methods.balanceOf(receiver).call();359      expect(+balance).to.equal(1);360    }361  });362363  itEth('transfer event on transfer from partial ownership to full ownership', async ({helper}) => {364    const caller = await helper.eth.createAccountWithBalance(donor);365    const receiver = helper.eth.createAccount();366    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'Transferry-Partial-to-Full', '6', '6');367    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);368369    const result = await contract.methods.mint(caller).send();370    const tokenId = result.events.Transfer.returnValues.tokenId;371372    const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);373374    await tokenContract.methods.repartition(2).send();375    await tokenContract.methods.transfer(receiver, 1).send();376377    const events: any = [];378    contract.events.allEvents((_: any, event: any) => {379      events.push(event);380    });381382    await tokenContract.methods.transfer(receiver, 1).send();383    if (events.length == 0) await helper.wait.newBlocks(1);384    const event = events[0];385386    expect(event.address).to.equal(collectionAddress);387    expect(event.returnValues.from).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');388    expect(event.returnValues.to).to.equal(receiver);389    expect(event.returnValues.tokenId).to.equal(tokenId.toString());390  });391392  itEth('transfer event on transfer from full ownership to partial ownership', async ({helper}) => {393    const caller = await helper.eth.createAccountWithBalance(donor);394    const receiver = helper.eth.createAccount();395    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'Transferry-Full-to-Partial', '6', '6');396    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);397398    const result = await contract.methods.mint(caller).send();399    const tokenId = result.events.Transfer.returnValues.tokenId;400401    const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);402403    await tokenContract.methods.repartition(2).send();404405    const events: any = [];406    contract.events.allEvents((_: any, event: any) => {407      events.push(event);408    });409410    await tokenContract.methods.transfer(receiver, 1).send();411    if (events.length == 0) await helper.wait.newBlocks(1);412    const event = events[0];413414    expect(event.address).to.equal(collectionAddress);415    expect(event.returnValues.from).to.equal(caller);416    expect(event.returnValues.to).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');417    expect(event.returnValues.tokenId).to.equal(tokenId.toString());418  });419});420421describe('RFT: Fees', () => {422  let donor: IKeyringPair;423424  before(async function() {425    await usingEthPlaygrounds(async (helper, privateKey) => {426      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);427428      donor = await privateKey({filename: __filename});429    });430  });431432  itEth('transferFrom() call fee is less than 0.2UNQ', async ({helper}) => {433    const caller = await helper.eth.createAccountWithBalance(donor);434    const receiver = helper.eth.createAccount();435    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Feeful-Transfer-From', '6', '6');436    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);437438    const result = await contract.methods.mint(caller).send();439    const tokenId = result.events.Transfer.returnValues.tokenId;440441    const cost = await helper.eth.recordCallFee(caller, () => contract.methods.transferFrom(caller, receiver, tokenId).send());442    expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));443    expect(cost > 0n);444  });445446  itEth('transfer() call fee is less than 0.2UNQ', async ({helper}) => {447    const caller = await helper.eth.createAccountWithBalance(donor);448    const receiver = helper.eth.createAccount();449    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Feeful-Transfer', '6', '6');450    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);451452    const result = await contract.methods.mint(caller).send();453    const tokenId = result.events.Transfer.returnValues.tokenId;454455    const cost = await helper.eth.recordCallFee(caller, () => contract.methods.transfer(receiver, tokenId).send());456    expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));457    expect(cost > 0n);458  });459});460461describe('Common metadata', () => {462  let donor: IKeyringPair;463  let alice: IKeyringPair;464465  before(async function() {466    await usingEthPlaygrounds(async (helper, privateKey) => {467      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);468469      donor = await privateKey({filename: __filename});470      [alice] = await helper.arrange.createAccounts([20n], donor);471    });472  });473474  itEth('Returns collection name', async ({helper}) => {475    const caller = helper.eth.createAccount();476    const tokenPropertyPermissions = [{477      key: 'URI',478      permission: {479        mutable: true,480        collectionAdmin: true,481        tokenOwner: false,482      },483    }];484    const collection = await helper.rft.mintCollection(485      alice,486      {487        name: 'Leviathan',488        tokenPrefix: '11',489        properties: [{key: 'ERC721Metadata', value: '1'}],490        tokenPropertyPermissions,491      },492    );493494    const contract = helper.ethNativeContract.collectionById(collection.collectionId, 'rft', caller);495    const name = await contract.methods.name().call();496    expect(name).to.equal('Leviathan');497  });498499  itEth('Returns symbol name', async ({helper}) => {500    const caller = await helper.eth.createAccountWithBalance(donor);501    const tokenPropertyPermissions = [{502      key: 'URI',503      permission: {504        mutable: true,505        collectionAdmin: true,506        tokenOwner: false,507      },508    }];509    const {collectionId} = await helper.rft.mintCollection(510      alice,511      {512        name: 'Leviathan',513        tokenPrefix: '12',514        properties: [{key: 'ERC721Metadata', value: '1'}],515        tokenPropertyPermissions,516      },517    );518519    const contract = helper.ethNativeContract.collectionById(collectionId, 'rft', caller);520    const symbol = await contract.methods.symbol().call();521    expect(symbol).to.equal('12');522  });523});
after · tests/src/eth/reFungible.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.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/>.1617import {Pallets, requirePalletsOrSkip} from '../util';18import {expect, itEth, usingEthPlaygrounds} from './util';19import {IKeyringPair} from '@polkadot/types/types';2021describe('Refungible: Information getting', () => {22  let donor: IKeyringPair;2324  before(async function() {25    await usingEthPlaygrounds(async (helper, privateKey) => {26      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);2728      donor = await privateKey({filename: __filename});29    });30  });3132  itEth('totalSupply', async ({helper}) => {33    const caller = await helper.eth.createAccountWithBalance(donor);34    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'TotalSupply', '6', '6');35    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);3637    await contract.methods.mint(caller).send();3839    const totalSupply = await contract.methods.totalSupply().call();40    expect(totalSupply).to.equal('1');41  });4243  itEth('balanceOf', async ({helper}) => {44    const caller = await helper.eth.createAccountWithBalance(donor);45    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'BalanceOf', '6', '6');46    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);4748    await contract.methods.mint(caller).send();49    await contract.methods.mint(caller).send();50    await contract.methods.mint(caller).send();5152    const balance = await contract.methods.balanceOf(caller).call();53    expect(balance).to.equal('3');54  });5556  itEth('ownerOf', async ({helper}) => {57    const caller = await helper.eth.createAccountWithBalance(donor);58    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'OwnerOf', '6', '6');59    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);6061    const result = await contract.methods.mint(caller).send();62    const tokenId = result.events.Transfer.returnValues.tokenId;6364    const owner = await contract.methods.ownerOf(tokenId).call();65    expect(owner).to.equal(caller);66  });6768  itEth('ownerOf after burn', async ({helper}) => {69    const caller = await helper.eth.createAccountWithBalance(donor);70    const receiver = helper.eth.createAccount();71    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'OwnerOf-AfterBurn', '6', '6');72    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);7374    const result = await contract.methods.mint(caller).send();75    const tokenId = result.events.Transfer.returnValues.tokenId;76    const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);7778    await tokenContract.methods.repartition(2).send();79    await tokenContract.methods.transfer(receiver, 1).send();8081    await tokenContract.methods.burnFrom(caller, 1).send();8283    const owner = await contract.methods.ownerOf(tokenId).call();84    expect(owner).to.equal(receiver);85  });8687  itEth('ownerOf for partial ownership', async ({helper}) => {88    const caller = await helper.eth.createAccountWithBalance(donor);89    const receiver = helper.eth.createAccount();90    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'Partial-OwnerOf', '6', '6');91    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);9293    const result = await contract.methods.mint(caller).send();94    const tokenId = result.events.Transfer.returnValues.tokenId;95    const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);9697    await tokenContract.methods.repartition(2).send();98    await tokenContract.methods.transfer(receiver, 1).send();99100    const owner = await contract.methods.ownerOf(tokenId).call();101    expect(owner).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');102  });103});104105describe('Refungible: Plain calls', () => {106  let donor: IKeyringPair;107  let minter: IKeyringPair;108  let bob: IKeyringPair;109  let charlie: IKeyringPair;110111  before(async function() {112    await usingEthPlaygrounds(async (helper, privateKey) => {113      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);114115      donor = await privateKey({filename: __filename});116      [minter, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);117    });118  });119120  itEth('Can perform mint()', async ({helper}) => {121    const owner = await helper.eth.createAccountWithBalance(donor);122    const receiver = helper.eth.createAccount();123    const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Minty', '6', '6', '');124    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);125126    const result = await contract.methods.mintWithTokenURI(receiver, 'Test URI').send();127128    const event = result.events.Transfer;129    expect(event.address).to.equal(collectionAddress);130    expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');131    expect(event.returnValues.to).to.equal(receiver);132    const tokenId = event.returnValues.tokenId;133    expect(tokenId).to.be.equal('1');134135    expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');136  });137138  itEth.skip('Can perform mintBulk()', async ({helper}) => {139    const owner = await helper.eth.createAccountWithBalance(donor);140    const receiver = helper.eth.createAccount();141    const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'MintBulky', '6', '6', '');142    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);143144    {145      const nextTokenId = await contract.methods.nextTokenId().call();146      expect(nextTokenId).to.be.equal('1');147      const result = await contract.methods.mintBulkWithTokenURI(148        receiver,149        [150          [nextTokenId, 'Test URI 0'],151          [+nextTokenId + 1, 'Test URI 1'],152          [+nextTokenId + 2, 'Test URI 2'],153        ],154      ).send();155156      const events = result.events.Transfer;157      for (let i = 0; i < 2; i++) {158        const event = events[i];159        expect(event.address).to.equal(collectionAddress);160        expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');161        expect(event.returnValues.to).to.equal(receiver);162        expect(event.returnValues.tokenId).to.equal(String(+nextTokenId + i));163      }164165      expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');166      expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');167      expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');168    }169  });170171  itEth('Can perform burn()', async ({helper}) => {172    const caller = await helper.eth.createAccountWithBalance(donor);173    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Burny', '6', '6');174    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);175176    const result = await contract.methods.mint(caller).send();177    const tokenId = result.events.Transfer.returnValues.tokenId;178    {179      const result = await contract.methods.burn(tokenId).send();180      const event = result.events.Transfer;181      expect(event.address).to.equal(collectionAddress);182      expect(event.returnValues.from).to.equal(caller);183      expect(event.returnValues.to).to.equal('0x0000000000000000000000000000000000000000');184      expect(event.returnValues.tokenId).to.equal(tokenId.toString());185    }186  });187188  itEth('Can perform transferFrom()', async ({helper}) => {189    const caller = await helper.eth.createAccountWithBalance(donor);190    const receiver = helper.eth.createAccount();191    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'TransferFromy', '6', '6');192    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);193194    const result = await contract.methods.mint(caller).send();195    const tokenId = result.events.Transfer.returnValues.tokenId;196197    const tokenAddress = helper.ethAddress.fromTokenId(collectionId, tokenId);198199    const tokenContract = helper.ethNativeContract.rftToken(tokenAddress, caller);200    await tokenContract.methods.repartition(15).send();201202    {203      const tokenEvents: any = [];204      tokenContract.events.allEvents((_: any, event: any) => {205        tokenEvents.push(event);206      });207      const result = await contract.methods.transferFrom(caller, receiver, tokenId).send();208      if (tokenEvents.length == 0) await helper.wait.newBlocks(1);209210      let event = result.events.Transfer;211      expect(event.address).to.equal(collectionAddress);212      expect(event.returnValues.from).to.equal(caller);213      expect(event.returnValues.to).to.equal(receiver);214      expect(event.returnValues.tokenId).to.equal(tokenId.toString());215216      event = tokenEvents[0];217      expect(event.address).to.equal(tokenAddress);218      expect(event.returnValues.from).to.equal(caller);219      expect(event.returnValues.to).to.equal(receiver);220      expect(event.returnValues.value).to.equal('15');221    }222223    {224      const balance = await contract.methods.balanceOf(receiver).call();225      expect(+balance).to.equal(1);226    }227228    {229      const balance = await contract.methods.balanceOf(caller).call();230      expect(+balance).to.equal(0);231    }232  });233234  itEth('Can perform burnFrom()', async ({helper}) => {235    const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});236237    const owner = await helper.eth.createAccountWithBalance(donor, 100n);238    const spender = await helper.eth.createAccountWithBalance(donor, 100n);239240    const token = await collection.mintToken(minter, 100n, {Ethereum: owner});241242    const address = helper.ethAddress.fromCollectionId(collection.collectionId);243    const contract = helper.ethNativeContract.collection(address, 'rft');244245    const tokenAddress = helper.ethAddress.fromTokenId(collection.collectionId, token.tokenId);246    const tokenContract = helper.ethNativeContract.rftToken(tokenAddress, owner);247    await tokenContract.methods.repartition(15).send();248    await tokenContract.methods.approve(spender, 15).send();249250    {251      const result = await contract.methods.burnFrom(owner, token.tokenId).send({from: spender});252      const event = result.events.Transfer;253      expect(event).to.be.like({254        address: helper.ethAddress.fromCollectionId(collection.collectionId),255        event: 'Transfer',256        returnValues: {257          from: owner,258          to: '0x0000000000000000000000000000000000000000',259          tokenId: token.tokenId.toString(),260        },261      });262    }263264    expect(await collection.getTokenBalance(token.tokenId, {Ethereum: owner})).to.be.eq(0n);265  });266267  itEth('Can perform burnFromCross()', async ({helper}) => {268    const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});269    270    const owner = bob;271    const spender = await helper.eth.createAccountWithBalance(donor, 100n);272273    const token = await collection.mintToken(minter, 100n, {Substrate: owner.address});274275    const address = helper.ethAddress.fromCollectionId(collection.collectionId);276    const contract = helper.ethNativeContract.collection(address, 'rft');277278    await token.repartition(owner, 15n);279    await token.approve(owner, {Ethereum: spender}, 15n);280281    {282      const ownerCross = helper.ethCrossAccount.fromKeyringPair(owner);283      const result = await contract.methods.burnFromCross(ownerCross, token.tokenId).send({from: spender});284      const event = result.events.Transfer;285      expect(event).to.be.like({286        address: helper.ethAddress.fromCollectionId(collection.collectionId),287        event: 'Transfer',288        returnValues: {289          from: helper.address.substrateToEth(owner.address),290          to: '0x0000000000000000000000000000000000000000',291          tokenId: token.tokenId.toString(),292        },293      });294    }295296    expect(await collection.getTokenBalance(token.tokenId, {Substrate: owner.address})).to.be.eq(0n);297  });298299  itEth('Can perform transferFromCross()', async ({helper}) => {300    const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});301302    const owner = bob;303    const spender = await helper.eth.createAccountWithBalance(donor, 100n);304    const receiver = charlie;305306    const token = await collection.mintToken(minter, 100n, {Substrate: owner.address});307308    const address = helper.ethAddress.fromCollectionId(collection.collectionId);309    const contract = helper.ethNativeContract.collection(address, 'rft');310311    await token.repartition(owner, 15n);312    await token.approve(owner, {Ethereum: spender}, 15n);313314    {315      const ownerCross = helper.ethCrossAccount.fromKeyringPair(owner);316      const recieverCross = helper.ethCrossAccount.fromKeyringPair(receiver);317      const result = await contract.methods.transferFromCross(ownerCross, recieverCross, token.tokenId).send({from: spender});318      const event = result.events.Transfer;319      expect(event).to.be.like({320        address: helper.ethAddress.fromCollectionId(collection.collectionId),321        event: 'Transfer',322        returnValues: {323          from: helper.address.substrateToEth(owner.address),324          to: helper.address.substrateToEth(receiver.address),325          tokenId: token.tokenId.toString(),326        },327      });328    }329330    expect(await token.getTop10Owners()).to.be.like([{Substrate: receiver.address}]);331  });332333  itEth('Can perform transfer()', async ({helper}) => {334    const caller = await helper.eth.createAccountWithBalance(donor);335    const receiver = helper.eth.createAccount();336    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Transferry', '6', '6');337    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);338339    const result = await contract.methods.mint(caller).send();340    const tokenId = result.events.Transfer.returnValues.tokenId;341342    {343      const result = await contract.methods.transfer(receiver, tokenId).send();344345      const event = result.events.Transfer;346      expect(event.address).to.equal(collectionAddress);347      expect(event.returnValues.from).to.equal(caller);348      expect(event.returnValues.to).to.equal(receiver);349      expect(event.returnValues.tokenId).to.equal(tokenId.toString());350    }351352    {353      const balance = await contract.methods.balanceOf(caller).call();354      expect(+balance).to.equal(0);355    }356357    {358      const balance = await contract.methods.balanceOf(receiver).call();359      expect(+balance).to.equal(1);360    }361  });362  363  itEth('Can perform transferCross()', async ({helper}) => {364    const caller = await helper.eth.createAccountWithBalance(donor);365    const receiver = helper.eth.createAccount();366    const to = helper.ethCrossAccount.fromAddress(receiver);367    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Transferry', '6', '6');368    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);369370    const result = await contract.methods.mint(caller).send();371    const tokenId = result.events.Transfer.returnValues.tokenId;372373    {374      const result = await contract.methods.transferCross(to, tokenId).send({from: caller});375376      const event = result.events.Transfer;377      expect(event.address).to.equal(collectionAddress);378      expect(event.returnValues.from).to.equal(caller);379      expect(event.returnValues.to).to.equal(receiver);380      expect(event.returnValues.tokenId).to.equal(tokenId.toString());381    }382383    {384      const balance = await contract.methods.balanceOf(caller).call();385      expect(+balance).to.equal(0);386    }387388    {389      const balance = await contract.methods.balanceOf(receiver).call();390      expect(+balance).to.equal(1);391    }392  });393394  itEth('transfer event on transfer from partial ownership to full ownership', async ({helper}) => {395    const caller = await helper.eth.createAccountWithBalance(donor);396    const receiver = helper.eth.createAccount();397    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'Transferry-Partial-to-Full', '6', '6');398    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);399400    const result = await contract.methods.mint(caller).send();401    const tokenId = result.events.Transfer.returnValues.tokenId;402403    const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);404405    await tokenContract.methods.repartition(2).send();406    await tokenContract.methods.transfer(receiver, 1).send();407408    const events: any = [];409    contract.events.allEvents((_: any, event: any) => {410      events.push(event);411    });412413    await tokenContract.methods.transfer(receiver, 1).send();414    if (events.length == 0) await helper.wait.newBlocks(1);415    const event = events[0];416417    expect(event.address).to.equal(collectionAddress);418    expect(event.returnValues.from).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');419    expect(event.returnValues.to).to.equal(receiver);420    expect(event.returnValues.tokenId).to.equal(tokenId.toString());421  });422423  itEth('transfer event on transfer from full ownership to partial ownership', async ({helper}) => {424    const caller = await helper.eth.createAccountWithBalance(donor);425    const receiver = helper.eth.createAccount();426    const {collectionId, collectionAddress} = await helper.eth.createRFTCollection(caller, 'Transferry-Full-to-Partial', '6', '6');427    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);428429    const result = await contract.methods.mint(caller).send();430    const tokenId = result.events.Transfer.returnValues.tokenId;431432    const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);433434    await tokenContract.methods.repartition(2).send();435436    const events: any = [];437    contract.events.allEvents((_: any, event: any) => {438      events.push(event);439    });440441    await tokenContract.methods.transfer(receiver, 1).send();442    if (events.length == 0) await helper.wait.newBlocks(1);443    const event = events[0];444445    expect(event.address).to.equal(collectionAddress);446    expect(event.returnValues.from).to.equal(caller);447    expect(event.returnValues.to).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');448    expect(event.returnValues.tokenId).to.equal(tokenId.toString());449  });450});451452describe('RFT: Fees', () => {453  let donor: IKeyringPair;454455  before(async function() {456    await usingEthPlaygrounds(async (helper, privateKey) => {457      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);458459      donor = await privateKey({filename: __filename});460    });461  });462463  itEth('transferFrom() call fee is less than 0.2UNQ', async ({helper}) => {464    const caller = await helper.eth.createAccountWithBalance(donor);465    const receiver = helper.eth.createAccount();466    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Feeful-Transfer-From', '6', '6');467    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);468469    const result = await contract.methods.mint(caller).send();470    const tokenId = result.events.Transfer.returnValues.tokenId;471472    const cost = await helper.eth.recordCallFee(caller, () => contract.methods.transferFrom(caller, receiver, tokenId).send());473    expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));474    expect(cost > 0n);475  });476477  itEth('transfer() call fee is less than 0.2UNQ', async ({helper}) => {478    const caller = await helper.eth.createAccountWithBalance(donor);479    const receiver = helper.eth.createAccount();480    const {collectionAddress} = await helper.eth.createRFTCollection(caller, 'Feeful-Transfer', '6', '6');481    const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);482483    const result = await contract.methods.mint(caller).send();484    const tokenId = result.events.Transfer.returnValues.tokenId;485486    const cost = await helper.eth.recordCallFee(caller, () => contract.methods.transfer(receiver, tokenId).send());487    expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));488    expect(cost > 0n);489  });490});491492describe('Common metadata', () => {493  let donor: IKeyringPair;494  let alice: IKeyringPair;495496  before(async function() {497    await usingEthPlaygrounds(async (helper, privateKey) => {498      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);499500      donor = await privateKey({filename: __filename});501      [alice] = await helper.arrange.createAccounts([20n], donor);502    });503  });504505  itEth('Returns collection name', async ({helper}) => {506    const caller = helper.eth.createAccount();507    const tokenPropertyPermissions = [{508      key: 'URI',509      permission: {510        mutable: true,511        collectionAdmin: true,512        tokenOwner: false,513      },514    }];515    const collection = await helper.rft.mintCollection(516      alice,517      {518        name: 'Leviathan',519        tokenPrefix: '11',520        properties: [{key: 'ERC721Metadata', value: '1'}],521        tokenPropertyPermissions,522      },523    );524525    const contract = helper.ethNativeContract.collectionById(collection.collectionId, 'rft', caller);526    const name = await contract.methods.name().call();527    expect(name).to.equal('Leviathan');528  });529530  itEth('Returns symbol name', async ({helper}) => {531    const caller = await helper.eth.createAccountWithBalance(donor);532    const tokenPropertyPermissions = [{533      key: 'URI',534      permission: {535        mutable: true,536        collectionAdmin: true,537        tokenOwner: false,538      },539    }];540    const {collectionId} = await helper.rft.mintCollection(541      alice,542      {543        name: 'Leviathan',544        tokenPrefix: '12',545        properties: [{key: 'ERC721Metadata', value: '1'}],546        tokenPropertyPermissions,547      },548    );549550    const contract = helper.ethNativeContract.collectionById(collectionId, 'rft', caller);551    const symbol = await contract.methods.symbol().call();552    expect(symbol).to.equal('12');553  });554});
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/reFungibleAbi.json
+++ b/tests/src/eth/reFungibleAbi.json
@@ -251,7 +251,7 @@
           { "internalType": "string", "name": "field_0", "type": "string" },
           { "internalType": "bytes", "name": "field_1", "type": "bytes" }
         ],
-        "internalType": "struct Tuple20[]",
+        "internalType": "struct Tuple21[]",
         "name": "",
         "type": "tuple[]"
       }
@@ -275,7 +275,7 @@
           { "internalType": "address", "name": "field_0", "type": "address" },
           { "internalType": "uint256", "name": "field_1", "type": "uint256" }
         ],
-        "internalType": "struct Tuple23",
+        "internalType": "struct Tuple24",
         "name": "",
         "type": "tuple"
       }
@@ -593,7 +593,7 @@
           { "internalType": "string", "name": "field_0", "type": "string" },
           { "internalType": "bytes", "name": "field_1", "type": "bytes" }
         ],
-        "internalType": "struct Tuple20[]",
+        "internalType": "struct Tuple21[]",
         "name": "properties",
         "type": "tuple[]"
       }
@@ -664,7 +664,7 @@
           { "internalType": "string", "name": "field_0", "type": "string" },
           { "internalType": "bytes", "name": "field_1", "type": "bytes" }
         ],
-        "internalType": "struct Tuple20[]",
+        "internalType": "struct Tuple21[]",
         "name": "properties",
         "type": "tuple[]"
       }
@@ -769,6 +769,24 @@
   },
   {
     "inputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "eth", "type": "address" },
+          { "internalType": "uint256", "name": "sub", "type": "uint256" }
+        ],
+        "internalType": "struct EthCrossAccount",
+        "name": "to",
+        "type": "tuple"
+      },
+      { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
+    ],
+    "name": "transferCross",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
       { "internalType": "address", "name": "from", "type": "address" },
       { "internalType": "address", "name": "to", "type": "address" },
       { "internalType": "uint256", "name": "tokenId", "type": "uint256" }