@agoric/governance 0.10.4-dev-fa844b5.0 → 0.10.4-dev-21fe8d9.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 (81) hide show
  1. package/exported.d.ts +37 -0
  2. package/exported.js +1 -1
  3. package/package.json +15 -14
  4. package/src/binaryVoteCounter.d.ts +19 -0
  5. package/src/binaryVoteCounter.d.ts.map +1 -0
  6. package/src/binaryVoteCounter.js +4 -0
  7. package/src/breakTie.d.ts +3 -0
  8. package/src/breakTie.d.ts.map +1 -0
  9. package/src/breakTie.js +4 -0
  10. package/src/closingRule.d.ts +7 -0
  11. package/src/closingRule.d.ts.map +1 -0
  12. package/src/closingRule.js +4 -0
  13. package/src/committee.d.ts +27 -0
  14. package/src/committee.d.ts.map +1 -0
  15. package/src/committee.js +4 -0
  16. package/src/constants.d.ts +16 -0
  17. package/src/constants.d.ts.map +1 -0
  18. package/src/contractGovernance/assertions.d.ts +7 -0
  19. package/src/contractGovernance/assertions.d.ts.map +1 -0
  20. package/src/contractGovernance/governApi.d.ts +32 -0
  21. package/src/contractGovernance/governApi.d.ts.map +1 -0
  22. package/src/contractGovernance/governApi.js +4 -0
  23. package/src/contractGovernance/governFilter.d.ts +31 -0
  24. package/src/contractGovernance/governFilter.d.ts.map +1 -0
  25. package/src/contractGovernance/governFilter.js +4 -0
  26. package/src/contractGovernance/governParam.d.ts +39 -0
  27. package/src/contractGovernance/governParam.d.ts.map +1 -0
  28. package/src/contractGovernance/governParam.js +3 -0
  29. package/src/contractGovernance/paramManager.d.ts +49 -0
  30. package/src/contractGovernance/paramManager.d.ts.map +1 -0
  31. package/src/contractGovernance/paramManager.js +5 -1
  32. package/src/contractGovernance/typedParamManager.d.ts +38 -0
  33. package/src/contractGovernance/typedParamManager.d.ts.map +1 -0
  34. package/src/contractGovernance/typedParamManager.js +5 -0
  35. package/src/contractGovernor.d.ts +29 -0
  36. package/src/contractGovernor.d.ts.map +1 -0
  37. package/src/contractGovernor.js +4 -0
  38. package/src/contractGovernorKit.d.ts +46 -0
  39. package/src/contractGovernorKit.d.ts.map +1 -0
  40. package/src/contractGovernorKit.js +4 -0
  41. package/src/contractHelper.d.ts +121 -0
  42. package/src/contractHelper.d.ts.map +1 -0
  43. package/src/contractHelper.js +4 -0
  44. package/src/electorateTools.d.ts +50 -0
  45. package/src/electorateTools.d.ts.map +1 -0
  46. package/src/electorateTools.js +4 -0
  47. package/src/index.d.ts +9 -0
  48. package/src/index.d.ts.map +1 -0
  49. package/src/index.js +5 -3
  50. package/src/multiCandidateVoteCounter.d.ts +19 -0
  51. package/src/multiCandidateVoteCounter.d.ts.map +1 -0
  52. package/src/multiCandidateVoteCounter.js +4 -0
  53. package/src/noActionElectorate.d.ts +13 -0
  54. package/src/noActionElectorate.d.ts.map +1 -0
  55. package/src/noActionElectorate.js +4 -0
  56. package/src/question.d.ts +31 -0
  57. package/src/question.d.ts.map +1 -0
  58. package/src/question.js +4 -0
  59. package/src/quorumCounter.d.ts +6 -0
  60. package/src/quorumCounter.d.ts.map +1 -0
  61. package/src/quorumCounter.js +4 -0
  62. package/src/typeGuards.d.ts +210 -0
  63. package/src/typeGuards.d.ts.map +1 -0
  64. package/src/types.d.ts +562 -0
  65. package/src/types.d.ts.map +1 -0
  66. package/src/types.js +2 -1
  67. package/src/validators.d.ts +21 -0
  68. package/src/validators.d.ts.map +1 -0
  69. package/src/validators.js +4 -0
  70. package/src/voterKit.d.ts +14 -0
  71. package/src/voterKit.d.ts.map +1 -0
  72. package/src/voterKit.js +4 -0
  73. package/tools/puppetContractGovernor.d.ts +53 -0
  74. package/tools/puppetContractGovernor.d.ts.map +1 -0
  75. package/tools/puppetContractGovernor.js +4 -2
  76. package/tools/puppetGovernance.d.ts +102 -0
  77. package/tools/puppetGovernance.d.ts.map +1 -0
  78. package/tools/puppetGovernance.js +4 -0
  79. package/tools/storageDoc.d.ts +10 -0
  80. package/tools/storageDoc.d.ts.map +1 -0
  81. package/src/types-ambient.js +0 -731
