Advanced topics of DeFi
Automated Market Makers (AMMs)
Automated Market Makers (AMMs) are a type of DeFi protocol that uses algorithms to facilitate trading between cryptocurrencies in a decentralized manner. These protocols use liquidity pools to enable users to swap tokens without the need for a centralized order book.
One of the most popular AMMs is Uniswap. Here's how Uniswap and other AMMs work:
- Users deposit two types of tokens into a liquidity pool. The ratio of the tokens in the pool determines the price of the tokens.
- When a user wants to trade one token for another, they swap their tokens with the liquidity pool. The algorithm calculates the price based on the current ratio of tokens in the pool.
- When tokens are swapped, the amount of tokens in the pool changes, which in turn affects the price of the tokens.
AMMs are able to offer continuous liquidity to traders, even during periods of high volatility, because the ratio of tokens in the pool adjusts automatically based on supply and demand. They have become increasingly popular due to their ability to provide decentralized and permissionless trading, as well as the potential to earn passive income from providing liquidity to the pools. However, AMMs are not without risks, particularly related to impermanent loss, which we will discuss in another section.