|
| 1 | +<pre> |
| 2 | + xls: XXXX |
| 3 | + title: Institutional DeFi Insurance Protocol |
| 4 | + description: Ecosystem-level insurance layer for XLS-66 Lending Protocol vault depositors, protecting against borrower defaults exceeding First-Loss Capital coverage. |
| 5 | + author: Will Flores <wflores@wardprotocol.org> |
| 6 | + discussion-from: https://github.com/XRPLF/XRPL-Standards/discussions/474 |
| 7 | + category: Ecosystem |
| 8 | + requires: XLS-65, XLS-66 |
| 9 | + status: Draft |
| 10 | + created: 2026-02-15 |
| 11 | + updated: 2026-02-21 |
| 12 | +</pre> |
| 13 | + |
| 14 | +# Institutional DeFi Insurance Protocol |
| 15 | + |
| 16 | +## 1. Abstract |
| 17 | + |
| 18 | +Ward Protocol provides institutional-grade insurance coverage for vault depositors participating in the XLS-66 Lending Protocol on the XRP Ledger. The protocol enables vault depositors to purchase insurance policies that protect against losses exceeding First-Loss Capital protection when borrowers default. |
| 19 | + |
| 20 | +Ward Protocol operates as an ecosystem-level application using existing XRPL primitives (XLS-30 AMM pools, XLS-20 NFTs, Payment transactions, and Escrow) without requiring protocol amendments. Insurance pools aggregate institutional capital, collect premiums from protected depositors, and automatically process claims triggered by XLS-66 default events that result in vault asset losses. |
| 21 | + |
| 22 | +## 2. Motivation |
| 23 | + |
| 24 | +The XLS-66 Lending Protocol enables fixed-term, fixed-rate loans on the XRP Ledger using pooled liquidity from XLS-65 Single Asset Vaults. While XLS-66 includes First-Loss Capital protection managed by LoanBrokers, vault depositors face significant uninsured risks when defaults exceed this protection. |
| 25 | + |
| 26 | +### 2.1 The Uninsured Loss Gap |
| 27 | + |
| 28 | +When a borrower defaults on an XLS-66 loan, the loss calculation follows: |
| 29 | +``` |
| 30 | +DefaultAmount = Loan.PrincipalOutstanding + Loan.InterestOutstanding |
| 31 | +DefaultCovered = min(FirstLossCapital × LiquidationRate, DefaultAmount) |
| 32 | +VaultLoss = DefaultAmount - DefaultCovered |
| 33 | +``` |
| 34 | + |
| 35 | +Example: A $55,000 default with $1,000 first-loss coverage leaves vault depositors with $54,000 in uninsured losses, distributed proportionally across all vault share holders via reduced `Vault.AssetsTotal`. |
| 36 | + |
| 37 | +### 2.2 Institutional Barriers |
| 38 | + |
| 39 | +This uninsured gap creates barriers for institutional participation: |
| 40 | + |
| 41 | +1. Regulatory capital requirements prevent allocation to uninsured positions |
| 42 | +2. Risk exposure exceeds acceptable limits for fiduciary mandates |
| 43 | +3. No mechanism exists to transfer tail risk to willing counterparties |
| 44 | +4. Vault share devaluation from `Vault.LossUnrealized` creates mark-to-market risk |
| 45 | + |
| 46 | +## 3. Specification |
| 47 | + |
| 48 | +### 3.1 Design Rationale: Ecosystem Layer |
| 49 | + |
| 50 | +Ward Protocol operates entirely at the ecosystem layer rather than proposing protocol amendments: |
| 51 | + |
| 52 | +- **Rapid deployment**: Production-ready in weeks, not the months/years required for amendments |
| 53 | +- **Market validation**: Prove institutional demand before requesting protocol changes |
| 54 | +- **Iteration speed**: Bug fixes and feature additions without consensus requirements |
| 55 | +- **Future upgrade path**: Successful adoption informs a potential native amendment (XLS-104) |
| 56 | + |
| 57 | +### 3.2 XRPL Primitives Used |
| 58 | + |
| 59 | +| Primitive | Usage | |
| 60 | +|-----------|-------| |
| 61 | +| XLS-20 NFTs | Policy certificates (transferable, with metadata) | |
| 62 | +| XLS-30 AMM | Insurance pool capital aggregation | |
| 63 | +| XLS-65 Vaults | Monitor depositor positions and share values | |
| 64 | +| XLS-66 Loans | Detect defaults, calculate losses | |
| 65 | +| XLS-80 Permissioned Domains | Institutional compliance and access control | |
| 66 | +| XLS-70 Credentials | Credential verification for domain membership | |
| 67 | +| Escrow | Time-locked claim settlements (48-hour dispute window) | |
| 68 | + |
| 69 | +### 3.3 Core Components |
| 70 | + |
| 71 | +#### 3.3.1 Insurance Pool Management |
| 72 | + |
| 73 | +Insurance pools aggregate capital using XLS-30 AMM pools: |
| 74 | + |
| 75 | +- **Pool Asset**: XRP or RLUSD (matches the XLS-66 vault asset) |
| 76 | +- **Liquidity Providers**: Institutional capital allocators seeking premium yield |
| 77 | +- **Pool Shares**: AMM LP tokens representing proportional ownership |
| 78 | +- **Capital Requirements**: Minimum 200% coverage ratio enforced programmatically |
| 79 | + |
| 80 | +#### 3.3.2 Policy Issuance |
| 81 | + |
| 82 | +Policies are minted as XLS-20 NFTs with structured metadata: |
| 83 | +```json |
| 84 | +{ |
| 85 | + "protocol": "ward-v1", |
| 86 | + "vault_id": "2DE64CA4...", |
| 87 | + "coverage_amount": "50000000000", |
| 88 | + "coverage_start": "2026-02-15T00:00:00Z", |
| 89 | + "coverage_end": "2026-05-15T00:00:00Z", |
| 90 | + "pool_id": "3F4A5B6C..." |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +Policy NFTs are fully transferable, enabling secondary market trading and portfolio management. |
| 95 | + |
| 96 | +#### 3.3.3 Premium Calculation |
| 97 | +``` |
| 98 | +premium = coverage × base_rate × term_factor × risk_multiplier |
| 99 | +
|
| 100 | +Where: |
| 101 | + base_rate: 1-5% annually (risk-tiered) |
| 102 | + risk_multiplier: 0.5x - 2.0x based on: |
| 103 | + - Vault utilization rate |
| 104 | + - First-loss coverage ratio |
| 105 | + - Impairment ratio (LossUnrealized / AssetsTotal) |
| 106 | + - Historical default rate |
| 107 | +``` |
| 108 | + |
| 109 | +#### 3.3.4 Default Monitoring |
| 110 | + |
| 111 | +Real-time monitoring of XLS-66 loan state: |
| 112 | + |
| 113 | +- WebSocket subscription to `LoanManage` transactions |
| 114 | +- Parse `tfLoanDefault` flag (0x00010000) |
| 115 | +- Track `Vault.AssetsTotal` changes post-default |
| 116 | +- Calculate per-share loss impact |
| 117 | + |
| 118 | +#### 3.3.5 Claim Validation (9 Steps) |
| 119 | + |
| 120 | +1. Verify loan defaulted (`lsfLoanDefault` flag on ledger) |
| 121 | +2. Calculate vault loss using XLS-66 formulas |
| 122 | +3. Fetch policy from Ward database |
| 123 | +4. Verify policy status is active |
| 124 | +5. Check claim is within coverage window |
| 125 | +6. Verify vault matches policy vault_id |
| 126 | +7. Calculate payout: `min(depositor_loss, coverage_amount)` |
| 127 | +8. Verify pool capital adequacy for payout |
| 128 | +9. Approve/reject with full audit log |
| 129 | + |
| 130 | +#### 3.3.6 Escrow Settlement |
| 131 | + |
| 132 | +Approved claims create XRPL Escrow transactions: |
| 133 | + |
| 134 | +- 48-hour hold period for dispute resolution |
| 135 | +- Multi-sig (3-of-5) can cancel fraudulent claims during hold |
| 136 | +- Automatic release after hold period expires |
| 137 | +- Full on-chain audit trail |
| 138 | + |
| 139 | +### 3.4 Permissioned Domain Integration (XLS-80) |
| 140 | + |
| 141 | +Ward Protocol uses XLS-80 Permissioned Domains for institutional access control: |
| 142 | + |
| 143 | +- **Domain Registration**: Ward operates a permissioned domain requiring XLS-70 credentials |
| 144 | +- **Credential Types**: KYC verification, accredited investor status, institutional mandate |
| 145 | +- **Access Tiers**: Public (view), Authenticated (purchase policies), Admin (pool management) |
| 146 | + |
| 147 | +### 3.5 API Specification |
| 148 | + |
| 149 | +Production API available at `https://api.wardprotocol.org` with OpenAPI documentation at `/docs`. |
| 150 | + |
| 151 | +**Endpoint Categories:** |
| 152 | +- **Public**: Health checks, pool statistics, protocol information |
| 153 | +- **Permissioned Domains**: Domain creation, credential verification, membership management |
| 154 | +- **Admin**: Pool configuration, claim processing, system monitoring |
| 155 | + |
| 156 | +All authenticated endpoints require API key via `X-API-Key` header with tiered rate limiting. |
| 157 | + |
| 158 | +## 4. Security Considerations |
| 159 | + |
| 160 | +1. **Oracle Risk**: Multiple independent monitoring nodes with 3-of-5 consensus required for claim approval |
| 161 | +2. **Capital Adequacy**: 200% minimum coverage ratio enforced; pools cannot issue policies beyond capacity |
| 162 | +3. **Key Management**: Multi-sig (3-of-5) institutional signers; cold storage for reserve capital |
| 163 | +4. **Claim Validation**: 48-hour escrow provides dispute window before settlement |
| 164 | +5. **No Custom Smart Contracts**: Uses only native XRPL transaction types, eliminating smart contract risk |
| 165 | +6. **Infrastructure Security**: Production VPS hardened with UFW firewall, Fail2ban intrusion prevention, SSH key-only auth, automated PostgreSQL backups |
| 166 | + |
| 167 | +## 5. Reference Implementation |
| 168 | + |
| 169 | +**Repository**: https://github.com/wflores9/ward-protocol |
| 170 | + |
| 171 | +**Stack**: |
| 172 | +- Python 3.12 with xrpl-py SDK |
| 173 | +- FastAPI + Uvicorn (API server) |
| 174 | +- PostgreSQL 16 (policy and claims database) |
| 175 | +- Nginx with SSL/TLS (reverse proxy) |
| 176 | + |
| 177 | +**Current Status**: |
| 178 | +- Production API live at api.wardprotocol.org |
| 179 | +- XLS-80 Permissioned Domain registered on testnet |
| 180 | +- 60 automated tests, 75% code coverage |
| 181 | +- OpenAPI documentation at /docs and /redoc |
| 182 | +- Hardened production infrastructure with automated backups |
| 183 | + |
| 184 | +## 6. Future Upgrade Path: XLS-104 |
| 185 | + |
| 186 | +If Ward Protocol achieves product-market fit, a future amendment proposal could introduce: |
| 187 | + |
| 188 | +- Native `InsurancePolicy` ledger object type |
| 189 | +- `PolicyClaim` transaction type |
| 190 | +- Automated claim settlement hooks integrated with XLS-66 |
| 191 | +- Reduced operational costs through native ledger support |
| 192 | + |
| 193 | +This ecosystem-first approach validates demand and refines the specification before proposing protocol-level changes. |
| 194 | + |
| 195 | +## 7. Discussion |
| 196 | + |
| 197 | +Community feedback is requested on: |
| 198 | + |
| 199 | +1. Are there other XRPL lending protocols Ward should design compatibility for? |
| 200 | +2. Would native insurance primitives be valuable for use cases beyond lending? |
| 201 | +3. Should we coordinate with XLS-66 implementers for joint testnet demonstration? |
| 202 | +4. Is the 48-hour escrow period appropriate, or should it be configurable? |
| 203 | + |
| 204 | +--- |
| 205 | + |
| 206 | +**Contact:** |
| 207 | +- GitHub: [@wflores9](https://github.com/wflores9) |
| 208 | +- Repository: https://github.com/wflores9/ward-protocol |
| 209 | +- API: https://api.wardprotocol.org |
| 210 | +- Email: wflores@wardprotocol.org |
0 commit comments