Skip to content

Commit

Permalink
MEX-533: fix compute method for user rewards for week
Browse files Browse the repository at this point in the history
- add additionalUserEnergyAmount to user energy
  • Loading branch information
mad2sm0key committed Nov 26, 2024
1 parent e8ebeee commit 79a905f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/modules/farm/v2/services/farm.v2.compute.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ export class FarmComputeServiceV2
? await this.farmAbi.farmTokenSupply(scAddress)
: await this.farmAbi.farmSupplyForWeek(scAddress, week);

userEnergyForWeek.amount = new BigNumber(userEnergyForWeek.amount)
.plus(additionalUserEnergyAmount)
.toFixed();
totalEnergyForWeek = new BigNumber(totalEnergyForWeek)
.plus(additionalUserEnergyAmount)
.toFixed();
Expand Down Expand Up @@ -368,6 +371,12 @@ export class FarmComputeServiceV2
farmedTokenPriceUSD,
);

console.log({
rewardsPerWeekUSD: userRewardsPerWeekUSD.toFixed(),
totalFarmPositionUSD: userTotalFarmPositionUSD.toFixed(),
additionalUserEnergy,
});

return new BigNumber(userRewardsPerWeekUSD)
.multipliedBy(52)
.dividedBy(userTotalFarmPositionUSD)
Expand Down

0 comments on commit 79a905f

Please sign in to comment.