Fees & trade costs

Why two pool fees do not always add to a single percentage

Work through fee compounding across sequential pools and distinguish it from price impact and duplicated fee display.

For sequential percentage deductions, multiply the retained fractions. Simply adding the percentages is an approximation. Each later fee acts on the amount remaining after the preceding conversion, expressed in the later pool's input asset.

A fee-only model

Assume hypothetical pools with equal-value one-for-one exchange rates and no price impact. An input of 1,000 passes through a 0.30% fee and then a 0.20% fee.

After first fee: 1,000 × 0.997 = 997

After second fee: 997 × 0.998 = 995.006

Combined deduction: 1 − (0.997 × 0.998) = 0.4994%

Adding the rates gives 0.50%, slightly higher than the exact 0.4994% for this model. With small rates the difference may be immaterial, but a calculation should identify the approximation.

The pool curves still matter

The retained-fraction model isolates fees. It does not calculate a real multi-hop swap, where each leg has its own price and size-dependent execution. The Uniswap v2 reference library calculates successive outputs using each pair's reserves. A complete quote therefore includes more than fee multiplication.

Do not subtract the combined deduction from a route output that already includes pool charges. Use the model to explain the fee component or to inspect a simplified scenario, not to add another fee to a finished quote.

Sequential hops are different from parallel allocations

If half of an input is charged 0.30% and the other half 0.20% in parallel, the fee-only weighted rate is 0.25%. It is not the sequential 0.4994% rate. Follow where each portion of the input actually travels before doing arithmetic.

Additional service charges may use their own base. Keep them separate until you know whether they apply before routing, after output, or as an independent payment.

Sources & verification (1)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. UniswapV2Library.sol

    Reference amount-out and amount-in arithmetic; integer rounding.

    https://github.com/Uniswap/v2-periphery/blob/master/contracts/libraries/UniswapV2Library.sol

Continue reading

Measure a buy-sell spread from executable quotes Estimate the cost of swapping out and immediately back Include the cost of leaving a position in a trade budget