@agoric/inter-protocol 0.16.2-other-dev-8f8782b.0 → 0.16.2-other-dev-3eb1a1d.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 (191) hide show
  1. package/README.md +6 -6
  2. package/package.json +42 -36
  3. package/scripts/build-bundles.js +5 -21
  4. package/src/auction/auctionBook.d.ts +147 -0
  5. package/src/auction/auctionBook.d.ts.map +1 -0
  6. package/src/auction/auctionBook.js +156 -150
  7. package/src/auction/auctionMath.d.ts +17 -0
  8. package/src/auction/auctionMath.d.ts.map +1 -0
  9. package/src/auction/auctionMath.js +81 -0
  10. package/src/auction/auctioneer.d.ts +69 -0
  11. package/src/auction/auctioneer.d.ts.map +1 -0
  12. package/src/auction/auctioneer.js +70 -59
  13. package/src/auction/offerBook.d.ts +45 -0
  14. package/src/auction/offerBook.d.ts.map +1 -0
  15. package/src/auction/offerBook.js +13 -12
  16. package/src/auction/params.d.ts +144 -0
  17. package/src/auction/params.d.ts.map +1 -0
  18. package/src/auction/params.js +10 -9
  19. package/src/auction/scheduleMath.d.ts +5 -0
  20. package/src/auction/scheduleMath.d.ts.map +1 -0
  21. package/src/auction/scheduleMath.js +18 -16
  22. package/src/auction/scheduler.d.ts +50 -0
  23. package/src/auction/scheduler.d.ts.map +1 -0
  24. package/src/auction/scheduler.js +53 -47
  25. package/src/auction/sortedOffers.d.ts +8 -0
  26. package/src/auction/sortedOffers.d.ts.map +1 -0
  27. package/src/auction/sortedOffers.js +10 -9
  28. package/src/auction/util.d.ts +30 -0
  29. package/src/auction/util.d.ts.map +1 -0
  30. package/src/auction/util.js +9 -6
  31. package/src/clientSupport.d.ts +167 -0
  32. package/src/clientSupport.d.ts.map +1 -0
  33. package/src/clientSupport.js +155 -97
  34. package/src/collectFees.d.ts +2 -0
  35. package/src/collectFees.d.ts.map +1 -0
  36. package/src/contractSupport.d.ts +28 -0
  37. package/src/contractSupport.d.ts.map +1 -0
  38. package/src/contractSupport.js +19 -13
  39. package/src/econCommitteeCharter.d.ts +40 -0
  40. package/src/econCommitteeCharter.d.ts.map +1 -0
  41. package/src/econCommitteeCharter.js +21 -20
  42. package/src/feeDistributor.d.ts +224 -0
  43. package/src/feeDistributor.d.ts.map +1 -0
  44. package/src/feeDistributor.js +37 -33
  45. package/src/index.d.ts +2 -0
  46. package/src/index.d.ts.map +1 -0
  47. package/src/index.js +1 -0
  48. package/src/interest-math.d.ts +3 -0
  49. package/src/interest-math.d.ts.map +1 -0
  50. package/src/interest.d.ts +28 -0
  51. package/src/interest.d.ts.map +1 -0
  52. package/src/interest.js +23 -18
  53. package/src/price/README.md +13 -0
  54. package/src/price/fluxAggregatorContract.d.ts +71 -0
  55. package/src/price/fluxAggregatorContract.d.ts.map +1 -0
  56. package/src/price/fluxAggregatorContract.js +64 -55
  57. package/src/price/fluxAggregatorKit.d.ts +103 -0
  58. package/src/price/fluxAggregatorKit.d.ts.map +1 -0
  59. package/src/price/fluxAggregatorKit.js +52 -40
  60. package/src/price/priceOracleKit.d.ts +38 -0
  61. package/src/price/priceOracleKit.d.ts.map +1 -0
  62. package/src/price/priceOracleKit.js +12 -14
  63. package/src/price/roundsManager.d.ts +204 -0
  64. package/src/price/roundsManager.d.ts.map +1 -0
  65. package/src/price/roundsManager.js +131 -85
  66. package/src/proposals/README.md +2 -3
  67. package/src/proposals/add-auction.d.ts +109 -0
  68. package/src/proposals/add-auction.d.ts.map +1 -0
  69. package/src/proposals/add-auction.js +256 -0
  70. package/src/proposals/addAssetToVault.d.ts +173 -0
  71. package/src/proposals/addAssetToVault.d.ts.map +1 -0
  72. package/src/proposals/addAssetToVault.js +192 -40
  73. package/src/proposals/committee-proposal.d.ts +113 -0
  74. package/src/proposals/committee-proposal.d.ts.map +1 -0
  75. package/src/proposals/committee-proposal.js +25 -31
  76. package/src/proposals/core-proposal.d.ts +149 -0
  77. package/src/proposals/core-proposal.d.ts.map +1 -0
  78. package/src/proposals/core-proposal.js +9 -11
  79. package/src/proposals/deploy-price-feeds.d.ts +76 -0
  80. package/src/proposals/deploy-price-feeds.d.ts.map +1 -0
  81. package/src/proposals/deploy-price-feeds.js +316 -0
  82. package/src/proposals/econ-behaviors.d.ts +541 -0
  83. package/src/proposals/econ-behaviors.d.ts.map +1 -0
  84. package/src/proposals/econ-behaviors.js +64 -45
  85. package/src/proposals/price-feed-proposal.d.ts +84 -0
  86. package/src/proposals/price-feed-proposal.d.ts.map +1 -0
  87. package/src/proposals/price-feed-proposal.js +109 -51
  88. package/src/proposals/replace-fee-distributor.d.ts +48 -0
  89. package/src/proposals/replace-fee-distributor.d.ts.map +1 -0
  90. package/src/proposals/replace-fee-distributor.js +195 -0
  91. package/src/proposals/replace-scaledPriceAuthorities.d.ts +30 -0
  92. package/src/proposals/replace-scaledPriceAuthorities.d.ts.map +1 -0
  93. package/src/proposals/replace-scaledPriceAuthorities.js +124 -0
  94. package/src/proposals/replaceElectorate.d.ts +55 -0
  95. package/src/proposals/replaceElectorate.d.ts.map +1 -0
  96. package/src/proposals/replaceElectorate.js +521 -0
  97. package/src/proposals/startEconCommittee.d.ts +34 -0
  98. package/src/proposals/startEconCommittee.d.ts.map +1 -0
  99. package/src/proposals/startEconCommittee.js +2 -2
  100. package/src/proposals/startPSM.d.ts +59 -0
  101. package/src/proposals/startPSM.d.ts.map +1 -0
  102. package/src/proposals/startPSM.js +44 -29
  103. package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +24 -0
  104. package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +1 -0
  105. package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
  106. package/src/proposals/upgrade-vaults.d.ts +41 -0
  107. package/src/proposals/upgrade-vaults.d.ts.map +1 -0
  108. package/src/proposals/upgrade-vaults.js +202 -0
  109. package/src/proposals/utils.d.ts +19 -0
  110. package/src/proposals/utils.d.ts.map +1 -0
  111. package/src/proposals/utils.js +43 -9
  112. package/src/provisionPool.d.ts +163 -0
  113. package/src/provisionPool.d.ts.map +1 -0
  114. package/src/provisionPool.js +122 -0
  115. package/src/provisionPoolKit.d.ts +359 -0
  116. package/src/provisionPoolKit.d.ts.map +1 -0
  117. package/src/provisionPoolKit.js +522 -0
  118. package/src/psm/psm.d.ts +125 -0
  119. package/src/psm/psm.d.ts.map +1 -0
  120. package/src/psm/psm.js +80 -79
  121. package/src/psm/types-ambient.d.ts +2 -0
  122. package/src/psm/types-ambient.d.ts.map +1 -0
  123. package/src/psm/types-ambient.js +3 -0
  124. package/src/reserve/assetReserve.d.ts +47 -0
  125. package/src/reserve/assetReserve.d.ts.map +1 -0
  126. package/src/reserve/assetReserve.js +28 -19
  127. package/src/reserve/assetReserveKit.d.ts +74 -0
  128. package/src/reserve/assetReserveKit.d.ts.map +1 -0
  129. package/src/reserve/assetReserveKit.js +24 -30
  130. package/src/reserve/params.d.ts +10 -0
  131. package/src/reserve/params.d.ts.map +1 -0
  132. package/src/tokens.d.ts +3 -0
  133. package/src/tokens.d.ts.map +1 -0
  134. package/src/tokens.js +5 -0
  135. package/src/vaultFactory/burn.d.ts +2 -0
  136. package/src/vaultFactory/burn.d.ts.map +1 -0
  137. package/src/vaultFactory/burn.js +1 -1
  138. package/src/vaultFactory/liquidation.d.ts +23 -0
  139. package/src/vaultFactory/liquidation.d.ts.map +1 -0
  140. package/src/vaultFactory/liquidation.js +37 -24
  141. package/src/vaultFactory/math.d.ts +11 -0
  142. package/src/vaultFactory/math.d.ts.map +1 -0
  143. package/src/vaultFactory/math.js +10 -9
  144. package/src/vaultFactory/orderedVaultStore.d.ts +93 -0
  145. package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
  146. package/src/vaultFactory/orderedVaultStore.js +8 -11
  147. package/src/vaultFactory/params.d.ts +140 -0
  148. package/src/vaultFactory/params.d.ts.map +1 -0
  149. package/src/vaultFactory/params.js +52 -24
  150. package/src/vaultFactory/prioritizedVaults.d.ts +279 -0
  151. package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
  152. package/src/vaultFactory/prioritizedVaults.js +4 -4
  153. package/src/vaultFactory/proceeds.d.ts +35 -0
  154. package/src/vaultFactory/proceeds.d.ts.map +1 -0
  155. package/src/vaultFactory/proceeds.js +26 -18
  156. package/src/vaultFactory/storeUtils.d.ts +25 -0
  157. package/src/vaultFactory/storeUtils.d.ts.map +1 -0
  158. package/src/vaultFactory/storeUtils.js +10 -12
  159. package/src/vaultFactory/types-ambient.d.ts +137 -0
  160. package/src/vaultFactory/types-ambient.d.ts.map +1 -0
  161. package/src/vaultFactory/{types.js → types-ambient.js} +42 -42
  162. package/src/vaultFactory/vault.d.ts +343 -0
  163. package/src/vaultFactory/vault.d.ts.map +1 -0
  164. package/src/vaultFactory/vault.js +105 -99
  165. package/src/vaultFactory/vaultDirector.d.ts +341 -0
  166. package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
  167. package/src/vaultFactory/vaultDirector.js +86 -64
  168. package/src/vaultFactory/vaultFactory.d.ts +202 -0
  169. package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
  170. package/src/vaultFactory/vaultFactory.js +52 -33
  171. package/src/vaultFactory/vaultHolder.d.ts +126 -0
  172. package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
  173. package/src/vaultFactory/vaultHolder.js +11 -16
  174. package/src/vaultFactory/vaultKit.d.ts +32 -0
  175. package/src/vaultFactory/vaultKit.d.ts.map +1 -0
  176. package/src/vaultFactory/vaultKit.js +5 -4
  177. package/src/vaultFactory/vaultManager.d.ts +674 -0
  178. package/src/vaultFactory/vaultManager.d.ts.map +1 -0
  179. package/src/vaultFactory/vaultManager.js +257 -158
  180. package/CHANGELOG.md +0 -1041
  181. package/exported.js +0 -2
  182. package/scripts/add-collateral-core.js +0 -112
  183. package/scripts/deploy-contracts.js +0 -100
  184. package/scripts/init-core.js +0 -198
  185. package/scripts/invite-committee-core.js +0 -42
  186. package/scripts/manual-price-feed.js +0 -117
  187. package/scripts/price-feed-core.js +0 -104
  188. package/scripts/start-local-chain.sh +0 -84
  189. package/src/psm/types.js +0 -3
  190. package/src/typeGuards.js +0 -13
  191. package/src/vaultFactory/type-imports.js +0 -4
