Core Contracts

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

Incorrect Utilization Rate Calculation in RAACMinter Due to Usage Index Confusion

Relevant Context

The RAACMinter contract implements a dynamic emission rate mechanism that adjusts based on the system's utilization rate. The utilization rate is meant to represent the ratio of borrowed assets to total deposits, expressed as a percentage between 0 and 100.

Finding Description

The getUtilizationRate() function in RAACMinter incorrectly uses the usage index from LendingPool.getNormalizedDebt() instead of the actual total borrowed amount when calculating the utilization rate. The usage index is a RAY-scaled (27 decimals) accumulator used for interest calculations, not the actual amount of debt in the system.

The current implementation:

function getUtilizationRate() internal view returns (uint256) {
uint256 totalBorrowed = lendingPool.getNormalizedDebt(); // Returns usage index (RAY)
uint256 totalDeposits = stabilityPool.getTotalDeposits(); // Returns actual deposits (WAD)
if (totalDeposits == 0) return 0;
return (totalBorrowed * 100) / totalDeposits;
}

This leads to an incorrect utilization rate calculation because it's comparing incompatible units: a RAY-scaled index against WAD-scaled deposits.

Impact Explanation

High. The incorrect utilization rate directly affects the emission rate calculations in calculateNewEmissionRate(), which determines the amount of RAAC tokens minted. This could result in either excessive or insufficient token emissions, potentially destabilizing the protocol's tokenomics.

Likelihood Explanation

High. This issue will affect every emission rate calculation, as it's a fundamental error in the utilization rate computation that occurs under normal operation.

Proof of Concept

  1. Assume the usage index is 1.5e27 (RAY)

  2. Total deposits are 1000e18 (WAD)

  3. Current calculation: (1.5e27 * 100) / 1000e18 = 150,000%

  4. This produces an impossibly high utilization rate, causing the emission rate to consistently hit the maximum

Recommendation

Modify the getUtilizationRate() function to use the debt token's total supply instead of the usage index:

function getUtilizationRate() internal view returns (uint256) {
// ... existing code ...
uint256 totalBorrowed = lendingPool.debtToken().totalSupply();
uint256 totalDeposits = stabilityPool.getTotalDeposits();
if (totalDeposits == 0) return 0;
return (totalBorrowed * 100) / totalDeposits;
// ... existing code ...
}

This solution uses the debt token's total supply, which accurately tracks the total outstanding debt in the system in WAD (18 decimals), making it compatible with the deposits amount for calculating the utilization percentage.

Updates

Lead Judging Commences

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

RAACMinter::getUtilizationRate incorrectly mixes stability pool deposits with lending pool debt index instead of using proper lending pool metrics

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

RAACMinter::getUtilizationRate incorrectly mixes stability pool deposits with lending pool debt index instead of using proper lending pool metrics

Support

FAQs

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

Give us feedback!