Skip to content

Commit

Permalink
Fix a possible bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehsan-saradar committed May 6, 2024
1 parent 8296e04 commit 584bd3d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion x/liquidstake/keeper/rebalancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ func (k Keeper) AutocompoundStakingRewards(ctx sdk.Context, whitelistedValsMap t

// subtract fee from accumulated rewards
acRewards := k.GetAccumulatingRewards(ctx)
acRewards = acRewards.Sub(autocompoundFee.Amount)
if autocompoundFee.Amount.GTE(acRewards) {
acRewards = sdk.ZeroInt()
} else {
acRewards = acRewards.Sub(autocompoundFee.Amount)
}
k.SetAccumulatingRewards(ctx, acRewards)

ctx.EventManager().EmitEvents(sdk.Events{
Expand Down

0 comments on commit 584bd3d

Please sign in to comment.