In Simple Terms
A DEX swap exchanges one token for another through contracts or an order-settlement system. A quote estimates the output for a particular route and market state. The signed transaction or order defines the conditions under which execution is allowed.
Your trade can move the pool’s price. Other activity can change the result while you wait. A tolerance setting limits acceptable execution relative to a quote; it does not erase costs or price impact already inside that quote.
Compare the exact input, expected output, minimum received, route and gas. Afterward, reconcile the recipient’s token balances with the successful transaction. A reassuring green message does not establish that the original quote was economically attractive.
Scope and teaching assumptions
Our exact-input example uses a standard-token, full-range constant-product pool like Uniswap v2. It exchanges WETH for USDC, assumes USDC equals 1 USD, and treats gas as a separate USD cost. All reserves, prices and fees are hypothetical. Concentrated liquidity, hooks, transfer-tax tokens, rebasing and multihop execution need different or additional rules. The model does not connect a wallet or submit trades.
In this guide
Identify the assets and the authority you give
Confirm the network, both token contracts, amount and recipient. WETH and native ETH are different assets even when their economic exposure is similar. Receiving a familiar ticker is insufficient if the contract is wrong or the next service cannot accept that version.
An ERC-20 approval permits a spender to use tokens; it is not necessarily the swap. Inspect each approval, permit signature and execution request. Revoking an allowance limits future use but cannot reverse a completed swap. Never share a recovery phrase to resolve an execution problem.
Keep three execution concepts separate
Price impact concerns the effect of your order on available liquidity. Slippage compares expected and actual execution as conditions change. Tolerance expresses a condition you will accept. Different interfaces calculate their displayed metrics differently, so read the definition and the actual minimum output.
Three questions, not one fee
Price impact
How does this trade size change its execution price against the available liquidity? It can already be reflected in the quote.
Slippage
How does execution differ from the quoted expectation? Other transactions or market changes can make the result worse or better.
Tolerance
Which output floor or input ceiling permits execution? This is a limit, not an automatic fee or a total-loss guarantee.
A quote can include substantial price impact with almost no later slippage. Conversely, a small quoted impact can be followed by a worse result before confirmation. Neither outcome alone proves manipulation, and a low tolerance does not make an unattractive quote attractive.
A pool quote integrates a changing price
Let x be the WETH reserve, y the USDC reserve, a the input and f the input-fee fraction. The effective input is a × (1 − f). Solving the constant-product constraint gives the output below. This is an average across the trade, not the initial reserve ratio multiplied by every input unit.
With 100 WETH and 300,000 USDC, the initial ratio is 3,000 USDC per WETH. Selling 10 WETH with a 0.3% assumed fee gives 9.97 WETH of effective input. The full 10 WETH enters the reserve; the fee remains in the pool under this simplified accounting.
a_eff = a × (1 − f)
Q = y × a_eff / (x + a_eff)
Reconcile the quote without counting costs twice
The fee-free initial-price benchmark is 30,000 USDC. At that same price, the input fee is worth 90 USDC, leaving a linear fee-adjusted benchmark of 29,910 USDC. The curve then reduces output by about 2,711.67 USDC. The executable teaching quote is 27,198.326816 USDC after rounding down to six decimals.
Average execution is about 2,719.83 USDC per WETH, a 9.34% shortfall against the fee-free starting ratio. This includes the assumed fee; we do not call it a universal interface price-impact metric. With 12 USD of separate gas, net received value is 27,186.33 USD and the benchmark shortfall including gas is 2,813.67 USD.
| Component | USDC or USD equivalent |
|---|---|
| Input valued at the fee-free initial ratio | 30,000.00 |
| Input fee valued at that ratio | 90.00 |
| Linear benchmark after the input fee | 29,910.00 |
| Additional reduction from the pool curve | 2,711.67 |
| Quoted USDC output, six decimals | 27,198.326816 |
| Gas paid separately (USD) | 12.00 |
| Quoted output value after gas (USD) | 27,186.33 |
| Total shortfall from the initial-price benchmark (USD) | 2,813.67 |
A 1% setting does not undo a 9% quote shortfall
Our large trade already quotes roughly 9.34% below the fee-free starting ratio. A further limit relative to that quote does not rewind the curve. Setting a small tolerance can restrict additional deterioration while still permitting execution of a quote with a large built-in shortfall.
The example is deliberately large relative to pool reserves, so the effect is visible. It is not a suggested trade size or an estimate for another pool. Compare routes for the same input and recipient, and consider not trading when the quoted outcome fails your objective.
Read the absolute minimum, not only the percentage
Our model defines d as the allowed percentage decrease in output units from its quote. It sets an integer output floor and rounds down to USDC’s six-decimal base units. With a 1% allowance, the minimum is 26,926.343547 USDC. This is the minimum-output rule for this teaching model, not a universal wallet convention.
Router02 receives an absolute amountOutMin. Interfaces compute that number before submission. The reviewed Uniswap v3 SDK instead applies Q / (1 + s) for its exact-input tolerance calculation. Similar-looking percentages can therefore produce different floors. Check the actual minimum received and the exact route, rather than copying our percentage into another app.
M_base = floor(Q_base × (10,000 − d_bps) / 10,000)
A quote, a deadline and confirmation are different
A quote uses a snapshot or recent state. A deadline constrains when a contract may execute; it does not reserve liquidity. Router02 checks its deadline against block time during execution. Passing the deadline does not itself remove a pending transaction from every queue or refund gas already spent.
For an exact-input swap, minimum output limits what you receive. For exact-output, maximum input limits what you spend. A transaction hash establishes an identifier, not a fill. Separate pending, reverted and successful execution before retrying or changing settings.
Transaction order can change your execution
MEV concerns value obtainable through transaction inclusion, exclusion and ordering. A sandwich can place another trader’s actions before and after yours, worsening your execution. Public visibility and an accommodating output floor can create exposure, but an unfavourable fill alone does not prove a sandwich.
A simplified sandwich sequence
Before your swap
Another trade changes the relevant pool state before your transaction executes. Your earlier quote no longer describes that state.
Your swap
The contract evaluates the changed state and your limits. A worse outcome can still execute when it remains above the authorised floor.
After your swap
The other participant trades back after your order. Whether the whole sequence is profitable depends on prices, fees and execution costs.
MEV is broader than sandwiching: arbitrage and liquidations are other examples. Do not subtract an invented MEV percentage from every swap. Establish the observed execution first and use transaction-level evidence before attributing a specific loss to ordering behaviour.
Privacy and intent execution solve different problems
A private submission channel may reduce exposure to public pending-transaction observers. It introduces its own infrastructure and coverage assumptions, and cannot remove your trade’s quoted curve effect. Check the specific network and execution path; a wallet feature is not a universal guarantee across chains.
Intent systems authorise an outcome for competing executors rather than directly specifying every pool action. They are not automatically private. The reviewed UniswapX technical documentation explicitly describes signed order messages as publicly broadcast. Inspect order limits, expiry, cancellation and permissions independently of marketing labels.
Compare routes by what reaches the recipient
A multihop route can cross several pools, each with fees and liquidity constraints. Splitting across pools differs from repeatedly sending separate transactions to the same pool. Compare net output for identical inputs, including separately paid gas and interface charges, while avoiding costs already embedded in the quote.
A route that outputs more tokens can still leave less value after gas. Confirm which token pays gas and retain enough for approvals or later actions. A same-chain swap does not by itself bridge an asset to another network; combined routes add the separate risks explained in our bridge guide.
Explore size, reserves and the output floor
Move the input relative to reserves, then change the allowed output decrease. The first changes the quote’s economics; the second changes the authorised floor. Gas changes the value after costs, not the number of USDC the pool quotes. These are separate levers.
The initial reserve ratio is only our comparison benchmark. It is not an independent oracle or a fair-value certificate. A pool can already be mispriced against other markets. Changing reserves in the model changes that starting benchmark as well as the available liquidity.
Explore a hypothetical exact-input swap
- Quoted USDC output
- 27,198.326816
- Minimum USDC output
- 26,926.343547
- Average USDC per WETH
- 2,719.83
- Quote shortfall versus starting ratio (%)
- 9.34
- Quoted value after gas (USD)
- 27,186.33
- Benchmark shortfall including gas (USD)
- 2,813.67
Test an execution candidate against the floor
For the default quote and floor, a hypothetical 27,050 USDC execution satisfies the minimum even though it is worse than quoted. A 26,900 USDC candidate fails it. A better 28,000 USDC outcome can pass too. Tolerance is not a fee automatically deducted from every successful trade.
These are hypothetical output candidates, not predictions of the pool’s next state. The table assumes the correct router enforces the stated final-output floor. Custom routes, unusual tokens and different order types require their own checks; an output bound cannot authenticate a malicious contract.
| Candidate output (USDC) | Meets the floor? | Interpretation |
|---|---|---|
| 27,198.326816 | Yes | At the model quote |
| 27,050 | Yes | Worse than quoted, within the authorised bound |
| 26,900 | No | Below the floor; execution must revert under this rule |
| 28,000 | Yes | Better than quoted; the floor is not a fixed charge |
Failed execution does not always mean zero cost
A directly submitted onchain transaction can consume gas even when its swap reverts. A prior approval is a separate transaction and may remain effective. Do not generalise this to all intent systems: an executor-funded order may allocate failed-execution costs differently. Read who actually submits and pays.
Before retrying, check receipt status, token transfers, recipient and any surviving allowance. Repeating a successful swap creates another trade. Raising tolerance blindly can authorise a worse result without fixing the underlying problem. First identify the failure: stale deadline, output bound, gas, permission or token behaviour.
Different order types have different boundaries
A marketable swap, a price-limited order and an intent are not interchangeable promises. Determine what can execute, how long authority lasts and whether an additional cancellation action is required. A signature can carry spending authority even before any settlement transaction appears.
Neither private submission nor a limit order guarantees a fill or the best external-market price. A floor protects a specified quantity under specified rules; it does not protect the dollar value of a token that depegs. Keep contract correctness, execution limits and asset valuation separate.
| Mechanism | Relevant boundary | Unresolved question |
|---|---|---|
| Exact-input swap | Fixed input and minimum output | Which final token and recipient does the bound protect? |
| Exact-output swap | Requested output and maximum input | How are unused input and approvals handled? |
| Signed intent or limit order | Signed conditions, expiry and cancellation rules | Who may settle it, and can authority remain outstanding? |
Keep a short pre-signing record
Record enough to reconcile the result later. A familiar interface or a simulation preview is useful context, not a substitute for reading the actual permission and execution parameters.
- Identity: exact network, input and output contracts, recipient and intended use of the received asset.
- Quote: input, output, route, reserve or liquidity context, timestamp and the definition of displayed price impact.
- Limits: absolute minimum received or maximum spent, deadline, and any order expiry or cancellation conditions.
- Costs: fees already included, separately paid gas, extra interface charges and the same benchmark for every route.
- Authority: spender, allowance, permit scope, signing network and any executor permissions.
- Completion: transaction or order identifier, receipt status, actual token movements, recipient balance and residual permissions.
Stop if the wallet request differs from that record. If you change the amount, route or timing, request a new quote and recheck the limits. A previous small test does not certify a later contract upgrade or a different token’s behaviour.
Smaller orders and splitting need their own comparison
Reducing input relative to liquidity generally reduces curve impact in this model. Merely dividing one trade into consecutive swaps in the same unchanged pool does not restore the starting price after each piece. Pool state persists, fees accumulate and separate transactions repeat gas costs.
Liquidity replenishment, arbitrage or routing across different pools can change the result, but then timing and market exposure also change. Compare a reproducible scenario rather than assuming that splitting is automatically cheaper. After execution, reconcile actual amounts and costs instead of using the original quote as proof.
Questions worth resolving
Does 1% tolerance cap my total loss at 1%?
No. The quote can already include price impact and fees, while gas is separate. The tolerance restricts an execution condition, not every cost or the future market value of what you receive.
Can I get better output than quoted?
Yes, if the route and conditions permit it. A minimum-output bound is a floor, not a fixed deduction. Some order systems have their own rules for improvements, so check the signed conditions.
Does a private channel remove price impact?
No. It can change who sees a pending transaction, not how much liquidity your order consumes. Network coverage, infrastructure and execution rules still matter.
Are all intent orders private?
No. Privacy and outcome-based execution are different properties. The reviewed UniswapX technical documentation describes publicly broadcast signed orders. Check the actual system rather than inferring privacy from the word intent.
Is a reverted swap free?
A directly submitted onchain transaction can still spend gas, and an earlier approval may persist. Executor-funded intent systems can allocate costs differently. Identify the transaction type and payer.
Does a high gas fee guarantee the best execution?
No. It does not authenticate the route, remove curve impact or guarantee a position ahead of every other transaction. Evaluate inclusion, limits and the economic quote separately.
How we built this guide
MyProfitFactor compared primary protocol documentation, contract code and SDK rules, then independently built the ledger and model. Integer token-unit arithmetic determines the quoted output and floor; display rounding is separate. We distinguish our explicit allowed-decrease convention from other interfaces. This is execution research, not a DEX ranking or a live trading recommendation.
Risk context
DEX activity combines token, contract, approval, execution and network risks. A valid minimum does not make an unknown contract safe or a poorly priced asset fairly valued. Use current documentation for the specific protocol, network and route before authorising funds.
Primary references
Three reference entry points keep the reading list compact. The complete section-level evidence mapping is retained in our research record.