Core Contracts

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

Incorrect Decimal Handling in `Auction.sol` Causes Overpayment in USDC for ZENO Purchases

Summary

The current implementation of Auction.sol and ZENO.sol has a decimal mismatch issue between USDC (6 decimals) and ZENO (18 decimals). This leads to incorrect pricing calculations in the buy(...) function, causing users to pay an excessively large amount of USDC. Similarly, in the redeem(...) function of ZENO.sol, the redemption amount is incorrectly calculated, making conversions between ZENO and USDC inaccurate.

Vulnerability Details

The issue arises due to the difference in decimal precision between USDC and ZENO, without proper scaling applied in the buy(...) function:

function buy(uint256 amount) external whenActive { // 1
require(amount <= state.totalRemaining, "Not enough ZENO remaining");
uint256 price = getPrice();
uint256 cost = price * amount;
require(usdc.transferFrom(msg.sender, businessAddress, cost), "Transfer failed");
bidAmounts[msg.sender] += amount;
state.totalRemaining -= amount;
state.lastBidTime = block.timestamp;
state.lastBidder = msg.sender;
zeno.mint(msg.sender, amount);
emit ZENOPurchased(msg.sender, amount, price);
}

Here, the cost is calculated as price * amount, where price is the USDC price per ZENO token, and amount is the number of ZENO tokens being purchased. Since ZENO has 18 decimals, the resulting USDC amount becomes unrealistically large, preventing users from making valid purchases.

A similar issue exists in the redeem(...) function in ZENO.sol, where ZENO tokens are incorrectly converted into USDC, again failing due to the decimal mismatch.

Impact

  • Users may be unable to purchase ZENO tokens due to an excessively large USDC cost.

  • Redemption of ZENO for USDC does not work as expected, preventing proper token conversion.

  • The contract does not function as intended, blocking core functionalities of the auction and redemption process.

Tools Used

N/A

Recommendations

  • Apply proper decimal scaling inside Auction.sol to ensure correct USDC and ZENO conversions.

  • Alternatively, modify the ZENO token to have 6 decimals to match USDC and avoid conversion issues.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Auction.sol's buy() function multiplies ZENO amount (18 decimals) by price (6 decimals) without normalization, causing users to pay 1 trillion times the intended USDC amount

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.