From a948b169ff754e3df3c9b07f1f7a71e2c7abbf99 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 25 Jan 2022 16:30:37 -0600 Subject: [PATCH] feat(vats): demo-config to install economy automatically --- packages/vats/decentral-demo-config.json | 5 ++++- packages/vats/src/core/boot.js | 8 +++++++- packages/vats/src/core/econ-behaviors.js | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/vats/decentral-demo-config.json b/packages/vats/decentral-demo-config.json index 9450241a9e1..3eb1420e185 100644 --- a/packages/vats/decentral-demo-config.json +++ b/packages/vats/decentral-demo-config.json @@ -2,7 +2,10 @@ "bootstrap": "bootstrap", "vats": { "bootstrap": { - "sourceSpec": "./src/core/boot.js" + "sourceSpec": "./src/core/boot.js", + "parameters": { + "governanceActions": true + } } }, "bundles": { diff --git a/packages/vats/src/core/boot.js b/packages/vats/src/core/boot.js index 1381d8daee9..ce932d3b427 100644 --- a/packages/vats/src/core/boot.js +++ b/packages/vats/src/core/boot.js @@ -4,6 +4,7 @@ import { makePromiseKit } from '@agoric/promise-kit'; import { CHAIN_BOOTSTRAP_MANIFEST, SIM_CHAIN_BOOTSTRAP_MANIFEST, + GOVERNANCE_ACTIONS_MANIFEST, } from './manifest.js'; import * as behaviors from './behaviors.js'; @@ -11,6 +12,7 @@ import * as behaviors from './behaviors.js'; const { entries, fromEntries, keys } = Object; const { details: X, quote: q } = assert; +// TODO: include behaviors in this table; separate sim-behaviors a bit more. // Choose a manifest based on runtime configured argv.ROLE. const roleToManifest = new Map([ ['chain', CHAIN_BOOTSTRAP_MANIFEST], @@ -121,6 +123,7 @@ const extract = (template, specimen) => { * @param {{ * argv: { ROLE: string }, * bootstrapManifest?: Record>, + * governanceActions?: boolean, * }} vatParameters */ const buildRootObject = (vatPowers, vatParameters) => { @@ -170,7 +173,10 @@ const buildRootObject = (vatPowers, vatParameters) => { ); }; - return runBehaviors(actualManifest); + await runBehaviors(actualManifest); + if (vatParameters.governanceActions) { + await runBehaviors(GOVERNANCE_ACTIONS_MANIFEST); + } }, }); }; diff --git a/packages/vats/src/core/econ-behaviors.js b/packages/vats/src/core/econ-behaviors.js index 14c11f2195e..cd4c6c7308a 100644 --- a/packages/vats/src/core/econ-behaviors.js +++ b/packages/vats/src/core/econ-behaviors.js @@ -36,6 +36,7 @@ export const startVaultFactory = async ({ priceAuthorityAdmin.resolve(adminFacet); + // TODO: refactor w.r.t. installEconomicGovernance below return installVaultFactoryOnChain({ agoricNames, board,