XRP Ledger Standards
XLS-66.4.2 Draft Amendment

Closed-Ended Loan Gates

Restricts loan origination and broker creation for the closed-ended Vault lifecycle

Authors
Jingchen Wu, Vito Tumas, Gregory Tsipenyuk
Created
2026-07-21
Updated
2026-11-25
Requires
XLS-65.4.4
Discussion
XRPLF/XRPL-Standards/discussions/590
Amendment
LendingProtocolV1_1
Patch of
XLS-0066: Lending Protocol

66.4.2 Closed-Ended Loan Gates

1. Abstract

Under LendingProtocolV1_1, loans funded by a closed-ended Vault may originate only during its Investment phase and must mature before Redemption. New LoanBroker objects require a closed-ended Vault. Repayment and loan management remain available in every phase.

2. Motivation

A closed-ended Vault needs a stable pool during Investment and must stop originating debt before depositors can redeem. Limiting the loan schedule prevents an operator from creating a loan that is structurally due at or after Redemption, while keeping repayments available so late funds can still return to the Vault.

3. Specification

This patch changes the parent XLS-66 sections named below. It uses the Vault fields and phases defined by XLS-65.4.4. All other parent behavior is unchanged.

3.1 Protocol Constants

Constant Value Meaning
LOAN_REDEMPTION_BUFFER 60 Minimum seconds between a loan's final scheduled payment and the Vault's RedemptionDate.

3.2 Transaction: LoanSet

3.2.1 Failure Conditions

Append these checks to parent §3.8.5.2:

    • LendingProtocol (parent): The check does not apply.
    • LendingProtocolV1_1: The Vault is closed-ended and now <= SubscriptionDate, where now is the parent ledger close time. (tecTOO_SOON)
    • LendingProtocol (parent): The check does not apply.
    • LendingProtocolV1_1: The Vault is closed-ended and now >= RedemptionDate. (tecEXPIRED)
    • LendingProtocol (parent): The check does not apply.
    • LendingProtocolV1_1: The Vault is closed-ended and StartDate + (PaymentInterval × PaymentTotal) + LOAN_REDEMPTION_BUFFER > RedemptionDate. (tecNO_PERMISSION)

For check 27, StartDate is now, as the parent sets a new loan's StartDate to the ledger close time. The expression MUST use arithmetic wide enough to avoid overflow.

3.2.2 Invariants

Under LendingProtocolV1_1, a closed-ended LoanSet succeeds only during the Investment phase and only if:

StartDate + (PaymentInterval × PaymentTotal) + LOAN_REDEMPTION_BUFFER <= RedemptionDate

The maturity bound is checked only at origination. StartDate and PaymentInterval are immutable, and ordinary scheduled payments preserve the schedule. Before fixCleanup3_4_0, unimpairment can rebase an already-late loan's due date past RedemptionDate; this patch does not re-check the bound in that case. Impairment only moves a due date earlier, and under fixCleanup3_4_0 neither impairment nor unimpairment changes it.

3.3 Transaction: LoanBrokerSet

3.3.1 Failure Conditions

In parent §3.3.3.2, append this check to the "LoanBrokerID is not specified" branch and renumber the later checks:

    • LendingProtocol (parent): The check does not apply.
    • LendingProtocolV1_1: Vault.VaultKind is not ClosedEnded. (tecNO_PERMISSION)

This check applies only when creating a LoanBroker. Updating an existing LoanBroker with LoanBrokerID remains allowed, including one attached to an open-ended Vault.

3.3.2 Invariants

Under LendingProtocolV1_1, no new LoanBroker is created against a Vault whose kind is not ClosedEnded.

3.4 Unchanged Transactions

LoanPay, LoanManage, and LoanDelete remain allowed in every phase. LoanBrokerDelete and all three LoanBrokerCover transactions also ignore the phase.

4. Rationale

The 60-second buffer prevents a loan's final payment from being scheduled at the instant Redemption opens. It is a floor on the schedule, not a guarantee that a borrower pays on time. The latest possible term for a new loan therefore shrinks as RedemptionDate approaches.

Requiring closed-ended Vaults only when a broker is created preserves existing open-ended brokers. Phase-independent payment and management paths let late payments return to the Vault after Redemption begins and let impaired or defaulted loans be resolved.

5. Backwards Compatibility

After LendingProtocolV1_1 is enabled, creating a LoanBroker without LoanBrokerID fails with tecNO_PERMISSION when its Vault is open-ended. Updating an existing broker by supplying its LoanBrokerID remains allowed, including for brokers already attached to open-ended Vaults.

6. Test Plan

The reference implementation tests LoanSet against checks 25-27 with the amendment both enabled and disabled, including the Subscription/Investment and Investment/Redemption phase boundaries and the exact LOAN_REDEMPTION_BUFFER boundary at, one second above, and one second below the limit, using wide arithmetic to confirm no overflow. It tests LoanBrokerSet creation against both open-ended and closed-ended Vaults, and confirms that updating an existing LoanBroker by LoanBrokerID succeeds regardless of Vault.VaultKind. It also tests that LoanPay, LoanManage, LoanDelete, LoanBrokerDelete, and the LoanBrokerCover transactions remain phase-independent, and exercises the maturity-bound interaction with impairment and unimpairment both before and after fixCleanup3_4_0.

7. Security Considerations

The maturity check limits a loan's schedule but does not guarantee settlement. Redemption begins unconditionally at RedemptionDate; depositors who redeem before a late payment arrives receive a share of the assets then held, while later redeemers may receive more after the payment is collected.

Implementations must calculate the full maturity expression without overflow and must distinguish broker creation from update so the new restriction cannot strand existing brokers.