Core Contracts

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

Incorrect RAAC reward calculation due to faulty getUtilizationRate() implementation

Description

The execution flow is tick() --> updateEmissionRate() --> calculateNewEmissionRate() --> getUtilizationRate() to calculate RAAC rewards. getUtilizationRate() calculates totalBorrowed and totalDeposits incorrectly:

File: contracts/core/minters/RAACMinter/RAACMinter.sol
237: /**
238: * @dev Calculates the current system utilization rate
239: * @return The utilization rate as a percentage (0-100)
240: */
241: function getUtilizationRate() internal view returns (uint256) {
242:@---> uint256 totalBorrowed = lendingPool.getNormalizedDebt();
243:@---> uint256 totalDeposits = stabilityPool.getTotalDeposits();
244: if (totalDeposits == 0) return 0;
245: return (totalBorrowed * 100) / totalDeposits;
246: }

On L242 lendingPool.getNormalizedDebt() simply returns the usageIndex (something like 1.05e27) and not the value or amount of debt:

File: contracts/core/pools/LendingPool/LendingPool.sol
609: function getNormalizedDebt() external view returns (uint256) {
610:@---> return reserve.usageIndex;
611: }

Similarly on L243 stabilityPool.getTotalDeposits() returns the rTokens deposited in the stability pool, not the total crvUSD deposited into the system.

This is not the correct "current system utilization rate" and the function would return an incorrect value.

Impact

Users do not get their deserved reward.

Mitigation

On L242, consider using ReserveLibrary's getNormalizedDebt() function. Re-think the logic on L243 whether we need just rToken balance of stability pool or the system's crvUSD balance + borrowed crvUSD.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 month 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 about 1 month 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.