Uniswap v4: Hooks, Pools, and More

Author's photo

Roule

I’m a Software engineer specializing in DeFi and blockchain technologies. Committed to exploring the intersection of code and decentralized finance. Beyond the digital realm, interests span diverse domains including health optimization, spiritual growth, physical fitness, and continuous learning across disciplines

September 5, 2023

Target Audience

Before starting, I want to note that this article is aimed at readers with a relatively solid foundation in DeFi.

Uni v3

If you want to learn more about the current version of Uniswap, I recommend the excellent article by PetitprinceETH available here.

Uni v4

On June 13, 2023, Uniswap shared its vision for v4 (in this post). I’ll give you an overview of this major upcoming update, which significantly impacts the current liquidity system.

HOOKS: MORE CUSTOMIZED POOLS

One of the major announcements is the introduction of hooks, smart contracts linked to our pool that can interact during its lifecycle (before or after a token exchange, for example).

This module is the keystone of potential innovations:

  • Dynamic fees based on volatility or other data
  • On-chain limit orders (perfect for DCA price zones without monitoring the asset 24/7)
  • Deposit of liquidity outside the range in lending protocols
  • Custom on-chain oracles
  • LP fees can be automatically reinvested in positions
  • Redistribution of internalized MEV profits to liquidity providers
  • A time-weighted average market maker

Pool Optimization and Flexibility

Dynamic Fees

In the aim of providing even more flexibility to liquidity providers, Uniswap proposes adaptive fees based on pair volatility. This avoids closing and reopening a position if the asset’s status changes. Currently, we must set the fee rate when creating the pool (0.01 / 0.05 / 0.3 / 1%, with an indication of the % of pools on each fee scale. We tend to say it’s 0.01 / 0.05 for stable-stable, 0.05 / 0.3 for known assets, and 1% for more degen pairs).

Automatic Reinvestment of Gains

Once again emphasizing optimization, the unicorn proposes “autocompound” of fees earned through the liquidity we provide: rather than claiming our due and modifying our position, the protocol will handle real-time reinvestment. The total gain is considerable since there are fewer position change fees, and we earn more in collected fees because the provided liquidity keeps increasing.

Custom Oracles

The hooks would also bring the possibility to integrate new oracles (support for transferring info between blockchain and external sources). This means developers can integrate their own logic to obtain price data or other information, possibly from multiple sources or according to their own algorithms, offering more flexibility and potential for innovation.

Architecture Modification

Lower Cost Pools

Fee reduction using a particular programming structure: the singleton.

In its simplest form, the singleton architecture is a design method that ensures only one instance of an entity exists. Here, this applies to pools, and more specifically to the linked smart contract. In v3, each provider has a smart contract per pool. Thanks to the implementation of a single smart contract, overloaded by hooks, overall fees can be reduced.

Singleton module diagram

(here, the Object in the diagram is the new pool smart contract)

To dive a bit deeper into the tech, we can talk about the addition of “flash accounting”.

In the general case, a transaction means token transfer from address A to address B. To proceed with this exchange, tokens are transferred from the user’s wallet to the pool, then from the pool to the recipient. Each transfer is recorded and validated in the chain, consuming a significant amount of gas.

In flash accounting, rather than actually transferring assets at each step, the system tracks net asset balances. If we perform multiple transactions in a single block, the system only transfers the net balance, so it could be smaller (or potentially zero if we buy and sell the same amount) than the total of cumulative individual transactions.

However, the tech needs to be proven (precise and secure) since this abstraction lightens the chain but poses a dilemma regarding traceability precision… However, this doesn’t remove the trustless aspect as all smart contracts remain open source, so no worries on that front.

Once again, Uniswap chooses to retain ownership and prohibits commercial use by forking their protocol for 4 years (maximum) through a “Business Source License 1.1”. Outside of a change made by Uniswap Governance or Labs, at the end of this period, the code will become open source under GPL.

My Analysis

The DeFi unicorn once again positions itself as a leader in decentralized protocol innovation and focuses on user experience and flexibility. Although becoming a liquidity provider requires relatively solid technical knowledge, I think these developments are another step toward recognizing DeFi as a serious and stable alternative to tradfi, for an increasingly broad audience.

© 2025 Delioos. All rights reserved.