@ottochain/sdk 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/dist/cjs/apps/compute/index.js +33 -0
  2. package/dist/cjs/apps/compute/state-machines/compute-rule110.js +164 -0
  3. package/dist/cjs/apps/compute/state-machines/index.js +9 -0
  4. package/dist/cjs/apps/contracts/index.js +1 -1
  5. package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +126 -148
  6. package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +153 -174
  7. package/dist/cjs/apps/contracts/state-machines/contract-universal.js +46 -58
  8. package/dist/cjs/apps/corporate/state-machines/corp-board.js +415 -481
  9. package/dist/cjs/apps/corporate/state-machines/corp-entity.js +368 -440
  10. package/dist/cjs/apps/corporate/state-machines/corp-securities.js +532 -647
  11. package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +499 -603
  12. package/dist/cjs/apps/governance/index.js +7 -7
  13. package/dist/cjs/apps/governance/state-machines/dao-multisig.js +170 -209
  14. package/dist/cjs/apps/governance/state-machines/dao-reputation.js +161 -214
  15. package/dist/cjs/apps/governance/state-machines/dao-single.js +92 -92
  16. package/dist/cjs/apps/governance/state-machines/dao-token.js +169 -223
  17. package/dist/cjs/apps/governance/state-machines/governance-simple.js +185 -217
  18. package/dist/cjs/apps/governance/state-machines/governance-universal.js +64 -64
  19. package/dist/cjs/apps/identity/constants.js +16 -24
  20. package/dist/cjs/apps/identity/index.js +1 -1
  21. package/dist/cjs/apps/identity/state-machines/identity-agent.js +124 -158
  22. package/dist/cjs/apps/identity/state-machines/identity-oracle.js +151 -169
  23. package/dist/cjs/apps/identity/state-machines/identity-registry.js +89 -115
  24. package/dist/cjs/apps/identity/state-machines/identity-universal.js +51 -57
  25. package/dist/cjs/apps/index.js +4 -1
  26. package/dist/cjs/apps/lending/assets.js +41 -17
  27. package/dist/cjs/apps/lending/credit-scoring.js +4 -4
  28. package/dist/cjs/apps/lending/eligibility.js +9 -25
  29. package/dist/cjs/apps/lending/index.js +1 -1
  30. package/dist/cjs/apps/lending/state-machines/lending-zk-loan.js +177 -156
  31. package/dist/cjs/apps/markets/index.js +1 -1
  32. package/dist/cjs/apps/markets/state-machines/market-auction.js +115 -134
  33. package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +122 -137
  34. package/dist/cjs/apps/markets/state-machines/market-group-buy.js +158 -177
  35. package/dist/cjs/apps/markets/state-machines/market-prediction.js +193 -227
  36. package/dist/cjs/apps/markets/state-machines/market-universal.js +65 -80
  37. package/dist/cjs/apps/oracles/index.js +1 -1
  38. package/dist/cjs/apps/privacy/index.js +67 -0
  39. package/dist/cjs/apps/privacy/state-machines/index.js +17 -0
  40. package/dist/cjs/apps/privacy/state-machines/mixer-ddhRing.js +286 -0
  41. package/dist/cjs/apps/privacy/state-machines/note-pool.js +476 -0
  42. package/dist/cjs/apps/staked-pool/assets.js +103 -0
  43. package/dist/cjs/apps/staked-pool/base.js +498 -0
  44. package/dist/cjs/apps/staked-pool/consumer.js +55 -0
  45. package/dist/cjs/apps/staked-pool/index.js +83 -0
  46. package/dist/cjs/apps/staked-pool/state-machines/index.js +12 -0
  47. package/dist/cjs/apps/staked-pool/state-machines/staked-pool-base.js +49 -0
  48. package/dist/cjs/apps/staked-pool/state-machines/staked-pool-oracle.js +131 -0
  49. package/dist/cjs/generated/google/protobuf/struct.js +1 -1
  50. package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
  51. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +1 -1
  52. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  53. package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +1 -1
  54. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +1 -1
  55. package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +1 -1
  56. package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +1 -1
  57. package/dist/cjs/generated/ottochain/v1/common.js +1 -1
  58. package/dist/cjs/generated/ottochain/v1/fiber.js +40 -2
  59. package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
  60. package/dist/cjs/generated/ottochain/v1/records.js +1 -1
  61. package/dist/cjs/index.js +20 -3
  62. package/dist/cjs/ottochain/genesis-manifest.js +6 -0
  63. package/dist/cjs/ottochain/metagraph-client.js +16 -8
  64. package/dist/cjs/ottochain/snapshot.js +2 -4
  65. package/dist/cjs/ottochain/transaction.js +10 -0
  66. package/dist/cjs/privacy/sealed-bid.js +85 -82
  67. package/dist/cjs/privacy/shield-app.js +32 -32
  68. package/dist/cjs/schema/effects.js +117 -1
  69. package/dist/cjs/schema/fiber-app.js +132 -3
  70. package/dist/cjs/schema/guard-lint.js +3 -12
  71. package/dist/cjs/schema/guards.js +38 -38
  72. package/dist/cjs/templates/asset-policy.js +190 -0
  73. package/dist/cjs/templates/index.js +86 -0
  74. package/dist/cjs/templates/machine.js +130 -0
  75. package/dist/cjs/templates/migration.js +39 -0
  76. package/dist/cjs/templates/state-shape.js +38 -0
  77. package/dist/cjs/validation.js +1 -3
  78. package/dist/esm/apps/compute/index.js +29 -0
  79. package/dist/esm/apps/compute/state-machines/compute-rule110.js +161 -0
  80. package/dist/esm/apps/compute/state-machines/index.js +5 -0
  81. package/dist/esm/apps/contracts/index.js +4 -4
  82. package/dist/esm/apps/contracts/state-machines/contract-agreement.js +128 -150
  83. package/dist/esm/apps/contracts/state-machines/contract-escrow.js +155 -176
  84. package/dist/esm/apps/contracts/state-machines/contract-universal.js +47 -59
  85. package/dist/esm/apps/corporate/index.js +2 -2
  86. package/dist/esm/apps/corporate/state-machines/corp-board.js +418 -484
  87. package/dist/esm/apps/corporate/state-machines/corp-entity.js +371 -443
  88. package/dist/esm/apps/corporate/state-machines/corp-securities.js +535 -650
  89. package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +502 -606
  90. package/dist/esm/apps/governance/index.js +10 -10
  91. package/dist/esm/apps/governance/state-machines/dao-multisig.js +172 -211
  92. package/dist/esm/apps/governance/state-machines/dao-reputation.js +163 -216
  93. package/dist/esm/apps/governance/state-machines/dao-single.js +94 -94
  94. package/dist/esm/apps/governance/state-machines/dao-token.js +171 -225
  95. package/dist/esm/apps/governance/state-machines/governance-simple.js +187 -219
  96. package/dist/esm/apps/governance/state-machines/governance-universal.js +65 -65
  97. package/dist/esm/apps/identity/constants.js +18 -26
  98. package/dist/esm/apps/identity/index.js +8 -8
  99. package/dist/esm/apps/identity/state-machines/identity-agent.js +125 -159
  100. package/dist/esm/apps/identity/state-machines/identity-oracle.js +153 -171
  101. package/dist/esm/apps/identity/state-machines/identity-registry.js +91 -117
  102. package/dist/esm/apps/identity/state-machines/identity-universal.js +52 -58
  103. package/dist/esm/apps/index.js +9 -6
  104. package/dist/esm/apps/lending/assets.js +41 -17
  105. package/dist/esm/apps/lending/credit-scoring.js +6 -6
  106. package/dist/esm/apps/lending/eligibility.js +10 -26
  107. package/dist/esm/apps/lending/index.js +5 -5
  108. package/dist/esm/apps/lending/state-machines/lending-zk-loan.js +178 -157
  109. package/dist/esm/apps/markets/index.js +5 -5
  110. package/dist/esm/apps/markets/state-machines/market-auction.js +117 -136
  111. package/dist/esm/apps/markets/state-machines/market-crowdfund.js +124 -139
  112. package/dist/esm/apps/markets/state-machines/market-group-buy.js +160 -179
  113. package/dist/esm/apps/markets/state-machines/market-prediction.js +195 -229
  114. package/dist/esm/apps/markets/state-machines/market-universal.js +66 -81
  115. package/dist/esm/apps/oracles/index.js +3 -3
  116. package/dist/esm/apps/privacy/index.js +56 -0
  117. package/dist/esm/apps/privacy/state-machines/index.js +6 -0
  118. package/dist/esm/apps/privacy/state-machines/mixer-ddhRing.js +282 -0
  119. package/dist/esm/apps/privacy/state-machines/note-pool.js +470 -0
  120. package/dist/esm/apps/staked-pool/assets.js +91 -0
  121. package/dist/esm/apps/staked-pool/base.js +493 -0
  122. package/dist/esm/apps/staked-pool/consumer.js +49 -0
  123. package/dist/esm/apps/staked-pool/index.js +60 -0
  124. package/dist/esm/apps/staked-pool/state-machines/index.js +6 -0
  125. package/dist/esm/apps/staked-pool/state-machines/staked-pool-base.js +46 -0
  126. package/dist/esm/apps/staked-pool/state-machines/staked-pool-oracle.js +127 -0
  127. package/dist/esm/generated/google/protobuf/struct.js +1 -1
  128. package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
  129. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +1 -1
  130. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  131. package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
  132. package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +1 -1
  133. package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +1 -1
  134. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +1 -1
  135. package/dist/esm/generated/ottochain/v1/common.js +1 -1
  136. package/dist/esm/generated/ottochain/v1/fiber.js +40 -2
  137. package/dist/esm/generated/ottochain/v1/messages.js +1 -1
  138. package/dist/esm/generated/ottochain/v1/records.js +1 -1
  139. package/dist/esm/index.js +10 -4
  140. package/dist/esm/ottochain/genesis-manifest.js +6 -0
  141. package/dist/esm/ottochain/metagraph-client.js +16 -8
  142. package/dist/esm/ottochain/snapshot.js +2 -4
  143. package/dist/esm/ottochain/transaction.js +8 -0
  144. package/dist/esm/privacy/index.js +2 -2
  145. package/dist/esm/privacy/sealed-bid.js +87 -84
  146. package/dist/esm/privacy/shield-app.js +33 -33
  147. package/dist/esm/schema/effects.js +110 -0
  148. package/dist/esm/schema/fiber-app.js +127 -3
  149. package/dist/esm/schema/guard-lint.js +3 -12
  150. package/dist/esm/schema/guards.js +36 -37
  151. package/dist/esm/templates/asset-policy.js +182 -0
  152. package/dist/esm/templates/index.js +41 -0
  153. package/dist/esm/templates/machine.js +125 -0
  154. package/dist/esm/templates/migration.js +34 -0
  155. package/dist/esm/templates/state-shape.js +34 -0
  156. package/dist/esm/validation.js +1 -3
  157. package/dist/esm/zk/index.js +4 -4
  158. package/dist/types/apps/compute/index.d.ts +176 -0
  159. package/dist/types/apps/compute/state-machines/compute-rule110.d.ts +157 -0
  160. package/dist/types/apps/compute/state-machines/index.d.ts +5 -0
  161. package/dist/types/apps/contracts/index.d.ts +14 -14
  162. package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +3 -3
  163. package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +3 -3
  164. package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +4 -4
  165. package/dist/types/apps/corporate/index.d.ts +162 -162
  166. package/dist/types/apps/corporate/state-machines/corp-board.d.ts +88 -88
  167. package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +14 -14
  168. package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +18 -18
  169. package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +43 -43
  170. package/dist/types/apps/governance/index.d.ts +81 -81
  171. package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +16 -16
  172. package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +22 -22
  173. package/dist/types/apps/governance/state-machines/dao-token.d.ts +21 -21
  174. package/dist/types/apps/governance/state-machines/governance-simple.d.ts +11 -11
  175. package/dist/types/apps/governance/state-machines/governance-universal.d.ts +4 -4
  176. package/dist/types/apps/identity/constants.d.ts +2 -2
  177. package/dist/types/apps/identity/index.d.ts +70 -70
  178. package/dist/types/apps/identity/state-machines/identity-agent.d.ts +23 -23
  179. package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +11 -11
  180. package/dist/types/apps/identity/state-machines/identity-registry.d.ts +27 -27
  181. package/dist/types/apps/identity/state-machines/identity-universal.d.ts +4 -4
  182. package/dist/types/apps/index.d.ts +9 -6
  183. package/dist/types/apps/lending/assets.d.ts +2 -2
  184. package/dist/types/apps/lending/credit-scoring.d.ts +5 -5
  185. package/dist/types/apps/lending/eligibility.d.ts +2 -2
  186. package/dist/types/apps/lending/index.d.ts +20 -12
  187. package/dist/types/apps/lending/state-machines/lending-zk-loan.d.ts +15 -7
  188. package/dist/types/apps/markets/index.d.ts +76 -76
  189. package/dist/types/apps/markets/state-machines/market-auction.d.ts +12 -12
  190. package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +19 -19
  191. package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +18 -18
  192. package/dist/types/apps/markets/state-machines/market-prediction.d.ts +15 -15
  193. package/dist/types/apps/markets/state-machines/market-universal.d.ts +7 -7
  194. package/dist/types/apps/oracles/index.d.ts +1 -1
  195. package/dist/types/apps/privacy/index.d.ts +328 -0
  196. package/dist/types/apps/privacy/state-machines/index.d.ts +6 -0
  197. package/dist/types/apps/privacy/state-machines/mixer-ddhRing.d.ts +337 -0
  198. package/dist/types/apps/privacy/state-machines/note-pool.d.ts +196 -0
  199. package/dist/types/apps/staked-pool/assets.d.ts +53 -0
  200. package/dist/types/apps/staked-pool/base.d.ts +80 -0
  201. package/dist/types/apps/staked-pool/consumer.d.ts +29 -0
  202. package/dist/types/apps/staked-pool/index.d.ts +51 -0
  203. package/dist/types/apps/staked-pool/state-machines/index.d.ts +6 -0
  204. package/dist/types/apps/staked-pool/state-machines/staked-pool-base.d.ts +8 -0
  205. package/dist/types/apps/staked-pool/state-machines/staked-pool-oracle.d.ts +34 -0
  206. package/dist/types/generated/openapi.d.ts +13 -0
  207. package/dist/types/generated/ottochain/v1/fiber.d.ts +7 -0
  208. package/dist/types/index.d.ts +3 -3
  209. package/dist/types/openapi.d.ts +4 -2
  210. package/dist/types/ottochain/genesis-manifest.d.ts +6 -0
  211. package/dist/types/ottochain/transaction.d.ts +9 -1
  212. package/dist/types/ottochain/types.d.ts +1 -1
  213. package/dist/types/privacy/index.d.ts +2 -2
  214. package/dist/types/privacy/sealed-bid.d.ts +9 -9
  215. package/dist/types/privacy/shield-app.d.ts +1 -1
  216. package/dist/types/schema/effects.d.ts +107 -0
  217. package/dist/types/schema/fiber-app.d.ts +281 -0
  218. package/dist/types/schema/guards.d.ts +12 -0
  219. package/dist/types/templates/asset-policy.d.ts +119 -0
  220. package/dist/types/templates/index.d.ts +26 -0
  221. package/dist/types/templates/machine.d.ts +139 -0
  222. package/dist/types/templates/migration.d.ts +34 -0
  223. package/dist/types/templates/state-shape.d.ts +30 -0
  224. package/dist/types/zk/index.d.ts +4 -4
  225. package/package.json +31 -13
