Submitted by WatchPug, also found by hyh
LiquidityFarming.sol#L265-L291
LiquidityProviders.sol#L286-L292
In HyphenLiquidityFarming, the accTokenPerShare is calculated based on the total staked shares.
However, as the mintedSharesAmount can easily become very large on LiquidityProviders.sol, all the users can lose their rewards due to precision loss.
Given:
Then:
accumulator = rewardsPerSecond * 24 hours == 864000e18 == 8.64e23
Expected Results: As the sole staker, Alice should get all the 864000e18 rewards.
Actual Results: Alice received 0 rewards.
Thats because when totalSharesStaked > 1e36, accumulator = (accumulator * ACC_TOKEN_PRECISION) / totalSharesStaked[_baseToken]; will be round down to 0.
When the totalSharesStaked is large enough, all users will lose their rewards due to precision loss.
See also the Recommendation on Issue #139.
ankurdubey521 (Biconomy) confirmed
pauliax (judge) commented:
