Below is an example of how UniswapX works using a hypothetical situation.
To start, lets say Alice (the swapper) wants to swap 1 ETH for USDC. Alice requests a quote from (potential fillers) Bob, Charlie, and Danielle:
- Bob offers to buy Alice’s ETH for 1,000 USDC
- Charlie offers 999 USDC
- Danielle offers 998 USDC
- Alice can also swap her 1 ETH directly through Uniswap v3 for 997 USDC
Alice accepts Bob’s quote for 1,000 USDC, and she signs the order.
This order includes a maximum value (set by Bob’s quote of 1,000 USDC) and minimum value of 997 USDC (set by the Uniswap smart order router API).
Bob could fill Alice’s order using his own USDC or by routing Alice’s 1 ETH to a variety of on-chain liquidity venues (Uniswap Protocol, Sushiswap, etc).
Bob decides to fill Alice’s order using some of his own USDC, and sends Alice 1,000 USDC in exchange for her 1 ETH.
If Bob had decided to fall through on his offer, Alice is not required to submit a new order and signature.
Instead, her existing order automatically updates, offering her 1 ETH to anyone who can give her 999 USDC in return.
One block has passed and now neither Charlie nor Danielle (nor any of the other fillers participating in the UniswapX system) are willing to fill Alice’s order at 999 USDC. After another Ethereum block (12 seconds) has expired, Alice’s 1 ETH becomes available for 998 USDC.
Suddenly, Danielle realizes that she can fill Alice’s 1 ETH sell order for 998 USDC while still collecting a 1 USDC profit for herself by sending Alice’s trade to a combination of Uniswap v3 and Sushiswap.
Danielle sends Alice’s 1 ETH to Uniswap v3 and Sushiswap on Alice’s behalf, returning 998 USDC to Alice and keeping the remaining 1 USDC output for herself.
Alice swaps her 1 ETH for 1 more USDC (998 USDC) through Danielle than she would have received if she had instead traded directly through Uniswap v3 (997 USDC).
This price improvement is achieved by sourcing liquidity from venues beyond Uniswap and capturing surplus value from advanced order routing that would otherwise be left for a MEV searcher to capture as an arbitrage or ‘backrun’ swap.
Additionally, by outsourcing the execution process to Danielle, who submitted the swap transaction through a private relay, Alice has avoided having her trade front-run by malicious MEV bots.