Core Contracts

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

Borrow rate calculations do not align with protocol's intenations of reaching optima rate.

Bug description

calculateBorrowRate is used to calculate the usage rate.

ReserveLibrary.sol#L218-L225

rateData.currentUsageRate = calculateBorrowRate(
rateData.primeRate,
rateData.baseRate,
rateData.optimalRate,
rateData.maxRate,
rateData.optimalUtilizationRate,
utilizationRate
);

This usageRate is then used to calculate the usageIndex which determines interest paid by borrowers. The higher the usageRate, the higher the usagIndex and subsequently the interest for borrowers.

ReserveLibrary.sol#L138-L142

reserve.usageIndex = calculateUsageIndex(
rateData.currentUsageRate,
timeDelta,
reserve.usageIndex
);

Let's look at calculations inside the calculateBorrowRate() function.

ReserveLibrary.sol#L283-L293

if (utilizationRate <= optimalUtilizationRate) {
uint256 rateSlope = primeRate - baseRate;
uint256 rateIncrease = utilizationRate.rayMul(rateSlope).rayDiv(
optimalUtilizationRate
);
rate = baseRate + rateIncrease;
} else {
uint256 excessUtilization = utilizationRate -
optimalUtilizationRate;
uint256 maxExcessUtilization = WadRayMath.RAY -
optimalUtilizationRate;
uint256 rateSlope = maxRate - primeRate;
uint256 rateIncrease = excessUtilization.rayMul(rateSlope).rayDiv(
maxExcessUtilization
);
rate = primeRate + rateIncrease;
}

If we look at the second branch it correctly increases rates when utilization is greater than the optimal, since the goal is to disincentivize borrowing activities to bring utilization closer back to optimal. However, the first branch that is triggered when utilization is lesser or equal to the optimal, also increases the rate, which yet again disincentivizes borrowing even more, since there's already not enough borrowing activity. Additionally, rates are also increased when utilization is at the optimal rate, while they should stay the same as the balance has already been reached and there's no need to disrupt it with rate changes.

Impact

Calculations of borrow rates do not align with the intentions of the protocol to reach optimal rate. When the protocol needs to incentivize borrowing activity due to utilization being lesser than the optimal one, the rates are increased which dicentivizes borrowing activity. When the utilization is at the optimal rate, new rate changes are going to result in changes in borrowing activity which will drive the utilization rate away from the optimal one.

Recommended Mitigation

When the utilization rate is lesser than the optimal, rates should decrease. When utilization is at the optimal rate, no rate changes should be made.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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