Core Contracts

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

Rebalancing should occur after updating the liquidityBuffer ratio

Summary

The contract currently has a setParamenter function that allows the owner to update the buffer ration as shown below

else if (param == OwnerParameter.LiquidityBufferRatio) {
require(newValue <= 100_00, "Ratio cannot exceed 100%");
uint256 oldValue = liquidityBufferRatio;
liquidityBufferRatio = newValue;
emit LiquidityBufferRatioUpdated(oldValue, newValue);
}

The issue is that this is closely related to the liquidity

function _rebalanceLiquidity() internal {
// if curve vault is not set, do nothing
if (address(curveVault) == address(0)) {
return;
}
uint256 totalDeposits = reserve.totalLiquidity; // Total liquidity in the system
uint256 desiredBuffer = totalDeposits.percentMul(liquidityBufferRatio);
uint256 currentBuffer = IERC20(reserve.reserveAssetAddress).balanceOf(reserve.reserveRTokenAddress);
if (currentBuffer > desiredBuffer) {
uint256 excess = currentBuffer - desiredBuffer;
// Deposit excess into the Curve vault
_depositIntoVault(excess);
} else if (currentBuffer < desiredBuffer) {
uint256 shortage = desiredBuffer - currentBuffer;
// Withdraw shortage from the Curve vault
_withdrawFromVault(shortage);
}
emit LiquidityRebalanced(currentBuffer, totalVaultDeposits);
}

The desiredBuffer will the changed if the liquidity bufferRatio is updated. However, the _rebalanceLiquidity function is not triggered immediately after this change. This means that until _rebalanceLiquidity is called again, the liquidity buffer will remain misaligned with the new ratio.

Impact

Rebalance not updated

Tools Used

manual Review

Recommendations

Add a call to rebalance liquidity after updating the buffer ratio.

Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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