difftreelog
Remove appPromotion + vesting test
in: master
Because it is a feature, not a bug
1 file changed
tests/src/app-promotion.test.tsdiffbeforeafterboth614 expect(totalBalanceBefore).to.be.equal(totalBalanceAfter);614 expect(totalBalanceBefore).to.be.equal(totalBalanceAfter);615 });615 });616616 617 itSub('e2e: should not be credited for vested balance', async ({helper}) => {618 const [staker, sender] = [accounts.pop()!, accounts.pop()!];619 const VESTED_TRANSFER = 300n * nominal;620 const STAKE = 100n * nominal;621 // Arrange: Staker has frozen vested transfer of VESTED_TRANSFER tokens622 await helper.balance.vestedTransfer(sender, staker.address, {start: 1000n, period: 10n, periodCount: 1n, perPeriod: VESTED_TRANSFER});623 // Arrange: Staker has frozen stake of 100 tokens624 await helper.staking.stake(staker, STAKE);625 let [stake] = await helper.staking.getTotalStakedPerBlock({Substrate: staker.address});626627 // Assert: Staker's full balance inludes vested transfer and staked amount628 const stakerBalanceBefore = await helper.balance.getSubstrateFull(staker.address);629 expect(stakerBalanceBefore).to.contain({miscFrozen: VESTED_TRANSFER + STAKE, feeFrozen: VESTED_TRANSFER + STAKE, reserved: 0n});630 expect(stakerBalanceBefore.free / nominal).to.eq(1299n);631 expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'appstake', amount: STAKE, reasons: 'All'}, {id: 'ormlvest', amount: VESTED_TRANSFER, reasons: 'All'}]);632633 await helper.wait.forRelayBlockNumber(rewardAvailableInBlock(stake.block));634 await helper.admin.payoutStakers(palletAdmin, 100);635 // Assert: Staker got reward only for {STAKE} staked tokens636 [stake] = await helper.staking.getTotalStakedPerBlock({Substrate: staker.address});637 const income = calculateIncome(STAKE);638 expect(stake.amount).to.be.equal(income);639 // Assert: Frozen balance increased on {income} amount640 const stakerBalanceAfterReward = await helper.balance.getSubstrateFull(staker.address);641 expect(stakerBalanceAfterReward).to.contain({miscFrozen: VESTED_TRANSFER + income, feeFrozen: VESTED_TRANSFER + income, reserved: 0n});642 expect(stakerBalanceAfterReward.free > stakerBalanceBefore.free).to.be.true;643 expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'appstake', amount: income, reasons: 'All'}, {id: 'ormlvest', amount: VESTED_TRANSFER, reasons: 'All'}]);644645 // Act: Staker can claim:646 await helper.balance.claim(staker);647 // Assert: Staker's frozen balance reduced on {VESTED_TRANSFER} amount648 const stakerBalanceAfterClaim = await helper.balance.getSubstrateFull(staker.address);649 expect(stakerBalanceAfterClaim).to.contain({miscFrozen: income, feeFrozen: income, reserved: 0n});650 expect(stakerBalanceAfterClaim.free).to.eq(stakerBalanceAfterReward.free);651 expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'appstake', amount: income, reasons: 'All'}]);652653 // Act: Staker receives another vested transfer654 await helper.balance.vestedTransfer(sender, staker.address, {start: 1000n, period: 10n, periodCount: 1n, perPeriod: VESTED_TRANSFER});655 // Assert: vested transfer included in balance656 const stakerBalanceAfterSecondVestedTransfer = await helper.balance.getSubstrateFull(staker.address);657 expect(stakerBalanceAfterSecondVestedTransfer).to.contain({miscFrozen: VESTED_TRANSFER + income, feeFrozen: VESTED_TRANSFER + income, reserved: 0n});658 expect(stakerBalanceAfterSecondVestedTransfer.free / nominal).to.eq(1599n);659 expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'appstake', amount: income, reasons: 'All'}, {id: 'ormlvest', amount: VESTED_TRANSFER, reasons: 'All'}]);660661 // Act: Staker can unstake662 await helper.staking.unstake(staker);663 // Assert: Staker's frozen balance reduced on {income} amount664 const stakerBalanceAfterUnstake = await helper.balance.getSubstrateFull(staker.address);665 expect(stakerBalanceAfterUnstake).to.contain({miscFrozen: VESTED_TRANSFER, feeFrozen: VESTED_TRANSFER, reserved: income});666 expect(stakerBalanceAfterUnstake.free / nominal).to.eq(1599n);667 // FIXME: should remove app staking instantly or after unlocking period ends?668 expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'appstake', amount: income, reasons: 'All'}, {id: 'ormlvest', amount: VESTED_TRANSFER, reasons: 'All'}]);669 670 // Assert: Balance after unstaking period ends671 const [pendingUnstake] = await helper.staking.getPendingUnstakePerBlock({Substrate: staker.address}); 672 await helper.wait.forParachainBlockNumber(pendingUnstake.block);673 const stakerBalanceAfterUnstakeFinished = await helper.balance.getSubstrateFull(staker.address);674 expect(stakerBalanceAfterUnstakeFinished).to.contain({miscFrozen: VESTED_TRANSFER, feeFrozen: VESTED_TRANSFER, reserved: 0n});675 expect(stakerBalanceAfterUnstakeFinished.free > stakerBalanceAfterUnstake.free).to.be.true;676 expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'ormlvest', amount: VESTED_TRANSFER, reasons: 'All'}]);677 });678 679 itSub('should bring compound interest', async ({helper}) => {617 itSub('should bring compound interest', async ({helper}) => {680 const staker = accounts.pop()!;618 const staker = accounts.pop()!;