@hyperscale0/hsx 1.0.284 → 1.0.294

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/README.md CHANGED
@@ -76,8 +76,7 @@ currency units, basis points and milliseconds.
76
76
 
77
77
  Examples have `id`, `title`, `summary`, `headers` and `source`. The ID is the
78
78
  filename without `.hsx`; leading comments supply the summary. The array is sorted
79
- by filename and contains no filesystem imports. Workspace imports use
80
- `@hyperscale0/hsx` instead of the published `@hyperscale0/hsx` name.
79
+ by filename and contains no filesystem imports.
81
80
 
82
81
  ## Working from source
83
82
 
package/bases/lending.hsx CHANGED
@@ -35,7 +35,6 @@ object plan "Plan" {
35
35
  expose activate as activate_balance
36
36
  expose topup as add_funds
37
37
  expose withdraw as withdraw_funds
38
- expose close as close_balance
39
38
  }
40
39
  attach round = lending.round {
41
40
  borrower: owner, plan: plan
package/bases/wallet.hsx CHANGED
@@ -11,7 +11,6 @@ object balance "Balance" {
11
11
  expose withdraw as withdraw_funds
12
12
  expose freeze as freeze_balance
13
13
  expose unfreeze as unfreeze_balance
14
- expose close as close_balance
15
14
  }
16
15
  attach spend = wallet.spend {
17
16
  wallet: balance, payee: operator, holder: owner
@@ -4,11 +4,11 @@ export const bases = [
4
4
  { "id": "escrow", "title": "Hold payment until delivery", "summary": "Hold a buyer’s payment until delivery is accepted.", "headers": ["escrow"], "source": "// Hold a buyer’s payment until delivery is accepted.\nprogram escrow_base \"Hold payment until delivery\"\nuse escrow\nparty seller: business\n\nobject order \"Order\" {\n fields { price: money }\n attach payment = escrow.hold {\n payer: owner, payee: seller\n expose create as create\n expose fund as fund\n expose deliver as deliver\n expose accept as accept\n expose dispute as dispute\n expose verify_return as verify_return\n expose refund as refund\n expose refund_undelivered as refund_undelivered\n expose settle_release as settle_release\n expose settle_return as settle_return\n expose settle_refund as settle_refund\n expose cancel as cancel\n }\n}\n" },
5
5
  { "id": "financing", "title": "Split a purchase into instalments", "summary": "Fund a purchase and collect its scheduled repayments.", "headers": ["financing"], "source": "// Fund a purchase and collect its scheduled repayments.\nprogram financing_base \"Split a purchase into instalments\"\nuse financing\nparty seller: business\n\nobject purchase \"Purchase\" {\n fields { price: money }\n attach allowance = financing.limits {\n borrower: owner, per_borrower: runtime\n expose create as request_limit\n expose approve as approve_limit\n }\n attach budget = financing.portfolio_limit {\n limit: runtime\n expose create as create_budget\n expose approve as approve_budget\n }\n // Architect sets the placeholder profit rate during tailoring.\n attach plan = financing.installments {\n borrower: owner, capital: operator\n months: 2, pricing: flat_total, profit_rate: 0%\n disburse_to: seller, seller: seller, limits: allowance, portfolio: budget\n expose create as quote\n expose sign as sign\n expose disburse as fund\n expose cancel as cancel_quote\n expose void as cancel_plan\n expose payoff as repay_early\n expose complete as complete\n }\n}\n\nexpose purchase.plan.payment.create as record_payment\nexpose purchase.plan.payment.pay as pay_instalment\nexpose purchase.plan.payment.refund as refund_payment\nexpose purchase.plan.payoff_quote.create as quote_payoff\n" },
6
6
  { "id": "insurance", "title": "Protect a purchase", "summary": "Collect cover premiums and reserve approved claims for payment.", "headers": ["insurance"], "source": "// Collect cover premiums and reserve approved claims for payment.\nprogram insurance_base \"Protect a purchase\"\nuse insurance\n\nobject purchase \"Purchase\" {\n attach cover = insurance.cover {\n holder: owner, adapter: \"conformance_boundary\"\n expose create as create_cover\n expose activate as activate_cover\n expose cancel as cancel_cover\n }\n attach claim = insurance.claim {\n cover: cover, inspector: operator\n expose create as create_claim\n expose approve as approve_claim\n expose deny as deny_claim\n expose pay as pay_claim\n }\n}\n\nexpose purchase.cover.slice.create as create_period\nexpose purchase.cover.slice.collect as collect_premium\n" },
7
- { "id": "lending", "title": "Pool funds for lending", "summary": "Pool member commitments to fund a loan and distribute repayments or losses.", "headers": ["lending", "financing", "wallet"], "source": "// Pool member commitments to fund a loan and distribute repayments or losses.\nprogram lending_base \"Pool funds for lending\"\nuse lending\nuse financing\nuse wallet\n\nobject plan \"Plan\" {\n fields { price: money }\n attach allowance = financing.limits {\n borrower: owner, per_borrower: runtime\n expose create as request_limit\n expose approve as approve_limit\n }\n attach budget = financing.portfolio_limit {\n limit: runtime\n expose create as create_budget\n expose approve as approve_budget\n }\n // Architect sets the placeholder profit rate during tailoring.\n attach plan = financing.installments {\n borrower: owner, capital: operator\n months: 2, pricing: flat_total, profit_rate: 0%\n disburse_to: borrower, limits: allowance, portfolio: budget\n expose create as quote\n expose sign as sign\n expose disburse as fund\n expose cancel as cancel_quote\n expose void as cancel_plan\n expose payoff as repay_early\n expose complete as complete\n }\n attach balance = wallet.balance {\n holder: actor\n expose create as create_balance\n expose activate as activate_balance\n expose topup as add_funds\n expose withdraw as withdraw_funds\n expose close as close_balance\n }\n attach round = lending.round {\n borrower: owner, plan: plan\n expose create as open_round\n expose close as close_round\n }\n attach commitment = lending.commitment {\n round: round, wallet: balance, investor: actor\n expose create as commit\n expose withdraw as withdraw_commitment\n }\n attach returns = lending.distribution {\n round: round, receipt: plan.settlement\n expose create as record_settlement\n expose prepare_cash as prepare_returns\n expose distribute_cash as distribute_returns\n }\n attach losses = lending.distribution {\n round: round, receipt: plan.settlement, mode: loss\n expose create as record_loss\n expose prepare_loss as prepare_losses\n expose distribute_loss as distribute_losses\n }\n}\n\nexpose plan.plan.payment.create as record_payment\nexpose plan.plan.payment.pay as pay_instalment\nexpose plan.plan.payment.refund as refund_payment\nexpose plan.plan.payoff_quote.create as quote_payoff\n\nexpose plan.returns.share.create as create_return_share\nexpose plan.losses.share.create as create_loss_share\nexpose plan.plan.write_off_request.create as request_write_off\nexpose plan.plan.write_off_request.apply as apply_write_off\nexpose plan.plan.write_off_request.cancel as cancel_write_off\n" },
7
+ { "id": "lending", "title": "Pool funds for lending", "summary": "Pool member commitments to fund a loan and distribute repayments or losses.", "headers": ["lending", "financing", "wallet"], "source": "// Pool member commitments to fund a loan and distribute repayments or losses.\nprogram lending_base \"Pool funds for lending\"\nuse lending\nuse financing\nuse wallet\n\nobject plan \"Plan\" {\n fields { price: money }\n attach allowance = financing.limits {\n borrower: owner, per_borrower: runtime\n expose create as request_limit\n expose approve as approve_limit\n }\n attach budget = financing.portfolio_limit {\n limit: runtime\n expose create as create_budget\n expose approve as approve_budget\n }\n // Architect sets the placeholder profit rate during tailoring.\n attach plan = financing.installments {\n borrower: owner, capital: operator\n months: 2, pricing: flat_total, profit_rate: 0%\n disburse_to: borrower, limits: allowance, portfolio: budget\n expose create as quote\n expose sign as sign\n expose disburse as fund\n expose cancel as cancel_quote\n expose void as cancel_plan\n expose payoff as repay_early\n expose complete as complete\n }\n attach balance = wallet.balance {\n holder: actor\n expose create as create_balance\n expose activate as activate_balance\n expose topup as add_funds\n expose withdraw as withdraw_funds\n }\n attach round = lending.round {\n borrower: owner, plan: plan\n expose create as open_round\n expose close as close_round\n }\n attach commitment = lending.commitment {\n round: round, wallet: balance, investor: actor\n expose create as commit\n expose withdraw as withdraw_commitment\n }\n attach returns = lending.distribution {\n round: round, receipt: plan.settlement\n expose create as record_settlement\n expose prepare_cash as prepare_returns\n expose distribute_cash as distribute_returns\n }\n attach losses = lending.distribution {\n round: round, receipt: plan.settlement, mode: loss\n expose create as record_loss\n expose prepare_loss as prepare_losses\n expose distribute_loss as distribute_losses\n }\n}\n\nexpose plan.plan.payment.create as record_payment\nexpose plan.plan.payment.pay as pay_instalment\nexpose plan.plan.payment.refund as refund_payment\nexpose plan.plan.payoff_quote.create as quote_payoff\n\nexpose plan.returns.share.create as create_return_share\nexpose plan.losses.share.create as create_loss_share\nexpose plan.plan.write_off_request.create as request_write_off\nexpose plan.plan.write_off_request.apply as apply_write_off\nexpose plan.plan.write_off_request.cancel as cancel_write_off\n" },
8
8
  { "id": "marketplace", "title": "Connect buyers and sellers", "summary": "Turn a seller’s offer into an order with payment held until acceptance.", "headers": ["marketplace", "escrow"], "source": "// Turn a seller’s offer into an order with payment held until acceptance.\nprogram marketplace_base \"Connect buyers and sellers\"\nuse marketplace\nuse escrow\nparty seller: business\n\nobject order \"Order\" {\n fields { price: money }\n attach offer = marketplace.listing {\n seller: seller\n expose create as create_offer\n expose publish as publish_offer\n expose withdraw as withdraw_offer\n expose sell as sell_offer\n }\n attach order = marketplace.order {\n listing: offer, buyer: owner, fulfiller: seller\n expose create as create_order\n expose commit as commit_order\n expose fulfill as fulfill_order\n expose cancel as cancel_order\n }\n attach payment = escrow.hold {\n payer: owner, payee: seller\n expose create as create\n expose fund as fund\n expose deliver as deliver\n expose accept as accept\n expose dispute as dispute\n expose verify_return as verify_return\n expose refund as refund\n expose refund_undelivered as refund_undelivered\n expose settle_release as settle_release\n expose settle_return as settle_return\n expose settle_refund as settle_refund\n expose cancel as cancel\n }\n}\n" },
9
9
  { "id": "money", "title": "Collect a payment", "summary": "Collect a payment from a customer.", "headers": ["money"], "source": "// Collect a payment from a customer.\nprogram money_base \"Collect a payment\"\nuse money\n\nobject purchase \"Purchase\" {\n attach payment = money.transfer {\n payer: owner, payee: operator\n expose create as create\n expose pay as pay\n expose cancel as cancel\n }\n}\n" },
10
10
  { "id": "reporting", "title": "Track repayments", "summary": "Report outstanding balances and overdue repayments on financed purchases.", "headers": ["reporting", "financing"], "source": "// Report outstanding balances and overdue repayments on financed purchases.\nprogram reporting_base \"Track repayments\"\nuse reporting\nuse financing\n\nobject purchase \"Purchase\" {\n fields { price: money }\n attach allowance = financing.limits {\n borrower: owner, per_borrower: runtime\n expose create as request_limit\n expose approve as approve_limit\n }\n attach budget = financing.portfolio_limit {\n limit: runtime\n expose create as create_budget\n expose approve as approve_budget\n }\n // Architect sets the placeholder profit rate during tailoring.\n attach plan = financing.installments {\n borrower: owner, capital: operator\n months: 2, pricing: flat_total, profit_rate: 0%\n disburse_to: borrower, limits: allowance, portfolio: budget\n expose create as quote\n expose sign as sign\n expose disburse as fund\n expose cancel as cancel_quote\n expose void as cancel_plan\n expose payoff as repay_early\n expose complete as complete\n }\n attach reports = reporting.portfolio {\n on: plan\n expose create as create_reports\n }\n}\n\nexpose purchase.plan.payment.create as record_payment\nexpose purchase.plan.payment.pay as pay_instalment\nexpose purchase.plan.payment.refund as refund_payment\nexpose purchase.plan.payoff_quote.create as quote_payoff\n" },
11
11
  { "id": "savings", "title": "Save as a group", "summary": "Collect contributions into a shared pot and pay each member in turn.", "headers": ["savings"], "source": "// Collect contributions into a shared pot and pay each member in turn.\nprogram savings_base \"Save as a group\"\nuse savings\n\nobject pot \"Pot\" {\n attach circle = savings.circle {\n contribution: runtime, members: 2, starts: runtime\n expose create as create_circle\n expose disband as disband_circle\n expose close as close_circle\n }\n attach membership = savings.membership {\n circle: circle, member: actor\n expose create as join\n expose activate as activate_membership\n expose withdraw as withdraw\n }\n}\n\nexpose pot.membership.contribution.create as schedule_contribution\n" },
12
- { "id": "wallet", "title": "Offer prepaid credit", "summary": "Let a customer add funds and reserve each spend before payment.", "headers": ["wallet"], "source": "// Let a customer add funds and reserve each spend before payment.\nprogram wallet_base \"Offer prepaid credit\"\nuse wallet\n\nobject balance \"Balance\" {\n attach balance = wallet.balance {\n holder: owner\n expose create as create_balance\n expose activate as activate_balance\n expose topup as add_funds\n expose withdraw as withdraw_funds\n expose freeze as freeze_balance\n expose unfreeze as unfreeze_balance\n expose close as close_balance\n }\n attach spend = wallet.spend {\n wallet: balance, payee: operator, holder: owner\n expose create as create\n expose reserve as reserve\n expose pay as pay\n expose cancel as cancel\n }\n}\n" },
12
+ { "id": "wallet", "title": "Offer prepaid credit", "summary": "Let a customer add funds and reserve each spend before payment.", "headers": ["wallet"], "source": "// Let a customer add funds and reserve each spend before payment.\nprogram wallet_base \"Offer prepaid credit\"\nuse wallet\n\nobject balance \"Balance\" {\n attach balance = wallet.balance {\n holder: owner\n expose create as create_balance\n expose activate as activate_balance\n expose topup as add_funds\n expose withdraw as withdraw_funds\n expose freeze as freeze_balance\n expose unfreeze as unfreeze_balance\n }\n attach spend = wallet.spend {\n wallet: balance, payee: operator, holder: owner\n expose create as create\n expose reserve as reserve\n expose pay as pay\n expose cancel as cancel\n }\n}\n" },
13
13
  ];
14
14
  //# sourceMappingURL=bases-bundle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oB;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;CAClE;AACD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE;QACV,QAAQ,EAAE,WAAW,CAAC;QACtB,YAAY,EAAE,eAAe,CAAC;QAC9B,SAAS,EAAE,qBAAqB,EAAE,CAAC;KACpC,CAAC;CACH;AAmVD,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,cAAmB,GAC3B,aAAa,CA6jIf"}
@@ -1,7 +1,7 @@
1
1
  import { CompileFailure, didYouMean, fail, failWithCode, } from "./diagnostics.js";
2
2
  import { hash as sha256 } from "fast-sha256";
3
3
  import { buildUdlCostManifest } from "./cost.js";
4
- import { validateUdl, resolveField, sameAccount, sameObjectField, subjectPartyRoles, RESERVED_OBJECT_NAMES, UDL_FORMAT_VERSION, udlObjectFieldSchema, udlInstrumentSchema, } from "@hyperscale0/udl";
4
+ import { validateUdl, resolveField, sameAccount, sameObjectField, subjectPartyRoles, RESERVED_OBJECT_NAMES, UDL_FORMAT_VERSION, udlObjectFieldSchema, udlFieldValueSchema, udlInstrumentSchema, } from "@hyperscale0/udl";
5
5
  import { bindingDependencies, parameterDiagnostics, BindingContractError, } from "./binding-contract.js";
6
6
  import { tunableBounds } from "./tunables.js";
7
7
  import { parseProgram } from "./parse.js";
@@ -2115,6 +2115,27 @@ export function compile(source, options = {}) {
2115
2115
  const tax = terms.get("tax");
2116
2116
  if (tax && tax.kind !== "percent")
2117
2117
  fail(tax, "tax needs a percentage of the fee", "write tax: 15%");
2118
+ if (paidBy === "seller" &&
2119
+ (!("literal" in transfer.amount) ||
2120
+ udlFieldValueSchema({
2121
+ name: "amount",
2122
+ type: "money",
2123
+ }).safeParse(transfer.amount.literal).success)) {
2124
+ const bps = BigInt(Number(literal(rate)));
2125
+ const taxBps = BigInt(tax ? Number(literal(tax)) : 0);
2126
+ const cap = quoted.kind === "capped"
2127
+ ? BigInt(String(literal(quoted.cap)))
2128
+ : undefined;
2129
+ let exceeds = cap === undefined && bps * (10000n + taxBps) > 100000000n;
2130
+ if ("literal" in transfer.amount) {
2131
+ const amount = BigInt(String(transfer.amount.literal));
2132
+ const grossFee = (amount * bps) / 10000n;
2133
+ const fee = cap !== undefined && cap < grossFee ? cap : grossFee;
2134
+ exceeds = fee + (fee * taxBps) / 10000n > amount;
2135
+ }
2136
+ if (exceeds)
2137
+ failWithCode(quoted, "seller_fee_exceeds_amount", "seller fee plus tax exceeds the base amount", "lower the seller fee, cap or tax so the combined charge fits within the amount");
2138
+ }
2118
2139
  const vat = tax
2119
2140
  ? derived("tax", "Fee tax", {
2120
2141
  op: "rate",