diff --git a/packages/inter-protocol/src/proposals/add-auction.js b/packages/inter-protocol/src/proposals/add-auction.js index 6814fbdcc87..d6b351f3ef0 100644 --- a/packages/inter-protocol/src/proposals/add-auction.js +++ b/packages/inter-protocol/src/proposals/add-auction.js @@ -11,6 +11,7 @@ const trace = makeTracer('NewAuction', true); * auctionUpgradeNewInstance: Instance; * auctionUpgradeNewGovCreator: any; * newContractGovBundleId: string; + * retiredContractInstances: MapStore; * }>} interlockPowers */ @@ -35,6 +36,7 @@ export const addAuction = async ( economicCommitteeCreatorFacet: electorateCreatorFacet, governedContractKits: governedContractKitsP, priceAuthority8400, + retiredContractInstances: retiredContractInstancesP, zoe, }, produce: { @@ -79,6 +81,10 @@ export const addAuction = async ( auctioneerInstallationP, ]); + // save the auctioneer instance so we can manage it later + const retiredContractInstances = await retiredContractInstancesP; + retiredContractInstances.init('auction-vat157', legacyKit.instance); + // Each field has an extra layer of type + value: // AuctionStartDelay: { type: 'relativeTime', value: { relValue: 2n, timerBrand: Object [Alleged: timerBrand] {} } } /** @type {any} */ @@ -210,6 +216,7 @@ export const ADD_AUCTION_MANIFEST = harden({ economicCommitteeCreatorFacet: true, governedContractKits: true, priceAuthority8400: true, + retiredContractInstances: true, zoe: true, }, produce: { diff --git a/packages/inter-protocol/src/proposals/deploy-price-feeds.js b/packages/inter-protocol/src/proposals/deploy-price-feeds.js index f98f62223f2..ea1b7c2df19 100644 --- a/packages/inter-protocol/src/proposals/deploy-price-feeds.js +++ b/packages/inter-protocol/src/proposals/deploy-price-feeds.js @@ -84,7 +84,8 @@ export const ensureOracleBrand = async ( }; /** - * @param {EconomyBootstrapPowers} powers + * @param {EconomyBootstrapPowers & + * PromiseSpaceOf<{ retiredContractInstances: MapStore }>} powers * @param {{ * AGORIC_INSTANCE_NAME: string; * contractTerms: import('@agoric/inter-protocol/src/price/fluxAggregatorKit.js').ChainlinkConfig; @@ -103,8 +104,9 @@ const startPriceAggregatorInstance = async ( highPrioritySendersManager, namesByAddressAdmin, startGovernedUpgradable, + retiredContractInstances: retiredContractInstancesP, }, - instance: { produce: produceInstance }, + instance: { produce: produceInstance, consume: consumeInstance }, }, { AGORIC_INSTANCE_NAME, contractTerms, brandIn, brandOut }, installation, @@ -139,6 +141,15 @@ const startPriceAggregatorInstance = async ( // @ts-expect-error GovernableStartFn vs. fluxAggregatorContract.js start installation, }); + const retiringInstance = consumeInstance[AGORIC_INSTANCE_NAME]; + const retiredContractInstances = await retiredContractInstancesP; + retiredContractInstances.init( + // XXX tail of label needs to vary with upgrade. BundleId would be different + // from previous, but is not necessarily unique. + `priceFeed-${AGORIC_INSTANCE_NAME}-u18`, + retiringInstance, + ); + produceInstance[AGORIC_INSTANCE_NAME].reset(); produceInstance[AGORIC_INSTANCE_NAME].resolve(governedKit.instance); trace( @@ -191,7 +202,9 @@ const distributeInvitations = async ( }; /** - * @param {EconomyBootstrapPowers & NamedVatPowers} powers + * @param {EconomyBootstrapPowers & + * NamedVatPowers & + * PromiseSpaceOf<{ retiredContractInstances: MapStore }>} powers * @param {{ * options: PriceFeedConfig & { * priceAggregatorRef: { bundleID: string }; @@ -307,6 +320,7 @@ export const getManifestForPriceFeeds = async ( installation: { produce: { priceAggregator: t } }, instance: { produce: t, + consume: t, }, oracleBrand: { produce: t }, produce: { priceAuthority8400: t }, diff --git a/packages/inter-protocol/src/proposals/replaceElectorate.js b/packages/inter-protocol/src/proposals/replaceElectorate.js index cb862be5a67..2228a9b6501 100644 --- a/packages/inter-protocol/src/proposals/replaceElectorate.js +++ b/packages/inter-protocol/src/proposals/replaceElectorate.js @@ -15,6 +15,7 @@ import { assertPathSegment, makeStorageNodeChild, } from '@agoric/internal/src/lib-chainStorage.js'; +import { makeScalarBigMapStore } from '@agoric/vat-data'; import { reserveThenDeposit } from './utils.js'; /** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */ @@ -181,8 +182,10 @@ const inviteToEconCharter = async ( * Starts a new Economic Committee (EC) by creating an instance with the * provided committee specifications. * - * @param {EconomyBootstrapPowers} powers - The resources and capabilities - * required to start the committee. + * @param {EconomyBootstrapPowers & + * PromiseSpaceOf<{ retiredContractInstances: MapStore }>} powers + * - The resources and capabilities required to start the committee. + * * @param {{ * options: { * committeeName: string; @@ -197,11 +200,16 @@ const inviteToEconCharter = async ( const startNewEconomicCommittee = async ( { consume: { board, chainStorage, startUpgradable }, - produce: { economicCommitteeKit, economicCommitteeCreatorFacet }, + produce: { + economicCommitteeKit, + economicCommitteeCreatorFacet, + retiredContractInstances, + }, installation: { consume: { committee }, }, instance: { + consume: { economicCommittee: economicCommitteeOriginalP }, produce: { economicCommittee }, }, }, @@ -214,6 +222,15 @@ const startNewEconomicCommittee = async ( trace(`committeeName ${committeeName}`); trace(`committeeSize ${committeeSize}`); + // Record the retired electorate vat so we can manage it later. + const contractInstanceMap = makeScalarBigMapStore( + 'retiredContractInstances', + { durable: true }, + ); + const econeconomicCommitteeOriginal = await economicCommitteeOriginalP; + contractInstanceMap.init('electorate-v24', econeconomicCommitteeOriginal); + retiredContractInstances.resolve(contractInstanceMap); + const committeesNode = await makeStorageNodeChild( chainStorage, COMMITTEES_ROOT, @@ -309,6 +326,7 @@ const startNewEconCharter = async ({ * @typedef {PromiseSpaceOf<{ * auctionUpgradeNewInstance: Instance; * auctionUpgradeNewGovCreator: any; + * retiredContractInstances: MapStore; * }>} interlockPowers */ @@ -492,6 +510,7 @@ export const getManifestForReplaceAllElectorates = async ( chainStorage: true, highPrioritySendersManager: true, namesByAddressAdmin: true, + retiredContractInstances: true, // Rest of these are designed to be widely shared board: true, startUpgradable: true, @@ -514,6 +533,7 @@ export const getManifestForReplaceAllElectorates = async ( economicCommittee: true, econCommitteeCharter: true, }, + consume: { economicCommittee: true }, }, }, },