The RToken::transfer
and RToken::transferFrom
functions apply scaling when transferring tokens, but the scaling mechanism is inconsistent due to the _liquidityIndex
not being updated. The RToken::updateLiquidityIndex
function, responsible for modifying _liquidityIndex
, is never invoked, resulting in a static value that may lead to incorrect transfer calculations.
Problem description
In RToken::transfer
, the transferred amount is scaled down using ILendingPool(_reservePool).getNormalizedIncome()
.
In RToken::transferFrom
, the transferred amount is scaled down using _liquidityIndex
.
_liquidityIndex
is intended to be updated by RToken::updateLiquidityIndex
, but since this function is only callable by the reserve pool and is never invoked, _liquidityIndex
remains constant.
This discrepancy can lead to incorrect calculations for transfer
and transferFrom
amounts, resulting in potential loss or misrepresentation of value.
Steps to reproduce
Call transfer
or transferFrom
on RToken
.
Observe that the scaled amount is calculated based on a static _liquidityIndex
that does not reflect real-time liquidity changes.
Since _liquidityIndex
is never updated, the scaling logic remains outdated, leading to unintended behavior.
Incorrect transfer calculations: Token transfers may not properly reflect the intended amounts.
Potential loss of value: Due to outdated scaling, users may receive fewer tokens than expected.
Operational inefficiency: The protocol relies on a mechanism that does not function as intended.
Manual Review, VSCode
Invoke updateLiquidityIndex
within the reserve pool logic to ensure _liquidityIndex
is regularly adjusted based on actual liquidity conditions.
Standardize the scaling mechanism by aligning transfer
and transferFrom
to use the same scaling factor consistently.
Add fail-safes to prevent transfers if _liquidityIndex
is outdated, ensuring users are not affected by incorrect scaling.
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.