git.delta.rocks / unique-network / refs/commits / a851f1b0aa7b

difftreelog

Add changeCollectionOwnerCross checks

Max Andreev2022-12-02parent: #231aa66.patch.diff
in: master

1 file changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
405405
406 itEth('Change owner [cross]', async ({helper}) => {406 itEth('Change owner [cross]', async ({helper}) => {
407 const owner = await helper.eth.createAccountWithBalance(donor);407 const owner = await helper.eth.createAccountWithBalance(donor);
408 const ownerEth = await helper.eth.createAccountWithBalance(donor);
409 const ownerCrossEth = helper.ethCrossAccount.fromAddress(ownerEth);
408 const [newOwner] = await helper.arrange.createAccounts([10n], donor);410 const [ownerSub] = await helper.arrange.createAccounts([10n], donor);
409 const newOwnerCross = helper.ethCrossAccount.fromKeyringPair(newOwner);411 const ownerCrossSub = helper.ethCrossAccount.fromKeyringPair(ownerSub);
412
410 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');413 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
411 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);414 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
412415
413 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;416 expect(await collectionEvm.methods.isOwnerOrAdminCross(ownerCrossSub).call()).to.be.false;
414417
418 // Can set ethereum owner:
415 await collectionEvm.methods.changeCollectionOwnerCross(newOwnerCross).send();419 await collectionEvm.methods.changeCollectionOwnerCross(ownerCrossEth).send({from: owner});
416
417 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.true;420 expect(await collectionEvm.methods.isOwnerOrAdminCross(ownerCrossEth).call()).to.be.true;
421 expect(await helper.collection.getData(collectionId))
422 .to.have.property('normalizedOwner').that.is.eq(helper.address.ethToSubstrate(ownerEth));
423
424 // Can set Substrate owner:
425 await collectionEvm.methods.changeCollectionOwnerCross(ownerCrossSub).send({from: ownerEth});
426 expect(await collectionEvm.methods.isOwnerOrAdminCross(ownerCrossSub).call()).to.be.true;
427 expect(await helper.collection.getData(collectionId))
428 .to.have.property('normalizedOwner').that.is.eq(ownerSub.address);
418 });429 });
419430
420 itEth.skip('change owner call fee', async ({helper}) => {431 itEth.skip('change owner call fee', async ({helper}) => {