@agoric/inter-protocol 0.16.2-dev-857e650.0 → 0.16.2-dev-fb922d3.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 (128) hide show
  1. package/bundles/bundle-auctioneer-js-meta.json +181 -181
  2. package/bundles/bundle-auctioneer.js +1 -1
  3. package/bundles/bundle-econCommitteeCharter-js-meta.json +129 -129
  4. package/bundles/bundle-econCommitteeCharter.js +1 -1
  5. package/bundles/bundle-feeDistributor-js-meta.json +115 -115
  6. package/bundles/bundle-feeDistributor.js +1 -1
  7. package/bundles/bundle-fluxAggregatorKit-js-meta.json +169 -169
  8. package/bundles/bundle-fluxAggregatorKit.js +1 -1
  9. package/bundles/bundle-psm-js-meta.json +167 -167
  10. package/bundles/bundle-psm.js +1 -1
  11. package/bundles/bundle-reserve-js-meta.json +169 -169
  12. package/bundles/bundle-reserve.js +1 -1
  13. package/bundles/bundle-scaledPriceAuthority-js-meta.json +142 -142
  14. package/bundles/bundle-scaledPriceAuthority.js +1 -1
  15. package/bundles/bundle-vaultFactory-js-meta.json +200 -200
  16. package/bundles/bundle-vaultFactory.js +1 -1
  17. package/package.json +17 -17
  18. package/scripts/deploy-contracts.js +12 -2
  19. package/scripts/init-core.js +5 -6
  20. package/scripts/manual-price-feed.js +20 -15
  21. package/src/auction/auctionBook.d.ts +16 -13
  22. package/src/auction/auctionBook.d.ts.map +1 -1
  23. package/src/auction/auctionBook.js +68 -56
  24. package/src/auction/auctioneer.d.ts.map +1 -1
  25. package/src/auction/auctioneer.js +54 -42
  26. package/src/auction/offerBook.d.ts.map +1 -1
  27. package/src/auction/offerBook.js +12 -11
  28. package/src/auction/params.d.ts +1 -1
  29. package/src/auction/params.d.ts.map +1 -1
  30. package/src/auction/params.js +3 -5
  31. package/src/auction/scheduleMath.d.ts.map +1 -1
  32. package/src/auction/scheduleMath.js +13 -13
  33. package/src/auction/scheduler.d.ts +4 -4
  34. package/src/auction/scheduler.d.ts.map +1 -1
  35. package/src/auction/scheduler.js +20 -20
  36. package/src/auction/sortedOffers.d.ts.map +1 -1
  37. package/src/auction/sortedOffers.js +8 -7
  38. package/src/auction/util.d.ts +1 -1
  39. package/src/auction/util.js +4 -4
  40. package/src/clientSupport.d.ts +65 -27
  41. package/src/clientSupport.d.ts.map +1 -1
  42. package/src/clientSupport.js +92 -34
  43. package/src/contractSupport.js +5 -5
  44. package/src/econCommitteeCharter.d.ts +4 -6
  45. package/src/econCommitteeCharter.d.ts.map +1 -1
  46. package/src/econCommitteeCharter.js +7 -11
  47. package/src/feeDistributor.d.ts +8 -24
  48. package/src/feeDistributor.d.ts.map +1 -1
  49. package/src/feeDistributor.js +26 -28
  50. package/src/interest.d.ts +1 -0
  51. package/src/interest.d.ts.map +1 -1
  52. package/src/interest.js +22 -15
  53. package/src/price/fluxAggregatorContract.d.ts +1 -0
  54. package/src/price/fluxAggregatorContract.d.ts.map +1 -1
  55. package/src/price/fluxAggregatorContract.js +24 -19
  56. package/src/price/fluxAggregatorKit.d.ts +23 -18
  57. package/src/price/fluxAggregatorKit.d.ts.map +1 -1
  58. package/src/price/fluxAggregatorKit.js +47 -32
  59. package/src/price/priceOracleKit.d.ts +2 -8
  60. package/src/price/priceOracleKit.d.ts.map +1 -1
  61. package/src/price/priceOracleKit.js +11 -13
  62. package/src/price/roundsManager.d.ts +28 -46
  63. package/src/price/roundsManager.d.ts.map +1 -1
  64. package/src/price/roundsManager.js +51 -63
  65. package/src/proposals/committee-proposal.d.ts.map +1 -1
  66. package/src/proposals/committee-proposal.js +5 -9
  67. package/src/proposals/core-proposal.d.ts.map +1 -1
  68. package/src/proposals/core-proposal.js +3 -5
  69. package/src/proposals/econ-behaviors.d.ts.map +1 -1
  70. package/src/proposals/econ-behaviors.js +55 -28
  71. package/src/proposals/price-feed-proposal.d.ts.map +1 -1
  72. package/src/proposals/price-feed-proposal.js +30 -11
  73. package/src/proposals/startPSM.d.ts.map +1 -1
  74. package/src/proposals/startPSM.js +24 -17
  75. package/src/proposals/utils.d.ts +1 -1
  76. package/src/proposals/utils.d.ts.map +1 -1
  77. package/src/proposals/utils.js +26 -7
  78. package/src/psm/psm.d.ts +14 -22
  79. package/src/psm/psm.d.ts.map +1 -1
  80. package/src/psm/psm.js +34 -31
  81. package/src/reserve/assetReserve.d.ts.map +1 -1
  82. package/src/reserve/assetReserve.js +16 -13
  83. package/src/reserve/assetReserveKit.d.ts +14 -26
  84. package/src/reserve/assetReserveKit.d.ts.map +1 -1
  85. package/src/reserve/assetReserveKit.js +13 -21
  86. package/src/tokens.d.ts +3 -3
  87. package/src/tokens.d.ts.map +1 -1
  88. package/src/tokens.js +5 -5
  89. package/src/typeGuards.d.ts +1 -3
  90. package/src/typeGuards.d.ts.map +1 -1
  91. package/src/typeGuards.js +1 -3
  92. package/src/vaultFactory/liquidation.d.ts.map +1 -1
  93. package/src/vaultFactory/liquidation.js +29 -16
  94. package/src/vaultFactory/math.d.ts.map +1 -1
  95. package/src/vaultFactory/math.js +8 -9
  96. package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -1
  97. package/src/vaultFactory/orderedVaultStore.js +6 -9
  98. package/src/vaultFactory/params.d.ts +1 -4
  99. package/src/vaultFactory/params.d.ts.map +1 -1
  100. package/src/vaultFactory/params.js +24 -18
  101. package/src/vaultFactory/prioritizedVaults.js +2 -2
  102. package/src/vaultFactory/proceeds.d.ts +3 -3
  103. package/src/vaultFactory/proceeds.d.ts.map +1 -1
  104. package/src/vaultFactory/proceeds.js +24 -18
  105. package/src/vaultFactory/storeUtils.d.ts +2 -6
  106. package/src/vaultFactory/storeUtils.d.ts.map +1 -1
  107. package/src/vaultFactory/storeUtils.js +8 -12
  108. package/src/vaultFactory/types.d.ts +16 -11
  109. package/src/vaultFactory/types.d.ts.map +1 -1
  110. package/src/vaultFactory/types.js +37 -27
  111. package/src/vaultFactory/vault.d.ts +103 -159
  112. package/src/vaultFactory/vault.d.ts.map +1 -1
  113. package/src/vaultFactory/vault.js +84 -85
  114. package/src/vaultFactory/vaultDirector.d.ts +21 -43
  115. package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
  116. package/src/vaultFactory/vaultDirector.js +30 -40
  117. package/src/vaultFactory/vaultFactory.d.ts +8 -6
  118. package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
  119. package/src/vaultFactory/vaultFactory.js +13 -11
  120. package/src/vaultFactory/vaultHolder.d.ts +12 -16
  121. package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
  122. package/src/vaultFactory/vaultHolder.js +7 -12
  123. package/src/vaultFactory/vaultKit.d.ts +1 -1
  124. package/src/vaultFactory/vaultKit.d.ts.map +1 -1
  125. package/src/vaultFactory/vaultKit.js +3 -2
  126. package/src/vaultFactory/vaultManager.d.ts +454 -68
  127. package/src/vaultFactory/vaultManager.d.ts.map +1 -1
  128. package/src/vaultFactory/vaultManager.js +120 -110
