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
42 event MintingFinished();42 event MintingFinished();
43}43}
44
45// Selector: 2da6e59e
46interface Collection is Dummy, ERC165 {
47 // Selector: setCollectionProperty(string,bytes) 2f073f66
48 function setCollectionProperty(string memory key, bytes memory value)
49 external;
50
51 // Selector: deleteCollectionProperty(string) 7b7debce
52 function deleteCollectionProperty(string memory key) external;
53
54 // Throws error if key not found
55 //
56 // Selector: collectionProperty(string) cf24fd6d
57 function collectionProperty(string memory key)
58 external
59 view
60 returns (bytes memory);
61
62 // Selector: setCollectionSponsor(address) 7623402e
63 function setCollectionSponsor(address sponsor) external;
64
65 // Selector: confirmCollectionSponsorship() 3c50e97a
66 function confirmCollectionSponsorship() external;
67
68 // Selector: setCollectionLimit(string,uint32) 6a3841db
69 function setCollectionLimit(string memory limit, uint32 value) external;
70
71 // Selector: setCollectionLimit(string,bool) 993b7fba
72 function setCollectionLimit(string memory limit, bool value) external;
73
74 // Selector: contractAddress() f6b4dfb4
75 function contractAddress() external view returns (address);
76
77 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
78 function addCollectionAdminSubstrate(uint256 newAdmin) external view;
79
80 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
81 function removeCollectionAdminSubstrate(uint256 newAdmin) external view;
82
83 // Selector: addCollectionAdmin(address) 92e462c7
84 function addCollectionAdmin(address newAdmin) external view;
85
86 // Selector: removeAdmin(address) 1785f53c
87 function removeAdmin(address admin) external view;
88
89 // Selector: setNesting(bool) e8fc50dd
90 function setNesting(bool enable) external;
91
92 // Selector: setNesting(bool,address[]) 7df12a9a
93 function setNesting(bool enable, address[] memory collections) external;
94
95 // Selector: setCollectionAccess(uint8) 41835d4c
96 function setCollectionAccess(uint8 mode) external;
97
98 // Selector: addToCollectionAllowList(address) 67844fe6
99 function addToCollectionAllowList(address user) external view;
100
101 // Selector: removeFromCollectionAllowList(address) 85c51acb
102 function removeFromCollectionAllowList(address user) external view;
103
104 // Selector: setMintMode(bool) 5dea9bd5
105 function setMintMode(bool mode) external;
106}
44107
45// Selector: 41369377108// Selector: 41369377
46interface TokenProperties is Dummy, ERC165 {109interface TokenProperties is Dummy, ERC165 {
191 function totalSupply() external view returns (uint256);254 function totalSupply() external view returns (uint256);
192}255}
193
194// Selector: 7d9262e6
195interface Collection is Dummy, ERC165 {
196 // Selector: setCollectionProperty(string,bytes) 2f073f66
197 function setCollectionProperty(string memory key, bytes memory value)
198 external;
199
200 // Selector: deleteCollectionProperty(string) 7b7debce
201 function deleteCollectionProperty(string memory key) external;
202
203 // Throws error if key not found
204 //
205 // Selector: collectionProperty(string) cf24fd6d
206 function collectionProperty(string memory key)
207 external
208 view
209 returns (bytes memory);
210
211 // Selector: setCollectionSponsor(address) 7623402e
212 function setCollectionSponsor(address sponsor) external;
213
214 // Selector: confirmCollectionSponsorship() 3c50e97a
215 function confirmCollectionSponsorship() external;
216
217 // Selector: setCollectionLimit(string,uint32) 6a3841db
218 function setCollectionLimit(string memory limit, uint32 value) external;
219
220 // Selector: setCollectionLimit(string,bool) 993b7fba
221 function setCollectionLimit(string memory limit, bool value) external;
222
223 // Selector: contractAddress() f6b4dfb4
224 function contractAddress() external view returns (address);
225
226 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
227 function addCollectionAdminSubstrate(uint256 newAdmin) external view;
228
229 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
230 function removeCollectionAdminSubstrate(uint256 newAdmin) external view;
231
232 // Selector: addCollectionAdmin(address) 92e462c7
233 function addCollectionAdmin(address newAdmin) external view;
234
235 // Selector: removeCollectionAdmin(address) fafd7b42
236 function removeCollectionAdmin(address admin) external view;
237
238 // Selector: setCollectionNesting(bool) 112d4586
239 function setCollectionNesting(bool enable) external;
240
241 // Selector: setCollectionNesting(bool,address[]) 64872396
242 function setCollectionNesting(bool enable, address[] memory collections)
243 external;
244
245 // Selector: setCollectionAccess(uint8) 41835d4c
246 function setCollectionAccess(uint8 mode) external;
247
248 // Selector: addToCollectionAllowList(address) 67844fe6
249 function addToCollectionAllowList(address user) external view;
250
251 // Selector: removeFromCollectionAllowList(address) 85c51acb
252 function removeFromCollectionAllowList(address user) external view;
253
254 // Selector: setCollectionMintMode(bool) 00018e84
255 function setCollectionMintMode(bool mode) external;
256}
257256
258// Selector: d74d154f257// Selector: d74d154f
259interface ERC721UniqueExtensions is Dummy, ERC165 {258interface ERC721UniqueExtensions is Dummy, ERC165 {
277 returns (bool);276 returns (bool);
278}277}
279
280// Selector: f56cd7fa
281interface Collection is Dummy, ERC165 {
282 // Selector: setCollectionProperty(string,bytes) 2f073f66
283 function setCollectionProperty(string memory key, bytes memory value)
284 external;
285
286 // Selector: deleteCollectionProperty(string) 7b7debce
287 function deleteCollectionProperty(string memory key) external;
288
289 // Throws error if key not found
290 //
291 // Selector: collectionProperty(string) cf24fd6d
292 function collectionProperty(string memory key)
293 external
294 view
295 returns (bytes memory);
296
297 // Selector: ethSetSponsor(address) 8f9af356
298 function ethSetSponsor(address sponsor) external;
299
300 // Selector: ethConfirmSponsorship() a8580d1a
301 function ethConfirmSponsorship() external;
302
303 // Selector: setLimit(string,uint32) 68db30ca
304 function setLimit(string memory limit, uint32 value) external;
305
306 // Selector: setLimit(string,bool) ea67e4c2
307 function setLimit(string memory limit, bool value) external;
308
309 // Selector: contractAddress() f6b4dfb4
310 function contractAddress() external view returns (address);
311
312 // Selector: addAdmin(address) 70480275
313 function addAdmin(address newAdmin) external view;
314
315 // Selector: removeAdmin(address) 1785f53c
316 function removeAdmin(address admin) external view;
317
318 // Selector: setNesting(bool) e8fc50dd
319 function setNesting(bool enable) external;
320
321 // Selector: setNesting(bool,address[]) 7df12a9a
322 function setNesting(bool enable, address[] memory collections) external;
323
324 // Selector: setAccess(string) 488f56aa
325 function setAccess(string memory mode) external;
326
327 // Selector: addToAllowList(address) 31f59102
328 function addToAllowList(address user) external view;
329
330 // Selector: removeFromAllowList(address) eba8dabc
331 function removeFromAllowList(address user) external view;
332
333 // Selector: setMintMode(bool) 5dea9bd5
334 function setMintMode(bool mode) external;
335}
336278
337interface UniqueNFT is279interface UniqueNFT is
338 Dummy,280 Dummy,
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"