XRPL AMM Technical Features and Updates
Tags: xrpl, dex, amm
Published: 2023-08-10 18:18:39

Last year, the RippleX team proposed the [XLS-30d technical specification to build a protocol native automated market maker (AMM)](https://dev.to/ripplexdev/xrpl-amm-network-available-for-testing-and-development-426i) integrated with the order book-based DEX on the XRP Ledger. It has been available on Devnet since November 2022. 

Since then, the community has made a lot of progress with testing and development. Hundreds of AMM pools were created on the Devnet and many more wallets were connected to test its functionality. The RippleX team has also added AMM support in three client libraries (xrpl.js, xrpl-py, and xrpl4j) and the [xrpl.org explorer](https://amm-devnet.xrpl.org/).

##Proposal Updates

A new amendment proposal is anticipated soon, at which point voting will commence to bring XLS-30d to the XRPL Mainnet. Because of the XRP Ledger’s decentralized nature, no singular authority can make decisions for the network. Every server on the network independently tallies the votes of the [validators](https://xrpl.org/validators.html) it is configured to listen to, as part of the [consensus](https://xrpl.org/consensus.html) process. That being said, in order for the amendment to pass, at least 80% of the validator community has to vote “yes” and that minimum threshold must be maintained for at least two weeks. If both of those conditions are met, then the amendment proposal to bring XLS-30d to Mainnet will be passed. 

In the meantime, [the RippleX team welcomes developer feedback](xls30@ripple.com), bug reports and recommendations to continue improving and iterating on the spec. Extensive testing of the protocol for core XRP Ledger stability continues.

##How Developers Can Use XLS-30d

There are two primary use cases for XLS-30d AMM integration: Create new financial applications and integrate into non-financial applications. 

###Create new financial applications:

- XLS-30d is designed as a native protocol of the XRPL, allowing developers to readily integrate with the AMM and create their own front-end trading and liquidity provision interfaces. Because the AMM is baked into the ledger, no heavy lifting is required and developers of all experience levels can easily integrate their apps or create their own that leverage the protocol. 
- Application developers can create interfaces that serve traders and liquidity providers (LPs), while the protocol handles the most efficient transaction order routing with its integration to the CLOB DEX. It is designed to source and execute an optimized price, whether from the AMM itself or from an orderbook.
- XLS-30d introduces a novel continuous auction mechanism that is designed to reduce impermanent loss by incentivizing arbitrageurs to bid for the right to capture price discrepancies. LPs effectively keep more of a pool’s trading fee revenues, while the arbitrageurs are incentivized to continuously bid at near zero trading fees and maintain stable volatility.
    - The **AMMBid** transaction enables arbitrageurs to place a bid for the next auction slot. The revenue from a successful bid transaction is then split between the current slot-holder and the pool, and remaining LP tokens are burned, which effectively increases the LP’s share in the pool.
- LP governance is enabled by the **AMMVote** transaction. Liquidity pool creators unilaterally establish a trading fee, and henceforth the fee becomes a votable parameter by liquidity provider. Using the **AMMVote** transaction, any LP may submit a vote for trading fees, which are calculated by a continuous weighted average based on stake in the pool. Developers can create the application layer such that all LPs may easily participate in this feature.

##Integrate into non-financial applications for user-friendly order flow:

- Developers with existing applications on the XRPL can integrate the AMM to enable simple swap functionalities, improve user experience and boost retention. An integration reduces the number of steps in a checkout flow process, whereby a digital transaction can be completed within a single unified application interface.
    - Let’s look at NFTs as an example. Say a user wants to buy an NFT that’s listed for 1,000 tokenA but they only have tokenB in their wallet. The AMM can be leveraged to facilitate the exchange by automatically swapping at an optimized transaction price. The user then confirms their transaction to be routed from tokenB to tokenA to the NFT without ever leaving your checkout page.  
    - In essence, if developers create an application or integration on top of the AMM, a simple interface can be served up to their desired audience, and they will have the ability to enable asset swaps on any application page at the click of a button. 
- For illiquid tokens, the AMM can enable developers to create liquidity pools instead of tracking an order book. With algorithmic market making, liquidity can be found at every price point and users will have a much easier time accessing and exchanging new or lower liquidity tokens. 
- XLS-30d also enables single-sided liquidity provision, meaning liquidity providers can then deposit one token into the pool and the algorithm will automatically balance it into a pair. This lowers friction for users by removing the need for them to hold both sides of the pool before participating, and ultimately boosts pool liquidity

##How to Get Started

Developers are invited to check out the most up to date [technical documentation](https://opensource.ripple.com/docs/xls-30d-amm/amm-uc/) to learn more, test and provide feedback. You can also search and view transactions and other data via the [XRPL Explorer](https://amm-devnet.xrpl.org/).

All developers are welcome to build integrations and test functionalities on this open-source technology. There is an active [discord](https://discord.gg/sfX3ERAMjH) community where developers can share ideas and ask questions to other XRPL community members.