A Proposal for the Future of the XRP Ledger DEX
Tags: xrpl, amm, dex, defi
Published: 2022-07-13 21:45:29

*RippleX invites the developer community to [provide feedback](https://github.com/XRPLF/XRPL-Standards/discussions/78) on its proposal for Automated Market Maker functionality on the XRP Ledger.*


With one of the world’s first established decentralized exchanges (DEX), the [XRP Ledger (XRPL)](https://www.xrpl.org/) enables anyone on the ledger to directly and efficiently buy, sell, or trade any tokenized asset—without the need for a central intermediary. 

The [XRPL DEX](https://xrpl.org/decentralized-exchange.html#decentralized-exchange) had a first-mover advantage in 2012 as a peer-to-peer exchange. It utilized a central limit order book (CLOB) model that matches bids and offers based on price and time priority. While this is a valuable exchange mechanism in its own right, we believe there is an opportunity to expand upon this feature set to unlock greater functionality and utility via an automated market maker (AMM).

That’s why the RippleX team is [proposing native AMM functionality](https://github.com/XRPLF/XRPL-Standards/discussions/78) on the XRP Ledger for consideration by its developer community. 

**What is an AMM?**

An AMM is a decentralized exchange protocol that allows users to swap assets using liquidity from pre-funded token pools and an algorithm to determine price. Any user can become a liquidity provider (LP) by contributing tokens to the liquidity pool in exchange for an ownership stake in that pool, represented by “LP tokens.” The AMM charges a spread on trades that change the ratio of tokens in the AMM’s liquidity pools. This trading fee is added to the AMM’s capital pool, further building on the LP token holders’ returns.

The AMM solves for the manual nature of a human-operated CLOB DEX. As a result, AMMs have become a critical part of the decentralized finance (DeFi) ecosystem. Through our proposal to the broader community, we believe this software solution will expand upon the XRP Ledger’s existing order book-based DEX capabilities by incorporating automated market-making.

**XRPL AMM Differentiators**

While an automated market maker would be a new addition to the XRP Ledger, it is certainly not the first of its kind. Bancor launched the first AMM in 2017, followed by others that ultimately drove AMM-style DEXes to their immense popularity in DeFi today. Despite being a later entrant to the space, the differentiated  AMM design proposed here, combined with the performant nature of XRP Ledger, makes this AMM a very compelling addition to decentralized finance. 

The most unique feature of the AMM protocol is the novel continuous auction mechanism. It is well-known that impermanent loss, or temporary financial loss that results from token pair prices diverging from the market price post-contribution, is a considerable risk of providing liquidity to an AMM. This protocol includes a unique mechanism where the AMM instance continuously auctions off trading advantages to arbitrageurs—charging them and giving these earnings to its LPs. Doing so allows LPs to partially take a large share of the profits (usually taken by arbitrageurs) to offset the effects of impermanent loss.

Another feature worth highlighting is the AMM’s integration with the CLOB DEX. If one assumes traders want the best price for any given transaction, the algorithm can optimize for that by providing the best of both worlds across both DEX protocols. How? Payment and order placement transactors automatically determine whether swapping within a liquidity pool or through the order book will provide the best price for the user and execute accordingly. Meanwhile, [pathfinding](https://xrpl.org/paths.html) considers “paths” with order books and AMMs in various combinations to improve the overall exchange rate. 

Finally, this AMM protocol allows for both single-sided and dual-sided liquidity contributions. Most mainstream AMM DEXes require liquidity providers to contribute the equal value of both tokens in a given pool, such as ETH and USDC. This adds friction to the user experience by requiring them to have liquidity available for both assets and often requires them to purchase or swap assets to initiate their position in the pool. By removing this requirement and allowing for single-sided contributions, users can more easily participate in the pool in exchange for a small fee.

**Onwards**

We are incredibly excited about the potential of this robust feature set in combination with the performant nature of the XRP Ledger. With speeds of up to 1500 transactions per second (TPS) and transaction finality of less than 4 seconds, this AMM protocol differs from others in class.

Developers, we’d love to hear your thoughts on our proposed standard for the XRP Ledger! Head to [GitHub](https://github.com/XRPLF/XRPL-Standards/discussions/78) to comment and start building today.

[Visit GitHub](https://github.com/XRPLF/XRPL-Standards/discussions/78)