Skip to content

Commit

Permalink
refactor: pass the new contractGovernor explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Oct 21, 2024
1 parent 6582793 commit e319cd1
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions packages/inter-protocol/src/proposals/add-auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const trace = makeTracer('NewAuction', true);
* @param {import('./econ-behaviors.js').EconomyBootstrapPowers &
* interlockPowers} powers
* @param {{
* options: { contractGovernorRef: { bundleID: string } };
* options: {
* contractGovernorRef: { bundleID: string };
* contractGovernorInstallation: Installation;
* };
* }} options
*/
export const addAuction = async (
Expand All @@ -43,16 +46,18 @@ export const addAuction = async (
produce: { auctioneer: auctionInstance },
},
installation: {
consume: {
auctioneer: auctioneerInstallationP,
contractGovernor: governorInstallationP,
},
consume: { auctioneer: auctioneerInstallationP },
},
issuer: {
consume: { [Stable.symbol]: stableIssuerP },
},
},
{ options: { contractGovernorRef: contractGovernorBundle } },
{
options: {
contractGovernorRef: contractGovernorBundle,
contractGovernorInstallation,
},
},
) => {
trace('addAuction start');
const STORAGE_PATH = 'auction';
Expand All @@ -64,14 +69,12 @@ export const addAuction = async (
stableIssuer,
legacyKit,
auctioneerInstallation,
governorInstallation,
] = await Promise.all([
poserInvitationP,
E(E(zoe).getInvitationIssuer()).getAmountOf(poserInvitationP),
stableIssuerP,
legacyKitP,
auctioneerInstallationP,
governorInstallationP,
]);

// Each field has an extra layer of type + value:
Expand Down Expand Up @@ -120,9 +123,14 @@ export const addAuction = async (
}),
);

const bundleIdFromZoe = await E(zoe).getBundleIDFromInstallation(
contractGovernorInstallation,
);
trace('governor bundle ID', bundleIdFromZoe, contractGovernorBundle.bundleID);

/** @type {GovernorStartedInstallationKit<typeof auctioneerInstallationP>} */
const governorStartResult = await E(zoe).startInstance(
governorInstallation,
contractGovernorInstallation,
undefined,
governorTerms,
harden({
Expand Down Expand Up @@ -235,9 +243,12 @@ export const getManifestForAddAuction = async (
{ restoreRef },
{ auctioneerRef, contractGovernorRef },
) => {
const contractGovernorInstallation = restoreRef(contractGovernorRef);
return {
manifest: ADD_AUCTION_MANIFEST,
options: { contractGovernorRef },
// XXX we should be able to receive contractGovernorInstallation via
// installations.consume, but the received installation isn't right.
options: { contractGovernorRef, contractGovernorInstallation },
installations: {
auctioneer: restoreRef(auctioneerRef),
contractGovernor: restoreRef(contractGovernorRef),
Expand Down

0 comments on commit e319cd1

Please sign in to comment.