Repository navigation
Amendment XLS: Collateral Lock for Loans #676
baali-who
started this conversation in
XLS Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
XLS-66 loans carry no on-ledger collateral by design. Builders who want collateral pair a loan with an XLS-85 token escrow that does not know the loan exists, so release depends on a key holder, a secret, a bot or a timer.
On Devnet (stock rippled 3.4.1) we reproduced three failures, each
tesSUCCESS:3B32B17240A4BD0E8D6D75DA97D813040B6124C90151E8B06EBAF9AD14D79D26;CancelAfterthat fell before the loan's maturity, with the loan unpaid:8E74D68A1EF3DC23DFF3FB32B827BD3855BDEF37252729E1813F20446876700B;E100E8DDDE102306067F3BF20E6EC6058E7E348B5E4E2E4A8D91FE7D27358FEB.Devnet resets, so the submit and tx JSON for all three, and the standalone and two-validator run logs, are at https://github.com/LiquidTeams/collateral-lock-evidence.
Proposal:
CollateralLockLoan.CollateralID, set byLoanSet, names a token escrow owned by and payable to the borrower. The escrow's existingLoanIDfield (added to theEscrowformat) points back.EscrowFinishandEscrowCancelon that escrow fail for every account with a new result code,tecPLEDGED, until the escrow's ownCancelAfterpasses.LoanManagewithtfLoanDefault, the same transaction moves the escrowed amount to the loan broker's owner and deletes the escrow. The sweep behaves exactly as anEscrowFinishsubmitted by the broker owner as destination (XLS-85 rules).ValidCollateralLock). A loan withoutCollateralIDbehaves exactly as today.EscrowFinish/EscrowCancelon the pledged escrowCancelAftertecPLEDGED(checked in preclaim, for every account)CancelAfter(the broker never defaulted)LoanManage tfLoanDefaultReference implementation
collateral-lock-developon https://github.com/LiquidTeams/rippled. It is six commits on top ofdevelop, with the amendment atSupported::No. Draft PR: feat: Add CollateralLock amendment rippled#8652.CollateralLockjtx suite of 11 cases, 1,377 checks and 0 failures (including IOU collateral and the lapse rule); the fullxrpld --unittestrun, 260 suites, 5,361 cases, 1,309,095 checks, 0 failures.The draft spec follows the XLS template, with
## Ledger Entry:and## Transaction:sections forLoan,Escrow,LoanSet,EscrowFinish,EscrowCancelandLoanManage. We will open it as a Draft PR after this discussion.Two design choices we'd like reviewed
CancelAfter.LoanSetrequires the escrow to have aCancelAfterno earlier thanMaturity + GracePeriod, so the broker always has at least one grace period after maturity in which only it can act (default and sweep). If it never defaults, the borrower can cancel the escrow afterCancelAfter, as with any XLS-85 escrow; the loan stays unpaid and can still be defaulted for the cover and vault accounting. We rejected a margin afterNextPaymentDueDate + GracePeriod(it needs a new constant or field, and keys off a value the borrower resets by paying) and letting anyone trigger the default (it changes XLS-66's broker-only default and forces the broker's cover to be liquidated). Is oneGracePeriodthe right protocol floor?EscrowFinishby the destination. The broker owner signs theLoanManage, so XLS-85's "recipient submits" rules apply:RequireAuth, deep freeze and MPT lock on the broker owner block it, the holding is created if missing, and the trust-line limit is not checked. We rejected a pledge-time capacity check because limits, balances and issuer rates can change before default, and duplicating the delivery arithmetic in preclaim risks divergence. Does reusing the XLS-85 destination rules read right to you?requires: XLS-66, XLS-85) or a nested patch under XLS-66, like the two-step loan creation in PR XLS-65/66: Two-step loan creation (LendingProtocolV1_2) #570? If two-step creation lands,CollateralIDwould move toLoanAccept.Authors: Alexander Baalmann (@baali-who), Harry Malinski (@hmalinski), LiquidAcre.
All reactions