• Stars
    star
    408
  • Rank 105,946 (Top 3 %)
  • Language
    TypeScript
  • License
    GNU General Publi...
  • Created over 2 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Uniswap's Universal Router for NFT and ERC20 swapping

Universal Router

Please read the Contributions section before submitting a Pull Request.

To see the commit of the smart contracts that was used in the latest deployment, see branch deployed-commit. To see the addresses of this latest deployment on each network, see folder deploy-addresses.

High-Level Overview

The Universal Router is a ERC20 and NFT swap router that allows users greater flexibility when performing trades across multiple token types.

Our flexible command style allows us to provide users with:

  • Splitting and interleaving of Uniswap trades
  • Purchases of NFTs across 8 marketplaces
  • Partial fills of trades
  • Wrapping and Unwrapping of ETH
  • Time-bound, signature controlled token approvals using Permit2

Transactions are encoded using a string of commands, allowing users to have maximum flexibility over what they want to perform. With all of these features available in a single transaction, the possibilities available to users are endless

Contract Overview

The Universal Router codebase consists of the UniversalRouter contract, and all of its dependencies. The purpose of the UniversalRouter is to allow users to unify Uniswap ERC20 swaps (on V2 and V3) with NFT purchases across 8 marketplaces, in a single transaction.

UniversalRouter integrates with Permit2, to enable users to have more safety, flexibility, and control over their ERC20 token approvals.

UniversalRouter command encoding

Calls to UniversalRouter.execute, the entrypoint to the contracts, provide 2 main parameters:

  • bytes commands: A bytes string. Each individual byte represents 1 command that the transaction will execute.
  • bytes[] inputs: An array of bytes strings. Each element in the array is the encoded parameters for a command.

commands[i] is the command that will use inputs[i] as its encoded input parameters.

Through function overloading there is also an optional third parameter for the execute function:

  • uint256 deadline: The timestamp deadline by which this transaction must be executed. Transactions executed after this specified deadline will revert.

How the command byte is structured

Each command is a bytes1 containing the following 8 bits:

 0 1 2 3 4 5 6 7
โ”Œโ”€โ”ฌโ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚fโ”‚r|  command  โ”‚
โ””โ”€โ”ดโ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • f is a single bit flag, that signals whether or not the command should be allowed to revert. If f is false, and the command reverts, then the entire transaction will revert. If f is true and the command reverts then the transaction will continue, allowing us to achieve partial fills. If using this flag, be careful to include further commands that will remove any funds that could be left unused in the UniversalRouter contract.

  • r is one bit of reserved space. This will allow us to increase the space used for commands, or add new flags in future.

  • command is a 6 bit unique identifier for the command that should be carried out. The values of these commands can be found within Commands.sol, or can be viewed in the table below.

   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚ 0x00 โ”‚  V3_SWAP_EXACT_IN             โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x01 โ”‚  V3_SWAP_EXACT_OUT            โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x02 โ”‚  PERMIT2_TRANSFER_FROM        โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x03 โ”‚  PERMIT2_PERMIT_BATCH         โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x04 โ”‚  SWEEP                        โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x05 โ”‚  TRANSFER                     โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x06 โ”‚  PAY_PORTION                  โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x07 โ”‚  -------                      โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x08 โ”‚  V2_SWAP_EXACT_IN             โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x09 โ”‚  V2_SWAP_EXACT_OUT            โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x0a โ”‚  PERMIT2_PERMIT               โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x0b โ”‚  WRAP_ETH                     โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x0c โ”‚  UNWRAP_WETH                  โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x0d โ”‚  PERMIT2_TRANSFER_FROM_BATCH  โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x0e โ”‚  -------                      โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x0f โ”‚  -------                      โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x10 โ”‚  SEAPORT_V1_5                 โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x11 โ”‚  LOOKS_RARE_721               โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x12 โ”‚  NFTX                         โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x13 โ”‚  CRYPTOPUNKS                  โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x14 โ”‚  LOOKS_RARE_1155              โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x15 โ”‚  OWNER_CHECK_721              โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x16 โ”‚  OWNER_CHECK_1155             โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x17 โ”‚  SWEEP_ERC721                 โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x18 โ”‚  X2Y2_721                     โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x19 โ”‚  SUDOSWAP                     โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x1a โ”‚  NFT20                        โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x1b โ”‚  X2Y2_1155                    โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x1c โ”‚  FOUNDATION                   โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x1d โ”‚  SWEEP_ERC1155                โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x1e โ”‚  ELEMENT_MARKET               โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x1f โ”‚  -------                      โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x20 โ”‚  SEAPORT_V1_4                 โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x21 โ”‚  EXECUTE_SUB_PLAN             โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x22 โ”‚  APPROVE_ERC20                โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x23 โ”‚  WRAP_STETH                   โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x24 โ”‚  UNWRAP_STETH                 โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
   โ”‚ 0x25-โ”‚  -------                      โ”‚
   โ”‚ 0x3f โ”‚                               โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Note that some of the commands in the middle of the series are unused. These gaps allowed us to create gas-efficiencies when selecting which command to execute.

