@agoric/governance 0.10.4-upgrade-14-dev-c8f9e7b.0 → 0.10.4-upgrade-16-fi-dev-8879538.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/exported.d.ts +32 -0
- package/exported.js +1 -1
- package/package.json +35 -29
- package/src/binaryVoteCounter.d.ts +6 -3
- package/src/binaryVoteCounter.d.ts.map +1 -1
- package/src/binaryVoteCounter.js +6 -2
- package/src/breakTie.d.ts +1 -0
- package/src/breakTie.d.ts.map +1 -1
- package/src/breakTie.js +4 -0
- package/src/closingRule.d.ts +4 -0
- package/src/closingRule.d.ts.map +1 -1
- package/src/closingRule.js +4 -0
- package/src/committee.d.ts +12 -8
- package/src/committee.d.ts.map +1 -1
- package/src/committee.js +24 -11
- package/src/constants.d.ts +12 -12
- package/src/constants.d.ts.map +1 -1
- package/src/contractGovernance/governApi.d.ts +11 -8
- package/src/contractGovernance/governApi.d.ts.map +1 -1
- package/src/contractGovernance/governApi.js +8 -3
- package/src/contractGovernance/governFilter.d.ts +8 -2
- package/src/contractGovernance/governFilter.d.ts.map +1 -1
- package/src/contractGovernance/governFilter.js +5 -1
- package/src/contractGovernance/governParam.d.ts +9 -2
- package/src/contractGovernance/governParam.d.ts.map +1 -1
- package/src/contractGovernance/governParam.js +6 -1
- package/src/contractGovernance/paramManager.d.ts +13 -9
- package/src/contractGovernance/paramManager.d.ts.map +1 -1
- package/src/contractGovernance/paramManager.js +18 -14
- package/src/contractGovernance/typedParamManager.d.ts +19 -10
- package/src/contractGovernance/typedParamManager.d.ts.map +1 -1
- package/src/contractGovernance/typedParamManager.js +5 -0
- package/src/contractGovernor.d.ts +11 -5
- package/src/contractGovernor.d.ts.map +1 -1
- package/src/contractGovernor.js +19 -9
- package/src/contractGovernorKit.d.ts +14 -48
- package/src/contractGovernorKit.d.ts.map +1 -1
- package/src/contractGovernorKit.js +56 -10
- package/src/contractHelper.d.ts +68 -78
- package/src/contractHelper.d.ts.map +1 -1
- package/src/contractHelper.js +21 -21
- package/src/electorateTools.d.ts +21 -17
- package/src/electorateTools.d.ts.map +1 -1
- package/src/electorateTools.js +20 -12
- package/src/index.js +3 -6
- package/src/multiCandidateVoteCounter.d.ts +6 -3
- package/src/multiCandidateVoteCounter.d.ts.map +1 -1
- package/src/multiCandidateVoteCounter.js +8 -4
- package/src/noActionElectorate.d.ts +6 -1
- package/src/noActionElectorate.d.ts.map +1 -1
- package/src/noActionElectorate.js +11 -2
- package/src/question.d.ts +15 -11
- package/src/question.d.ts.map +1 -1
- package/src/question.js +5 -0
- package/src/quorumCounter.d.ts +1 -1
- package/src/quorumCounter.d.ts.map +1 -1
- package/src/quorumCounter.js +4 -0
- package/src/typeGuards.d.ts +91 -54
- package/src/typeGuards.d.ts.map +1 -1
- package/src/types.d.ts +59 -62
- package/src/types.d.ts.map +1 -1
- package/src/types.js +35 -27
- package/src/validators.d.ts +5 -0
- package/src/validators.d.ts.map +1 -1
- package/src/validators.js +6 -3
- package/src/voterKit.d.ts +6 -11
- package/src/voterKit.d.ts.map +1 -1
- package/src/voterKit.js +4 -0
- package/tools/puppetContractGovernor.d.ts +15 -11
- package/tools/puppetContractGovernor.d.ts.map +1 -1
- package/tools/puppetContractGovernor.js +7 -5
- package/tools/puppetGovernance.d.ts +31 -30
- package/tools/puppetGovernance.d.ts.map +1 -1
- package/tools/puppetGovernance.js +6 -4
- package/tools/storageDoc.d.ts +3 -3
- package/tools/storageDoc.d.ts.map +1 -1
- package/CHANGELOG.md +0 -456
- package/src/types-ambient.d.ts +0 -1047
- package/src/types-ambient.d.ts.map +0 -1
- package/src/types-ambient.js +0 -731
package/src/contractHelper.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const GOVERNANCE_STORAGE_KEY: "governance";
|
|
2
|
-
export function validateElectorate(zcf: ZCF<GovernanceTerms<{}
|
|
2
|
+
export function validateElectorate(zcf: ZCF<GovernanceTerms<{}>>, paramManager: import("./contractGovernance/typedParamManager.js").TypedParamManager<any>): Promise<true>;
|
|
3
|
+
import type { GovernanceTerms } from './types.js';
|
|
3
4
|
/**
|
|
4
5
|
* Helper for the 90% of contracts that will have only a single set of
|
|
5
6
|
* parameters. Using this for managed parameters, a contract only has to
|
|
@@ -12,7 +13,7 @@ export function validateElectorate(zcf: ZCF<GovernanceTerms<{}> & {}>, paramMana
|
|
|
12
13
|
* parameter values, and the governance guarantees only hold if they're not used
|
|
13
14
|
* directly by the governed contract.
|
|
14
15
|
*
|
|
15
|
-
* @template {import('./contractGovernance/typedParamManager').ParamTypesMap} M
|
|
16
|
+
* @template {import('./contractGovernance/typedParamManager.js').ParamTypesMap} M
|
|
16
17
|
* Map of types of custom governed terms
|
|
17
18
|
* @param {ZCF<GovernanceTerms<M>>} zcf
|
|
18
19
|
* @param {Invitation} initialPoserInvitation
|
|
@@ -20,92 +21,77 @@ export function validateElectorate(zcf: ZCF<GovernanceTerms<{}> & {}>, paramMana
|
|
|
20
21
|
* @param {ERef<StorageNode>} [storageNode]
|
|
21
22
|
* @param {ERef<Marshaller>} [marshaller]
|
|
22
23
|
*/
|
|
23
|
-
export function handleParamGovernance<M extends import("./contractGovernance/typedParamManager.js").ParamTypesMap>(zcf: ZCF<GovernanceTerms<M>>, initialPoserInvitation: Invitation, paramTypesMap: M, storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<
|
|
24
|
+
export function handleParamGovernance<M extends import("./contractGovernance/typedParamManager.js").ParamTypesMap>(zcf: ZCF<GovernanceTerms<M>>, initialPoserInvitation: Invitation, paramTypesMap: M, storageNode?: globalThis.ERef<globalThis.StorageNode> | undefined, marshaller?: globalThis.ERef<{
|
|
25
|
+
toCapData: import("@endo/marshal").ToCapData<unknown>;
|
|
26
|
+
fromCapData: import("@endo/marshal").FromCapData<unknown>;
|
|
27
|
+
serialize: import("@endo/marshal").ToCapData<unknown>;
|
|
28
|
+
unserialize: import("@endo/marshal").FromCapData<unknown>;
|
|
29
|
+
}> | undefined): {
|
|
24
30
|
publicMixin: {
|
|
25
|
-
getAmount: (name: string) => Amount
|
|
26
|
-
getBrand: (name: string) => Brand
|
|
31
|
+
getAmount: (name: string) => globalThis.Amount;
|
|
32
|
+
getBrand: (name: string) => globalThis.Brand;
|
|
27
33
|
getInstance: (name: string) => Instance;
|
|
28
34
|
getInstallation: (name: string) => Installation<any>;
|
|
29
|
-
getInvitationAmount: (name: string) =>
|
|
35
|
+
getInvitationAmount: (name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>;
|
|
30
36
|
getNat: (name: string) => bigint;
|
|
31
37
|
getRatio: (name: string) => Ratio;
|
|
32
38
|
getString: (name: string) => string;
|
|
33
|
-
getTimestamp: (name: string) => import("@agoric/time
|
|
34
|
-
getRelativeTime: (name: string) => import("@agoric/time
|
|
39
|
+
getTimestamp: (name: string) => import("@agoric/time").TimestampRecord;
|
|
40
|
+
getRelativeTime: (name: string) => import("@agoric/time").RelativeTimeRecord;
|
|
35
41
|
getUnknown: (name: string) => any;
|
|
36
|
-
getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
|
|
37
|
-
getGovernedParams: () => ERef<ParamStateRecord>;
|
|
42
|
+
getSubscription: () => globalThis.StoredSubscription<GovernanceSubscriptionState>;
|
|
43
|
+
getGovernedParams: () => globalThis.ERef<import("./types.js").ParamStateRecord>;
|
|
38
44
|
};
|
|
39
45
|
augmentPublicFacet: <PF extends {}>(originalPublicFacet: PF) => GovernedPublicFacet<PF>;
|
|
40
46
|
augmentVirtualPublicFacet: <OPF extends {}>(originalPublicFacet: OPF) => OPF & {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
getInstance: import("@agoric/
|
|
44
|
-
|
|
45
|
-
getInvitationAmount: import("@agoric/
|
|
46
|
-
getNat: import("@agoric/
|
|
47
|
-
getRatio: import("@agoric/
|
|
48
|
-
getString: import("@agoric/
|
|
49
|
-
getTimestamp: import("@agoric/
|
|
50
|
-
getRelativeTime: import("@agoric/
|
|
51
|
-
getUnknown: import("@agoric/
|
|
52
|
-
getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
|
|
53
|
-
getGovernedParams: () => ERef<ParamStateRecord>;
|
|
54
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, OPF & {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
getInstance: import("@agoric/
|
|
58
|
-
|
|
59
|
-
getInvitationAmount: import("@agoric/
|
|
60
|
-
getNat: import("@agoric/
|
|
61
|
-
getRatio: import("@agoric/
|
|
62
|
-
getString: import("@agoric/
|
|
63
|
-
getTimestamp: import("@agoric/
|
|
64
|
-
getRelativeTime: import("@agoric/
|
|
65
|
-
getUnknown: import("@agoric/
|
|
66
|
-
getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
|
|
67
|
-
getGovernedParams: () => ERef<ParamStateRecord>;
|
|
47
|
+
getBrand: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
48
|
+
getInstallation: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
49
|
+
getInstance: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
50
|
+
getAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
51
|
+
getInvitationAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
52
|
+
getNat: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
53
|
+
getRatio: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
54
|
+
getString: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
55
|
+
getTimestamp: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
56
|
+
getRelativeTime: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
57
|
+
getUnknown: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
58
|
+
getSubscription: () => globalThis.StoredSubscription<GovernanceSubscriptionState>;
|
|
59
|
+
getGovernedParams: () => globalThis.ERef<import("./types.js").ParamStateRecord>;
|
|
60
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, OPF & {
|
|
61
|
+
getBrand: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
62
|
+
getInstallation: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
63
|
+
getInstance: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
64
|
+
getAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
65
|
+
getInvitationAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
66
|
+
getNat: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
67
|
+
getRatio: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
68
|
+
getString: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
69
|
+
getTimestamp: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
70
|
+
getRelativeTime: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
71
|
+
getUnknown: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>) | ((name: string) => globalThis.Amount) | ((name: string) => globalThis.Brand) | ((name: string) => Instance) | ((name: string) => Installation<any>) | ((name: string) => bigint) | ((name: string) => Ratio) | ((name: string) => string) | ((name: string) => import("@agoric/time").TimestampRecord) | ((name: string) => import("@agoric/time").RelativeTimeRecord) | ((name: string) => any)>;
|
|
72
|
+
getSubscription: () => globalThis.StoredSubscription<GovernanceSubscriptionState>;
|
|
73
|
+
getGovernedParams: () => globalThis.ERef<import("./types.js").ParamStateRecord>;
|
|
68
74
|
}>;
|
|
69
75
|
makeGovernorFacet: <CF extends {}>(originalCreatorFacet: CF, governedApis?: {} | undefined) => GovernedCreatorFacet<CF>;
|
|
70
76
|
makeFarGovernorFacet: <CF_1 extends {}>(limitedCreatorFacet: CF_1, governedApis?: Record<string, (...any: any[]) => unknown> | undefined) => GovernedCreatorFacet<CF_1>;
|
|
71
|
-
makeVirtualGovernorFacet:
|
|
77
|
+
makeVirtualGovernorFacet: <LCF extends {
|
|
72
78
|
[methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown;
|
|
73
|
-
}) => {
|
|
74
|
-
governorFacet: import("@agoric/
|
|
75
|
-
|
|
76
|
-
}>>;
|
|
77
|
-
limitedCreatorFacet: {
|
|
78
|
-
[methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown;
|
|
79
|
-
};
|
|
79
|
+
}>(limitedCreatorFacet: LCF) => {
|
|
80
|
+
governorFacet: import("@agoric/swingset-liveslots").FunctionsPlusContext<unknown, GovernedCreatorFacet<LCF>>;
|
|
81
|
+
limitedCreatorFacet: LCF;
|
|
80
82
|
};
|
|
81
|
-
makeDurableGovernorFacet: <CF_2>(baggage:
|
|
82
|
-
governorFacet: {
|
|
83
|
+
makeDurableGovernorFacet: <CF_2>(baggage: import("@agoric/vat-data").Baggage, limitedCreatorFacet: CF_2, governedApis?: Record<string, (...any: any[]) => unknown> | undefined) => {
|
|
84
|
+
governorFacet: import("@endo/exo").Guarded<{
|
|
83
85
|
getParamMgrRetriever: () => {
|
|
84
86
|
get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
|
|
85
87
|
Electorate: "invitation";
|
|
86
88
|
}>;
|
|
87
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
89
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
88
90
|
get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
|
|
89
91
|
Electorate: "invitation";
|
|
90
92
|
}>;
|
|
91
93
|
}>;
|
|
92
|
-
getInvitation: (name: any) => Promise<Invitation<unknown,
|
|
93
|
-
getLimitedCreatorFacet: () => CF_2;
|
|
94
|
-
/** @type {() => GovernedApis} */
|
|
95
|
-
getGovernedApis: () => GovernedApis;
|
|
96
|
-
getGovernedApiNames: () => string[];
|
|
97
|
-
setOfferFilter: (strings: any) => Promise<void>;
|
|
98
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
99
|
-
getParamMgrRetriever: () => {
|
|
100
|
-
get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
|
|
101
|
-
Electorate: "invitation";
|
|
102
|
-
}>;
|
|
103
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
104
|
-
get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
|
|
105
|
-
Electorate: "invitation";
|
|
106
|
-
}>;
|
|
107
|
-
}>;
|
|
108
|
-
getInvitation: (name: any) => Promise<Invitation<unknown, never>>;
|
|
94
|
+
getInvitation: (name: any) => Promise<Invitation<unknown, undefined>>;
|
|
109
95
|
getLimitedCreatorFacet: () => CF_2;
|
|
110
96
|
/** @type {() => GovernedApis} */
|
|
111
97
|
getGovernedApis: () => GovernedApis;
|
|
@@ -119,18 +105,22 @@ export function handleParamGovernance<M extends import("./contractGovernance/typ
|
|
|
119
105
|
}>;
|
|
120
106
|
};
|
|
121
107
|
export namespace publicMixinAPI {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
108
|
+
let getSubscription: import("@endo/patterns").MethodGuard;
|
|
109
|
+
let getGovernedParams: import("@endo/patterns").MethodGuard;
|
|
110
|
+
let getAmount: import("@endo/patterns").MethodGuard;
|
|
111
|
+
let getBrand: import("@endo/patterns").MethodGuard;
|
|
112
|
+
let getInstance: import("@endo/patterns").MethodGuard;
|
|
113
|
+
let getInstallation: import("@endo/patterns").MethodGuard;
|
|
114
|
+
let getInvitationAmount: import("@endo/patterns").MethodGuard;
|
|
115
|
+
let getNat: import("@endo/patterns").MethodGuard;
|
|
116
|
+
let getRatio: import("@endo/patterns").MethodGuard;
|
|
117
|
+
let getString: import("@endo/patterns").MethodGuard;
|
|
118
|
+
let getTimestamp: import("@endo/patterns").MethodGuard;
|
|
119
|
+
let getRelativeTime: import("@endo/patterns").MethodGuard;
|
|
120
|
+
let getUnknown: import("@endo/patterns").MethodGuard;
|
|
135
121
|
}
|
|
122
|
+
import type { GovernanceSubscriptionState } from './types.js';
|
|
123
|
+
import type { GovernedPublicFacet } from './types.js';
|
|
124
|
+
import type { GovernedCreatorFacet } from './types.js';
|
|
125
|
+
import type { GovernedApis } from './types.js';
|
|
136
126
|
//# sourceMappingURL=contractHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractHelper.d.ts","sourceRoot":"","sources":["contractHelper.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contractHelper.d.ts","sourceRoot":"","sources":["contractHelper.js"],"names":[],"mappings":"AAkBA,kDAAmD;AAwB5C,gFAFI,OAAO,2CAA2C,EAAE,iBAAiB,CAAC,GAAG,CAAC,iBAQpF;qCAnCqO,YAAY;AA6NlP;;;;;;;;;;;;;;;;;;;GAmBG;AACH,sCAJW,CAAC,kIADD,UAAU,iBACV,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wHAxI4B,OAAO;;yCAuCI,OAAO,WAAW,OAAO,EAAE,KAAK,OAAO;;;;;8CA+B7E,OAAO,kBAAkB,EAAE,OAAO,8EAEP,OAAO;;;;;;;;;;;;;YAkBvC,iCAAiC;;;;;;;;;;EAuExC;;;;;;;;;;;;;;;;iDAtQqO,YAAY;yCAAZ,YAAY;0CAAZ,YAAY;kCAAZ,YAAY"}
|
package/src/contractHelper.js
CHANGED
|
@@ -2,15 +2,19 @@ import { Far } from '@endo/marshal';
|
|
|
2
2
|
import { makeStoredPublisherKit } from '@agoric/notifier';
|
|
3
3
|
import { getMethodNames, objectMap } from '@agoric/internal';
|
|
4
4
|
import { ignoreContext, prepareExo } from '@agoric/vat-data';
|
|
5
|
-
import {
|
|
5
|
+
import { M } from '@agoric/store';
|
|
6
6
|
import { AmountShape, BrandShape } from '@agoric/ertp';
|
|
7
7
|
import { RelativeTimeRecordShape, TimestampRecordShape } from '@agoric/time';
|
|
8
8
|
import { E } from '@endo/eventual-send';
|
|
9
|
-
import { assertElectorateMatches } from './contractGovernance/paramManager.js';
|
|
10
9
|
import { makeParamManagerFromTerms } from './contractGovernance/typedParamManager.js';
|
|
11
10
|
import { GovernorFacetShape } from './typeGuards.js';
|
|
11
|
+
import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, GovernanceSubscriptionState, GovernanceTerms, GovernedApis, GovernedCreatorFacet, GovernedPublicFacet} from './types.js';
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const { Fail } = assert;
|
|
14
18
|
|
|
15
19
|
export const GOVERNANCE_STORAGE_KEY = 'governance';
|
|
16
20
|
|
|
@@ -31,31 +35,26 @@ const publicMixinAPI = harden({
|
|
|
31
35
|
});
|
|
32
36
|
|
|
33
37
|
/**
|
|
38
|
+
* Verify that the electorate is represented by a live invitation.
|
|
39
|
+
*
|
|
34
40
|
* @param {ZCF<GovernanceTerms<{}> & {}>} zcf
|
|
35
|
-
* @param {import('./contractGovernance/typedParamManager').TypedParamManager<
|
|
41
|
+
* @param {import('./contractGovernance/typedParamManager.js').TypedParamManager<any>} paramManager
|
|
36
42
|
*/
|
|
37
43
|
export const validateElectorate = (zcf, paramManager) => {
|
|
38
|
-
const
|
|
39
|
-
return E.when(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
finishedParams,
|
|
44
|
-
)}, but was ${q(governedParams)}`;
|
|
45
|
-
assertElectorateMatches(paramManager, governedParams);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
zcf.shutdownWithFailure(err);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
44
|
+
const invitation = paramManager.getInternalParamValue(CONTRACT_ELECTORATE);
|
|
45
|
+
return E.when(
|
|
46
|
+
E(zcf.getInvitationIssuer()).isLive(invitation),
|
|
47
|
+
isLive => isLive || Fail`Electorate invitation is not live.`,
|
|
48
|
+
);
|
|
50
49
|
};
|
|
51
50
|
harden(validateElectorate);
|
|
52
51
|
|
|
53
52
|
/**
|
|
54
53
|
* Utility function for `makeParamGovernance`.
|
|
55
54
|
*
|
|
56
|
-
* @template T
|
|
55
|
+
* @template {import('./contractGovernance/typedParamManager.js').ParamTypesMap} T
|
|
57
56
|
* @param {ZCF<GovernanceTerms<{}> & {}>} zcf
|
|
58
|
-
* @param {import('./contractGovernance/typedParamManager').TypedParamManager<T>} paramManager
|
|
57
|
+
* @param {import('./contractGovernance/typedParamManager.js').TypedParamManager<T>} paramManager
|
|
59
58
|
*/
|
|
60
59
|
const facetHelpers = (zcf, paramManager) => {
|
|
61
60
|
// validate async to wait for params to be finished
|
|
@@ -152,10 +151,11 @@ const facetHelpers = (zcf, paramManager) => {
|
|
|
152
151
|
*
|
|
153
152
|
* @see {makeDurableGovernorFacet}
|
|
154
153
|
*
|
|
155
|
-
* @
|
|
154
|
+
* @template {{ [methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown}} LCF
|
|
155
|
+
* @param {LCF} limitedCreatorFacet
|
|
156
156
|
*/
|
|
157
157
|
const makeVirtualGovernorFacet = limitedCreatorFacet => {
|
|
158
|
-
/** @type {import('@agoric/
|
|
158
|
+
/** @type {import('@agoric/swingset-liveslots').FunctionsPlusContext<unknown, GovernedCreatorFacet<limitedCreatorFacet>>} */
|
|
159
159
|
const governorFacet = harden({
|
|
160
160
|
getParamMgrRetriever: () =>
|
|
161
161
|
Far('paramRetriever', { get: () => paramManager }),
|
|
@@ -244,7 +244,7 @@ const facetHelpers = (zcf, paramManager) => {
|
|
|
244
244
|
* parameter values, and the governance guarantees only hold if they're not used
|
|
245
245
|
* directly by the governed contract.
|
|
246
246
|
*
|
|
247
|
-
* @template {import('./contractGovernance/typedParamManager').ParamTypesMap} M
|
|
247
|
+
* @template {import('./contractGovernance/typedParamManager.js').ParamTypesMap} M
|
|
248
248
|
* Map of types of custom governed terms
|
|
249
249
|
* @param {ZCF<GovernanceTerms<M>>} zcf
|
|
250
250
|
* @param {Invitation} initialPoserInvitation
|
package/src/electorateTools.d.ts
CHANGED
|
@@ -1,46 +1,50 @@
|
|
|
1
1
|
export type QuestionRecord = {
|
|
2
|
-
voteCap: ERef<VoteCounterCreatorFacet>;
|
|
2
|
+
voteCap: globalThis.ERef<VoteCounterCreatorFacet>;
|
|
3
3
|
publicFacet: VoteCounterPublicFacet;
|
|
4
|
-
deadline: import(
|
|
4
|
+
deadline: import("@agoric/time").Timestamp;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn} from './types.js';
|
|
8
|
+
*/
|
|
7
9
|
/**
|
|
8
10
|
* @typedef {object} QuestionRecord
|
|
9
11
|
* @property {ERef<VoteCounterCreatorFacet>} voteCap
|
|
10
12
|
* @property {VoteCounterPublicFacet} publicFacet
|
|
11
|
-
* @property {import('@agoric/time
|
|
13
|
+
* @property {import('@agoric/time').Timestamp} deadline
|
|
12
14
|
*/
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Start up a new Counter for a question
|
|
17
|
+
*
|
|
15
18
|
* @param {ZCF} zcf
|
|
16
19
|
* @param {QuestionSpec} questionSpec
|
|
17
20
|
* @param {unknown} quorumThreshold
|
|
18
21
|
* @param {ERef<Installation>} voteCounter
|
|
19
22
|
* @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore
|
|
20
|
-
* @param {Publisher<unknown>}
|
|
23
|
+
* @param {Publisher<unknown>} questionsPublisher
|
|
21
24
|
* @param {Publisher<OutcomeRecord>} outcomePublisher
|
|
22
|
-
* @returns {AddQuestionReturn}
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Start up a new Counter for a question
|
|
26
|
-
*
|
|
27
|
-
* @type {StartCounter}
|
|
25
|
+
* @returns {Promise<AddQuestionReturn>}
|
|
28
26
|
*/
|
|
29
|
-
export
|
|
27
|
+
export function startCounter(zcf: ZCF, questionSpec: QuestionSpec, quorumThreshold: unknown, voteCounter: ERef<Installation>, questionStore: MapStore<Handle<"Question">, QuestionRecord>, questionsPublisher: Publisher<unknown>, outcomePublisher: globalThis.Publisher<OutcomeRecord>): Promise<AddQuestionReturn>;
|
|
30
28
|
/** @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore */
|
|
31
|
-
export function getOpenQuestions(questionStore: MapStore<Handle<
|
|
29
|
+
export function getOpenQuestions(questionStore: MapStore<Handle<"Question">, QuestionRecord>): Promise<any>;
|
|
32
30
|
/**
|
|
33
31
|
* @param {ERef<Handle<'Question'>>} questionHandleP
|
|
34
32
|
* @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore
|
|
35
33
|
*/
|
|
36
|
-
export function getQuestion(questionHandleP: ERef<Handle<
|
|
34
|
+
export function getQuestion(questionHandleP: ERef<Handle<"Question">>, questionStore: MapStore<Handle<"Question">, QuestionRecord>): Promise<import("./types.js").Question>;
|
|
37
35
|
/**
|
|
38
36
|
* @param {ZCF} zcf
|
|
39
37
|
* @param {AddQuestion} addQuestion
|
|
40
38
|
*/
|
|
41
39
|
export function getPoserInvitation(zcf: ZCF, addQuestion: AddQuestion): Promise<Invitation<{
|
|
42
40
|
addQuestion: AddQuestion;
|
|
43
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
41
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
44
42
|
addQuestion: AddQuestion;
|
|
45
|
-
}>,
|
|
43
|
+
}>, undefined>>;
|
|
44
|
+
import type { VoteCounterCreatorFacet } from './types.js';
|
|
45
|
+
import type { VoteCounterPublicFacet } from './types.js';
|
|
46
|
+
import type { QuestionSpec } from './types.js';
|
|
47
|
+
import type { OutcomeRecord } from './types.js';
|
|
48
|
+
import type { AddQuestionReturn } from './types.js';
|
|
49
|
+
import type { AddQuestion } from './types.js';
|
|
46
50
|
//# sourceMappingURL=electorateTools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electorateTools.d.ts","sourceRoot":"","sources":["electorateTools.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"electorateTools.d.ts","sourceRoot":"","sources":["electorateTools.js"],"names":[],"mappings":";;;cAYc,OAAO,cAAc,EAAE,SAAS;;AAR9C;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,kCATW,GAAG,+CAEH,OAAO,eACP,IAAI,CAAC,YAAY,CAAC,iBAClB,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,sBAC5C,SAAS,CAAC,OAAO,CAAC,qFAwC5B;AAED,0EAA0E;AAC1E,gDADY,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,gBAYvD;AAED;;;GAGG;AACH,6CAHW,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,iBACxB,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,0CAKpD;AAEH;;;GAGG;AACH,wCAHW,GAAG;;;;gBAcb;6CAlG8H,YAAY;4CAAZ,YAAY;kCAAZ,YAAY;mCAAZ,YAAY;uCAAZ,YAAY;iCAAZ,YAAY"}
|
package/src/electorateTools.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
+
import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';
|
|
1
2
|
import { E } from '@endo/eventual-send';
|
|
2
3
|
import { deeplyFulfilled, Far } from '@endo/marshal';
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn} from './types.js';
|
|
7
|
+
*/
|
|
8
|
+
|
|
4
9
|
/**
|
|
5
10
|
* @typedef {object} QuestionRecord
|
|
6
11
|
* @property {ERef<VoteCounterCreatorFacet>} voteCap
|
|
7
12
|
* @property {VoteCounterPublicFacet} publicFacet
|
|
8
|
-
* @property {import('@agoric/time
|
|
13
|
+
* @property {import('@agoric/time').Timestamp} deadline
|
|
9
14
|
*/
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
|
-
*
|
|
17
|
+
* Start up a new Counter for a question
|
|
18
|
+
*
|
|
13
19
|
* @param {ZCF} zcf
|
|
14
20
|
* @param {QuestionSpec} questionSpec
|
|
15
21
|
* @param {unknown} quorumThreshold
|
|
16
22
|
* @param {ERef<Installation>} voteCounter
|
|
17
23
|
* @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore
|
|
18
|
-
* @param {Publisher<unknown>}
|
|
24
|
+
* @param {Publisher<unknown>} questionsPublisher
|
|
19
25
|
* @param {Publisher<OutcomeRecord>} outcomePublisher
|
|
20
|
-
* @returns {AddQuestionReturn}
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Start up a new Counter for a question
|
|
25
|
-
*
|
|
26
|
-
* @type {StartCounter}
|
|
26
|
+
* @returns {Promise<AddQuestionReturn>}
|
|
27
27
|
*/
|
|
28
28
|
const startCounter = async (
|
|
29
29
|
zcf,
|
|
@@ -91,8 +91,16 @@ const getQuestion = (questionHandleP, questionStore) =>
|
|
|
91
91
|
* @param {AddQuestion} addQuestion
|
|
92
92
|
*/
|
|
93
93
|
const getPoserInvitation = (zcf, addQuestion) => {
|
|
94
|
-
const questionPoserHandler =
|
|
95
|
-
|
|
94
|
+
const questionPoserHandler = seat => {
|
|
95
|
+
seat.exit();
|
|
96
|
+
return Far(`questionPoser`, { addQuestion });
|
|
97
|
+
};
|
|
98
|
+
return zcf.makeInvitation(
|
|
99
|
+
questionPoserHandler,
|
|
100
|
+
`questionPoser`,
|
|
101
|
+
undefined,
|
|
102
|
+
EmptyProposalShape,
|
|
103
|
+
);
|
|
96
104
|
};
|
|
97
105
|
|
|
98
106
|
harden(startCounter);
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '@agoric/zoe/exported.js';
|
|
5
|
-
|
|
6
|
-
import './types-ambient.js';
|
|
1
|
+
/// <reference types="@agoric/internal/exported" />
|
|
2
|
+
/// <reference types="@agoric/ertp/exported" />
|
|
3
|
+
/// <reference types="@agoric/zoe/exported" />
|
|
7
4
|
|
|
8
5
|
export {
|
|
9
6
|
ChoiceMethod,
|
|
@@ -8,9 +8,12 @@ export function start(zcf: ZCF<{
|
|
|
8
8
|
questionSpec: QuestionSpec;
|
|
9
9
|
quorumThreshold: bigint;
|
|
10
10
|
}>, { outcomePublisher }: {
|
|
11
|
-
outcomePublisher: Publisher<MultiOutcomeRecord>;
|
|
11
|
+
outcomePublisher: globalThis.Publisher<MultiOutcomeRecord>;
|
|
12
12
|
}): {
|
|
13
|
-
publicFacet: MultiVoteCounterPublicFacet;
|
|
14
|
-
creatorFacet: VoteCounterCreatorFacet;
|
|
13
|
+
publicFacet: import("./types.js").MultiVoteCounterPublicFacet;
|
|
14
|
+
creatorFacet: import("./types.js").VoteCounterCreatorFacet;
|
|
15
15
|
};
|
|
16
|
+
import type { BuildMultiVoteCounter } from './types.js';
|
|
17
|
+
import type { QuestionSpec } from './types.js';
|
|
18
|
+
import type { MultiOutcomeRecord } from './types.js';
|
|
16
19
|
//# sourceMappingURL=multiCandidateVoteCounter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiCandidateVoteCounter.d.ts","sourceRoot":"","sources":["multiCandidateVoteCounter.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multiCandidateVoteCounter.d.ts","sourceRoot":"","sources":["multiCandidateVoteCounter.js"],"names":[],"mappings":"AAoCA,oCAAoC;AACpC,kEAuLE;AAEF;;;GAGG;AACH;;qBAH6D,MAAM;;;;;;EAiBlE;2CA5NmG,YAAY;kCAAZ,YAAY;wCAAZ,YAAY"}
|
|
@@ -17,6 +17,10 @@ import {
|
|
|
17
17
|
import { makeQuorumCounter } from './quorumCounter.js';
|
|
18
18
|
import { breakTie } from './breakTie.js';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @import {QuestionSpec, BuildMultiVoteCounter, MultiOutcomeRecord, Position, VoteStatistics} from './types.js';
|
|
22
|
+
*/
|
|
23
|
+
|
|
20
24
|
const { Fail } = assert;
|
|
21
25
|
|
|
22
26
|
const validateQuestionSpec = questionSpec => {
|
|
@@ -96,7 +100,7 @@ const makeMultiCandidateVoteCounter = (
|
|
|
96
100
|
outcome: 'fail',
|
|
97
101
|
reason: 'No quorum',
|
|
98
102
|
};
|
|
99
|
-
E(publisher).publish(voteOutcome);
|
|
103
|
+
void E(publisher).publish(voteOutcome);
|
|
100
104
|
return;
|
|
101
105
|
}
|
|
102
106
|
|
|
@@ -139,7 +143,7 @@ const makeMultiCandidateVoteCounter = (
|
|
|
139
143
|
outcomePromise.resolve(untiedPositions.concat(tieWinners));
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
E.when(outcomePromise.promise, winPositions => {
|
|
146
|
+
void E.when(outcomePromise.promise, winPositions => {
|
|
143
147
|
/** @type { MultiOutcomeRecord } */
|
|
144
148
|
const voteOutcome = {
|
|
145
149
|
question: details.questionHandle,
|
|
@@ -169,10 +173,10 @@ const makeMultiCandidateVoteCounter = (
|
|
|
169
173
|
chosenPositions.length <= maxChoices ||
|
|
170
174
|
Fail`The number of choices exceeds the max choices.`;
|
|
171
175
|
|
|
172
|
-
|
|
176
|
+
for (const position of chosenPositions) {
|
|
173
177
|
positionIncluded(positions, position) ||
|
|
174
178
|
Fail`The specified choice is not a legal position: ${position}.`;
|
|
175
|
-
}
|
|
179
|
+
}
|
|
176
180
|
|
|
177
181
|
const completedBallot = harden({ chosen: chosenPositions, shares });
|
|
178
182
|
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {ElectoratePublic, ElectorateCreatorFacet} from './types.js';
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* This Electorate visibly has no members, takes no votes, and approves no
|
|
3
6
|
* changes.
|
|
4
7
|
*
|
|
5
8
|
* @type {ContractStartFn<ElectoratePublic, ElectorateCreatorFacet>}
|
|
6
9
|
*/
|
|
7
|
-
export const start: ContractStartFn<ElectoratePublic, ElectorateCreatorFacet>;
|
|
10
|
+
export const start: ContractStartFn<ElectoratePublic, ElectorateCreatorFacet, any, any>;
|
|
11
|
+
import type { ElectoratePublic } from './types.js';
|
|
12
|
+
import type { ElectorateCreatorFacet } from './types.js';
|
|
8
13
|
//# sourceMappingURL=noActionElectorate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noActionElectorate.d.ts","sourceRoot":"","sources":["noActionElectorate.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"noActionElectorate.d.ts","sourceRoot":"","sources":["noActionElectorate.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH;;;;;GAKG;AACH,wFAiDE;sCA1DyD,YAAY;4CAAZ,YAAY"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { makePublishKit } from '@agoric/notifier';
|
|
2
2
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
3
3
|
import { makeExo } from '@agoric/store';
|
|
4
|
+
import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';
|
|
4
5
|
|
|
5
6
|
import { ElectoratePublicI, ElectorateCreatorI } from './typeGuards.js';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @import {ElectoratePublic, ElectorateCreatorFacet} from './types.js';
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
/**
|
|
8
13
|
* This Electorate visibly has no members, takes no votes, and approves no
|
|
9
14
|
* changes.
|
|
@@ -37,8 +42,12 @@ const start = zcf => {
|
|
|
37
42
|
|
|
38
43
|
const creatorFacet = makeExo('creatorFacet', ElectorateCreatorI, {
|
|
39
44
|
getPoserInvitation() {
|
|
40
|
-
return zcf.makeInvitation(
|
|
41
|
-
|
|
45
|
+
return zcf.makeInvitation(
|
|
46
|
+
() => {},
|
|
47
|
+
`noActionElectorate doesn't allow posing questions`,
|
|
48
|
+
undefined,
|
|
49
|
+
EmptyProposalShape,
|
|
50
|
+
);
|
|
42
51
|
},
|
|
43
52
|
addQuestion(_instance, _question) {
|
|
44
53
|
throw Error(`noActionElectorate doesn't add questions.`);
|