Automated market makers (AMMs) are a form of decentralized cryptocurrency trading platform that uses smart contracts to enable token swaps and value exchange. Unlike centralized exchanges, this process doesn't rely on order books to determine asset prices. Instead, it uses a mathematical formula to determine prices based on the asset's supply and demand curve.
AMMs are a popular feature in the decentralized finance (DeFi) industry due to a number of benefits. They're more accessible, less expensive, and far more efficient than traditional cryptocurrency platforms. This has seen the concept gain major traction as more investors seek to transact in a stable and sanction-free environment.
This article will discuss what AMMs entail and its role in the burgeoning DeFi market.
What is market making?
Market making is a common practice in the traditional financial landscape.
It's a trading strategy where a firm or individual acts as a stop-gap solution for the buying and selling of an asset.
The market maker is often tasked with providing liquidity for an asset and securing consistent interest from buyers and sellers for the said asset. The firm or individual provides bid and ask prices in relation to the market size of the underlying asset.
In return, the market maker gains from the difference between the bid and ask spreads. They also earn income from charges levied on providing liquidity and executing these market orders.
What Is an automated market maker (AMM)?
An AMM is a type of market maker that relies on smart contracts. These smart contracts self-execute buy and sell orders based on preset commands without requiring the presence of a third party. AMMs are most prevalent on decentralized exchanges (DEX) and other peer-to-peer (P2P) decentralized applications (DApps) running on blockchain networks. This makes them easily accessible as anyone can buy and sell cryptocurrencies without an intermediary since they are distributed operations.
Automated market makers work with liquidity pools, which are essentially crowdsourced funds for each trading pair. They allow for the provision of liquidity for both sides of the market. Typical examples of AMMs are Uniswap and PancakeSwap.
As assets are bought and sold, smart contracts automatically adjust the pool’s asset ratio to maintain price equilibrium. This way, assets in each pool are readily available. This allows trades to be continuously carried out on the AMM protocol.
Instead of using an order book to determine the price of an asset, AMMs rely on mathematical algorithms. This way, the price for each asset is calculated using a preset formula. The most prevalent formula used by most AMM protocols is x * y = k, where x represents the supply of asset A, while y represents the supply for asset B. K is the constant factor and reflects the total liquidity available in the pool.
How do AMMs work?
AMMs function similarly to order books on centralized exchanges. They allow the trading of two pairs of assets, for instance, ETH/USDC. However, it operates without the need for a counterparty, as the AMM protocol enables the trade on behalf of the traders using smart contracts.
This decentralized trading practice operates by offering liquidity pools made up of two cryptocurrencies. The pools use predetermined mathematical algorithms to fix the price for each asset relative to the other.
When you start a trade, the funds are sent to the relevant pool. Then, the mathematical algorithm calculates the asset price based on the number of tokens in the pool. To make sure each asset has enough liquidity, the algorithm automatically adjusts the ratio of the crypto assets in the pool relative to the trade size, which impacts each asset's price. This makes sure the underlying assets are equal in value with enough liquidity.
AMMs charge a small fee for every transaction, but it's often a fraction of the trade. The generated funds are then shared among all liquidity providers in that pool.
What Is a liquidity pool?
A liquidity pool is a smart contract-powered financial tool that provides liquidity for the trading of cryptocurrencies.
Put simply, liquidity pools allow traders to delegate their digital assets to a smart contract, which is ultimately used to facilitate orders in exchange for a portion of the trading fees.
One of the benefits of using liquidity pools is that it doesn't require a buyer and seller to facilitate a trade. This is the norm with centralized exchanges. With liquidity pools, a buyer can enter a buy order for a given price using pre-funded liquidity pools.
Liquidity pools are funded by users who earn a portion of every trading fee. The investors store a liquidity pair of equal values (50:50) in the pool. For instance, if an investor wants to contribute to an ETH/DAI liquidity pool, they have to contribute an equal amount of both ETH and DAI.
The systemic nature of liquidity pools has made them a preferred means for DeFi protocols in enabling automated trading. Liquidity pools are also key in addressing issues of slippage. They stabilize the price of an asset relative to its market size. This makes sure the underlying asset doesn't experience price swings when trading is ongoing.
Mechanism of liquidity provision
The mechanism of providing liquidity on AMM is hinged on two premises. The first is that liquidity-takers pay a fee to liquidity providers for retrieving the underlying asset. Secondly, once liquidity is removed from the pool, the bonding curve creates an automatic transfer of fees taken from the takers and given to the providers.
Role of smart contracts
Smart contracts are key ingredients in operating an AMM. They're basically used in executing instant buy and sell orders in a liquidity pool. Smart contracts can't be interfered with when fulfilling these conditions.
Price discovery mechanisms
Price discovery mechanisms are a key aspect of AMM protocols. The general idea boils down to how these decentralized services gain the required information on price. The mechanisms in force are split into three formats.
The first is ‘an AMM without a priori knowledge’. This determines price by local transactions. AMMs like the constant product market marker (CPMM) of Uniswap V2 or Balancer operate using this system.
The second is ‘an AMM with a priori which operates on the ideology that price = 1. Stableswap AMMs like Curve V1 fall under this category.
The third price discovery mechanism is the one that operates using external inputs from oracles to determine price. An example is DODO AMM protocol.
Pricing algorithm calculation
To ensure slippage is minimized across all liquidity pools, AMM platforms use a pricing algorithm. The most prevalent formula is x * y = k. Where:
X is the amount of an asset in a liquidity pool
Y is the amount of the second asset in the same pool
K is the total amount of liquidity on offer. It's usually a fixed figure.
This formula is the most popular but not the only one used by AMMs. Some, like Curve and Balancer, use a more complicated one. However, at the end of the calculation, the primary aim is to determine a stable price for each asset in that liquidity pool using the smart contract algorithm.
Breaking down the formula gives us a better insight into how this pricing algorithm calculation really works. The end-point is to retain the same value for the total liquidity in a pool. This is achieved by reducing the value of one asset and increasing the other to ensure equilibrium.
For instance, if a user executes a buy order for ETH in a liquidity pool containing ETH/DOT and the volume of ETH shoots up, the liquidity pool will be out of balance. An equivalent buy order for DOT will be placed to balance the overall token liquidity across the board. This causes the total liquidity to remain at par. The price doesn't swing radically, and it cuts down on potential slippage incidents.
Examples of AMM protocols
Following the rapid development of blockchain technology, more financial solutions have focused on decentralizing the financial system. Some top-ranking AMMs include Ethereum-based Uniswap, Sushiswap, Curve, and Balancer. Other notable mentions include Bancor and DODO.
Features of AMMs
AMMs are innately different from their centralized counterparts, even though they both do the same thing. Below, we highlight the key identifying characteristics of these decentralized trading hubs.
Decentralized
The first key feature of AMM is that it is permissionless and operates in a decentralized manner. Due to this, users don't have to interact with any third party before trades are consolidated. Instead, they interact with computer codes or smart contracts through liquidity pools. This way, no centralized entity can decide whether or not one person engages in cryptocurrency trading.
Use of smart contracts
AMM relies heavily on smart contracts. This blockchain technology system allows trades to be executed automatically once preset conditions are met. In essence, smart contracts work on the premise of ‘if and then.’ Once the conditions are fulfilled, the smart contract gives the go-ahead with little to no interference from an outside source.
Non-custodial framework
AMMs are non-custodial, as users are solely responsible for the security of their funds. DEX platforms are usually accessed via crypto wallets, and once the user is done, they can disconnect their wallet. This way, platforms can't store any user’s assets but only processes their transactions using smart contracts.
Secure
AMM protocols are inherently secure due to their decentralized nature. Hence, cyberattacks are difficult to execute due to the distributed system of operating each blockchain node. On the other hand, hackers can easily steal funds from centralized exchanges due to their singular security framework.
Zero price manipulation
With a rigid pricing algorithm in place, it's very difficult to either inflate or deflate the price of an asset in a liquidity pool. This way, AMM platforms always maintain an equal measure of liquidity for each respective pool.
Pros and cons of AMMs
AMM is considered the next phase of the financial landscape due to its appeal to the decentralized economy. While it has its advantages, the nascent technology also has its weaknesses.
Pros
Anyone can become a liquidity provider and earn passive returns
Enables automated trading
Reduces price manipulation
The protocol doesn't deal with intermediaries
It's more secure than a centralized exchange
Cons
Mostly used in the DeFi market
Can be complex for crypto newbies
Fees can be dynamic based on network traffic
AMM vs. order book model
Order books and AMMs are both trading models used in the financial markets. Ordinarily, order books are known for their intermediary interference and management of the order flow. On the other hand, AMM facilitates the trading of crypto assets without the need for a counterparty.
Another key difference between the two is that AMMs incentivize investors to become liquidity providers (LPs) by giving them a portion of every transaction fee. This idea is alien to the order book system, as the centralized exchange keeps all the fees to itself.
Role of AMMs in DeFi
AMM is a huge part of the DeFi market. As a result of its emergence, DeFi cryptocurrency traders can easily access liquidity and earn on the side. What is even more intriguing is that they ensure a more stable pricing environment. They also enable self-custody with a lower barrier to entry.
This makes them a crypto haven and a level playing field for the next generation of investors.
FAQs
What is an AMM?
AMM stands for automated market maker. They're decentralized crypto trading hubs that enable the trading of multiple assets via smart contracts.
What are the types of AMM?
There are several kinds of AMM in existence. One is constant function market makers (CFMMs) – UniSwap belongs here. Others include constant product market maker CPMM), constant sum market maker (CSMM), and constant mean market maker (CMMM).
What's the formula for AMM crypto?
The most common formula is the x * y = k. Here, x stands for the amount of tokens for one asset and y represents the amount of tokens for the second asset. The 'k' represents total liquidity offered across a particular pool. The mathematical formula automatically balances each asset volume to make sure there's a constant even figure.
What's the benefit of an AMM?
AMM comes with multiple advantages. These include low price manipulation, better security, passive income potential, lower barrier of entry, self-custody of assets, and many more
How does AMM liquidity work?
AMM liquidity operates through crowdsourcing cryptocurrencies. This way, traders get to deposit crypto assets into relevant pools to offer liquidity and reduce slippage. In return, liquidity providers are paid a part of the trading fee.
© 2024 OKX. This article may be reproduced or distributed in its entirety, or excerpts of 100 words or less of this article may be used, provided such use is non-commercial. Any reproduction or distribution of the entire article must also prominently state: “This article is © 2024 OKX and is used with permission.” Permitted excerpts must cite to the name of the article and include attribution, for example “Article Name, [author name if applicable], © 2024 OKX.” No derivative works or other uses of this article are permitted.