Uniswap V4: Everything You Need To Know.

July 4, 2023

In conclusion

If you ask any of your crypto-adjacent buddies about swapping tokens, Uniswap will be their first (and only) stop. And they're not alone. Right now, Uniswap holds the lion's share of DEX volume, accounting for about three-quarters of the total. The closest competitor, 1inch, can only muster a paltry 6% of the pie. It's safe to say that Uniswap is sitting comfortably at the top of the DEX game, while the rest are left trailing in its wake. On top of this:

  • Over its lifetime, more than $1.6T in transactions have taken place on the Uniswap platform, far and away the most of any dApp
  • Uniswap consistently ranks in the top five in TVL out of all projects, currently sitting just under $4B in locked value. 
  • They consistently rake in over $1M in daily fees, placing them just below Lido in terms of top dApps.
  • Their v2 codebase is the most-forked protocol of all time, with 438 projects being tracked on DeFiLlama - accounting for $3B in value of their own.

To understand how Uniswap has been able to grow into the behemoth it is today, we must take a trip back to the earliest days of DeFi. 

V1 - The origin story

It’d be difficult to overstate the impact that Uniswap has had on the broader DeFi economy. Born from Vitalik’s 2017 call-to-arms for the development of an Automated Market Maker (AMM) for permissionless token swaps, Hayden Adams launched the first version of Uniswap in November of 2018. 

V1 used a clever mechanism for pricing tokens against ETH, known as the constant product (“XY=K”) formula. In the formula, ‘x’ and ‘y’ are token amounts, which always multiply to equal a constant (‘k’): x*y=k. Out of all the exchange methodologies being theorized at the time, the XY=K model proved to have the earliest potential.

While this was a zero-to-one innovation, it had some shortcomings:

  • Every token was paired with ETH
  • Large orders would result in extreme slippage
  • Fee pricing was fixed

V2 - Taking Uni from proof-of-concept to prime time

V2 made changes that improved the functionality and composability of the protocol, cementing it into the foundations of DeFi:

  • ERC20 / ERC20 - tokens no longer had to be paired with ETH exclusively
  • Price oracles - now offering price feeds for each pair. These constant feeds can (and have been) used by any other dApp wishing to source token prices without using oracles reliant on off-chain data.

V3 - The path to sophisticated liquidity provision

With V2 establishing Uniswap as a powerhouse in the DeFi ecosystem, it was clear that further enhancements were needed to address the limitations of UniV2's initial XY=K design. That's where V3 comes in, paving the way for sophisticated liquidity provision by introducing concentrated liquidity and eliminating many inefficiencies associated with the old architecture.

Imagine you are a liquidity provider (LP) in the ETH-USDC pool. In the XY=K design (UniV2 and earlier), you would be providing an even “layer” of liquidity for traders from ETH prices from 0 USDC to ∞ USDC. While it would be nice if our ETH bags pumped to infinity, this is not the most efficient use of LP capital.

With concentrated liquidity, LPs can define a lower and an upper bound (known as “ticks” - ‘a’ and ‘b’ in the image above). So instead of providing from 0 to ∞ USDC per ETH, you could provide from 1000-4000 USDC per ETH - a much better use of capital. Read more here.

If the price stays within your chosen range, you earn fees from the pool. If the price is outside your range then your liquidity is not used, therefore no fees are earned.

In addition to concentrated liquidity, UniV3 introduced fee tiers and range orders.

  • Fee tiers: allow for LPs to tailor their positions to account for different levels of volatility (with higher fees reserved for high-volatility assets such as meme coins).
  • Range orders: by using v3 out-of-range ticks, users can basically set limit orders which fill over a specified range.

While this complicated the LPing process, the move to concentrated liquidity allowed for sophisticated market makers to hone in on specific strategies that actually produce a profit.

Get hooked on UniV4

