Skip to content

Draft: Concentrated Liquidity AMM#498

Draft
RomThpt wants to merge 5 commits intoXRPLF:masterfrom
RomThpt:draft/concentrated-liquidity-amm
Draft

Draft: Concentrated Liquidity AMM#498
RomThpt wants to merge 5 commits intoXRPLF:masterfrom
RomThpt:draft/concentrated-liquidity-amm

Conversation

@RomThpt
Copy link
Copy Markdown

@RomThpt RomThpt commented Mar 11, 2026

Summary

  • Add Draft XLS specification for a Concentrated Liquidity AMM (CLAMM) for the XRP Ledger
  • Introduces three new ledger entries (CLAMM, CLAMMTick, CLAMMPosition), seven transaction types, and four RPCs
  • Enables LPs to concentrate capital within specific price ranges for up to 4000x capital efficiency improvement over XLS-30
  • Positions represented as NFTokens (XLS-20) for secondary market trading and fee collection without withdrawal

Structure

The specification follows the AMENDMENT_TEMPLATE.md format with complete subsections for:

  • Ledger entries: Object identifier, fields, flags, ownership, reserves, deletion, pseudo-account, freeze/lock, invariants, RPC name
  • Transactions: Fields, flags, transaction fee, failure conditions (tem/tec error codes), state changes
  • RPCs: Request/response field tables, failure conditions, examples

Related Discussion

This Draft XLS formalizes the proposal from Discussion #427.

Category: Amendment | Status: Draft | Requires: XLS-20

Add specification for a capital-efficient AMM enabling liquidity
providers to concentrate capital within specific price ranges.

Introduces three new ledger entries (CLAMM, CLAMMTick, CLAMMPosition),
seven transactions, and four RPCs. Positions are represented as
NFTokens (XLS-20) for secondary market trading.

Structured per AMENDMENT_TEMPLATE.md with full subsections for
ledger entry ownership, reserves, deletion, invariants, and
transaction failure conditions with error codes.

Ref: XRPLF#427
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 11, 2026

🎫 XLS Number Assignment

This PR adds a new XLS draft. The next available XLS number has been determined:

Draft Directory Assigned Number New Directory Name
XLS-draft-concentrated-liquidity-amm XLS-99 xls-0099-concentrated-liquidity-amm

Next Steps for XLS Editors

Before merging this PR, please:

  1. Rename the directory from XLS-draft-concentrated-liquidity-amm to xls-0099-concentrated-liquidity-amm
  2. Update the preamble in the README.md:
    • Set xls: to 99
    • Set status: to Draft

This comment was automatically generated. The XLS number is based on the highest existing number in the repository at the time this PR was opened.

Rename XLS-draft-concentrated-liquidity-amm to
XLS-0098-concentrated-liquidity-amm and set xls: 98
in preamble per bot assignment.

Ref: XRPLF#427
@mvadari
Copy link
Copy Markdown
Collaborator

mvadari commented Mar 11, 2026

@RomThpt the bot doesn't handle PR concurrency well, fixed the numbers for you

Rename directory and update preamble per maintainer correction.
XLS-98 was a bot concurrency error, corrected by @mvadari.

Ref: XRPLF#498
@mvadari mvadari added the has XLS number This PR has been assigned an XLS number, which is now reserved label Mar 17, 2026
RomThpt added 2 commits March 20, 2026 01:25
- Add CLAMMTickBitmap ledger entry (4.1.4): compressed 256-bit bitmap
  for efficient initialized tick lookup during swaps
- Add CLAMMDelete transaction (4.2.8): removes empty pools from ledger,
  supports multi-call cleanup with tecINCOMPLETE for large directories
- Add CLAMMClawback transaction (4.2.9): issuer clawback of tokens from
  holder CLAMM positions, with tfClawTwoAssets flag support
- Update abstract: 3 -> 4 ledger entries, 7 -> 9 transactions
- Update index and summary tables
Ledger entries:
- Fix type codes: CLAMM 0x008A, CLAMMTick 0x008B, CLAMMPosition 0x008C
- Fix TradingFee type: UINT32 -> UINT16
- Rename Liquidity -> LiquidityAmount to match sfLiquidityAmount
- Add missing fields: Account (pseudo-account), VoteSlots
- Fix LiquidityNet type: INT128 -> UINT128 (two's complement)
- Fix PreviousTxnID/Seq optionality: REQUIRED -> OPTIONAL

Transactions:
- Document Asset/Asset2/FeeTier as alternative to PoolID on all tx
- Fix CLAMMWithdraw.LiquidityAmount: REQUIRED -> OPTIONAL
- Fix CLAMMVote.TradingFee: OPTIONAL -> REQUIRED
- Rename CLAMMSwap fields: AmountIn -> Amount, MinAmountOut -> DeliverMin

RPCs:
- clamm_info: add account, protocol_fees, frozen, amount/2, vote_slots
- clamm_positions: add nftoken_id lookup, owner field, default limit 100
- clamm_ticks: rename tick_lower/upper -> min_tick/max_tick, limit 100
- clamm_quote: fix response fields (fee_amount, final_sqrt_price,
  input_asset, output_asset, final_tick), remove sqrt_price_limit
- Document asset/asset2/fee_tier alternative on all RPCs
RomThpt added a commit to RomThpt/rippled that referenced this pull request Mar 20, 2026
Implement a Concentrated Liquidity Automated Market Maker for the XRP
Ledger, enabling LPs to concentrate capital within specific price ranges
for up to 4000x capital efficiency improvement over XLS-30.

Ledger entries:
- CLAMM (0x008A): pool state with current tick, sqrt price, liquidity
- CLAMMTick (0x008B): per-tick liquidity and fee growth data
- CLAMMPosition (0x008C): LP position linked to NFToken (XLS-20)
- CLAMMTickBitmap (0x008D): compressed bitmap for tick lookup

Transactions:
- CLAMMCreate (85): create pool with asset pair, fee tier, initial price
- CLAMMDeposit (86): add liquidity within a price range, mint NFToken
- CLAMMWithdraw (87): remove liquidity, burn NFToken on full withdrawal
- CLAMMSwap (88): direct swap through a pool
- CLAMMCollectFees (89): collect accumulated fees without removing liquidity
- CLAMMVote (90): vote on trading fee parameters
- CLAMMBid (91): bid for auction slot (discounted fees, MEV protection)
- CLAMMDelete (92): remove empty pools from ledger
- CLAMMClawback (93): issuer clawback of tokens from CLAMM positions

RPCs: clamm_info, clamm_positions, clamm_ticks, clamm_quote

Integration:
- Payment engine routing through CLAMM pools (CLAMMLiquidity/CLAMMOffer)
- NFToken position transfer with fee settlement
- NFTokenBurn blocked for CLAMM positions
- ValidCLAMM invariant checker

Tests: unit tests, payment routing, tick bitmap, fuzz testing

Spec: XRPLF/XRPL-Standards#498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has XLS number This PR has been assigned an XLS number, which is now reserved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants