Skip to content

Commit

Permalink
chore: use installation.produce.CONTRACT rather than agoricNames
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Aug 21, 2024
1 parent b6e0739 commit 37505e3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,20 @@ const triggerAuction = async t => {
t.is(atomOut, '+5200000');
};

function newAuctioneerFromNewBundle(details) {
// contract vat names are based on bundleID
const ORIGINAL_AUCTION_VAT_NAME = 'zcf-b1-a5683-auctioneer';

const newAuctioneerFromNewBundle = details => {
for (const detail of details) {
// contract vat names are based on bundleID
const originalAuctionVatName = 'zcf-b1-a5683-auctioneer';
if (
!detail.vatName.includes('governor') &&
detail.vatName !== originalAuctionVatName
detail.vatName !== ORIGINAL_AUCTION_VAT_NAME
) {
return true;
}
}
return false;
}
};

const checkAuctionVat = async t => {
const details = await getDetailsMatchingVats('auctioneer');
Expand Down
16 changes: 4 additions & 12 deletions packages/inter-protocol/src/proposals/add-auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const addAuction = async (
priceAuthority,
chainStorage,
economicCommitteeCreatorFacet: electorateCreatorFacet,
agoricNamesAdmin,
auctioneerKit: legacyKitP,
},
produce: { newAuctioneerKit, auctionsUpgradeComplete },
Expand All @@ -35,6 +34,7 @@ export const addAuction = async (
},
installation: {
consume: { contractGovernor: contractGovernorInstallation },
produce: { auctioneer: produceInstallation },
},
issuer: {
consume: { [Stable.symbol]: stableIssuerP },
Expand All @@ -54,6 +54,8 @@ export const addAuction = async (
* >}
*/
const installationP = E(zoe).installBundleID(bundleID);
produceInstallation.reset();
produceInstallation.resolve(installationP);

const [
initialPoserInvitation,
Expand All @@ -67,16 +69,6 @@ export const addAuction = async (
legacyKitP,
]);

await E.when(
installationP,
installation =>
E(E(agoricNamesAdmin).lookupAdmin('installation')).update(
'auctioneer',
installation,
),
err => console.error(`🚨 failed to update vaultFactory installation`, err),
);

// Each field has an extra layer of type + value:
// AuctionStartDelay: { type: 'relativeTime', value: { relValue: 2n, timerBrand: Object [Alleged: timerBrand] {} } }
/** @type {any} */
Expand Down Expand Up @@ -187,7 +179,6 @@ export const ADD_AUCTION_MANIFEST = harden({
priceAuthority: true,
chainStorage: true,
economicCommitteeCreatorFacet: true,
agoricNamesAdmin: true,
auctioneerKit: true,
},
produce: {
Expand All @@ -202,6 +193,7 @@ export const ADD_AUCTION_MANIFEST = harden({
auctioneer: true,
contractGovernor: true,
},
produce: { auctioneer: true },
},
issuer: {
consume: { [Stable.symbol]: true },
Expand Down
26 changes: 9 additions & 17 deletions packages/inter-protocol/src/proposals/upgrade-vaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export const upgradeVaults = async (
newAuctioneerKit: tempAuctioneerKit,
auctionsUpgradeComplete: auctionsUpgradeCompleteProducer,
},
installation: {
produce: { VaultFactory: produceVaultInstallation },
},
instance: {
produce: { auctioneer: auctioneerProducer },
},
Expand All @@ -78,27 +81,13 @@ export const upgradeVaults = async (
* Installation<import('../../src/vaultFactory/vaultFactory.js')['start']>
* >}
*/
let installationP;
const installationP = E(zoe).installBundleID(bundleID);
produceVaultInstallation.reset();
produceVaultInstallation.resolve(installationP);

await auctionsUpgradeComplete;
auctionsUpgradeCompleteProducer.reset();

if (vaultsRef) {
if (bundleID) {
installationP = E(zoe).installBundleID(bundleID);
await E.when(
installationP,
installation =>
E(E(agoricNamesAdmin).lookupAdmin('installation')).update(
'vaultFactory',
installation,
),
err =>
console.error(`🚨 failed to update vaultFactory installation`, err),
);
}
}

const readCurrentDirectorParams = async () => {
const { publicFacet: directorPF } = kit;

Expand Down Expand Up @@ -282,6 +271,9 @@ export const getManifestForUpgradeVaults = async (
newAuctioneerKit: uV,
auctionsUpgradeComplete: uV,
},
installation: {
produce: { VaultFactory: true },
},
instance: { produce: { auctioneer: uV, newAuctioneerKit: uV } },
},
},
Expand Down

0 comments on commit 37505e3

Please sign in to comment.