In Auction contract, there is an incorrect cost calculation in the `buy()` function leads to an overpayment issue due to mismatched decimal precision between ZENO (18 decimals) and USDC (6 decimals). This results in users paying significantly more USDC than intended when purchasing ZENO tokens.
In the `buy()` function, the cost of ZENO tokens is calculated as:
• price is derived from getPrice(), which returns a value in USDC’s decimal precision (6 decimals).
• amount represents the ZENO tokens, which use 18 decimals.
• Multiplying a 6-decimal value (price) by an 18-decimal value (amount) results in a 24-decimal value.
• Since USDC only supports 6 decimals, this results in an overpayment by a factor of 1e12.
For example, if:
• price = 2 USDC (2 * 10^6)
• amount = 1 ZENO (1 * 10^18)
• cost = 2e6 * 1e18 = 2e24
This is 12 orders of magnitude higher than the correct amount.
• Users overpay to buy ZENO token, causing them to lose funds.
Manual Review
To fix this issue, scale the cost calculation properly by dividing by 1e18:
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.