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
261 Ok(())261 Ok(())
262 }262 }
263263
264 fn set_collection_access(&mut self, caller: caller, mode: string) -> Result<void> {264 fn set_collection_access(&mut self, caller: caller, mode: uint8) -> Result<void> {
265 let caller = T::CrossAccountId::from_eth(caller);265 let caller = T::CrossAccountId::from_eth(caller);
266 self.check_is_owner_or_admin(&caller)266 self.check_is_owner_or_admin(&caller)
267 .map_err(dispatch_to_evm::<T>)?;267 .map_err(dispatch_to_evm::<T>)?;
268 self.collection.permissions.access = Some(match mode.as_str() {268 self.collection.permissions.access = Some(match mode {
269 "Normal" => AccessMode::Normal,269 0 => AccessMode::Normal,
270 "AllowList" => AccessMode::AllowList,270 1 => AccessMode::AllowList,
271 _ => return Err("Not supported access mode".into()),271 _ => return Err("Not supported access mode".into()),
272 });272 });
273 save(self);273 save(self);
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
543 token_owner,543 token_owner,
544 ..544 ..
545 } => {545 } => {
546 //TODO: исследовать угрозы при публичном минтинге.
546 if is_token_create && (collection_admin || token_owner) {547 if is_token_create && (collection_admin || token_owner) {
547 return Ok(());548 return Ok(());
548 }549 }
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: 1248b7d1
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: addCollectionAdmin(address) 92e462c7
124 function addCollectionAdmin(address newAdmin) public view {
125 require(false, stub_error);
126 newAdmin;
127 dummy;
128 }
129
130 // Selector: removeCollectionAdmin(address) fafd7b42
131 function removeCollectionAdmin(address admin) public view {
132 require(false, stub_error);
133 admin;
134 dummy;
135 }
136
137 // Selector: setCollectionNesting(bool) 112d4586
138 function setCollectionNesting(bool enable) public {
139 require(false, stub_error);
140 enable;
141 dummy = 0;
142 }
143
144 // Selector: setCollectionNesting(bool,address[]) 64872396
145 function setCollectionNesting(bool enable, address[] memory collections)
146 public
147 {
148 require(false, stub_error);
149 enable;
150 collections;
151 dummy = 0;
152 }
153
154 // Selector: setCollectionAccess(string) 392172a9
155 function setCollectionAccess(string memory mode) public {
156 require(false, stub_error);
157 mode;
158 dummy = 0;
159 }
160
161 // Selector: addToCollectionAllowList(address) 67844fe6
162 function addToCollectionAllowList(address user) public view {
163 require(false, stub_error);
164 user;
165 dummy;
166 }
167
168 // Selector: removeFromCollectionAllowList(address) 85c51acb
169 function removeFromCollectionAllowList(address user) public view {
170 require(false, stub_error);
171 user;
172 dummy;
173 }
174
175 // Selector: setCollectionMintMode(bool) 00018e84
176 function setCollectionMintMode(bool mode) public {
177 require(false, stub_error);
178 mode;
179 dummy = 0;
180 }
181}
18253
183// Selector: 4136937754// Selector: 41369377
184contract TokenProperties is Dummy, ERC165 {55contract TokenProperties is Dummy, ERC165 {
426 }297 }
427}298}
299
300// Selector: 6aea9834
301contract Collection is Dummy, ERC165 {
302 // Selector: setCollectionProperty(string,bytes) 2f073f66
303 function setCollectionProperty(string memory key, bytes memory value)
304 public
305 {
306 require(false, stub_error);
307 key;
308 value;
309 dummy = 0;
310 }
311
312 // Selector: deleteCollectionProperty(string) 7b7debce
313 function deleteCollectionProperty(string memory key) public {
314 require(false, stub_error);
315 key;
316 dummy = 0;
317 }
318
319 // Throws error if key not found
320 //
321 // Selector: collectionProperty(string) cf24fd6d
322 function collectionProperty(string memory key)
323 public
324 view
325 returns (bytes memory)
326 {
327 require(false, stub_error);
328 key;
329 dummy;
330 return hex"";
331 }
332
333 // Selector: setCollectionSponsor(address) 7623402e
334 function setCollectionSponsor(address sponsor) public {
335 require(false, stub_error);
336 sponsor;
337 dummy = 0;
338 }
339
340 // Selector: confirmCollectionSponsorship() 3c50e97a
341 function confirmCollectionSponsorship() public {
342 require(false, stub_error);
343 dummy = 0;
344 }
345
346 // Selector: setCollectionLimit(string,uint32) 6a3841db
347 function setCollectionLimit(string memory limit, uint32 value) public {
348 require(false, stub_error);
349 limit;
350 value;
351 dummy = 0;
352 }
353
354 // Selector: setCollectionLimit(string,bool) 993b7fba
355 function setCollectionLimit(string memory limit, bool value) public {
356 require(false, stub_error);
357 limit;
358 value;
359 dummy = 0;
360 }
361
362 // Selector: contractAddress() f6b4dfb4
363 function contractAddress() public view returns (address) {
364 require(false, stub_error);
365 dummy;
366 return 0x0000000000000000000000000000000000000000;
367 }
368
369 // Selector: addCollectionAdmin(address) 92e462c7
370 function addCollectionAdmin(address newAdmin) public view {
371 require(false, stub_error);
372 newAdmin;
373 dummy;
374 }
375
376 // Selector: removeCollectionAdmin(address) fafd7b42
377 function removeCollectionAdmin(address admin) public view {
378 require(false, stub_error);
379 admin;
380 dummy;
381 }
382
383 // Selector: setCollectionNesting(bool) 112d4586
384 function setCollectionNesting(bool enable) public {
385 require(false, stub_error);
386 enable;
387 dummy = 0;
388 }
389
390 // Selector: setCollectionNesting(bool,address[]) 64872396
391 function setCollectionNesting(bool enable, address[] memory collections)
392 public
393 {
394 require(false, stub_error);
395 enable;
396 collections;
397 dummy = 0;
398 }
399
400 // Selector: setCollectionAccess(uint8) 41835d4c
401 function setCollectionAccess(uint8 mode) public {
402 require(false, stub_error);
403 mode;
404 dummy = 0;
405 }
406
407 // Selector: addToCollectionAllowList(address) 67844fe6
408 function addToCollectionAllowList(address user) public view {
409 require(false, stub_error);
410 user;
411 dummy;
412 }
413
414 // Selector: removeFromCollectionAllowList(address) 85c51acb
415 function removeFromCollectionAllowList(address user) public view {
416 require(false, stub_error);
417 user;
418 dummy;
419 }
420
421 // Selector: setCollectionMintMode(bool) 00018e84
422 function setCollectionMintMode(bool mode) public {
423 require(false, stub_error);
424 mode;
425 dummy = 0;
426 }
427}
428428
429// Selector: 780e9d63429// Selector: 780e9d63
430contract ERC721Enumerable is Dummy, ERC165 {430contract ERC721Enumerable is Dummy, ERC165 {
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
247 expect(oldPermissions.mintMode).to.be.false;247 expect(oldPermissions.mintMode).to.be.false;
248 expect(oldPermissions.access).to.be.equal('Normal');248 expect(oldPermissions.access).to.be.equal('Normal');
249249
250 //TODO: change value, when enum generated
250 await collectionEvm.methods.setCollectionAccess('AllowList').send({from: owner});251 await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});
251 await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});252 await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});
252 await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});253 await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});
253254
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
341 "type": "function"341 "type": "function"
342 },342 },
343 {343 {
344 "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],344 "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
345 "name": "setCollectionAccess",345 "name": "setCollectionAccess",
346 "outputs": [],346 "outputs": [],
347 "stateMutability": "nonpayable",347 "stateMutability": "nonpayable",