StabilityPool
compute users RAAC rewards based on their instantaneous balance of tokens at the time of withdrawal.
Because nothing prevents users to deposit and withdraw in a same block, it is possible to flash-loan a huge amount of tokens to get a proportional amount of rewards, without really participating in the economics of the protocol.
Let's see how rewards are computed.
First, the user must deposit rTokens
into the StabilityPool
:
rTokens can be obtained by depositing crvUSD
into the LendingPool
.
From the snippet above, we can see that depositing rTokens
automatically mint deTokens
and increase the userDeposit
balance.
The _mintRAACRewards()
mints the RAAC rewards for the entire pool, that will then be proportionally distributed to users at withdraw.
Once user has deposited rTokens
, nothing prevent him to call withdraw()
right away:
In the function above, the function of interest is calculateRaacRewards()
at L229
which returns raacRewards
:
The function compute the user reward based on the instantaneous userDeposit
and the totalDeposits
and return his share of the total deposits.
Then, if we check back the withdraw()
function, the user gets transferred raacRewards
of RAAC tokens, even though he simply flash-loaned, deposited, and withdrawn in a same tx.
Drain of RAAC rewards out of the Stability Pool.
Do not allow users to deposit and withdraw from the pool in a same block, this is common practice in this type of systems.
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.