Uniswap V3 — New Era Of AMMs?
So what is the long-awaited Uniswap V3 all about? How is it different from V2? Will this be a game-changer when it comes to the Automated Market Makers space? And will it launch directly on Layer 2? You’ll find answers to these questions in this article.
Although Uniswap, as one of the core DeFi projects, doesn’t need much of an introduction, let’s quickly go through a few major points before we jump into V3.
Uniswap, in essence, is a protocol for decentralized and permissionless exchange of tokens on the Ethereum blockchain.
The initial version of Uniswap was launched in Nov 2018 and slowly started building users’ interest.
In May 2020, at the beginning of DeFi Summer, Uniswap launched a second version of the protocol called Uniswap V2.
The main feature was the addition of ERC20/ERC20 liquidity pools on top of ERC20-ETH pools present in V1.
In the second half of 2020, Uniswap V2 went through a period of parabolic growth and quickly became the most popular application on Ethereum. It also became pretty much a standard for Automated Market Makers (AMMs) making it one of the most forked projects in the whole DeFi space.
Less than a year since its launch, V2 has facilitated over $135B in trading volume — an astonishing number that is comparable with top centralized cryptocurrency exchanges.
You can learn more about the full story behind Uniswap V1 and V2 in this article here.
Also, the concepts of liquidity pools and automated market makers are worth understanding. If you need a quick recap, here is an article.
Just before releasing V2, the team behind Uniswap had already started working on a new version of the protocol, details of which were announced just now — at the end of March 2021. The team decided to launch Uniswap V3 on both the Ethereum mainnet and Optimism — an Ethereum Layer 2 scaling solution — targeting early May for the release.
This was clearly one of the most anticipated announcements in DeFi’s history and it looks like V3 can completely revolutionise the AMM space.
So what are the main changes?
Uniswap V3 focuses on maximising capital efficiency when compared to V2. This not only allows LPs to earn a higher return on their capital but also dramatically improves trade execution that can now be comparable or even surpass the quality of both centralized exchanges and stablecoin-focused AMMs.
On top of this, because of better capital efficiency, LPs can create overall portfolios that significantly increase exposure to preferred assets and reduce their downside risk. They can also add single assets as liquidity to a price range that is above or below the current market price which basically creates a fee-earning limit order that executes along a smooth curve.
This is all possible by introducing a new concept of concentrated liquidity — more on this in a second.
Besides this, V3 introduces multiple fee tiers and improves Uniswap Oracles.
Now, let’s go through some of the Uniswap V3 features one by one to understand them a bit better.
Concentrated liquidity is the main concept behind V3.
When LPs provide liquidity to a V2 pool, liquidity is distributed evenly along the price curve. Although this allows for handling all price ranges between 0 and ∞, it makes the capital quite inefficient. This is because most assets usually trade within certain price ranges. This is especially visible in pools with stable assets that trade within a very narrow range. As an example, Uniswap DAI/USDC pool only uses around 0.5% of capital for trading between $0.99 and $1.01 — a price range where the vast majority of trading volume goes through. This is also the volume that makes the majority of trading fees for the LPs.
This means that in this particular example, 99.5% of the remaining capital is pretty much never used.
In V3, LPs can choose a custom price range when providing liquidity. This allows for concentrating capital within ranges where most of the trading activity occurs.
To achieve this, V3 creates individualised price curves for each of the liquidity providers.
Before V3, the only way to allow LPs to have individual curves was to create a separate pool per curve. These pools if not aggregated together resulted in high gas costs if a trade had to be routed across multiple pools.
What is important is that users trade against combined liquidity that is available at a certain price point. This combined liquidity comes from all the price curves that overlap at this specific price point.
LPs earn trading fees that are directly proportional to their liquidity contribution in a given range.
Concentrating liquidity offers much better capital efficiency for liquidity providers.
To understand it better, let’s go through a quick example.
Alice and Bob both decide to provide liquidity in the ETH/DAI pool on Uniswap V3. They each have $10,000 and the current price of ETH is $1,750.
Alice splits her entire capital between ETH and DAI and deploys it across the entire price range (similar to V2). She deposits 5,000 DAI and 2.85 ETH.
Bob, instead of using his entire capital, decides to concentrate his liquidity and provides capital within the price range from 1,500 to 2,500. He deposits 600 DAI and 0.37 ETH — a total of $1200 and keeps the remaining $8800 for other purposes.
What is interesting is that as long as the ETH/DAI price stays within the 1,500 to 2,500 range, they both earn the same amount of trading fees. This means that Bob is able to provide only 12% of Alice’s capital and still makes the same returns — making his capital 8.34 times more efficient than Alice’s capital.
On top of that, Bob is putting less of his overall capital at risk. In case of a quite unlikely scenario of ETH going to $0, Bob’s and Alice’s entire liquidity would move into ETH. Although they would both lose their entire capital, Bob puts a much smaller amount at risk.
LPs in more stable pools will most likely provide liquidity in particularly narrow ranges. If the $25M currently held in the Uniswap v2 DAI/USDC pool were instead concentrated between 0.99–1.01 price range in v3, it would provide the same depth as $5B in Uniswap v2 as long as prices stayed within that range.
When V3 launches, the maximum capital efficiency will be at 4000x when compared to V2. This will be achievable when providing liquidity within a single 0.1% price range. On top of that, the V3 pool factory will be able to support ranges as granular as 0.02% — which translates to a maximum of 20,000x capital efficiency relative to V2.
V3 also introduces the concept of active liquidity. If the price of assets trading in a specific liquidity pool moves outside of the LP’s price range, the LP’s liquidity is effectively removed from the pool and stops earning fees. When this happens, the LP’s liquidity shifts completely towards one of the assets and they end up holding only one of them. At this point, the LP can either wait until the market price moves back into their specified price range or they may decide to update their range to account for current prices.
Although it is entirely possible that there will be no liquidity at a specific price range, in practice this would create an enormous opportunity for liquidity providers to indeed provide liquidity to that price range and start collecting all trading fees. From the game theory point of view, we should be able to see a reasonable distribution of capital with some LPs focusing on narrow price ranges, others focusing on less likely but more profitable ranges and yet another ones choosing to update their price range if the price moves out of their previous range.
Range Limit Orders
Range Limit Orders is the next feature enabled by concentrated liquidity.
This allows LPs to provide a single token as liquidity in a custom price range above or below the current market price. When the market price enters into the specified range, one asset is sold for another along a smooth curve — all while still earning swap fees in the process.
This feature, when used together with a narrow range, allows for achieving a similar goal to a standard limit order that can be set at a specific price.
For example, let’s assume that DAI/USDC trades below 1.001. An LP can decide to deposit their DAI to a narrow range between 1.001 and 1.002. Once DAI trades above 1.002 DAI/USDC the whole LP’s liquidity is converted into USDC. At this point, the LP has to withdraw their liquidity to avoid automatically converting back into DAI once DAI/USDC goes back to trading below 1.002.
LPs can also decide to provide liquidity in multiple price ranges that may or may not overlap.
For example, an LP can provide liquidity to the following price ranges in the ETH/DAI pool:
-$2000 between $1,500-$2,500
-$1000 between $2,000 — $3,000
-$500 between $3,500-$5,000
Being able to enter multiple LP positions within different price ranges allows for approximating pretty much any price curve or even an order book. This also enables creating more sophisticated market-making strategies.
As each LP can basically create their own price curve, the liquidity positions are no longer fungible and cannot be represented by well-known ERC20 LP tokens.
Instead, provided liquidity is tracked by non-fungible ERC721 tokens. Despite this, it looks like LP positions that fall within the same price range will be able to be represented by ERC20 tokens either via peripheral contracts or through other partner protocols.
On top of this, trading fees are no longer automatically reinvested back into the liquidity pool on LPs’ behalf. Instead, peripheral contracts can be created to offer such functionality.
The next new feature is the flexibility when it comes to trading fees. Instead of offering the standard 0.3% trading fee known from Uniswap V2, V3 initially offers 3 separate fee tiers — 0.05%, 0.3% and 1%. This allows LPs to choose the pools according to the risk they are willing to take. The team behind Uniswap expects the 0.05% fee to be predominantly used for pools with similar assets such as different stable coins, 0.3% for other standard pairs like ETH/DAI and 1% for more exotic pairs.
Similarly to V2, V3 can also enable a protocol fee switch where part of the trading fee would be redirected from LPs to UNI token holders. Instead of having a fixed percentage like in V2, V3 offers between 10 and 25% of LP fees on a per-pool basis. This will be switched off at launch, although it can be switched on at any time as per Uniswap governance.
Last but not least is a significant improvement to the TWAP oracles introduced by Uniswap V2. V3 makes it possible to calculate any recent TWAP within the past ~9 days in a single on-chain call.
On top of this, the cost of keeping oracles up to date has been reduced by around 50% when compared to V2.
These are pretty much all the main features behind Uniswap V3.
What is interesting is that all of these features haven’t caused an increase in the gas cost. Rather the opposite, the most common feature — a simple swap will be around 30% cheaper than its V2 equivalent.
It looks like Uniswap V3 can be a game-changer when it comes to AMMs. It basically combines the benefits of a standard AMM with the benefits of a stable-asset AMM — all of this while making capital way more efficient. This makes V3 a super flexible protocol able to accommodate a whole range of different assets.
It will be interesting to see how V3 could affect other AMMs, especially the ones that V2 couldn’t earlier compete with, for example, stable coin AMMs like Curve.
It is also crucial that V3 launches in parallel on Optimism.
Optimism is an optimistic rollup-based Layer 2 scaling solution that enables fast and cheap transactions without sacrificing Layer 1’s security. At the moment, Optimism is partially rolled out and has started integrating with a few selected partners like Synthetix.
Uniswap on Layer 2 should be able to attract even more users who might have been priced out by high gas fees on Layer 1.
Exchanges enabling withdrawals to Optimism would be another big step towards the quick adoption of V3 on Layer 2.
On top of the V3 launch, an imminent full launch of Optimism will clearly be another highly anticipated event to wait for.
Besides this, the migration from V2 to V3 will be done on a fully voluntary basis. In case of V1 to V2 migration, it took just over 2 weeks for V2 to surpass V1’s liquidity. It would be also interesting to see if Uniswap’s governance decides to further encourage LPs by voting in some kind of incentives only present in V3 — maybe another liquidity mining program?
With the super high capital efficiency of V3, even if the existing liquidity is split between V2, V3 and V3 on Optimism, it should still be way more than enough to facilitate trading with low slippage across all of these 3 protocols.
One challenge of V3 is that providing liquidity may become a bit harder, especially for less sophisticated users. Choosing a wrong price range may magnify the chances of being affected by impermanent loss and it will be interesting to see a development of third party services that could help with choosing optimal strategies for allocating liquidity.
So what do you think about Uniswap V3? Will this be a game-changer in the AMM space? Will Uniswap on Optimism bring even more users to DeFi?
Finematics is also now participating in Round 9 of Gitcoin Grants based on the quadratic funding mechanism where even the smallest contribution matters. If you’d like to show your extra support, check out this link here.
Originally published at https://finematics.com on March 23, 2021.