What you should know before starting:

You might already know this stuff, but DeFi is a complex topic. Click the toggle and have a quick read to keep everything in perspective.

What are Automated Market Makers all about?

Automated Market Makers (AMM) power most DEXs. It’s what allows them to cut out many of the middlemen. To understand how they work, let’s look at an example:

<aside> 📝 Let’s say you have a large amount of a token called BoringTutorialCoin **and you want to trade it for a second token called, ExcitingTutorialHelper. Basically, you want to “swap” some BTC for ETH (see what I did there? 😎). There are many options out there to choose from, but you have narrowed it down to two: a centralized exchange called Coinface , or a fancy new DEX called PointerSwap.

</aside>

Order Books

At Coinface, they’re a centralized exchange so they handle the transactions with an Order Book. An order book is just like it sounds. It’s a book with a list of all the orders waiting to be filled. On one side are orders of those who want to buy a certain asset, on the other side are those who want to sell it. The buyers and sellers can set their desired prices and it’s the order book system’s job to find a match.

The Order Book “Dance” 🕺🏽

The Order Book “Dance” 🕺🏽

Check out the “dancing” order book graph above. This is kind of an abstract visualization of traders offering to buy and sell an asset at different prices. When they meet in the middle there’s a match and the order goes through.

AMM

Our good DeFi friends at PointerSwap use an AMM instead of an OrderBook. AMMs don’t need to match up buyers and sellers, because traders buy and sell directly to and from a smart contract. These smart contracts have been preloaded with a bunch of each token so that you can just buy and sell with it directly. The collection of preloaded tokens in the contract is referred to as the Liquidity Pool. With a Liquidity Pool, you don’t need to be matched with anyone else wanting to make a trade, it’s just you and the smart contract.

<aside> 🏄 So using our example above, if you want to swap some BoringTutorialCoin for that new, sweet ExcitingTutorialHelper token, with the AMM from PointerSwap, you’re just moving a bit of each token into and out of their liquidity pool directly. Pretty cool!

</aside>

Ok, now you might be asking yourself, how does an AMM with its liquidity pool know how to automatically adjust the price of a token? For this, the smart contract relies on a formula it uses to constantly “recalibrate” and update the price. But before we even look at this formula, watch this short animated video I made for you to help explain how it works:


How an AMM calculates price

https://www.loom.com/share/11b2e0d38f1b4d399dbfbca15a0c1f2d