This bug results in users transferring significantly fewer RTokens than expected, leading to incorrect balance updates and potential loss of funds due to unintended transfer reductions.
Affected Components:
transfer function in RToken
transferFrom function in RToken
_update function in RToken
The RToken contract implements a scaling mechanism for transferring tokens based on the underlying asset's value. However, due to redundant scaling in both the transfer function and the _update function, the transferred amount is scaled twice, causing an incorrect and lower-than-expected transfer.
The transfer and transferFrom functions scale the amount using rayDiv(ILendingPool(_reservePool).getNormalizedIncome()) before calling super.transfer().
The _update function, which is invoked on every transfer operation, scales the amount again using the same rayDiv operation before calling super._update().
As a result, the transferred amount is effectively reduced by an additional factor of rayDiv(ILendingPool(_reservePool).getNormalizedIncome()), making it significantly lower than expected.
Assume 1 RToken is backed by 2 underlying tokens.
A user wants to transfer 2 underlying tokens worth of RTokens.
The transfer function scales amount by rayDiv(ILendingPool(_reservePool).getNormalizedIncome()), reducing it to 1 RToken.
The _update function then applies the same scaling again, further reducing the transfer amount unexpectedly.
The recipient ends up receiving much less than the intended amount.
Users transferring RTokens experience unintended balance reductions.
Contract logic relying on accurate token transfers may fail.
Potential financial loss due to incorrect value transfers.
Remove the redundant scaling operation from either the transfer function or the _update function.
A potential fix:
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.