Uni swap

Uni swap is AMM Token Trading for Wallet Users, With Gas Costs

Uni swap is self-custody token trading through shared reserves, called liquidity pools, and automatic pricing, called an automated market maker. The Uniswap Protocol executes swaps through smart contracts, while the connected wallet retains control until signing. A quote identifies the route, pool fee, network cost, price impact, and minimum output before settlement. The interface routes across v2, v3, v4, and UniswapX liquidity where each option is available.

It is a decentralized exchange protocol that lets self-custody wallet users trade tokens through automated liquidity pools.

Completing a Swap From Token Selection to Receipt

A Uniswap swap moves from token selection to a signed transaction and an onchain receipt.

Prepare the Wallet and Network

Preparation starts by matching the wallet network, token balances, and native gas asset.

Select the chain holding the input token, then connect a self-custody wallet. ETH pays gas on Ethereum, Unichain, Arbitrum, Base, and OP Mainnet, while AVAX pays gas on Avalanche. The input token must exist on the selected chain, and its contract address identifies the exact asset.

Read the Quote

A Uni swap quote states the input, expected output, minimum output, route, fee, and network cost.

Inspect the token addresses, pool path, price impact, and approval request before signing. The Universal Router can combine several routing actions into one transaction, while Permit2 manages token spending permissions. A quote is a proposed execution boundary, not a reserved price, so request a fresh one after a long pause.

Sign and Verify Settlement

Settlement begins only after the wallet displays and signs the final transaction request.

Track the transaction hash until the receipt shows success, then compare the wallet's output balance with the quoted minimum. Ethereum divides time into 12-second slots and 32-slot epochs, equal to 6.4 minutes, although inclusion time still follows demand and fee settings. Record the route, amount, gas paid, and receipt when the trade supports accounting or treasury operations.

Contract Identity, Allowances, and Execution Boundaries

Contract identity, token allowances, and quote limits define the main operational risks of a Uniswap trade.

Token identity begins with the contract address on the active chain, because symbols such as USDC can represent different contracts across networks, and an EVM address is 20 bytes and normally appears as 40 hexadecimal digits after the 0x prefix. ERC-20 approvals are separate onchain permissions. Permit2 combines 2 contracts: SignatureTransfer supports a one-use signed transfer, while AllowanceTransfer supports amount-limited and time-limited permissions. Disconnecting a wallet changes the interface session, not the recorded allowance. Review and reduce unused allowances during routine wallet maintenance.

The minimum output enforces the lowest acceptable receipt. If execution would deliver less, the transaction reverts, but consumed gas remains payable. Price impact grows when an order is large relative to active liquidity, and public transaction ordering adds movement between quote and inclusion. Splitting activity across chains also creates separate balances, approvals, and records.

Liquidity provision adds another exposure. A v3 or v4 position earns pool fees only while its liquidity is active, and a concentrated range stops earning when price moves outside it. The token mix also changes as price crosses the range, so position maintenance requires a different plan from a one-time swap.

Constant Product Pools, Concentrated Liquidity, and Hooks

Uniswap pools set token prices from onchain liquidity rather than a centralized order book.

V2 Reserves and Routing

In that setup, Uniswap v2 pairs hold two ERC-20 reserves and preserve the constant-product relationship x × y = k.

Buying one reserve reduces its pool balance and increases the other, moving the marginal price along the curve. Larger orders consume more of the available reserve and create greater price impact. Multi-hop routing links pools through an intermediate asset such as WETH when the direct pair offers weaker execution.

V3 Ranges and V4 Hooks

That said, Uniswap v3 concentrates liquidity in selected ranges, while v4 adds programmable hooks around pool actions.

A v3 liquidity position has unique range and fee settings, so the NonfungiblePositionManager represents it as an ERC-721 token. V4 moves pool accounting into one PoolManager contract and supports native ETH. Hooks execute configured logic before or after swaps, liquidity changes, donations, and initialization. These mechanisms broaden pool design, yet every quote still resolves to defined token movements the wallet authorizes.

Protocol Fees, Network Gas, and Price Impact

A Uniswap trade costs the pool fee, network gas, and any price impact from execution.

As a rule, Uniswap v2 applies a fixed 0.30% swap fee. Uniswap v3 exposes 4 established tiers: 0.01%, 0.05%, 0.30%, and 1%. The chosen pool charges its tier on the swap amount, and a multi-hop route applies the relevant fee at each pool. The quote incorporates the route before the wallet signs.

Fixed Parameter Protocol Value Custody or Control
Uniswap v2 pool fee 0.30% per swap Pair contract holds reserves; wallet authorizes spending
Uniswap v3 fee tiers 0.01%, 0.05%, 0.30%, and 1% Pool fixes the tier; provider controls its position
Uniswap v4 fee resolution 0% to 100% in 0.0001% steps PoolManager holds balances; configuration or hook controls the fee
Permit2 architecture 2 contracts Wallet signs a one-use transfer or bounded allowance

In the same way, Uniswap v4 permits pool fees from 0% through 100% in 0.0001% increments, with dynamic logic supplied by hooks.

Network gas is separate. On Ethereum, an EIP-1559 transaction pays gas used multiplied by its effective gas price, composed of the base fee and priority fee within the wallet's maximum. One ETH equals 10 18 wei. Contract route complexity changes gas used, while block demand changes the price per gas unit. A reverted transaction still pays for executed computation.

In one hypothetical example, a 1 000 USDC swap through a 0.05% pool deducts 0.50 USDC as the pool fee before price impact and gas. Price impact is the execution change caused by the order itself; slippage tolerance sets the boundary for additional movement before settlement.


Wallet and Network Prerequisites

