Uniswap V3

in LeoFinance3 years ago (edited)

image.png

For today’s article I am taking a look at the changes that Uniswap has made to it’s protocol when it launched V3 back a few months ago. They made some interesting changes to how the liquidity pools and automated market maker works, and I think it’s important to understand how these can affect the earnings potential for liquidity providers, and how it changes the risk to things like impermanent loss.

Please note I am on vacation the week of August 8-13 and no articles will be coming out that week.

For the usual disclosure, I am not a financial advisor, I don’t even work in finance at all. My day job is as a telecommunications software engineer. Treat everything you read here as some educational resources and not financial advice.

Liquidity Pools

Let’s start with a quick refresher on what liquidity pools are, in case you don’t feel like reading through my article about them. A liquidity pool is a setup with a pair of cryptos in order to facilitate trading between them. You can consider it the heart of a Decentralized Exchange (DEX), as it powers the Automated Market Maker (AMM).

Basically, let’s assume we have a pool with Ethereum (ETH) and Dai (DAI). People stake up both of them into the pool, and the ratio between them sets the price. Let’s assume we have 100 ETH and 270,000 DAI. That would give us a market price of 2700 ETH/1 DAI, and as DAI is a stablecoin, we can say ETH is worth $2700.

Whenever a trade happens within the pool, one of the assets is converted into the other, which affects the price of it. It would never work so cleanly, because it operates on a curve, and it’s just not how the market maker works (if you want a more realistic example, my article does it much better with more reasonable math), but let’s pretend we ended up with 50 ETH and 500,000 DAI. This would give us a new price of 1 ETH for 10,000 DAI, so a $10,000 price tag.

The liquidity providers earn fees for the swaps that go through the pool, and sometimes bonus incentives as well. These fees are what would normally be collected as trading fees on a centralized platform, earned by the company running it, but here more of the fees are distributed to the providers directly, with a smaller portion being kept by the protocol development/management team.

You also have to consider impermanent loss. Let’s assume the above example, and you are the sole provider of liquidity. If you held onto your tokens in the above example, you’d have 100 ETH worth $1,000,000 plus $270,000 worth of DAI, and instead you have $500,000 worth of each, so are out $270,000. Again, my article on impermanent loss looks at the numbers a little more closer to reality, and that is an exaggerated figure for sure, but it illustrates how the mechanic works, which is all that is needed for this article.

Concentrated Liquidity

The first major change in the Uniswap V3 protocol is concentrated liquidity, which allows for much higher capital efficiency and some pretty nifty tricks you can pull off using it, like essentially placing buy/sell limit orders like a centralized exchange order book.

In a traditional liquidity pools, you provide liquidity from the entire range from 0 to infinity, meaning it’s spread out over an entire price curve, most of which will never be hit for the entire time you are providing liquidity, and that’s not even account for some of the impossible prices to hit, like infinity.

The new pools introduced in V3 allows a liquidity provider to specify a price range that they want to concentrate their liquidity within. This means all of their liquidity is sitting within that range, instead of spread out over the entire price curve, so as long as prices trade within that range, you will earn more in fees, because you have much greater depth at that price point.

You can also achieve the same depth for a given price range with less capital in the new V3 system, meaning it is far more capital efficient, especially for pools of stable assets that don’t move much in price. Having liquidity concentrated in ranges also means that more trading can happen in a zone with higher depth, without impacting the price as much.

Let’s look at a quick example and see how it works in action. We’ll have a pool of ETH / DAI, and two people each starting with $10,000. We’ll put the price of ETH at $2,000 to make the math round out a little easier.

Mike is going to do the more traditional route, split his liquidity evenly and spread it out over the entire price range, much like how the V2 protocol, and most other DEXs operate. He puts in 5000 DAI and 2.5 ETH.

John is going to use the new method and chooses a price range of $1500-$2500 for ETH. He puts in 1000 DAI and 0.4 ETH, for a total of $2000 worth of capital invested.

As long as the price stays within the $1500-$2500 price range for ETH, then Mike and John are going to earn about the same in swap fees, but with $8000 difference in capital investment, meaning John can then use that $8000 for something else and earn just as much in the swap fees.

One thing to be very cautious about in these pools is the impermanent loss, because if the price gets outside of the range you have specified, you’ll be left holding the lesser valuable crypto. Looking at the DAI/ETH pool, from our example, if the price of ETH were to go above $2500, all of your ETH would have been sold for DAI, so you’d be losing out on all of the gains from ETH rolling up.

Similarly, if the price were to crash well below $1500, all of the DAI would have been converted to ETH, and you’d be left holding a bunch of potentially worthless ETH (as unlikely a scenario as that is for ETH to crash down to being worthless). That being said, with the capital efficiency, you can risk less of your capital overall, so you can help mitigate this with careful planning.

Limit Orders

Another feature of the new V3 protocol is that it can accept single assets being put into the pool. If you combine this with setting a price range, you can effectively set a buy/sell limit type order, like you could put onto an order book on a centralized platform.

Let’s say you are sitting on 1000 ETH, and you want to sell it at a price of $4000 and turn it into DAI. You could provide the ETH to the liquidity pool at the price of $4000, and if the price passes that range, your ETH would get turned into DAI, providing the liquidity for the swap at that price range.

This can give traders the power to essentially mirror an order book from a traditional exchange, on a decentralized one. And instead of paying the trading fees you would normally have to pay, you actually earn fees from the swaps as the price moves through your range, so you’re earning while getting the trades you wanted done anyways.

Conclusions

As we can see, the change to the way the liquidity pools operate on the new platform is pretty significant, but there were also changes to the way the data oracles work, as well as general transaction fee reduction on things like simple swaps as well so overall the Uniswap V3 protocol brought about quite a few things that a lot of platforms have been trying to bring to market for quite awhile.

The new pools offer ways to make more returns while investing less capital, but it also makes things easier to misjudge and end up getting less in the end, like if you have a price range and one of the asset pumps up significantly higher than you were anticipating and you miss out on a lot more gains than if your capital was spread over the entire curve. Even more so than with the previous iterations, make sure you understand the risks involved, have done your research, and you have your risks mitigated as much as possible.

Socials And Other Links

Find me on social media on Twitter, Facebook, Instagram, Telegram and noise.cash.

If you enjoyed this content, you can check me out every weekday. My posts start at my website, but you can also find them cross posted at Publish0x, LeoFinancial, Hive, and read.cash.

You can also sign up for my newsletter which I send out every Friday with news and whatnot from the crypto space, delivered right to your inbox!

You can also find links to resources such as research and news sites over at this link.

Want some more content right now? Check out some of my previous posts:

Next Level Swaps: SwapSpaceExplained

Polygon Commit Chain
Layer 2 Scaling
Why Is DeFi Expensive

A few referral links, in case you are interested in the service, and it also helps me out.

Binance – large centralized exchange – referral link saves you 10% on trading fees
Coinbase – basic crypto exchange – referral link gets you bonus crypto on first deposit
Cointiply – very good crypto faucet and earning site – no bonus for you on this referral unfortunately

Originally Posted On My Website: https://ninjawingnut.xyz/2021/08/02/uniswap-v3/

Posted Using LeoFinance Beta

Sort:  

What a nice post but my question is can I avoid impermanent loss completely, I need a strategy that work really fine, because defi is the future of finance


Posted via proofofbrain.io

The only real way I've seen that can really mitigate impermanent loss almost entirely would be if you provide liquidity to a pool that is pairing 2 stablecoins together.

In that situation, where both of the assets are going to stay at the same price relative to each other, within a very tight range, then you can have less worry about it unless one of them somehow falls significantly off peg.

Posted Using LeoFinance Beta