@@ -24,20 +24,15 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
24
24
  };
25
25
  };
26
26
  helper: {
27
- /**
28
- * Start non-durable processes (or restart if needed after vat restart)
29
- */
27
+ /** Start non-durable processes (or restart if needed after vat restart) */
30
28
  start(): void;
31
- /**
32
- * @param {Timestamp} updateTime
33
- */
29
+ /** @param {Timestamp} updateTime */
34
30
  chargeAllVaults(updateTime: Timestamp): Promise<void>;
35
31
  assetNotify(): Promise<void>;
36
32
  burnToCoverDebt(debt: any, proceeds: any, seat: any): void;
37
33
  sendToReserve(penalty: any, seat: any, seatKeyword?: string): void;
38
34
  markLiquidating(debt: any, collateral: any): void;
39
35
  /**
40
- *
41
36
  * @param {Amount<'nat'>} debt
42
37
  * @param {Amount<'nat'>} collateral
43
38
  * @param {Amount<'nat'>} overage
@@ -46,14 +41,18 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
46
41
  markDoneLiquidating(debt: Amount<'nat'>, collateral: Amount<'nat'>, overage: Amount<'nat'>, shortfall: Amount<'nat'>): void;
47
42
  writeMetrics(): Promise<void>;
48
43
  /**
49
- * This is designed to tolerate an incomplete plan, in case calculateDistributionPlan encounters
50
- * an error during its calculation. We don't have a way to induce such errors in CI so we've
51
- * done so manually in dev and verified this function recovers as expected.
44
+ * This is designed to tolerate an incomplete plan, in case
45
+ * calculateDistributionPlan encounters an error during its calculation.
46
+ * We don't have a way to induce such errors in CI so we've done so
47
+ * manually in dev and verified this function recovers as expected.
52
48
  *
53
49
  * @param {AmountKeywordRecord} proceeds
54
50
  * @param {Amount<'nat'>} totalDebt
55
51
  * @param {Pick<PriceQuote, 'quoteAmount'>} oraclePriceAtStart
56
- * @param {MapStore<Vault, { collateralAmount: Amount<'nat'>, debtAmount: Amount<'nat'>}>} vaultData
52
+ * @param {MapStore<
53
+ * Vault,
54
+ * { collateralAmount: Amount<'nat'>; debtAmount: Amount<'nat'> }
55
+ * >} vaultData
57
56
  * @param {Amount<'nat'>} totalCollateral
58
57
  */
59
58
  planProceedsDistribution(proceeds: AmountKeywordRecord, totalDebt: Amount<'nat'>, oraclePriceAtStart: Pick<PriceQuote, 'quoteAmount'>, vaultData: MapStore<Vault, {
@@ -72,6 +71,102 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
72
71
  };
73
72
  };
74
73
  invitationMakers: {
74
+ /** @typedef {import('@agoric/time/src/types').RelativeTime} RelativeTime */
75
+ /**
76
+ * @typedef {object} MetricsNotification
77
+ * @property {Ratio | null} lockedQuote priceQuote that will be used for
78
+ * liquidation. Non-null from priceLock time until liquidation has taken
79
+ * place.
80
+ * @property {number} numActiveVaults present count of vaults
81
+ * @property {number} numLiquidatingVaults present count of liquidating vaults
82
+ * @property {Amount<'nat'>} totalCollateral present sum of collateral across
83
+ * all vaults
84
+ * @property {Amount<'nat'>} totalDebt present sum of debt across all vaults
85
+ * @property {Amount<'nat'>} retainedCollateral collateral held as a result of
86
+ * not returning excess refunds to owners of vaults liquidated with
87
+ * shortfalls
88
+ * @property {Amount<'nat'>} liquidatingCollateral present sum of collateral in
89
+ * vaults sent for liquidation
90
+ * @property {Amount<'nat'>} liquidatingDebt present sum of debt in vaults sent
91
+ * for liquidation
92
+ * @property {Amount<'nat'>} totalCollateralSold running sum of collateral sold
93
+ * in liquidation
94
+ * @property {Amount<'nat'>} totalOverageReceived running sum of overages,
95
+ * central received greater than debt
96
+ * @property {Amount<'nat'>} totalProceedsReceived running sum of minted
97
+ * received from liquidation
98
+ * @property {Amount<'nat'>} totalShortfallReceived running sum of shortfalls,
99
+ * minted received less than debt
100
+ * @property {number} numLiquidationsCompleted running count of liquidated
101
+ * vaults
102
+ * @property {number} numLiquidationsAborted running count of vault liquidations
103
+ * that were reverted.
104
+ */
105
+ /**
106
+ * @typedef {{
107
+ * compoundedStabilityFee: Ratio;
108
+ * stabilityFee: Ratio;
109
+ * latestStabilityFeeUpdate: Timestamp;
110
+ * }} AssetState
111
+ *
112
+ * @typedef {{
113
+ * getChargingPeriod: () => RelativeTime;
114
+ * getRecordingPeriod: () => RelativeTime;
115
+ * getDebtLimit: () => Amount<'nat'>;
116
+ * getStabilityFee: () => Ratio;
117
+ * getLiquidationPadding: () => Ratio;
118
+ * getLiquidationMargin: () => Ratio;
119
+ * getLiquidationPenalty: () => Ratio;
120
+ * getMintFee: () => Ratio;
121
+ * getMinInitialDebt: () => Amount<'nat'>;
122
+ * }} GovernedParamGetters
123
+ */
124
+ /**
125
+ * @typedef {Readonly<{
126
+ * debtMint: ZCFMint<'nat'>;
127
+ * collateralBrand: Brand<'nat'>;
128
+ * collateralUnit: Amount<'nat'>;
129
+ * descriptionScope: string;
130
+ * startTimeStamp: Timestamp;
131
+ * storageNode: StorageNode;
132
+ * }>} HeldParams
133
+ */
134
+ /**
135
+ * @typedef {{
136
+ * assetTopicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<AssetState>;
137
+ * debtBrand: Brand<'nat'>;
138
+ * liquidatingVaults: SetStore<Vault>;
139
+ * metricsTopicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<MetricsNotification>;
140
+ * poolIncrementSeat: ZCFSeat;
141
+ * retainedCollateralSeat: ZCFSeat;
142
+ * unsettledVaults: MapStore<string, Vault>;
143
+ * }} ImmutableState
144
+ */
145
+ /**
146
+ * @typedef {{
147
+ * compoundedStabilityFee: Ratio;
148
+ * latestStabilityFeeUpdate: Timestamp;
149
+ * numLiquidationsCompleted: number;
150
+ * numLiquidationsAborted: number;
151
+ * totalCollateral: Amount<'nat'>;
152
+ * totalCollateralSold: Amount<'nat'>;
153
+ * totalDebt: Amount<'nat'>;
154
+ * liquidatingCollateral: Amount<'nat'>;
155
+ * liquidatingDebt: Amount<'nat'>;
156
+ * totalOverageReceived: Amount<'nat'>;
157
+ * totalProceedsReceived: Amount<'nat'>;
158
+ * totalShortfallReceived: Amount<'nat'>;
159
+ * vaultCounter: number;
160
+ * lockedQuote: PriceQuote | undefined;
161
+ * }} MutableState
162
+ */
163
+ /**
164
+ * @type {(brand: Brand) => {
165
+ * prioritizedVaults: ReturnType<typeof makePrioritizedVaults>;
166
+ * storedQuotesNotifier: import('@agoric/notifier').StoredNotifier<PriceQuote>;
167
+ * storedCollateralQuote: PriceQuote;
168
+ * }}
169
+ */
75
170
  AdjustBalances(): Promise<Invitation<R, A>>;
76
171
  CloseVault(): Promise<Invitation<R, A>>;
77
172
  TransferVault(): Promise<Invitation<R, A>>;
@@ -105,13 +200,14 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
105
200
  }[];
106
201
  };
