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`;