Core Contracts

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

Not Reverting When Not Enough Liquidity And Curve Vault Not Set

Summary

In the LendingPool.sol contract the _ensureLiquidity function should revert instead of returning when there is not enough liquidity when the Curve vault is not set, ensuring proper handling of insufficient liquidity scenarios.

Vulnerability Details

The vulnerability arises from the _ensureLiquidity function, which currently returns without taking any action if there is not enough liquidity and the Curve vault is not set. This behavior can lead to silent failures where the function does not provide any feedback or error, potentially causing unexpected behavior in the protocol.

Impact

By returning silently when there is not enough liquidity, the protocol will fail to handle insufficient liquidity scenarios properly. This will lead to failed withdrawals or borrowing attempts without clear error messages, causing confusion for users and potentially leading to financial discrepancies. It undermines the reliability and predictability of the protocol's operations.

Tools Used

Manual Review

Recommendations

To mitigate this vulnerability, update the _ensureLiquidity function to revert with an appropriate error message when there is not enough liquidity and the Curve vault is not set. Here is an example of how to implement this:

function _ensureLiquidity(uint256 amount) internal {
uint256 availableLiquidity = IERC20(reserve.reserveAssetAddress).balanceOf(reserve.reserveRTokenAddress);
if (availableLiquidity < amount) {
// if curve vault is not set, revert with an error
if (address(curveVault) == address(0)) {
revert InsufficientLiquidity();
}
uint256 requiredAmount = amount - availableLiquidity;
// Withdraw required amount from the Curve vault
_withdrawFromVault(requiredAmount);
}
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 7 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.

Give us feedback!