Using Uniswap requires a compatible self-custody wallet, trade tokens, and the chain's native gas asset.

Network selection comes before token selection because the same ticker on two chains represents separate balances and contracts, while Ethereum Mainnet uses chain ID 1, Unichain uses 130, Base uses 8453, and OP Mainnet uses 10. Uniswap deployments also operate on Arbitrum, Polygon, BNB Smart Chain, Avalanche, and other supported EVM networks. A bridge moves assets between chains; a same-chain swap only changes assets on the active network. Pool depth and gas conditions then decide the practical venue. Changing networks in the wallet does not bridge an existing token balance.

  • Use MetaMask, Rabby, Coinbase Wallet, or Uniswap Wallet for self-custody signing.
  • Confirm the selected chain before choosing the input and output tokens.
  • Keep the chain's native asset available for approval and swap gas.
  • Match ERC-20 assets by contract address, not ticker alone.
  • Review the final wallet request through WalletConnect or the direct connection.

The wallet remains the control point for every approval and transaction. Choose the chain after comparing asset location, active liquidity, and settlement cost. Another page walks through the same ground in practice.


Swap Activity, Liquidity Positions, and UNI Governance

After the first pass, Uniswap supports three core activities: swapping tokens, supplying liquidity, and governing protocol parameters with UNI.

Swappers exchange one asset for another at the quoted route. Liquidity providers deposit paired assets and receive rights tied to their share or position. V2 represents pool shares with fungible ERC-20 liquidity tokens, while v3 uses ERC-721 positions because ranges and fee tiers differ. Fees in v2 grow inside pool reserves; v3 and v4 fees accumulate for collection. Range choice, rebalancing, and divergence between deposited assets shape the provider's ongoing exposure.

From there, UNI gives holders governance rights after voting power is delegated. At genesis, 1 000 000 000 UNI were minted, with 60% allocated to community members over the initial 4-year distribution. The token schedule introduced 2% annual inflation after those 4 years. Those figures describe the protocol's governance design, not the amount required for a swap.


From V1 Pairs to the V4 PoolManager

One level down, Uniswap evolved through four deployed versions, each changing liquidity control, routing, or contract architecture.

V1 and V2

V1 established ETH-paired pools, while v2 opened direct ERC-20-to-ERC-20 markets.

In that setup, Uniswap v1 launched in November 2018. V2 reached Ethereum Mainnet on May 18, 2020, adding arbitrary ERC-20 pairs, flash swaps, and time-weighted price accumulators. Its interface abstracts WETH wrapping when a route begins or ends with ETH.

V3

V3 moved liquidity from full-range deposits into price ranges chosen by each provider.

That said, Uniswap v3 launched on Ethereum Mainnet on May 5, 2021. Concentrated liquidity improved capital placement, multiple fee tiers separated pool economics, and ERC-721 positions preserved each provider's individual range settings.

V4

V4 consolidated pool accounting and exposed lifecycle hooks around core actions.

As a rule, Uniswap v4 launched on January 31, 2025. Its singleton PoolManager, flash accounting, native ETH support, and hooks reduced duplicated pool infrastructure and enabled customized logic. Earlier contracts remain deployed, while routing can draw from v2, v3, v4, and UniswapX.

When Is an Aggregator or Order Book a Better Fit?

An aggregator or order book fits when route breadth or execution controls outweigh direct pool access.

1inch searches multiple decentralized venues and can split an order across routes when useful, CoW Swap expresses signed intents for competing solvers and batch settlement, and Curve uses its StableSwap design for closely priced assets. Balancer adds weighted multi-token pools, so each alternative changes route source, price formation, or settlement workflow. Coinbase Advanced and Kraken Pro instead use account-based order books, centralized custody, and offchain matching before withdrawal. Uniswap settles authorized movements onchain from a self-custody wallet. Choose among them by custody model, supported chain, order type, liquidity source, and total settlement cost.

Does a failed Uniswap swap still consume gas?

Yes, a failed onchain Uniswap swap still consumes gas because validators execute the transaction before recording its reverted outcome. The wallet pays for the computation used, although the swap does not transfer the requested output token. Review the receipt status, keep enough of the chain's native asset for another attempt, and request a fresh quote before resubmitting.

Why did my token approval complete without completing the swap?

A token approval and a swap are separate onchain actions, so the approval can settle while the later swap remains unsigned or reverts. The first action records an ERC-20 allowance for Permit2 or another router; it does not exchange assets. Return to the quote, confirm the allowance scope, check the active network and gas balance, then sign the swap transaction separately.

Is ETH the same asset as WETH inside Uniswap pools?

ETH and WETH represent equivalent units of value on the same EVM network, but they use different token interfaces. ETH is the native gas asset, while WETH is an ERC-20 token created by depositing ETH into its wrapper contract. Uniswap v2 pools use WETH internally, and interfaces wrap or unwrap ETH around a trade when the selected route requires it.

Do I need UNI to trade through the Uniswap Protocol?

No, trading through the Uniswap Protocol does not require UNI. A swap requires the input token, enough of the network's native asset for gas, a compatible wallet, and sufficient pool or routed liquidity. UNI provides governance rights and can be delegated for voting on protocol parameters, treasury actions, and contract administration, but it is not the mandatory settlement token for ordinary ERC-20 swaps.

When should a liquidity provider collect accumulated Uniswap fees?

A liquidity provider should collect fees when the expected benefit exceeds the network cost and fits the position's maintenance plan. V3 and v4 fees accumulate separately from deposited liquidity, so collection requires an onchain action; v2 fees compound inside pool reserves. Collection does not reset the chosen range. Evaluate gas, the intended reinvestment, and whether the position already needs a range adjustment or withdrawal.