Are Uniswap‘s Liquidity Pools Right for You?
Today, let’s talk about Uniswap, Liquidity pools to be exact. I want to discuss how they work and whether or not they’re a good idea for everyone. So first things first Uniswap.exchange is the website where this all happens.
Uniswap is a decentralized ERC-20 token exchange, and it’s not just for tokens. It also supports Ethereum, and the beauty of Uniswap is you can exchange ETH for any other ERC-20 token in a decentralized fashion. There’s no company involved, no KYC, and there’s no person involved that’s mediating things.
It’s not like a centralized exchange where there’s a company that’s holding your money and is charging you fees on it. This is a decentralized exchange where you’re always in full control over your money. When you execute a transaction, it immediately all in one transaction, takes the money out of your wallet, puts the money back in, in the other format, so there’s no custodianship. Uniswap Is a really, really amazing decentralized tool.
How Uniswap liquidity pool works?
The way that it works is using what’s called liquidity pools and what liquidity pools basically are, are pools of tokens that sit in smart contracts, and there’s enough tokens for you to be able to exchange any of them with one another using Ethereum as a conduit. So, there’s loads of Ethereum in there, and there’s loads of every kind of token that Uniswap currently supports.
And the other thing with Uniswap is anyone can create a new exchange pair in a new liquidity pool for any token, at any time. So it’s completely open, there’s no listing fees, and it’s really great in that regard. Let’s talk a little bit about how liquidity pools actually work.
Click on Pool, and you’re going to be taken to the liquidity pool page.
And this is where you can either add liquidity, remove liquidity, or create your own exchange pair. We’re going to focus on today on the first two, adding and removing liquidity.
Let’s say I wanted to participate in the DAI liquidity pool. The way the pools work is you have to deposit and equal value of ETH and the token that you want to participate with. If I want to participate in the DAI at liquidity pool, I have to have the equivalent amount of DAI and ETH to contribute all at the same time.
When somebody comes in and wants to trade DAI to Ethereum on Uniswap, your liquidity is tapped into. So, the amount that you put in may shift more towards Ethereum, or it may shift more towards DAI based on the trade that needs to happen. So, if somebody wants to trade DAI and take Ethereum out, your Ethereum liquidity might shrink, and your DAI liquidity might go up. And it’s kind of like a scale in that regard. You should always come out to the same value. If your ETH goes down by a dollar, your DAI should go up by a dollar. That’s the way that the liquidity pool is meant to work.
Liquidity providers receive a fee from people that are conducting swaps. There’s a 0.3% transfer fee that Uniswap charges to the swapper that is then split among all the liquidity providers in that specific pool based on how much of the pool they’re offering. If it’s a large amount that you’re offering in a liquidity pool, a large percentage of the pool, you’re going to get a bigger chunk of that 0.3%.
Let’s say we wanted to participate in the DAI Pool; I’m going to select DAI here:
and then you can enter either the amount of ETH or the amount of DAI, and it’s going to give me the commensurate amount. So, I’m going to put 10 DAI:
Remember that you have to have the equivalent amount of DAI and ETH, so when you put 10 DAI here, this is 10 DAI + $10 worth of ETHs. So you really putting in $20 worth of Crypto. And first thing it’s going to ask you to do is Unlock and you’re going to have to do it in an Ethereum transaction in order to unlock:
This is a Metamask display bug that you’re going to see a lot when you’re using Metamask.
And basically, this happens whenever you have to authorize a smart contract to utilize a specific token. It’s nothing to be concerned about. It looks crazy, but in reality, I’m not sending any Dai here. I’m just spending the gas to authorize the token.
Now when transaction is confirmed, and we’ve allowed the smart contract to access our DAI, we can add the liquidity and again it’s going to be 10 DAI and 0.0472 ETH(about $10 worth) that I’m about to add into current liquidity pool that already has over 6,000 ETH and over a million DAI.
When I click on Add Liquidity button, I’m going to get another Metamask transaction that I’m going to confirm and wait for that to go through.
Now that that’s been confirmed on this page, we can start to see my pool share, which is very small as we said, only 0.0007% of the pool. Whenever there is those 0.3% fees, I’m going to get that tiny fraction of them. And we can already start to see these numbers starting to shift over here.
I put in 10 DAI, and I put in 0.0472 ETH, and already I’m looking at a little bit over 10 DAI. Since my pool share is very small, Uniswap UI doesn’t have enough decimal points for ETH, but I’m sure that this amount of ETH has gone down slightly because it started to shift to DAI.
Something that’s important to realize about the liquidity pools is that you sort of lose control over the ratio you have between the token that you are in the pool of and ETH.
I could come back in a week, and I could have loads of ETH and almost no DAI, or I might have all DAI and almost no ETH. If you’re okay with that, then liquidity pools are for you. If you kind of want to have a tighter control over what your ratio is between ETH and the token that you’re participating with, then liquidity pools might not be the best option for you.
One other thing to understand about how this works is that when you deposit liquidity, you are depositing your crypto and you’re receiving back a Uniswap token. And this is a Uniswap token that’s specific to the pool that you’re in. When deposited 10 DAI and 0.0472 ETH, I received back 0.04147 Uniswap tokens.
That amount of tokens represents my share of the pool. That’s how Uniswap knows what I’ve got.
And that’s how you’re going to get your fees when you end up withdrawing: when you withdraw your liquidity, you’re burning the token, and you’re getting back a commensurate percentage of the total liquidity pool that reflects the amount you put in plus the fees that you have earned since then. When you click on remove liquidity, the balance you’re seeing it is not your ETH balance, and it’s not your DAI balance. It’s your balance of Uniswap pool tokens.
If you want to remove all your liquidity, you’re going to want to just click on that:
And it’s, by the way, it’s a little misleading because it looks like it would be your DAI balance because you’re selecting the liquidity pool here, but it’s not.
It’s your pool token balance. Click on that. It’s going to populate the exact amount of pool tokens you have, and it’s going to show you what you’re about to pull out.
You’re about to pull out all the ETH and all the DAI that you currently have in the liquidity pool, and you hit remove liquidity button, and you’re going to submit that Metamask transaction and wait for that to complete.
Now let’s take a look at those transactions in the block explorer. Remember over here when we deposited, it was 9.9999, as far as the eye can see:
And now we ended up with just a little bit less, 9.997947, right?
And then on the Ethereum side, we had deposited 0.047222 ETH:
and we withdrew 0.047232 ETH:
As you can see, it shifted ever so slightly towards ETH. Just in that few minutes that I was in the pool, it just shifted slightly because somebody must’ve come in with some ETH and wanted to trade for DAI on Uniswap. When that happened, they deposited their ETH into the pool and then took the DAI out. And my tiny percentage of that pool gave up just a fraction of a penny, and I got a fraction of a penny’s worth of ETH.
And in that process, I also earned 0.0007% of the 0.3% fee that that trader paid, which is obviously a super, super small amount just for the amount that I put in. But if I had put $1,000, $10,000 into the liquidity pool, it would start to add up.
Keep in mind, like I said before, the fees are interesting, but the other side of this is you lose control of that ratio. So if you come in there with 50% ETH, 50% DAI, and ETH is maybe $300 at the time. There is a chance you could come back in a week or a month, and now you’ve got 75% ETH and 25% DAI. But maybe the price of ETH dropped a hundred bucks, you know, and all of a sudden you’re like, shoot, I didn’t want to be 75% in ETH, I wish it was the other way around. You lose control of that in the liquidity pool.
Hope this was a useful tutorial and helps you decide whether or not Uniswap’s liquidity pools are for you or not. Try it with as small in amount as you want to do it in. You can do with a dollar or $10, whatever. Just give it a try with a really small amount before you jump in with both feet. Watch the ratios and how they work, and then you can decide later if it’s something you want to get bigger into.
If you like this tutorial, please subscribe to Chris Blec youtube channel. He is putting out content several times a week on DeFi, on all sorts of different projects, compound finance, Uniswap, etcetera.
DeFi is coming. Don't get left behind
Hugh Karp talks about Nexus as a part of the best practice standard for smart contract security.
Nicola Di Marco Founder & Designer from DexWallet talking about building mobile wallet for the decentralized finance with integrated borrowing, lending, exchange, and native in-wallet Staking for everyone.
Fortmatic co-founder, Sean Li talks about building an SDK that enables users across the globe to interact with dApps using just their phone number.