Type of decentralized exchange (DEX) protocol that relies on a mathematical formula to price assets. AMM’s are smart contracts that hold liquidity reserves that traders can trade against. These reserves are funded by liquidity providers (LP’s)
- Instead of using an order book like a traditional exchange, assets are priced according to a pricing algorithm
- Requires liquidity pools to function. The more liquidity there is in a pool, the less slippage large orders may incur which in turn can attract more volume to that platform
- Pricing is determined by the algorithm and more importantly, its determined by how much the ratio between the tokens in the liquidity pool changes after a trade
- AMM’s work by maintaining a constant product based on the amount of liquidity in both sides of the pool
- What this means is that any trade in the pool must change the reserves In such a way that the product of those reserves remains unchanged
- If the ratio changes by a wide margin, there’s going to be a large amount of slippage
- As more and more traders buy on coin out of a pool, that coin becomes exponentially more expensive due to the x*y = k formula as k is a constant
- Number of x tokens decreases, so its value increases to maintain k
- When someone executes a trade, we get (x + Δx) * (y + Δy) = k
- Any exchange corresponds to a move on a convex token reserve curve (A). A liquidity pool using this model cannot be depleted, as tokens will get more expensive with lower reserves
- When the token supply of either one of the two tokens approaches zero, its relative price rises infinitely as a result
- As such, constant product function forms a hyperbola when plotting the two assets in the pool (A) which creates the desirable property of always having liquidity as prices approach infinity on both sides of the spectrum (can never buy up all of one asset in the pool)
- Smart contract based liquidity pools are not reliant on external price feeds (oracles). Whenever the market price of an asset shifts, anyone can arbitrage by buyer the cheaper tokens in the pool and then selling them for what their trading at on exchanges
- Anyone who provides liquidity to the pool receives pool share tokens that allow them too participate in the accumulation of funds and to redeem these tokens for their share of a potentially growing liquidity pool
- Liquidity provision results in a growing K and is visualized in figure B