Core Contracts

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

Liquidity Rate Over-Calculation Due to Missing Division by RAY

Description

The calculateLiquidityRate function in the contract incorrectly computes the liquidity rate due to the lack of division by RAY after the multiplication of utilizationRate and usageRate. This results in an overestimation of the liquidity rate, causing incorrect financial calculations in the protocol. The issue arises because both utilizationRate and usageRate are stored in RAY precision (1e27), and their multiplication results in a value scaled by RAY^2. However, without normalization by RAY, the final computed liquidity rate would be over-calculated.

Impact

  • Overestimated Liquidity Rate: The liquidity rate is significantly higher than expected, leading to excessive interest rate calculations.

Scenario

  1. utilizationRate is 50% (0.5 * RAY = 5e26).

  2. usageRate is 10% (0.1 * RAY = 1e26).

  3. computed liquidity rate is 5e28 instead of the expected 5e25 (i.e., 5%).

Root Cause

The incorrect calculation occurs due to the missing division by RAY when computing grossLiquidityRate:

uint256 grossLiquidityRate = utilizationRate.rayMul(usageRate);

Since both utilizationRate and usageRate are in RAY precision, their product is in RAY^2 precision. The missing division by RAY inflates the result incorrectly.

Suggested Fix

Modify the calculation of grossLiquidityRate to normalize the result by dividing by RAY:

uint256 grossLiquidityRate = utilizationRate.rayMul(usageRate) / RAY;

This ensures that the liquidity rate remains within expected bounds.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!