Automated Market Maker (AMM) based Decentralized Exchanges (DEXs) have proven to be one of the most impactful DeFi innovations. They enable the creation and running of openly accessible on-chain liquidity for a range of different tokens.
AMMs fundamentally alter how users swap cryptocurrencies. Instead of using a traditional buy/sell order book, both sides of trades are pre-funded by on-chain liquidity pools. Liquidity pools allow users to seamlessly switch between tokens on-chain in a completely decentralized and non-custodial manner. Liquidity providers earn passive income via trading fees based on the percentage of their contribution to the pool.
In this article, we explore how AMMs work, dissect their inherent problems, and examine solutions to solve these key obstacles. Some of the key takeaways include:
- There are several AMM types: Constant Sum Market Maker (CSMM), Constant Mean Market Maker (CMMM), and advanced Hybrid CFMMs.
- Some of the key challenges that AMMs must overcome include impermanent loss, forced multi-token exposure, and low capital efficiency.
- Innovations by Bancor, Uniswap, Curve, and others are making AMMs more attractive to larger liquidity providers by improving capital efficiency, reducing volatility risk, and providing more capital deployment options.
- Using Chainlink oracles, Bancor aims to be the first to solve the problem of impermanent loss on volatile tokens in their upcoming V2 release.
By providing a more thorough analysis, we hope to better inform DeFi users about the challenges and innovations of AMMs, so that decentralized liquidity can realize its full potential as a fundamental building block for DeFi and the broader financial world.
Overview of Automated Market Makers (AMMs)
Market makers (MMs) are entities tasked with creating price action on an exchange that would otherwise be illiquid without trading activity. This is done by MMs buying and selling assets from their own account with the goal of making a profit. Their trading activity creates liquidity for other traders, lowering the slippage of larger trades.
Automated Market Makers (AMMs) use algorithmic “Money Robots” to mimic these price actions within electronic markets like DeFi. While different designs of Decentralized Exchanges exist, AMM-based DEXs have consistently achieved the most liquidity and the highest amount of average daily trading volume.
Constant Function Market Makers (CFMMs) are the most popular class of AMMs, and are specifically designed to enable the decentralized exchange of digital assets. These AMM exchanges are based on a constant function, where the combined asset reserves of trading pairs must remain unchanged. In non-custodial AMMs, user deposits for trading pairs are pooled within a smart contract, which any trader can leverage for token swap liquidity. Thus, users trade against the smart contract (pooled assets) as opposed to directly with counterparty like in order book exchanges.
There are three primary designs of Constant Function Market Makers that have emerged since 2017.
The first type to emerge was the Constant Product Market Maker (CPMM) and it was popularized in the first AMM-based DEXs, Bancor and Uniswap. CPMMs are based on the function x*y=k, which establishes a range of prices for two tokens according to the available quantities (liquidity) of each token. When the supply of token X increases, the token supply of Y must decrease, and vice-versa, to maintain the constant product K. When plotted, the result is a hyperbola where liquidity is always available, but at increasingly higher prices that approach infinity at both ends.
The second type is a Constant Sum Market Maker (CSMM), which is ideal for zero slippage trades but does not provide infinite liquidity. CSMMs follow the formula x+y=k, creating a straight line when plotted. This design unfortunately allows arbitrageurs to drain one of the reserves if the off-chain reference price between the tokens is not 1:1. Such a situation would destroy one side of the liquidity pool, forcing liquidity providers to eat the loss and leaving no more liquidity for traders. Because of this, CSMM is an uncommon model of AMMs.
The third type is a Constant Mean Market Maker (CMMM), which enables the creation of AMMs that can have more than two tokens and be weighted outside of the standard 50/50 distribution. In this model, the weighted geometric mean of each reserve remains constant. For a liquidity pool with three assets, the equation would be the following: (x*y*z)^(⅓)=k. This allows for variable exposure to different assets in the pool and enables swaps between any of the pool’s assets.
As AMM-based liquidity has progressed, we have seen the emergence of advanced Hybrid CFMMs which combine multiple functions and parameters to achieve specific behaviors, such as adjusted risk exposure for liquidity providers or reduced price slippage for traders.
For example, Curve AMMs combine both a CPMM and CSMM to create denser pockets of liquidity that bring down slippage within a given range of trades. The result is a hyperbola (blue line) that returns a linear exchange rate for most trades and exponential prices only for larger trades.
The rest of this article will focus primarily on different AMM designs that seek to solve key challenges for AMMs. While the first generation of AMM pools in DeFi have experienced extensive growth over the past two years, there are a few obstacles preventing their widespread adoption, including impermanent loss, low capital efficiency, and multi-token exposure.
Inherent Problems Holding Back AMMs
The primary and most commonly unknown risk experienced by users providing liquidity to AMM pools is impermanent loss—the difference in value over time between depositing tokens in an AMM versus simply holding those tokens in a wallet. This loss occurs when the market-wide price of tokens inside an AMM diverges in any direction. Since AMMs don’t automatically adjust their exchange rates, an arbitrageur is required to buy the underpriced assets or sell the overpriced assets until the prices offered by the AMM match the market-wide price of external markets. The profit extracted by arbitrageurs is siphoned from the pockets of liquidity providers, creating a loss.
In the example above, the impermanent loss experienced within the AMM is caused by a change in the market price of ETH due to the trading activity of other exchanges. The AMM’s internal response to this external price change is to readjust the exchange rate in the pool to match the exchange rate of external markets. In the rebalancing process of swapping ETH to BNT, the AMM experiences a slight decline in the total reserves in the pool.
The reason it is called an “impermanent” loss is that as long as the relative prices of the tokens within the AMM return to their original values, the losses disappear and liquidity providers keep their earned fees as profit. However, such a situation is rare, meaning most liquidity providers suffer permanent losses in excess of the trading fees they generate. The graph below shows the impermanent losses experienced when providing liquidity to an ETH-DAI AMM pool, before taking into account trading fees.
AMMs commonly require liquidity providers to deposit two different tokens to supply equal liquidity on both sides of the trade. As a result, liquidity providers are unable to keep their long exposure to a single token, and instead have to split their exposure by holding an additional ERC20 reserve asset. A team owning a large quantity of one token or individual holders wishing to provide liquidity are forced to purchase another asset in order to provide liquidity, decreasing their holdings in the pool’s base token and adding exposure to another asset.
Low Capital Efficiency
AMMs have been criticized for requiring large amounts of liquidity to achieve the same level of slippage as an order book based exchange. This is due to the fact that a substantial portion of AMM liquidity is available only when the pricing curve begins to turn exponential. As such, most liquidity will never be used by rational traders due to the extreme slippage experienced.
AMM liquidity providers have no control over which price points are being offered to traders, leading some people to refer to AMMs as “lazy liquidity” that’s underutilized and poorly provisioned. Meanwhile, market makers on order book exchanges can control exactly which price points they want to buy and sell tokens. This leads to very high capital efficiency, but with the trade-off of requiring active participation and oversight of liquidity provisioning.
Cutting Edge Solutions to Improve AMMs
Many of the limitations from the first generation of AMMs are being solved by innovative projects with new design patterns.
High Capital Efficiency and Low Slippage AMMs
As mentioned in a previous section, Hybrid CFMMs enable extremely low slippage trades through an exchange rate curve that is mostly linear and parabolic only once the liquidity pool is pushed to its limits. Liquidity providers earn more fees (albeit on a lower fee per trade basis) because capital is used more efficiently, while arbitrageurs still profit from rebalancing the pool.
Curve offers low-slippage swaps between tokens that have a relatively stable 1:1 exchange rate. This means its solution is predominantly designed for stablecoins, although they recently launched support for token pairs with a stable exchange such as wrapped versions of Bitcoin (renBTC and wBTC).
Bancor V2 expands this low-slippage model to volatile assets through a similar mechanism that dynamically updates the pool’s reserve weights to hold the value of reserves at a 1:1 ratio. Liquidity can be amplified within common price regions, while preserving crucial incentives for arbitrageurs to re-balance the pool.
Mitigating Impermanent Loss
Bancor aims to be the first to solve the problem of impermanent loss on volatile tokens in their upcoming V2 release. Bancor V2 mitigates the risk of Impermanent loss through the usage of pegged liquidity reserves, which hold the relative value of its AMM reserves constant. Until recently, this was done exclusively with mirror-asset pairs that maintain a constant 1:1 price ratio. But Bancor V2 uses Chainlink oracles to expand this concept to assets with variable exchange rates. Such a solution would be a major breakthrough for utilizing non-stablecoin digital assets in AMMs as the risk for liquidity providers is reduced.
By using Chainlink oracles, Bancor V2 pools are able to maintain accurate exchange rates, even when the pricing of tokens diverges as a result of external market price changes. Instead of arbitrageurs fixing the exchange rate, the oracle provides price updates that adjust the AMM’s weights so the internal exchange rate matches the external market price. The benefit from this is that arbitrageurs are no longer siphoning value from liquidity providers in the form of impermanent loss.
Instead, arbitrageurs are only needed to balance the token distributions in the AMM pools in response to token trades. Bancor V2 always encourages a return to balance since liquidity providers to a reserve with lower weighting earn a higher ROI until the pool returns to 50/50 weights. Overall, users and token teams alike can feel more confident about their deposited liquidity generating profits from trading fees and not losing value through regular market movements.
Uniswap V2 allows any ERC20 token to be pooled with any other ERC20 token, eliminating the requirement that liquidity providers be exposed to ETH. This gives liquidity providers the flexibility to maintain a more diverse combination of ERC20 token positions and create more potential pool combinations for trades to pull liquidity from.
Bancor V2 takes this a step further by enabling liquidity providers to maintain exposure to a single token, removing the two-sided liquidity deposit requirement. By pegging liquidity reserves via Chainlink oracles, users can maintain exposure to any token in the AMM ranging from 100% exposure to any ERC20 token, 100% exposure to BNT, or any distribution between the two. This is ideal for cryptocurrency investors wanting to keep full exposure to their preferred assets, especially when combined with mitigation of impermanent loss. This is likely to attract token teams and investment funds wanting to provide low risk liquidity on an AMM without needing to purchase additional reserves.
AMM Innovation into the Future
From Bancor to Uniswap to Curve and more, AMM technologies are providing new primitives for accessing immediate liquidity for any digital asset. Not only do AMMs create price action in previously illiquid markets, but it does so in a highly secure, globally accessible, and non-custodial manner.
While AMMs have already experienced impressive growth, the innovations around greater capital efficiency, multi-asset pools, and mitigating impermanent loss provide the necessary infrastructure to attract much larger liquidity providers from traditional markets. With capital being more customizable and better utilized with less downside risk, DeFi is primed for a major capital infusion. We’re excited to work with Bancor on solving some of the most important issues in AMMs and look forward to continued innovation into the future.