Automated Market Makers (AMM)

From CryptoWiki

Basics

  • A type of DEX. The top 3 AMMs account for nearly 90% of trade volume among DEXs (6-10-2020).
  • There are multiple times of AMMs, such as; dAMMs, vAMMs and PMMs.
  • From TokenSets Weekly Market Report #43 (21-9-2020):

"Automated market makers are smart contracts that create a liquidity pool of ERC20 tokens, which are automatically traded by an algorithm rather than an order book. This effectively replaces a traditional limit order-book with a system where assets can be automatically swapped against the pool’s latest price.

There are two main types of automated market makers (AMMs). While one may be governed and set up by professional market makers, the other is fully automated by a set algorithm, allowing any user in the market to participate by depositing liquidity into the smart contract."

"Automated Market Makers are exchanges that don’t have an order book. The price is determined by the ratio of assets in the exchange. The exchange relies on the formula below:

  1. x * y = k
  2. x = first asset (Ether)
  3. y = second asset (some Token)
  4. k = constant that must always stay the same"

"AMMs trace their origins to a Reddit post by Vitalik a few years ago. 

From there, we had Bancor being the first AMM live on Ethereum. However due to the incorrect use of their native BNT token, it failed to get much traction... Until Uniswap came along and delivered on the simple promise of a properly functioning automated market maker with no extras. Since Uniswap got traction in the past year, the AMM space is truly starting to take off with many players now entering the space.

Before we go into explaining what are AMMs, let's maybe talk about what problem they solve. So in the traditional/normal world, an exchange is usually compromised of an order book. The way an order book works is someone will place an order to BUY a certain amount of tokens at a certain price with a certain currency and another party will place an order to SELL a certain amount of tokens for a certain currency.

If we break it down there's three variables at play:

  • The price they want their offers to go through at
  • The amount of tokens they're willing to buy/sell
  • A token pair that they will accept in exchange for the token they're buying/selling

This means that you'll have a two groups and only when do they overlap will trades get settled.

In some sorts you can see the order book as a constant negotiation between buyers and sellers. If there's more demand to buy then people will outbid other buyers in order to have their orders settled first. You'll also have traders wanting to cancel orders and change prices. As you can see that this will involve a fair bit of actions which isn't great in a blockchain context.

DEXs like 0x solve this issue by having the matching of orders on a server where speed is no problem and then treating the blockchain as a settlement layer. This semi-works although has a few major drawbacks:

  • Order cancellation can be messy since it's a race between the settlement traction versus when you tell the blockchain not to honour the trade
  • Smart contracts can't automatically just buy tokens, they require off-chain orders passed to them in order to buy or sell tokens
  • Bootstrapping liquidity for markets is hard because price discovery isn't easy with a few buyers and sellers

What if instead we had a kind of exchange where:

  • There's only one price and the smart contract determines what it is
  • You don't need to match orders, there's simply one price and either you take it or leave it
  • Anyone can bootstrap a market and provide liquidity for it"