The RToken contract has a double scaling issue in its transfer functions where amounts are scaled down by the liquidity index twice - once in the transfer function and again in the _update function. This leads to incorrect transfer amounts.
The OpenZeppelin ERC20 implementation calls _update() from its transfer functions, creating this double scaling issue.
The transfer function scales the amount by dividing it by the normalized income:
However, the _update function, which is called by the parent ERC20 implementation during transfer, also performs scaling:
This means that when a transfer is made:
First scaling: amount is divided by normalized income in transfer()
Second scaling: the already scaled amount is divided again by normalized income in _update()
This double scaling means users will receive significantly less tokens than intended when transfers occur.
Manual code review
Remove scaling from transfer and transferFrom functions
Keep scaling in _update function
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.