XLS-30d proposal brings Automated Market Makers to XRP Ledger
The XLS-30d proposal aims to introduce several new features to automated market makers (AMMs) on the XRP Ledger (XRPL) when it is implemented. These features will include new transaction types, the ability to vote on trading fees, and a continuous auction mechanism.
Introducing Two New Transaction Types for AMM on XRPL: AMMDeposit and AMMWithdraw
The XLS-30d proposal introduces two new transaction types for AMMs on the XRPL: “AMMDeposit” and “AMMWithdraw”. These transactions allow users to add or remove liquidity from an AMM instance, respectively. Both equal-asset and single-sided deposits and withdrawals are supported.
Equal-asset deposits and withdrawals refer to situations where a user adds or removes liquidity from an AMM instance by depositing or withdrawing a proportional value of both assets in the AMM’s liquidity pool. For example, if an AMM’s liquidity pool consists of OXP and XRP, and a user wants to add liquidity to the pool, they could deposit an equal dollar value (1-to-1 dollar ratio) of both OXP and XRP.
Single-sided deposits and withdrawals, on the other hand, refer to situations where a user is adding or removing liquidity from an AMM instance by depositing or withdrawing only one of the assets in the AMM’s liquidity pool. For example, if an AMM’s liquidity pool consists of XRP and OXP, and a user wants to add liquidity to the pool, they could deposit a certain amount of XRP but not OXP.
Offering both equal and single-side deposits and withdrawals allows users to take advantage of imbalances in the liquidity pool. However, single-sided deposits and withdrawals may change the ratio of assets in the AMM and their relative pricing, resulting in a trading fee being charged on the amount of the asset that causes this change. This fee is added to the AMM pools and distributed to LPToken holders upon redemption.
LPTokens and Trading Fees in AMM on XRPL
When users add liquidity to an AMM instance, they receive pool stakes called LPTokens. These tokens can be bought, sold, and used to make payments on the XRPL, just like any other issued asset or token. The AMM charges a trading fee on the portion of a trade that changes the ratio of tokens in the AMM. This fee is added to the AMM pools and is distributed to LPToken holders in proportion to their tokens upon redemption.
To ensure that the trading fees for an AMM instance are balanced, the XLS-30d proposal suggests making the trading fee a votable parameter for LPToken holders. These holders, as significant stakeholders in the AMM instance, are in the best position to make this decision in a balanced way. The trading fee for the AMM instance is specified in basis points (bps) and can be set between 0 and 1000 bps, which is equivalent to a range of 0% to 1%. This fee is charged as a percentage of the trade size on certain transactions, including AMMDeposit, AMMWithdraw, and Payment. It is added to the AMM instance’s pools and is distributed to the LPs in proportion to their LPTokens upon liquidity removal. It is worth noting that the trading fee may affect the participation of users in the AMM, as higher fees may deter participation and result in lower trading volume, while lower fees may result in lower revenue for LPs.
Continuous Auction Mechanism for Improved Arbitrage in AMM on XRPL
One issue with AMMs is that they do not automatically adjust prices in response to external market conditions, such as volatility or asymmetric trading. This can lead to arbitrage opportunities, but arbitrageurs must wait until their profits exceed the trading fees in order to take advantage of them. Additionally, they may have to compete with other arbitrageurs, which reduces their success probability.
To address this issue, the XLS-30d proposal introduces a continuous auction mechanism for AMM instances. In this mechanism, people can bid on 24-hour slots at zero trading fee using their LPTokens. The slot holder can then immediately execute arbitrage transactions without having to wait for their profits to exceed the trading fee, thus eliminating the race condition for them. This not only reduces the time window during which the AMM experiences decreased trading volume but also makes it easier for users to engage in arbitrage. Additionally, since it is a continuous auction mechanism, if someone outbids a current slot holder, part of the proceeds from the auction are refunded to the previous slot holder (computed pro-rata).
Part of the proceeds from the auction are deleted, or “burned”, to reduce the overall supply of LPTokens and increase their value. The remaining proceeds are distributed to the LPToken holders in proportion to their tokens. This creates an incentive for LPToken holders to participate in the auction and increases the profits they can earn from arbitrage opportunities.
XLS-30d Proposal for Enhanced Liquidity and Trading on XRPL’s AMM
The XLS-30d proposal introduces interoperability between AMMs and the XRPL decentralised exchange (DEX). This allows AMM offers to be transparently injected into the liquidity stream of the DEX, which can then be used for payment execution. This helps to aggregate liquidity across different DEXs and improve pricing for traders.
In terms of the technicals, the interoperability between AMMs and the XRPL DEX is achieved through the use of “payment channels” and “order book channels”. Payment channels allow for the transfer of XRP or other assets between two parties without the need for each individual transaction to be recorded on the XRPL. This allows for faster and more efficient transfer of funds. Order book channels, on the other hand, allow for the exchange of assets between two parties without the need for an order book.
Overall, the interoperability between AMMs and the XRPL DEX helps to bring the benefits of both market-making models to the XRPL. AMMs offer fast and efficient execution of trades, while DEXs offer decentralised and transparent trading. By combining the two, traders can enjoy the best of both worlds and benefit from improved liquidity and pricing.