rToken
is an ERC20 with overridden transfer functions. When a user wants to transfer tokens, the amount gets scaled to account for the current liquidityIndex
of the LendingPool
. However, this amount also gets calculated at the overridden _update
function, so the initial amount gets scaled 2 times instead of 1.
The _update
function in the ERC20 tokens gets used in the mint
, burn
and transfer
functions to update the addresses' balances internally. In the mint
and burn
functions of rToken
, the unscaled amount is correctly entered and gets scaled by the _update
function. However, transfer functions also scale that amount before, so it gets scaled twice resulting in wrong amounts getting transferred.
In every transfer, wrong amount is actually getting transferred because the amount is getting scaled down twice.
Manual review
Remove the scaling from the transfer functions and allow only _update
to calculate the scaled amount.
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.