Core Contracts

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

Incorrect Asset Deposits to Curve Vault in _rebalanceLiquidity

Summary

The _rebalanceLiquidity function is designed to rebalance liquidity between the lending pool and the Curve vault. However, the function incorrectly assumes that the lending pool holds the reserve assets (reserve.reserveAssetAddress) when depositing into Curve vault. This assumption is incorrect because the reserve assets are held in the reserveRTokenAddress contract, not the lending pool. As a result, the _depositIntoVault and _withdrawFromVault functions will fail due to insufficient balance in the lending pool.

Vulnerability Details

The issue arises in the _rebalanceLiquidity function, which attempts to deposit or withdraw reserve assets (reserve.reserveAssetAddress) into/from the Curve vault. The function assumes that the lending pool holds the reserve assets, but in reality, the assets are held in the reserveRTokenAddress contract.

I//@audit assets are transfered to rToken
ERC20(reserve.reserveAssetAddress).safeTransferFrom(
msg.sender, // from
reserve.reserveRTokenAddress, // to
amount // amount
);

The _depositIntoVault function approves and transfers assets from the lending pool (address(this)), but the lending pool does not hold the reserve assets. When _depositIntoVault is called, deposit operations will fail because the lending pool does not have the required reserve assets.

//@audit reserve assets are not in the pool
function _depositIntoVault(uint256 amount) internal {
IERC20(reserve.reserveAssetAddress).approve(address(curveVault), amount);
curveVault.deposit(amount, address(this));
totalVaultDeposits += amount;
}

Impact

deposit, withdraw and borrow will fail when rebalancing and trying to deposit to curve vault

Tools Used

Manual

Recommendations

  • Transfer the required amount of reserve assets from reserveRTokenAddress to the lending pool before depositing into the Curve vault.

    function _depositIntoVault(uint256 amount) internal {
    // Transfer assets from reserveRTokenAddress to the lending pool
    IERC20(reserve.reserveAssetAddress).safeTransferFrom(
    reserve.reserveRTokenAddress, // from
    address(this), // to (lending pool)
    amount // amount
    );
    // Approve and deposit into the Curve vault
    IERC20(reserve.reserveAssetAddress).approve(address(curveVault), amount);
    curveVault.deposit(amount, address(this));
    totalVaultDeposits += amount;
    }
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

LendingPool::_depositIntoVault and _withdrawFromVault don't transfer tokens between RToken and LendingPool, breaking Curve vault interactions

inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

LendingPool::_depositIntoVault and _withdrawFromVault don't transfer tokens between RToken and LendingPool, breaking Curve vault interactions

Support

FAQs

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