package/src/types.d.ts ADDED
@@ -0,0 +1,562 @@
1
+ /**
2
+ * * UNRANKED: "unranked voting" means that the voter specifies some number of
3
+ * positions, and is endorsing them equally.
4
+ * * ORDER: The voter assigns ordinal numbers to some of the positions. The
5
+ * positions will be treated as an ordered list with no gaps.
6
+ *
7
+ * When voters are limited to choosing a single candidate, either UNRANKED or
8
+ * ORDER would work. UNRANKED has a simpler representation so we use that.
9
+ */
10
+ export type ChoiceMethod = 'unranked' | 'order' | 'plurality';
11
+ /**
12
+ * param_change is very specific. Survey means multiple answers are possible,
13
+ * Election means some candidates are going to "win". It's not clear these are
14
+ * orthogonal. The important distinction is that param_change has a structured
15
+ * issue, while the others have a issue presented as a string.
16
+ */
17
+ export type ElectionType = 'param_change' | 'election' | 'survey' | 'api_invocation' | 'offer_filter';
18
+ export type QuorumRule = 'majority' | 'all' | 'no_quorum';
19
+ export type SimpleIssue = {
20
+ text: string;
21
+ };
22
+ export type ParamValue = Amount | Brand | Installation | Instance | bigint | Ratio | string | import('@agoric/time').TimestampRecord | import('@agoric/time').RelativeTimeRecord | unknown;
23
+ export type ParamValueForType<T extends ParamType> = T extends 'amount' ? Amount<any> : T extends 'brand' ? Brand : T extends 'installation' ? Installation : T extends 'instance' ? Instance : T extends 'invitation' ? Amount<'set'> : T extends 'nat' ? bigint : T extends 'ratio' ? Ratio : T extends 'string' ? string : T extends 'timestamp' ? import('@agoric/time').Timestamp : T extends 'relativeTime' ? import('@agoric/time').RelativeTime : T extends 'unknown' ? unknown : never;
24
+ /**
25
+ * <T>
26
+ */
27
+ export type ParamValueTyped<T extends ParamType = ParamType> = {
28
+ type: T;
29
+ value: ParamValueForType<T>;
30
+ };
31
+ /**
32
+ * <T>
33
+ */
34
+ export type GovernanceTerms<T extends import("./contractGovernance/typedParamManager.js").ParamTypesMap> = {
35
+ electionManager: import('@agoric/zoe/src/zoeService/utils.js').Instance<typeof import("./contractGovernor.js")['start']>;
36
+ governedParams: import('./contractGovernance/typedParamManager.js').ParamRecordsFromTypes<T & {
37
+ Electorate: 'invitation';
38
+ }>;
39
+ };
40
+ export type Issue = SimpleIssue | ParamChangeIssue<unknown> | ApiInvocationIssue | OfferFilterIssue;
41
+ /**
42
+ * - QuestionSpec plus the Electorate Instance and
43
+ * a numerical threshold for the quorum. (The voteCounter doesn't know the
44
+ * size of the electorate, so the Electorate has to say what limit to enforce.)
45
+ */
46
+ export type QuestionTerms = {
47
+ questionSpec: QuestionSpec;
48
+ quorumThreshold: number;
49
+ electorate: Instance;
50
+ };
51
+ export type TextPosition = {
52
+ text: string;
53
+ };
54
+ export type Position = TextPosition | ChangeParamsPosition | NoChangeParamsPosition | InvokeApiPosition | DontInvokeApiPosition | OfferFilterPosition | NoChangeOfferFilterPosition | InvokeApiPosition;
55
+ export type OutcomeRecord = {
56
+ question: Handle<'Question'>;
57
+ } & ({
58
+ outcome: 'win';
59
+ position: Position;
60
+ } | {
61
+ outcome: 'fail';
62
+ reason: 'No quorum';
63
+ });
64
+ export type MultiOutcomeRecord = {
65
+ question: Handle<'Question'>;
66
+ } & ({
67
+ outcome: 'win';
68
+ positions: Position[];
69
+ } | {
70
+ outcome: 'fail';
71
+ reason: 'No quorum';
72
+ });
73
+ /**
74
+ * Specification when requesting creation of a Question
75
+ */
76
+ export type QuestionSpec<I extends Issue = Issue> = {
77
+ method: ChoiceMethod;
78
+ issue: I;
79
+ positions: Position[];
80
+ electionType: ElectionType;
81
+ maxChoices: number;
82
+ maxWinners: number;
83
+ closingRule: ClosingRule;
84
+ quorumRule: QuorumRule;
85
+ tieOutcome: Position;
86
+ };
87
+ export type QuestionDetailsExtraProperties = {
88
+ /**
89
+ * - instance of the VoteCounter
90
+ */
91
+ counterInstance: Instance;
92
+ questionHandle: Handle<'Question'>;
93
+ };
94
+ /**
95
+ * complete question details: questionSpec plus counter and questionHandle
96
+ */
97
+ export type QuestionDetails = QuestionSpec & QuestionDetailsExtraProperties;
98
+ export type GovernancePair = {
99
+ governor: Instance;
100
+ governed: Instance;
101
+ };
102
+ export type Question = {
103
+ getVoteCounter: () => Instance;
104
+ getDetails: () => QuestionDetails;
105
+ };
106
+ export type CompleteUnrankedQuestion = {
107
+ questionHandle: Handle<'Question'>;
108
+ /**
109
+ * - a list of equal-weight preferred positions
110
+ */
111
+ chosen: Position[];
112
+ };
113
+ export type CompleteWeightedBallot = {
114
+ questionHandle: Handle<'Question'>;
115
+ /**
116
+ * - list of positions with
117
+ * weights. VoteCounter may limit weights to a range or require uniqueness.
118
+ */
119
+ weighted: [Position, bigint][];
120
+ };
121
+ export type CompleteOrderedBallot = {
122
+ questionHandle: Handle<'Question'>;
123
+ /**
124
+ * - ordered list of position from most preferred
125
+ * to least preferred
126
+ */
127
+ ordered: Position[];
128
+ };
129
+ export type PositionCount = {
130
+ position: Position;
131
+ total: bigint;
132
+ };
133
+ export type VoteStatistics = {
134
+ spoiled: bigint;
135
+ votes: number;
136
+ results: PositionCount[];
137
+ };
138
+ export type QuorumCounter = {
139
+ check: (stats: VoteStatistics) => boolean;
140
+ };
141
+ export type BuildQuestion = (questionSpec: QuestionSpec, instance: Instance) => Question;
142
+ /**
143
+ * - a facet that the Electorate should
144
+ * hold tightly. submitVote() is the core capability that allows the holder to
145
+ * specify the identity and choice of a voter. The voteCounter is making that
146
+ * available to the Electorate, which should wrap and attenuate it so each
147
+ * voter gets only the ability to cast their own vote at a weight specified by
148
+ * the electorate.
149
+ */
150
+ export type VoteCounterCreatorFacet = {
151
+ submitVote: SubmitVote;
152
+ };
153
+ export type VoteCounterPublicFacet = {
154
+ isOpen: () => boolean;
155
+ getQuestion: () => Question;
156
+ getOutcome: () => Promise<Position>;
157
+ getDetails: () => QuestionDetails;
158
+ getStats: () => Promise<VoteStatistics>;
159
+ };
160
+ export type MultiVoteCounterPublicFacet = {
161
+ isOpen: () => boolean;
162
+ getQuestion: () => Question;
163
+ getOutcome: () => Promise<Position[]>;
164
+ getDetails: () => QuestionDetails;
165
+ getStats: () => Promise<VoteStatistics>;
166
+ };
167
+ /**
168
+ * TEST ONLY: Should not be allowed to escape from contracts
169
+ */
170
+ export type VoteCounterCloseFacet = {
171
+ closeVoting: () => void;
172
+ };
173
+ export type VoteCounterFacets = {
174
+ publicFacet: VoteCounterPublicFacet;
175
+ creatorFacet: VoteCounterCreatorFacet;
176
+ closeFacet: VoteCounterCloseFacet;
177
+ };
178
+ export type MultiVoteCounterFacets = {
179
+ publicFacet: MultiVoteCounterPublicFacet;
180
+ creatorFacet: VoteCounterCreatorFacet;
181
+ closeFacet: VoteCounterCloseFacet;
182
+ };
183
+ export type BuildVoteCounter = (questionSpec: QuestionSpec, threshold: bigint, instance: Instance, publisher: ERef<Publisher<OutcomeRecord>>) => VoteCounterFacets;
184
+ export type BuildMultiVoteCounter = (questionSpec: QuestionSpec, threshold: bigint, instance: Instance, publisher: ERef<Publisher<MultiOutcomeRecord>>) => MultiVoteCounterFacets;
185
+ export type CompletedBallet = {
186
+ chosen: Position;
187
+ shares: bigint;
188
+ };
189
+ export type SubmitVote = (voterHandle: Handle<'Voter'>, chosenPositions: Position[], weight?: bigint | undefined) => CompletedBallet;
190
+ export type GetOpenQuestions = () => Promise<Handle<'Question'>[]>;
191
+ export type GetQuestion = (h: Handle<'Question'>) => Promise<Question>;
192
+ export type ElectoratePublic = {
193
+ getQuestionSubscriber: () => Subscriber<QuestionDetails>;
194
+ /**
195
+ * ,
196
+ */
197
+ getOpenQuestions: GetOpenQuestions;
198
+ getInstance: () => Instance;
199
+ getQuestion: GetQuestion;
200
+ };
201
+ export type ClaimsElectoratePublic = ElectoratePublic & {
202
+ makeVoterInvitation: () => ERef<Invitation<unknown, undefined>>;
203
+ };
204
+ export type CommitteeElectoratePublic = ElectoratePublic & {
205
+ getName: () => string;
206
+ };
207
+ export type PoserFacet = {
208
+ addQuestion: AddQuestion;
209
+ };
210
+ export type ElectorateCreatorFacet = {
211
+ /**
212
+ * can be used directly when the creator doesn't need any
213
+ * reassurance. When someone needs to connect addQuestion to the Electorate
214
+ * instance, getPoserInvitation() lets them get addQuestion with assurance.
215
+ */
216
+ addQuestion: AddQuestion;
217
+ getPoserInvitation: () => Promise<Invitation>;
218
+ getQuestionSubscriber: () => Subscriber<QuestionDetails>;
219
+ getPublicFacet: () => ElectoratePublic;
220
+ };
221
+ export type GetVoterInvitations = {
222
+ getVoterInvitations: () => Invitation[];
223
+ };
224
+ /**
225
+ * - a facet that the Electorate should hold
226
+ * tightly. It allows specification of the vote's weight, so the Electorate
227
+ * should distribute an attenuated wrapper that doesn't make that available!
228
+ */
229
+ export type VoterFacet = {
230
+ submitVote: SubmitVote;
231
+ };
232
+ export type ClosingRule = {
233
+ timer: ERef<import("@agoric/time").TimerService>;
234
+ deadline: import('@agoric/time').Timestamp;
235
+ };
236
+ export type CloseVoting = (closingRule: ClosingRule, closeVoting: () => void) => any;
237
+ export type AddQuestionReturn = {
238
+ publicFacet: VoteCounterPublicFacet;
239
+ creatorFacet: VoteCounterCreatorFacet;
240
+ instance: import('@agoric/zoe/src/zoeService/utils.js').Instance<typeof import('./binaryVoteCounter.js').start>;
241
+ deadline: import('@agoric/time').Timestamp;
242
+ questionHandle: Handle<'Question'>;
243
+ };
244
+ export type AddQuestion = (voteCounter: ERef<Installation<any>>, questionSpec: QuestionSpec) => Promise<AddQuestionReturn>;
245
+ export type CreateQuestion = (name: string, proposedValue: ParamValue, voteCounterInstallation: Installation, contractInstance: Instance, closingRule: ClosingRule) => Promise<QuestionDetails>;
246
+ export type ParamChangeIssue<P = StandardParamPath> = {
247
+ spec: ParamChangesSpec<P>;
248
+ contract: import('@agoric/zoe/src/zoeService/utils.js').Instance<(zcf: ZCF<GovernanceTerms<{}>>) => {}>;
249
+ };
250
+ export type ApiInvocationIssue = {
251
+ apiMethodName: string;
252
+ methodArgs: unknown[];
253
+ };
254
+ export type OfferFilterIssue = {
255
+ strings: string[];
256
+ };
257
+ export type ParamChangePositions = {
258
+ positive: ChangeParamsPosition;
259
+ negative: NoChangeParamsPosition;
260
+ };
261
+ /**
262
+ * details for a question that can change a contract parameter
263
+ */
264
+ export type ParamChangeIssueDetails = {
265
+ method: ChoiceMethod;
266
+ issue: ParamChangeIssue<unknown>;
267
+ positions: ParamChangePositions;
268
+ electionType: ElectionType;
269
+ maxChoices: number;
270
+ closingRule: ClosingRule;
271
+ quorumRule: QuorumRule;
272
+ tieOutcome: NoChangeParamsPosition;
273
+ /**
274
+ * - instance of the VoteCounter
275
+ */
276
+ counterInstance: Instance;
277
+ questionHandle: Handle<'Question'>;
278
+ };
279
+ /**
280
+ * a Record containing
281
+ * keyword pairs with descriptions of parameters under governance.
282
+ */
283
+ export type ParamStateRecord = Record<Keyword, ParamValueTyped>;
284
+ export type GovernanceSubscriptionState = {
285
+ current: ParamStateRecord;
286
+ };
287
+ /**
288
+ * The base paramManager with typed getters
289
+ */
290
+ export type ParamManagerBase = {
291
+ getParams: () => ERef<ParamStateRecord>;
292
+ getAmount: (name: string) => Amount;
293
+ getBrand: (name: string) => Brand;
294
+ getInstance: (name: string) => Instance;
295
+ getInstallation: (name: string) => Installation;
296
+ getInvitationAmount: (name: string) => Amount<'set'>;
297
+ getNat: (name: string) => bigint;
298
+ getRatio: (name: string) => Ratio;
299
+ getString: (name: string) => string;
300
+ getTimestamp: (name: string) => import('@agoric/time').TimestampRecord;
301
+ getRelativeTime: (name: string) => import('@agoric/time').RelativeTimeRecord;
302
+ getUnknown: (name: string) => any;
303
+ /**
304
+ * - for
305
+ * most types, the visible value is the same as proposedValue. For Invitations
306
+ * the visible value is the amount of the invitation.
307
+ */
308
+ getVisibleValue: (name: string, proposedValue: ParamValue) => ParamValue;
309
+ getInternalParamValue: (name: string) => Promise<Invitation>;
310
+ getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
311
+ };
312
+ export type UpdateParams = (paramChanges: Record<string, ParamValue>) => Promise<void>;
313
+ /**
314
+ * These are typed `any` because the builder pattern of paramManager makes it very
315
+ * complicated for the type system to know the set of param-specific functions
316
+ * returned by `.build()`. Instead we let paramManager create the desired methods
317
+ * and use typedParamManager to create a version that includes the static types.
318
+ */
319
+ export type ParamManagerGettersAndUpdaters = Record<string, any>;
320
+ /**
321
+ * These are typed `any` because the builder pattern of paramManager makes it very
322
+ * complicated for the type system to know the set of param-specific functions
323
+ * returned by `.build()`. Instead we let paramManager create the desired methods
324
+ * and use typedParamManager to create a version that includes the static types.
325
+ */
326
+ export type AnyParamManager = ParamManagerBase & ParamManagerGettersAndUpdaters & {
327
+ updateParams: UpdateParams;
328
+ };
329
+ export type ParameterNameList = Record<string, string[]>;
330
+ export type AssertParamManagerType = (type: ParamType, value: ParamValue, name: string) => any;
331
+ /**
332
+ * - ParamManager is a facility that governed
333
+ * contracts can use to manage their visible state in a way that allows the
334
+ * ContractGovernor to update values using governance. When paramManager is
335
+ * instantiated inside the contract, the contract has synchronous access to
336
+ * the values, and clients of the contract can verify that a ContractGovernor
337
+ * can change the values in a legible way.
338
+ */
339
+ export type BuildParamManager = (paramDescriptions: Iterable<ParamValueTyped>) => AnyParamManager;
340
+ export type ChangeParamsPosition = {
341
+ /**
342
+ * one or more changes to parameters
343
+ */
344
+ changes: Record<string, ParamValue>;
345
+ };
346
+ export type OfferFilterPosition = {
347
+ strings: string[];
348
+ };
349
+ export type NoChangeOfferFilterPosition = {
350
+ dontUpdate: string[];
351
+ };
352
+ export type InvokeApiPosition = {
353
+ apiMethodName: string;
354
+ methodArgs: unknown[];
355
+ };
356
+ export type DontInvokeApiPosition = {
357
+ dontInvoke: string;
358
+ };
359
+ export type NoChangeParamsPosition = {
360
+ /**
361
+ * Parameters in the proposal that this position
362
+ * is opposed to
363
+ */
364
+ noChange: string[];
365
+ };
366
+ export type Governor = {
367
+ createQuestion: CreateQuestion;
368
+ };
369
+ export type GovernedApis = {
370
+ [methodName: string]: (...args: any) => unknown;
371
+ };
372
+ export type GovernorPublic = {
373
+ getElectorate: () => Promise<Instance>;
374
+ getGovernedContract: () => Instance;
375
+ validateVoteCounter: (voteCounter: Instance) => Promise<void>;
376
+ validateElectorate: (regP: ERef<Instance>) => Promise<void>;
377
+ validateTimer: (closingRule: ClosingRule) => void;
378
+ };
379
+ /**
380
+ * identifier for a paramManager within a contract
381
+ */
382
+ export type ParamKey = {
383
+ key: unknown;
384
+ };
385
+ /**
386
+ * <P>
387
+ */
388
+ export type ParamChangesSpec<P> = {
389
+ paramPath: P;
390
+ /**
391
+ * one or more changes to parameters
392
+ */
393
+ changes: Record<string, ParamValue>;
394
+ };
395
+ export type ContractGovernanceVoteResult = {
396
+ /**
397
+ * - instance of the VoteCounter
398
+ */
399
+ instance: Instance;
400
+ details: ERef<QuestionDetails>;
401
+ /**
402
+ * - A promise for the result
403
+ * of updating the parameter value. Primarily useful for its behavior on
404
+ * rejection.
405
+ */
406
+ outcomeOfUpdate: Promise<ParamValue>;
407
+ };
408
+ export type GovernorCreatorFacet<SF extends GovernableStartFn> = {
409
+ voteOnParamChanges: VoteOnParamChanges;
410
+ voteOnApiInvocation: VoteOnApiInvocation;
411
+ voteOnOfferFilter: VoteOnOfferFilter;
412
+ /**
413
+ * facet of the governed contract,
414
+ * with creator-like powers but without the tightly held ability to change
415
+ * param values.
416
+ */
417
+ getCreatorFacet: () => LimitedCF<SF>;
418
+ replaceElectorate: (poserInvitation: Invitation) => Promise<void>;
419
+ getAdminFacet: () => AdminFacet;
420
+ /**
421
+ * - public facet of the governed contract
422
+ */
423
+ getPublicFacet: () => GovernedPublicFacet<Awaited<ReturnType<SF>>['publicFacet']>;
424
+ /**
425
+ * - instance of the governed
426
+ * contract
427
+ */
428
+ getInstance: () => Instance;
429
+ };
430
+ export type GovernedPublicFacetMethods = {
431
+ getSubscription: (key?: any) => StoredSubscription<GovernanceSubscriptionState>;
432
+ /**
433
+ * - get descriptions of
434
+ * all the governed parameters
435
+ */
436
+ getGovernedParams: (key?: any) => ERef<ParamStateRecord>;
437
+ getInvitationAmount: (name: string) => Amount;
438
+ };
439
+ export type GovernedPublicFacet<PF extends {}> = PF & GovernedPublicFacetMethods;
440
+ export type LimitedCF<SF extends GovernableStartFn> = ReturnType<Awaited<ReturnType<SF>>['creatorFacet']['getLimitedCreatorFacet']>;
441
+ /**
442
+ * What a governed contract must return as its creatorFacet in order to be governed
443
+ */
444
+ export type GovernedCreatorFacet<CF extends {}> = {
445
+ /**
446
+ * - allows accessing
447
+ * and updating governed parameters. Should only be directly accessible to the
448
+ * contractGovernor
449
+ */
450
+ getParamMgrRetriever: () => ParamManagerRetriever;
451
+ /**
452
+ * - the creator
453
+ * facet of the governed contract. Doesn't provide access to any governance
454
+ * functionality
455
+ */
456
+ getLimitedCreatorFacet: () => ERef<CF>;
457
+ getInvitation: (name: string) => Promise<Invitation>;
458
+ getGovernedApis: () => ERef<GovernedApis>;
459
+ getGovernedApiNames: () => (string | symbol)[];
460
+ setOfferFilter: (strings: string[]) => void;
461
+ };
462
+ export type StandardParamPath = {
463
+ key: string;
464
+ };
465
+ export type ParamManagerRetriever = {
466
+ get: (paramKey?: ParamKey) => AnyParamManager;
467
+ };
468
+ export type VoteOnParamChanges<P = StandardParamPath> = (voteCounterInstallation: Installation, deadline: import('@agoric/time').Timestamp, paramSpec: ParamChangesSpec<P>) => Promise<ContractGovernanceVoteResult>;
469
+ export type VoteOnApiInvocation = (apiMethodName: string, methodArgs: unknown[], voteCounterInstallation: Installation, deadline: import('@agoric/time').Timestamp) => Promise<ContractGovernanceVoteResult>;
470
+ export type VoteOnOfferFilter = (voteCounterInstallation: Installation, deadline: import('@agoric/time').Timestamp, strings: string[]) => Promise<ContractGovernanceVoteResult>;
471
+ export type ParamGovernor = {
472
+ voteOnParamChanges: VoteOnParamChanges;
473
+ createdQuestion: CreatedQuestion;
474
+ };
475
+ export type ApiGovernor = {
476
+ voteOnApiInvocation: VoteOnApiInvocation;
477
+ createdQuestion: CreatedQuestion;
478
+ };
479
+ export type FilterGovernor = {
480
+ voteOnFilter: VoteOnOfferFilter;
481
+ createdQuestion: CreatedQuestion;
482
+ };
483
+ /**
484
+ * Was this question created by this ContractGovernor?
485
+ */
486
+ export type CreatedQuestion = (questionInstance: Instance) => boolean;
487
+ export type PositionIncluded = (positions: Position[], position: Position) => boolean;
488
+ export type GovernedContractTerms = {
489
+ timer: import('@agoric/time').TimerService;
490
+ issuerKeywordRecord: IssuerKeywordRecord;
491
+ privateArgs: object;
492
+ };
493
+ export type AssertContractGovernance = (zoe: ERef<ZoeService>, allegedGoverned: import('@agoric/zoe/src/zoeService/utils.js').Instance<(zcf: ZCF<GovernanceTerms<{}>>) => {}>, allegedGovernor: Instance, contractGovernorInstallation: Installation<(<SF extends GovernableStartFn>(zcf: ZCF<{
494
+ timer: import("@agoric/time").TimerService;
495
+ governedContractInstallation: Installation<SF>;
496
+ governed: {
497
+ issuerKeywordRecord: IssuerKeywordRecord;
498
+ terms: {
499
+ governedParams: {
500
+ Electorate: import("./contractGovernance/typedParamManager.js").InvitationParam;
501
+ };
502
+ };
503
+ label?: string | undefined;
504
+ };
505
+ }>, privateArgs: {
506
+ governed: Record<string, unknown>;
507
+ }, baggage: import("@agoric/vat-data").Baggage) => Promise<{
508
+ creatorFacet: GovernorCreatorFacet<SF>;
509
+ publicFacet: GovernorPublic; /**
510
+ * @callback BuildQuestion
511
+ * @param {QuestionSpec} questionSpec
512
+ * @param {Instance} instance - voteCounter instance
513
+ * @returns {Question}
514
+ */
515
+ }>)>) => Promise<GovernancePair>;
516
+ /**
517
+ * - assert that the contract uses the
518
+ * electorate
519
+ */
520
+ export type AssertContractElectorate = (zoe: ERef<ZoeService>, allegedGovernor: Instance, allegedElectorate: Instance) => any;
521
+ export type GovernableStartFn = import("@agoric/zoe/src/zoeService/utils.js").ContractStartFunction & ((zcf?: any, pa?: any, baggage?: any) => ERef<{
522
+ creatorFacet: GovernedCreatorFacet<{}>;
523
+ publicFacet: GovernedPublicFacet<{}>;
524
+ }>);
525
+ export type GovernorSF = typeof import("./contractGovernor.js")['start'];
526
+ /**
527
+ * Same result as StartedInstanceKit but:
528
+ * - typed for contractGovernor installation being started by Zoe. (It in turn starts the governed contract.)
529
+ * - parameterized by Installation instead of StartFunction
530
+ */
531
+ export type GovernorStartedInstallationKit<I extends ERef<Installation<GovernableStartFn>>> = {
532
+ instance: import('@agoric/zoe/src/zoeService/utils.js').Instance<GovernorSF>;
533
+ adminFacet: AdminFacet;
534
+ creatorFacet: GovernorCreatorFacet<InstallationStart<Awaited<I>>>;
535
+ publicFacet: GovernorPublic;
536
+ };
537
+ /**
538
+ * Akin to StartedInstanceKit but designed for the results of starting governed contracts. Used in bootstrap space.
539
+ */
540
+ export type GovernanceFacetKit<SF extends GovernableStartFn> = {
541
+ /**
542
+ * of the governed contract
543
+ */
544
+ adminFacet: AdminFacet;
545
+ /**
546
+ * creator-like facet within the governed contract (without the powers the governor needs)
547
+ */
548
+ creatorFacet: LimitedCF<SF>;
549
+ /**
550
+ * of the governing contract
551
+ */
552
+ governorCreatorFacet: GovernorCreatorFacet<SF>;
553
+ /**
554
+ * of the governing contract
555
+ */
556
+ governorAdminFacet: AdminFacet;
557
+ publicFacet: Awaited<ReturnType<SF>>['publicFacet'];
558
+ instance: Instance;
559
+ governor: Instance;
560
+ };
561
+ import type { ParamType } from './constants.js';
562
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;;;;;;2BAGc,UAAU,GAAG,OAAO,GAAG,WAAW;;;;;;;2BAWlC,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,gBAAgB,GACtE,cAAkB;yBAUL,UAAU,GAAG,KAAK,GAAG,WAAW;;UAKhC,MAAM;;yBAIN,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAC9D,KAAS,GAAG,MAAM,GAAG,OAAO,cAAc,EAAE,eAAe,GAC3D,OAAW,cAAc,EAAE,kBAAkB,GAAG,OAAO;qDAQ3C,CAAC,SAAS,QAAQ,GAAG,OAAO,GAAG,CAAC,GAC5C,CAAG,SAAS,OAAO,GAAG,KAA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AAQ,WAAW,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;cACtC,QAAQ;cACR,QAAQ;;+BArsBO,gBAAgB"}
package/src/types.js CHANGED
@@ -1,4 +1,5 @@
1
- export {};
1
+ export {};
2
+
2
3
  /**
3
4
  * @typedef { 'unranked' | 'order' | 'plurality' } ChoiceMethod
4
5
  * * UNRANKED: "unranked voting" means that the voter specifies some number of
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, AssertContractGovernance, AssertContractElectorate} from './types.js';
3
+ */
4
+ /**
5
+ * Assert that the governed contract was started by the governor. Throws if
6
+ * either direction can't be established. If the call succeeds, then the
7
+ * governor got exclusive access to the governed contract's creatorFacet, and
8
+ * can be trusted to manage its parameters.
9
+ *
10
+ * @type {AssertContractGovernance}
11
+ */
12
+ export const assertContractGovernance: AssertContractGovernance;
13
+ /**
14
+ * Assert that the governor refers to the indicated electorate.
15
+ *
16
+ * @type {AssertContractElectorate}
17
+ */
18
+ export const assertContractElectorate: AssertContractElectorate;
19
+ import type { AssertContractGovernance } from './types.js';
20
+ import type { AssertContractElectorate } from './types.js';
21
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["validators.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;GAOG;AACH,gEAgCE;AAEF;;;;GAIG;AACH,gEAWE;8CA7DiL,YAAY;8CAAZ,YAAY"}
package/src/validators.js CHANGED
@@ -2,6 +2,10 @@ import { E } from '@endo/eventual-send';
2
2
 