@@ -1,5 +1,7 @@
1
+ import { q, Fail } from '@endo/errors';
1
2
  import { AmountMath, AmountShape } from '@agoric/ertp';
2
- import { makeTracer, StorageNodeShape } from '@agoric/internal';
3
+ import { StorageNodeShape, makeTracer } from '@agoric/internal';
4
+ import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js';
3
5
  import { M, prepareExoClassKit } from '@agoric/vat-data';
4
6
  import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js';
5
7
  import { SeatShape } from '@agoric/zoe/src/typeGuards.js';
@@ -9,44 +11,49 @@ import {
9
11
  makeNatAmountShape,
10
12
  } from '../contractSupport.js';
11
13
  import { calculateCurrentDebt, reverseInterest } from '../interest-math.js';
12
- import { UnguardedHelperI } from '../typeGuards.js';
13
- import { prepareVaultKit } from './vaultKit.js';
14
-
15
- import '@agoric/zoe/exported.js';
16
14
  import { calculateDebtCosts } from './math.js';
17
-
18
- const { quote: q, Fail } = assert;
15
+ import { prepareVaultKit } from './vaultKit.js';
19
16
 
20
17
  const trace = makeTracer('Vault', true);
21
18
 
22
- /** @typedef {import('./storeUtils.js').NormalizedDebt} NormalizedDebt */
19
+ /**
20
+ * @import {Brand} from '@agoric/ertp/src/types.js';
21
+ * @import {NormalizedDebt} from './storeUtils.js';
22
+ */
23
23
 
