diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js b/packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js index f29dfd1e555..b711832bffb 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js +++ b/packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js @@ -44,6 +44,7 @@ export function buildRootObject(vatPowers, vatParameters) { chainTimerService, zoe, contractHost, + { priceAuthority, adminFacet: priceAuthorityAdmin }, ] = await Promise.all([ E(vats.sharing).getSharingService(), E(vats.registrar).getSharedRegistrar(), @@ -51,6 +52,7 @@ export function buildRootObject(vatPowers, vatParameters) { E(vats.timer).createTimerService(timerDevice), E(vats.zoe).buildZoe(vatAdminSvc), E(vats.host).makeHost(), + E(vats.priceAuthority).makePriceAuthority(), ]); // Make the other demo mints @@ -61,6 +63,8 @@ export function buildRootObject(vatPowers, vatParameters) { ), ); + // TODO: Create priceAuthority pairs for + // Register the moola and simolean issuers const issuerInfo = await Promise.all( issuerNames.map(async (issuerName, i) => @@ -86,6 +90,9 @@ export function buildRootObject(vatPowers, vatParameters) { // Give the authority to create a new host for vattp to share objects with. additionalPowers.vattp = makeVattpFrom(vats); } + if (powerFlags && powerFlags.includes('agoric.priceAuthorityAdmin')) { + additionalPowers.priceAuthorityAdmin = priceAuthorityAdmin; + } const pursePetnames = { moola: 'Fun budget', @@ -121,6 +128,7 @@ export function buildRootObject(vatPowers, vatParameters) { contractHost, faucet, ibcport, + priceAuthority, registrar: registry, registry, board, @@ -365,6 +373,7 @@ export function buildRootObject(vatPowers, vatParameters) { // to give capabilities to all clients (since we are running // locally with the `--give-me-all-the-agoric-powers` flag). return chainBundler.createUserBundle(nickname, [ + 'agoric.priceAuthorityAdmin', 'agoric.vattp', ]); } diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/chain-config.json b/packages/cosmic-swingset/lib/ag-solo/vats/chain-config.json index a157336412a..8b90198d173 100644 --- a/packages/cosmic-swingset/lib/ag-solo/vats/chain-config.json +++ b/packages/cosmic-swingset/lib/ag-solo/vats/chain-config.json @@ -21,6 +21,9 @@ "network": { "sourceSpec": "vat-network.js" }, + "priceAuthority": { + "sourceSpec": "vat-priceAuthority.js" + }, "provisioning": { "sourceSpec": "vat-provisioning.js" }, diff --git a/packages/cosmic-swingset/lib/ag-solo/vats/vat-priceAuthority.js b/packages/cosmic-swingset/lib/ag-solo/vats/vat-priceAuthority.js new file mode 100644 index 00000000000..fb921011132 --- /dev/null +++ b/packages/cosmic-swingset/lib/ag-solo/vats/vat-priceAuthority.js @@ -0,0 +1,7 @@ +import { makePriceAuthorityRegistry } from '@agoric/zoe/tools/priceAuthorityRegistry'; + +export function buildRootObject(_vatPowers) { + return harden({ + makePriceAuthority: makePriceAuthorityRegistry, + }); +} diff --git a/packages/zoe/tools/priceAuthorityRegistry.js b/packages/zoe/tools/priceAuthorityRegistry.js index 75f48723a86..b2a45f23906 100644 --- a/packages/zoe/tools/priceAuthorityRegistry.js +++ b/packages/zoe/tools/priceAuthorityRegistry.js @@ -63,13 +63,13 @@ export const makePriceAuthorityRegistry = () => { const record = lookup(brandIn, brandOut); return E(record.priceAuthority).getTimerService(brandIn, brandOut); }, - async getAmountInQuote(amountIn, brandOut) { + async quoteGiven(amountIn, brandOut) { const record = lookup(amountIn.brand, brandOut); - return E(record.priceAuthority).getAmountInQuote(amountIn, brandOut); + return E(record.priceAuthority).quoteGiven(amountIn, brandOut); }, - async getAmountOutQuote(brandIn, amountOut) { + async quoteWanted(brandIn, amountOut) { const record = lookup(brandIn, amountOut.brand); - return E(record.priceAuthority).getAmountOutQuote(brandIn, amountOut); + return E(record.priceAuthority).quoteWanted(brandIn, amountOut); }, async getPriceNotifier(brandIn, brandOut) { const record = lookup(brandIn, brandOut);