The Auction::buy function allows users to purchase Zeno tokens in exchange for USDC. However, an incorrect handling of token decimals results in users paying significantly more USDC than intended.
The buy function takes an amount of Zeno tokens (e.g., 100e18).
Zeno follows the ERC-20 standard with 18 decimals.
The price per Zeno token is determined via the getPrice function, which returns a value in 6 decimals (as seen in the test file).
When computing the total USDC cost:
Cost = 100e18 * 2e6 = 200e24 , (price Assumed is 2e6)
Since USDC has only 6 decimals, the user ends up paying 1e12 times more USDC than necessary.
Users are required to pay an excessively high amount of USDC due to incorrect decimal handling, leading to severe overpayment and potential loss of funds.
Manual review
Properly normalize USDC decimals when computing the price.
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.