Skip to content

Commit

Permalink
fix(vats): move startPriceAuthority earlier in the boot sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Mar 25, 2022
1 parent 935dd05 commit 3d15399
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
22 changes: 0 additions & 22 deletions packages/run-protocol/src/econ-behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,6 @@ export const setupAmm = async ({
return ammInstallation.then(i => ammInstallationProducer.resolve(i));
};

/**
* @param {BootstrapPowers & {
* consume: { loadVat: ERef<VatLoader<PriceAuthorityVat>>},
* }} powers
*
* @typedef {ERef<ReturnType<import('../../vats/src/vat-priceAuthority.js').buildRootObject>>} PriceAuthorityVat
*/
export const startPriceAuthority = async ({
consume: { loadVat },
produce,
}) => {
const vats = { priceAuthority: E(loadVat)('priceAuthority') };
const { priceAuthority, adminFacet } = await E(
vats.priceAuthority,
).makePriceAuthorityRegistry();

produce.priceAuthorityVat.resolve(vats.priceAuthority);
produce.priceAuthority.resolve(priceAuthority);
produce.priceAuthorityAdmin.resolve(adminFacet);
};
harden(startPriceAuthority);

/**
* @param { EconomyBootstrapPowers } powers
* @param { Object } config
Expand Down
22 changes: 22 additions & 0 deletions packages/vats/src/core/basic-behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,28 @@ export const buildZoe = async ({
};
harden(buildZoe);

/**
* @param {BootstrapPowers & {
* consume: { loadVat: ERef<VatLoader<PriceAuthorityVat>>},
* }} powers
*
* @typedef {ERef<ReturnType<import('../vat-priceAuthority.js').buildRootObject>>} PriceAuthorityVat
*/
export const startPriceAuthority = async ({
consume: { loadVat },
produce,
}) => {
const vats = { priceAuthority: E(loadVat)('priceAuthority') };
const { priceAuthority, adminFacet } = await E(
vats.priceAuthority,
).makePriceAuthorityRegistry();

produce.priceAuthorityVat.resolve(vats.priceAuthority);
produce.priceAuthority.resolve(priceAuthority);
produce.priceAuthorityAdmin.resolve(adminFacet);
};
harden(startPriceAuthority);

/**
* Create inert brands (no mint or issuer) referred to by price oracles.
*
Expand Down
16 changes: 8 additions & 8 deletions packages/vats/src/core/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ const SHARED_BOOTSTRAP_MANIFEST = harden({
},
},
},
startPriceAuthority: {
consume: { loadVat: true },
produce: {
priceAuthorityVat: 'priceAuthority',
priceAuthority: 'priceAuthority',
priceAuthorityAdmin: 'priceAuthority',
},
},
makeVatsFromBundles: {
vats: {
vatAdmin: 'vatAdmin',
Expand Down Expand Up @@ -294,14 +302,6 @@ const SHARED_POST_BOOT_MANIFEST = harden({
produce: { amm: 'amm', ammGovernor: 'ammGovernor' },
},
},
startPriceAuthority: {
consume: { loadVat: true },
produce: {
priceAuthorityVat: 'priceAuthority',
priceAuthority: 'priceAuthority',
priceAuthorityAdmin: 'priceAuthority',
},
},
startVaultFactory: {
consume: {
feeMintAccess: 'zoe',
Expand Down

0 comments on commit 3d15399

Please sign in to comment.