Since the time when Bitcoin came out more than a decade ago and opened the door for the entire cryptocurrency industry we know today, there has always been a high demand for this new asset type. Initially, people were exchanging fiat for Bitcoin and vice versa through peer-to-peer (P2P) environments like LocalBitcoins. Then we saw the emergence of centralized cryptocurrency exchanges that resembled traditional forex and stock exchanges. Finally, these days we are experiencing another major breakthrough that is possible exclusively thanks to blockchain. I’m talking about Decentralized Exchanges (DEXs) based on Automated Market Makers (AMMs). AMMs represent one of the most significant innovations in the Decentralized Finance (DeFi) space, which is by far the fastest-growing sector within the crypto industry right now.
AMMs allow the development and running of accessible liquidity for a range of tokens. This liquidity is available on-chain and enables a seamless trading process. Thanks to the innovation of AMMs, there is a fundamentally new way to swap cryptocurrencies. Previously, traders could buy cryptocurrencies through centralized exchanges only, which are using a traditional buy/sell order book that tracks the liquidity and sets the price based on that. Elsewhere, in AMM-based systems, both sides of trades are already pre-funded by on-chain liquidity pools. The latter ones enable users to instantly swap tokens on-chain in a decentralized and non-custodial manner. The liquidity pools are maintained by so-called liquidity providers, whose goal is to earn passive income. The trading fees of the platform are distributed fairly to all contributors to liquidity pools.
How Do AMM(Automated Market Makers) Differ From Centralized Exchanges?
For example, let’s suppose that we have two cryptocurrency exchanges with three listed tokens each – Bitcoin, Ethereum, and USDT, and thus three pairs based on them. The first exchange, let’s call it exchange A, is centralized. In order for you to buy Bitcoin in exchange for your Ethereum, you have to wait for someone on the other side to sell Bitcoin and be willing to buy Ethereum. The centralized exchange will monitor all buy and sell bids to match the trades and create the best prices for both sides. Basically, exchange A is the meeting place between buyers and sellers.
Most centralized exchanges are operating thanks to so-called market makers, which are individuals or companies that both buy and sell continuously the same asset to provide liquidity and earn from the bid/ask difference. While the presence of market makers is taking some burden off the exchange’s shoulders, there is still a high risk of price manipulation in favor of market makers, who are setting the bid/ask price for their benefit and against the traders. Also, conducting large trades becomes difficult due to potential price slippage, as it is challenging to find entities on the other side to sell you a big amount of Bitcoin. Even market makers might not help you since their reserves may be limited.
In the case of the second exchange from our example, let’s call it exchange B, it is decentralized and has no order book that matches buy and sell orders. How does it operate then? It can do the trick thanks to Automated Market Makers, which are nothing else than smart contract-based algorithms. Thus, our DEX has three liquidity pools for each of the listed pairs with 50/50 distribution – BTC/ETH, BTC/USDT, and ETH/USDT. In reality, most liquidity pools involve a proprietary stablecoin in pair with a major cryptocurrency, but we’re using these pairs for the sake of our example. Liquidity providers are locking their cryptocurrency in those pools to earn passive income based on fees, while the tokens from the pools are then swapped by traders seamlessly. Traders don’t even have to deposit funds, as in the case of centralized exchanges. They are simply swapping the cryptocurrency they hold for the one they want to buy.
To recap, AMMs represent a new class of DEXs that use mathematical formulas to set the price of a listed cryptocurrency. There are no buy or sell orders in an order book, and traders don’t have to wait for someone else on the other side to sell their tokens to. Instead, the smart contract has the function of a maker in every transaction. The liquidity pools make sure that the swaps between tokens can be carried out seamlessly and without price slippage.
We’ll compare the four mentioned AMMs and see how the concept works, but here are the main aspects you should know about AMMs:
- There are more types of AMMs, with the main ones being Constant Product Market Maker (CPMM), Constant Sum Market Maker (CSMM), Constant Mean Market Maker (CMMM), and advanced Hybrid CFMMs.
- While AMMs are a great innovation, there are several challenges they must tackle, including impermanent loss, low capital efficiency, and forced multi-token exposure.
Main Types of AMM(Automated Market Makers)
The main category of AMMs is made up of several types collectively known as Constant Function Market Makers (CFMMs), which are meant to allow the decentralized exchange of cryptocurrencies. CFMM-based DEXs are employing a constant function, hence the name, in which the combined asset reserves of a trading pair must always remain unchanged. For example, in a hypothetical ETH/USDT pair, liquidity providers, in this case, must lock $100 worth of ETH and $100 worth of USDT in the pool.
The first type of CFMMs is the Constant Product Market Maker (CPMM), which became widely known thanks to Bancor and Uniswap. CPMMs use the function X*Y=K, which is employed to set the price of two tokens based on the available quantities of every token. When the supply of token X goes up, the supply of token Y must decrease, and vice versa. In this way, the constant product K is maintained. When we plot the function, we see a hyperbola in which liquidity is always available, though at higher prices, and it can go infinitely at both ends.
The second type of AMMs is Constant Sum Market Maker (CSMM), which is ideal for trades with zero slippage. However, this formula doesn’t ensure infinite liquidity. CSMM uses the formula X+Y=K. It generates a straight line when the function is plotted.
In this case, if the off-chain reference price between the tokens is not 1:1 – for example, Ethereum on Coinbase is much more expensive than Ethereum on our DEX – it allows the so-called arbitrageurs (an arbitrageur is a person or entity that tries to benefit from market inefficiencies) to drain one of the reserves (in our example, Ethereum) since it’s cheaper on our DEX and can be sold for a higher price on Coinbase. This market condition would hurt one side of the pool, forcing liquidity providers to incur a loss and leave no more liquidity for DEX traders. Thus, CSMM is not a popular model.
The third type of function-based AMMs is the Constant Mean Market Maker (CMMM), which allows the development of AMMs that can host more than two tokens. Consequently, the pools can be weighted differently from the traditional 50/50 distribution. For example, we can have a liquidity pool with three tokens, which would employ the following equation: (X*Y*Z)^(⅓)=K. This approach enables traders to swap between any of the three assets in the pool.
Today, there are more advanced models, such as Hybrid CFMMs, which merge several functions and parameters to target predefined goals, like adjusting the risk level for liquidity providers or ensure reduced price slippage for traders.
Problems and Advantages of AMMs
As mentioned, even if AMMs are more advanced than traditional exchange systems powered by market makers, they have several problems. Here are some of them:
- Impermanent Loss – the most common problem of AMM is the so-called impermanent loss, which represents a risk for those who provide liquidity to the pools. The loss is caused by the difference in value over time between the tokens deposited initially in a liquidity pool versus holding these tokens in your personal wallet. This happens when the off-chain price of a token, for example, Ethereum, goes higher or lower than the price of the same token in an AMM-based DEX. Given that AMMs don’t automatically adjust their exchange rates based on the market-wide situation, arbitrageurs would always buy underpriced tokens or sell the overpriced ones until the prices offered by the AMM is balanced to match the rate offered by external markets. The profit of arbitrageurs comes at the expense of liquidity providers, who incur a loss.
- Multi-Token Exposure – most AMMs require liquidity providers to deposit two tokens in a pool to make sure that the liquidity on both sides of a pair is provided. Consequently, liquidity providers that would have normally planned to maintain long exposure to a single token are forced to split their holdings to comply with the rules.
- Low Capital Efficiency – many AMMs, especially the less popular ones, require large amounts of liquidity to match the same level of slippage as a centralized exchange that operates order books.
Also, AMMs are currently vulnerable to hacks and bugs. For example, Balancer and Uniswap have experienced hacking attacks in which liquidity providers saw their funds stolen.
All in all, despite their transformative potential, the mathematical formulas embedded in the AMM smart contracts cannot truly reflect market sentiment. Thus, all AMMs would expect arbitrage traders to correct prices based on the rates offered in external markets, and that means losses for liquidity providers.
Still, AMMs are still evolving, and traders interact with them because of the unique advantages they provide, such as:
- AMMs enable the markets to be less susceptible to price manipulations.
- AMMs represent the only systems that allow the operation of genuine decentralized exchanges.
- AMM-based DEXs allow token holders to earn passive income by becoming liquidity providers.
- Swapping tokens on AMM-based DEXs can be much more convenient, faster, and seamless than on regular exchanges.
- Price slippage is often reduced when compared to typical centralized exchanges.
- Most AMM projects are permissionless and decentralized, meaning that they don’t require users to pass through KYC verification procedures.
Examples of AMM(Automated Market Makers) Projects
Now that you know the basics of Automated Market Makers, let us compare the four most popular projects using this model of liquidity creation.
Kyber Network was among the first AMMs to develop automated liquidity pools more than two years ago. Its liquidity pools are launched exclusively by professional market makers or by Kyber’s team. Thus, Kyber pools are not open for anyone to become liquidity providers.
Kyber makes use of external oracles to set prices in the pool, or they are set automatically based on the smart contract parameters determined during setup.
Kyber offers three types of liquidity pools:
- Fed Price Reserves – they enable liquidity pools to have an external price feed through oracles.
- Automated Price Reserves – with this option, market makers can deploy pools with preset algorithms that would adjust the price automatically. This kind of XYK that we described above is similar to that employed by Uniswap and Balancer.
- Bridge Reserves – these kinds of reserves use liquidity from other on-chain sources like Uniswap and 0x.
Kyber applies a 0.2% fee on all trades carried out on its network.
The disadvantage of Kyber for regular token holders is that the capital requirements for liquidity pools are large. Fed price reserves require no less than $20,000, while automated price reserve pools require a minimum of $50,000.
Uniswap is regarded as the first true decentralized automated market maker. It was launched in November 2019 and has managed to become the most popular AMM so far.
It allows anyone to set a liquidity pool on its network and lets any trader become a liquidity provider.
Uniswap’s liquidity pools can be made of two pairs only, which can be paired against any ERC-20 token. The most common pairs are ETH/ERC-20 Token and DAI/ERC-20 token.
The price in the Uniswap smart contract cannot be controlled in any way. The price of tokens is determined by the balance ratio between the two tokens in the pool. Because of this, liquidity providers may be subject to impermanent loss as described above.
Balancer came out quite recently compared to the previous two AMMs. Most of its approaches and functions are similar to those offered by Uniswap, but Balancer has some features that enable it to deploy more use cases besides hosting liquidity pools. For example, the project has introduced multi-token pools, private pools, dynamic pool fees, and custom pool ratios.
Balancer allows liquidity pools with up to 8 tokens per pool. This opens the door for many unique use cases, such as building an automated portfolio manager that can act as an index.
Curve was launched in early 2020 and has become popular within the DeFi ecosystem. What makes Curve different from other AMMs is that its liquidity supports only stablecoins – all kinds of stablecoins. The pools can be deployed by admins only, but everyone can contribute to them.
While some might consider this a limitation, the fact that Curve focused exclusively on stablecoins allows it to kill the competition in this specific niche. Its pools allow traders to carry out large trades with low slippage.
Here is a comprehensive table created by Multi.io research:
In conclusion, we should admit that AMMs represent a major breakthrough in the DeFi space. They enable traders to experience instant settlement while liquidity providers can earn passive income based on the fees from each trade.
I’d advise professional market makers to go for a system like Kyber Network. As for regular cryptocurrency holders, they can have easier access to Uniswap or Balancer. Those who are targeting steady interest rates on their stablecoins should definitely look into Curve’s options.