From 9b9c94520c2da0a05bdee195fe8e27ffd1452677 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Tue, 1 Oct 2024 11:51:23 +0500 Subject: [PATCH 1/3] chore: changes to incorporate governedContractKits --- .../src/proposals/replaceElectorate.js | 72 +++++-------------- 1 file changed, 18 insertions(+), 54 deletions(-) diff --git a/packages/inter-protocol/src/proposals/replaceElectorate.js b/packages/inter-protocol/src/proposals/replaceElectorate.js index 240eb74593f..edb8e2dfb7b 100644 --- a/packages/inter-protocol/src/proposals/replaceElectorate.js +++ b/packages/inter-protocol/src/proposals/replaceElectorate.js @@ -5,6 +5,7 @@ import { makeStorageNodeChild, } from '@agoric/internal/src/lib-chainStorage.js'; import { reserveThenDeposit } from './utils.js'; +import { deeplyFulfilledObject } from '@agoric/internal'; const trace = (...args) => console.log('GovReplaceCommiteeAndCharter', ...args); @@ -198,18 +199,7 @@ 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); @@ -220,34 +210,15 @@ const addGovernorsToEconCharter = async ( E(creatorFacet).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(creatorFacet).addInstance(instance, governorCreatorFacet, label); + } }; export const replaceElectorate = async (permittedPowers, config) => { @@ -264,14 +235,16 @@ export const replaceElectorate = async (permittedPowers, config) => { }, ); + const governedContractKitsMap = + await permittedPowers.consume.governedContractKits; const psmKitMap = await permittedPowers.consume.psmKit; + console.log('RABI', [...governedContractKitsMap.values()]); + 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 +290,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 +317,6 @@ export const getManifestForReplaceElectorate = async (_, options) => ({ economicCommittee: true, econCommitteeCharter: true, }, - consume: { - reserve: true, - VaultFactory: true, - auctioneer: true, - provisionPool: true, - }, }, }, }, From 8a1f820314aafd7c3feb70db06878f8552f4a3bd Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Tue, 1 Oct 2024 11:58:40 +0500 Subject: [PATCH 2/3] fixup! chore: changes to incorporate governedContractKits --- packages/inter-protocol/src/proposals/replaceElectorate.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/inter-protocol/src/proposals/replaceElectorate.js b/packages/inter-protocol/src/proposals/replaceElectorate.js index edb8e2dfb7b..43400ccf80d 100644 --- a/packages/inter-protocol/src/proposals/replaceElectorate.js +++ b/packages/inter-protocol/src/proposals/replaceElectorate.js @@ -5,7 +5,6 @@ import { makeStorageNodeChild, } from '@agoric/internal/src/lib-chainStorage.js'; import { reserveThenDeposit } from './utils.js'; -import { deeplyFulfilledObject } from '@agoric/internal'; const trace = (...args) => console.log('GovReplaceCommiteeAndCharter', ...args); From 0fba11ebb643dff5518f4609d8cb646d319062c9 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Wed, 2 Oct 2024 13:55:45 +0500 Subject: [PATCH 3/3] fixup! chore: changes to incorporate governedContractKits --- .../inter-protocol/src/proposals/replaceElectorate.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/inter-protocol/src/proposals/replaceElectorate.js b/packages/inter-protocol/src/proposals/replaceElectorate.js index 43400ccf80d..02b440e717a 100644 --- a/packages/inter-protocol/src/proposals/replaceElectorate.js +++ b/packages/inter-protocol/src/proposals/replaceElectorate.js @@ -201,12 +201,12 @@ const addGovernorsToEconCharter = async ( { 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); } const governedContractKitMap = await governedContractKits; @@ -216,7 +216,7 @@ const addGovernorsToEconCharter = async ( governorCreatorFacet, label, } of governedContractKitMap.values()) { - E(creatorFacet).addInstance(instance, governorCreatorFacet, label); + E(ecCreatorFacet).addInstance(instance, governorCreatorFacet, label); } }; @@ -238,8 +238,6 @@ export const replaceElectorate = async (permittedPowers, config) => { await permittedPowers.consume.governedContractKits; const psmKitMap = await permittedPowers.consume.psmKit; - console.log('RABI', [...governedContractKitsMap.values()]); - const creatorFacets = [ ...[...governedContractKitsMap.values()].map( governedContractKit => governedContractKit.governorCreatorFacet,