Core Contracts

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

Double Taxation in NFT Minting Refund

Summary

The RAAC NFT contract has a vulnerability where users are charged fees twice when receiving a refund for overpayment during NFT minting. The first fee is charged when transferring the amount to the fund, and a second fee is charged when receiving the refund amount.

Vulnerability Details

When a user mints an NFT and sends more tokens than the required price, the contract attempts to refund the excess amount. However, due to the tax mechanism in the RToken contract's _update function, fees are charged twice:

  1. First fee charged when transferring payment to contract

  2. Second fee charged when receiving refund of excess amount

The relevant code:

function mint(uint256 _tokenId, uint256 _amount) public override {
uint256 price = raac_hp.tokenToHousePrice(_tokenId);
if(price == 0) { revert RAACNFT__HousePrice(); }
if(price > _amount) { revert RAACNFT__InsufficientFundsMint(); }
// transfer erc20 from user to contract - requires pre-approval from user
token.safeTransferFrom(msg.sender, address(this), _amount);
// mint tokenId to user
_safeMint(msg.sender, _tokenId);
// If user approved more than necessary, refund the difference
if (_amount > price) {
uint256 refundAmount = _amount - price;
token.safeTransfer(msg.sender, refundAmount);
}
emit NFTMinted(msg.sender, _tokenId, price);
}

Impact

Users who overpay when minting NFTs end up paying more in fees than intended due to the double taxation. This results in financial loss for users and makes the actual cost of minting higher than advertised.

Tools Used

  • Manual code review

Recommendations

Consider removing the refund mechanism and instead directly deducting the required amount. You can use the price value instead of _amount.

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

Appeal created

0x180db Submitter
7 months ago
inallhonesty Lead Judge
7 months ago
0x180db Submitter
7 months ago
inallhonesty Lead Judge
7 months ago
inallhonesty Lead Judge 6 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!