As a sub-lesson of decentralized exchanges, (objectively the most important DeFi use case) we will resume covering DEXs by further exploring automated market makers (AMM).
Automated market makers (AMM) enable unstoppable, automated, and decentralized trading using algorithms to price assets in liquidity pools. Traditional exchanges require buyers, sellers, and a central reserve of assets. In contrast, AMM exchanges crowdsource liquidity and use smart contracts to execute trades.
In 2021, AMM-based exchanges are processing billions of dollars worth of on-chain transactions every day. Uniswap, Sushi, Balancer, and Curve Finance are a few top crypto decentralized exchanges using the AMM model to deliver DeFi to the masses.
Each AMM takes a slightly different approach, but the general idea is the same.
Automated market makers (AMM) are decentralized exchanges that pool liquidity from users and price the assets within the pool using algorithms. The exact mechanics vary from exchange to exchange, but generally, AMMs offer deep liquidity, low transaction fees, and 100% uptime for as many users as possible.
An easy way to understand AMM-based exchanges is to consider how they differ from traditional exchanges.
Traditional exchanges require buyers and sellers to meet at an overlapping price point on a centralized order book. In contrast, AMMs do quite a few things differently.
Uniswap is a prime example of how automated market makers work.
Uniswap is an AMM protocol that acts like a robot waiter serving up trades between you and a liquidity pool bootstrapped by liquidity providers (LPs). Under the AMM model, you can play several roles: trader, liquidity provider, and protocol governor. The protocol itself achieves two things:
For instance, let us imagine trading ETH tokens for UNI tokens on Uniswap. After clicking the swap button, the algorithm calculates how much the trade impacts the liquidity pool's reserves - after which a price quote is given.
After approving the transaction, the AMM deposits UNI tokens into the ETH-UNI pool. Finally, it sends the quoted amount of ETH from the pool to the customer’s wallet.
AMMs use a constant product formula to price assets, which states:
x * y = k
X and y are equal amounts of a liquidity pool’s assets while k is the total or constant amount of pool liquidity. Now, let us view the ETH-UNI trade from the perspective of our new formula.
To buy ETH (x) on Uniswap, users need to add UNI (y) tokens to the pool. Note that k demands that the amount of liquidity remains constant. Therefore, by adding UNI tokens users increase one side of the pool and decrease the other (removing ETH).
The algorithm divides the pool's total liquidity by the new amount of UNI in the pool, then divides that by the new amount of ETH in the pool so that (k / y) / x = price. This is how the protocol determines the price paid for ETH (and other tokens), which will increase the more ETH is bought from the pool.
The way AMMs handle liquidity is similar to smart order routing systems. Both track the best paths for gathering liquidity at the best price possible. You can try out smart order routing by registering an account on Shrimpy and swapping tokens.
AMMs offer advantages that help introduce many DeFi features that traditional exchanges cannot replicate. Here are a few advantages that they hold.
There are downsides to all innovations. The disadvantages of AMM models boil down to the following:
Automated market makers were initially introduced by Vitalik Buterin in 2017. Four years later, the first AMM models were launched. Not only have they severely improved the capabilities of existing decentralized exchanges, but AMMs have also made it possible for DeFi to exist in the first place. Attractive yields for providing liquidity were one of the main reasons why market participants switched to DeFi at all.
Appropriately, the next lesson deals with liquidity mining and yield farming: two important methods of earning passive income in DeFi. Both function similarly but there are nevertheless important distinctions that are reason enough for each to have a lesson dedicated to them.
Each day Shrimpy executes over 200,000 automated trades on behalf of our investor community. And joining them is easy.
After you sign up and connect your first exchange account, you’ll deploy an investment-maximizing strategy in as few as 5-minutes.
Whether you create your own rebalancing strategy or completely custom automation, the ability to walk your own path belongs in the hands of every crypto investor.