What is AMM? Overview of AMM (2022)
What is AMM? This article helps you to know more about the development process, benefits, limitations and current status of AMM.
The DEX floor is probably no longer a stranger to you. And one of the main factors that made the boom of exchanges is the use of AMM mechanism. In this article, we will analyze together to understand more about what AMM is.
What is AMM?
AMM (short for Automated Market Maker) is an automated market maker. This is a transaction method that uses an algorithm to calculate the token price at the time of purchase.
The AMM mechanism does not have a seller concept, instead, smart contracts will act as an intermediary, the seller puts assets into a place called the Liquidity Pool, then the buyer will swap the assets they currently have. with assets in the pool via smart contract.
AMM is often found in DEX (Decentralized exchanges) products such as: Uniswap, Bancor, Mooniswap… Although on exchanges, the AMM mechanism has changed slightly to attract users, but in general, it is quite similar.
Benefits & Limitations of AMM
Benefit
- Low slippage (for illiquid tokens).
- Transaction latency is measured in milliseconds instead of seconds.
- Developed markets are highly liquid.
- Minimize market manipulation and money laundering.
- Generate passive income for Liquidity providers.
Limit
- It seems too easy to create a pool on AMM exchanges, especially Uniswap, so nowadays, there are many scam tokens on the market, all of which are similar from logo to token name. Therefore, what distinguishes real and fake tokens is the smart contract, and new users will easily be confused leading to loss of money because of sending money to the wrong smart contract.
- It is not possible to suspend orders to sell high or buy low in the future for users who do not have time to watch the price.
- Impermanent loss: It can simply be understood as the loss that can occur when comparing between holding tokens on your wallet and contributing to the pool. This is the reason why Hakka pool 1 uses stable coins as I mentioned above.
- The fee to pay for providers depends on the pool, the larger the pool, the cheaper the fee.
Math formula behind AMM in DEX
Overall, AMM is a very simple model. There is a constant value associated between 2 different tokens in a decentralized exchange.
Here is that model:
In there:
- K is the constant variable that I mentioned.
- X is token A.
- Y is token B.
- But in general, the sum of powers of X and Y should be 1.
When mapping, you will get a concave curve, as shown below. As more liquidity is added, the curve shifts outwards. That means you will incur less fees (in this case, slippage fees) when trading. But overall, the curve won’t change much.
What is the K constant in trading tokens?
Since K is a constant, which, as I discussed above, leads to an interesting phenomenon!
Imagine these shapes are transparent and you can see all three rectangles above. These are the different rectangles below the curve.
What does it mean when all 3 are below the curve?
The area under the curve shows the number of tokens we will receive when we swap (swap) one token for another. It can be seen that when you change the number of tokens during the Swap, you will get a different swap rate.
But the interesting thing is that if you calculate the area of three rectangles (imagine they don’t overlap) then the area of the 3 rectangles is the same!
Thanks to this constant K, make these rectangles all the same in mass!
Because according to conservation theory, the first principle in physics, nothing is destroyed, it just changes from one form to another. So it is also true for this constant K. The total area under the curve will remain the same because nothing is lost or created.
What does that mean?
Whenever you change from token A to token B or from token B to A, the amount of change is the same, as long as the curve doesn’t shift. If the curve changes because of more liquidity, the area under the curve will be different. But if everything stays the same, you can change any amount of Token A for Token B and the total number of tokens will be the same.
The development of AMM
One of the exchanges that brought AMM to the top is Uniswap with hidden gems x10; x100. However, Kyber Network (2018) and Bancor (2017) were the first to adopt AMM.
Unlike Uniswap, Kyber Network is a centralized AMM model, so only the team and Market maker have control over the pool, no one can contribute to the pool.
In November 2019, Uniswap officially used the decentralized AMM mechanism (decentralized), allowing anyone to contribute to the pool to increase liquidity. After that, pool contributors (providers) are also entitled to a portion of the transaction fee when a transaction on Uniswap is made.
If on Uniswap, you can only put ETH with 1 other token into 1 pool, then the Balancer has a significant improvement: Allows users to add up to 8 different tokens to make swapping more convenient. In addition, in Balancer, providers can customize the rate of tokens put into the pool in 1 transfer.
Eg:
- On Uniswap, if you want to get HAKKA but have USDT, you have to swap 2 times: 1st time swap USDT to ETH, 2nd time swap ETH to Hakka, so the total fee will be doubled, this will not happen in Balancer .
- And when you want to contribute to Uniswap pool, in Uniswap, you have to prepare tokens and ETH at a ratio of 1:1 to contribute, in Balancer, any ratio of tokens is fine.
The Liquidity Pool in Curve only allows stablecoin contributions, which reduces slippage in transactions. The use of stablecoins to maintain asset prices can also be seen in a few other pools not only on decentralized exchanges (DEX), Hakka pool 1 is an example.
Common Liquidity Pools in AMM
There are 3 types of Liquidity Pool commonly encountered in AMM:
- Fed price reserves: Simply put, it will refer to the external price, when the tokens in the pool are not updated or the imbalance mechanism is triggered, the transactions will stop automatically.
- Automated price reserves: Liquidity pools will be created with algorithms to adjust prices, this will improve over Fed price reserves in that there is no need to compare with external prices, this is how Uniswap and Balancer are doing.
- Bridge reserves: This practice aggregates the liquidity of other on-chain sources such as 0x and Uniswap. Transactions coming from these sources will not incur transaction fees.
What do you get when you become a Liquitity Provider?
Usually, liquidity providers are rewarded with transaction fees. Specifically, In Uniswap, 0.3% transaction fee will be divided equally among members contributing to the pool being traded, or in Curve it is 0.04%.
However, besides transaction fees, some exchanges will apply native tokens such as BAL (Balancer), Sushi (Sushiswap). This will help attract users to contribute to the pool, because if the exchange thrives, the token has more incentives, the profit will increase a lot.
Learn more: The risks to be aware of when becoming an LP of AMM
Current status of AMM
In the context of the growing ecosystems, AMM is almost the first link to be noticed, because this place is considered as the trading center of the whole ecosystem.
For example in Polygon, when Layer-2 was noticed, specifically starting with Polygon, Quickswap had a tremendous growth, from ~$10 to $1,000 for 1 QUICK token. Or for Avalanche, when the community noticed the growth of AVAX, the price of PNG (Pangolin’s token), or JOE (Joe Trader’s token) also pumped.
Another trend in 2021 that I want to talk about AMM is the integration of a series of functions, turning AMMs into a miniature DeFi hub. Take for example with Sushi: Previously, we only knew SushiSwap with Swap tokens, now, SushiSwap can be called simply Sushi because in fact, the project has integrated many other products such as Lending ( Kashi), IDO Platform (Miso),…
Another name that is also quite famous in AMM, that is PancakeSwap, also goes in that direction with many models built on CAKE (project’s token) such as IFO, lottery, etc.
Summary
AMM is one of the most unique projects DeFi has ever spawned. If DeFi is the future of Crypto, then this puzzle will always exist and grow. What do you think about the current AMM? You can comment your opinion below.