Draft
Conversation
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
🎫 XLS Number AssignmentThis PR adds a new XLS draft. The next available XLS number has been determined:
Next Steps for XLS EditorsBefore merging this PR, please:
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
Collaborator
|
@RomThpt the bot doesn't handle PR concurrency well, fixed the numbers for you |
- 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
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CLAMM,CLAMMTick,CLAMMPosition), seven transaction types, and four RPCsStructure
The specification follows the AMENDMENT_TEMPLATE.md format with complete subsections for:
Related Discussion
This Draft XLS formalizes the proposal from Discussion #427.
Category: Amendment | Status: Draft | Requires: XLS-20