Skip to content

Commit

Permalink
feat: repair KREAd contract on zoe upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert authored and mhofman committed Jun 22, 2024
1 parent e4cc97c commit 84dd229
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions golang/cosmos/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,8 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte
CoreProposalSteps = []vm.CoreProposalStep{
// Upgrade Zoe + ZCF
vm.CoreProposalStepForModules("@agoric/builders/scripts/vats/replace-zoe.js"),
// Revive KREAd characters
vm.CoreProposalStepForModules("@agoric/builders/scripts/vats/revive-kread.js"),

// upgrade the provisioning vat
vm.CoreProposalStepForModules("@agoric/builders/scripts/vats/replace-provisioning.js"),
Expand Down
13 changes: 13 additions & 0 deletions packages/builders/scripts/vats/revive-kread.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { makeHelpers } from '@agoric/deploy-script-support';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
export const defaultProposalBuilder = async () =>
harden({
sourceSpec: '@agoric/vats/src/proposals/kread-proposal.js',
getManifestCall: ['getManifestForKread'],
});

export default async (homeP, endowments) => {
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
await writeCoreProposal('revive-kread', defaultProposalBuilder);
};
24 changes: 24 additions & 0 deletions packages/vats/src/proposals/kread-proposal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { E } from '@endo/far';

/**
* @param {BootstrapPowers & {
* consume: { kreadKit: any };
* }} powers
*/
export const repairKread = async ({ consume: { kreadKit: kreadKitP } }) => {
console.log('repairSubscribers');

const kreadKit = await kreadKitP;
const creatorFacet = kreadKit.creatorFacet;
console.log(`KREAd creatorFacet`, creatorFacet);
await E(creatorFacet).reviveMarketExitSubscribers();
console.log('KREAd subscribers were revived!');
};

export const getManifestForKread = _powers => ({
manifest: {
[repairKread.name]: {
consume: { kreadKit: true },
},
},
});

0 comments on commit 84dd229

Please sign in to comment.