Skip to content

Commit

Permalink
chore: sending invitations for EC charter
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Sep 23, 2024
1 parent 189a18e commit c4e1ae9
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions packages/inter-protocol/test/psm/gov-replace-committee.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,14 @@ const invitePSMCommitteeMembers = async (
const distributeInvitations = async addrInvitations => {
await Promise.all(
addrInvitations.map(async ([addr, invitationP]) => {
const [voterInvitation, charterMemberInvitation] = await Promise.all([
invitationP,
E(E.get(econCharterKit).creatorFacet).makeCharterMemberInvitation(),
]);
const [voterInvitation] = await Promise.all([invitationP]);
trace('sending charter, voting invitations to', addr);
await reserveThenDeposit(
`econ committee member ${addr}`,
namesByAddressAdmin,
addr,
[voterInvitation, charterMemberInvitation],
[voterInvitation],
);
trace('sent charter, voting invitations to', addr);
}),
);
};
Expand All @@ -123,6 +119,26 @@ const invitePSMCommitteeMembers = async (
};
harden(invitePSMCommitteeMembers);

const inviteToEconCharter = async (
{ consume: { namesByAddressAdmin, econCharterKit } },
{ options: { voterAddresses } },
) => {
const { creatorFacet } = E.get(econCharterKit);

// This doesn't resolve until the committee members create their smart wallets.
// Don't block bootstrap on it.
void Promise.all(
values(voterAddresses).map(async addr => {
const debugName = `econ charter member ${addr}`;
reserveThenDeposit(debugName, namesByAddressAdmin, addr, [
E(creatorFacet).makeCharterMemberInvitation(),
]).catch(err => console.error(`failed deposit to ${debugName}`, err));
}),
);
};

harden(inviteToEconCharter);

/**
* Convenience function for returning a storage node at or under its input,
* falling back to an inert object with the correct interface (but incomplete
Expand Down Expand Up @@ -258,6 +274,10 @@ const main = async permittedPowers => {
options: { voterAddresses: runConfig.economicCommitteeAddresses },
});

await inviteToEconCharter(permittedPowers, {
options: { voterAddresses: runConfig.economicCommitteeAddresses },
});

// somethign with the PSM charter?

/*
Expand Down

0 comments on commit c4e1ae9

Please sign in to comment.