@@ -1,185 +1,169 @@
1
- import { defineFiberApp } from "../../../schema/fiber-app.js";
2
- import { actorIsSigner, signerInSet } from "../../../schema/guards.js";
1
+ import { defineFiberApp } from '../../../schema/fiber-app.js';
2
+ import { actorIsSigner, signerInSet } from '../../../schema/guards.js';
3
3
  /**
4
4
  * Reputation-based governance. Minimum reputation required for participation.
5
5
  */
6
6
  export const daoReputationDef = defineFiberApp({
7
7
  metadata: {
8
- name: "DAOReputation",
9
- app: "governance",
10
- type: "daoReputation",
11
- version: "1.0.0",
12
- description: "Reputation-based governance. Minimum reputation required for participation.",
13
- category: "governance/dao",
8
+ name: 'DAOReputation',
9
+ app: 'governance',
10
+ type: 'daoReputation',
11
+ version: '1.0.0',
12
+ description: 'Reputation-based governance. Minimum reputation required for participation.',
13
+ category: 'governance/dao',
14
14
  crossReferences: {
15
- Identity: "member verification",
16
- Reputation: "threshold checks",
17
- Contract: "action execution",
15
+ Identity: 'member verification',
16
+ Reputation: 'threshold checks',
17
+ Contract: 'action execution',
18
18
  },
19
19
  },
20
20
  createSchema: {
21
- required: [
22
- "memberThreshold",
23
- "voteThreshold",
24
- "proposeThreshold",
25
- "quorum",
26
- "votingPeriodMs",
27
- ],
21
+ required: ['memberThreshold', 'voteThreshold', 'proposeThreshold', 'quorum', 'votingPeriodMs'],
28
22
  properties: {
29
23
  memberThreshold: {
30
- type: "number",
31
- description: "Min reputation to join as a member",
24
+ type: 'number',
25
+ description: 'Min reputation to join as a member',
32
26
  },
33
- voteThreshold: { type: "number", description: "Min reputation to vote" },
27
+ voteThreshold: { type: 'number', description: 'Min reputation to vote' },
34
28
  proposeThreshold: {
35
- type: "number",
36
- description: "Min reputation to submit a proposal",
29
+ type: 'number',
30
+ description: 'Min reputation to submit a proposal',
37
31
  },
38
32
  quorum: {
39
- type: "number",
40
- description: "Min total votes (count) to execute",
33
+ type: 'number',
34
+ description: 'Min total votes (count) to execute',
41
35
  },
42
36
  votingPeriodMs: {
43
- type: "number",
44
- description: "Voting window in milliseconds",
37
+ type: 'number',
38
+ description: 'Voting window in milliseconds',
45
39
  },
46
40
  },
47
41
  },
48
42
  stateSchema: {
49
43
  properties: {
50
- members: { type: "array", computed: true },
51
- memberJoinedAt: { type: "object", computed: true },
52
- memberThreshold: { type: "number" },
53
- voteThreshold: { type: "number" },
54
- proposeThreshold: { type: "number" },
55
- quorum: { type: "number" },
56
- votingPeriodMs: { type: "number" },
57
- proposal: { type: "object" },
58
- votes: { type: "object", computed: true },
59
- history: { type: "array", computed: true },
44
+ members: { type: 'array', computed: true },
45
+ memberJoinedAt: { type: 'object', computed: true },
46
+ memberThreshold: { type: 'number' },
47
+ voteThreshold: { type: 'number' },
48
+ proposeThreshold: { type: 'number' },
49
+ quorum: { type: 'number' },
50
+ votingPeriodMs: { type: 'number' },
51
+ proposal: { type: 'object' },
52
+ votes: { type: 'object', computed: true },
53
+ history: { type: 'array', computed: true },
60
54
  },
61
55
  },
62
56
  eventSchemas: {
63
57
  propose: {
64
- description: "Submit a proposal (requires >= proposeThreshold reputation)",
65
- required: [
66
- "proposalId",
67
- "title",
68
- "description",
69
- "actionType",
70
- "payload",
71
- "agentReputation",
72
- ],
58
+ description: 'Submit a proposal (requires >= proposeThreshold reputation)',
59
+ required: ['proposalId', 'title', 'description', 'actionType', 'payload', 'agentReputation'],
73
60
  properties: {
74
- agent: { type: "address" },
75
- agentReputation: { type: "number" },
76
- proposalId: { type: "string" },
77
- title: { type: "string" },
78
- description: { type: "string" },
79
- actionType: { type: "string" },
80
- payload: { type: "object" },
61
+ agent: { type: 'address' },
62
+ agentReputation: { type: 'number' },
63
+ proposalId: { type: 'string' },
64
+ title: { type: 'string' },
65
+ description: { type: 'string' },
66
+ actionType: { type: 'string' },
67
+ payload: { type: 'object' },
81
68
  },
82
69
  },
83
70
  vote: {
84
- description: "Cast a vote (requires >= voteThreshold, no double-vote, within window)",
85
- required: ["vote", "agentReputation"],
71
+ description: 'Cast a vote (requires >= voteThreshold, no double-vote, within window)',
72
+ required: ['vote', 'agentReputation'],
86
73
  properties: {
87
- agent: { type: "address" },
88
- agentReputation: { type: "number" },
89
- vote: { type: "string", description: '"for" | "against" | "abstain"' },
74
+ agent: { type: 'address' },
75
+ agentReputation: { type: 'number' },
76
+ vote: { type: 'string', description: '"for" | "against" | "abstain"' },
90
77
  },
91
78
  },
92
79
  execute: {
93
- description: "Execute a passing proposal after voting ends",
80
+ description: 'Execute a passing proposal after voting ends',
94
81
  properties: {},
95
82
  },
96
83
  reject: {
97
- description: "Formally reject a failed proposal",
84
+ description: 'Formally reject a failed proposal',
98
85
  properties: {},
99
86
  },
100
87
  join: {
101
- description: "Join the DAO (requires >= memberThreshold reputation)",
102
- required: ["agentReputation"],
88
+ description: 'Join the DAO (requires >= memberThreshold reputation)',
89
+ required: ['agentReputation'],
103
90
  properties: {
104
- agent: { type: "address" },
105
- agentReputation: { type: "number" },
91
+ agent: { type: 'address' },
92
+ agentReputation: { type: 'number' },
106
93
  },
107
94
  },
108
95
  leave: {
109
- description: "Leave the DAO voluntarily",
96
+ description: 'Leave the DAO voluntarily',
110
97
  properties: {
111
- agent: { type: "address" },
98
+ agent: { type: 'address' },
112
99
  },
113
100
  },
114
101
  propose_threshold_change: {
115
- description: "Propose changing reputation thresholds",
116
- required: ["proposalId", "agentReputation"],
102
+ description: 'Propose changing reputation thresholds',
103
+ required: ['proposalId', 'agentReputation'],
117
104
  properties: {
118
- agent: { type: "address" },
119
- agentReputation: { type: "number" },
120
- proposalId: { type: "string" },
121
- memberThreshold: { type: "number" },
122
- voteThreshold: { type: "number" },
123
- proposeThreshold: { type: "number" },
105
+ agent: { type: 'address' },
106
+ agentReputation: { type: 'number' },
107
+ proposalId: { type: 'string' },
108
+ memberThreshold: { type: 'number' },
109
+ voteThreshold: { type: 'number' },
110
+ proposeThreshold: { type: 'number' },
124
111
  },
125
112
  },
126
113
  },
127
114
  states: {
128
115
  ACTIVE: {
129
- id: "ACTIVE",
116
+ id: 'ACTIVE',
130
117
  isFinal: false,
131
118
  metadata: {
132
- label: "Active",
133
- description: "DAO is idle and ready to accept a proposal",
134
- category: "initial",
119
+ label: 'Active',
120
+ description: 'DAO is idle and ready to accept a proposal',
121
+ category: 'initial',
135
122
  },
136
123
  },
137
124
  VOTING: {
138
- id: "VOTING",
125
+ id: 'VOTING',
139
126
  isFinal: false,
140
127
  metadata: {
141
- label: "Voting",
142
- description: "Members vote with reputation-weighted power",
143
- category: "pending",
128
+ label: 'Voting',
129
+ description: 'Members vote with reputation-weighted power',
130
+ category: 'pending',
144
131
  },
145
132
  },
146
133
  DISSOLVED: {
147
- id: "DISSOLVED",
134
+ id: 'DISSOLVED',
148
135
  isFinal: true,
149
136
  metadata: {
150
- label: "Dissolved",
151
- description: "Reputation DAO dissolved (terminal)",
152
- category: "terminal",
137
+ label: 'Dissolved',
138
+ description: 'Reputation DAO dissolved (terminal)',
139
+ category: 'terminal',
153
140
  },
154
141
  },
155
142
  },
156
- initialState: "ACTIVE",
143
+ initialState: 'ACTIVE',
157
144
  transitions: [
158
145
  // ACTIVE → VOTING: propose (reputation check)
159
146
  {
160
- from: "ACTIVE",
161
- to: "VOTING",
162
- eventName: "propose",
147
+ from: 'ACTIVE',
148
+ to: 'VOTING',
149
+ eventName: 'propose',
163
150
  guard: {
164
- ">=": [
165
- { var: "event.agentReputation" },
166
- { var: "state.proposeThreshold" },
167
- ],
151
+ '>=': [{ var: 'event.agentReputation' }, { var: 'state.proposeThreshold' }],
168
152
  },
169
153
  effect: {
170
154
  merge: [
171
- { var: "state" },
155
+ { var: 'state' },
172
156
  {
173
157
  proposal: {
174
- id: { var: "event.proposalId" },
175
- title: { var: "event.title" },
176
- description: { var: "event.description" },
177
- actionType: { var: "event.actionType" },
178
- payload: { var: "event.payload" },
179
- proposer: { var: "event.agent" },
180
- proposedAt: { var: "$ordinal" },
158
+ id: { var: 'event.proposalId' },
159
+ title: { var: 'event.title' },
160
+ description: { var: 'event.description' },
161
+ actionType: { var: 'event.actionType' },
162
+ payload: { var: 'event.payload' },
163
+ proposer: { var: 'event.agent' },
164
+ proposedAt: { var: '$ordinal' },
181
165
  deadline: {
182
- "+": [{ var: "$ordinal" }, { var: "state.votingPeriodMs" }],
166
+ '+': [{ var: '$ordinal' }, { var: 'state.votingPeriodMs' }],
183
167
  },
184
168
  },
185
169
  votes: { for: [], against: [], abstain: [] },
@@ -190,66 +174,54 @@ export const daoReputationDef = defineFiberApp({
190
174
  },
191
175
  // VOTING → VOTING: vote (reputation check, no double-vote, within window)
192
176
  {
193
- from: "VOTING",
194
- to: "VOTING",
195
- eventName: "vote",
177
+ from: 'VOTING',
178
+ to: 'VOTING',
179
+ eventName: 'vote',
196
180
  guard: {
197
181
  and: [
198
182
  {
199
- ">=": [
200
- { var: "event.agentReputation" },
201
- { var: "state.voteThreshold" },
202
- ],
183
+ '>=': [{ var: 'event.agentReputation' }, { var: 'state.voteThreshold' }],
203
184
  },
204
- { "!": [signerInSet("state.votes.for")] },
205
- { "!": [signerInSet("state.votes.against")] },
206
- { "!": [signerInSet("state.votes.abstain")] },
207
- { "<=": [{ var: "$ordinal" }, { var: "state.proposal.deadline" }] },
185
+ { '!': [signerInSet('state.votes.for')] },
186
+ { '!': [signerInSet('state.votes.against')] },
187
+ { '!': [signerInSet('state.votes.abstain')] },
188
+ { '<=': [{ var: '$ordinal' }, { var: 'state.proposal.deadline' }] },
208
189
  ],
209
190
  },
210
191
  effect: {
211
192
  merge: [
212
- { var: "state" },
193
+ { var: 'state' },
213
194
  {
214
195
  votes: {
215
196
  if: [
216
- { "===": [{ var: "event.vote" }, "for"] },
197
+ { '===': [{ var: 'event.vote' }, 'for'] },
217
198
  {
218
199
  merge: [
219
- { var: "state.votes" },
200
+ { var: 'state.votes' },
220
201
  {
221
202
  for: {
222
- cat: [
223
- { var: "state.votes.for" },
224
- [{ var: "event.agent" }],
225
- ],
203
+ cat: [{ var: 'state.votes.for' }, [{ var: 'event.agent' }]],
226
204
  },
227
205
  },
228
206
  ],
229
207
  },
230
- { "===": [{ var: "event.vote" }, "against"] },
208
+ { '===': [{ var: 'event.vote' }, 'against'] },
231
209
  {
232
210
  merge: [
233
- { var: "state.votes" },
211
+ { var: 'state.votes' },
234
212
  {
235
213
  against: {
236
- cat: [
237
- { var: "state.votes.against" },
238
- [{ var: "event.agent" }],
239
- ],
214
+ cat: [{ var: 'state.votes.against' }, [{ var: 'event.agent' }]],
240
215
  },
241
216
  },
242
217
  ],
243
218
  },
244
219
  {
245
220
  merge: [
246
- { var: "state.votes" },
221
+ { var: 'state.votes' },
247
222
  {
248
223
  abstain: {
249
- cat: [
250
- { var: "state.votes.abstain" },
251
- [{ var: "event.agent" }],
252
- ],
224
+ cat: [{ var: 'state.votes.abstain' }, [{ var: 'event.agent' }]],
253
225
  },
254
226
  },
255
227
  ],
@@ -263,46 +235,40 @@ export const daoReputationDef = defineFiberApp({
263
235
  },
264
236
  // VOTING → ACTIVE: execute (voting ended, for > against, quorum met)
265
237
  {
266
- from: "VOTING",
267
- to: "ACTIVE",
268
- eventName: "execute",
238
+ from: 'VOTING',
239
+ to: 'ACTIVE',
240
+ eventName: 'execute',
269
241
  // A2 fix: votes.for/against/abstain are arrays of voter addresses; count with
270
242
  // `length` (size is not a JLVM opcode).
271
243
  guard: {
272
244
  and: [
273
- { ">": [{ var: "$ordinal" }, { var: "state.proposal.deadline" }] },
245
+ { '>': [{ var: '$ordinal' }, { var: 'state.proposal.deadline' }] },
274
246
  {
275
- ">": [
276
- { length: [{ var: "state.votes.for" }] },
277
- { length: [{ var: "state.votes.against" }] },
278
- ],
247
+ '>': [{ length: [{ var: 'state.votes.for' }] }, { length: [{ var: 'state.votes.against' }] }],
279
248
  },
280
249
  {
281
- ">=": [
250
+ '>=': [
282
251
  {
283
- "+": [
284
- { length: [{ var: "state.votes.for" }] },
285
- { length: [{ var: "state.votes.against" }] },
286
- ],
252
+ '+': [{ length: [{ var: 'state.votes.for' }] }, { length: [{ var: 'state.votes.against' }] }],
287
253
  },
288
- { var: "state.quorum" },
254
+ { var: 'state.quorum' },
289
255
  ],
290
256
  },
291
257
  ],
292
258
  },
293
259
  effect: {
294
260
  merge: [
295
- { var: "state" },
261
+ { var: 'state' },
296
262
  {
297
263
  history: {
298
264
  cat: [
299
- { var: "state.history" },
265
+ { var: 'state.history' },
300
266
  [
301
267
  {
302
- type: "executed",
303
- proposal: { var: "state.proposal" },
304
- votes: { var: "state.votes" },
305
- at: { var: "$ordinal" },
268
+ type: 'executed',
269
+ proposal: { var: 'state.proposal' },
270
+ votes: { var: 'state.votes' },
271
+ at: { var: '$ordinal' },
306
272
  },
307
273
  ],
308
274
  ],
@@ -313,9 +279,9 @@ export const daoReputationDef = defineFiberApp({
313
279
  // under the reserved `_emit` key (extracted as an EmittedEvent, stripped from state).
314
280
  _emit: [
315
281
  {
316
- name: "proposal_executed",
317
- data: { action: "increase", agents: { var: "state.votes.for" } },
318
- destination: "Reputation",
282
+ name: 'proposal_executed',
283
+ data: { action: 'increase', agents: { var: 'state.votes.for' } },
284
+ destination: 'Reputation',
319
285
  },
320
286
  ],
321
287
  },
@@ -325,31 +291,25 @@ export const daoReputationDef = defineFiberApp({
325
291
  },
326
292
  // VOTING → ACTIVE: reject (voting ended, for <= against or quorum not met)
327
293
  {
328
- from: "VOTING",
329
- to: "ACTIVE",
330
- eventName: "reject",
294
+ from: 'VOTING',
295
+ to: 'ACTIVE',
296
+ eventName: 'reject',
331
297
  // A2 fix: count the array-shaped vote tallies with `length` (size is not a JLVM
332
298
  // opcode).
333
299
  guard: {
334
300
  and: [
335
- { ">": [{ var: "$ordinal" }, { var: "state.proposal.deadline" }] },
301
+ { '>': [{ var: '$ordinal' }, { var: 'state.proposal.deadline' }] },
336
302
  {
337
303
  or: [
338
304
  {
339
- "<=": [
340
- { length: [{ var: "state.votes.for" }] },
341
- { length: [{ var: "state.votes.against" }] },
342
- ],
305
+ '<=': [{ length: [{ var: 'state.votes.for' }] }, { length: [{ var: 'state.votes.against' }] }],
343
306
  },
344
307
  {
345
- "<": [
308
+ '<': [
346
309
  {
347
- "+": [
348
- { length: [{ var: "state.votes.for" }] },
349
- { length: [{ var: "state.votes.against" }] },
350
- ],
310
+ '+': [{ length: [{ var: 'state.votes.for' }] }, { length: [{ var: 'state.votes.against' }] }],
351
311
  },
352
- { var: "state.quorum" },
312
+ { var: 'state.quorum' },
353
313
  ],
354
314
  },
355
315
  ],
@@ -358,17 +318,17 @@ export const daoReputationDef = defineFiberApp({
358
318
  },
359
319
  effect: {
360
320
  merge: [
361
- { var: "state" },
321
+ { var: 'state' },
362
322
  {
363
323
  history: {
364
324
  cat: [
365
- { var: "state.history" },
325
+ { var: 'state.history' },
366
326
  [
367
327
  {
368
- type: "rejected",
369
- proposal: { var: "state.proposal" },
370
- votes: { var: "state.votes" },
371
- at: { var: "$ordinal" },
328
+ type: 'rejected',
329
+ proposal: { var: 'state.proposal' },
330
+ votes: { var: 'state.votes' },
331
+ at: { var: '$ordinal' },
372
332
  },
373
333
  ],
374
334
  ],
@@ -382,9 +342,9 @@ export const daoReputationDef = defineFiberApp({
382
342
  },
383
343
  // ACTIVE → ACTIVE: join (reputation check, not already member)
384
344
  {
385
- from: "ACTIVE",
386
- to: "ACTIVE",
387
- eventName: "join",
345
+ from: 'ACTIVE',
346
+ to: 'ACTIVE',
347
+ eventName: 'join',
388
348
  // S1/A2: bind event.agent to a verified signer (actorIsSigner) so the member is appended to the
389
349
  // array and keyed into memberJoinedAt under a CHAIN-VERIFIED address (set is the rc.5 map-write
390
350
  // opcode), and dedup on that bound actor.
@@ -397,27 +357,20 @@ export const daoReputationDef = defineFiberApp({
397
357
  and: [
398
358
  actorIsSigner(),
399
359
  {
400
- ">=": [
401
- { var: "event.agentReputation" },
402
- { var: "state.memberThreshold" },
403
- ],
360
+ '>=': [{ var: 'event.agentReputation' }, { var: 'state.memberThreshold' }],
404
361
  },
405
- { "!": [{ in: [{ var: "event.agent" }, { var: "state.members" }] }] },
362
+ { '!': [{ in: [{ var: 'event.agent' }, { var: 'state.members' }] }] },
406
363
  ],
407
364
  },
408
365
  effect: {
409
366
  merge: [
410
- { var: "state" },
367
+ { var: 'state' },
411
368
  {
412
369
  members: {
413
- cat: [{ var: "state.members" }, [{ var: "event.agent" }]],
370
+ cat: [{ var: 'state.members' }, [{ var: 'event.agent' }]],
414
371
  },
415
372
  memberJoinedAt: {
416
- set: [
417
- { var: "state.memberJoinedAt" },
418
- { var: "event.agent" },
419
- { var: "$ordinal" },
420
- ],
373
+ set: [{ var: 'state.memberJoinedAt' }, { var: 'event.agent' }, { var: '$ordinal' }],
421
374
  },
422
375
  },
423
376
  ],
@@ -426,19 +379,16 @@ export const daoReputationDef = defineFiberApp({
426
379
  },
427
380
  // ACTIVE → ACTIVE: leave (member only)
428
381
  {
429
- from: "ACTIVE",
430
- to: "ACTIVE",
431
- eventName: "leave",
432
- guard: signerInSet("state.members"),
382
+ from: 'ACTIVE',
383
+ to: 'ACTIVE',
384
+ eventName: 'leave',
385
+ guard: signerInSet('state.members'),
433
386
  effect: {
434
387
  merge: [
435
- { var: "state" },
388
+ { var: 'state' },
436
389
  {
437
390
  members: {
438
- filter: [
439
- { var: "state.members" },
440
- { "!==": [{ var: "" }, { var: "event.agent" }] },
441
- ],
391
+ filter: [{ var: 'state.members' }, { '!==': [{ var: '' }, { var: 'event.agent' }] }],
442
392
  },
443
393
  },
444
394
  ],
@@ -447,32 +397,29 @@ export const daoReputationDef = defineFiberApp({
447
397
  },
448
398
  // ACTIVE → VOTING: propose_threshold_change
449
399
  {
450
- from: "ACTIVE",
451
- to: "VOTING",
452
- eventName: "propose_threshold_change",
400
+ from: 'ACTIVE',
401
+ to: 'VOTING',
402
+ eventName: 'propose_threshold_change',
453
403
  guard: {
454
- ">=": [
455
- { var: "event.agentReputation" },
456
- { var: "state.proposeThreshold" },
457
- ],
404
+ '>=': [{ var: 'event.agentReputation' }, { var: 'state.proposeThreshold' }],
458
405
  },
459
406
  effect: {
460
407
  merge: [
461
- { var: "state" },
408
+ { var: 'state' },
462
409
  {
463
410
  proposal: {
464
- id: { var: "event.proposalId" },
465
- title: "Threshold Change",
466
- actionType: "threshold_change",
411
+ id: { var: 'event.proposalId' },
412
+ title: 'Threshold Change',
413
+ actionType: 'threshold_change',
467
414
  payload: {
468
- memberThreshold: { var: "event.memberThreshold" },
469
- voteThreshold: { var: "event.voteThreshold" },
470
- proposeThreshold: { var: "event.proposeThreshold" },
415
+ memberThreshold: { var: 'event.memberThreshold' },
416
+ voteThreshold: { var: 'event.voteThreshold' },
417
+ proposeThreshold: { var: 'event.proposeThreshold' },
471
418
  },
472
- proposer: { var: "event.agent" },
473
- proposedAt: { var: "$ordinal" },
419
+ proposer: { var: 'event.agent' },
420
+ proposedAt: { var: '$ordinal' },
474
421
  deadline: {
475
- "+": [{ var: "$ordinal" }, { var: "state.votingPeriodMs" }],
422
+ '+': [{ var: '$ordinal' }, { var: 'state.votingPeriodMs' }],
476
423
  },
477
424
  },
478
425
  votes: { for: [], against: [], abstain: [] },