It's been a solid five years since Uniswap first hit the scene, and now we're getting a glimpse of its fourth iteration, Uniswap v4. This bad boy comes packed with some wicked features that take token-swapping infrastructure to the next level. Check it out:

🎁 Native ETH: Forget about messing around with wrapped ETH (wETH) like in v2 and v3. In v4, you can pair tokens directly with the OG native ETH, just like in the good ol' days. Say goodbye to those annoying wrapping and unwrapping costs.

📸 Flash accounting: This sweet addition lets you pull off multiple operations within a pool without needing to settle in between. Combine it with...

🥇 Singleton: Uniswap v4 flips the script with a Singleton contract that holds all the pools. No more dealing with separate contracts for each pool. This means fewer costs when creating new pools and making those fancy multi-hop trades. And get this—Hayden, the mastermind behind Uniswap, claims it could slash new-pool creation costs by a mind-blowing 99%!

And hold up, we're not done yet. By blending Singleton and flash accounting with the upcoming EIP-1153 (Transient Storage), Uniswap v4 only includes the essential on-chain transactions. Translation? You get to enjoy complex swaps with minimal gas usage, just like you're cruising through a CEX (centralized exchange) but without all the centralized nonsense. How cool is that? 😎

Now, brace yourself for the most thrilling addition of them all—HOOKS 🪝

Basically, a hook is a set of custom code built into v4 pools during their creation, they can be set to execute:

  • Before or after initializing a pool position
  • Before or after modifying a pool position
  • Before or after a swap
  • Before or after a pool donation (donations are another new feature, which opens the door to potential bribing markets on Uniswap pools, a la Bunni from Timeless Finance)

The possibilities are truly staggering, but perhaps the easiest to understand is how custom fee structures could be implemented in v4 pools to better align the interests of LPs, swappers, and token holders.

[Trades are routed such that the swapper receives the best execution. This could mean that many pools are used in order to accomplish the swap efficiently.]

Hook Implementation 1 - Fee Customization

Now, my friend, things are about to get even more interesting. In Uniswap v4, we're breaking free from those static fees of the past (like the fixed 0.05%, 0.30%, and 1% tiers in v3). Brace yourself for some next-level flexibility because v4 pools can have:

🔥 Dynamic fees: Picture this, fees that can change based on how wild and crazy the pair's volatility gets. It's like the fees are dancing to the market's rhythm.

🎯 Targeted fees: Here's where things get really dialled in. Fees can be directed to specific subsets of liquidity providers (LPs) based on factors like their position sizing or even the age of their position.

🚫 Withdrawal fees: We're putting a little twist in the mix to discourage that Just In Time (JIT) liquidity strategy. You know, when LPs swoop in and out at lightning speed. Since it is usually sophisticated market makers practising these strategies, pools can be designed to benefit the retail LP.

💰 Auto-compounding fees: This one's a game-changer. Instead of just pocketing the fees, they can be automatically compounded back into the LPs' positions. It's like the fees are working hard to grow that LP's investment.

With these fresh capabilities, pool creators have the power of customization in their hands. They can fine-tune their pools like never before, creating the perfect trading environment for their users. It's all about precision and making every detail count, my friend. Uniswap v4 is taking us to a whole new level of pool creation.

Hook Implementation 2 - MEV

Since Maximum Extractable Value (MEV) is usually accomplished at the detriment of the everyday user, it's basically a four-letter word in crypto. But with v4 Hooks, MEV could offer some assistance to LPs.

In v4, hooks can be designed to help rebalance pools following each swap (action “H2” in the flowchart above). In the case where they could earn extra revenue from this rebalancing, this revenue could be passed along to the hardworking liquidity providers. 

Additional Capabilities Possible with Hooks

The true extent of these possibilities will only be fully realized when those super-smart DeFi devs work their magic on an initial product, but here are some ideas already floating around the ether.

