git.delta.rocks / unique-network / refs/commits / 448629b28a12

difftreelog

Merge pull request #986 from UniqueNetwork/feature/add_mint_bulk_cross

Yaroslav Bolyukin2023-09-25parents: #6486f2a #752e2b0.patch.diff
in: master
Add mintBulkCross to NFT and RFT collections

20 files changed

modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -425,7 +425,7 @@
 				.map(|cfg| &cfg.registry);
 			let task_manager =
 				sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
-					.map_err(|e| format!("Error: {:?}", e))?;
+					.map_err(|e| format!("Error: {e:?}"))?;
 			let info_provider = Some(timestamp_with_aura_info(12000));
 
 			runner.async_run(|config| -> Result<(Pin<Box<dyn Future<Output = _>>>, _)> {
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -119,7 +119,7 @@
 		} else if self.sub == Default::default() {
 			Ok(Some(T::CrossAccountId::from_eth(self.eth)))
 		} else {
-			Err(format!("All fields of cross account is non zeroed {:?}", self).into())
+			Err(format!("All fields of cross account is non zeroed {self:?}").into())
 		}
 	}
 
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -26,7 +26,7 @@
 	char::{REPLACEMENT_CHARACTER, decode_utf16},
 	convert::TryInto,
 };
-use evm_coder::{abi::AbiType, ToLog, generate_stubgen, solidity_interface, types::*};
+use evm_coder::{abi::AbiType, AbiCoder, ToLog, generate_stubgen, solidity_interface, types::*};
 use frame_support::BoundedVec;
 use up_data_structs::{
 	TokenId, PropertyPermission, PropertyKeyPermission, Property, CollectionId, PropertyKey,
@@ -64,6 +64,15 @@
 	},
 }
 
+/// Token minting parameters
+#[derive(AbiCoder, Default, Debug)]
+pub struct MintTokenData {
+	/// Minted token owner
+	pub owner: eth::CrossAddress,
+	/// Minted token properties
+	pub properties: Vec<eth::Property>,
+}
+
 frontier_contract! {
 	macro_rules! NonfungibleHandle_result {...}
 	impl<T: Config> Contract for NonfungibleHandle<T> {...}
@@ -981,13 +990,41 @@
 		Ok(true)
 	}
 
+	/// @notice Function to mint a token.
+	/// @param data Array of pairs of token owner and token's properties for minted token
+	#[weight(<SelfWeightOf<T>>::create_multiple_items(data.len() as u32) + <SelfWeightOf<T>>::set_token_properties(data.len() as u32))]
+	fn mint_bulk_cross(&mut self, caller: Caller, data: Vec<MintTokenData>) -> Result<bool> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+		let mut create_nft_data = Vec::with_capacity(data.len());
+		for MintTokenData { owner, properties } in data {
+			let owner = owner.into_sub_cross_account::<T>()?;
+			create_nft_data.push(CreateItemData::<T> {
+				properties: properties
+					.into_iter()
+					.map(|property| property.try_into())
+					.collect::<Result<Vec<_>>>()?
+					.try_into()
+					.map_err(|_| "too many properties")?,
+				owner,
+			});
+		}
+
+		<Pallet<T>>::create_multiple_items(self, &caller, create_nft_data, &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(true)
+	}
+
 	/// @notice Function to mint multiple tokens with the given tokenUris.
 	/// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
 	///  numbers and first number should be obtained with `nextTokenId` method
 	/// @param to The new owner
 	/// @param tokens array of pairs of token ID and token URI for minted tokens
 	#[solidity(hide, rename_selector = "mintBulkWithTokenURI")]
-	#[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32)  + <SelfWeightOf<T>>::set_token_properties(tokens.len() as u32))]
+	#[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32) + <SelfWeightOf<T>>::set_token_properties(tokens.len() as u32))]
 	fn mint_bulk_with_token_uri(
 		&mut self,
 		caller: Caller,
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
@@ -800,7 +800,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x307b061a
+/// @dev the ERC-165 identifier for this interface is 0x9b397d16
 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,
@@ -997,6 +997,17 @@
 	// 	return false;
 	// }
 
+	/// @notice Function to mint a token.
+	/// @param data Array of pairs of token owner and token's properties for minted token
+	/// @dev EVM selector for this function is: 0xab427b0c,
+	///  or in textual repr: mintBulkCross(((address,uint256),(string,bytes)[])[])
+	function mintBulkCross(MintTokenData[] memory data) public returns (bool) {
+		require(false, stub_error);
+		data;
+		dummy = 0;
+		return false;
+	}
+
 	// /// @notice Function to mint multiple tokens with the given tokenUris.
 	// /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
 	// ///  numbers and first number should be obtained with `nextTokenId` method
@@ -1044,6 +1055,14 @@
 	string uri;
 }
 
+/// Token minting parameters
+struct MintTokenData {
+	/// Minted token owner
+	CrossAddress owner;
+	/// Minted token properties
+	Property[] properties;
+}
+
 /// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 /// @dev See https://eips.ethereum.org/EIPS/eip-721
 /// @dev the ERC-165 identifier for this interface is 0x780e9d63
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -26,7 +26,7 @@
 	char::{REPLACEMENT_CHARACTER, decode_utf16},
 	convert::TryInto,
 };
-use evm_coder::{abi::AbiType, ToLog, generate_stubgen, solidity_interface, types::*};
+use evm_coder::{abi::AbiType, AbiCoder, ToLog, generate_stubgen, solidity_interface, types::*};
 use frame_support::{BoundedBTreeMap, BoundedVec};
 use pallet_common::{
 	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
@@ -71,6 +71,24 @@
 	},
 }
 
+/// Token minting parameters
+#[derive(AbiCoder, Default, Debug)]
+pub struct OwnerPieces {
+	/// Minted token owner
+	pub owner: eth::CrossAddress,
+	/// Number of token pieces
+	pub pieces: u128,
+}
+
+/// Token minting parameters
+#[derive(AbiCoder, Default, Debug)]
+pub struct MintTokenData {
+	/// Minted token owner and number of pieces
+	pub owners: Vec<OwnerPieces>,
+	/// Minted token properties
+	pub properties: Vec<eth::Property>,
+}
+
 /// @title A contract that allows to set and delete token properties and change token property permissions.
 #[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]
 impl<T: Config> RefungibleHandle<T> {
@@ -1021,6 +1039,55 @@
 		Ok(true)
 	}
 
