notes

Automated Market Makers (AMM)

AMMs keep DeFi running round the clock. But how?

defi

amm

uniswap

balancer

Last updated on July 27th, 2022

Automated Market Makers (AMM)

Automated Market Makers are algorithmic protocols that determine the price of assets on decentralized exchanges, without requiring the immediate presence of buyers and sellers. AMMs allow these assets to be traded automatically and permissionlessly by using a system called liquidity pools, where users are incentivized to supply liquidity to be used to execute each trade on the exchange.

Let’s take a step back to cover what liquidity means. Liquidity refers to the ease at which one asset can be traded for another, without significantly impacting the price of the asset in the process. In other words, the easier it is to trade an asset for another, the more liquid that asset is.

AMMs are an improvement over traditional market makers. In centralized exchanges, buyers and sellers set the price they wish to buy or sell an asset at, into a system called an order book. In an order book system, the trade is only executed when another user accepts to buy or sell the asset at the prices in the order book. With AMMs, this step is completely removed.

These new protocols are decentralized in nature and are always available for trading, as long as liquidity exists for the assets to be traded. Let’s take a closer look at how AMMs actually work.

How do AMMs work?

Earlier, I mentioned that AMMs are algorithmic protocols; this means that they follow a formula or set of formulas to calculate the price at which a trade is executed. A trade refers to the exchange of one asset for another, and for a trade to happen there needs to be a liquidity pool that exists for the trading pair.

For example, if a user wants to trade ETH/USDC, the AMM will use its formula to calculate the price of the trade from the amount of ETH and USDC available in the pool.

AMMs also use smart contracts to execute the trades. It’s these smart contracts that compute the algorithmic calculations, deposit and withdraw funds from the liquidity pools and complete the trade for the user.

Liquidity pools & providers

Liquidity pools are pools of equal amounts of trading pairs that have been supplied by liquidity providers in exchange for a percentage of the fees generated by the pool.

For example, to provide $1000 liquidity to the ETH/USDC pool we mentioned above, a liquidity provider would need to deposit ~$500 worth of each of the tokens.

The percentage of the rewards earned by the liquidity provider is usually determined by the ratio of the liquidity they have provided and the total amount in the pool. The rewards are also usually received in the native token of the exchange, e.g UNI on Uniswap, BAL on Balancer and so on.

A closer look at DeFi’s leading AMMs

link