@agoric/inter-protocol 0.16.2-dev-eb7e9eb.0 → 0.16.2-u11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/CHANGELOG.md +1041 -0
  2. package/bundles/bundle-auctioneer-js-meta.json +722 -0
  3. package/bundles/bundle-auctioneer.js +1 -0
  4. package/bundles/bundle-econCommitteeCharter-js-meta.json +222 -242
  5. package/bundles/bundle-econCommitteeCharter.js +1 -1
  6. package/bundles/bundle-feeDistributor-js-meta.json +458 -0
  7. package/bundles/bundle-feeDistributor.js +1 -0
  8. package/bundles/bundle-fluxAggregatorKit-js-meta.json +327 -343
  9. package/bundles/bundle-fluxAggregatorKit.js +1 -1
  10. package/bundles/bundle-psm-js-meta.json +308 -328
  11. package/bundles/bundle-psm.js +1 -1
  12. package/bundles/bundle-reserve-js-meta.json +662 -0
  13. package/bundles/bundle-reserve.js +1 -0
  14. package/bundles/bundle-scaledPriceAuthority-js-meta.json +542 -0
  15. package/bundles/bundle-scaledPriceAuthority.js +1 -0
  16. package/bundles/bundle-vaultFactory-js-meta.json +790 -0
  17. package/bundles/bundle-vaultFactory.js +1 -0
  18. package/package.json +31 -31
  19. package/scripts/add-collateral-core.js +112 -0
  20. package/scripts/build-bundles.js +21 -5
  21. package/scripts/deploy-contracts.js +100 -0
  22. package/scripts/init-core.js +198 -0
  23. package/scripts/invite-committee-core.js +42 -0
  24. package/scripts/manual-price-feed.js +117 -0
  25. package/scripts/price-feed-core.js +104 -0
  26. package/scripts/start-local-chain.sh +84 -0
  27. package/src/auction/auctionBook.js +56 -68
  28. package/src/auction/auctioneer.js +44 -56
  29. package/src/auction/offerBook.js +11 -12
  30. package/src/auction/params.js +5 -3
  31. package/src/auction/scheduleMath.js +13 -13
  32. package/src/auction/scheduler.js +32 -22
  33. package/src/auction/sortedOffers.js +7 -8
  34. package/src/auction/util.js +4 -4
  35. package/src/clientSupport.js +96 -152
  36. package/src/contractSupport.js +5 -5
  37. package/src/econCommitteeCharter.js +15 -16
  38. package/src/feeDistributor.js +33 -34
  39. package/src/interest.js +14 -20
  40. package/src/price/fluxAggregatorContract.js +45 -51
  41. package/src/price/fluxAggregatorKit.js +32 -47
  42. package/src/price/priceOracleKit.js +13 -11
  43. package/src/price/roundsManager.js +64 -52
  44. package/src/proposals/addAssetToVault.js +3 -15
  45. package/src/proposals/committee-proposal.js +9 -5
  46. package/src/proposals/core-proposal.js +7 -7
  47. package/src/proposals/econ-behaviors.js +32 -57
  48. package/src/proposals/price-feed-proposal.js +26 -59
  49. package/src/proposals/startEconCommittee.js +1 -1
  50. package/src/proposals/startPSM.js +22 -32
  51. package/src/proposals/utils.js +7 -26
  52. package/src/psm/psm.js +63 -69
  53. package/src/reserve/assetReserve.js +18 -27
  54. package/src/reserve/assetReserveKit.js +22 -14
  55. package/src/typeGuards.js +13 -0
  56. package/src/vaultFactory/liquidation.js +17 -30
  57. package/src/vaultFactory/math.js +9 -8
  58. package/src/vaultFactory/orderedVaultStore.js +9 -6
  59. package/src/vaultFactory/params.js +18 -24
  60. package/src/vaultFactory/prioritizedVaults.js +2 -2
  61. package/src/vaultFactory/proceeds.js +18 -24
  62. package/src/vaultFactory/storeUtils.js +12 -8
  63. package/src/vaultFactory/types.js +28 -38
  64. package/src/vaultFactory/vault.js +89 -88
  65. package/src/vaultFactory/vaultDirector.js +41 -33
  66. package/src/vaultFactory/vaultFactory.js +26 -33
  67. package/src/vaultFactory/vaultHolder.js +13 -8
  68. package/src/vaultFactory/vaultKit.js +2 -3
  69. package/src/vaultFactory/vaultManager.js +120 -138
  70. package/src/auction/auctionBook.d.ts +0 -83
  71. package/src/auction/auctionBook.d.ts.map +0 -1
  72. package/src/auction/auctioneer.d.ts +0 -75
  73. package/src/auction/auctioneer.d.ts.map +0 -1
  74. package/src/auction/offerBook.d.ts +0 -72
  75. package/src/auction/offerBook.d.ts.map +0 -1
  76. package/src/auction/params.d.ts +0 -142
  77. package/src/auction/params.d.ts.map +0 -1
  78. package/src/auction/scheduleMath.d.ts +0 -4
  79. package/src/auction/scheduleMath.d.ts.map +0 -1
  80. package/src/auction/scheduler.d.ts +0 -49
  81. package/src/auction/scheduler.d.ts.map +0 -1
  82. package/src/auction/sortedOffers.d.ts +0 -8
  83. package/src/auction/sortedOffers.d.ts.map +0 -1
  84. package/src/auction/util.d.ts +0 -30
  85. package/src/auction/util.d.ts.map +0 -1
  86. package/src/clientSupport.d.ts +0 -167
  87. package/src/clientSupport.d.ts.map +0 -1
  88. package/src/collectFees.d.ts +0 -2
  89. package/src/collectFees.d.ts.map +0 -1
  90. package/src/contractSupport.d.ts +0 -33
  91. package/src/contractSupport.d.ts.map +0 -1
  92. package/src/econCommitteeCharter.d.ts +0 -41
  93. package/src/econCommitteeCharter.d.ts.map +0 -1
  94. package/src/feeDistributor.d.ts +0 -212
  95. package/src/feeDistributor.d.ts.map +0 -1
  96. package/src/index.d.ts +0 -2
  97. package/src/index.d.ts.map +0 -1
  98. package/src/interest-math.d.ts +0 -3
  99. package/src/interest-math.d.ts.map +0 -1
  100. package/src/interest.d.ts +0 -29
  101. package/src/interest.d.ts.map +0 -1
  102. package/src/price/fluxAggregatorContract.d.ts +0 -112
  103. package/src/price/fluxAggregatorContract.d.ts.map +0 -1
  104. package/src/price/fluxAggregatorKit.d.ts +0 -155
  105. package/src/price/fluxAggregatorKit.d.ts.map +0 -1
  106. package/src/price/priceOracleKit.d.ts +0 -52
  107. package/src/price/priceOracleKit.d.ts.map +0 -1
  108. package/src/price/roundsManager.d.ts +0 -330
  109. package/src/price/roundsManager.d.ts.map +0 -1
  110. package/src/proposals/addAssetToVault.d.ts +0 -155
  111. package/src/proposals/addAssetToVault.d.ts.map +0 -1
  112. package/src/proposals/committee-proposal.d.ts +0 -121
  113. package/src/proposals/committee-proposal.d.ts.map +0 -1
  114. package/src/proposals/core-proposal.d.ts +0 -149
  115. package/src/proposals/core-proposal.d.ts.map +0 -1
  116. package/src/proposals/econ-behaviors.d.ts +0 -201
  117. package/src/proposals/econ-behaviors.d.ts.map +0 -1
  118. package/src/proposals/price-feed-proposal.d.ts +0 -83
  119. package/src/proposals/price-feed-proposal.d.ts.map +0 -1
  120. package/src/proposals/startEconCommittee.d.ts +0 -34
  121. package/src/proposals/startEconCommittee.d.ts.map +0 -1
  122. package/src/proposals/startPSM.d.ts +0 -61
  123. package/src/proposals/startPSM.d.ts.map +0 -1
  124. package/src/proposals/utils.d.ts +0 -15
  125. package/src/proposals/utils.d.ts.map +0 -1
  126. package/src/provisionPool.d.ts +0 -165
  127. package/src/provisionPool.d.ts.map +0 -1
  128. package/src/provisionPool.js +0 -119
  129. package/src/provisionPoolKit.d.ts +0 -379
  130. package/src/provisionPoolKit.d.ts.map +0 -1
  131. package/src/provisionPoolKit.js +0 -461
  132. package/src/psm/psm.d.ts +0 -178
  133. package/src/psm/psm.d.ts.map +0 -1
  134. package/src/psm/types.d.ts +0 -2
  135. package/src/psm/types.d.ts.map +0 -1
  136. package/src/reserve/assetReserve.d.ts +0 -44
  137. package/src/reserve/assetReserve.d.ts.map +0 -1
  138. package/src/reserve/assetReserveKit.d.ts +0 -114
  139. package/src/reserve/assetReserveKit.d.ts.map +0 -1
  140. package/src/reserve/params.d.ts +0 -10
  141. package/src/reserve/params.d.ts.map +0 -1
  142. package/src/tokens.d.ts +0 -3
  143. package/src/tokens.d.ts.map +0 -1
  144. package/src/tokens.js +0 -5
  145. package/src/vaultFactory/burn.d.ts +0 -2
  146. package/src/vaultFactory/burn.d.ts.map +0 -1
  147. package/src/vaultFactory/liquidation.d.ts +0 -24
  148. package/src/vaultFactory/liquidation.d.ts.map +0 -1
  149. package/src/vaultFactory/math.d.ts +0 -10
  150. package/src/vaultFactory/math.d.ts.map +0 -1
  151. package/src/vaultFactory/orderedVaultStore.d.ts +0 -94
  152. package/src/vaultFactory/orderedVaultStore.d.ts.map +0 -1
  153. package/src/vaultFactory/params.d.ts +0 -159
  154. package/src/vaultFactory/params.d.ts.map +0 -1
  155. package/src/vaultFactory/prioritizedVaults.d.ts +0 -279
  156. package/src/vaultFactory/prioritizedVaults.d.ts.map +0 -1
  157. package/src/vaultFactory/proceeds.d.ts +0 -34
  158. package/src/vaultFactory/proceeds.d.ts.map +0 -1
  159. package/src/vaultFactory/storeUtils.d.ts +0 -25
  160. package/src/vaultFactory/storeUtils.d.ts.map +0 -1
  161. package/src/vaultFactory/type-imports.d.ts +0 -2
  162. package/src/vaultFactory/type-imports.d.ts.map +0 -1
  163. package/src/vaultFactory/types.d.ts +0 -137
  164. package/src/vaultFactory/types.d.ts.map +0 -1
  165. package/src/vaultFactory/vault.d.ts +0 -529
  166. package/src/vaultFactory/vault.d.ts.map +0 -1
  167. package/src/vaultFactory/vaultDirector.d.ts +0 -560
  168. package/src/vaultFactory/vaultDirector.d.ts.map +0 -1
  169. package/src/vaultFactory/vaultFactory.d.ts +0 -162
  170. package/src/vaultFactory/vaultFactory.d.ts.map +0 -1
  171. package/src/vaultFactory/vaultHolder.d.ts +0 -201
  172. package/src/vaultFactory/vaultHolder.d.ts.map +0 -1
  173. package/src/vaultFactory/vaultKit.d.ts +0 -32
  174. package/src/vaultFactory/vaultKit.d.ts.map +0 -1
  175. package/src/vaultFactory/vaultManager.d.ts +0 -554
  176. package/src/vaultFactory/vaultManager.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  // @jessie-check
