XRP Ledger Apex is back in Amsterdam

Register Now
Last updated
Edit

Clawback

[Source]

Requires the Clawback amendment.

Claw back tokens issued by your account.

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 Clawback JSON

{
  "TransactionType": "Clawback",
  "Account": "rp6abvbTbjoce8ZDJkT6snvxTZSYMBCC9S",
  "Amount": {
      "currency": "FOO",
      "issuer": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
      "value": "314.159"
    }
}

Clawback Fields

In addition to the common fields, Clawback transactions use the following fields:

FieldJSON TypeInternal TypeDescription
AmountCurrency AmountAmountIndicates the amount being clawed back, as well as the counterparty from which the amount is being clawed back. The quantity to claw back, in the value sub-field, must not be zero. If this is more than the current balance, the transaction claws back the entire balance. The sub-field issuer within Amount represents the token holder's account ID, rather than the issuer's.

Note: In the XRP Ledger, the party that created a token is called the issuer, but trust lines are bidirectional and, under some configurations, both sides can be seen as the issuer. In this transaction, the token issuer's address is in the Account field, and the token holder's address is in the Amount field's issuer sub-field.

Error Cases

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

Error CodeDescription
temDISABLEDOccurs if the Clawback amendment is not enabled.
temBAD_AMOUNTOccurs if the holder's balance is 0. It is not an error if the amount exceeds the holder's balance; in that case, the maximum available balance is clawed back. Also occurs if the counterparty listed in Amount is the same as the Account issuing this transaction.
tecNO_LINEOccurs there is no trust line with the counterparty or that trust line's balance is 0.
tecNO_PERMISSIONOccurs if you attempt to set lsfAllowTrustlineClawback while lsfNoFreeze is set. Also occurs, conversely, if you try to set lsfNoFreeze while lsfAllowTrustLineClawback is set.