UniswapX
UniswapX is a new permissionless, open source (GPL), auction-based routing protocol for trading across AMMs and other liquidity sources.
UniswapX improves swapping in several ways:
- Better prices by aggregating liquidity sources
- Gas-free swapping
- Protection against MEV (Maximal Extractable Value)
- No cost for failed transactions
- And in the coming months, UniswapX will expand to gas-free cross-chain swaps.
Swappers generate signed orders which specify the intents of their swap, and fillers compete using arbitrary filling strategies to satisfy these orders.
Trading on UniswapX
To trade using UniswapX, swappers create a new type of order called an Exclusive Dutch Order which specifies the maximum and minimum outputs they are willing to receive in a trade over a certain time period.
They then sign a message that uses Permit2 to allow the transfer of tokens to complete the trade as long as the the number of tokens sent and received matched what is specified in the decay curve. These Signed Order messages are broadcast publicly and available to be executed by anyone who wants to be a “filler”.
Fillers on UniswapX​
UniswapX introduces a new participant in the Uniswap ecosystem, the Filler. These agents pickup signed orders from swappers and compete to execute them using any source of liquidity they have access to.
Anyone can fill orders on UniswapX, get started by reading our Filler Integration Guide.
Parametizing UniswapX Orders on Mainnet​
The UniswapX protocol on Mainnet does not explicitly parameterize the pricing of orders like the Exclusive Dutch Order, rather order parameterization is left to be configured by the order constructor.
In the current Uniswap Labs interface implementation of UniswapX, some fillers may choose to help parameterize orders on Mainnet by participating as quoters. These fillers can only win a quote if they guarantee improved swapper execution over Uniswap v3 or v2 liquidity pools. Fillers who win a quote will receive execution priority for a limited period of time to fill orders they submitted wining quotes for.
To ensure a smooth swapping experience for traders, the set of Quoters will be vetted by Uniswap Labs following UniswapX’s launch, with plans to make the quoting system fully permissionless in the near future.
If you are interested in participating as a Quoter, please reach out here.
UniswapX Protocol Architecture
Reactors​
Order Reactors settle UniswapX orders. They are responsible for validating orders of a specific type, resolving them into inputs and outputs, and executing them against the filler's strategy, and verifying that the order was successfully fulfilled.
Reactors process orders using the following steps:
- Validate the order
- Resolve the order into inputs and outputs
- Pull input tokens from the swapper to the fillContract using permit2
permitWitnessTransferFrom
with the order as witness - Call
reactorCallback
on the fillContract - Verify that the output tokens were received by the output recipients
Reactors implement the IReactor interface which abstracts the specifics of the order specification. This allows for different reactor implementations with different order formats to be used with the same interface, allowing for shared infrastructure and easy extension by fillers.
Current reactor implementations:
- V2DutchOrderReactor: The latest version of the Dutch Order Reactor, that settle v2 linear decay dutch orders.
- LimitOrderReactor: A reactor that settles simple static limit orders
- DutchOrderReactor: A reactor that settles linear-decay dutch orders
- ExclusiveDutchOrderReactor: A reactor that settles linear-decay dutch orders with a period of exclusivity before decay begins
- PriorityOrderReactor.sol: A reactor that settles orders which implement priority taxes
Fill Contracts​
Order fillContracts fill UniswapX orders. They specify the filler's strategy for fulfilling orders and are called by the reactor with reactorCallback
.
Some sample fillContract implementations are provided in this repository:
- SwapRouter02Executor: A fillContract that uses UniswapV2 and UniswapV3 via the SwapRouter02 router
Direct Fill​
If a filler wants to fill orders using funds on-hand rather than a fillContract, they can do so gas efficiently using the directFill
macro by specifying address(1)
as the fillContract. This will pull tokens from the filler using msg.sender
to satisfy the order outputs.
Whitepaper
More details on the UniswapX protocol are available in the UniswapX Whitepaper.
Deployment Addresses
Contract | Address | Source |
---|---|---|
V2 Dutch Order Reactor | 0x00000011f84b9aa48e5f8aa8b9897600006289be | V2DutchOrderReactor |
V1 Exclusive Dutch Order Reactor | 0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4 | ExclusiveDutchOrderReactor |
OrderQuoter | 0x54539967a06Fc0E3C3ED0ee320Eb67362D13C5fF | OrderQuoter |
Permit2 | 0x000000000022D473030F116dDEE9F6B43aC78BA3 | Permit2 |