Skip main navigation

New offer! Get 30% off your first 2 months of Unlimited Monthly. Start your subscription for just £29.99 £19.99. New subscribers only. T&Cs apply

Find out more

Liquidity pools in practice

Instructions for interacting with Liquidity pools with (if possible) directions to interact with liquidity pool on testnet
(calm music)
<v ->In this video,</v> we’re going to learn about how to become a liquidity provider on the decentralized exchange, Uniswap. In previous videos, you should have learned how to get Metamask as a wallet, received some tokens on a testnet, Ether. Swapped those tokens, or some of those tokens, into DAI, a stable coin. And so now what we have in our Metamask wallet, which you can see up on the top right hand side here, is we should have some ETH and some DAI within our test network that you can see at the top here. So you have almost 2.5 ETH and around 1,300 DAI in this wallet. We’re going to go to
Always make sure that you’re going to the correct website, that’s really important to stay safe. And we’re going to launch the app on the top right hand corner here. This will take a few moments to open up. In the past, we swapped using the Uniswap protocol. We swapped from ETH to DAI. What we want to do today is we want to pool, we want to become a liquidity provider, and add some of our ETH and DAI into a pool and earn some of the fees from others swapping within that pool. So I’ve clicked on pool at the top here. Uniswap has recently gone to version three, that you can see here. That’s a little bit more complicated.
So we’re going to go down to “View Version Two Liquidity.” V2 liquidity.
These are the options that will come up for you here. If you have liquidity within the protocol, you are already providing liquidity into a pool, it would come up here, it would appear here. Your options to provide liquidity are to either create a pair, we’re not going to do this today. This would be if you had, for instance, a new crypto currency you had created, and you would like to create a pool so that others can swap your crypto currency. We’re not going to do that today. What we want to do is go to add V2 liquidity.
This looks quite similar to the interface that we saw in a previous exercise, where we swapped between ETH and DAI. When we’re providing liquidity to a pool, however, we have to provide equal values of the two tokens into the pool. Specifically, in this case of Uniswap, that is what we have to do. We can select our token, DAI. It’s coming up here with our balances in our wallet. 2.499 ETH, and 1,300 DAI. We’ll select DAI. And you can either decide how much ETH or how much DAI you would like to provide as liquidity. Let’s say we’d like to provide one ETH liquidity. It automatically populates the equal value of DAI, based on particular exchange rates at the moment.
We’re going to come down the bottom here. And we’re going to click supply. What this will do is it will add the ETH and the DAI that you have into a smart contract, and in return, you will receive tokens that represent your position within that pool. And it says that up here in the tip section. “When you add liquidity, “you will receive pool tokens representing your position.” Now, why would you do this? Well, it says down the bottom here. By adding liquidity, you will earn 0.3% of all trades in this pair proportional to your share of the pool. You’re taking on some risk here. You’re adding ETH and DAI into a pool, so that others can swap between them.
And in return, you’re getting some fees. Previously, we paid those fees when we were swapping. Now we’re receiving some of them, because we’re providing liquidity. We’re going to click on supply down the bottom here. It comes up with the details of what we’re doing. And it says up here, “You will receive 12.6289 ETH/DAI Pool Tokens.” These are your liquidity provider tokens that represent the liquidity you’ve added. Confirm supply. It will come up in the top right hand corner here in your Metamask wallet. You will have your gas fee. Always check that your gas fee is what you’re willing to pay. We can confirm the transaction.
In previous videos, we used this little button here to add DAI to Metamask. That’s so that you can view the token easily within your Metamask wallet. In this circumstance, we’re going to go ahead and click “Add UNI-V2 to Metamask.” All this is doing is it’s making it easy to view the tokens that you have received, the liquidity provider tokens, in your wallet. So we’ll add token.
And we’re also going to click here, “View on Explorer.” This is a useful exercise. This is the Etherscan Explorer, you can see this is a testnet transaction, this is not real money. And you can see the details of the providing of liquidity that we’ve done. The provision of liquidity. We’ve added 554 DAI, we’ve added almost one ETH. And in return, we’ve received 12.6289 Uniswap V2 liquidity provider tokens.
Want you to close this for a second. Go up to your Metamask wallet and see the position that we are in. Click on assets. Previously we had around 2.49 ETH, and we had around 1,300 DAI. They’re no longer sitting in your wallet. But you have these 12.628 liquidity provider tokens. That’s representing your share in the pool that you have provided liquidity to. And it says that down here. “Your position, DAI/ETH, 12.62 tokens.” That’s the DAI and ETH you have in the pool. So if we click this back button here.
This was empty before, we didn’t have any liquidity, but now we can see our position. Your total pool tokens and so on. This won’t really work on a testnet, but you can usually click this “View accrued fees and analytics” button at any time and you can see the fees that you have earned while you’re providing liquidity. Those fees are eventually paid out when you withdraw your liquidity. Now what withdrawing liquidity means, or removing liquidity, is that you send your tokens back, some or all of them, the 12.62 liquidity provider tokens, through the smart contract, and in return, you’ll get your DAI and ETH back into your wallet. So let us do that now.
We can click on remove here, remove liquidity. It’s asking how much of the liquidity you would like to remove. I would like to remove it all, so I can click maximum. And it’s now telling you that “Removing pool tokens converts your position “back into the underlying tokens at the current rate, “proportional to your share of the pool, “and the accrued fees that you have earned “are included in the amounts that you receive.”
You can see the amount of DAI and the amount of ETH that we’re going to get back here. Of course, we haven’t accrued many fees, this has only been a few moments. But we’ll go ahead and approve anyway.
It’s asking you to sign the transaction to enable this to happen. And then what we’re going to do is click remove. There’s a couple of steps here. Depending on whether you’ve done this before, there may be more or less steps, but it’s relatively straight forward. This is the confirmation of the transaction within Uniswap. This is what we will receive back. Importantly here, it’s saying that we’re burning these liquidity provider tokens. These 12.62 tokens were actually minted when we added liquidity to the pool, and then they’re burned again when we remove our liquidity. They’re kind of a way to keep account of who has what in the pool. We’ll confirm.
Up here again in Metamask, always check your gas fee. We’re going to confirm.
And we have a pending transaction here. In a few moments, we’ll come back, and that transaction should be finalized and successful.
It’s been about 30 seconds or so. You can see with this tick that the transaction is successful. We can click on “View on Explorer” to see the transaction again. We’re going to open up Etherscan. You can see the transaction’s been a success. It’s a little more complicated in here now, there’s more transactions going on, but you can see that it’s been a success. And you can always go back and check in your wallet, so click up on Metamask.
You can see when you click on assets that your ETH amount is back up at that 2.49, and your DAI amount is back up at 1,300. And you have 0 of those liquidity provider tokens. If you had accrued fees throughout this time, they would be included within these amounts. So you’re no longer liquidity providing within this protocol. What we’ve done in this exercise is we’ve shown what it means to be a liquidity provider or demonstrated that. We’ve done this on Uniswap. That’s just one example of where you could become a liquidity provider. There are many other options out there, with different fees, different ways of how you do this.
But this should give you a really nice introduction of what it means to provide liquidity in the DeFi ecosystem. And it’s a really integral part of your DeFi journey. (calm music)

Now that we understand the important role that liquidity pools play in DeFi, let’s explore how we can get involved, specifically by becoming a liquidity provider. Watch Dr Darcy Allen demonstrate how to become a liquidity provider on the Uniswap platform.

This article is from the free online

Decentralised Finance: Blockchain, Ethereum, and The Future of Banking

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now