diff --git a/packages/inter-protocol/src/proposals/replaceElectorate.js b/packages/inter-protocol/src/proposals/replaceElectorate.js index 240eb74593f..02b440e717a 100644 --- a/packages/inter-protocol/src/proposals/replaceElectorate.js +++ b/packages/inter-protocol/src/proposals/replaceElectorate.js @@ -198,56 +198,26 @@ const startNewEconCharter = async ({ }; const addGovernorsToEconCharter = async ( - { - consume: { - reserveKit, - vaultFactoryKit, - auctioneerKit, - psmKit, - provisionPoolStartResult, - }, - instance: { - consume: { reserve, VaultFactory, auctioneer, provisionPool }, - }, - }, + { consume: { psmKit, governedContractKits } }, { options: { econCharterKit } }, ) => { - const { creatorFacet } = E.get(econCharterKit); + const { creatorFacet: ecCreatorFacet } = E.get(econCharterKit); const psmKitMap = await psmKit; for (const { psm, psmGovernorCreatorFacet, label } of psmKitMap.values()) { - E(creatorFacet).addInstance(psm, psmGovernorCreatorFacet, label); + E(ecCreatorFacet).addInstance(psm, psmGovernorCreatorFacet, label); } - await Promise.all( - [ - { - label: 'reserve', - instanceP: reserve, - facetP: E.get(reserveKit).governorCreatorFacet, - }, - { - label: 'VaultFactory', - instanceP: VaultFactory, - facetP: E.get(vaultFactoryKit).governorCreatorFacet, - }, - { - label: 'auctioneer', - instanceP: auctioneer, - facetP: E.get(auctioneerKit).governorCreatorFacet, - }, - { - label: 'provisionPool', - instanceP: provisionPool, - facetP: E.get(provisionPoolStartResult).governorCreatorFacet, - }, - ].map(async ({ label, instanceP, facetP }) => { - const [instance, govFacet] = await Promise.all([instanceP, facetP]); + const governedContractKitMap = await governedContractKits; - return E(creatorFacet).addInstance(instance, govFacet, label); - }), - ); + for (const { + instance, + governorCreatorFacet, + label, + } of governedContractKitMap.values()) { + E(ecCreatorFacet).addInstance(instance, governorCreatorFacet, label); + } }; export const replaceElectorate = async (permittedPowers, config) => { @@ -264,14 +234,14 @@ export const replaceElectorate = async (permittedPowers, config) => { }, ); + const governedContractKitsMap = + await permittedPowers.consume.governedContractKits; const psmKitMap = await permittedPowers.consume.psmKit; const creatorFacets = [ - E.get(permittedPowers.consume.reserveKit).governorCreatorFacet, - E.get(permittedPowers.consume.auctioneerKit).governorCreatorFacet, - E.get(permittedPowers.consume.vaultFactoryKit).governorCreatorFacet, - E.get(permittedPowers.consume.provisionPoolStartResult) - .governorCreatorFacet, + ...[...governedContractKitsMap.values()].map( + governedContractKit => governedContractKit.governorCreatorFacet, + ), ...[...psmKitMap.values()].map(psmKit => psmKit.psmGovernorCreatorFacet), ]; @@ -317,11 +287,8 @@ export const getManifestForReplaceElectorate = async (_, options) => ({ manifest: { [replaceElectorate.name]: { consume: { - reserveKit: true, - auctioneerKit: true, - vaultFactoryKit: true, psmKit: true, - provisionPoolStartResult: true, + governedContractKits: true, board: true, chainStorage: true, @@ -347,12 +314,6 @@ export const getManifestForReplaceElectorate = async (_, options) => ({ economicCommittee: true, econCommitteeCharter: true, }, - consume: { - reserve: true, - VaultFactory: true, - auctioneer: true, - provisionPool: true, - }, }, }, },