From 96ff0aa089ed70b17d069db31aead39fe96e3262 Mon Sep 17 00:00:00 2001 From: IliaAzhel Date: Thu, 10 Oct 2024 04:32:09 +0300 Subject: [PATCH] [Farming] update farming tests snapshots --- src/farming/test/unit/EternalFarms.spec.ts | 33 ++++++++++++++----- src/farming/test/unit/FarmingCenter.spec.ts | 16 ++++----- .../__snapshots__/EternalFarms.spec.ts.snap | 4 +-- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/farming/test/unit/EternalFarms.spec.ts b/src/farming/test/unit/EternalFarms.spec.ts index 780b7771..d0eb4939 100644 --- a/src/farming/test/unit/EternalFarms.spec.ts +++ b/src/farming/test/unit/EternalFarms.spec.ts @@ -1445,10 +1445,24 @@ describe('unit/EternalFarms', () => { }); it('do not update rewards if nothing to collect', async () => { + let rewardTokenAddress = await context.rewardToken.getAddress() + let bonusRewardTokenAddress = await context.bonusRewardToken.getAddress() + + await context.eternalFarming.connect(actors.wallets[0]).setRates( + { + rewardToken: rewardTokenAddress, + bonusRewardToken: bonusRewardTokenAddress, + pool: context.pool01, + nonce: localNonce, + }, + 0, + 0 + ); + await context.eternalFarming.connect(lpUser0).collectRewards( { - rewardToken: await context.rewardToken.getAddress(), - bonusRewardToken: await context.bonusRewardToken.getAddress(), + rewardToken: rewardTokenAddress, + bonusRewardToken: bonusRewardTokenAddress, pool: context.pool01, nonce: localNonce, }, @@ -1456,13 +1470,13 @@ describe('unit/EternalFarms', () => { lpUser0.address ); - const rewardTokenBalanceBefore = await context.eternalFarming.rewards(lpUser0.address, context.rewardToken); - const bonusRewardTokenBalanceBefore = await context.eternalFarming.rewards(lpUser0.address, context.bonusRewardToken); + const rewardTokenBalanceBefore = await context.eternalFarming.rewards(lpUser0.address, rewardTokenAddress); + const bonusRewardTokenBalanceBefore = await context.eternalFarming.rewards(lpUser0.address, bonusRewardTokenAddress); await context.eternalFarming.connect(lpUser0).collectRewards( { - rewardToken: await context.rewardToken.getAddress(), - bonusRewardToken: await context.bonusRewardToken.getAddress(), + rewardToken: rewardTokenAddress, + bonusRewardToken: bonusRewardTokenAddress, pool: context.pool01, nonce: localNonce, }, @@ -1470,8 +1484,9 @@ describe('unit/EternalFarms', () => { lpUser0.address ); - const rewardTokenBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.rewardToken); - const bonusRewardTokenBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.bonusRewardToken); + const rewardTokenBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, rewardTokenAddress); + const bonusRewardTokenBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, bonusRewardTokenAddress); + expect(rewardTokenBalanceAfter).to.be.eq(rewardTokenBalanceBefore); expect(bonusRewardTokenBalanceAfter).to.be.eq(bonusRewardTokenBalanceBefore); @@ -1643,7 +1658,7 @@ describe('unit/EternalFarms', () => { await context.rewardToken.getAddress(), await context.bonusRewardToken.getAddress(), lpUser0.address, - 9999n, + 9079n, 199n ); }); diff --git a/src/farming/test/unit/FarmingCenter.spec.ts b/src/farming/test/unit/FarmingCenter.spec.ts index 58f91bb6..c1542518 100644 --- a/src/farming/test/unit/FarmingCenter.spec.ts +++ b/src/farming/test/unit/FarmingCenter.spec.ts @@ -572,11 +572,11 @@ describe('unit/FarmingCenter', () => { let balanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.rewardToken); let bonusBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.bonusRewardToken); - expect(balanceAfter - balanceBefore).to.equal(199699n); - expect(bonusBalanceAfter - bonusBalanceBefore).to.equal(99549n); + expect(balanceAfter - balanceBefore).to.equal(189799); + expect(bonusBalanceAfter - bonusBalanceBefore).to.equal(94599); - await claimAndCheck(context.rewardToken, lpUser0, 199699n); - await claimAndCheck(context.bonusRewardToken, lpUser0, 99549n); + await claimAndCheck(context.rewardToken, lpUser0, 189799n); + await claimAndCheck(context.bonusRewardToken, lpUser0, 94599n); }); it('collect rewards after eternalFarming deactivate', async () => { @@ -631,11 +631,11 @@ describe('unit/FarmingCenter', () => { let balanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.rewardToken); let bonusBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.bonusRewardToken); - expect(balanceAfter - balanceBefore).to.equal(199699n); - expect(bonusBalanceAfter - bonusBalanceBefore).to.equal(99549n); + expect(balanceAfter - balanceBefore).to.equal(189799); + expect(bonusBalanceAfter - bonusBalanceBefore).to.equal(94599); - await claimAndCheck(context.rewardToken, lpUser0, 199699n); - await claimAndCheck(context.bonusRewardToken, lpUser0, 99549n); + await claimAndCheck(context.rewardToken, lpUser0, 189799n); + await claimAndCheck(context.bonusRewardToken, lpUser0, 94599n); }); it('cannot collect if not owner', async () => { diff --git a/src/farming/test/unit/__snapshots__/EternalFarms.spec.ts.snap b/src/farming/test/unit/__snapshots__/EternalFarms.spec.ts.snap index 2616188c..38bb6739 100644 --- a/src/farming/test/unit/__snapshots__/EternalFarms.spec.ts.snap +++ b/src/farming/test/unit/__snapshots__/EternalFarms.spec.ts.snap @@ -2,6 +2,6 @@ exports[`unit/EternalFarms #claimReward when requesting the full amount has gas cost [ @skip-on-coverage ] 1`] = `60772`; -exports[`unit/EternalFarms #enterFarming works and has gas cost [ @skip-on-coverage ] 1`] = `506125`; +exports[`unit/EternalFarms #enterFarming works and has gas cost [ @skip-on-coverage ] 1`] = `499494`; -exports[`unit/EternalFarms #exitFarming after end time works and has gas cost [ @skip-on-coverage ] 1`] = `175750`; +exports[`unit/EternalFarms #exitFarming after end time works and has gas cost [ @skip-on-coverage ] 1`] = `177134`;