Ship Slice 3.3 v0.0.43 — second foundational template del Origin Contract Atelier.
Multi-party escrow + time-locked milestones + dispute-enabled via Pillar 6 Tribunal.
Cambios:
- contracts/origin-escrow/Cargo.toml: ink! 6.0.0-beta.1 + scale codec aligned
- contracts/origin-escrow/lib.rs: full ink! v6 contract source ~500 LOC:
* 5-state machine canonical (Created → Active → Disputed → Releasing → Completed)
* Storage canonical: parties (depositor + beneficiary + arbiter + treasury) +
config (terms_hash + total + fee + windows) + state tracking + milestones mapping
* 5 events canonical (Deposited, MilestoneCompleted, DisputeRaised,
DisputeResolved, EscrowCompleted)
* 12 error variants canonical (InvalidState, UnauthorizedCaller, etc.)
* Constructor canonical con invariants compile-detect (fee ≤ 5% BM V2 §5.3,
depositor != beneficiary, terms_hash != zero)
* 9 read methods canonical (state, parties, amounts, milestones)
* 5 write methods canonical (deposit, add_milestone, confirm_milestone,
raise_dispute, resolve_dispute)
* 4 Resolution variants Tribunal: ReleaseToBeneficiary, RefundToDepositor,
SplitFifty, Custom (with depositor_bps + beneficiary_bps == 10_000 invariant)
* 3 unit tests canonical
- contracts/origin-escrow/README.md: use cases + state machine diagram +
resolution patterns + cross-pillar integration
Inmutables compliance:
- #16 HTS anti-clasista: escrow_fee_bps cap 5% BM V2 §5.3
- #26 Content-Addressed: terms_hash + description_hash BLAKE3 inmutable
- #37 Free perpetua: 9 read methods sin payment
- #41 AGI Cross-Species: AGI puede ser depositor/beneficiary/arbiter
Cross-pillar wire canonical:
- Pillar 6 Tribunal (Mathi): arbiter = Tribunal contract address
- Pillar 2 OMC Marketplace (Marihan): escrow integrado purchases
- Pillar 1 Hosting (Larihana): refundable hosting fees future
- Pillar 4 Origin Chain (Charon): deploy vía pallet-revive Index 11
Use cases canonical:
- Freelance contracts (client + worker + Tribunal)
- OMC marketplace purchases (buyer + seller + Tribunal)
- Institutional partnerships (university + researcher + Tribunal)
- Refundable event tickets (organizer + holder + Tribunal)
Próximo Ship Slice 3.4 v0.0.44: origin-credential-mint contract template
(Ed25519 + BLAKE3 attestation, Sussi Ethos schema integration).
⚓ Path A Slice 3.3 SCAFFOLD shipped. Templates library canonical 2/5 complete.
🤖 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
75 lines
3.5 KiB
Markdown
75 lines
3.5 KiB
Markdown
# origin-escrow — Multi-party Escrow Contract Template (Slice 3.3)
|
|
|
|
**Second foundational template** del Origin Contract Atelier. Multi-party escrow + time-locked milestones + dispute-enabled via Pillar 6 Tribunal integration.
|
|
|
|
## Use cases canonical
|
|
|
|
| Use case | Parties | Flow típico |
|
|
|----------|---------|-------------|
|
|
| **Freelance contracts** | Cliente + Freelancer + Tribunal | Deposit → milestones met → progressive releases |
|
|
| **OMC marketplace** (Marihan) | Buyer + Seller + Tribunal | Deposit → asset delivered → release. Dispute → refund. |
|
|
| **Institutional partnerships** | Universidad + Researcher + Tribunal | Multi-milestone investigation funding |
|
|
| **Refundable event tickets** | Organizer + Holder + Tribunal | Deposit guarantee → event held → release. Cancel → refund. |
|
|
|
|
## State machine canonical
|
|
|
|
```
|
|
┌──────► Created ──deposit──► Active ──confirm_milestone──► Releasing
|
|
│ │
|
|
│ ├──raise_dispute──► Disputed
|
|
│ │ │
|
|
│ │ └──resolve_dispute──► Completed
|
|
│ │
|
|
│ └──all milestones complete──► Completed
|
|
└────────────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
5 estados terminales: `Created → Active → Disputed → Releasing → Completed`.
|
|
|
|
## Inmutables compliance
|
|
|
|
| Inmutable | Enforcement |
|
|
|-----------|-------------|
|
|
| **#16 HTS anti-clasista** | escrow_fee_bps capped 5% BM V2 §5.3 ceiling. Pi 5 institutional rate Phase 3.x |
|
|
| **#26 Content-Addressed Immutability** | terms_hash + description_hash BLAKE3 inmutable post-deploy |
|
|
| **#37 Free perpetua** | 9 read methods sin payment (state, depositor, beneficiary, milestones, etc.) |
|
|
| **#41 AGI Cross-Species** | AGI accounts pueden ser any party (depositor, beneficiary, arbiter) |
|
|
|
|
## Resolution canonical (Tribunal options)
|
|
|
|
4 resolution patterns canonical para Tribunal:
|
|
|
|
1. **ReleaseToBeneficiary**: 100% remaining → beneficiary (work completed satisfactorily)
|
|
2. **RefundToDepositor**: 100% remaining → depositor (work not delivered / fraud)
|
|
3. **SplitFifty**: 50/50 split (partial completion / shared responsibility)
|
|
4. **Custom { depositor_bps, beneficiary_bps }**: arbitrary split (e.g., 30/70 partial completion)
|
|
|
|
Invariant compile-detect: `depositor_bps + beneficiary_bps == 10_000` (100%).
|
|
|
|
## Tests canonical (3 unit tests)
|
|
|
|
1. `constructor_canonical_invariants` — valid params + initial state Created
|
|
2. `excessive_fee_rejected_canonical` — 6% fee rejected (>5% ceiling)
|
|
3. `same_party_depositor_beneficiary_rejected` — same address rejected
|
|
|
|
## Cross-pillar integration
|
|
|
|
- **Pillar 4 Origin Chain (Charon)**: deploy vía pallet-revive Index 11
|
|
- **Pillar 6 Nexus Services (Mathi)**: Tribunal contract address = arbiter parameter
|
|
- **Pillar 2 OMC Marketplace (Marihan)**: escrow integrado a marketplace purchases
|
|
- **Pillar 1 Hosting (Larihana)**: refundable hosting fees future use case
|
|
|
|
## Deploy
|
|
|
|
```bash
|
|
cd contracts/origin-escrow
|
|
cargo contract build --release
|
|
# → target/ink/origin_escrow.polkavm
|
|
```
|
|
|
|
Deploy via Polkadot.js Apps OR Origin Contract Atelier (Phase 3.x maduración).
|
|
|
|
---
|
|
|
|
— Charon ⚓ (Pilar 4, Phase 3 Slice 3.3 SCAFFOLD shipped 2026-05-27)
|