StabilityPool.sol can be drained from its rewards due to how rewards are calculated via flashloan or ordinary deposit/withdraw cycles from users .
calculateRaacRewards is called everytime a withdraw is initiated from msg.sender calculating his rewards proportional to his Deposit amounts from TotalRewards and TotalDeposits in the system.
due to how userRewards are calculated : (totalRewards * userDeposit) / totalDeposits
example math :
TotalRewards = 5000 , userDeposit = 1000 , totalDeposits = 10000
(5000*1000) / 10000 = 500 userRewards
}
That way of simplistic Rewards calculation taking balances and deposits at the moment for calculation , and malicious user being able to deposit and withdraw without restrictions he can deposit/Withdraw as much as he wants and everytime take a share of the rewards for the pool till its drained or malicious user can wait for the Depositing of RaacRewards through depositRAACFromPool ,Flashloan huge amount of Rtoken making his userDeposit big % of TotalDeposits in the pool , leading to him stealing huge amount of rewards from the pool ,that is also repeatable till the rewards are drained .
due to how rewards are calculated and no restrictions on deposit/withdraw to users , Rewards can be easily drained vie Deposit/Withdraw cycles or flashloans .
manual review
incorporate Time restrictions on deposit and withdraw or locking similiar to veRAACtoken.sol
change the Rewards calculation to take into account the Locking mechanism .
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.