Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Valid

`RToken::transfer()` always transfers wrong amounts

Vulnerability Details

On RToken::transfer() a wrong amount will always be transferred. As the amount argument is applied twice a rayDiv() with the liquidity index.

When transfering the first div happens here.

And the second happens in _update(), here.

This is because transfer calls eventually call update. See OZ ERC20 implementation here.

Impact

RToken::transfer() results always in the receiver receiving less amount.

Recommendations

Only apply the rayDiv() once, remove the division here. The _update() div one will now be the only one.

For reference you can see AAVE aToken::ScaledBalanceToken code, they only apply it once, here. Right before the common ERC20 logic call.

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RToken::transfer and transferFrom double-scale amounts by dividing in both external functions and _update, causing users to transfer significantly less than intended

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RToken::transfer and transferFrom double-scale amounts by dividing in both external functions and _update, causing users to transfer significantly less than intended

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!