24
24
  /**
25
- * @file This has most of the logic for a Vault, to borrow Minted against collateral.
25
+ * @file This has most of the logic for a Vault, to borrow Minted against
26
+ * collateral.
27
+ *
28
+ * The logic here is for Vault which is the majority of logic of vaults but the
29
+ * user view is the `vault` value contained in VaultKit.
26
30
  *
27
- * The logic here is for Vault which is the majority of logic of vaults but
28
- * the user view is the `vault` value contained in VaultKit.
31
+ * A note on naming convention:
29
32
  *
30
- * A note on naming convention:
31
- * - `Pre` is used as a postfix for any mutable value retrieved *before* an
32
- * `await`, to flag values that must used very carefully after the `await`
33
- * - `new` is a prefix for values that describe the result of executing a
34
- * transaction; e.g., `debt` is the value before the txn, and `newDebt`
35
- * will be value if the txn completes.
36
- * - the absence of one of these implies the opposite, so `newDebt` is the
37
- * future value fo `debt`, as computed based on values after any `await`
33
+ * - `Pre` is used as a postfix for any mutable value retrieved _before_ an
34
+ * `await`, to flag values that must used very carefully after the
35
+ * `await`
36
+ * - `new` is a prefix for values that describe the result of executing a
37
+ * transaction; e.g., `debt` is the value before the txn, and `newDebt`
38
+ * will be value if the txn completes.
39
+ * - the absence of one of these implies the opposite, so `newDebt` is the future
40
+ * value fo `debt`, as computed based on values after any `await`
38
41
  */
