Core Contracts

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

Raac token fee on transfer issue.

Summary

Raac token is free on transfer token due to which actual amount of tokens transferrred to the fee collector account maybe different. This is not taken care properly in fee collector.

Vulnerability Details

Following is how base tax is taken from transferring raac token

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);
}

We can clearly see that onloy when fee collector is address zero then only no tax is taken otherwise tax is reduced from the actual amount. My reasoning for this is that if fee collectors were exempted from tax then there wouldn't be any check like if fee collector is zero then only exempt the tax. Due to this fee collectors are also accounted for the tax.

There are variious instances where raac token is transferred but fees on transfer case is not handled correctly.

function collectFee(uint256 amount, uint8 feeType) external override nonReentrant whenNotPaused returns (bool) {
if (amount == 0 || amount > MAX_FEE_AMOUNT) revert InvalidFeeAmount();
if (feeType > 7) revert InvalidFeeType();
// Transfer tokens from sender
raacToken.safeTransferFrom(msg.sender, address(this), amount);
// Update collected fees
_updateCollectedFees(amount, feeType);
emit FeeCollected(feeType, amount);
return true;
}

Impact

Incorrect token calcualtions in fee collector account.

Tools Used

Recommendations

Use difference in balance of fee collector for calculating how much tokens were transferred

Updates

Lead Judging Commences

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