- UniswapX is a new decentralized trading protocol that sources on-chain and off-chain liquidity for swap executions.
- Swappers propose a trade order, and fillers route them for on-chain settlement.
- UniswapX uses proprietary Dutch Orders to foster a competitive filler market and optimal swapper price discovery.
In a new whitepaper published on July 17, 2023, Uniswap unveils its new EVM-compatible, non-custodial Dutch auction-based trading platform, UniswapX.
This decentralized swapping protocol will revolutionize trading within Ethereum DeFi networks by sourcing on-chain and off-chain liquidity and offering extremely flexible trade orders.
UniswapX utilizes two main parties when executing trades: swappers and fillers. Swappers are users that submit trade orders, and fillers are individuals who execute trades to “fill” orders.
UniswapX outsources the routing of trade orders to fillers who direct them to sources of on-chain and off-chain liquidity for execution. Fillers are compensated with a percentage from each filled order.
UniswapX Dutch Orders
The UniswapX protocol utilizes what it refers to as Dutch Orders, which are different than normal limit orders and are based on a Dutch auction trading model where an asset is initially listed for sale at a very high price and then becomes cheaper over time until all listings are sold.
In a blockchain-based Dutch auction, the auction process is typically automated and takes place on a decentralized platform. The auction starts with a high token price, and it decreases over time, often at regular intervals, until it reaches a level where participants are willing to buy the tokens.
The participants can submit bids for the tokens at any time during the auction, and the offers are accepted on a first-come, first-served basis.
Dutch auctions are designed to ensure fair price discovery and allow participants to acquire tokens at a price they find acceptable. They can be used to distribute tokens to the public, raise funds for a project, or allocate resources in a decentralized manner.
Normal limit orders execute at their limit price, but Dutch Orders execute at a price that depends on the time it was recorded onto a block. Trade prices in a Dutch Order start at a value above the market spot for that trade and decay over time until the order price hits the lowest value a swapper is willing to accept.
The Dutch Order decay mechanism incentivizes fillers to execute trades as soon as possible to take profit before the swapper accepts a trade with a low value. Fillers can use a combination of on-chain and off-chain liquidity when filling orders, but if they wait too long, they could risk losing the order to another filler willing to take a smaller profit on the trade.
How a Trade is Executed on UniswapX
When a swapper submits a trade order, they create and sign a transaction. These transactions specify order fill logic which is data necessary to execute a trade. Fill logic consists of the input token the swapper wants to trade, the output token they wish to receive in exchange, the intended trade route, an execution deadline (when the trade has to be completed), and the swapper’s minimum desired output amount (the expected price of the output token).
Signed transactions are then submitted to the UniswapX mempool (a pool of pending transactions) to await block inclusion. Next, fillers pick transactions from the mempool to be included in a block and settled on-chain.
However, before their on-chain settlement, fillers run the signed transactions through a reactor smart contract to ensure that a trade’s execution aligns with a swapper’s specified order parameters; the reactor contract reverses trades that do not align.
Swappers authorize the reactor contract to pull the input token from their wallet address on their behalf, and the filler submits the transaction to the block for on-chain validation.
By submitting the transaction on-chain directly, fillers pay swapper gas fees which are recouped by factoring fee costs into the trade execution price. Once settled on-chain, the reactor contract automatedly contacts the filler’s executor contract to specify the trade route and fill logic.
The executor contract then sources liquidity and sends the output token to the swapper wallet address to complete the exchange. Finally, the reactor contract reaffirms that all of the swapper’s order conditions or parameters have been met.