From ce4245c9b6d2fa8142b018714a8277b84a697716 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Thu, 3 Oct 2024 17:22:36 +0500 Subject: [PATCH] docs: add JSDoc comments to enhance function documentation --- .../src/proposals/replaceElectorate.js | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/packages/inter-protocol/src/proposals/replaceElectorate.js b/packages/inter-protocol/src/proposals/replaceElectorate.js index 0780b6924189..c04ea2c62c06 100644 --- a/packages/inter-protocol/src/proposals/replaceElectorate.js +++ b/packages/inter-protocol/src/proposals/replaceElectorate.js @@ -18,6 +18,7 @@ import { import { reserveThenDeposit } from './utils.js'; /** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */ +/** @import {EconCharterStartResult} from './econ-behaviors.js') */ /** @import {CommitteeElectorateCreatorFacet} from '@agoric/governance/src/committee.js'; */ const trace = (...args) => console.log('GovReplaceCommiteeAndCharter', ...args); @@ -137,6 +138,29 @@ const inviteECMembers = async ( await distributeInvitations(zip(values(voterAddresses), invitations)); }; +/** + * Invites members to the Economic Charter by creating and distributing charter + * member invitations to the specified voter addresses. + * + * @param {EconomyBootstrapPowers} powers - The bootstrap powers required for + * economic operations, including `namesByAddressAdmin` used for managing + * names and deposits. + * @param {{ + * options: { + * voterAddresses: Record; + * econCharterKit: { + * creatorFacet: { + * makeCharterMemberInvitation: () => Promise; + * }; + * }; + * }; + * }} config + * - The configuration object containing voter addresses and the econ charter kit + * for creating charter member invitations. + * + * @returns {Promise} This function does not explicitly return a value. It + * processes all charter member invitations asynchronously. + */ const inviteToEconCharter = async ( { consume: { namesByAddressAdmin } }, { options: { voterAddresses, econCharterKit } }, @@ -235,6 +259,17 @@ const startNewEconomicCommittee = async ( return creatorFacet; }; + +/** + * Starts a new Economic Committee Charter by creating an instance with the + * provided committee specifications. + * + * - @param {EconomyBootstrapPowers} powers - The resources and capabilities + * required to start the committee. + * + * @returns {Promise} A promise that resolves to the + * charter kit result. + */ const startNewEconCharter = async ({ consume: { zoe }, produce: { econCharterKit }, @@ -271,6 +306,22 @@ const startNewEconCharter = async ({ return startResult; }; +/** + * Adds governors to an existing Economic Committee Charter + * + * - @param {EconomyBootstrapPowers} powers - The resources and capabilities + * required to start the committee. + * + * @param {{ + * options: { + * econCharterKit: EconCharterStartResult; + * }; + * }} config + * - Configuration object containing the name and size of the committee. + * + * @returns {Promise} A promise that resolves once all the governors have + * been successfully added to the economic charter + */ const addGovernorsToEconCharter = async ( { consume: { psmKit, governedContractKits } }, { options: { econCharterKit } },