The Auction contract erroneously computes the USDC cost for purchasing ZENO tokens by multiplying the price by the amount without accounting for decimal precision. This results in a cost that is excessively high, potentially charging a buyer astronomically more USDC than intended.
In the [buy](https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/zeno/Auction.sol#L87) function, the cost is calculated using:
ZENO Decimals: 18 (1e18 units per token)
USDC Decimals: 6 (1e6 units per token)
Issue: The calculation price * amount multiplies a USDC price (1e6) by a ZENO amount (1e18), resulting in a cost value that is 1e12 times larger than intended.
Auction Parameters:
Starting Price: 100 USDC (100e6 units)
Reserve Price: 50 USDC (50e6 units)
Current Price: 75 USDC (75e6 units)
User Action:
User buys 1 ZENO token (1e18 units)
Incorrect Calculation:
Expected Cost: 75 USDC (75e6 units)
Actual Cost: 75e24 USDC units (75 followed by 24 zeros)
Result:
The user is charged 75e18 USDC instead of 75 USDC, which is 1e12 times more than intended.
Users are overcharged by a factor of 1e12 (1,000,000,000,000x)
Funds are irreversibly transferred, making recovery impossible
Manual Review
Numerical Simulation:
Adjust the cost calculation to account for the difference in decimal precision:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.