Yield Farming 101: What is a liquidity pool?
Decentralized finance (DeFi) wouldn’t exist without having a place for traders to swap coins; luckily, we have liquidity pools to fill the void that centralized finance (CeFi), and banks leave behind!
To provide a place to trade tokens, automated-market makers (AMMs) have liquidity pools (LPs). LPs are smart contracts that contain a pair of tokens of varying amounts that traders can trade tokens to/from.
LPs provide the “trading interface” for traders to deposit one token and take another in return of equal value.
Two parties use LPs: those that trade one token for another (take liquidity) and deposit liquidity (make liquidity) known as LP providers. To understand LPs, you must understand the two parties involved.
The Traders (Takers)
You’re a trader or a taker when you go to any AMM and want to swap one token for another. You’d like to take liquidity from the LP. You are simply swapping tokens around in the LP and not providing more tokens for others to swap.
For example, perhaps you’d like to trade USDC for KOGECOIN on an AMM. You’d like to “pay” for KOGECOIN with USDC or swap an amount of KOGECOIN with an amount of USDC. To do that, the AMM must have an LP available with enough KOGECOIN to give to you in exchange for the USDC you’re going to give to them.
On the flip side, if you’d like to sell your KOGECOIN in exchange for USDC, the AMM would need the opposite (enough USDC to give to you in exchange for KOGECOIN).
You’re trading from a liquidity pool or taking liquidity when you trade one token for another on an AMM. You’re either taking KOGECOIN or taking USDC.
The Liquidity Providers (Makers)
Where do you think those tokens come from in the first place? Liquidity providers. Liquidity providers create the liquidity pools and continue to add tokens to the pool as it incurs more and more trades.
Liquidity providers are on the other side of the transaction. Liquidity providers don’t trade tokens; they create the LP and deposit new tokens into the LP for the traders to swap. They “make the market.”
Creating the LP
A liquidity provider creates an LP by depositing a certain ratio of tokens on an AMM. When a provider deposits tokens to create an LP, he’s effectively creating a market and setting a value for each token compared to the other.
If the provider deposits 100 KOGECOIN and 1 USDC, she’s effectively setting the price of one KOGECOIN to be 0.01 USDC and one USDC as 100 KOGECOIN. The ratio of tokens is important because that ratio will control the price throughout the LP’s existence.
If a provider deposits a 100:1 KOGECOIN/USDC ratio to create an LP, the AMM will attempt to maintain this ratio by continually adjusting the price after each trade in the LP.
Providing Liquidity to an Existing LP
Once a provider creates an LP and defines the ratio of tokens, other providers (or the original provider) can begin adding liquidity to the LP. Now that the token ratio is set, providers must maintain that ratio by depositing an exact 1:1 value ratio of tokens.
Perhaps some traders have used the LP already and have swapped a few KOGECOIN for USDC and vice versa. Maybe the LP now has 50 KOGECOIN and 0.5 USDC (still a 100:1 ratio or 0.01 USDC/KOGECOIN). To maintain that ratio, providers must deposit an equal value of each token in an exact 50/50 split.
To maintain that ratio of tokens in the LP, providers can deposit as many tokens as they want, but the AMM will only allow a 1:1 value ratio between the two tokens.
Conclusion
Liquidity pools are a critical component of DeFi in general. LPs allow trade to happen and are the foundation that other products are built on, such as farms and vaults.
If you have any questions about liquidity pools or yield farming, stop by the KogeFarm Telegram or Discord communities where you’ll typically find someone willing to help out.