+	/// @notice Function to mint a token.
+	/// @param tokenProperties Properties of minted token
+	#[weight(if token_properties.len() == 1 {
+		<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(token_properties.iter().next().unwrap().owners.len() as u32)
+	} else {
+		<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(token_properties.len() as u32)
+	} + <SelfWeightOf<T>>::set_token_properties(token_properties.len() as u32))]
+	fn mint_bulk_cross(
+		&mut self,
+		caller: Caller,
+		token_properties: Vec<MintTokenData>,
+	) -> Result<bool> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+		let has_multiple_tokens = token_properties.len() > 1;
+
+		let mut create_rft_data = Vec::with_capacity(token_properties.len());
+		for MintTokenData { owners, properties } in token_properties {
+			let has_multiple_owners = owners.len() > 1;
+			if has_multiple_tokens & has_multiple_owners {
+				return Err(
+					"creation of multiple tokens supported only if they have single owner each"
+						.into(),
+				);
+			}
+			let users: BoundedBTreeMap<_, _, _> = owners
+				.into_iter()
+				.map(|data| Ok((data.owner.into_sub_cross_account::<T>()?, data.pieces)))
+				.collect::<Result<BTreeMap<_, _>>>()?
+				.try_into()
+				.map_err(|_| "too many users")?;
+			create_rft_data.push(CreateItemData::<T> {
+				properties: properties
+					.into_iter()
+					.map(|property| property.try_into())
+					.collect::<Result<Vec<_>>>()?
+					.try_into()
+					.map_err(|_| "too many properties")?,
+				users,
+			});
+		}
+
+		<Pallet<T>>::create_multiple_items(self, &caller, create_rft_data, &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(true)
+	}
+
 	/// @notice Function to mint multiple tokens with the given tokenUris.
 	/// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
 	///  numbers and first number should be obtained with `nextTokenId` method
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
after · pallets/refungible/src/stubs/UniqueRefungible.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56/// @dev common stubs holder7contract Dummy {8	uint8 dummy;9	string stub_error = "this contract is implemented in native";10}1112contract ERC165 is Dummy {13	function supportsInterface(bytes4 interfaceID) external view returns (bool) {14		require(false, stub_error);15		interfaceID;16		return true;17	}18}1920/// @dev inlined interface21contract ERC721TokenEvent {22	event TokenChanged(uint256 indexed tokenId);23}2425/// @title A contract that allows to set and delete token properties and change token property permissions.26/// @dev the ERC-165 identifier for this interface is 0xde0695c227contract TokenProperties is Dummy, ERC165, ERC721TokenEvent {28	// /// @notice Set permissions for token property.29	// /// @dev Throws error if `msg.sender` is not admin or owner of the collection.30	// /// @param key Property key.31	// /// @param isMutable Permission to mutate property.32	// /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.33	// /// @param tokenOwner Permission to mutate property by token owner if property is mutable.34	// /// @dev EVM selector for this function is: 0x222d97fa,35	// ///  or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)36	// function setTokenPropertyPermission(string memory key, bool isMutable, bool collectionAdmin, bool tokenOwner) public {37	// 	require(false, stub_error);38	// 	key;39	// 	isMutable;40	// 	collectionAdmin;41	// 	tokenOwner;42	// 	dummy = 0;43	// }4445	/// @notice Set permissions for token property.46	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.47	/// @param permissions Permissions for keys.48	/// @dev EVM selector for this function is: 0xbd92983a,49	///  or in textual repr: setTokenPropertyPermissions((string,(uint8,bool)[])[])50	function setTokenPropertyPermissions(TokenPropertyPermission[] memory permissions) public {51		require(false, stub_error);52		permissions;53		dummy = 0;54	}5556	/// @notice Get permissions for token properties.57	/// @dev EVM selector for this function is: 0xf23d7790,58	///  or in textual repr: tokenPropertyPermissions()59	function tokenPropertyPermissions() public view returns (TokenPropertyPermission[] memory) {60		require(false, stub_error);61		dummy;62		return new TokenPropertyPermission[](0);63	}6465	// /// @notice Set token property value.66	// /// @dev Throws error if `msg.sender` has no permission to edit the property.67	// /// @param tokenId ID of the token.68	// /// @param key Property key.69	// /// @param value Property value.70	// /// @dev EVM selector for this function is: 0x1752d67b,71	// ///  or in textual repr: setProperty(uint256,string,bytes)72	// function setProperty(uint256 tokenId, string memory key, bytes memory value) public {73	// 	require(false, stub_error);74	// 	tokenId;75	// 	key;76	// 	value;77	// 	dummy = 0;78	// }7980	/// @notice Set token properties value.81	/// @dev Throws error if `msg.sender` has no permission to edit the property.82	/// @param tokenId ID of the token.83	/// @param properties settable properties84	/// @dev EVM selector for this function is: 0x14ed3a6e,85	///  or in textual repr: setProperties(uint256,(string,bytes)[])86	function setProperties(uint256 tokenId, Property[] memory properties) public {87		require(false, stub_error);88		tokenId;89		properties;90		dummy = 0;91	}9293	// /// @notice Delete token property value.94	// /// @dev Throws error if `msg.sender` has no permission to edit the property.95	// /// @param tokenId ID of the token.96	// /// @param key Property key.97	// /// @dev EVM selector for this function is: 0x066111d1,98	// ///  or in textual repr: deleteProperty(uint256,string)99	// function deleteProperty(uint256 tokenId, string memory key) public {100	// 	require(false, stub_error);101	// 	tokenId;102	// 	key;103	// 	dummy = 0;104	// }105106	/// @notice Delete token properties value.107	/// @dev Throws error if `msg.sender` has no permission to edit the property.108	/// @param tokenId ID of the token.109	/// @param keys Properties key.110	/// @dev EVM selector for this function is: 0xc472d371,111	///  or in textual repr: deleteProperties(uint256,string[])112	function deleteProperties(uint256 tokenId, string[] memory keys) public {113		require(false, stub_error);114		tokenId;115		keys;116		dummy = 0;117	}118119	/// @notice Get token property value.120	/// @dev Throws error if key not found121	/// @param tokenId ID of the token.122	/// @param key Property key.123	/// @return Property value bytes124	/// @dev EVM selector for this function is: 0x7228c327,125	///  or in textual repr: property(uint256,string)126	function property(uint256 tokenId, string memory key) public view returns (bytes memory) {127		require(false, stub_error);128		tokenId;129		key;130		dummy;131		return hex"";132	}133}134135/// Ethereum representation of collection [`PropertyKey`](up_data_structs::PropertyKey) and [`PropertyValue`](up_data_structs::PropertyValue).136struct Property {137	string key;138	bytes value;139}140141/// Ethereum representation of Token Property Permissions.142struct TokenPropertyPermission {143	/// Token property key.144	string key;145	/// Token property permissions.146	PropertyPermission[] permissions;147}148149/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) as an key and value.150struct PropertyPermission {151	/// TokenPermission field.152	TokenPermissionField code;153	/// TokenPermission value.154	bool value;155}156157/// Ethereum representation of TokenPermissions (see [`up_data_structs::PropertyPermission`]) fields as an enumeration.158enum TokenPermissionField {159	/// Permission to change the property and property permission. See [`up_data_structs::PropertyPermission::mutable`]160	Mutable,161	/// Change permission for the collection administrator. See [`up_data_structs::PropertyPermission::token_owner`]162	TokenOwner,163	/// Permission to change the property for the owner of the token. See [`up_data_structs::PropertyPermission::collection_admin`]164	CollectionAdmin165}166167/// @title A contract that allows you to work with collections.168/// @dev the ERC-165 identifier for this interface is 0xb34d97e9169contract Collection is Dummy, ERC165 {170	// /// Set collection property.171	// ///172	// /// @param key Property key.173	// /// @param value Propery value.174	// /// @dev EVM selector for this function is: 0x2f073f66,175	// ///  or in textual repr: setCollectionProperty(string,bytes)176	// function setCollectionProperty(string memory key, bytes memory value) public {177	// 	require(false, stub_error);178	// 	key;179	// 	value;180	// 	dummy = 0;181	// }182183	/// Set collection properties.184	///185	/// @param properties Vector of properties key/value pair.186	/// @dev EVM selector for this function is: 0x50b26b2a,187	///  or in textual repr: setCollectionProperties((string,bytes)[])188	function setCollectionProperties(Property[] memory properties) public {189		require(false, stub_error);190		properties;191		dummy = 0;192	}193194	// /// Delete collection property.195	// ///196	// /// @param key Property key.197	// /// @dev EVM selector for this function is: 0x7b7debce,198	// ///  or in textual repr: deleteCollectionProperty(string)199	// function deleteCollectionProperty(string memory key) public {200	// 	require(false, stub_error);201	// 	key;202	// 	dummy = 0;203	// }204205	/// Delete collection properties.206	///207	/// @param keys Properties keys.208	/// @dev EVM selector for this function is: 0xee206ee3,209	///  or in textual repr: deleteCollectionProperties(string[])210	function deleteCollectionProperties(string[] memory keys) public {211		require(false, stub_error);212		keys;213		dummy = 0;214	}215216	/// Get collection property.217	///218	/// @dev Throws error if key not found.219	///220	/// @param key Property key.221	/// @return bytes The property corresponding to the key.222	/// @dev EVM selector for this function is: 0xcf24fd6d,223	///  or in textual repr: collectionProperty(string)224	function collectionProperty(string memory key) public view returns (bytes memory) {225		require(false, stub_error);226		key;227		dummy;228		return hex"";229	}230231	/// Get collection properties.232	///233	/// @param keys Properties keys. Empty keys for all propertyes.234	/// @return Vector of properties key/value pairs.235	/// @dev EVM selector for this function is: 0x285fb8e6,236	///  or in textual repr: collectionProperties(string[])237	function collectionProperties(string[] memory keys) public view returns (Property[] memory) {238		require(false, stub_error);239		keys;240		dummy;241		return new Property[](0);242	}243244	// /// Set the sponsor of the collection.245	// ///246	// /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.247	// ///248	// /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.249	// /// @dev EVM selector for this function is: 0x7623402e,250	// ///  or in textual repr: setCollectionSponsor(address)251	// function setCollectionSponsor(address sponsor) public {252	// 	require(false, stub_error);253	// 	sponsor;254	// 	dummy = 0;255	// }256257	/// Set the sponsor of the collection.258	///259	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.260	///261	/// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.262	/// @dev EVM selector for this function is: 0x84a1d5a8,263	///  or in textual repr: setCollectionSponsorCross((address,uint256))264	function setCollectionSponsorCross(CrossAddress memory sponsor) public {265		require(false, stub_error);266		sponsor;267		dummy = 0;268	}269270	/// Whether there is a pending sponsor.271	/// @dev EVM selector for this function is: 0x058ac185,272	///  or in textual repr: hasCollectionPendingSponsor()273	function hasCollectionPendingSponsor() public view returns (bool) {274		require(false, stub_error);275		dummy;276		return false;277	}278279	/// Collection sponsorship confirmation.280	///281	/// @dev After setting the sponsor for the collection, it must be confirmed with this function.282	/// @dev EVM selector for this function is: 0x3c50e97a,283	///  or in textual repr: confirmCollectionSponsorship()284	function confirmCollectionSponsorship() public {285		require(false, stub_error);286		dummy = 0;287	}288289	/// Remove collection sponsor.290	/// @dev EVM selector for this function is: 0x6e0326a3,291	///  or in textual repr: removeCollectionSponsor()292	function removeCollectionSponsor() public {293		require(false, stub_error);294		dummy = 0;295	}296297	/// Get current sponsor.298	///299	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.300	/// @dev EVM selector for this function is: 0x6ec0a9f1,301	///  or in textual repr: collectionSponsor()302	function collectionSponsor() public view returns (CrossAddress memory) {303		require(false, stub_error);304		dummy;305		return CrossAddress(0x0000000000000000000000000000000000000000, 0);306	}307308	/// Get current collection limits.309	///310	/// @return Array of collection limits311	/// @dev EVM selector for this function is: 0xf63bc572,312	///  or in textual repr: collectionLimits()313	function collectionLimits() public view returns (CollectionLimit[] memory) {314		require(false, stub_error);315		dummy;316		return new CollectionLimit[](0);317	}318319	/// Set limits for the collection.320	/// @dev Throws error if limit not found.321	/// @param limit Some limit.322	/// @dev EVM selector for this function is: 0x2316ee74,323	///  or in textual repr: setCollectionLimit((uint8,(bool,uint256)))324	function setCollectionLimit(CollectionLimit memory limit) public {325		require(false, stub_error);326		limit;327		dummy = 0;328	}329330	/// Get contract address.331	/// @dev EVM selector for this function is: 0xf6b4dfb4,332	///  or in textual repr: contractAddress()333	function contractAddress() public view returns (address) {334		require(false, stub_error);335		dummy;336		return 0x0000000000000000000000000000000000000000;337	}338339	/// Add collection admin.340	/// @param newAdmin Cross account administrator address.341	/// @dev EVM selector for this function is: 0x859aa7d6,342	///  or in textual repr: addCollectionAdminCross((address,uint256))343	function addCollectionAdminCross(CrossAddress memory newAdmin) public {344		require(false, stub_error);345		newAdmin;346		dummy = 0;347	}348349	/// Remove collection admin.350	/// @param admin Cross account administrator address.351	/// @dev EVM selector for this function is: 0x6c0cd173,352	///  or in textual repr: removeCollectionAdminCross((address,uint256))353	function removeCollectionAdminCross(CrossAddress memory admin) public {354		require(false, stub_error);355		admin;356		dummy = 0;357	}358359	// /// Add collection admin.360	// /// @param newAdmin Address of the added administrator.361	// /// @dev EVM selector for this function is: 0x92e462c7,362	// ///  or in textual repr: addCollectionAdmin(address)363	// function addCollectionAdmin(address newAdmin) public {364	// 	require(false, stub_error);365	// 	newAdmin;366	// 	dummy = 0;367	// }368369	// /// Remove collection admin.370	// ///371	// /// @param admin Address of the removed administrator.372	// /// @dev EVM selector for this function is: 0xfafd7b42,373	// ///  or in textual repr: removeCollectionAdmin(address)374	// function removeCollectionAdmin(address admin) public {375	// 	require(false, stub_error);376	// 	admin;377	// 	dummy = 0;378	// }379380	/// @dev EVM selector for this function is: 0x0b9f3890,381	///  or in textual repr: setCollectionNesting((bool,bool,address[]))382	function setCollectionNesting(CollectionNestingAndPermission memory collectionNestingAndPermissions) public {383		require(false, stub_error);384		collectionNestingAndPermissions;385		dummy = 0;386	}387388	// /// Toggle accessibility of collection nesting.389	// ///390	// /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'391	// /// @dev EVM selector for this function is: 0x112d4586,392	// ///  or in textual repr: setCollectionNesting(bool)393	// function setCollectionNesting(bool enable) public {394	// 	require(false, stub_error);395	// 	enable;396	// 	dummy = 0;397	// }398399	// /// Toggle accessibility of collection nesting.400	// ///401	// /// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'402	// /// @param collections Addresses of collections that will be available for nesting.403	// /// @dev EVM selector for this function is: 0x64872396,404	// ///  or in textual repr: setCollectionNesting(bool,address[])405	// function setCollectionNesting(bool enable, address[] memory collections) public {406	// 	require(false, stub_error);407	// 	enable;408	// 	collections;409	// 	dummy = 0;410	// }411412	/// @dev EVM selector for this function is: 0x92c660a8,413	///  or in textual repr: collectionNesting()414	function collectionNesting() public view returns (CollectionNestingAndPermission memory) {415		require(false, stub_error);416		dummy;417		return CollectionNestingAndPermission(false, false, new address[](0));418	}419420	// /// Returns nesting for a collection421	// /// @dev EVM selector for this function is: 0x22d25bfe,422	// ///  or in textual repr: collectionNestingRestrictedCollectionIds()423	// function collectionNestingRestrictedCollectionIds() public view returns (CollectionNesting memory) {424	// 	require(false, stub_error);425	// 	dummy;426	// 	return CollectionNesting(false,new uint256[](0));427	// }428429	// /// Returns permissions for a collection430	// /// @dev EVM selector for this function is: 0x5b2eaf4b,431	// ///  or in textual repr: collectionNestingPermissions()432	// function collectionNestingPermissions() public view returns (CollectionNestingPermission[] memory) {433	// 	require(false, stub_error);434	// 	dummy;435	// 	return new CollectionNestingPermission[](0);436	// }437438	/// Set the collection access method.439	/// @param mode Access mode440	/// @dev EVM selector for this function is: 0x41835d4c,441	///  or in textual repr: setCollectionAccess(uint8)442	function setCollectionAccess(AccessMode mode) public {443		require(false, stub_error);444		mode;445		dummy = 0;446	}447448	/// Checks that user allowed to operate with collection.449	///450	/// @param user User address to check.451	/// @dev EVM selector for this function is: 0x91b6df49,452	///  or in textual repr: allowlistedCross((address,uint256))453	function allowlistedCross(CrossAddress memory user) public view returns (bool) {454		require(false, stub_error);455		user;456		dummy;457		return false;458	}459460	// /// Add the user to the allowed list.461	// ///462	// /// @param user Address of a trusted user.463	// /// @dev EVM selector for this function is: 0x67844fe6,464	// ///  or in textual repr: addToCollectionAllowList(address)465	// function addToCollectionAllowList(address user) public {466	// 	require(false, stub_error);467	// 	user;468	// 	dummy = 0;469	// }470471	/// Add user to allowed list.472	///473	/// @param user User cross account address.474	/// @dev EVM selector for this function is: 0xa0184a3a,475	///  or in textual repr: addToCollectionAllowListCross((address,uint256))476	function addToCollectionAllowListCross(CrossAddress memory user) public {477		require(false, stub_error);478		user;479		dummy = 0;480	}481482	// /// Remove the user from the allowed list.483	// ///484	// /// @param user Address of a removed user.485	// /// @dev EVM selector for this function is: 0x85c51acb,486	// ///  or in textual repr: removeFromCollectionAllowList(address)487	// function removeFromCollectionAllowList(address user) public {488	// 	require(false, stub_error);489	// 	user;490	// 	dummy = 0;491	// }492493	/// Remove user from allowed list.494	///495	/// @param user User cross account address.496	/// @dev EVM selector for this function is: 0x09ba452a,497	///  or in textual repr: removeFromCollectionAllowListCross((address,uint256))498	function removeFromCollectionAllowListCross(CrossAddress memory user) public {499		require(false, stub_error);500		user;501		dummy = 0;502	}503504	/// Switch permission for minting.505	///506	/// @param mode Enable if "true".507	/// @dev EVM selector for this function is: 0x00018e84,508	///  or in textual repr: setCollectionMintMode(bool)509	function setCollectionMintMode(bool mode) public {510		require(false, stub_error);511		mode;512		dummy = 0;513	}514515	// /// Check that account is the owner or admin of the collection516	// ///517	// /// @param user account to verify518	// /// @return "true" if account is the owner or admin519	// /// @dev EVM selector for this function is: 0x9811b0c7,520	// ///  or in textual repr: isOwnerOrAdmin(address)521	// function isOwnerOrAdmin(address user) public view returns (bool) {522	// 	require(false, stub_error);523	// 	user;524	// 	dummy;525	// 	return false;526	// }527528	/// Check that account is the owner or admin of the collection529	///530	/// @param user User cross account to verify531	/// @return "true" if account is the owner or admin532	/// @dev EVM selector for this function is: 0x3e75a905,533	///  or in textual repr: isOwnerOrAdminCross((address,uint256))534	function isOwnerOrAdminCross(CrossAddress memory user) public view returns (bool) {535		require(false, stub_error);536		user;537		dummy;538		return false;539	}540541	/// Returns collection type542	///543	/// @return `Fungible` or `NFT` or `ReFungible`544	/// @dev EVM selector for this function is: 0xd34b55b8,545	///  or in textual repr: uniqueCollectionType()546	function uniqueCollectionType() public view returns (string memory) {547		require(false, stub_error);548		dummy;549		return "";550	}551552	/// Get collection owner.553	///554	/// @return Tuble with sponsor address and his substrate mirror.555	/// If address is canonical then substrate mirror is zero and vice versa.556	/// @dev EVM selector for this function is: 0xdf727d3b,557	///  or in textual repr: collectionOwner()558	function collectionOwner() public view returns (CrossAddress memory) {559		require(false, stub_error);560		dummy;561		return CrossAddress(0x0000000000000000000000000000000000000000, 0);562	}563564	// /// Changes collection owner to another account565	// ///566	// /// @dev Owner can be changed only by current owner567	// /// @param newOwner new owner account568	// /// @dev EVM selector for this function is: 0x4f53e226,569	// ///  or in textual repr: changeCollectionOwner(address)570	// function changeCollectionOwner(address newOwner) public {571	// 	require(false, stub_error);572	// 	newOwner;573	// 	dummy = 0;574	// }575576	/// Get collection administrators577	///578	/// @return Vector of tuples with admins address and his substrate mirror.579	/// If address is canonical then substrate mirror is zero and vice versa.580	/// @dev EVM selector for this function is: 0x5813216b,581	///  or in textual repr: collectionAdmins()582	function collectionAdmins() public view returns (CrossAddress[] memory) {583		require(false, stub_error);584		dummy;585		return new CrossAddress[](0);586	}587588	/// Changes collection owner to another account589	///590	/// @dev Owner can be changed only by current owner591	/// @param newOwner new owner cross account592	/// @dev EVM selector for this function is: 0x6496c497,593	///  or in textual repr: changeCollectionOwnerCross((address,uint256))594	function changeCollectionOwnerCross(CrossAddress memory newOwner) public {595		require(false, stub_error);596		newOwner;597		dummy = 0;598	}599}600601/// Cross account struct602struct CrossAddress {603	address eth;604	uint256 sub;605}606607/// Ethereum representation of `AccessMode` (see [`up_data_structs::AccessMode`]).608enum AccessMode {609	/// Access grant for owner and admins. Used as default.610	Normal,611	/// Like a [`Normal`](AccessMode::Normal) but also users in allow list.612	AllowList613}614615/// Ethereum representation of `NestingPermissions` (see [`up_data_structs::NestingPermissions`]) field.616struct CollectionNestingPermission {617	CollectionPermissionField field;618	bool value;619}620621/// Ethereum representation of `NestingPermissions` (see [`up_data_structs::NestingPermissions`]) fields as an enumeration.622enum CollectionPermissionField {623	/// Owner of token can nest tokens under it.624	TokenOwner,625	/// Admin of token collection can nest tokens under token.626	CollectionAdmin627}628629/// Nested collections.630struct CollectionNesting {631	bool token_owner;632	uint256[] ids;633}634635/// Nested collections and permissions636struct CollectionNestingAndPermission {637	/// Owner of token can nest tokens under it.638	bool token_owner;639	/// Admin of token collection can nest tokens under token.640	bool collection_admin;641	/// If set - only tokens from specified collections can be nested.642	address[] restricted;643}644645/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.646struct CollectionLimit {647	CollectionLimitField field;648	OptionUint256 value;649}650651/// Optional value652struct OptionUint256 {653	/// Shows the status of accessibility of value654	bool status;655	/// Actual value if `status` is true656	uint256 value;657}658659/// [`CollectionLimits`](up_data_structs::CollectionLimits) fields representation for EVM.660enum CollectionLimitField {661	/// How many tokens can a user have on one account.662	AccountTokenOwnership,663	/// How many bytes of data are available for sponsorship.664	SponsoredDataSize,665	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]666	SponsoredDataRateLimit,667	/// How many tokens can be mined into this collection.668	TokenLimit,669	/// Timeouts for transfer sponsoring.670	SponsorTransferTimeout,671	/// Timeout for sponsoring an approval in passed blocks.672	SponsorApproveTimeout,673	/// Whether the collection owner of the collection can send tokens (which belong to other users).674	OwnerCanTransfer,675	/// Can the collection owner burn other people's tokens.676	OwnerCanDestroy,677	/// Is it possible to send tokens from this collection between users.678	TransferEnabled679}680681/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension682/// @dev See https://eips.ethereum.org/EIPS/eip-721683/// @dev the ERC-165 identifier for this interface is 0x5b5e139f684contract ERC721Metadata is Dummy, ERC165 {685	// /// @notice A descriptive name for a collection of NFTs in this contract686	// /// @dev real implementation of this function lies in `ERC721UniqueExtensions`687	// /// @dev EVM selector for this function is: 0x06fdde03,688	// ///  or in textual repr: name()689	// function name() public view returns (string memory) {690	// 	require(false, stub_error);691	// 	dummy;692	// 	return "";693	// }694695	// /// @notice An abbreviated name for NFTs in this contract696	// /// @dev real implementation of this function lies in `ERC721UniqueExtensions`697	// /// @dev EVM selector for this function is: 0x95d89b41,698	// ///  or in textual repr: symbol()699	// function symbol() public view returns (string memory) {700	// 	require(false, stub_error);701	// 	dummy;702	// 	return "";703	// }704705	/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.706	///707	/// @dev If the token has a `url` property and it is not empty, it is returned.708	///  Else If the collection does not have a property with key `schemaName` or its value is not equal to `ERC721Metadata`, it return an error `tokenURI not set`.709	///  If the collection property `baseURI` is empty or absent, return "" (empty string)710	///  otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix711	///  otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).712	///713	/// @return token's const_metadata714	/// @dev EVM selector for this function is: 0xc87b56dd,715	///  or in textual repr: tokenURI(uint256)716	function tokenURI(uint256 tokenId) public view returns (string memory) {717		require(false, stub_error);718		tokenId;719		dummy;720		return "";721	}722}723724/// @title ERC721 Token that can be irreversibly burned (destroyed).725/// @dev the ERC-165 identifier for this interface is 0x42966c68726contract ERC721Burnable is Dummy, ERC165 {727	/// @notice Burns a specific ERC721 token.728	/// @dev Throws unless `msg.sender` is the current RFT owner, or an authorized729	///  operator of the current owner.730	/// @param tokenId The RFT to approve731	/// @dev EVM selector for this function is: 0x42966c68,732	///  or in textual repr: burn(uint256)733	function burn(uint256 tokenId) public {734		require(false, stub_error);735		tokenId;736		dummy = 0;737	}738}739740/// @title ERC721 minting logic.741/// @dev the ERC-165 identifier for this interface is 0x3fd94ea6742contract ERC721UniqueMintable is Dummy, ERC165 {743	/// @notice Function to mint a token.744	/// @param to The new owner745	/// @return uint256 The id of the newly minted token746	/// @dev EVM selector for this function is: 0x6a627842,747	///  or in textual repr: mint(address)748	function mint(address to) public returns (uint256) {749		require(false, stub_error);750		to;751		dummy = 0;752		return 0;753	}754755	// /// @notice Function to mint a token.756	// /// @dev `tokenId` should be obtained with `nextTokenId` method,757	// ///  unlike standard, you can't specify it manually758	// /// @param to The new owner759	// /// @param tokenId ID of the minted RFT760	// /// @dev EVM selector for this function is: 0x40c10f19,761	// ///  or in textual repr: mint(address,uint256)762	// function mint(address to, uint256 tokenId) public returns (bool) {763	// 	require(false, stub_error);764	// 	to;765	// 	tokenId;766	// 	dummy = 0;767	// 	return false;768	// }769770	/// @notice Function to mint token with the given tokenUri.771	/// @param to The new owner772	/// @param tokenUri Token URI that would be stored in the NFT properties773	/// @return uint256 The id of the newly minted token774	/// @dev EVM selector for this function is: 0x45c17782,775	///  or in textual repr: mintWithTokenURI(address,string)776	function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {777		require(false, stub_error);778		to;779		tokenUri;780		dummy = 0;781		return 0;782	}783	// /// @notice Function to mint token with the given tokenUri.784	// /// @dev `tokenId` should be obtained with `nextTokenId` method,785	// ///  unlike standard, you can't specify it manually786	// /// @param to The new owner787	// /// @param tokenId ID of the minted RFT788	// /// @param tokenUri Token URI that would be stored in the RFT properties789	// /// @dev EVM selector for this function is: 0x50bb4e7f,790	// ///  or in textual repr: mintWithTokenURI(address,uint256,string)791	// function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {792	// 	require(false, stub_error);793	// 	to;794	// 	tokenId;795	// 	tokenUri;796	// 	dummy = 0;797	// 	return false;798	// }799800}801802/// @title Unique extensions for ERC721.803/// @dev the ERC-165 identifier for this interface is 0x4abaabdb804contract ERC721UniqueExtensions is Dummy, ERC165 {805	/// @notice A descriptive name for a collection of NFTs in this contract806	/// @dev EVM selector for this function is: 0x06fdde03,807	///  or in textual repr: name()808	function name() public view returns (string memory) {809		require(false, stub_error);810		dummy;811		return "";812	}813814	/// @notice An abbreviated name for NFTs in this contract815	/// @dev EVM selector for this function is: 0x95d89b41,816	///  or in textual repr: symbol()817	function symbol() public view returns (string memory) {818		require(false, stub_error);819		dummy;820		return "";821	}822823	/// @notice A description for the collection.824	/// @dev EVM selector for this function is: 0x7284e416,825	///  or in textual repr: description()826	function description() public view returns (string memory) {827		require(false, stub_error);828		dummy;829		return "";830	}831832	// /// Returns the owner (in cross format) of the token.833	// ///834	// /// @param tokenId Id for the token.835	// /// @dev EVM selector for this function is: 0x2b29dace,836	// ///  or in textual repr: crossOwnerOf(uint256)837	// function crossOwnerOf(uint256 tokenId) public view returns (CrossAddress memory) {838	// 	require(false, stub_error);839	// 	tokenId;840	// 	dummy;841	// 	return CrossAddress(0x0000000000000000000000000000000000000000,0);842	// }843844	/// Returns the owner (in cross format) of the token.845	///846	/// @param tokenId Id for the token.847	/// @dev EVM selector for this function is: 0xcaa3a4d0,848	///  or in textual repr: ownerOfCross(uint256)849	function ownerOfCross(uint256 tokenId) public view returns (CrossAddress memory) {850		require(false, stub_error);851		tokenId;852		dummy;853		return CrossAddress(0x0000000000000000000000000000000000000000, 0);854	}855856	/// @notice Count all RFTs assigned to an owner857	/// @param owner An cross address for whom to query the balance858	/// @return The number of RFTs owned by `owner`, possibly zero859	/// @dev EVM selector for this function is: 0xec069398,860	///  or in textual repr: balanceOfCross((address,uint256))861	function balanceOfCross(CrossAddress memory owner) public view returns (uint256) {862		require(false, stub_error);863		owner;864		dummy;865		return 0;866	}867868	/// Returns the token properties.869	///870	/// @param tokenId Id for the token.871	/// @param keys Properties keys. Empty keys for all propertyes.872	/// @return Vector of properties key/value pairs.873	/// @dev EVM selector for this function is: 0xe07ede7e,874	///  or in textual repr: properties(uint256,string[])875	function properties(uint256 tokenId, string[] memory keys) public view returns (Property[] memory) {876		require(false, stub_error);877		tokenId;878		keys;879		dummy;880		return new Property[](0);881	}882883	/// @notice Transfer ownership of an RFT884	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`885	///  is the zero address. Throws if `tokenId` is not a valid RFT.886	///  Throws if RFT pieces have multiple owners.887	/// @param to The new owner888	/// @param tokenId The RFT to transfer889	/// @dev EVM selector for this function is: 0xa9059cbb,890	///  or in textual repr: transfer(address,uint256)891	function transfer(address to, uint256 tokenId) public {892		require(false, stub_error);893		to;894		tokenId;895		dummy = 0;896	}897898	/// @notice Transfer ownership of an RFT899	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`900	///  is the zero address. Throws if `tokenId` is not a valid RFT.901	///  Throws if RFT pieces have multiple owners.902	/// @param to The new owner903	/// @param tokenId The RFT to transfer904	/// @dev EVM selector for this function is: 0x2ada85ff,905	///  or in textual repr: transferCross((address,uint256),uint256)906	function transferCross(CrossAddress memory to, uint256 tokenId) public {907		require(false, stub_error);908		to;909		tokenId;910		dummy = 0;911	}912913	/// @notice Transfer ownership of an RFT914	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`915	///  is the zero address. Throws if `tokenId` is not a valid RFT.916	///  Throws if RFT pieces have multiple owners.917	/// @param to The new owner918	/// @param tokenId The RFT to transfer919	/// @dev EVM selector for this function is: 0xd5cf430b,920	///  or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)921	function transferFromCross(922		CrossAddress memory from,923		CrossAddress memory to,924		uint256 tokenId925	) public {926		require(false, stub_error);927		from;928		to;929		tokenId;930		dummy = 0;931	}932933	// /// @notice Burns a specific ERC721 token.934	// /// @dev Throws unless `msg.sender` is the current owner or an authorized935	// ///  operator for this RFT. Throws if `from` is not the current owner. Throws936	// ///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.937	// ///  Throws if RFT pieces have multiple owners.938	// /// @param from The current owner of the RFT939	// /// @param tokenId The RFT to transfer940	// /// @dev EVM selector for this function is: 0x79cc6790,941	// ///  or in textual repr: burnFrom(address,uint256)942	// function burnFrom(address from, uint256 tokenId) public {943	// 	require(false, stub_error);944	// 	from;945	// 	tokenId;946	// 	dummy = 0;947	// }948949	/// @notice Burns a specific ERC721 token.950	/// @dev Throws unless `msg.sender` is the current owner or an authorized951	///  operator for this RFT. Throws if `from` is not the current owner. Throws952	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.953	///  Throws if RFT pieces have multiple owners.954	/// @param from The current owner of the RFT955	/// @param tokenId The RFT to transfer956	/// @dev EVM selector for this function is: 0xbb2f5a58,957	///  or in textual repr: burnFromCross((address,uint256),uint256)958	function burnFromCross(CrossAddress memory from, uint256 tokenId) public {959		require(false, stub_error);960		from;961		tokenId;962		dummy = 0;963	}964965	/// @notice Returns next free RFT ID.966	/// @dev EVM selector for this function is: 0x75794a3c,967	///  or in textual repr: nextTokenId()968	function nextTokenId() public view returns (uint256) {969		require(false, stub_error);970		dummy;971		return 0;972	}973974	// /// @notice Function to mint multiple tokens.975	// /// @dev `tokenIds` should be an array of consecutive numbers and first number976	// ///  should be obtained with `nextTokenId` method977	// /// @param to The new owner978	// /// @param tokenIds IDs of the minted RFTs979	// /// @dev EVM selector for this function is: 0x44a9945e,980	// ///  or in textual repr: mintBulk(address,uint256[])981	// function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {982	// 	require(false, stub_error);983	// 	to;984	// 	tokenIds;985	// 	dummy = 0;986	// 	return false;987	// }988989	/// @notice Function to mint a token.990	/// @param tokenProperties Properties of minted token991	/// @dev EVM selector for this function is: 0xdf7a5db7,992	///  or in textual repr: mintBulkCross((((address,uint256),uint128)[],(string,bytes)[])[])993	function mintBulkCross(MintTokenData[] memory tokenProperties) public returns (bool) {994		require(false, stub_error);995		tokenProperties;996		dummy = 0;997		return false;998	}9991000	// /// @notice Function to mint multiple tokens with the given tokenUris.1001	// /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive1002	// ///  numbers and first number should be obtained with `nextTokenId` method1003	// /// @param to The new owner1004	// /// @param tokens array of pairs of token ID and token URI for minted tokens1005	// /// @dev EVM selector for this function is: 0x36543006,1006	// ///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])1007	// function mintBulkWithTokenURI(address to, TokenUri[] memory tokens) public returns (bool) {1008	// 	require(false, stub_error);1009	// 	to;1010	// 	tokens;1011	// 	dummy = 0;1012	// 	return false;1013	// }10141015	/// @notice Function to mint a token.1016	/// @param to The new owner crossAccountId1017	/// @param properties Properties of minted token1018	/// @return uint256 The id of the newly minted token1019	/// @dev EVM selector for this function is: 0xb904db03,1020	///  or in textual repr: mintCross((address,uint256),(string,bytes)[])1021	function mintCross(CrossAddress memory to, Property[] memory properties) public returns (uint256) {1022		require(false, stub_error);1023		to;1024		properties;1025		dummy = 0;1026		return 0;1027	}10281029	/// Returns EVM address for refungible token1030	///1031	/// @param token ID of the token1032	/// @dev EVM selector for this function is: 0xab76fac6,1033	///  or in textual repr: tokenContractAddress(uint256)1034	function tokenContractAddress(uint256 token) public view returns (address) {1035		require(false, stub_error);1036		token;1037		dummy;1038		return 0x0000000000000000000000000000000000000000;1039	}10401041	/// @notice Returns collection helper contract address1042	/// @dev EVM selector for this function is: 0x1896cce6,1043	///  or in textual repr: collectionHelperAddress()1044	function collectionHelperAddress() public view returns (address) {1045		require(false, stub_error);1046		dummy;1047		return 0x0000000000000000000000000000000000000000;1048	}1049}10501051/// Data for creation token with uri.1052struct TokenUri {1053	/// Id of new token.1054	uint256 id;1055	/// Uri of new token.1056	string uri;1057}10581059/// Token minting parameters1060struct MintTokenData {1061	/// Minted token owner and number of pieces1062	OwnerPieces[] owners;1063	/// Minted token properties1064	Property[] properties;1065}10661067/// Token minting parameters1068struct OwnerPieces {1069	/// Minted token owner1070	CrossAddress owner;1071	/// Number of token pieces1072	uint128 pieces;1073}10741075/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension1076/// @dev See https://eips.ethereum.org/EIPS/eip-7211077/// @dev the ERC-165 identifier for this interface is 0x780e9d631078contract ERC721Enumerable is Dummy, ERC165 {1079	/// @notice Enumerate valid RFTs1080	/// @param index A counter less than `totalSupply()`1081	/// @return The token identifier for the `index`th NFT,1082	///  (sort order not specified)1083	/// @dev EVM selector for this function is: 0x4f6ccce7,1084	///  or in textual repr: tokenByIndex(uint256)1085	function tokenByIndex(uint256 index) public view returns (uint256) {1086		require(false, stub_error);1087		index;1088		dummy;1089		return 0;1090	}10911092	/// Not implemented1093	/// @dev EVM selector for this function is: 0x2f745c59,1094	///  or in textual repr: tokenOfOwnerByIndex(address,uint256)1095	function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {1096		require(false, stub_error);1097		owner;1098		index;1099		dummy;1100		return 0;1101	}11021103	/// @notice Count RFTs tracked by this contract1104	/// @return A count of valid RFTs tracked by this contract, where each one of1105	///  them has an assigned and queryable owner not equal to the zero address1106	/// @dev EVM selector for this function is: 0x18160ddd,1107	///  or in textual repr: totalSupply()1108	function totalSupply() public view returns (uint256) {1109		require(false, stub_error);1110		dummy;1111		return 0;1112	}1113}11141115/// @dev inlined interface1116contract ERC721Events {1117	event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);1118	event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);1119	event ApprovalForAll(address indexed owner, address indexed operator, bool approved);1120}11211122/// @title ERC-721 Non-Fungible Token Standard1123/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md1124/// @dev the ERC-165 identifier for this interface is 0x80ac58cd1125contract ERC721 is Dummy, ERC165, ERC721Events {1126	/// @notice Count all RFTs assigned to an owner1127	/// @dev RFTs assigned to the zero address are considered invalid, and this1128	///  function throws for queries about the zero address.1129	/// @param owner An address for whom to query the balance1130	/// @return The number of RFTs owned by `owner`, possibly zero1131	/// @dev EVM selector for this function is: 0x70a08231,1132	///  or in textual repr: balanceOf(address)1133	function balanceOf(address owner) public view returns (uint256) {1134		require(false, stub_error);1135		owner;1136		dummy;1137		return 0;1138	}11391140	/// @notice Find the owner of an RFT1141	/// @dev RFTs assigned to zero address are considered invalid, and queries1142	///  about them do throw.1143	///  Returns special 0xffffffffffffffffffffffffffffffffffffffff address for1144	///  the tokens that are partially owned.1145	/// @param tokenId The identifier for an RFT1146	/// @return The address of the owner of the RFT1147	/// @dev EVM selector for this function is: 0x6352211e,1148	///  or in textual repr: ownerOf(uint256)1149	function ownerOf(uint256 tokenId) public view returns (address) {1150		require(false, stub_error);1151		tokenId;1152		dummy;1153		return 0x0000000000000000000000000000000000000000;1154	}11551156	/// @dev Not implemented1157	/// @dev EVM selector for this function is: 0xb88d4fde,1158	///  or in textual repr: safeTransferFrom(address,address,uint256,bytes)1159	function safeTransferFrom(1160		address from,1161		address to,1162		uint256 tokenId,1163		bytes memory data1164	) public {1165		require(false, stub_error);1166		from;1167		to;1168		tokenId;1169		data;1170		dummy = 0;1171	}11721173	/// @dev Not implemented1174	/// @dev EVM selector for this function is: 0x42842e0e,1175	///  or in textual repr: safeTransferFrom(address,address,uint256)1176	function safeTransferFrom(1177		address from,1178		address to,1179		uint256 tokenId1180	) public {1181		require(false, stub_error);1182		from;1183		to;1184		tokenId;1185		dummy = 0;1186	}11871188	/// @notice Transfer ownership of an RFT -- THE CALLER IS RESPONSIBLE1189	///  TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE1190	///  THEY MAY BE PERMANENTLY LOST1191	/// @dev Throws unless `msg.sender` is the current owner or an authorized1192	///  operator for this RFT. Throws if `from` is not the current owner. Throws1193	///  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.1194	///  Throws if RFT pieces have multiple owners.1195	/// @param from The current owner of the NFT1196	/// @param to The new owner1197	/// @param tokenId The NFT to transfer1198	/// @dev EVM selector for this function is: 0x23b872dd,1199	///  or in textual repr: transferFrom(address,address,uint256)1200	function transferFrom(1201		address from,1202		address to,1203		uint256 tokenId1204	) public {1205		require(false, stub_error);1206		from;1207		to;1208		tokenId;1209		dummy = 0;1210	}12111212	/// @dev Not implemented1213	/// @dev EVM selector for this function is: 0x095ea7b3,1214	///  or in textual repr: approve(address,uint256)1215	function approve(address approved, uint256 tokenId) public {1216		require(false, stub_error);1217		approved;1218		tokenId;1219		dummy = 0;1220	}12211222	/// @notice Sets or unsets the approval of a given operator.1223	///  The `operator` is allowed to transfer all token pieces of the `caller` on their behalf.1224	/// @param operator Operator1225	/// @param approved Should operator status be granted or revoked?1226	/// @dev EVM selector for this function is: 0xa22cb465,1227	///  or in textual repr: setApprovalForAll(address,bool)1228	function setApprovalForAll(address operator, bool approved) public {1229		require(false, stub_error);1230		operator;1231		approved;1232		dummy = 0;1233	}12341235	/// @dev Not implemented1236	/// @dev EVM selector for this function is: 0x081812fc,1237	///  or in textual repr: getApproved(uint256)1238	function getApproved(uint256 tokenId) public view returns (address) {1239		require(false, stub_error);1240		tokenId;1241		dummy;1242		return 0x0000000000000000000000000000000000000000;1243	}12441245	/// @notice Tells whether the given `owner` approves the `operator`.1246	/// @dev EVM selector for this function is: 0xe985e9c5,1247	///  or in textual repr: isApprovedForAll(address,address)1248	function isApprovedForAll(address owner, address operator) public view returns (bool) {1249		require(false, stub_error);1250		owner;1251		operator;1252		dummy;1253		return false;1254	}1255}12561257contract UniqueRefungible is1258	Dummy,1259	ERC165,1260	ERC721,1261	ERC721Enumerable,1262	ERC721UniqueExtensions,1263	ERC721UniqueMintable,1264	ERC721Burnable,1265	ERC721Metadata,1266	Collection,1267	TokenProperties1268{}
modifiedpallets/scheduler-v2/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/scheduler-v2/src/benchmarking.rs
+++ b/pallets/scheduler-v2/src/benchmarking.rs
@@ -136,8 +136,10 @@
 	let bound = EncodedCall::bound() as u32;
 	let mut len = match maybe_lookup_len {
 		Some(len) => {
-			len.min(<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get() - 2)
-				.max(bound) - 3
+			len.clamp(
+				bound,
+				<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get() - 2,
+			) - 3
 		}
 		None => bound.saturating_sub(4),
 	};
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
--- a/pallets/unique/src/eth/stubs/CollectionHelpers.sol
+++ b/pallets/unique/src/eth/stubs/CollectionHelpers.sol
@@ -25,12 +25,12 @@
 }
 
 /// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x4135fff1
