Skip to content

Commit

Permalink
MEX-514: fix compute user APR if no total staked amount
Browse files Browse the repository at this point in the history
Signed-off-by: Claudiu Lataretu <[email protected]>
  • Loading branch information
claudiulataretu committed Sep 16, 2024
1 parent 450aa76 commit 42d4a06
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/modules/staking/services/staking.compute.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@ export class StakingComputeService {
.plus(additionalUserStakeAmount)
.toFixed();

if (userTotalStakePosition === '0') {
return 0;
}

const userRewardsPerWeek = await this.computeUserRewardsForWeek(
scAddress,
userAddress,
Expand Down Expand Up @@ -726,6 +730,10 @@ export class StakingComputeService {
.plus(additionalUserStakeAmount)
.toFixed();

if (userTotalStakePosition === '0') {
return 0;
}

const userMaxRewardsPerWeek = new BigNumber(
boostedRewardsPerWeek[0].amount,
)
Expand Down

0 comments on commit 42d4a06

Please sign in to comment.