Skip to main content

Introduction to Uniswap V4

Uniswap V4, the latest iteration of the Uniswap protocol, is a significant advancement in decentralized exchanges (DEXs) and automated market makers (AMMs). Here are the key features of Uniswap V4:

Customizability with Hooks: Uniswap V4 introduces a new feature called "hooks", which are essentially smart contracts that can be attached to liquidity pools. These hooks enable a high degree of customization, allowing developers to implement specific functionalities at different points in a pool's lifecycle, such as before or after swaps and liquidity modifications.

For example, hooks can enable order types (i.e. limit order), specially-tailored oracles, or custom AMM curves. The flexibility of hooks allows for a broad range of innovations while maintaining the core efficiency of the platform.

Singleton Contract for Efficiency: A significant architectural change in Uniswap V4 is the introduction of a Singleton contract. In previous versions, each token pair required a separate smart contract, leading to higher gas costs, especially in multi-hop trades. The Singleton contract model consolidates all pools into a single contract, significantly reducing gas costs for both trading and pool creation. This model allows for more efficient multi-hop trades as tokens do not need to be transferred between multiple contracts. Additionally, creating a new pool in V4 is 99% cheaper in gas costs compared to V3, lowering barriers for setting up new pools.

Flash Accounting System: Another innovative feature in Uniswap V4 is the "flash accounting" system. This system allows users to efficiently chain together multiple actions in a single transaction, such as swap-and-add-liquidity. The system tracks the net balances of inbound and outbound tokens; at the end of the transaction, the contract verifies all debts have been settled. If the user hasn’t settled their debts, the entire transaction reverts, ensuring security and efficiency. This system is similar to flash loans in concept and is part of the effort to reduce gas costs and enhance transaction efficiency on the platform.

Unlimited Fee Tiers: Uniswap V4 allows unlimited fee tiers for various liquidity pools. This flexibility allows for a more tailored approach in catering to a diverse range of assets and trading strategies. Each pool can have its own unique fee tiers, optimizing the platform's appeal to a wider spectrum of users and market needs.

Native ETH Support: Uniswap V4 enhances user experience by enabling direct trading pairs with native ETH, eliminating the need for WETH (Wrapped ETH). This simplification streamlines the trading process and lowers transaction costs.

Community-Driven Development and Innovation: Uniswap V4 emphasizes a community-driven approach to development and innovation. Since its code release, there has been active community engagement, with many issues, pull requests, and unique feature ideas contributed by users. The protocol is designed to encourage innovation, allowing the global community to shape the future of AMMs.