The LendingPool contract does not correctly calculate the amount of RTokens to mint to users upon deposit of reserve assets. This stems from the fact that the calculated balanceIncrease is not incremented to the user's amountToMint.
When users invoke LendingPool.deposit(), they specify an amount of reserve assets which they will supply and get minted RTokens in exchange:
In ReserveLibrary.deposit(), the mint() function from RToken is invoked to mint RToken to the depositor passing the same amount as amountToMint:
Now in RToken.mint(), the following is done:
balanceIncrease represents the interest accrued to the user's balance between the last time their balance was updated and the current mint operation. It ensures that users receive credit for the interest that has accrued on their deposited liquidity.
However, the function calculates the balanceIncrease based on the index delta but fails to increment this to the user's amountToMint. It then simply proceeds to mint the user an incorrect amount leaving the calculated balanceIncrease unused anywhere.
This causes the amountToMint to be incorrect, potentially causing them to receive less RToken than expected.
Manual Review
The amountToMint should be updated to include the balanceIncrease:
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.