git.delta.rocks / unique-network / refs/commits / 425a1544a345

difftreelog

Check isOwnerOrAdminCross for rft, nft and ft

Max Andreev2022-12-22parent: #a1111d4.patch.diff
in: master
+ Remove only for vesting test

2 files changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
1515
16import {IKeyringPair} from '@polkadot/types/types';16import {IKeyringPair} from '@polkadot/types/types';
17import {expect} from 'chai';17import {expect} from 'chai';
18import {Pallets} from '../util';
18import {IEthCrossAccountId} from '../util/playgrounds/types';19import {IEthCrossAccountId} from '../util/playgrounds/types';
19import {usingEthPlaygrounds, itEth} from './util';20import {usingEthPlaygrounds, itEth} from './util';
20import {EthUniqueHelper} from './util/playgrounds/unique.dev';21import {EthUniqueHelper} from './util/playgrounds/unique.dev';
39 });40 });
40 });41 });
4142
43 [
44 {mode: 'nft' as const, requiredPallets: []},
45 {mode: 'rft' as const, requiredPallets: [Pallets.ReFungible]},
46 {mode: 'ft' as const, requiredPallets: []},
47 ].map(testCase => {
42 itEth('can add account admin by owner', async ({helper, privateKey}) => {48 itEth.ifWithPallets(`can add account admin by owner for ${testCase.mode}`, testCase.requiredPallets, async ({helper, privateKey}) => {
43 // arrange49 // arrange
44 const owner = await helper.eth.createAccountWithBalance(donor);50 const owner = await helper.eth.createAccountWithBalance(donor);
45 const adminSub = await privateKey('//admin2');51 const adminSub = await privateKey('//admin2');
49 const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);55 const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);
50 const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);56 const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);
51 57
52 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');58 const {collectionAddress, collectionId} = await helper.eth.createCollection(testCase.mode, owner, 'A', 'B', 'C');
53 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);59 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner, true);
5460
61 // Check isOwnerOrAdminCross returns false:
62 expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossSub).call()).to.be.false;
63 expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossEth).call()).to.be.false;
64 expect(await collectionEvm.methods.isOwnerOrAdminCross(helper.ethCrossAccount.fromAddress(adminDeprecated)).call()).to.be.false;
65
55 // Soft-deprecated: can addCollectionAdmin 66 // Soft-deprecated: can addCollectionAdmin
56 await collectionEvm.methods.addCollectionAdmin(adminDeprecated).send();67 await collectionEvm.methods.addCollectionAdmin(adminDeprecated).send();
70 });81 });
71 expect(adminListRpc).to.be.like(adminListEth);82 expect(adminListRpc).to.be.like(adminListEth);
83
84 // 3. check isOwnerOrAdminCross returns true:
85 expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossSub).call()).to.be.true;
86 expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossEth).call()).to.be.true;
87 expect(await collectionEvm.methods.isOwnerOrAdminCross(helper.ethCrossAccount.fromAddress(adminDeprecated)).call()).to.be.true;
72 });88 });
89 });
7390
74 itEth('cross account admin can mint', async ({helper}) => {91 itEth('cross account admin can mint', async ({helper}) => {
75 // arrange: create collection and accounts92 // arrange: create collection and accounts
modifiedtests/src/vesting.test.tsdiffbeforeafterboth
28 });28 });
29 });29 });
3030
31 itSub.only('can perform vestedTransfer and claim tokens', async ({helper}) => {31 itSub('can perform vestedTransfer and claim tokens', async ({helper}) => {
32 // arrange32 // arrange
33 const [sender, recepient] = await helper.arrange.createAccounts([1000n, 1n], donor);33 const [sender, recepient] = await helper.arrange.createAccounts([1000n, 1n], donor);
34 const currentRelayBlock = await helper.chain.getRelayBlockNumber();34 const currentRelayBlock = await helper.chain.getRelayBlockNumber();