How this calculation works
Price the trade with fee-adjusted input and retain the full deposited input in the modeled pool reserves. Compare average output per full input with the starting reserve-ratio spot price, and apply an entered tolerance to the computed quote.
Effective input = Δx(1−f); output = y × effective input / (x + effective input)A worked example
For reserves 1,000 and 2,000,000, input 10 and an assumed 0.3% fee, modeled output is approximately 19,743.160688. A 1% entered tolerance gives an arithmetic minimum of about 19,545.729081.
Good to know
A scenario from entered prices, quantities and assumptions. No live prices, wallet connection, trade execution, return forecast or tax determination. Decimal arithmetic is used; displayed values are rounded. Examples are arithmetic demonstrations, not market rates or recommendations. Hypothetical fixed-fee full-range model retaining input fees in the pool. No routing, concentrated ranges, hooks, transfer taxes, dynamic fees, gas, token-decimal encoding or protocol-fee extraction. The entered tolerance is not a forecast of execution.
Reference: Uniswap: constant-product pool pricing concepts (opens in a new tab) ↗
A reserve ratio is a starting price, not the average price of a trade
For input reserve x and output reserve y, the starting spot ratio is y/x output units per input unit. A finite input changes reserves while it trades, so the whole input generally cannot receive that initial ratio.
The pricing input is reduced by the entered fee. Output is y times that effective input divided by x plus effective input. Average output per full input unit also includes the effect of the fee, making it lower than the fee-free infinitesimal starting ratio.
This model retains the input fee in the pool. The input reserve therefore increases by the full deposited amount, not only the fee-adjusted pricing amount. With a positive fee, the actual post-trade reserve product can grow rather than stay exactly equal to its starting value.
A tolerance threshold does not forecast execution
The minimum-output figure multiplies the computed quote by one minus the entered tolerance. It describes an arithmetic threshold; it does not predict reserve changes, ordering, routing or the output a real transaction will receive.
An Ethereum gas fee is a separate execution cost and is not deducted from the pool’s output here. Likewise, a token’s on-chain decimal encoding must be handled separately from the human-readable reserve units used in these fields.
The 50/50 pool divergence model asks a different question about an LP versus holding after a price movement. This swap model is one hypothetical trade with a fixed fee. It does not implement concentrated liquidity, dynamic hooks, transfer-tax tokens or a complete current protocol.
A few questions, answered
Is the default fee a current network or protocol rate?
No. It is an illustrative input. Enter the fee appropriate to your separate scenario.
Does the shortfall measure exclude the fee?
No. It compares average output for the full input amount with the starting spot ratio, so it includes fee and pool price movement.
Will this execute a swap?
No. It performs local arithmetic and does not connect to a wallet, fetch reserves or submit transactions.