Decentralized exchanges (DEXs) are one of the most prominent features of decentralized finance (DeFi). The most popular type of DEX is those using an automated market maker (AMM). AMMs are an essential component of the DeFi landscape. Rather than using order books to match buyers, AMMs facilitate peer-to-peer token swaps and value creation using liquidity providers and liquidity pools. Also, liquidity pools help maximize yield generation thanks to using liquidity provider (LP) tokens, representing an LP’s share of a pool. But, what is a liquidity pool, and how do LP tokens work?
In this “What is a Liquidity Pool?” article, we’re going to dive deep into the world of DeFi lending and liquidity pools. We explore automated market makers (AMMs), liquidity providers, and impermanent loss. Also, we discuss LP tokens, how they work, and why liquidity pools are so essential to the DeFi ecosystem.
Moralis Academy is the number one Web3 and blockchain education suite online. If you want to learn how to interact with the top DeFi protocols on Ethereum, check out the DeFi 101 course at Moralis Academy. In this course, we teach you how to stay safe in DeFi and how to make the most out of the new financial revolution. Also, save our “Rust & Solana” and “Solana vs NEAR” articles for later reading. Kickstart your blockchain education today and join our community of over 30,000 students at Moralis Academy!
What is a Decentralized Exchange (DEX)?
DEXs are an essential component of the DeFi landscape. A DEX is a peer-to-peer exchange for buying, selling, and trading crypto assets. Unlike centralized exchanges (CEXs), DEXs have no central authority or single point of failure. Also, DEXs operate without intermediaries, giving users full custody of their assets.
Often, centralized financial institutions such as banks offer little transparency to customers. However, because DEXs interact with public blockchain networks like Ethereum, all activities are observable via a block explorer such as Etherscan and can be traced on-chain. Also, because DEXs are non-custodial, they expose users to less counterparty risk than centralized alternatives. One of the most common types of DEX is those using an automated market maker (AMM).
What is an Automated Market Maker (AMM)?
Before we address the question of “what is a liquidity pool?”, let’s first take a look at why they exist in the first place. Liquidity pools are an essential part of automated market makers (AMMs). AMMs are a type of DEX that uses mathematical formulas to match orders instead of an order book to enable users to exchange tokens in a permissionless manner. AMMs use algorithms to set the prices of assets that are bought and sold. Each AMM protocol often has a slightly different algorithm from the next. However, the underlying principle is usually quite similar between AMMs.
To highlight how this works, let’s take a look at Uniswap, the number one DEX on Ethereum. Uniswap uses the following formula for token price setting: x * y = k. In this formula, “x” points to the number of a particular token held in a liquidity pool. Also, the “y” refers to the number of the other token in a given token pair. The “k” in this example is a fixed constant representing the total liquidity in a pool.
How Does an AMM Work?
Traditional exchanges use a market-making model that relies on order books. However, AMMs allow anyone to provide liquidity to the protocol in the form of trading pairs. Whereas centralized exchanges require counterparties for each trade, AMMs allow users to interact with smart contracts. Instead of counterparties, these smart contracts “make” the market. As such, AMMs create peer-to-contract (P2C) transactions. On the other hand, non-AMM exchanges tend to create peer-to-peer (P2P) transactions, as there is always another person on the other side of each exchange.
Because AMMs don’t use order books, they often only provide one order type. However, it is worth noting that some advanced AMMs do offer multiple order types. That said, the price paid for crypto assets is generally determined by a formula. As such, users don’t need to have their orders matched with counterparties when interacting with an AMM.
What is a Liquidity Pool?
So, what is a liquidity pool? When liquidity providers (LPs) put liquidity into a smart contract, it goes into a liquidity pool. These pools are usually made up of equal parts of two different crypto assets, known as a trading pair. For example, let’s say Bob wants to swap ETH for DAI. Bob can go to an AMM such as Uniswap and select the ETH/DAI trading pair.
The liquidity for this trading pair comes from the liquidity providers who deposit equal amounts of ETH and DAI to the protocol. Accordingly, liquidity pools serve as the pool of assets that traders can trade against rather than being matched via an order book. Also, liquidity providers earn a percentage of trading fees each time someone makes a trade using the relevant trading pair. However, each AMM has a slightly different rewards structure for LPs.
Before liquidity pools, DEXs would often suffer poor liquidity. Also, many early DEXs relied on traditional market-making models, something that is antithetical to DeFi. However, liquidity pools tackle this issue by incentivizing user-generated liquidity provision throughout the DeFi landscape.
The more liquidity a given pool has, the less likely it is that traders will experience slippage. Slippage is the difference between the price a trader expects to pay and the price they actually pay. This often occurs when large orders push up the price of an asset due to insufficient liquidity. Accordingly, liquidity attracts liquidity, causing a positive feedback loop.
Impermanent Loss
Now that we have addressed the question of “what is a liquidity pool?”, let’s take a closer look at impermanent loss. When a liquidity provider puts liquidity into a liquidity pool and the value of their assets is lower when they take it out, impermanent loss occurs. The risk of impermanent loss can be reduced when the two assets that make up a trading pair move in small price ranges, such as stablecoins. Although impermanent loss is quite common for liquidity providers, it can often be offset by trading fee earnings.
For example, let’s say you deposit one ETH and 2,000 USDT into a liquidity pool. For the sake of this example, we’ll say that one ETH is of equal value to 2,000 USDT. Your overall deposit is, therefore, $4,000. If the price of ETH increases, arbitrageurs will increase the amount of USDT in the liquidity pool and withdraw ETH until the new price is reflected in the pool. When this happens, the ratio of USDT to ETH in the liquidity pool changes. As such, you may have been better off simply holding the ETH and USDT in the first place.
Liquidity Provider (LP) Tokens
When a liquidity provider (LP) provides liquidity to an AMM such as Uniswap or Balancer, the protocol issues them liquidity provider (LP) tokens. LP tokens represent the share of a liquidity pool that an LP owns. For example, if you deposit $200 into a liquidity pool containing $1,000, you’d receive 20% of the LP tokens for that pool. Also, let’s say you deposit $100 of ETH and $100 of USDT; you would receive ETH/USDT LP tokens.
Also, LP tokens allow LPs to maximize profits by injecting an additional layer of liquidity into the DeFi ecosystem. Yield farming, also known as “liquidity mining”, is when investors jump between multiple DeFi protocols to earn the highest rewards. Many DeFi platforms offer interest for depositing LP tokens into a liquidity pool. As such, LP tokens help investors to maximize yields and earn higher rewards.
Furthermore, LP tokens help AMMs to remain non-custodial by giving liquidity providers a redeemable representation of their assets. When an LP leaves a liquidity pool and wants to redeem its assets, they simply exchange its LP tokens for the underlying assets by interacting with the relevant smart contracts.
If you want to take your DeFi game to the next level, check out the DeFi 201 course at Moralis Academy. This course teaches students about advanced concepts such as yield farming, flash loans, DeFi hedge funds, and much more!
Why are LP Tokens Important?
The DeFi ecosystem depends on liquidity to facilitate frictionless token swaps with minimal slippage. Also, high levels of liquidity allow investors to maximize yield generation. In the traditional financial ecosystem, fiat currencies tend to be highly liquid. As such, anyone can exchange cash for stocks, gold, or other assets. Unfortunately, though, exchanging fiat for crypto is less straightforward.
Thankfully, top-tier crypto assets such as Bitcoin (BTC) and Ethereum (ETH) are highly liquid on most cryptocurrency exchanges. Because so much of the DeFi landscape exists on the Ethereum blockchain, ETH, the native asset of Ethereum, is one of the most liquid assets in DeFi. Accordingly, ETH can be traded on pretty much every DEX on Ethereum.
Before the invention of LP tokens, any assets held in a DeFi smart contract on Ethereum were illiquid and inaccessible until withdrawal. Because of this, investors generally had to choose between participating in proof-of-stake (PoS) consensus and voting on governance proposals or earning a yield in DeFi. However, LP tokens address this issue by providing investors with easy-to-redeem tokens that represent their share of a liquidity pool.
LP tokens can be used several times to maximize yield generation. For example, if you provide liquidity to a pool on Curve Finance, you would earn LP tokens proportional to your share. Not only would you earn trading fees on token swaps made using your Curve pool, but you could also invest them in another DeFi protocol to earn additional rewards. Moreover, LP tokens give investors additional revenue streams while enhancing the overall liquidity of the DeFi ecosystem. However, it is worth bearing in mind that yield farming or liquidity mining in this fashion presents additional risks.
Yield Farming and Liquidity Mining
Some DeFi protocols feature additional incentives or “incentivized” pools for yield farming and liquidity mining using LP tokens. These pools often boast higher rewards than regular pools. However, this additional reward usually comes with extra risk. Yield farming is a process whereby investors stake crypto assets or provide liquidity to multiple DeFi protocols with the intention of maximizing rewards.
Furthermore, some DeFi yield generation protocols allow investors to automate the rebalancing of their liquidity mining portfolios to maximize returns with minimal effort. LP tokens play an essential role in liquidity mining because without them there would be significantly less liquidity available to users.
What is a Liquidity Pool? – Summary
Next time someone asks you, “what is a liquidity pool?”, you should be able to answer that question confidently after reading this article. By going through the provided material herein, you know that liquidity pools are a vital component of the DeFi ecosystem. They facilitate peer-to-peer lending and value creation on the blockchain without the need for intermediaries. Plus, liquidity pools allow investors to put their idle assets to work and earn a passive income in return.
As a vital component of AMMs, the most popular type of DEX, liquidity pools allow investors to retain control of their assets by removing the need for counterparties and the associated risks. Furthermore, LP tokens maximize the liquidity throughout the DeFi ecosystem by unlocking tokens held in smart contracts. When interacting with liquidity pools, it’s important to consider risks such as impermanent loss. Although liquidity mining and yield farming can help investors maximize gains, these strategies are inherently risky. Always conduct your own research and only invest what you can afford to lose.
If you want to learn how to build your own decentralized exchange (DEX) but have no coding experience, check out the JavaScript Programming for Blockchain Developers course at Moralis Academy. This is the perfect starting point for anyone looking to begin a career in Web3 development. Also, check out our “Understanding Crypto Crashes” and “How to Invest During a Crypto Bear Market” articles to learn how to safeguard your portfolio during market downturns! Take your first steps towards a life-changing career in Web3 with Moralis Academy! In addition, don’t forget to follow us on Twitter @MoralisAcademy! We’d love to hear your thoughts about DeFi lending and liquidity pools!