+/// @dev the ERC-165 identifier for this interface is 0x94e5af0d
 contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
 	/// Create a collection
 	/// @return address Address of the newly created collection
-	/// @dev EVM selector for this function is: 0xa765ee5b,
-	///  or in textual repr: createCollection(((address,uint256),string,string,string,uint8,uint8,(string,bytes)[],(string,(uint8,bool)[])[],(address,uint256)[],(bool,bool,address[]),(uint8,uint256)[],uint8))
+	/// @dev EVM selector for this function is: 0x72b5bea7,
+	///  or in textual repr: createCollection((string,string,string,uint8,uint8,(string,bytes)[],(string,(uint8,bool)[])[],(address,uint256)[],(bool,bool,address[]),(uint8,uint256)[],(address,uint256),uint8))
 	function createCollection(CreateCollectionData memory data) public payable returns (address) {
 		require(false, stub_error);
 		data;
@@ -170,8 +170,6 @@
 
 /// Collection properties
 struct CreateCollectionData {
-	/// Collection sponsor
-	CrossAddress pending_sponsor;
 	/// Collection name
 	string name;
 	/// Collection description
@@ -192,11 +190,12 @@
 	CollectionNestingAndPermission nesting_settings;
 	/// Collection limits
 	CollectionLimitValue[] limits;
+	/// Collection sponsor
+	CrossAddress pending_sponsor;
 	/// Extra collection flags
 	CollectionFlags flags;
 }
 
-/// Cross account struct
 type CollectionFlags is uint8;
 
 library CollectionFlagsLib {
@@ -207,13 +206,19 @@
 	/// External collections can't be managed using `unique` api
 	CollectionFlags constant externalField = CollectionFlags.wrap(1);
 
-	/// Reserved bits
+	/// Reserved flags
 	function reservedField(uint8 value) public pure returns (CollectionFlags) {
 		require(value < 1 << 5, "out of bound value");
 		return CollectionFlags.wrap(value << 1);
 	}
 }
 
+/// Cross account struct
+struct CrossAddress {
+	address eth;
+	uint256 sub;
+}
+
 /// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.
 struct CollectionLimitValue {
 	CollectionLimitField field;
@@ -250,12 +255,6 @@
 	bool collection_admin;
 	/// If set - only tokens from specified collections can be nested.
 	address[] restricted;
-}
-
-/// Cross account struct
-struct CrossAddress {
-	address eth;
-	uint256 sub;
 }
 
 /// Ethereum representation of Token Property Permissions.
@@ -292,10 +291,10 @@
 
 /// Type of tokens in collection
 enum CollectionMode {
-	/// Fungible
-	Fungible,
 	/// Nonfungible
 	Nonfungible,
+	/// Fungible
+	Fungible,
 	/// Refungible
 	Refungible
 }
modifiedruntime/common/ethereum/sponsoring/refungible.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/sponsoring/refungible.rs
+++ b/runtime/common/ethereum/sponsoring/refungible.rs
@@ -242,6 +242,7 @@
 			BurnFrom { .. }
 			| BurnFromCross { .. }
 			| MintBulk { .. }
+			| MintBulkCross { .. }
 			| MintBulkWithTokenUri { .. } => None,
 
 			MintCross { .. } => withdraw_create_item::<T>(
modifiedruntime/common/tests/mod.rsdiffbeforeafterboth
--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -33,7 +33,7 @@
 const PARA_ID: u32 = 2037;
 
 fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
-	TPublic::Pair::from_string(&format!("//{}", seed), None)
+	TPublic::Pair::from_string(&format!("//{seed}"), None)
 		.expect("static values are valid; qed")
 		.public()
 }
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -469,6 +469,39 @@
     "inputs": [
       {
         "components": [
+          {
+            "components": [
+              { "internalType": "address", "name": "eth", "type": "address" },
+              { "internalType": "uint256", "name": "sub", "type": "uint256" }
+            ],
+            "internalType": "struct CrossAddress",
+            "name": "owner",
+            "type": "tuple"
+          },
+          {
+            "components": [
+              { "internalType": "string", "name": "key", "type": "string" },
+              { "internalType": "bytes", "name": "value", "type": "bytes" }
+            ],
+            "internalType": "struct Property[]",
+            "name": "properties",
+            "type": "tuple[]"
+          }
+        ],
+        "internalType": "struct MintTokenData[]",
+        "name": "data",
+        "type": "tuple[]"
+      }
+    ],
+    "name": "mintBulkCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "components": [
           { "internalType": "address", "name": "eth", "type": "address" },
           { "internalType": "uint256", "name": "sub", "type": "uint256" }
         ],
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/reFungible.json
+++ b/tests/src/eth/abi/reFungible.json
@@ -451,6 +451,55 @@
     "inputs": [
       {
         "components": [
+          {
+            "components": [
+              {
+                "components": [
+                  {
+                    "internalType": "address",
+                    "name": "eth",
+                    "type": "address"
+                  },
+                  {
+                    "internalType": "uint256",
+                    "name": "sub",
+                    "type": "uint256"
+                  }
+                ],
+                "internalType": "struct CrossAddress",
+                "name": "owner",
+                "type": "tuple"
+              },
+              { "internalType": "uint128", "name": "pieces", "type": "uint128" }
+            ],
+            "internalType": "struct OwnerPieces[]",
+            "name": "owners",
+            "type": "tuple[]"
+          },
+          {
+            "components": [
+              { "internalType": "string", "name": "key", "type": "string" },
+              { "internalType": "bytes", "name": "value", "type": "bytes" }
+            ],
+            "internalType": "struct Property[]",
+            "name": "properties",
+            "type": "tuple[]"
+          }
+        ],
+        "internalType": "struct MintTokenData[]",
+        "name": "tokenProperties",
+        "type": "tuple[]"
+      }
+    ],
+    "name": "mintBulkCross",
+    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "components": [
           { "internalType": "address", "name": "eth", "type": "address" },
           { "internalType": "uint256", "name": "sub", "type": "uint256" }
         ],
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/CollectionHelpers.sol
+++ b/tests/src/eth/api/CollectionHelpers.sol
@@ -20,12 +20,12 @@
 }
 
 /// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x4135fff1