107
202
  /**
108
- * This is designed to tolerate an incomplete plan, in case calculateDistributionPlan encounters
109
- * an error during its calculation. We don't have a way to induce such errors in CI so we've
110
- * done so manually in dev and verified this function recovers as expected.
203
+ * This is designed to tolerate an incomplete plan, in case
204
+ * calculateDistributionPlan encounters an error during its calculation.
205
+ * We don't have a way to induce such errors in CI so we've done so
206
+ * manually in dev and verified this function recovers as expected.
111
207
  *
112
208
  * @param {object} obj
113
209
  * @param {import('./proceeds.js').DistributionPlan} obj.plan
114
- * @param {Array<Vault>} obj.vaultsInPlan
210
+ * @param {Vault[]} obj.vaultsInPlan
115
211
  * @param {ZCFSeat} obj.liqSeat
116
212
  * @param {Amount<'nat'>} obj.totalCollateral
117
213
  * @param {Amount<'nat'>} obj.totalDebt
@@ -119,7 +215,7 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
119
215
  */
120
216
  distributeProceeds({ plan, vaultsInPlan, liqSeat, totalCollateral, totalDebt, }: {
121
217
  plan: import('./proceeds.js').DistributionPlan;
122
- vaultsInPlan: Array<Vault>;
218
+ vaultsInPlan: Vault[];
123
219
  liqSeat: ZCFSeat;
124
220
  totalCollateral: Amount<'nat'>;
125
221
  totalDebt: Amount<'nat'>;
@@ -150,9 +246,7 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
150
246
  * @param {string} base
151
247
  */
152
248
  scopeDescription(base: string): string;
153
- /**
154
- * coefficient on existing debt to calculate new debt
155
- */
249
+ /** coefficient on existing debt to calculate new debt */
156
250
  getCompoundedStabilityFee(): Ratio;
157
251
  /**
158
252
  * Called by a vault when its balances change.
@@ -160,7 +254,8 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
160
254
  * @param {NormalizedDebt} oldDebtNormalized
161
255
  * @param {Amount<'nat'>} oldCollateral
162
256
  * @param {VaultId} vaultId
163
- * @param {import('./vault.js').VaultPhase} vaultPhase at the end of whatever change updated balances
257
+ * @param {import('./vault.js').VaultPhase} vaultPhase at the end of
258
+ * whatever change updated balances
164
259
  * @param {Vault} vault
165
260
  * @returns {void}
166
261
  */
@@ -168,9 +263,7 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
168
263
  };
169
264
  self: {
170
265
  getGovernedParams(): GovernedParamGetters;
171
- /**
172
- * @param {ZCFSeat} seat
173
- */
266
+ /** @param {ZCFSeat} seat */
174
267
  makeVaultKit(seat: ZCFSeat): Promise<{
175
268
  publicSubscribers: {
176
269
  vault: {
@@ -180,6 +273,102 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
180
273
  };
181
274
  };
182
275
  invitationMakers: {
276
+ /** @typedef {import('@agoric/time/src/types').RelativeTime} RelativeTime */
277
+ /**
278
+ * @typedef {object} MetricsNotification
279
+ * @property {Ratio | null} lockedQuote priceQuote that will be used for
280
+ * liquidation. Non-null from priceLock time until liquidation has taken
281
+ * place.
282
+ * @property {number} numActiveVaults present count of vaults
283
+ * @property {number} numLiquidatingVaults present count of liquidating vaults
284
+ * @property {Amount<'nat'>} totalCollateral present sum of collateral across
285
+ * all vaults
286
+ * @property {Amount<'nat'>} totalDebt present sum of debt across all vaults
287
+ * @property {Amount<'nat'>} retainedCollateral collateral held as a result of
288
+ * not returning excess refunds to owners of vaults liquidated with
289
+ * shortfalls
290
+ * @property {Amount<'nat'>} liquidatingCollateral present sum of collateral in
291
+ * vaults sent for liquidation
292
+ * @property {Amount<'nat'>} liquidatingDebt present sum of debt in vaults sent
293
+ * for liquidation
294
+ * @property {Amount<'nat'>} totalCollateralSold running sum of collateral sold
295
+ * in liquidation
296
+ * @property {Amount<'nat'>} totalOverageReceived running sum of overages,
297
+ * central received greater than debt
298
+ * @property {Amount<'nat'>} totalProceedsReceived running sum of minted
299
+ * received from liquidation
300
+ * @property {Amount<'nat'>} totalShortfallReceived running sum of shortfalls,
301
+ * minted received less than debt
302
+ * @property {number} numLiquidationsCompleted running count of liquidated
303
+ * vaults
304
+ * @property {number} numLiquidationsAborted running count of vault liquidations
305
+ * that were reverted.
306
+ */
307
+ /**
308
+ * @typedef {{
309
+ * compoundedStabilityFee: Ratio;
310
+ * stabilityFee: Ratio;
311
+ * latestStabilityFeeUpdate: Timestamp;
312
+ * }} AssetState
313
+ *
314
+ * @typedef {{
315
+ * getChargingPeriod: () => RelativeTime;
316
+ * getRecordingPeriod: () => RelativeTime;
317
+ * getDebtLimit: () => Amount<'nat'>;
318
+ * getStabilityFee: () => Ratio;
319
+ * getLiquidationPadding: () => Ratio;
320
+ * getLiquidationMargin: () => Ratio;
321
+ * getLiquidationPenalty: () => Ratio;
322
+ * getMintFee: () => Ratio;
323
+ * getMinInitialDebt: () => Amount<'nat'>;
324
+ * }} GovernedParamGetters
325
+ */
326
+ /**
327
+ * @typedef {Readonly<{
328
+ * debtMint: ZCFMint<'nat'>;
329
+ * collateralBrand: Brand<'nat'>;
330
+ * collateralUnit: Amount<'nat'>;
331
+ * descriptionScope: string;
332
+ * startTimeStamp: Timestamp;
333
+ * storageNode: StorageNode;
334
+ * }>} HeldParams
335
+ */
336
+ /**
337
+ * @typedef {{
338
+ * assetTopicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<AssetState>;
339
+ * debtBrand: Brand<'nat'>;
340
+ * liquidatingVaults: SetStore<Vault>;
341
+ * metricsTopicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<MetricsNotification>;
342
+ * poolIncrementSeat: ZCFSeat;
343
+ * retainedCollateralSeat: ZCFSeat;
344
+ * unsettledVaults: MapStore<string, Vault>;
345
+ * }} ImmutableState
346
+ */
347
+ /**
348
+ * @typedef {{
349
+ * compoundedStabilityFee: Ratio;
350
+ * latestStabilityFeeUpdate: Timestamp;
351
+ * numLiquidationsCompleted: number;
352
+ * numLiquidationsAborted: number;
353
+ * totalCollateral: Amount<'nat'>;
354
+ * totalCollateralSold: Amount<'nat'>;
355
+ * totalDebt: Amount<'nat'>;
356
+ * liquidatingCollateral: Amount<'nat'>;
357
+ * liquidatingDebt: Amount<'nat'>;
358
+ * totalOverageReceived: Amount<'nat'>;
359
+ * totalProceedsReceived: Amount<'nat'>;
360
+ * totalShortfallReceived: Amount<'nat'>;
361
+ * vaultCounter: number;
362
+ * lockedQuote: PriceQuote | undefined;
363
+ * }} MutableState
364
+ */
365
+ /**
366
+ * @type {(brand: Brand) => {
367
+ * prioritizedVaults: ReturnType<typeof makePrioritizedVaults>;
368
+ * storedQuotesNotifier: import('@agoric/notifier').StoredNotifier<PriceQuote>;
369
+ * storedCollateralQuote: PriceQuote;
370
+ * }}
371
+ */
183
372
  AdjustBalances(): Promise<Invitation<R, A>>;
184
373
  CloseVault(): Promise<Invitation<R, A>>;
185
374
  TransferVault(): Promise<Invitation<R, A>>;
@@ -212,9 +401,7 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
212
401
  };
213
402
  };
214
403
  lockOraclePrices(): PriceQuote;
215
- /**
216
- * @param {ERef<AuctioneerPublicFacet>} auctionPF
217
- */
404
+ /** @param {ERef<AuctioneerPublicFacet>} auctionPF */
218
405
  liquidateVaults(auctionPF: ERef<AuctioneerPublicFacet>): Promise<void>;
219
406
  };
220
407
  } & import("@endo/eventual-send").RemotableBrand<{}, {
@@ -228,20 +415,15 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
228
415
  };
