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

difftreelog

CORE-386 Fix after rebase

Trubnikov Sergey2022-06-09parent: #7b97719.patch.diff
in: master

6 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -21,7 +21,6 @@
 };
 pub use pallet_evm::{PrecompileOutput, PrecompileResult, PrecompileHandle, account::CrossAccountId};
 use pallet_evm_coder_substrate::dispatch_to_evm;
-use sp_core::{H160, U256};
 use sp_std::vec::Vec;
 use up_data_structs::{Property, SponsoringRateLimit, NestingRule, OwnerRestrictedSet, AccessMode};
 use alloc::format;
@@ -290,7 +289,11 @@
 	Ok(caller)
 }
 
-fn save<T: Config>(collection: &CollectionHandle<T>) {
+fn save<T: Config>(collection: &CollectionHandle<T>) -> Result<void> {
+	// TODO possibly delete for the lack of transaction
+	collection
+		.check_is_internal()
+		.map_err(dispatch_to_evm::<T>)?;
 	<crate::CollectionById<T>>::insert(collection.id, collection.collection.clone());
 	Ok(())
 }
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1133,7 +1133,6 @@
 		user: &T::CrossAccountId,
 		admin: bool,
 	) -> DispatchResult {
-		collection.check_is_mutable()?;
 		collection.check_is_owner(sender)?;
 
 		let was_admin = <IsAdmin<T>>::get((collection.id, user));
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
@@ -51,6 +51,147 @@
 	event MintingFinished();
 }
 
