This is a segment from the Lightspeed newsletter. To read full editions, subscribe.
Automated market makers (AMMs) offer continuous market liquidity and decentralized trading mechanisms that make a whole host of DeFi innovations viable. Recently, a few projects — including memecoin launchpad pump.fun — have taken an interest in developing their own use case-specific AMMs, veering away from reliance on third-party platforms.
To understand this trend, we need a more intimate understanding of how AMMs work, the problems they solve, and the strategic advantage of customizing liquidity mechanisms to align with project objectives.
AMMs remove TradFi’s order book model entirely, instead replacing the concept with liquidity pools. These are user-supplied reserves of tokens (typically equal in value within constant-product concepts) that get locked inside of smart contracts. Instead of matching buy and sell orders directly, AMMs facilitate trades using formulas that continuously determine token prices based on their relative quantities within each pool.
One of the most prevalent AMM models utilizes the constant-product market maker algorithm, expressed mathematically as x * y = k. In this markup, x and y represent the reserve balances of two tokens in the liquidity pool, while k is a constant representing the product of these reserves.
When a user conducts a trade, exchanging token x for token y (or vice versa), the quantities shift, altering the ratio of tokens in the pool. To maintain the invariant constant (k), the AMM algorithm adjusts the price dynamically, ensuring the product of the token quantities remains stable post-trade.
If it’s helpful, you can also just pretend this all happens by magic, the mechanics of which are entirely indiscernible to all but the most learned pursuers of the occult. The outcome is the same either way, with the key point being: At the end of a trade, a given liquidity pool will always remain balanced according to the AMM’s ruleset. Through the maintenance of this balance, the system preserves a continuous state of liquidity and predictable token pricing without reliance on centralized counterparties. Abracadabra.
Of course, this model also introduces certain trade-offs. Impermanent loss for one, which can occur due to price fluctuations and alter token ratios. AMMs also typically require significant liquidity to reduce slippage (the difference between expected and executed trade prices). When a liquidity pool has limited reserves, even relatively small trades can substantially impact the token ratio, causing notable price swings during execution.