Skip to content

Commit

Permalink
chore(provisionPool): add governedParamOverrides to privateArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge-Lopes committed Dec 6, 2024
1 parent ad4e83e commit f564aab
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions packages/vats/src/proposals/upgrade-provisionPool-proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { E } from '@endo/far';
import { deeplyFulfilled } from '@endo/marshal';
import { makeTracer } from '@agoric/internal';

const tracer = makeTracer('UpgradeProvisionPool');
const trace = makeTracer('UpgradeProvisionPool');

/**
* @param {BootstrapPowers & {
Expand Down Expand Up @@ -30,7 +30,7 @@ export const upgradeProvisionPool = async (
const { provisionPoolRef } = options.options;

assert(provisionPoolRef.bundleID);
tracer(`PROVISION POOL BUNDLE ID: `, provisionPoolRef);
trace(`PROVISION POOL BUNDLE ID: `, provisionPoolRef);

const [
provisionPoolStartResult,
Expand All @@ -49,6 +49,7 @@ export const upgradeProvisionPool = async (
adminFacet,
instance,
creatorFacet: ppCreatorFacet,
publicFacet: ppPublicFacet,
} = provisionPoolStartResult;
const { creatorFacet: wfCreatorFacet } = walletFactoryStartResult;

Expand All @@ -59,35 +60,47 @@ export const upgradeProvisionPool = async (
E(electorateCreatorFacet).getPoserInvitation(),
]);

const readCurrentGovernedParams = async () => {
await null;

const params = await E(ppPublicFacet).getGovernedParams();
return harden({
PerAccountInitialAmount: params.PerAccountInitialAmount.value,
});
};
const governedParamOverrides = await readCurrentGovernedParams();
trace('governedParamOverrides: ', { governedParamOverrides });

const newPrivateArgs = harden({
...originalPrivateArgs,
initialPoserInvitation: poserInvitation,
governedParamOverrides,
});

const upgradeResult = await E(adminFacet).upgradeContract(
provisionPoolRef.bundleID,
newPrivateArgs,
);

tracer('ProvisionPool upgraded: ', upgradeResult);
trace('ProvisionPool upgraded: ', upgradeResult);

const references = {
bankManager,
namesByAddressAdmin,
walletFactory: wfCreatorFacet,
};

tracer('Calling setReferences with: ', references);
trace('Calling setReferences with: ', references);
await E(ppCreatorFacet).setReferences(references);

tracer('Creating bridgeHandler...');
trace('Creating bridgeHandler...');
const bridgeHandler = await E(ppCreatorFacet).makeHandler();

tracer('Setting new bridgeHandler...');
trace('Setting new bridgeHandler...');
// @ts-expect-error casting
await E(provisionWalletBridgeManager).setHandler(bridgeHandler);

tracer('Done.');
trace('Done.');
};

export const getManifestForUpgradingProvisionPool = (
Expand Down

0 comments on commit f564aab

Please sign in to comment.