The buy function has a precision mismatch issue due to different decimal places between USDC (6 decimals) and ZENO (potentially 18 decimals). This can lead to incorrect fund transfers, where users receive significantly less than expected.
The buy
function contains a critical issue related to the precision mismatch between USDC and ZENO tokens. The function assumes that the operation USDC.safeTransfer(msg.sender, amount);
correctly transfers the expected value, but this assumption can be incorrect due to differences in token decimal precision.
Users may receive an incorrect amount of USDC, potentially causing financial loss.
The contract may fail to execute expected trades accurately, leading to trust issues and reputational damage.
Possible exploitation scenarios where an attacker could manipulate token conversions to their advantage.
To prevent this issue, the contract should normalize the amount
value before executing transfers:
Convert USDC amount to 18 decimals (if ZENO operates with 18 decimals) before calculations:
Use proper conversion factors based on token decimals:
Implement a dynamic approach to fetch token decimals using IERC20Metadata(address).decimals()
:
Implement proper decimal conversion logic before any transfers.
Ensure extensive unit testing with different token decimal configurations.
Consider integrating an oracle or external pricing mechanism for additional accuracy in token swaps.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
View preliminary resultsAppeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.