@totemsdk/omnia-factory 0.5.0 → 0.5.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.
@@ -33,11 +33,11 @@ export declare function factoryEscapeStateVariable(escapeBlock: number): {
33
33
  * - **Cooperative / update** (any time): `MULTISIG(N …)` — all parties sign.
34
34
  * `SETTLEMENT=true` closes after minimal coinage (1 block).
35
35
  * - **Unilateral escape** (after the absolute block in `STATE(103)`): any
36
- * single party k may withdraw its allocation `SHARE_k = STATE(200+k)` to its
37
- * own settlement address, zero its state (`STATE(200+k) EQ 0`), keep the
38
- * other parties' balances unchanged, and return the remainder to the factory
39
- * script. Repeated withdrawals cannot double-claim because each zeroes its
40
- * own port. `STATE(103)` is immutable on every spend (`SAMESTATE(103 103)`),
36
+ * single party k may withdraw its allocation `SHARE_k = PREVSTATE(200+k)`
37
+ * (the spent coin's share) to its own settlement address, zero its state in
38
+ * the successor (`STATE(200+k) EQ 0`), keep the other parties' balances
39
+ * unchanged, and return the remainder to the factory script. Repeated
40
+ * withdrawals cannot double-claim because each zeroes its own port. `STATE(103)` is immutable on every spend (`SAMESTATE(103 103)`),
41
41
  * so the escape clock cannot be pushed by any counterparty.
42
42
  *
43
43
  * Minimum 2 participants required.
@@ -49,11 +49,11 @@ function factoryEscapeStateVariable(escapeBlock) {
49
49
  * - **Cooperative / update** (any time): `MULTISIG(N …)` — all parties sign.
50
50
  * `SETTLEMENT=true` closes after minimal coinage (1 block).
51
51
  * - **Unilateral escape** (after the absolute block in `STATE(103)`): any
52
- * single party k may withdraw its allocation `SHARE_k = STATE(200+k)` to its
53
- * own settlement address, zero its state (`STATE(200+k) EQ 0`), keep the
54
- * other parties' balances unchanged, and return the remainder to the factory
55
- * script. Repeated withdrawals cannot double-claim because each zeroes its
56
- * own port. `STATE(103)` is immutable on every spend (`SAMESTATE(103 103)`),
52
+ * single party k may withdraw its allocation `SHARE_k = PREVSTATE(200+k)`
53
+ * (the spent coin's share) to its own settlement address, zero its state in
54
+ * the successor (`STATE(200+k) EQ 0`), keep the other parties' balances
55
+ * unchanged, and return the remainder to the factory script. Repeated
56
+ * withdrawals cannot double-claim because each zeroes its own port. `STATE(103)` is immutable on every spend (`SAMESTATE(103 103)`),
57
57
  * so the escape clock cannot be pushed by any counterparty.
58
58
  *
59
59
  * Minimum 2 participants required.
@@ -68,11 +68,11 @@ function buildFactoryScript(participants, _options = {}) {
68
68
  const lines = [
69
69
  'LET SETTLEMENT=STATE(100)',
70
70
  `ASSERT SAMESTATE(${exports.FACTORY_ESCAPE_PORT} ${exports.FACTORY_ESCAPE_PORT})`,
71
- `IF @BLOCK GT STATE(${exports.FACTORY_ESCAPE_PORT}) THEN`,
71
+ `IF @BLOCK GT PREVSTATE(${exports.FACTORY_ESCAPE_PORT}) THEN`,
72
72
  ];
73
73
  participants.forEach((_, k) => {
74
74
  const port = exports.FACTORY_BALANCE_PORT_BASE + k;
75
- lines.push(` LET SHARE${k}=STATE(${port})`);
75
+ lines.push(` LET SHARE${k}=PREVSTATE(${port})`);
76
76
  lines.push(` IF SIGNEDBY(${pks[k]}) THEN`);
77
77
  lines.push(` IF SHARE${k} GT 0 THEN`);
78
78
  lines.push(` ASSERT VERIFYOUT(0 ${payouts[k]} SHARE${k} @TOKENID FALSE)`);
package/dist/script.d.ts CHANGED
@@ -33,11 +33,11 @@ export declare function factoryEscapeStateVariable(escapeBlock: number): {
33
33
  * - **Cooperative / update** (any time): `MULTISIG(N …)` — all parties sign.
34
34
  * `SETTLEMENT=true` closes after minimal coinage (1 block).
35
35
  * - **Unilateral escape** (after the absolute block in `STATE(103)`): any
36
- * single party k may withdraw its allocation `SHARE_k = STATE(200+k)` to its
37
- * own settlement address, zero its state (`STATE(200+k) EQ 0`), keep the
38
- * other parties' balances unchanged, and return the remainder to the factory
39
- * script. Repeated withdrawals cannot double-claim because each zeroes its
40
- * own port. `STATE(103)` is immutable on every spend (`SAMESTATE(103 103)`),
36
+ * single party k may withdraw its allocation `SHARE_k = PREVSTATE(200+k)`
37
+ * (the spent coin's share) to its own settlement address, zero its state in
38
+ * the successor (`STATE(200+k) EQ 0`), keep the other parties' balances
39
+ * unchanged, and return the remainder to the factory script. Repeated
40
+ * withdrawals cannot double-claim because each zeroes its own port. `STATE(103)` is immutable on every spend (`SAMESTATE(103 103)`),
41
41
  * so the escape clock cannot be pushed by any counterparty.
42
42
  *
43
43
  * Minimum 2 participants required.
package/dist/script.js CHANGED
@@ -40,11 +40,11 @@ export function factoryEscapeStateVariable(escapeBlock) {
40
40
  * - **Cooperative / update** (any time): `MULTISIG(N …)` — all parties sign.
41
41
  * `SETTLEMENT=true` closes after minimal coinage (1 block).
42
42
  * - **Unilateral escape** (after the absolute block in `STATE(103)`): any
43
- * single party k may withdraw its allocation `SHARE_k = STATE(200+k)` to its
44
- * own settlement address, zero its state (`STATE(200+k) EQ 0`), keep the
45
- * other parties' balances unchanged, and return the remainder to the factory
46
- * script. Repeated withdrawals cannot double-claim because each zeroes its
47
- * own port. `STATE(103)` is immutable on every spend (`SAMESTATE(103 103)`),
43
+ * single party k may withdraw its allocation `SHARE_k = PREVSTATE(200+k)`
44
+ * (the spent coin's share) to its own settlement address, zero its state in
45
+ * the successor (`STATE(200+k) EQ 0`), keep the other parties' balances
46
+ * unchanged, and return the remainder to the factory script. Repeated
47
+ * withdrawals cannot double-claim because each zeroes its own port. `STATE(103)` is immutable on every spend (`SAMESTATE(103 103)`),
48
48
  * so the escape clock cannot be pushed by any counterparty.
49
49
  *
50
50
  * Minimum 2 participants required.
@@ -59,11 +59,11 @@ export function buildFactoryScript(participants, _options = {}) {
59
59
  const lines = [
60
60
  'LET SETTLEMENT=STATE(100)',
61
61
  `ASSERT SAMESTATE(${FACTORY_ESCAPE_PORT} ${FACTORY_ESCAPE_PORT})`,
62
- `IF @BLOCK GT STATE(${FACTORY_ESCAPE_PORT}) THEN`,
62
+ `IF @BLOCK GT PREVSTATE(${FACTORY_ESCAPE_PORT}) THEN`,
63
63
  ];
64
64
  participants.forEach((_, k) => {
65
65
  const port = FACTORY_BALANCE_PORT_BASE + k;
66
- lines.push(` LET SHARE${k}=STATE(${port})`);
66
+ lines.push(` LET SHARE${k}=PREVSTATE(${port})`);
67
67
  lines.push(` IF SIGNEDBY(${pks[k]}) THEN`);
68
68
  lines.push(` IF SHARE${k} GT 0 THEN`);
69
69
  lines.push(` ASSERT VERIFYOUT(0 ${payouts[k]} SHARE${k} @TOKENID FALSE)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totemsdk/omnia-factory",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Channel factory layer for Omnia — N-of-N MULTISIG funding, virtual channel management, and factory settlement",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -24,10 +24,10 @@
24
24
  "LICENSE"
25
25
  ],
26
26
  "dependencies": {
27
+ "@totemsdk/core": "^1.3.0",
27
28
  "@totemsdk/omnia": "^2.0.1",
28
- "@totemsdk/tx-builder": "^0.2.1",
29
- "@totemsdk/core": "^1.2.11",
30
29
  "@totemsdk/wots-lease": "^1.0.1",
30
+ "@totemsdk/tx-builder": "^0.2.1",
31
31
  "@totemsdk/txpow": "^1.0.2",
32
32
  "@totemsdk/chain-provider": "^0.2.1",
33
33
  "@totemsdk/storage": "^0.1.0"