difftreelog
CORE-386 Fix PR
in: master
7 files changed
pallets/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);
pallets/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(());
}
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth51 event MintingFinished();51 event MintingFinished();52}52}5354// Selector: 1248b7d155contract Collection is Dummy, ERC165 {56 // Selector: setCollectionProperty(string,bytes) 2f073f6657 function setCollectionProperty(string memory key, bytes memory value)58 public59 {60 require(false, stub_error);61 key;62 value;63 dummy = 0;64 }6566 // Selector: deleteCollectionProperty(string) 7b7debce67 function deleteCollectionProperty(string memory key) public {68 require(false, stub_error);69 key;70 dummy = 0;71 }7273 // Throws error if key not found74 //75 // Selector: collectionProperty(string) cf24fd6d76 function collectionProperty(string memory key)77 public78 view79 returns (bytes memory)80 {81 require(false, stub_error);82 key;83 dummy;84 return hex"";85 }8687 // Selector: setCollectionSponsor(address) 7623402e88 function setCollectionSponsor(address sponsor) public {89 require(false, stub_error);90 sponsor;91 dummy = 0;92 }9394 // Selector: confirmCollectionSponsorship() 3c50e97a95 function confirmCollectionSponsorship() public {96 require(false, stub_error);97 dummy = 0;98 }99100 // Selector: setCollectionLimit(string,uint32) 6a3841db101 function setCollectionLimit(string memory limit, uint32 value) public {102 require(false, stub_error);103 limit;104 value;105 dummy = 0;106 }107108 // Selector: setCollectionLimit(string,bool) 993b7fba109 function setCollectionLimit(string memory limit, bool value) public {110 require(false, stub_error);111 limit;112 value;113 dummy = 0;114 }115116 // Selector: contractAddress() f6b4dfb4117 function contractAddress() public view returns (address) {118 require(false, stub_error);119 dummy;120 return 0x0000000000000000000000000000000000000000;121 }122123 // Selector: addCollectionAdmin(address) 92e462c7124 function addCollectionAdmin(address newAdmin) public view {125 require(false, stub_error);126 newAdmin;127 dummy;128 }129130 // Selector: removeCollectionAdmin(address) fafd7b42131 function removeCollectionAdmin(address admin) public view {132 require(false, stub_error);133 admin;134 dummy;135 }136137 // Selector: setCollectionNesting(bool) 112d4586138 function setCollectionNesting(bool enable) public {139 require(false, stub_error);140 enable;141 dummy = 0;142 }143144 // Selector: setCollectionNesting(bool,address[]) 64872396145 function setCollectionNesting(bool enable, address[] memory collections)146 public147 {148 require(false, stub_error);149 enable;150 collections;151 dummy = 0;152 }153154 // Selector: setCollectionAccess(string) 392172a9155 function setCollectionAccess(string memory mode) public {156 require(false, stub_error);157 mode;158 dummy = 0;159 }160161 // Selector: addToCollectionAllowList(address) 67844fe6162 function addToCollectionAllowList(address user) public view {163 require(false, stub_error);164 user;165 dummy;166 }167168 // Selector: removeFromCollectionAllowList(address) 85c51acb169 function removeFromCollectionAllowList(address user) public view {170 require(false, stub_error);171 user;172 dummy;173 }174175 // Selector: setCollectionMintMode(bool) 00018e84176 function setCollectionMintMode(bool mode) public {177 require(false, stub_error);178 mode;179 dummy = 0;180 }181}18253183// Selector: 4136937754// Selector: 41369377184contract TokenProperties is Dummy, ERC165 {55contract TokenProperties is Dummy, ERC165 {426 }297 }427}298}299300// Selector: 6aea9834301contract Collection is Dummy, ERC165 {302 // Selector: setCollectionProperty(string,bytes) 2f073f66303 function setCollectionProperty(string memory key, bytes memory value)304 public305 {306 require(false, stub_error);307 key;308 value;309 dummy = 0;310 }311312 // Selector: deleteCollectionProperty(string) 7b7debce313 function deleteCollectionProperty(string memory key) public {314 require(false, stub_error);315 key;316 dummy = 0;317 }318319 // Throws error if key not found320 //321 // Selector: collectionProperty(string) cf24fd6d322 function collectionProperty(string memory key)323 public324 view325 returns (bytes memory)326 {327 require(false, stub_error);328 key;329 dummy;330 return hex"";331 }332333 // Selector: setCollectionSponsor(address) 7623402e334 function setCollectionSponsor(address sponsor) public {335 require(false, stub_error);336 sponsor;337 dummy = 0;338 }339340 // Selector: confirmCollectionSponsorship() 3c50e97a341 function confirmCollectionSponsorship() public {342 require(false, stub_error);343 dummy = 0;344 }345346 // Selector: setCollectionLimit(string,uint32) 6a3841db347 function setCollectionLimit(string memory limit, uint32 value) public {348 require(false, stub_error);349 limit;350 value;351 dummy = 0;352 }353354 // Selector: setCollectionLimit(string,bool) 993b7fba355 function setCollectionLimit(string memory limit, bool value) public {356 require(false, stub_error);357 limit;358 value;359 dummy = 0;360 }361362 // Selector: contractAddress() f6b4dfb4363 function contractAddress() public view returns (address) {364 require(false, stub_error);365 dummy;366 return 0x0000000000000000000000000000000000000000;367 }368369 // Selector: addCollectionAdmin(address) 92e462c7370 function addCollectionAdmin(address newAdmin) public view {371 require(false, stub_error);372 newAdmin;373 dummy;374 }375376 // Selector: removeCollectionAdmin(address) fafd7b42377 function removeCollectionAdmin(address admin) public view {378 require(false, stub_error);379 admin;380 dummy;381 }382383 // Selector: setCollectionNesting(bool) 112d4586384 function setCollectionNesting(bool enable) public {385 require(false, stub_error);386 enable;387 dummy = 0;388 }389390 // Selector: setCollectionNesting(bool,address[]) 64872396391 function setCollectionNesting(bool enable, address[] memory collections)392 public393 {394 require(false, stub_error);395 enable;396 collections;397 dummy = 0;398 }399400 // Selector: setCollectionAccess(uint8) 41835d4c401 function setCollectionAccess(uint8 mode) public {402 require(false, stub_error);403 mode;404 dummy = 0;405 }406407 // Selector: addToCollectionAllowList(address) 67844fe6408 function addToCollectionAllowList(address user) public view {409 require(false, stub_error);410 user;411 dummy;412 }413414 // Selector: removeFromCollectionAllowList(address) 85c51acb415 function removeFromCollectionAllowList(address user) public view {416 require(false, stub_error);417 user;418 dummy;419 }420421 // Selector: setCollectionMintMode(bool) 00018e84422 function setCollectionMintMode(bool mode) public {423 require(false, stub_error);424 mode;425 dummy = 0;426 }427}428428429// Selector: 780e9d63429// Selector: 780e9d63430contract ERC721Enumerable is Dummy, ERC165 {430contract ERC721Enumerable is Dummy, ERC165 {tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -42,64 +42,6 @@
event MintingFinished();
}
-// Selector: 1248b7d1
-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: 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(string) 392172a9
- function setCollectionAccess(string memory 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: 41369377
interface TokenProperties is Dummy, ERC165 {
// Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa
@@ -232,6 +174,64 @@
function finishMinting() external returns (bool);
}
+// Selector: 6aea9834
+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: 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: 780e9d63
interface ERC721Enumerable is Dummy, ERC165 {
// Selector: tokenByIndex(uint256) 4f6ccce7
tests/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});
tests/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",