+// Selector: 2da6e59e
+contract Collection is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		public
+	{
+		require(false, stub_error);
+		key;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) public {
+		require(false, stub_error);
+		key;
+		dummy = 0;
+	}
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		public
+		view
+		returns (bytes memory)
+	{
+		require(false, stub_error);
+		key;
+		dummy;
+		return hex"";
+	}
+
+	// Selector: setCollectionSponsor(address) 7623402e
+	function setCollectionSponsor(address sponsor) public {
+		require(false, stub_error);
+		sponsor;
+		dummy = 0;
+	}
+
+	// Selector: confirmCollectionSponsorship() 3c50e97a
+	function confirmCollectionSponsorship() public {
+		require(false, stub_error);
+		dummy = 0;
+	}
+
+	// Selector: setCollectionLimit(string,uint32) 6a3841db
+	function setCollectionLimit(string memory limit, uint32 value) public {
+		require(false, stub_error);
+		limit;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: setCollectionLimit(string,bool) 993b7fba
+	function setCollectionLimit(string memory limit, bool value) public {
+		require(false, stub_error);
+		limit;
+		value;
+		dummy = 0;
+	}
+
+	// Selector: contractAddress() f6b4dfb4
+	function contractAddress() public view returns (address) {
+		require(false, stub_error);
+		dummy;
+		return 0x0000000000000000000000000000000000000000;
+	}
+
+	// Selector: addCollectionAdminSubstrate(uint256) 5730062b
+	function addCollectionAdminSubstrate(uint256 newAdmin) public view {
+		require(false, stub_error);
+		newAdmin;
+		dummy;
+	}
+
+	// Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
+	function removeCollectionAdminSubstrate(uint256 newAdmin) public view {
+		require(false, stub_error);
+		newAdmin;
+		dummy;
+	}
+
+	// Selector: addCollectionAdmin(address) 92e462c7
+	function addCollectionAdmin(address newAdmin) public view {
+		require(false, stub_error);
+		newAdmin;
+		dummy;
+	}
+
+	// Selector: removeAdmin(address) 1785f53c
+	function removeAdmin(address admin) public view {
+		require(false, stub_error);
+		admin;
+		dummy;
+	}
+
+	// Selector: setNesting(bool) e8fc50dd
+	function setNesting(bool enable) public {
+		require(false, stub_error);
+		enable;
+		dummy = 0;
+	}
+
+	// Selector: setNesting(bool,address[]) 7df12a9a
+	function setNesting(bool enable, address[] memory collections) public {
+		require(false, stub_error);
+		enable;
+		collections;
+		dummy = 0;
+	}
+
+	// Selector: setCollectionAccess(uint8) 41835d4c
+	function setCollectionAccess(uint8 mode) public {
+		require(false, stub_error);
+		mode;
+		dummy = 0;
+	}
+
+	// Selector: addToCollectionAllowList(address) 67844fe6
+	function addToCollectionAllowList(address user) public view {
+		require(false, stub_error);
+		user;
+		dummy;
+	}
+
+	// Selector: removeFromCollectionAllowList(address) 85c51acb
+	function removeFromCollectionAllowList(address user) public view {
+		require(false, stub_error);
+		user;
+		dummy;
+	}
+
+	// Selector: setMintMode(bool) 5dea9bd5
+	function setMintMode(bool mode) public {
+		require(false, stub_error);
+		mode;
+		dummy = 0;
+	}
+}
+
 // Selector: 41369377
 contract TokenProperties is Dummy, ERC165 {
 	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
@@ -327,147 +468,6 @@
 		require(false, stub_error);
 		dummy;
 		return 0;
-	}
-}
-
-// Selector: 7d9262e6
-contract Collection is Dummy, ERC165 {
-	// Selector: setCollectionProperty(string,bytes) 2f073f66
-	function setCollectionProperty(string memory key, bytes memory value)
-		public
-	{
-		require(false, stub_error);
-		key;
-		value;
-		dummy = 0;
-	}
-
-	// Selector: deleteCollectionProperty(string) 7b7debce
-	function deleteCollectionProperty(string memory key) public {
-		require(false, stub_error);
-		key;
-		dummy = 0;
-	}
-
-	// Throws error if key not found
-	//
-	// Selector: collectionProperty(string) cf24fd6d
-	function collectionProperty(string memory key)
-		public
-		view
-		returns (bytes memory)
-	{
-		require(false, stub_error);
-		key;
-		dummy;
-		return hex"";
-	}
-
-	// Selector: ethSetSponsor(address) 8f9af356
-	function ethSetSponsor(address sponsor) public {
-		require(false, stub_error);
-		sponsor;
-		dummy = 0;
-	}
-
-	// Selector: ethConfirmSponsorship() a8580d1a
-	function ethConfirmSponsorship() public {
-		require(false, stub_error);
-		dummy = 0;
-	}
-
-	// Selector: setLimit(string,uint32) 68db30ca
-	function setLimit(string memory limit, uint32 value) public {
-		require(false, stub_error);
-		limit;
-		value;
-		dummy = 0;
-	}
-
-	// Selector: setLimit(string,bool) ea67e4c2
-	function setLimit(string memory limit, bool value) public {
-		require(false, stub_error);
-		limit;
-		value;
-		dummy = 0;
-	}
-
-	// Selector: contractAddress() f6b4dfb4
-	function contractAddress() public view returns (address) {
-		require(false, stub_error);
-		dummy;
-		return 0x0000000000000000000000000000000000000000;
-	}
-
-	// Selector: addCollectionAdminSubstrate(uint256) 5730062b
-	function addCollectionAdminSubstrate(uint256 newAdmin) public view {
-		require(false, stub_error);
-		newAdmin;
-		dummy;
-	}
-
-	// Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
-	function removeCollectionAdminSubstrate(uint256 newAdmin) public view {
-		require(false, stub_error);
-		newAdmin;
-		dummy;
-	}
-
-	// Selector: addCollectionAdmin(address) 92e462c7
-	function addCollectionAdmin(address newAdmin) public view {
-		require(false, stub_error);
-		newAdmin;
-		dummy;
-	}
-
-	// Selector: removeAdmin(address) 1785f53c
-	function removeAdmin(address admin) public view {
-		require(false, stub_error);
-		admin;
-		dummy;
-	}
-
-	// Selector: setNesting(bool) e8fc50dd
-	function setNesting(bool enable) public {
-		require(false, stub_error);
-		enable;
-		dummy = 0;
-	}
-
-	// Selector: setNesting(bool,address[]) 7df12a9a
-	function setNesting(bool enable, address[] memory collections) public {
-		require(false, stub_error);
-		enable;
-		collections;
-		dummy = 0;
-	}
-
-	// Selector: setAccess(string) 488f56aa
-	function setAccess(string memory mode) public {
-		require(false, stub_error);
-		mode;
-		dummy = 0;
-	}
-
-	// Selector: addToAllowList(address) 31f59102
-	function addToAllowList(address user) public view {
-		require(false, stub_error);
-		user;
-		dummy;
-	}
-
-	// Selector: removeFromAllowList(address) eba8dabc
-	function removeFromAllowList(address user) public view {
-		require(false, stub_error);
-		user;
-		dummy;
-	}
-
-	// Selector: setMintMode(bool) 5dea9bd5
-	function setMintMode(bool mode) public {
-		require(false, stub_error);
-		mode;
-		dummy = 0;
 	}
 }
 
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
after · tests/src/eth/api/UniqueNFT.sol
1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8	uint256 field_0;9	string field_1;10}1112// Common stubs holder13interface Dummy {1415}1617interface ERC165 is Dummy {18	function supportsInterface(bytes4 interfaceID) external view returns (bool);19}2021// Inline22interface ERC721Events {23	event Transfer(24		address indexed from,25		address indexed to,26		uint256 indexed tokenId27	);28	event Approval(29		address indexed owner,30		address indexed approved,31		uint256 indexed tokenId32	);33	event ApprovalForAll(34		address indexed owner,35		address indexed operator,36		bool approved37	);38}3940// Inline41interface ERC721MintableEvents {42	event MintingFinished();43}4445// Selector: 2da6e59e46interface Collection is Dummy, ERC165 {47	// Selector: setCollectionProperty(string,bytes) 2f073f6648	function setCollectionProperty(string memory key, bytes memory value)49		external;5051	// Selector: deleteCollectionProperty(string) 7b7debce52	function deleteCollectionProperty(string memory key) external;5354	// Throws error if key not found55	//56	// Selector: collectionProperty(string) cf24fd6d57	function collectionProperty(string memory key)58		external59		view60		returns (bytes memory);6162	// Selector: setCollectionSponsor(address) 7623402e63	function setCollectionSponsor(address sponsor) external;6465	// Selector: confirmCollectionSponsorship() 3c50e97a66	function confirmCollectionSponsorship() external;6768	// Selector: setCollectionLimit(string,uint32) 6a3841db69	function setCollectionLimit(string memory limit, uint32 value) external;7071	// Selector: setCollectionLimit(string,bool) 993b7fba72	function setCollectionLimit(string memory limit, bool value) external;7374	// Selector: contractAddress() f6b4dfb475	function contractAddress() external view returns (address);7677	// Selector: addCollectionAdminSubstrate(uint256) 5730062b78	function addCollectionAdminSubstrate(uint256 newAdmin) external view;7980	// Selector: removeCollectionAdminSubstrate(uint256) 4048fcf981	function removeCollectionAdminSubstrate(uint256 newAdmin) external view;8283	// Selector: addCollectionAdmin(address) 92e462c784	function addCollectionAdmin(address newAdmin) external view;8586	// Selector: removeAdmin(address) 1785f53c87	function removeAdmin(address admin) external view;8889	// Selector: setNesting(bool) e8fc50dd90	function setNesting(bool enable) external;9192	// Selector: setNesting(bool,address[]) 7df12a9a93	function setNesting(bool enable, address[] memory collections) external;9495	// Selector: setCollectionAccess(uint8) 41835d4c96	function setCollectionAccess(uint8 mode) external;9798	// Selector: addToCollectionAllowList(address) 67844fe699	function addToCollectionAllowList(address user) external view;100101	// Selector: removeFromCollectionAllowList(address) 85c51acb102	function removeFromCollectionAllowList(address user) external view;103104	// Selector: setMintMode(bool) 5dea9bd5105	function setMintMode(bool mode) external;106}107108// Selector: 41369377109interface TokenProperties is Dummy, ERC165 {110	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa111	function setTokenPropertyPermission(112		string memory key,113		bool isMutable,114		bool collectionAdmin,115		bool tokenOwner116	) external;117118	// Selector: setProperty(uint256,string,bytes) 1752d67b119	function setProperty(120		uint256 tokenId,121		string memory key,122		bytes memory value123	) external;124125	// Selector: deleteProperty(uint256,string) 066111d1126	function deleteProperty(uint256 tokenId, string memory key) external;127128	// Throws error if key not found129	//130	// Selector: property(uint256,string) 7228c327131	function property(uint256 tokenId, string memory key)132		external133		view134		returns (bytes memory);135}136137// Selector: 42966c68138interface ERC721Burnable is Dummy, ERC165 {139	// Selector: burn(uint256) 42966c68140	function burn(uint256 tokenId) external;141}142143// Selector: 58800161144interface ERC721 is Dummy, ERC165, ERC721Events {145	// Selector: balanceOf(address) 70a08231146	function balanceOf(address owner) external view returns (uint256);147148	// Selector: ownerOf(uint256) 6352211e149	function ownerOf(uint256 tokenId) external view returns (address);150151	// Not implemented152	//153	// Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672154	function safeTransferFromWithData(155		address from,156		address to,157		uint256 tokenId,158		bytes memory data159	) external;160161	// Not implemented162	//163	// Selector: safeTransferFrom(address,address,uint256) 42842e0e164	function safeTransferFrom(165		address from,166		address to,167		uint256 tokenId168	) external;169170	// Selector: transferFrom(address,address,uint256) 23b872dd171	function transferFrom(172		address from,173		address to,174		uint256 tokenId175	) external;176177	// Selector: approve(address,uint256) 095ea7b3178	function approve(address approved, uint256 tokenId) external;179180	// Not implemented181	//182	// Selector: setApprovalForAll(address,bool) a22cb465183	function setApprovalForAll(address operator, bool approved) external;184185	// Not implemented186	//187	// Selector: getApproved(uint256) 081812fc188	function getApproved(uint256 tokenId) external view returns (address);189190	// Not implemented191	//192	// Selector: isApprovedForAll(address,address) e985e9c5193	function isApprovedForAll(address owner, address operator)194		external195		view196		returns (address);197}198199// Selector: 5b5e139f200interface ERC721Metadata is Dummy, ERC165 {201	// Selector: name() 06fdde03202	function name() external view returns (string memory);203204	// Selector: symbol() 95d89b41205	function symbol() external view returns (string memory);206207	// Returns token's const_metadata208	//209	// Selector: tokenURI(uint256) c87b56dd210	function tokenURI(uint256 tokenId) external view returns (string memory);211}212213// Selector: 68ccfe89214interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {215	// Selector: mintingFinished() 05d2035b216	function mintingFinished() external view returns (bool);217218	// `token_id` should be obtained with `next_token_id` method,219	// unlike standard, you can't specify it manually220	//221	// Selector: mint(address,uint256) 40c10f19222	function mint(address to, uint256 tokenId) external returns (bool);223224	// `token_id` should be obtained with `next_token_id` method,225	// unlike standard, you can't specify it manually226	//227	// Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f228	function mintWithTokenURI(229		address to,230		uint256 tokenId,231		string memory tokenUri232	) external returns (bool);233234	// Not implemented235	//236	// Selector: finishMinting() 7d64bcb4237	function finishMinting() external returns (bool);238}239240// Selector: 780e9d63241interface ERC721Enumerable is Dummy, ERC165 {242	// Selector: tokenByIndex(uint256) 4f6ccce7243	function tokenByIndex(uint256 index) external view returns (uint256);244245	// Not implemented246	//247	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59248	function tokenOfOwnerByIndex(address owner, uint256 index)249		external250		view251		returns (uint256);252253	// Selector: totalSupply() 18160ddd254	function totalSupply() external view returns (uint256);255}256257// Selector: d74d154f258interface ERC721UniqueExtensions is Dummy, ERC165 {259	// Selector: transfer(address,uint256) a9059cbb260	function transfer(address to, uint256 tokenId) external;261262	// Selector: burnFrom(address,uint256) 79cc6790263	function burnFrom(address from, uint256 tokenId) external;264265	// Selector: nextTokenId() 75794a3c266	function nextTokenId() external view returns (uint256);267268	// Selector: mintBulk(address,uint256[]) 44a9945e269	function mintBulk(address to, uint256[] memory tokenIds)270		external271		returns (bool);272273	// Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006274	function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)275		external276		returns (bool);277}278279interface UniqueNFT is280	Dummy,281	ERC165,282	ERC721,283	ERC721Metadata,284	ERC721Enumerable,285	ERC721UniqueExtensions,286	ERC721Mintable,287	ERC721Burnable,288	Collection,289	TokenProperties290{}
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -84,7 +84,7 @@
     "inputs": [
       { "internalType": "address", "name": "newAdmin", "type": "address" }
     ],
