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
51 event MintingFinished();51 event MintingFinished();
52}52}
53
54// Selector: 2da6e59e
55contract Collection is Dummy, ERC165 {
56 // Selector: setCollectionProperty(string,bytes) 2f073f66
57 function setCollectionProperty(string memory key, bytes memory value)
58 public
59 {
60 require(false, stub_error);
61 key;
62 value;
63 dummy = 0;
64 }
65
66 // Selector: deleteCollectionProperty(string) 7b7debce
67 function deleteCollectionProperty(string memory key) public {
68 require(false, stub_error);
69 key;
70 dummy = 0;
71 }
72
73 // Throws error if key not found
74 //
75 // Selector: collectionProperty(string) cf24fd6d
76 function collectionProperty(string memory key)
77 public
78 view
79 returns (bytes memory)
80 {
81 require(false, stub_error);
82 key;
83 dummy;
84 return hex"";
85 }
86
87 // Selector: setCollectionSponsor(address) 7623402e
88 function setCollectionSponsor(address sponsor) public {
89 require(false, stub_error);
90 sponsor;
91 dummy = 0;
92 }
93
94 // Selector: confirmCollectionSponsorship() 3c50e97a
95 function confirmCollectionSponsorship() public {
96 require(false, stub_error);
97 dummy = 0;
98 }
99
100 // Selector: setCollectionLimit(string,uint32) 6a3841db
101 function setCollectionLimit(string memory limit, uint32 value) public {
102 require(false, stub_error);
103 limit;
104 value;
105 dummy = 0;
106 }
107
108 // Selector: setCollectionLimit(string,bool) 993b7fba
109 function setCollectionLimit(string memory limit, bool value) public {
110 require(false, stub_error);
111 limit;
112 value;
113 dummy = 0;
114 }
115
116 // Selector: contractAddress() f6b4dfb4
117 function contractAddress() public view returns (address) {
118 require(false, stub_error);
119 dummy;
120 return 0x0000000000000000000000000000000000000000;
121 }
122
123 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
124 function addCollectionAdminSubstrate(uint256 newAdmin) public view {
125 require(false, stub_error);
126 newAdmin;
127 dummy;
128 }
129
130 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
131 function removeCollectionAdminSubstrate(uint256 newAdmin) public view {
132 require(false, stub_error);
133 newAdmin;
134 dummy;
135 }
136
137 // Selector: addCollectionAdmin(address) 92e462c7
138 function addCollectionAdmin(address newAdmin) public view {
139 require(false, stub_error);
140 newAdmin;
141 dummy;
142 }
143
144 // Selector: removeAdmin(address) 1785f53c
145 function removeAdmin(address admin) public view {
146 require(false, stub_error);
147 admin;
148 dummy;
149 }
150
151 // Selector: setNesting(bool) e8fc50dd
152 function setNesting(bool enable) public {
153 require(false, stub_error);
154 enable;
155 dummy = 0;
156 }
157
158 // Selector: setNesting(bool,address[]) 7df12a9a
159 function setNesting(bool enable, address[] memory collections) public {
160 require(false, stub_error);
161 enable;
162 collections;
163 dummy = 0;
164 }
165
166 // Selector: setCollectionAccess(uint8) 41835d4c
167 function setCollectionAccess(uint8 mode) public {
168 require(false, stub_error);
169 mode;
170 dummy = 0;
171 }
172
173 // Selector: addToCollectionAllowList(address) 67844fe6
174 function addToCollectionAllowList(address user) public view {
175 require(false, stub_error);
176 user;
177 dummy;
178 }
179
180 // Selector: removeFromCollectionAllowList(address) 85c51acb
181 function removeFromCollectionAllowList(address user) public view {
182 require(false, stub_error);
183 user;
184 dummy;
185 }
186
187 // Selector: setMintMode(bool) 5dea9bd5
188 function setMintMode(bool mode) public {
189 require(false, stub_error);
190 mode;
191 dummy = 0;
192 }
193}
53194
54// Selector: 41369377195// Selector: 41369377
55contract TokenProperties is Dummy, ERC165 {196contract TokenProperties is Dummy, ERC165 {
330 }471 }
331}472}
332
333// Selector: 7d9262e6
334contract Collection is Dummy, ERC165 {
335 // Selector: setCollectionProperty(string,bytes) 2f073f66
336 function setCollectionProperty(string memory key, bytes memory value)
337 public
338 {
339 require(false, stub_error);
340 key;
341 value;
342 dummy = 0;
343 }
344
345 // Selector: deleteCollectionProperty(string) 7b7debce
346 function deleteCollectionProperty(string memory key) public {
347 require(false, stub_error);
348 key;
349 dummy = 0;
350 }
351
352 // Throws error if key not found
353 //
354 // Selector: collectionProperty(string) cf24fd6d
355 function collectionProperty(string memory key)
356 public
357 view
358 returns (bytes memory)
359 {
360 require(false, stub_error);
361 key;
362 dummy;
363 return hex"";
364 }
365
366 // Selector: ethSetSponsor(address) 8f9af356
367 function ethSetSponsor(address sponsor) public {
368 require(false, stub_error);
369 sponsor;
370 dummy = 0;
371 }
372
373 // Selector: ethConfirmSponsorship() a8580d1a
374 function ethConfirmSponsorship() public {
375 require(false, stub_error);
376 dummy = 0;
377 }
378
379 // Selector: setLimit(string,uint32) 68db30ca
380 function setLimit(string memory limit, uint32 value) public {
381 require(false, stub_error);
382 limit;
383 value;
384 dummy = 0;
385 }
386
387 // Selector: setLimit(string,bool) ea67e4c2
388 function setLimit(string memory limit, bool value) public {
389 require(false, stub_error);
390 limit;
391 value;
392 dummy = 0;
393 }
394
395 // Selector: contractAddress() f6b4dfb4
396 function contractAddress() public view returns (address) {
397 require(false, stub_error);
398 dummy;
399 return 0x0000000000000000000000000000000000000000;
400 }
401
402 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
403 function addCollectionAdminSubstrate(uint256 newAdmin) public view {
404 require(false, stub_error);
405 newAdmin;
406 dummy;
407 }
408
409 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
410 function removeCollectionAdminSubstrate(uint256 newAdmin) public view {
411 require(false, stub_error);
412 newAdmin;
413 dummy;
414 }
415
416 // Selector: addCollectionAdmin(address) 92e462c7
417 function addCollectionAdmin(address newAdmin) public view {
418 require(false, stub_error);
419 newAdmin;
420 dummy;
421 }
422
423 // Selector: removeAdmin(address) 1785f53c
424 function removeAdmin(address admin) public view {
425 require(false, stub_error);
426 admin;
427 dummy;
428 }
429
430 // Selector: setNesting(bool) e8fc50dd
431 function setNesting(bool enable) public {
432 require(false, stub_error);
433 enable;
434 dummy = 0;
435 }
436
437 // Selector: setNesting(bool,address[]) 7df12a9a
438 function setNesting(bool enable, address[] memory collections) public {
439 require(false, stub_error);
440 enable;
441 collections;
442 dummy = 0;
443 }
444
445 // Selector: setAccess(string) 488f56aa
446 function setAccess(string memory mode) public {
447 require(false, stub_error);
448 mode;
449 dummy = 0;
450 }
451
452 // Selector: addToAllowList(address) 31f59102
453 function addToAllowList(address user) public view {
454 require(false, stub_error);
455 user;
456 dummy;
457 }
458
459 // Selector: removeFromAllowList(address) eba8dabc
460 function removeFromAllowList(address user) public view {
461 require(false, stub_error);
462 user;
463 dummy;
464 }
465
466 // Selector: setMintMode(bool) 5dea9bd5
467 function setMintMode(bool mode) public {
468 require(false, stub_error);
469 mode;
470 dummy = 0;
471 }
472}
473473
474// Selector: d74d154f474// Selector: d74d154f
475contract ERC721UniqueExtensions is Dummy, ERC165 {475contract ERC721UniqueExtensions is Dummy, ERC165 {
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -42,6 +42,69 @@
 	event MintingFinished();
 }
 
+// Selector: 2da6e59e
+interface Collection is Dummy, ERC165 {
+	// Selector: setCollectionProperty(string,bytes) 2f073f66
+	function setCollectionProperty(string memory key, bytes memory value)
+		external;
+
+	// Selector: deleteCollectionProperty(string) 7b7debce
+	function deleteCollectionProperty(string memory key) external;
+
+	// Throws error if key not found
+	//
+	// Selector: collectionProperty(string) cf24fd6d
+	function collectionProperty(string memory key)
+		external
+		view
+		returns (bytes memory);
+
+	// Selector: setCollectionSponsor(address) 7623402e
+	function setCollectionSponsor(address sponsor) external;
+
+	// Selector: confirmCollectionSponsorship() 3c50e97a
+	function confirmCollectionSponsorship() external;
+
+	// Selector: setCollectionLimit(string,uint32) 6a3841db
+	function setCollectionLimit(string memory limit, uint32 value) external;
+
+	// Selector: setCollectionLimit(string,bool) 993b7fba
+	function setCollectionLimit(string memory limit, bool value) external;
+
+	// Selector: contractAddress() f6b4dfb4
+	function contractAddress() external view returns (address);
+
+	// Selector: addCollectionAdminSubstrate(uint256) 5730062b
+	function addCollectionAdminSubstrate(uint256 newAdmin) external view;
+
+	// Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
+	function removeCollectionAdminSubstrate(uint256 newAdmin) external view;
+
+	// Selector: addCollectionAdmin(address) 92e462c7
+	function addCollectionAdmin(address newAdmin) external view;
+
+	// Selector: removeAdmin(address) 1785f53c
+	function removeAdmin(address admin) external view;
+
+	// Selector: setNesting(bool) e8fc50dd
+	function setNesting(bool enable) external;
+
+	// Selector: setNesting(bool,address[]) 7df12a9a
+	function setNesting(bool enable, address[] memory collections) external;
+
+	// Selector: setCollectionAccess(uint8) 41835d4c
+	function setCollectionAccess(uint8 mode) external;
+
+	// Selector: addToCollectionAllowList(address) 67844fe6
+	function addToCollectionAllowList(address user) external view;
+
+	// Selector: removeFromCollectionAllowList(address) 85c51acb
+	function removeFromCollectionAllowList(address user) external view;
+
+	// Selector: setMintMode(bool) 5dea9bd5
+	function setMintMode(bool mode) external;
+}
+
 // Selector: 41369377
 interface TokenProperties is Dummy, ERC165 {
 	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
@@ -189,70 +252,6 @@
 
 	// Selector: totalSupply() 18160ddd
 	function totalSupply() external view returns (uint256);
-}
-
-// Selector: 7d9262e6
-interface Collection is Dummy, ERC165 {
-	// Selector: setCollectionProperty(string,bytes) 2f073f66
-	function setCollectionProperty(string memory key, bytes memory value)
-		external;
-
-	// Selector: deleteCollectionProperty(string) 7b7debce
-	function deleteCollectionProperty(string memory key) external;
-
-	// Throws error if key not found
-	//
-	// Selector: collectionProperty(string) cf24fd6d
-	function collectionProperty(string memory key)
-		external
-		view
-		returns (bytes memory);
-
-	// Selector: setCollectionSponsor(address) 7623402e
-	function setCollectionSponsor(address sponsor) external;
-
-	// Selector: confirmCollectionSponsorship() 3c50e97a
-	function confirmCollectionSponsorship() external;
-
-	// Selector: setCollectionLimit(string,uint32) 6a3841db
-	function setCollectionLimit(string memory limit, uint32 value) external;
-
-	// Selector: setCollectionLimit(string,bool) 993b7fba
-	function setCollectionLimit(string memory limit, bool value) external;
-
-	// Selector: contractAddress() f6b4dfb4
-	function contractAddress() external view returns (address);
-
-	// Selector: addCollectionAdminSubstrate(uint256) 5730062b
-	function addCollectionAdminSubstrate(uint256 newAdmin) external view;
-
-	// Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
-	function removeCollectionAdminSubstrate(uint256 newAdmin) external view;
-
-	// Selector: addCollectionAdmin(address) 92e462c7
-	function addCollectionAdmin(address newAdmin) external view;
-
-	// Selector: removeCollectionAdmin(address) fafd7b42
-	function removeCollectionAdmin(address admin) external view;
-
-	// Selector: setCollectionNesting(bool) 112d4586
-	function setCollectionNesting(bool enable) external;
-
-	// Selector: setCollectionNesting(bool,address[]) 64872396
-	function setCollectionNesting(bool enable, address[] memory collections)
-		external;
-
-	// Selector: setCollectionAccess(uint8) 41835d4c
-	function setCollectionAccess(uint8 mode) external;
-
-	// Selector: addToCollectionAllowList(address) 67844fe6
-	function addToCollectionAllowList(address user) external view;
-
-	// Selector: removeFromCollectionAllowList(address) 85c51acb
-	function removeFromCollectionAllowList(address user) external view;
-
-	// Selector: setCollectionMintMode(bool) 00018e84
-	function setCollectionMintMode(bool mode) external;
 }
 
 // Selector: d74d154f
@@ -275,63 +274,6 @@
 	function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)
 		external
 		returns (bool);
