git.delta.rocks / unique-network / refs/commits / 7f98069c7b60

difftreelog

feat Add `collection_admins` method to eth collection.

Trubnikov Sergey2022-10-24parent: #ab2e6a7.patch.diff
in: master

19 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -580,7 +580,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	fn collection_owner(&self) -> Result<(address, uint256)> {
 		Ok(convert_cross_account_to_tuple::<T>(
@@ -616,13 +616,16 @@
 	// 		.map_err(dispatch_to_evm::<T>)
 	// }
 
-	// TODO: need implement AbiWriter for &Vec<T>
-	// fn collection_admins(&self) -> Result<Vec<(address, uint256)>> {
-	// 	let result = pallet_common::IsAdmin::<T>::iter_prefix((self.id,))
-	// 		.map(|(admin, _)| pallet_common::eth::convert_cross_account_to_tuple::<T>(&admin))
-	// 		.collect();
-	// 	Ok(result)
-	// }
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	fn collection_admins(&self) -> Result<Vec<(address, uint256)>> {
+		let result = crate::IsAdmin::<T>::iter_prefix((self.id,))
+			.map(|(admin, _)| crate::eth::convert_cross_account_to_tuple::<T>(&admin))
+			.collect();
+		Ok(result)
+	}
 }
 
 /// ### Note
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -18,7 +18,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0x3af103fb
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -282,7 +282,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
@@ -303,6 +303,18 @@
 		newOwner;
 		dummy = 0;
 	}
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() public view returns (Tuple6[] memory) {
+		require(false, stub_error);
+		dummy;
+		return new Tuple6[](0);
+	}
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x63034ac5
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
before · pallets/nonfungible/src/stubs/UniqueNFT.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/// @title A contract that allows to set and delete token properties and change token property permissions.21/// @dev the ERC-165 identifier for this interface is 0x4136937722contract TokenProperties is Dummy, ERC165 {23	/// @notice Set permissions for token property.24	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.25	/// @param key Property key.26	/// @param isMutable Permission to mutate property.27	/// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.28	/// @param tokenOwner Permission to mutate property by token owner if property is mutable.29	/// @dev EVM selector for this function is: 0x222d97fa,30	///  or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)31	function setTokenPropertyPermission(32		string memory key,33		bool isMutable,34		bool collectionAdmin,35		bool tokenOwner36	) public {37		require(false, stub_error);38		key;39		isMutable;40		collectionAdmin;41		tokenOwner;42		dummy = 0;43	}4445	/// @notice Set token property value.46	/// @dev Throws error if `msg.sender` has no permission to edit the property.47	/// @param tokenId ID of the token.48	/// @param key Property key.49	/// @param value Property value.50	/// @dev EVM selector for this function is: 0x1752d67b,51	///  or in textual repr: setProperty(uint256,string,bytes)52	function setProperty(53		uint256 tokenId,54		string memory key,55		bytes memory value56	) public {57		require(false, stub_error);58		tokenId;59		key;60		value;61		dummy = 0;62	}6364	/// @notice Delete token property value.65	/// @dev Throws error if `msg.sender` has no permission to edit the property.66	/// @param tokenId ID of the token.67	/// @param key Property key.68	/// @dev EVM selector for this function is: 0x066111d1,69	///  or in textual repr: deleteProperty(uint256,string)70	function deleteProperty(uint256 tokenId, string memory key) public {71		require(false, stub_error);72		tokenId;73		key;74		dummy = 0;75	}7677	/// @notice Get token property value.78	/// @dev Throws error if key not found79	/// @param tokenId ID of the token.80	/// @param key Property key.81	/// @return Property value bytes82	/// @dev EVM selector for this function is: 0x7228c327,83	///  or in textual repr: property(uint256,string)84	function property(uint256 tokenId, string memory key) public view returns (bytes memory) {85		require(false, stub_error);86		tokenId;87		key;88		dummy;89		return hex"";90	}91}9293/// @title A contract that allows you to work with collections.94/// @dev the ERC-165 identifier for this interface is 0x62e2229095contract Collection is Dummy, ERC165 {96	/// Set collection property.97	///98	/// @param key Property key.99	/// @param value Propery value.100	/// @dev EVM selector for this function is: 0x2f073f66,101	///  or in textual repr: setCollectionProperty(string,bytes)102	function setCollectionProperty(string memory key, bytes memory value) public {103		require(false, stub_error);104		key;105		value;106		dummy = 0;107	}108109	/// Delete collection property.110	///111	/// @param key Property key.112	/// @dev EVM selector for this function is: 0x7b7debce,113	///  or in textual repr: deleteCollectionProperty(string)114	function deleteCollectionProperty(string memory key) public {115		require(false, stub_error);116		key;117		dummy = 0;118	}119120	/// Get collection property.121	///122	/// @dev Throws error if key not found.123	///124	/// @param key Property key.125	/// @return bytes The property corresponding to the key.126	/// @dev EVM selector for this function is: 0xcf24fd6d,127	///  or in textual repr: collectionProperty(string)128	function collectionProperty(string memory key) public view returns (bytes memory) {129		require(false, stub_error);130		key;131		dummy;132		return hex"";133	}134135	/// Set the sponsor of the collection.136	///137	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.138	///139	/// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.140	/// @dev EVM selector for this function is: 0x7623402e,141	///  or in textual repr: setCollectionSponsor(address)142	function setCollectionSponsor(address sponsor) public {143		require(false, stub_error);144		sponsor;145		dummy = 0;146	}147148	/// Whether there is a pending sponsor.149	/// @dev EVM selector for this function is: 0x058ac185,150	///  or in textual repr: hasCollectionPendingSponsor()151	function hasCollectionPendingSponsor() public view returns (bool) {152		require(false, stub_error);153		dummy;154		return false;155	}156157	/// Collection sponsorship confirmation.158	///159	/// @dev After setting the sponsor for the collection, it must be confirmed with this function.160	/// @dev EVM selector for this function is: 0x3c50e97a,161	///  or in textual repr: confirmCollectionSponsorship()162	function confirmCollectionSponsorship() public {163		require(false, stub_error);164		dummy = 0;165	}166167	/// Remove collection sponsor.168	/// @dev EVM selector for this function is: 0x6e0326a3,169	///  or in textual repr: removeCollectionSponsor()170	function removeCollectionSponsor() public {171		require(false, stub_error);172		dummy = 0;173	}174175	/// Get current sponsor.176	///177	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.178	/// @dev EVM selector for this function is: 0x6ec0a9f1,179	///  or in textual repr: collectionSponsor()180	function collectionSponsor() public view returns (Tuple17 memory) {181		require(false, stub_error);182		dummy;183		return Tuple17(0x0000000000000000000000000000000000000000, 0);184	}185186	/// Set limits for the collection.187	/// @dev Throws error if limit not found.188	/// @param limit Name of the limit. Valid names:189	/// 	"accountTokenOwnershipLimit",190	/// 	"sponsoredDataSize",191	/// 	"sponsoredDataRateLimit",192	/// 	"tokenLimit",193	/// 	"sponsorTransferTimeout",194	/// 	"sponsorApproveTimeout"195	/// @param value Value of the limit.196	/// @dev EVM selector for this function is: 0x6a3841db,197	///  or in textual repr: setCollectionLimit(string,uint32)198	function setCollectionLimit(string memory limit, uint32 value) public {199		require(false, stub_error);200		limit;201		value;202		dummy = 0;203	}204205	/// Set limits for the collection.206	/// @dev Throws error if limit not found.207	/// @param limit Name of the limit. Valid names:208	/// 	"ownerCanTransfer",209	/// 	"ownerCanDestroy",210	/// 	"transfersEnabled"211	/// @param value Value of the limit.212	/// @dev EVM selector for this function is: 0x993b7fba,213	///  or in textual repr: setCollectionLimit(string,bool)214	function setCollectionLimit(string memory limit, bool value) public {215		require(false, stub_error);216		limit;217		value;218		dummy = 0;219	}220221	/// Get contract address.222	/// @dev EVM selector for this function is: 0xf6b4dfb4,223	///  or in textual repr: contractAddress()224	function contractAddress() public view returns (address) {225		require(false, stub_error);226		dummy;227		return 0x0000000000000000000000000000000000000000;228	}229230	/// Add collection admin.231	/// @param newAdmin Address of the added administrator.232	/// @dev EVM selector for this function is: 0x92e462c7,233	///  or in textual repr: addCollectionAdmin(address)234	function addCollectionAdmin(address newAdmin) public {235		require(false, stub_error);236		newAdmin;237		dummy = 0;238	}239240	/// Remove collection admin.241	///242	/// @param admin Address of the removed administrator.243	/// @dev EVM selector for this function is: 0xfafd7b42,244	///  or in textual repr: removeCollectionAdmin(address)245	function removeCollectionAdmin(address admin) public {246		require(false, stub_error);247		admin;248		dummy = 0;249	}250251	/// Toggle accessibility of collection nesting.252	///253	/// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'254	/// @dev EVM selector for this function is: 0x112d4586,255	///  or in textual repr: setCollectionNesting(bool)256	function setCollectionNesting(bool enable) public {257		require(false, stub_error);258		enable;259		dummy = 0;260	}261262	/// Toggle accessibility of collection nesting.263	///264	/// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'265	/// @param collections Addresses of collections that will be available for nesting.266	/// @dev EVM selector for this function is: 0x64872396,267	///  or in textual repr: setCollectionNesting(bool,address[])268	function setCollectionNesting(bool enable, address[] memory collections) public {269		require(false, stub_error);270		enable;271		collections;272		dummy = 0;273	}274275	/// Set the collection access method.276	/// @param mode Access mode277	/// 	0 for Normal278	/// 	1 for AllowList279	/// @dev EVM selector for this function is: 0x41835d4c,280	///  or in textual repr: setCollectionAccess(uint8)281	function setCollectionAccess(uint8 mode) public {282		require(false, stub_error);283		mode;284		dummy = 0;285	}286287	/// Checks that user allowed to operate with collection.288	///289	/// @param user User address to check.290	/// @dev EVM selector for this function is: 0xd63a8e11,291	///  or in textual repr: allowed(address)292	function allowed(address user) public view returns (bool) {293		require(false, stub_error);294		user;295		dummy;296		return false;297	}298299	/// Add the user to the allowed list.300	///301	/// @param user Address of a trusted user.302	/// @dev EVM selector for this function is: 0x67844fe6,303	///  or in textual repr: addToCollectionAllowList(address)304	function addToCollectionAllowList(address user) public {305		require(false, stub_error);306		user;307		dummy = 0;308	}309310	/// Remove the user from the allowed list.311	///312	/// @param user Address of a removed user.313	/// @dev EVM selector for this function is: 0x85c51acb,314	///  or in textual repr: removeFromCollectionAllowList(address)315	function removeFromCollectionAllowList(address user) public {316		require(false, stub_error);317		user;318		dummy = 0;319	}320321	/// Switch permission for minting.322	///323	/// @param mode Enable if "true".324	/// @dev EVM selector for this function is: 0x00018e84,325	///  or in textual repr: setCollectionMintMode(bool)326	function setCollectionMintMode(bool mode) public {327		require(false, stub_error);328		mode;329		dummy = 0;330	}331332	/// Check that account is the owner or admin of the collection333	///334	/// @param user account to verify335	/// @return "true" if account is the owner or admin336	/// @dev EVM selector for this function is: 0x9811b0c7,337	///  or in textual repr: isOwnerOrAdmin(address)338	function isOwnerOrAdmin(address user) public view returns (bool) {339		require(false, stub_error);340		user;341		dummy;342		return false;343	}344345	/// Returns collection type346	///347	/// @return `Fungible` or `NFT` or `ReFungible`348	/// @dev EVM selector for this function is: 0xd34b55b8,349	///  or in textual repr: uniqueCollectionType()350	function uniqueCollectionType() public view returns (string memory) {351		require(false, stub_error);352		dummy;353		return "";354	}355356	/// Get collection owner.357	///358	/// @return Tuble with sponsor address and his substrate mirror.359	/// If address is canonical then substrate mirror is zero and vice versa.360	/// @dev EVM selector for this function is: 0xdf727d3b,361	///  or in textual repr: collectionOwner()362	function collectionOwner() public view returns (Tuple17 memory) {363		require(false, stub_error);364		dummy;365		return Tuple17(0x0000000000000000000000000000000000000000, 0);366	}367368	/// Changes collection owner to another account369	///370	/// @dev Owner can be changed only by current owner371	/// @param newOwner new owner account372	/// @dev EVM selector for this function is: 0x4f53e226,373	///  or in textual repr: changeCollectionOwner(address)374	function changeCollectionOwner(address newOwner) public {375		require(false, stub_error);376		newOwner;377		dummy = 0;378	}379}380381/// @dev anonymous struct382struct Tuple17 {383	address field_0;384	uint256 field_1;385}386387/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension388/// @dev See https://eips.ethereum.org/EIPS/eip-721389/// @dev the ERC-165 identifier for this interface is 0x5b5e139f390contract ERC721Metadata is Dummy, ERC165 {391	// /// @notice A descriptive name for a collection of NFTs in this contract392	// /// @dev real implementation of this function lies in `ERC721UniqueExtensions`393	// /// @dev EVM selector for this function is: 0x06fdde03,394	// ///  or in textual repr: name()395	// function name() public view returns (string memory) {396	// 	require(false, stub_error);397	// 	dummy;398	// 	return "";399	// }400401	// /// @notice An abbreviated name for NFTs in this contract402	// /// @dev real implementation of this function lies in `ERC721UniqueExtensions`403	// /// @dev EVM selector for this function is: 0x95d89b41,404	// ///  or in textual repr: symbol()405	// function symbol() public view returns (string memory) {406	// 	require(false, stub_error);407	// 	dummy;408	// 	return "";409	// }410411	/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.412	///413	/// @dev If the token has a `url` property and it is not empty, it is returned.414	///  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`.415	///  If the collection property `baseURI` is empty or absent, return "" (empty string)416	///  otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix417	///  otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).418	///419	/// @return token's const_metadata420	/// @dev EVM selector for this function is: 0xc87b56dd,421	///  or in textual repr: tokenURI(uint256)422	function tokenURI(uint256 tokenId) public view returns (string memory) {423		require(false, stub_error);424		tokenId;425		dummy;426		return "";427	}428}429430/// @title ERC721 Token that can be irreversibly burned (destroyed).431/// @dev the ERC-165 identifier for this interface is 0x42966c68432contract ERC721Burnable is Dummy, ERC165 {433	/// @notice Burns a specific ERC721 token.434	/// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized435	///  operator of the current owner.436	/// @param tokenId The NFT to approve437	/// @dev EVM selector for this function is: 0x42966c68,438	///  or in textual repr: burn(uint256)439	function burn(uint256 tokenId) public {440		require(false, stub_error);441		tokenId;442		dummy = 0;443	}444}445446/// @dev inlined interface447contract ERC721UniqueMintableEvents {448	event MintingFinished();449}450451/// @title ERC721 minting logic.452/// @dev the ERC-165 identifier for this interface is 0x476ff149453contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {454	/// @dev EVM selector for this function is: 0x05d2035b,455	///  or in textual repr: mintingFinished()456	function mintingFinished() public view returns (bool) {457		require(false, stub_error);458		dummy;459		return false;460	}461462	/// @notice Function to mint token.463	/// @param to The new owner464	/// @return uint256 The id of the newly minted token465	/// @dev EVM selector for this function is: 0x6a627842,466	///  or in textual repr: mint(address)467	function mint(address to) public returns (uint256) {468		require(false, stub_error);469		to;470		dummy = 0;471		return 0;472	}473474	// /// @notice Function to mint token.475	// /// @dev `tokenId` should be obtained with `nextTokenId` method,476	// ///  unlike standard, you can't specify it manually477	// /// @param to The new owner478	// /// @param tokenId ID of the minted NFT479	// /// @dev EVM selector for this function is: 0x40c10f19,480	// ///  or in textual repr: mint(address,uint256)481	// function mint(address to, uint256 tokenId) public returns (bool) {482	// 	require(false, stub_error);483	// 	to;484	// 	tokenId;485	// 	dummy = 0;486	// 	return false;487	// }488489	/// @notice Function to mint token with the given tokenUri.490	/// @param to The new owner491	/// @param tokenUri Token URI that would be stored in the NFT properties492	/// @return uint256 The id of the newly minted token493	/// @dev EVM selector for this function is: 0x45c17782,494	///  or in textual repr: mintWithTokenURI(address,string)495	function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {496		require(false, stub_error);497		to;498		tokenUri;499		dummy = 0;500		return 0;501	}502503	// /// @notice Function to mint token with the given tokenUri.504	// /// @dev `tokenId` should be obtained with `nextTokenId` method,505	// ///  unlike standard, you can't specify it manually506	// /// @param to The new owner507	// /// @param tokenId ID of the minted NFT508	// /// @param tokenUri Token URI that would be stored in the NFT properties509	// /// @dev EVM selector for this function is: 0x50bb4e7f,510	// ///  or in textual repr: mintWithTokenURI(address,uint256,string)511	// function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {512	// 	require(false, stub_error);513	// 	to;514	// 	tokenId;515	// 	tokenUri;516	// 	dummy = 0;517	// 	return false;518	// }519520	/// @dev Not implemented521	/// @dev EVM selector for this function is: 0x7d64bcb4,522	///  or in textual repr: finishMinting()523	function finishMinting() public returns (bool) {524		require(false, stub_error);525		dummy = 0;526		return false;527	}528}529530/// @title Unique extensions for ERC721.531/// @dev the ERC-165 identifier for this interface is 0x4468500d532contract ERC721UniqueExtensions is Dummy, ERC165 {533	/// @notice A descriptive name for a collection of NFTs in this contract534	/// @dev EVM selector for this function is: 0x06fdde03,535	///  or in textual repr: name()536	function name() public view returns (string memory) {537		require(false, stub_error);538		dummy;539		return "";540	}541542	/// @notice An abbreviated name for NFTs in this contract543	/// @dev EVM selector for this function is: 0x95d89b41,544	///  or in textual repr: symbol()545	function symbol() public view returns (string memory) {546		require(false, stub_error);547		dummy;548		return "";549	}550551	/// @notice Transfer ownership of an NFT552	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`553	///  is the zero address. Throws if `tokenId` is not a valid NFT.554	/// @param to The new owner555	/// @param tokenId The NFT to transfer556	/// @dev EVM selector for this function is: 0xa9059cbb,557	///  or in textual repr: transfer(address,uint256)558	function transfer(address to, uint256 tokenId) public {559		require(false, stub_error);560		to;561		tokenId;562		dummy = 0;563	}564565	/// @notice Burns a specific ERC721 token.566	/// @dev Throws unless `msg.sender` is the current owner or an authorized567	///  operator for this NFT. Throws if `from` is not the current owner. Throws568	///  if `to` is the zero address. Throws if `tokenId` is not a valid NFT.569	/// @param from The current owner of the NFT570	/// @param tokenId The NFT to transfer571	/// @dev EVM selector for this function is: 0x79cc6790,572	///  or in textual repr: burnFrom(address,uint256)573	function burnFrom(address from, uint256 tokenId) public {574		require(false, stub_error);575		from;576		tokenId;577		dummy = 0;578	}579580	/// @notice Returns next free NFT ID.581	/// @dev EVM selector for this function is: 0x75794a3c,582	///  or in textual repr: nextTokenId()583	function nextTokenId() public view returns (uint256) {584		require(false, stub_error);585		dummy;586		return 0;587	}588	// /// @notice Function to mint multiple tokens.589	// /// @dev `tokenIds` should be an array of consecutive numbers and first number590	// ///  should be obtained with `nextTokenId` method591	// /// @param to The new owner592	// /// @param tokenIds IDs of the minted NFTs593	// /// @dev EVM selector for this function is: 0x44a9945e,594	// ///  or in textual repr: mintBulk(address,uint256[])595	// function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {596	// 	require(false, stub_error);597	// 	to;598	// 	tokenIds;599	// 	dummy = 0;600	// 	return false;601	// }602603	// /// @notice Function to mint multiple tokens with the given tokenUris.604	// /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive605	// ///  numbers and first number should be obtained with `nextTokenId` method606	// /// @param to The new owner607	// /// @param tokens array of pairs of token ID and token URI for minted tokens608	// /// @dev EVM selector for this function is: 0x36543006,609	// ///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])610	// function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) public returns (bool) {611	// 	require(false, stub_error);612	// 	to;613	// 	tokens;614	// 	dummy = 0;615	// 	return false;616	// }617618}619620/// @dev anonymous struct621struct Tuple6 {622	uint256 field_0;623	string field_1;624}625626/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension627/// @dev See https://eips.ethereum.org/EIPS/eip-721628/// @dev the ERC-165 identifier for this interface is 0x780e9d63629contract ERC721Enumerable is Dummy, ERC165 {630	/// @notice Enumerate valid NFTs631	/// @param index A counter less than `totalSupply()`632	/// @return The token identifier for the `index`th NFT,633	///  (sort order not specified)634	/// @dev EVM selector for this function is: 0x4f6ccce7,635	///  or in textual repr: tokenByIndex(uint256)636	function tokenByIndex(uint256 index) public view returns (uint256) {637		require(false, stub_error);638		index;639		dummy;640		return 0;641	}642643	/// @dev Not implemented644	/// @dev EVM selector for this function is: 0x2f745c59,645	///  or in textual repr: tokenOfOwnerByIndex(address,uint256)646	function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {647		require(false, stub_error);648		owner;649		index;650		dummy;651		return 0;652	}653654	/// @notice Count NFTs tracked by this contract655	/// @return A count of valid NFTs tracked by this contract, where each one of656	///  them has an assigned and queryable owner not equal to the zero address657	/// @dev EVM selector for this function is: 0x18160ddd,658	///  or in textual repr: totalSupply()659	function totalSupply() public view returns (uint256) {660		require(false, stub_error);661		dummy;662		return 0;663	}664}665666/// @dev inlined interface667contract ERC721Events {668	event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);669	event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);670	event ApprovalForAll(address indexed owner, address indexed operator, bool approved);671}672673/// @title ERC-721 Non-Fungible Token Standard674/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md675/// @dev the ERC-165 identifier for this interface is 0x80ac58cd676contract ERC721 is Dummy, ERC165, ERC721Events {677	/// @notice Count all NFTs assigned to an owner678	/// @dev NFTs assigned to the zero address are considered invalid, and this679	///  function throws for queries about the zero address.680	/// @param owner An address for whom to query the balance681	/// @return The number of NFTs owned by `owner`, possibly zero682	/// @dev EVM selector for this function is: 0x70a08231,683	///  or in textual repr: balanceOf(address)684	function balanceOf(address owner) public view returns (uint256) {685		require(false, stub_error);686		owner;687		dummy;688		return 0;689	}690691	/// @notice Find the owner of an NFT692	/// @dev NFTs assigned to zero address are considered invalid, and queries693	///  about them do throw.694	/// @param tokenId The identifier for an NFT695	/// @return The address of the owner of the NFT696	/// @dev EVM selector for this function is: 0x6352211e,697	///  or in textual repr: ownerOf(uint256)698	function ownerOf(uint256 tokenId) public view returns (address) {699		require(false, stub_error);700		tokenId;701		dummy;702		return 0x0000000000000000000000000000000000000000;703	}704705	/// @dev Not implemented706	/// @dev EVM selector for this function is: 0xb88d4fde,707	///  or in textual repr: safeTransferFrom(address,address,uint256,bytes)708	function safeTransferFrom(709		address from,710		address to,711		uint256 tokenId,712		bytes memory data713	) public {714		require(false, stub_error);715		from;716		to;717		tokenId;718		data;719		dummy = 0;720	}721722	/// @dev Not implemented723	/// @dev EVM selector for this function is: 0x42842e0e,724	///  or in textual repr: safeTransferFrom(address,address,uint256)725	function safeTransferFrom(726		address from,727		address to,728		uint256 tokenId729	) public {730		require(false, stub_error);731		from;732		to;733		tokenId;734		dummy = 0;735	}736737	/// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE738	///  TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE739	///  THEY MAY BE PERMANENTLY LOST740	/// @dev Throws unless `msg.sender` is the current owner or an authorized741	///  operator for this NFT. Throws if `from` is not the current owner. Throws742	///  if `to` is the zero address. Throws if `tokenId` is not a valid NFT.743	/// @param from The current owner of the NFT744	/// @param to The new owner745	/// @param tokenId The NFT to transfer746	/// @dev EVM selector for this function is: 0x23b872dd,747	///  or in textual repr: transferFrom(address,address,uint256)748	function transferFrom(749		address from,750		address to,751		uint256 tokenId752	) public {753		require(false, stub_error);754		from;755		to;756		tokenId;757		dummy = 0;758	}759760	/// @notice Set or reaffirm the approved address for an NFT761	/// @dev The zero address indicates there is no approved address.762	/// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized763	///  operator of the current owner.764	/// @param approved The new approved NFT controller765	/// @param tokenId The NFT to approve766	/// @dev EVM selector for this function is: 0x095ea7b3,767	///  or in textual repr: approve(address,uint256)768	function approve(address approved, uint256 tokenId) public {769		require(false, stub_error);770		approved;771		tokenId;772		dummy = 0;773	}774775	/// @dev Not implemented776	/// @dev EVM selector for this function is: 0xa22cb465,777	///  or in textual repr: setApprovalForAll(address,bool)778	function setApprovalForAll(address operator, bool approved) public {779		require(false, stub_error);780		operator;781		approved;782		dummy = 0;783	}784785	/// @dev Not implemented786	/// @dev EVM selector for this function is: 0x081812fc,787	///  or in textual repr: getApproved(uint256)788	function getApproved(uint256 tokenId) public view returns (address) {789		require(false, stub_error);790		tokenId;791		dummy;792		return 0x0000000000000000000000000000000000000000;793	}794795	/// @dev Not implemented796	/// @dev EVM selector for this function is: 0xe985e9c5,797	///  or in textual repr: isApprovedForAll(address,address)798	function isApprovedForAll(address owner, address operator) public view returns (address) {799		require(false, stub_error);800		owner;801		operator;802		dummy;803		return 0x0000000000000000000000000000000000000000;804	}805}806807contract UniqueNFT is808	Dummy,809	ERC165,810	ERC721,811	ERC721Enumerable,812	ERC721UniqueExtensions,813	ERC721UniqueMintable,814	ERC721Burnable,815	ERC721Metadata,816	Collection,817	TokenProperties818{}
after · pallets/nonfungible/src/stubs/UniqueNFT.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/// @title A contract that allows to set and delete token properties and change token property permissions.21/// @dev the ERC-165 identifier for this interface is 0x4136937722contract TokenProperties is Dummy, ERC165 {23	/// @notice Set permissions for token property.24	/// @dev Throws error if `msg.sender` is not admin or owner of the collection.25	/// @param key Property key.26	/// @param isMutable Permission to mutate property.27	/// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.28	/// @param tokenOwner Permission to mutate property by token owner if property is mutable.29	/// @dev EVM selector for this function is: 0x222d97fa,30	///  or in textual repr: setTokenPropertyPermission(string,bool,bool,bool)31	function setTokenPropertyPermission(32		string memory key,33		bool isMutable,34		bool collectionAdmin,35		bool tokenOwner36	) public {37		require(false, stub_error);38		key;39		isMutable;40		collectionAdmin;41		tokenOwner;42		dummy = 0;43	}4445	/// @notice Set token property value.46	/// @dev Throws error if `msg.sender` has no permission to edit the property.47	/// @param tokenId ID of the token.48	/// @param key Property key.49	/// @param value Property value.50	/// @dev EVM selector for this function is: 0x1752d67b,51	///  or in textual repr: setProperty(uint256,string,bytes)52	function setProperty(53		uint256 tokenId,54		string memory key,55		bytes memory value56	) public {57		require(false, stub_error);58		tokenId;59		key;60		value;61		dummy = 0;62	}6364	/// @notice Delete token property value.65	/// @dev Throws error if `msg.sender` has no permission to edit the property.66	/// @param tokenId ID of the token.67	/// @param key Property key.68	/// @dev EVM selector for this function is: 0x066111d1,69	///  or in textual repr: deleteProperty(uint256,string)70	function deleteProperty(uint256 tokenId, string memory key) public {71		require(false, stub_error);72		tokenId;73		key;74		dummy = 0;75	}7677	/// @notice Get token property value.78	/// @dev Throws error if key not found79	/// @param tokenId ID of the token.80	/// @param key Property key.81	/// @return Property value bytes82	/// @dev EVM selector for this function is: 0x7228c327,83	///  or in textual repr: property(uint256,string)84	function property(uint256 tokenId, string memory key) public view returns (bytes memory) {85		require(false, stub_error);86		tokenId;87		key;88		dummy;89		return hex"";90	}91}9293/// @title A contract that allows you to work with collections.94/// @dev the ERC-165 identifier for this interface is 0x3af103fb95contract Collection is Dummy, ERC165 {96	/// Set collection property.97	///98	/// @param key Property key.99	/// @param value Propery value.100	/// @dev EVM selector for this function is: 0x2f073f66,101	///  or in textual repr: setCollectionProperty(string,bytes)102	function setCollectionProperty(string memory key, bytes memory value) public {103		require(false, stub_error);104		key;105		value;106		dummy = 0;107	}108109	/// Delete collection property.110	///111	/// @param key Property key.112	/// @dev EVM selector for this function is: 0x7b7debce,113	///  or in textual repr: deleteCollectionProperty(string)114	function deleteCollectionProperty(string memory key) public {115		require(false, stub_error);116		key;117		dummy = 0;118	}119120	/// Get collection property.121	///122	/// @dev Throws error if key not found.123	///124	/// @param key Property key.125	/// @return bytes The property corresponding to the key.126	/// @dev EVM selector for this function is: 0xcf24fd6d,127	///  or in textual repr: collectionProperty(string)128	function collectionProperty(string memory key) public view returns (bytes memory) {129		require(false, stub_error);130		key;131		dummy;132		return hex"";133	}134135	/// Set the sponsor of the collection.136	///137	/// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.138	///139	/// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.140	/// @dev EVM selector for this function is: 0x7623402e,141	///  or in textual repr: setCollectionSponsor(address)142	function setCollectionSponsor(address sponsor) public {143		require(false, stub_error);144		sponsor;145		dummy = 0;146	}147148	/// Whether there is a pending sponsor.149	/// @dev EVM selector for this function is: 0x058ac185,150	///  or in textual repr: hasCollectionPendingSponsor()151	function hasCollectionPendingSponsor() public view returns (bool) {152		require(false, stub_error);153		dummy;154		return false;155	}156157	/// Collection sponsorship confirmation.158	///159	/// @dev After setting the sponsor for the collection, it must be confirmed with this function.160	/// @dev EVM selector for this function is: 0x3c50e97a,161	///  or in textual repr: confirmCollectionSponsorship()162	function confirmCollectionSponsorship() public {163		require(false, stub_error);164		dummy = 0;165	}166167	/// Remove collection sponsor.168	/// @dev EVM selector for this function is: 0x6e0326a3,169	///  or in textual repr: removeCollectionSponsor()170	function removeCollectionSponsor() public {171		require(false, stub_error);172		dummy = 0;173	}174175	/// Get current sponsor.176	///177	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.178	/// @dev EVM selector for this function is: 0x6ec0a9f1,179	///  or in textual repr: collectionSponsor()180	function collectionSponsor() public view returns (Tuple17 memory) {181		require(false, stub_error);182		dummy;183		return Tuple17(0x0000000000000000000000000000000000000000, 0);184	}185186	/// Set limits for the collection.187	/// @dev Throws error if limit not found.188	/// @param limit Name of the limit. Valid names:189	/// 	"accountTokenOwnershipLimit",190	/// 	"sponsoredDataSize",191	/// 	"sponsoredDataRateLimit",192	/// 	"tokenLimit",193	/// 	"sponsorTransferTimeout",194	/// 	"sponsorApproveTimeout"195	/// @param value Value of the limit.196	/// @dev EVM selector for this function is: 0x6a3841db,197	///  or in textual repr: setCollectionLimit(string,uint32)198	function setCollectionLimit(string memory limit, uint32 value) public {199		require(false, stub_error);200		limit;201		value;202		dummy = 0;203	}204205	/// Set limits for the collection.206	/// @dev Throws error if limit not found.207	/// @param limit Name of the limit. Valid names:208	/// 	"ownerCanTransfer",209	/// 	"ownerCanDestroy",210	/// 	"transfersEnabled"211	/// @param value Value of the limit.212	/// @dev EVM selector for this function is: 0x993b7fba,213	///  or in textual repr: setCollectionLimit(string,bool)214	function setCollectionLimit(string memory limit, bool value) public {215		require(false, stub_error);216		limit;217		value;218		dummy = 0;219	}220221	/// Get contract address.222	/// @dev EVM selector for this function is: 0xf6b4dfb4,223	///  or in textual repr: contractAddress()224	function contractAddress() public view returns (address) {225		require(false, stub_error);226		dummy;227		return 0x0000000000000000000000000000000000000000;228	}229230	/// Add collection admin.231	/// @param newAdmin Address of the added administrator.232	/// @dev EVM selector for this function is: 0x92e462c7,233	///  or in textual repr: addCollectionAdmin(address)234	function addCollectionAdmin(address newAdmin) public {235		require(false, stub_error);236		newAdmin;237		dummy = 0;238	}239240	/// Remove collection admin.241	///242	/// @param admin Address of the removed administrator.243	/// @dev EVM selector for this function is: 0xfafd7b42,244	///  or in textual repr: removeCollectionAdmin(address)245	function removeCollectionAdmin(address admin) public {246		require(false, stub_error);247		admin;248		dummy = 0;249	}250251	/// Toggle accessibility of collection nesting.252	///253	/// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'254	/// @dev EVM selector for this function is: 0x112d4586,255	///  or in textual repr: setCollectionNesting(bool)256	function setCollectionNesting(bool enable) public {257		require(false, stub_error);258		enable;259		dummy = 0;260	}261262	/// Toggle accessibility of collection nesting.263	///264	/// @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'265	/// @param collections Addresses of collections that will be available for nesting.266	/// @dev EVM selector for this function is: 0x64872396,267	///  or in textual repr: setCollectionNesting(bool,address[])268	function setCollectionNesting(bool enable, address[] memory collections) public {269		require(false, stub_error);270		enable;271		collections;272		dummy = 0;273	}274275	/// Set the collection access method.276	/// @param mode Access mode277	/// 	0 for Normal278	/// 	1 for AllowList279	/// @dev EVM selector for this function is: 0x41835d4c,280	///  or in textual repr: setCollectionAccess(uint8)281	function setCollectionAccess(uint8 mode) public {282		require(false, stub_error);283		mode;284		dummy = 0;285	}286287	/// Checks that user allowed to operate with collection.288	///289	/// @param user User address to check.290	/// @dev EVM selector for this function is: 0xd63a8e11,291	///  or in textual repr: allowed(address)292	function allowed(address user) public view returns (bool) {293		require(false, stub_error);294		user;295		dummy;296		return false;297	}298299	/// Add the user to the allowed list.300	///301	/// @param user Address of a trusted user.302	/// @dev EVM selector for this function is: 0x67844fe6,303	///  or in textual repr: addToCollectionAllowList(address)304	function addToCollectionAllowList(address user) public {305		require(false, stub_error);306		user;307		dummy = 0;308	}309310	/// Remove the user from the allowed list.311	///312	/// @param user Address of a removed user.313	/// @dev EVM selector for this function is: 0x85c51acb,314	///  or in textual repr: removeFromCollectionAllowList(address)315	function removeFromCollectionAllowList(address user) public {316		require(false, stub_error);317		user;318		dummy = 0;319	}320321	/// Switch permission for minting.322	///323	/// @param mode Enable if "true".324	/// @dev EVM selector for this function is: 0x00018e84,325	///  or in textual repr: setCollectionMintMode(bool)326	function setCollectionMintMode(bool mode) public {327		require(false, stub_error);328		mode;329		dummy = 0;330	}331332	/// Check that account is the owner or admin of the collection333	///334	/// @param user account to verify335	/// @return "true" if account is the owner or admin336	/// @dev EVM selector for this function is: 0x9811b0c7,337	///  or in textual repr: isOwnerOrAdmin(address)338	function isOwnerOrAdmin(address user) public view returns (bool) {339		require(false, stub_error);340		user;341		dummy;342		return false;343	}344345	/// Returns collection type346	///347	/// @return `Fungible` or `NFT` or `ReFungible`348	/// @dev EVM selector for this function is: 0xd34b55b8,349	///  or in textual repr: uniqueCollectionType()350	function uniqueCollectionType() public view returns (string memory) {351		require(false, stub_error);352		dummy;353		return "";354	}355356	/// Get collection owner.357	///358	/// @return Tuple with sponsor address and his substrate mirror.359	/// If address is canonical then substrate mirror is zero and vice versa.360	/// @dev EVM selector for this function is: 0xdf727d3b,361	///  or in textual repr: collectionOwner()362	function collectionOwner() public view returns (Tuple17 memory) {363		require(false, stub_error);364		dummy;365		return Tuple17(0x0000000000000000000000000000000000000000, 0);366	}367368	/// Changes collection owner to another account369	///370	/// @dev Owner can be changed only by current owner371	/// @param newOwner new owner account372	/// @dev EVM selector for this function is: 0x4f53e226,373	///  or in textual repr: changeCollectionOwner(address)374	function changeCollectionOwner(address newOwner) public {375		require(false, stub_error);376		newOwner;377		dummy = 0;378	}379380	/// Get collection administrators381	///382	/// @return Vector of tuples with admins address and his substrate mirror.383	/// If address is canonical then substrate mirror is zero and vice versa.384	/// @dev EVM selector for this function is: 0x5813216b,385	///  or in textual repr: collectionAdmins()386	function collectionAdmins() public view returns (Tuple17[] memory) {387		require(false, stub_error);388		dummy;389		return new Tuple17[](0);390	}391}392393/// @dev anonymous struct394struct Tuple17 {395	address field_0;396	uint256 field_1;397}398399/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension400/// @dev See https://eips.ethereum.org/EIPS/eip-721401/// @dev the ERC-165 identifier for this interface is 0x5b5e139f402contract ERC721Metadata is Dummy, ERC165 {403	// /// @notice A descriptive name for a collection of NFTs in this contract404	// /// @dev real implementation of this function lies in `ERC721UniqueExtensions`405	// /// @dev EVM selector for this function is: 0x06fdde03,406	// ///  or in textual repr: name()407	// function name() public view returns (string memory) {408	// 	require(false, stub_error);409	// 	dummy;410	// 	return "";411	// }412413	// /// @notice An abbreviated name for NFTs in this contract414	// /// @dev real implementation of this function lies in `ERC721UniqueExtensions`415	// /// @dev EVM selector for this function is: 0x95d89b41,416	// ///  or in textual repr: symbol()417	// function symbol() public view returns (string memory) {418	// 	require(false, stub_error);419	// 	dummy;420	// 	return "";421	// }422423	/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.424	///425	/// @dev If the token has a `url` property and it is not empty, it is returned.426	///  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`.427	///  If the collection property `baseURI` is empty or absent, return "" (empty string)428	///  otherwise, if token property `suffix` present and is non-empty, return concatenation of baseURI and suffix429	///  otherwise, return concatenation of `baseURI` and stringified token id (decimal stringifying, without paddings).430	///431	/// @return token's const_metadata432	/// @dev EVM selector for this function is: 0xc87b56dd,433	///  or in textual repr: tokenURI(uint256)434	function tokenURI(uint256 tokenId) public view returns (string memory) {435		require(false, stub_error);436		tokenId;437		dummy;438		return "";439	}440}441442/// @title ERC721 Token that can be irreversibly burned (destroyed).443/// @dev the ERC-165 identifier for this interface is 0x42966c68444contract ERC721Burnable is Dummy, ERC165 {445	/// @notice Burns a specific ERC721 token.446	/// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized447	///  operator of the current owner.448	/// @param tokenId The NFT to approve449	/// @dev EVM selector for this function is: 0x42966c68,450	///  or in textual repr: burn(uint256)451	function burn(uint256 tokenId) public {452		require(false, stub_error);453		tokenId;454		dummy = 0;455	}456}457458/// @dev inlined interface459contract ERC721UniqueMintableEvents {460	event MintingFinished();461}462463/// @title ERC721 minting logic.464/// @dev the ERC-165 identifier for this interface is 0x476ff149465contract ERC721UniqueMintable is Dummy, ERC165, ERC721UniqueMintableEvents {466	/// @dev EVM selector for this function is: 0x05d2035b,467	///  or in textual repr: mintingFinished()468	function mintingFinished() public view returns (bool) {469		require(false, stub_error);470		dummy;471		return false;472	}473474	/// @notice Function to mint token.475	/// @param to The new owner476	/// @return uint256 The id of the newly minted token477	/// @dev EVM selector for this function is: 0x6a627842,478	///  or in textual repr: mint(address)479	function mint(address to) public returns (uint256) {480		require(false, stub_error);481		to;482		dummy = 0;483		return 0;484	}485486	// /// @notice Function to mint token.487	// /// @dev `tokenId` should be obtained with `nextTokenId` method,488	// ///  unlike standard, you can't specify it manually489	// /// @param to The new owner490	// /// @param tokenId ID of the minted NFT491	// /// @dev EVM selector for this function is: 0x40c10f19,492	// ///  or in textual repr: mint(address,uint256)493	// function mint(address to, uint256 tokenId) public returns (bool) {494	// 	require(false, stub_error);495	// 	to;496	// 	tokenId;497	// 	dummy = 0;498	// 	return false;499	// }500501	/// @notice Function to mint token with the given tokenUri.502	/// @param to The new owner503	/// @param tokenUri Token URI that would be stored in the NFT properties504	/// @return uint256 The id of the newly minted token505	/// @dev EVM selector for this function is: 0x45c17782,506	///  or in textual repr: mintWithTokenURI(address,string)507	function mintWithTokenURI(address to, string memory tokenUri) public returns (uint256) {508		require(false, stub_error);509		to;510		tokenUri;511		dummy = 0;512		return 0;513	}514515	// /// @notice Function to mint token with the given tokenUri.516	// /// @dev `tokenId` should be obtained with `nextTokenId` method,517	// ///  unlike standard, you can't specify it manually518	// /// @param to The new owner519	// /// @param tokenId ID of the minted NFT520	// /// @param tokenUri Token URI that would be stored in the NFT properties521	// /// @dev EVM selector for this function is: 0x50bb4e7f,522	// ///  or in textual repr: mintWithTokenURI(address,uint256,string)523	// function mintWithTokenURI(address to, uint256 tokenId, string memory tokenUri) public returns (bool) {524	// 	require(false, stub_error);525	// 	to;526	// 	tokenId;527	// 	tokenUri;528	// 	dummy = 0;529	// 	return false;530	// }531532	/// @dev Not implemented533	/// @dev EVM selector for this function is: 0x7d64bcb4,534	///  or in textual repr: finishMinting()535	function finishMinting() public returns (bool) {536		require(false, stub_error);537		dummy = 0;538		return false;539	}540}541542/// @title Unique extensions for ERC721.543/// @dev the ERC-165 identifier for this interface is 0x4468500d544contract ERC721UniqueExtensions is Dummy, ERC165 {545	/// @notice A descriptive name for a collection of NFTs in this contract546	/// @dev EVM selector for this function is: 0x06fdde03,547	///  or in textual repr: name()548	function name() public view returns (string memory) {549		require(false, stub_error);550		dummy;551		return "";552	}553554	/// @notice An abbreviated name for NFTs in this contract555	/// @dev EVM selector for this function is: 0x95d89b41,556	///  or in textual repr: symbol()557	function symbol() public view returns (string memory) {558		require(false, stub_error);559		dummy;560		return "";561	}562563	/// @notice Transfer ownership of an NFT564	/// @dev Throws unless `msg.sender` is the current owner. Throws if `to`565	///  is the zero address. Throws if `tokenId` is not a valid NFT.566	/// @param to The new owner567	/// @param tokenId The NFT to transfer568	/// @dev EVM selector for this function is: 0xa9059cbb,569	///  or in textual repr: transfer(address,uint256)570	function transfer(address to, uint256 tokenId) public {571		require(false, stub_error);572		to;573		tokenId;574		dummy = 0;575	}576577	/// @notice Burns a specific ERC721 token.578	/// @dev Throws unless `msg.sender` is the current owner or an authorized579	///  operator for this NFT. Throws if `from` is not the current owner. Throws580	///  if `to` is the zero address. Throws if `tokenId` is not a valid NFT.581	/// @param from The current owner of the NFT582	/// @param tokenId The NFT to transfer583	/// @dev EVM selector for this function is: 0x79cc6790,584	///  or in textual repr: burnFrom(address,uint256)585	function burnFrom(address from, uint256 tokenId) public {586		require(false, stub_error);587		from;588		tokenId;589		dummy = 0;590	}591592	/// @notice Returns next free NFT ID.593	/// @dev EVM selector for this function is: 0x75794a3c,594	///  or in textual repr: nextTokenId()595	function nextTokenId() public view returns (uint256) {596		require(false, stub_error);597		dummy;598		return 0;599	}600	// /// @notice Function to mint multiple tokens.601	// /// @dev `tokenIds` should be an array of consecutive numbers and first number602	// ///  should be obtained with `nextTokenId` method603	// /// @param to The new owner604	// /// @param tokenIds IDs of the minted NFTs605	// /// @dev EVM selector for this function is: 0x44a9945e,606	// ///  or in textual repr: mintBulk(address,uint256[])607	// function mintBulk(address to, uint256[] memory tokenIds) public returns (bool) {608	// 	require(false, stub_error);609	// 	to;610	// 	tokenIds;611	// 	dummy = 0;612	// 	return false;613	// }614615	// /// @notice Function to mint multiple tokens with the given tokenUris.616	// /// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive617	// ///  numbers and first number should be obtained with `nextTokenId` method618	// /// @param to The new owner619	// /// @param tokens array of pairs of token ID and token URI for minted tokens620	// /// @dev EVM selector for this function is: 0x36543006,621	// ///  or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])622	// function mintBulkWithTokenURI(address to, Tuple6[] memory tokens) public returns (bool) {623	// 	require(false, stub_error);624	// 	to;625	// 	tokens;626	// 	dummy = 0;627	// 	return false;628	// }629630}631632/// @dev anonymous struct633struct Tuple6 {634	uint256 field_0;635	string field_1;636}637638/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension639/// @dev See https://eips.ethereum.org/EIPS/eip-721640/// @dev the ERC-165 identifier for this interface is 0x780e9d63641contract ERC721Enumerable is Dummy, ERC165 {642	/// @notice Enumerate valid NFTs643	/// @param index A counter less than `totalSupply()`644	/// @return The token identifier for the `index`th NFT,645	///  (sort order not specified)646	/// @dev EVM selector for this function is: 0x4f6ccce7,647	///  or in textual repr: tokenByIndex(uint256)648	function tokenByIndex(uint256 index) public view returns (uint256) {649		require(false, stub_error);650		index;651		dummy;652		return 0;653	}654655	/// @dev Not implemented656	/// @dev EVM selector for this function is: 0x2f745c59,657	///  or in textual repr: tokenOfOwnerByIndex(address,uint256)658	function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {659		require(false, stub_error);660		owner;661		index;662		dummy;663		return 0;664	}665666	/// @notice Count NFTs tracked by this contract667	/// @return A count of valid NFTs tracked by this contract, where each one of668	///  them has an assigned and queryable owner not equal to the zero address669	/// @dev EVM selector for this function is: 0x18160ddd,670	///  or in textual repr: totalSupply()671	function totalSupply() public view returns (uint256) {672		require(false, stub_error);673		dummy;674		return 0;675	}676}677678/// @dev inlined interface679contract ERC721Events {680	event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);681	event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);682	event ApprovalForAll(address indexed owner, address indexed operator, bool approved);683}684685/// @title ERC-721 Non-Fungible Token Standard686/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md687/// @dev the ERC-165 identifier for this interface is 0x80ac58cd688contract ERC721 is Dummy, ERC165, ERC721Events {689	/// @notice Count all NFTs assigned to an owner690	/// @dev NFTs assigned to the zero address are considered invalid, and this691	///  function throws for queries about the zero address.692	/// @param owner An address for whom to query the balance693	/// @return The number of NFTs owned by `owner`, possibly zero694	/// @dev EVM selector for this function is: 0x70a08231,695	///  or in textual repr: balanceOf(address)696	function balanceOf(address owner) public view returns (uint256) {697		require(false, stub_error);698		owner;699		dummy;700		return 0;701	}702703	/// @notice Find the owner of an NFT704	/// @dev NFTs assigned to zero address are considered invalid, and queries705	///  about them do throw.706	/// @param tokenId The identifier for an NFT707	/// @return The address of the owner of the NFT708	/// @dev EVM selector for this function is: 0x6352211e,709	///  or in textual repr: ownerOf(uint256)710	function ownerOf(uint256 tokenId) public view returns (address) {711		require(false, stub_error);712		tokenId;713		dummy;714		return 0x0000000000000000000000000000000000000000;715	}716717	/// @dev Not implemented718	/// @dev EVM selector for this function is: 0xb88d4fde,719	///  or in textual repr: safeTransferFrom(address,address,uint256,bytes)720	function safeTransferFrom(721		address from,722		address to,723		uint256 tokenId,724		bytes memory data725	) public {726		require(false, stub_error);727		from;728		to;729		tokenId;730		data;731		dummy = 0;732	}733734	/// @dev Not implemented735	/// @dev EVM selector for this function is: 0x42842e0e,736	///  or in textual repr: safeTransferFrom(address,address,uint256)737	function safeTransferFrom(738		address from,739		address to,740		uint256 tokenId741	) public {742		require(false, stub_error);743		from;744		to;745		tokenId;746		dummy = 0;747	}748749	/// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE750	///  TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE751	///  THEY MAY BE PERMANENTLY LOST752	/// @dev Throws unless `msg.sender` is the current owner or an authorized753	///  operator for this NFT. Throws if `from` is not the current owner. Throws754	///  if `to` is the zero address. Throws if `tokenId` is not a valid NFT.755	/// @param from The current owner of the NFT756	/// @param to The new owner757	/// @param tokenId The NFT to transfer758	/// @dev EVM selector for this function is: 0x23b872dd,759	///  or in textual repr: transferFrom(address,address,uint256)760	function transferFrom(761		address from,762		address to,763		uint256 tokenId764	) public {765		require(false, stub_error);766		from;767		to;768		tokenId;769		dummy = 0;770	}771772	/// @notice Set or reaffirm the approved address for an NFT773	/// @dev The zero address indicates there is no approved address.774	/// @dev Throws unless `msg.sender` is the current NFT owner, or an authorized775	///  operator of the current owner.776	/// @param approved The new approved NFT controller777	/// @param tokenId The NFT to approve778	/// @dev EVM selector for this function is: 0x095ea7b3,779	///  or in textual repr: approve(address,uint256)780	function approve(address approved, uint256 tokenId) public {781		require(false, stub_error);782		approved;783		tokenId;784		dummy = 0;785	}786787	/// @dev Not implemented788	/// @dev EVM selector for this function is: 0xa22cb465,789	///  or in textual repr: setApprovalForAll(address,bool)790	function setApprovalForAll(address operator, bool approved) public {791		require(false, stub_error);792		operator;793		approved;794		dummy = 0;795	}796797	/// @dev Not implemented798	/// @dev EVM selector for this function is: 0x081812fc,799	///  or in textual repr: getApproved(uint256)800	function getApproved(uint256 tokenId) public view returns (address) {801		require(false, stub_error);802		tokenId;803		dummy;804		return 0x0000000000000000000000000000000000000000;805	}806807	/// @dev Not implemented808	/// @dev EVM selector for this function is: 0xe985e9c5,809	///  or in textual repr: isApprovedForAll(address,address)810	function isApprovedForAll(address owner, address operator) public view returns (address) {811		require(false, stub_error);812		owner;813		operator;814		dummy;815		return 0x0000000000000000000000000000000000000000;816	}817}818819contract UniqueNFT is820	Dummy,821	ERC165,822	ERC721,823	ERC721Enumerable,824	ERC721UniqueExtensions,825	ERC721UniqueMintable,826	ERC721Burnable,827	ERC721Metadata,828	Collection,829	TokenProperties830{}
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -91,7 +91,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0x3af103fb
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -355,7 +355,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
@@ -376,6 +376,18 @@
 		newOwner;
 		dummy = 0;
 	}
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() public view returns (Tuple17[] memory) {
+		require(false, stub_error);
+		dummy;
+		return new Tuple17[](0);
+	}
 }
 
 /// @dev anonymous struct
modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

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

binary blob — no preview

modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -13,7 +13,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0x3af103fb
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -184,7 +184,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
@@ -197,6 +197,14 @@
 	/// @dev EVM selector for this function is: 0x4f53e226,
 	///  or in textual repr: changeCollectionOwner(address)
 	function changeCollectionOwner(address newOwner) external;
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() external view returns (Tuple6[] memory);
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x63034ac5
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -62,7 +62,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0x3af103fb
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -233,7 +233,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
@@ -246,6 +246,14 @@
 	/// @dev EVM selector for this function is: 0x4f53e226,
 	///  or in textual repr: changeCollectionOwner(address)
 	function changeCollectionOwner(address newOwner) external;
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() external view returns (Tuple17[] memory);
 }
 
 /// @dev anonymous struct
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -62,7 +62,7 @@
 }
 
 /// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0x62e22290
+/// @dev the ERC-165 identifier for this interface is 0x3af103fb
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -233,7 +233,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuble with sponsor address and his substrate mirror.
+	/// @return Tuple with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
@@ -246,6 +246,14 @@
 	/// @dev EVM selector for this function is: 0x4f53e226,
 	///  or in textual repr: changeCollectionOwner(address)
 	function changeCollectionOwner(address newOwner) external;
+
+	/// Get collection administrators
+	///
+	/// @return Vector of tuples with admins address and his substrate mirror.
+	/// If address is canonical then substrate mirror is zero and vice versa.
+	/// @dev EVM selector for this function is: 0x5813216b,
+	///  or in textual repr: collectionAdmins()
+	function collectionAdmins() external view returns (Tuple17[] memory);
 }
 
 /// @dev anonymous struct
modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -14,6 +14,7 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 import {IKeyringPair} from '@polkadot/types/types';
+import {IEthCrossAccountId} from '../util/playgrounds/types';
 import {usingEthPlaygrounds, itEth, expect, EthUniqueHelper} from './util';
 
 async function recordEthFee(helper: EthUniqueHelper, userAddress: string, call: () => Promise<any>) {
@@ -68,11 +69,31 @@
 
     const newAdmin = helper.eth.createAccount();
     const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+  
     expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.false;
     await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
     expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.true;
   });
+  
+  itEth.skip('Check adminlist', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+        
+    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+    
+    const admin1 = helper.eth.createAccount();
+    const [admin2] = await helper.arrange.createAccounts([10n], donor);
+    await collectionEvm.methods.addCollectionAdmin(admin1).send();
+    await collectionEvm.methods.addCollectionAdminSubstrate(admin2.addressRaw).send();
 
+    const adminListRpc = await helper.collection.getAdmins(collectionId);
+    let adminListEth = await collectionEvm.methods.collectionAdmins().call();
+    adminListEth = adminListEth.map((element: IEthCrossAccountId) => {
+      return helper.address.convertCrossAccountFromEthCrossAcoount(element);
+    });
+    expect(adminListRpc).to.be.like(adminListEth);
+  });  
+    
   itEth('(!negative tests!) Add admin by ADMIN is not allowed', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/fungibleAbi.json
+++ b/tests/src/eth/fungibleAbi.json
@@ -126,6 +126,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionAdmins",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple6[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "collectionOwner",
     "outputs": [
       {
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -156,6 +156,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionAdmins",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple17[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "collectionOwner",
     "outputs": [
       {
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/reFungibleAbi.json
+++ b/tests/src/eth/reFungibleAbi.json
@@ -156,6 +156,23 @@
   },
   {
     "inputs": [],
+    "name": "collectionAdmins",
+    "outputs": [
+      {
+        "components": [
+          { "internalType": "address", "name": "field_0", "type": "address" },
+          { "internalType": "uint256", "name": "field_1", "type": "uint256" }
+        ],
+        "internalType": "struct Tuple17[]",
+        "name": "",
+        "type": "tuple[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
     "name": "collectionOwner",
     "outputs": [
       {
modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -70,6 +70,13 @@
   ethereum?: TEthereumAccount;
 }
 
+export interface IEthCrossAccountId {
+  0: TEthereumAccount;
+  1: TSubstrateAccount;
+  field_0: TEthereumAccount;
+  field_1: TSubstrateAccount;
+}
+
 export interface ICollectionLimits {
   accountTokenOwnershipLimit?: number | null;
   sponsoredDataSize?: number | null;
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -7,9 +7,11 @@
 
 import {ApiPromise, WsProvider, Keyring} from '@polkadot/api';
 import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';
-import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';
+import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm, base58Encode, blake2AsU8a} from '@polkadot/util-crypto';
 import {IKeyringPair} from '@polkadot/types/types';
-import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISchedulerOptions, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, IForeignAssetMetadata, TNetworks, MoonbeamAssetInfo, DemocracyStandardAccountVote, AcalaAssetMetadata} from './types';
+import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISchedulerOptions, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, IForeignAssetMetadata, TNetworks, MoonbeamAssetInfo, DemocracyStandardAccountVote, AcalaAssetMetadata, IEthCrossAccountId} from './types';
+import {hexToU8a} from '@polkadot/util/hex';
+import {u8aConcat} from '@polkadot/util/u8a';
 
 export class CrossAccountId implements ICrossAccountId {
   Substrate?: TSubstrateAccount;
@@ -2309,6 +2311,73 @@
 
     return siblingPrefix + encodedParaId + suffix;
   }
+
+  /**
+   * Encode key to substrate address
+   * @param key key for encoding address
+   * @param ss58Format prefix for encoding to the address of the corresponding network
+   * @returns encoded substrate address
+   */
+  encodeSubstrateAddress (key: Uint8Array | string | bigint, ss58Format = 42): string {
+    const u8a :Uint8Array = typeof key === 'string'
+      ? hexToU8a(key)
+      : typeof key === 'bigint'
+        ? hexToU8a(key.toString(16))
+        : key;
+  
+    if (ss58Format < 0 || ss58Format > 16383 || [46, 47].includes(ss58Format)) {
+      throw new Error(`ss58Format is not valid, received ${typeof ss58Format} "${ss58Format}"`);
+    }
+  
+    const allowedDecodedLengths = [1, 2, 4, 8, 32, 33];
+    if (!allowedDecodedLengths.includes(u8a.length)) {
+      throw new Error(`key length is not valid, received ${u8a.length}, valid values are ${allowedDecodedLengths.join(', ')}`);
+    }
+  
+    const u8aPrefix = ss58Format < 64
+      ? new Uint8Array([ss58Format])
+      : new Uint8Array([
+        ((ss58Format & 0xfc) >> 2) | 0x40,
+        (ss58Format >> 8) | ((ss58Format & 0x03) << 6),
+      ]);
+
+    const input = u8aConcat(u8aPrefix, u8a);
+  
+    return base58Encode(u8aConcat(
+      input,
+      blake2AsU8a(input).subarray(0, [32, 33].includes(u8a.length) ? 2 : 1),
+    ));
+  }
+
+  /**
+   * Restore substrate address from bigint representation
+   * @param number decimal representation of substrate address
+   * @returns substrate address
+   */
+  restoreCrossAccountFromBigInt(number: bigint): TSubstrateAccount {
+    if (this.helper.api === null) {
+      throw 'Not connected';
+    }
+    const res = this.helper.api.registry.createType('AccountId', '0x' + number.toString(16).padStart(64, '0')).toJSON();
+    if (res === undefined || res === null) {
+      throw 'Restore address error';
+    }
+    return res.toString();
+  }
+
+  /**
+   * Convert etherium cross account id to substrate cross account id
+   * @param ethCrossAccount etherium cross account
+   * @returns substrate cross account id
+   */
+  convertCrossAccountFromEthCrossAcoount(ethCrossAccount: IEthCrossAccountId): ICrossAccountId {
+    if (ethCrossAccount.field_1 === '0') {
+      return {Ethereum: ethCrossAccount.field_0.toLocaleLowerCase()};
+    }
+    
+    const ss58 = this.restoreCrossAccountFromBigInt(BigInt(ethCrossAccount.field_1));
+    return {Substrate: ss58};
+  }
 }
 
 class StakingGroup extends HelperGroup<UniqueHelper> {