Automated Market Maker
(AMM)
This module explores the Automated Market Maker (AMM) implementation in rippled, one of the most sophisticated DeFi features on the XRP Ledger. You will learn how AMM pools provide decentralized liquidity, how the constant product formula maintains price equilibrium, and how the pathfinding engine integrates AMM liquidity alongside the traditional order book (CLOB).

Module overview
Building on your understanding of transactors (Module 03bis), ledger entries (Module 03), and the consensus mechanism (Module 08-09), you will dive into the complete AMM architecture: from pool creation to liquidity provision, trading fee governance, and auction slot mechanics.
By the end of this module, you will understand:
- How AMM pools are created and managed as pseudo-accounts
- The mathematical formulas behind swaps, deposits, and withdrawals
- How LP tokens represent ownership of pool liquidity
- The governance mechanisms for trading fees and auction slots
- How pathfinding integrates AMM offers with CLOB offers
In this module
This module covers the complete AMM implementation that brings decentralized exchange capabilities to the XRP Ledger:
- Architecture: Understand the ltAMM ledger entry, pseudo-account model, LP token design, and how pools are represented on the ledger.
- Transactions: Learn all seven AMM transaction types (Create, Deposit, Withdraw, Vote, Bid, Delete, Clawback) and their validation phases.
- VoteSlots: Explore the fee governance mechanism where LPs vote on trading fees with weight proportional to their pool ownership.
- AuctionSlot: Discover the 24-hour auction system that allows active traders to bid for discounted fees using LP tokens.
- Logic: Master the constant product formula, swap calculations, LP token minting/burning, and precision handling.
- Pathfinding: Understand how synthetic AMMOffers are dynamically generated to compete with CLOB offers for best execution.
Learning objectives
Explain how AMM pools maintain price equilibrium through the constant product formula
Trace AMM transactions through the complete transactor lifecycle
Calculate LP token amounts for deposits and withdrawals
Understand the trading fee governance mechanism and auction slot bidding
Debug AMM-related issues using pool balances and invariant checks
Implement test scenarios for AMM functionality
Navigate the AMM codebase efficiently











