Uniswap Developer Documentation

repository·main·Indexed 18 days ago

https://github.com/uniswap/docs

Technical guidance for building on Uniswap protocols (v2, v3, v4), including SDKs, liquidity provisioning, and trading integrations. Covers the Trading API, Universal Router, Permit2, UniswapX, and Unichain, as well as AI integration and ecosystem tooling.

Tokens
335.9K
Snippets
668
Records
1.2K
Agent score
64%

What's inside Uniswap Developer Docs

  1. Overview of Unichain

    main
    Unichain is a DeFi-focused Ethereum Layer 2 (L2) rollup designed to provide fast blocks, lower transaction costs, and efficient onchain liquidity. It utilizes a permissionless fault-proof system for trust-minimized security and is part of the Superchain ecosystem, supporting native interoperability and cross-chain liquidity access.
  2. Overview of Uniswap Liquidity Workflows

    main

    Uniswap provides three primary ways to participate as a liquidity provider or market maker:

    1. Liquidity Provisioning (LP): Deposit token pairs into v2, v3, or v4 pools to earn swap fees. Best for market makers and yield seekers.
    2. UniswapX filling: Compete in permissionless auctions to fill user swap orders offchain or cross-chain. Best for MEV searchers and trading firms.
    3. Liquidity Launchpad (CCA): Bootstrap initial liquidity for new tokens using a Continuous Clearing Auction (CCA) to seed a v4 pool at a discovered price. Best for new projects and token launchers.
  3. What is The Compact?

    main
    The Compact is an ownerless ERC6909 contract designed to facilitate the voluntary formation and mediation of reusable resource locks. It allows tokens (ERC20 or native) to be credibly committed for asynchronous conditions and claimed once those conditions are met. This enables complex, cross-chain, or multi-step workflows where assets are locked until specific criteria are fulfilled.
  4. Overview of Uniswap v4 Community SDK packages

    main

    The SDK is organized into several packages depending on your environment and requirements:

    PackageDescription
    @zahastudio/uniswap-sdkCore SDK, framework-agnostic. Works with any viem client.
    @zahastudio/uniswap-sdk-reactReact hooks and provider built on wagmi + TanStack Query.
    @zahastudio/trading-sdkExperimental Trading SDK for quote, approval, and swap flows via the Uniswap Trading API.
    @zahastudio/trading-sdk-reactExperimental React provider and hooks for the Trading SDK.
  5. What is the Uniswap Liquidity Launchpad?

    main

    The Uniswap Liquidity Launchpad is a framework designed to bootstrap initial liquidity for Uniswap v4 pools using transparent price discovery. It uses a Continuous Clearing Auction (CCA) mechanism to establish market price and then automatically seeds Uniswap v4 pools with the auction proceeds.

    Key capabilities include:

    • Price Discovery: Running fair auctions via CCA to establish market price.
    • Liquidity Bootstrapping: Automatically seeding Uniswap v4 pools at the discovered price.
    • Token Creation: Optionally deploying new ERC-20 tokens with metadata or integrating existing ones.
  6. Overview of Uniswap AMM Protocols

    main

    Uniswap consists of Automated Market Maker (AMM) contracts that serve as the core liquidity pools for executing swaps.

    • Uniswap v4: The current and recommended version for new integrations. It features a single PoolManager contract, hooks for custom pool behavior, and flash accounting for gas efficiency.
    • Uniswap v3: Uses concentrated liquidity with NFT-based positions. Best for existing integrations or v3-specific workflows.
    • Uniswap v2: The original constant-product AMM, useful for understanding fundamentals or maintaining legacy integrations.
  7. Overview of Uniswap Universal Router

    main

    The UniversalRouter is an unowned, non-upgradeable ETH and ERC20 swap router designed to aggregate trades across Uniswap v2, v3, and v4. It uses a command-based architecture that allows developers to compose complex workflows into a single transaction.

    Key capabilities include:

    • Multi-protocol Swaps: Splitting and interleaving swaps across v2, v3, and v4.
    • Trade Management: Supporting partial fills and sub-plan execution.
    • ETH Handling: Wrapping and unwrapping ETH via WETH.
    • Permit2 Integration: Using time-bound, signature-controlled token approvals to reduce repeated approval transactions.
    • Position Management: Interacting with v3 and v4 position managers (e.g., liquidity modification, pool initialization, and permits).
    • Safety: Performing balance checks during execution.
  8. Overview of Uniswap Developer Documentation

    main

    The Uniswap Developer Docs provide technical guidance for building on Uniswap protocols. The documentation is organized into several key functional areas:

    • Core Concepts & Quickstart: Found in get-started/.
    • Trading & Swapping: Integration guides and Swapping API details in trading/.
    • Liquidity & Provisioning: Information on UniswapX, Liquidity Launchpad, and the Provisioning API in liquidity/.
    • Protocols: Deep dives into v2, v3, v4, Universal Router, Permit2, smart wallets, and protocol fees in protocols/.
    • SDKs: Documentation for v2, v3, and v4 SDKs in sdks/.
    • Unichain: Getting started, guides, and tooling for Unichain in unichain/.
    • AI Integration: Uniswap AI skills and plugins in uniswap-ai/.
    • Ecosystem & Community: Governance, subgraphs, builder support, and community tooling in ecosystem/ and community/.
    • Examples: Contract examples and SDK snippets in examples/.
    • Changelog: API and protocol change notifications in changelog/.

    Live documentation can be accessed at developers.uniswap.org.

  9. Explore community-built SDKs and libraries for Uniswap

    main

    The Uniswap ecosystem includes several independently maintained tools and libraries. Note that these are community-maintained and not officially supported by Uniswap Labs; always audit dependencies before production use.

    Key community tools include:

    • Community Uniswap SDK: A TypeScript SDK for Uniswap v4 featuring React hooks, pool queries, swaps, and liquidity management (Maintained by Zaha Studio).
    • OpenZeppelin Uniswap Hooks: Secure, modular Solidity hooks for Uniswap v4 designed for fee management and sandwich protection (Maintained by OpenZeppelin).
    • Uniswap v4 Template: A Foundry-based starter template for building, testing, and deploying Uniswap v4 hooks (Maintained by Uniswap Foundation).
    • Uniswap v4 Community Indexer: A multi-chain indexer providing pool, swap, and hook data via GraphQL (Maintained by Envio).
  10. Compare UniswapX auction mechanisms by chain

    main

    UniswapX uses an RFQ + Exclusive Dutch Auction model on all supported chains. The primary difference is the timing mechanism used to measure the exclusivity window and price decay:

    • Ethereum: Uses the Dutch V2 reactor. Timing is time-based using decayStartTime.
    • Arbitrum, Avalanche, Base, BNB Smart Chain, Robinhood Chain, Tempo, and Unichain: Use the Dutch V3 reactor. Timing is block-based using decayStartBlock.

    All auctions are gasless for users; gas fees are wrapped into the final price and paid by the filler. Failed swaps incur no fees.

    | Chain | Auction Type | Reactor | Timing Mechanism |
    |-------|-------------|---------|------------------|
    | **Ethereum** | RFQ + Exclusive Dutch Auction | Dutch V2 | Time-based: exclusivity window, then decay (`decayStartTime`) |
    | **Arbitrum, Avalanche, Base, BNB Smart Chain, Robinhood Chain, Tempo, Unichain** | RFQ + Exclusive Dutch Auction | Dutch V3 | Block-based: exclusivity window, then decay (`decayStartBlock`) |
  11. Explore Uniswap v3 Concepts

    main

    Before integrating with Uniswap v3, familiarize yourself with the core architectural principles, how price oracles function within the protocol, and the handling of unsupported tokens.

    Key conceptual areas include:

    • Architecture: The underlying design of the v3 protocol.
    • Price Oracles: How Uniswap v3 provides oracle services.
    • Unsupported Tokens: Understanding token compatibility and limitations.
  12. Explore Uniswap ecosystem research

    main

    The Uniswap Foundation supports protocol research through grants, programs, and ecosystem collaborations. Research focuses on practical DeFi implementation, including AMMs, MEV (Maximal Extractable Value), liquidity design, and decentralized exchange economics.

    Key research areas include:

    • Scaling and Layer 2s: Analyzing how L2 performance impacts Uniswap v3 capital deployment and arbitrage.
    • MEV and Block Building: Studying Ethereum block auction dynamics and the impact of execution tickets on decentralization.
    • Liquidity and AMM Design: Investigating Geometric Mean Market Makers (G3Ms), constant product markets, and liquidity provider (LP) returns.
    • Price Oracles: Analyzing Constant Function Market Makers (CFMMs) as primitives for efficient asset pricing.
    • Market Stability: Formal analysis of constant product markets and their ability to track reference prices.