-    "name": "addAdmin",
+    "name": "addCollectionAdmin",
     "outputs": [],
     "stateMutability": "view",
     "type": "function"
@@ -102,7 +102,7 @@
     "inputs": [
       { "internalType": "address", "name": "user", "type": "address" }
     ],
-    "name": "addToAllowList",
+    "name": "addToCollectionAllowList",
     "outputs": [],
     "stateMutability": "view",
     "type": "function"
@@ -320,7 +320,7 @@
     "inputs": [
       { "internalType": "address", "name": "user", "type": "address" }
     ],
-    "name": "removeFromAllowList",
+    "name": "removeFromCollectionAllowList",
     "outputs": [],
     "stateMutability": "view",
     "type": "function"
@@ -349,13 +349,6 @@
     "type": "function"
   },
   {
-    "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],
-    "name": "setAccess",
-    "outputs": [],
-    "stateMutability": "nonpayable",
-    "type": "function"
-  },
-  {
     "inputs": [
       { "internalType": "address", "name": "operator", "type": "address" },
       { "internalType": "bool", "name": "approved", "type": "bool" }
@@ -388,34 +381,6 @@
       { "internalType": "bool", "name": "value", "type": "bool" }
     ],
     "name": "setCollectionLimit",
-    "outputs": [],
-    "stateMutability": "nonpayable",
-    "type": "function"
-  },
-  {
-    "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
-    "name": "setCollectionMintMode",
-    "outputs": [],
-    "stateMutability": "nonpayable",
-    "type": "function"
-  },
-  {
-    "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
-    "name": "setCollectionNesting",
-    "outputs": [],
-    "stateMutability": "nonpayable",
-    "type": "function"
-  },
-  {
-    "inputs": [
-      { "internalType": "bool", "name": "enable", "type": "bool" },
-      {
-        "internalType": "address[]",
-        "name": "collections",
-        "type": "address[]"
-      }
-    ],
-    "name": "setCollectionNesting",
     "outputs": [],
     "stateMutability": "nonpayable",
     "type": "function"