Core Contracts

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

depositRAACFromPool will always revert if liquidityPool address is not whitelisted in RAACToken

Summary

The depositRAACFromPool function in StabilityPool.sol will always revert if neither liquidityPool address and stability pool is whitelisted in RAACToken.

Vulnerability Details

Below is a snippet of the depositRAACFromPoolfunction:

function depositRAACFromPool(uint256 amount) external onlyLiquidityPool validAmount(amount) {
uint256 preBalance = raacToken.balanceOf(address(this));
raacToken.safeTransferFrom(msg.sender, address(this), amount);
uint256 postBalance = raacToken.balanceOf(address(this));
if (postBalance != preBalance + amount) revert InvalidTransfer();
// TODO: Logic for distributing to managers based on allocation
emit RAACDepositedFromPool(msg.sender, amount);
}

As seen above, the after the token is transferred to the stability pool, if postBalance is not equal to preBalance + amount , the function will revert. raacTokenis a fee-on-transfer token, which means that after the token is transferred to the stability pool, the amount received by the stability pool will actually be less than the prebalance + amountwhich in the end make the function revert with InvalidTransfer.

Below is the snippet of the _updatefunction in RAACToken.solwhich causes the fee transfer:

function _update(
address from,
address to,
uint256 amount
) internal virtual override {
uint256 baseTax = swapTaxRate + burnTaxRate;
// Skip tax for whitelisted addresses or when fee collector disabled
if (baseTax == 0 || from == address(0) || to == address(0) || whitelistAddress[from] || whitelistAddress[to] || feeCollector == address(0)) {
super._update(from, to, amount);
return;
}
// All other cases where tax is applied
uint256 totalTax = amount.percentMul(baseTax);
uint256 burnAmount = totalTax * burnTaxRate / baseTax;
super._update(from, feeCollector, totalTax - burnAmount);
super._update(from, address(0), burnAmount);
super._update(from, to, amount - totalTax);
}

As seen above, the tax is applied except if the transfer involves interaction with a whitelisted address.

Impact

The depositRAACFromPoolfunction is bricked if neither liquidityPool address and stability pool address is whitelisted in RAACToken.

Tools Used

Manual review

Recommendations

Ensure that either the liquidity pool address or stability pool is whitelisted in RAACToken.solor change the prebalance and postbalance condition to take into account the tax rate of the RAAC Token.

Updates

Lead Judging Commences

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