@agoric/governance 0.10.4-dev-aa68d8f.0 → 0.10.4-dev-651b051.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/package.json +22 -22
- package/src/contractGovernance/governApi.d.ts +7 -6
- package/src/contractGovernance/governApi.d.ts.map +1 -1
- package/src/contractGovernance/governApi.js +3 -2
- package/src/contractGovernance/governParam.d.ts +2 -1
- package/src/contractGovernance/governParam.d.ts.map +1 -1
- package/src/contractGovernance/governParam.js +1 -0
- package/src/contractGovernance/paramManager.d.ts +2 -2
- package/src/contractGovernance/paramManager.d.ts.map +1 -1
- package/src/contractGovernance/paramManager.js +2 -2
- package/src/contractGovernorKit.d.ts +1 -1
- package/src/contractGovernorKit.d.ts.map +1 -1
- package/src/contractGovernorKit.js +2 -1
- package/src/contractHelper.d.ts +29 -29
- package/src/electorateTools.d.ts +1 -1
- package/src/quorumCounter.d.ts +1 -1
- package/src/typeGuards.d.ts +1 -1
- package/src/types.d.ts +10 -963
- package/src/types.d.ts.map +1 -1
- package/src/types.js +14 -10
- package/tools/puppetContractGovernor.d.ts +8 -6
- package/tools/puppetContractGovernor.d.ts.map +1 -1
- package/tools/puppetContractGovernor.js +2 -1
- package/tools/puppetGovernance.d.ts +13 -13
- package/tools/puppetGovernance.d.ts.map +1 -1
package/src/types.d.ts
CHANGED
|
@@ -19,17 +19,14 @@ export type QuorumRule = "majority" | "all" | "no_quorum";
|
|
|
19
19
|
export type SimpleIssue = {
|
|
20
20
|
text: string;
|
|
21
21
|
};
|
|
22
|
-
export type ParamValue =
|
|
22
|
+
export type ParamValue = string | number | bigint | globalThis.Brand | globalThis.Amount | import("@agoric/time").TimestampRecord | import("@agoric/time").RelativeTimeRecord | Instance | Installation<any> | Ratio | Container<any, any>;
|
|
23
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
24
|
export type ParamValueTyped<T extends ParamType = ParamType> = {
|
|
28
25
|
type: T;
|
|
29
26
|
value: ParamValueForType<T>;
|
|
30
27
|
};
|
|
31
28
|
/**
|
|
32
|
-
*
|
|
29
|
+
* Terms a contract must provide in order to be governed.
|
|
33
30
|
*/
|
|
34
31
|
export type GovernanceTerms<T extends import("./contractGovernance/typedParamManager.js").ParamTypesMap> = {
|
|
35
32
|
electionManager: import("@agoric/zoe/src/zoeService/utils.js").Instance<typeof import("./contractGovernor.js")["start"]>;
|
|
@@ -293,7 +290,7 @@ export type ParamManagerBase = {
|
|
|
293
290
|
getBrand: (name: string) => Brand;
|
|
294
291
|
getInstance: (name: string) => Instance;
|
|
295
292
|
getInstallation: (name: string) => Installation;
|
|
296
|
-
getInvitationAmount: (name: string) =>
|
|
293
|
+
getInvitationAmount: (name: string) => InvitationAmount;
|
|
297
294
|
getNat: (name: string) => bigint;
|
|
298
295
|
getRatio: (name: string) => Ratio;
|
|
299
296
|
getString: (name: string) => string;
|
|
@@ -351,7 +348,7 @@ export type NoChangeOfferFilterPosition = {
|
|
|
351
348
|
};
|
|
352
349
|
export type InvokeApiPosition = {
|
|
353
350
|
apiMethodName: string;
|
|
354
|
-
methodArgs:
|
|
351
|
+
methodArgs: Passable[];
|
|
355
352
|
};
|
|
356
353
|
export type DontInvokeApiPosition = {
|
|
357
354
|
dontInvoke: string;
|
|
@@ -466,7 +463,7 @@ export type ParamManagerRetriever = {
|
|
|
466
463
|
get: (paramKey?: ParamKey) => AnyParamManager;
|
|
467
464
|
};
|
|
468
465
|
export type VoteOnParamChanges<P = StandardParamPath> = (voteCounterInstallation: Installation, deadline: import("@agoric/time").Timestamp, paramSpec: ParamChangesSpec<P>) => Promise<ContractGovernanceVoteResult>;
|
|
469
|
-
export type VoteOnApiInvocation = (apiMethodName: string, methodArgs:
|
|
466
|
+
export type VoteOnApiInvocation = (apiMethodName: string, methodArgs: Passable[], voteCounterInstallation: Installation, deadline: import("@agoric/time").Timestamp) => Promise<ContractGovernanceVoteResult>;
|
|
470
467
|
export type VoteOnOfferFilter = (voteCounterInstallation: Installation, deadline: import("@agoric/time").Timestamp, strings: string[]) => Promise<ContractGovernanceVoteResult>;
|
|
471
468
|
export type ParamGovernor = {
|
|
472
469
|
voteOnParamChanges: VoteOnParamChanges;
|
|
@@ -502,960 +499,7 @@ export type AssertContractGovernance = (zoe: ERef<ZoeService>, allegedGoverned:
|
|
|
502
499
|
};
|
|
503
500
|
label?: string | undefined;
|
|
504
501
|
};
|
|
505
|
-
}>, privateArgs:
|
|
506
|
-
/**
|
|
507
|
-
* @typedef {object} VoteStatistics
|
|
508
|
-
* @property {bigint} spoiled
|
|
509
|
-
* @property {number} votes
|
|
510
|
-
* @property {PositionCount[]} results
|
|
511
|
-
*/
|
|
512
|
-
/**
|
|
513
|
-
* @typedef {object} QuorumCounter
|
|
514
|
-
* @property {(stats: VoteStatistics) => boolean} check
|
|
515
|
-
*/
|
|
516
|
-
/**
|
|
517
|
-
* @callback BuildQuestion
|
|
518
|
-
* @param {QuestionSpec} questionSpec
|
|
519
|
-
* @param {Instance} instance - voteCounter instance
|
|
520
|
-
* @returns {Question}
|
|
521
|
-
*/
|
|
522
|
-
/**
|
|
523
|
-
* @typedef {object} VoteCounterCreatorFacet - a facet that the Electorate should
|
|
524
|
-
* hold tightly. submitVote() is the core capability that allows the holder to
|
|
525
|
-
* specify the identity and choice of a voter. The voteCounter is making that
|
|
526
|
-
* available to the Electorate, which should wrap and attenuate it so each
|
|
527
|
-
* voter gets only the ability to cast their own vote at a weight specified by
|
|
528
|
-
* the electorate.
|
|
529
|
-
* @property {SubmitVote} submitVote
|
|
530
|
-
*/
|
|
531
|
-
/**
|
|
532
|
-
* @typedef {object} VoteCounterPublicFacet
|
|
533
|
-
* @property {() => boolean} isOpen
|
|
534
|
-
* @property {() => Question} getQuestion
|
|
535
|
-
* @property {() => Promise<Position>} getOutcome
|
|
536
|
-
* @property {() => QuestionDetails} getDetails
|
|
537
|
-
* @property {() => Promise<VoteStatistics>} getStats
|
|
538
|
-
*/
|
|
539
|
-
/**
|
|
540
|
-
* @typedef {object} MultiVoteCounterPublicFacet
|
|
541
|
-
* @property {() => boolean} isOpen
|
|
542
|
-
* @property {() => Question} getQuestion
|
|
543
|
-
* @property {() => Promise<Position[]>} getOutcome
|
|
544
|
-
* @property {() => QuestionDetails} getDetails
|
|
545
|
-
* @property {() => Promise<VoteStatistics>} getStats
|
|
546
|
-
*/
|
|
547
|
-
/**
|
|
548
|
-
* @typedef {object} VoteCounterCloseFacet
|
|
549
|
-
* TEST ONLY: Should not be allowed to escape from contracts
|
|
550
|
-
* @property {() => void} closeVoting
|
|
551
|
-
*/
|
|
552
|
-
/**
|
|
553
|
-
* @typedef {object} VoteCounterFacets
|
|
554
|
-
* @property {VoteCounterPublicFacet} publicFacet
|
|
555
|
-
* @property {VoteCounterCreatorFacet} creatorFacet
|
|
556
|
-
* @property {VoteCounterCloseFacet} closeFacet
|
|
557
|
-
*/
|
|
558
|
-
/**
|
|
559
|
-
* @typedef {object} MultiVoteCounterFacets
|
|
560
|
-
* @property {MultiVoteCounterPublicFacet} publicFacet
|
|
561
|
-
* @property {VoteCounterCreatorFacet} creatorFacet
|
|
562
|
-
* @property {VoteCounterCloseFacet} closeFacet
|
|
563
|
-
*/
|
|
564
|
-
/**
|
|
565
|
-
* @callback BuildVoteCounter
|
|
566
|
-
* @param {QuestionSpec} questionSpec
|
|
567
|
-
* @param {bigint} threshold - questionSpec includes quorumRule; the electorate
|
|
568
|
-
* converts that to a number that the counter can enforce.
|
|
569
|
-
* @param {Instance} instance
|
|
570
|
-
* @param {ERef<Publisher<OutcomeRecord>>} publisher
|
|
571
|
-
* @returns {VoteCounterFacets}
|
|
572
|
-
*/
|
|
573
|
-
/**
|
|
574
|
-
* @callback BuildMultiVoteCounter
|
|
575
|
-
* @param {QuestionSpec} questionSpec
|
|
576
|
-
* @param {bigint} threshold - questionSpec includes quorumRule; the electorate
|
|
577
|
-
* converts that to a number that the counter can enforce.
|
|
578
|
-
* @param {Instance} instance
|
|
579
|
-
* @param {ERef<Publisher<MultiOutcomeRecord>>} publisher
|
|
580
|
-
* @returns {MultiVoteCounterFacets}
|
|
581
|
-
*/
|
|
582
|
-
/**
|
|
583
|
-
* @typedef {object} CompletedBallet
|
|
584
|
-
* @property {Position} chosen
|
|
585
|
-
* @property {bigint} shares
|
|
586
|
-
*/
|
|
587
|
-
/**
|
|
588
|
-
* @callback SubmitVote
|
|
589
|
-
* @param {Handle<'Voter'>} voterHandle
|
|
590
|
-
* @param {Position[]} chosenPositions
|
|
591
|
-
* @param {bigint} [weight]
|
|
592
|
-
* @returns {CompletedBallet}
|
|
593
|
-
*/
|
|
594
|
-
/**
|
|
595
|
-
* @callback GetOpenQuestions
|
|
596
|
-
* @returns {Promise<Handle<'Question'>[]>}
|
|
597
|
-
*/
|
|
598
|
-
/**
|
|
599
|
-
* @callback GetQuestion
|
|
600
|
-
* @param {Handle<'Question'>} h
|
|
601
|
-
* @returns {Promise<Question>}
|
|
602
|
-
*/
|
|
603
|
-
/**
|
|
604
|
-
* @typedef {object} ElectoratePublic
|
|
605
|
-
* @property {() => Subscriber<QuestionDetails>} getQuestionSubscriber
|
|
606
|
-
* @property {GetOpenQuestions} getOpenQuestions,
|
|
607
|
-
* @property {() => Instance} getInstance
|
|
608
|
-
* @property {GetQuestion} getQuestion
|
|
609
|
-
*/
|
|
610
|
-
/**
|
|
611
|
-
* @typedef { ElectoratePublic & {makeVoterInvitation: () => ERef<Invitation>} } ClaimsElectoratePublic
|
|
612
|
-
* @typedef { ElectoratePublic & {getName: () => string} } CommitteeElectoratePublic
|
|
613
|
-
*/
|
|
614
|
-
/**
|
|
615
|
-
* @typedef {object} PoserFacet
|
|
616
|
-
* @property {AddQuestion} addQuestion
|
|
617
|
-
*/
|
|
618
|
-
/**
|
|
619
|
-
* @typedef {object} ElectorateCreatorFacet
|
|
620
|
-
* @property {AddQuestion} addQuestion can be used directly when the creator doesn't need any
|
|
621
|
-
* reassurance. When someone needs to connect addQuestion to the Electorate
|
|
622
|
-
* instance, getPoserInvitation() lets them get addQuestion with assurance.
|
|
623
|
-
* @property {() => Promise<Invitation>} getPoserInvitation
|
|
624
|
-
* @property {() => Subscriber<QuestionDetails>} getQuestionSubscriber
|
|
625
|
-
* @property {() => ElectoratePublic} getPublicFacet
|
|
626
|
-
*/
|
|
627
|
-
/**
|
|
628
|
-
* @typedef {object} GetVoterInvitations
|
|
629
|
-
* @property {() => Invitation[]} getVoterInvitations
|
|
630
|
-
*/
|
|
631
|
-
/**
|
|
632
|
-
* @typedef {object} VoterFacet - a facet that the Electorate should hold
|
|
633
|
-
* tightly. It allows specification of the vote's weight, so the Electorate
|
|
634
|
-
* should distribute an attenuated wrapper that doesn't make that available!
|
|
635
|
-
* @property {SubmitVote} submitVote
|
|
636
|
-
*/
|
|
637
|
-
/**
|
|
638
|
-
* @typedef {object} ClosingRule
|
|
639
|
-
* @property {ERef<import('@agoric/time').TimerService>} timer
|
|
640
|
-
* @property {import('@agoric/time').Timestamp} deadline
|
|
641
|
-
*/
|
|
642
|
-
/**
|
|
643
|
-
* @callback CloseVoting
|
|
644
|
-
* @param {ClosingRule} closingRule
|
|
645
|
-
* @param {() => void} closeVoting
|
|
646
|
-
*/
|
|
647
|
-
/**
|
|
648
|
-
* @typedef {object} AddQuestionReturn
|
|
649
|
-
* @property {VoteCounterPublicFacet} publicFacet
|
|
650
|
-
* @property {VoteCounterCreatorFacet} creatorFacet
|
|
651
|
-
* @property {import('@agoric/zoe/src/zoeService/utils.js').Instance<typeof import('./binaryVoteCounter.js').start>} instance
|
|
652
|
-
* @property {import('@agoric/time').Timestamp} deadline
|
|
653
|
-
* @property {Handle<'Question'>} questionHandle
|
|
654
|
-
*/
|
|
655
|
-
/**
|
|
656
|
-
* @callback AddQuestion
|
|
657
|
-
* @param {ERef<Installation>} voteCounter
|
|
658
|
-
* @param {QuestionSpec} questionSpec
|
|
659
|
-
* @returns {Promise<AddQuestionReturn>}
|
|
660
|
-
*/
|
|
661
|
-
/**
|
|
662
|
-
* @callback CreateQuestion
|
|
663
|
-
*
|
|
664
|
-
* @param {string} name - The name of the parameter to change
|
|
665
|
-
* @param {ParamValue} proposedValue - the proposed value for the named
|
|
666
|
-
* parameter
|
|
667
|
-
* @param {Installation} voteCounterInstallation - the voteCounter to
|
|
668
|
-
* instantiate to count votes. Expected to be a binaryVoteCounter. Other
|
|
669
|
-
* voteCounters might be added here, or might require separate governors.
|
|
670
|
-
* under management so users can trace it back and see that it would use
|
|
671
|
-
* this electionManager to manage parameters
|
|
672
|
-
* @param {Instance} contractInstance - include the instance of the contract
|
|
673
|
-
* @param {ClosingRule} closingRule - deadline and timer for closing voting
|
|
674
|
-
* @returns {Promise<QuestionDetails>}
|
|
675
|
-
*/
|
|
676
|
-
/**
|
|
677
|
-
* @template [P=StandardParamPath] path for a paramManagerRetriever
|
|
678
|
-
* @typedef {object} ParamChangeIssue
|
|
679
|
-
* @property {ParamChangesSpec<P>} spec
|
|
680
|
-
* @property {import('@agoric/zoe/src/zoeService/utils.js').Instance<(zcf: ZCF<GovernanceTerms<{}>>) => {}>} contract
|
|
681
|
-
*/
|
|
682
|
-
/**
|
|
683
|
-
* @typedef {object} ApiInvocationIssue
|
|
684
|
-
* @property {string} apiMethodName
|
|
685
|
-
* @property {unknown[]} methodArgs
|
|
686
|
-
*/
|
|
687
|
-
/**
|
|
688
|
-
* @typedef {object} OfferFilterIssue
|
|
689
|
-
* @property {string[]} strings
|
|
690
|
-
*/
|
|
691
|
-
/**
|
|
692
|
-
* @typedef {object} ParamChangePositions
|
|
693
|
-
* @property {ChangeParamsPosition} positive
|
|
694
|
-
* @property {NoChangeParamsPosition} negative
|
|
695
|
-
*/
|
|
696
|
-
/**
|
|
697
|
-
* @typedef {object} ParamChangeIssueDetails
|
|
698
|
-
* details for a question that can change a contract parameter
|
|
699
|
-
* @property {ChoiceMethod} method
|
|
700
|
-
* @property {ParamChangeIssue<unknown>} issue
|
|
701
|
-
* @property {ParamChangePositions} positions
|
|
702
|
-
* @property {ElectionType} electionType
|
|
703
|
-
* @property {number} maxChoices
|
|
704
|
-
* @property {ClosingRule} closingRule
|
|
705
|
-
* @property {QuorumRule} quorumRule
|
|
706
|
-
* @property {NoChangeParamsPosition} tieOutcome
|
|
707
|
-
* @property {Instance} counterInstance - instance of the VoteCounter
|
|
708
|
-
* @property {Handle<'Question'>} questionHandle
|
|
709
|
-
*/
|
|
710
|
-
/**
|
|
711
|
-
* @typedef {Record<Keyword, ParamValueTyped>} ParamStateRecord a Record containing
|
|
712
|
-
* keyword pairs with descriptions of parameters under governance.
|
|
713
|
-
*/
|
|
714
|
-
/** @typedef {{current: ParamStateRecord}} GovernanceSubscriptionState */
|
|
715
|
-
/**
|
|
716
|
-
* @typedef {object} ParamManagerBase The base paramManager with typed getters
|
|
717
|
-
* @property {() => ERef<ParamStateRecord>} getParams
|
|
718
|
-
* @property {(name: string) => Amount} getAmount
|
|
719
|
-
* @property {(name: string) => Brand} getBrand
|
|
720
|
-
* @property {(name: string) => Instance} getInstance
|
|
721
|
-
* @property {(name: string) => Installation} getInstallation
|
|
722
|
-
* @property {(name: string) => Amount<'set'>} getInvitationAmount
|
|
723
|
-
* @property {(name: string) => bigint} getNat
|
|
724
|
-
* @property {(name: string) => Ratio} getRatio
|
|
725
|
-
* @property {(name: string) => string} getString
|
|
726
|
-
* @property {(name: string) => import('@agoric/time').TimestampRecord} getTimestamp
|
|
727
|
-
* @property {(name: string) => import('@agoric/time').RelativeTimeRecord} getRelativeTime
|
|
728
|
-
* @property {(name: string) => any} getUnknown
|
|
729
|
-
* @property {(name: string, proposedValue: ParamValue) => ParamValue} getVisibleValue - for
|
|
730
|
-
* most types, the visible value is the same as proposedValue. For Invitations
|
|
731
|
-
* the visible value is the amount of the invitation.
|
|
732
|
-
* @property {(name: string) => Promise<Invitation>} getInternalParamValue
|
|
733
|
-
* @property {() => StoredSubscription<GovernanceSubscriptionState>} getSubscription
|
|
734
|
-
*/
|
|
735
|
-
/**
|
|
736
|
-
* @callback UpdateParams
|
|
737
|
-
* @param {Record<string,ParamValue>} paramChanges
|
|
738
|
-
* @returns {Promise<void>}
|
|
739
|
-
*/
|
|
740
|
-
/**
|
|
741
|
-
* These are typed `any` because the builder pattern of paramManager makes it very
|
|
742
|
-
* complicated for the type system to know the set of param-specific functions
|
|
743
|
-
* returned by `.build()`. Instead we let paramManager create the desired methods
|
|
744
|
-
* and use typedParamManager to create a version that includes the static types.
|
|
745
|
-
*
|
|
746
|
-
* @typedef {Record<string, any>} ParamManagerGettersAndUpdaters
|
|
747
|
-
* @typedef {ParamManagerBase & ParamManagerGettersAndUpdaters & {updateParams: UpdateParams}} AnyParamManager
|
|
748
|
-
*/
|
|
749
|
-
/**
|
|
750
|
-
* @typedef {Record<string, string[]>} ParameterNameList
|
|
751
|
-
*/
|
|
752
|
-
/**
|
|
753
|
-
* @callback AssertParamManagerType
|
|
754
|
-
* @param {ParamType} type
|
|
755
|
-
* @param {ParamValue} value
|
|
756
|
-
* @param {string} name
|
|
757
|
-
*/
|
|
758
|
-
/**
|
|
759
|
-
* @callback BuildParamManager - ParamManager is a facility that governed
|
|
760
|
-
* contracts can use to manage their visible state in a way that allows the
|
|
761
|
-
* ContractGovernor to update values using governance. When paramManager is
|
|
762
|
-
* instantiated inside the contract, the contract has synchronous access to
|
|
763
|
-
* the values, and clients of the contract can verify that a ContractGovernor
|
|
764
|
-
* can change the values in a legible way.
|
|
765
|
-
* @param {Iterable<ParamValueTyped>} paramDescriptions
|
|
766
|
-
* @returns {AnyParamManager}
|
|
767
|
-
*/
|
|
768
|
-
/**
|
|
769
|
-
* @typedef {object} ChangeParamsPosition
|
|
770
|
-
* @property {Record<string,ParamValue>} changes one or more changes to parameters
|
|
771
|
-
*/
|
|
772
|
-
/**
|
|
773
|
-
* @typedef {object} OfferFilterPosition
|
|
774
|
-
* @property {string[]} strings
|
|
775
|
-
*/
|
|
776
|
-
/**
|
|
777
|
-
* @typedef {object} NoChangeOfferFilterPosition
|
|
778
|
-
* @property {string[]} dontUpdate
|
|
779
|
-
*/
|
|
780
|
-
/**
|
|
781
|
-
* @typedef {object} InvokeApiPosition
|
|
782
|
-
* @property {string} apiMethodName
|
|
783
|
-
* @property {unknown[]} methodArgs
|
|
784
|
-
*/
|
|
785
|
-
/**
|
|
786
|
-
* @typedef {object} DontInvokeApiPosition
|
|
787
|
-
* @property {string} dontInvoke
|
|
788
|
-
*/
|
|
789
|
-
/**
|
|
790
|
-
* @typedef {object} NoChangeParamsPosition
|
|
791
|
-
* @property {string[]} noChange Parameters in the proposal that this position
|
|
792
|
-
* is opposed to
|
|
793
|
-
*/
|
|
794
|
-
/**
|
|
795
|
-
* @typedef {object} Governor
|
|
796
|
-
* @property {CreateQuestion} createQuestion
|
|
797
|
-
*/
|
|
798
|
-
/** @typedef {{ [methodName: string]: (...args: any) => unknown }} GovernedApis */
|
|
799
|
-
/**
|
|
800
|
-
* @typedef {object} GovernorPublic
|
|
801
|
-
* @property {() => Promise<Instance>} getElectorate
|
|
802
|
-
* @property {() => Instance} getGovernedContract
|
|
803
|
-
* @property {(voteCounter: Instance) => Promise<void>} validateVoteCounter
|
|
804
|
-
* @property {(regP: ERef<Instance>) => Promise<void>} validateElectorate
|
|
805
|
-
* @property {(closingRule: ClosingRule) => void} validateTimer
|
|
806
|
-
*/
|
|
807
|
-
/**
|
|
808
|
-
* @typedef {object} ParamKey identifier for a paramManager within a contract
|
|
809
|
-
* @property {unknown} key
|
|
810
|
-
*/
|
|
811
|
-
/**
|
|
812
|
-
* Description of a set of coordinated changes for a ParamManager
|
|
813
|
-
*
|
|
814
|
-
* @template P path for a paramManagerRetriever
|
|
815
|
-
* @typedef {object} ParamChangesSpec<P>
|
|
816
|
-
* @property {P} paramPath
|
|
817
|
-
* @property {Record<string, ParamValue>} changes one or more changes to parameters
|
|
818
|
-
*/
|
|
819
|
-
/**
|
|
820
|
-
* @typedef {object} ContractGovernanceVoteResult
|
|
821
|
-
* @property {Instance} instance - instance of the VoteCounter
|
|
822
|
-
* @property {ERef<QuestionDetails>} details
|
|
823
|
-
* @property {Promise<ParamValue>} outcomeOfUpdate - A promise for the result
|
|
824
|
-
* of updating the parameter value. Primarily useful for its behavior on
|
|
825
|
-
* rejection.
|
|
826
|
-
*/
|
|
827
|
-
/**
|
|
828
|
-
* @template {GovernableStartFn} SF Start function of governed contract
|
|
829
|
-
* @typedef {object} GovernorCreatorFacet
|
|
830
|
-
* @property {VoteOnParamChanges} voteOnParamChanges
|
|
831
|
-
* @property {VoteOnApiInvocation} voteOnApiInvocation
|
|
832
|
-
* @property {VoteOnOfferFilter} voteOnOfferFilter
|
|
833
|
-
* @property {() => LimitedCF<SF>} getCreatorFacet facet of the governed contract,
|
|
834
|
-
* with creator-like powers but without the tightly held ability to change
|
|
835
|
-
* param values.
|
|
836
|
-
* @property {(poserInvitation: Invitation) => Promise<void>} replaceElectorate
|
|
837
|
-
* @property {() => AdminFacet} getAdminFacet
|
|
838
|
-
* @property {() => GovernedPublicFacet<Awaited<ReturnType<SF>>['publicFacet']>} getPublicFacet - public facet of the governed contract
|
|
839
|
-
* @property {() => Instance} getInstance - instance of the governed
|
|
840
|
-
* contract
|
|
841
|
-
*/
|
|
842
|
-
/**
|
|
843
|
-
* @typedef GovernedPublicFacetMethods
|
|
844
|
-
* @property {(key?: any) => StoredSubscription<GovernanceSubscriptionState>} getSubscription
|
|
845
|
-
* @property {(key?: any) => ERef<ParamStateRecord>} getGovernedParams - get descriptions of
|
|
846
|
-
* all the governed parameters
|
|
847
|
-
* @property {(name: string) => Amount} getInvitationAmount
|
|
848
|
-
*/
|
|
849
|
-
/**
|
|
850
|
-
* @template {{}} PF Public facet
|
|
851
|
-
* @typedef {PF & GovernedPublicFacetMethods} GovernedPublicFacet
|
|
852
|
-
*/
|
|
853
|
-
/**
|
|
854
|
-
* @template {GovernableStartFn} SF
|
|
855
|
-
* @typedef {ReturnType<Awaited<ReturnType<SF>>['creatorFacet']['getLimitedCreatorFacet']>} LimitedCF
|
|
856
|
-
*/
|
|
857
|
-
/**
|
|
858
|
-
* @template {{}} CF creator facet
|
|
859
|
-
* @typedef GovernedCreatorFacet
|
|
860
|
-
* What a governed contract must return as its creatorFacet in order to be governed
|
|
861
|
-
* @property {() => ParamManagerRetriever} getParamMgrRetriever - allows accessing
|
|
862
|
-
* and updating governed parameters. Should only be directly accessible to the
|
|
863
|
-
* contractGovernor
|
|
864
|
-
* @property {() => ERef<CF>} getLimitedCreatorFacet - the creator
|
|
865
|
-
* facet of the governed contract. Doesn't provide access to any governance
|
|
866
|
-
* functionality
|
|
867
|
-
* @property {(name: string) => Promise<Invitation>} getInvitation
|
|
868
|
-
* @property {() => ERef<GovernedApis>} getGovernedApis
|
|
869
|
-
* @property {() => (string | symbol)[]} getGovernedApiNames
|
|
870
|
-
* @property {(strings: string[]) => void} setOfferFilter
|
|
871
|
-
*/
|
|
872
|
-
/**
|
|
873
|
-
* @typedef {{key: string}} StandardParamPath
|
|
874
|
-
*/
|
|
875
|
-
/**
|
|
876
|
-
* @typedef {object} ParamManagerRetriever
|
|
877
|
-
* @property {(paramKey?: ParamKey) => AnyParamManager} get
|
|
878
|
-
*/
|
|
879
|
-
/**
|
|
880
|
-
* @template [P=StandardParamPath]
|
|
881
|
-
*
|
|
882
|
-
* @callback VoteOnParamChanges
|
|
883
|
-
* @param {Installation} voteCounterInstallation
|
|
884
|
-
* @param {import('@agoric/time').Timestamp} deadline
|
|
885
|
-
* @param {ParamChangesSpec<P>} paramSpec
|
|
886
|
-
* @returns {Promise<ContractGovernanceVoteResult>}
|
|
887
|
-
*/
|
|
888
|
-
/**
|
|
889
|
-
* @callback VoteOnApiInvocation
|
|
890
|
-
* @param {string} apiMethodName
|
|
891
|
-
* @param {unknown[]} methodArgs
|
|
892
|
-
* @param {Installation} voteCounterInstallation
|
|
893
|
-
* @param {import('@agoric/time').Timestamp} deadline
|
|
894
|
-
* @returns {Promise<ContractGovernanceVoteResult>}
|
|
895
|
-
*/
|
|
896
|
-
/**
|
|
897
|
-
* @callback VoteOnOfferFilter
|
|
898
|
-
* @param {Installation} voteCounterInstallation
|
|
899
|
-
* @param {import('@agoric/time').Timestamp} deadline
|
|
900
|
-
* @param {string[]} strings
|
|
901
|
-
* @returns {Promise<ContractGovernanceVoteResult>}
|
|
902
|
-
*/
|
|
903
|
-
/**
|
|
904
|
-
* @typedef {object} ParamGovernor
|
|
905
|
-
* @property {VoteOnParamChanges} voteOnParamChanges
|
|
906
|
-
* @property {CreatedQuestion} createdQuestion
|
|
907
|
-
*/
|
|
908
|
-
/**
|
|
909
|
-
* @typedef {object} ApiGovernor
|
|
910
|
-
* @property {VoteOnApiInvocation} voteOnApiInvocation
|
|
911
|
-
* @property {CreatedQuestion} createdQuestion
|
|
912
|
-
*/
|
|
913
|
-
/**
|
|
914
|
-
* @typedef {object} FilterGovernor
|
|
915
|
-
* @property {VoteOnOfferFilter} voteOnFilter
|
|
916
|
-
* @property {CreatedQuestion} createdQuestion
|
|
917
|
-
*/
|
|
918
|
-
/**
|
|
919
|
-
* @callback CreatedQuestion
|
|
920
|
-
* Was this question created by this ContractGovernor?
|
|
921
|
-
* @param {Instance} questionInstance
|
|
922
|
-
* @returns {boolean}
|
|
923
|
-
*/
|
|
924
|
-
/**
|
|
925
|
-
* @callback PositionIncluded
|
|
926
|
-
* @param {Position[]} positions
|
|
927
|
-
* @param {Position} position
|
|
928
|
-
* @returns {boolean}
|
|
929
|
-
*/
|
|
930
|
-
/**
|
|
931
|
-
* @typedef {object} GovernedContractTerms
|
|
932
|
-
* @property {import('@agoric/time').TimerService} timer
|
|
933
|
-
* @property {IssuerKeywordRecord} issuerKeywordRecord
|
|
934
|
-
* @property {object} privateArgs
|
|
935
|
-
*/
|
|
936
|
-
/**
|
|
937
|
-
* @callback AssertContractGovernance
|
|
938
|
-
*
|
|
939
|
-
* @param {ERef<ZoeService>} zoe
|
|
940
|
-
* @param {import('@agoric/zoe/src/zoeService/utils.js').Instance<(zcf: ZCF<GovernanceTerms<{}>>) => {}>} allegedGoverned
|
|
941
|
-
* @param {Instance} allegedGovernor
|
|
942
|
-
* @param {Installation<import('@agoric/governance/src/contractGovernor.js').start>} contractGovernorInstallation
|
|
943
|
-
* @returns {Promise<GovernancePair>}
|
|
944
|
-
*/
|
|
945
|
-
/**
|
|
946
|
-
* @callback AssertContractElectorate - assert that the contract uses the
|
|
947
|
-
* electorate
|
|
948
|
-
*
|
|
949
|
-
* @param {ERef<ZoeService>} zoe
|
|
950
|
-
* @param {Instance} allegedGovernor
|
|
951
|
-
* @param {Instance} allegedElectorate
|
|
952
|
-
*/
|
|
953
|
-
/**
|
|
954
|
-
* @typedef {ContractStartFunction
|
|
955
|
-
* & ((zcf?: any, pa?: any, baggage?: any) => ERef<{creatorFacet: GovernedCreatorFacet<{}>, publicFacet: GovernedPublicFacet<{}>}>)} GovernableStartFn
|
|
956
|
-
*/
|
|
957
|
-
/**
|
|
958
|
-
* @typedef {import('./contractGovernor.js')['start']} GovernorSF
|
|
959
|
-
*/
|
|
960
|
-
/**
|
|
961
|
-
* @see {StartedInstanceKit}
|
|
962
|
-
* @template {ERef<Installation<GovernableStartFn>>} I
|
|
963
|
-
* @typedef GovernorStartedInstallationKit
|
|
964
|
-
* Same result as StartedInstanceKit but:
|
|
965
|
-
* - typed for contractGovernor installation being started by Zoe. (It in turn starts the governed contract.)
|
|
966
|
-
* - parameterized by Installation instead of StartFunction
|
|
967
|
-
* @property {import('@agoric/zoe/src/zoeService/utils.js').Instance<GovernorSF>} instance
|
|
968
|
-
* @property {AdminFacet} adminFacet
|
|
969
|
-
* @property {GovernorCreatorFacet<InstallationStart<Awaited<I>>>} creatorFacet
|
|
970
|
-
* @property {GovernorPublic} publicFacet
|
|
971
|
-
*/
|
|
972
|
-
/**
|
|
973
|
-
* @see {StartedInstanceKit}
|
|
974
|
-
* @template {GovernableStartFn} SF
|
|
975
|
-
* @typedef GovernanceFacetKit
|
|
976
|
-
* Akin to StartedInstanceKit but designed for the results of starting governed contracts. Used in bootstrap space.
|
|
977
|
-
* @property {AdminFacet} adminFacet of the governed contract
|
|
978
|
-
* @property {LimitedCF<SF>} creatorFacet creator-like facet within the governed contract (without the powers the governor needs)
|
|
979
|
-
* @property {GovernorCreatorFacet<SF>} governorCreatorFacet of the governing contract
|
|
980
|
-
* @property {AdminFacet} governorAdminFacet of the governing contract
|
|
981
|
-
* @property {Awaited<ReturnType<SF>>['publicFacet']} publicFacet
|
|
982
|
-
* @property {Instance} instance
|
|
983
|
-
* @property {Instance} governor
|
|
984
|
-
*/
|
|
985
|
-
{
|
|
986
|
-
/**
|
|
987
|
-
* @typedef {object} QuorumCounter
|
|
988
|
-
* @property {(stats: VoteStatistics) => boolean} check
|
|
989
|
-
*/
|
|
990
|
-
/**
|
|
991
|
-
* @callback BuildQuestion
|
|
992
|
-
* @param {QuestionSpec} questionSpec
|
|
993
|
-
* @param {Instance} instance - voteCounter instance
|
|
994
|
-
* @returns {Question}
|
|
995
|
-
*/
|
|
996
|
-
/**
|
|
997
|
-
* @typedef {object} VoteCounterCreatorFacet - a facet that the Electorate should
|
|
998
|
-
* hold tightly. submitVote() is the core capability that allows the holder to
|
|
999
|
-
* specify the identity and choice of a voter. The voteCounter is making that
|
|
1000
|
-
* available to the Electorate, which should wrap and attenuate it so each
|
|
1001
|
-
* voter gets only the ability to cast their own vote at a weight specified by
|
|
1002
|
-
* the electorate.
|
|
1003
|
-
* @property {SubmitVote} submitVote
|
|
1004
|
-
*/
|
|
1005
|
-
/**
|
|
1006
|
-
* @typedef {object} VoteCounterPublicFacet
|
|
1007
|
-
* @property {() => boolean} isOpen
|
|
1008
|
-
* @property {() => Question} getQuestion
|
|
1009
|
-
* @property {() => Promise<Position>} getOutcome
|
|
1010
|
-
* @property {() => QuestionDetails} getDetails
|
|
1011
|
-
* @property {() => Promise<VoteStatistics>} getStats
|
|
1012
|
-
*/
|
|
1013
|
-
/**
|
|
1014
|
-
* @typedef {object} MultiVoteCounterPublicFacet
|
|
1015
|
-
* @property {() => boolean} isOpen
|
|
1016
|
-
* @property {() => Question} getQuestion
|
|
1017
|
-
* @property {() => Promise<Position[]>} getOutcome
|
|
1018
|
-
* @property {() => QuestionDetails} getDetails
|
|
1019
|
-
* @property {() => Promise<VoteStatistics>} getStats
|
|
1020
|
-
*/
|
|
1021
|
-
/**
|
|
1022
|
-
* @typedef {object} VoteCounterCloseFacet
|
|
1023
|
-
* TEST ONLY: Should not be allowed to escape from contracts
|
|
1024
|
-
* @property {() => void} closeVoting
|
|
1025
|
-
*/
|
|
1026
|
-
/**
|
|
1027
|
-
* @typedef {object} VoteCounterFacets
|
|
1028
|
-
* @property {VoteCounterPublicFacet} publicFacet
|
|
1029
|
-
* @property {VoteCounterCreatorFacet} creatorFacet
|
|
1030
|
-
* @property {VoteCounterCloseFacet} closeFacet
|
|
1031
|
-
*/
|
|
1032
|
-
/**
|
|
1033
|
-
* @typedef {object} MultiVoteCounterFacets
|
|
1034
|
-
* @property {MultiVoteCounterPublicFacet} publicFacet
|
|
1035
|
-
* @property {VoteCounterCreatorFacet} creatorFacet
|
|
1036
|
-
* @property {VoteCounterCloseFacet} closeFacet
|
|
1037
|
-
*/
|
|
1038
|
-
/**
|
|
1039
|
-
* @callback BuildVoteCounter
|
|
1040
|
-
* @param {QuestionSpec} questionSpec
|
|
1041
|
-
* @param {bigint} threshold - questionSpec includes quorumRule; the electorate
|
|
1042
|
-
* converts that to a number that the counter can enforce.
|
|
1043
|
-
* @param {Instance} instance
|
|
1044
|
-
* @param {ERef<Publisher<OutcomeRecord>>} publisher
|
|
1045
|
-
* @returns {VoteCounterFacets}
|
|
1046
|
-
*/
|
|
1047
|
-
/**
|
|
1048
|
-
* @callback BuildMultiVoteCounter
|
|
1049
|
-
* @param {QuestionSpec} questionSpec
|
|
1050
|
-
* @param {bigint} threshold - questionSpec includes quorumRule; the electorate
|
|
1051
|
-
* converts that to a number that the counter can enforce.
|
|
1052
|
-
* @param {Instance} instance
|
|
1053
|
-
* @param {ERef<Publisher<MultiOutcomeRecord>>} publisher
|
|
1054
|
-
* @returns {MultiVoteCounterFacets}
|
|
1055
|
-
*/
|
|
1056
|
-
/**
|
|
1057
|
-
* @typedef {object} CompletedBallet
|
|
1058
|
-
* @property {Position} chosen
|
|
1059
|
-
* @property {bigint} shares
|
|
1060
|
-
*/
|
|
1061
|
-
/**
|
|
1062
|
-
* @callback SubmitVote
|
|
1063
|
-
* @param {Handle<'Voter'>} voterHandle
|
|
1064
|
-
* @param {Position[]} chosenPositions
|
|
1065
|
-
* @param {bigint} [weight]
|
|
1066
|
-
* @returns {CompletedBallet}
|
|
1067
|
-
*/
|
|
1068
|
-
/**
|
|
1069
|
-
* @callback GetOpenQuestions
|
|
1070
|
-
* @returns {Promise<Handle<'Question'>[]>}
|
|
1071
|
-
*/
|
|
1072
|
-
/**
|
|
1073
|
-
* @callback GetQuestion
|
|
1074
|
-
* @param {Handle<'Question'>} h
|
|
1075
|
-
* @returns {Promise<Question>}
|
|
1076
|
-
*/
|
|
1077
|
-
/**
|
|
1078
|
-
* @typedef {object} ElectoratePublic
|
|
1079
|
-
* @property {() => Subscriber<QuestionDetails>} getQuestionSubscriber
|
|
1080
|
-
* @property {GetOpenQuestions} getOpenQuestions,
|
|
1081
|
-
* @property {() => Instance} getInstance
|
|
1082
|
-
* @property {GetQuestion} getQuestion
|
|
1083
|
-
*/
|
|
1084
|
-
/**
|
|
1085
|
-
* @typedef { ElectoratePublic & {makeVoterInvitation: () => ERef<Invitation>} } ClaimsElectoratePublic
|
|
1086
|
-
* @typedef { ElectoratePublic & {getName: () => string} } CommitteeElectoratePublic
|
|
1087
|
-
*/
|
|
1088
|
-
/**
|
|
1089
|
-
* @typedef {object} PoserFacet
|
|
1090
|
-
* @property {AddQuestion} addQuestion
|
|
1091
|
-
*/
|
|
1092
|
-
/**
|
|
1093
|
-
* @typedef {object} ElectorateCreatorFacet
|
|
1094
|
-
* @property {AddQuestion} addQuestion can be used directly when the creator doesn't need any
|
|
1095
|
-
* reassurance. When someone needs to connect addQuestion to the Electorate
|
|
1096
|
-
* instance, getPoserInvitation() lets them get addQuestion with assurance.
|
|
1097
|
-
* @property {() => Promise<Invitation>} getPoserInvitation
|
|
1098
|
-
* @property {() => Subscriber<QuestionDetails>} getQuestionSubscriber
|
|
1099
|
-
* @property {() => ElectoratePublic} getPublicFacet
|
|
1100
|
-
*/
|
|
1101
|
-
/**
|
|
1102
|
-
* @typedef {object} GetVoterInvitations
|
|
1103
|
-
* @property {() => Invitation[]} getVoterInvitations
|
|
1104
|
-
*/
|
|
1105
|
-
/**
|
|
1106
|
-
* @typedef {object} VoterFacet - a facet that the Electorate should hold
|
|
1107
|
-
* tightly. It allows specification of the vote's weight, so the Electorate
|
|
1108
|
-
* should distribute an attenuated wrapper that doesn't make that available!
|
|
1109
|
-
* @property {SubmitVote} submitVote
|
|
1110
|
-
*/
|
|
1111
|
-
/**
|
|
1112
|
-
* @typedef {object} ClosingRule
|
|
1113
|
-
* @property {ERef<import('@agoric/time').TimerService>} timer
|
|
1114
|
-
* @property {import('@agoric/time').Timestamp} deadline
|
|
1115
|
-
*/
|
|
1116
|
-
/**
|
|
1117
|
-
* @callback CloseVoting
|
|
1118
|
-
* @param {ClosingRule} closingRule
|
|
1119
|
-
* @param {() => void} closeVoting
|
|
1120
|
-
*/
|
|
1121
|
-
/**
|
|
1122
|
-
* @typedef {object} AddQuestionReturn
|
|
1123
|
-
* @property {VoteCounterPublicFacet} publicFacet
|
|
1124
|
-
* @property {VoteCounterCreatorFacet} creatorFacet
|
|
1125
|
-
* @property {import('@agoric/zoe/src/zoeService/utils.js').Instance<typeof import('./binaryVoteCounter.js').start>} instance
|
|
1126
|
-
* @property {import('@agoric/time').Timestamp} deadline
|
|
1127
|
-
* @property {Handle<'Question'>} questionHandle
|
|
1128
|
-
*/
|
|
1129
|
-
/**
|
|
1130
|
-
* @callback AddQuestion
|
|
1131
|
-
* @param {ERef<Installation>} voteCounter
|
|
1132
|
-
* @param {QuestionSpec} questionSpec
|
|
1133
|
-
* @returns {Promise<AddQuestionReturn>}
|
|
1134
|
-
*/
|
|
1135
|
-
/**
|
|
1136
|
-
* @callback CreateQuestion
|
|
1137
|
-
*
|
|
1138
|
-
* @param {string} name - The name of the parameter to change
|
|
1139
|
-
* @param {ParamValue} proposedValue - the proposed value for the named
|
|
1140
|
-
* parameter
|
|
1141
|
-
* @param {Installation} voteCounterInstallation - the voteCounter to
|
|
1142
|
-
* instantiate to count votes. Expected to be a binaryVoteCounter. Other
|
|
1143
|
-
* voteCounters might be added here, or might require separate governors.
|
|
1144
|
-
* under management so users can trace it back and see that it would use
|
|
1145
|
-
* this electionManager to manage parameters
|
|
1146
|
-
* @param {Instance} contractInstance - include the instance of the contract
|
|
1147
|
-
* @param {ClosingRule} closingRule - deadline and timer for closing voting
|
|
1148
|
-
* @returns {Promise<QuestionDetails>}
|
|
1149
|
-
*/
|
|
1150
|
-
/**
|
|
1151
|
-
* @template [P=StandardParamPath] path for a paramManagerRetriever
|
|
1152
|
-
* @typedef {object} ParamChangeIssue
|
|
1153
|
-
* @property {ParamChangesSpec<P>} spec
|
|
1154
|
-
* @property {import('@agoric/zoe/src/zoeService/utils.js').Instance<(zcf: ZCF<GovernanceTerms<{}>>) => {}>} contract
|
|
1155
|
-
*/
|
|
1156
|
-
/**
|
|
1157
|
-
* @typedef {object} ApiInvocationIssue
|
|
1158
|
-
* @property {string} apiMethodName
|
|
1159
|
-
* @property {unknown[]} methodArgs
|
|
1160
|
-
*/
|
|
1161
|
-
/**
|
|
1162
|
-
* @typedef {object} OfferFilterIssue
|
|
1163
|
-
* @property {string[]} strings
|
|
1164
|
-
*/
|
|
1165
|
-
/**
|
|
1166
|
-
* @typedef {object} ParamChangePositions
|
|
1167
|
-
* @property {ChangeParamsPosition} positive
|
|
1168
|
-
* @property {NoChangeParamsPosition} negative
|
|
1169
|
-
*/
|
|
1170
|
-
/**
|
|
1171
|
-
* @typedef {object} ParamChangeIssueDetails
|
|
1172
|
-
* details for a question that can change a contract parameter
|
|
1173
|
-
* @property {ChoiceMethod} method
|
|
1174
|
-
* @property {ParamChangeIssue<unknown>} issue
|
|
1175
|
-
* @property {ParamChangePositions} positions
|
|
1176
|
-
* @property {ElectionType} electionType
|
|
1177
|
-
* @property {number} maxChoices
|
|
1178
|
-
* @property {ClosingRule} closingRule
|
|
1179
|
-
* @property {QuorumRule} quorumRule
|
|
1180
|
-
* @property {NoChangeParamsPosition} tieOutcome
|
|
1181
|
-
* @property {Instance} counterInstance - instance of the VoteCounter
|
|
1182
|
-
* @property {Handle<'Question'>} questionHandle
|
|
1183
|
-
*/
|
|
1184
|
-
/**
|
|
1185
|
-
* @typedef {Record<Keyword, ParamValueTyped>} ParamStateRecord a Record containing
|
|
1186
|
-
* keyword pairs with descriptions of parameters under governance.
|
|
1187
|
-
*/
|
|
1188
|
-
/** @typedef {{current: ParamStateRecord}} GovernanceSubscriptionState */
|
|
1189
|
-
/**
|
|
1190
|
-
* @typedef {object} ParamManagerBase The base paramManager with typed getters
|
|
1191
|
-
* @property {() => ERef<ParamStateRecord>} getParams
|
|
1192
|
-
* @property {(name: string) => Amount} getAmount
|
|
1193
|
-
* @property {(name: string) => Brand} getBrand
|
|
1194
|
-
* @property {(name: string) => Instance} getInstance
|
|
1195
|
-
* @property {(name: string) => Installation} getInstallation
|
|
1196
|
-
* @property {(name: string) => Amount<'set'>} getInvitationAmount
|
|
1197
|
-
* @property {(name: string) => bigint} getNat
|
|
1198
|
-
* @property {(name: string) => Ratio} getRatio
|
|
1199
|
-
* @property {(name: string) => string} getString
|
|
1200
|
-
* @property {(name: string) => import('@agoric/time').TimestampRecord} getTimestamp
|
|
1201
|
-
* @property {(name: string) => import('@agoric/time').RelativeTimeRecord} getRelativeTime
|
|
1202
|
-
* @property {(name: string) => any} getUnknown
|
|
1203
|
-
* @property {(name: string, proposedValue: ParamValue) => ParamValue} getVisibleValue - for
|
|
1204
|
-
* most types, the visible value is the same as proposedValue. For Invitations
|
|
1205
|
-
* the visible value is the amount of the invitation.
|
|
1206
|
-
* @property {(name: string) => Promise<Invitation>} getInternalParamValue
|
|
1207
|
-
* @property {() => StoredSubscription<GovernanceSubscriptionState>} getSubscription
|
|
1208
|
-
*/
|
|
1209
|
-
/**
|
|
1210
|
-
* @callback UpdateParams
|
|
1211
|
-
* @param {Record<string,ParamValue>} paramChanges
|
|
1212
|
-
* @returns {Promise<void>}
|
|
1213
|
-
*/
|
|
1214
|
-
/**
|
|
1215
|
-
* These are typed `any` because the builder pattern of paramManager makes it very
|
|
1216
|
-
* complicated for the type system to know the set of param-specific functions
|
|
1217
|
-
* returned by `.build()`. Instead we let paramManager create the desired methods
|
|
1218
|
-
* and use typedParamManager to create a version that includes the static types.
|
|
1219
|
-
*
|
|
1220
|
-
* @typedef {Record<string, any>} ParamManagerGettersAndUpdaters
|
|
1221
|
-
* @typedef {ParamManagerBase & ParamManagerGettersAndUpdaters & {updateParams: UpdateParams}} AnyParamManager
|
|
1222
|
-
*/
|
|
1223
|
-
/**
|
|
1224
|
-
* @typedef {Record<string, string[]>} ParameterNameList
|
|
1225
|
-
*/
|
|
1226
|
-
/**
|
|
1227
|
-
* @callback AssertParamManagerType
|
|
1228
|
-
* @param {ParamType} type
|
|
1229
|
-
* @param {ParamValue} value
|
|
1230
|
-
* @param {string} name
|
|
1231
|
-
*/
|
|
1232
|
-
/**
|
|
1233
|
-
* @callback BuildParamManager - ParamManager is a facility that governed
|
|
1234
|
-
* contracts can use to manage their visible state in a way that allows the
|
|
1235
|
-
* ContractGovernor to update values using governance. When paramManager is
|
|
1236
|
-
* instantiated inside the contract, the contract has synchronous access to
|
|
1237
|
-
* the values, and clients of the contract can verify that a ContractGovernor
|
|
1238
|
-
* can change the values in a legible way.
|
|
1239
|
-
* @param {Iterable<ParamValueTyped>} paramDescriptions
|
|
1240
|
-
* @returns {AnyParamManager}
|
|
1241
|
-
*/
|
|
1242
|
-
/**
|
|
1243
|
-
* @typedef {object} ChangeParamsPosition
|
|
1244
|
-
* @property {Record<string,ParamValue>} changes one or more changes to parameters
|
|
1245
|
-
*/
|
|
1246
|
-
/**
|
|
1247
|
-
* @typedef {object} OfferFilterPosition
|
|
1248
|
-
* @property {string[]} strings
|
|
1249
|
-
*/
|
|
1250
|
-
/**
|
|
1251
|
-
* @typedef {object} NoChangeOfferFilterPosition
|
|
1252
|
-
* @property {string[]} dontUpdate
|
|
1253
|
-
*/
|
|
1254
|
-
/**
|
|
1255
|
-
* @typedef {object} InvokeApiPosition
|
|
1256
|
-
* @property {string} apiMethodName
|
|
1257
|
-
* @property {unknown[]} methodArgs
|
|
1258
|
-
*/
|
|
1259
|
-
/**
|
|
1260
|
-
* @typedef {object} DontInvokeApiPosition
|
|
1261
|
-
* @property {string} dontInvoke
|
|
1262
|
-
*/
|
|
1263
|
-
/**
|
|
1264
|
-
* @typedef {object} NoChangeParamsPosition
|
|
1265
|
-
* @property {string[]} noChange Parameters in the proposal that this position
|
|
1266
|
-
* is opposed to
|
|
1267
|
-
*/
|
|
1268
|
-
/**
|
|
1269
|
-
* @typedef {object} Governor
|
|
1270
|
-
* @property {CreateQuestion} createQuestion
|
|
1271
|
-
*/
|
|
1272
|
-
/** @typedef {{ [methodName: string]: (...args: any) => unknown }} GovernedApis */
|
|
1273
|
-
/**
|
|
1274
|
-
* @typedef {object} GovernorPublic
|
|
1275
|
-
* @property {() => Promise<Instance>} getElectorate
|
|
1276
|
-
* @property {() => Instance} getGovernedContract
|
|
1277
|
-
* @property {(voteCounter: Instance) => Promise<void>} validateVoteCounter
|
|
1278
|
-
* @property {(regP: ERef<Instance>) => Promise<void>} validateElectorate
|
|
1279
|
-
* @property {(closingRule: ClosingRule) => void} validateTimer
|
|
1280
|
-
*/
|
|
1281
|
-
/**
|
|
1282
|
-
* @typedef {object} ParamKey identifier for a paramManager within a contract
|
|
1283
|
-
* @property {unknown} key
|
|
1284
|
-
*/
|
|
1285
|
-
/**
|
|
1286
|
-
* Description of a set of coordinated changes for a ParamManager
|
|
1287
|
-
*
|
|
1288
|
-
* @template P path for a paramManagerRetriever
|
|
1289
|
-
* @typedef {object} ParamChangesSpec<P>
|
|
1290
|
-
* @property {P} paramPath
|
|
1291
|
-
* @property {Record<string, ParamValue>} changes one or more changes to parameters
|
|
1292
|
-
*/
|
|
1293
|
-
/**
|
|
1294
|
-
* @typedef {object} ContractGovernanceVoteResult
|
|
1295
|
-
* @property {Instance} instance - instance of the VoteCounter
|
|
1296
|
-
* @property {ERef<QuestionDetails>} details
|
|
1297
|
-
* @property {Promise<ParamValue>} outcomeOfUpdate - A promise for the result
|
|
1298
|
-
* of updating the parameter value. Primarily useful for its behavior on
|
|
1299
|
-
* rejection.
|
|
1300
|
-
*/
|
|
1301
|
-
/**
|
|
1302
|
-
* @template {GovernableStartFn} SF Start function of governed contract
|
|
1303
|
-
* @typedef {object} GovernorCreatorFacet
|
|
1304
|
-
* @property {VoteOnParamChanges} voteOnParamChanges
|
|
1305
|
-
* @property {VoteOnApiInvocation} voteOnApiInvocation
|
|
1306
|
-
* @property {VoteOnOfferFilter} voteOnOfferFilter
|
|
1307
|
-
* @property {() => LimitedCF<SF>} getCreatorFacet facet of the governed contract,
|
|
1308
|
-
* with creator-like powers but without the tightly held ability to change
|
|
1309
|
-
* param values.
|
|
1310
|
-
* @property {(poserInvitation: Invitation) => Promise<void>} replaceElectorate
|
|
1311
|
-
* @property {() => AdminFacet} getAdminFacet
|
|
1312
|
-
* @property {() => GovernedPublicFacet<Awaited<ReturnType<SF>>['publicFacet']>} getPublicFacet - public facet of the governed contract
|
|
1313
|
-
* @property {() => Instance} getInstance - instance of the governed
|
|
1314
|
-
* contract
|
|
1315
|
-
*/
|
|
1316
|
-
/**
|
|
1317
|
-
* @typedef GovernedPublicFacetMethods
|
|
1318
|
-
* @property {(key?: any) => StoredSubscription<GovernanceSubscriptionState>} getSubscription
|
|
1319
|
-
* @property {(key?: any) => ERef<ParamStateRecord>} getGovernedParams - get descriptions of
|
|
1320
|
-
* all the governed parameters
|
|
1321
|
-
* @property {(name: string) => Amount} getInvitationAmount
|
|
1322
|
-
*/
|
|
1323
|
-
/**
|
|
1324
|
-
* @template {{}} PF Public facet
|
|
1325
|
-
* @typedef {PF & GovernedPublicFacetMethods} GovernedPublicFacet
|
|
1326
|
-
*/
|
|
1327
|
-
/**
|
|
1328
|
-
* @template {GovernableStartFn} SF
|
|
1329
|
-
* @typedef {ReturnType<Awaited<ReturnType<SF>>['creatorFacet']['getLimitedCreatorFacet']>} LimitedCF
|
|
1330
|
-
*/
|
|
1331
|
-
/**
|
|
1332
|
-
* @template {{}} CF creator facet
|
|
1333
|
-
* @typedef GovernedCreatorFacet
|
|
1334
|
-
* What a governed contract must return as its creatorFacet in order to be governed
|
|
1335
|
-
* @property {() => ParamManagerRetriever} getParamMgrRetriever - allows accessing
|
|
1336
|
-
* and updating governed parameters. Should only be directly accessible to the
|
|
1337
|
-
* contractGovernor
|
|
1338
|
-
* @property {() => ERef<CF>} getLimitedCreatorFacet - the creator
|
|
1339
|
-
* facet of the governed contract. Doesn't provide access to any governance
|
|
1340
|
-
* functionality
|
|
1341
|
-
* @property {(name: string) => Promise<Invitation>} getInvitation
|
|
1342
|
-
* @property {() => ERef<GovernedApis>} getGovernedApis
|
|
1343
|
-
* @property {() => (string | symbol)[]} getGovernedApiNames
|
|
1344
|
-
* @property {(strings: string[]) => void} setOfferFilter
|
|
1345
|
-
*/
|
|
1346
|
-
/**
|
|
1347
|
-
* @typedef {{key: string}} StandardParamPath
|
|
1348
|
-
*/
|
|
1349
|
-
/**
|
|
1350
|
-
* @typedef {object} ParamManagerRetriever
|
|
1351
|
-
* @property {(paramKey?: ParamKey) => AnyParamManager} get
|
|
1352
|
-
*/
|
|
1353
|
-
/**
|
|
1354
|
-
* @template [P=StandardParamPath]
|
|
1355
|
-
*
|
|
1356
|
-
* @callback VoteOnParamChanges
|
|
1357
|
-
* @param {Installation} voteCounterInstallation
|
|
1358
|
-
* @param {import('@agoric/time').Timestamp} deadline
|
|
1359
|
-
* @param {ParamChangesSpec<P>} paramSpec
|
|
1360
|
-
* @returns {Promise<ContractGovernanceVoteResult>}
|
|
1361
|
-
*/
|
|
1362
|
-
/**
|
|
1363
|
-
* @callback VoteOnApiInvocation
|
|
1364
|
-
* @param {string} apiMethodName
|
|
1365
|
-
* @param {unknown[]} methodArgs
|
|
1366
|
-
* @param {Installation} voteCounterInstallation
|
|
1367
|
-
* @param {import('@agoric/time').Timestamp} deadline
|
|
1368
|
-
* @returns {Promise<ContractGovernanceVoteResult>}
|
|
1369
|
-
*/
|
|
1370
|
-
/**
|
|
1371
|
-
* @callback VoteOnOfferFilter
|
|
1372
|
-
* @param {Installation} voteCounterInstallation
|
|
1373
|
-
* @param {import('@agoric/time').Timestamp} deadline
|
|
1374
|
-
* @param {string[]} strings
|
|
1375
|
-
* @returns {Promise<ContractGovernanceVoteResult>}
|
|
1376
|
-
*/
|
|
1377
|
-
/**
|
|
1378
|
-
* @typedef {object} ParamGovernor
|
|
1379
|
-
* @property {VoteOnParamChanges} voteOnParamChanges
|
|
1380
|
-
* @property {CreatedQuestion} createdQuestion
|
|
1381
|
-
*/
|
|
1382
|
-
/**
|
|
1383
|
-
* @typedef {object} ApiGovernor
|
|
1384
|
-
* @property {VoteOnApiInvocation} voteOnApiInvocation
|
|
1385
|
-
* @property {CreatedQuestion} createdQuestion
|
|
1386
|
-
*/
|
|
1387
|
-
/**
|
|
1388
|
-
* @typedef {object} FilterGovernor
|
|
1389
|
-
* @property {VoteOnOfferFilter} voteOnFilter
|
|
1390
|
-
* @property {CreatedQuestion} createdQuestion
|
|
1391
|
-
*/
|
|
1392
|
-
/**
|
|
1393
|
-
* @callback CreatedQuestion
|
|
1394
|
-
* Was this question created by this ContractGovernor?
|
|
1395
|
-
* @param {Instance} questionInstance
|
|
1396
|
-
* @returns {boolean}
|
|
1397
|
-
*/
|
|
1398
|
-
/**
|
|
1399
|
-
* @callback PositionIncluded
|
|
1400
|
-
* @param {Position[]} positions
|
|
1401
|
-
* @param {Position} position
|
|
1402
|
-
* @returns {boolean}
|
|
1403
|
-
*/
|
|
1404
|
-
/**
|
|
1405
|
-
* @typedef {object} GovernedContractTerms
|
|
1406
|
-
* @property {import('@agoric/time').TimerService} timer
|
|
1407
|
-
* @property {IssuerKeywordRecord} issuerKeywordRecord
|
|
1408
|
-
* @property {object} privateArgs
|
|
1409
|
-
*/
|
|
1410
|
-
/**
|
|
1411
|
-
* @callback AssertContractGovernance
|
|
1412
|
-
*
|
|
1413
|
-
* @param {ERef<ZoeService>} zoe
|
|
1414
|
-
* @param {import('@agoric/zoe/src/zoeService/utils.js').Instance<(zcf: ZCF<GovernanceTerms<{}>>) => {}>} allegedGoverned
|
|
1415
|
-
* @param {Instance} allegedGovernor
|
|
1416
|
-
* @param {Installation<import('@agoric/governance/src/contractGovernor.js').start>} contractGovernorInstallation
|
|
1417
|
-
* @returns {Promise<GovernancePair>}
|
|
1418
|
-
*/
|
|
1419
|
-
/**
|
|
1420
|
-
* @callback AssertContractElectorate - assert that the contract uses the
|
|
1421
|
-
* electorate
|
|
1422
|
-
*
|
|
1423
|
-
* @param {ERef<ZoeService>} zoe
|
|
1424
|
-
* @param {Instance} allegedGovernor
|
|
1425
|
-
* @param {Instance} allegedElectorate
|
|
1426
|
-
*/
|
|
1427
|
-
/**
|
|
1428
|
-
* @typedef {ContractStartFunction
|
|
1429
|
-
* & ((zcf?: any, pa?: any, baggage?: any) => ERef<{creatorFacet: GovernedCreatorFacet<{}>, publicFacet: GovernedPublicFacet<{}>}>)} GovernableStartFn
|
|
1430
|
-
*/
|
|
1431
|
-
/**
|
|
1432
|
-
* @typedef {import('./contractGovernor.js')['start']} GovernorSF
|
|
1433
|
-
*/
|
|
1434
|
-
/**
|
|
1435
|
-
* @see {StartedInstanceKit}
|
|
1436
|
-
* @template {ERef<Installation<GovernableStartFn>>} I
|
|
1437
|
-
* @typedef GovernorStartedInstallationKit
|
|
1438
|
-
* Same result as StartedInstanceKit but:
|
|
1439
|
-
* - typed for contractGovernor installation being started by Zoe. (It in turn starts the governed contract.)
|
|
1440
|
-
* - parameterized by Installation instead of StartFunction
|
|
1441
|
-
* @property {import('@agoric/zoe/src/zoeService/utils.js').Instance<GovernorSF>} instance
|
|
1442
|
-
* @property {AdminFacet} adminFacet
|
|
1443
|
-
* @property {GovernorCreatorFacet<InstallationStart<Awaited<I>>>} creatorFacet
|
|
1444
|
-
* @property {GovernorPublic} publicFacet
|
|
1445
|
-
*/
|
|
1446
|
-
/**
|
|
1447
|
-
* @see {StartedInstanceKit}
|
|
1448
|
-
* @template {GovernableStartFn} SF
|
|
1449
|
-
* @typedef GovernanceFacetKit
|
|
1450
|
-
* Akin to StartedInstanceKit but designed for the results of starting governed contracts. Used in bootstrap space.
|
|
1451
|
-
* @property {AdminFacet} adminFacet of the governed contract
|
|
1452
|
-
* @property {LimitedCF<SF>} creatorFacet creator-like facet within the governed contract (without the powers the governor needs)
|
|
1453
|
-
* @property {GovernorCreatorFacet<SF>} governorCreatorFacet of the governing contract
|
|
1454
|
-
* @property {AdminFacet} governorAdminFacet of the governing contract
|
|
1455
|
-
* @property {Awaited<ReturnType<SF>>['publicFacet']} publicFacet
|
|
1456
|
-
* @property {Instance} instance
|
|
1457
|
-
* @property {Instance} governor
|
|
1458
|
-
*/
|
|
502
|
+
}>, privateArgs: {
|
|
1459
503
|
governed: Record<string, unknown>;
|
|
1460
504
|
}, baggage: import("@agoric/vat-data").Baggage) => Promise<{
|
|
1461
505
|
creatorFacet: GovernorCreatorFacet<SF>;
|
|
@@ -1497,7 +541,7 @@ export type GovernanceFacetKit<SF extends GovernableStartFn> = {
|
|
|
1497
541
|
/**
|
|
1498
542
|
* of the governing contract
|
|
1499
543
|
*/
|
|
1500
|
-
governorCreatorFacet: GovernorCreatorFacet<SF
|
|
544
|
+
governorCreatorFacet: Guarded<GovernorCreatorFacet<SF>>;
|
|
1501
545
|
/**
|
|
1502
546
|
* of the governing contract
|
|
1503
547
|
*/
|
|
@@ -1506,6 +550,9 @@ export type GovernanceFacetKit<SF extends GovernableStartFn> = {
|
|
|
1506
550
|
instance: Instance;
|
|
1507
551
|
governor: Instance;
|
|
1508
552
|
};
|
|
553
|
+
import type { Container } from '@endo/pass-style';
|
|
1509
554
|
import type { ParamType } from './constants.js';
|
|
555
|
+
import type { Passable } from '@endo/pass-style';
|
|
1510
556
|
import type { ContractStartFunction } from '@agoric/zoe/src/zoeService/utils.js';
|
|
557
|
+
import type { Guarded } from '@endo/exo';
|
|
1511
558
|
//# sourceMappingURL=types.d.ts.map
|