The transfer and transferFrom functions in the RToken contract incorrectly handle the scaling of transfer amounts, leading to discrepancies in the transferred amounts. The issue arises due to double scaling and inconsistent use of the liquidity index.
Double Scaling Issue:
Both transfer and transferFrom functions divide the transfer amount by the liquidity index or normalized income. However, the _update function, which is called internally, also scales the amount by the normalized income. This results in the transfer amount being divided by the liquidity index twice, leading to a lower-than-intended transfer amount.
Inconsistent Index Usage:
The transfer function uses ILendingPool(_reservePool).getNormalizedIncome() for scaling, while the transferFrom function uses _liquidityIndex. This inconsistency can lead to different transfer amounts being calculated for the same intended transfer, especially since _liquidityIndex is not updated properly due to the lack of implementation in the LendingPool.
Users transferring less than the intended amount.
Discrepancies in the transfer amounts between transfer and transferFrom.
Potential integration issues with external platforms due to unreliable transfer amounts.
Manual
Remove the scaling operation from the transfer and transferFrom functions, as it is already handled in the _update function. This will prevent double scaling.
Implement the updateLiquidityIndex function in the LendingPool to ensure _liquidityIndex is always up-to-date, aligning it with the normalized income used in transfer.
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.