Analyzing Uniswap V3

arnau ramio
16 min readApr 11, 2021

It has been a long time since I spent a few hours writing and writing down my thoughts and developments in the DeFi world. After the book, nothing has left me more restless and with more desire to recover the DeFi posts such as the announcement of Uniswap v3, which intends to be already operational by the end of May.

Uniswap has been in the DeFi world for many years now, clearly being one of the protagonists; not only because of the volume and number of users that it has managed to enchant, but also because of participating in some of the most interesting and crazy events such as the vampire mining of Sushi in the middle of summer 2020. Now it seems that Uniswap plans to change the rules of the game again, especially in the world of AMM or Automated Market Makers.

My goal today with this post is to inform about the advances and new functionalities of Uniswap v3 and to try to delve into what implications and investment strategies they entail. I know you are not up to date with the changes yet, but I sincerely believe that it will be a before and after, as much as the liquidity mining program of Compound was.

Evolution of Uniswap

Uniswap doesn’t need much of an introduction, but we will run through some of the more important points. In case you want to know more about Uniswap and how it works internally, I recommend this other post.

Basically Uniswap is a DeFi protocol that allows to trade pairs of tokens in a decentralized way and without asking anyone for “permission”. It was launched for the first time in 2018 under version 1, which allowed the creation of liquidity pools between ETH and ERC20 token. Its popularity increased every month, although the differentiating point came with the v2 published in mid-2020, giving the possibility of creating a pool between ERC20 tokens. In just 2 weeks, v2 contained more liquidity than v1: Uniswap became one of the protocols with the highest TVL and became the standard for AMMs. In fact, Uniswap’s v2 has moved $ 138 trillion in traded volume, figures that can even be compared to some of the larger centralized exchanges.

In its day Uniswap was a complete revolution, not only for DeFi, but for the financial sector in general. For the first time we had a decentralized protocol that allows anyone in the world to buy and sell assets and especially, generate markets from scratch. What do I mean by this? Now it is not necessary to have an intermediary company that through a software puts purchase and sale orders in contact to give a price to the asset, but the price is established by an algorithm. Uniswap has allowed us to say goodbye to centralized markets and expensive market makers that prevent the price of an asset from falling to 0 when there are no purchase orders. In turn, it has allowed us to say ‘hello!’ To a new world where liquidity is abundant, and where any type of asset, be it a utility token or a real-world asset represented through a security token, can have of liquidity, for everyone and with practically no associated cost except that of providing liquidity to the pools.

If all this seems incomprehensible to you, I highly recommend reading this post from Uniswap, so that you can understand its internal workings and understand everything mentioned above.

Uniswap v3

As we have just seen I think it is clear that Uniswap itself is a revolution for DeFi and the financial sector. At present, the teem leaded by Adams Hayer has surprised us again changing the rules of the game another time and redesigning the future of the AMM.

Version 3 primarily focuses on these innovations:

  • The possibility of adding concentrated liquidity in specific price ranges in the rice curve.
  • Creating multiple commission layers
  • Improving the oracles
  • Offering its protocol in the first layer (Ethereum) like in Optimism, a second layer of Ethereum focused on improving the scalability.

With the new functionalities it intends to improve the efficiency of the capital blocked in the pools of liquidity, allowing the liquidity providers to generate more fees wite the same or even less capital and offering a better execution, similar to what we could have with a centralised exchange or a AMM focused on stable coins as a curve. The increase of the efficient capital allows the LP to increase their exposure in concrete assets and highly reduce the risk that this means. Mitigating the chances of trading in unwanted prices or suffering impermanent loss.

Concentrated Liquidity

Capital efficiency

The concentrated liquidity is the big concept of v3 and surely the most differential and ground-breaking factor. In the pools of the v2 of Uniswap a provider of liquidity provides capital to the pools in exchange of fees. The problem was that the liquidity was shared between the entire price curve (from 0 to infinite). This caused the major part of the capital being completely useless, since the majority of assets trade in quite stable price ranges. Without going any further, Uniswap is a bad protocol for trading stablecoins because the liquidity is distributed between the whole curve of prices, but the 95 % of the trading of these assets happens between the ranges of 0,99 $ and 1,01 $.