229
416
  };
230
417
  helper: {
231
- /**
232
- * Start non-durable processes (or restart if needed after vat restart)
233
- */
418
+ /** Start non-durable processes (or restart if needed after vat restart) */
234
419
  start(): void;
235
- /**
236
- * @param {Timestamp} updateTime
237
- */
420
+ /** @param {Timestamp} updateTime */
238
421
  chargeAllVaults(updateTime: Timestamp): Promise<void>;
239
422
  assetNotify(): Promise<void>;
240
423
  burnToCoverDebt(debt: any, proceeds: any, seat: any): void;
241
424
  sendToReserve(penalty: any, seat: any, seatKeyword?: string): void;
242
425
  markLiquidating(debt: any, collateral: any): void;
243
426
  /**
244
- *
245
427
  * @param {Amount<'nat'>} debt
246
428
  * @param {Amount<'nat'>} collateral
247
429
  * @param {Amount<'nat'>} overage
@@ -250,14 +432,18 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
250
432
  markDoneLiquidating(debt: Amount<'nat'>, collateral: Amount<'nat'>, overage: Amount<'nat'>, shortfall: Amount<'nat'>): void;
251
433
  writeMetrics(): Promise<void>;
252
434
  /**
253
- * This is designed to tolerate an incomplete plan, in case calculateDistributionPlan encounters
254
- * an error during its calculation. We don't have a way to induce such errors in CI so we've
255
- * done so manually in dev and verified this function recovers as expected.
435
+ * This is designed to tolerate an incomplete plan, in case
436
+ * calculateDistributionPlan encounters an error during its calculation.
437
+ * We don't have a way to induce such errors in CI so we've done so
438
+ * manually in dev and verified this function recovers as expected.
256
439
  *
257
440
  * @param {AmountKeywordRecord} proceeds
258
441
  * @param {Amount<'nat'>} totalDebt
259
442
  * @param {Pick<PriceQuote, 'quoteAmount'>} oraclePriceAtStart
260
- * @param {MapStore<Vault, { collateralAmount: Amount<'nat'>, debtAmount: Amount<'nat'>}>} vaultData
443
+ * @param {MapStore<
444
+ * Vault,
445
+ * { collateralAmount: Amount<'nat'>; debtAmount: Amount<'nat'> }
446
+ * >} vaultData
261
447
  * @param {Amount<'nat'>} totalCollateral
262
448
  */
263
449
  planProceedsDistribution(proceeds: AmountKeywordRecord, totalDebt: Amount<'nat'>, oraclePriceAtStart: Pick<PriceQuote, 'quoteAmount'>, vaultData: MapStore<Vault, {
@@ -276,6 +462,102 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
276
462
  };
277
463
  };
278
464
  invitationMakers: {
465
+ /** @typedef {import('@agoric/time/src/types').RelativeTime} RelativeTime */
466
+ /**
467
+ * @typedef {object} MetricsNotification
468
+ * @property {Ratio | null} lockedQuote priceQuote that will be used for
469
+ * liquidation. Non-null from priceLock time until liquidation has taken
470
+ * place.
471
+ * @property {number} numActiveVaults present count of vaults
472
+ * @property {number} numLiquidatingVaults present count of liquidating vaults
473
+ * @property {Amount<'nat'>} totalCollateral present sum of collateral across
474
+ * all vaults
475
+ * @property {Amount<'nat'>} totalDebt present sum of debt across all vaults
476
+ * @property {Amount<'nat'>} retainedCollateral collateral held as a result of
477
+ * not returning excess refunds to owners of vaults liquidated with
478
+ * shortfalls
479
+ * @property {Amount<'nat'>} liquidatingCollateral present sum of collateral in
480
+ * vaults sent for liquidation
481
+ * @property {Amount<'nat'>} liquidatingDebt present sum of debt in vaults sent
482
+ * for liquidation
483
+ * @property {Amount<'nat'>} totalCollateralSold running sum of collateral sold
484
+ * in liquidation
485
+ * @property {Amount<'nat'>} totalOverageReceived running sum of overages,
486
+ * central received greater than debt
487
+ * @property {Amount<'nat'>} totalProceedsReceived running sum of minted
488
+ * received from liquidation
489
+ * @property {Amount<'nat'>} totalShortfallReceived running sum of shortfalls,
490
+ * minted received less than debt
491
+ * @property {number} numLiquidationsCompleted running count of liquidated
492
+ * vaults
493
+ * @property {number} numLiquidationsAborted running count of vault liquidations
494
+ * that were reverted.
495
+ */
496
+ /**
497
+ * @typedef {{
498
+ * compoundedStabilityFee: Ratio;
499
+ * stabilityFee: Ratio;
500
+ * latestStabilityFeeUpdate: Timestamp;
501
+ * }} AssetState
502
+ *
503
+ * @typedef {{
504
+ * getChargingPeriod: () => RelativeTime;
505
+ * getRecordingPeriod: () => RelativeTime;
506
+ * getDebtLimit: () => Amount<'nat'>;
507
+ * getStabilityFee: () => Ratio;
508
+ * getLiquidationPadding: () => Ratio;
509
+ * getLiquidationMargin: () => Ratio;
510
+ * getLiquidationPenalty: () => Ratio;
511
+ * getMintFee: () => Ratio;
512
+ * getMinInitialDebt: () => Amount<'nat'>;
513
+ * }} GovernedParamGetters
514
+ */
515
+ /**
516
+ * @typedef {Readonly<{
517
+ * debtMint: ZCFMint<'nat'>;
518
+ * collateralBrand: Brand<'nat'>;
519
+ * collateralUnit: Amount<'nat'>;
520
+ * descriptionScope: string;
521
+ * startTimeStamp: Timestamp;
522
+ * storageNode: StorageNode;
523
+ * }>} HeldParams
524
+ */
525
+ /**
526
+ * @typedef {{
527
+ * assetTopicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<AssetState>;
528
+ * debtBrand: Brand<'nat'>;
529
+ * liquidatingVaults: SetStore<Vault>;
530
+ * metricsTopicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<MetricsNotification>;
531
+ * poolIncrementSeat: ZCFSeat;
532
+ * retainedCollateralSeat: ZCFSeat;
533
+ * unsettledVaults: MapStore<string, Vault>;
534
+ * }} ImmutableState
535
+ */
536
+ /**
537
+ * @typedef {{
538
+ * compoundedStabilityFee: Ratio;
539
+ * latestStabilityFeeUpdate: Timestamp;
540
+ * numLiquidationsCompleted: number;
541
+ * numLiquidationsAborted: number;
542
+ * totalCollateral: Amount<'nat'>;
543
+ * totalCollateralSold: Amount<'nat'>;
544
+ * totalDebt: Amount<'nat'>;
545
+ * liquidatingCollateral: Amount<'nat'>;
546
+ * liquidatingDebt: Amount<'nat'>;
547
+ * totalOverageReceived: Amount<'nat'>;
548
+ * totalProceedsReceived: Amount<'nat'>;
549
+ * totalShortfallReceived: Amount<'nat'>;
550
+ * vaultCounter: number;
551
+ * lockedQuote: PriceQuote | undefined;
552
+ * }} MutableState
553
+ */
554
+ /**
555
+ * @type {(brand: Brand) => {
556
+ * prioritizedVaults: ReturnType<typeof makePrioritizedVaults>;
557
+ * storedQuotesNotifier: import('@agoric/notifier').StoredNotifier<PriceQuote>;
558
+ * storedCollateralQuote: PriceQuote;
559
+ * }}
560
+ */
279
561
  AdjustBalances(): Promise<Invitation<R, A>>;
280
562
  CloseVault(): Promise<Invitation<R, A>>;
281
563
  TransferVault(): Promise<Invitation<R, A>>;
@@ -309,13 +591,14 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
309
591
  }[];
310
592
  };
