Skip to content

Conversation

@sappenin
Copy link
Collaborator

@sappenin sappenin commented Jan 7, 2026

Add XLS-0085 Token Escrow Support (v6.0.0)

Overview

This PR implements support for the XLS-0085 Token Escrow amendment, which extends the existing Escrow functionality to support Trustline-based tokens (IOUs)** and **Multi-Purpose Tokens (MPTs) in addition to XRP.

✨ New Features

1. IOU Token Escrows

  • IOU tokens can now be held in escrow
  • Requires issuer to enable the new ALLOW_TRUSTLINE_LOCKING flag
  • Transfer rates are locked at escrow creation time

2. MPT Token Escrows

  • MPT tokens can now be held in escrow
  • Requires lsfMPTCanEscrow and lsfMPTCanTransfer flags on the token
  • Locked amounts are tracked in MpTokenObject and MpTokenIssuanceObject

3. New AccountSet Flag

  • Added ALLOW_TRUSTLINE_LOCKING(17) enum value
  • Added AccountRootFlags.ALLOW_TRUSTLINE_LOCKING (0x40000000) constant
  • Added lsfAllowTrustLineLocking() method for checking account state

4. New EscrowObject Fields

  • transferRate(): Stores the locked transfer rate (IOU) or transfer fee (MPT) at escrow creation
  • issuerNode(): Reference to issuer's directory node when issuer is neither source nor destination

5. MPT Locked Amount Tracking

  • MpTokenObject.lockedAmount(): Tracks amount locked in escrows for a holder
  • MpTokenIssuanceObject.lockedAmount(): Tracks total amount locked across all holders

✅ Test Coverage

  • Unit Tests: 168/168 passing (10 new tests added)
  • Integration Tests: Full coverage for IOU and MPT escrow scenarios including create/finish/cancel operations, flag handling, transfer rate locking, and error conditions

🚨 Breaking Changes

While all existing XRP escrow functionality remains fully backward compatible, there are some breaking changes required to support IOU and MPT tokens.

Type Changes

  • EscrowCreate.amount(): XrpCurrencyAmountCurrencyAmount
  • EscrowObject.amount(): XrpCurrencyAmountCurrencyAmount
  • MetaEscrowObject.amount(): XrpCurrencyAmountCurrencyAmount

Impact: Code that reads escrow amounts must be updated to handle CurrencyAmount using .handle() or .map() methods. Building transactions with XrpCurrencyAmount continues to work due to polymorphism.

@sappenin sappenin requested a review from nkramer44 January 7, 2026 23:58
@sappenin sappenin self-assigned this Jan 7, 2026
@sappenin sappenin requested a review from nhartner as a code owner January 7, 2026 23:58
* @return An {@link Optional} of type {@link String} containing the issuer node hint.
*/
@JsonProperty("IssuerNode")
Optional<String> issuerNode();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This is typed as a String to conform to the Hex value returned by the RPC layer. Also aligns with RippleStateObject types like lowNode and highNode`.

@sappenin sappenin requested a review from nkramer44 as a code owner January 8, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants