An Automated Market Maker, or AMM, is a protocol used by a decentralized exchange (DEX) to determine the value of crypto trading pairs (such as ETH/USDT). After the price is determined, users can swap tokens. These tokens are exchanged for tokens stored in a so-called liquidity pool.
In a centralized crypto exchange, such as Bitvavo, the price of a trading pair is determined by the supply and demand on the platform. After all, there needs to be a selling party to fulfill the buyer’s order in the order book. This is why cryptocurrencies always have a slightly different price, depending on the exchange that is used.
Every DEX can use its own AMM. This means that one DEX will be more popular than the other if it can offer a better price. All AMMS have one thing in common. Namely that the price of a trading pair is determined by a formula, and that no one can directly influence this.
The Automated Market Maker is not just important for a DEX. Almost every DeFi application in one way or another deals with the AMM. This is because users increasingly are able to buy or swap tokens within an application. Since a DeFi application works decentralized, it will need to use an AMM.
How does an AMM work?
An Automated Market Maker uses smart contracts. This means that the AMM itself also operates on the blockchain, and isn’t managed by a central and authoritarian party. It is easier to understand the functioning of an AMM when comparing it to the way that the prices of cryptocurrencies are traditionally determined.
How does demand and supply work on a crypto exchange?
When a user on a central crypto exchange wants to buy 1 Bitcoin with 20 Ethereum coins, the user will need to use the BTC/ETH trading pair. The user enters the transaction he wants to make, and then places a buy order. This order is then added to the order book, and then he will need to wait for a buyer willing to sell 1 Bitcoin for 20 Ethereum coins.
Assume that all selling parties want to receive more Ethereum coins for 1 Bitcoin. Now the sale won’t occur. This is because the relevant parties have not come to an agreement.
The operation of an AMM
An AMM does not use an order book, as was used in the above example. Instead, the user can only directly swap his crypto coins for other crypto coins. On the other side of the platform there is therefore no buying or selling party needed to successfully execute the transaction.
The same user as in the above example once again wants to swap 20 Ethereum coins for 1 Bitcoin. The AMM will automatically calculate the price of this trading pair. The price is the same for everyone at that very moment wanting to perform the same transaction.
There are various formulas that can determine the price of a trading pair. Every platform can use a different algorithm, as a result of which some platforms are able to offer a more attractive price than their competitors.
When the seller agrees with the price proposed by the AMM for the transaction, the Ethereum coins are moved to a liquidity pool. Subsequently 1 Bitcoin is removed from this pool, which is sent to the user’s wallet.
This means that there need to be enough coins in the liquidity pool to perform a transaction between different trading pairs. These coins are provided by so-called liquidity providers or LPs.
What is a liquidity pool?
A liquidity pool can be compared to a safe that holds tokens. When users want to execute an order on a DEX that uses an AMM, the tokens will be swapped between the user and the liquidity pool. Swapping is a term that is used for the movement of coins between a wallet’s user and the liquidity pool.
Not just a DEX uses a liquidity pool. With more DeFi applications being developed, more and more liquidity pools are also needed. This is because a lot of tokens circulate in these applications. To be able to always guarantee these users, these liquidity pools need to be well filled. If they are not, liquidity will be lacking and an application may no longer work.
What is a liquidity provider (LP)?
A liquidity provider is a person who provides tokens to a liquidity pool. This means that the user temporarily parts with his tokens, so that an application can use them for the functionalities it is meant to provide.
No one will of course simply part with his tokens for the liquidity pool. He won’t be able to use the tokens, since they are no longer directly held by him. A solution was therefore created to ensure that liquidity pools always have adequate liquidity.
People that provide liquidity to a liquidity pool and that are therefore liquidity providers, temporarily provide their tokens to the pool. A smart contract will record which wallet the tokens originated from, what quantity was offered, and for how long they are being provided. After a certain period, the liquidity provider will get his tokens back. As such, the liquidity provider is thus in fact lending his tokens.
In exchange for lending his tokens, the liquidity provider receives a reward. This reward is also called the APR or APY, which stands for Annual Percentage Rate or Annual Percentage Yield. The APY or APR is represented as a percentage. For example, the APY for lending tokens to a pool can be 12% per year. This means that a liquidity provider receives 12% interest on the tokens he lends. This reward is paid out in the form of other tokens that were lent. If one LP lends 100 Ethereum to a liquidity pool with an APY of 12%, then after one year the LP will recceive 112 Ethereum in return.
Often the reward will increase as a liquidity provider lends the coins for a longer period of time. This is because of the risk associated with lending tokens and coins. The longer someone lends their coins, the greater the risk. The LP will be rewarded for the risk he is willing to take.
These rewards are paid from the fees that users pay to use the liquidity pool. When a user swaps tokens with an AMM, the user will have to pay the fees for this. These fees are paid out the pool’s liquidity providers.
Earning money by providing liquidity to a liquidity pool is also called ‘liquidity farming’. More and more crypto traders are using liquidity farming to earn passive returns on the cryptocurrencies that they earn and that they intend to keep for the long term. However, liquidity farming is not without risk.
The risk of impermanent loss
A liquidity provider runs the risk of impermanent loss when he lends tokens to a liquidity pool. After lending the tokens, they cannot simply be taken back. A period is agreed in advance for the duration of which the LP lends his tokens to the liquidity pool. During this period, the value of one of the two cryptocurrencies in the trading pair could starkly increase. This is where a loss is made.
Because the relationship between the trading pair changes, the user will receive a different proportion of reward. This means that the user would have earned more money simply by leaving both tokens in his wallet and selling them.
The resulting loss is also called the impermanent loss. This risk can be reduced by not providing liquidity to highly volatile trading pairs. With stable trading pairs, the risk of impermanent loss becomes much smaller. However, this also means that the return made for providing liquidity to stable trading pairs is often lower than for highly volatile trading pairs.
Example of an impermanent loss
Impermanent loss is often difficult to understand, and might be more easily explained with the below example.
What can a liquidity pool be used for?
A liquidity pool can be used for different purposes. The concept is quite simple, and it is therefore also possible to give other functions to the liquidity pool. Nevertheless, the most important function of a liquidity pool remains to provide liquidity to a DEX. This is because a DEX uses an AMM instead of an order book. The purchase and sale is therefore separate from the question about the demand and supply at that time.
Liquidity pools can also be used for governance within a crypto project. When the community has an idea for a protocol, money will be needed to realize the idea. They could use a liquidity pool to raise this money. This also makes it clear how the community feels about the proposal. If the proposed monetary amount is not raised, it indicates that there is insufficient support for the idea.
Within DeFi, liquidity pools are often also used as insurance against the risks associated with a smart contract. Should something go wrong, the project will have a liquidity pool with tokens to compensate for potential damages. This liquidity pool could be funded by moving part of the transaction fees into it. In that way, everyone using the project will contribute a small share to insure security.
Finally, liquidity pools are these days also used as collateral for synthetic tokens. These are tokens that derive their value from another product, such as shares or raw materials. By sending tokens to a liquidity pool, it is ensured that the synthetic token does in fact have value.
Increasingly, new functions are found for liquidity pool, and there is therefore a big likelihood that these types of pools will be used more and more often in the coming years. This will not just make it possible for new applications to be developed, but also offers more opportunities for cryptocurrency owners to generate passive income from their coins and tokens.
An Automated Market Maker (AMM) is a protocol that ensures that users can directly swap tokens with each other without the intervention of a ledger. As a result, AMM does not depend on the direct demand and supply on the market. Instead, liquidity providers ensure that there are enough tokens in the liquidity pool. The AMM ensures that a set price is determined for a trading pair, at which users can swap tokens with the liquidity pool.
Users pay transaction fees to use an AMM. These transaction fees are then used as a reward for the liquidity providers. They can therefore earn money by lending tokens to a liquidity pool. The reward is represented as APR or APY, and is a percentage based on the number of tokens that the liquidity providers lend.
It can therefore pay to be a liquidity provider, although it is not without risk. As a liquidity provider, you run the risk of losing money, which is called impermanent loss. Highly volatile tokens can, due to price fluctuations, change the relationship between the trading pair. As a result, a difference arises between the final value of the tokens that were moved to the liquidity pool, and the tokens earned in reward for providing that liquidity.
The most important use of liquidity pools is to provide liquidity to a DEX, although the pools are increasingly used for different purposes. For example, supporting governance, providing insurance, or as collateral for synthetic tokens.