git.delta.rocks / unique-network / refs/commits / 87ff08974106

difftreelog

CORE-386 Fix PR

Trubnikov Sergey2022-06-03parent: #9e201d9.patch.diff
in: master

7 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -261,13 +261,13 @@
 		Ok(())
 	}
 
-	fn set_collection_access(&mut self, caller: caller, mode: string) -> Result<void> {
+	fn set_collection_access(&mut self, caller: caller, mode: uint8) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		self.check_is_owner_or_admin(&caller)
 			.map_err(dispatch_to_evm::<T>)?;
-		self.collection.permissions.access = Some(match mode.as_str() {
-			"Normal" => AccessMode::Normal,
-			"AllowList" => AccessMode::AllowList,
+		self.collection.permissions.access = Some(match mode {
+			0 => AccessMode::Normal,
+			1 => AccessMode::AllowList,
 			_ => return Err("Not supported access mode".into()),
 		});
 		save(self);
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -543,6 +543,7 @@
 				token_owner,
 				..
 			} => {
+				//TODO: исследовать угрозы при публичном минтинге.
 				if is_token_create && (collection_admin || token_owner) {
 					return Ok(());
 				}
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,135 +51,6 @@
 	event MintingFinished();
 }
 
-// Selector: 1248b7d1
-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: addCollectionAdmin(address) 92e462c7
-	function addCollectionAdmin(address newAdmin) public view {
-		require(false, stub_error);
-		newAdmin;
-		dummy;
-	}
-
-	// Selector: removeCollectionAdmin(address) fafd7b42
-	function removeCollectionAdmin(address admin) public view {
-		require(false, stub_error);
-		admin;
-		dummy;
-	}
-
-	// Selector: setCollectionNesting(bool) 112d4586
-	function setCollectionNesting(bool enable) public {
-		require(false, stub_error);
-		enable;
-		dummy = 0;
-	}
-
-	// Selector: setCollectionNesting(bool,address[]) 64872396
-	function setCollectionNesting(bool enable, address[] memory collections)
-		public
-	{
-		require(false, stub_error);
-		enable;
-		collections;
-		dummy = 0;
-	}
-
-	// Selector: setCollectionAccess(string) 392172a9
-	function setCollectionAccess(string memory 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: setCollectionMintMode(bool) 00018e84
-	function setCollectionMintMode(bool mode) public {
-		require(false, stub_error);
-		mode;
-		dummy = 0;
-	}
-}
-
 // Selector: 41369377
 contract TokenProperties is Dummy, ERC165 {
 	// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
@@ -426,6 +297,135 @@
 	}
 }
 
+// Selector: 6aea9834
+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: addCollectionAdmin(address) 92e462c7
+	function addCollectionAdmin(address newAdmin) public view {
+		require(false, stub_error);
+		newAdmin;
+		dummy;
+	}
+
+	// Selector: removeCollectionAdmin(address) fafd7b42
+	function removeCollectionAdmin(address admin) public view {
+		require(false, stub_error);
+		admin;
+		dummy;
+	}
+
+	// Selector: setCollectionNesting(bool) 112d4586
+	function setCollectionNesting(bool enable) public {
+		require(false, stub_error);
+		enable;
+		dummy = 0;
+	}
+
+	// Selector: setCollectionNesting(bool,address[]) 64872396
+	function setCollectionNesting(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: setCollectionMintMode(bool) 00018e84
+	function setCollectionMintMode(bool mode) public {
+		require(false, stub_error);
+		mode;
+		dummy = 0;
+	}
+}
+
 // Selector: 780e9d63
 contract ERC721Enumerable is Dummy, ERC165 {
 	// Selector: tokenByIndex(uint256) 4f6ccce7
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
42 event MintingFinished();42 event MintingFinished();
43}43}
44
45// Selector: 1248b7d1
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: addCollectionAdmin(address) 92e462c7
78 function addCollectionAdmin(address newAdmin) external view;
79
80 // Selector: removeCollectionAdmin(address) fafd7b42
81 function removeCollectionAdmin(address admin) external view;
82
83 // Selector: setCollectionNesting(bool) 112d4586
84 function setCollectionNesting(bool enable) external;
85
86 // Selector: setCollectionNesting(bool,address[]) 64872396
87 function setCollectionNesting(bool enable, address[] memory collections)
88 external;
89
90 // Selector: setCollectionAccess(string) 392172a9
91 function setCollectionAccess(string memory mode) external;
92
93 // Selector: addToCollectionAllowList(address) 67844fe6
94 function addToCollectionAllowList(address user) external view;
95
96 // Selector: removeFromCollectionAllowList(address) 85c51acb
97 function removeFromCollectionAllowList(address user) external view;
98
99 // Selector: setCollectionMintMode(bool) 00018e84
100 function setCollectionMintMode(bool mode) external;
101}
10244
103// Selector: 4136937745// Selector: 41369377
104interface TokenProperties is Dummy, ERC165 {46interface TokenProperties is Dummy, ERC165 {
232 function finishMinting() external returns (bool);174 function finishMinting() external returns (bool);
233}175}
176
177// Selector: 6aea9834
178interface Collection is Dummy, ERC165 {
179 // Selector: setCollectionProperty(string,bytes) 2f073f66
180 function setCollectionProperty(string memory key, bytes memory value)
181 external;
182
183 // Selector: deleteCollectionProperty(string) 7b7debce
184 function deleteCollectionProperty(string memory key) external;
185
186 // Throws error if key not found
187 //
188 // Selector: collectionProperty(string) cf24fd6d
189 function collectionProperty(string memory key)
190 external
191 view
192 returns (bytes memory);
193
194 // Selector: setCollectionSponsor(address) 7623402e
195 function setCollectionSponsor(address sponsor) external;
196
197 // Selector: confirmCollectionSponsorship() 3c50e97a
198 function confirmCollectionSponsorship() external;
199
200 // Selector: setCollectionLimit(string,uint32) 6a3841db
201 function setCollectionLimit(string memory limit, uint32 value) external;
202
203 // Selector: setCollectionLimit(string,bool) 993b7fba
204 function setCollectionLimit(string memory limit, bool value) external;
205
206 // Selector: contractAddress() f6b4dfb4
207 function contractAddress() external view returns (address);
208
209 // Selector: addCollectionAdmin(address) 92e462c7
210 function addCollectionAdmin(address newAdmin) external view;
211
212 // Selector: removeCollectionAdmin(address) fafd7b42
213 function removeCollectionAdmin(address admin) external view;
214
215 // Selector: setCollectionNesting(bool) 112d4586
216 function setCollectionNesting(bool enable) external;
217
218 // Selector: setCollectionNesting(bool,address[]) 64872396
219 function setCollectionNesting(bool enable, address[] memory collections)
220 external;
221
222 // Selector: setCollectionAccess(uint8) 41835d4c
223 function setCollectionAccess(uint8 mode) external;
224
225 // Selector: addToCollectionAllowList(address) 67844fe6
226 function addToCollectionAllowList(address user) external view;
227
228 // Selector: removeFromCollectionAllowList(address) 85c51acb
229 function removeFromCollectionAllowList(address user) external view;
230
231 // Selector: setCollectionMintMode(bool) 00018e84
232 function setCollectionMintMode(bool mode) external;
233}
234234
235// Selector: 780e9d63235// Selector: 780e9d63
236interface ERC721Enumerable is Dummy, ERC165 {236interface ERC721Enumerable is Dummy, ERC165 {
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -247,7 +247,8 @@
     expect(oldPermissions.mintMode).to.be.false;
     expect(oldPermissions.access).to.be.equal('Normal');
 
-    await collectionEvm.methods.setCollectionAccess('AllowList').send({from: owner});
+    //TODO: change value, when enum generated
+    await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});
     await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});
     await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});
 
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -341,7 +341,7 @@
     "type": "function"
   },
   {
-    "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],
+    "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
     "name": "setCollectionAccess",
     "outputs": [],
     "stateMutability": "nonpayable",