Comment on page
Where does the yield come from?
Automated market makers (AMMs) are a relatively well-known design that found their way into crypto markets in 2018. They allowed users to buy and sell on-chain tokens in a gas-efficient way. In comparison to an order-book-based market that required users to constantly place and cancel orders, AMMs enabled liquidity providers to deposit liquidity just once and have the smart contracts automatically manage the position for them.
From a liquidity provider's perspective, you hold some inventory of NFTs and ETH and would like to earn some yield on these assets instead of having them sit idly in your wallet. One way to earn yield would be depositing your NFTs and ETH into the AMM and earning fees on trades that happen. Every time someone buys from your pool or sells into your pool, they pay a fee for the privilege of using your liquidity. This is how a liquidity provider (LP) earns yield when depositing assets into an AMM.
The AMM will automatically adjust the price in the pool each time a buy or sell occurs and fees will accrue to you. The intuition here is that each NFT in the pool is essentially treated as fungible. The AMM will automatically manage your position and you will be able to withdraw your NFTs and ETH at any time. Traders can buy the NFTs that you have deposited in the AMM and also sell any NFTs that they might have and receive the ETH you deposited in return. It ensures that there is always idle liquidity available and also adjusts the price impact that each trade has depending on the amount of liquidity deposited. If there is more liquidity there is less price impact and vice versa.
The biggest risk to an LP is that they will suffer a loss on the value of the position relative to if they had just held the assets instead of providing liquidity to a pool. This is known as Impermanent Loss, explained here Impermanent Loss or in this tweet:
There are many different strategies to depositing liquidity into a pool, but a common theme is to create a pool for assets which the LP thinks will trade within a range, thus limiting their expectation of their impermanent loss while allowing them to be paid a fee every time a trade occurs within this range.
All liquidity in each AMM is represented as an ERC20 token called LP tokens. These LP tokens grant the holders the right to withdraw a certain amount of NFTs and ETH from the AMM depending on how much they own. When liquidity providers add liquidity, the smart contract mints these LP tokens and sends them to the providers. Since they are fundamentally just an ERC20 token they can be used anywhere else in the Ethereum ecosystem.