How the input bytes are structures

Each input bytes string is merely the abi encoding of a set of parameters. Depending on the command chosen, the input bytes string will be different. For example:

The inputs for V3_SWAP_EXACT_IN is the encoding of 5 parameters:

  • address The recipient of the output of the trade
  • uint256 The amount of input tokens for the trade
  • uint256 The minimum amount of output tokens the user wants
  • bytes The UniswapV3 path you want to trade along
  • bool A flag for whether the input funds should come from the caller (through Permit2) or whether the funds are already in the UniversalRouter

Whereas in contrast CRYPTOPUNKS has just 3 parameters encoded:

  • uint256 The ID of the punk you wish to purchase
  • address The recipient of the punk
  • uint256 The amount of ETH to pay for the punk

Encoding parameters in a bytes string in this way gives us maximum flexiblity to be able to support many commands which require different datatypes in a gas-efficient way.

For a more detailed breakdown of which parameters you should provide for each command take a look at the Dispatcher.dispatch function, or alternatively at the ABI_DEFINITION mapping in planner.ts.

Developer documentation to give a detailed explanation of the inputs for every command will be coming soon!

Usage

To Compile and Run Tests

  1. Create .env file with api key
INFURA_API_KEY='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  1. Run yarn commands to compile and test

To Run Hardhat Tests

yarn install
yarn symlink
yarn compile
yarn test

To Update Hardhat Gas Snapshots

yarn test:gas

To Run Forge Tests

forge install
forge build
forge test

Integrating

  1. Install the latest version of @uniswap/universal-router package.
  2. Add git submodules for contracts that aren't a node package. Make sure there's an empty .gitmodules file. Then run:
      git submodule add https://github.com/transmissions11/solmate
      git submodule add https://github.com/Uniswap/permit2
  3. You should now be able to import contracts from universal-router and compile.

Contributions

Before you submit your PR, run all of the following and commit the changes:

# make sure all tests pass this will also update gas snapshots
yarn test:all

# lint code
yarn prettier:fix

If you are only concerned with investigating gas diffs, you can run this command to only run gas tests

yarn test:gas

To Deploy

Fill out parameters in script/deployParameters/Deploy<network>.s.sol

forge script --broadcast \
--rpc-url <RPC-URL> \
--private-key <PRIVATE_KEY> \
--sig 'run()' \
script/deployParameters/Deploy<network>.s.sol:Deploy<network>

To Deploy and Verify

forge script --broadcast \
--rpc-url <RPC-URL> \
--private-key <PRIVATE-KEY> \
--sig 'run()' \
script/deployParameters/Deploy<network>.s.sol:Deploy<network> \
--etherscan-api-key <ETHERSCAN-API-KEY> \
--verify

To Deploy Permit2 Alongside UniversalRouter

Fill out parameters in scripts/deployParameters/<network>.json

forge script --broadcast \
--rpc-url <RPC-URL> \
--private-key <PRIVATE_KEY> \
--sig 'runAndDeployPermit2(string)' \
script/deployParameters/DeployUniversalRouter.s.sol:DeployUniversalRouter \
<pathToJSON>

More Repositories

1

web3-react

A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps
TypeScript
5,373
star
2

interface

๐Ÿฆ„ Open source interfaces for the Uniswap protocol
TypeScript
4,923
star
3

v3-core

๐Ÿฆ„ ๐Ÿฆ„ ๐Ÿฆ„ Core smart contracts of Uniswap v3
TypeScript
4,386
star
4

