Core Contracts

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

`_depositIntoVault()` function always reverts due to missing asset transfer

Summary

The incorrect assumption about asset location in _depositIntoVault() will cause transaction reverts for all protocol operations as assets are held by RToken contract instead of LendingPool

Root Cause

In LendingPool.sol the _depositIntoVault() function attempts to transfer assets directly from LendingPool, but assets are actually held by the RToken contract as shown in ReserveLibrary.sol.

function _depositIntoVault(uint256 amount) internal {
IERC20(reserve.reserveAssetAddress).approve(address(curveVault), amount);
curveVault.deposit(amount, address(this));
totalVaultDeposits += amount;
}

Internal pre-conditions

  1. Any function that calls _rebalanceLiquidity() needs to be executed (deposit, withdraw, borrow)

  2. Assets need to be transferred to reserve.reserveRTokenAddress during deposit

Impact

The protocol operations will be completely blocked as core functions like deposit, withdraw, and borrow will revert due to failed vault deposits. This effectively makes the protocol unusable.

Proof of Concept

The issue occurs because:

  1. During deposit, assets are transferred to reserve.reserveRTokenAddress (ReserveLibrary.sol)

  2. When _depositIntoVault() is called, it tries to transfer assets from LendingPool

  3. Since LendingPool doesn't hold the assets, the transfer fails and reverts

Mitigation

Add asset transfer from RToken before vault deposit:

function _depositIntoVault(uint256 amount) internal {
+ IRToken(reserve.reserveRTokenAddress).transferAsset(address(this), amount);
IERC20(reserve.reserveAssetAddress).approve(address(curveVault), amount);
curveVault.deposit(amount, address(this));
totalVaultDeposits += amount;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months 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 7 months 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.

Give us feedback!