-}
-
-// Selector: f56cd7fa
-interface Collection is Dummy, ERC165 {
-	// Selector: setCollectionProperty(string,bytes) 2f073f66
-	function setCollectionProperty(string memory key, bytes memory value)
-		external;
-
-	// Selector: deleteCollectionProperty(string) 7b7debce
-	function deleteCollectionProperty(string memory key) external;
-
-	// Throws error if key not found
-	//
-	// Selector: collectionProperty(string) cf24fd6d
-	function collectionProperty(string memory key)
-		external
-		view
-		returns (bytes memory);
-
-	// Selector: ethSetSponsor(address) 8f9af356
-	function ethSetSponsor(address sponsor) external;
-
-	// Selector: ethConfirmSponsorship() a8580d1a
-	function ethConfirmSponsorship() external;
-
-	// Selector: setLimit(string,uint32) 68db30ca
-	function setLimit(string memory limit, uint32 value) external;
-
-	// Selector: setLimit(string,bool) ea67e4c2
-	function setLimit(string memory limit, bool value) external;
-
-	// Selector: contractAddress() f6b4dfb4
-	function contractAddress() external view returns (address);
-
-	// Selector: addAdmin(address) 70480275
-	function addAdmin(address newAdmin) external view;
-
-	// Selector: removeAdmin(address) 1785f53c
-	function removeAdmin(address admin) external view;
-
-	// Selector: setNesting(bool) e8fc50dd
-	function setNesting(bool enable) external;
-
-	// Selector: setNesting(bool,address[]) 7df12a9a
-	function setNesting(bool enable, address[] memory collections) external;
-
-	// Selector: setAccess(string) 488f56aa
-	function setAccess(string memory mode) external;
-
-	// Selector: addToAllowList(address) 31f59102
-	function addToAllowList(address user) external view;
-
-	// Selector: removeFromAllowList(address) eba8dabc
-	function removeFromAllowList(address user) external view;
-
-	// Selector: setMintMode(bool) 5dea9bd5
-	function setMintMode(bool mode) external;
 }
 
 interface UniqueNFT is
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"