AMM refs: more edits per reviews

This commit is contained in:
mDuo13
2022-11-21 22:37:19 -08:00
parent abd20d99d9
commit 720a322892
6 changed files with 55 additions and 37 deletions

View File

@@ -1,3 +1,3 @@
## {{currentpage.name}} Fields ## {{currentpage.name}} Fields
In addition to the [common fields](pseudo-transaction-types.html), a {{currentpage.name}} pseudo-transaction uses the following fields: In addition to the [common fields](pseudo-transaction-types.html), {{currentpage.name}} pseudo-transactions use the following fields:

View File

@@ -1,3 +1,3 @@
## {{currentpage.name}} Fields ## {{currentpage.name}} Fields
In addition to the [common fields][], a {{currentpage.name}} transaction uses the following fields: In addition to the [common fields][], {{currentpage.name}} transactions use the following fields:

View File

@@ -12,9 +12,10 @@ status: not_enabled
{% include '_snippets/amm-disclaimer.md' %} {% include '_snippets/amm-disclaimer.md' %}
Bid on an Automated Market Maker's (AMM's) auction slot. If this transaction succeeds, you win the bid and can trade against the AMM at a discounted fee until you are outbid or 24 hours have passed. If you are outbid before 24 hours have passed, you are refunded part of the cost of your bid based on how much time remains. Bid on an Automated Market Maker's (AMM's) auction slot. If you win, you can trade against the AMM at a discounted fee until you are outbid or 24 hours have passed. If you are outbid before 24 hours have passed, you are refunded part of the cost of your bid based on how much time remains.
You bid using the AMM's LP Tokens; the amount of a winning bid is returned to the AMM, decreasing the outstanding balance of LP Tokens.
The price of the auction slot is always denominated in that AMM's LP Tokens; the amount paid is returned to the AMM, decreasing the outstanding balance of LP Tokens.
## Example {{currentpage.name}} JSON ## Example {{currentpage.name}} JSON
@@ -74,7 +75,7 @@ Each member of the `AuthAccounts` array must be an object with the following fie
Like other "inner objects" that can appear in arrays, the JSON representation of each of these objects is wrapped in an object whose only key is the object type, `AuthAccount`. Like other "inner objects" that can appear in arrays, the JSON representation of each of these objects is wrapped in an object whose only key is the object type, `AuthAccount`.
## Slot Price Calculations ## Auction Slot Price
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_FAILED_BID` result. 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_FAILED_BID` result.
@@ -101,9 +102,9 @@ If successful, the transaction automatically outbids the previous slot owner and
**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](ledgers.html#ledger-close-times) of the previous ledger, which is approximate. **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](ledgers.html#ledger-close-times) of the previous ledger, which is approximate.
## Refunds ## Bid Refunds
In the case where the transaction outbids the previous slot holder, the AMM refunds the previous holder part of the price of the auction slot. The amount refunded is calculated using the following formula: When you outbid an active auction slot, the AMM refunds the previous holder part of the price, using this formula:
```text ```text
R = B × (1 - t) R = B × (1 - t)
@@ -115,6 +116,8 @@ R = B × (1 - t)
As a special case, during the final (20th) interval of the auction slot, the refunded amount is zero. 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](ledgers.html#ledger-close-times) of the _previous_ ledger, which can result in a difference of up to about 10 seconds from real time.
## AMM Cases previous holder ## AMM Cases previous holder
In addition to errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html): In addition to errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html):

View File