v2-core

๐Ÿฆ„ ๐Ÿฆ„ Core smart contracts of Uniswap V2
TypeScript
2,964
star
5

v4-core

๐Ÿฆ„ ๐Ÿฆ„ ๐Ÿฆ„ ๐Ÿฆ„ Core smart contracts of Uniswap v4
Solidity
1,810
star
6

v3-periphery

๐Ÿฆ„ ๐Ÿฆ„ ๐Ÿฆ„ Peripheral smart contracts for interacting with Uniswap v3
TypeScript
1,194
star
7

token-lists

๐Ÿ“š The Token Lists specification
TypeScript
926
star
8

v2-periphery

๐ŸŽš Peripheral smart contracts for interacting with Uniswap V2
Solidity
916
star
9

permit2

๐Ÿ”‘๐Ÿ”‘๐Ÿ”‘ next generation token approvals mechanism
Solidity
745
star
10

v4-periphery

๐Ÿฆ„ ๐Ÿฆ„ ๐Ÿฆ„ ๐Ÿฆ„ Peripheral smart contracts for interacting with Uniswap v4
Solidity
640
star
11

wallet

Uniswap Wallet is the simplest, safest, and most powerful self-custodial crypto wallet. It is developed by the Uniswap Labs team, inventors of the Uniswap Protocol.
TypeScript
530
star
12

merkle-distributor

๐Ÿ“ฆ A smart contract that distributes a balance of tokens according to a merkle root
TypeScript
497
star
13

v3-sdk

๐Ÿ›  An SDK for building applications on top of Uniswap V3
TypeScript
453
star
14

v1-contracts

๐ŸUniswap V1 smart contracts
Python
438
star
15

v2-sdk

๐Ÿ›  An SDK for building applications on top of Uniswap V2
TypeScript
427
star
16

v2-subgraph

Uniswap V2 subgraph ๐Ÿ“Š
TypeScript
399
star
17

smart-order-router

TypeScript
398
star
18

UniswapX

๐Ÿฆ„ Gasless ERC20 swap settlement protocol ๐Ÿฆ„
Solidity
380
star
19

v3-info

Interface for Uniswap V3 analytics. ๐Ÿ“Š
TypeScript
378
star
20

v3-subgraph

Subgraph for Uniswap V3
TypeScript
341
star
21

v3-staker

Canonical liquidity mining contract for Uniswap V3
TypeScript
330
star
22

docs

๐Ÿ““ Uniswap V3 docs website
TypeScript
310
star
23

default-token-list

โ—ฆ The Uniswap default token list
JavaScript
298
star
24

info

โ„น๏ธ Uniswap v1+v2 analytics
JavaScript
283
star
25

tokenlists-org

A site for browsing featured token lists
JavaScript
175
star
26

sybil-list

List of verified mappings from Ethereum addresses to social profiles
162
star
27

routing-api

TypeScript
147
star
28

org-v1

๐ŸŒ Uniswap protocol homepage
JavaScript
144
star
29

token-list-bridge-utils

TypeScript
138
star
30

solidity-lib

๐Ÿ“– Solidity libraries that are shared across Uniswap contracts
TypeScript
131
star
31

widgets

TypeScript
124
star
32

examples

TypeScript
124
star
33

governance-seatbelt

Make governance safer
TypeScript
116
star
34

retroactive-query

๐Ÿ‘€โฌ…๏ธ Queries for surfacing information about past users of Uniswap
109
star
35

v3-market-depth-study

Market depth calculation for Uniswap v3
Python
107
star
36

swap-router-contracts

Smart contracts for swapping on Uniswap V2 and V3. Superseded by https://github.com/Uniswap/universal-router
TypeScript
102
star
37

unisocks

๐Ÿงฆ
JavaScript
101
star
38

v3-polars

Jupyter Notebook
96
star
39

redux-multicall

A React + Redux library for fetching, batching, and caching chain state via the MultiCall contract.
TypeScript
93
star
40

api-deprecated

๐Ÿ”ฎ Uniswap market data
TypeScript
86
star
41

governance

๐Ÿ› Governance contracts for the Uniswap protocol
Solidity
78
star
42

sdk-core

โš™๏ธ Code shared across TypeScript Uniswap SDK versions
TypeScript
77
star
43

