Explain It Like I’m Five: What Are Automated Market Makers And How Do They Work?

Tobias W. Kaiser
InstaLiq DAO
Published in
5 min readDec 17, 2021

If you’re new to the DeFi realm, you might have asked yourself the question how Automated Market Makers (AMMs) on decentralized exchanges such as Uniswap or SushiSwap work. You might have even used one of them before to swap your tokens without exactly knowing how they work, being satisfied with the fact that the token price displayed on the DEX and the token amount you have received is roughly what you’d expect if you had bought the tokens on a centralized exchange.

In this article, we’ll use a simple example to explain how AMMs achieve this.

What are Automated Market Makers?

On a centralized exchange, which could be a crypto exchange, or any other asset market, a market maker is an entity that always offers to buy or sell an asset at a specific price. This ensures that the price does not break out above or below the price range determined by the market makers, unless the market makers change their pricing. The ability to issue trades without changing the price of an asset is also called liquidity.

On decentralized exchanges, this function is taken care of by AMMs, also referred to as liquidity pools. Here, a smart contract is used that always makes it possible to sell one token in exchange for another.

What does x * y = k mean?

If you search for other “beginner friendly” descriptions of how AMMs work, you’ll often see the x * y = k formula that is used for pricing assets within an AMM. For a beginner, this likely won’t explain anything though.

When you create a liquidity pool, you need to provide both of the tokens that will ultimately be used for the swap and the amount of both tokens that you provide determines the listing price. Most standard AMMs simply assume that both token sides in the pool have exactly the same monetary value.

Let’s exemplify this using an AMM that lets you trade apples for bananas. When creating a liquidity pool, you choose the rate at which your tokens, or in this case, fruits, are initially swapped. Suppose you create the pool with five apples on one side and five bananas on the other side. This means that the AMM will assume that one apple is worth exactly the same as one banana.

At this price, the AMM (theoretically) allows you to pay one banana in order to take out one apple. Doing so leaves the pool with six bananas and four apples, so the AMM now assumes that each apple is worth 1.5 bananas.

In order to take out another apple, you’d now have to pay one and a half banana. Likewise, if you returned the apple, you’d be able to take out 1.5 bananas.

Wait, wouldn’t that leave the pool 0.5 bananas short?

Yes. If all the swaps were carried out in bulk at the same price, this would mean that the pool would leak tokens (or fruits). What the AMM actually does instead is shave off a tiny slice of apple and an equivalent tiny slice of banana, swap them at the current price, then update the price, shave off the next slices, and repeat this process over and over again, until the banana you paid to the pool is completely gone.

Since the price of apples is now constantly rising as both fruits are gradually sliced into a delicious mush of apple and banana sauce, you’d ultimately get a slightly lower amount of apple as you initially expected. This difference between the price quoted by the DEX and the price you actually pay is called slippage and this is also why it is important for crypto projects that people stake their tokens in liquidity pools.

Take our example from above, but now, there’s not five, but 1,000 apples and bananas in the pool. Pay a banana to take out an apple (999 apples = 1001 bananas) and then pay one apple to take out 1.002 bananas, that would leave the pool only 0.002 bananas short.

Likewise, if you applied the “slicing” method for swapping your fruits, like an actual AMM would, the slippage you incur for swapping a single apple or banana, is much lower than if there were only five of each fruit in the pool.

This is also where the x * y = k formula comes into play. Rather than having to do all the work of slicing up both fruits into a mush, this formula can calculate the exact amount of apple you would get for a banana, or vice versa.

How do Initial Liquidity Swaps help projects get liquidity?

Since crypto projects absolutely rely on liquidity to allow traders to buy and sell their tokens without incurring too much slippage and causing too much volatility, creating liquidity is the number one priority for any token launch.

The idea with Initial Liquidity Swaps is to distribute half of the token supply that is allocated for release through an open auction mechanism, whose proceeds are fully going into a liquidity pool, alongside with the other half of the supply. This means that bidders both determine the initial listing price of the token and receive project tokens at the rate determined by them.

For the project, this means that a large part of their initial token supply is instantly and permanently locked up as liquidity, alongside a matching amount of reference tokens on the other side of the AMM. At InstaLiq DAO, we believe that this creates a much fairer process compared to other token launch methods. If you want to support us, or keep up to date, feel free to follow us on Twitter, or join our Discord server.

--

--

Tobias W. Kaiser
InstaLiq DAO

Cryptoeconomist and semi-professional Poker Player —Co- Founder of InstaLiq DAO