- Automated Market Makers (AMMs) are autonomous protocols using smart contracts to create price actions and provide liquidity.
- AMMs are used in decentralized exchanges to replace the order books that are used in traditional and centralized finance.
- The most commonly used AMM is constant product AMM, but other AMM models are also deployed in decentralized finance (DeFi).
Market Makers (MMs)
Market Makers (MMs) are entities providing buying and selling prices on assets from their own account with the goal of making profits from spreads. A centralized exchange relies on professional traders or financial institutions, to create multiple bid-ask orders to match the orders of retail traders, or in other words, to provide liquidity. In this system, the liquidity providers – high-net-worth individuals or companies – essentially take up the role of MMs.
Automatic Market Makers (AMMs)
Automated Market Makers (AMMs) are autonomous protocols using self-executing computer programs, called smart contracts, to create price actions and provide liquidity. Decentralized exchanges (DEXs) replace the order matching and order books with AMMs. In essence, traders are not trading directly against each other, but instead, liquidity is locked in the smart contracts. For AMMs, any entity can become the liquidity provider as long as it follows the requirement programmed in the smart contract.
MMs vs AMMs: Alice was to buy 1 ETH
To have a better understanding of the traditional MMs and AMMs, let’s walk through one example - Alice was to buy 1 ETH at the price of 2,400 USDC.
Scenario 1: Alice decides to buy 1 ETH from a centralized exchange. Here is what happens: Alice puts down the order, the exchange finds a trader Bob who is willing to sell 1 ETH at the price of 2,400 USDC, and the deal is done. But what if the exchange can’t find a suitable match for Alice? Then Alice has to wait for a suitable match who is willing to sell 1 ETH at the price Alice offers to execute the order. But in reality, the wait was barely long because MMs with large capitals, writing multiple bid-ask orders, always act as the counter-party for Alices and Bobs. So instead of trading with Bob, Alice buys 1 ETH from MMs. When Bob wants to sell his ETH, similarly he would sell it to MMs.
Scenario 2: Alice wants to buy 1 ETH at 2,400 USDC from a DEX. Here is what happens: Alice puts down 2,400 x 1 = 2400 USDC (amid slippage) into the ETH/USDC pool and she gets 1 ETH from the pool. That’s it. No Bob nor MMs acting as Alice’s counter-party. The price is determined, and the order is executed, automatically by AMMs.
How do AMMs work?
While different designs exist, constant function AMMs are the most popular class. These AMMs are based on constant functions where the combined asset reserves of pairs in the liquidity pools must remain constant. For example, many DeFi exchanges use the constant product equation X * Y = K, where X denotes the quantity of asset A and Y denotes the quantity of asset B, while K is a constant. The price of asset A relative to asset B is Y/X. So, if the amount of asset A falls, the amount of asset B will need to increase in order to fulfill the balancing effect of constant K. This will cause the price of asset A to increase. Vice versa.
To understand how AMMs work, let’s use Alice’s example again. So, Alice wants to buy 1 ETH with her USDC from a DEX, which uses the X * Y = K formula AMM. The market price (across many platforms) is 2,400 USDC. Alice notices the ETH/USDC pool has 100 ETH and 240,000 USDC.
She placed the order (take 1 ETH from the pool) and how much USDC does she need to add to the pool?
Based on AMM, Xb * Yb = Xa * Ya, where b and a denotes before and after the trade. Alice already knows that Xb = 100, Yb = 240,000, and Xa = 99, so Ya = 242,424
Therefore, Alice would need to offer (Ya - Yb) = 2,424 USDC to get 1 ETH.
Now the price of ETH becomes 2,448 USDC (Ya/ Xa = 242,424/99) in the pool, trading higher than the market price of 2400 USDC, and creating an arbitrage opportunity. The arbitragers will find this discrepancy and sell their ETHs on this platform while buying ETHs across other platforms where the ETHs are cheaper, eventually re-balancing the ratio of the pair in the pool to maintain the price at around market.
Other than arbitraging opportunities, when large orders (relative to the pool size) are placed in AMMs, it can also cause notable slippage for the traders. Like in the example for Alice, she paid 2,424 USDC for 1 ETH, higher than the market price of 2,400 USDC. Slippages happen in every pool, especially pools that are not adequately funded. To mitigate slippages, AMMs encourage users to become liquidity providers.
Liquidity Provider (LP) in DeFi
While Alice whose net worth equals 1 ETH very unlikely qualifies as an LP with a centralized exchange, she is qualified, encouraged, and incentivized to become an LP with a DEX. As discussed earlier, deep liquidity is key to mitigating slippage. AMMs encourage users to deposit assets in the liquidity pool, and as an incentive, rewards the LPs with the fees paid on transactions executed on the pool. In addition, some protocols issue governance tokens to LPs and traders. The token holders have voting rights on issues relating to protocol governance. Besides, many governance tokens can be traded, creating more incentives for LPs to deposit assets in the pool. (Check out here to find out the benefits and risks associated with LP)
Finally, though constant product AMMs (X * Y = K) is used as an example in this article, there are also other constant function AMMs, such as constant sum AMMs (X + Y = K) and constant mean AMMs (X1 * X2 * … * Xn)(1/n) = K. As the AMMs progressed, some DEX combines multiple functions and parameters to achieve a specific purpose, such as lower slippage for traders or mitigate risks for liquidity providers. Building on various mathematical formulae, AMMs have been consistently proven to effectively attract liquidity and achieve the highest daily trading volumes.
Discover SynFutures' Crypto Derivatives products: www.synfutures.com/.
Disclaimer: SynFutures Academy does not guarantee the reliability of the site content and shall not be held liable for any errors, omissions, or inaccuracies. The opinions and views expressed in any SynFutures Academy article are solely those of the author(s) and do not reflect the opinions of SynFutures. The SynFutures Academy articles are for educational purposes or information only. SynFutures Academy has no relationship to the projects mentioned in the articles, and there is no endorsement for these projects. The information provided on the site does not constitute an endorsement of any of the products and services discussed or investment, financial, or trading advice. A qualified professional should be consulted prior to making financial decisions.