How we should imagine Uniswap v4 to be?

A51 Finance
7 min readDec 12, 2023

--

Many articles have been written about Uniswap v4 and how it will revolutionize the DeFi space, but only a few have been written to guide the developers about how they should prepare for its launch. Anyone looking to create something on Uniswap will have a hard time understanding where to start. The information is fragmented and not easily accessible.

This article is an attempt to fix that. We will go through each concept in Uniswap v4 so you can position yourself in the best way when it eventually launches.

Imagining Uniswap v4 vs. v3

Uniswap Labs intends Uniswap v4 to become a platform for AMMs which means Uniswap v4 is not just an AMM anymore, but a platform to build AMMs. In an interview with Bankless, Hayden Adams compared Uniswap v4 with Ethereum and its rollups-centric roadmap.

Uniswap is going in a similar direction with hooks instead of rollups. Just like Ethereum, Uniswap Labs also intends to keep the base protocol simple and without any complexity and all the innovation is pushed to the fringes meaning hooks. Hooks will be the place where all the innovation happens. One of the reasons for doing this is that Uniswap v3 was quite opinionated in the way it worked, but Uniswap v4 is just a neutral liquidity innovation space to build opinionated AMMs. This could spark a huge spur of innovation in the AMM space.

This reminds me of the endgame article written by Vitalik to envision the endgame for the blockchain design and he argued that all the blockchains will eventually converge to a similar design whether they are L2-centric or monolithic chains. This seems to be the endgame for Uniswap v4, and v5 might take Uniswap to an app chain.

What does it mean that Uniswap v4 is “not just an AMM anymore”?

It means that Uniswap v4 is not only a platform for exchanging assets but also a platform where developers can build their own customized AMMs.

What will happen to other AMMs now that incentive for forking does not exist anymore?

Many AMMs that are forks of Uniswap v2 or v3 on chains where Uniswap is already the dominant player will have a tough time going forward. They will probably have to start building on Uniswap v4 as well. In addition to this, vast majority of AMMs’ only innovation was around LP fees, but since Uniswap v4 now allows you to do all of that in their ecosystem, these AMMs might not be that lucrative anymore due to vast network effects of Uniswap’s ecosystem.

Imagining pools in v4 vs. v3

Pools have a very different meaning in v4 vs. v3. In the previous versions of Uniswap, all liquidity resided in pools and every pool was a separate contract. In v4, all liquidity exists in a singleton contract, and pools are just a wrapper around all the customizability you do with hooks

Anyone can initialize their own pool with their own custom hook which means that in practice there could exist hundreds if not thousands of pools for a pair of tokens.

How does liquidity function between singleton contract and pools

The assets across all the pools themselves reside in one single contract but are governed by pools. Pools are where price ratios are set, hooks are attached, and trades take place.

Should we be worried about all of the liquidity lying in the same contract?

Absolutely not. Singleton architecture has been tried in the past and has worked well. Balancer has been a proponent of singleton architecture. It offers a huge advantage over the factory architecture in terms of gas efficiency. If anyone is worried about potential vulnerabilities in the singleton contract that could put all the assets at risk should also realize that the factory architecture is no better in this regard as a vulnerability in a factory contract will also mean that that piece of code is replicated in all the contracts deployed by the factory meaning all the contracts now have that vulnerability.

What can be built on Uniswap v4

In the context of Automated Market Makers (AMMs), Uniswap v4’s introduction of hooks and a more platform-centric approach allows for the creation of highly specialized and innovative AMMs. Here are some specific possibilities:

Custom Fee Structures: Developers can create AMMs with unique fee models that could be dynamic, adjusting based on market conditions, volume, or even the time of day to optimize for liquidity provider returns and trader costs.

Dynamic Liquidity Allocation: AMMs on Uniswap v4 could automatically adjust liquidity across different price ranges based on algorithms, maximizing capital efficiency and potentially reducing impermanent loss.

Concentrated Liquidity Positions: While Uniswap v3 introduced concentrated liquidity, v4 could allow for even more granular control over liquidity positions, enabling developers to create AMMs that cater to very specific market segments or strategies.

Liquidity Provider (LP) Strategy Hooks: AMMs can be designed to allow LPs to implement custom strategies for their liquidity, such as automatic rebalancing, yield optimization, or integration with other DeFi protocols for additional earnings.

Slippage Protection Mechanisms: AMMs on Uniswap v4 could include advanced slippage protection, using hooks to integrate with oracles or other data sources to adjust pool parameters in real time to protect users from front-running or price manipulation.

Cross-Protocol AMMs: By leveraging hooks, developers could create AMMs that work across different protocols, enabling liquidity sharing and increased market depth.

Token-Specific AMMs: AMMs could be tailored for specific types of tokens, like stablecoins, governance tokens, or utility tokens, optimizing the trading function for the particular characteristics of these tokens.

Risk-Adjusted AMMs: AMMs could be designed to adjust fees or liquidity depth based on the risk profile of the assets being traded, potentially attracting a different class of investors.

AMMs with Integrated Insurance: Hooks could allow for the creation of AMMs that have integrated insurance mechanisms, offering protection against smart contract risk or other DeFi-related risks like divergence loss or LVR.

Social Trading AMMs: AMMs could be created where liquidity providers follow the strategies of successful traders or pools, automatically adjusting their liquidity provision to mirror successful patterns.

Pools with Governance Features: Developers could build AMMs that include governance in specific pools and could open another frontier for community collaboration.

By providing a neutral platform for liquidity provision and exchange, Uniswap v4 empowers developers to innovate within the AMM space, creating specialized and potentially more efficient markets.

Uniswap v4 Hooks is a great listing site to see what has been built so far.

Uniswap v4’s Routing & Pool Discovery Problem

Since Uniswap v3 had a factory pool deployment architecture, it featured limited variants of pools based on the fee tiers (0.01%, 0.05%, 0.3%, 1%). Once the pool is created, it cannot be recreated on the same fee tier meaning maximum 4 types of pool creations were allowed per pair. So the swap router of Uniswap would only resolve the trades from these tiers of the pool.

With the introduction of singleton architecture and pool creations with separate hooks integration, there can be infinite combinations of pool positions with hooks, which is great because anyone can create their own version of the pool with a custom set of logic to facilitate liquidity provision and trades. While this customization opens the doors of innovation, at the same time it has created a vacuum of decision making for the swap router of Uniswap or Uniswap X. Below are some of the problems of pool discovery that a pool creator will face.

  1. Position Discovery: Uniswap X swap router asks the fillers to bring the best quote for the trade from anywhere regardless if it’s on Uniswap. An individual pool position creator will have to create sufficient liquidity depth in the position to get noticed by the fillers.
  2. Hook Execution Dependency: Trade fillers are picky, so only selective positions will be used to fill the trade which means the hooks attached to other positions which will not be picked sit idle. Suppose a hook of limit order is attached to pool position, it will require its after Swap event to be triggered to actually know the price change which will lead it to fill the limit orders. This is inefficient for the users of that position.
  3. Swap Interfaces: New strategy builders and pool creators in v3 were not worried about having to ask their community to swap from a specific tier or building their own swap interfaces since the discovery was easier with limited options. In v4, they will have to advertise their positions as well as they might have to build their micro swap front ends to keep the trades going through their positions. The limitation with this approach is that they won’t initially get the volume through their hooks from the majority users landing on Uniswap frontend.

Conclusion

To conclude, Uniswap is moving towards yet another uncharted territory of liquidity and trading experience that will eventually transform itself into a native liquidity layer upon which many liquidity and money markets will be built and modular AMMs will become a norm. However, the transition still requires the answers to some possible vacuum it may create regarding the fair distribution of trading priority through virtually thousands of unique positions with custom hooks as well as the user experience because its predecessor v3 had this fundamental issue of LP profitability due to the bleeding impermanent loss in volatility.

--

--

A51 Finance

'Remote Control' for your liquidity positions offering a superior UI to use underlying AMMs.