Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using governedContractKits in core eval replacing committee and charter #10178

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 17 additions & 54 deletions packages/inter-protocol/src/proposals/replaceElectorate.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,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);
Expand All @@ -220,34 +209,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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are lots of contracts floating around. let's rename creatorFacet to ecCreatorFacet or committeeCreatorFacet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Made the update.

}
};

export const replaceElectorate = async (permittedPowers, config) => {
Expand All @@ -264,14 +234,16 @@ export const replaceElectorate = async (permittedPowers, config) => {
},
);

const governedContractKitsMap =
await permittedPowers.consume.governedContractKits;
const psmKitMap = await permittedPowers.consume.psmKit;

console.log('RABI', [...governedContractKitsMap.values()]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meant to be dropped?

(I use 'CTH' (my initials) for the same purpose, and have a pre-commit script I run routinely to find phrases which should seldom be submitted. YMMV.)


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),
];

Expand Down Expand Up @@ -317,11 +289,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,
Expand All @@ -347,12 +316,6 @@ export const getManifestForReplaceElectorate = async (_, options) => ({
economicCommittee: true,
econCommitteeCharter: true,
},
consume: {
reserve: true,
VaultFactory: true,
auctioneer: true,
provisionPool: true,
},
},
},
},
Expand Down
Loading