@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.
- package/exported.d.ts +37 -0
- package/exported.js +1 -1
- package/package.json +15 -14
- package/src/binaryVoteCounter.d.ts +19 -0
- package/src/binaryVoteCounter.d.ts.map +1 -0
- package/src/binaryVoteCounter.js +4 -0
- package/src/breakTie.d.ts +3 -0
- package/src/breakTie.d.ts.map +1 -0
- package/src/breakTie.js +4 -0
- package/src/closingRule.d.ts +7 -0
- package/src/closingRule.d.ts.map +1 -0
- package/src/closingRule.js +4 -0
- package/src/committee.d.ts +27 -0
- package/src/committee.d.ts.map +1 -0
- package/src/committee.js +4 -0
- package/src/constants.d.ts +16 -0
- package/src/constants.d.ts.map +1 -0
- package/src/contractGovernance/assertions.d.ts +7 -0
- package/src/contractGovernance/assertions.d.ts.map +1 -0
- package/src/contractGovernance/governApi.d.ts +32 -0
- package/src/contractGovernance/governApi.d.ts.map +1 -0
- package/src/contractGovernance/governApi.js +4 -0
- package/src/contractGovernance/governFilter.d.ts +31 -0
- package/src/contractGovernance/governFilter.d.ts.map +1 -0
- package/src/contractGovernance/governFilter.js +4 -0
- package/src/contractGovernance/governParam.d.ts +39 -0
- package/src/contractGovernance/governParam.d.ts.map +1 -0
- package/src/contractGovernance/governParam.js +3 -0
- package/src/contractGovernance/paramManager.d.ts +49 -0
- package/src/contractGovernance/paramManager.d.ts.map +1 -0
- package/src/contractGovernance/paramManager.js +5 -1
- package/src/contractGovernance/typedParamManager.d.ts +38 -0
- package/src/contractGovernance/typedParamManager.d.ts.map +1 -0
- package/src/contractGovernance/typedParamManager.js +5 -0
- package/src/contractGovernor.d.ts +29 -0
- package/src/contractGovernor.d.ts.map +1 -0
- package/src/contractGovernor.js +4 -0
- package/src/contractGovernorKit.d.ts +46 -0
- package/src/contractGovernorKit.d.ts.map +1 -0
- package/src/contractGovernorKit.js +4 -0
- package/src/contractHelper.d.ts +121 -0
- package/src/contractHelper.d.ts.map +1 -0
- package/src/contractHelper.js +4 -0
- package/src/electorateTools.d.ts +50 -0
- package/src/electorateTools.d.ts.map +1 -0
- package/src/electorateTools.js +4 -0
- package/src/index.d.ts +9 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +5 -3
- package/src/multiCandidateVoteCounter.d.ts +19 -0
- package/src/multiCandidateVoteCounter.d.ts.map +1 -0
- package/src/multiCandidateVoteCounter.js +4 -0
- package/src/noActionElectorate.d.ts +13 -0
- package/src/noActionElectorate.d.ts.map +1 -0
- package/src/noActionElectorate.js +4 -0
- package/src/question.d.ts +31 -0
- package/src/question.d.ts.map +1 -0
- package/src/question.js +4 -0
- package/src/quorumCounter.d.ts +6 -0
- package/src/quorumCounter.d.ts.map +1 -0
- package/src/quorumCounter.js +4 -0
- package/src/typeGuards.d.ts +210 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/types.d.ts +562 -0
- package/src/types.d.ts.map +1 -0
- package/src/types.js +2 -1
- package/src/validators.d.ts +21 -0
- package/src/validators.d.ts.map +1 -0
- package/src/validators.js +4 -0
- package/src/voterKit.d.ts +14 -0
- package/src/voterKit.d.ts.map +1 -0
- package/src/voterKit.js +4 -0
- package/tools/puppetContractGovernor.d.ts +53 -0
- package/tools/puppetContractGovernor.d.ts.map +1 -0
- package/tools/puppetContractGovernor.js +4 -2
- package/tools/puppetGovernance.d.ts +102 -0
- package/tools/puppetGovernance.d.ts.map +1 -0
- package/tools/puppetGovernance.js +4 -0
- package/tools/storageDoc.d.ts +10 -0
- package/tools/storageDoc.d.ts.map +1 -0
- package/src/types-ambient.js +0 -731
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export function prepareContractGovernorKit(baggage: import('@agoric/vat-data').Baggage, powers: {
|
|
2
|
+
timer: import('@agoric/time').TimerService;
|
|
3
|
+
zoe: ERef<ZoeService>;
|
|
4
|
+
}): (startedInstanceKit: import("@agoric/zoe/src/zoeService/utils.js").StartedInstanceKit<GovernableStartFn>, limitedCreatorFacet: any) => import("@endo/exo").GuardedKit<{
|
|
5
|
+
helper: {
|
|
6
|
+
/** @type {() => Promise<Instance>} */
|
|
7
|
+
getElectorateInstance(): Promise<Instance>;
|
|
8
|
+
/** @type {() => Promise<PoserFacet>} */
|
|
9
|
+
getUpdatedPoserFacet(): Promise<PoserFacet>;
|
|
10
|
+
provideApiGovernance(): Promise<import("./types.js").ApiGovernor>;
|
|
11
|
+
provideFilterGovernance(): import("./types.js").FilterGovernor;
|
|
12
|
+
provideParamGovernance(): import("./types.js").ParamGovernor;
|
|
13
|
+
};
|
|
14
|
+
creator: {
|
|
15
|
+
/**
|
|
16
|
+
* @param {Invitation} poserInvitation
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
*/
|
|
19
|
+
replaceElectorate(poserInvitation: Invitation): Promise<void>;
|
|
20
|
+
/** @type {VoteOnParamChanges} */
|
|
21
|
+
voteOnParamChanges(voteCounterInstallation: Installation<any>, deadline: import("@agoric/time").Timestamp, paramSpec: import("./types.js").ParamChangesSpec<import("./types.js").StandardParamPath>): Promise<import("./types.js").ContractGovernanceVoteResult>;
|
|
22
|
+
/** @type {VoteOnApiInvocation} */
|
|
23
|
+
voteOnApiInvocation(apiMethodName: string, methodArgs: unknown[], voteCounterInstallation: Installation<any>, deadline: import("@agoric/time").Timestamp): Promise<import("./types.js").ContractGovernanceVoteResult>;
|
|
24
|
+
/** @type {VoteOnOfferFilter} */
|
|
25
|
+
voteOnOfferFilter(voteCounterInstallation: Installation<any>, deadline: import("@agoric/time").Timestamp, strings: string[]): Promise<import("./types.js").ContractGovernanceVoteResult>;
|
|
26
|
+
getCreatorFacet(): any;
|
|
27
|
+
getAdminFacet(): import("@agoric/zoe/src/zoeService/utils.js").AdminFacet<GovernableStartFn>;
|
|
28
|
+
getInstance(): import("@agoric/zoe/src/zoeService/utils.js").Instance<GovernableStartFn>;
|
|
29
|
+
getPublicFacet(): import("./types.js").GovernedPublicFacetMethods;
|
|
30
|
+
};
|
|
31
|
+
public: {
|
|
32
|
+
getElectorate(): Promise<Instance>;
|
|
33
|
+
getGovernedContract(): import("@agoric/zoe/src/zoeService/utils.js").Instance<GovernableStartFn>;
|
|
34
|
+
/** @param {Instance} counter */
|
|
35
|
+
validateVoteCounter(counter: Instance): Promise<void>;
|
|
36
|
+
/** @param {Instance} regP */
|
|
37
|
+
validateElectorate(regP: Instance): Promise<void>;
|
|
38
|
+
/** @param {ClosingRule} closingRule */
|
|
39
|
+
validateTimer(closingRule: ClosingRule): void;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
export type ContractGovernorKit = ReturnType<ReturnType<typeof prepareContractGovernorKit>>;
|
|
43
|
+
import type { GovernableStartFn } from './types.js';
|
|
44
|
+
import type { PoserFacet } from './types.js';
|
|
45
|
+
import type { ClosingRule } from './types.js';
|
|
46
|
+
//# sourceMappingURL=contractGovernorKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contractGovernorKit.d.ts","sourceRoot":"","sources":["contractGovernorKit.js"],"names":[],"mappings":"AAkEO,oDANI,OAAO,kBAAkB,EAAE,OAAO;WAEjC,OAAO,cAAc,EAAE,YAAY;;;;QAmCvC,sCAAsC;iCAArB,QAAQ,QAAQ,CAAC;QAOlC,wCAAwC;;;;;;;QAmExC;;;WAGG;2CAFQ,UAAU,GACR,QAAQ,IAAI,CAAC;QAgB1B,iCAAiC;;QAOjC,kCAAkC;;QAelC,gCAAgC;;;;;;;;;;QA4BhC,gCAAgC;qCAApB,QAAQ;QAepB,6BAA6B;iCAAjB,QAAQ;QAWpB,uCAAuC;;;GAY9C;kCAEa,WAAW,WAAW,iCAAiC,CAAC,CAAC;uCApQ2K,YAAY;gCAAZ,YAAY;iCAAZ,YAAY"}
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
} from './contractGovernance/governParam.js';
|
|
17
17
|
import { ClosingRuleShape, ParamChangesSpecShape } from './typeGuards.js';
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, ClosingRule, GovernableStartFn, LimitedCF, PoserFacet, VoteOnApiInvocation, VoteOnOfferFilter, VoteOnParamChanges} from './types.js';
|
|
21
|
+
*/
|
|
22
|
+
|
|
19
23
|
const trace = makeTracer('CGK', false);
|
|
20
24
|
|
|
21
25
|
const ContractGovernorKitI = {
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export const GOVERNANCE_STORAGE_KEY: "governance";
|
|
2
|
+
export function validateElectorate(zcf: ZCF<GovernanceTerms<{}>>, paramManager: import('./contractGovernance/typedParamManager.js').TypedParamManager<any>): Promise<void>;
|
|
3
|
+
import type { GovernanceTerms } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Helper for the 90% of contracts that will have only a single set of
|
|
6
|
+
* parameters. Using this for managed parameters, a contract only has to
|
|
7
|
+
*
|
|
8
|
+
* - Define the parameter template, which includes name, type and value
|
|
9
|
+
* - Add any methods needed in the public and creator facets.
|
|
10
|
+
*
|
|
11
|
+
* It's also crucial that the governed contract not interact with the product of
|
|
12
|
+
* makeGovernorFacet(). The wrapped creatorFacet has the power to change
|
|
13
|
+
* parameter values, and the governance guarantees only hold if they're not used
|
|
14
|
+
* directly by the governed contract.
|
|
15
|
+
*
|
|
16
|
+
* @template {import('./contractGovernance/typedParamManager.js').ParamTypesMap} M
|
|
17
|
+
* Map of types of custom governed terms
|
|
18
|
+
* @param {ZCF<GovernanceTerms<M>>} zcf
|
|
19
|
+
* @param {Invitation} initialPoserInvitation
|
|
20
|
+
* @param {M} paramTypesMap
|
|
21
|
+
* @param {ERef<StorageNode>} [storageNode]
|
|
22
|
+
* @param {ERef<Marshaller>} [marshaller]
|
|
23
|
+
*/
|
|
24
|
+
export function handleParamGovernance<M extends import("./contractGovernance/typedParamManager.js").ParamTypesMap>(zcf: ZCF<GovernanceTerms<M>>, initialPoserInvitation: Invitation, paramTypesMap: M, storageNode?: ERef<StorageNode> | undefined, marshaller?: ERef<Marshaller<unknown>> | undefined): {
|
|
25
|
+
publicMixin: {
|
|
26
|
+
getAmount: (name: string) => globalThis.Amount;
|
|
27
|
+
getBrand: (name: string) => globalThis.Brand;
|
|
28
|
+
getInstance: (name: string) => Instance;
|
|
29
|
+
getInstallation: (name: string) => Installation<any>;
|
|
30
|
+
getInvitationAmount: (name: string) => globalThis.Amount<"set">;
|
|
31
|
+
getNat: (name: string) => bigint;
|
|
32
|
+
getRatio: (name: string) => Ratio;
|
|
33
|
+
getString: (name: string) => string;
|
|
34
|
+
getTimestamp: (name: string) => import("@agoric/time").TimestampRecord;
|
|
35
|
+
getRelativeTime: (name: string) => import("@agoric/time").RelativeTimeRecord;
|
|
36
|
+
getUnknown: (name: string) => any;
|
|
37
|
+
getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
|
|
38
|
+
getGovernedParams: () => ERef<import("./types.js").ParamStateRecord>;
|
|
39
|
+
};
|
|
40
|
+
augmentPublicFacet: <PF extends {}>(originalPublicFacet: PF) => GovernedPublicFacet<PF>;
|
|
41
|
+
augmentVirtualPublicFacet: <OPF extends {}>(originalPublicFacet: OPF) => OPF & {
|
|
42
|
+
getBrand: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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)>;
|
|
43
|
+
getInstallation: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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)>;
|
|
44
|
+
getInstance: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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)>;
|
|
45
|
+
getAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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)>;
|
|
46
|
+
getInvitationAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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)>;
|
|
47
|
+
getNat: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getRatio: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getString: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getTimestamp: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getRelativeTime: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getUnknown: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
|
|
54
|
+
getGovernedParams: () => ERef<import("./types.js").ParamStateRecord>;
|
|
55
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, OPF & {
|
|
56
|
+
getBrand: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getInstallation: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getInstance: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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)>;
|
|
59
|
+
getAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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)>;
|
|
60
|
+
getInvitationAmount: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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)>;
|
|
61
|
+
getNat: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getRatio: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getString: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getTimestamp: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getRelativeTime: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getUnknown: import("@agoric/swingset-liveslots").PlusContext<never, ((name: string) => globalThis.Amount<"set">) | ((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
|
+
getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
|
|
68
|
+
getGovernedParams: () => ERef<import("./types.js").ParamStateRecord>;
|
|
69
|
+
}>;
|
|
70
|
+
makeGovernorFacet: <CF extends {}>(originalCreatorFacet: CF, governedApis?: {} | undefined) => GovernedCreatorFacet<CF>;
|
|
71
|
+
makeFarGovernorFacet: <CF_1 extends {}>(limitedCreatorFacet: CF_1, governedApis?: Record<string, (...any: any[]) => unknown> | undefined) => GovernedCreatorFacet<CF_1>;
|
|
72
|
+
makeVirtualGovernorFacet: <LCF extends {
|
|
73
|
+
[methodName: string]: (context?: unknown, ...rest: unknown[]) => unknown;
|
|
74
|
+
}>(limitedCreatorFacet: LCF) => {
|
|
75
|
+
governorFacet: import("@agoric/swingset-liveslots").FunctionsPlusContext<unknown, GovernedCreatorFacet<LCF>>;
|
|
76
|
+
limitedCreatorFacet: LCF;
|
|
77
|
+
};
|
|
78
|
+
makeDurableGovernorFacet: <CF_2>(baggage: import('@agoric/vat-data').Baggage, limitedCreatorFacet: CF_2, governedApis?: Record<string, (...any: any[]) => unknown> | undefined) => {
|
|
79
|
+
governorFacet: import("@endo/exo").Guarded<{
|
|
80
|
+
getParamMgrRetriever: () => {
|
|
81
|
+
get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
|
|
82
|
+
Electorate: "invitation";
|
|
83
|
+
}>;
|
|
84
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
85
|
+
get: () => import("./contractGovernance/typedParamManager.js").TypedParamManager<M & {
|
|
86
|
+
Electorate: "invitation";
|
|
87
|
+
}>;
|
|
88
|
+
}>;
|
|
89
|
+
getInvitation: (name: any) => Promise<Invitation<unknown, undefined>>;
|
|
90
|
+
getLimitedCreatorFacet: () => CF_2;
|
|
91
|
+
/** @type {() => GovernedApis} */
|
|
92
|
+
getGovernedApis: () => GovernedApis;
|
|
93
|
+
getGovernedApiNames: () => string[];
|
|
94
|
+
setOfferFilter: (strings: any) => Promise<void>;
|
|
95
|
+
}>;
|
|
96
|
+
limitedCreatorFacet: CF_2;
|
|
97
|
+
};
|
|
98
|
+
params: import("./contractGovernance/typedParamManager.js").Getters<M & {
|
|
99
|
+
Electorate: "invitation";
|
|
100
|
+
}>;
|
|
101
|
+
};
|
|
102
|
+
export namespace publicMixinAPI {
|
|
103
|
+
let getSubscription: import("@endo/patterns").MethodGuard;
|
|
104
|
+
let getGovernedParams: import("@endo/patterns").MethodGuard;
|
|
105
|
+
let getAmount: import("@endo/patterns").MethodGuard;
|
|
106
|
+
let getBrand: import("@endo/patterns").MethodGuard;
|
|
107
|
+
let getInstance: import("@endo/patterns").MethodGuard;
|
|
108
|
+
let getInstallation: import("@endo/patterns").MethodGuard;
|
|
109
|
+
let getInvitationAmount: import("@endo/patterns").MethodGuard;
|
|
110
|
+
let getNat: import("@endo/patterns").MethodGuard;
|
|
111
|
+
let getRatio: import("@endo/patterns").MethodGuard;
|
|
112
|
+
let getString: import("@endo/patterns").MethodGuard;
|
|
113
|
+
let getTimestamp: import("@endo/patterns").MethodGuard;
|
|
114
|
+
let getRelativeTime: import("@endo/patterns").MethodGuard;
|
|
115
|
+
let getUnknown: import("@endo/patterns").MethodGuard;
|
|
116
|
+
}
|
|
117
|
+
import type { GovernanceSubscriptionState } from './types.js';
|
|
118
|
+
import type { GovernedPublicFacet } from './types.js';
|
|
119
|
+
import type { GovernedCreatorFacet } from './types.js';
|
|
120
|
+
import type { GovernedApis } from './types.js';
|
|
121
|
+
//# sourceMappingURL=contractHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contractHelper.d.ts","sourceRoot":"","sources":["contractHelper.js"],"names":[],"mappings":"AAkBA,kDAAmD;AAsB5C,gFAFI,OAAO,2CAA2C,EAAE,iBAAiB,CAAC,GAAG,CAAC,iBAepF;qCAxCqO,YAAY;AAkOlP;;;;;;;;;;;;;;;;;;;GAmBG;AACH,yKALW,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wHAvImB,OAAO;;yCAuCI,OAAO,WAAW,OAAO,EAAE,KAAK,OAAO;;;;;8CA+B7E,OAAO,kBAAkB,EAAE,OAAO,8EAEP,OAAO;;;;;;;;;;;;;YAkBvC,iCAAiC;;;;;;;;;;EAuExC;;;;;;;;;;;;;;;;iDA3QqO,YAAY;yCAAZ,YAAY;0CAAZ,YAAY;kCAAZ,YAAY"}
|
package/src/contractHelper.js
CHANGED
|
@@ -10,6 +10,10 @@ import { assertElectorateMatches } from './contractGovernance/paramManager.js';
|
|
|
10
10
|
import { makeParamManagerFromTerms } from './contractGovernance/typedParamManager.js';
|
|
11
11
|
import { GovernorFacetShape } from './typeGuards.js';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, GovernanceSubscriptionState, GovernanceTerms, GovernedApis, GovernedCreatorFacet, GovernedPublicFacet} from './types.js';
|
|
15
|
+
*/
|
|
16
|
+
|
|
13
17
|
const { Fail, quote: q } = assert;
|
|
14
18
|
|
|
15
19
|
export const GOVERNANCE_STORAGE_KEY = 'governance';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type QuestionRecord = {
|
|
2
|
+
voteCap: ERef<VoteCounterCreatorFacet>;
|
|
3
|
+
publicFacet: VoteCounterPublicFacet;
|
|
4
|
+
deadline: import('@agoric/time').Timestamp;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn} from './types.js';
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {object} QuestionRecord
|
|
11
|
+
* @property {ERef<VoteCounterCreatorFacet>} voteCap
|
|
12
|
+
* @property {VoteCounterPublicFacet} publicFacet
|
|
13
|
+
* @property {import('@agoric/time').Timestamp} deadline
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Start up a new Counter for a question
|
|
17
|
+
*
|
|
18
|
+
* @param {ZCF} zcf
|
|
19
|
+
* @param {QuestionSpec} questionSpec
|
|
20
|
+
* @param {unknown} quorumThreshold
|
|
21
|
+
* @param {ERef<Installation>} voteCounter
|
|
22
|
+
* @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore
|
|
23
|
+
* @param {Publisher<unknown>} questionsPublisher
|
|
24
|
+
* @param {Publisher<OutcomeRecord>} outcomePublisher
|
|
25
|
+
* @returns {Promise<AddQuestionReturn>}
|
|
26
|
+
*/
|
|
27
|
+
export function startCounter(zcf: ZCF, questionSpec: QuestionSpec, quorumThreshold: unknown, voteCounter: ERef<Installation<any>>, questionStore: MapStore<Handle<'Question'>, QuestionRecord>, questionsPublisher: Publisher<unknown>, outcomePublisher: Publisher<OutcomeRecord>): Promise<AddQuestionReturn>;
|
|
28
|
+
/** @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore */
|
|
29
|
+
export function getOpenQuestions(questionStore: MapStore<Handle<'Question'>, QuestionRecord>): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* @param {ERef<Handle<'Question'>>} questionHandleP
|
|
32
|
+
* @param {MapStore<Handle<'Question'>, QuestionRecord>} questionStore
|
|
33
|
+
*/
|
|
34
|
+
export function getQuestion(questionHandleP: ERef<Handle<"Question">>, questionStore: MapStore<Handle<'Question'>, QuestionRecord>): Promise<import("./types.js").Question>;
|
|
35
|
+
/**
|
|
36
|
+
* @param {ZCF} zcf
|
|
37
|
+
* @param {AddQuestion} addQuestion
|
|
38
|
+
*/
|
|
39
|
+
export function getPoserInvitation(zcf: ZCF, addQuestion: AddQuestion): Promise<Invitation<{
|
|
40
|
+
addQuestion: AddQuestion;
|
|
41
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
42
|
+
addQuestion: AddQuestion;
|
|
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';
|
|
50
|
+
//# sourceMappingURL=electorateTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,uDAEP,SAAS,OAAO,UAAU,CAAC,EAAE,cAAc,CAAC,sBAC5C,UAAU,OAAO,CAAC,0EAwC5B;AAED,0EAA0E;AAC1E,gDADY,SAAS,OAAO,UAAU,CAAC,EAAE,cAAc,CAAC,gBAYvD;AAED;;;GAGG;AACH,sFAFW,SAAS,OAAO,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
|
@@ -2,6 +2,10 @@ import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';
|
|
|
2
2
|
import { E } from '@endo/eventual-send';
|
|
3
3
|
import { deeplyFulfilled, Far } from '@endo/marshal';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn} from './types.js';
|
|
7
|
+
*/
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
* @typedef {object} QuestionRecord
|
|
7
11
|
* @property {ERef<VoteCounterCreatorFacet>} voteCap
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ParamTypes } from "./constants.js";
|
|
2
|
+
export { ChoiceMethod, ElectionType, QuorumRule, coerceQuestionSpec, positionIncluded, buildQuestion } from "./question.js";
|
|
3
|
+
export { validateQuestionDetails, validateQuestionFromCounter } from "./contractGovernor.js";
|
|
4
|
+
export { handleParamGovernance, publicMixinAPI } from "./contractHelper.js";
|
|
5
|
+
export { assertBallotConcernsParam, makeParamChangePositions, setupParamGovernance, CONTRACT_ELECTORATE } from "./contractGovernance/governParam.js";
|
|
6
|
+
export { assertElectorateMatches, makeParamManagerBuilder } from "./contractGovernance/paramManager.js";
|
|
7
|
+
export { makeParamManager, makeParamManagerSync } from "./contractGovernance/typedParamManager.js";
|
|
8
|
+
export { assertContractGovernance, assertContractElectorate } from "./validators.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
|
|
2
|
+
import '@agoric/ertp/exported.js';
|
|
3
|
+
import '@agoric/zoe/src/contractFacet/types-ambient.js';
|
|
4
|
+
import '@agoric/zoe/tools/types-ambient.js';
|
|
5
|
+
import '@agoric/zoe/src/types.js';
|
|
4
6
|
|
|
5
7
|
/// <reference path="./types-ambient.js" />
|
|
6
8
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @type {BuildMultiVoteCounter} */
|
|
2
|
+
export const makeMultiCandidateVoteCounter: BuildMultiVoteCounter;
|
|
3
|
+
/**
|
|
4
|
+
* @param {ZCF<{questionSpec: QuestionSpec, quorumThreshold: bigint }>} zcf
|
|
5
|
+
* @param {{outcomePublisher: Publisher<MultiOutcomeRecord>}} outcomePublisher
|
|
6
|
+
*/
|
|
7
|
+
export function start(zcf: ZCF<{
|
|
8
|
+
questionSpec: QuestionSpec;
|
|
9
|
+
quorumThreshold: bigint;
|
|
10
|
+
}>, { outcomePublisher }: {
|
|
11
|
+
outcomePublisher: Publisher<MultiOutcomeRecord>;
|
|
12
|
+
}): {
|
|
13
|
+
publicFacet: import("./types.js").MultiVoteCounterPublicFacet;
|
|
14
|
+
creatorFacet: import("./types.js").VoteCounterCreatorFacet;
|
|
15
|
+
};
|
|
16
|
+
import type { BuildMultiVoteCounter } from './types.js';
|
|
17
|
+
import type { QuestionSpec } from './types.js';
|
|
18
|
+
import type { MultiOutcomeRecord } from './types.js';
|
|
19
|
+
//# sourceMappingURL=multiCandidateVoteCounter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiCandidateVoteCounter.d.ts","sourceRoot":"","sources":["multiCandidateVoteCounter.js"],"names":[],"mappings":"AAqCA,oCAAoC;AACpC,kEAuLE;AAEF;;;GAGG;AACH;;qBAH6D,MAAM;;;;;;EAiBlE;2CA5NmG,YAAY;kCAAZ,YAAY;wCAAZ,YAAY"}
|
|
@@ -18,6 +18,10 @@ import {
|
|
|
18
18
|
import { makeQuorumCounter } from './quorumCounter.js';
|
|
19
19
|
import { breakTie } from './breakTie.js';
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @import {QuestionSpec, BuildMultiVoteCounter, MultiOutcomeRecord, Position, VoteStatistics} from './types.js';
|
|
23
|
+
*/
|
|
24
|
+
|
|
21
25
|
const { Fail } = assert;
|
|
22
26
|
|
|
23
27
|
const validateQuestionSpec = questionSpec => {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {ElectoratePublic, ElectorateCreatorFacet} from './types.js';
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* This Electorate visibly has no members, takes no votes, and approves no
|
|
6
|
+
* changes.
|
|
7
|
+
*
|
|
8
|
+
* @type {ContractStartFn<ElectoratePublic, ElectorateCreatorFacet>}
|
|
9
|
+
*/
|
|
10
|
+
export const start: ContractStartFn<ElectoratePublic, ElectorateCreatorFacet, any, any>;
|
|
11
|
+
import type { ElectoratePublic } from './types.js';
|
|
12
|
+
import type { ElectorateCreatorFacet } from './types.js';
|
|
13
|
+
//# sourceMappingURL=noActionElectorate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noActionElectorate.d.ts","sourceRoot":"","sources":["noActionElectorate.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH;;;;;GAKG;AACH,wFAiDE;sCA1DyD,YAAY;4CAAZ,YAAY"}
|
|
@@ -5,6 +5,10 @@ import { EmptyProposalShape } from '@agoric/zoe/src/typeGuards.js';
|
|
|
5
5
|
|
|
6
6
|
import { ElectoratePublicI, ElectorateCreatorI } from './typeGuards.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @import {ElectoratePublic, ElectorateCreatorFacet} from './types.js';
|
|
10
|
+
*/
|
|
11
|
+
|
|
8
12
|
/**
|
|
9
13
|
* This Electorate visibly has no members, takes no votes, and approves no
|
|
10
14
|
* changes.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @type {BuildQuestion} */
|
|
2
|
+
export const buildQuestion: BuildQuestion;
|
|
3
|
+
export namespace ChoiceMethod {
|
|
4
|
+
let UNRANKED: "unranked";
|
|
5
|
+
let ORDER: "order";
|
|
6
|
+
let PLURALITY: "plurality";
|
|
7
|
+
}
|
|
8
|
+
export namespace ElectionType {
|
|
9
|
+
let PARAM_CHANGE: "param_change";
|
|
10
|
+
let ELECTION: "election";
|
|
11
|
+
let SURVEY: "survey";
|
|
12
|
+
let API_INVOCATION: "api_invocation";
|
|
13
|
+
let OFFER_FILTER: "offer_filter";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
* @param {QuestionSpec} allegedQuestionSpec
|
|
18
|
+
* @returns {QuestionSpec}
|
|
19
|
+
*/
|
|
20
|
+
export function coerceQuestionSpec({ method, issue, positions, electionType, maxChoices, maxWinners, closingRule, quorumRule, tieOutcome, }: QuestionSpec): QuestionSpec;
|
|
21
|
+
/** @type {PositionIncluded} */
|
|
22
|
+
export const positionIncluded: PositionIncluded;
|
|
23
|
+
export namespace QuorumRule {
|
|
24
|
+
let MAJORITY: "majority";
|
|
25
|
+
let NO_QUORUM: "no_quorum";
|
|
26
|
+
let ALL: "all";
|
|
27
|
+
}
|
|
28
|
+
import type { BuildQuestion } from './types.js';
|
|
29
|
+
import type { QuestionSpec } from './types.js';
|
|
30
|
+
import type { PositionIncluded } from './types.js';
|
|
31
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["question.js"],"names":[],"mappings":"AAqFA,4BAA4B;AAC5B,0CAgBE;;;;;;;;;;;;;AAxDF;;;;GAIG;AACH,yKAgCC;AAxCD,+BAA+B;AAC/B,gDAA4E;;;;;;mCAtCF,YAAY;kCAAZ,YAAY;sCAAZ,YAAY"}
|
package/src/question.js
CHANGED
|
@@ -3,6 +3,10 @@ import { makeHandle } from '@agoric/zoe/src/makeHandle.js';
|
|
|
3
3
|
|
|
4
4
|
import { QuestionI, QuestionSpecShape } from './typeGuards.js';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @import {BuildQuestion, PositionIncluded, Question, QuestionSpec} from './types.js';
|
|
8
|
+
*/
|
|
9
|
+
|
|
6
10
|
// Topics being voted on are 'Questions'. Before a Question is known to a
|
|
7
11
|
// electorate, the parameters can be described with a QuestionSpec. Once the
|
|
8
12
|
// question has been presented to an Electorate, there is a QuestionDetails
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quorumCounter.d.ts","sourceRoot":"","sources":["quorumCounter.js"],"names":[],"mappings":"AAQO;;;;GAUN"}
|