311
593
  /**
312
- * This is designed to tolerate an incomplete plan, in case calculateDistributionPlan encounters
313
- * an error during its calculation. We don't have a way to induce such errors in CI so we've
314
- * done so manually in dev and verified this function recovers as expected.
594
+ * This is designed to tolerate an incomplete plan, in case
595
+ * calculateDistributionPlan encounters an error during its calculation.
596
+ * We don't have a way to induce such errors in CI so we've done so
597
+ * manually in dev and verified this function recovers as expected.
315
598
  *
316
599
  * @param {object} obj
317
600
  * @param {import('./proceeds.js').DistributionPlan} obj.plan
318
- * @param {Array<Vault>} obj.vaultsInPlan
601
+ * @param {Vault[]} obj.vaultsInPlan
319
602
  * @param {ZCFSeat} obj.liqSeat
320
603
  * @param {Amount<'nat'>} obj.totalCollateral
321
604
  * @param {Amount<'nat'>} obj.totalDebt
@@ -323,7 +606,7 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
323
606
  */
324
607
  distributeProceeds({ plan, vaultsInPlan, liqSeat, totalCollateral, totalDebt, }: {
325
608
  plan: import('./proceeds.js').DistributionPlan;
326
- vaultsInPlan: Array<Vault>;
609
+ vaultsInPlan: Vault[];
327
610
  liqSeat: ZCFSeat;
328
611
  totalCollateral: Amount<'nat'>;
329
612
  totalDebt: Amount<'nat'>;
@@ -354,9 +637,7 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
354
637
  * @param {string} base
355
638
  */
356
639
  scopeDescription(base: string): string;
357
- /**
358
- * coefficient on existing debt to calculate new debt
359
- */
640
+ /** coefficient on existing debt to calculate new debt */
360
641
  getCompoundedStabilityFee(): Ratio;
361
642
  /**
362
643
  * Called by a vault when its balances change.
@@ -364,7 +645,8 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
364
645
  * @param {NormalizedDebt} oldDebtNormalized
365
646
  * @param {Amount<'nat'>} oldCollateral
366
647
  * @param {VaultId} vaultId
367
- * @param {import('./vault.js').VaultPhase} vaultPhase at the end of whatever change updated balances
648
+ * @param {import('./vault.js').VaultPhase} vaultPhase at the end of
649
+ * whatever change updated balances
368
650
  * @param {Vault} vault
369
651
  * @returns {void}
370
652
  */
@@ -372,9 +654,7 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
372
654
  };
373
655
  self: {
374
656
  getGovernedParams(): GovernedParamGetters;
375
- /**
376
- * @param {ZCFSeat} seat
377
- */
657
+ /** @param {ZCFSeat} seat */
378
658
  makeVaultKit(seat: ZCFSeat): Promise<{
379
659
  publicSubscribers: {
380
660
  vault: {
@@ -384,6 +664,102 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
384
664
  };
385
665
  };
386
666
  invitationMakers: {
667
+ /** @typedef {import('@agoric/time/src/types').RelativeTime} RelativeTime */
668
+ /**
669
+ * @typedef {object} MetricsNotification
670
+ * @property {Ratio | null} lockedQuote priceQuote that will be used for
671
+ * liquidation. Non-null from priceLock time until liquidation has taken
672
+ * place.
673
+ * @property {number} numActiveVaults present count of vaults
674
+ * @property {number} numLiquidatingVaults present count of liquidating vaults
675
+ * @property {Amount<'nat'>} totalCollateral present sum of collateral across
676
+ * all vaults
677
+ * @property {Amount<'nat'>} totalDebt present sum of debt across all vaults
678
+ * @property {Amount<'nat'>} retainedCollateral collateral held as a result of
679
+ * not returning excess refunds to owners of vaults liquidated with
680
+ * shortfalls
681
+ * @property {Amount<'nat'>} liquidatingCollateral present sum of collateral in
682
+ * vaults sent for liquidation
683
+ * @property {Amount<'nat'>} liquidatingDebt present sum of debt in vaults sent
684
+ * for liquidation
685
+ * @property {Amount<'nat'>} totalCollateralSold running sum of collateral sold
686
+ * in liquidation
687
+ * @property {Amount<'nat'>} totalOverageReceived running sum of overages,
688
+ * central received greater than debt
689
+ * @property {Amount<'nat'>} totalProceedsReceived running sum of minted
690
+ * received from liquidation
691
+ * @property {Amount<'nat'>} totalShortfallReceived running sum of shortfalls,
692
+ * minted received less than debt
693
+ * @property {number} numLiquidationsCompleted running count of liquidated
694
+ * vaults
695
+ * @property {number} numLiquidationsAborted running count of vault liquidations
696
+ * that were reverted.
697
+ */
698
+ /**
699
+ * @typedef {{
700
+ * compoundedStabilityFee: Ratio;
701
+ * stabilityFee: Ratio;
702
+ * latestStabilityFeeUpdate: Timestamp;
703
+ * }} AssetState
704
+ *
705
+ * @typedef {{
706
+ * getChargingPeriod: () => RelativeTime;
707
+ * getRecordingPeriod: () => RelativeTime;
708
+ * getDebtLimit: () => Amount<'nat'>;
709
+ * getStabilityFee: () => Ratio;
710
+ * getLiquidationPadding: () => Ratio;
711
+ * getLiquidationMargin: () => Ratio;
712
+ * getLiquidationPenalty: () => Ratio;
713
+ * getMintFee: () => Ratio;
714
+ * getMinInitialDebt: () => Amount<'nat'>;
715
+ * }} GovernedParamGetters
716
+ */
717
+ /**
718
+ * @typedef {Readonly<{
719
+ * debtMint: ZCFMint<'nat'>;
720
+ * collateralBrand: Brand<'nat'>;
721
+ * collateralUnit: Amount<'nat'>;
722
+ * descriptionScope: string;
723
+ * startTimeStamp: Timestamp;
724
+ * storageNode: StorageNode;
725
+ * }>} HeldParams
726
+ */
727
+ /**
728
+ * @typedef {{
729
+ * assetTopicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<AssetState>;
730
+ * debtBrand: Brand<'nat'>;
731
+ * liquidatingVaults: SetStore<Vault>;
732
+ * metricsTopicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<MetricsNotification>;
733
+ * poolIncrementSeat: ZCFSeat;
734
+ * retainedCollateralSeat: ZCFSeat;
735
+ * unsettledVaults: MapStore<string, Vault>;
736
+ * }} ImmutableState
737
+ */
738
+ /**
739
+ * @typedef {{
740
+ * compoundedStabilityFee: Ratio;
741
+ * latestStabilityFeeUpdate: Timestamp;
742
+ * numLiquidationsCompleted: number;
743
+ * numLiquidationsAborted: number;
744
+ * totalCollateral: Amount<'nat'>;
745
+ * totalCollateralSold: Amount<'nat'>;
746
+ * totalDebt: Amount<'nat'>;
747
+ * liquidatingCollateral: Amount<'nat'>;
748
+ * liquidatingDebt: Amount<'nat'>;
749
+ * totalOverageReceived: Amount<'nat'>;
750
+ * totalProceedsReceived: Amount<'nat'>;
751
+ * totalShortfallReceived: Amount<'nat'>;
752
+ * vaultCounter: number;
753
+ * lockedQuote: PriceQuote | undefined;
754
+ * }} MutableState
755
+ */
756
+ /**
757
+ * @type {(brand: Brand) => {
758
+ * prioritizedVaults: ReturnType<typeof makePrioritizedVaults>;
759
+ * storedQuotesNotifier: import('@agoric/notifier').StoredNotifier<PriceQuote>;
760
+ * storedCollateralQuote: PriceQuote;
761
+ * }}
762
+ */
387
763
  AdjustBalances(): Promise<Invitation<R, A>>;
388
764
  CloseVault(): Promise<Invitation<R, A>>;
389
765
  TransferVault(): Promise<Invitation<R, A>>;
@@ -416,9 +792,7 @@ export function prepareVaultManagerKit(baggage: MapStore<string, unknown>, { zcf
416
792
  };
417
793
  };
418
794
  lockOraclePrices(): PriceQuote;
419
- /**
420
- * @param {ERef<AuctioneerPublicFacet>} auctionPF
421
- */
795
+ /** @param {ERef<AuctioneerPublicFacet>} auctionPF */
422
796
  liquidateVaults(auctionPF: ERef<AuctioneerPublicFacet>): Promise<void>;
423
797
  };
424
798
  }>>;
@@ -433,8 +807,9 @@ export type NormalizedDebt = import('./storeUtils.js').NormalizedDebt;
433
807
  export type RelativeTime = import('@agoric/time/src/types').RelativeTime;
434
808
  export type MetricsNotification = {
435
809
  /**
436
- * priceQuote that will be used for liquidation.
437
- * Non-null from priceLock time until liquidation has taken place.
810
+ * priceQuote that will be used for
811
+ * liquidation. Non-null from priceLock time until liquidation has taken
812
+ * place.
438
813
  */
439
814
  lockedQuote: Ratio | null;
440
815
  /**
@@ -446,7 +821,8 @@ export type MetricsNotification = {
446
821
  */
447
822
  numLiquidatingVaults: number;
448
823
  /**
449
- * present sum of collateral across all vaults
824
+ * present sum of collateral across
825
+ * all vaults
450
826
  */
451
827
  totalCollateral: Amount<'nat'>;
452
828
  /**
@@ -454,40 +830,49 @@ export type MetricsNotification = {
454
830
  */
455
831
  totalDebt: Amount<'nat'>;
456
832
  /**
457
- * collateral held as a result of not returning excess refunds
458
- * to owners of vaults liquidated with shortfalls
833
+ * collateral held as a result of
834
+ * not returning excess refunds to owners of vaults liquidated with
835
+ * shortfalls
459
836
  */
460
837
  retainedCollateral: Amount<'nat'>;
461
838
  /**
462
- * present sum of collateral in vaults sent for liquidation
839
+ * present sum of collateral in
840
+ * vaults sent for liquidation
463
841
  */
464
842
  liquidatingCollateral: Amount<'nat'>;
465
843
  /**
466
- * present sum of debt in vaults sent for liquidation
844
+ * present sum of debt in vaults sent
845
+ * for liquidation
467
846
  */
468
847
  liquidatingDebt: Amount<'nat'>;
469
848
  /**
470
- * running sum of collateral sold in liquidation
849
+ * running sum of collateral sold
850
+ * in liquidation
471
851
  */
472
852
  totalCollateralSold: Amount<'nat'>;
473
853
  /**
474
- * running sum of overages, central received greater than debt
854
+ * running sum of overages,
855
+ * central received greater than debt
475
856
  */
476
857
  totalOverageReceived: Amount<'nat'>;
477
858
  /**
478
- * running sum of minted received from liquidation
859
+ * running sum of minted
860
+ * received from liquidation
479
861
  */
480
862
  totalProceedsReceived: Amount<'nat'>;
481
863
  /**
482
- * running sum of shortfalls, minted received less than debt
864
+ * running sum of shortfalls,
865
+ * minted received less than debt
483
866
  */
484
867
  totalShortfallReceived: Amount<'nat'>;
485
868
  /**
486
- * running count of liquidated vaults
869
+ * running count of liquidated
870
+ * vaults
487
871
  */
488
872
  numLiquidationsCompleted: number;
489
873
  /**
490
- * running count of vault liquidations that were reverted.
874
+ * running count of vault liquidations
875
+ * that were reverted.
491
876
  */
492
877
  numLiquidationsAborted: number;
493
878
  };
@@ -542,10 +927,11 @@ export type MutableState = {
542
927
  };
543
928
  export type VaultManagerKit = Awaited<ReturnType<ReturnType<typeof prepareVaultManagerKit>>>;
544
929
  /**
545
- * Each VaultManager manages a single collateral type.
930
+ * Each VaultManager manages a
931
+ * single collateral type.
546
932
  *
547
- * It manages some number of outstanding debt positions, each called a Vault,
548
- * for which the collateral is provided in exchange for borrowed Minted.
933
+ * It manages some number of outstanding debt positions, each called a Vault,
934
+ * for which the collateral is provided in exchange for borrowed Minted.
549
935
  */
550
936
  export type VaultManager = VaultManagerKit['self'];
551
937
  export type CollateralManager = VaultManagerKit['collateral'];