Core Contracts

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

Incorrect utilization rate calculation

Summary

getUtilizationRate is using an incorrect variable, leading to excessively inflated rate and constant max emissions.

Details

getUtilizationRate fetches 2 variables - totalBorrowed and totalDeposits

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

getTotalDeposits checks the rToken balance of the stability pool. However getNormalizedDebt returns the usageIndex which is a number expressed in RAY (1e27).

function getNormalizedDebt() external view returns (uint256) {
return reserve.usageIndex;
}

The return value of getUtilizationRate will be larger than 1e9, while utilizationRate is expected to be a 2-digit number.
Emission rate calculation will always perform calculations based on max utilization. Protocol will always operate on maxEmissionRate leading to overdistribution and loss of funds.

function calculateNewEmissionRate() internal view returns (uint256) {
uint256 utilizationRate = getUtilizationRate();
uint256 adjustment = (emissionRate * adjustmentFactor) / 100;
if (utilizationRate > utilizationTarget) { // @audit-issue this will always pass, forever
uint256 increasedRate = emissionRate + adjustment;
uint256 maxRate = increasedRate > benchmarkRate ? increasedRate : benchmarkRate;
return maxRate < maxEmissionRate ? maxRate : maxEmissionRate;
} else if (utilizationRate < utilizationTarget) {
uint256 decreasedRate = emissionRate > adjustment ? emissionRate - adjustment : 0;
uint256 minRate = decreasedRate < benchmarkRate ? decreasedRate : benchmarkRate;
return minRate > minEmissionRate ? minRate : minEmissionRate;
}
}

Impact

Unfair emission distribution, loss of funds for the protocol

Mitigation

Use the actual total debt, not the usage index.

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!