Core Contracts

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

Changing the liquidity pool address leads to stuck funds

Summary

If this function is called more than one time without transferring funds from the old liquidity pool to the new one, any RAAC tokens held in the previous liquidity pool will become inaccessible. This leads to a permanent loss of funds.

Vulnerability Details

  • There is a scenario where setLiquidityPool is called by mistake or the pool address needs to be changed for security reasons and the owner calls the setLiquidityPool function to do so, but this results in the loss of all tokens.

Issue: Funds in the Old Liquidity Pool Are Not Transferred

  • The function setLiquidityPool allows the contract owner to change the liquidity pool address without ensuring that any existing RAAC token balance in the old liquidity pool (if there is one) is transferred to the new one.

  • As a result, those tokens become unrecoverable, leading to financial loss.

Affected Code:

function setLiquidityPool(address _liquidityPool) external onlyOwner {
liquidityPool = _liquidityPool;
emit LiquidityPoolSet(_liquidityPool);
}

Impact

  • Irrecoverable Tokens: Since there is no built-in mechanism to reclaim tokens from the old liquidity pool (if there is one), funds could be lost indefinitely.

Tools Used

  • Manual Code Review

Recommendations

Implement a Safe Transfer Mechanism

Before updating liquidityPool, ensure that the old pool’s RAAC balance is transferred to the new pool:

function setLiquidityPool(address _liquidityPool) external onlyOwner {
require(_liquidityPool != address(0), "Invalid address");
if (liquidityPool != address(0)) {
uint256 balance = raacToken.balanceOf(liquidityPool);
if (balance > 0) {
raacToken.safeTransferFrom(liquidityPool, _liquidityPool, balance);
}
}
liquidityPool = _liquidityPool;
emit LiquidityPoolSet(_liquidityPool);
}

This ensures that any existing RAAC tokens in the old liquidity pool (if there is one) are transferred to the new pool before updating the address.

Another way of dealing with this problem is to add a simple check to see if the liquidityPool is already set, and if it is just throw an custom Error.

Conclusion

The current implementation of setLiquidityPool introduces a risk of fund loss if called more than once.

Severity

  • The likelihood might be low but the impact is critical.

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!