Over the past few years, many innovative financial tools have graced the decentralized crypto space. Yet, only some are as innovative as an AMM. Unabbreviated as the automated market maker, AMMs ensure trustless transactions and trades across decentralized exchanges (DEXs), focusing on democratizing finance.
As a technology, an automated market maker involves smart contracts, ensuring that trade facilitation is handled by code and not by humans. Simply put, it orchestrates a harmony in the DeFi space, where price discovery, trades, transactions, token swaps, and other components move in sync with each other. Powered by blockchain technology and suitable for the financial crypto markets, an AMM has several components running the behind the curtains.
In the subsequent sections, we review the entire AMM premise, looking at its diverse components, simplifying the modus operandi, and even covering real-world applications.
The history of AMMs
Long before AMMs or even DEXs were around, trades across traditional markets were facilitated by the order book system. You can consider the order book as a diary that records the interest of buyers and sellers for a given asset.
These legacy market makers provided liquidity to traditional markets, profiting from bid-ask price spread. For the unversed, the price spread signifies the difference between what is being asked by the seller and what is being paid by the buyer. These market makers buy low and sell high, offering assets to either category of trade participants for a small profit.
While traditional market makers are still useful across other high-beta assets like equities, they do not work that well across crypto markets. Crypto markets are highly volatile, and liquidity is often an issue, especially for the more elusive token pairs.
The rise of AMMs
AMMs emerged officially in 2017 with Bancor. However, Uniswap made AMMs popular, surfacing in 2018. Built on Ethereum, Uniswap is powered by smart contracts and automates the process of market making. Since 2018, many things have happened in the AMM space, especially regarding liquidity provisioning, price discovery, and handling risks like impermanent loss.
Yet, a lot more is desired by the crypto community.
“I want more crypto projects that try to disrupt popular web2 apps using crypto superpowers to discover new use cases rather than building marginal improvements on the few existing use cases (AMMs, lending, etc.).”Hayden Adams (hayden.eth) creator of the Uniswap Protocol: Twitter
However, Hayden’s take is not a unanimous perspective and did face some backlash from the Twitter community:
Post UniSwap, several AMM-powered DEXs like PancakeSwap and SushiSwap have also surfaced. New and improved automated market maker models, like Probabilistic AMMs, Constant Product AMMs, and more, have come to the fore, with new possibilities for the DeFi space. And in 2023, even layer-2 solutions like Polygon have started deploying AMMs, in the form of UniSwap V3, with a focus on lowering the crypto trading fees.
Understanding automated market makers: the concept
A simple way of looking at an AMM is to consider a specialized DEX protocol. Governing the protocol is a mathematical algorithm, pricing each asset and governing how it moves within the DeFi space.
You can think of an automated market maker as an engine fuelling the operations of the DEX in sight. Let us understand this a bit better with a traditional way of defining things.
Here is a detailed thread that captures the concept of AMMs.
What is an automated market maker (AMM)?
An automated market maker doesn’t depend on buy-sell orders like a traditional order book-led exchange. Instead, it relies on liquidity pools. A set of these pools make an automated market maker, with each pool filled with a wide range of tokens for facilitating trades. The number of tokens in a given pool determines the price of the trade.
Here is a quick example to understand this better:
Imagine there is a fish market where the prices of fish fluctuate depending on demand and supply. If a higher number of a particular fish floods the market, the supply increases, pushing the prices down. If the supply turns scarce, the price surges. AMMs operate similarly, with the concept of price discovery dependent on the supply-demand mechanics.
Unlike traditional order books, where humans handle the buying and selling, AMMs support automated trading with liquidity providers, DeFi users, and more intertwined with smart contracts.
How does AMM work?
Here is another example to understand how an automated market maker works:
Imagine there is a self-functioning car wash where you select the washing service, pay for it right into the machines, and sit back while the machine takes care of the work. As for an automated market maker, paying into the machines is synonymous with depositing a token in a DEX or a standalone liquidity pool.
The services returned by the car wash are synonymous with the swapped tokens, which a specific liquidity pool of the concerned AMM gives in return for the deposits.
As liquidity providers manage the liquidity pools by offering specific quantities of tokens, one smart contract-powered arm of the automated market maker is concerned with incentivizing them by giving the provider a portion of the crypto trading fees. Note that every liquidity pool or even DEX works as a crypto trading platform, and users must pay trading fees to access the services. A portion of these trading fees is given to the liquidity providers. What portion goes where is decided by the AMM smart contracts.
The role of gas fees
Another component is involved when it comes to making AMM-specific transactions. This involves the gas fees — more like the fuel users must pay for using the blockchain technology associated with a given ecosystem. Notably, the gas fee isn’t a direct function of the AMM’s smart contract and is determined by the blockchain itself.
To sum it up, here are the activities that a typical automated market maker handles as part of an end-to-end DeFi protocol:
- Facilitating token swaps using trading pairs
- Helping with price discovery by trading supply-demand
- Allocating crypto trading fees to the liquidity providers
- Managing liquidity provisioning across pools
- Managing impermanent loss by putting certain conditions in smart contracts
- Enabling yield farming conditions
- Interacting with other protocols
As seen, AMMs are in charge of considerably more than just handling trades and swaps.
The mathematics behind AMM
Let us now look at a pretty simple formula for an automated market maker and implement the same practically:
The standard formula for an AMM remains:
x* y = k
x represents the amount of asset A, y represents the amount of asset B, and K is the AMM-defined constant.
As in any liquidity pool, two tokens (A and B) are involved; we consider the token swaps as trading pair swaps.
It is worth noting that the K needs to be constant. There if the amount of X changes within the pool, the amount of Y will also need to change in a specific ratio to ensure that the K remains the same. Let us take the DAI/WBTC example here.
Did you know? The mathematical base of how an AMM operates dates back to 1996. Professor Othmar M. Lehner proposed a model for the market maker in his detailed dissertation on “Forecasting and Hedging in the Currency Market.”
Suppose a DAI/WBTC pool has 10,000 DAI and 10 WBTC, making the constant 10,000 x 10 = 100,000.
Now if a person withdraws 1 WBTC from the pool, changing the Y, the value of X will also change per the k/y ratio. Therefore, the new amount of DAI that should be present within the pool is 100,000/9 = 1,111.11.
Therefore, a trader who wants to withdraw 1 WBTC should deposit 1,111.11 DAI tokens into the pool. Another way of looking at it is equating 1 WBTC (pool-specific) price to 1,111.11 DAI tokens. This is how an AMM works, especially in regard to liquidity provision and token swaps.
Note that while x * y = k is the standard formula, different AMMs have different versions to justify pool health. For instance, Balance follows a weighted approach with k = (balance 1 / weight 1) * (balance 2 / weight 2)…… * (balance n / weight n).
Curve Finance follows D = A * S + S^N / N^N as the go-to formula where D is the constant, S is the sum of all reserves, A is the special coefficient meant for amplification, and N is the number of pool-specific assets.
Even the likes of Uniswap V3 and Bancor have specific mathematical calculations backing their algorithms.
What are the different Types of AMM?
Automated market makers can vary depending on the algorithms they use and the purpose they serve. Here are the different types to be aware of:
These are automated market makers without any actual assets in pools. Instead, all there is a mathematical model governing the prices. These market makers can be complex. One such example would be Perpetual Protocol, where event outcomes are traded.
Another way of looking at virtual AMMs is to consider them loaded with virtual balances to lower the impact of large trades. Bancor’s V2 is an example of where virtual balances are used.
These AMMs use probabilistic mathematical formulas to govern the price of the trades. These are smart contract-led AMMs where complex mathematical models are used. These AMMs can serve as benchmarks for other AMMs which require assistance with proprietary formulas. Tokemak is one such example of a probabilistic AMM.
Constant product AMMs
These are the most common form of AMMs, usually represented by the x * y = k formula. In these AMMs, if the price of one asset goes up due to lower supply, the other asset’s price must go down to maintain balance. Uniswap is an example of a constant product AMM.
Uniswap has recently launched the UniswapX protocol — a better way to trade across AMMs, offering improved liquidity, zero transaction failure, and even gas-free swapping. This is set to take the concept of constant product AMMs to a whole new level.
Hybrid automated market makers are capable of changing their operating principle based on scenarios. They can work as constant product AMMs for standard trades, but when the price of an asset becomes way too volatile, driving the risks of liquidations, they can turn into probabilistic AMMs. Balancer works as a hybrid AMM.
Weighted average price AMMs
The operating principle of these AMMs relies on a special formula where the price of an asset is represented by the amount of both the assets in the pool and not just one asset. One such example is Curve Finance, a platform used to trade stablecoins.
Custom mean AMMs
There is a custom mean formula governing the price of assets within these automated market makers. This way, it is possible to customize the price of assets to meet specific AMM requirements. Notional is an example of a custom mean AMM.
These automated market makers, per their name, change the ecosystem parameters in response to market conditions. 1inch is an example of this.
These are specialized market makers meant to simplify NFT trades. These AMMs are meant to infuse liquidity into the otherwise illiquid NFT space. NFTX is an example of such an NFT AMM.
SeaCows is yet another project that aims to ramp up NFT liquidity by making NFTFi more accessible to people.
These AMMs, at their core, are meant to facilitate lending and borrowing. Users supply or deposit assets into pools, earning interest in the process. On the other hand, borrowers can loan out assets at pre-determined interest rates. Aave and Compound are prime examples of lending AMMs.
The pooling nature of assets to ensure the ones that belong to others is at the heart of insurance AMMs. Nexus Mutual is one example of this.
Per the name, these AMMs allow options trading, where not the asset but the derivative of the same is used for trading. Opyn is an example of an option AMM.
There are a few AMMs that allow you to trade specific scenarios or even bet on specific event-related outcomes. Augur is one such widely popular prediction AMM.
These AMMs are good at aggregative liquidity from diverse DeFi protocols. 1inch offers liquidity-as-a-service as part of its AMM offering.
If you wish to trade synthetic assets that represent real-world assets like stocks or even gold, you can consider Synthetic AMMs like Synthetix.
Applications in DeFi
If you are planning to explore AMMs further, here are a few DeFi-specific applications that you must keep in mind:
This is where liquidity providers deposit specific assets into pools, earning yields and fees in the process. There are several yield farming platforms in play, including the likes of Compound and SushiSwap.
This leg, or rather the use-case of automated market makers, is at the core of liquidity pools. Liquidity providers provide liquidity, which they build on top of for generating higher yields via yield farming. If you are solely looking at liquidity provisioning as a use case, platforms like Cure Finance and Uniswap are the ones to focus on.
Trading fee incentivization
Another application of automated market makers would be to use the platform for incentivizing liquidity providers. The market maker protocol works as a standard trading interface, with each transaction incurring some kind of trading fee. AMMs have a built-in trading fee-sharing schedule with the liquidity providers, which keeps them interested and incentivized.
Automated market makers also allow you to take arbitrage trading positions as the price of an asset within an AMM’s liquidity pool might vary from the market due to the inclination to adhere to the constant value, k. For example, if you plan to buy ETH, trading at $1,900 on most exchanges, on an AMM, you might have to consider the ETH/USDT balance before moving in.
Note: This is considering we are dealing with an ETH/USDT pool.
Now, if the supply of ETH is higher in the pool due to people buying a lot of USDT for ETH, the price of ETH might be lower than the market’s $1,900. This price difference is what gives rise to an arbitrage trading opportunity.
Impermanent loss is a unique issue that plagues most AMMs.
This concerns when the price of assets supplied by the liquidity providers moves in another direction, pushing them towards liquidation risks. Despite being a source of impermanent loss, AMMs also offer solutions to the same. These can be in the form of probabilistic AMMs with specialized mathematical algorithms in play.
AMMs like Balancer have weightage-specific solutions in place, lowering the price sensitivity and inherent volatility of assets. Then we have Curve Finance, where the pools primarily deal in stablecoins — which are intended to hold steady values.
AMMs eliminate the need for traditional market markers and order books, enabling P2P, automated trades. Order size and middlemen issues aren’t encountered as smart contracts govern the entire trading scenario.
Some AMMs like Uniswap serve as decentralized price oracles, allowing other DeFi protocols to access real-time price-based info.
Several popular cross-chain market makers, like the Synapse Protocol, THORChain, Ren Protocol, and more, allow users to swap tokens across chains. This functionality makes AMMs suitable as cross-chain bridges.
AMMs are also good for asset creation, provided you can locate the right one. The likes of Synthetix can help create synthetic assets by mimicking real-world ones.
What are the benefits of AMMs?
Here is a quick list of benefits, per our discussion, that capture the true essence of automated market makers:
- They are permissionless
- There are no order book-related complications
- They allow liquidity providers to earn rewards
- Highly transparent
- Highly price efficient as they ensure proper price discovery due to constant mathematical equations in play
- Interoperable as AMMs can let you interact cross-chain
The risks of AMMs
Despite the crazy potential, automated market makers do come with their share of risks and challenges. These include:
- Impermanent loss
- Smart contract-related security vulnerabilities
- High gas fees
- Regulatory risks
- Low liquidity risks
- Volatility risks
The path ahead for AMMs
Automated market makers are revolutionizing DeFi. At first glance, they infuse liquidity into the DeFi ecosystem, making it easier for users to buy and sell crypto. Yet, the functionality of AMM’s exceeds this one use case. As seen throughout our discussion, the right AMM can help with arbitrage trading, yield farming, and more.
Still, the potential of AMM remains untapped. Over time, we might see DeFi experts using AMM and related technology to create and trade new financial assets, make the small-cap token space more liquid, and put across more innovative DEXs. And NFT AMMs and virtual AMMs with specialized smart contracts are already making their presence felt. In all, AMMs are venturing seamlessly into lending, insurance, real-asset, and other spaces. It will be interesting to see how far and deep they foray.
Frequently asked questions
What is the full form of AMM?
Who created AMM?
How does an AMM work?
What are the benefits of on-exchange trading?
What does a market maker do in crypto?
What is a virtual AMM?
What is liquidity pool crypto?
What is an NFT AMM?
In line with the Trust Project guidelines, the educational content on this website is offered in good faith and for general information purposes only. BeInCrypto prioritizes providing high-quality information, taking the time to research and create informative content for readers. While partners may reward the company with commissions for placements in articles, these commissions do not influence the unbiased, honest, and helpful content creation process. Any action taken by the reader based on this information is strictly at their own risk.