+/// @dev the ERC-165 identifier for this interface is 0x94e5af0d
 interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
 	/// Create a collection
 	/// @return address Address of the newly created collection
-	/// @dev EVM selector for this function is: 0xa765ee5b,
-	///  or in textual repr: createCollection(((address,uint256),string,string,string,uint8,uint8,(string,bytes)[],(string,(uint8,bool)[])[],(address,uint256)[],(bool,bool,address[]),(uint8,uint256)[],uint8))
+	/// @dev EVM selector for this function is: 0x72b5bea7,
+	///  or in textual repr: createCollection((string,string,string,uint8,uint8,(string,bytes)[],(string,(uint8,bool)[])[],(address,uint256)[],(bool,bool,address[]),(uint8,uint256)[],(address,uint256),uint8))
 	function createCollection(CreateCollectionData memory data) external payable returns (address);
 
 	/// Create an NFT collection
@@ -103,8 +103,6 @@
 
 /// Collection properties
 struct CreateCollectionData {
-	/// Collection sponsor
-	CrossAddress pending_sponsor;
 	/// Collection name
 	string name;
 	/// Collection description
@@ -125,11 +123,12 @@
 	CollectionNestingAndPermission nesting_settings;
 	/// Collection limits
 	CollectionLimitValue[] limits;
+	/// Collection sponsor
+	CrossAddress pending_sponsor;
 	/// Extra collection flags
 	CollectionFlags flags;
 }
 