For example: if I deposit 10000 $ in the pool DAI/USDC (5000 $ DAI and 5000 $ USDC) only 0,5 % of the capital contributed will be providing liquidity to the prices ranges of 0,99 $ and 1,002 $. When its really in this range where 95 % of the volume happens and where mor than 95% of the fees is generated. We can say that 99,5 % of the contribution of liquidity of the LP’s in pools between stable tokens in Uniswap are never used. There is not much to discuss as this is rarely efficient.

On the other hand, v3 works in a totally different way. The LP can concentrate their liquidity in specific price ranges, creating thousands of individual curves. For this to even be possible v2 should create new pools for each price range chosen and connect it through “rooting”. This is one of the adopted strategies and as we have seen it is not effective. This is because the cost of gas goes up in the moment, we have to use a wide range of pools to do a swap. Although v2 Balancer brings a lot of improvements the proposal of Unisap of providing concentrated liquidity in specific range prices creating a pool of liquidity emerged from the combination of a lot of price curve that even overlap is more efficient.

To make it more comprehensible we will put an example:

Alice deposits 4000 $ of liquidity in the pool ETH/DAI between the price ranges of 2000 $ and 3500 $. Bob deposits 5000 $ of liquidity between the price ranges of 2500 $ and 1500 $ and Tom deposits 4500 $ between the price ranges of 2000 $ and 900 $. The available liquidity for the pair of ETH/DAI will be the combination of all these individual price curves.

Results

What is the result we obtain?

A spectacular improvement in the efficiency of the capital and the available liquidity of the DeFi sector, nothing less than a complete revolution.

With the v3 the LP’s can generate more fees than now even depositing less capital, giving a more efficient use to the capital and decreasing the risk of exposing their assets. Uniswap has come up with a solution to the most critical problem of the AMM that no other protocol has been able to fix. The case is that the difference of liquidity between the centralised exchanges and the DEX is still to exaggerated mainly because of inefficiency of the actual AMM. The concentrated liquidity could even make Uniswap un DEX more efficient than the AMM concentrated in stable coins and even the centralised giants. If that weren’t enough the concentrated liquidity allows the LP’s to invest in a pool in many different ways, giving them more options and possibilities to design their own strategies as market makers.

Let’s see an example with “simple” numbers to check the impact of this new version of the capital:

For this example, we have Alice and Bob again. Both dispose of 10000 $ and want to contribute with liquidity in a pool of ETH/DAI, Alice in v2 and Bob in the v3 of Uniswap. To clarify the price of the Ether we will set it in 1750 $.

Alice deposits 5000 DAI and 2,85 ETH to the pool of Uniswap, contributing with liquidity to the whole curve from the value of 0 $ to infinite.

Bon on the other hand, is a good DeFi gen, he is up to date on the new functionalities of the v3 and has studied between the ETH/DAI market to choose if he is going to contribute with liquidity between the ranges of 1500 $ and 2500 $. What is surprising is that Bob generates the same quantities of fees than Alice and will only deposit 600 DAI and 0,37 ETH. Not only will he have reduced his risk that he is exposing his assets to but also will have 8800 $ to use in other protocols.

Putting lower capital at risk, Bob has been able to improve 8,34 times the efficiency of his capital.

Capital requiements V2 vs V3

Pools between stablecoins

In the pools between stablecoins the situation is even more exaggerated, as these types of assets usually trade in stable and specific price ranges, what makes the majority of liquidity to be completely unusable.

To make a comparison, if a pool of the v3 had 25 M $ blocked between the ranges of 0,99 $ and 1,01 $ it would be as efficient as a pool of 5b $ in liquidity deposited in a pool of the v2. Although this happens as long as the price is maintained in the price range. The team of Uniswap has announced that the efficiency improvement can be of 4000x between the price ranges of 0,1 % and can even get to an improvement of 25000x in price ranges as small as 0,02% (the maximum that the protocol allows)

Ative Liquidity

One implication of the new functionalities provided by concentrated liquidity is the obligation to have a more active management of your liquidity. The protocol will allow the liquidity that moves outside the price range to be blocked in a single token, waiting for the LP to withdraw its investment, update the price range in which it wishes to operate or simply for the market to return to those ranges. This provides a lot of security for investors who want to protect themselves from drastic price movements.

