difftreelog
Nested rft pieces burn test
in: master
1 file changed
tests/src/sub/refungible/nesting.test.tsdiffbeforeafterboth58 });58 });59 });59 });606061 itSub('owner can unnest nested token', async ({helper}) => {61 itSub('Owner can unnest nested token', async ({helper}) => {62 const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});62 const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});63 const targetToken = await collection.mintToken(alice);63 const targetToken = await collection.mintToken(alice);646477 expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(0n);77 expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(0n);78 });78 });797980 itSub('owner can burn nested token', async ({helper}) => {80 itSub('Owner can burn nested token pieces', async ({helper}) => {81 const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});81 const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});82 const targetToken = await collection.mintToken(alice);82 const targetToken = await collection.mintToken(alice);838384 // Owner mints nested RFT token:84 // Owner mints nested RFT token:85 const collectionRFT = await helper.rft.mintCollection(alice);85 const collectionRFT = await helper.rft.mintCollection(alice);86 const token = await collectionRFT.mintToken(alice, 10n, targetToken.nestingAccount());86 const token = await collectionRFT.mintToken(alice, 100n, {Substrate: alice.address});87 await token.transfer(alice, targetToken.nestingAccount(), 30n);878888 // 1.1 Owner can partially burnFrom nested pieces:89 // 1.1 Owner can partially burnFrom nested pieces:89 await token.burnFrom(alice, targetToken.nestingAccount(), 6n);90 await token.burnFrom(alice, targetToken.nestingAccount(), 10n);90 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(0n);91 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(70n);91 expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(4n);92 expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(20n);92 expect(await targetToken.getChildren()).to.has.length(1);93 expect(await targetToken.getChildren()).to.has.length(1);939494 // 1.1 Owner can burnFrom all nested pieces:95 // 1.1 Owner can burnFrom all nested pieces:95 await token.burnFrom(alice, targetToken.nestingAccount(), 4n);96 await token.burnFrom(alice, targetToken.nestingAccount(), 20n);96 expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(0n);97 expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(0n);97 expect(await targetToken.getChildren()).to.has.length(0);98 expect(await targetToken.getChildren()).to.has.length(0);98 expect(await token.doesExist()).to.be.false;99 expect(await token.doesExist()).to.be.true;100101 // 2. Target token does not contain any pieces and can be burnt:102 await targetToken.burn(alice);103 expect(await targetToken.doesExist()).to.be.false;99 });104 });100});105});101106