diff --git a/docs/concepts/tokens/decentralized-exchange/automated-market-makers.md b/docs/concepts/tokens/decentralized-exchange/automated-market-makers.md index b2ba5e2b3e..454728087a 100644 --- a/docs/concepts/tokens/decentralized-exchange/automated-market-makers.md +++ b/docs/concepts/tokens/decentralized-exchange/automated-market-makers.md @@ -77,9 +77,11 @@ To vote, a liquidity provider sends an [AMMVote transaction][]. Whenever anyone ### Auction Slot -Unlike any previous Automated Market Makers, the XRP Ledger's AMM design has an _auction slot_ that a liquidity provider can bid on to get a discount on the trading fee for a 24-hour period. The bid must be paid in LP Tokens, which are returned to the AMM. No more than one account can hold the auction slot at a time, but the bidder can name up to 4 more accounts to also receive the discount. There is no minimum bid, but if the slot is currently occupied then you must outbid the current slot holder to displace them. If someone displaces you, you get part of your bid back depending on how much time remains. As long as you hold an active auction slot, you pay a discounted trading fee equal to 1/10 (one tenth) of the normal trading fee when making trades against that AMM. +Unlike any previous Automated Market Makers, the XRP Ledger's AMM design has an _auction slot_ that a liquidity provider can bid on to get a discount on the trading fee for a 24-hour period. The bid must be paid in LP Tokens, which are returned to the AMM. In most blockchains, when the price of an AMM's assets shifts significantly in external markets, traders can use arbitrage to profit off an AMM, which results in a loss for liquidity providers. The auction mechanism is intended to return more of that value to liquidity providers and more quickly bring the AMM's prices back into balance with external markets. -With any AMM, when the price of its assets shifts significantly in external markets, traders can use arbitrage to profit off the AMM, which results in a loss for liquidity providers. The auction mechanism is intended to return more of that value to liquidity providers and more quickly bring the AMM's prices back into balance with external markets. +No more than one account can hold the auction slot at a time, but the bidder can name up to 4 more accounts to also receive the discount. If the slot is currently occupied then you must outbid the current slot holder to displace them. If someone displaces you, you get part of your bid back depending on how much time remains. As long as you hold an active auction slot, you pay a discounted trading fee equal to 1/10 (one tenth) of the normal trading fee when making trades against that AMM. + +The minimum bid to win the auction slot, if it is empty or expired, is equal to the current total number of LP Tokens outstanding multiplied by the trading fee, divided by 25. (In pseudocode, `MinBid = LPTokens * TradingFee / 25`.) If the auction slot is occupied, you must bid at least the minimum _plus_ up to 105% of what the current slot holder paid, discounted by how much time they have remaining. ## Representation in the Ledger diff --git a/docs/references/protocol/transactions/types/ammbid.md b/docs/references/protocol/transactions/types/ammbid.md index 2d43a331d9..13e35aaee0 100644 --- a/docs/references/protocol/transactions/types/ammbid.md +++ b/docs/references/protocol/transactions/types/ammbid.md @@ -76,14 +76,20 @@ Like other "inner objects" that can appear in arrays, the JSON representation of If successful, the transaction automatically outbids the previous slot owner and debits the bid price from the sender's LP Tokens. The price to win the auction decreases over time, divided into 20 intervals of 72 minutes each. If the sender does not have enough LP Tokens to win the bid, or the price of the bid is higher than the transaction's `BidMax` value, the transaction fails with a `tecAMM_INVALID_TOKENS` result. -- If the auction slot is currently empty, expired, or in its last interval, the **minimum bid** is **0.001% of the AMM's total LP Tokens balance**. +- If the auction slot is currently empty, expired, or in its last interval, the **minimum bid** is defined by the following formula: - **Caution:** This minimum value is a placeholder and may change before the AMM feature becomes finalized. + ```text + M = L * F / 25 + ``` + + - `M` is the minimum bid. + - `L` is the total number of LP Tokens currently issued by the AMM + - `F` is the trading fee, as a decimal - Otherwise, the price to outbid the current holder is calculated using the following formula: - ``` - P = B × 1.05 × (1 - t⁶⁰) + M + ```text + P = B * 1.05 * (1 - t^60) + M ``` - `P` is the price to outbid, in LP Tokens. @@ -93,24 +99,24 @@ If successful, the transaction automatically outbids the previous slot owner and There are two special cases for the cost to outbid someone. In the **first interval** after someone wins the bid, the price to outbid them is the minimum bid plus 5% more than the existing bid: - ``` - P = B × 1.05 + M + ```text + P = B * 1.05 + M ``` In the **last interval** of someone's slot, the cost to outbid someone is only the minimum bid: - ``` + ```text P = M ``` -**Note:** To make sure all servers in the network reach the same results when building a ledger, time measurements are based on the [official close time](../../../../concepts/ledgers/ledger-close-times.md) of the previous ledger, which is approximate. +{% admonition type="info" name="Note"%}To make sure all servers in the network reach the same results when building a ledger, time measurements are based on the [official close time](../../../../concepts/ledgers/ledger-close-times.md) of the previous ledger, which is approximate.{% /admonition %} ## Bid Refunds When you outbid an active auction slot, the AMM refunds the previous holder part of the price, using this formula: ```text -R = B × (1 - t) +R = B * (1 - t) ``` - `R` is the amount to refund, in LP Tokens. @@ -119,7 +125,7 @@ R = B × (1 - t) As a special case, during the final (20th) interval of the auction slot, the refunded amount is zero. -**Note:** As with all XRP Ledger times, transaction processing uses the [official close time](../../../../concepts/ledgers/ledger-close-times.md) of the _previous_ ledger, which can result in a difference of up to about 10 seconds from real time. +{% admonition type="info" name="Note"%}As with all XRP Ledger times, transaction processing uses the [official close time](../../../../concepts/ledgers/ledger-close-times.md) of the _previous_ ledger, which can result in a difference of up to about 10 seconds from real time.{% /admonition %} ## Error Cases