On the other hand, we see the enormous potential that Uniswap opens up to new “money lego” models where external protocols, such as Yearn, design concrete and automated strategies to follow the price ranges. For example, it could be providing liquidity in 3 different ranges and that these vary depending on the market, always seeking to maximize profits while reducing risk as much as possible.

It is true that there is the possibility that some price ranges are illiquid and that in times of high volatility two assets end up trading in areas with 0 liquidity, creating a huge problem for the ecosystem. This, despite being possible, is unlikely. Due to game theory and the natural incentives generated by the market, there will be LPs interested in following strategies where they deposit liquidity in extreme ranges. Surely those ranges will have little liquidity and will not generate fees, but they will be extremely profitable if the pair of tokens ends up trading in that range.

That is, it is most likely that there will end up being a responsible distribution of capital throughout the curve since there will be LP’s that will follow strategies where they deposit liquidity in ranges with little volume but with great profit possibilities, some LP’s will deposit in the areas of more volume and there will be some others that will follow strategies designed by external protocols where liquidity will follow the market and will vary the established price ranges.

Somehow this variety of strategies will create a kind of decentralized and completely public order book. Something very interesting for possible new more sophisticated investment strategies.

Range Limit Orders

Another incredible functionality will be the possibility of depositing liquidity in a single token for a specific range, which will be at higher or lower prices than the market. When the price reaches that area, that asset will begin to become the other pair until it reaches the next price range, where 100% of asset A will have been swapped for asset B of the pool and will have generated fees at all times.

Let’s repeat it again. Let’s say the price traded between DAI / USDC is at 1,0009. Right now I could deposit $ 5,000 in DAI between the price ranges of 1,001 and 1,002. As soon as the market price reaches 1,001, the DAI will begin to convert to USDC through swaps and generating fees along the way. This rebalancing will end in the price range of 1.002, where 100% of the position will be in USDC.

Range Orders Example

In some ways it is something very similar to the typical “limit orders” that we have in centralized exchanges, but in a completely open and decentralized protocol.

Non-Fungible Liquidity

Today the LP tokens that represent your property in a pool are represented under the ERC-20 standard. This implies that you cannot differentiate between two LPs and therefore neither of them can choose to use different investment strategies. It is simply not possible.

If we want to be able to provide concentrated liquidity and for each LP to decide in which price ranges it wants to move, we need the LP tokens to be represented not by fungible ERC-20 but by non-fungible ERC-721 tokens. Although those that represent the same ranges will surely be able to be combined and migrate to an ERC-20 version, for example with external protocols that provide this service.

ERC-721, much mor than only NFT’s

This really is much more important than it seems, because now we can differentiate between LPs and generate incentive models such as much more complex liquidity mining programs aimed at all types of LPs. Projects will be able to maximize their liquidity in a much faster and more efficient way, with personalized incentive programs for each rank.

Flexible Commission System

Before analyzing the new commission model for Uniswap v3, it is important to comment on another big change within the traditional operation of pools. Currently, the fees generated by the trades are automatically reinvested in the pool. This is interesting, since they maximize your returns, although on the other hand it makes swaps much more expensive, since part of the transaction gas is used to reinvest the commission. In v3 the fees will not be reversed. In other words, we will be able to “harvestrate” what we are generating, in addition to most likely being other protocols that generate investment strategies optimized for Uniswap pools that will include a way to reinvest the fees and thus increase your position in the pool.

In this way, we can analyze the new commission system. In Uniswap v2 the commission for all pools is 0.3%. From now on, each pool will have the option of being created according to 3 types of commissions: 0.05%, 0.3% and 1%. Despite the fact that this implies dividing the liquidity into 3 different pools and that there is a certain degree of diversification of the liquidity, it is reasonable to think that each pair of tokens will be balanced naturally by the market, accepting the obvious commission according to the pair.

That is, in the pairs between stable currencies or tokenized assets that represent the same (sBTC, wBTC or renBTC) the fees will be the lowest. Among industry standard tokens such as ETH / DAI, the commission will remain as the current one at a value of 0.3%, and for the more exotic or riskier pools the fee will be 1%. Basically it is a way to compensate the risk that each asset represents.

