What is an Automated Market Maker? How does the XRPL's AMM work?
The paradigm is gradually shifting in favor of decentralized protocols, with more people realizing the value of decentralization.
Last updated
The paradigm is gradually shifting in favor of decentralized protocols, with more people realizing the value of decentralization.
Last updated
Centralized Exchanges Vs Decentralized Exchanges
With your typical centralized exchange, you deposit your money, either via bank transfer, credit/debit card, or you can deposit a cryptocurrency you already hold in your wallet in order to trade. When you deposit crypto, you give up control of it. Not from a usability standpoint, as you can still trade it or withdraw it, but from a technical standpoint – you cannot spend it on the blockchain. You don’t own the private keys to the funds, which means that when you withdraw, you ask the exchange to sign a transaction on your behalf. When you’re trading, transactions don’t occur on-chain – instead, the exchange allocates balances to users in its own central database.
A decentralized exchange (DEX) changes the narrative of how people buy and sell crypto to each other. Instead of proprietary software with closed-source codes that CEXs run, DEXs usually use smart contracts to allow orders to be settled automatically and directly from blockchain wallets. Essentially, A DEX is a P2P marketplace that connects cryptocurrency buyers and sellers. In simple words, decentralized exchanges are autonomous decentralized applications (DApps) that allow cryptocurrency buyers or sellers to trade without having to give up control over their funds to any intermediary or custodian. With no intermediary or counterparty to hold on to any funds, users retain sole ownership of their private keys and, thus, their assets.
At the heart of the emergence of DEXs in the crypto narrative was a simple but all-important fact in their makeup: non-custodial wallets and fund management. This continues to be the most obvious difference today between DEXs and CEXs.
The XRP Ledger (XRPL) was the first DEX in history, which was built in 2012 and still operates today. It uses on-chain order books, aka central limit order book (CLOB), and it is a fully-functional built-in (native) exchange where users can trade XRP, XRPL tokens or issued currencies with each other. Unfortunately, due to the non-stop misinformation and lack of reporting by the crypto media, the majority still does not know that the XRPL has a DEX, among other great features. Users can interact with the XRPL DEX through different interfaces such as swap.anodos.finance and Xaman app.
What is an Automated Market Maker?
Automated market makers (AMMs) are a type of a decentralized exchange mechanism that pool liquidity from users and price the assets within the pool using algorithms. When you are trading on an AMM, you are executing the trade against the liquidity in the liquidity pool. For the buyer to buy, there doesn’t need to be a seller at that particular moment, only sufficient liquidity in the specific pool.
For those that want to dive into the details, here are the differences between Automated Market Makers (AMMs) and Central Limit Order Book (CLOB) DEXs.
The difference between an AMM with liquidity pools and an order book is that the order book is a collection of the currently open orders for a given market. People put limit orders (sell or buy orders) at specific prices and with specific amounts and this consists of the order book. The system then matches orders with each other. Automated market makers (AMM) have changed this game. They are a significant innovation that allows for on-chain trading without the need for an order book. As no direct counterparty is needed to execute trades, traders can get in and out of positions on token pairs that likely would be highly illiquid on order book exchanges.
The introduction of liquidity pools was a game-changer for the entire decentralized finance market. These pools seek to address the issue by incentivizing users to provide liquidity in exchange for a share of the trading fees. Anyone can be a liquidity provider (LP) in an AMM.
An AMM is simply like a self-running stall at a market that always has items to trade. The price of items isn't set by any one person but is determined by how much of each item is available. If lots of people want to buy a particular item and start trading their items for it, the AMM adjusts the price so that item becomes more expensive. If people want to get rid of an item and it starts piling up, the AMM makes it cheaper. This way, the AMM keeps the trading going by balancing supply and demand automatically, without anyone having to manually set the prices.
Users called liquidity providers (LPs) add an equal value of two tokens in a pool to create a market. In exchange for providing their funds, they earn trading fees from the trades that happen in their pool, proportional to their share of the total liquidity. AMMs have made market making more accessible.
When tokens are deposited into a liquidity pool, the AMM automatically generates a new token that represents the share the depositor owns of that pool. This is called a liquidity provider (LP) token, and it can be used for a multitude of functions both within its native platform and other decentralized finance apps. LP tokens allow AMMs to be non-custodial, meaning they do not hold on to your tokens, but instead operate via automated functions that promote decentralization and fairness.
Technically, when you deposit to a pool, you are not locking the assets you are providing. You are selling them for a share of the liquidity pool. When you buy a share of a mutual fund, you don’t lock in USD for a mutual fund share. You buy shares of a mutual fund. In either case you are buying shares of a liquidity pool. When you buy, you have the ability to effect the price of the liquidity pool underlying assets whether your deposit is one or two sided.
AMMs bring several advantages to the world of decentralized exchanges:
24/7 Liquidity: Liquidity pools are available 24/7, making it possible for users to trade at any time, even during periods of low trading activity.
Lower Entry Barriers: AMMs are often more user-friendly than traditional order book exchanges. Users don't need to place specific buy or sell orders. They simply swap one asset for another at the current price.
Decentralization: AMMs operate without a centralized intermediary, which aligns with the principles of blockchain technology.
Liquidity Provision Rewards: Users who provide liquidity to these pools earn a portion of the trading fees. This provides a financial incentive for liquidity providers.
Predictable Fees: AMMs often feature predictable fee structures, making it easier for traders to understand their costs.
Challenges in AMMs and Impermanent Loss
While AMMs offer significant benefits, they also face challenges. The main challenge is the impermanent loss (IL) experienced by liquidity providers. Impermanent loss (IL) occurs when the prices of the assets in the pool change compared to when they were initially provided. It’s the result of token rebalancing by the AMM as prices of the tokens in an LP position diverge from their starting ratio to each other. Liquidity providers may find themselves with fewer assets than if they had held them outside the pool.
Ιmpermanent loss isn’t a great term. It’s called impermanent loss because the losses only become realized once you withdraw your tokens from the liquidity pool. At that point, however, the losses very much become permanent. The fees you earn may be able to compensate for those losses, but it’s still a slightly misleading name. Impermanent loss is basically opportunity cost on what would happen if you just held the assets in your wallet instead of adding them to the liquidity pool.
Impermanent loss is not something to be afraid of and can be mitigated by fees earned. Your goal as a LP should be to provide assets you don't intend to hold, but use specifically on the AMM to earn income from the fees and trading activity.
Most fear a breakout of the assets they provide, but even in the unfavorable scenario of a breakout happening in a short time, the IL is not as big as imagined even if the assets go up by 200-600%.
The goal is to mitigate IL by fees earned. Remember, the higher the trading activity, the more money you make from fees as a LP.
Even if the numbers above scare you, let's zoom in on the chart and only consider the price range near your entry point. IL remains <2% as long as the relative prices of the assets in your pool stay within 50% of your entry.
In other words, IL is actually not a big factor in the short-term, or even medium-term with less volatile tokens. It’s something to be aware of, but not necessarily something to be feared.
It's also very important to note that not all pools are created equal, and not all pools have the same IL risk. In the case your provide liquidity into a stablecoin pair such as USD/EUR there is usually 0 to minimal IL. Same if you provide liquidity to 2 crypto assets with high correlation such as XRP/XLM.
Providing liquidity to an XRP/stablecoin pair gives you less exposure to XRP's upside, but also less exposure to XRP's downside.
The XRPL AMM's novel Continuous Auction mechanism will compensate LPs through the distribution of winning bid amounts for each AMM pool, mitigating, even further, impermanent loss exposure.
Overall, impermanent loss is not something that should keep you away from participating in the AMM as a liquidity provider. But keep in this mind, this is not a risk-free procedure, do not add in the liquidity pools XRP and XRPL tokens you intend to hold for the long term. You should see becoming a Liquidity Provider as another investment or income strategy, so you should not use crypto assets you intend to just hold.
Key Features of XLS-30
In the evolving landscape of Automated Market Makers (AMMs), the XRP Ledger's introduction of XLS-30 marks a significant milestone, bringing forward a suite of innovative features that redefine exchanging value and liquidity provision. The vision for an Internet of Value and a full DeFI ecosystem on XRPL is getting closer and closer.
These developments not only offer enhanced control and benefits to liquidity providers, but also ensure a more efficient and diverse trading experience for users on the XRP Ledger.
XLS-30 comes with several unique features that set it apart in the world of AMMs:
Fee Voting: Unlike AMMs and platforms with fixed trading fees, XLS-30 allows liquidity providers to vote on the trading fees of the pool they are participating in. This democratic approach ensures that fees align with the interests of the community.
Continuous Auction Mechanism: To address impermanent loss and enhance liquidity provider rewards, XLS-30 introduces a continuous auction mechanism. Impermanent loss is a common concern for liquidity providers in AMMs as discussed in the previous lessons. XLS-30's continuous auction mechanism directly addresses this issue. It auctions off trading advantages for a 24-hour slot with zero trading fees. By participating in these auctions, liquidity providers can effectively minimize their exposure to impermanent loss by offering their assets for trading advantages. This innovation aligns the interests of liquidity providers and traders.
Two-Way Interoperability: One of the standout features of XLS-30 is its seamless interoperability. It allows for the coexistence of AMM-based trading with the existing Central Limit Order Book (CLOB) DEX. This means that users can access both liquidity sources, benefiting from competitive pricing and a wider selection of assets.
The XRPL's AMM benefits both liquidity providers and traders in many ways:
Liquidity Providers: These are users who contribute their assets to liquidity pools. In return, they receive LP tokens representing their share of the pool. With XLS-30, liquidity providers enjoy an array of benefits, including predictable fee voting, the continuous auction mechanism, and protection against impermanent loss.
Traders: Traders on the XRP Ledger benefit from improved liquidity thanks to the AMM-based system. They can swap assets seamlessly and access a wide range of trading pairs without having to worry about the current liquidity and depth like in the CLOB DEX.
It's very important to mention that there is no staking or earning with your XRP. You give assets to the AMM so others can trade them and you get paid a fee for that. The income comes from the trading fee that traders pay. If someone swaps $100 worth of assets and the fee in that pool is 1% then the trader pays $1 which goes to the pool and is distributed to LPs based on the share of the pool they own.
When you deposit single-sided liquidity there isn’t actually a swap or conversion involved. Only one asset is actually added to the pool which changes the asset ratio. Something that can be dangerous when pool's liquidity is low because it will cause big differences in prices and the share you receive.
The XRPL's AMM basically allows you to earn yield from market making, volatility, and the continuous auction mechanism.
Conclusion
XLS-30 is more than “just another” Automated Market Maker; it's a solution that addresses the unique challenges faced in the decentralized exchange space. Its features, such as fee voting, continuous auction mechanism, and two-way interoperability, set it apart and make it a significant player in the world of DeFi.
By empowering liquidity providers and traders, XLS-30 contributes to the growth and maturation of the XRP Ledger's DeFi ecosystem. As DeFi enthusiasts and community members engage with the XRPL DEX and AMM, they'll play a pivotal role in shaping the future of DeFi on the XRP Ledger.
In conclusion, many decentralized exchanges have emerged over the years, each iterating on previous attempts to streamline the user experience and build more powerful trading venues. Ultimately, the idea seems heavily aligned with the ethos of self-sovereignty: users don’t need to trust a third party. Even though both centralized and decentralized crypto ecosystems work hand in hand, the paradigm is gradually shifting in favor of DEXs, with more people realizing the value of decentralization.
Join the Internet of Value movement with AnodoSwap: https://swap.anodos.finance