Uniswap

Uniswap Executes Token Swaps Through Pools and Signed Orders While Liquidity, Fees and Gas Shape Results

Uniswap lets a wallet trade tokens through smart-contract pools or signed orders instead of relying on a traditional matching order book. A quoted result depends on the route, active pool depth, price impact, the fee that the pool charges and network gas. The protocol also supports liquidity provision and market creation, although those actions carry different risks. A trade is complete only when an onchain pool transaction succeeds or a signed UniswapX order settles within its terms.

Key takeaway: Pool depth, price impact, swap fees and network gas shape a Uniswap quote, while balances, permissions and user limits govern execution.

Swaps, Liquidity and Market Creation

Swaps, liquidity provision and market creation are separate functions connected by the same pool state. Each changes ownership or exposure in a different way.

Trading Against Pools

A pool swap exchanges an input token for an output token against reserves supplied by liquidity providers. The exchange rate changes during execution because the transaction alters those reserves. Routing software may use one pool, several pools or an auction-based order when that path produces an acceptable quote.

Supplying Liquidity

Liquidity provision places one or both pool assets into a position so other participants can trade against the available liquidity. The provider receives a position that tracks a share of the pool or a selected price range. Fees may accrue, but the asset mix changes as swaps occur and the position can underperform simply holding the original tokens.

Creating New Markets

Pool creation initializes a compatible asset pair and its chosen parameters, but swaps require usable liquidity after initialization. Permissionless creation expands access, but it does not authenticate a token or its issuer. Contract identity and the selected network matter because duplicate names and symbols do not represent the same asset.

Pools, Routes and Quote Construction

A quote connects an input amount to available liquidity at a particular moment. Routing software can compare routes across v2, v3 and v4 pools and may also quote supported UniswapX orders. It may split a trade or pass through an intermediate asset when that route offers a better executable output after pool fees.

An automated market maker does not wait for a seller to post an equal order. Its pool state supplies the opposing side of the trade. That difference permits onchain execution when the transaction is included and liquidity and user limits permit it, but the displayed spot price is not automatically the price for the full requested amount.

What Determines a Swap Result?

A swap result depends on the trade size relative to active liquidity, not merely the total value deposited across every pool. Concentrated liquidity may be deep near the current price yet thin beyond a nearby range boundary. A larger order can cross more ranges and produce greater price impact.

The constant-product relationship makes larger trades move the pool price more when reserves are shallow. Price impact comes from the trade changing pool state. Slippage tolerance is different: it defines how far execution may move from the quoted terms before the transaction must fail.

Network gas is another input. When a wallet submits a direct onchain swap itself, it needs the network-native asset for gas, and the transaction can consume gas even if it reverts. Balances, token allowances, deadlines and minimum-output or maximum-input limits must all remain valid when the transaction executes.

Protocol Paths Compared

The available paths divide into pool swaps, signed orders and liquidity positions. Their required inputs and completion boundaries differ even when they involve the same token pair.

Path Required Input State Change Execution Boundary
v2 Pool Swap Token pair, amount and wallet authorization Trades against two full-range reserves The quote must satisfy the user limit and available reserves
v3 Pool Swap Tokens, amount and a route through fee-tier pools Moves through active concentrated-liquidity ranges Execution stops if active liquidity cannot satisfy the user limit
v4 Pool Swap Pool key, amount and any required hook data PoolManager accounts for settlement and calls any configured swap hook Hook rules or the user limit can reject execution
UniswapX Order Signed order with output and tolerance terms A filler settles the order using available liquidity Settlement must meet the signed terms before expiry
v2 LP Position Both pool tokens at the current reserve ratio Mints fungible LP shares across the full price range The provider cannot select a custom range
v3 LP Position Token amounts and lower and upper ticks Creates a distinct concentrated-liquidity position Fees accrue only while the position is in range
v4 LP Position Pool key, amount, range and any required hook data PositionManager records the liquidity position Range status and attached hook rules govern activity
Common Reading Every path needs explicit assets and valid chain state Swaps change balances while LP paths create or modify positions Signed limits, ranges or hook conditions define acceptable execution

These paths are not interchangeable. Pool swaps commit through a transaction, while UniswapX uses a signed order that competing fillers may settle. Liquidity positions create continuing market exposure instead of completing a one-time exchange. The appropriate path follows the desired state change, not the pair name alone.