-/// Cross account struct
 type CollectionFlags is uint8;
 
 library CollectionFlagsLib {
@@ -140,13 +139,19 @@
 	/// External collections can't be managed using `unique` api
 	CollectionFlags constant externalField = CollectionFlags.wrap(1);
 
-	/// Reserved bits
+	/// Reserved flags
 	function reservedField(uint8 value) public pure returns (CollectionFlags) {
 		require(value < 1 << 5, "out of bound value");
 		return CollectionFlags.wrap(value << 1);
 	}
 }
 
+/// Cross account struct
+struct CrossAddress {
+	address eth;
+	uint256 sub;
+}
+
 /// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.
 struct CollectionLimitValue {
 	CollectionLimitField field;
@@ -183,12 +188,6 @@
 	bool collection_admin;
 	/// If set - only tokens from specified collections can be nested.
 	address[] restricted;
-}
-
-/// Cross account struct
-struct CrossAddress {
-	address eth;
-	uint256 sub;
 }
 
 /// Ethereum representation of Token Property Permissions.
@@ -225,10 +224,10 @@
 
 /// Type of tokens in collection
 enum CollectionMode {
-	/// Fungible
-	Fungible,
 	/// Nonfungible
 	Nonfungible,
+	/// Fungible
+	Fungible,
 	/// Refungible
 	Refungible
 }
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -551,7 +551,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x307b061a
+/// @dev the ERC-165 identifier for this interface is 0x9b397d16
 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,
