When order.priceInUSDC
is very small (e.g., 1 wei
), this formula causes rounding down to zero or rounding up that consumes the entire amount, due to Solidity’s lack of floating-point arithmetic.
This introduces precision loss, allows fee evasion, and may result in sellers receiving zero proceeds, effectively breaking micro-order fairness and opening doors for spam attacks or unintended gas waste.
Likelihood:
High
Easy to trigger with a single call.
No special permissions or contracts required.
Any user can exploit it with createSellOrder()
and buyOrder()
.
Impact:
Fees are skipped entirely on small orders, even when FEE > 0
Sellers might receive 0 if fee ever rounds up to 100%
Attackers can spam small orders with no economic penalty
Thousands of dust orders can bloat storage & waste gas
Protocol loses intended revenue flow from valid order activity
The POC simulates two order flows:
Minimal Order
alice
creates an order to sell 1 wei WETH for 1 wei USDC.
Fee = (1 * 3) / 100 = 0
→ no fee taken.
dan
buys the order, paying 1 wei
USDC.
Alice receives full 1 wei, and protocol gets no fee.
Precision loss confirmed (fee is lost), and seller can avoid fee intentionally by keeping price low.
Slightly Larger Order
alice
creates another order to sell 10 wei WETH for 10 wei USDC.
Fee = (10 * 3) / 100 = 0.3
, which truncates to 0.
Again, no protocol fee is collected.
Alice receives all 10 wei.
This shows fee logic is ineffective for small orders, and fee collection is dependent on order size, which breaks economic consistency.
Use Higher Precision
Enforce Minimum Fee
Reject Dust Orders
Protocol Suffers Potential Revenue Leakage due to Precision Loss in Fee Calculation
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.