🌟 Time-weighted Average Market Maker (TWAMM): This is a game-changer for handling large orders. With TWAMM support, pools can automatically break down those mammoth orders into smaller, bite-sized chunks executed over time. No more causing seismic price shifts with a single colossal order. 

🏦 Auto-lending for out-of-range liquidity: In the past, when a v3 pool went out of range, idle capital would just sit there gathering dust. But in v4, that idle capital can be put to work by automatically lending it out to earn some sweet yield.

📈 On-chain limit orders: Say goodbye to the old "range orders" and say hello to the upgraded version. Now, with v4, you can set on-chain limit orders that fill at specific tick prices. It's like setting your orders on autopilot and letting the protocol handle the rest.

🔍 Optional oracle feeds: In the previous versions, every pool had to export a price oracle, even though many outside protocols only used a handful of Uniswap oracles. But in v4, pool creators have the freedom to omit those extra price oracles, saving on precious gas fees.

🔒 KYC pools: Let's face it, my friend, regulation will probably sneak its slimy tentacles into the world of crypto sooner or later. Uniswap Labs, being a US entity, knows this all too well. With v4, the possibility emerges for establishing pools that only allow trades from whitelisted (KYC'ed) wallets, particularly for trading "crypto securities." 

These are just a few examples of the exciting capabilities that hooks bring to the table in Uniswap v4. And while the future of decentralized finance is looking brighter than ever, not everyone was pumped about Uniswap’s announcement.

Criticisms

The main criticisms from Uniswap’s news of version four surrounded its license and the overlap with other developing projects.

#OpenSourceInNameOnly

Ah, the world of open-source licensing and the occasional controversy it brings. Uniswap v4, like its predecessor v3, will be licensed under the Business Source License (BSL). This license puts some limitations on the commercial and production use of the v4 source code for a period of up to four years. Essentially, it prevents other protocols from forking the v4 code and releasing their own version until that time limit expires. Needless to say, this raised some eyebrows and sparked a lively debate within the crypto Twitter community.

https://twitter.com/LefterisJP/status/1668735734126084096?s=20

Copy-pasting from other projects

But that's not all. Uniswap also found itself facing criticism due to perceived similarities between v4 and other protocols. Let's take a closer look at some of the comparisons that caught people's attention:

Balancer: Balancer's v2 boasts features such as dynamic fees, a single-contract architecture, and the ability to lend out idle capital through Boosted Pools. Some similarities with Uniswap v4 are apparent.

Ambient (formerly Crocswap): Interestingly, the timing of Ambient's rebranding aligned quite closely with the announcement of Uniswap v4. Both projects share certain characteristics, including a single-contract architecture and dynamic fees.

Trader Joe (v2.1): Trader Joe, with its v2.1, offers dynamic fees, limit orders, and auto-compounding fees. These features bear a resemblance to some of the capabilities introduced by Uniswap v4.

Maverick: Maverick provides customizable tools for liquidity providers (LPs) that overlap with certain aspects of UniV4 hooks. The similarity in their offerings has not gone unnoticed.

Whether it was parallel thinking or blatant copy-pasting, the news of UniV4’s upgrades rattled some cages. Still, these changes are necessary once we understand where Uniswap is heading…

Uniswap’s endgame - cater to institutions and buildoors

When Uniswap dropped the concentrated liquidity bomb in version three, there was a whole lot of chatter about how it made things unnecessarily convoluted for the regular folks. It seemed like the platform was all about pleasing the big-shot market makers, leaving the average Joe scratching their head.

And now, with the fancy new addition of hooks and all the extra intricacy they bring, it's even more of a brain teaser for retail users. Meanwhile, those market makers can dive deep into the nitty-gritty and fine-tune their strategies for each pool. Plus, with the minimal gas costs for creating and destroying pools, you can bet your bottom dollar that the smart money will be running all sorts of A/B tests from the get-go.