39
42
 
40
43
  /**
41
44
  * Constants for vault phase.
42
45
  *
43
- * ACTIVE - vault is in use and can be changed
44
- * LIQUIDATING - vault is being liquidated by the vault manager, and cannot be changed by the user.
45
- * If liquidation fails, vaults may remain in this state. An upgrade to the contract
46
- * might be able to recover them.
47
- * TRANSFER - vault is able to be transferred (payments and debits frozen until it has a new owner)
48
- * CLOSED - vault was closed by the user and all assets have been paid out
49
- * LIQUIDATED - vault was closed by the manager, with remaining assets paid to owner
46
+ * - ACTIVE - vault is in use and can be changed
47
+ * - LIQUIDATING - vault is being liquidated by the vault manager, and cannot be
48
+ * changed by the user. If liquidation fails, vaults may remain in this state.
49
+ * An upgrade to the contract might be able to recover them.
50
+ * - TRANSFER - vault is able to be transferred (payments and debits frozen until
51
+ * it has a new owner)
52
+ * - CLOSED - vault was closed by the user and all assets have been paid out
53
+ * - LIQUIDATED - vault was closed by the manager, with remaining assets paid to
54
+ * owner
55
+ *
56
+ * @enum {(typeof Phase)[keyof typeof Phase]}
50
57
  */
