The StabilityPool mints RAACToken rewards for users that have deposited their RToken. Attackers can observe the mempool and deposit a large amount of RTokens into the StabilityPool right before RAACToken rewards get minted, resulting in the attacker getting most of the rewards. The attacker then leaves the system right after that by withdrawing their RToken from the StabilityPool.
The StabilityPool mints RAACToken whenever users deposit() into or withdraw() from the pool. By depositing RToken into the pool, users get DEToken in return at a 1:1 ratio, representing their share of the rewards.
Here's what that looks like:
To get access to the rewards, users simply have to withdraw() their RToken by sending their DEToken back to the stability pool:
This looks okay, but there's a problem in the calculateRAACRewards() function. It doesn't take the time factor into account and simply calculates the rewards based on the DEToken supply and deposit, regardless how long the user has participated in the system:
What this means is, it allows an attacker to deposit a large amount of RToken when a lot of RAACToken have been minted, withdraw again, and receive a large portion of the rewards, while other users have been locking their RToken in the StabilityPool for much longer.
An attacker with significant funds is able to take most of the rewards out of the system, leaving other participants with a loss of potential rewards.
Manual review.
To account for this, it's better to include some sort of time factor in the rewards calculation.
This can be done by issuing shares inside of the StabilityPool using an "index", similar to how it's done in the LendingPool.
Users that have deposited their RToken longer will naturally have more shares, resulting in a fair reward distribution.
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.