TL;DR
Uniswap v4 will be the next major upgrade of the most used decentralized exchange (DEX). The upgrade aims for a user experience closer to centralized exchanges – combined with the obvious benefit of not relying on a central custodian. Uniswap has given developers a sneak peek into the code of Uniswap v4. It’s main feature is called hooks and they will allow for limit orders, as an example.
Uniswap founder Hayden Adams wrote an article about Uniswap v4 in which he releases the draft code of v4 and talked about its goal. Which is ‘that v4 can be built in public, with open feedback and meaningful community contribution.’ Adams expects this to be a months-long process.
A Step Back: What Is Uniswap?
Uniswap is a DEX built on Ethereum and launched in 2018. It pioneered a mechanism known as an Automated Market Maker (AMM) to facilitate trades. This means that instead of matching individual buyers and sellers like a traditional exchange, Uniswap has pools of different cryptocurrencies that people can trade against. These pools are funded by other users who earn fees on trades as a reward for providing liquidity.
To give you an idea: there are hundreds of thousands of liquidity providers on Uniswap, and millions of traders. The trading volume of Uniswap is in the same ballpark as that of listed centralized exchange Coinbase.
Uniswap has been updated two times already. The transition from v2 to v3 was a big one and was released in the spring of 2021. V3 added concentrated liquidity, which allowed liquidity providers (LPs) to take positions in a certain price range for a trading pair. This increased the efficiency with which LPs can deploy (and risk) their capital. It allowed them to deploy refined strategies as opposed to just dumping their coins in a pool and hoping for the best. (More on that in the article about Trader Joe’s Liquidity Book, which uses a similar design.) Uniswap v3 also enshrined oracles, which allowed builders to integrate real-time, on-chain pricing data.
Hooks and Singleton Contracts
The mentioned integration of real-time on-chain pricing data came at the expense of some increased costs for swappers. Now Uniswap v4 allows anyone to make these tradeoff decisions through the introduction of “hooks.” Hooks are contracts that run at various points of a pool action’s lifecycle.
Hooks
In software, a hook is a place where a developer can insert their own code into an existing system. The hooks are essentially pieces of code that run at certain points in a transaction’s lifecycle, offering further potential for customization and complex operations.
In Uniswap V4, hooks allow developers to customize how the Uniswap protocol behaves in specific situations. They will make it possible to add a new feature or change how something works without developers having to fork the entire code base.
Hooks can for example be used for dynamic fees. Unlike in Uniswap v3, where the pool creator was limited to a few fixed fee tiers, in Uniswap v4, the pool creator can choose any fee as a static fee or attach a dynamic fee hook. This allows for a greater range of fee implementations, such as an oracle that tracks on-chain volatility and adjusts the fee accordingly.
Additionally, Uniswap v4 introduces the concept of a limit order hook. This feature allows the creation of limit…
Erik started as a freelance writer around the time Satoshi was brewing on the whitepaper.
As a crypto investor, he is class of 2020. More of a holder than a trader, but never shy to experiment with new protocols.