Education · 06
AMM Pools on the XRP Ledger
#XRPEducationMonthDavid Schwartz pointed out something interesting about meme coins on XRPL. For many of them, most of the trading liquidity sits in a pool that pairs the token with XRP.
Think about what that means when you open a dollar chart. The pool prices the token in XRP. The chart can then take that XRP price and convert it into dollars. So when you see the token up 5%, the first question is which price actually moved.
How does the pool set a price?
An automated market maker (AMM) holds two assets that people can swap. Say a pool holds 2,000 XRP and 1,000 tokens. That balance gives you a starting rate of 2 XRP per token, before fees and price impact.
Now put 200 XRP into the pool to buy tokens. The XRP balance goes up to 2,200, and the token balance drops to roughly 909. You get about 91 tokens, so you paid an average of 2.20 XRP each, even though the pool started at 2 XRP.
The maths behind that is called constant product. In this example, with fees left out, multiplying the two balances gives you the same number before and after the swap. As your buy takes tokens out of the pool, the remaining tokens get more expensive in XRP.
That’s price impact. Put the same 200 XRP into a much deeper pool at the same starting rate and it shifts the balances by a smaller percentage, so the price moves less.
What makes this native to XRPL?
On Ethereum, a protocol like Uniswap runs its pools through smart contracts. On the XRP Ledger, the XLS-30 amendment made AMMs part of the ledger’s own transaction rules and connected them to the existing decentralised exchange.
The order book has prices posted by other traders. The AMM has prices calculated from its balances. If an order book has the best price for the first part of your trade and the pool has a better price for the rest, the ledger can use both in a single transaction.
Who supplies the assets?
Liquidity providers put assets into the pool and receive LP tokens in return. If you hold 1% of the pool’s LP tokens, you can redeem them for 1% of each asset currently in the pool.
Trading fees stay in the pool, and LP token holders can vote on the fee. They also take on the risk that the mix changes. When people buy the token with XRP, the pool takes in XRP and gives out tokens. If the token keeps rising against XRP, your pool share can end up worth less than holding the original assets separately, even after fees.
Back to David’s 5% example.
Say the pool still prices the token at 2 XRP and XRP is worth $2. That puts the token at $4 in dollar terms.
XRP then rises 5% to $2.10. With the pool still pricing the token at 2 XRP, its dollar equivalent is now $4.20. Both balances in the pool can stay exactly where they were.
David also pointed out what can happen next. That higher dollar price can prompt someone to sell the token. The sale puts tokens into the pool and takes XRP out, pushing the token’s XRP price down. If it drops to 1.90 XRP while XRP is still at $2.10, the token is now worth $3.99 in dollar terms.
Same day. XRP is up 5%. The token is down a cent.
So next time an XRP-paired token moves on a dollar chart, check the XRP pair too. How much of that move came from the token itself, and how much came from XRP?