Uniswap, a DeFi (decentralized finance) exchange is an automatic liquidity protocol built on the ethereum blockchain. This protocol allows the average person to provide liquidity. Before DeFi, only Banks, Governments, or people with a lot of money could take advantage of this system, but by adding your funds to a liquidity pool you can reap the rewards instead of by financial institutions.
In the finance world liquidity means the ease of which an asset or security can be effectively converted into ready cash without affecting its market price. For instance, if a person had a significant amount of one coin (coin A) and needed another (coin B) immediately to pay a bill, they would swap A for B using a liquidity pool. This pool provides the necessary access to either asset at any time. This not only provides liquidity, but stabilizes the asset.
- How Liquidity Pools Work
- Adding to a Pool
How Liquidity Pools Work
To understand how pools work, we first need to look at the players. As you can see from the screenshot, the workflow consists of pool Providers and Traders. We will discuss each in detail below, and then take time to understand how the process works.
Basically, liquidity pools contain two assets. As a provider you fund a set amount of both. By adding, you are given a share of the pool. The total amount you provide to the pool increases your share. For instance, if you provide 1000 DAI and 2.5 ETH, your share of the pool may be 5%, whereas someone who provides 50 DAI and 0.02 ETH may only have 0.01%.
Each time the pool is in use, a fee is taken and distributed to all owners of the pool. The greater your pool share, the bigger cut of the fee. This process incentivizes providers to stay long term keeping the pool healthy, and in turn stabilizes the asset.
Supplying liquidity through Uniswap is done via a smart contract. In return for your addition you are given pool tokens. At any time you can withdraw your shares, returning your pool tokens to take back your assets. Note: adding or removing funds costs gas, so make sure it counts.
Trading on Uniswap is simple. You swap one token for another. Each swap costs gas and a transaction fee to process.
When a trader pays a fee to swap they are taking one of the assets out of the pool and replacing it with the other. By doing so the pool's scale of balance shifts between the assets, tipping to favor one side. For example, if our pool is at 100/100 and a swap takes 20, but gives 20, the pool is now at 120/80. When the balance shifts like this providers end up with more of one asset and less of the other. Over time, as traders continue to transact swapping between the assets, providers will eventually see the opposite.
With any investment there is always a risk. In regards to providing liquidity consider the following risks:
- A bank run may occur for a single asset, which creates supply imbalance. For example, if ETH were to hard fork and drop to 0, everyone would want DAI. Traders would swap out all of their ETH for DAI, and the providers would be left with only ETH unless they remove themselves from the pool prior to the run.
- The value of one asset may be rising at a volatile rate and as a provider you want to remove your pool share to cash in. When you go to remove the share you find you have more of the other asset. Taking it out of the pool at that time could cause a loss.
- Liquidity providers gain passive rewards through transaction fees
- Having liquidity stabilizes the asset, making it less likely to significantly drop in value
Adding Liquidity to a Pool
Note: This tutorial assumes you use and have a basic understanding of MetaMask. Make sure you have the tokens you want to provide liquidity for in your wallet before proceeding. If this is your first time, I recommend starting small.
With your wallet funds intact, it is time to add liquidity to our pool. Start by opening the Uniswap website and launching the application:
Login with your MetaMask wallet, select Pool, and click Add Liquidity:
Note: We are using WHALE/ETH for this example. WHALE is a coin you need to add to Uniswap. For coins you do not need to add, you can skip the next 4 steps, jumping down to addition and approval.
To find the $WHALE/ETH pool, leave ETH at the top, and click Select a token:
To find $WHALE select “Having trouble finding a token?”:
Note: The address of each token can be found on their Etherscan page under contract icon. Make sure you grab the address of the token before pasting. In the search box enter the token address “0x9355372396e3f6daf13359b7b607a3374cc638e0” and click Add:
Now add token as an Input and enter the value to supply (notice the ETH value will also fill in). Now that WHALE and ETH amounts appear the price conversion table and your pool share shows. Click Approve:
Approving WHALE enables the smart contract initiation and MetaMask needs confirmation, click Confirm:
Give the transaction time to complete. After completing, click the Supply button to add to the pool:
MetaMask asks you to confirm a second transaction, confirm and wait for it to process. With the transaction complete, your pool tokens will appear in wallet (you may need to add them via the same process above) and your share information now appears under “Your Position”:
Congratulations, you are now a part of the liquidity pool!
If you need any help or are stuck, leave a comment.