- SG Thoughts
- Posts
- The best DEX?
The best DEX?
Exploring the OG DEX
Uniswap
Uniswap is a DEX protocol based on Ethereum that allows users to swap various tokens directly from their wallets without the need for traditional exchanges. Uniswap changed the paradigm of how traditional exchanges worked and it was designed to function as an automated liquidity protocol. Uniswap’s revolutionary approach to determine prices and manage liquidity pools changed the crypto space and they have continued to work on new innovations for DeFi.
Their upcoming and highly anticipated upgrade, Uniswap V4, is set to launch by Q3 2024 and it will introduce innovations for the creation of more efficient AMMs and DEXs. In this article, we’ll dive into Uniswap V4, and how previous versions of Uniswap stack up against this upcoming version. Let’s dive in.
Uniswap V1
Initially envisioned by Vitalik Buterin’s idea of a way to run on-chain decentralized exchanges with automated market makers, Uniswap V1 was born to solve the liquidity issue of normally illiquid assets.
Uniswap’s core innovation was the use of liquidity pools and a mathematical formula to determine asset prices without the need for traditional order books. Uniswap allows users to trade against these pools, which are filled by liquidity providers depositing assets into them. This changed the paradigm of finance by empowering any user to become a market maker.
What was the formula that revolutionized finance?
Prices for tokens on a pool are calculated automatically using what is known as a constant product formula (x*y=k), where x and y represent the quantity of the two tokens in the liquidity pool, and k is a constant. This formula ensures that the product of the quantities of the two tokens remains constant, thereby determining the price of the tokens.
Uniswap V2
The second version, launched in May 2020 introduced ERC-20/ERC-20 Swaps, Flash Swaps, Price Oracles, improved Liquidity Pools that allowed any combination of ERC-20 tokens to be pooled together, and technical improvements that helped with the better handling of ERC-20 tokens with optimized gas costs and a more robust security model. For some time Uniswap was the best available in terms of decentralized trading, however, as the space grew, some limitations were brought to life.
Uniswap V3
How did Uniswap V3 address the limitations of V1 and V2? The core concept is:
Uniswap V3 differed with V1 and V2, where liquidity was spread evenly across all prices, leading to less efficient use of capital.
Probably the biggest upgrade until now, Uniswap V3 changed the way capital is utilized in the DeFi space. With a range of improvements and new features, here’s how Uniswap V3 helped catalyze the growth of decentralized finance.
1. Concentrated Liquidity
In Uniswap V4, liquidity providers (LPs) are able to allocate their capital to specific price ranges within a trading pair's liquidity pool. This means that LPs can provide capital with greater efficiency as their funds are concentrated within a certain range where they expect the most trading activity will take place.
This was a significant upgrade for the protocol, but most importantly, it was very rewarding for LPs as by choosing a range where the most trading could potentially take place, they could also earn more fees compared to a broader range.
Source: “Uniswap v3 Core”. Uniswap V3 Whitepaper. Adams, H., Zinsmeister, N., Salem, M., Keefer, & Robinson, R.
But that’s not all. V3 went a step further to protect their LPs by enhancing them to be rewarded with an extra when their investment incurred a higher risk.
2. Multiple Fee Tiers
Uniswap V3 introduced multiple fee tiers (0.05%, 0.30%, and 1.00%), allowing LPs to be compensated based on the perceived risk of providing liquidity to different pairs.
High-volatility pairs could opt for higher fee tiers, compensating LPs for the increased risk, whereas stable pairs might use lower fee tiers.
In V2 and V1, there was a single fee level for all trades, which did not account for the varying degrees of risk between different types of assets.
Source: “Uniswap V3’s Concentrated Liquidity vs. Trader Joe’s Liquidity Book”, CoinGecko.
3. Flexible and Efficient Liquidity Management
Continuing with the principle of capital efficiency, V3 provided LPs more tools and options to manage their liquidity, including the ability to add or remove liquidity in custom price ranges. This flexibility allows LPs to adapt their strategies based on market conditions, potentially increasing their returns.
4. Improved Price Oracles
Going in line with efficiency, this version also enhanced the price oracle functionality introduced in V2, making it easier and more gas-efficient for other applications to integrate Uniswap prices.
The improved oracles were able to provide high-quality, time-weighted average prices on-chain, making them more resistant to manipulation and useful for a wider range of DeFi applications.
V3 definitely changed the game, becoming the standard for on-chain trading. The features mentioned above are only the core and most significant upgrades, but overall, this version also introduced gas efficiency improvements and more trading tools for users to get the most out of their trades.
As DeFi kept growing, the demand for customized solutions and the rise of SaaS models that enabled projects to easily tailor protocols to their specific needs were the catalysts for the creation of Uniswap V4.
Uniswap V4
The much-anticipated V4 will offer unparalleled flexibility and efficiency to both liquidity providers and traders. Expected to be launched in Q3 2024, V4 will introduce hooks and other customization options to become an even-more scalable platform.
1. Hooks
The core innovation in this version of the DEX is the introduction of "hooks". Hooks are external contracts that developers can create to customize how pools, swaps, fees, and LP positions interact within the Uniswap Protocol. This feature will provide more flexibility and a more customizable approach to liquidity provision by allowing developers to create customizable AMM pools with features like:
Time-weighted average market makers.
Dynamic fees based on volatility.
On-chain limit orders.
Implementation of Ethereum's upcoming Dencun hard fork.
2. Singleton Contracts
In Uniswap V3 and earlier, each token pair required a separate smart contract, leading to higher gas costs. To solve this, V4 will introduce a model, Singleton Contracts, that consolidate all pools into a single contract, significantly reducing gas costs for both trading and pool creation.
These contracts will allow for more efficient multi-hop trades as tokens do not need to be transferred between multiple contracts. Allegedly, creating a new pool in V4 could potentially be 99% cheaper in gas costs compared to V3.
Source: “Our Vision for Uniswap v4”, Adams, H.
While details for this new version are still limited, it’s expected that this version will also include unlimited fee tiers for liquidity pools, a system that lets users chain together multiple actions in a single transaction, and other improvements that will target trading efficiency.
Without a doubt Uniswap was one of the pioneers of decentralized finance and they have continued to live up to that reputation since their inception. Not only they helped the space grow in total value locked (TVL), but they also opened up the doors to anyone to take place in the market making process with attractive rewards.