And now one of the most interesting points for UNI holders and believers of the protocol. Each pool will have the possibility of activating a discount of 10–25% of the fees generated by the LP’s and transferring that liquidity to the holders to UNI.

Oracles

Uniswap v2 introduced “time weighted average price” (TWAP) oracles. These oracles serve as a key piece of the DeFi infrastructure and have been integrated into dozens of projects, such as Compound.

Oracles v2 work by storing cumulative sums of Uniswap pair prices per second. These price sums can be checked once at the beginning of a period and once at the end to calculate an accurate TWAP during that period.

Uniswap v3 offers significant enhancements to the TWAP oracle, making it possible to calculate any recent TWAP within the last 9 days in a single chain call. This is accomplished by storing a series of cumulative sums rather than just one.

Improved TWAP oracles

This is a big change for DeFi protocols that need a decentralized provider to set the value of an asset. This change makes it much easier and cheaper to create more advanced oracles that include Simple Moving Averages (SMA), Exponential Moving Averages (EMA), outlier filtering, and more.

And most importantly, all these improvements have not meant an increase in the cost of gas, rather now the cost of calculating TWAPS is now much lower.

License Closed The First Year

There is no doubt that if something is part of the DeFi concept, it is the idea of ​​an ecosystem full of open protocols and open source. This has always been the case, although the Uniswap v3 core could be the first protocol to be released under a Business Source License.

After the experience with Sushiswap, surely Uniswap seeks to protect its development to avoid copying and get some traction in its protocol. The truth is that it is difficult to analyze the situation.

On the one hand this clearly breaks with the open and innovative spirit that DeFi offers. Such a license clearly breaks with all of this. Even so, it is curious, since in my personal case, as a HODLER of UNI tokens, perhaps a license of this type benefits me, and gives me more security than other projects. There is no doubt that it is something different and we will have to see what the final reaction of the community is.

It should be clarified that this license is liable to be changed and put as open source by the government already on day 1. And even if they do not decide, it will become open source in a period of 1 year.

Conclusions

I am convinced that this new version of Uniswap can represent a before and after in the crypto world, and act as the second great “trigger” to open another new general growth of the DeFi ecosystem.

First of all there will not only be a great improvement in the efficiency of the capital used in the liquidity pools; We will be able to provide the ecosystem with more liquidity, it will be possible to generate more fees with less capital and then use this for other purposes, while mitigating the risk of impermanent loss. There will surely be an explosion of external protocols that will design concrete strategies for investment in pools, with new models of capital optimization. The LPs will be able to design more complex and personalized strategies and somehow we will be recovering a certain power that the bots had monopolized in the initial versions.

As was Compound in 2020, which thanks to its liquidity mining program the ecosystem took a huge leap, Uniswap v3 may have similar consequences.

It will also be interesting to see how these improvements impact the other MMAs like Curve, Balancer or Sushiswap. Of course, now we can observe the differences and what each one contributes. This is not the case with v3, since certain features that today are exclusive to curve, for example, can be replicated and improved in Uniswap. Will there be a liquidity drain from these MMAs to lock on Uniswap?

And finally it is worth noting that this version of Uniswap will also be available in a 2nd layer through Optimism. It seems that this option will not arrive until summer, but again we are in front of one of the most anticipated innovations in the ecosystem. If the Optimistic Roll-Ups start to be used during this year we could see Ethereum’s commissions divided by 100, even without having completed the Layer 1 upgrade with Ethereum 2.0. We will soon see a new post clarifying everything about the scalability of Ethereum and how it can improve through first layers (Eth 2.0) or second layers (Plasma, payment channels or roll-ups).

Simplified versión of an Optimistic Roll-up

Without a doubt a very good time to be involved in this ecosystem. I feel fortunate to be experiencing the most important changes in the financial system in recent years. DeFi is growing, and every time it earns more points to become a new financial system that comes to change things forever. And if you think like me and are looking to deepen this ecosystem, I recommend 100% to participate in our DeFi and Tokenization Bootcamps. Places are very limited!

You can also buy our latest book “Decentralized Finance for Restless” available on Amazon, Bubok, La casa del libro and Fnac.

Biografía

--

--

arnau ramio

Blockchain-Business Developer & DeFi Manager. Co-Founder & COO at Themar Solutions and Co-Founder of Learningheroes.com