During token transfers, the RToken
contract does not mint accrued interest for the sender before updating _userState
. This leads to a mismatch where the sender continues to accrue interest on tokens they no longer own, while the receiver does not accrue interest on the received tokens until they perform a mint
or burn
operation.
The contract maintains interest accrual using an index stored in _userState[account].index
. However, during transfer()
and transferFrom()
, the sender’s interest is not settled before updating _userState
.
This results in:
Over-accrual for the sender: The sender’s balance continues to compound interest as if they still own the tokens, even after transferring them.
Under-accrual for the receiver: The receiver does not start earning interest on the received tokens until they explicitly trigger a mint or burn action.
This breaks the expected behavior of an interest-bearing token where all token balances should consistently reflect accrued interest.
The issue originates in the _update()
function, which is called during transfers:
Here, the accrued interest is not minted before updating _userState
, leading to incorrect tracking of interest accumulation.
Users who transfer tokens will continue earning interest on tokens they no longer own.
Recipients will not accrue interest on received tokens until they interact with the contract again.
This could lead to discrepancies in yield distribution and potential loss of funds for recipients expecting to accrue interest immediately upon receiving tokens.
Manual Review
Before executing the _update()
function in transfer()
and transferFrom()
, the accrued interest for the sender should be minted and accounted for. This ensures:
The sender stops earning interest on transferred tokens.
The receiver starts earning interest immediately upon receiving tokens.
Modify _update()
to calculate and mint accrued interest before updating _userState
.
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.