difftreelog
CORE-386 Fix names and tests
in: master
8 files changed
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -211,7 +211,7 @@
Ok(())
}
- #[solidity(rename_selector = "setNesting")]
+ #[solidity(rename_selector = "setCollectionNesting")]
fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<void> {
check_is_owner_or_admin(caller, self)?;
let permissions = CollectionPermissions {
@@ -231,7 +231,7 @@
save(self)
}
- #[solidity(rename_selector = "setNesting")]
+ #[solidity(rename_selector = "setCollectionNesting")]
fn set_nesting(
&mut self,
caller: caller,
@@ -309,7 +309,7 @@
Ok(())
}
- fn set_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {
+ fn set_collection_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {
check_is_owner_or_admin(caller, self)?;
let permissions = CollectionPermissions { mint_mode: Some(mode), .. Default::default() };
self.collection.permissions = <Pallet<T>>::clamp_permissions(
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8 uint256 field_0;9 string field_1;10}1112// Common stubs holder13contract Dummy {14 uint8 dummy;15 string stub_error = "this contract is implemented in native";16}1718contract ERC165 is Dummy {19 function supportsInterface(bytes4 interfaceID)20 external21 view22 returns (bool)23 {24 require(false, stub_error);25 interfaceID;26 return true;27 }28}2930// Inline31contract ERC721Events {32 event Transfer(33 address indexed from,34 address indexed to,35 uint256 indexed tokenId36 );37 event Approval(38 address indexed owner,39 address indexed approved,40 uint256 indexed tokenId41 );42 event ApprovalForAll(43 address indexed owner,44 address indexed operator,45 bool approved46 );47}4849// Inline50contract ERC721MintableEvents {51 event MintingFinished();52}5354// Selector: 4136937755contract TokenProperties is Dummy, ERC165 {56 // Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa57 function setTokenPropertyPermission(58 string memory key,59 bool isMutable,60 bool collectionAdmin,61 bool tokenOwner62 ) public {63 require(false, stub_error);64 key;65 isMutable;66 collectionAdmin;67 tokenOwner;68 dummy = 0;69 }7071 // Selector: setProperty(uint256,string,bytes) 1752d67b72 function setProperty(73 uint256 tokenId,74 string memory key,75 bytes memory value76 ) public {77 require(false, stub_error);78 tokenId;79 key;80 value;81 dummy = 0;82 }8384 // Selector: deleteProperty(uint256,string) 066111d185 function deleteProperty(uint256 tokenId, string memory key) public {86 require(false, stub_error);87 tokenId;88 key;89 dummy = 0;90 }9192 // Throws error if key not found93 //94 // Selector: property(uint256,string) 7228c32795 function property(uint256 tokenId, string memory key)96 public97 view98 returns (bytes memory)99 {100 require(false, stub_error);101 tokenId;102 key;103 dummy;104 return hex"";105 }106}107108// Selector: 42966c68109contract ERC721Burnable is Dummy, ERC165 {110 // Selector: burn(uint256) 42966c68111 function burn(uint256 tokenId) public {112 require(false, stub_error);113 tokenId;114 dummy = 0;115 }116}117118// Selector: 58800161119contract ERC721 is Dummy, ERC165, ERC721Events {120 // Selector: balanceOf(address) 70a08231121 function balanceOf(address owner) public view returns (uint256) {122 require(false, stub_error);123 owner;124 dummy;125 return 0;126 }127128 // Selector: ownerOf(uint256) 6352211e129 function ownerOf(uint256 tokenId) public view returns (address) {130 require(false, stub_error);131 tokenId;132 dummy;133 return 0x0000000000000000000000000000000000000000;134 }135136 // Not implemented137 //138 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672139 function safeTransferFromWithData(140 address from,141 address to,142 uint256 tokenId,143 bytes memory data144 ) public {145 require(false, stub_error);146 from;147 to;148 tokenId;149 data;150 dummy = 0;151 }152153 // Not implemented154 //155 // Selector: safeTransferFrom(address,address,uint256) 42842e0e156 function safeTransferFrom(157 address from,158 address to,159 uint256 tokenId160 ) public {161 require(false, stub_error);162 from;163 to;164 tokenId;165 dummy = 0;166 }167168 // Selector: transferFrom(address,address,uint256) 23b872dd169 function transferFrom(170 address from,171 address to,172 uint256 tokenId173 ) public {174 require(false, stub_error);175 from;176 to;177 tokenId;178 dummy = 0;179 }180181 // Selector: approve(address,uint256) 095ea7b3182 function approve(address approved, uint256 tokenId) public {183 require(false, stub_error);184 approved;185 tokenId;186 dummy = 0;187 }188189 // Not implemented190 //191 // Selector: setApprovalForAll(address,bool) a22cb465192 function setApprovalForAll(address operator, bool approved) public {193 require(false, stub_error);194 operator;195 approved;196 dummy = 0;197 }198199 // Not implemented200 //201 // Selector: getApproved(uint256) 081812fc202 function getApproved(uint256 tokenId) public view returns (address) {203 require(false, stub_error);204 tokenId;205 dummy;206 return 0x0000000000000000000000000000000000000000;207 }208209 // Not implemented210 //211 // Selector: isApprovedForAll(address,address) e985e9c5212 function isApprovedForAll(address owner, address operator)213 public214 view215 returns (address)216 {217 require(false, stub_error);218 owner;219 operator;220 dummy;221 return 0x0000000000000000000000000000000000000000;222 }223}224225// Selector: 5b5e139f226contract ERC721Metadata is Dummy, ERC165 {227 // Selector: name() 06fdde03228 function name() public view returns (string memory) {229 require(false, stub_error);230 dummy;231 return "";232 }233234 // Selector: symbol() 95d89b41235 function symbol() public view returns (string memory) {236 require(false, stub_error);237 dummy;238 return "";239 }240241 // Returns token's const_metadata242 //243 // Selector: tokenURI(uint256) c87b56dd244 function tokenURI(uint256 tokenId) public view returns (string memory) {245 require(false, stub_error);246 tokenId;247 dummy;248 return "";249 }250}251252// Selector: 68ccfe89253contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {254 // Selector: mintingFinished() 05d2035b255 function mintingFinished() public view returns (bool) {256 require(false, stub_error);257 dummy;258 return false;259 }260261 // `token_id` should be obtained with `next_token_id` method,262 // unlike standard, you can't specify it manually263 //264 // Selector: mint(address,uint256) 40c10f19265 function mint(address to, uint256 tokenId) public returns (bool) {266 require(false, stub_error);267 to;268 tokenId;269 dummy = 0;270 return false;271 }272273 // `token_id` should be obtained with `next_token_id` method,274 // unlike standard, you can't specify it manually275 //276 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f277 function mintWithTokenURI(278 address to,279 uint256 tokenId,280 string memory tokenUri281 ) public returns (bool) {282 require(false, stub_error);283 to;284 tokenId;285 tokenUri;286 dummy = 0;287 return false;288 }289290 // Not implemented291 //292 // Selector: finishMinting() 7d64bcb4293 function finishMinting() public returns (bool) {294 require(false, stub_error);295 dummy = 0;296 return false;297 }298}299300// Selector: 780e9d63301contract ERC721Enumerable is Dummy, ERC165 {302 // Selector: tokenByIndex(uint256) 4f6ccce7303 function tokenByIndex(uint256 index) public view returns (uint256) {304 require(false, stub_error);305 index;306 dummy;307 return 0;308 }309310 // Not implemented311 //312 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59313 function tokenOfOwnerByIndex(address owner, uint256 index)314 public315 view316 returns (uint256)317 {318 require(false, stub_error);319 owner;320 index;321 dummy;322 return 0;323 }324325 // Selector: totalSupply() 18160ddd326 function totalSupply() public view returns (uint256) {327 require(false, stub_error);328 dummy;329 return 0;330 }331}332333// Selector: c0de6be0334contract Collection is Dummy, ERC165 {335 // Selector: setCollectionProperty(string,bytes) 2f073f66336 function setCollectionProperty(string memory key, bytes memory value)337 public338 {339 require(false, stub_error);340 key;341 value;342 dummy = 0;343 }344345 // Selector: deleteCollectionProperty(string) 7b7debce346 function deleteCollectionProperty(string memory key) public {347 require(false, stub_error);348 key;349 dummy = 0;350 }351352 // Throws error if key not found353 //354 // Selector: collectionProperty(string) cf24fd6d355 function collectionProperty(string memory key)356 public357 view358 returns (bytes memory)359 {360 require(false, stub_error);361 key;362 dummy;363 return hex"";364 }365366 // Selector: setCollectionSponsor(address) 7623402e367 function setCollectionSponsor(address sponsor) public {368 require(false, stub_error);369 sponsor;370 dummy = 0;371 }372373 // Selector: confirmCollectionSponsorship() 3c50e97a374 function confirmCollectionSponsorship() public {375 require(false, stub_error);376 dummy = 0;377 }378379 // Selector: setCollectionLimit(string,uint32) 6a3841db380 function setCollectionLimit(string memory limit, uint32 value) public {381 require(false, stub_error);382 limit;383 value;384 dummy = 0;385 }386387 // Selector: setCollectionLimit(string,bool) 993b7fba388 function setCollectionLimit(string memory limit, bool value) public {389 require(false, stub_error);390 limit;391 value;392 dummy = 0;393 }394395 // Selector: contractAddress() f6b4dfb4396 function contractAddress() public view returns (address) {397 require(false, stub_error);398 dummy;399 return 0x0000000000000000000000000000000000000000;400 }401402 // Selector: addCollectionAdminSubstrate(uint256) 5730062b403 function addCollectionAdminSubstrate(uint256 newAdmin) public view {404 require(false, stub_error);405 newAdmin;406 dummy;407 }408409 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9410 function removeCollectionAdminSubstrate(uint256 newAdmin) public view {411 require(false, stub_error);412 newAdmin;413 dummy;414 }415416 // Selector: addCollectionAdmin(address) 92e462c7417 function addCollectionAdmin(address newAdmin) public view {418 require(false, stub_error);419 newAdmin;420 dummy;421 }422423 // Selector: removeCollectionAdmin(address) fafd7b42424 function removeCollectionAdmin(address admin) public view {425 require(false, stub_error);426 admin;427 dummy;428 }429430 // Selector: setNesting(bool) e8fc50dd431 function setNesting(bool enable) public {432 require(false, stub_error);433 enable;434 dummy = 0;435 }436437 // Selector: setNesting(bool,address[]) 7df12a9a438 function setNesting(bool enable, address[] memory collections) public {439 require(false, stub_error);440 enable;441 collections;442 dummy = 0;443 }444445 // Selector: setCollectionAccess(uint8) 41835d4c446 function setCollectionAccess(uint8 mode) public {447 require(false, stub_error);448 mode;449 dummy = 0;450 }451452 // Selector: addToCollectionAllowList(address) 67844fe6453 function addToCollectionAllowList(address user) public view {454 require(false, stub_error);455 user;456 dummy;457 }458459 // Selector: removeFromCollectionAllowList(address) 85c51acb460 function removeFromCollectionAllowList(address user) public view {461 require(false, stub_error);462 user;463 dummy;464 }465466 // Selector: setMintMode(bool) 5dea9bd5467 function setMintMode(bool mode) public {468 require(false, stub_error);469 mode;470 dummy = 0;471 }472}473474// Selector: d74d154f475contract ERC721UniqueExtensions is Dummy, ERC165 {476 // Selector: transfer(address,uint256) a9059cbb477 function transfer(address to, uint256 tokenId) public {478 require(false, stub_error);479 to;480 tokenId;481 dummy = 0;482 }483484 // Selector: burnFrom(address,uint256) 79cc6790485 function burnFrom(address from, uint256 tokenId) public {486 require(false, stub_error);487 from;488 tokenId;489 dummy = 0;490 }491492 // Selector: nextTokenId() 75794a3c493 function nextTokenId() public view returns (uint256) {494 require(false, stub_error);495 dummy;496 return 0;497 }498499 // Selector: mintBulk(address,uint256[]) 44a9945e500 function mintBulk(address to, uint256[] memory tokenIds)501 public502 returns (bool)503 {504 require(false, stub_error);505 to;506 tokenIds;507 dummy = 0;508 return false;509 }510511 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006512 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)513 public514 returns (bool)515 {516 require(false, stub_error);517 to;518 tokens;519 dummy = 0;520 return false;521 }522}523524contract UniqueNFT is525 Dummy,526 ERC165,527 ERC721,528 ERC721Metadata,529 ERC721Enumerable,530 ERC721UniqueExtensions,531 ERC721Mintable,532 ERC721Burnable,533 Collection,534 TokenProperties535{}tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -191,7 +191,7 @@
function totalSupply() external view returns (uint256);
}
-// Selector: c0de6be0
+// Selector: 7d9262e6
interface Collection is Dummy, ERC165 {
// Selector: setCollectionProperty(string,bytes) 2f073f66
function setCollectionProperty(string memory key, bytes memory value)
@@ -235,11 +235,12 @@
// Selector: removeCollectionAdmin(address) fafd7b42
function removeCollectionAdmin(address admin) external view;
- // Selector: setNesting(bool) e8fc50dd
- function setNesting(bool enable) external;
+ // Selector: setCollectionNesting(bool) 112d4586
+ function setCollectionNesting(bool enable) external;
- // Selector: setNesting(bool,address[]) 7df12a9a
- function setNesting(bool enable, address[] memory collections) external;
+ // Selector: setCollectionNesting(bool,address[]) 64872396
+ function setCollectionNesting(bool enable, address[] memory collections)
+ external;
// Selector: setCollectionAccess(uint8) 41835d4c
function setCollectionAccess(uint8 mode) external;
@@ -250,8 +251,8 @@
// Selector: removeFromCollectionAllowList(address) 85c51acb
function removeFromCollectionAllowList(address user) external view;
- // Selector: setMintMode(bool) 5dea9bd5
- function setMintMode(bool mode) external;
+ // Selector: setCollectionMintMode(bool) 00018e84
+ function setCollectionMintMode(bool mode) external;
}
// Selector: d74d154f
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -25,8 +25,8 @@
} from './util/helpers';
describe('Add collection admins', () => {
- itWeb3('Add admin by owner', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('Add admin by owner', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -42,8 +42,8 @@
.to.be.eq(newAdmin.toLocaleLowerCase());
});
- itWeb3('Add substrate admin by owner', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('Add substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -60,8 +60,8 @@
.to.be.eq(newAdmin.address.toLocaleLowerCase());
});
- itWeb3('(!negative tests!) Add admin by ADMIN is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Add admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -69,7 +69,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const admin = await createEthAccountWithBalance(api, web3);
+ const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdmin(admin).send();
@@ -83,8 +83,8 @@
.to.be.eq(admin.toLocaleLowerCase());
});
- itWeb3('(!negative tests!) Add admin by USER is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Add admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -92,7 +92,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const notAdmin = await createEthAccountWithBalance(api, web3);
+ const notAdmin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
const user = await createEthAccount(web3);
@@ -103,8 +103,8 @@
expect(adminList.length).to.be.eq(0);
});
- itWeb3('(!negative tests!) Add substrate admin by ADMIN is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Add substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -112,7 +112,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const admin = await createEthAccountWithBalance(api, web3);
+ const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdmin(admin).send();
@@ -126,8 +126,8 @@
.to.be.eq(admin.toLocaleLowerCase());
});
- itWeb3('(!negative tests!) Add substrate admin by USER is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Add substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -135,7 +135,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const notAdmin0 = await createEthAccountWithBalance(api, web3);
+ const notAdmin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
const notAdmin1 = privateKey('//Alice');
await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin1.addressRaw).call({from: notAdmin0}))
@@ -147,8 +147,8 @@
});
describe('Remove collection admins', () => {
- itWeb3('Remove admin by owner', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('Remove admin by owner', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -171,8 +171,8 @@
expect(adminList.length).to.be.eq(0);
});
- itWeb3('Remove substrate admin by owner', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('Remove substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -194,8 +194,8 @@
expect(adminList.length).to.be.eq(0);
});
- itWeb3('(!negative tests!) Remove admin by ADMIN is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Remove admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -205,7 +205,7 @@
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
- const admin0 = await createEthAccountWithBalance(api, web3);
+ const admin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await collectionEvm.methods.addCollectionAdmin(admin0).send();
const admin1 = await createEthAccount(web3);
await collectionEvm.methods.addCollectionAdmin(admin1).send();
@@ -221,8 +221,8 @@
}
});
- itWeb3('(!negative tests!) Remove admin by USER is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Remove admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -232,7 +232,7 @@
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
- const admin = await createEthAccountWithBalance(api, web3);
+ const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await collectionEvm.methods.addCollectionAdmin(admin).send();
const notAdmin = await createEthAccount(web3);
@@ -246,8 +246,8 @@
}
});
- itWeb3('(!negative tests!) Remove substrate admin by ADMIN is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Remove substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -258,7 +258,7 @@
const adminSub = privateKey('//Alice');
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();
- const adminEth = await createEthAccountWithBalance(api, web3);
+ const adminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await collectionEvm.methods.addCollectionAdmin(adminEth).send();
await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: adminEth}))
@@ -271,8 +271,8 @@
.to.be.deep.contains(adminEth.toLocaleLowerCase());
});
- itWeb3('(!negative tests!) Remove substrate admin by USER is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Remove substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -283,7 +283,7 @@
const adminSub = privateKey('//Alice');
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();
- const notAdminEth = await createEthAccountWithBalance(api, web3);
+ const notAdminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: notAdminEth}))
.to.be.rejectedWith('NoPermission');
tests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -250,7 +250,7 @@
await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});
await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});
- await collectionEvm.methods.setMintMode(true).send({from: owner});
+ await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});
const newPermissions = (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();
expect(newPermissions.mintMode).to.be.true;
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -386,27 +386,15 @@
"type": "function"
},
{
- "inputs": [
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bytes", "name": "value", "type": "bytes" }
- ],
- "name": "setCollectionProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "sponsor", "type": "address" }
- ],
- "name": "setCollectionSponsor",
+ "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
+ "name": "setCollectionMintMode",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
- "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
- "name": "setMintMode",
+ "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
+ "name": "setCollectionNesting",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
@@ -420,14 +408,26 @@
"type": "address[]"
}
],
- "name": "setNesting",
+ "name": "setCollectionNesting",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
- "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
- "name": "setNesting",
+ "inputs": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "name": "setCollectionProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "sponsor", "type": "address" }
+ ],
+ "name": "setCollectionSponsor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
tests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionAdmin.test.ts
+++ b/tests/src/removeCollectionAdmin.test.ts
@@ -111,18 +111,24 @@
});
});
- it('Admin can\'t remove collection admin.', async () => {
+ it.only('Admin can\'t remove collection admin.', async () => {
await usingApi(async (api, privateKeyWrapper) => {
const collectionId = await createCollectionExpectSuccess();
const alice = privateKeyWrapper('//Alice');
const bob = privateKeyWrapper('//Bob');
const charlie = privateKeyWrapper('//Charlie');
+ const addBobAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
+ await submitTransactionAsync(alice, addBobAdminTx);
+ const addCharlieAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(charlie.address));
+ await submitTransactionAsync(alice, addCharlieAdminTx);
+
const adminListAfterAddAdmin = await getAdminList(api, collectionId);
expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(bob.address));
+ expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(charlie.address));
const removeAdminTx = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));
- await expect(submitTransactionAsync(charlie, removeAdminTx)).to.be.rejected;
+ await expect(submitTransactionExpectFailAsync(charlie, removeAdminTx)).to.be.rejected;
const adminListAfterRemoveAdmin = await getAdminList(api, collectionId);
expect(adminListAfterRemoveAdmin).to.be.deep.contains(normalizeAccountId(bob.address));