universal-router-sdk

TypeScript
77
star
44

hardhat-v3-deploy

Hardhat plugin for Uniswap V3 deployment
TypeScript
75
star
45

sybil-interface

Interface that incorporates Sybil, a governance tool for discovering delegates.
TypeScript
69
star
46

deploy-v3

CLI to deploy Uniswap V3 to any Ethereum compatible network
TypeScript
62
star
47

liquidity-staker

Initial UNI liquidity staking contracts
TypeScript
60
star
48

unisocks-erc721

๐Ÿงฆ
Python
52
star
49

sdks

prototype SDK monorepo
TypeScript
44
star
50

v1-docs

42
star
51

uniswapx-sdk

SDK bindings for the UniswapX protocol
TypeScript
40
star
52

uniswapx-parameterization-api

TypeScript
40
star
53

widgets-demo

@uniswap/widgets demo
40
star
54

uniswapx-service

UniswapX Order Service
TypeScript
39
star
55

marketdepth-v3

Uniswap v3 onchain market depth calculator
Solidity
39
star
56

unipig

๐Ÿฆ„๐Ÿท
JavaScript
38
star
57

v3-new-chain-deployments

Instructions for deploying the Uniswap V3 protocol to new chains after receiving approval from governance.
34
star
58

unified-routing-api

TypeScript
34
star
59

uniswap-first-contract-example

Example code for the smart contract getting started example.
JavaScript
29
star
60

permit2-sdk

TypeScript
29
star
61

old-solidity-contracts

โš ๏ธ DEPRECATED
Python
29
star
62

unisocks-erc20

๐Ÿงฆ
Python
26
star
63

v3-core-optimism

Optimism fork of the V3 core contracts
TypeScript
25
star
64

lp-action-contracts

Solidity
25
star
65

sybil-verifier-worker

Cloudlfare worker to verify mappings for Sybil, a governance tool for delegates.
JavaScript
25
star
66

router-sdk

TypeScript
23
star
67

advanced-weth

A smart contract that wraps WETH that adds functionality for transparently dealing in WETH
JavaScript
20
star
68

ethers-rs-mobile

Rust
17
star
69

v3-periphery-optimism

Optimism fork of the V3 periphery contracts
TypeScript
17
star
70

ds-tools

Python
15
star
71

jest-environment-hardhat

TypeScript
15
star
72

conedison

Utilities for Uniswap repositories
TypeScript
13
star
73

extended-token-list

JavaScript
12
star
74

v1-interface

๐Ÿ’€ Legacy interface for the Uniswap V1 protocol
JavaScript
12
star
75

returns-comparison-study

Python
11
star
76

mask-app

TypeScript
10
star
77

convert-cidv0-cidv1

GitHub action that converts CIDv0 for IPFS to CIDv1
JavaScript
9
star
78

polygon-bridge

Bridge contract for Polygon
TypeScript
9
star
79

mrkl-drop-data-chunks

The Merkle drop data broken up into chunks of 101 addresses and including a mapping file
TypeScript
8
star
80

fx-comparison-study

R
7
star
81

snapshot-gas-cost

Tiny utility package for snapshotting gas costs
TypeScript
7
star
82

eslint-config

Uniswap ESLint config
JavaScript
7
star
83

analytics

Uniswap analytics
TypeScript
7
star
84

interface-redirects

โ†ช๏ธ Redirects for alternative app.uniswap.org domains
6
star
85

analytics-events

Uniswap analytics events
TypeScript
6
star
86

permit2-dashboard

a dashboard for managing permit2 permissions
TypeScript
6
star
87

replace-vercel-dns-records

GitHub action for replacing Vercel DNS records, particularly useful for IPFS DNSLink TXT records
JavaScript
5
star
88

view-quoter-v3

Solidity
5
star
89

ticketblaster

a whimsical ticketing thing
TypeScript
4
star
90

relayer

Contracts supporting relayed UniversalRouter swaps
Solidity
4
star
91

v1-sdk

๐Ÿ›  An SDK for building applications on top of Uniswap V1
TypeScript
3
star
92

signer

TypeScript
3
star
93

contracts

Collection of all Uniswap smart contracts
Solidity
2
star
94

interfaces

Solidity
2
star
95

info-redirects

โ†ช๏ธ Redirects for the uniswap.info domain
1
star