@hyperscale0/udl 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +5 -1
  3. package/conformance/invalid/invalid-journeys.expected.json +3 -19
  4. package/conformance/invalid/invalid-journeys.udl +47 -49
  5. package/conformance/valid/attested.expected.json +6 -0
  6. package/conformance/valid/attested.udl +251 -0
  7. package/conformance/valid/hand-edited.expected.json +1 -1
  8. package/conformance/valid/hand-edited.udl +1 -1
  9. package/conformance/valid/minimal.expected.json +1 -1
  10. package/conformance/valid/minimal.udl +0 -15
  11. package/conformance/valid/vocabulary.expected.json +6 -0
  12. package/conformance/valid/vocabulary.udl +1999 -0
  13. package/dist/allocation.d.ts +60 -0
  14. package/dist/allocation.d.ts.map +1 -0
  15. package/dist/allocation.js +177 -0
  16. package/dist/allocation.js.map +1 -0
  17. package/dist/diagnostics.d.ts +1 -31
  18. package/dist/diagnostics.d.ts.map +1 -1
  19. package/dist/diagnostics.js +0 -30
  20. package/dist/diagnostics.js.map +1 -1
  21. package/dist/distribution.d.ts +15 -0
  22. package/dist/distribution.d.ts.map +1 -0
  23. package/dist/distribution.js +49 -0
  24. package/dist/distribution.js.map +1 -0
  25. package/dist/effects.d.ts.map +1 -1
  26. package/dist/effects.js +23 -1
  27. package/dist/effects.js.map +1 -1
  28. package/dist/evolution.d.ts +12 -0
  29. package/dist/evolution.d.ts.map +1 -1
  30. package/dist/evolution.js +42 -1
  31. package/dist/evolution.js.map +1 -1
  32. package/dist/finance.d.ts +18 -1
  33. package/dist/finance.d.ts.map +1 -1
  34. package/dist/finance.js +158 -27
  35. package/dist/finance.js.map +1 -1
  36. package/dist/index.d.ts +8 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +5 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/instrument-references.d.ts +5 -0
  41. package/dist/instrument-references.d.ts.map +1 -0
  42. package/dist/instrument-references.js +69 -0
  43. package/dist/instrument-references.js.map +1 -0
  44. package/dist/limits.d.ts +3 -3
  45. package/dist/limits.d.ts.map +1 -1
  46. package/dist/limits.js +3 -7
  47. package/dist/limits.js.map +1 -1
  48. package/dist/reference.d.ts +3 -0
  49. package/dist/reference.d.ts.map +1 -0
  50. package/dist/reference.js +28 -0
  51. package/dist/reference.js.map +1 -0
  52. package/dist/schema.d.ts +1232 -83
  53. package/dist/schema.d.ts.map +1 -1
  54. package/dist/schema.js +398 -60
  55. package/dist/schema.js.map +1 -1
  56. package/dist/validation.d.ts +14 -0
  57. package/dist/validation.d.ts.map +1 -1
  58. package/dist/validation.js +75 -131
  59. package/dist/validation.js.map +1 -1
  60. package/dist/vocabulary.d.ts +23 -0
  61. package/dist/vocabulary.d.ts.map +1 -0
  62. package/dist/vocabulary.js +965 -0
  63. package/dist/vocabulary.js.map +1 -0
  64. package/docs/README.md +2 -1
  65. package/docs/funding-custody.md +165 -0
  66. package/docs/guide/09-schedules-and-allocation.md +130 -0
  67. package/docs/llms-full.txt +620 -101
  68. package/docs/llms.txt +1 -1
  69. package/docs/reference/clauses.md +451 -63
  70. package/docs/reference/cli.md +3 -1
  71. package/docs/reference/diagnostics.md +33 -38
  72. package/package.json +5 -6
  73. package/spec/udl.schema.json +1095 -118
  74. package/src/allocation.ts +259 -0
  75. package/src/diagnostics.ts +0 -32
  76. package/src/distribution.ts +61 -0
  77. package/src/effects.ts +27 -1
  78. package/src/evolution.ts +63 -3
  79. package/src/finance.ts +218 -24
  80. package/src/index.ts +30 -3
  81. package/src/instrument-references.ts +98 -0
  82. package/src/limits.ts +3 -7
  83. package/src/reference.ts +31 -0
  84. package/src/schema.ts +417 -66
  85. package/src/validation.ts +112 -182
  86. package/src/vocabulary.ts +1508 -0
@@ -0,0 +1,1999 @@
1
+ {
2
+ "instruments": [
3
+ {
4
+ "actionOrder": [
5
+ "payoff",
6
+ "write_off",
7
+ "create",
8
+ "close"
9
+ ],
10
+ "actions": {
11
+ "close": {
12
+ "agentDescription": "Close when the declared count and schedule hold.",
13
+ "effects": {
14
+ "reads": [
15
+ {
16
+ "signature": "reads.requires_aggregate",
17
+ "source": "requiresAggregate"
18
+ }
19
+ ]
20
+ },
21
+ "moves": [],
22
+ "publicAction": "closeCover",
23
+ "requiresAggregate": [
24
+ {
25
+ "check": {
26
+ "kind": "count_at_least",
27
+ "targetField": "minimumMissed"
28
+ },
29
+ "instrumentId": "slice",
30
+ "over": "children",
31
+ "refField": "coverId",
32
+ "statuses": [
33
+ "closed"
34
+ ]
35
+ },
36
+ {
37
+ "check": {
38
+ "field": "dueAt",
39
+ "kind": "ordered",
40
+ "positionField": "position"
41
+ },
42
+ "instrumentId": "slice",
43
+ "over": "children",
44
+ "refField": "coverId",
45
+ "statuses": [
46
+ "open"
47
+ ]
48
+ },
49
+ {
50
+ "check": {
51
+ "amounts": [
52
+ {
53
+ "amountField": "principal",
54
+ "totalField": "principal"
55
+ },
56
+ {
57
+ "amountField": "profit",
58
+ "totalField": "profit"
59
+ }
60
+ ],
61
+ "dateField": "dueAt",
62
+ "datesField": "dates",
63
+ "kind": "schedule",
64
+ "positionField": "position",
65
+ "remainder": "first"
66
+ },
67
+ "instrumentId": "slice",
68
+ "over": "children",
69
+ "refField": "coverId",
70
+ "statuses": [
71
+ "open"
72
+ ]
73
+ }
74
+ ],
75
+ "steps": [],
76
+ "summary": "Close instrument"
77
+ },
78
+ "create": {
79
+ "agentDescription": "Record the signed cover terms.",
80
+ "moves": [],
81
+ "publicAction": "createCover",
82
+ "requiresExposure": [
83
+ {
84
+ "amountField": "principal",
85
+ "anchorField": "limitId",
86
+ "capField": "cap",
87
+ "capOnAnchor": true,
88
+ "childInstrumentId": "cover",
89
+ "measure": {
90
+ "allocation": "principal"
91
+ },
92
+ "statuses": [
93
+ "open"
94
+ ]
95
+ }
96
+ ],
97
+ "steps": [],
98
+ "summary": "Create instrument"
99
+ },
100
+ "payoff": {
101
+ "agentDescription": "Compute this obligation's payoff from its remaining balances.",
102
+ "allocate": {
103
+ "capture": "payoffReceipt",
104
+ "mode": "payoff",
105
+ "paymentIdentityField": "paymentIdentity",
106
+ "sourceAccountField": "payerAccount"
107
+ },
108
+ "effects": {
109
+ "decides": [
110
+ {
111
+ "signature": "decides.allocation",
112
+ "source": "allocate"
113
+ }
114
+ ],
115
+ "moves": [
116
+ {
117
+ "signature": "moves.allocation",
118
+ "source": "allocate"
119
+ }
120
+ ]
121
+ },
122
+ "input": {
123
+ "additionalProperties": false,
124
+ "properties": {
125
+ "payerAccount": {
126
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
127
+ "type": "string"
128
+ },
129
+ "paymentIdentity": {
130
+ "minLength": 1,
131
+ "type": "string"
132
+ }
133
+ },
134
+ "required": [
135
+ "payerAccount",
136
+ "paymentIdentity"
137
+ ],
138
+ "type": "object"
139
+ },
140
+ "moves": [],
141
+ "publicAction": "payoffCover",
142
+ "steps": [],
143
+ "summary": "Payoff instrument"
144
+ },
145
+ "write_off": {
146
+ "agentDescription": "Cancel this obligation without cash.",
147
+ "allocate": {
148
+ "capture": "loss",
149
+ "mode": "write_off"
150
+ },
151
+ "effects": {
152
+ "decides": [
153
+ {
154
+ "signature": "decides.allocation",
155
+ "source": "allocate"
156
+ }
157
+ ]
158
+ },
159
+ "moves": [],
160
+ "publicAction": "writeOffCover",
161
+ "steps": [],
162
+ "summary": "Write Off instrument"
163
+ }
164
+ },
165
+ "agentDescription": "Freeze the signed dates and amounts before admitting slices.",
166
+ "allocation": {
167
+ "buckets": [
168
+ {
169
+ "key": "principal",
170
+ "source": {
171
+ "amountField": "principal",
172
+ "destinationField": "receiver",
173
+ "from": "slice"
174
+ }
175
+ },
176
+ {
177
+ "key": "profit",
178
+ "source": {
179
+ "amountField": "profit",
180
+ "destinationField": "receiver",
181
+ "from": "slice"
182
+ }
183
+ },
184
+ {
185
+ "key": "cost",
186
+ "source": {
187
+ "amountField": "amount",
188
+ "destinationField": "receiver",
189
+ "from": "children",
190
+ "parameters": {
191
+ "cost": true
192
+ },
193
+ "refField": "sliceId",
194
+ "statuses": [
195
+ "open"
196
+ ],
197
+ "template": "assessment"
198
+ }
199
+ }
200
+ ],
201
+ "dueField": "dueAt",
202
+ "earningRuleField": "earningRule",
203
+ "positionField": "position",
204
+ "sliceInstrumentId": "slice",
205
+ "sliceRefField": "coverId",
206
+ "sliceStatuses": [
207
+ "open"
208
+ ]
209
+ },
210
+ "dateOrder": [
211
+ {
212
+ "afterField": "end",
213
+ "beforeField": "start",
214
+ "operator": "<"
215
+ }
216
+ ],
217
+ "fields": {
218
+ "currency": {
219
+ "description": "ISO 4217 currency code",
220
+ "maxLength": 3,
221
+ "minLength": 3,
222
+ "pattern": "^[A-Z]{3}$",
223
+ "type": "string"
224
+ },
225
+ "dates": {
226
+ "items": {
227
+ "format": "hyperscale-date-time",
228
+ "type": "string"
229
+ },
230
+ "maxItems": 366,
231
+ "minItems": 1,
232
+ "type": "array"
233
+ },
234
+ "earningRule": {
235
+ "enum": [
236
+ "per_slice_on_due",
237
+ "on_disbursement"
238
+ ],
239
+ "type": "string"
240
+ },
241
+ "end": {
242
+ "format": "hyperscale-date-time",
243
+ "type": "string"
244
+ },
245
+ "limitId": {
246
+ "pattern": "^lim_(sandbox|live)_[a-z0-9]{8,64}$",
247
+ "type": "string"
248
+ },
249
+ "minimumMissed": {
250
+ "maximum": 1,
251
+ "minimum": 1,
252
+ "type": "integer"
253
+ },
254
+ "principal": {
255
+ "pattern": "^[1-9][0-9]{0,17}$",
256
+ "type": "string",
257
+ "x-hyperscale-currency": "SAR"
258
+ },
259
+ "profit": {
260
+ "pattern": "^[1-9][0-9]{0,17}$",
261
+ "type": "string",
262
+ "x-hyperscale-currency": "SAR"
263
+ },
264
+ "start": {
265
+ "format": "hyperscale-date-time",
266
+ "type": "string"
267
+ }
268
+ },
269
+ "id": "cover",
270
+ "idPrefix": "cvr",
271
+ "lifecycle": {
272
+ "initial": "open",
273
+ "states": [
274
+ "open",
275
+ "closed"
276
+ ],
277
+ "transitions": {
278
+ "close": {
279
+ "from": [
280
+ "open"
281
+ ],
282
+ "to": "closed"
283
+ },
284
+ "payoff": {
285
+ "from": [
286
+ "open"
287
+ ],
288
+ "to": "closed"
289
+ },
290
+ "write_off": {
291
+ "from": [
292
+ "open"
293
+ ],
294
+ "to": "closed"
295
+ }
296
+ }
297
+ },
298
+ "required": [
299
+ "limitId",
300
+ "start",
301
+ "end",
302
+ "minimumMissed",
303
+ "principal",
304
+ "profit",
305
+ "dates",
306
+ "earningRule",
307
+ "currency"
308
+ ],
309
+ "summary": "Cover instrument",
310
+ "title": "Cover"
311
+ },
312
+ {
313
+ "actionOrder": [
314
+ "create",
315
+ "close"
316
+ ],
317
+ "actions": {
318
+ "close": {
319
+ "due": {
320
+ "field": "dueAt",
321
+ "offset": {
322
+ "field": "grace"
323
+ }
324
+ },
325
+ "effects": {
326
+ "decides": [
327
+ {
328
+ "signature": "decides.allocation",
329
+ "source": "requiresAllocation"
330
+ },
331
+ {
332
+ "signature": "decides.referenced_transition",
333
+ "source": "transitionsRefs[0]"
334
+ }
335
+ ],
336
+ "schedules": [
337
+ {
338
+ "signature": "schedules.due",
339
+ "source": "due"
340
+ }
341
+ ]
342
+ },
343
+ "moves": [],
344
+ "requiresAllocation": {
345
+ "buckets": [
346
+ "principal",
347
+ "profit"
348
+ ],
349
+ "check": "settled",
350
+ "refField": "coverId",
351
+ "slice": "self"
352
+ },
353
+ "steps": [],
354
+ "summary": "Close instrument",
355
+ "transitionsRefs": [
356
+ {
357
+ "action": "close",
358
+ "field": "coverId"
359
+ }
360
+ ]
361
+ },
362
+ "create": {
363
+ "agentDescription": "Check both signed bounds and the assessment kind.",
364
+ "effects": {
365
+ "reads": [
366
+ {
367
+ "signature": "reads.requires_refs",
368
+ "source": "requiresRefs"
369
+ }
370
+ ]
371
+ },
372
+ "moves": [],
373
+ "publicAction": "createSlice",
374
+ "requiresRefs": [
375
+ {
376
+ "dateComparison": {
377
+ "localPath": "fields.start",
378
+ "operator": ">=",
379
+ "referencedPath": "fields.start"
380
+ },
381
+ "field": "coverId",
382
+ "statuses": [
383
+ "open"
384
+ ],
385
+ "unique": {
386
+ "byFields": [
387
+ "kind"
388
+ ],
389
+ "namespace": "assessment"
390
+ }
391
+ },
392
+ {
393
+ "dateComparison": {
394
+ "localPath": "fields.end",
395
+ "operator": "<=",
396
+ "referencedPath": "fields.end"
397
+ },
398
+ "field": "coverId",
399
+ "statuses": [
400
+ "open"
401
+ ]
402
+ }
403
+ ],
404
+ "steps": [],
405
+ "summary": "Create instrument"
406
+ }
407
+ },
408
+ "agentDescription": "Keep one premium and its signed interval.",
409
+ "derivedAmounts": [
410
+ {
411
+ "field": "commission",
412
+ "rounding": "floor",
413
+ "rule": {
414
+ "bps": {
415
+ "field": "rate"
416
+ },
417
+ "kind": "percentage_of"
418
+ },
419
+ "sourceField": "premium"
420
+ },
421
+ {
422
+ "field": "charge",
423
+ "rounding": "floor",
424
+ "rule": {
425
+ "capField": "cap",
426
+ "kind": "minimum"
427
+ },
428
+ "sourceField": "cost"
429
+ }
430
+ ],
431
+ "fields": {
432
+ "cap": {
433
+ "pattern": "^[1-9][0-9]{0,17}$",
434
+ "type": "string",
435
+ "x-hyperscale-currency": "SAR"
436
+ },
437
+ "charge": {
438
+ "pattern": "^(0|[1-9][0-9]{0,17})$",
439
+ "type": "string",
440
+ "x-hyperscale-currency": "SAR"
441
+ },
442
+ "commission": {
443
+ "pattern": "^(0|[1-9][0-9]{0,17})$",
444
+ "type": "string",
445
+ "x-hyperscale-currency": "SAR"
446
+ },
447
+ "cost": {
448
+ "pattern": "^[1-9][0-9]{0,17}$",
449
+ "type": "string",
450
+ "x-hyperscale-currency": "SAR"
451
+ },
452
+ "coverId": {
453
+ "pattern": "^cvr_(sandbox|live)_[a-z0-9]{8,64}$",
454
+ "type": "string"
455
+ },
456
+ "currency": {
457
+ "description": "ISO 4217 currency code",
458
+ "maxLength": 3,
459
+ "minLength": 3,
460
+ "pattern": "^[A-Z]{3}$",
461
+ "type": "string"
462
+ },
463
+ "dueAt": {
464
+ "format": "hyperscale-date-time",
465
+ "type": "string"
466
+ },
467
+ "end": {
468
+ "format": "hyperscale-date-time",
469
+ "type": "string"
470
+ },
471
+ "grace": {
472
+ "enum": [
473
+ "P3D",
474
+ "P7D"
475
+ ],
476
+ "type": "string"
477
+ },
478
+ "kind": {
479
+ "enum": [
480
+ "fine",
481
+ "cost"
482
+ ],
483
+ "type": "string"
484
+ },
485
+ "position": {
486
+ "maximum": 366,
487
+ "minimum": 1,
488
+ "type": "integer"
489
+ },
490
+ "premium": {
491
+ "pattern": "^[1-9][0-9]{0,17}$",
492
+ "type": "string",
493
+ "x-hyperscale-currency": "SAR"
494
+ },
495
+ "principal": {
496
+ "pattern": "^[1-9][0-9]{0,17}$",
497
+ "type": "string",
498
+ "x-hyperscale-currency": "SAR"
499
+ },
500
+ "profit": {
501
+ "pattern": "^[1-9][0-9]{0,17}$",
502
+ "type": "string",
503
+ "x-hyperscale-currency": "SAR"
504
+ },
505
+ "rate": {
506
+ "maximum": 1000,
507
+ "minimum": 500,
508
+ "type": "integer"
509
+ },
510
+ "receiver": {
511
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
512
+ "type": "string"
513
+ },
514
+ "start": {
515
+ "format": "hyperscale-date-time",
516
+ "type": "string"
517
+ }
518
+ },
519
+ "id": "slice",
520
+ "idPrefix": "slc",
521
+ "lifecycle": {
522
+ "initial": "open",
523
+ "states": [
524
+ "open",
525
+ "closed"
526
+ ],
527
+ "transitions": {
528
+ "close": {
529
+ "from": [
530
+ "open"
531
+ ],
532
+ "to": "closed"
533
+ }
534
+ }
535
+ },
536
+ "required": [
537
+ "coverId",
538
+ "start",
539
+ "end",
540
+ "dueAt",
541
+ "position",
542
+ "principal",
543
+ "profit",
544
+ "premium",
545
+ "cost",
546
+ "cap",
547
+ "rate",
548
+ "grace",
549
+ "kind",
550
+ "receiver",
551
+ "currency"
552
+ ],
553
+ "summary": "Slice instrument",
554
+ "title": "Slice"
555
+ },
556
+ {
557
+ "actionOrder": [
558
+ "create",
559
+ "close"
560
+ ],
561
+ "actions": {
562
+ "close": {
563
+ "agentDescription": "Close this claim.",
564
+ "moves": [],
565
+ "publicAction": "closeClaim",
566
+ "steps": [],
567
+ "summary": "Close coverId"
568
+ },
569
+ "create": {
570
+ "agentDescription": "Read the cover's due premiums under the admission clock.",
571
+ "effects": {
572
+ "reads": [
573
+ {
574
+ "signature": "reads.requires_aggregate",
575
+ "source": "requiresAggregate"
576
+ }
577
+ ]
578
+ },
579
+ "moves": [],
580
+ "publicAction": "createClaim",
581
+ "requiresAggregate": [
582
+ {
583
+ "anchorField": "coverId",
584
+ "check": {
585
+ "kind": "count_exactly",
586
+ "value": 0
587
+ },
588
+ "dueBefore": {
589
+ "field": "dueAt"
590
+ },
591
+ "instrumentId": "slice",
592
+ "over": "siblings",
593
+ "refField": "coverId",
594
+ "statuses": [
595
+ "open"
596
+ ]
597
+ }
598
+ ],
599
+ "steps": [],
600
+ "summary": "Create coverId"
601
+ }
602
+ },
603
+ "agentDescription": "Refuse a claim while a sibling premium is unpaid past due.",
604
+ "fields": {
605
+ "coverId": {
606
+ "pattern": "^cvr_(sandbox|live)_[a-z0-9]{8,64}$",
607
+ "type": "string"
608
+ }
609
+ },
610
+ "id": "claim",
611
+ "idPrefix": "clm",
612
+ "lifecycle": {
613
+ "initial": "open",
614
+ "states": [
615
+ "open",
616
+ "closed"
617
+ ],
618
+ "transitions": {
619
+ "close": {
620
+ "from": [
621
+ "open"
622
+ ],
623
+ "to": "closed"
624
+ }
625
+ }
626
+ },
627
+ "required": [
628
+ "coverId"
629
+ ],
630
+ "summary": "Claim instrument",
631
+ "title": "Claim"
632
+ },
633
+ {
634
+ "actionOrder": [
635
+ "create",
636
+ "close"
637
+ ],
638
+ "actions": {
639
+ "close": {
640
+ "agentDescription": "Allocate this payment to outstanding debt once.",
641
+ "allocate": {
642
+ "amountField": "amount",
643
+ "capture": "allocationReceipt",
644
+ "mode": "payment",
645
+ "paymentIdentityField": "paymentIdentity",
646
+ "refField": "coverId",
647
+ "sourceAccountField": "payer"
648
+ },
649
+ "effects": {
650
+ "decides": [
651
+ {
652
+ "signature": "decides.allocation",
653
+ "source": "allocate"
654
+ }
655
+ ],
656
+ "moves": [
657
+ {
658
+ "signature": "moves.allocation",
659
+ "source": "allocate"
660
+ }
661
+ ]
662
+ },
663
+ "moves": [],
664
+ "publicAction": "closePayment",
665
+ "steps": [],
666
+ "summary": "Close instrument"
667
+ },
668
+ "create": {
669
+ "agentDescription": "Record one payment identity.",
670
+ "moves": [],
671
+ "publicAction": "createPayment",
672
+ "steps": [],
673
+ "summary": "Create instrument"
674
+ }
675
+ },
676
+ "agentDescription": "Allocate one identified payment through the obligation's bucket rules.",
677
+ "fields": {
678
+ "amount": {
679
+ "pattern": "^[1-9][0-9]{0,17}$",
680
+ "type": "string",
681
+ "x-hyperscale-currency": "SAR"
682
+ },
683
+ "coverId": {
684
+ "pattern": "^cvr_(sandbox|live)_[a-z0-9]{8,64}$",
685
+ "type": "string"
686
+ },
687
+ "currency": {
688
+ "description": "ISO 4217 currency code",
689
+ "maxLength": 3,
690
+ "minLength": 3,
691
+ "pattern": "^[A-Z]{3}$",
692
+ "type": "string"
693
+ },
694
+ "payer": {
695
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
696
+ "type": "string"
697
+ },
698
+ "paymentIdentity": {
699
+ "maxLength": 128,
700
+ "minLength": 1,
701
+ "type": "string"
702
+ }
703
+ },
704
+ "id": "payment",
705
+ "idPrefix": "pmt",
706
+ "lifecycle": {
707
+ "initial": "open",
708
+ "states": [
709
+ "open",
710
+ "closed"
711
+ ],
712
+ "transitions": {
713
+ "close": {
714
+ "from": [
715
+ "open"
716
+ ],
717
+ "to": "closed"
718
+ }
719
+ }
720
+ },
721
+ "required": [
722
+ "coverId",
723
+ "amount",
724
+ "payer",
725
+ "paymentIdentity",
726
+ "currency"
727
+ ],
728
+ "summary": "Payment instrument",
729
+ "title": "Payment"
730
+ },
731
+ {
732
+ "actionOrder": [
733
+ "create",
734
+ "fund",
735
+ "refund",
736
+ "release"
737
+ ],
738
+ "actions": {
739
+ "create": {
740
+ "agentDescription": "Open the held account for these contributions.",
741
+ "moves": [],
742
+ "publicAction": "createJoinedSettlement",
743
+ "steps": [
744
+ {
745
+ "bind": {
746
+ "currency": {
747
+ "from": "const",
748
+ "value": "SAR"
749
+ },
750
+ "productId": {
751
+ "from": "instance",
752
+ "path": "productId"
753
+ }
754
+ },
755
+ "capture": {
756
+ "hold": "accountId"
757
+ },
758
+ "operation": "account.escrow.provision"
759
+ }
760
+ ],
761
+ "summary": "Create instrument"
762
+ },
763
+ "fund": {
764
+ "agentDescription": "Fund all contributions together.",
765
+ "contributionStage": {
766
+ "accountPath": "refs.hold",
767
+ "stage": "fund"
768
+ },
769
+ "effects": {
770
+ "moves": [
771
+ {
772
+ "signature": "moves.transfer.internal",
773
+ "source": "contributionStage"
774
+ }
775
+ ]
776
+ },
777
+ "moves": [],
778
+ "publicAction": "fundJoinedSettlement",
779
+ "steps": [],
780
+ "summary": "Fund instrument"
781
+ },
782
+ "refund": {
783
+ "agentDescription": "Refund all contributions to their original accounts.",
784
+ "contributionStage": {
785
+ "accountPath": "refs.hold",
786
+ "stage": "refund"
787
+ },
788
+ "effects": {
789
+ "moves": [
790
+ {
791
+ "signature": "moves.transfer.internal",
792
+ "source": "contributionStage"
793
+ }
794
+ ]
795
+ },
796
+ "moves": [],
797
+ "publicAction": "refundJoinedSettlement",
798
+ "steps": [],
799
+ "summary": "Refund instrument"
800
+ },
801
+ "release": {
802
+ "agentDescription": "Release the complete seller, fee and tax partition.",
803
+ "effects": {
804
+ "moves": [
805
+ {
806
+ "signature": "moves.transfer.internal",
807
+ "source": "moves[0]"
808
+ },
809
+ {
810
+ "signature": "moves.transfer.internal",
811
+ "source": "moves[1]"
812
+ },
813
+ {
814
+ "signature": "moves.transfer.internal",
815
+ "source": "moves[2]"
816
+ }
817
+ ]
818
+ },
819
+ "moves": [
820
+ {
821
+ "bind": {
822
+ "amount": {
823
+ "from": "instance",
824
+ "path": "fields.sellerNet"
825
+ },
826
+ "currency": {
827
+ "from": "const",
828
+ "value": "SAR"
829
+ },
830
+ "destinationAccountId": {
831
+ "from": "instance",
832
+ "path": "fields.seller"
833
+ },
834
+ "productId": {
835
+ "from": "instance",
836
+ "path": "productId"
837
+ },
838
+ "sourceAccountId": {
839
+ "from": "instance",
840
+ "path": "refs.hold"
841
+ }
842
+ },
843
+ "key": "net",
844
+ "operation": "internal_transfer.create"
845
+ },
846
+ {
847
+ "bind": {
848
+ "amount": {
849
+ "from": "instance",
850
+ "path": "fields.sellerFee"
851
+ },
852
+ "currency": {
853
+ "from": "const",
854
+ "value": "SAR"
855
+ },
856
+ "destinationAccountId": {
857
+ "from": "instance",
858
+ "path": "fields.feeAccount"
859
+ },
860
+ "productId": {
861
+ "from": "instance",
862
+ "path": "productId"
863
+ },
864
+ "sourceAccountId": {
865
+ "from": "instance",
866
+ "path": "refs.hold"
867
+ }
868
+ },
869
+ "key": "fee",
870
+ "operation": "internal_transfer.create"
871
+ },
872
+ {
873
+ "bind": {
874
+ "amount": {
875
+ "from": "instance",
876
+ "path": "fields.tax"
877
+ },
878
+ "currency": {
879
+ "from": "const",
880
+ "value": "SAR"
881
+ },
882
+ "destinationAccountId": {
883
+ "from": "instance",
884
+ "path": "fields.taxAccount"
885
+ },
886
+ "productId": {
887
+ "from": "instance",
888
+ "path": "productId"
889
+ },
890
+ "sourceAccountId": {
891
+ "from": "instance",
892
+ "path": "refs.hold"
893
+ }
894
+ },
895
+ "key": "tax",
896
+ "operation": "internal_transfer.create"
897
+ }
898
+ ],
899
+ "publicAction": "releaseJoinedSettlement",
900
+ "steps": [],
901
+ "summary": "Release instrument"
902
+ }
903
+ },
904
+ "agentDescription": "Fund one held balance from an immutable list and refund each origin.",
905
+ "contributions": {
906
+ "accountKey": "origin",
907
+ "amountKey": "amount",
908
+ "field": "contributions",
909
+ "totalField": "price"
910
+ },
911
+ "fields": {
912
+ "buyerPart": {
913
+ "pattern": "^[1-9][0-9]{0,17}$",
914
+ "type": "string",
915
+ "x-hyperscale-currency": "SAR"
916
+ },
917
+ "contributions": {
918
+ "items": {
919
+ "additionalProperties": false,
920
+ "properties": {
921
+ "amount": {
922
+ "pattern": "^[1-9][0-9]{0,17}$",
923
+ "type": "string",
924
+ "x-hyperscale-currency": "SAR"
925
+ },
926
+ "origin": {
927
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
928
+ "type": "string"
929
+ }
930
+ },
931
+ "required": [
932
+ "amount",
933
+ "origin"
934
+ ],
935
+ "type": "object"
936
+ },
937
+ "maxItems": 256,
938
+ "minItems": 1,
939
+ "type": "array"
940
+ },
941
+ "currency": {
942
+ "const": "SAR",
943
+ "type": "string"
944
+ },
945
+ "feeAccount": {
946
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
947
+ "type": "string"
948
+ },
949
+ "funderPart": {
950
+ "pattern": "^[1-9][0-9]{0,17}$",
951
+ "type": "string",
952
+ "x-hyperscale-currency": "SAR"
953
+ },
954
+ "price": {
955
+ "pattern": "^[1-9][0-9]{0,17}$",
956
+ "type": "string",
957
+ "x-hyperscale-currency": "SAR"
958
+ },
959
+ "seller": {
960
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
961
+ "type": "string"
962
+ },
963
+ "sellerFee": {
964
+ "pattern": "^[1-9][0-9]{0,17}$",
965
+ "type": "string",
966
+ "x-hyperscale-currency": "SAR"
967
+ },
968
+ "sellerNet": {
969
+ "pattern": "^[1-9][0-9]{0,17}$",
970
+ "type": "string",
971
+ "x-hyperscale-currency": "SAR"
972
+ },
973
+ "tax": {
974
+ "pattern": "^[1-9][0-9]{0,17}$",
975
+ "type": "string",
976
+ "x-hyperscale-currency": "SAR"
977
+ },
978
+ "taxAccount": {
979
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
980
+ "type": "string"
981
+ }
982
+ },
983
+ "id": "joined_settlement",
984
+ "idPrefix": "stlm",
985
+ "lifecycle": {
986
+ "initial": "created",
987
+ "states": [
988
+ "created",
989
+ "funded",
990
+ "refunded",
991
+ "released"
992
+ ],
993
+ "transitions": {
994
+ "fund": {
995
+ "from": [
996
+ "created"
997
+ ],
998
+ "to": "funded"
999
+ },
1000
+ "refund": {
1001
+ "from": [
1002
+ "funded"
1003
+ ],
1004
+ "to": "refunded"
1005
+ },
1006
+ "release": {
1007
+ "from": [
1008
+ "funded"
1009
+ ],
1010
+ "to": "released"
1011
+ }
1012
+ }
1013
+ },
1014
+ "partitions": [
1015
+ {
1016
+ "pieceFields": [
1017
+ "buyerPart",
1018
+ "funderPart"
1019
+ ],
1020
+ "totalField": "price"
1021
+ },
1022
+ {
1023
+ "pieceFields": [
1024
+ "sellerNet",
1025
+ "sellerFee",
1026
+ "tax"
1027
+ ],
1028
+ "totalField": "price"
1029
+ }
1030
+ ],
1031
+ "required": [
1032
+ "price",
1033
+ "buyerPart",
1034
+ "funderPart",
1035
+ "sellerNet",
1036
+ "sellerFee",
1037
+ "tax",
1038
+ "seller",
1039
+ "feeAccount",
1040
+ "taxAccount",
1041
+ "currency",
1042
+ "contributions"
1043
+ ],
1044
+ "summary": "Joined Settlement instrument",
1045
+ "title": "Joined Settlement"
1046
+ },
1047
+ {
1048
+ "actionOrder": [
1049
+ "create",
1050
+ "close"
1051
+ ],
1052
+ "actions": {
1053
+ "close": {
1054
+ "agentDescription": "Pay the positive remaining balance.",
1055
+ "effects": {
1056
+ "moves": [
1057
+ {
1058
+ "signature": "moves.transfer.internal",
1059
+ "source": "moves[0]"
1060
+ }
1061
+ ]
1062
+ },
1063
+ "moves": [
1064
+ {
1065
+ "bind": {
1066
+ "amount": {
1067
+ "from": "instance",
1068
+ "path": "refs.remaining"
1069
+ },
1070
+ "currency": {
1071
+ "from": "const",
1072
+ "value": "SAR"
1073
+ },
1074
+ "destinationAccountId": {
1075
+ "from": "instance",
1076
+ "path": "fields.receiver"
1077
+ },
1078
+ "productId": {
1079
+ "from": "instance",
1080
+ "path": "productId"
1081
+ },
1082
+ "sourceAccountId": {
1083
+ "from": "instance",
1084
+ "path": "fields.payer"
1085
+ }
1086
+ },
1087
+ "key": "pay",
1088
+ "operation": "internal_transfer.create"
1089
+ }
1090
+ ],
1091
+ "publicAction": "closePayoffRemainder",
1092
+ "remainder": {
1093
+ "amountRef": "remaining",
1094
+ "onZero": "refuse",
1095
+ "subtractPaths": [
1096
+ "fields.paid",
1097
+ "fields.rebate"
1098
+ ],
1099
+ "totalPath": "fields.total"
1100
+ },
1101
+ "steps": [],
1102
+ "summary": "Close instrument"
1103
+ },
1104
+ "create": {
1105
+ "agentDescription": "Record immutable balances.",
1106
+ "moves": [],
1107
+ "publicAction": "createPayoffRemainder",
1108
+ "steps": [],
1109
+ "summary": "Create instrument"
1110
+ }
1111
+ },
1112
+ "agentDescription": "Subtract paid principal and cancelled profit from a fixed total.",
1113
+ "fields": {
1114
+ "currency": {
1115
+ "const": "SAR",
1116
+ "type": "string"
1117
+ },
1118
+ "paid": {
1119
+ "pattern": "^[1-9][0-9]{0,17}$",
1120
+ "type": "string",
1121
+ "x-hyperscale-currency": "SAR"
1122
+ },
1123
+ "payer": {
1124
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1125
+ "type": "string"
1126
+ },
1127
+ "rebate": {
1128
+ "pattern": "^[1-9][0-9]{0,17}$",
1129
+ "type": "string",
1130
+ "x-hyperscale-currency": "SAR"
1131
+ },
1132
+ "receiver": {
1133
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1134
+ "type": "string"
1135
+ },
1136
+ "total": {
1137
+ "pattern": "^[1-9][0-9]{0,17}$",
1138
+ "type": "string",
1139
+ "x-hyperscale-currency": "SAR"
1140
+ }
1141
+ },
1142
+ "id": "payoff_remainder",
1143
+ "idPrefix": "rem",
1144
+ "lifecycle": {
1145
+ "initial": "open",
1146
+ "states": [
1147
+ "open",
1148
+ "closed"
1149
+ ],
1150
+ "transitions": {
1151
+ "close": {
1152
+ "from": [
1153
+ "open"
1154
+ ],
1155
+ "to": "closed"
1156
+ }
1157
+ }
1158
+ },
1159
+ "parties": {
1160
+ "payer": "payer",
1161
+ "receiver": "receiver"
1162
+ },
1163
+ "required": [
1164
+ "payer",
1165
+ "receiver",
1166
+ "total",
1167
+ "paid",
1168
+ "rebate",
1169
+ "currency"
1170
+ ],
1171
+ "summary": "Payoff Remainder instrument",
1172
+ "title": "Payoff Remainder"
1173
+ },
1174
+ {
1175
+ "actionOrder": [
1176
+ "create",
1177
+ "close"
1178
+ ],
1179
+ "actions": {
1180
+ "close": {
1181
+ "agentDescription": "Refund the recorded assessment allocation once.",
1182
+ "allocate": {
1183
+ "action": "close",
1184
+ "assessmentField": "assessment",
1185
+ "capture": "refundReceipt",
1186
+ "mode": "refund",
1187
+ "refField": "paymentId"
1188
+ },
1189
+ "effects": {
1190
+ "decides": [
1191
+ {
1192
+ "signature": "decides.allocation",
1193
+ "source": "allocate"
1194
+ }
1195
+ ],
1196
+ "moves": [
1197
+ {
1198
+ "signature": "moves.allocation",
1199
+ "source": "allocate"
1200
+ }
1201
+ ]
1202
+ },
1203
+ "moves": [],
1204
+ "publicAction": "closeAllocationRefund",
1205
+ "steps": [],
1206
+ "summary": "Close instrument"
1207
+ },
1208
+ "create": {
1209
+ "agentDescription": "Identify the original payment receipt.",
1210
+ "moves": [],
1211
+ "publicAction": "createAllocationRefund",
1212
+ "steps": [],
1213
+ "summary": "Create instrument"
1214
+ }
1215
+ },
1216
+ "agentDescription": "Refund one previously recorded allocation to its original payer.",
1217
+ "fields": {
1218
+ "assessment": {
1219
+ "maxLength": 128,
1220
+ "minLength": 1,
1221
+ "type": "string"
1222
+ },
1223
+ "paymentId": {
1224
+ "pattern": "^pmt_(sandbox|live)_[a-z0-9]{8,64}$",
1225
+ "type": "string"
1226
+ }
1227
+ },
1228
+ "id": "allocation_refund",
1229
+ "idPrefix": "arfn",
1230
+ "lifecycle": {
1231
+ "initial": "open",
1232
+ "states": [
1233
+ "open",
1234
+ "closed"
1235
+ ],
1236
+ "transitions": {
1237
+ "close": {
1238
+ "from": [
1239
+ "open"
1240
+ ],
1241
+ "to": "closed"
1242
+ }
1243
+ }
1244
+ },
1245
+ "required": [
1246
+ "paymentId",
1247
+ "assessment"
1248
+ ],
1249
+ "summary": "Allocation Refund instrument",
1250
+ "title": "Allocation Refund"
1251
+ },
1252
+ {
1253
+ "actionOrder": [
1254
+ "create",
1255
+ "close"
1256
+ ],
1257
+ "actions": {
1258
+ "close": {
1259
+ "agentDescription": "Close the limit without releasing its subject claim.",
1260
+ "moves": [],
1261
+ "publicAction": "closeLimit",
1262
+ "steps": [],
1263
+ "summary": "Close instrument"
1264
+ },
1265
+ "create": {
1266
+ "agentDescription": "Claim this borrower and currency once.",
1267
+ "effects": {
1268
+ "decides": [
1269
+ {
1270
+ "signature": "decides.subject_unique",
1271
+ "source": "unique"
1272
+ }
1273
+ ]
1274
+ },
1275
+ "moves": [],
1276
+ "publicAction": "createLimit",
1277
+ "steps": [],
1278
+ "summary": "Create instrument",
1279
+ "unique": {
1280
+ "byFields": [
1281
+ "borrower",
1282
+ "currency"
1283
+ ],
1284
+ "namespace": "borrower_limit"
1285
+ }
1286
+ }
1287
+ },
1288
+ "agentDescription": "Keep one permanent cap per borrower and currency.",
1289
+ "fields": {
1290
+ "borrower": {
1291
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1292
+ "type": "string"
1293
+ },
1294
+ "cap": {
1295
+ "pattern": "^[1-9][0-9]{0,17}$",
1296
+ "type": "string",
1297
+ "x-hyperscale-currency": "SAR"
1298
+ },
1299
+ "currency": {
1300
+ "const": "SAR",
1301
+ "type": "string"
1302
+ }
1303
+ },
1304
+ "id": "limit",
1305
+ "idPrefix": "lim",
1306
+ "lifecycle": {
1307
+ "initial": "open",
1308
+ "states": [
1309
+ "open",
1310
+ "closed"
1311
+ ],
1312
+ "transitions": {
1313
+ "close": {
1314
+ "from": [
1315
+ "open"
1316
+ ],
1317
+ "to": "closed"
1318
+ }
1319
+ }
1320
+ },
1321
+ "required": [
1322
+ "borrower",
1323
+ "currency",
1324
+ "cap"
1325
+ ],
1326
+ "summary": "Limit instrument",
1327
+ "title": "Limit"
1328
+ },
1329
+ {
1330
+ "actionOrder": [
1331
+ "collect",
1332
+ "refund",
1333
+ "create"
1334
+ ],
1335
+ "actions": {
1336
+ "collect": {
1337
+ "agentDescription": "Collect this assessment's remaining balance.",
1338
+ "allocate": {
1339
+ "amountField": "amount",
1340
+ "assessment": "self",
1341
+ "capture": "collectionReceipt",
1342
+ "mode": "payment",
1343
+ "paymentIdentityField": "paymentIdentity",
1344
+ "refField": "coverId",
1345
+ "sourceAccountField": "receiver"
1346
+ },
1347
+ "effects": {
1348
+ "decides": [
1349
+ {
1350
+ "signature": "decides.allocation",
1351
+ "source": "allocate"
1352
+ }
1353
+ ],
1354
+ "moves": [
1355
+ {
1356
+ "signature": "moves.allocation",
1357
+ "source": "allocate"
1358
+ }
1359
+ ]
1360
+ },
1361
+ "input": {
1362
+ "additionalProperties": false,
1363
+ "properties": {
1364
+ "paymentIdentity": {
1365
+ "minLength": 1,
1366
+ "type": "string"
1367
+ }
1368
+ },
1369
+ "required": [
1370
+ "paymentIdentity"
1371
+ ],
1372
+ "type": "object"
1373
+ },
1374
+ "moves": [],
1375
+ "publicAction": "collectFirstCost",
1376
+ "steps": [],
1377
+ "summary": "Collect instrument"
1378
+ },
1379
+ "create": {
1380
+ "agentDescription": "Record the assessment.",
1381
+ "moves": [],
1382
+ "publicAction": "createFirstCost",
1383
+ "steps": [],
1384
+ "summary": "Create instrument"
1385
+ },
1386
+ "refund": {
1387
+ "agentDescription": "Reverse this record's prior collection.",
1388
+ "allocate": {
1389
+ "action": "collect",
1390
+ "capture": "refundReceipt",
1391
+ "mode": "refund"
1392
+ },
1393
+ "effects": {
1394
+ "decides": [
1395
+ {
1396
+ "signature": "decides.allocation",
1397
+ "source": "allocate"
1398
+ }
1399
+ ],
1400
+ "moves": [
1401
+ {
1402
+ "signature": "moves.allocation",
1403
+ "source": "allocate"
1404
+ }
1405
+ ]
1406
+ },
1407
+ "moves": [],
1408
+ "publicAction": "refundFirstCost",
1409
+ "steps": [],
1410
+ "summary": "Refund instrument"
1411
+ }
1412
+ },
1413
+ "agentDescription": "One assessment selected by template and bound kind.",
1414
+ "fields": {
1415
+ "amount": {
1416
+ "pattern": "^[1-9][0-9]{0,17}$",
1417
+ "type": "string",
1418
+ "x-hyperscale-currency": "SAR"
1419
+ },
1420
+ "coverId": {
1421
+ "pattern": "^cvr_(sandbox|live)_[a-z0-9]{8,64}$",
1422
+ "type": "string"
1423
+ },
1424
+ "currency": {
1425
+ "description": "ISO 4217 currency code",
1426
+ "maxLength": 3,
1427
+ "minLength": 3,
1428
+ "pattern": "^[A-Z]{3}$",
1429
+ "type": "string"
1430
+ },
1431
+ "receiver": {
1432
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1433
+ "type": "string"
1434
+ },
1435
+ "sliceId": {
1436
+ "pattern": "^slc_(sandbox|live)_[a-z0-9]{8,64}$",
1437
+ "type": "string"
1438
+ }
1439
+ },
1440
+ "id": "first_cost",
1441
+ "idPrefix": "fc",
1442
+ "lifecycle": {
1443
+ "initial": "open",
1444
+ "states": [
1445
+ "open",
1446
+ "paid",
1447
+ "refunded"
1448
+ ],
1449
+ "transitions": {
1450
+ "collect": {
1451
+ "from": [
1452
+ "open"
1453
+ ],
1454
+ "to": "paid"
1455
+ },
1456
+ "refund": {
1457
+ "from": [
1458
+ "paid"
1459
+ ],
1460
+ "to": "refunded"
1461
+ }
1462
+ }
1463
+ },
1464
+ "required": [
1465
+ "sliceId",
1466
+ "coverId",
1467
+ "amount",
1468
+ "receiver",
1469
+ "currency"
1470
+ ],
1471
+ "summary": "First Cost instrument",
1472
+ "templateBinding": {
1473
+ "id": "assessment",
1474
+ "parameters": {
1475
+ "cost": true
1476
+ }
1477
+ },
1478
+ "title": "First Cost"
1479
+ },
1480
+ {
1481
+ "actionOrder": [
1482
+ "collect",
1483
+ "refund",
1484
+ "create"
1485
+ ],
1486
+ "actions": {
1487
+ "collect": {
1488
+ "agentDescription": "Collect this assessment's remaining balance.",
1489
+ "allocate": {
1490
+ "amountField": "amount",
1491
+ "assessment": "self",
1492
+ "capture": "collectionReceipt",
1493
+ "mode": "payment",
1494
+ "paymentIdentityField": "paymentIdentity",
1495
+ "refField": "coverId",
1496
+ "sourceAccountField": "receiver"
1497
+ },
1498
+ "effects": {
1499
+ "decides": [
1500
+ {
1501
+ "signature": "decides.allocation",
1502
+ "source": "allocate"
1503
+ }
1504
+ ],
1505
+ "moves": [
1506
+ {
1507
+ "signature": "moves.allocation",
1508
+ "source": "allocate"
1509
+ }
1510
+ ]
1511
+ },
1512
+ "input": {
1513
+ "additionalProperties": false,
1514
+ "properties": {
1515
+ "paymentIdentity": {
1516
+ "minLength": 1,
1517
+ "type": "string"
1518
+ }
1519
+ },
1520
+ "required": [
1521
+ "paymentIdentity"
1522
+ ],
1523
+ "type": "object"
1524
+ },
1525
+ "moves": [],
1526
+ "publicAction": "collectSecondCost",
1527
+ "steps": [],
1528
+ "summary": "Collect instrument"
1529
+ },
1530
+ "create": {
1531
+ "agentDescription": "Record the assessment.",
1532
+ "moves": [],
1533
+ "publicAction": "createSecondCost",
1534
+ "steps": [],
1535
+ "summary": "Create instrument"
1536
+ },
1537
+ "refund": {
1538
+ "agentDescription": "Reverse this record's prior collection.",
1539
+ "allocate": {
1540
+ "action": "collect",
1541
+ "capture": "refundReceipt",
1542
+ "mode": "refund"
1543
+ },
1544
+ "effects": {
1545
+ "decides": [
1546
+ {
1547
+ "signature": "decides.allocation",
1548
+ "source": "allocate"
1549
+ }
1550
+ ],
1551
+ "moves": [
1552
+ {
1553
+ "signature": "moves.allocation",
1554
+ "source": "allocate"
1555
+ }
1556
+ ]
1557
+ },
1558
+ "moves": [],
1559
+ "publicAction": "refundSecondCost",
1560
+ "steps": [],
1561
+ "summary": "Refund instrument"
1562
+ }
1563
+ },
1564
+ "agentDescription": "One assessment selected by template and bound kind.",
1565
+ "fields": {
1566
+ "amount": {
1567
+ "pattern": "^[1-9][0-9]{0,17}$",
1568
+ "type": "string",
1569
+ "x-hyperscale-currency": "SAR"
1570
+ },
1571
+ "coverId": {
1572
+ "pattern": "^cvr_(sandbox|live)_[a-z0-9]{8,64}$",
1573
+ "type": "string"
1574
+ },
1575
+ "currency": {
1576
+ "description": "ISO 4217 currency code",
1577
+ "maxLength": 3,
1578
+ "minLength": 3,
1579
+ "pattern": "^[A-Z]{3}$",
1580
+ "type": "string"
1581
+ },
1582
+ "receiver": {
1583
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1584
+ "type": "string"
1585
+ },
1586
+ "sliceId": {
1587
+ "pattern": "^slc_(sandbox|live)_[a-z0-9]{8,64}$",
1588
+ "type": "string"
1589
+ }
1590
+ },
1591
+ "id": "second_cost",
1592
+ "idPrefix": "sc",
1593
+ "lifecycle": {
1594
+ "initial": "open",
1595
+ "states": [
1596
+ "open",
1597
+ "paid",
1598
+ "refunded"
1599
+ ],
1600
+ "transitions": {
1601
+ "collect": {
1602
+ "from": [
1603
+ "open"
1604
+ ],
1605
+ "to": "paid"
1606
+ },
1607
+ "refund": {
1608
+ "from": [
1609
+ "paid"
1610
+ ],
1611
+ "to": "refunded"
1612
+ }
1613
+ }
1614
+ },
1615
+ "required": [
1616
+ "sliceId",
1617
+ "coverId",
1618
+ "amount",
1619
+ "receiver",
1620
+ "currency"
1621
+ ],
1622
+ "summary": "Second Cost instrument",
1623
+ "templateBinding": {
1624
+ "id": "assessment",
1625
+ "parameters": {
1626
+ "cost": true
1627
+ }
1628
+ },
1629
+ "title": "Second Cost"
1630
+ },
1631
+ {
1632
+ "actionOrder": [
1633
+ "close",
1634
+ "create"
1635
+ ],
1636
+ "actions": {
1637
+ "close": {
1638
+ "agentDescription": "Close the assessment.",
1639
+ "moves": [],
1640
+ "publicAction": "closeFineOnly",
1641
+ "steps": [],
1642
+ "summary": "Close instrument"
1643
+ },
1644
+ "create": {
1645
+ "agentDescription": "Record the assessment.",
1646
+ "moves": [],
1647
+ "publicAction": "createFineOnly",
1648
+ "steps": [],
1649
+ "summary": "Create instrument"
1650
+ }
1651
+ },
1652
+ "agentDescription": "One assessment selected by template and bound kind.",
1653
+ "fields": {
1654
+ "amount": {
1655
+ "pattern": "^[1-9][0-9]{0,17}$",
1656
+ "type": "string",
1657
+ "x-hyperscale-currency": "SAR"
1658
+ },
1659
+ "coverId": {
1660
+ "pattern": "^cvr_(sandbox|live)_[a-z0-9]{8,64}$",
1661
+ "type": "string"
1662
+ },
1663
+ "currency": {
1664
+ "description": "ISO 4217 currency code",
1665
+ "maxLength": 3,
1666
+ "minLength": 3,
1667
+ "pattern": "^[A-Z]{3}$",
1668
+ "type": "string"
1669
+ },
1670
+ "receiver": {
1671
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1672
+ "type": "string"
1673
+ },
1674
+ "sliceId": {
1675
+ "pattern": "^slc_(sandbox|live)_[a-z0-9]{8,64}$",
1676
+ "type": "string"
1677
+ }
1678
+ },
1679
+ "id": "fine_only",
1680
+ "idPrefix": "fo",
1681
+ "lifecycle": {
1682
+ "initial": "open",
1683
+ "states": [
1684
+ "open",
1685
+ "closed"
1686
+ ],
1687
+ "transitions": {
1688
+ "close": {
1689
+ "from": [
1690
+ "open"
1691
+ ],
1692
+ "to": "closed"
1693
+ }
1694
+ }
1695
+ },
1696
+ "required": [
1697
+ "sliceId",
1698
+ "coverId",
1699
+ "amount",
1700
+ "receiver",
1701
+ "currency"
1702
+ ],
1703
+ "summary": "Fine Only instrument",
1704
+ "templateBinding": {
1705
+ "id": "assessment",
1706
+ "parameters": {
1707
+ "cost": false
1708
+ }
1709
+ },
1710
+ "title": "Fine Only"
1711
+ },
1712
+ {
1713
+ "actionOrder": [
1714
+ "create",
1715
+ "close"
1716
+ ],
1717
+ "actions": {
1718
+ "close": {
1719
+ "agentDescription": "Record the custody transition.",
1720
+ "funding": {
1721
+ "capture": "snapshot",
1722
+ "collectAction": "collect",
1723
+ "destinationAccountField": "fundingAccount",
1724
+ "obligationField": "obligationId",
1725
+ "principalField": "principal",
1726
+ "sourceAccountPath": "refs.escrow",
1727
+ "terms": {
1728
+ "currency": "currency",
1729
+ "principal": "principal"
1730
+ },
1731
+ "ticketAccountField": "wallet",
1732
+ "ticketAmountField": "amount",
1733
+ "ticketInstrumentId": "ticket",
1734
+ "ticketInvestorField": "investor",
1735
+ "ticketRefField": "roundId",
1736
+ "ticketStatus": "open"
1737
+ },
1738
+ "moves": [],
1739
+ "steps": [],
1740
+ "summary": "Record custody"
1741
+ },
1742
+ "create": {
1743
+ "agentDescription": "Record the custody transition.",
1744
+ "moves": [],
1745
+ "steps": [
1746
+ {
1747
+ "bind": {
1748
+ "currency": {
1749
+ "from": "instance",
1750
+ "path": "fields.currency"
1751
+ },
1752
+ "owner.id": {
1753
+ "from": "instance",
1754
+ "path": "productId"
1755
+ },
1756
+ "owner.type": {
1757
+ "from": "const",
1758
+ "value": "product"
1759
+ },
1760
+ "productId": {
1761
+ "from": "instance",
1762
+ "path": "productId"
1763
+ },
1764
+ "role": {
1765
+ "from": "const",
1766
+ "value": "product_escrow"
1767
+ }
1768
+ },
1769
+ "capture": {
1770
+ "escrow": "accountId"
1771
+ },
1772
+ "operation": "account.escrow.provision"
1773
+ }
1774
+ ],
1775
+ "summary": "Record custody"
1776
+ }
1777
+ },
1778
+ "agentDescription": "Bind frozen tickets to one obligation and its receipts.",
1779
+ "fields": {
1780
+ "currency": {
1781
+ "const": "SAR",
1782
+ "type": "string"
1783
+ },
1784
+ "fundingAccount": {
1785
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1786
+ "type": "string"
1787
+ },
1788
+ "maximumTicket": {
1789
+ "pattern": "^[1-9][0-9]{0,17}$",
1790
+ "type": "string",
1791
+ "x-hyperscale-currency": "SAR"
1792
+ },
1793
+ "minimumTicket": {
1794
+ "pattern": "^[1-9][0-9]{0,17}$",
1795
+ "type": "string",
1796
+ "x-hyperscale-currency": "SAR"
1797
+ },
1798
+ "obligationId": {
1799
+ "pattern": "^cvr_(sandbox|live)_[a-z0-9]{8,64}$",
1800
+ "type": "string"
1801
+ },
1802
+ "principal": {
1803
+ "pattern": "^[1-9][0-9]{0,17}$",
1804
+ "type": "string",
1805
+ "x-hyperscale-currency": "SAR"
1806
+ }
1807
+ },
1808
+ "id": "round",
1809
+ "idPrefix": "rnd",
1810
+ "lifecycle": {
1811
+ "initial": "open",
1812
+ "states": [
1813
+ "open",
1814
+ "closed"
1815
+ ],
1816
+ "transitions": {
1817
+ "close": {
1818
+ "from": [
1819
+ "open"
1820
+ ],
1821
+ "to": "closed"
1822
+ }
1823
+ }
1824
+ },
1825
+ "required": [
1826
+ "obligationId",
1827
+ "principal",
1828
+ "minimumTicket",
1829
+ "maximumTicket",
1830
+ "fundingAccount",
1831
+ "currency"
1832
+ ],
1833
+ "summary": "Frozen investor custody",
1834
+ "title": "round"
1835
+ },
1836
+ {
1837
+ "actionOrder": [
1838
+ "create",
1839
+ "collect"
1840
+ ],
1841
+ "actions": {
1842
+ "collect": {
1843
+ "agentDescription": "Record the custody transition.",
1844
+ "engineOwned": true,
1845
+ "moves": [],
1846
+ "steps": [],
1847
+ "summary": "Record custody"
1848
+ },
1849
+ "create": {
1850
+ "agentDescription": "Record the custody transition.",
1851
+ "moves": [],
1852
+ "requiresExposure": [
1853
+ {
1854
+ "amountField": "amount",
1855
+ "anchorField": "roundId",
1856
+ "capField": "maximumTicket",
1857
+ "capOnAnchor": true,
1858
+ "childInstrumentId": "ticket",
1859
+ "groupField": "investor",
1860
+ "minimumField": "minimumTicket",
1861
+ "statuses": [
1862
+ "open"
1863
+ ]
1864
+ }
1865
+ ],
1866
+ "steps": [],
1867
+ "summary": "Record custody"
1868
+ }
1869
+ },
1870
+ "agentDescription": "Bind frozen tickets to one obligation and its receipts.",
1871
+ "fields": {
1872
+ "amount": {
1873
+ "pattern": "^[1-9][0-9]{0,17}$",
1874
+ "type": "string",
1875
+ "x-hyperscale-currency": "SAR"
1876
+ },
1877
+ "currency": {
1878
+ "const": "SAR",
1879
+ "type": "string"
1880
+ },
1881
+ "investor": {
1882
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1883
+ "type": "string"
1884
+ },
1885
+ "roundId": {
1886
+ "pattern": "^rnd_(sandbox|live)_[a-z0-9]{8,64}$",
1887
+ "type": "string"
1888
+ },
1889
+ "wallet": {
1890
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1891
+ "type": "string"
1892
+ }
1893
+ },
1894
+ "id": "ticket",
1895
+ "idPrefix": "tkt",
1896
+ "lifecycle": {
1897
+ "initial": "open",
1898
+ "states": [
1899
+ "open",
1900
+ "closed"
1901
+ ],
1902
+ "transitions": {
1903
+ "collect": {
1904
+ "from": [
1905
+ "open"
1906
+ ],
1907
+ "to": "closed"
1908
+ }
1909
+ }
1910
+ },
1911
+ "required": [
1912
+ "roundId",
1913
+ "amount",
1914
+ "investor",
1915
+ "wallet",
1916
+ "currency"
1917
+ ],
1918
+ "summary": "Frozen investor custody",
1919
+ "title": "ticket"
1920
+ },
1921
+ {
1922
+ "actionOrder": [
1923
+ "create"
1924
+ ],
1925
+ "actions": {
1926
+ "create": {
1927
+ "agentDescription": "Record the custody transition.",
1928
+ "moves": [],
1929
+ "receiptDistribution": {
1930
+ "capture": "receipt",
1931
+ "feeAccountField": "fee",
1932
+ "feeBps": 100,
1933
+ "mode": "cash",
1934
+ "receiptField": "receiptId",
1935
+ "receiptPath": "refs.allocationReceipt",
1936
+ "residualAccountField": "residual",
1937
+ "roundField": "roundId",
1938
+ "snapshotRef": "snapshot",
1939
+ "taxAccountField": "tax",
1940
+ "vatBps": 1500
1941
+ },
1942
+ "steps": [],
1943
+ "summary": "Record custody"
1944
+ }
1945
+ },
1946
+ "agentDescription": "Bind frozen tickets to one obligation and its receipts.",
1947
+ "fields": {
1948
+ "currency": {
1949
+ "const": "SAR",
1950
+ "type": "string"
1951
+ },
1952
+ "fee": {
1953
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1954
+ "type": "string"
1955
+ },
1956
+ "receiptId": {
1957
+ "pattern": "^pmt_(sandbox|live)_[a-z0-9]{8,64}$",
1958
+ "type": "string"
1959
+ },
1960
+ "residual": {
1961
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1962
+ "type": "string"
1963
+ },
1964
+ "roundId": {
1965
+ "pattern": "^rnd_(sandbox|live)_[a-z0-9]{8,64}$",
1966
+ "type": "string"
1967
+ },
1968
+ "tax": {
1969
+ "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
1970
+ "type": "string"
1971
+ }
1972
+ },
1973
+ "id": "distribution",
1974
+ "idPrefix": "dst",
1975
+ "lifecycle": {
1976
+ "initial": "open",
1977
+ "states": [
1978
+ "open"
1979
+ ],
1980
+ "transitions": {}
1981
+ },
1982
+ "required": [
1983
+ "roundId",
1984
+ "receiptId",
1985
+ "fee",
1986
+ "tax",
1987
+ "residual",
1988
+ "currency"
1989
+ ],
1990
+ "summary": "Frozen investor custody",
1991
+ "title": "distribution"
1992
+ }
1993
+ ],
1994
+ "product": "vocabulary",
1995
+ "subjects": [],
1996
+ "title": "Vocabulary witnesses",
1997
+ "udl": 1,
1998
+ "version": 1
1999
+ }