Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6765 publish vaultManager's price feed #6862

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ERTP/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const IssuerShape = M.remotable('Issuer');
export const PaymentShape = M.remotable('Payment');
export const PurseShape = M.remotable('Purse');
export const DepositFacetShape = M.remotable('DepositFacet');
const NotifierShape = M.remotable('Notifier');
export const NotifierShape = M.remotable('Notifier');
export const MintShape = M.remotable('Mint');

/**
Expand Down
10 changes: 6 additions & 4 deletions packages/inter-protocol/src/contractSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,26 +184,28 @@ harden(provideEmptySeat);
*
* @param {import('@agoric/vat-data').Baggage} baggage
* @param {string} category diagnostic tag
* @returns {import('@agoric/vat-data').Baggage}
*/
export const provideChildBaggage = (baggage, category) => {
const baggageSet = provideDurableSetStore(baggage, `${category}Set`);
return Far('childBaggageManager', {
// TODO(types) infer args
/**
* @template {(baggage: import('@agoric/ertp').Baggage) => any} M Maker function
* @template {(baggage: import('@agoric/ertp').Baggage, ...rest: any) => any} M Maker function
* @param {string} childName diagnostic tag
* @param {M} makeChild
* @param {...any} nonBaggageArgs
* @returns {ReturnType<M>}
*/
addChild: (childName, makeChild) => {
addChild: (childName, makeChild, ...nonBaggageArgs) => {
const childStore = makeScalarBigMapStore(`${childName}${category}`, {
durable: true,
});
const result = makeChild(childStore);
const result = makeChild(childStore, ...nonBaggageArgs);
baggageSet.add(childStore);
return result;
},
children: () => baggageSet.values(),
});
};
harden(provideChildBaggage);
/** @typedef {ReturnType<typeof provideChildBaggage>} ChildBaggageManager */
15 changes: 8 additions & 7 deletions packages/inter-protocol/src/vaultFactory/vaultDirector.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
makeScalarBigMapStore,
} from '@agoric/vat-data';
import { assertKeywordName } from '@agoric/zoe/src/cleanProposal.js';
import { unitAmount } from '@agoric/zoe/src/contractSupport/priceQuote.js';
import { makeMakeCollectFeesInvitation } from '../collectFees.js';
import {
CHARGING_PERIOD_KEY,
Expand All @@ -43,7 +44,7 @@ const { details: X, quote: q, Fail } = assert;
/** @typedef {{
* debtMint: ZCFMint<'nat'>,
* directorParamManager: import('@agoric/governance/src/contractGovernance/typedParamManager').TypedParamManager<import('./params.js').VaultDirectorParams>,
* managerBaggages: *,
* managerBaggages: import('../contractSupport.js').ChildBaggageManager,
* marshaller: ERef<Marshaller>,
* shortfallReporter: import('../reserve/assetReserve.js').ShortfallReporter,
* storedMetricsSubscriber: StoredSubscriber<MetricsNotification>,
Expand Down Expand Up @@ -469,22 +470,22 @@ const makeVaultDirector = defineDurableExoClassKit(
const { managerBaggages } = ephemera;
// alleged okay because used only as a diagnostic tag
const brandName = await E(collateralBrand).getAllegedName();
const collateralUnit = await unitAmount(collateralBrand);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't suppose there's a straightforward way to get the displayInfo earlier, is there?


const makeVaultManager = managerBaggages.addChild(
brandName,
prepareVaultManagerKit,
);

const { self: vm } = makeVaultManager(
zcf,
debtMint,
collateralBrand,
zcf.getTerms().priceAuthority,
collateralUnit,
factoryPowers,
timerService,
startTimeStamp,
managerStorageNode,
ephemera.marshaller,
marshaller,
);

const { self: vm } = makeVaultManager();
collateralTypes.init(collateralBrand, vm);
const { install, terms } = getLiquidationConfig(directorParamManager);
await vm.setupLiquidator(install, terms);
Expand Down
Loading