@@ -674,6 +674,12 @@
 	// ///  or in textual repr: mintBulk(address,uint256[])
 	// function mintBulk(address to, uint256[] memory tokenIds) external returns (bool);
 
+	/// @notice Function to mint a token.
+	/// @param data Array of pairs of token owner and token's properties for minted token
+	/// @dev EVM selector for this function is: 0xab427b0c,
+	///  or in textual repr: mintBulkCross(((address,uint256),(string,bytes)[])[])
+	function mintBulkCross(MintTokenData[] memory data) external returns (bool);
+
 	// /// @notice Function to mint multiple tokens with the given tokenUris.
 	// /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
 	// ///  numbers and first number should be obtained with `nextTokenId` method
@@ -705,6 +711,14 @@
 	string uri;
 }
 
+/// Token minting parameters
+struct MintTokenData {
+	/// Minted token owner
+	CrossAddress owner;
+	/// Minted token properties
+	Property[] properties;
+}
+
 /// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 /// @dev See https://eips.ethereum.org/EIPS/eip-721
 /// @dev the ERC-165 identifier for this interface is 0x780e9d63
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -551,7 +551,7 @@
 }
 
 /// @title Unique extensions for ERC721.
-/// @dev the ERC-165 identifier for this interface is 0x95c0f66c
+/// @dev the ERC-165 identifier for this interface is 0x4abaabdb
 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,