Fee Layers and Network Gas

A swap can involve an LP fee, an enabled protocol fee and network execution costs. Their calculation and allocation differ, and the route and live pool configuration determine which charges apply.

Pool Fees

LP fees accrue to liquidity providers whose capital is active during a swap. Uniswap v2 uses a flat pool fee, while v3 supports multiple fee tiers for the same pair. A Uniswap v4 pool can use a static fee or a dynamic fee controlled through its hook.

Protocol Fees

Protocol fees redirect part of the swap fee when governance has enabled that mechanism for the relevant pool or version. They are not an extra gas charge. Because activation and allocation can change, the live route and pool state determine whether a protocol share applies.

Gas Costs

Gas pays for computation and settlement on the selected network. Congestion, route complexity and the number of contract actions affect it. A filler handles settlement gas for a filled UniswapX order, while an unfilled order does not leave the signer paying for a failed onchain transaction.

Liquidity Positions and Range Exposure

A liquidity position exchanges passive token ownership for exposure to pool activity. Its behavior depends heavily on the protocol version and selected range.

Full-Range Positions

A v2 position supplies liquidity across the complete price curve and receives fungible LP tokens. Swap fees enter the reserves and increase the position’s share value within the pool. Full-range coverage avoids a chosen boundary, but it does not remove price movement or divergence from simply holding both assets.

Concentrated Ranges

A v3 or v4 provider selects lower and upper price boundaries. A narrower range concentrates liquidity within that band, but the position stops earning swap fees after the market price leaves the range. As the price approaches and crosses a boundary, the position shifts toward one of its two assets.

Hook-Modified Pools

A v4 hook is external smart-contract logic attached when a pool is created. It can alter fees, validate an action or reject a swap at defined lifecycle points. Hook behavior is specific to that pool, so two pools for the same currencies can impose materially different execution conditions.

Confirmation Signals and Better-Fit Boundaries

An onchain swap is complete when its receipt reports success and the expected output reaches the specified recipient. A transaction hash by itself proves submission, not successful execution. For a signed auction order, completion means a filler settled the order within its encoded terms and the output transfer occurred.

Pool-based trading fits direct onchain exchange, self-custody and smart-contract composition. An order book may fit better when a resting order with explicit price-time priority is required. A custodial venue may suit fiat funding or account recovery, but it introduces custody and counterparty exposure that pool settlement does not require.

Confirmation Signals and Better-Fit Boundaries: Pool-based trading fits direct onchain exchange, self-custody and smart-contract composition.; An order book may fit better when a resting order with explicit price-time priority is required.; A custodial venue may suit fiat funding or account recovery, but it introduces custody and counterparty exposure that pool settlement does not require.

Open full-size image

Uniswap: the short answers

Which Wallet Permission May Be Required Before an ERC-20 Swap?

An ERC-20 input may require an allowance that lets a router or Permit2 transfer the approved token amount. That authorization is separate from the swap itself and may require its own transaction. A network-native currency input does not use an ERC-20 allowance, although the wallet still signs the swap and needs enough native currency for gas when submitting an onchain transaction.

How Long Can a Swap Take to Confirm?

A direct pool swap appears after the network includes the transaction and reports successful execution. Confirmation time varies with network conditions, gas settings and the selected chain’s settlement behavior. A UniswapX order also depends on a filler accepting its terms, so signing the order does not establish a fixed completion time or prove that settlement occurred.

Why Can a Quote Fail Before the Transaction Confirms?

A quote can fail when pool state changes enough to breach the minimum-output or maximum-input limit. An expired deadline, insufficient balance, missing allowance, inadequate gas funds or a rejecting v4 hook can also stop execution.

Does a Normal Pool Swap Move Tokens Between Blockchains?

A normal automated market maker pool swap settles on one blockchain and changes balances recorded on that chain. Moving value to another network requires a separate bridge operation or an explicitly supported cross-chain order route. A matching token symbol on two networks does not make the assets interchangeable, and the destination contract identity must match the intended asset.

Which Token Identity Matters When Two Assets Share the Same Symbol?

The contract address together with the blockchain identifies an ERC-20 token, while its symbol is only display metadata. Different contracts can use the same name and ticker without representing the same asset. A pool’s existence or available liquidity does not authenticate the issuer, so the selected contract and network must match the asset that the wallet holder intends to trade.

- updated