Users can escape fees due to no edge case handling
Observing the onAfterSwap function in the UpliftOnlyExample contract:
the value amountCalculatedRaw
being very small and multiplying it by hookSwapFeePercentage
can result in rounding down to zero due to Solidity's fixed-point arithmetic restrictions. For instance, let amountCalculatedRaw = 1
and hookSwapFeePercentage = 0.1% (1e15)
. The hookfee= 1 * 1e15 / 1e18 = 0.0001 which is truncated due to integer division
Users can split large swap amounts into smallers ones to incur no fees, which will result in a loss of revenue
Manual Review
Include a minimum fee to ensure that even small amountCalculatedRaw
values incur a non-zero fee.
Likelyihood: Very Low, tokens with 2 or less decimals and few fees. Impact: Low, bypass fees but for very few amounts, gas usage will be equivalent. (No reason to break a big swap in multiple)
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.