51
58
  export const Phase = /** @type {const} */ ({
52
59
  ACTIVE: 'active',
@@ -55,10 +62,11 @@ export const Phase = /** @type {const} */ ({
55
62
  LIQUIDATED: 'liquidated',
56
63
  TRANSFER: 'transfer',
57
64
  });
65
+ harden(Phase);
58
66
 
59
67
  /**
60
- * @typedef {Phase[keyof Omit<typeof Phase, 'TRANSFER'>]} VaultPhase
61
- * @type {{[K in VaultPhase]: Array<VaultPhase>}}
68
+ * @typedef {Exclude<Phase, 'transfer'>} VaultPhase
69
+ * @type {{ [K in VaultPhase]: VaultPhase[] }}
62
70
  */
63
71
  const validTransitions = {
64
72
  [Phase.ACTIVE]: [Phase.LIQUIDATING, Phase.CLOSED],
@@ -68,46 +76,54 @@ const validTransitions = {
68
76
  };
69
77
 
70
78
  /**
71
- * @typedef {Phase[keyof typeof Phase]} HolderPhase
72
- *
73
79
  * @typedef {object} VaultNotification
74
80
  * @property {Amount<'nat'>} locked Amount of Collateral locked
75
- * @property {{debt: Amount<'nat'>, interest: Ratio}} debtSnapshot 'debt' at the point the compounded interest was 'interest'
76
- * @property {HolderPhase} vaultState
81
+ * @property {{ debt: Amount<'nat'>; interest: Ratio }} debtSnapshot 'debt' at
82
+ * the point the compounded interest was 'interest'
83
+ * @property {Phase} vaultState
77
84
  */
78
85
 
79
86
  // XXX masks typedef from types.js, but using that causes circular def problems
80
87
  /**
81
88
  * @typedef {object} VaultManager
82
- * @property {() => Subscriber<import('./vaultManager').AssetState>} getAssetSubscriber
89
+ * @property {() => Subscriber<import('./vaultManager.js').AssetState>} getAssetSubscriber
83
90
  * @property {(collateralAmount: Amount) => Amount<'nat'>} maxDebtFor
84
- * @property {() => Brand} getCollateralBrand
91
+ * @property {() => Brand<'nat'>} getCollateralBrand
85
92
  * @property {(base: string) => string} scopeDescription
86
93
  * @property {() => Brand<'nat'>} getDebtBrand
87
94
  * @property {MintAndTransfer} mintAndTransfer
88
95
  * @property {(amount: Amount, seat: ZCFSeat) => void} burn
89
96
  * @property {() => Ratio} getCompoundedInterest
90
- * @property {(oldDebt: import('./storeUtils.js').NormalizedDebt, oldCollateral: Amount<'nat'>, vaultId: VaultId, vaultPhase: VaultPhase, vault: Vault) => void} handleBalanceChange
97
+ * @property {(
98
+ * oldDebt: import('./storeUtils.js').NormalizedDebt,
99
+ * oldCollateral: Amount<'nat'>,
100
+ * vaultId: VaultId,
101
+ * vaultPhase: VaultPhase,
102
+ * vault: Vault,
103
+ * ) => void} handleBalanceChange
91
104
  * @property {() => import('./vaultManager.js').GovernedParamGetters} getGovernedParams
92
105
  */
93
106
 
94
107
  /**
95
108
  * @typedef {Readonly<{
96
- * idInManager: VaultId,
97
- * manager: VaultManager,
98
- * storageNode: StorageNode,
99
- * vaultSeat: ZCFSeat,
109
+ * idInManager: VaultId;
110
+ * manager: VaultManager;
111
+ * storageNode: StorageNode;
112
+ * vaultSeat: ZCFSeat;
100
113
  * }>} ImmutableState
101
114
  */
102
115
 
103
116
  /**
104
- * Snapshot is of the debt and compounded interest when the principal was last changed.
117
+ * Snapshot is of the debt and compounded interest when the principal was last
118
+ * changed.
105
119
  *
106
120
  * @typedef {{
107
- * interestSnapshot: Ratio,
108
- * phase: VaultPhase,
109
- * debtSnapshot: Amount<'nat'>,
110
- * outerUpdater: import('@agoric/zoe/src/contractSupport/recorder.js').Recorder<VaultNotification> | null,
121
+ * interestSnapshot: Ratio;
122
+ * phase: VaultPhase;
123
+ * debtSnapshot: Amount<'nat'>;
124
+ * outerUpdater:
125
+ * | import('@agoric/zoe/src/contractSupport/recorder.js').Recorder<VaultNotification>
126
+ * | null;
111
127
  * }} MutableState
112
128
  */
113
129
 
@@ -137,7 +153,7 @@ const VaultStateShape = harden({
137
153
  });
138
154
 
139
155
  /**
140
- * @param {import('@agoric/ertp').Baggage} baggage
156
+ * @param {import('@agoric/swingset-liveslots').Baggage} baggage
141
157
  * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
142
158
  * @param {ZCF} zcf
143
159
  */
@@ -195,7 +211,10 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
195
211
  return AmountMath.makeEmpty(this.facets.helper.debtBrand());
196
212
  },
197
213
  /**
198
- * @typedef {{ give: { Collateral: Amount<'nat'>, Minted: Amount<'nat'> }, want: { Collateral: Amount<'nat'>, Minted: Amount<'nat'> } }} FullProposal
214
+ * @typedef {{
215
+ * give: { Collateral: Amount<'nat'>; Minted: Amount<'nat'> };
216
+ * want: { Collateral: Amount<'nat'>; Minted: Amount<'nat'> };
217
+ * }} FullProposal
199
218
  */
200
219
  /**
201
220
  * @param {ProposalRecord} partial
@@ -220,9 +239,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
220
239
  //#endregion
221
240
 
222
241
  //#region Phase logic
223
- /**
224
- * @param {VaultPhase} newPhase
225
- */
242
+ /** @param {VaultPhase} newPhase */
226
243
  assignPhase(newPhase) {
227
244
  const { state } = this;
228
245
 
@@ -261,12 +278,14 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
261
278
  },
262
279
 
263
280
  /**
264
- * Update the debt balance and propagate upwards to
265
- * maintain aggregate debt and liquidation order.
281
+ * Update the debt balance and propagate upwards to maintain aggregate
282
+ * debt and liquidation order.
266
283
  *
267
- * @param {NormalizedDebt} oldDebtNormalized - prior principal and all accrued interest, normalized to the launch of the vaultManager
284
+ * @param {NormalizedDebt} oldDebtNormalized - prior principal and all
285
+ * accrued interest, normalized to the launch of the vaultManager
268
286
  * @param {Amount<'nat'>} oldCollateral - actual collateral
269
- * @param {Amount<'nat'>} newDebtActual - actual principal and all accrued interest
287
+ * @param {Amount<'nat'>} newDebtActual - actual principal and all
288
+ * accrued interest
270
289
  */
271
290
  updateDebtAccounting(oldDebtNormalized, oldCollateral, newDebtActual) {
272
291
  const { state, facets } = this;
@@ -283,8 +302,8 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
283
302
  },
284
303
 
285
304
  /**
286
- *
287
305
  * @param {ZCFSeat} seat
306
+ * @returns {Amount<'nat'>}
288
307
  */
289
308
  getCollateralAllocated(seat) {
290
309
  return seat.getAmountAllocated(
@@ -292,6 +311,10 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
292
311
  this.facets.helper.collateralBrand(),
293
312
  );
294
313
  },
314
+ /**
315
+ * @param {ZCFSeat} seat
316
+ * @returns {Amount<'nat'>}
317
+ */
295
318
  getMintedAllocated(seat) {
296
319
  return seat.getAmountAllocated(
297
320
  'Minted',
@@ -307,7 +330,6 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
307
330
  },
308
331
 
309
332
  /**
310
- *
311
333
  * @param {Amount<'nat'>} collateralAmount
312
334
  * @param {Amount<'nat'>} proposedDebt
313
335
  */
@@ -320,10 +342,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
320
342
  )} for ${q(collateralAmount)} collateral`;
321
343
  },
322
344
 
323
- /**
324
- *
325
- * @param {HolderPhase} newPhase
326
- */
345
+ /** @param {Phase} newPhase */
327
346
  getStateSnapshot(newPhase) {
328
347
  const { state, facets } = this;
329
348
 
@@ -338,9 +357,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
338
357
  });
339
358
  },
340
359
 
341
- /**
342
- * call this whenever anything changes!
343
- */
360
+ /** call this whenever anything changes! */
344
361
  updateUiState() {
345
362
  const { state, facets } = this;
346
363
  const { outerUpdater } = state;
@@ -368,9 +385,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
368
385
  }
369
386
  },
370
387
 
371
- /**
372
- * @param {ZCFSeat} seat
373
- */
388
+ /** @param {ZCFSeat} seat */
374
389
  async closeHook(seat) {
375
390
  const { state, facets } = this;
376
391
 
@@ -440,11 +455,11 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
440
455
  },
441
456
 
442
457
  /**
443
- * Calculate the fee, the amount to mint and the resulting debt.
444
- * The give and the want together reflect a delta, where typically
445
- * one is zero because they come from the gave/want of an offer
446
- * proposal. If the `want` is zero, the `fee` will also be zero,
447
- * so the simple math works.
458
+ * Calculate the fee, the amount to mint and the resulting debt. The
459
+ * give and the want together reflect a delta, where typically one is
460
+ * zero because they come from the gave/want of an offer proposal. If
461
+ * the `want` is zero, the `fee` will also be zero, so the simple math
462
+ * works.
448
463
  *
449
464
  * @param {Amount<'nat'>} currentDebt
450
465
  * @param {Amount<'nat'>} giveAmount
@@ -522,7 +537,6 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
522
537
  },
523
538
 
524
539
  /**
525
- *
526
540
  * @param {ZCFSeat} clientSeat
527
541
  * @param {FullProposal} fp
528
542
  * @param {ReturnType<typeof calculateDebtCosts>} costs
@@ -543,7 +557,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
543
557
 
544
558
  const giveMintedTaken = AmountMath.subtract(fp.give.Minted, surplus);
545
559
 
546
- /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */
560
+ /** @type {TransferPart[]} */
547
561
  const transfers = harden([
548
562
  [clientSeat, vaultSeat, { Collateral: fp.give.Collateral }],
549
563
  [vaultSeat, clientSeat, { Collateral: fp.want.Collateral }],
@@ -568,7 +582,6 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
568
582
  },
569
583
 
570
584
  /**
571
- *
572
585
  * @param {ZCFSeat} seat
573
586
  * @returns {VaultKit}
574
587
  */
@@ -579,7 +592,6 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
579
592
  helper.assertCloseable();
580
593
  seat.exit();
581
594
 
582
- // eslint-disable-next-line no-use-before-define
583
595
  const vaultKit = makeVaultKit(self, state.storageNode);
584
596
  state.outerUpdater = vaultKit.vaultUpdater;
585
597
  helper.updateUiState();
@@ -669,9 +681,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
669
681
  return vaultKit;
670
682
  },
671
683
 
672
- /**
673
- * Called by manager at start of liquidation.
674
- */
684
+ /** Called by manager at start of liquidation. */
675
685
  liquidating() {
676
686
  const { facets } = this;
677
687
 
@@ -681,8 +691,8 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
681
691
  },
682
692
 
683
693
  /**
684
- * Called by manager at end of liquidation, at which point all debts have been
685
- * covered.
694
+ * Called by manager at end of liquidation, at which point all debts
695
+ * have been covered.
686
696
  */
687
697
  liquidated() {
688
698
  const { facets } = this;
@@ -774,9 +784,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
774
784
  );
775
785
  },
776
786
 
777
- /**
778
- * @returns {Promise<Invitation>}
779
- */
787
+ /** @returns {Promise<Invitation<VaultKit>>} */
780
788
  makeTransferInvitation() {
781
789
  const { state, facets } = this;
782
790
  const { outerUpdater } = state;
@@ -808,10 +816,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
808
816
 
809
817
  // for status/debugging
810
818
 
811
- /**
812
- *
813
- * @returns {Amount<'nat'>}
814
- */
819
+ /** @returns {Amount<'nat'>} */
815
820
  getCollateralAmount() {
816
821
  const { state, facets } = this;
817
822
  const { vaultSeat } = state;
@@ -825,15 +830,15 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
825
830
  /**
826
831
  * The actual current debt, including accrued interest.
827
832
  *
828
- * This looks like a simple getter but it does a lot of the heavy lifting for
829
- * interest accrual. Rather than updating all records when interest accrues,
830
- * the vault manager updates just its rolling compounded interest. Here we
831
- * calculate what the current debt is given what's recorded in this vault and
832
- * what interest has compounded since this vault record was written.
833
- *
834
- * @see getNormalizedDebt
833
+ * This looks like a simple getter but it does a lot of the heavy
834
+ * lifting for interest accrual. Rather than updating all records when
835
+ * interest accrues, the vault manager updates just its rolling
836
+ * compounded interest. Here we calculate what the current debt is given
837
+ * what's recorded in this vault and what interest has compounded since
838
+ * this vault record was written.
835
839
  *
836
840
  * @returns {Amount<'nat'>}
841
+ * @see getNormalizedDebt
837
842
  */
838
843
  getCurrentDebt() {
839
844
  const { state } = this;
@@ -845,14 +850,15 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
845
850
  },
846
851
 
847
852
  /**
848
- * The normalization puts all debts on a common time-independent scale since
849
- * the launch of this vault manager. This allows the manager to order vaults
850
- * by their debt-to-collateral ratios without having to mutate the debts as
851
- * the interest accrues.
853
+ * The normalization puts all debts on a common time-independent scale
854
+ * since the launch of this vault manager. This allows the manager to
855
+ * order vaults by their debt-to-collateral ratios without having to
856
+ * mutate the debts as the interest accrues.
852
857
  *
858
+ * @returns {import('./storeUtils.js').NormalizedDebt} as if the vault
859
+ * was open at the launch of this manager, before any interest
860
+ * accrued
853
861
  * @see getActualDebAmount
854
- *
855
- * @returns {import('./storeUtils.js').NormalizedDebt} as if the vault was open at the launch of this manager, before any interest accrued
856
862
  */
857
863
  getNormalizedDebt() {
858
864
  const { state } = this;