Core Contracts

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

Incorrect Scaling Calculation in RToken Burn Function

Summary

The RToken contract's burn function incorrectly uses rayMul instead of rayDiv when calculating the scaled amount, resulting in inflated burn values that cause users to lose funds by burning more RTokens than necessary for the same amount of underlying assets. This benefits the protocol and remaining RToken holders at the expense of users performing burns.

Vulnerability Details

The calculation multiplies the amount by the index instead of dividing it. Since the liquidity index typically grows over time and is greater than 1 RAY, this results in an inflated amountScaled value.

Example:

  • Amount to burn: 100 asset tokens

  • Current index: 2.0 RAY

  • Current calculation of RTokens: 100 * 2.0 = 200 (incorrect)

  • Expected calculation of RTokens: 100 / 2.0 = 50 (correct)

function burn(
address from,
address receiverOfUnderlying,
uint256 amount,
uint256 index
) external override onlyReservePool returns (uint256, uint256, uint256) {
// ...
uint256 amountScaled = amount.rayMul(index); // @audit incorrect: using rayMul instead of rayDiv
// ...
}

Impact

HIGH - Users are losing more Tokens than intended.

  1. Users burning RTokens lose significant value

  2. Less underlying tokens received per RToken burned

  3. The loss increases as the liquidity index grows over time

  4. The protocol unfairly gains value at the expense of users

Recommendations

Replace the rayMul operation with rayDiv

-- uint256 amountScaled = amount.rayMul(index);
++ uint256 amountScaled = amount.rayDiv(index);
Updates

Lead Judging Commences

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

RToken::burn incorrectly calculates amountScaled using rayMul instead of rayDiv, causing incorrect token burn amounts and breaking the interest accrual mechanism

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

RToken::burn incorrectly calculates amountScaled using rayMul instead of rayDiv, causing incorrect token burn amounts and breaking the interest accrual mechanism

Support

FAQs

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