AMMClawback

[Source]

Attention

AMMClawback functionality is part of the proposed XLS-73d extension to the XRP Ledger protocol. You can test this feature on the Devnet test network, but there isn't an official amendment and it isn't available on the production Mainnet. Until there is an amendment, the details documented on this page are subject to change.

Claw back tokens from a holder that has deposited your issued tokens into an AMM pool.

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.

Example AMMClawback JSON

{
  "TransactionType": "AMMClawback",
  "Account": "rPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL",
  "Holder": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
  "Asset": {
      "currency" : "FOO",
      "issuer" : "rPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL"
  },
  "Asset2" : {
      "currency" : "BAR",
      "issuer" : "rHtptZx1yHf6Yv43s1RWffM3XnEYv3XhRg"
  },
  "Amount": {
      "currency" : "FOO",
      "issuer" : "rPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL",
      "value" : "1000"
  }
}

AMMClawback Fields

AMMClawback transactions use the following fields:

FieldJSON TypeInternal TypeRequiredDescription
AccountStringAccountIDYesThe issuer of the asset being clawed back. This field must match the account submitting the transaction.
AssetObjectSTIssueYesSpecifies the asset that the issuer wants to claw back from the AMM pool. In JSON, this is an object with currency and issuer fields. The issuer field must match with Account.
Asset2ObjectSTIssueYesSpecifies the other asset in the AMM's pool. In JSON, this is an object with currency and issuer fields (omit issuer for XRP).
AmountCurrency AmountAmountNoThe 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 will be clawed back.
HolderStringAccountIDYesThe account holding the asset to be clawed back.

AMMClawback Flags

Flag NameHex ValueDecimal ValueDescription
tfClawTwoAssets0x000000011Claw back the specified amount of Asset, and a corresponding amount of Asset2 based on the AMM pool's asset proportion; both assets must be issued by the issuer in the Account field. If this flag isn't enabled, the issuer claws back the specified amount of Asset, while a corresponding proportion of Asset2 goes back to the Holder.

Error Cases

Besides errors that can occur for all transactions, AMMClawback transactions can result in the following transaction result codes:

Error CodeDescription
tecNO_PERMISSIONOccurs 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_BALANCEOccurs if the Holder doesn't hold any LP tokens from the AMM pool.
temDISABLEDOccurs if the AMMClawback amendment is not enabled.
temBAD_AMOUNTOccurs 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_FLAGOccurs if you try enabling flags besides tfClawTwoAssets.
temMALFORMEDOccurs if the issuer subfield doesn't match between Asset and Account, Account is the same as the Holder, or Asset is XRP.
terNO_AMMOccurs if the AMM pool specified by Asset and Asset2 doesn't exist.