@@ -14,7 +14,7 @@ status: not_enabled
Create a new Automated Market-Maker (AMM) instance for trading a given pair of assets ([fungible tokens](tokens.html) or [XRP](xrp.html)). Create a new Automated Market-Maker (AMM) instance for trading a given pair of assets ([fungible tokens](tokens.html) or [XRP](xrp.html)).
If successful, this transaction creates both an [AMM object][] and a [special AccountRoot object](accountroot.html#special-amm-accountroot-objects) which, together, represent the AMM; it also transfers ownership of the starting balance of both assets from the sender to the created `AccountRoot`, and issues an initial balance of liquidity provider tokens (LP Tokens) from the AMM account to this transaction's sender. Creates both an [AMM object][] and a [special AccountRoot object](accountroot.html#special-amm-accountroot-objects) to represent the AMM; it also transfers ownership of the starting balance of both assets from the sender to the created `AccountRoot`, and issues an initial balance of liquidity provider tokens (LP Tokens) from the AMM account to this transaction's sender.
**Caution:** When you create the AMM, you should fund it with (approximately) equal-value amounts of each asset. Otherwise, other users can profit at your expense by trading with this AMM ([performing arbitrage](https://www.machow.ski/posts/an_introduction_to_automated_market_makers/#price-arbitrage)). The currency risk that liquidity providers take on increases with the volatility (potential for imbalance) of the asset pair. The higher the trading fee, the more it offsets this risk, so it's best to set the trading fee based on the volatility of the asset pair. **Caution:** When you create the AMM, you should fund it with (approximately) equal-value amounts of each asset. Otherwise, other users can profit at your expense by trading with this AMM ([performing arbitrage](https://www.machow.ski/posts/an_introduction_to_automated_market_makers/#price-arbitrage)). The currency risk that liquidity providers take on increases with the volatility (potential for imbalance) of the asset pair. The higher the trading fee, the more it offsets this risk, so it's best to set the trading fee based on the volatility of the asset pair.
@@ -59,9 +59,9 @@ In addition to errors that can occur for all transactions, {{currentpage.name}}
| `temBAD_AMM_TOKENS` | The values of `Amount` and `Amount2` are not valid: for example, both refer to the same token. | | `temBAD_AMM_TOKENS` | The values of `Amount` and `Amount2` are not valid: for example, both refer to the same token. |
| `temBAD_FEE` | The `TradingFee` value is invalid. It must be zero or a positive integer and cannot be over 1000. | | `temBAD_FEE` | The `TradingFee` value is invalid. It must be zero or a positive integer and cannot be over 1000. |
| `terNO_ACCOUNT` | One of the accounts referenced in the request does not exist. | | `terNO_ACCOUNT` | One of the accounts referenced in the request does not exist. |
| `terNO_AUTH` | At least one of `Amount` or `Amount2` requires an [authorized trust line](authorized-trust-lines.html), but the issuer of that token has not authorized the trust line. | | `tecNO_AUTH` | The sender is not authorized to hold one of the deposit assets (`Amount` or `Amount2`). |
| `terNO_LINE` | At least one of `Amount` or `Amount2` requires an [authorized trust line](authorized-trust-lines.html), but no trust line exists. | | `tecNO_LINE` | The sender does not have a trust line for one of the deposit assets (`Amount` or `Amount2`). |
| `tecFROZEN` | At least one of `Amount` or `Amount2` is currently [frozen](freezes.html). | | `tecFROZEN` | At least one of the deposit assets (`Amount` or `Amount2`) is currently [frozen](freezes.html). |
| `tecUNFUNDED_AMM` | The sender does not hold enough money to fund the AMM with the amounts specified in `Amount` and `Amount2`. | | `tecUNFUNDED_AMM` | The sender does not hold enough money to fund the AMM with the amounts specified in `Amount` and `Amount2`. |
| `tecAMM_EXISTS` | There is already another AMM trading this currency pair. | | `tecAMM_EXISTS` | There is already another AMM trading this currency pair. |

View File

@@ -14,6 +14,8 @@ status: not_enabled
Deposit funds into an Automated Market-Maker (AMM) instance and receive the AMM's liquidity provider tokens (_LP Tokens_) in exchange. You can deposit one or both of the assets in the AMM's pool. Deposit funds into an Automated Market-Maker (AMM) instance and receive the AMM's liquidity provider tokens (_LP Tokens_) in exchange. You can deposit one or both of the assets in the AMM's pool.
If successful, this transaction creates a [trust line](trust-lines-and-issuing.html) to the AMM Account (limit 0) to hold the LP Tokens.
## Example {{currentpage.name}} JSON ## Example {{currentpage.name}} JSON
```json ```json
@@ -53,10 +55,10 @@ Deposit funds into an Automated Market-Maker (AMM) instance and receive the AMM'
### AMMDeposit Modes ### AMMDeposit Modes
This transaction has several modes, depending on which flags you specify. Each mode expects a specific combination of fields. The modes fall into two categories: This transaction has five modes, defined by which flag you specify. Each mode expects a specific combination of fields. The modes fall into two categories:
- **Double-asset deposits**, in which you provide both assets in the AMM's pool in proportions that match the balance of those assets already there. These deposits are not subject to a fee. - **Double-asset deposits**, in which you provide both assets in the AMM's pool, proportional to the balance of the assets already there. These deposits are not subject to a fee.
- **Single-asset deposits**, in which you provide only one of the AMM's two assets. You can envision a single-asset deposit as trading _some_ of the deposited asset for the other asset, then performing a double-asset deposit. The trading fee applies to the amount you would need to trade for, but not to the rest of the deposit; the amount of the fee is debited from the LP Tokens paid out. _For example, if the AMM's asset pool is split perfectly evenly between USD and EUR, and you try to deposit 100 USD, the amount of LP Tokens you receive is slightly less than if you had deposited 50 EUR + 50 USD, because you pay the trading fee to convert some of your USD to an equal amount of EUR._ - **Single-asset deposits**, in which you provide only one of the AMM's two assets. The AMM charges a fee, debited from the LP Tokens paid out, based on how much your deposit shifts the balance of assets in the pool.
The following combinations of fields indicate a **double-asset deposit**: The following combinations of fields indicate a **double-asset deposit**:
@@ -76,13 +78,14 @@ The following combinations of fields indicate a **single asset deposit**:
Any other combination of these fields and flags is invalid. Any other combination of these fields and flags is invalid.
### Single Asset Deposit Fee Calculations ### Single Asset Deposit Fee
If you deposit one asset, the AMM charges a fee by reducing the total amount of LP Tokens it pays out, weighted by how much your deposit shifts the balance of assets in the pool. This is equivalent to if you had traded part of the deposit amount for the other asset, then performed a double-asset deposit. The formula for how many LP Tokens you receive for a double-asset deposit is as follows: The fee for a single asset deposit is calculated to be the same as if you had used the AMM to trade part of the deposit amount for the other asset, then performed a double-asset deposit. The AMM's trading fee applies to the amount you would need to trade for, but not to the rest of the deposit. _For example, if the AMM's asset pool is split perfectly evenly between USD and EUR, and you try to deposit 100 USD, the amount of LP Tokens you receive is slightly less than if you had deposited 50 EUR + 50 USD, because you pay the trading fee to convert some of your USD to an equal amount of EUR._
<!-- TODO: improve graphic --> The formula for how many LP Tokens you receive for a double-asset deposit is:
{{ include_svg("img/amm-single-asset-deposit-formula.svg", "L = T × ( (( (B - (F × (1 - W) × B)) ÷ P)^W) - 1)") }} {{ include_svg("img/amm-single-asset-deposit-formula.svg", "L = T × ( (( (B - (F × (1 - W) × B)) ÷ P)^W) - 1)") }}
<!-- TODO: improve graphic -->
Where: Where:
@@ -90,7 +93,7 @@ Where:
- `T` is the total outstanding LP Tokens before the deposit <!-- TODO: or is it after the deposit? --> - `T` is the total outstanding LP Tokens before the deposit <!-- TODO: or is it after the deposit? -->
- `B` is the amount of the asset being deposited - `B` is the amount of the asset being deposited
- `F` is the trading fee, as a decimal - `F` is the trading fee, as a decimal
- `W` is the weight of the deposit asset in the pool <!-- TODO: before the deposit? how is this calculated? --> - `W` is the weight of the deposit asset in the pool. This is defined as 0.5 for all AMM pools (meaning a 50/50 split), so exponentiation by W is equivalent to taking the square root.
- `P` is the total amount of the deposit asset in the pool before the deposit <!-- TODO: or is it after the deposit? --> - `P` is the total amount of the deposit asset in the pool before the deposit <!-- TODO: or is it after the deposit? -->
### AMMDeposit Flags ### AMMDeposit Flags
@@ -120,7 +123,10 @@ In addition to errors that can occur for all transactions, {{currentpage.name}}
| `temBAD_AMM_TOKENS` | The transaction specified the LP Tokens incorrectly; for example, the `issuer` is not the AMM's associated AccountRoot address or the `currency` is not the currency code for this AMM's LP Tokens, or the transaction specified this AMM's LP Tokens in one of the asset fields. | | `temBAD_AMM_TOKENS` | The transaction specified the LP Tokens incorrectly; for example, the `issuer` is not the AMM's associated AccountRoot address or the `currency` is not the currency code for this AMM's LP Tokens, or the transaction specified this AMM's LP Tokens in one of the asset fields. |
| `tecAMM_FAILED_DEPOSIT` | The conditions on the deposit could not be satisfied; for example, the requested effective price in the `EPrice` field is too low. | | `tecAMM_FAILED_DEPOSIT` | The conditions on the deposit could not be satisfied; for example, the requested effective price in the `EPrice` field is too low. |
| `tecAMM_INVALID_TOKENS` | The AMM for this token pair does not exist, or one of the calculations resulted in a deposit amount rounding to zero. | | `tecAMM_INVALID_TOKENS` | The AMM for this token pair does not exist, or one of the calculations resulted in a deposit amount rounding to zero. |
| `tecNO_PERMISSION` | One of the assets to deposit in this transaction uses [Authorized Trust Lines](authorized-trust-lines.html) but the sender's trust line is not authorized. <!-- TODO: shouldn't this be impossible, since you can't get any amount of a token you aren't authorized to hold? --> | | `tecINSUF_RESERVE_LINE` | The sender of this transaction does meet the increased [reserve requirement](reserves.html) of processing this transaction, probably because they need a new trust line to hold the LP Tokens, and they don't have enough XRP to meet the additional owner reserve for a new trust line. |
| `tecNO_AUTH` | The sender is not authorized to hold one of the deposit assets. |
| `tecNO_LINE` | The sender does not have a trust line for one of the deposit assets. |
| `tecUNFUNDED_AMM` | The sender does not have a high enough balance to make the specified deposit. |
| `terNO_ACCOUNT` | An account specified in the request does not exist. | | `terNO_ACCOUNT` | An account specified in the request does not exist. |
| `terNO_AMM` | The Automated Market Maker instance for the asset pair in this transaction does not exist. | | `terNO_AMM` | The Automated Market Maker instance for the asset pair in this transaction does not exist. |

View File

@@ -48,7 +48,7 @@ Withdraw funds an Automated Market-Maker (AMM) instance by returning the AMM's l
| `Amount` | [Currency Amount][] | Amount | No | The amount of one asset to withdraw from the AMM. This must match the type of one of the assets (tokens or XRP) in the AMM's pool. | | `Amount` | [Currency Amount][] | Amount | No | The amount of one asset to withdraw from the AMM. This must match the type of one of the assets (tokens or XRP) in the AMM's pool. |
| `Amount2` | [Currency Amount][] | Amount | No | The amount of another asset to withdraw from the AMM. If present, this must match the type of the other asset in the AMM's pool and cannot be the same type as `Amount`. | | `Amount2` | [Currency Amount][] | Amount | No | The amount of another asset to withdraw from the AMM. If present, this must match the type of the other asset in the AMM's pool and cannot be the same type as `Amount`. |
| `EPrice` | [Currency Amount][] | Amount | No | The minimum effective price, in LP Token returned, to pay per unit of the asset to withdraw. | | `EPrice` | [Currency Amount][] | Amount | No | The minimum effective price, in LP Token returned, to pay per unit of the asset to withdraw. |
| `LPTokensIn` | [Currency Amount][] | Amount | No | How many of the AMM's LP Tokens to redeem. | | `LPTokenIn` | [Currency Amount][] | Amount | No | How many of the AMM's LP Tokens to redeem. |
**Note:** For a two-asset withdrawal, it is possible for `Asset` to correspond to _either_ `Amount` or `Amount2` as long as `Asset2` corresponds to the other one. It is recommended to match them (that is, `Amount2` is an amount of the asset defined in `Asset2`) because it is less confusing that way. **Note:** For a two-asset withdrawal, it is possible for `Asset` to correspond to _either_ `Amount` or `Amount2` as long as `Asset2` corresponds to the other one. It is recommended to match them (that is, `Amount2` is an amount of the asset defined in `Asset2`) because it is less confusing that way.
@@ -57,27 +57,33 @@ Withdraw funds an Automated Market-Maker (AMM) instance by returning the AMM's l
This transaction has several modes, depending on which flags you specify. Each mode expects a specific combination of fields. The modes fall into two categories: This transaction has several modes, depending on which flags you specify. Each mode expects a specific combination of fields. The modes fall into two categories:
- **Double-asset withdrawals**, in which you receive both assets from the AMM's pool in proportions that match their balances there. These withdrawals are not subject to a fee. - **Double-asset withdrawals**, in which you receive both assets from the AMM's pool in proportions that match their balances there. These withdrawals are not subject to a fee.
- **Single-asset withdrawals**, in which you receive one asset from the AMM's pool. You can envision a single-asset withdrawal as performing a double-asset deposit, then trading _some_ of the deposited asset for the other asset. The trading fee applies to the amount you would need to trade for, but not to the rest of the withdrawal. Depending on the fields specified, the amount of the fee can be added to the amount of LP Tokens paid in, or debited from the amount of the asset paid out. - **Single-asset withdrawals**, in which you receive one asset from the AMM's pool. The AMM charges a fee based on how much your deposit shifts the balance of assets in the pool. Depending on the withdraw mode, the amount of the fee can be added to the amount of LP Tokens paid in, or debited from the amount of the asset paid out.
The following modes are for a **double-asset withdrawal**: The following modes are for a **double-asset withdrawal**:
| Flag Name(s) | Flag Value | Fields Specified | Meaning | | Flag Name(s) | Flag Value | Fields Specified | Meaning |
|-----------------|--------------|------------------------|---------| |-----------------|--------------|------------------------|---------|
| `tfLPToken` | `0x00010000` | `LPTokensIn` only | Return the specified amount of LP Tokens and receive both assets from the AMM's pool in amounts based on the returned LP Tokens' share of the total LP Tokens issued. | | `tfLPToken` | `0x00010000` | `LPTokenIn` only | Return the specified amount of LP Tokens and receive both assets from the AMM's pool in amounts based on the returned LP Tokens' share of the total LP Tokens issued. |
| `tfWithdrawAll` | `0x00020000` | No Fields | Return _all_ of your LP Tokens and receive as much as you can of both assets in the AMM's pool. | | `tfWithdrawAll` | `0x00020000` | No Fields | Return _all_ of your LP Tokens and receive as much as you can of both assets in the AMM's pool. |
| `tfTwoAsset` | `0x00100000` | `Amount` and `Amount2` | Withdraw both of this AMM's assets, in up to the specified amounts. The actual amounts received maintains the balance of assets in the AMM's pool. | | `tfTwoAsset` | `0x00100000` | `Amount` and `Amount2` | Withdraw both of this AMM's assets, in up to the specified amounts. The actual amounts received maintains the balance of assets in the AMM's pool. |
The following combinations of fields indicate a **single asset withdrawal**: The following combinations of fields indicate a **single asset withdrawal**:
| Flag Name(s) | Flag Value | Fields Specified | Meaning | | Flag Name(s) | Flag Value | Fields Specified | Meaning |
|-------------------------|--------------|---------------------------|---------| |-------------------------|--------------|--------------------------|---------|
| `tfSingleAsset` | `0x00080000` | `Amount` only | Withdraw exactly the specified amount of one asset, by returning as many LP Tokens as necessary. | | `tfSingleAsset` | `0x00080000` | `Amount` only | Withdraw exactly the specified amount of one asset, by returning as many LP Tokens as necessary. |
| `tfOneAssetWithdrawAll` | `0x00040000` | `Amount` only | Withdraw at least the specified amount of one asset, by returning _all_ of your LP Tokens. Fails if you can't receive at least the specified amount. The specified amount can be 0, meaning the transaction succeeds if it withdraws any positive amount. | | `tfOneAssetWithdrawAll` | `0x00040000` | `Amount` only | Withdraw at least the specified amount of one asset, by returning _all_ of your LP Tokens. Fails if you can't receive at least the specified amount. The specified amount can be 0, meaning the transaction succeeds if it withdraws any positive amount. |
| `tfOneAssetLPToken` | `0x00200000` | `Amount` and `LPTokensIn` | Withdraw up to the specified amount of one asset, by returning up to the specified amount of LP Tokens. | | `tfOneAssetLPToken` | `0x00200000` | `Amount` and `LPTokenIn` | Withdraw up to the specified amount of one asset, by returning up to the specified amount of LP Tokens. |
| `tfLimitLPToken` | `0x00400000` | `Amount` and `EPrice` | Withdraw up to the specified amount of one asset, but pay no more than the specified effective price in LP Tokens per unit of the asset received. | | `tfLimitLPToken` | `0x00400000` | `Amount` and `EPrice` | Withdraw up to the specified amount of one asset, but pay no more than the specified effective price in LP Tokens per unit of the asset received. |
Any other combination of these fields is invalid. Any other combination of these fields is invalid.
### Single Asset Withdrawal Fee
The fee for a single asset withdrawal is calculated to be the same as if you had performed a double-asset withdrawal and then used the AMM to trade all of the other asset for the one you are withdrawing. The trading fee applies to the amount you would need to trade for, but not to the rest of the withdrawal.
<!-- TODO: add a formula and example calculation(s) of single-asset withdrawal fees -->
### AMMWithdraw Flags ### AMMWithdraw Flags
@@ -101,15 +107,18 @@ You must specify **exactly one** of these flags, in addition to any [global flag
In addition to errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html): In addition to errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html):
| Error Code | Description | | Error Code | Description |
|:---------------------|:---------------------------------------------| |:-------------------------|:---------------------------------------------|
| `tecFROZEN` | The transaction tried to deposit a [frozen](freezes.html) token. | | `tecFROZEN` | The transaction tried to deposit a [frozen](freezes.html) token. |
| `tecAMM_BALANCE` | The transaction would withdraw all of one asset from the pool, or rounding would cause a "withdraw all" to leave a nonzero amount behind. | | `tecAMM_BALANCE` | The transaction would withdraw all of one asset from the pool, or rounding would cause a "withdraw all" to leave a nonzero amount behind. |
| `temBAD_AMM_TOKENS` | The transaction specified the LP Tokens incorrectly; for example, the `issuer` is not the AMM's associated AccountRoot address or the `currency` is not the currency code for this AMM's LP Tokens, or the transaction specified this AMM's LP Tokens in one of the asset fields. |
| `tecAMM_FAILED_WITHDRAW` | The conditions on the withdrawal could not be satisfied; for example, the requested effective price in the `EPrice` field is too low. | | `tecAMM_FAILED_WITHDRAW` | The conditions on the withdrawal could not be satisfied; for example, the requested effective price in the `EPrice` field is too low. |
| `tecAMM_INVALID_TOKENS` | The AMM for this token pair does not exist, or one of the calculations resulted in a withdrawal amount rounding to zero. | | `tecAMM_INVALID_TOKENS` | The AMM for this token pair does not exist, or one of the calculations resulted in a withdrawal amount rounding to zero. |
| `tecINSUF_RESERVE_LINE` | The sender of this transaction does meet the increased [reserve requirement](reserves.html) of processing this transaction, probably because they need at least one new trust line to hold one of the assets to be withdrawn, and they don't have enough XRP to meet the additional owner reserve for a new trust line. |
| `tecNO_AUTH` | The sender is not authorized to hold one of the deposit assets. |
| `temBAD_AMM_OPTIONS` | The transaction specified an invalid combination of fields. See [AMMWithdraw Modes](#ammwithdraw-modes). | | `temBAD_AMM_OPTIONS` | The transaction specified an invalid combination of fields. See [AMMWithdraw Modes](#ammwithdraw-modes). |
| `temBAD_AMM_TOKENS` | The transaction specified the LP Tokens incorrectly; for example, the `issuer` is not the AMM's associated AccountRoot address or the `currency` is not the currency code for this AMM's LP Tokens, or the transaction specified this AMM's LP Tokens in one of the asset fields. |
| `terNO_AMM` | The Automated Market Maker instance for the asset pair in this transaction does not exist. | | `terNO_AMM` | The Automated Market Maker instance for the asset pair in this transaction does not exist. |
<!--{# common link defs #}--> <!--{# common link defs #}-->
{% include '_snippets/rippled-api-links.md' %} {% include '_snippets/rippled-api-links.md' %}
{% include '_snippets/tx-type-links.md' %} {% include '_snippets/tx-type-links.md' %}