Normal behavior: Users should either pay the exact ETH amount OR use WETH, with incorrect ETH amounts being rejected.
Specific issue: If a user sends ETH that doesn't match the exact fee, the function falls through to the WETH payment path without refunding the ETH. User loses the ETH AND pays WETH.
Likelihood:
User sends partial ETH by mistake (e.g., miscalculates fee)
User has WETH approved, so the WETH path succeeds
Both ETH and WETH are taken
Impact:
Users lose funds when sending incorrect ETH amounts
ETH becomes permanently stuck in the contract (no withdrawal mechanism)
User effectively pays 1.5x or more for tokens
The following test demonstrates that when a user sends partial ETH (not the exact amount), the function does not revert. Instead, it falls through to the WETH payment path, taking the user's WETH while keeping the partial ETH in the contract. The user ends up paying both partial ETH and full WETH, effectively overpaying.
Add an explicit check for incorrect ETH amounts. The function should only accept exact ETH payment or zero ETH (for WETH payment). Any other amount should revert to prevent users from losing funds.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.