Core Contracts

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

Utilization is wrongly computed and would vary in magnitude

Summary

Utilization is wrongly computed and would vary in magnitude

Vulnerability Details

getUtilizationRate computes the utilization wrong as it doesn't take into account percentage increases, but it uses total balance increases instead. In simple terms, deepening on how much rToken.balanceOf(address(this)) there is the utilization rate would vary by a few orders of magnitude.

function getUtilizationRate() internal view returns (uint256) {
// reserve.usageIndex - 1e27
uint256 totalBorrowed = lendingPool.getNormalizedDebt();
// rToken.balanceOf(address(this)) - 1e18
uint256 totalDeposits = stabilityPool.getTotalDeposits();
if (totalDeposits == 0) return 0;
// stabilityPool can have 1e24 tokens or more and
// usageIndex will always be in 1e27
// 1e27 * 100 / 1e18 = 1e11
return (totalBorrowed * 100) / totalDeposits;
}

Example:

  1. Stability pool can have 1k tokens - 1e21 and utilization would be 1e27 * 100 / 1e21 = 1e8

  2. Stability pool can have 100k tokens - 1e23 and utilization would be 1e27 * 100 / 1e23 = 1e6

  3. Stability pool can have 1m tokens - 1e24 and utilization would be 1e27 * 100 / 1e24 = 1e5

Here utilization varies from 10_000 (1e5) to 100_000_000 (1e8), which are orders of magnitude different.

he main issue would be in calculateNewEmissionRate as it must have a fixed min, target and max utilization. However since these 2 numbers are so much different this would mean that either utilization is above max or bellow min.

Impact

is used inside calculateNewEmissionRate, which would impact the amount of rewards that are calculated.
Utilization is always either bellow min or above max

Tools Used

Manual review

Recommendations

User percentage based utilization instead.

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!