-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add noAction electorate for assurance of no governance changes
- Loading branch information
1 parent
8345ecd
commit 3ca89e8
Showing
3 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// @ts-check | ||
|
||
import { Far } from '@agoric/marshal'; | ||
import { makeSubscriptionKit } from '@agoric/notifier'; | ||
import { makePromiseKit } from '@agoric/promise-kit'; | ||
|
||
/** | ||
* This Electorate visibly has no members, takes no votes, and approves no | ||
* changes. | ||
* | ||
* @type {ContractStartFn} | ||
*/ | ||
const start = zcf => { | ||
const { subscription } = makeSubscriptionKit(); | ||
|
||
/** @type {ElectoratePublic} */ | ||
const publicFacet = Far('publicFacet', { | ||
getQuestionSubscription: () => subscription, | ||
getOpenQuestions: () => { | ||
/** @type {Handle<'Question'>[]} */ | ||
const noQuestions = []; | ||
const questionsPromise = makePromiseKit(); | ||
questionsPromise.resolve(noQuestions); | ||
return questionsPromise.promise; | ||
}, | ||
getName: () => 'no Action electorate', | ||
getInstance: zcf.getInstance, | ||
getQuestion: () => { | ||
throw Error(`noActionElectorate doesn't have questions.`); | ||
}, | ||
}); | ||
|
||
/** @type {ElectorateCreatorFacet} */ | ||
const creatorFacet = Far('creatorFacet', { | ||
getPoserInvitation: () => { | ||
return zcf.makeInvitation(() => {}, | ||
`noActionElectorate doesn't allow posing questions`); | ||
}, | ||
addQuestion() { | ||
throw Error(`noActionElectorate doesn't add questions.`); | ||
}, | ||
getVoterInvitations: () => { | ||
throw Error(`No Action Electorate doesn't have invitations.`); | ||
}, | ||
getQuestionSubscription: () => subscription, | ||
getPublicFacet: () => publicFacet, | ||
}); | ||
|
||
return { publicFacet, creatorFacet }; | ||
}; | ||
|
||
harden(start); | ||
export { start }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters