Normal behavior: The protocol should collect a 3% fee on all transactions regardless of transaction size. Every trade should contribute to protocol revenue through consistent fee collection.
Specific issue: The fee calculation uses integer division which rounds down to zero for small transaction amounts, causing the protocol to lose fee revenue on trades below 34 USDC. This creates an economic incentive for users to split large orders into multiple small orders to avoid fees.
Technical Details: The current fee calculation: `protocolFee = (order.priceInUSDC * FEE) / PRECISION` where FEE = 3 and PRECISION = 100, results in zero fees for any price less than 34 USDC due to Solidity's integer division truncation.
Mathematical Analysis:
- For 33 USDC: fee = (33 * 3) / 100 = 99 / 100 = 0 (truncated)
- For 34 USDC: fee = (34 * 3) / 100 = 102 / 100 = 1 wei
- This creates a fee cliff where users pay 0 or 1+ wei with no gradual scaling
Economic Impact: Protocol loses revenue on small trades - Users can exploit this by splitting large orders - Unfair fee structure favoring small transactions - Potential for fee avoidance strategies
Likelihood:
Reason 1: Automatically occurs for any transaction with price < 34 USDC (very common for small trades or test transactions)
Reason 2: Users can intentionally exploit this by splitting large orders into multiple sub-34 USDC transactions
Impact:
Impact 1: Direct revenue loss for the protocol on all small transactions below the fee threshold
Impact 2: Economic distortion where users are incentivized to avoid fees through order splitting, reducing overall protocol efficiency
The current fee calculation (price * 3) / 100 results in zero fees for any price below 34 USDC due to Solidity's integer division truncation. This creates a significant fee avoidance opportunity.
Implement a minimum fee to ensure all transactions contribute to protocol revenue while maintaining fair fee structure.
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.