Core Contracts

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

Faulty getUtilizationRate() function in RAACMinter breaks emissionRate calculation

Faulty getUtilizationRate() function in RAACMinter breaks emissionRate calculation

Summary

The RAACMinter#getUtilizationRate() function is intended to calculate the utilization rate of the lending pool by dividing the total borrowed amount by the total deposited amount and returning a value in BPS between 0 and 100.

Vulnerability Details

Currently, RAACMinter#getUtilizationRate() is implemented as follows:

/**
* @dev Calculates the current system utilization rate
* @return The utilization rate as a percentage (0-100)
*/
function getUtilizationRate() internal view returns (uint256) {
šŸ“Œ uint256 totalBorrowed = lendingPool.getNormalizedDebt();
uint256 totalDeposits = stabilityPool.getTotalDeposits();
if (totalDeposits == 0) return 0;
return (totalBorrowed * 100) / totalDeposits;
}

RAACMinter.sol#237

We can observe that, instead of retrieving the total debt from the lending pool, the function fetches the usageIndex, which is a normalized value of the total debt and has 27 decimals by default.

/**
* @notice Gets the reserve's normalized debt
* @return The normalized debt (usage index)
*/
function getNormalizedDebt() external view returns (uint256) {
šŸ“Œ return reserve.usageIndex;
}

LendingPool.sol#609

// @audit default value of usageIndex is 1e27
reserve.usageIndex = uint128(WadRayMath.RAY);

LendingPool#196

Impact

This causes the function to return a value far above 100, rendering the logic for utilizationTarget in calculateNewEmissionRate() ineffective.

Tools Used

Manual review

Recommendations

Add the following function to both LendingPool.sol and ILendingPool.sol:

function getTotalUsage() external view returns (uint256) {
return reserve.totalUsage;
}

Then, update the totalBorrowed variable to:

uint256 totalBorrowed = lendingPool.getTotalUsage();
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!