1. WEB3 Uniswap DEX learn books
  2. Uniswap
  3. 1. 背景
    1. 1.1. Solidity-Fixed-Point
    2. 1.2. ERC4626
    3. 1.3. 闪电贷Flashloan
    4. 1.4. 去中心化交易所
    5. 1.5. 恒定乘积公式
    6. 1.6. 价格操纵
  4. 2. uniswapV1
    1. 2.1. 工厂合约
    2. 2.2. Exchange合约
    3. 2.3. Uniswap合约
  5. 3. uniswapV2
    1. 3.1. 架构
    2. 3.2. 兑换函数
    3. 3.3. 流动性代币
    4. 3.4. Uniswap协议手续费
    5. 3.5. 代币价格预言机
    6. 3.6. 库View函数
    7. 3.7. Routes
  6. 4. uniswapV3
    1. 4.1. uniswapV3
      1. 4.1.1. 框架
      2. 4.1.2. 开发环境
    2. 4.2. 手动计算的Swap
      1. 4.2.1. 完整合约代码
      2. 4.2.2. 计算流动性
      3. 4.2.3. 添加流动性
      4. 4.2.4. swap代币
      5. 4.2.5. 管理流动池
    3. 4.3. 池子内的自动Swap
      1. 4.3.1. 完整合约代码
      2. 4.3.2. 添加流动性
      3. 4.3.3. 计算swap数量
      4. 4.3.4. 计算新的Tick位置
      5. 4.3.5. swap代币
      6. 4.3.6. 预估swap数量
    4. 4.4. 跨流动性区间的Swap
      1. 4.4.1. 完整合约代码
      2. 4.4.2. 添加流动性
      3. 4.4.3. swap代币
      4. 4.4.4. swap滑点
    5. 4.5. Milestone 4. 跨池子兑换
      1. 4.5.1. 完整合约代码
      2. 4.5.2. 部署Pool的工厂合约
      3. 4.5.3. 计算兑换路径
      4. 4.5.4. swap代币
    6. 4.6. Milestone 5. 累计手续费用 + Oracle price
      1. 4.6.1. 完整合约代码
      2. 4.6.2. swap 手续费
      3. 4.6.3. 协议手续费
      4. 4.6.4. 价格预言机
    7. 4.7. Milestone 6: NFT Positions
      1. 4.7.1. 完整合约代码
      2. 4.7.2. NFT Manager
      3. 4.7.3. NFT源数据

Web3 Uniswap Development Book

Web3 Uniswap DEX Development Book

Useful Links

  1. This book is hosted on GitHub: https://github.com/yuhuajing/uniswap-book
  2. Page in https://yuhuajing.github.io/uniswap-book/

Table of Contents

  • 背景
    • Solidity-Fixed-Point
    • ERC4626
    • 闪电贷Flashloan
    • 去中心化交易所
    • 恒定乘积公式
    • 价格操纵
  • uniswapV1
    • 工厂合约
    • Exchange合约
    • Uniswap合约
  • uniswapV2
    • 架构
    • 兑换函数
    • 流动性代币
    • Uniswap协议手续费
    • 代币价格预言机
    • 库View函数
    • Routes
  • uniswapV3
    • uniswapV3
      • 框架
      • 开发环境
    • 简单的Swap
      • 简介
      • 计算流动性
      • 提供流动性
      • 兑换代币
      • 管理流动池
      • 部署池合约
      • User Interface
    • 单流动性区间的Swap
      • swap价格
      • Tick索引
      • 添加流动性
      • swap代币
      • swap数量
    • 跨流动性区间的Swap
      • swap价格
      • swap代币对
      • swap滑点
      • 添加流动性
      • 定点数
      • Flash Loans
      • User Interface
    • Milestone 4. Multi-pool Swaps
      • Factory Contract
      • Swap Path
      • Multi-Pool Swaps
      • User Interface
      • Tick Rounding
    • Milestone 5. Fees and Price Oracle
      • Introduction
      • Swap Fees
      • Flash Loan Fees
      • Protocol Fees
      • Price Oracle
      • User Interface
    • Milestone 6: NFT Positions
      • Introduction
      • Overview of ERC721
      • NFT Manager
      • NFT Renderer

Running locally

To run the book locally:

  1. Install Rust.
  2. Install mdBook:
    $ cargo install mdbook
    $ cargo install mdbook-katex
    
  3. Clone the repo:
    $ git clone https://github.com/yuhuajing/uniswap-book.git
    $ cd uniswap-book
    
  4. Run:
    $ mdbook serve --open
    
  5. Visit http://localhost:3000/ (or whatever URL the previous command outputs!)