Core Contracts

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

Withdraw from vault doesn't sends tokens to reserve.reserveRTokenAddress

Summary

Withdraw from vault doesn't sends tokens to reserve.reserveRTokenAddress due to which there won't be enough tokens required for withdrawal in r token contract.

Vulnerability Details

Following is function which enusres there is enough liquidity when a depositor calls the withdraw function

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

Issue is in withdraw from vault function

function _withdrawFromVault(uint256 amount) internal {
curveVault.withdraw(amount, address(this), msg.sender, 0, new address[](0));
totalVaultDeposits -= amount;
}

As we can see that even if enough tokens are withdrawn from the vault ,those tokens are not sent to the r token address due to which withdrawal will fail.

Impact

Withdrawal will fail even if there are enough tokens

Tools Used

Manual review

Recommendations

Send the withdrawn tokens from the vault to the rtoken contract.

Updates

Lead Judging Commences

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