Merge pull request #3242 from tequdev/ja-ammclawback

[JA] AMMClawback and other fixes
This commit is contained in:
Rome Reginelli
2025-09-02 12:09:22 -07:00
committed by GitHub
11 changed files with 106 additions and 25 deletions

View File

@@ -11,7 +11,7 @@ labels:
Claw back tokens from a holder who has deposited your issued tokens into an AMM pool.
Clawback is disabled by default. To use clawback, you must send an [AccountSet transaction](https://xrpl.org/docs/references/protocol/transactions/types/accountset) to enable the **Allow Trust Line Clawback** setting. An issuer with any existing tokens cannot enable clawback. You can only enable **Allow Trust Line Clawback** if you have a completely empty owner directory, meaning you must do so before you set up any trust lines, offers, escrows, payment channels, checks, or signer lists. After you enable clawback, it cannot reverted: the account permanently gains the ability to claw back issued assets on trust lines.
Clawback is disabled by default. To use clawback, you must send an [AccountSet transaction][] to enable the **Allow Trust Line Clawback** setting. An issuer with any existing tokens cannot enable clawback. You can only enable **Allow Trust Line Clawback** if you have a completely empty owner directory, meaning you must do so before you set up any trust lines, offers, escrows, payment channels, checks, or signer lists. After you enable clawback, it cannot reverted: the account permanently gains the ability to claw back issued assets on trust lines.
_(Added by the [AMMClawback amendment][].)_
@@ -49,7 +49,7 @@ _(Added by the [AMMClawback amendment][].)_
| `Asset` | Object | Issue | Yes | Specifies the asset that the issuer wants to claw back from the AMM pool. The asset can be XRP, a token, or an MPT (see: [Specifying Without Amounts][]). The `issuer` field must match with `Account`. |
| `Asset2` | Object | Issue | Yes | Specifies the other asset in the AMM's pool. The asset can be XRP, a token, or an MPT (see: [Specifying Without Amounts][]). |
| `Amount` | [Currency Amount][] | Amount | No | The maximum amount to claw back from the AMM account. The `currency` and `issuer` subfields should match the `Asset` subfields. If this field isn't specified, or the `value` subfield exceeds the holder's available tokens in the AMM, all of the holder's tokens are clawed back. |
| `Holder` | String | AccountID | Yes | The account holding the asset to be clawed back. |
| `Holder` | String - [Address][] | AccountID | Yes | The account holding the asset to be clawed back. |
## AMMClawback Flags
@@ -67,7 +67,7 @@ Besides errors that can occur for all transactions, `AMMClawback` transactions c
|:-------------------|:------------|
| `tecNO_PERMISSION` | Occurs if you attempt to claw back tokens from an AMM without the `lsfAllowTrustlineClawback` flag enabled, or the `tfClawTwoAssets` flag is enabled when you didn't issue both assets in the AMM. Also occurs if the `Asset` issuer doesn't match `Account`. |
| `tecAMM_BALANCE` | Occurs if the `Holder` doesn't hold any LP tokens from the AMM pool. |
| `temDISABLED` | Occurs if the [AMMClawback amendment](#) is not enabled. |
| `temDISABLED` | Occurs if the [AMMClawback amendment][] is not enabled. |
| `temBAD_AMOUNT` | Occurs if the `Amount` field in the `AMMClawback` transaction is less than or equal to 0, or the `currency` and `issuer` subfields don't match between `Amount` and `Asset`. |
| `temINVALID_FLAG` | Occurs if you try enabling flags besides `tfClawTwoAssets`. |
| `temMALFORMED` | Occurs if the `issuer` subfield doesn't match between `Asset` and `Account`, `Account` is the same as the `Holder`, or `Asset` is XRP. |