The Zeno::buy() function in the Auction contract is susceptible to rounding issues when calculating the total cost of purchasing ZENO tokens. This can lead to major discrepancies in the amount of USDC transferred or the number of ZENO tokens received.
The function computes the cost of purchasing amount ZENO tokens using the Auction::getPrice() function:
Since Solidity performs integer division, there is a possibility of precision loss when multiplying and dividing values, especially if USDC uses 6 decimals while ZENO has 18 decimals. This can lead to cases where users pay slightly more or less than expected.
Users will overpay or underpay due to rounding discrepancies.
Could lead to small amounts of USDC being effectively lost over multiple transactions.
Potential for inconsistencies in accounting and tracking.
PoC
Manual code review
Consider using a fixed-point arithmetic library to ensure proper rounding behavior.
Adjust calculations to take into account the decimal differences between USDC and ZENO.
Ensure rounding is handled in favor of the user to prevent unintended losses.
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.