Description: In the swap operations, inside the swap_operations::swap_exact_in
function, fee calculations use integer division which can lead to precision loss, especially for small swap amounts. The fee is calculated as let lp_fees = (amount_out as u128 * 3).div_floor(&1000) as u64;
, which rounds down and can result in zero fees for small transactions.
Impact: Users can exploit this by splitting large swaps into many small transactions to avoid paying fees, reducing protocol revenue and liquidity provider returns.
Proof of Concept: Instead of swapping 1000 tokens at once (which would incur a fee of 3 tokens), a user could perform 1000 swaps of 1 token each, potentially paying no fees due to rounding down.
Recommended Mitigation: Implement a minimum fee amount for all swaps, or use a more precise fee calculation method that accumulates fractional fees.
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.