The contract mints RToken at a 1:1 ratio with crvUSD deposits, which is incorrect.
Here's how the process of minting the incorrect amount of RToken works:
A user calls the LendingPool::deposit function, providing the amount variable as input, which represents the amount of crvUSD the user intends to deposit.
In the ReserveLibrary.deposit function, the specified amount of crvUSD is transferred from the user to the contract.
Next, the RToken::mint function is executed, with amount being one of the inputs.
Inside the mint function, the amount is referred to as amountToMint, which can be quite misleading.
At line 136, the amountToMint of RToken is minted for the user without considering index and balanceIncrease.
This issue can lead to users losing their funds.
Manual review
To account for index and balanceIncrease when calculating the amount of RToken to be minted, amountScaled should be computed as follows:
Now amountScaled should be minted instead of amountToMint.
The balanceIncrease is the interest that has already accrued on the user's existing scaledBalance since their last interaction. It's not something you mint as new tokens in the _mint function.
The balanceIncrease is the interest that has already accrued on the user's existing scaledBalance since their last interaction. It's not something you mint as new tokens in the _mint function.
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.