Decentralized Finance on Ethereum Introduction Part II - Liquidity Pools

Decentralized Finance on Ethereum Introduction Part II - Liquidity Pools

By BB80898 | OGF | 5 Mar 2021


Please note: you'll need some way of interacting with the ethereum network using your wallet for this stage. There are a ton of videos about this on youtube, but metamask is usually the go to nowadays.

 

We covered the intro to DeFi basics in the previous post. About how and what tokens are, what they closely represent in traditional finance, and some of the pitfalls which can come from investing in certain projects. Now let's talk about liquidity pools in decentralized exhanges, and give an example.

I will be going over Uniswap, as it is the king of liquidity swaps right now, but almost all other platforms follow the same structure really. And even on multiple blockchains (JustSwap on Tron is a 1:1 copy of Uniswap).

A liquidity pool is basically a group of investors pooling their resources together, to enable other investors to have the ability to swap between two pairs of crypto coins or tokens. Now UniSwap deals exclusively with tokens hosted on the Ethereum blockchain. What are called ERC-20 tokens. By providing liquidity to these pools, when another investor swaps between any given pair, the people who provided the liquidity between that specific pair, get a commission for facilitating the swap. Easy example:

DAI / ETH currently has a $7,000 value in total assets being staked into the pool.

You contribute 1 ETH and 1450 DAI to the pool. A 50/50 ratio. And it must always be a 50/50 ratio. 

Thus, your total contribution is $2,900. Roughly 30% of the entire pool's liquidity is provided by you. ($7,000 + $2,900 = $9,900).

Now let's also assume, $1,000 of ETH was converted to DAI by another investor, after you staked into the pool. And that investor, paid 3% for that swap. Therefore, the pool now has earned $30 from that one swap. And since you contributed almost 30% of the entire liquidity pool, then 30% of the $30 profit, or $10 goes to you.

In this example, one token was a stable coin (DAI) which is always worth a dollar, and the other was ethereum itself.

Impermanent loss.

In this example, your impermanent losses only depends on the price of Ethereum. Because the price of DAI is pegged at, or around 1 dollar, you can't really lose too much. (unless you have millions invested and then, even fractions mean thousands of dollars). So, building up on our previous example, you're total dollar amount invested into ETH / DAI pool was $2,900 because ETH was worth $1450 when you entered the pool. But let's say, ETH drops by 50%. Then you're suffering an impermanent loss. Because you have not left the pool, un-staked your eth, and sold it back to US dollars, your losses aren't permanent. The price can rebound, and your initial investment can still be worth $2,900 again.

Things get more complicated as you start to invest in pools that have two assets which are more volatile. The more volatile your swapping pair is, the more the value of your initial investment can change dramatically in terms of impermanent losses and gains.

UniSwap has a great way of showing you the total dollar amount your investment day to day, so you can see your impermanent losses and gains accordingly.

But the purpose of going into liquidity pools in the first place, isn't to make money from the appreciation of the coins and tokens you are staking / providing liquidity to, but the expectation of your profits being large due to a high demand of other investors coming in to swap between any given pair.

Take FOMO coins #1, and FOMO coin #2. You invest funds into FOMO coin 1 & 2's liquidity pool (hence forth referred as LP) and you own 10% of the total pool. When investors start to pile into FOMO projects and need FOMO coins 1 & 2, you're going to get a nice fat chunk of those swap fees. (Paid out in Uniswaps' native token "UNI") So by entering into a trading pair, early, you can get a chance of gaining a large portion of the LP and thus a higher percentage of the swap fees from subsequent trades/ swaps. And of course, as the fees pile on, you keep making more money even, if, larger investors come in and continue to stake into the LP pool. Because you got in early, you're making money off every subsequent trade / swap after you enter. So if a big whale comes in and swaps, by paying a huge fee, you get a cut of the LARGER fee. Your shares shrinks as more and more investors pile into the LP. Not all end up staking on UniSwap. Some take those LP tokens and stake them elsewhere. Foregoing the swap fees, for some yield farming project into another DeFi platform (see Intro to DefI on Ethereum Part I for details).

 

8b84a6e24bfcf224903b0a166d33fb2bd7ac6865e9fefc036ff0edd3211488ee.jpg

