Exploring crypto can be tough, with traditional exchanges often charging high fees despite slow processes. This complexity frustrates users and limits access to liquidity. Automated market makers (AMMs) solve this by using smart contracts to automate transactions on decentralized exchanges, making DeFi more accessible and efficient for everyone.
In the subsequent sections, we review the entire AMM premise, looking at its diverse components, simplifying the modus operandi, and covering real-world applications.
KEY TAKEAWAYS
•Automated market makers (AMMs) eliminate the need for intermediaries, allowing for direct, trustless transactions on decentralized exchanges.
•AMMs use specific mathematical formulas to determine prices and manage liquidity, ensuring efficient trading and liquidity provision.
•AMMs are not just for trading — they also support yield farming, arbitrage opportunities, and cross-chain asset swaps, making them handy tools in the DeFi ecosystem.
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 makes 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.
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 making AMM-specific transactions. This involves gas fees, which are 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
Where,
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.
The example
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 regarding 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:
Virtual AMMs
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.
Probabilistic AMMs
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 AMMs
Hybrid automated market makers are capable of changing their operating principles 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.
Dynamic AMMs
These automated market makers, per their name, change the ecosystem parameters in response to market conditions. 1inch is an example of this.
NFT AMMs
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.
Lending AMMs
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.
Insurance 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.
Option AMMs
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.
Prediction AMMs
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.
Liquidity-as-a-service AMMs
These AMMs are good at aggregative liquidity from diverse DeFi protocols. 1inch offers liquidity-as-a-service as part of its AMM offering.
Synthetic AMMs
If you wish to trade synthetic assets that represent real-world assets like stocks or even gold, you can consider Synthetic AMMs like Synthetix.
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, emerging in 2018. Built on Ethereum, Uniswap is powered by smart contracts and automates the process of market making. Since 2018, significant developments have happened in the AMM space, especially regarding liquidity provisioning, price discovery, and handling risks like impermanent loss.
Yet, the crypto community desires a lot more.
“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:
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.
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.
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.
Here is a detailed thread that captures the concept of AMMs.
Applications in DeFi
If you are planning to explore AMMs further, here are a few DeFi-specific applications that you must keep in mind:
Yield farming
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.
Liquidity provision
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 to generate 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 to incentivize 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.
Arbitrage trading
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 specific to the fact we are dealing with an ETH/USDT pool.
Now, if the pool’s supply of ETH is higher 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 gives rise to an arbitrage trading opportunity.
Loss management
Impermanent loss is a unique issue that plagues most market makers.
This is 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, 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.
Automated trading
AMMs eliminate the need for traditional market markers and order books, enabling P2P and automated trades. Order size and middlemen issues aren’t encountered as smart contracts govern the entire trading scenario.
Price oracle
Some AMMs like Uniswap serve as decentralized price oracles, allowing other DeFi protocols to access real-time price-based info.
Cross-chain trading
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.
Asset creation
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.
The market making space has matured significantly, with newer protocols like Uniswap V4 and Curve V2 leading the market. Also, ZK-Rollups and Optimistic Rollups have become the go-to scaling solutions, with many AMMs transitioning to these rollups for improved efficiency and lower costs.
What are the benefits and risks of AMMs?
Here is a quick list of benefits and risks that capture the true essence of automated market makers:
Benefits | Risks |
Permissionless: No need for intermediaries or centralized control. | Impermanent loss: Risk of assets losing value within the pool. |
No order book complications: Automated price discovery and trading. | Smart contract vulnerabilities: Potential security issues in code. |
Rewards for liquidity providers: Earn fees and incentives for providing liquidity. | High gas fees: Transactions can be costly, especially on congested networks. |
Transparency: Operate on open-source smart contracts with clear rules. | Regulatory risks: Increasing scrutiny from regulators worldwide. |
Price efficiency: Ensures proper price discovery through mathematical equations. | Low liquidity risks: Can lead to slippage and higher trading costs |
Interoperability: Supports cross-chain interactions and trading. | Volatility risks: Crypto market volatility can impact pool values. |
Next-gen AMMs?
AMMs like Velodrome and Radiant Capital have set new industry standards by introducing novel mechanisms such as dynamic fees and intuitive liquidity incentives. Additionally, the rise of DeFi 3.0 has led to the development of more sustainable and capital-efficient AMMs, focusing on reducing risks like impermanent loss. Some AMMs are now incorporating AI-driven algorithms to optimize liquidity pools and improve trading outcomes, representing the cutting edge of decentralized finance.
The path ahead for AMMs
Automated market makers are transforming DeFi by infusing liquidity into the ecosystem, simplifying crypto trading. They also enable arbitrage trading, yield farming, and more. Although their full potential remains untapped, AMMs are poised to drive innovation in DeFi, including new financial assets and enhanced DEXs. With NFT and virtual market makers already emerging, the future will see AMMs expand further into areas like lending, insurance, and real assets.
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?
Disclaimer
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. Please note that our Terms and Conditions, Privacy Policy, and Disclaimers have been updated.