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

difftreelog

fix after rebase

Trubnikov Sergey2022-12-09parent: #e047487.patch.diff
in: master

4 files changed

modifiedtests/src/eth/collectionLimits.test.tsdiffbeforeafterboth
13 });13 });
1414
15 [15 [
16 {case: 'nft' as const, method: 'createNFTCollection' as const},16 {case: 'nft' as const},
17 {case: 'rft' as const, method: 'createRFTCollection' as const, requiredPallets: [Pallets.ReFungible]},17 {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},
18 {case: 'ft' as const, method: 'createFTCollection' as const},18 {case: 'ft' as const},
19 ].map(testCase =>19 ].map(testCase =>
20 itEth.ifWithPallets(`for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {20 itEth.ifWithPallets(`for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {
21 const owner = await helper.eth.createAccountWithBalance(donor);21 const owner = await helper.eth.createAccountWithBalance(donor);
22 const {collectionId, collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, 'Limits', 'absolutely anything', 'FLO', 18);22 const {collectionId, collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'FLO', 18);
23 const limits = {23 const limits = {
24 accountTokenOwnershipLimit: 1000,24 accountTokenOwnershipLimit: 1000,
25 sponsoredDataSize: 1024,25 sponsoredDataSize: 1024,
71 });71 });
7272
73 [73 [
74 {case: 'nft' as const, method: 'createNFTCollection' as const},74 {case: 'nft' as const},
75 {case: 'rft' as const, method: 'createRFTCollection' as const, requiredPallets: [Pallets.ReFungible]},75 {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},
76 {case: 'ft' as const, method: 'createFTCollection' as const},76 {case: 'ft' as const},
77 ].map(testCase =>77 ].map(testCase =>
78 itEth.ifWithPallets(`for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {78 itEth.ifWithPallets(`for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {
79 const invalidLimits = {79 const invalidLimits = {
82 };82 };
8383
84 const owner = await helper.eth.createAccountWithBalance(donor);84 const owner = await helper.eth.createAccountWithBalance(donor);
85 const {collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, 'Limits', 'absolutely anything', 'ISNI', 18);85 const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'ISNI', 18);
86 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);86 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
87 await expect(collectionEvm.methods87 await expect(collectionEvm.methods
88 .setCollectionLimit('badLimit', '1')88 .setCollectionLimit('badLimit', '1')
modifiedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
128 let sponsorship = (await collectionSub.getData())!.raw.sponsorship;128 let sponsorship = (await collectionSub.getData())!.raw.sponsorship;
129 expect(sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsorEth, true));129 expect(sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsorEth, true));
130 // Account cannot confirm sponsorship if it is not set as a sponsor130 // Account cannot confirm sponsorship if it is not set as a sponsor
131 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');131 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmUnsetSponsorFail');
132 132
133 // Sponsor can confirm sponsorship:133 // Sponsor can confirm sponsorship:
134 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsorEth});134 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsorEth});
173 tokenId: '1',173 tokenId: '1',
174 },174 },
175 },175 },
176 ]);176 );
177 177
178 const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));178 const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
179 const sponsorBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsorEth));179 const sponsorBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsorEth));
289 tokenId: '1',289 tokenId: '1',
290 },290 },
291 },291 },
292 ]);292 );
293 expect(await collectionEvm.methods.tokenURI(tokenId).call({from: user})).to.be.equal('Test URI');293 expect(await collectionEvm.methods.tokenURI(tokenId).call({from: user})).to.be.equal('Test URI');
294 294
295 const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));295 const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
modifiedtests/src/eth/destroyCollection.test.tsdiffbeforeafterboth
21describe('Destroy Collection from EVM', function() {21describe('Destroy Collection from EVM', function() {
22 let donor: IKeyringPair;22 let donor: IKeyringPair;
23 const testCases = [23 const testCases = [
24 {method: 'createRFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF'], requiredPallets: [Pallets.ReFungible]},24 {case: 'rft' as const, params: ['Limits', 'absolutely anything', 'OLF'], requiredPallets: [Pallets.ReFungible]},
25 {method: 'createNFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF'], requiredPallets: [Pallets.NFT]},25 {case: 'nft' as const, params: ['Limits', 'absolutely anything', 'OLF'], requiredPallets: [Pallets.NFT]},
26 {method: 'createFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF', 18], requiredPallets: [Pallets.Fungible]},26 {case: 'ft' as const, params: ['Limits', 'absolutely anything', 'OLF', 18], requiredPallets: [Pallets.Fungible]},
27 ];27 ];
2828
29 before(async function() {29 before(async function() {
33 });33 });
3434
35 testCases.map((testCase) => 35 testCases.map((testCase) =>
36 itEth.ifWithPallets(`Cannot burn non-owned or non-existing collection ${testCase.method}`, testCase.requiredPallets, async ({helper}) => {36 itEth.ifWithPallets(`Cannot burn non-owned or non-existing collection ${testCase.case}`, testCase.requiredPallets, async ({helper}) => {
37 const owner = await helper.eth.createAccountWithBalance(donor);37 const owner = await helper.eth.createAccountWithBalance(donor);
38 const signer = await helper.eth.createAccountWithBalance(donor);38 const signer = await helper.eth.createAccountWithBalance(donor);
39 39
40 const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);40 const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);
41 41
42 const collectionHelpers = helper.ethNativeContract.collectionHelpers(signer);42 const collectionHelpers = helper.ethNativeContract.collectionHelpers(signer);
43 const {collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, ...testCase.params as [string, string, string, number?]);43 const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, ...testCase.params as [string, string, string, number?]);
4444
45 // cannot burn collec45 // cannot burn collec
46 await expect(collectionHelpers.methods46 await expect(collectionHelpers.methods
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
202 const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);202 const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
203 const functionName: string = this.createCollectionMethodName(mode);203 const functionName: string = this.createCollectionMethodName(mode);
204204
205 const functionParams = functionName === 'createFTCollection' ? [name, decimals, description, tokenPrefix] : [name, description, tokenPrefix];205 const functionParams = mode === 'ft' ? [name, decimals, description, tokenPrefix] : [name, description, tokenPrefix];
206 const result = await collectionHelper.methods[functionName](...functionParams).send({value: Number(collectionCreationPrice)});206 const result = await collectionHelper.methods[functionName](...functionParams).send({value: Number(collectionCreationPrice)});
207207
208 const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);208 const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
231 }231 }
232232
233 createFungibleCollection(signer: string, name: string, decimals: number, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[]}> {233 createFungibleCollection(signer: string, name: string, decimals: number, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[]}> {
234 return this.createCollecion('createFTCollection', signer, name, description, tokenPrefix, decimals);234 return this.createCollection('ft', signer, name, description, tokenPrefix, decimals);
235 }235 }
236236
237 async createERC721MetadataCompatibleRFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {237 async createERC721MetadataCompatibleRFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {