Uniswap releases version 4 code, allowing for new types of liquidity pools

Uniswap Labs has released a draft of the code for Uniswap V4, according to a June 13 blog post from Uniswap’s founder, Hayden Adams. The new code features “hooks” or plugins that allow developers to create custom liquidity pools. 

Uniswap is the largest decentralized crypto exchange in the world by volume. Its latest version is V3 and was deployed on May 4, 2021.

Uniswap’s official user interface. Source: Uniswap

According to the post, V4’s “hooks” feature will allow future developers to create on-chain limit orders, automatic deposits to lending protocols, auto-compounded liquidity provider (LP) fees, and many other innovations to the exchange once it is implemented.

Releasing the source code is the first step to launching a new version of Uniswap. The team now plans to converse with members of the Uniswap community and iterate on this base code over time. V4 will be deployed once enough consensus has been built around a final version, but previous versions will still remain available as well.

According to Adams’ post, Uniswap V4’s purpose is to “create a way for pool deployers to introduce code that performs a designated action at key points throughout the pool’s lifecycle – like before or after a swap, or before or after an LP position is changed.”

For example, deployers will be able to create time-weighted average market makers (TWAMMs) that allow users to sell large amounts of crypto in small batches over time. This may help traders to avoid being frontrun by EVM bots or to suffer adverse price movements. On-chain limit orders will also be possible, as pools will be able to incorporate logic that lets them fulfill an order only when a token hits a particular price.

Some other examples of “hooks” include code which can redeposit fees back into an LPs pool or lend out inventory when a particular pool isn’t being used.

In a conversation with Cointelegraph, Uniswap Labs Engineer Sara Reynolds said the new version will allow automated market maker (AMM) exchanges like Uniswap to develop more rapidly than ever before, thanks to the inherent customizability it allows:

“In V4 what we really start to see is sort of this ‘primitive’ for customized logic[…]and that’s really exciting because I think it will really start to evolve AMM innovation quite fast.”

Uniswap Labs Head of Comms Bridget Frey echoed this sentiment, stating “Right now, other people have to build new AMMs to do a lot of this work. Now, what you’ll be able to do is to build your project with a hook contract on top of Uniswap’s security and liquidity in ways that hopefully make the innovation faster and easier to do for all sorts of projects.”

Decentralized exchanges have seen an influx of new users recently. The top three DEXs experienced a 444% surge in volume after the United States Securities and Exchange sued their centralized competitors, Binance and Coinbase, for allegedly violating securities regulations. This surge occurred even though the SEC has also tried to change the definition of “exchange” to include decentralized ones. Crypto venture capital firm Paradigm has argued that decentralized exchanges do not fit the definition of an “exchange” found in securities laws.

This article was edited on June 13 to clarify the deployment process.