- Automated market makers (AMM) are protocols that provide liquidity to specific markets through automated algorithmic trading.
- In the context of decentralized cryptocurrency exchanges, automated market makers represent smart contracts that create so-called liquidity pools of tokens, which are automatically traded by an algorithm rather than an order book.
- AMMs determine token prices based on pre-set mathematical formulas. The capital used to fund these liquidity pools is crowdfunded by decentralized exchange users who, in return for providing liquidity, receive a percentage of the fees earned by the protocol.
What is Market Making?
Before we explore how automated market makers work and the functions they serve, we must explain what market making is in the first place.
Simply put, market making is the activity of providing liquidity to a market by simultaneously quoting prices to both buy and sell an asset.
When a user wants to buy a financial asset, say a cryptocurrency like Bitcoin, they must first access a cryptocurrency exchange — where buyers and sellers meet.
A typical centralized cryptocurrency exchange will use an order book and an order matching system to pair buyers with corresponding sellers. The order book is a dynamic, real-time electronic record that maintains and displays all orders to buy or sell a cryptocurrency at different prices at any given point in time. The order matching system is a specialized software protocol that matches and settles the orders recorded on the order book.
Sometimes, if there is a limited number of counterparties to trade with, it may not be possible for the user to fill their Bitcoin order at the exchange. When this happens, we say that the “Bitcoin market is illiquid.”
In this regard, liquidity is an indicator or a measure of the “availability” or the speed at which an asset can be bought or sold without noticeably affecting its price stability.
When a market is illiquid, there aren’t enough available assets or traders within that market. It becomes difficult to execute a trade without significantly affecting the asset’s price on that particular exchange.
In order to guarantee liquidity, centralized exchanges employ professional traders – represented by banks, brokerage houses, and a variety of other financial groups – to continuously provide a “bid-ask spread” on the exchange. In other words, these market makers constantly offer to buy and sell an asset at multiple prices so that users will always have someone to trade against. The process of providing liquidity to the exchange is called market making, and the entities that provide this service are called market makers.
The market maker’s role is to make financial markets more efficient and reduce asset price volatility by providing constant liquidity for the assets.
How Does an Automated Market Maker (AMM) work?
Instead of relying on order books, order matching systems, and institutional market makers, decentralized cryptocurrency exchanges rely on automated market makers or smart contracts that create liquidity pools of tokens and set prices according to mathematical formulas.
Under the hood, when a user makes a trade on an AMM-based decentralized exchange, the smart contract will automatically send the tokens to the liquidity pool and then exchange them for the counterpart token from the pair. The exchange ratio between the tokens is automatically calculated using a mathematical formula. The formula used by Uniswap’s AMM, for example, is x*y=k — where the X and Y represent the amount of each token in the pool, and K is a predefined constant.
Due to the way AMMs work, there will always be some slippage with every trade. As a general rule, however, the more liquidity there is in a pool, the less slippage large orders will incur.
What Are Liquidity Pools?
Liquidity pools are pools of tokens locked in a smart contract used for market making.
Liquidity pools allow users to make transactions directly on the blockchain and seamlessly switch between tokens in a completely decentralized and non-custodial manner.
A typical decentralized exchange will have many liquidity pools, and each pool will contain two different assets tied together as a trading pair. The trading pairs can represent any two tokens as long as they comply with Ethereum’s native ERC20 token standard. The largest liquidity pool on Uniswap is the WBTC/ETH pool, which currently has over $150 million worth of liquidity.
The great thing about AMMs is that anyone can become a market maker and earn a passive income by merely staking cryptocurrency capital. To become a market maker or a liquidity provider (LP) in an AMM, users need to deposit an equivalent value of two tokens in the corresponding pool — for example, $150 worth of ETH and $150 worth of USDC in the USDC/ETH pool.
Once the tokens have been deposited, the users will automatically receive liquidity provider tokens representing their proportional share in that particular liquidity pool and immediately start earning fees from the pool’s trades.
The fees earned by LPs are proportional to their liquidity contribution to the pool. For example, if the LP provides 1/20 of a specific pool’s total liquidity, they’ll earn 1/20 of the fees earned by the protocol.
The rewards or the fees are individually determined by each protocol and vary across different AMMs. Uniswap, for example, applies a 0.3% fee to every trade, while Curve applies a fee of 0.04%.
When the liquidity providers want to stop providing liquidity to the liquidity pool, they simply return the LP tokens to the smart contract and receive the tokens they provided plus their trading fees back.
What is Liquidity Mining?
Liquidity mining, also called “yield farming,” is the act of providing liquidity to decentralized exchanges or other DeFi protocols to receive native governance tokens.
Understanding Defi and Yield Farming: What is Defi?
Aside from earning a portion of the protocol’s fees, the governance tokens represent an additional income source for liquidity providers. The tokens are called governance tokens because they often confer certain rights, such as voting rights on protocol changes or rights to a portion of the protocol’s profits.
Governance or liquidity tokens can often be reinvested into other pools that accept that token. If such a pool also rewards its LPs with yet another token, these can once again be staked as well to maximize yield (hence “yield farming”).
On the exchanges’ side of things, yield farming further incentivizes liquidity providers to provide capital to the exchange’s liquidity pools. More liquidity means more pools and less slippage, attracting more traders and generating even more trading fees for the exchange and the LPs.
What Is Impermanent Loss?
Impermanent loss is the primary and the most common risk experienced by liquidity providers in automated market makers. Impermanent loss is the decrease in token value that users experience by depositing tokens in an AMM versus merely holding them in a wallet over the same time.
Impermanent loss occurs when the market-wide price between the tokens deposited in the AMM diverges in any direction. As a general rule, the bigger the diversion between the tokens’ prices after they’ve been deposited, the more significant the impermanent loss.
Impermanent loss happens because of how the price-setting formulas of AMMs work. Namely, AMM’s can’t automatically adjust the tokens’ exchange rates, which means that arbitrageurs are required to buy the underpriced assets or sell the overpriced assets until the prices offered by the AMM match those of external markets.
The profits obtained by the arbitrage traders come from liquidity providers’ pockets. For LPs, these losses are often greater than the profits earned through the pool’s fees and token rewards combined.
This phenomenon is called “impermanent” loss because as soon as the tokens’ prices within the AMM converge back to their original values, the losses disappear. However, the LPs still get to keep their earned fees and token rewards as profit. That being said, if the LPs withdraw their funds from the AMM at a different price ratio than when they initially deposited them, the losses become very much permanent.
Automated market makers are the powerhouse behind decentralized finance. They enable anyone to make markets and seamlessly trade cryptocurrency in a highly secure, non-custodial, and decentralized manner.
And while AMMs have already seen massive growth, they’re still in their infancy. Inspiring innovations are just around the corner — multi-asset liquidity pools and impermanent loss-resistant protocols are already being developed and tested.
Once Ethereum 2.0 is fully implemented, and DeFi integrates the AMM innovations mentioned above, this new type of finance will become unstoppable and quite possibly mainstream.