Uniswap Labs Blog

How Uniswap v4 and UniswapX Create the Best Swapping Experience

October 04, 2023

Since day one, Uniswap has been committed to creating the best swap experience. As crypto markets have evolved, so has our understanding of what exactly that experience looks like for users.

To be the best place to swap, Uniswap must have the best prices and the best liquidity. Best price can seem easy to measure but needs deep liquidity to find the best path. Liquidity is best when there is a flexible but reliable combination of tokens, pools, and fee tiers to attract liquidity providers for deeper markets.

Each successive version of Uniswap has supported more complex pool features, and v4 will take that to another level. While great for liquidity, pool customizability made it hard to find swappers the optimal route that would give them the best price. Routing and liquidity have become two separate – but related – problem spaces as markets have evolved.

To make progress on both fronts, we’re unbundling them. Uniswap v4 introduces hooks to build custom automated market maker (AMM) features, like recurring investments or oracles. UniswapX outsources routing complexity to an open network of third-party fillers who then compete to find the best price across liquidity sources. Together, these complementary protocols help give users the best swapping experience.

Best liquidity with Uniswap v4

Uniswap v1 was an experiment in liquidity creation to test if AMMs had a place in crypto. But AMMs unlocked powerful new tools to let anyone create permissionless markets. Uniswap became the most popular venue for long-tail of tokens, like MKR and DAI. Only after came the next problem of what it means to be the best place for liquidity.

Later versions of Uniswap became more expressive. Uniswap v2 and v3 introduced ERC20 pairs, concentrated liquidity, and custom fee tiers to make deploying liquidity even more customizable. Uniswap v4 takes that one step further. V4 hooks are like plugins, letting pool deployers introduce arbitrary code that can run at key points throughout the pool’s lifecycle – like before or after a swap.

With hooks, developers can innovate on top of the Uniswap Protocol’s liquidity and security to create customized AMM pools that integrate with v4’s smart contracts. Because each pool is now defined by more than just the tokens and fee tier, we'll see pools of all colors, shapes, and sizes.


All this customization and expressivity began to fragment Uniswap’s liquidity across three (soon four) different versions and nearly a dozen chains. Finding a swapper the best price on a trade meant checking a lot more pools for the optimal route. That meant more computation, more hops, and more gas. Customized AMM features will make Uniswap the best place for liquidity, but it becomes more challenging to find the best route that gives swappers the most tokens.

UniswapX is a protocol focused on the routing problem. It outsources the problem of discovering the best route to a competitive marketplace that is aware of other onchain sources and private inventory to find swappers the best price.

Best prices with UniswapX

Finding the best possible route depends on how broad liquidity coverage is. The more liquidity we know about, the more options we can have to find the best route. The Uniswap auto-router, DEX aggregators, and meta-aggregators are popular for this exact reason — they have broad liquidity coverage.


The Uniswap auto-router searches v3 and v3 to find the most tokens

But as the universe of liquidity pools expands, manually maintaining a single routing engine is not sustainable. Aggregators are bottlenecked by needing constant maintenance. With Uniswap v4, that maintenance will be more difficult. Liquidity will exist behind custom hooks that routing engines would need to find, audit, and use.

Our solution to the routing problem was to create a marketplace that would gamify liquidity discovery. Instead of accepting a quote from a single source, swaps go through an auction system. “Fillers” will compete to find the best route that offers the best price for swappers.

This market is highly competitive. Fillers, who look like the block-builders and traders of today, are incentivized to use any strategy at their disposal to offer lower prices. They can give MEV back to swappers, look for obscure liquidity sources, tap into private inventory, or save gas by batching — anything that will give them an advantage to win the auction. UniswapX turns routing from a one-to-one problem into a one-to-many problem with a permissionless protocol that formalizes market participants, sets ground rules, and lets fillers compete with each other to push value back to the swapper.

Creating a market for swap fulfillment prepares us for a multichain future as well. Swapping tokens across chains will need to mimic the UX of swapping on a single network. Routing will need to abstract bridge complexity and latency. Fillers can draw on cross-domain MEV, private inventory, and user intents to win the right to give a swapper the largest number of output tokens.

As the universe of existing liquidity pools branches across four Uniswap versions and more chains, the UniswapX filler network will actively discover new liquidity sources to maximize liquidity coverage and offer the best price.

Parallel and complementary protocols

Uniswap v4 and UniswapX are parallel and complementary protocols. Each focuses on a specific problem space: Uniswap v4 optimizes pool customizability to be maximally expressive and UniswapX optimizes routing to maximize output tokens. Combined, these two give swappers the best swapping experience while maintaining our commitment to decentralized, censorship-resistant, and permissionless markets.

Related posts