Amendment XLS: Permissioned AMM #566
JibreelMuhammad
started this conversation in
XLS Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Canonical draft (kept current): https://github.com/JibreelMuhammad/xls-drafts/blob/main/XLS-Permissioned-AMM.md
Related: System XLS: AMM Pool Discovery (#565).
Posting at the Proposal stage per XLS-1; no XLS number is requested yet (an Editor assigns it at PR time). Feedback welcome before I open a PR.
Amendment XLS: Permissioned AMM
1. Abstract
This amendment adds optional, pool-level access control to the XRP Ledger's native AMM (XLS-30), reusing the credential and domain machinery from Credentials (XLS-70) and Permissioned Domains (XLS-80). An AMM pool may reference a Permissioned Domain, after which AMM-specific market actions — providing liquidity, withdrawing liquidity, voting on the trading fee, and bidding for the auction slot — require the acting account to be a member of that domain. Swaps may remain public or be gated as well, mirroring the hybrid model of Permissioned DEX (XLS-81).
Where Permissioned DEX gates the order-book primitive ("who may place and take offers in this domain"), Permissioned AMM gates the pool primitive ("who may enter, fund, withdraw from, and govern this specific pool"), using the AMM ledger object as the market identity. The two are complementary controls over the two different market engines the XRPL already recognizes.
2. Introduction
2.1. Terminology
ltAMMledger entry created byAMMCreate.PermissionedDomainledger entry (XLS-80) defined by a set of accepted credentials.2.2. Summary
ltAMMmodified (addssfDomainID,sfAssetDomain,sfAsset2Domain,sfPoolPermissions). No new entry type; reuses the existingPermissionedDomainmembership test.AMMCreate,AMMDeposit,AMMWithdraw,AMMVote,AMMBidmodified; AMM swap routing modified.amm_inforeturns the new fields).2.3. Relationship to Permissioned DEX
DomainIDltAMMobject +DomainIDBoth build on the same
PermissionedDomainobject and the same membership test. This proposal reuses that test verbatim, so an account already onboarded to a domain for Permissioned DEX needs no additional onboarding for a Permissioned AMM scoped to the same domain.3. Specification
3.1. Ledger Entry:
ltAMM(Modified)3.1.1. Fields
Four optional fields are added. All default to absent, in which case the pool behaves as a standard, fully public XLS-30 pool.
DomainIDAssetDomainAssetside. Falls back toDomainID.Asset2DomainAsset2side. Falls back toDomainID.PoolPermissionsA pool is "permissioned" if
DomainID(or either per-side domain) is set. These domain fields are constant afterAMMCreate: changing the governing domain on a live pool would retroactively strand existing positions whose owners qualified under the old rules, matching the conservative posture of the AMM amendment family.3.1.2. Flags
PoolPermissionsis a bitmask. Absent/zero means the default policy: all liquidity and governance actions are gated byDomainID, swaps remain public (hybrid).lsfSwapsPermissionedlsfDepositPermissionedAMMDepositrequires membership (default on for permissioned pools).lsfWithdrawPermissionedAMMWithdrawrequires membership, subject to the §3.5 carve-out.lsfGovernancePermissionedAMMVoteandAMMBidrequire membership (default on for permissioned pools).Per-side domains (
AssetDomain/Asset2Domain) refine deposits/withdrawals: a single-asset action on theAssetside checksAssetDomain(orDomainIDif unset); a two-asset action checks membership of both side-domains.3.1.3. Ownership, Reserves, Deletion
Unchanged from XLS-30. The added fields impose no additional owner reserve and do not alter pool deletion conditions.
3.1.4. Membership Test
Identical to Permissioned Domains / Permissioned DEX: an account is a member of domain
Dif it holds a credential thatDaccepts, the credential has been accepted by the holder (XLS-70), and the credential is not expired or revoked. No new membership notion or credential type is introduced. Membership is evaluated at transaction-application time, so revocation takes effect immediately.3.1.5. Example JSON
{ "LedgerEntryType": "AMM", "Account": "rAMM...", "Asset": { "currency": "XRP" }, "Asset2": { "currency": "USD", "issuer": "rISSUER..." }, "TradingFee": 30, "DomainID": "AbC123...", "PoolPermissions": 14 }3.2. Transaction:
AMMCreate(Modified)New optional fields
DomainID,AssetDomain,Asset2Domain,PoolPermissions. The creator MUST be a member of every domain it sets (it cannot create a pool it could not participate in). OntesSUCCESS, these are written to theltAMMobject.3.3. Transactions:
AMMDeposit,AMMWithdraw(Modified)When the relevant flag applies, the actor must be a member of the relevant domain(s): the side-domain for single-asset actions, both side-domains for two-asset actions.
AMMWithdrawis subject to the §3.5 carve-out.3.4. Transactions:
AMMVote,AMMBid(Modified)When
lsfGovernancePermissionedapplies, the actor must be a member ofDomainID.3.5. Swap Routing and the Withdrawal Carve-out
Swaps. When
lsfSwapsPermissionedis set, the AMM is eligible as a liquidity source for a payment-engine step only when the executing account is a member ofDomainID; otherwise the pool is skipped in routing for that account. When unset, the pool participates in pathfinding exactly as today (hybrid behavior, consistent with XLS-81 hybrid offers).Withdrawal carve-out. If withdrawals are gated and an LP's credential later lapses, the LP would otherwise be locked out of its own funds.
AMMWithdrawtherefore permits an account to withdraw liquidity from a position it owns even if its membership has lapsed, provided it withdraws to itself and performs no other gated action in the same transaction. Compliance is preserved (the account is exiting, creating no new exposure) while custody safety is guaranteed.3.6. Failure Conditions
temDISABLEDfeaturePermissionedAMMis not enabled.temMALFORMEDPoolPermissionshas unknown bits set.tecNO_PERMISSIONtecOBJECT_NOT_FOUNDDomainIDdoes not exist.3.7. State Changes
On success,
AMMCreaterecords the domain fields and flags on the newltAMM. GatedAMMDeposit/AMMWithdraw/AMMVote/AMMBidbehave exactly as their XLS-30 counterparts once the membership check passes; the only added behavior is the pre-action membership gate and the §3.5 carve-out.4. Rationale
Why reuse Permissioned Domains. The ledger already standardizes credential-based membership (XLS-70/80) and applies it to order books (XLS-81). Reusing it for pools gives consistent compliance semantics, shared onboarding, and delegable KYC, while adding only restrictions and no new membership concept.
Why per-side domains and a flag bitmask. RWA operators need finer control than "can this account trade" — e.g. members may add the property-token side while anyone may swap, or governance may be restricted while deposits are open. Per-side domains plus the flag bitmask express the motivating cases without a new ledger object.
Why immutable domain fields. Mutating the governing domain on a live pool would retroactively change who qualifies for existing positions and could strand liquidity; immutability keeps a pool's rules stable for its lifetime.
Alternate designs considered (pathways evaluated).
5. Backwards Compatibility
Fully backwards compatible. All new fields are optional; a pool created without them is a standard public XLS-30 pool, byte-identical in behavior. Existing pools are unaffected and require no migration. On servers where
featurePermissionedAMMis not enabled, the presence of any new field is rejected withtemDISABLED.6. Test Plan
DomainIDonly, with per-side domains, and with eachPoolPermissionscombination; verify fields persist and are immutable.tecNO_PERMISSIONfor each gated action.AssetDomainbut notAsset2Domaincan single-asset-deposit theAssetside but not perform a two-asset deposit.lsfSwapsPermissionedunset, non-members can swap (hybrid); set, non-members' paths skip the pool while members route normally.temDISABLEDwhen fields are present pre-activation;temMALFORMEDon unknownPoolPermissionsbits;tecOBJECT_NOT_FOUNDon a missingDomainID.rippled(unit + integration) is required for this XLS to reachFinal.7. Security Considerations
Apply-time checks. Gated actions re-evaluate membership when applied, so credential expiry/revocation takes effect immediately; there is no cached-permission window.
No trapped capital. The §3.5 self-withdrawal carve-out guarantees an LP can always exit its own position, preventing a revoked credential from becoming a custodial loss.
No new privilege path. The amendment adds only restrictions; it never grants access an account would not otherwise have, and introduces no new credential or membership concept beyond XLS-70/80.
Pathfinding disclosure. When swaps are gated, a non-member's path simply excludes the pool — identical to how a Permissioned DEX book is excluded for non-members; no information beyond public ledger state is revealed.
Operator centralization. A single credential issuer can fully control membership. This is intended for regulated venues; participants can inspect a pool's
DomainIDand the domain's accepted credentials before depositing.8. Appendix
8.1. FAQ
Does a credential have to be issued before someone can participate? Yes. Under XLS-70/80 a domain is defined by accepted credentials, not an address list; an account becomes a member only by holding a credential that has been issued and accepted. An operator wanting a simple allowlist can be the sole issuer and issue only to chosen accounts.
Can swaps stay public while liquidity is gated? Yes — leave
lsfSwapsPermissionedunset. This is the default hybrid behavior.Can a pool require different credentials for each side? Yes — set
AssetDomainandAsset2Domainto different domains.8.2. System Diagram
A Mermaid diagram of the gating flow is maintained alongside this spec; see the companion
permissioned-amm-flowfigure (participant + domain → membership check → gated liquidity/governance actions, with swaps public unless flagged).Beta Was this translation helpful? Give feedback.
All reactions