@hyperscale0/hsx 5.7.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const HSX_VERSION = "5.7.0";
1
+ export const HSX_VERSION = "5.8.0";
package/std/financing.hsx CHANGED
@@ -10,6 +10,8 @@ header financing
10
10
  // it tops up only the missing down payment, without advancing lender principal.
11
11
  // Disburse still collects any missing down payment, activates slices, and confirms
12
12
  // the fully funded hold. Existing escrow credit counts once toward the down payment.
13
+ // Disburse first credits an active marketplace.reservation on the same hold,
14
+ // so list the plan in its converters; the deposit then counts as escrow credit.
13
15
  // Borrower-directed disbursement excludes collect_down_payment. A down_payment
14
16
  // there reduces principal but does not collect cash. Price is subject metadata,
15
17
  // not the borrower limit. The escrow payer and price must match the plan.
@@ -82,7 +84,7 @@ instrument installments(months: integer(1, 366), charge_limit: integer(1, 3) = 3
82
84
  requires self.portfolioLimit in [approved]
83
85
  when disburse_to is funds {
84
86
  requires self.funds in [pending]
85
- invoke: [{ reference: self.id, action: fund_down_payment, input: {} }]
87
+ invoke: [{ selection: { instrument: all(marketplace.reservation), reference: "funds", anchor: self.funds, states: [active], limit: 1 }, action: credit, input: { funds: { field: self.funds }, contribution: { field: self.downPayment } } }, { reference: self.id, action: fund_down_payment, input: {} }]
86
88
  }
87
89
  when disburse_to is borrower { moves self.principal from self.capital to self.borrower economics { purpose: principal, sourceParty: capital } }
88
90
  invoke: [{ selection: { instrument: slice, reference: "plan", anchor: self.id, states: [draft], limit: 366, order: [position] }, action: activate, input: {} }]
@@ -9,8 +9,8 @@ header marketplace
9
9
  // verify_return and refund aliases. Refund needs disputed -> return_verified,
10
10
  // with payee evidence, then returns the full price to payer; accept pays payee.
11
11
  // A reservation holds its own deposit. Activate requires an active listing and
12
- // no placed order. Convert must wire the declared converters to invoke credit;
13
- // naming a converter alone does not add that invocation. Credit consumes the
12
+ // no placed order. Only a declared converter may invoke credit. A financing
13
+ // plan on the same hold credits it when the lender disburses. Credit consumes the
14
14
  // deposit once, credits at most the contribution, and returns excess to buyer.
15
15
  // Expose cancel, seller_cancel or operator_cancel for the intended actors.
16
16
  // Buyer cancel and expiry use configured refund percentages; seller/operator
@@ -64,7 +64,7 @@ instrument order(listing: ref<marketplace.listing>, buyer: party) {
64
64
  action cancel { from: [quoted, placed], to: cancelled, actor: { party: buyer } }
65
65
  }
66
66
 
67
- instrument reservation(listing: ref<marketplace.listing>, funds: ref<escrow.hold>, plans: ref<financing.installments>[], converters: ref[], buyer: party, seller: party, expires_after: duration = 48h, deposit: money = 1000 SAR, cancellation_refund: percent = 100%, expiry_refund: percent = 100%, retained_to: party = programOperator, operator: party = programOperator, competing_quotes: enum(allowed, blocked) = allowed) {
67
+ instrument reservation(listing: ref<marketplace.listing>, funds: ref<escrow.hold>, converters: ref[], buyer: party, seller: party, expires_after: duration = 48h, deposit: money = 1000 SAR, cancellation_refund: percent = 100%, expiry_refund: percent = 100%, retained_to: party = programOperator, operator: party = programOperator, competing_quotes: enum(allowed, blocked) = allowed) {
68
68
  revisioned: true
69
69
  summary: "Exclusive timed listing hold with explicit deposit credit and refund."
70
70
  fields {
@@ -82,12 +82,6 @@ instrument reservation(listing: ref<marketplace.listing>, funds: ref<escrow.hold
82
82
  requires count of { instrument: all(marketplace.order), reference: "listing", anchor: self.listing, states: [placed, fulfilled], limit: 366 } == 0
83
83
  moves self.deposit from self.buyer to self.held economics { purpose: principal, sourceParty: buyer }
84
84
  }
85
- action convert_financed {
86
- from: active, to: active, actor: { party: buyer }, deadline: { at: self.expiresAt }
87
- input { plan: ref<plans> }
88
- requires input.plan.funds == self.funds; requires input.plan.borrower == self.buyer
89
- invoke: [{ reference: input.plan, action: disburse, input: {} }]
90
- }
91
85
  action convert_cash {
92
86
  from: active, to: active, actor: { party: buyer }, deadline: { at: self.expiresAt }
93
87
  invoke: [{ reference: self.funds, action: fund, input: {} }]