3
3
  const { Fail, quote: q } = assert;
4
4
 
5
+ /**
6
+ * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, AssertContractGovernance, AssertContractElectorate} from './types.js';
7
+ */
8
+
5
9
  /**
6
10
  * Assert that the governed contract was started by the governor. Throws if
7
11
  * either direction can't be established. If the call succeeds, then the
@@ -0,0 +1,14 @@
1
+ export function prepareVoterKit(baggage: import('@agoric/vat-data').Baggage, { submitVote, zcf }: {
2
+ zcf: ZCF;
3
+ submitVote: (questionHandle: Handle<'Question'>, voterHandle: Handle<'Voter'>, chosenPositions: Position[], weight: bigint) => ERef<CompletedBallet>;
4
+ }): (id?: any) => import("@endo/exo").GuardedKit<{
5
+ voter: {
6
+ castBallotFor(questionHandle: any, positions: any, weight?: bigint): Promise<CompletedBallet>;
7
+ };
8
+ invitationMakers: {
9
+ makeVoteInvitation(positions: any, questionHandle: any): Promise<Invitation<CompletedBallet, undefined>>;
10
+ };
11
+ }>;
12
+ import type { Position } from './types.js';
13
+ import type { CompletedBallet } from './types.js';
14
+ //# sourceMappingURL=voterKit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voterKit.d.ts","sourceRoot":"","sources":["voterKit.js"],"names":[],"mappings":"AA8BO,yCALI,OAAO,kBAAkB,EAAE,OAAO;SAElC,GAAG;iCACc,OAAO,UAAU,CAAC,eAAe,OAAO,OAAO,CAAC,uCAAuC,MAAM;;;;;;;;GAiCxH;8BAvDyJ,YAAY;qCAAZ,YAAY"}
package/src/voterKit.js CHANGED
@@ -3,6 +3,10 @@ import { defineDurableHandle } from '@agoric/zoe/src/makeHandle.js';
3
3
  import { E } from '@endo/eventual-send';
4
4
  import { PositionShape, QuestionHandleShape } from './typeGuards.js';
5
5
 
6
+ /**
7
+ * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, CompletedBallet, Position} from './types.js';
8
+ */
9
+
6
10
  const VoterI = M.interface('voter', {
7
11
  castBallotFor: M.call(QuestionHandleShape, M.arrayOf(PositionShape)).returns(
8
12
  M.promise(),