Skip to content

Commit

Permalink
refactor: WellKnownInstallations
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Feb 10, 2023
1 parent 06298b2 commit 24f23f0
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 23 deletions.
26 changes: 3 additions & 23 deletions packages/vats/src/core/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,7 @@
*/

/**
* @typedef {{
* amm: import('@agoric/inter-protocol/src/vpool-xyk-amm/multipoolMarketMaker.js').start,
* binaryVoteCounter: import('@agoric/governance/src/binaryVoteCounter.js').start,
* centralSupply: import('@agoric/vats/src/centralSupply.js').start,
* committee: import('@agoric/governance/src/committee.js').start,
* contractGovernor: import('@agoric/governance/src/contractGovernor.js').start,
* econCommitteeCharter: import('@agoric/inter-protocol/src/econCommitteeCharter.js').start,
* feeDistributor: import('@agoric/inter-protocol/src/feeDistributor.js').start,
* interchainPool: import('@agoric/inter-protocol/src/interchainPool.js').start,
* liquidate: import('@agoric/inter-protocol/src/vaultFactory/liquidateIncrementally.js').start,
* mintHolder: import('@agoric/vats/src/mintHolder.js').prepare,
* noActionElectorate: unknown,
* Pegasus: unknown,
* psm: import('@agoric/inter-protocol/src/psm/psm.js').start,
* priceAggregator: import('@agoric/inter-protocol/src/price/fluxAggregator.contract.js').start,
* provisionPool: import('@agoric/vats/src/provisionPool.js').start,
* reserve: import('@agoric/inter-protocol/src/reserve/assetReserve.js').start,
* stakeFactory: import('@agoric/inter-protocol/src/stakeFactory/stakeFactory.js').start,
* walletFactory: import('@agoric/smart-wallet/src/walletFactory.js').start,
* VaultFactory: import('@agoric/inter-protocol/src/vaultFactory/vaultFactory.js').start,
* }} WellKnownInstallations */
* @typedef {import('./wellKnown').WellKnownInstallations} WellKnownInstallations */

/**
* @typedef {import('../tokens.js').TokenKeyword} TokenKeyword
Expand Down Expand Up @@ -186,8 +166,8 @@
* consume: Record<WellKnownName['oracleBrand'], Promise<Brand>>,
* },
* installation:{
* produce: { [K in keyof WellKnownInstallations]: Producer<Installation<WellKnownInstallations[K]>> },
* consume: { [K in keyof WellKnownInstallations]: Promise<Installation<WellKnownInstallations[K]>> },
* produce: { [K in keyof WellKnownInstallations]: Producer<WellKnownInstallations[K]> },
* consume: { [K in keyof WellKnownInstallations]: Promise<WellKnownInstallations[K]> },
* },
* instance:{
* produce: Record<WellKnownName['instance'], Producer<Instance>>,
Expand Down
51 changes: 51 additions & 0 deletions packages/vats/src/core/wellKnown.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @file Type exports for WellKnown names. TS so it doesn't affect runtime dependency graph.
*/
// 'start' fns
import type { start as amm } from '@agoric/inter-protocol/src/vpool-xyk-amm/multipoolMarketMaker.js';
import type { start as binaryVoteCounter } from '@agoric/governance/src/binaryVoteCounter.js';
import type { start as committee } from '@agoric/governance/src/committee.js';
import type { start as contractGovernor } from '@agoric/governance/src/contractGovernor.js';
import type { start as econCommitteeCharter } from '@agoric/inter-protocol/src/econCommitteeCharter.js';
import type { start as feeDistributor } from '@agoric/inter-protocol/src/feeDistributor.js';
import type { start as interchainPool } from '@agoric/inter-protocol/src/interchainPool.js';
import type { start as liquidate } from '@agoric/inter-protocol/src/vaultFactory/liquidateIncrementally.js';
import type { start as noActionElectorate } from '@agoric/governance/src/noActionElectorate.js';
import type { start as priceAggregator } from '@agoric/inter-protocol/src/price/fluxAggregator.contract.js';
import type { start as psm } from '@agoric/inter-protocol/src/psm/psm.js';
import type { start as reserve } from '@agoric/inter-protocol/src/reserve/assetReserve.js';
import type { start as stakeFactory } from '@agoric/inter-protocol/src/stakeFactory/stakeFactory.js';
import type { start as VaultFactory } from '@agoric/inter-protocol/src/vaultFactory/vaultFactory.js';
import type { start as walletFactory } from '@agoric/smart-wallet/src/walletFactory.js';
import type { start as Pegasus } from '@agoric/pegasus/src/pegasus.js';
import type { start as provisionPool } from '../provisionPool.js';
import type { start as centralSupply } from '../centralSupply.js';

// 'prepare' fns
import type { prepare as mintHolder } from '../mintHolder.js';

const contractFns = {
amm,
binaryVoteCounter,
centralSupply,
committee,
contractGovernor,
econCommitteeCharter,
feeDistributor,
interchainPool,
liquidate,
mintHolder,
noActionElectorate,
Pegasus,
priceAggregator,
provisionPool,
psm,
reserve,
stakeFactory,
VaultFactory,
walletFactory,
};

export type WellKnownInstallations = {
[K in keyof typeof contractFns]: Installation<(typeof contractFns)[K]>;
};

0 comments on commit 24f23f0

Please sign in to comment.