Skip to content

Commit

Permalink
feat(vats): demo-config to install economy automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc authored and michaelfig committed Jan 26, 2022
1 parent 98e5c94 commit a948b16
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/vats/decentral-demo-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"bootstrap": "bootstrap",
"vats": {
"bootstrap": {
"sourceSpec": "./src/core/boot.js"
"sourceSpec": "./src/core/boot.js",
"parameters": {
"governanceActions": true
}
}
},
"bundles": {
Expand Down
8 changes: 7 additions & 1 deletion packages/vats/src/core/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ 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';

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],
Expand Down Expand Up @@ -121,6 +123,7 @@ const extract = (template, specimen) => {
* @param {{
* argv: { ROLE: string },
* bootstrapManifest?: Record<string, Record<string, unknown>>,
* governanceActions?: boolean,
* }} vatParameters
*/
const buildRootObject = (vatPowers, vatParameters) => {
Expand Down Expand Up @@ -170,7 +173,10 @@ const buildRootObject = (vatPowers, vatParameters) => {
);
};

return runBehaviors(actualManifest);
await runBehaviors(actualManifest);
if (vatParameters.governanceActions) {
await runBehaviors(GOVERNANCE_ACTIONS_MANIFEST);
}
},
});
};
Expand Down
1 change: 1 addition & 0 deletions packages/vats/src/core/econ-behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const startVaultFactory = async ({

priceAuthorityAdmin.resolve(adminFacet);

// TODO: refactor w.r.t. installEconomicGovernance below
return installVaultFactoryOnChain({
agoricNames,
board,
Expand Down

0 comments on commit a948b16

Please sign in to comment.