contracts/core/tokens/RToken.sol
In the RToken contract, the transfer and transferFrom functions use different scaling factors when adjusting the amount before executing a transfer.
In the transfer function, the amount is scaled using the value retrieved from the lending pool contract’s getNormalizedIncome function.
In contrast, the transferFrom function scales the amount using the _liquidityIndex value, which is stored within the RToken contract.
The _liquidityIndex variable in the RToken contract is initialized to 1e27 (WadRayMath.RAY) and can only be updated via the updateLiquidityIndex function. However, this function can only be called by the reservePool contract, and the lendingPool contract does not include any logic to trigger this update. As a result, the _liquidityIndex value remains static.
On the other hand, the liquidity index obtained from the lending pool contract through the getNormalizedIncome function is dynamic, as it updates whenever lending or borrowing occurs in the pool.
As a result, the actual value transferred differs between the two functions, leading to inconsistent outcomes. This deviation from the ERC-20 standard could introduce bugs in other contracts that interact with the token.
Manual Review
Use the liquidity index value obtained from the lending pool contract when scaling transfer amounts in both the transfer and transferFrom functions.
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.