From fff596d5ac361a944f563991e6d5f3732915a057 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Thu, 26 Sep 2024 14:26:00 +0500 Subject: [PATCH] feat: builder script for replacing committee and charter --- .../scripts/inter-protocol/ec-changes-core.js | 35 +++++++++++++ .../proposals/replaceCommitteeAndCharter.js | 52 ++++++++++++++++++- 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 packages/builders/scripts/inter-protocol/ec-changes-core.js diff --git a/packages/builders/scripts/inter-protocol/ec-changes-core.js b/packages/builders/scripts/inter-protocol/ec-changes-core.js new file mode 100644 index 00000000000..9caa366c170 --- /dev/null +++ b/packages/builders/scripts/inter-protocol/ec-changes-core.js @@ -0,0 +1,35 @@ +/* global process */ + +import { makeHelpers } from '@agoric/deploy-script-support'; +import { getManifestForReplaceCommitteeAndCharter } from '@agoric/inter-protocol/src/proposals/replaceCommitteeAndCharter'; + +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ +export const defaultProposalBuilder = async ({ publishRef, install }, opts) => { + return harden({ + sourceSpec: + '@agoric/inter-protocol/src/proposals/replaceCommitteeAndCharter.js', + getManifestCall: [ + getManifestForReplaceCommitteeAndCharter.name, + { + ...opts, + economicCommitteeRef: publishRef( + install( + '@agoric/governance/src/committee.js', + '@agoric/governance/bundles/bundle-committee.js', + ), + ), + economicCharterRef: publishRef( + install( + '@agoric/inter-protocol/src/econCommitteeCharter.js', + '@agoric/inter-protocol/bundles/bundle-econCommitteeCharter.js', + ), + ), + }, + ], + }); +}; + +export default async (homeP, endowments) => { + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('replace-committee-and-charter', defaultProposalBuilder); +}; diff --git a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js index e9f2be296eb..e5fe720879e 100644 --- a/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js +++ b/packages/inter-protocol/src/proposals/replaceCommitteeAndCharter.js @@ -337,7 +337,7 @@ const shutdown = async ({ trace('EC Charter shutdown successful'); }; -const main = async permittedPowers => { +const replaceCommitteeAndCharter = async permittedPowers => { await shutdown(permittedPowers); await startNewEconomicCommittee(permittedPowers); await startNewEconCharter(permittedPowers); @@ -377,4 +377,52 @@ const main = async permittedPowers => { trace('Installed New Economic Committee'); }; -main; +export const getManifestForReplaceCommitteeAndCharter = async ({ + economicCommitteeRef: _economicCommitteeRef, + economicCharterRef: _economicCharterRef, +}) => ({ + manifest: { + [replaceCommitteeAndCharter.name]: { + consume: { + board: true, + chainStorage: true, + econCharterKit: true, + economicCommitteeCreatorFacet: true, + highPrioritySendersManager: true, + instancePrivateArgs: true, + namesByAddressAdmin: true, + priceAuthority: true, + priceAuthorityAdmin: true, + reserveKit: true, + vaultFactoryKit: true, + auctioneerKit: true, + psmKit: true, + zoe: true, + }, + produce: { + economicCommittee: true, + economicCommitteeCreatorFacet: true, + econCharterKit: true, + econCommitteeCharter: true, + }, + installation: { + consume: { + committee: true, + econCommitteeCharter: true, + binaryVoteCounter: true, + }, + }, + instance: { + consume: { + reserve: true, + VaultFactory: true, + auctioneer: true, + }, + produce: { + economicCommittee: true, + econCommitteeCharter: true, + }, + }, + }, + }, +});