What Are Automated Market Makers (AMMs)?

Updated May 17, 2022

What is an automated market maker? Automated market makers (AMMs) are a type of decentralized exchange (DEX) that use algorithmic “money robots” to make it easy for individual traders to buy and sell crypto assets. Instead of trading directly with other people as with a traditional order book, users trade directly through the AMM. 

Market makers are entities tasked with providing liquidity for a tradable asset on an exchange that may otherwise be illiquid. Market makers do this by buying and selling assets from their own accounts with the goal of making a profit, often from the spread—the gap between the highest buy offer and lowest sell offer. Their trading activity creates liquidity, lowering the price impact of larger trades.

While other types of decentralized exchange (DEX) designs exist, AMM-based DEXs have become extremely popular, providing deep liquidity for a wide range of digital tokens. 

What Are Liquidity Pools and Liquidity Providers?

Underpinning AMMs are liquidity pools, a crowdsourced collection of crypto assets that the AMM uses to trade with people buying or selling one of these assets. The users that deposit their assets to the pools are known as liquidity providers (LPs). 

Liquidity is essential for AMMs to function properly. If an AMM doesn’t have a sufficient liquidity pool, it can create a large price impact when traders buy and sell assets on the DeFi AMM, leading to capital inefficiency and impermanent loss. To incentivize liquidity providers to deposit their crypto assets to the protocol, AMMs reward them with a fraction of the fees generated on the AMM, usually distributed as LP tokens. The practice of depositing assets to earn rewards is known as yield farming

The prices of assets on an AMM automatically change depending on the demand. For example, a liquidity pool could hold ten million dollars of ETH and ten million dollars of USDC. A trader could then swap 500k dollars worth of their own USDC for ETH, which would raise the price of ETH on the AMM.

What Are the Different Automated Market Maker (AMM) Models?  

Constant function market makers (CFMMs), such as constant product market makers, constant sum market makers, and constant mean market makers, are a class of first-generation AMMs made popular by protocols like Bancor, Curve, and Uniswap. 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 that any trader can use for token swap liquidity. Users trade against the smart contract (pooled assets) as opposed to directly with a counterparty as in order book exchanges.

Constant Product Market Maker (CPMM)

The first type of CFMM to emerge was the constant product market maker (CPMM), which was popularized by the first AMM-based DEX, Bancor. 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, which approach infinity at both ends.

A visualization of a Constant Product Market Maker; source: Dmitriy Berenzon 
A visualization of a constant product market maker; source: Dmitriy Berenzon

Constant Sum Market Maker (CSMM)

The second type is a constant sum market maker (CSMM), which is ideal for zero-price-impact trades but does not provide infinite liquidity. CSMMs follow the formula x+y=k, which creates 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, leaving all of the liquidity residing in just one of the assets and therefore leaving no more liquidity for traders. Because of this, CSMM is a model rarely used by AMMs.

A visualization of a Constant Sum Market Maker; source: Dmitriy Berenzon 
A visualization of a constant sum market maker; source: Dmitriy Berenzon

Constant Mean Market Maker (CMMM)

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.

Problems of First-Generation AMM Models

Many of first-generation AMMs are limited by impermanent loss and low capital efficiency, which impacts both liquidity providers and traders.

Impermanent Loss

Impermanent loss is 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, they require an arbitrageur 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.

Low Capital Efficiency

Traditional AMM designs require large amounts of liquidity to achieve the same level of price impact 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 price impact experienced.

In this situation, 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 the price points at which 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.

 

Improving AMM Models With Hybrid, Dynamic, Proactive, and Virtual Solutions

The above limitations are being overcome by innovative projects with new design patterns, such as hybrid automated market makers, dynamic automated market makers, proactive market makers, and virtual automated market makers.

Hybrid CFMMs

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 impact for traders.

For example, Curve AMMs—known as the stableswap invariant—combine both a CPMM and CSMM using an advanced formula to create denser pockets of liquidity that bring down price impact within a given range of trades. The result is a hyperbola (blue line) that returns a linear exchange rate for large parts of the price curve and exponential prices when exchange rates near the outer bounds.

Curve Whitepaper
Source: Curve whitepaper‌‌

Hybrid CFMMs enable extremely low price impact trades by using an exchange rate curve that is mostly linear and becomes parabolic only once the liquidity pool is pushed to its limits. Liquidity providers earn more in 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-price-impact swaps between tokens that have a relatively stable 1:1 exchange rate. This means its solution is predominantly designed for stablecoins. However, Curve has also recently launched support for more volatile token pairs with similarly concentrated liquidity.

Dynamic Automated Market Maker (DAMM)

Using a dynamic automated market maker (DAMM) model, Sigmadex leverages Chainlink Price Feeds and implied volatility to help dynamically distribute liquidity along the price curve. By incorporating multiple dynamic variables into its algorithm, it can create a more robust market maker that adapts to changing market conditions. During periods of low volatility, Sigmadex can concentrate liquidity near the market price and increase capital efficiency, and then expand it during periods of high volatility to help protect traders from impairment loss.

Proactive Market Maker (PMM)

Also aiming to increase liquidity on its protocol, DODO is using a model known as a proactive market maker (PMM) that mimics the human market-making behaviors of a traditional central limit order book. The protocol uses globally accurate market prices from Chainlink Price Feeds to proactively move the price curve of each asset in response to market changes, increasing the liquidity near the current market price. Ultimately, this facilitates more efficient trading and reduces the impairment loss for liquidity providers. 

Virtual Automated Market Makers (vAMM) 

Virtual automated market makers (vAMMs) such as Perpetual Protocol minimize price impact, mitigate impermanent loss, and enable single token exposure for synthetic assets. vAMMs use the same x*y=k constant product formula as CPMMs, but instead of relying on a liquidity pool, traders deposit collateral to a smart contract. By trading synthetic assets rather than the underlying asset, users can gain exposure to the price movements of a wide variety of crypto assets in a highly efficient manner. However, users holding an open position in a synthetic asset are at risk of having their collateral liquidated if the price moves against them. 

Chainlink Oracles Are Powering AMM Innovation

Chainlink Price Feeds already underpin much of the DeFi economy and play a key role in helping AMMs accurately set asset prices and increase the liquidity available to traders. Now, Chainlink Keepers are beginning to play a major role by enabling smart contracts to be automated in a decentralized and highly secure manner. For example, Bancor 3 has integrated Chainlink Keepers to help support its auto-compounding feature. 

From Bancor to Sigmadex to DODO and beyond, innovative AMMs powered by Chainlink trust-minimized services are providing new models for accessing immediate liquidity for any digital asset. Not only do AMMs powered by Chainlink help create price action in previously illiquid markets, but they do so in a highly secure, globally accessible, and non-custodial manner.

To learn more about Chainlink, visit chain.link, explore the docs, and follow @chainlink on Twitter.