_getCurrentPoolRate()
calculates the current rate for a specific pool. If the pool has no deposits, it returns the existing rate. If there are deposits, it calculates the rewards earned in the current period and adjusts the rate accordingly based on the total deposited amount in the pool.
Here is the _getCurrentPoolRate()
function implementation:
A rounding to 0 can occur in the getCurrentPoolRate() function which leads to a loss of rewards for the stakers. With the following values:
`
rewards = 1e3
PRECISION = 1e18
totalDeposited = 10000*1e18
`
the calculation will round down to 0. The _getCurrentPoolRate is called when stakers stake/withdraw, the pool rate will updated to the new rate and the pool lastUpdate timestamp will be updated to the current timestamp. Thus, stakers rewards will be lost.
The example displays a small value but as the totalDeposited increases, rewards will be lost in the rounding process.
Stakers will lose rewards when the current rate calculation round to 0.
Manual review
Consider changing the _getCurrentPoolRate implementaion to:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.