Core Contracts

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

No rebalanceLiquidity was performed after _repay

Summary

No rebalanceLiquidity was performed after _repay.

Vulnerability Details

_rebalanceLiquidity is used to rebalance liquidity between the buffer and Curve vault to maintain the desired buffer ratio. The variables involved are uint256 currentBuffer = IERC20(reserve.reserveAssetAddress).balanceOf(reserve.reserveRTokenAddress);. That is to say, as long as reserve.reserveRTokenAddress changes, this function needs to call rebalancing. In the LendingPool.sol contract, the deposit, withdraw, and borrow functions all have _rebalanceLiquidity operations, but there is no _repay function.

Impact

After the _repay operation, if a certain asset in the pool (such as a borrowed asset) is reduced, and other assets are not adjusted in time through _rebalanceLiquidity (such as withdrawing or depositing into Curve Vault), it may cause an imbalance in the proportion of assets in the pool.

Tools Used

Manual review

Recommendations

Add _rebalanceLiquidity to the _repay function

function _repay(uint256 amount, address onBehalfOf) internal {
//......
//......
//......
IERC20(reserve.reserveAssetAddress).safeTransferFrom(msg.sender, reserve.reserveRTokenAddress, amountScaled);
reserve.totalUsage = newTotalSupply;
user.scaledDebtBalance -= amountBurned;
// Update liquidity and interest rates
ReserveLibrary.updateInterestRatesAndLiquidity(reserve, rateData, amountScaled, 0);
// Rebalance liquidity after _repay
_rebalanceLiquidity();
emit Repay(msg.sender, onBehalfOf, actualRepayAmount);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

LendingPool::finalizeLiquidation or repay doesn't call _rebalanceLiquidity, leaving excess funds idle instead of depositing them in Curve vault for yield

Support

FAQs

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