@@ -668,6 +668,12 @@
 	// ///  or in textual repr: mintBulk(address,uint256[])
 	// function mintBulk(address to, uint256[] memory tokenIds) external returns (bool);
 
+	/// @notice Function to mint a token.
+	/// @param tokenProperties Properties of minted token
+	/// @dev EVM selector for this function is: 0xdf7a5db7,
+	///  or in textual repr: mintBulkCross((((address,uint256),uint128)[],(string,bytes)[])[])
+	function mintBulkCross(MintTokenData[] memory tokenProperties) external returns (bool);
+
 	// /// @notice Function to mint multiple tokens with the given tokenUris.
 	// /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
 	// ///  numbers and first number should be obtained with `nextTokenId` method
@@ -706,6 +712,22 @@
 	string uri;
 }
 
+/// Token minting parameters
+struct MintTokenData {
+	/// Minted token owner and number of pieces
+	OwnerPieces[] owners;
+	/// Minted token properties
+	Property[] properties;
+}
+
+/// Token minting parameters
+struct OwnerPieces {
+	/// Minted token owner
+	CrossAddress owner;
+	/// Number of token pieces
+	uint128 pieces;
+}
+
 /// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 /// @dev See https://eips.ethereum.org/EIPS/eip-721
 /// @dev the ERC-165 identifier for this interface is 0x780e9d63
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -18,6 +18,7 @@
 import {IKeyringPair} from '@polkadot/types/types';
 import {Contract} from 'web3-eth-contract';
 import {ITokenPropertyPermission} from '../util/playgrounds/types';
+import {CREATE_COLLECTION_DATA_DEFAULTS, CollectionMode, CreateCollectionData, TokenPermissionField} from './util/playgrounds/types';
 
 describe('Check ERC721 token URI for NFT', () => {
   let donor: IKeyringPair;
@@ -197,6 +198,96 @@
     }
   });
 
