Technology attributes
Other attributes
An automated market maker (AMM) is a type of decentralized exchange (DEX) protocol that relies on a mathematical formula to price assets. Instead of using an order book like a traditional exchange, assets are priced according to a pricing algorithm. Pricing information often comes from multiple APIs to consistently provide the most accurate cost. Anyone can become a liquidity provider for automated market makers and receive a part of trading commissions. AMMs allow digital assets to be traded without permission and automatically by using liquidity pools rather than a traditional market of buyers and sellers.
These AMMs are built generally to work in the Ethereum blockchain as part of a decentralized finance (DeFi) ecosystem. The technology is decentralized, is developed to be always available for trading, and does not rely on traditional interactions between buyers and sellers.
A market maker facilitates the process of providing liquidity for trading pairs and is used on centralized exchanges in both traditional and blockchain-based exchanges. A centralized exchange oversees the operations of traders and providers in an automated system to ensure trading orders are matched accordingly, such that when Trader A wants to purchase an asset at a given price or exchange rate, it is the centralized exchange's job to match Trader A with Trader B over an agreed price and to make the process as seamless as possible.
In this traditional scheme, when liquidity is low, slippage can occur. Slippage is when the price of an asset at the point of executing a trade shifts considerably before the trade is completed, which often occurs in volatile terrains and trades. To achieve a fluid trading system, centralized exchanges rely on professional traders or financial institutions to provide liquidity for any trading pair. To achieve this, entities create bid-ask orders in multiple to match orders of retail traders, to allow the exchanges to ensure their counterparties make pairs available for trades. In this system, liquidity providers take up the role of market makers, and market makers facilitate the processes required to provide liquidity for trading pairs.
The automated market maker (AMM) works to solve some of the problems with centralized exchanges. Often used in decentralized exchanges (DEXs), AMMs allow DEXs to replace order-matching systems or custodial infrastructures with autonomous protocols. The protocols use smart contracts to define the price of digital assets and to provide liquidity. Using an AMM, an individual trader is not trading against counterparties; instead, they are trading against the liquidity locked inside smart contracts. This means the following, in an AMM:
- Trading pairs normally found on a centralized exchange exist as individual "liquidity pools." For example, if a trader wanted to trade Ether (ETH) for Tether (USDT), the trader would need to find an ETH/USDT liquidity pool on the exchange.
- Instead of using dedicated market makers, anyone can provide liquidity to a "liquidity pool" by depositing both assets represented in the given pool. For example, to be a liquidity provider in the above ETH/USDT liquidity pool, they would need to deposit a certain predetermined ratio of ETH and USDT.
Several early models of 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 popularized by protocols such as Bancor, Curve, and Uniswap. These AMM exchanges are based on a constant function requiring the combined asset reserves of trading pairs to remain unchanged. In non-custodial AMMs, user deposits for trading pairs pooled within a smart contract any trader can use for token swap liquidity. In these automated market maker models, users trade against the smart contract and pooled assets as opposed to directly with a counterpart. However, these early constant function market makers have several complications and limitations, explored below, which have led some projects and developers to design new patterns, such as hybrid market makers, dynamic automated market makers, proactive market makers, and virtual market makers.
The first type of CFMM to emerge was the constant product market maker (CPMM), which was popularized by what some consider the first AMM-based decentralized exchange (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 a given token. According to the formula, when the supply of token x increases, the supply of token y must decrease, and vice versa, to maintain the constant k. When plotted, the result is a hyperbola where liquidity is always available but at increasingly higher prices, which can approach infinity at both ends.
Another type of CFMM is the 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. The CSMM design does allow arbitrageurs to drain one of the reserves if the off-chain reference price between the tokens is not 1:1, and such a situation destroys one side of the liquidity pool and leaves the liquidity residing in one of the assets and therefore leaving no more liquidity for traders. Due to these concerns, the CSMM model is rarely used by AMMs.
Another major type of first-generation AMM model is the constant mean market maker (CMMM), which enables the creation of AMMs that have more than two tokens and can be weighted outside of the standard fifty-fifty distribution. This model has the weighted geometric mean of each reserve remaining constant, which means, for a liquidity pool with three assets, the equation could be (x*y*z)1/3=k. This formula allows for variable exposure to different assets in a pool and enables swaps between any of the pool's assets.
As AMM-based liquidity has developed, newer types of AMMs have emerged, such as 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, also known as stableswap invariants, combine both a CPMM and CSMM using an advanced formula to create denser pockets of liquidity to bring price impacts to a given range of trades. The result is a hyperbola that returns a linear exchange rate for large parts of the price curve and exponential prices when exchange rates near the outer bounds.
Hybrid CFMMs are intended to enable low-price impact trades by using an exchange rate curve that is mostly linear and becomes parabolic only when the liquidity pool is pushed to its limits. Further, liquidity providers can earn more in fees, although often on a lower fee-per-trade basis, because the capital of a liquidity pool is used more efficiently, while arbitrage traders (arbitrageurs) can still profit from rebalancing the pool. The solution, based on its balancing, is predominantly designed for stablecoins but has also been used to support volatile token pairs with similarly concentrated liquidity.
A dynamic automated market maker (DAMM) model can use price feeds (oracles) and implied volatility to help dynamically distribute liquidity along the price curve. By incorporating multiple dynamic variables into its algorithm, the model can create a more robust market maker adapting into its algorithm, which creates a more robust market maker capable of adapting to changing market conditions. During periods of low volatility, the model can concentrate liquidity near the market price and increase capital efficiency, which can further expand during periods of high volatility to help protect traders from impairment loss.
Aiming to increase liquidity in protocols, another model has been developed called the proactive market maker (PMM), which can mimic the human market-making behavior of a traditional central limit order book. The protocol uses accurate market prices from an oracle to proactively move the price curve of an asset in response to market changes, increasing the liquidity near the current market price, which works to facilitate efficient trading and reduces the impairment loss for liquidity providers.
Virtual automated market makers (vAMMs) are developed to minimize price impact, mitigate impermanent loss, and enable single token exposure for synthetic assets. The vAMMs use the same x*y=k constant product formula as CPMMs, but rather than relying on a liquidity pool, traders deposit collateral to a smart contract and trade synthetic assets instead of the underlying asset to give users exposure to the price movement of a variety of cryptocurrency assets in an 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.
To make sure the ratio of assets in liquidity pools remains as balanced as possible and to eliminate discrepancies in the pricing of pooled assets, AMMs use preset mathematical equations. One of the most common such equations is x*y=k. This equation sets the mathematical relationship between the assets in the liquidity pools. In this equation, x represents the value of Asset A, y represents the value of Asset B, and k remains constant. This means the price of Asset A multiplied by the price of Asset B must always equal the same number.
This means when orders are placed in AMMs and a sizeable amount of token is removed or added to a pool, discrepancies can be created between the asset's price in the pool and the market price—which is reflected in the price the same pair is traded at on multiple exchanges—making the price of Asset A different than what the rest of the market shows it as, either higher or lower, depending on if a lot of Asset A has either been added to or taken from the liquidity pool. This effect is known as slippage, which can occur when the liquidity is not great enough in the liquidity pool to cover large trades. AMMs can be susceptible to slippage because the price-adjusting algorithms are based on the ratio between the assets in a liquidity pool.
When this occurs, it creates an arbitrage opportunity. Arbitrage trading is a strategy that involves finding differences between the price of an asset on multiple exchanges, buying it on the platform where it is slightly cheaper and selling it on the platform where it is slightly higher. With AMMs, arbitrage traders are financially incentivized to find assets trading a discount in a liquidity pool and buy them up until the asset's price returns to its market price.
For the liquidity pools in the AMMs to work, the pools require liquidity providers (LPs). Pools that are not sufficiently funded are far more susceptible to slippages, and to mitigate slippages, AMMs tend to encourage users to deposit appropriate digital assets in liquidity pools so users can trade against these funds. In order to incentivize users to deposit their digital assets in a liquidity pool, a fraction of fees paid on transactions executed on the pool are provided to the liquidity providers.
This often means if an LP's deposit represents 1 percent of the liquidity locked in a pool, the LP will receive an LP token that represents 1 percent of the accrued transaction fees of that pool. When an LP wishes to exit from a pool, they redeem the LP token and receive their share of transaction fees. Further, some AMMs issue governance tokens to LPs and traders, which allows the LPs to have voting rights on issues related to the governance and development of the AMM protocol.
Apart from the incentives offered to LPs to incentivize them to stake their digital assets in liquidity pools, LPs can also capitalize on yield farming opportunities that allow them to increase their earnings. In this case, the LP deposits the appropriate ratio of digital assets in a liquidity pool on an AMM protocol, and once the deposit has been confirmed, the LP receives its tokens, which in some cases can be deposited into a separate lending protocol to earn extra interest. In this way, LPs can maximize earnings in DeFi protocols, although the user will have to withdraw the LP token before they can withdraw their funds from the initial liquidity pool.
One of the risks associated with liquidity pools is impermanent loss. This occurs when price ratios of pooled assets fluctuate, and an LP will automatically incur losses when the price ratio of a given pooled asset deviates from the price at which the funds were deposited. The higher the shift in price, the higher the loss. This is common in pools that contain volatile digital assets. However, it is called impermanent loss because the probability is high that the price ratio will revert. The loss only becomes permanent when the LP withdraws the said funds before the price ratio reverts. Further, some potential earnings from partaking in a liquidity pool can sometimes cover impermanent losses when or if they become permanent.
One trend in AMM development has revolved around concentrated liquidity. This feature is designed specifically to make the price-adjusting mechanism more efficient, minimize slippage, and allow liquidity providers to earn higher fees. Concentrated liquidity is developed to allow LPs to allocate assets to specific price ranges, which means by combining multiple concentrated liquidity positions, LPs are able to create individual price curves that are customized to their preference. This also allows LPs to earn trading fees against the liquidity provided at specific ranges than the total pool liquidity.
Traditional AMM designs require large amounts of liquidity to achieve a similar level of price impact as a book-based exchange. This is due to the substantial portion of AMM liquidity that is only made available when the pricing curve begins to turn exponential. Because of this, most liquidity will not be used by rational traders due to the price impact the trader would experience during a trade using that liquidity. Further, AMMs and liquidity providers do not have control over which price points are offered to traders, due to their algorithmic pricing. This has led some people to refer to AMMs as "lazy liquidity" that is underutilized and poorly provisioned. However, traditional market makers based on order books allow exchanges to control the price points at which they want to buy and sell tokens, leading to higher capital efficiency, with the trade-off of requiring active participation and oversight of liquidity provisioning.
Another concern with AMMs, despite their comparative advantages over centralized exchanges, such as greater security and opportunities for community building, is the phenomenon of front-running. Front-running occurs when one user places a similar trade as a prospective buyer but sells it immediately after. Because the transactions are public, and the buyer has to wait until they can get added to the blockchain, others can view the buy and place bids. Front runners are not trying to execute a trade; rather, they are simply identifying transactions and bidding on the transaction to drive the price up so that they can sell back and earn a profit. And by "sandwiching" the original bid from a buyer with a new bid, the speculator is capable of extracting value from the transaction. Often, in practice, miners are the catalysts behind front-running, which led to the term "miner extractable value" (MEV), which refers to the rents a third party can extract from the original transaction. Also known as sandwich attacks, these have been largely automated and implemented by bots, which account for the bulk of MEV.
In a paper, Andreas Park, a professor of finance at the University of Toronto, suggested that the intrinsic transparency of blockchain operations creates a challenge in which an attacker may "sandwich" any trade by submitting a transaction that can be processed before the original one, and that the attack reverses after. Further, these attacks, according to professor Park, can be driven by an incentive problem inherent to second-generation blockchains, in which validators may not have sufficiently strong incentives to monitor private pools because it reduces their MEV, and the execution risk for users joining private pools increases.
AMMs as a mechanism have enabled peer-to-peer trading because they can instantly settle transactions after they are confirmed and included on the blockchain, and the mechanism allows any user to contribute liquidity and any buyer to trade tokens. However, AMMs have relied on expectations of future growth to drive their valuations; the revenue from transaction fees in AMMs is relatively small and linked to the liquidity providers rather than the exchange. This means, especially as APRs from trade fees might be low in AMMs, DEXs rely on governance token offerings for greater incentives, requiring a high price valuation to onboard and retain liquidity providers. These providers can often be "mercenary capital," known as such for going where short-run returns are higher. Further, anomalous and surprising events, known as black swan events, and market volatility can further damage AMMs, sometimes beyond repair. These events can lead to a liquidity freeze. However, partially because AMMs do not produce revenue as a function of their business model, they are almost a public good in the DeFi community, rather than a profit driver.
Some concerns around AMMs, such as front-running, occur because pending transactions are generally visible, which allows a bot to detect it, pay a higher gas fee, and miners can impact market pricing. One way to avoid this is to hide the transactions, use zero-knowledge proofs and other privacy-preserving solutions, which can become increasingly popular because they are thought to minimize some attacks, such as front-running, by disguising the size and time of transactions that are submitted and verified.
Another attempt to remove the AMM from the reliance on external liquidity providers has seen some DEX developers grow their own treasury of protocol-owned liquidity, which can codify buy-pressure through the inflation of the assets that it supports. Instead of giving all of the trading fees to the liquidity providers, the DAO controls the revenue.
One challenge to AMMs remains, and that is, despite their necessity to the expansion of the DeFi community, there have been concerns that there may be a lack of sustainability for DEXs and AMMs in the long run because there is not enough demand for different tokens. The value of the token in any AMM comes down to the value of the community, which can require a core team to lead and direct traffic but need to apply best practices from a business perspective to create sustainability and find the scalability organizations require to succeed.