2
2
 
3
- import { Stable } from '@agoric/internal/src/tokens.js';
3
+ import { Stable } from '@agoric/vats/src/tokens.js';
4
4
  import * as econBehaviors from './econ-behaviors.js';
5
5
  import { ECON_COMMITTEE_MANIFEST } from './startEconCommittee.js';
6
6
 
@@ -15,7 +15,9 @@ export * from './startEconCommittee.js'; // eslint-disable-line import/export
15
15
  // require updating a lot of tests. So for now, we just
16
16
  // grab the kits afterward and store them.
17
17
 
18
- /** @param {import('./econ-behaviors.js').EconomyBootstrapPowers} powers */
18
+ /**
19
+ * @param {import('./econ-behaviors.js').EconomyBootstrapPowers} powers
20
+ */
19
21
  export const storeInterContractStartKits = async ({
20
22
  consume: {
21
23
  contractKits,
@@ -29,15 +31,13 @@ export const storeInterContractStartKits = async ({
29
31
  },
30
32
  }) => {
31
33
  /**
32
- * @param {Promise<MapStore<string, { instance: Instance }>>} storeP
33
- * @param {Promise<{ instance: Instance }>[]} kitPs
34
+ * @param {Promise<MapStore<string, {instance: Instance}>>} storeP
35
+ * @param {Promise<{instance: Instance}>[]} kitPs
34
36
  */
35
37
  const storeAll = async (storeP, kitPs) => {
36
38
  const store = await storeP;
37
39
  const kits = await Promise.all(kitPs);
38
- for (const kit of kits) {
39
- store.init(kit.instance, kit);
40
- }
40
+ kits.forEach(kit => store.init(kit.instance, kit));
41
41
  };
42
42
 
43
43
  await storeAll(contractKits, [
@@ -6,9 +6,11 @@ import { AmountMath } from '@agoric/ertp';
6
6
  import '@agoric/governance/exported.js';
7
7
  import { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
8
8
  import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
9
+ import '@agoric/vats/exported.js';
10
+ import '@agoric/vats/src/core/types.js';
11
+ import { Stable } from '@agoric/vats/src/tokens.js';
9
12
  import { E } from '@endo/far';
10
13
  import { makeScalarBigMapStore } from '@agoric/vat-data';
11
- import { Stable } from '@agoric/internal/src/tokens.js';
12
14
  import { makeGovernedTerms as makeGovernedATerms } from '../auction/params.js';
13
15
  import { makeReserveTerms } from '../reserve/params.js';
14
16
  import { makeGovernedTerms as makeGovernedVFTerms } from '../vaultFactory/params.js';
@@ -22,9 +24,7 @@ export const SECONDS_PER_WEEK = 7n * SECONDS_PER_DAY;
22
24
 
23
25
  /**
24
26
  * @typedef {import('../vaultFactory/vaultFactory.js').VaultFactoryContract['publicFacet']} VaultFactoryPublicFacet
25
- *
26
27
  * @typedef {import('../auction/auctioneer.js').AuctioneerPublicFacet} AuctioneerPublicFacet
27
- *
28
28
  * @typedef {import('../auction/auctioneer.js').AuctioneerCreatorFacet} AuctioneerCreatorFacet
29
29
  */
30
30
 
@@ -33,65 +33,43 @@ export const SECONDS_PER_WEEK = 7n * SECONDS_PER_DAY;
33
33
  * @property {string} label
34
34
  * @property {Instance} psm
35
35
  * @property {Instance} psmGovernor
36
- * @property {Awaited<
37
- * ReturnType<
38
- * Awaited<
39
- * ReturnType<import('../psm/psm.js')['start']>
40
- * >['creatorFacet']['getLimitedCreatorFacet']
41
- * >
42
- * >} psmCreatorFacet
43
- * @property {GovernorCreatorFacet<import('../../src/psm/psm.js')['start']>} psmGovernorCreatorFacet
36
+ * @property {Awaited<ReturnType<Awaited<ReturnType<import('../psm/psm.js')['prepare']>>['creatorFacet']['getLimitedCreatorFacet']>>} psmCreatorFacet
37
+ * @property {GovernorCreatorFacet<import('../../src/psm/psm.js')['prepare']>} psmGovernorCreatorFacet
44
38
  * @property {AdminFacet} psmAdminFacet
45
39
  */
46
40
 
47
- /** @typedef {GovernanceFacetKit<import('../auction/auctioneer.js').start>} AuctioneerKit */
41
+ /**
42
+ * @typedef {GovernanceFacetKit<import('../auction/auctioneer.js').start>} AuctioneerKit
43
+ */
48
44
 
49
45
  /**
50
- * @typedef {WellKnownSpaces & ChainBootstrapSpace & EconomyBootstrapSpace} EconomyBootstrapPowers
51
- *
46
+ * @typedef { WellKnownSpaces & ChainBootstrapSpace & EconomyBootstrapSpace
47
+ * } EconomyBootstrapPowers
52
48
  * @typedef {PromiseSpaceOf<{
53
- * economicCommitteeKit: CommitteeStartResult;
54
- * economicCommitteeCreatorFacet: import('@agoric/governance/src/committee.js').CommitteeElectorateCreatorFacet;
55
- * feeDistributorKit: StartedInstanceKit<
56
- * typeof import('../feeDistributor.js').start
57
- * >;
58
- * periodicFeeCollectors: MapStore<
59
- * number,
60
- * import('../feeDistributor.js').PeriodicFeeCollector
61
- * >;
62
- * psmKit: MapStore<Brand, PSMKit>;
63
- * anchorBalancePayments: MapStore<Brand, Payment<'nat'>>;
64
- * econCharterKit: EconCharterStartResult;
65
- * reserveKit: GovernanceFacetKit<
66
- * import('../reserve/assetReserve.js')['start']
67
- * >;
68
- * vaultFactoryKit: GovernanceFacetKit<
69
- * import('../vaultFactory/vaultFactory.js')['start']
70
- * >;
71
- * auctioneerKit: AuctioneerKit;
72
- * minInitialDebt: NatValue;
49
+ * economicCommitteeKit: CommitteeStartResult,
50
+ * economicCommitteeCreatorFacet: import('@agoric/governance/src/committee.js').CommitteeElectorateCreatorFacet,
51
+ * feeDistributorKit: StartedInstanceKit<typeof import('../feeDistributor.js').start>,
52
+ * periodicFeeCollectors: MapStore<number, import('../feeDistributor.js').PeriodicFeeCollector>,
53
+ * psmKit: MapStore<Brand, PSMKit>,
54
+ * anchorBalancePayments: MapStore<Brand, Payment<'nat'>>,
55
+ * econCharterKit: EconCharterStartResult,
56
+ * reserveKit: GovernanceFacetKit<import('../reserve/assetReserve.js')['prepare']>,
57
+ * vaultFactoryKit: GovernanceFacetKit<import('../vaultFactory/vaultFactory.js')['prepare']>,
58
+ * auctioneerKit: AuctioneerKit,
59
+ * minInitialDebt: NatValue,
73
60
  * }>} EconomyBootstrapSpace
74
61
  */
75
62
 
76
- /**
77
- * @typedef {import('@agoric/zoe/src/zoeService/utils.js').StartedInstanceKit<
78
- * import('../econCommitteeCharter')['start']
79
- * >} EconCharterStartResult
80
- */
81
- /**
82
- * @typedef {import('@agoric/zoe/src/zoeService/utils.js').StartedInstanceKit<
83
- * import('@agoric/governance/src/committee.js')['start']
84
- * >} CommitteeStartResult
85
- */
63
+ /** @typedef {import('@agoric/zoe/src/zoeService/utils.js').StartedInstanceKit<import('../econCommitteeCharter')['prepare']>} EconCharterStartResult */
64
+ /** @typedef {import('@agoric/zoe/src/zoeService/utils.js').StartedInstanceKit<import('@agoric/governance/src/committee.js')['prepare']>} CommitteeStartResult */
86
65
 
87
66
  /**
88
67
  * @file A collection of productions, each of which declares inputs and outputs.
89
- * Each function is passed a set of powers for reading from and writing to the
90
- * vat config.
68
+ * Each function is passed a set of powers for reading from and writing to the vat config.
91
69
  *
92
- * Each of the things they produce they're responsible for resolving or setting.
70
+ * Each of the things they produce they're responsible for resolving or setting.
93
71
  *
94
- * In production called by @agoric/vats to bootstrap.
72
+ * In production called by @agoric/vats to bootstrap.
95
73
  */
96
74
 
97
75
  /** @param {EconomyBootstrapPowers} powers */
@@ -323,11 +301,7 @@ export const startVaultFactory = async (
323
301
  }),
324
302
  );
325
303
 
326
- /**
327
- * @type {GovernorStartedInstallationKit<
328
- * typeof vaultFactoryInstallation
329
- * >}
330
- */
304
+ /** @type {GovernorStartedInstallationKit<typeof vaultFactoryInstallation>} */
331
305
  const g = await E(consume.zoe).startInstance(
332
306
  contractGovernorInstallation,
333
307
  undefined,
@@ -376,8 +350,8 @@ export const startVaultFactory = async (
376
350
  };
377
351
 
378
352
  /**
379
- * Grant access to the VaultFactory creatorFacet to up to one user based on
380
- * address.
353
+ * Grant access to the VaultFactory creatorFacet
354
+ * to up to one user based on address.
381
355
  *
382
356
  * @param {EconomyBootstrapPowers} powers
383
357
  * @param {object} [root0]
@@ -463,8 +437,9 @@ export const startRewardDistributor = async ({
463
437
 
464
438
  /**
465
439
  * @type {Awaited<
466
- * ReturnType<typeof import('../feeDistributor.js').makeFeeDistributor>
467
- * > & { adminFacet: AdminFacet; instance: Instance }}
440
+ * ReturnType<typeof import('../feeDistributor.js').makeFeeDistributor>>
441
+ * & { adminFacet: AdminFacet, instance: Instance }
442
+ * }
468
443
  */
469
444
  const instanceKit = await E(zoe).startInstance(
470
445
  feeDistributor,
@@ -1,10 +1,10 @@
1
1
  // @ts-nocheck -- lots of type errors. low prio b/c proposals are like scripts
2
- import { makeTracer } from '@agoric/internal';
2
+ import { E } from '@endo/far';
3
3
  import {
4
- assertPathSegment,
5
4
  makeStorageNodeChild,
5
+ assertPathSegment,
6
6
  } from '@agoric/internal/src/lib-chainStorage.js';
7
- import { E } from '@endo/far';
7
+ import { makeTracer } from '@agoric/internal';
8
8
 
9
9
  import { unitAmount } from '@agoric/zoe/src/contractSupport/priceQuote.js';
10
10
  import { reserveThenDeposit, reserveThenGetNames } from './utils.js';
@@ -18,17 +18,14 @@ const sanitizePathSegment = name => {
18
18
  return candidate;
19
19
  };
20
20
 
21
- export const instanceNameFor = (inBrandName, outBrandName) =>
22
- `${inBrandName}-${outBrandName} price feed`;
23
-
24
21
  /**
25
22
  * @typedef {{
26
- * brandIn?: ERef<Brand<'nat'> | undefined>;
27
- * brandOut?: ERef<Brand<'nat'> | undefined>;
28
- * IN_BRAND_NAME: string;
29
- * IN_BRAND_DECIMALS: string;
30
- * OUT_BRAND_NAME: string;
31
- * OUT_BRAND_DECIMALS: string;
23
+ * brandIn?: ERef<Brand<'nat'> | undefined>,
24
+ * brandOut?: ERef<Brand<'nat'> | undefined>,
25
+ * IN_BRAND_NAME: string,
26
+ * IN_BRAND_DECIMALS: string,
27
+ * OUT_BRAND_NAME: string,
28
+ * OUT_BRAND_DECIMALS: string,
32
29
  * }} PriceFeedOptions
33
30
  */
34
31
 
@@ -36,7 +33,7 @@ export const instanceNameFor = (inBrandName, outBrandName) =>
36
33
  * Create inert brands (no mint or issuer) referred to by price oracles.
37
34
  *
38
35
  * @param {ChainBootstrapSpace & NamedVatPowers} space
39
- * @param {{ options: { priceFeedOptions: PriceFeedOptions } }} opt
36
+ * @param {{options: {priceFeedOptions: PriceFeedOptions}}} opt
40
37
  * @returns {Promise<[Brand<'nat'>, Brand<'nat'>]>}
41
38
  */
42
39
  export const ensureOracleBrands = async (
@@ -65,6 +62,7 @@ export const ensureOracleBrands = async (
65
62
  let b = await brand;
66
63
  if (!b) {
67
64
  // not 1st await
65
+ // eslint-disable-next-line @jessie.js/no-nested-await
68
66
  b = await E(agoricNames).provideInertBrand(
69
67
  name,
70
68
  harden({ decimalPlaces: parseInt(decimals, 10) }),
@@ -81,17 +79,7 @@ export const ensureOracleBrands = async (
81
79
 
82
80
  /**
83
81
  * @param {ChainBootstrapSpace} powers
84
- * @param {{
85
- * options: {
86
- * priceFeedOptions: {
87
- * AGORIC_INSTANCE_NAME: string;
88
- * oracleAddresses: string[];
89
- * contractTerms: import('@agoric/inter-protocol/src/price/fluxAggregatorKit.js').ChainlinkConfig;
90
- * IN_BRAND_NAME: string;
91
- * OUT_BRAND_NAME: string;
92
- * };
93
- * };
94
- * }} config
82
+ * @param {{options: {priceFeedOptions: {AGORIC_INSTANCE_NAME: string, oracleAddresses: string[], contractTerms: import('@agoric/inter-protocol/src/price/fluxAggregatorKit.js').ChainlinkConfig, IN_BRAND_NAME: string, OUT_BRAND_NAME: string}}}} config
95
83
  */
96
84
  export const createPriceFeed = async (
97
85
  {
@@ -108,7 +96,6 @@ export const createPriceFeed = async (
108
96
  priceAuthorityAdmin,
109
97
  startGovernedUpgradable,
110
98
  },
111
- instance: { produce: produceInstance },
112
99
  },
113
100
  {
114
101
  options: {
@@ -130,17 +117,9 @@ export const createPriceFeed = async (
130
117
  const timer = await chainTimerService;
131
118
 
132
119
  /**
133
- * Values come from economy-template.json, which at this writing had IN:ATOM,
134
- * OUT:USD
120
+ * Values come from economy-template.json, which at this writing had IN:ATOM, OUT:USD
135
121
  *
136
- * @type {[
137
- * [Brand<'nat'>, Brand<'nat'>],
138
- * [
139
- * Installation<
140
- * import('@agoric/inter-protocol/src/price/fluxAggregatorContract.js')['start]
141
- * >,
142
- * ],
143
- * ]}
122
+ * @type {[[Brand<'nat'>, Brand<'nat'>], [Installation<import('@agoric/inter-protocol/src/price/fluxAggregatorContract.js').prepare>]]}
144
123
  */
145
124
  const [[brandIn, brandOut], [priceAggregator]] = await Promise.all([
146
125
  reserveThenGetNames(E(agoricNamesAdmin).lookupAdmin('oracleBrand'), [
@@ -182,27 +161,11 @@ export const createPriceFeed = async (
182
161
  installation: priceAggregator,
183
162
  });
184
163
 
185
- // Publish price feed in home.priceAuthority.
186
- const forceReplace = true;
187
- // Make sure this PA is registered before sharing the instance in agoricNames,
188
- // which allows contracts that depend on the registry value to wait for it and
189
- // prevent a race.
190
- await E(priceAuthorityAdmin).registerPriceAuthority(
191
- E(faKit.publicFacet).getPriceAuthority(),
192
- brandIn,
193
- brandOut,
194
- forceReplace,
195
- );
196
-
197
- await E(E(agoricNamesAdmin).lookupAdmin('instance'))
164
+ E(E(agoricNamesAdmin).lookupAdmin('instance'))
198
165
  .update(AGORIC_INSTANCE_NAME, faKit.instance)
199
166
  .catch(err =>
200
167
  console.error(`🚨 failed to update ${AGORIC_INSTANCE_NAME}`, err),
201
168
  );
202
- // being after the above awaits means that when this resolves, the consumer
203
- // gets notified that the authority is in the registry and its instance is in
204
- // agoricNames.
205
- produceInstance[AGORIC_INSTANCE_NAME].resolve(faKit.instance);
206
169
 
207
170
  E(E.get(econCharterKit).creatorFacet).addInstance(
208
171
  faKit.instance,
@@ -211,6 +174,15 @@ export const createPriceFeed = async (
211
174
  );
212
175
  trace('registered', AGORIC_INSTANCE_NAME, faKit.instance);
213
176
 
177
+ // Publish price feed in home.priceAuthority.
178
+ const forceReplace = true;
179
+ void E(priceAuthorityAdmin).registerPriceAuthority(
180
+ E(faKit.publicFacet).getPriceAuthority(),
181
+ brandIn,
182
+ brandOut,
183
+ forceReplace,
184
+ );
185
+
214
186
  /**
215
187
  * Initialize a new oracle and send an invitation to administer it.
216
188
  *
@@ -233,8 +205,7 @@ export const createPriceFeed = async (
233
205
 
234
206
  const t = 'priceFeed';
235
207
  /**
236
- * Add a price feed to a running chain, returning the manifest, installations,
237
- * and options.
208
+ * Add a price feed to a running chain, returning the manifest, installations, and options.
238
209
  *
239
210
  * @param {object} utils
240
211
  * @param {(ref: unknown) => Promise<unknown>} [utils.restoreRef]
@@ -261,9 +232,6 @@ export const getManifestForPriceFeed = async (
261
232
  priceAuthorityAdmin: t,
262
233
  startGovernedUpgradable: t,
263
234
  },
264
- instance: {
265
- produce: t,
266
- },
267
235
  },
268
236
  [ensureOracleBrands.name]: {
269
237
  namedVat: {
@@ -275,7 +243,6 @@ export const getManifestForPriceFeed = async (
275
243
  },
276
244
  },
277
245
  installations: {
278
- // ??? will every eval of price-feed-proposal install priceAggregator ?
279
246
  priceAggregator: restoreRef(priceFeedOptions.priceAggregatorRef),
280
247
  },
281
248
  options: {
@@ -336,7 +303,7 @@ export const startPriceFeeds = async (
336
303
  {
337
304
  options: {
338
305
  priceFeedOptions: {
339
- AGORIC_INSTANCE_NAME: instanceNameFor(inBrandName, outBrandName),
306
+ AGORIC_INSTANCE_NAME: `${inBrandName}-${outBrandName} price feed`,
340
307
  contractTerms: {
341
308
  minSubmissionCount: 2,
342
309
  minSubmissionValue: 1,
@@ -22,7 +22,7 @@ const sanitizePathSegment = name => {
22
22
 
23
23
  /**
24
24
  * @param {import('./econ-behaviors').EconomyBootstrapPowers} powers
25
- * @param {object} config
25
+ * @param {object} [config]
26
26
  * @param {object} [config.options]
27
27
  * @param {EconCommitteeOptions} [config.options.econCommitteeOptions]
28
28
  */
@@ -6,14 +6,14 @@ import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance';
6
6
  import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
7
7
  import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js';
8
8
  import { E } from '@endo/far';
9
+ import { Stable } from '@agoric/vats/src/tokens.js';
9
10
  import {
10
11
  makeHistoryReviver,
11
12
  makeBoardRemote,
12
13
  slotToBoardRemote,
13
- } from '@agoric/internal/src/marshal.js';
14
+ } from '@agoric/vats/tools/board-utils.js';
14
15
  import { deeplyFulfilledObject } from '@agoric/internal';
15
16
  import { makeScalarBigMapStore } from '@agoric/vat-data';
16
- import { Stable } from '@agoric/internal/src/tokens.js';
17
17
 
18
18
  import { reserveThenGetNamePaths } from './utils.js';
19
19
 
@@ -35,13 +35,10 @@ export { inviteCommitteeMembers, startEconCharter, inviteToEconCharter };
35
35
  const stablePsmKey = `published.psm.${Stable.symbol}`;
36
36
 
37
37
  /**
38
- * @param {[key: string, value: string][]} chainStorageEntries
38
+ * @param {Array<[key: string, value: string]>} chainStorageEntries
39
39
  * @param {string} keyword
40
- * @param {{ minted: Brand<'nat'>; anchor: Brand<'nat'> }} brands
41
- * @returns {{
42
- * metrics?: MetricsNotification;
43
- * governance?: GovernanceSubscriptionState;
44
- * }}
40
+ * @param {{ minted: Brand<'nat'>, anchor: Brand<'nat'> }} brands
41
+ * @returns {{ metrics?: MetricsNotification, governance?: GovernanceSubscriptionState }}
45
42
  */
46
43
  const findOldPSMState = (chainStorageEntries, keyword, brands) => {
47
44
  // In this reviver, object references are revived as boardIDs
@@ -83,7 +80,7 @@ const findOldPSMState = (chainStorageEntries, keyword, brands) => {
83
80
  * @param {bigint} [config.WantMintedFeeBP]
84
81
  * @param {bigint} [config.GiveMintedFeeBP]
85
82
  * @param {bigint} [config.MINT_LIMIT]
86
- * @param {{ anchorOptions?: AnchorOptions }} [config.options]
83
+ * @param {{ anchorOptions?: AnchorOptions } } [config.options]
87
84
  */
88
85
  export const startPSM = async (
89
86
  {
@@ -294,16 +291,16 @@ harden(startPSM);
294
291
  */
295
292
 
296
293
  /**
297
- * Make anchor issuer out of a Cosmos asset; presumably USDC over IBC. Add it to
298
- * BankManager.
294
+ * Make anchor issuer out of a Cosmos asset; presumably
295
+ * USDC over IBC. Add it to BankManager.
299
296
  *
300
- * Also, if vatParameters shows an anchorPoolBalance for this asset, mint a
301
- * payment for that balance.
297
+ * Also, if vatParameters shows an anchorPoolBalance for this asset,
298
+ * mint a payment for that balance.
302
299
  *
303
300
  * TODO: address redundancy with publishInterchainAssetFromBank
304
301
  *
305
302
  * @param {EconomyBootstrapPowers & WellKnownSpaces & ChainStorageVatParams} powers
306
- * @param {{ options: { anchorOptions?: AnchorOptions } }} config
303
+ * @param {{options?: { anchorOptions?: AnchorOptions } }} [config]
307
304
  */
308
305
  export const makeAnchorAsset = async (
309
306
  {
@@ -348,18 +345,13 @@ export const makeAnchorAsset = async (
348
345
  }),
349
346
  );
350
347
 
351
- const { creatorFacet: mint, publicFacet: issuer } = /**
352
- * @type {{
353
- * creatorFacet: ERef<Mint<'nat'>>;
354
- * publicFacet: ERef<Issuer<'nat'>>;
355
- * }}
356
- */ (
357
- await E(startUpgradable)({
358
- installation: mintHolder,
359
- label: keyword,
360
- terms,
361
- })
362
- );
348
+ /** @type {{ creatorFacet: ERef<Mint<'nat'>>, publicFacet: ERef<Issuer<'nat'>> }} */
349
+ // @ts-expect-error cast
350
+ const { creatorFacet: mint, publicFacet: issuer } = await E(startUpgradable)({
351
+ installation: mintHolder,
352
+ label: keyword,
353
+ terms,
354
+ });
363
355
 
364
356
  const brand = await E(issuer).getBrand();
365
357
  const kit = harden({ mint, issuer, brand });
@@ -371,25 +363,23 @@ export const makeAnchorAsset = async (
371
363
  slotToBoardRemote,
372
364
  );
373
365
  const metricsKey = `${stablePsmKey}.${keyword}.metrics`;
374
- const maybeReviveMetrics = async () => {
375
- if (!toSlotReviver.has(metricsKey)) {
376
- return;
377
- }
366
+ if (toSlotReviver.has(metricsKey)) {
378
367
  const metrics = toSlotReviver.getItem(metricsKey);
379
368
  produceAnchorBalancePayments.resolve(
380
369
  makeScalarBigMapStore('Anchor balance payments', { durable: true }),
381
370
  );
382
371
  // XXX this rule should only apply to the 1st await
372
+ // eslint-disable-next-line @jessie.js/no-nested-await
383
373
  const anchorPaymentMap = await anchorBalancePayments;
384
374
 
385
375
  // TODO: validate that `metrics.anchorPoolBalance.value` is
386
376
  // pass-by-copy PureData (e.g., contains no remotables).
377
+ // eslint-disable-next-line @jessie.js/no-nested-await
387
378
  const pmt = await E(mint).mintPayment(
388
379
  AmountMath.make(brand, metrics.anchorPoolBalance.value),
389
380
  );
390
381
  anchorPaymentMap.init(brand, pmt);
391
- };
392
- await maybeReviveMetrics();
382
+ }
393
383
 
394
384
  await Promise.all([
395
385
  E(E(agoricNamesAdmin).lookupAdmin('issuer')).update(keyword, kit.issuer),
@@ -10,6 +10,7 @@ const { Fail } = assert;
10
10
  */
11
11
  export const reserveThenGetNamePaths = async (nameAdmin, paths) => {
12
12
  /**
13
+ *
13
14
  * @param {ERef<import('@agoric/vats').NameAdmin>} nextAdmin
14
15
  * @param {string[]} path
15
16
  */
@@ -53,7 +54,7 @@ export const reserveThenGetNames = async (nameAdmin, names) =>
53
54
  * @param {string} debugName
54
55
  * @param {ERef<import('@agoric/vats').NameAdmin>} namesByAddressAdmin
55
56
  * @param {string} addr
56
- * @param {ERef<Payment>[]} payments
57
+ * @param {Array<ERef<Payment>>} payments
57
58
  */
58
59
  export const reserveThenDeposit = async (
59
60
  debugName,
@@ -78,15 +79,7 @@ export const reserveThenDeposit = async (
78
79
  );
79
80
  };
80
81
 
81
- /**
82
- * @type {<T>(
83
- * store: ERef<
84
- * Map<string, T> | import('@agoric/internal/src/scratch.js').ScratchPad
85
- * >,
86
- * key: string,
87
- * make: () => T,
88
- * ) => Promise<T>}
89
- */
82
+ /** @type {<T>(store: ERef<Map<string, T> | import('@agoric/internal/src/scratch.js').ScratchPad>, key: string, make: () => T) => Promise<T>} */
90
83
  const provideWhen = async (store, key, make) => {
91
84
  const found = await E(store).get(key);
92
85
  if (found) {
@@ -98,33 +91,21 @@ const provideWhen = async (store, key, make) => {
98
91
  };
99
92
 
100
93
  /**
101
- * @param {{
102
- * scratch: ERef<import('@agoric/internal/src/scratch.js').ScratchPad>;
103
- * }} homeP
94
+ * @param {{ scratch: ERef<import('@agoric/internal/src/scratch.js').ScratchPad> }} homeP
104
95
  * @param {object} opts
105
- * @param {(specifier: string) => Promise<{ default: Bundle }>} opts.loadBundle
96
+ * @param {(specifier: string) => Promise<{default: Bundle}>} opts.loadBundle
106
97
  * @param {string} [opts.installCacheKey]
107
98
  */
108
99
  export const makeInstallCache = async (
109
100
  homeP,
110
101
  { installCacheKey = 'installCache', loadBundle },
111
102
  ) => {
112
- /**
113
- * @type {CopyMap<
114
- * string,
115
- * { installation: Installation; boardId: string; path?: string }
116
- * >}
117
- */
103
+ /** @type {CopyMap<string, {installation: Installation, boardId: string, path?: string}>} */
118
104
  const initial = await provideWhen(E.get(homeP).scratch, installCacheKey, () =>
119
105
  makeCopyMap([]),
120
106
  );
121
107
  // ISSUE: getCopyMapEntries of CopyMap<K, V> loses K, V.
122
- /**
123
- * @type {Map<
124
- * string,
125
- * { installation: Installation; boardId: string; path?: string }
126
- * >}
127
- */
108
+ /** @type {Map<string, {installation: Installation, boardId: string, path?: string}>} */
128
109
  const working = new Map(getCopyMapEntries(initial));
129
110
 
130
111
  const saveCache = async () => {