+  itEth('Can perform mintBulkCross()', async ({helper}) => {
+    const caller = await helper.eth.createAccountWithBalance(donor);
+    const callerCross = helper.ethCrossAccount.fromAddress(caller);
+    const receiver = helper.eth.createAccount();
+    const receiverCross = helper.ethCrossAccount.fromAddress(receiver);
+
+    const permissions = [
+      {code: TokenPermissionField.Mutable, value: true},
+      {code: TokenPermissionField.TokenOwner, value: true},
+      {code: TokenPermissionField.CollectionAdmin, value: true},
+    ];
+    const {collectionAddress} = await helper.eth.createCollection(
+      caller,
+      {
+        ...CREATE_COLLECTION_DATA_DEFAULTS,
+        name: 'A',
+        description: 'B',
+        tokenPrefix: 'C',
+        collectionMode: 'nft',
+        adminList: [callerCross],
+        tokenPropertyPermissions: [
+          {key: 'key_0_0', permissions},
+          {key: 'key_1_0', permissions},
+          {key: 'key_1_1', permissions},
+          {key: 'key_2_0', permissions},
+          {key: 'key_2_1', permissions},
+          {key: 'key_2_2', permissions},
+        ],
+      },
+    ).send();
+
+    const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', caller);
+    {
+      const nextTokenId = await contract.methods.nextTokenId().call();
+      expect(nextTokenId).to.be.equal('1');
+      const result = await contract.methods.mintBulkCross([
+        {
+          owner: receiverCross,
+          properties: [
+            {key: 'key_0_0', value: Buffer.from('value_0_0')},
+          ],
+        },
+        {
+          owner: receiverCross,
+          properties: [
+            {key: 'key_1_0', value: Buffer.from('value_1_0')},
+            {key: 'key_1_1', value: Buffer.from('value_1_1')},
+          ],
+        },
+        {
+          owner: receiverCross,
+          properties: [
+            {key: 'key_2_0', value: Buffer.from('value_2_0')},
+            {key: 'key_2_1', value: Buffer.from('value_2_1')},
+            {key: 'key_2_2', value: Buffer.from('value_2_2')},
+          ],
+        },
+      ]).send({from: caller});
+      const events = result.events.Transfer.sort((a: any, b: any) => +a.returnValues.tokenId - b.returnValues.tokenId);
+      const bulkSize = 3;
+      for(let i = 0; i < bulkSize; i++) {
+        const event = events[i];
+        expect(event.address).to.equal(collectionAddress);
+        expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');
+        expect(event.returnValues.to).to.equal(receiver);
+        expect(event.returnValues.tokenId).to.equal(`${+nextTokenId + i}`);
+      }
+
+      const properties = [
+        await contract.methods.properties(+nextTokenId, []).call(),
+        await contract.methods.properties(+nextTokenId + 1, []).call(),
+        await contract.methods.properties(+nextTokenId + 2, []).call(),
+      ];
+      expect(properties).to.be.deep.equal([
+        [
+          ['key_0_0', helper.getWeb3().utils.toHex('value_0_0')],
+        ],
+        [
+          ['key_1_0', helper.getWeb3().utils.toHex('value_1_0')],
+          ['key_1_1', helper.getWeb3().utils.toHex('value_1_1')],
+        ],
+        [
+          ['key_2_0', helper.getWeb3().utils.toHex('value_2_0')],
+          ['key_2_1', helper.getWeb3().utils.toHex('value_2_1')],
+          ['key_2_2', helper.getWeb3().utils.toHex('value_2_2')],
+        ],
+      ]);
+    }
+  });
+
   itEth('Can perform burn()', async ({helper}) => {
     const caller = await helper.eth.createAccountWithBalance(donor);
 
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -18,6 +18,7 @@
 import {expect, itEth, usingEthPlaygrounds} from './util';
 import {IKeyringPair} from '@polkadot/types/types';
 import {ITokenPropertyPermission} from '../util/playgrounds/types';
+import {CREATE_COLLECTION_DATA_DEFAULTS, TokenPermissionField} from './util/playgrounds/types';
 
 describe('Refungible: Plain calls', () => {
   let donor: IKeyringPair;
@@ -125,6 +126,169 @@
     }
   });
 
+  itEth('Can perform mintBulkCross() with multiple tokens', async ({helper}) => {
+    const caller = await helper.eth.createAccountWithBalance(donor);
+    const callerCross = helper.ethCrossAccount.fromAddress(caller);
+    const receiver = helper.eth.createAccount();
+    const receiverCross = helper.ethCrossAccount.fromAddress(receiver);
+
+    const permissions = [
+      {code: TokenPermissionField.Mutable, value: true},
+      {code: TokenPermissionField.TokenOwner, value: true},
+      {code: TokenPermissionField.CollectionAdmin, value: true},
+    ];
+    const {collectionAddress} = await helper.eth.createCollection(
+      caller,
+      {
+        ...CREATE_COLLECTION_DATA_DEFAULTS,
+        name: 'A',
+        description: 'B',
+        tokenPrefix: 'C',
+        collectionMode: 'rft',
+        adminList: [callerCross],
+        tokenPropertyPermissions: [
+          {key: 'key_0_0', permissions},
+          {key: 'key_1_0', permissions},
+          {key: 'key_1_1', permissions},
+          {key: 'key_2_0', permissions},
+          {key: 'key_2_1', permissions},
+          {key: 'key_2_2', permissions},
+        ],
+      },
+    ).send();
+
+    const contract = await helper.ethNativeContract.collection(collectionAddress, 'rft', caller);
+    const nextTokenId = await contract.methods.nextTokenId().call();
+    expect(nextTokenId).to.be.equal('1');
+    const result = await contract.methods.mintBulkCross([
+      {
+        owners: [{
+          owner: receiverCross,
+          pieces: 1,
+        }],
+        properties: [
+          {key: 'key_0_0', value: Buffer.from('value_0_0')},
+        ],
+      },
+      {
+        owners: [{
+          owner: receiverCross,
+          pieces: 2,
+        }],
+        properties: [
+          {key: 'key_1_0', value: Buffer.from('value_1_0')},
+          {key: 'key_1_1', value: Buffer.from('value_1_1')},
+        ],
+      },
+      {
+        owners: [{
+          owner: receiverCross,
+          pieces: 1,
+        }],
+        properties: [
+          {key: 'key_2_0', value: Buffer.from('value_2_0')},
+          {key: 'key_2_1', value: Buffer.from('value_2_1')},
+          {key: 'key_2_2', value: Buffer.from('value_2_2')},
+        ],
+      },
+    ]).send({from: caller});
+    const events = result.events.Transfer.sort((a: any, b: any) => +a.returnValues.tokenId - b.returnValues.tokenId);
+    const bulkSize = 3;
+    for(let i = 0; i < bulkSize; i++) {
+      const event = events[i];
+      expect(event.address).to.equal(collectionAddress);
+      expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');
+      expect(event.returnValues.to).to.equal(receiver);
+      expect(event.returnValues.tokenId).to.equal(`${+nextTokenId + i}`);
+    }
+
+    const properties = [
+      await contract.methods.properties(+nextTokenId, []).call(),
+      await contract.methods.properties(+nextTokenId + 1, []).call(),
+      await contract.methods.properties(+nextTokenId + 2, []).call(),
+    ];
+    expect(properties).to.be.deep.equal([
+      [
+        ['key_0_0', helper.getWeb3().utils.toHex('value_0_0')],
+      ],
+      [
+        ['key_1_0', helper.getWeb3().utils.toHex('value_1_0')],
+        ['key_1_1', helper.getWeb3().utils.toHex('value_1_1')],
+      ],
+      [
+        ['key_2_0', helper.getWeb3().utils.toHex('value_2_0')],
+        ['key_2_1', helper.getWeb3().utils.toHex('value_2_1')],
+        ['key_2_2', helper.getWeb3().utils.toHex('value_2_2')],
+      ],
+    ]);
+  });
+
+  itEth('Can perform mintBulkCross() with multiple owners', async ({helper}) => {
+    const caller = await helper.eth.createAccountWithBalance(donor);
+    const callerCross = helper.ethCrossAccount.fromAddress(caller);
+    const receiver = helper.eth.createAccount();
+    const receiverCross = helper.ethCrossAccount.fromAddress(receiver);
+    const receiver2 = helper.eth.createAccount();
+    const receiver2Cross = helper.ethCrossAccount.fromAddress(receiver2);
+
+    const permissions = [
+      {code: TokenPermissionField.Mutable, value: true},
+      {code: TokenPermissionField.TokenOwner, value: true},
+      {code: TokenPermissionField.CollectionAdmin, value: true},
+    ];
+    const {collectionAddress} = await helper.eth.createCollection(
+      caller,
+      {
+        ...CREATE_COLLECTION_DATA_DEFAULTS,
+        name: 'A',
+        description: 'B',
+        tokenPrefix: 'C',
+        collectionMode: 'rft',
+        adminList: [callerCross],
+        tokenPropertyPermissions: [
+          {key: 'key_2_0', permissions},
+          {key: 'key_2_1', permissions},
+          {key: 'key_2_2', permissions},
+        ],
+      },
+    ).send();
+
+    const contract = await helper.ethNativeContract.collection(collectionAddress, 'rft', caller);
+    const nextTokenId = await contract.methods.nextTokenId().call();
+    expect(nextTokenId).to.be.equal('1');
+    const result = await contract.methods.mintBulkCross([{
+      owners: [
+        {
+          owner: receiverCross,
+          pieces: 1,
+        },
+        {
+          owner: receiver2Cross,
+          pieces: 2,
+        },
+      ],
+      properties: [
+        {key: 'key_2_0', value: Buffer.from('value_2_0')},
+        {key: 'key_2_1', value: Buffer.from('value_2_1')},
+        {key: 'key_2_2', value: Buffer.from('value_2_2')},
+      ],
+    }]).send({from: caller});
+    const event = result.events.Transfer;
+    expect(event.address).to.equal(collectionAddress);
+    expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');
+    expect(event.returnValues.to).to.equal('0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF');
+    expect(event.returnValues.tokenId).to.equal(`${+nextTokenId}`);
+
+    const properties = [
+      await contract.methods.properties(+nextTokenId, []).call(),
+    ];
+    expect(properties).to.be.deep.equal([[
+      ['key_2_0', helper.getWeb3().utils.toHex('value_2_0')],
+      ['key_2_1', helper.getWeb3().utils.toHex('value_2_1')],
+      ['key_2_2', helper.getWeb3().utils.toHex('value_2_2')],
+    ]]);
+  });
+
   itEth('Can perform setApprovalForAll()', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const operator = helper.eth.createAccount();
@@ -786,4 +950,70 @@
 
     await expect(contract.methods.transferFromCross(ownerCross, recieverCross, token.tokenId).send({from: spender})).to.be.rejected;
   });
+
+  itEth('[negative] Can perform mintBulkCross() with multiple owners and multiple tokens', async ({helper}) => {
+    const caller = await helper.eth.createAccountWithBalance(donor);
+    const callerCross = helper.ethCrossAccount.fromAddress(caller);
+    const receiver = helper.eth.createAccount();
+    const receiverCross = helper.ethCrossAccount.fromAddress(receiver);
+    const receiver2 = helper.eth.createAccount();
+    const receiver2Cross = helper.ethCrossAccount.fromAddress(receiver2);
+
+    const permissions = [
+      {code: TokenPermissionField.Mutable, value: true},
+      {code: TokenPermissionField.TokenOwner, value: true},
+      {code: TokenPermissionField.CollectionAdmin, value: true},
+    ];
+    const {collectionAddress} = await helper.eth.createCollection(
+      caller,
+      {
+        ...CREATE_COLLECTION_DATA_DEFAULTS,
+        name: 'A',
+        description: 'B',
+        tokenPrefix: 'C',
+        collectionMode: 'rft',
+        adminList: [callerCross],
+        tokenPropertyPermissions: [
+          {key: 'key_0_0', permissions},
+          {key: 'key_2_0', permissions},
+          {key: 'key_2_1', permissions},
+          {key: 'key_2_2', permissions},
+        ],
+      },
+    ).send();
+
+    const contract = await helper.ethNativeContract.collection(collectionAddress, 'rft', caller);
+    const nextTokenId = await contract.methods.nextTokenId().call();
+    expect(nextTokenId).to.be.equal('1');
+    const createData = [
+      {
+        owners: [{
+          owner: receiverCross,
+          pieces: 1,
+        }],
+        properties: [
+          {key: 'key_0_0', value: Buffer.from('value_0_0')},
+        ],
+      },
+      {
+        owners: [
+          {
+            owner: receiverCross,
+            pieces: 1,
+          },
+          {
+            owner: receiver2Cross,
+            pieces: 2,
+          },
+        ],
+        properties: [
+          {key: 'key_2_0', value: Buffer.from('value_2_0')},
+          {key: 'key_2_1', value: Buffer.from('value_2_1')},
+          {key: 'key_2_2', value: Buffer.from('value_2_2')},
+        ],
+      },
+    ];
+
+    await expect(contract.methods.mintBulkCross(createData).call({from: caller})).to.be.rejectedWith('creation of multiple tokens supported only if they have single owner each');
+  });
 });