@hyperscale0/hsx 1.0.0-alpha.6 → 1.0.0-rc.1
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.
- package/CHANGELOG.md +48 -10
- package/LICENSING.md +3 -3
- package/README.md +37 -149
- package/TRADEMARKS.md +4 -4
- package/dist/src/ast.d.ts +129 -10
- package/dist/src/ast.d.ts.map +1 -1
- package/dist/src/cli.d.ts +2 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +148 -12
- package/dist/src/cli.js.map +1 -1
- package/dist/src/compile.d.ts +41 -4
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +82 -15
- package/dist/src/compile.js.map +1 -1
- package/dist/src/cost.d.ts +78 -0
- package/dist/src/cost.d.ts.map +1 -0
- package/dist/src/cost.js +369 -0
- package/dist/src/cost.js.map +1 -0
- package/dist/src/diagnostics.d.ts +11 -0
- package/dist/src/diagnostics.d.ts.map +1 -0
- package/dist/src/diagnostics.js +420 -0
- package/dist/src/diagnostics.js.map +1 -0
- package/dist/src/emit.d.ts +35 -0
- package/dist/src/emit.d.ts.map +1 -0
- package/dist/src/emit.js +359 -0
- package/dist/src/emit.js.map +1 -0
- package/dist/src/entry-overrides.d.ts +17 -3
- package/dist/src/entry-overrides.d.ts.map +1 -1
- package/dist/src/entry-overrides.js +180 -35
- package/dist/src/entry-overrides.js.map +1 -1
- package/dist/src/format.d.ts +10 -0
- package/dist/src/format.d.ts.map +1 -0
- package/dist/src/format.js +183 -0
- package/dist/src/format.js.map +1 -0
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/ir.d.ts +66 -0
- package/dist/src/ir.d.ts.map +1 -0
- package/dist/src/ir.js +15 -0
- package/dist/src/ir.js.map +1 -0
- package/dist/src/lex.d.ts +9 -1
- package/dist/src/lex.d.ts.map +1 -1
- package/dist/src/lex.js +50 -4
- package/dist/src/lex.js.map +1 -1
- package/dist/src/limits.d.ts +2 -3
- package/dist/src/limits.d.ts.map +1 -1
- package/dist/src/limits.js +2 -3
- package/dist/src/limits.js.map +1 -1
- package/dist/src/modules.d.ts +36 -0
- package/dist/src/modules.d.ts.map +1 -0
- package/dist/src/modules.js +372 -0
- package/dist/src/modules.js.map +1 -0
- package/dist/src/parse.d.ts.map +1 -1
- package/dist/src/parse.js +590 -17
- package/dist/src/parse.js.map +1 -1
- package/dist/src/typecheck.d.ts +8 -0
- package/dist/src/typecheck.d.ts.map +1 -0
- package/dist/src/typecheck.js +2958 -0
- package/dist/src/typecheck.js.map +1 -0
- package/dist/src/version.d.ts +4 -15
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +4 -15
- package/dist/src/version.js.map +1 -1
- package/docs/README.md +23 -0
- package/docs/guide/01-first-program.md +24 -0
- package/docs/guide/02-money.md +25 -0
- package/docs/guide/03-instruments.md +22 -0
- package/docs/guide/04-lifecycles.md +25 -0
- package/docs/guide/05-fees-and-splits.md +45 -0
- package/docs/guide/06-schedules.md +22 -0
- package/docs/guide/07-composition.md +46 -0
- package/docs/guide/08-writing-a-module.md +26 -0
- package/docs/guide/09-cost.md +24 -0
- package/docs/guide/10-diagnostics.md +27 -0
- package/docs/llms-full.txt +1738 -0
- package/docs/llms.txt +45 -0
- package/docs/reference/cli.md +33 -0
- package/docs/reference/diagnostics.md +619 -0
- package/docs/reference/grammar.md +39 -0
- package/docs/reference/std/advance.md +35 -0
- package/docs/reference/std/cancellable_booking.md +35 -0
- package/docs/reference/std/captured_payment.md +43 -0
- package/docs/reference/std/conditional_disbursement.md +33 -0
- package/docs/reference/std/credit_facility.md +35 -0
- package/docs/reference/std/held_payment.md +64 -0
- package/docs/reference/std/instant_transfer.md +30 -0
- package/docs/reference/std/metered.md +27 -0
- package/docs/reference/std/pooled_split.md +26 -0
- package/docs/reference/std/premium_forward.md +39 -0
- package/docs/reference/std/reconciled_payout.md +33 -0
- package/docs/reference/std/recurring_collection.md +25 -0
- package/docs/reference/std/rotating_pool.md +42 -0
- package/docs/reference/std/scheduled.md +51 -0
- package/docs/reference/std/security_deposit.md +46 -0
- package/docs/reference/std/settlement_batch.md +42 -0
- package/docs/reference/std/swap.md +46 -0
- package/docs/reference/std/threshold_pool.md +47 -0
- package/docs/reference/std/weighted_distribution.md +39 -0
- package/docs/reference/types.md +20 -0
- package/docs/reference/udl-output.md +14 -0
- package/docs/sessions/2026-09-02-two-instruments.hsx +21 -0
- package/docs/sessions/2026-09-02-two-instruments.md +41 -0
- package/examples/01-first-program/README.md +45 -0
- package/examples/01-first-program/tip-jar.hsx +17 -0
- package/examples/02-imports-and-archetypes/README.md +99 -0
- package/examples/02-imports-and-archetypes/photo-booth.hsx +37 -0
- package/examples/03-diagnostics/README.md +68 -0
- package/examples/03-diagnostics/corner-shop-fixed.hsx +22 -0
- package/examples/03-diagnostics/corner-shop.hsx +19 -0
- package/examples/04-complete-product/README.md +87 -0
- package/examples/04-complete-product/study-hall.hsx +67 -0
- package/examples/05-watch-club/README.md +9 -0
- package/examples/05-watch-club/watch-club.hsx +124 -0
- package/examples/README.md +18 -0
- package/examples/advance/README.md +3 -0
- package/examples/advance/advance.hsx +13 -0
- package/examples/advance/advance.udl +339 -0
- package/examples/cancellable_booking/README.md +3 -0
- package/examples/cancellable_booking/cancellable_booking.hsx +14 -0
- package/examples/cancellable_booking/cancellable_booking.udl +391 -0
- package/examples/captured_payment/README.md +3 -0
- package/examples/captured_payment/captured_payment.hsx +21 -0
- package/examples/captured_payment/captured_payment.udl +677 -0
- package/examples/conditional_disbursement/README.md +3 -0
- package/examples/conditional_disbursement/conditional_disbursement.hsx +17 -0
- package/examples/conditional_disbursement/conditional_disbursement.udl +412 -0
- package/examples/cost-table.json +386 -0
- package/examples/credit_facility/README.md +3 -0
- package/examples/credit_facility/credit_facility.hsx +27 -0
- package/examples/credit_facility/credit_facility.udl +1373 -0
- package/examples/held_payment/README.md +3 -0
- package/examples/held_payment/held_payment.hsx +13 -0
- package/examples/held_payment/held_payment.udl +507 -0
- package/examples/instant_transfer/README.md +3 -0
- package/examples/instant_transfer/instant_transfer.hsx +16 -0
- package/examples/instant_transfer/instant_transfer.udl +364 -0
- package/examples/metered/README.md +3 -0
- package/examples/metered/metered.hsx +13 -0
- package/examples/metered/metered.udl +247 -0
- package/examples/pooled_split/README.md +3 -0
- package/examples/pooled_split/pooled_split.hsx +15 -0
- package/examples/pooled_split/pooled_split.udl +425 -0
- package/examples/premium_forward/README.md +3 -0
- package/examples/premium_forward/premium_forward.hsx +19 -0
- package/examples/premium_forward/premium_forward.udl +594 -0
- package/examples/reconciled_payout/README.md +3 -0
- package/examples/reconciled_payout/reconciled_payout.hsx +13 -0
- package/examples/reconciled_payout/reconciled_payout.udl +303 -0
- package/examples/recurring_collection/README.md +3 -0
- package/examples/recurring_collection/recurring_collection.hsx +21 -0
- package/examples/recurring_collection/recurring_collection.udl +1130 -0
- package/examples/rotating_pool/README.md +3 -0
- package/examples/rotating_pool/rotating_pool.hsx +18 -0
- package/examples/rotating_pool/rotating_pool.udl +4352 -0
- package/examples/scheduled/README.md +3 -0
- package/examples/scheduled/scheduled.hsx +12 -0
- package/examples/scheduled/scheduled.udl +335 -0
- package/examples/security_deposit/README.md +3 -0
- package/examples/security_deposit/security_deposit.hsx +21 -0
- package/examples/security_deposit/security_deposit.udl +293 -0
- package/examples/settlement_batch/README.md +3 -0
- package/examples/settlement_batch/settlement_batch.hsx +19 -0
- package/examples/settlement_batch/settlement_batch.udl +753 -0
- package/examples/swap/README.md +3 -0
- package/examples/swap/swap.hsx +19 -0
- package/examples/swap/swap.udl +876 -0
- package/examples/threshold_pool/README.md +3 -0
- package/examples/threshold_pool/threshold_pool.hsx +16 -0
- package/examples/threshold_pool/threshold_pool.udl +667 -0
- package/examples/weighted_distribution/README.md +3 -0
- package/examples/weighted_distribution/weighted_distribution.hsx +20 -0
- package/examples/weighted_distribution/weighted_distribution.udl +337 -0
- package/package.json +19 -6
- package/skills/hsx/SKILL.md +483 -0
- package/src/ast.ts +163 -9
- package/src/cli.ts +164 -12
- package/src/compile.ts +160 -20
- package/src/cost.ts +579 -0
- package/src/diagnostics.ts +442 -0
- package/src/emit.ts +447 -0
- package/src/entry-overrides.ts +263 -48
- package/src/format.ts +261 -0
- package/src/index.ts +32 -4
- package/src/ir.ts +99 -0
- package/src/lex.ts +59 -4
- package/src/limits.ts +2 -3
- package/src/modules.ts +444 -0
- package/src/parse.ts +655 -21
- package/src/typecheck.ts +3876 -0
- package/src/version.ts +4 -16
- package/std/SEMANTICS.md +130 -0
- package/std/settlements/advance.hsx +177 -0
- package/std/settlements/cancellable_booking.hsx +87 -0
- package/std/settlements/captured_payment.hsx +144 -0
- package/std/settlements/conditional_disbursement.hsx +185 -0
- package/std/settlements/credit_facility.hsx +167 -0
- package/std/settlements/held_payment.hsx +578 -0
- package/std/settlements/index.hsx +3 -0
- package/std/settlements/instant_transfer.hsx +190 -0
- package/std/settlements/metered.hsx +67 -0
- package/std/settlements/pooled_split.hsx +68 -0
- package/std/settlements/premium_forward.hsx +257 -0
- package/std/settlements/reconciled_payout.hsx +77 -0
- package/std/settlements/recurring_collection.hsx +27 -0
- package/std/settlements/rotating_pool.hsx +252 -0
- package/std/settlements/scheduled.hsx +641 -0
- package/std/settlements/security_deposit.hsx +166 -0
- package/std/settlements/settlement_batch.hsx +122 -0
- package/std/settlements/swap.hsx +1114 -0
- package/std/settlements/threshold_pool.hsx +221 -0
- package/std/settlements/weighted_distribution.hsx +141 -0
- package/dist/src/archetypes.d.ts +0 -17
- package/dist/src/archetypes.d.ts.map +0 -1
- package/dist/src/archetypes.js +0 -327
- package/dist/src/archetypes.js.map +0 -1
- package/dist/src/check.d.ts +0 -12
- package/dist/src/check.d.ts.map +0 -1
- package/dist/src/check.js +0 -1910
- package/dist/src/check.js.map +0 -1
- package/dist/src/lower.d.ts +0 -146
- package/dist/src/lower.d.ts.map +0 -1
- package/dist/src/lower.js +0 -4570
- package/dist/src/lower.js.map +0 -1
- package/dist/src/model.d.ts +0 -467
- package/dist/src/model.d.ts.map +0 -1
- package/dist/src/model.js +0 -15
- package/dist/src/model.js.map +0 -1
- package/spec/hsx-ir.schema.json +0 -920
- package/src/archetypes.ts +0 -340
- package/src/check.ts +0 -2938
- package/src/lower.ts +0 -5416
- package/src/model.ts +0 -519
|
@@ -0,0 +1,1738 @@
|
|
|
1
|
+
<!-- Generated by scripts/docs/build.ts for HSX 1.0.0-rc.1. Do not edit. -->
|
|
2
|
+
|
|
3
|
+
# HSX full documentation
|
|
4
|
+
|
|
5
|
+
# Your first program
|
|
6
|
+
|
|
7
|
+
An HSX file declares one program, the parties that take part, and the instruments that define its money rules. A settlement applies a standard-library instrument. The compiler checks the application and emits canonical UDL with a Business Frame, an origin map, and a cost manifest.
|
|
8
|
+
|
|
9
|
+
This program sends a tip from a listener to a host:
|
|
10
|
+
|
|
11
|
+
```hsx
|
|
12
|
+
program tip_jar "Tip jar"
|
|
13
|
+
import { instant_transfer } from "std/settlements"
|
|
14
|
+
party listener: person
|
|
15
|
+
party host: business
|
|
16
|
+
settlement tip = instant_transfer {
|
|
17
|
+
payer: listener
|
|
18
|
+
payee: host
|
|
19
|
+
amount: tipAmount: money(SAR)
|
|
20
|
+
fees { listener: 1% }
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`tipAmount` is an input field measured in SAR minor units. The settlement becomes an instrument named `tip` in the UDL document.
|
|
25
|
+
|
|
26
|
+
A port declares a decision that an external caller may supply. The port names the parties allowed to answer and may define a typed input shape. Use a port only when the selected instrument accepts a condition parameter.
|
|
27
|
+
|
|
28
|
+
After package installation, run `npx hsx check product.hsx` while editing and `npx hsx build product.hsx --out product.udl.json` when the program passes. In a repository checkout, run `bun install` once, then use `bun run bin/hsx.ts check product.hsx` and `bun run bin/hsx.ts build product.hsx --out product.udl.json`.
|
|
29
|
+
|
|
30
|
+
# Money
|
|
31
|
+
|
|
32
|
+
HSX indexes money by currency. `money<SAR>` is the field type inside a general instrument. `amount: total: money(SAR)` binds a settlement parameter to a new SAR money field. Values use integer minor units, so `1250` means SAR 12.50.
|
|
33
|
+
|
|
34
|
+
Money of different currencies never unifies. Percent literals use basis-point precision: `2%` is 200 basis points and `2.5%` is 250 basis points. The compiler floors percentage-derived minor units and assigns any declared remainder according to the selected instrument.
|
|
35
|
+
|
|
36
|
+
Money is linear. A computed amount must be consumed exactly once. This invalid general-form program uses `rest` twice, so the compiler reports `HSX1201`:
|
|
37
|
+
|
|
38
|
+
```hsx expect=HSX1201
|
|
39
|
+
program duplicated_money "Duplicated money"
|
|
40
|
+
party buyer: person
|
|
41
|
+
instrument invoice {
|
|
42
|
+
fields { amount: money<SAR>; }
|
|
43
|
+
lifecycle { states created paid; initial created; on pay: created -> paid; }
|
|
44
|
+
parties { payer: buyer; }
|
|
45
|
+
action create { steps: []; }
|
|
46
|
+
action pay {
|
|
47
|
+
computes remainder rest { amount_ref: total; on_zero: refuse; total_path: fields.amount; }
|
|
48
|
+
moves: [{ amount: rest; }, { amount: rest; }]
|
|
49
|
+
steps: []
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Do not use free arithmetic to repair a linearity refusal. Choose a standard-library split, fee, or derived-amount form that states where every minor unit goes.
|
|
55
|
+
|
|
56
|
+
# Instruments
|
|
57
|
+
|
|
58
|
+
Start with the standard library. Import a settlement module by export name from `std/settlements`, then apply it under a local settlement name. The local name becomes the emitted instrument id.
|
|
59
|
+
|
|
60
|
+
```hsx
|
|
61
|
+
program equipment_hire "Equipment hire"
|
|
62
|
+
import { scheduled } from "std/settlements"
|
|
63
|
+
party renter: person
|
|
64
|
+
party owner: business
|
|
65
|
+
settlement installments = scheduled {
|
|
66
|
+
payer: renter
|
|
67
|
+
payee: owner
|
|
68
|
+
amount: hirePrice: money(SAR)
|
|
69
|
+
count: 2
|
|
70
|
+
every: P30D
|
|
71
|
+
first_due: firstPaymentAt
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Required parameters state the instrument's core contract. Optional parameters add bounded behavior such as a deadline, cancellation allocation, fee, or policy. Omit an optional block when the product does not need it. Do not pass an empty block as a substitute unless the module documents that form.
|
|
76
|
+
|
|
77
|
+
The generated standard-library reference lists every module, parameter, action, port, and emitted clause. Read that page before choosing a module. Prefer one module that already states the required lifecycle over a custom instrument with copied mechanics.
|
|
78
|
+
|
|
79
|
+
# Lifecycles
|
|
80
|
+
|
|
81
|
+
A lifecycle lists every state, names one initial state, and declares action transitions. Every reachable nonterminal state must have a bounded exit or be explicitly parked for a caller action. Actions hold the money moves and other typed clauses that occur on a transition.
|
|
82
|
+
|
|
83
|
+
```hsx
|
|
84
|
+
program approvals "Approvals"
|
|
85
|
+
instrument approval {
|
|
86
|
+
title: "Approval"
|
|
87
|
+
summary: "A bounded approval decision"
|
|
88
|
+
fields {}
|
|
89
|
+
lifecycle {
|
|
90
|
+
states pending approved rejected;
|
|
91
|
+
initial pending;
|
|
92
|
+
on approve: pending -> approved;
|
|
93
|
+
on reject: pending -> rejected;
|
|
94
|
+
}
|
|
95
|
+
action create { steps: []; moves: []; }
|
|
96
|
+
action approve { steps: []; moves: []; }
|
|
97
|
+
action reject { steps: []; moves: []; }
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Standard-library instruments bind ports to caller decisions. A deadline appears as stored date data and a `due` clause on the action that may run at that date. An unwind states how a failed or cancelled path drains held value. The compiler refuses a reachable exit that strands money.
|
|
102
|
+
|
|
103
|
+
Keep lifecycle changes additive after composition. Add a new action or state when old instances can still obey the previous contract. Do not rename a state or tighten an active transition in place.
|
|
104
|
+
|
|
105
|
+
# Fees and splits
|
|
106
|
+
|
|
107
|
+
Standard-library payment modules accept bounded fee forms. A payer fee sits on top of the principal. A payee fee is carved from the payout. A fee may be an exact percentage, an immutable money field, or a finite tier table when the module accepts it.
|
|
108
|
+
|
|
109
|
+
```hsx
|
|
110
|
+
program lesson_market "Lesson market"
|
|
111
|
+
import { instant_transfer, pooled_split } from "std/settlements"
|
|
112
|
+
party student: person
|
|
113
|
+
party tutor: business
|
|
114
|
+
party assistant: business
|
|
115
|
+
party school: business
|
|
116
|
+
settlement lesson = instant_transfer {
|
|
117
|
+
payer: student
|
|
118
|
+
payee: tutor
|
|
119
|
+
amount: lessonFee: money(SAR)
|
|
120
|
+
fees { student: 1%, tutor: 8% }
|
|
121
|
+
}
|
|
122
|
+
settlement payout = pooled_split {
|
|
123
|
+
payer: school
|
|
124
|
+
amount: weeklyPool: money(SAR)
|
|
125
|
+
payout_due: payoutAt
|
|
126
|
+
split { tutor: 60%, assistant: 40%, remainder_to: tutor }
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Every percentage partition must total 100 percent. `pooled_split` distributes a pool among named recipients and sends integer-division residue to `remainder_to`. `security_deposit` can bind a decided claim amount and return the unused remainder. `weighted_distribution` records bounded entitlement rows before it snapshots a distribution.
|
|
131
|
+
|
|
132
|
+
`cancellable_booking` uses `quote` and `commit` when a fee must be shown before it can move money. Its `cancel` action prices a penalty from the time left before `starts_at`, freezes the price and the fields named by `fixes`, and gives the offer a bounded life. Its `confirm` action commits that exact quote. Expiry or a changed frozen field refuses the commit instead of repricing it silently.
|
|
133
|
+
|
|
134
|
+
```hsx
|
|
135
|
+
program studio_booking "Studio booking"
|
|
136
|
+
import { cancellable_booking } from "std/settlements"
|
|
137
|
+
party guest: person
|
|
138
|
+
party studio: business
|
|
139
|
+
settlement session = cancellable_booking {
|
|
140
|
+
guest: guest
|
|
141
|
+
host: studio
|
|
142
|
+
amount: sessionPrice: money(SAR)
|
|
143
|
+
starts_at: startsAt
|
|
144
|
+
late_penalty_bps: 5000
|
|
145
|
+
late_within: P2D
|
|
146
|
+
early_penalty_bps: 1000
|
|
147
|
+
offer_life: PT30M
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
# Schedules
|
|
152
|
+
|
|
153
|
+
HSX schedules are finite. A literal `count`, an interval, and a first due date let the compiler expand installments at compile time. The monthly obligation form can instead use a caller-controlled end condition, but it must name the drain action that ends future liability.
|
|
154
|
+
|
|
155
|
+
```hsx
|
|
156
|
+
program installments "Installments"
|
|
157
|
+
import { scheduled } from "std/settlements"
|
|
158
|
+
party buyer: person
|
|
159
|
+
party seller: business
|
|
160
|
+
settlement plan = scheduled {
|
|
161
|
+
payer: buyer
|
|
162
|
+
payee: seller
|
|
163
|
+
amount: totalAmount: money(SAR)
|
|
164
|
+
count: 3
|
|
165
|
+
every: P30D
|
|
166
|
+
first_due: firstDueAt
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
`scheduled` handles finite installments and obligation schedules. `recurring_collection` records collection periods without inventing money movement. `rotating_pool` expands a fixed roster and cycle count. `settlement_batch` closes on a stored date before calculation, approval, instruction, acknowledgement, and reconciliation actions.
|
|
171
|
+
|
|
172
|
+
General modules may use a comprehension over a compile-time integer or finite list. Runtime-dependent bounds are refused. An expansion may contain at most 256 generated rows.
|
|
173
|
+
|
|
174
|
+
# Composition
|
|
175
|
+
|
|
176
|
+
One program can apply several instruments. Each instrument keeps its own lifecycle and fields. References connect them through typed ids instead of shared mutable state.
|
|
177
|
+
|
|
178
|
+
```hsx
|
|
179
|
+
program studio_sales "Studio sales"
|
|
180
|
+
import { instant_transfer, scheduled } from "std/settlements"
|
|
181
|
+
party buyer: person
|
|
182
|
+
party studio: business
|
|
183
|
+
settlement purchase = instant_transfer {
|
|
184
|
+
payer: buyer
|
|
185
|
+
payee: studio
|
|
186
|
+
amount: purchasePrice: money(SAR)
|
|
187
|
+
fees { buyer: 1% }
|
|
188
|
+
}
|
|
189
|
+
settlement installments = scheduled {
|
|
190
|
+
payer: buyer
|
|
191
|
+
payee: studio
|
|
192
|
+
amount: servicePrice: money(SAR)
|
|
193
|
+
count: 2
|
|
194
|
+
every: P30D
|
|
195
|
+
first_due: firstPaymentAt
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
A general instrument declares a `ref<target>` field when an instance must point to another instrument. Cross-instrument clauses bind against the target's declared fields, actions, and lifecycle states after the full module graph resolves. A missing target or incompatible field reports a typed diagnostic before UDL emission.
|
|
200
|
+
|
|
201
|
+
Keep each money route in one instrument. Connect instruments with evidence and references. Do not move an amount through an untyped text field.
|
|
202
|
+
|
|
203
|
+
`reconciled_payout` composes a payout instruction with one explicit expectation about the bank debit that follows. Its `reconcile` clause binds the expected amount, currency, direction, payout reference, evidence source, match law, and deadline. A match settles the payout. A missed or mismatched expectation creates the declared break child, so the composition retains the exception as contract data.
|
|
204
|
+
|
|
205
|
+
```hsx
|
|
206
|
+
program supplier_payment "Supplier payment"
|
|
207
|
+
import { reconciled_payout } from "std/settlements"
|
|
208
|
+
party treasury: business
|
|
209
|
+
party supplier: business
|
|
210
|
+
settlement payout = reconciled_payout {
|
|
211
|
+
payer: treasury
|
|
212
|
+
beneficiary: supplier
|
|
213
|
+
amount: netPayable: money(SAR)
|
|
214
|
+
beneficiary_ref: supplierBeneficiaryId
|
|
215
|
+
settle_by: settleBy
|
|
216
|
+
matched_within: 100
|
|
217
|
+
matched_ceiling: 500
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
# Writing a module
|
|
222
|
+
|
|
223
|
+
A module is ordinary HSX source. It declares a dotted module name and exports templates, types, constants, subjects, or applications. The compiler does not branch on a standard-library module name.
|
|
224
|
+
|
|
225
|
+
```hsx
|
|
226
|
+
program approval_example "Approval example"
|
|
227
|
+
instrument approval() {
|
|
228
|
+
title: "Approval"
|
|
229
|
+
summary: "A reusable approval lifecycle"
|
|
230
|
+
fields {}
|
|
231
|
+
lifecycle {
|
|
232
|
+
states pending approved;
|
|
233
|
+
initial pending;
|
|
234
|
+
on approve: pending -> approved;
|
|
235
|
+
}
|
|
236
|
+
action create { steps: []; moves: []; }
|
|
237
|
+
action approve { steps: []; moves: []; }
|
|
238
|
+
}
|
|
239
|
+
instrument review = approval()
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
A parameter list makes an instrument a template, including an empty list. A concrete instrument without a parameter list emits directly when its file compiles. Export only the declarations that callers need.
|
|
243
|
+
|
|
244
|
+
Imported exports carry the local declarations they reference. Identical declarations unify. Conflicting declarations report `HSX1009`. Keep module parameters typed, keep loops finite, and use UDL clause vocabulary for instrument and action mechanics.
|
|
245
|
+
|
|
246
|
+
Publish a module only after compiling it directly and through an importing program. Compare the canonical UDL bytes from both paths when the exported application should be identical.
|
|
247
|
+
|
|
248
|
+
# Cost
|
|
249
|
+
|
|
250
|
+
Compilation emits a deterministic cost manifest beside the UDL document. The manifest pins the cost-table version and effective digest. It records fixed structural cost, action effect rows, payer, settlement policy, meters, per-event prices, and any basis-point volume price.
|
|
251
|
+
|
|
252
|
+
```hsx
|
|
253
|
+
program direct_sale "Direct sale"
|
|
254
|
+
import { instant_transfer } from "std/settlements"
|
|
255
|
+
party buyer: person
|
|
256
|
+
party seller: business
|
|
257
|
+
settlement sale = instant_transfer {
|
|
258
|
+
payer: buyer
|
|
259
|
+
payee: seller
|
|
260
|
+
amount: saleAmount: money(SAR)
|
|
261
|
+
fees { buyer: 1% }
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Read an action line as `instrument.action`, followed by the effect signature and its count. The payer tells whether the product or end customer bears the row. `perEventMinor` prices one occurrence in the cost table's billing currency. A row with `bps` also names a volume meter.
|
|
266
|
+
|
|
267
|
+
The monthly estimate is an expression over declared meter variables. Billing supplies observed readings to that frozen expression. Recomposition emits a new manifest for the next commercial snapshot. It does not rewrite a prior manifest.
|
|
268
|
+
|
|
269
|
+
An effect without a price row reports `HSX1301`. An invalid price reports `HSX1302`. A missing cost table also reports `HSX1301`. Use the single rate card shipped at `examples/cost-table.json`; do not create a second table for documentation.
|
|
270
|
+
|
|
271
|
+
Do not confuse an action `quote` with the commercial cost manifest. `cancellable_booking.cancel` quotes a customer-visible cancellation penalty and `confirm` commits it. The compiler counts an instrument that carries a quote as unwind work because an expired or abandoned offer still needs bounded cleanup. The cost manifest prices that runtime work from the shipped rate card. It does not replace, spend, or alter the quoted financial amount.
|
|
272
|
+
|
|
273
|
+
# Diagnostics
|
|
274
|
+
|
|
275
|
+
An HSX diagnostic carries a stable code, severity, stage, source line and column, message, and fix. Match automation on the code. Treat the message as explanation rather than a stable interface.
|
|
276
|
+
|
|
277
|
+
The stages locate the refusal:
|
|
278
|
+
|
|
279
|
+
- `parse` means the source did not form valid declarations or expressions.
|
|
280
|
+
- `bind` means an import, name, port, or reference did not resolve.
|
|
281
|
+
- `typecheck` and `check` mean the program formed but violated a type or language law.
|
|
282
|
+
- `lower` means the typed program could not emit valid UDL.
|
|
283
|
+
|
|
284
|
+
Use one loop: compile, find the first error code in the diagnostics reference, apply its stated fix, and compile again. Do not suppress the diagnostic or alter generated UDL by hand.
|
|
285
|
+
|
|
286
|
+
```hsx
|
|
287
|
+
program repaired_transfer "Repaired transfer"
|
|
288
|
+
import { instant_transfer } from "std/settlements"
|
|
289
|
+
party sender: person
|
|
290
|
+
party recipient: business
|
|
291
|
+
settlement transfer = instant_transfer {
|
|
292
|
+
payer: sender
|
|
293
|
+
payee: recipient
|
|
294
|
+
amount: transferAmount: money(SAR)
|
|
295
|
+
fees { sender: 1% }
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Exit code `0` means the command accepted the program. Exit code `1` means compilation refused it. Exit code `2` means the invocation or file operation failed. `hsx explain HSX1201` prints the catalog entry for one code.
|
|
300
|
+
|
|
301
|
+
# CLI
|
|
302
|
+
|
|
303
|
+
```text
|
|
304
|
+
hsx 1.0.0-rc.1, the HSX compiler
|
|
305
|
+
|
|
306
|
+
Usage:
|
|
307
|
+
hsx check <file.hsx> [--strict]
|
|
308
|
+
hsx build <file.hsx> [--out <file.json>] [--strict]
|
|
309
|
+
hsx cost <file.hsx> [--json] [--out <file.json>] [--strict]
|
|
310
|
+
hsx explain <HSX####>
|
|
311
|
+
hsx format <file.hsx>
|
|
312
|
+
hsx --version
|
|
313
|
+
hsx --help
|
|
314
|
+
|
|
315
|
+
Commands:
|
|
316
|
+
check Compile and report diagnostics. Prints nothing when the program is clean.
|
|
317
|
+
build Compile and write canonical UDL and its Business Frame as JSON.
|
|
318
|
+
cost Compile and print the version-pinned cost manifest as a table or JSON.
|
|
319
|
+
explain Print one diagnostic title, fix, and source example.
|
|
320
|
+
format Print the source in the one canonical HSX style.
|
|
321
|
+
|
|
322
|
+
Options:
|
|
323
|
+
--json Print the cost manifest as JSON instead of a table.
|
|
324
|
+
--out <file> Write build or cost JSON to this path instead of stdout.
|
|
325
|
+
--strict Treat warning-severity diagnostics as failures.
|
|
326
|
+
|
|
327
|
+
Exit codes:
|
|
328
|
+
0 the program compiled (verdict valid, or warning without --strict)
|
|
329
|
+
1 the program was refused (verdict invalid, or warning with --strict)
|
|
330
|
+
2 the command line or the input file could not be used
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
# Diagnostics
|
|
334
|
+
|
|
335
|
+
Use `hsx explain HSX####` for the same catalog entry.
|
|
336
|
+
|
|
337
|
+
## HSX1000: Missing file declaration
|
|
338
|
+
|
|
339
|
+
Stage: `typecheck`
|
|
340
|
+
|
|
341
|
+
Fix: Add one program header or module declaration.
|
|
342
|
+
|
|
343
|
+
No source-only witness exists. The compiler host or lowering input must supply the invalid value.
|
|
344
|
+
|
|
345
|
+
## HSX1001: Unbound name
|
|
346
|
+
|
|
347
|
+
Stage: `bind`
|
|
348
|
+
|
|
349
|
+
Fix: Declare or import the name before using it.
|
|
350
|
+
|
|
351
|
+
```hsx expect=HSX1001
|
|
352
|
+
program catalog_probe "Catalog probe"
|
|
353
|
+
instrument probe = missing()
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## HSX1002: Duplicate program declaration
|
|
357
|
+
|
|
358
|
+
Stage: `typecheck`
|
|
359
|
+
|
|
360
|
+
Fix: Keep exactly one program declaration.
|
|
361
|
+
|
|
362
|
+
```hsx expect=HSX1002
|
|
363
|
+
program catalog_probe "Catalog probe"
|
|
364
|
+
instrument probe {
|
|
365
|
+
fields {}
|
|
366
|
+
lifecycle { states created; initial created; }
|
|
367
|
+
action create { steps: []; }
|
|
368
|
+
|
|
369
|
+
}
|
|
370
|
+
program second "Second"
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## HSX1003: Invalid declaration name
|
|
374
|
+
|
|
375
|
+
Stage: `typecheck`
|
|
376
|
+
|
|
377
|
+
Fix: Use lowercase snake_case for program and instrument names.
|
|
378
|
+
|
|
379
|
+
```hsx expect=HSX1003
|
|
380
|
+
program NotSnake "Catalog probe"
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## HSX1004: Duplicate declaration
|
|
384
|
+
|
|
385
|
+
Stage: `typecheck`
|
|
386
|
+
|
|
387
|
+
Fix: Keep one declaration or give each declaration a distinct name.
|
|
388
|
+
|
|
389
|
+
```hsx expect=HSX1004
|
|
390
|
+
program catalog_probe "Catalog probe"
|
|
391
|
+
instrument probe {
|
|
392
|
+
fields {}
|
|
393
|
+
lifecycle { states created; initial created; }
|
|
394
|
+
action create { steps: []; }
|
|
395
|
+
|
|
396
|
+
}
|
|
397
|
+
instrument probe { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## HSX1005: Invalid field name
|
|
401
|
+
|
|
402
|
+
Stage: `typecheck`
|
|
403
|
+
|
|
404
|
+
Fix: Rename the field in lower camelCase.
|
|
405
|
+
|
|
406
|
+
No source-only witness exists. The parser normalizes every accepted field spelling before typechecking.
|
|
407
|
+
|
|
408
|
+
## HSX1006: Invalid module import
|
|
409
|
+
|
|
410
|
+
Stage: `bind`
|
|
411
|
+
|
|
412
|
+
Fix: Resolve one module that exports each imported name exactly once.
|
|
413
|
+
|
|
414
|
+
No source-only witness exists. This refusal requires a compiler-host module resolver result.
|
|
415
|
+
|
|
416
|
+
## HSX1007: Invalid cross-instrument reference
|
|
417
|
+
|
|
418
|
+
Stage: `typecheck`
|
|
419
|
+
|
|
420
|
+
Fix: Name an existing target instrument in the ref type.
|
|
421
|
+
|
|
422
|
+
```hsx expect=HSX1007
|
|
423
|
+
program catalog_probe "Catalog probe"
|
|
424
|
+
instrument probe {
|
|
425
|
+
fields { parentId { type: ref; description: "Parent"; } }
|
|
426
|
+
lifecycle { states created; initial created; }
|
|
427
|
+
action create { steps: []; }
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## HSX1008: Invalid subject or decision port
|
|
432
|
+
|
|
433
|
+
Stage: `typecheck`
|
|
434
|
+
|
|
435
|
+
Fix: Complete the declaration and bind every referenced decision port.
|
|
436
|
+
|
|
437
|
+
```hsx expect=HSX1008
|
|
438
|
+
program catalog_probe "Catalog probe"
|
|
439
|
+
instrument probe {
|
|
440
|
+
fields {}
|
|
441
|
+
lifecycle { states created; initial created; }
|
|
442
|
+
action create { steps: []; }
|
|
443
|
+
|
|
444
|
+
}
|
|
445
|
+
subject vehicle { title: "Vehicle"; }
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## HSX1009: Imported declaration collision
|
|
449
|
+
|
|
450
|
+
Stage: `bind`
|
|
451
|
+
|
|
452
|
+
Fix: Rename the importer-owned declaration or the module-local declaration.
|
|
453
|
+
|
|
454
|
+
No source-only witness exists. This refusal requires declarations returned by a compiler-host module resolver.
|
|
455
|
+
|
|
456
|
+
## HSX1010: Wrong type-argument count
|
|
457
|
+
|
|
458
|
+
Stage: `typecheck`
|
|
459
|
+
|
|
460
|
+
Fix: Supply exactly the type arguments declared by the instrument function.
|
|
461
|
+
|
|
462
|
+
```hsx expect=HSX1010
|
|
463
|
+
program catalog_probe "Catalog probe"
|
|
464
|
+
export instrument template<C>() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
|
|
465
|
+
instrument probe = template<SAR, USD>()
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
## HSX1011: Missing required argument
|
|
469
|
+
|
|
470
|
+
Stage: `typecheck`
|
|
471
|
+
|
|
472
|
+
Fix: Pass every required instrument-function argument.
|
|
473
|
+
|
|
474
|
+
```hsx expect=HSX1011
|
|
475
|
+
program catalog_probe "Catalog probe"
|
|
476
|
+
export instrument template(value: text) { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
|
|
477
|
+
instrument probe = template()
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## HSX1012: Unknown named argument
|
|
481
|
+
|
|
482
|
+
Stage: `typecheck`
|
|
483
|
+
|
|
484
|
+
Fix: Remove the argument or use a parameter declared by the instrument function.
|
|
485
|
+
|
|
486
|
+
```hsx expect=HSX1012
|
|
487
|
+
program catalog_probe "Catalog probe"
|
|
488
|
+
export instrument template() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
|
|
489
|
+
instrument probe = template(typo: true)
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## HSX1013: Duplicate named argument
|
|
493
|
+
|
|
494
|
+
Stage: `typecheck`
|
|
495
|
+
|
|
496
|
+
Fix: Pass each named argument once.
|
|
497
|
+
|
|
498
|
+
```hsx expect=HSX1013
|
|
499
|
+
program catalog_probe "Catalog probe"
|
|
500
|
+
export instrument template(value: text) { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
|
|
501
|
+
instrument probe = template(value: "one", value: "two")
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
## HSX1014: JSON supplied as HSX
|
|
505
|
+
|
|
506
|
+
Stage: `parse`
|
|
507
|
+
|
|
508
|
+
Fix: Replace the JSON object with HSX declarations.
|
|
509
|
+
|
|
510
|
+
```hsx expect=HSX1014
|
|
511
|
+
{ "hsx": 1 }
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
## HSX1015: Invalid composed program identity
|
|
515
|
+
|
|
516
|
+
Stage: `typecheck`
|
|
517
|
+
|
|
518
|
+
Fix: Give the composed program a bounded product id and title.
|
|
519
|
+
|
|
520
|
+
No source-only witness exists. This refusal requires a compiler-host published catalog.
|
|
521
|
+
|
|
522
|
+
## HSX1016: Empty published composition
|
|
523
|
+
|
|
524
|
+
Stage: `typecheck`
|
|
525
|
+
|
|
526
|
+
Fix: Select at least one published instrument with use.
|
|
527
|
+
|
|
528
|
+
No source-only witness exists. This refusal requires a compiler-host published catalog.
|
|
529
|
+
|
|
530
|
+
## HSX1017: Duplicate published instrument
|
|
531
|
+
|
|
532
|
+
Stage: `typecheck`
|
|
533
|
+
|
|
534
|
+
Fix: Keep one use declaration for each published instrument.
|
|
535
|
+
|
|
536
|
+
No source-only witness exists. This refusal requires a compiler-host published catalog.
|
|
537
|
+
|
|
538
|
+
## HSX1018: Unavailable published instrument
|
|
539
|
+
|
|
540
|
+
Stage: `typecheck`
|
|
541
|
+
|
|
542
|
+
Fix: Use an instrument id from the supplied published catalog.
|
|
543
|
+
|
|
544
|
+
```hsx expect=HSX1018
|
|
545
|
+
program catalog_probe "Catalog probe"
|
|
546
|
+
use missing
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
## HSX1020: Invalid public action name
|
|
550
|
+
|
|
551
|
+
Stage: `typecheck`
|
|
552
|
+
|
|
553
|
+
Fix: Expose each action once under a distinct lower camelCase name.
|
|
554
|
+
|
|
555
|
+
No source-only witness exists. This refusal requires a compiler-host published catalog.
|
|
556
|
+
|
|
557
|
+
## HSX1021: Invalid exposed action
|
|
558
|
+
|
|
559
|
+
Stage: `typecheck`
|
|
560
|
+
|
|
561
|
+
Fix: Expose an action on an explicitly used published instrument.
|
|
562
|
+
|
|
563
|
+
No source-only witness exists. This refusal requires a compiler-host published catalog.
|
|
564
|
+
|
|
565
|
+
## HSX1022: Authored instrument in a composition
|
|
566
|
+
|
|
567
|
+
Stage: `typecheck`
|
|
568
|
+
|
|
569
|
+
Fix: Publish the instrument separately, then select it with use.
|
|
570
|
+
|
|
571
|
+
No source-only witness exists. This refusal requires a compiler-host published catalog.
|
|
572
|
+
|
|
573
|
+
## HSX1023: Invalid required-field list
|
|
574
|
+
|
|
575
|
+
Stage: `typecheck`
|
|
576
|
+
|
|
577
|
+
Fix: List declared, non-optional field names once each.
|
|
578
|
+
|
|
579
|
+
```hsx expect=HSX1023
|
|
580
|
+
program catalog_probe "Catalog probe"
|
|
581
|
+
instrument probe {
|
|
582
|
+
fields {}
|
|
583
|
+
lifecycle { states created; initial created; }
|
|
584
|
+
action create { steps: []; }
|
|
585
|
+
required: missing;
|
|
586
|
+
}
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
## HSX1101: Currency mismatch
|
|
590
|
+
|
|
591
|
+
Stage: `typecheck`
|
|
592
|
+
|
|
593
|
+
Fix: Use the declared currency because money values never coerce.
|
|
594
|
+
|
|
595
|
+
```hsx expect=HSX1101
|
|
596
|
+
program catalog_probe "Catalog probe"
|
|
597
|
+
instrument probe {
|
|
598
|
+
fields {}
|
|
599
|
+
lifecycle { states created; initial created; }
|
|
600
|
+
action create { steps: []; }
|
|
601
|
+
|
|
602
|
+
}
|
|
603
|
+
const fee: money<SAR> = USD 1.00
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
## HSX1102: Money precision exceeds minor units
|
|
607
|
+
|
|
608
|
+
Stage: `typecheck`
|
|
609
|
+
|
|
610
|
+
Fix: Round the literal to the currency's minor-unit precision.
|
|
611
|
+
|
|
612
|
+
```hsx expect=HSX1102
|
|
613
|
+
program catalog_probe "Catalog probe"
|
|
614
|
+
instrument probe {
|
|
615
|
+
fields {}
|
|
616
|
+
lifecycle { states created; initial created; }
|
|
617
|
+
action create { steps: []; }
|
|
618
|
+
|
|
619
|
+
}
|
|
620
|
+
const fee: money<SAR> = SAR 1.001
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
## HSX1103: Invalid numeric value
|
|
624
|
+
|
|
625
|
+
Stage: `typecheck`
|
|
626
|
+
|
|
627
|
+
Fix: Use an integer, percent, bps, or valid fixed-money binding.
|
|
628
|
+
|
|
629
|
+
```hsx expect=HSX1103
|
|
630
|
+
program catalog_probe "Catalog probe"
|
|
631
|
+
instrument probe {
|
|
632
|
+
fields {}
|
|
633
|
+
lifecycle { states created; initial created; }
|
|
634
|
+
action create { steps: []; }
|
|
635
|
+
summary: 1.5;
|
|
636
|
+
}
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
## HSX1104: Value has the wrong type
|
|
640
|
+
|
|
641
|
+
Stage: `typecheck`
|
|
642
|
+
|
|
643
|
+
Fix: Pass the type declared by the parameter or UDL slot.
|
|
644
|
+
|
|
645
|
+
```hsx expect=HSX1104
|
|
646
|
+
program catalog_probe "Catalog probe"
|
|
647
|
+
instrument probe {
|
|
648
|
+
fields {}
|
|
649
|
+
lifecycle { states created; initial created; }
|
|
650
|
+
action create { steps: []; }
|
|
651
|
+
summary: money(SAR, 2500);
|
|
652
|
+
}
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
## HSX1110: Unsupported parameter combination
|
|
656
|
+
|
|
657
|
+
Stage: `typecheck`
|
|
658
|
+
|
|
659
|
+
Fix: Choose a supported compile-time parameter combination.
|
|
660
|
+
|
|
661
|
+
```hsx expect=HSX1110
|
|
662
|
+
program catalog_probe "Catalog probe"
|
|
663
|
+
export instrument template() {
|
|
664
|
+
unsupported { message: "Not supported"; fix: "Choose another form"; }
|
|
665
|
+
fields {}
|
|
666
|
+
lifecycle { states created; initial created; }
|
|
667
|
+
action create { steps: []; }
|
|
668
|
+
}
|
|
669
|
+
instrument probe = template()
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
## HSX1201: Linear money consumed more than once
|
|
673
|
+
|
|
674
|
+
Stage: `typecheck`
|
|
675
|
+
|
|
676
|
+
Fix: Leave exactly one sink for each produced money value.
|
|
677
|
+
|
|
678
|
+
```hsx expect=HSX1201
|
|
679
|
+
program catalog_probe "Catalog probe"
|
|
680
|
+
instrument probe {
|
|
681
|
+
fields {}
|
|
682
|
+
lifecycle { states created; initial created; }
|
|
683
|
+
action create { steps: []; }
|
|
684
|
+
fields { amount: money<SAR>; }
|
|
685
|
+
action pay { computes remainder rest { amount_ref: total; on_zero: refuse; total_path: fields.amount; }; moves: [{ amount: rest; }, { amount: rest; }]; }
|
|
686
|
+
}
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
## HSX1202: Linear money is unconsumed
|
|
690
|
+
|
|
691
|
+
Stage: `typecheck`
|
|
692
|
+
|
|
693
|
+
Fix: Route each produced money value to one explicit sink.
|
|
694
|
+
|
|
695
|
+
```hsx expect=HSX1202
|
|
696
|
+
program catalog_probe "Catalog probe"
|
|
697
|
+
instrument probe {
|
|
698
|
+
fields {}
|
|
699
|
+
lifecycle { states created; initial created; }
|
|
700
|
+
action create { steps: []; }
|
|
701
|
+
fields { amount: money<SAR>; }
|
|
702
|
+
action pay { computes remainder rest { amount_ref: total; on_zero: refuse; total_path: fields.amount; }; }
|
|
703
|
+
}
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
## HSX1301: Missing cost-table price
|
|
707
|
+
|
|
708
|
+
Stage: `typecheck`
|
|
709
|
+
|
|
710
|
+
Fix: Supply a versioned cost table with a row for every emitted effect.
|
|
711
|
+
|
|
712
|
+
```hsx expect=HSX1301
|
|
713
|
+
program catalog_probe "Catalog probe"
|
|
714
|
+
instrument probe {
|
|
715
|
+
fields {}
|
|
716
|
+
lifecycle { states created; initial created; }
|
|
717
|
+
action create { steps: []; }
|
|
718
|
+
|
|
719
|
+
}
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
## HSX1302: Invalid cost-table row
|
|
723
|
+
|
|
724
|
+
Stage: `typecheck`
|
|
725
|
+
|
|
726
|
+
Fix: Use non-negative integer prices and a supported settlement timing.
|
|
727
|
+
|
|
728
|
+
No source-only witness exists. This refusal requires a malformed compiler-host cost table.
|
|
729
|
+
|
|
730
|
+
## HSX1303: Invalid cost-table currency
|
|
731
|
+
|
|
732
|
+
Stage: `typecheck`
|
|
733
|
+
|
|
734
|
+
Fix: Use the supported uppercase cost-table currency.
|
|
735
|
+
|
|
736
|
+
No source-only witness exists. This refusal requires an invalid compiler-host cost-table currency.
|
|
737
|
+
|
|
738
|
+
## HSX1401: Unbounded action
|
|
739
|
+
|
|
740
|
+
Stage: `typecheck`
|
|
741
|
+
|
|
742
|
+
Fix: Replace runtime iteration with a bounded compile-time comprehension.
|
|
743
|
+
|
|
744
|
+
```hsx expect=HSX1401
|
|
745
|
+
program catalog_probe "Catalog probe"
|
|
746
|
+
instrument probe {
|
|
747
|
+
fields {}
|
|
748
|
+
lifecycle { states created; initial created; }
|
|
749
|
+
action create { steps: []; }
|
|
750
|
+
action run { while { condition: true; }; }
|
|
751
|
+
}
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
## HSX1402: Missing lifecycle
|
|
755
|
+
|
|
756
|
+
Stage: `typecheck`
|
|
757
|
+
|
|
758
|
+
Fix: Declare lifecycle states and an initial state.
|
|
759
|
+
|
|
760
|
+
```hsx expect=HSX1402
|
|
761
|
+
program catalog_probe "Catalog probe"
|
|
762
|
+
instrument probe { fields {}; action create { steps: []; }; }
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
## HSX1403: Runtime comprehension bound
|
|
766
|
+
|
|
767
|
+
Stage: `typecheck`
|
|
768
|
+
|
|
769
|
+
Fix: Use an integer literal or literal finite list as the bound.
|
|
770
|
+
|
|
771
|
+
```hsx expect=HSX1403
|
|
772
|
+
program catalog_probe "Catalog probe"
|
|
773
|
+
export instrument template(count: integer) {
|
|
774
|
+
fields {}
|
|
775
|
+
lifecycle { states created; initial created; }
|
|
776
|
+
action create { steps: []; }
|
|
777
|
+
for item in count { action run_[item] { steps: []; } }
|
|
778
|
+
}
|
|
779
|
+
instrument probe = template(count: runtimeCount: integer)
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
## HSX1404: Comprehension expansion limit
|
|
783
|
+
|
|
784
|
+
Stage: `typecheck`
|
|
785
|
+
|
|
786
|
+
Fix: Reduce the fixed expansion to the compiler limit.
|
|
787
|
+
|
|
788
|
+
```hsx expect=HSX1404
|
|
789
|
+
program catalog_probe "Catalog probe"
|
|
790
|
+
instrument probe {
|
|
791
|
+
fields {}
|
|
792
|
+
lifecycle { states created; initial created; }
|
|
793
|
+
action create { steps: []; }
|
|
794
|
+
for item in 257 { action run_[item] { steps: []; } }
|
|
795
|
+
}
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
## HSX1405: Invalid compile-time selection
|
|
799
|
+
|
|
800
|
+
Stage: `typecheck`
|
|
801
|
+
|
|
802
|
+
Fix: Give compile-time conditions and unsupported branches fixed blocks.
|
|
803
|
+
|
|
804
|
+
```hsx expect=HSX1405
|
|
805
|
+
program catalog_probe "Catalog probe"
|
|
806
|
+
export instrument template() { unsupported: true; fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
|
|
807
|
+
instrument probe = template()
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
## HSX1406: Invalid companion instrument
|
|
811
|
+
|
|
812
|
+
Stage: `typecheck`
|
|
813
|
+
|
|
814
|
+
Fix: Construct each companion with a compile-time id.
|
|
815
|
+
|
|
816
|
+
```hsx expect=HSX1406
|
|
817
|
+
program catalog_probe "Catalog probe"
|
|
818
|
+
export instrument template() {
|
|
819
|
+
fields {}
|
|
820
|
+
lifecycle { states created; initial created; }
|
|
821
|
+
action create { steps: []; }
|
|
822
|
+
instruments { invalid: true; }
|
|
823
|
+
}
|
|
824
|
+
instrument probe = template()
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
## HSX1501: Unknown UDL clause
|
|
828
|
+
|
|
829
|
+
Stage: `typecheck`
|
|
830
|
+
|
|
831
|
+
Fix: Use a clause exported by the targeted UDL vocabulary.
|
|
832
|
+
|
|
833
|
+
```hsx expect=HSX1501
|
|
834
|
+
program catalog_probe "Catalog probe"
|
|
835
|
+
instrument probe {
|
|
836
|
+
fields {}
|
|
837
|
+
lifecycle { states created; initial created; }
|
|
838
|
+
action create { steps: []; }
|
|
839
|
+
unknown_clause: true;
|
|
840
|
+
}
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
## HSX1502: Program emits no instruments
|
|
844
|
+
|
|
845
|
+
Stage: `typecheck`
|
|
846
|
+
|
|
847
|
+
Fix: Declare or instantiate at least one instrument.
|
|
848
|
+
|
|
849
|
+
```hsx expect=HSX1502
|
|
850
|
+
program catalog_probe "Catalog probe"
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
## HSX1503: Missing fields block
|
|
854
|
+
|
|
855
|
+
Stage: `typecheck`
|
|
856
|
+
|
|
857
|
+
Fix: Add a fields block, even when it is empty.
|
|
858
|
+
|
|
859
|
+
```hsx expect=HSX1503
|
|
860
|
+
program catalog_probe "Catalog probe"
|
|
861
|
+
instrument probe { lifecycle { states created; initial created; }; action create { steps: []; }; }
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
## HSX1504: Missing create action
|
|
865
|
+
|
|
866
|
+
Stage: `typecheck`
|
|
867
|
+
|
|
868
|
+
Fix: Add an action create block.
|
|
869
|
+
|
|
870
|
+
```hsx expect=HSX1504
|
|
871
|
+
program catalog_probe "Catalog probe"
|
|
872
|
+
instrument probe { fields {}; lifecycle { states created; initial created; }; }
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
## HSX1505: Repeated single-valued clause
|
|
876
|
+
|
|
877
|
+
Stage: `typecheck`
|
|
878
|
+
|
|
879
|
+
Fix: Keep one occurrence of the clause.
|
|
880
|
+
|
|
881
|
+
```hsx expect=HSX1505
|
|
882
|
+
program catalog_probe "Catalog probe"
|
|
883
|
+
instrument probe {
|
|
884
|
+
fields {}
|
|
885
|
+
lifecycle { states created; initial created; }
|
|
886
|
+
action create { steps: []; }
|
|
887
|
+
title: "First"; title: "Second";
|
|
888
|
+
}
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
## HSX1506: Conflicting public action settings
|
|
892
|
+
|
|
893
|
+
Stage: `typecheck`
|
|
894
|
+
|
|
895
|
+
Fix: Keep either public: none or a public action name.
|
|
896
|
+
|
|
897
|
+
```hsx expect=HSX1506
|
|
898
|
+
program catalog_probe "Catalog probe"
|
|
899
|
+
instrument probe {
|
|
900
|
+
fields {}
|
|
901
|
+
lifecycle { states created; initial created; }
|
|
902
|
+
action create { steps: []; }
|
|
903
|
+
action finish { public: none; public_action: finishProbe; steps: []; }
|
|
904
|
+
}
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
## HSX1507: Invalid application metadata
|
|
908
|
+
|
|
909
|
+
Stage: `typecheck`
|
|
910
|
+
|
|
911
|
+
Fix: Keep contract mechanics in the parameterized instrument.
|
|
912
|
+
|
|
913
|
+
```hsx expect=HSX1507
|
|
914
|
+
program catalog_probe "Catalog probe"
|
|
915
|
+
export instrument template() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
|
|
916
|
+
instrument probe = template() { fields: {}; }
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
## HSX1601: Invalid UDL shape
|
|
920
|
+
|
|
921
|
+
Stage: `lower`
|
|
922
|
+
|
|
923
|
+
Fix: Correct the named clause so it matches the targeted UDL definition.
|
|
924
|
+
|
|
925
|
+
No source-only witness exists. Typed source cannot bypass the checker to emit an invalid UDL shape.
|
|
926
|
+
|
|
927
|
+
## HSX1602: Invalid UDL semantics
|
|
928
|
+
|
|
929
|
+
Stage: `lower`
|
|
930
|
+
|
|
931
|
+
Fix: Correct the named clause so it satisfies the targeted UDL law.
|
|
932
|
+
|
|
933
|
+
No source-only witness exists. Typed source cannot bypass the checker to emit invalid UDL semantics.
|
|
934
|
+
|
|
935
|
+
## HSX1603: Unresolved compiler marker
|
|
936
|
+
|
|
937
|
+
Stage: `lower`
|
|
938
|
+
|
|
939
|
+
Fix: Correct compile-time block keys or parameter bindings.
|
|
940
|
+
|
|
941
|
+
```hsx expect=HSX1603
|
|
942
|
+
program catalog_probe "Catalog probe"
|
|
943
|
+
instrument probe {
|
|
944
|
+
fields {}
|
|
945
|
+
lifecycle { states created; initial created; }
|
|
946
|
+
action create { steps: []; }
|
|
947
|
+
title: "__hsx_none__";
|
|
948
|
+
}
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
# Grammar vocabulary
|
|
952
|
+
|
|
953
|
+
The parser is hand-written. This page records the exported lexer vocabulary, the UDL clause vocabulary it binds, and the current standard-library module names.
|
|
954
|
+
|
|
955
|
+
## Keywords
|
|
956
|
+
|
|
957
|
+
`action`, `as`, `asset`, `commit`, `const`, `expect`, `expose`, `expires`, `export`, `from`, `import`, `instrument`, `module`, `party`, `port`, `program`, `quote`, `rate`, `reconcile`, `settlement`, `subject`, `type`, `use`
|
|
958
|
+
|
|
959
|
+
## Punctuation
|
|
960
|
+
|
|
961
|
+
`{`, `}`, `(`, `)`, `[`, `]`, `:`, `,`, `;`, `=`, `|`, `.`, `<`, `>`, `?` and `->`
|
|
962
|
+
|
|
963
|
+
## Typed clause spellings
|
|
964
|
+
|
|
965
|
+
`agent description`, `capture input`, `commit`, `quote`, `decided amount`, `deadline`, `decision`, `computes distribute`, `description`, `due`, `earnable`, `event name`, `examples`, `input`, `moves`, `payout`, `port`, `principal`, `public action`, `reconcile`, `computes remainder`, `requires aggregate`, `requires checks`, `requires drained`, `requires exposure`, `requires refs`, `sandbox failure point`, `sets at`, `computes signed_sum`, `steps`, `summary`, `updates`, `notify`, `agent description`, `aggregate invariants`, `caller parked states`, `description`, `dials`, `distinct parties`, `computes derived`, `computes fees`, `id prefix`, `nav`, `partitions`, `subject`, `summary`, `surface visibility`, `template id`, `title`, `update`
|
|
966
|
+
|
|
967
|
+
## Standard-library modules
|
|
968
|
+
|
|
969
|
+
- `advance`
|
|
970
|
+
- `cancellable_booking`
|
|
971
|
+
- `captured_payment`
|
|
972
|
+
- `conditional_disbursement`
|
|
973
|
+
- `credit_facility`
|
|
974
|
+
- `held_payment`
|
|
975
|
+
- `instant_transfer`
|
|
976
|
+
- `metered`
|
|
977
|
+
- `pooled_split`
|
|
978
|
+
- `premium_forward`
|
|
979
|
+
- `reconciled_payout`
|
|
980
|
+
- `recurring_collection`
|
|
981
|
+
- `rotating_pool`
|
|
982
|
+
- `scheduled`
|
|
983
|
+
- `security_deposit`
|
|
984
|
+
- `settlement_batch`
|
|
985
|
+
- `swap`
|
|
986
|
+
- `threshold_pool`
|
|
987
|
+
- `weighted_distribution`
|
|
988
|
+
|
|
989
|
+
# advance
|
|
990
|
+
|
|
991
|
+
Source: [`std/settlements/advance.hsx`](../../../std/settlements/advance.hsx)
|
|
992
|
+
|
|
993
|
+
## Export
|
|
994
|
+
|
|
995
|
+
`advance<C>`
|
|
996
|
+
|
|
997
|
+
## Parameters
|
|
998
|
+
|
|
999
|
+
- `funder: party`
|
|
1000
|
+
- `to: party`
|
|
1001
|
+
- `amount: money<C>`
|
|
1002
|
+
- `fee: optional<percent>`
|
|
1003
|
+
- `count: optional<integer>`
|
|
1004
|
+
- `every: optional<text>`
|
|
1005
|
+
- `first_due: optional<date>`
|
|
1006
|
+
- `against: optional<ref>`
|
|
1007
|
+
|
|
1008
|
+
## Decision ports
|
|
1009
|
+
|
|
1010
|
+
None.
|
|
1011
|
+
|
|
1012
|
+
## Actions and clauses
|
|
1013
|
+
|
|
1014
|
+
| Action | Clauses lowered |
|
|
1015
|
+
| --------------------- | ------------------------------------------------ |
|
|
1016
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1017
|
+
| `disburse` | `agent description`, `moves`, `steps`, `summary` |
|
|
1018
|
+
| `settle` | `agent description`, `moves`, `steps`, `summary` |
|
|
1019
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1020
|
+
| `disburse` | `agent description`, `moves`, `steps`, `summary` |
|
|
1021
|
+
| `collect_repayment_1` | `due`, `moves`, `steps`, `summary` |
|
|
1022
|
+
|
|
1023
|
+
# cancellable_booking
|
|
1024
|
+
|
|
1025
|
+
Source: [`std/settlements/cancellable_booking.hsx`](../../../std/settlements/cancellable_booking.hsx)
|
|
1026
|
+
|
|
1027
|
+
## Export
|
|
1028
|
+
|
|
1029
|
+
`cancellable_booking<C>`
|
|
1030
|
+
|
|
1031
|
+
## Parameters
|
|
1032
|
+
|
|
1033
|
+
- `guest: party`
|
|
1034
|
+
- `host: party`
|
|
1035
|
+
- `amount: money<C>`
|
|
1036
|
+
- `starts_at: date`
|
|
1037
|
+
- `late_penalty_bps: integer`
|
|
1038
|
+
- `late_within: text`
|
|
1039
|
+
- `early_penalty_bps: integer`
|
|
1040
|
+
- `offer_life: text`
|
|
1041
|
+
|
|
1042
|
+
## Decision ports
|
|
1043
|
+
|
|
1044
|
+
None.
|
|
1045
|
+
|
|
1046
|
+
## Actions and clauses
|
|
1047
|
+
|
|
1048
|
+
| Action | Clauses lowered |
|
|
1049
|
+
| ---------- | ---------------------------------------------------------- |
|
|
1050
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1051
|
+
| `take` | `agent description`, `moves`, `steps`, `summary` |
|
|
1052
|
+
| `complete` | `due`, `moves`, `steps`, `summary` |
|
|
1053
|
+
| `cancel` | `agent description`, `moves`, `quote`, `steps`, `summary` |
|
|
1054
|
+
| `confirm` | `agent description`, `commit`, `moves`, `steps`, `summary` |
|
|
1055
|
+
| `retain` | `agent description`, `moves`, `steps`, `summary` |
|
|
1056
|
+
|
|
1057
|
+
# captured_payment
|
|
1058
|
+
|
|
1059
|
+
Source: [`std/settlements/captured_payment.hsx`](../../../std/settlements/captured_payment.hsx)
|
|
1060
|
+
|
|
1061
|
+
## Export
|
|
1062
|
+
|
|
1063
|
+
`captured_payment<C>`
|
|
1064
|
+
|
|
1065
|
+
## Parameters
|
|
1066
|
+
|
|
1067
|
+
- `payer: party`
|
|
1068
|
+
- `payee: party`
|
|
1069
|
+
- `amount: money<C>`
|
|
1070
|
+
- `reserve_until: date`
|
|
1071
|
+
- `correction: condition`
|
|
1072
|
+
- `external_reversal: condition`
|
|
1073
|
+
- `capture_mode: text`
|
|
1074
|
+
- `correction_mode: text`
|
|
1075
|
+
- `negative_position: text`
|
|
1076
|
+
- `timeout: text`
|
|
1077
|
+
- `derived_amount: optional<block>`
|
|
1078
|
+
|
|
1079
|
+
## Decision ports
|
|
1080
|
+
|
|
1081
|
+
- `correction`
|
|
1082
|
+
- `external_reversal`
|
|
1083
|
+
|
|
1084
|
+
## Actions and clauses
|
|
1085
|
+
|
|
1086
|
+
| Action | Clauses lowered |
|
|
1087
|
+
| ------------------ | -------------------------------------------------------------------------------------------- |
|
|
1088
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1089
|
+
| `authorize` | `agent description`, `moves`, `steps`, `summary` |
|
|
1090
|
+
| `capture` | `agent description`, `deadline`, `description`, `input`, `moves`, `steps`, `summary` |
|
|
1091
|
+
| `capture_more` | `agent description`, `deadline`, `description`, `input`, `moves`, `steps`, `summary` |
|
|
1092
|
+
| `settle` | `agent description`, `deadline`, `moves`, `steps`, `summary` |
|
|
1093
|
+
| `void` | `agent description`, `moves`, `steps`, `summary` |
|
|
1094
|
+
| `expire` | `due`, `moves`, `steps`, `summary` |
|
|
1095
|
+
| `settle_on_expiry` | `due`, `moves`, `steps`, `summary` |
|
|
1096
|
+
| `correction_name` | `agent description`, `moves`, `port`, `steps`, `summary` |
|
|
1097
|
+
| `reversal_name` | `agent description`, `deadline`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1098
|
+
|
|
1099
|
+
# conditional_disbursement
|
|
1100
|
+
|
|
1101
|
+
Source: [`std/settlements/conditional_disbursement.hsx`](../../../std/settlements/conditional_disbursement.hsx)
|
|
1102
|
+
|
|
1103
|
+
## Export
|
|
1104
|
+
|
|
1105
|
+
`conditional_disbursement<C>`
|
|
1106
|
+
|
|
1107
|
+
## Parameters
|
|
1108
|
+
|
|
1109
|
+
- `source: party`
|
|
1110
|
+
- `destination: party`
|
|
1111
|
+
- `cap: money<C>`
|
|
1112
|
+
- `amount: money<C>`
|
|
1113
|
+
- `decision: condition`
|
|
1114
|
+
- `reopen_policy: text`
|
|
1115
|
+
- `recovery_policy: text`
|
|
1116
|
+
|
|
1117
|
+
## Decision ports
|
|
1118
|
+
|
|
1119
|
+
- `decision`
|
|
1120
|
+
|
|
1121
|
+
## Actions and clauses
|
|
1122
|
+
|
|
1123
|
+
| Action | Clauses lowered |
|
|
1124
|
+
| --------- | ------------------------------------------------------------------------------------------------- |
|
|
1125
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1126
|
+
| `deny` | `agent description`, `capture input`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1127
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1128
|
+
| `approve` | `agent description`, `capture input`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1129
|
+
| `pay` | `agent description`, `moves`, `steps`, `summary` |
|
|
1130
|
+
|
|
1131
|
+
# credit_facility
|
|
1132
|
+
|
|
1133
|
+
Source: [`std/settlements/credit_facility.hsx`](../../../std/settlements/credit_facility.hsx)
|
|
1134
|
+
|
|
1135
|
+
## Export
|
|
1136
|
+
|
|
1137
|
+
`credit_facility<C>`
|
|
1138
|
+
|
|
1139
|
+
## Parameters
|
|
1140
|
+
|
|
1141
|
+
- `lender: party`
|
|
1142
|
+
- `borrower: party`
|
|
1143
|
+
- `draw_destination: party`
|
|
1144
|
+
- `limit: money<C>`
|
|
1145
|
+
- `expires_at: date`
|
|
1146
|
+
- `obligation: ref`
|
|
1147
|
+
- `availability_policy: text`
|
|
1148
|
+
- `expiry_policy: text`
|
|
1149
|
+
- `close_policy: text`
|
|
1150
|
+
|
|
1151
|
+
## Decision ports
|
|
1152
|
+
|
|
1153
|
+
None.
|
|
1154
|
+
|
|
1155
|
+
## Actions and clauses
|
|
1156
|
+
|
|
1157
|
+
| Action | Clauses lowered |
|
|
1158
|
+
| --------- | ------------------------------------------------ |
|
|
1159
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1160
|
+
| `freeze` | `due`, `moves`, `steps`, `summary` |
|
|
1161
|
+
| `close` | `agent description`, `moves`, `steps`, `summary` |
|
|
1162
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1163
|
+
| `resolve` | `agent description`, `moves`, `steps`, `summary` |
|
|
1164
|
+
|
|
1165
|
+
# held_payment
|
|
1166
|
+
|
|
1167
|
+
Source: [`std/settlements/held_payment.hsx`](../../../std/settlements/held_payment.hsx)
|
|
1168
|
+
|
|
1169
|
+
## Export
|
|
1170
|
+
|
|
1171
|
+
`held_payment<C>`
|
|
1172
|
+
|
|
1173
|
+
## Parameters
|
|
1174
|
+
|
|
1175
|
+
- `payer: party`
|
|
1176
|
+
- `payee: party`
|
|
1177
|
+
- `amount: money<C>`
|
|
1178
|
+
- `release: condition`
|
|
1179
|
+
- `fees: optional<block>`
|
|
1180
|
+
- `on_cancel: optional<block>`
|
|
1181
|
+
- `derived_amount: optional<block>`
|
|
1182
|
+
- `release_to: optional<party>`
|
|
1183
|
+
- `whole_amount: optional<block>`
|
|
1184
|
+
- `release_action: optional<text>`
|
|
1185
|
+
- `whole_fee: optional<money<C>>`
|
|
1186
|
+
- `reference: optional<text>`
|
|
1187
|
+
- `upstream: optional<ref>`
|
|
1188
|
+
- `id_prefix_override: optional<text>`
|
|
1189
|
+
|
|
1190
|
+
## Decision ports
|
|
1191
|
+
|
|
1192
|
+
- `release`
|
|
1193
|
+
|
|
1194
|
+
## Actions and clauses
|
|
1195
|
+
|
|
1196
|
+
| Action | Clauses lowered |
|
|
1197
|
+
| --------------------- | --------------------------------------------------------------------------------------------- |
|
|
1198
|
+
| `fund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1199
|
+
| `fund_piece_3` | `agent description`, `moves`, `steps`, `summary` |
|
|
1200
|
+
| `collect_service_fee` | `agent description`, `moves`, `steps`, `summary` |
|
|
1201
|
+
| `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1202
|
+
| `release_piece_3` | `agent description`, `moves`, `steps`, `summary` |
|
|
1203
|
+
| `refund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1204
|
+
| `refund_piece_3` | `agent description`, `moves`, `steps`, `summary` |
|
|
1205
|
+
| `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
|
|
1206
|
+
| `unfund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1207
|
+
| `unfund_piece_3` | `agent description`, `moves`, `steps`, `summary` |
|
|
1208
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1209
|
+
| `fund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
|
|
1210
|
+
| `release_name` | `agent description`, `deadline`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1211
|
+
| `release_on_deadline` | `due`, `moves`, `steps`, `summary` |
|
|
1212
|
+
| `cancel` | `agent description`, `deadline`, `moves`, `steps`, `summary` |
|
|
1213
|
+
| `fund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1214
|
+
| `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1215
|
+
| `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
|
|
1216
|
+
| `fund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1217
|
+
| `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1218
|
+
| `refund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1219
|
+
| `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
|
|
1220
|
+
| `abandon` | `agent description`, `moves`, `steps`, `summary` |
|
|
1221
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1222
|
+
| `fund` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
|
|
1223
|
+
| `release_action` | `agent description`, `deadline`, `moves`, `port`, `sandbox failure point`, `steps`, `summary` |
|
|
1224
|
+
| `release_on_deadline` | `due`, `event name`, `moves`, `steps`, `summary` |
|
|
1225
|
+
| `cancel` | `agent description`, `deadline`, `event name`, `moves`, `steps`, `summary` |
|
|
1226
|
+
| `abandon` | `agent description`, `moves`, `steps`, `summary` |
|
|
1227
|
+
|
|
1228
|
+
# instant_transfer
|
|
1229
|
+
|
|
1230
|
+
Source: [`std/settlements/instant_transfer.hsx`](../../../std/settlements/instant_transfer.hsx)
|
|
1231
|
+
|
|
1232
|
+
## Export
|
|
1233
|
+
|
|
1234
|
+
`instant_transfer<C>`
|
|
1235
|
+
|
|
1236
|
+
## Parameters
|
|
1237
|
+
|
|
1238
|
+
- `payer: party`
|
|
1239
|
+
- `payee: party`
|
|
1240
|
+
- `amount: money<C>`
|
|
1241
|
+
- `fees: optional<block>`
|
|
1242
|
+
- `derived_amount: optional<block>`
|
|
1243
|
+
|
|
1244
|
+
## Decision ports
|
|
1245
|
+
|
|
1246
|
+
None.
|
|
1247
|
+
|
|
1248
|
+
## Actions and clauses
|
|
1249
|
+
|
|
1250
|
+
| Action | Clauses lowered |
|
|
1251
|
+
| --------------------- | ------------------------------------------------ |
|
|
1252
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1253
|
+
| `pay_piece_1` | `agent description`, `moves`, `steps`, `summary` |
|
|
1254
|
+
| `pay_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1255
|
+
| `collect_service_fee` | `agent description`, `moves`, `steps`, `summary` |
|
|
1256
|
+
|
|
1257
|
+
# metered
|
|
1258
|
+
|
|
1259
|
+
Source: [`std/settlements/metered.hsx`](../../../std/settlements/metered.hsx)
|
|
1260
|
+
|
|
1261
|
+
## Export
|
|
1262
|
+
|
|
1263
|
+
`metered`
|
|
1264
|
+
|
|
1265
|
+
## Parameters
|
|
1266
|
+
|
|
1267
|
+
- `payer: party`
|
|
1268
|
+
- `payee: party`
|
|
1269
|
+
- `close_by: date`
|
|
1270
|
+
- `rates: unknown`
|
|
1271
|
+
|
|
1272
|
+
## Decision ports
|
|
1273
|
+
|
|
1274
|
+
None.
|
|
1275
|
+
|
|
1276
|
+
## Actions and clauses
|
|
1277
|
+
|
|
1278
|
+
| Action | Clauses lowered |
|
|
1279
|
+
| -------------- | --------------------------------------- |
|
|
1280
|
+
| `create` | `agent description`, `steps`, `summary` |
|
|
1281
|
+
| `close_period` | `due`, `steps`, `summary` |
|
|
1282
|
+
|
|
1283
|
+
# pooled_split
|
|
1284
|
+
|
|
1285
|
+
Source: [`std/settlements/pooled_split.hsx`](../../../std/settlements/pooled_split.hsx)
|
|
1286
|
+
|
|
1287
|
+
## Export
|
|
1288
|
+
|
|
1289
|
+
`pooled_split<C>`
|
|
1290
|
+
|
|
1291
|
+
## Parameters
|
|
1292
|
+
|
|
1293
|
+
- `payer: party`
|
|
1294
|
+
- `amount: money<C>`
|
|
1295
|
+
- `payout_due: date`
|
|
1296
|
+
- `split: block`
|
|
1297
|
+
|
|
1298
|
+
## Decision ports
|
|
1299
|
+
|
|
1300
|
+
None.
|
|
1301
|
+
|
|
1302
|
+
## Actions and clauses
|
|
1303
|
+
|
|
1304
|
+
| Action | Clauses lowered |
|
|
1305
|
+
| -------- | ------------------------------------------------ |
|
|
1306
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1307
|
+
|
|
1308
|
+
# premium_forward
|
|
1309
|
+
|
|
1310
|
+
Source: [`std/settlements/premium_forward.hsx`](../../../std/settlements/premium_forward.hsx)
|
|
1311
|
+
|
|
1312
|
+
## Export
|
|
1313
|
+
|
|
1314
|
+
`premium_forward<C>`
|
|
1315
|
+
|
|
1316
|
+
## Parameters
|
|
1317
|
+
|
|
1318
|
+
- `payer: party`
|
|
1319
|
+
- `carrier: party`
|
|
1320
|
+
- `amount: money<C>`
|
|
1321
|
+
- `bind: condition`
|
|
1322
|
+
- `commission: percent`
|
|
1323
|
+
- `policy_ref: optional<text>`
|
|
1324
|
+
- `renewal_due: optional<date>`
|
|
1325
|
+
- `endorsement: optional<condition>`
|
|
1326
|
+
|
|
1327
|
+
## Decision ports
|
|
1328
|
+
|
|
1329
|
+
- `bind`
|
|
1330
|
+
- `endorsement`
|
|
1331
|
+
|
|
1332
|
+
## Actions and clauses
|
|
1333
|
+
|
|
1334
|
+
| Action | Clauses lowered |
|
|
1335
|
+
| ----------------- | ---------------------------------------------------------------------------------------- |
|
|
1336
|
+
| `create` | `agent description`, `steps`, `summary` |
|
|
1337
|
+
| `fund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
|
|
1338
|
+
| `fund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1339
|
+
| `bind` | `agent description`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1340
|
+
| `forward_piece_2` | `agent description`, `moves`, `steps`, `summary` |
|
|
1341
|
+
| `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
|
|
1342
|
+
| `abandon` | `agent description`, `steps`, `summary` |
|
|
1343
|
+
| `endorsement` | `agent description`, `capture input`, `description`, `input`, `port`, `steps`, `summary` |
|
|
1344
|
+
| `lapse` | `due`, `steps`, `summary` |
|
|
1345
|
+
|
|
1346
|
+
# reconciled_payout
|
|
1347
|
+
|
|
1348
|
+
Source: [`std/settlements/reconciled_payout.hsx`](../../../std/settlements/reconciled_payout.hsx)
|
|
1349
|
+
|
|
1350
|
+
## Export
|
|
1351
|
+
|
|
1352
|
+
`reconciled_payout<C>`
|
|
1353
|
+
|
|
1354
|
+
## Parameters
|
|
1355
|
+
|
|
1356
|
+
- `payer: party`
|
|
1357
|
+
- `beneficiary: party`
|
|
1358
|
+
- `amount: money<C>`
|
|
1359
|
+
- `beneficiary_ref: text`
|
|
1360
|
+
- `settle_by: date`
|
|
1361
|
+
- `matched_within: integer`
|
|
1362
|
+
- `matched_ceiling: integer`
|
|
1363
|
+
|
|
1364
|
+
## Decision ports
|
|
1365
|
+
|
|
1366
|
+
None.
|
|
1367
|
+
|
|
1368
|
+
## Actions and clauses
|
|
1369
|
+
|
|
1370
|
+
| Action | Clauses lowered |
|
|
1371
|
+
| ---------- | ---------------------------------------------------------- |
|
|
1372
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1373
|
+
| `instruct` | `agent description`, `moves`, `payout`, `steps`, `summary` |
|
|
1374
|
+
| `settle` | `due`, `moves`, `reconcile`, `steps`, `summary` |
|
|
1375
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1376
|
+
| `carry` | `agent description`, `moves`, `steps`, `summary` |
|
|
1377
|
+
|
|
1378
|
+
# recurring_collection
|
|
1379
|
+
|
|
1380
|
+
Source: [`std/settlements/recurring_collection.hsx`](../../../std/settlements/recurring_collection.hsx)
|
|
1381
|
+
|
|
1382
|
+
## Export
|
|
1383
|
+
|
|
1384
|
+
`recurring_collection`
|
|
1385
|
+
|
|
1386
|
+
## Parameters
|
|
1387
|
+
|
|
1388
|
+
- `marker: optional<text>`
|
|
1389
|
+
|
|
1390
|
+
## Decision ports
|
|
1391
|
+
|
|
1392
|
+
None.
|
|
1393
|
+
|
|
1394
|
+
## Actions and clauses
|
|
1395
|
+
|
|
1396
|
+
| Action | Clauses lowered |
|
|
1397
|
+
| --------- | --------------------------------------- |
|
|
1398
|
+
| `create` | `agent description`, `steps`, `summary` |
|
|
1399
|
+
| `collect` | `agent description`, `steps`, `summary` |
|
|
1400
|
+
| `end` | `agent description`, `steps`, `summary` |
|
|
1401
|
+
|
|
1402
|
+
# rotating_pool
|
|
1403
|
+
|
|
1404
|
+
Source: [`std/settlements/rotating_pool.hsx`](../../../std/settlements/rotating_pool.hsx)
|
|
1405
|
+
|
|
1406
|
+
## Export
|
|
1407
|
+
|
|
1408
|
+
`rotating_pool<C>`
|
|
1409
|
+
|
|
1410
|
+
## Parameters
|
|
1411
|
+
|
|
1412
|
+
- `members: optional<list<party>>`
|
|
1413
|
+
- `contribution: money<C>`
|
|
1414
|
+
- `count: integer`
|
|
1415
|
+
- `every: optional<text>`
|
|
1416
|
+
- `first_due: date`
|
|
1417
|
+
- `payout_order: optional<list<party>>`
|
|
1418
|
+
- `default_policy: optional<text>`
|
|
1419
|
+
- `guarantee_policy: optional<text>`
|
|
1420
|
+
- `guarantor: optional<party>`
|
|
1421
|
+
- `exit_policy: optional<text>`
|
|
1422
|
+
- `memo: optional<text>`
|
|
1423
|
+
- `membership: optional<block>`
|
|
1424
|
+
|
|
1425
|
+
## Decision ports
|
|
1426
|
+
|
|
1427
|
+
None.
|
|
1428
|
+
|
|
1429
|
+
## Actions and clauses
|
|
1430
|
+
|
|
1431
|
+
| Action | Clauses lowered |
|
|
1432
|
+
| ---------- | ------------------------------------------------- |
|
|
1433
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1434
|
+
| `cancel` | `agent description`, `moves`, `steps`, `summary` |
|
|
1435
|
+
| `activate` | `agent description`, `moves`, `steps`, `summary` |
|
|
1436
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1437
|
+
| `close` | `agent description`, `moves`, `steps`, `summary` |
|
|
1438
|
+
| `create` | `agent description`, `examples`, `moves`, `steps` |
|
|
1439
|
+
| `activate` | `due`, `examples`, `moves`, `steps` |
|
|
1440
|
+
| `disband` | `agent description`, `examples`, `moves`, `steps` |
|
|
1441
|
+
| `close` | `agent description`, `examples`, `moves`, `steps` |
|
|
1442
|
+
|
|
1443
|
+
# scheduled
|
|
1444
|
+
|
|
1445
|
+
Source: [`std/settlements/scheduled.hsx`](../../../std/settlements/scheduled.hsx)
|
|
1446
|
+
|
|
1447
|
+
## Export
|
|
1448
|
+
|
|
1449
|
+
`scheduled<C>`
|
|
1450
|
+
|
|
1451
|
+
## Parameters
|
|
1452
|
+
|
|
1453
|
+
- `payer: party`
|
|
1454
|
+
- `payee: party`
|
|
1455
|
+
- `amount: money<C>`
|
|
1456
|
+
- `count: optional<integer>`
|
|
1457
|
+
- `every: text`
|
|
1458
|
+
- `first_due: date`
|
|
1459
|
+
- `mode: optional<text>`
|
|
1460
|
+
- `debtor: optional<party>`
|
|
1461
|
+
- `advance_to: optional<party>`
|
|
1462
|
+
- `until: optional<condition>`
|
|
1463
|
+
- `month_end: optional<text>`
|
|
1464
|
+
- `period_liability: optional<text>`
|
|
1465
|
+
- `termination_drain: optional<text>`
|
|
1466
|
+
- `mandate: optional<condition>`
|
|
1467
|
+
- `derived_amount: optional<unknown>`
|
|
1468
|
+
|
|
1469
|
+
## Decision ports
|
|
1470
|
+
|
|
1471
|
+
- `until`
|
|
1472
|
+
- `mandate`
|
|
1473
|
+
|
|
1474
|
+
## Actions and clauses
|
|
1475
|
+
|
|
1476
|
+
| Action | Clauses lowered |
|
|
1477
|
+
| ------------------- | ------------------------------------------------------------------------------------------------- |
|
|
1478
|
+
| `create` | `agent description`, `steps`, `summary` |
|
|
1479
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1480
|
+
| `approve` | `agent description`, `steps`, `summary` |
|
|
1481
|
+
| `advance` | `agent description`, `moves`, `steps`, `summary` |
|
|
1482
|
+
| `delinquent_action` | `due`, `sets at`, `steps`, `summary` |
|
|
1483
|
+
| `complete` | `due`, `steps`, `summary` |
|
|
1484
|
+
| `write_off` | `agent description`, `steps`, `summary` |
|
|
1485
|
+
| `create` | `agent description`, `steps`, `summary` |
|
|
1486
|
+
| `repay` | `agent description`, `capture input`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1487
|
+
| `refund` | `agent description`, `moves`, `steps`, `summary` |
|
|
1488
|
+
| `create` | `agent description`, `steps`, `summary` |
|
|
1489
|
+
| `open_period` | `due`, `steps`, `summary` |
|
|
1490
|
+
| `collect_period` | `agent description`, `capture input`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1491
|
+
| `until` | `agent description`, `capture input`, `description`, `input`, `port`, `steps`, `summary` |
|
|
1492
|
+
|
|
1493
|
+
# security_deposit
|
|
1494
|
+
|
|
1495
|
+
Source: [`std/settlements/security_deposit.hsx`](../../../std/settlements/security_deposit.hsx)
|
|
1496
|
+
|
|
1497
|
+
## Export
|
|
1498
|
+
|
|
1499
|
+
`security_deposit<C>`
|
|
1500
|
+
|
|
1501
|
+
## Parameters
|
|
1502
|
+
|
|
1503
|
+
- `payer: party`
|
|
1504
|
+
- `holder: party`
|
|
1505
|
+
- `amount: money<C>`
|
|
1506
|
+
- `claim: optional<condition>`
|
|
1507
|
+
- `return: optional<condition>`
|
|
1508
|
+
- `claim_amount: optional<block>`
|
|
1509
|
+
- `deadline: optional<date>`
|
|
1510
|
+
- `claim_to: optional<party>`
|
|
1511
|
+
- `return_to: optional<party>`
|
|
1512
|
+
- `memo: optional<text>`
|
|
1513
|
+
- `claim_input: optional<block>`
|
|
1514
|
+
- `claim_capture: optional<block>`
|
|
1515
|
+
- `fund_failure_point: optional<text>`
|
|
1516
|
+
- `id_prefix_override: optional<text>`
|
|
1517
|
+
|
|
1518
|
+
## Decision ports
|
|
1519
|
+
|
|
1520
|
+
- `claim`
|
|
1521
|
+
- `return`
|
|
1522
|
+
|
|
1523
|
+
## Actions and clauses
|
|
1524
|
+
|
|
1525
|
+
| Action | Clauses lowered |
|
|
1526
|
+
| --------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
1527
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1528
|
+
| `place_deposit` | `agent description`, `moves`, `steps`, `summary` |
|
|
1529
|
+
| `claim_name` | `agent description`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1530
|
+
| `return_name` | `agent description`, `moves`, `steps`, `summary` |
|
|
1531
|
+
| `create` | `agent description`, `deadline`, `moves`, `steps`, `summary` |
|
|
1532
|
+
| `fund` | `agent description`, `deadline`, `moves`, `sandbox failure point`, `steps`, `summary` |
|
|
1533
|
+
| `claim` | `agent description`, `capture input`, `deadline`, `decided amount`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1534
|
+
| `return` | `agent description`, `deadline`, `moves`, `port`, `steps`, `summary` |
|
|
1535
|
+
| `expire` | `due`, `moves`, `steps`, `summary` |
|
|
1536
|
+
| `cancel` | `agent description`, `moves`, `steps`, `summary` |
|
|
1537
|
+
|
|
1538
|
+
# settlement_batch
|
|
1539
|
+
|
|
1540
|
+
Source: [`std/settlements/settlement_batch.hsx`](../../../std/settlements/settlement_batch.hsx)
|
|
1541
|
+
|
|
1542
|
+
## Export
|
|
1543
|
+
|
|
1544
|
+
`settlement_batch<C>`
|
|
1545
|
+
|
|
1546
|
+
## Parameters
|
|
1547
|
+
|
|
1548
|
+
- `settlement_account: party`
|
|
1549
|
+
- `source_capture_refs: text`
|
|
1550
|
+
- `fee_entries: text`
|
|
1551
|
+
- `external_reversal_offsets: text`
|
|
1552
|
+
- `close_trigger: date`
|
|
1553
|
+
- `payout_destination: party`
|
|
1554
|
+
- `negative_position: text`
|
|
1555
|
+
- `payout_acknowledgement: condition`
|
|
1556
|
+
- `payout_beneficiary_ref: text`
|
|
1557
|
+
|
|
1558
|
+
## Decision ports
|
|
1559
|
+
|
|
1560
|
+
- `payout_acknowledgement`
|
|
1561
|
+
|
|
1562
|
+
## Actions and clauses
|
|
1563
|
+
|
|
1564
|
+
| Action | Clauses lowered |
|
|
1565
|
+
| ------------------------ | ------------------------------------------------------------------------------------------------- |
|
|
1566
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1567
|
+
| `close` | `due`, `moves`, `steps`, `summary` |
|
|
1568
|
+
| `calculate` | `agent description`, `computes signed_sum`, `moves`, `steps`, `summary` |
|
|
1569
|
+
| `approve` | `agent description`, `moves`, `steps`, `summary` |
|
|
1570
|
+
| `instruct` | `agent description`, `moves`, `payout`, `steps`, `summary` |
|
|
1571
|
+
| `payout_acknowledgement` | `agent description`, `capture input`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1572
|
+
| `reconcile` | `due`, `moves`, `reconcile`, `steps`, `summary` |
|
|
1573
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1574
|
+
| `accrue` | `agent description`, `moves`, `steps`, `summary` |
|
|
1575
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1576
|
+
| `adjust` | `agent description`, `moves`, `steps`, `summary` |
|
|
1577
|
+
| `correct` | `agent description`, `moves`, `steps`, `summary` |
|
|
1578
|
+
|
|
1579
|
+
# swap
|
|
1580
|
+
|
|
1581
|
+
Source: [`std/settlements/swap.hsx`](../../../std/settlements/swap.hsx)
|
|
1582
|
+
|
|
1583
|
+
## Export
|
|
1584
|
+
|
|
1585
|
+
`swap<C>`
|
|
1586
|
+
|
|
1587
|
+
## Parameters
|
|
1588
|
+
|
|
1589
|
+
- `between: list<party>`
|
|
1590
|
+
- `amounts: block`
|
|
1591
|
+
- `fees: block`
|
|
1592
|
+
- `release: condition`
|
|
1593
|
+
- `dispute: condition`
|
|
1594
|
+
- `side_names: optional<block>`
|
|
1595
|
+
- `lifecycle_state_order: optional<list<text>>`
|
|
1596
|
+
- `action_bindings: optional<block>`
|
|
1597
|
+
- `parked_states: optional<block>`
|
|
1598
|
+
- `fixed_prefix: optional<text>`
|
|
1599
|
+
|
|
1600
|
+
## Decision ports
|
|
1601
|
+
|
|
1602
|
+
- `release`
|
|
1603
|
+
- `dispute`
|
|
1604
|
+
|
|
1605
|
+
## Actions and clauses
|
|
1606
|
+
|
|
1607
|
+
| Action | Clauses lowered |
|
|
1608
|
+
| --------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
1609
|
+
| `abandon` | `agent description`, `moves`, `public action`, `steps`, `summary` |
|
|
1610
|
+
| `cancel` | `agent description`, `moves`, `public action`, `steps`, `summary` |
|
|
1611
|
+
| `create` | `agent description`, `moves`, `public action`, `steps`, `summary` |
|
|
1612
|
+
| `dispute` | `agent description`, `deadline`, `moves`, `port`, `public action`, `steps`, `summary` |
|
|
1613
|
+
| `fund` | `agent description`, `moves`, `public action`, `steps`, `summary` |
|
|
1614
|
+
| `post` | `due`, `moves`, `steps`, `summary` |
|
|
1615
|
+
| `release` | `agent description`, `moves`, `port`, `public action`, `sets at`, `steps`, `summary` |
|
|
1616
|
+
| `create` | `agent description`, `moves`, `public action`, `steps`, `summary` |
|
|
1617
|
+
| `fund` | `agent description`, `event name`, `moves`, `public action`, `sandbox failure point`, `steps`, `summary` |
|
|
1618
|
+
| `release` | `agent description`, `event name`, `moves`, `port`, `public action`, `sandbox failure point`, `sets at`, `steps`, `summary` |
|
|
1619
|
+
| `post` | `due`, `event name`, `moves`, `steps`, `summary` |
|
|
1620
|
+
| `dispute` | `agent description`, `deadline`, `event name`, `moves`, `port`, `public action`, `steps`, `summary` |
|
|
1621
|
+
| `cancel` | `agent description`, `event name`, `moves`, `public action`, `steps`, `summary` |
|
|
1622
|
+
| `abandon` | `agent description`, `event name`, `moves`, `public action`, `steps`, `summary` |
|
|
1623
|
+
|
|
1624
|
+
# threshold_pool
|
|
1625
|
+
|
|
1626
|
+
Source: [`std/settlements/threshold_pool.hsx`](../../../std/settlements/threshold_pool.hsx)
|
|
1627
|
+
|
|
1628
|
+
## Export
|
|
1629
|
+
|
|
1630
|
+
`threshold_pool<C>`
|
|
1631
|
+
|
|
1632
|
+
## Parameters
|
|
1633
|
+
|
|
1634
|
+
- `contributor: optional<party>`
|
|
1635
|
+
- `beneficiary: optional<party>`
|
|
1636
|
+
- `target: money<C>`
|
|
1637
|
+
- `commitment: money<C>`
|
|
1638
|
+
- `max_contributors: optional<integer>`
|
|
1639
|
+
- `close_by: date`
|
|
1640
|
+
- `close_policy: optional<text>`
|
|
1641
|
+
- `overfund_policy: optional<text>`
|
|
1642
|
+
- `cancel_policy: optional<text>`
|
|
1643
|
+
- `fail_policy: optional<text>`
|
|
1644
|
+
- `beneficiary_account: optional<account<C>>`
|
|
1645
|
+
- `memo: optional<text>`
|
|
1646
|
+
- `contribution_instrument: optional<block>`
|
|
1647
|
+
- `wording: optional<block>`
|
|
1648
|
+
|
|
1649
|
+
## Decision ports
|
|
1650
|
+
|
|
1651
|
+
None.
|
|
1652
|
+
|
|
1653
|
+
## Actions and clauses
|
|
1654
|
+
|
|
1655
|
+
| Action | Clauses lowered |
|
|
1656
|
+
| ---------- | ------------------------------------------------- |
|
|
1657
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1658
|
+
| `activate` | `due`, `moves`, `steps`, `summary` |
|
|
1659
|
+
| `fail` | `due`, `moves`, `steps`, `summary` |
|
|
1660
|
+
| `close` | `agent description`, `moves`, `steps`, `summary` |
|
|
1661
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1662
|
+
| `cancel` | `agent description`, `moves`, `steps`, `summary` |
|
|
1663
|
+
| `collect` | `agent description`, `moves`, `steps`, `summary` |
|
|
1664
|
+
| `refund` | `agent description`, `moves`, `steps`, `summary` |
|
|
1665
|
+
| `create` | `agent description`, `examples`, `moves`, `steps` |
|
|
1666
|
+
| `activate` | `due`, `examples`, `moves`, `steps` |
|
|
1667
|
+
| `fail` | `due`, `examples`, `moves`, `steps` |
|
|
1668
|
+
| `close` | `agent description`, `examples`, `moves`, `steps` |
|
|
1669
|
+
|
|
1670
|
+
# weighted_distribution
|
|
1671
|
+
|
|
1672
|
+
Source: [`std/settlements/weighted_distribution.hsx`](../../../std/settlements/weighted_distribution.hsx)
|
|
1673
|
+
|
|
1674
|
+
## Export
|
|
1675
|
+
|
|
1676
|
+
`weighted_distribution<C>`
|
|
1677
|
+
|
|
1678
|
+
## Parameters
|
|
1679
|
+
|
|
1680
|
+
- `source: party`
|
|
1681
|
+
- `recipient: party`
|
|
1682
|
+
- `amount: money<C>`
|
|
1683
|
+
- `record_at: date`
|
|
1684
|
+
- `weight: optional<money<C>>`
|
|
1685
|
+
- `max_recipients: optional<integer>`
|
|
1686
|
+
- `snapshot: optional<condition>`
|
|
1687
|
+
- `rounding_policy: optional<text>`
|
|
1688
|
+
- `withholding_policy: optional<text>`
|
|
1689
|
+
- `correction_policy: optional<text>`
|
|
1690
|
+
- `flat: optional<block>`
|
|
1691
|
+
- `id_prefix_override: optional<text>`
|
|
1692
|
+
|
|
1693
|
+
## Decision ports
|
|
1694
|
+
|
|
1695
|
+
- `snapshot`
|
|
1696
|
+
|
|
1697
|
+
## Actions and clauses
|
|
1698
|
+
|
|
1699
|
+
| Action | Clauses lowered |
|
|
1700
|
+
| ---------- | ------------------------------------------------------------------------------------------------- |
|
|
1701
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1702
|
+
| `snapshot` | `agent description`, `capture input`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
|
|
1703
|
+
| `create` | `agent description`, `moves`, `steps`, `summary` |
|
|
1704
|
+
| `payout` | `agent description`, `computes distribute`, `moves`, `steps`, `summary` |
|
|
1705
|
+
| `create` | `agent description`, `moves`, `requires refs`, `steps`, `summary` |
|
|
1706
|
+
| `payout` | `computes distribute`, `due`, `moves`, `steps`, `summary` |
|
|
1707
|
+
|
|
1708
|
+
# Types
|
|
1709
|
+
|
|
1710
|
+
HSX checks types before it emits UDL. Money and account values carry a currency parameter, and no implicit currency conversion exists.
|
|
1711
|
+
|
|
1712
|
+
| Kind | Meaning |
|
|
1713
|
+
| ----------- | -------------------------------------------------------------------- |
|
|
1714
|
+
| `account` | A currency-indexed ledger account reference. |
|
|
1715
|
+
| `boolean` | A compile-time or stored true or false value. |
|
|
1716
|
+
| `bps` | An integer basis-point value. |
|
|
1717
|
+
| `condition` | A declared decision port. |
|
|
1718
|
+
| `date` | A stored date-time string checked by UDL. |
|
|
1719
|
+
| `integer` | A bounded whole number. |
|
|
1720
|
+
| `money` | A currency-indexed minor-unit amount. |
|
|
1721
|
+
| `party` | A declared program party. |
|
|
1722
|
+
| `percent` | An exact percentage with basis-point precision. |
|
|
1723
|
+
| `ref` | A typed reference to another instrument. |
|
|
1724
|
+
| `text` | A finite string value. |
|
|
1725
|
+
| `unknown` | An internal checker result that source must resolve before lowering. |
|
|
1726
|
+
|
|
1727
|
+
# UDL output
|
|
1728
|
+
|
|
1729
|
+
An accepted compile returns four artifacts.
|
|
1730
|
+
|
|
1731
|
+
| Artifact | Contents |
|
|
1732
|
+
| -------------- | ----------------------------------------------------------------------------------- |
|
|
1733
|
+
| `document` | The canonical UDL object. Serialize it with `serializeUdl` from `@hyperscale0/udl`. |
|
|
1734
|
+
| `frame` | The Business Frame paired with the document. |
|
|
1735
|
+
| `originMap` | Canonical UDL paths mapped to authored HSX spans. |
|
|
1736
|
+
| `costManifest` | The deterministic manifest pinned to the supplied rate card. |
|
|
1737
|
+
|
|
1738
|
+
Canonical UDL sorts object keys, preserves array order, uses two-space JSON indentation, and ends with one line feed.
|