In the end - doesn’t this make sense? Market making, in the traditional world, isn’t for retail users. It’s a complicated game and it often takes large teams to pull it off. Perhaps Uniswap’s shift is simply an acknowledgement that institutions will occupy the vast majority of future market-making activity in DeFi. And if it’s done in a trustless and permissionless manner, maybe that’s OK.

And for devs, these v4 changes are a real game-changer for those itching to build on Uniswap. It's already the foundation for a boatload of integrations in the DeFi world, but with hooks thrown into the mix, builders can conjure up some seriously rad and innovative use cases.

https://twitter.com/Panoptic_xyz/status/1668656803373264896?s=20

From Uniswap's point of view, they're gunning to be the go-to platform for innovation. With the introduction of hooks, it's highly likely that new DEXs eyeing a launch might choose to build on top of Uniswap rather than trying to go head-to-head with it. By prioritizing hooks and expanding its software toolkit for builders, Uniswap aims to solidify its dominance in the industry. They want to be the cool kid on the block that everyone wants to collaborate with and ride the wave of success together.

https://twitter.com/Saypien_/status/1671889070736424960?s=20

Our Take

Uniswap isn’t going anywhere.

Now, some folks might grumble about their licensing approach, but you can't deny its effectiveness. Open sourcing is a double-edged sword. Just because Balancer or Ambient came up with (or at least suggested) something similar, doesn't mean their brilliant ideas can't be swiped (unless, of course, you have a BSL, kek).

Uniswap's shift from a retail-focused v1-2 to a more institutional- and builder-oriented v3-4 makes complete sense in terms of its growth strategy. They want their protocol to be as invincible as Ethereum itself. And by tapping into the smart money and infiltrating every nook and cranny of DeFi, they just might pull off this audacious mission. They're playing the long game, and they're playing it smart.

Other DEXs we’re watching

Fortunately, the realm of innovation extends far beyond Uniswap's domain. As a crucial piece of the ecosystem's infrastructure, various decentralized exchange (DEX) designs are proving their worth and making their mark.

Curve remains the undisputed king of stableswaps. Their unique architecture enables massive trades between pegged assets with minimal slippage, showcasing its perfect fit in the world of DeFi.

Some ve(3,3) DEXs, like Velodrome, have displayed remarkable staying power while accruing value to their governance tokens—a feat that may be foreign to UNI holders.

Meanwhile, new contenders are staking their claims with groundbreaking technologies. Maverick, Ambient, and Trader Joe are all set to revolutionize the game with their innovative approaches. Maverick, in particular, has devised concentrated liquidity that dynamically follows price movements, and they have made a significant impact on the LST swapping market.

Vertex's hybrid model, blending a Central Limit Order Book (CLOB) with an Automated Market Maker (AMM), promises to deliver the best of both worlds in terms of DEX performance (read our report here). It'll be fascinating to observe the market's reaction to this game-changing concept.

dYdX, Hyperliquid, and Syndr are harnessing the power of app chains. dYdX and Hyperliquid operate on the Tendermint Layer 1, while Syndr utilizes Arbitrum Orbit Layer 3. This enables them to have complete control over chain parameters, resulting in nearly-instant confirmations and potentially paving the way for highly efficient order books.

Satori is placing its bet on Zero-Knowledge technology, launching on various Zero-Knowledge chains such as Scroll and Polygon's zkEVM. The question remains: will ZK tech render Optimistic roll-ups obsolete?

Uniswap has been a staple of DeFi since day one. They have weathered the storms, adapted, and innovated to survive in this Cambrian tidepool of digital capitalistic innovation. It's no wonder they hold the top spot among DEXs, and with their shift to v4, it's unlikely that their position in the stack rankings will be challenged anytime soon.

You dont have a LARP NFT or are subscribed to Unlock Protocol. For Pro Access, Subscribe to Unlock Protocol here.
If you have another wallet with LARP NFT, change it here.

Table of contents
Prices
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Top Tweets