Here's how it will play out.

Using your chrome based browser, and metamask wallet unlocked, navigate to UniSwap.org

Click "use Uniswap" on the top right corner.

Right away, you'll land on the swap page. This is where you can swap, your Ethereum or any ERC-20 token, into another ERC-20 token or vise versa.

So let's assume you want to contribute $1,000 to the DAI/ ETH pool, but you have no DAI.

By default, the from Token is always set to ETH. Right below you'll see the "TO" coin button.

Click to, and select DAI.

Right after, it'll ask you to authorize the wallet, to sign off in transactions for that specific token (Ethereum in this case). This authorization is an ethereum network transaction. It will cost you gas fees. (This is a one time fee, per exchange, and per token). So once you've authorized Ethereum on UniSwap, you'll never needs this step again). Unless you revoke the permission which is whole different article, and how someone can exploit it to drain your wallet with authorizing unlimited amounts).

After you've authorized the coin, you now hit swap. (This is yet, another transaction on the Ethereum blockchain).

Remember, the amount of DAI you need, must be proportional to the amount of ETH you need. So in this example, you'll need .35 ETH (at a value of 1462 per eth), and 500 DAI.

So you've swapped .35 ETH for 500 DAI. Now how do you stake?

On the top of the page, you'll see a "pool" button right next to the swap button. Click pool.

You'll see "create a pair" and "add liquidity"

Click add liquidity. Now just like you chose the coins to swap between, choose eth and dai in the listing pair.

Assuming this is your first interaction with UniSwap using the DAI you just converted from ETH, it also, needs to be authorized.

When you've chosen the amounts you'd like to stake, you'll see the authorize button again. (gas fees again).

Click authorize.

Finally, after the authorization has been confirmed, you can click "stake" or "add to pool" (I honestly haven't touched UniSwap in ages because of gas fees so I forgot).

If you click the "pool" page again, you'll see your contribution to the LP you're apart of, and your % of the pool's total investment. Now every time another investor swaps between the pairs of the LP you're in, you get a % of the fees relative to your ownership in the pool.

One very IMPORTANT NOTE: Every interaction which happens on the Ethereum network requires time to process (confirmations). Unless you're willing to pay gas fees out the whazoo, expect to be waiting anywhere from 5 minutes to 20 minutes+ for transactions to process at "reasonable" gas fees. If ETH gas fees drop below 30 gwei (which happens once in a blue moon) you can have those same transaction confirm in 2-5 minutes. It really depends how much you're willing to shell out to have your transactions go through quickly. And also, how much MORE someone else is willing to pay, to have their transaction be processed before yours. It can be done in under a minute if you're paying sky high gas fees.

Now you'll also see the LP tokens you received from UniSwap in your metamask wallet. Usually UniV2-XXXXXX.

Those are basically identifiers for your LP tokens from a specific pool (contract address).

So if you were to stake in ETH / BAT pool, the UniV2 tokens in your Metamask could be UniV2-XXYZ1 for example.

We'll jump into contracts addresses, ethereum transactions, and how to view coin related data on blockchain explorers. And how you can use this to your advantage, and how it can be used against you.

The data on blockchain explorers are all public information by the way,

Your Old Grey Fox

As always : THIS IS NOT INVESTING ADVICE. DO YOUR OWN DUE DILIGENCE AND RESEARCH. THIS IS JUST ME SHARING MY STORIES AND views / news updates.

 

https://www.publish0x.com?a=JxboYq4Keg Sign up link for any readers who want to join this fun community.

Alphanova.crypto

Above is the .crypto address for anyone who wants to shoot me some cheddar for my thoughts. Please no BTC or ETH. Network fees are killer. Stick to LTC, XRP, ADA, or TRX. The last 3 are almost free in terms of network fees. Remember - no matter how much you send anywhere, choose a coin that's low in network fees. Anything besides ETH / BTC really...

 

 

 

 

 

How do you rate this article?

5


BB80898
BB80898

Been involved in crypto since 2010. First here to help average investors avoid pitfalls of investing in crypto. And second, to bring attention to potential crypto projects / coins which have merits worthy of pointing out.


OGF
OGF

Sharing my crypto journey with those who want to learn from my mistakes and victories.

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.