@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
@@ -0,0 +1,23 @@
1
+ export function setWakeupsForNextAuction(auctioneerPublicFacet: ERef<import("../auction/auctioneer.js").AuctioneerPublicFacet>, timer: ERef<TimerService>, priceLockWaker: TimerWaker, liquidationWaker: TimerWaker, reschedulerWaker: TimerWaker): Promise<void>;
2
+ export function liquidationResults(debt: Amount<"nat">, minted: Amount<"nat">): {
3
+ overage: Amount<"nat">;
4
+ shortfall: Amount<"nat">;
5
+ };
6
+ export function watchForGovernanceChange(auctioneerPublicFacet: ERef<import("../auction/auctioneer.js").AuctioneerPublicFacet>, timer: ERef<TimerService>, reschedulerWaker: TimerWaker): void;
7
+ export function getLiquidatableVaults(zcf: ZCF, collateralizationDetails: {
8
+ quote: PriceQuote;
9
+ interest: Ratio;
10
+ margin: Ratio;
11
+ }, prioritizedVaults: ReturnType<typeof import("./prioritizedVaults.js").makePrioritizedVaults>, liquidatingVaults: SetStore<Vault>, debtBrand: Brand<"nat">, collateralBrand: Brand<"nat">): {
12
+ vaultData: MapStore<Vault, {
13
+ collateralAmount: Amount<"nat">;
14
+ debtAmount: Amount<"nat">;
15
+ }>;
16
+ totalDebt: Amount<"nat">;
17
+ totalCollateral: Amount<"nat">;
18
+ liqSeat: ZCFSeat;
19
+ };
20
+ import type { TimerService } from '@agoric/time';
21
+ import type { TimerWaker } from '@agoric/time';
22
+ import type { PriceQuote } from '@agoric/zoe/tools/types.js';
23
+ //# sourceMappingURL=liquidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquidation.d.ts","sourceRoot":"","sources":["liquidation.js"],"names":[],"mappings":"AAoJO,gEAPI,IAAI,CAAC,OAAO,0BAA0B,EAAE,qBAAqB,CAAC,SAC9D,IAAI,CAAC,YAAY,CAAC,kBAClB,UAAU,oBACV,UAAU,oBACV,UAAU,GACR,OAAO,CAAC,IAAI,CAAC,CAqCzB;AAQM,yCAJI,MAAM,CAAC,KAAK,CAAC,UACb,MAAM,CAAC,KAAK,CAAC,GACX;IAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;CAAE,CAYhE;AAWM,gEALI,IAAI,CAAC,OAAO,0BAA0B,EAAE,qBAAqB,CAAC,SAC9D,IAAI,CAAC,YAAY,CAAC,oBAClB,UAAU,GACR,IAAI,CA0BhB;AAwBM,2CArBI,GAAG,4BAEX;IAA6C,KAAK,EAA1C,UAAU;IACsB,QAAQ,EAAxC,KAAK;IAC2B,MAAM,EAAtC,KAAK;CACb,qBAAQ,UAAU,CACpB,cAAkB,wBAAwB,EAAE,qBAAqB,CAC9D,qBACO,QAAQ,CAAC,KAAK,CAAC,aACf,KAAK,CAAC,KAAK,CAAC,mBACZ,KAAK,CAAC,KAAK,CAAC,GACV;IACR,SAAS,EAAE,QAAQ,CACvB,KAAW,EACX;QAAQ,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;KAAE,CAC/D,CAAC;IACF,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;CAClB,CAiDH;kCArS+B,cAAc;gCAChB,cAAc;gCAGkD,4BAA4B"}
@@ -5,7 +5,6 @@ import { makeTracer } from '@agoric/internal';
5
5
  import { observeIteration, subscribeEach } from '@agoric/notifier';
6
6
  import { makeScalarMapStore } from '@agoric/store';
7
7
  import { TimeMath } from '@agoric/time';
8
- import { atomicRearrange } from '@agoric/zoe/src/contractSupport/index.js';
9
8
  import { E } from '@endo/eventual-send';
10
9
 
11
10
  import { AUCTION_START_DELAY, PRICE_LOCK_PERIOD } from '../auction/params.js';
@@ -13,16 +12,18 @@ import { makeCancelTokenMaker } from '../auction/util.js';
13
12
 
14
13
  const trace = makeTracer('LIQ');
15
14
 
16
- /** @typedef {import('@agoric/time/src/types').TimerService} TimerService */
17
- /** @typedef {import('@agoric/time/src/types').TimerWaker} TimerWaker */
18
- /** @typedef {import('@agoric/time/src/types').CancelToken} CancelToken */
19
- /** @typedef {import('@agoric/time/src/types').RelativeTimeRecord} RelativeTimeRecord */
15
+ /** @import {TimerService} from '@agoric/time' */
16
+ /** @import {TimerWaker} from '@agoric/time' */
17
+ /** @import {CancelToken} from '@agoric/time' */
18
+ /** @import {RelativeTimeRecord} from '@agoric/time' */
19
+ /** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
20
20
 
21
21
  const makeCancelToken = makeCancelTokenMaker('liq');
22
22
 
23
23
  /**
24
24
  * This will normally be set. If the schedule goes sideways, we'll unschedule
25
- * all events and unset it. When auction params are changed, we'll restart the schedule
25
+ * all events and unset it. When auction params are changed, we'll restart the
26
+ * schedule
26
27
  *
27
28
  * @type {object | undefined}
28
29
  */
@@ -47,15 +48,16 @@ const cancelWakeups = timer => {
47
48
  };
48
49
 
49
50
  /**
50
- * Schedule wakeups for the *next* auction round.
51
+ * Schedule wakeups for the _next_ auction round.
51
52
  *
52
- * In practice, there are these cases to handle (with N as "live" and N+1 is "next"):
53
+ * In practice, there are these cases to handle (with N as "live" and N+1 is
54
+ * "next"):
53
55
  *
54
- * | when (now within the range) | what |
55
- * | -------------------------------- | --------------------------------------- |
56
- * | [start N, nominalStart N+1] | good: schedule normally the three wakers|
57
- * | (nominalStart N+1, endTime N+1] | recover: skip round N+1 and schedule N+2|
58
- * | (endTime N+1, ∞) | give up: wait for repair by governance |
56
+ * | when (now within the range) | what |
57
+ * | ------------------------------- | ---------------------------------------- |
58
+ * | [start N, nominalStart N+1] | good: schedule normally the three wakers |
59
+ * | (nominalStart N+1, endTime N+1] | recover: skip round N+1 and schedule N+2 |
60
+ * | (endTime N+1, ∞) | give up: wait for repair by governance |
59
61
  *
60
62
  * @param {object} opts
61
63
  * @param {ERef<TimerService>} opts.timer
@@ -63,7 +65,7 @@ const cancelWakeups = timer => {
63
65
  * @param {TimerWaker} opts.liquidationWaker
64
66
  * @param {TimerWaker} opts.reschedulerWaker
65
67
  * @param {import('../auction/scheduler.js').Schedule} opts.nextAuctionSchedule
66
- * @param {import('@agoric/time/src/types').TimestampRecord} opts.now
68
+ * @param {import('@agoric/time').TimestampRecord} opts.now
67
69
  * @param {ParamStateRecord} opts.params
68
70
  * @returns {void}
69
71
  */
@@ -132,7 +134,7 @@ const setWakeups = ({
132
134
  };
133
135
 
134
136
  /**
135
- * Schedule wakeups for the *next* auction round.
137
+ * Schedule wakeups for the _next_ auction round.
136
138
  *
137
139
  * Called by vaultDirector's resetWakeupsForNextAuction at start() and every
138
140
  * time there's a "reschedule" wakeup.
@@ -185,7 +187,7 @@ harden(setWakeupsForNextAuction);
185
187
  /**
186
188
  * @param {Amount<'nat'>} debt
187
189
  * @param {Amount<'nat'>} minted
188
- * @returns {{ overage: Amount<'nat'>, shortfall: Amount<'nat'>}}
190
+ * @returns {{ overage: Amount<'nat'>; shortfall: Amount<'nat'> }}
189
191
  */
190
192
  export const liquidationResults = (debt, minted) => {
191
193
  if (AmountMath.isEmpty(minted)) {
@@ -240,15 +242,21 @@ export const watchForGovernanceChange = (
240
242
  * @param {PriceQuote} collateralizationDetails.quote
241
243
  * @param {Ratio} collateralizationDetails.interest
242
244
  * @param {Ratio} collateralizationDetails.margin
243
- * @param {ReturnType<typeof import('./prioritizedVaults.js').makePrioritizedVaults>} prioritizedVaults
245
+ * @param {ReturnType<
246
+ * typeof import('./prioritizedVaults.js').makePrioritizedVaults
247
+ * >} prioritizedVaults
244
248
  * @param {SetStore<Vault>} liquidatingVaults
245
249
  * @param {Brand<'nat'>} debtBrand
246
250
  * @param {Brand<'nat'>} collateralBrand
247
251
  * @returns {{
248
- * vaultData: MapStore<Vault, { collateralAmount: Amount<'nat'>, debtAmount: Amount<'nat'>}>,
249
- * totalDebt: Amount<'nat'>,
250
- * totalCollateral: Amount<'nat'>,
251
- * liqSeat: ZCFSeat}}
252
+ * vaultData: MapStore<
253
+ * Vault,
254
+ * { collateralAmount: Amount<'nat'>; debtAmount: Amount<'nat'> }
255
+ * >;
256
+ * totalDebt: Amount<'nat'>;
257
+ * totalCollateral: Amount<'nat'>;
258
+ * liqSeat: ZCFSeat;
259
+ * }}
252
260
  */
253
261
  export const getLiquidatableVaults = (
254
262
  zcf,
@@ -261,13 +269,18 @@ export const getLiquidatableVaults = (
261
269
  const vaultsToLiquidate = prioritizedVaults.removeVaultsBelow(
262
270
  collateralizationDetails,
263
271
  );
264
- /** @type {MapStore<Vault, { collateralAmount: Amount<'nat'>, debtAmount: Amount<'nat'>}>} */
272
+ /**
273
+ * @type {MapStore<
274
+ * Vault,
275
+ * { collateralAmount: Amount<'nat'>; debtAmount: Amount<'nat'> }
276
+ * >}
277
+ */
265
278
  const vaultData = makeScalarMapStore();
266
279
 
267
280
  const { zcfSeat: liqSeat } = zcf.makeEmptySeatKit();
268
281
  let totalDebt = AmountMath.makeEmpty(debtBrand);
269
282
  let totalCollateral = AmountMath.makeEmpty(collateralBrand);
270
- /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */
283
+ /** @type {TransferPart[]} */
271
284
  const transfers = [];
272
285
 
273
286
  for (const vault of vaultsToLiquidate.values()) {
@@ -288,7 +301,7 @@ export const getLiquidatableVaults = (
288
301
  }
289
302
 
290
303
  if (transfers.length > 0) {
291
- atomicRearrange(zcf, harden(transfers));
304
+ zcf.atomicRearrange(harden(transfers));
292
305
  }
293
306
 
294
307
  return { vaultData, totalDebt, totalCollateral, liqSeat };
@@ -0,0 +1,11 @@
1
+ export function calculateMinimumCollateralization(liquidationMargin: Ratio, liquidationPadding: Ratio): Ratio;
2
+ export function minimumPrice(quoteA: PriceQuote, quoteB?: PriceQuote | undefined): Ratio;
3
+ export function maxDebtForVault(quoteAmount: PriceQuote, liquidationMargin: Ratio, liquidationPadding: Ratio): Amount<"nat">;
4
+ export function calculateDebtCosts(currentDebt: Amount<"nat">, give: Amount<"nat">, want: Amount<"nat">, debtFee: Ratio): {
5
+ newDebt: import("@agoric/ertp").NatAmount;
6
+ toMint: import("@agoric/ertp").NatAmount;
7
+ fee: import("@agoric/ertp").NatAmount;
8
+ surplus: import("@agoric/ertp").NatAmount;
9
+ };
10
+ import type { PriceQuote } from '@agoric/zoe/tools/types.js';
11
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["math.js"],"names":[],"mappings":"AA4BO,qEAJI,KAAK,sBACL,KAAK,GACH,KAAK,CAKmC;AAS9C,qCAJI,UAAU,oCAER,KAAK,CAajB;AAYM,6CALI,UAAU,qBACV,KAAK,sBACL,KAAK,GACH,MAAM,CAAC,KAAK,CAAC,CAczB;AAaM,gDALI,MAAM,CAAC,KAAK,CAAC,QACb,MAAM,CAAC,KAAK,CAAC,QACb,MAAM,CAAC,KAAK,CAAC,WACb,KAAK;;;;;EASf;gCA7E6F,4BAA4B"}
@@ -1,8 +1,8 @@
1
1
  // @jessie-check
2
2
 
3
3
  /**
4
- * @file calculations specific to the Vault Factory contract
5
- * See also ../interest-math.js
4
+ * @file calculations specific to the Vault Factory contract See also
5
+ * ../interest-math.js
6
6
  */
7
7
 
8
8
  import { AmountMath } from '@agoric/ertp';
@@ -16,9 +16,11 @@ import {
16
16
  import { priceFrom } from '../auction/util.js';
17
17
  import { addSubtract } from '../contractSupport.js';
18
18
 
19
+ /** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
20
+
19
21
  /**
20
- * Calculate the minimum collateralization given the liquidation margin and the "padding"
21
- * from that liquidation threshold.
22
+ * Calculate the minimum collateralization given the liquidation margin and the
23
+ * "padding" from that liquidation threshold.
22
24
  *
23
25
  * @param {Ratio} liquidationMargin
24
26
  * @param {Ratio} liquidationPadding
@@ -74,11 +76,10 @@ export const maxDebtForVault = (
74
76
  };
75
77
 
76
78
  /**
77
- * Calculate the fee, the amount to mint and the resulting debt.
78
- * The give and the want together reflect a delta, where typically
79
- * one is zero because they come from the gave/want of an offer
80
- * proposal. If the `want` is zero, the `fee` will also be zero,
81
- * so the simple math works.
79
+ * Calculate the fee, the amount to mint and the resulting debt. The give and
80
+ * the want together reflect a delta, where typically one is zero because they
81
+ * come from the gave/want of an offer proposal. If the `want` is zero, the
82
+ * `fee` will also be zero, so the simple math works.
82
83
  *
83
84
  * @param {Amount<'nat'>} currentDebt
84
85
  * @param {Amount<'nat'>} give excess of currentDebt is returned in 'surplus'
@@ -0,0 +1,93 @@
1
+ export function makeOrderedVaultStore(store: MapStore<string, Vault>): {
2
+ addVault: (vaultId: string, vault: Vault) => string;
3
+ removeByKey: (key: string) => Vault;
4
+ has: (key: string) => boolean;
5
+ keys: (keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<string>;
6
+ entries: (keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<[string, import("@endo/exo").Guarded<{
7
+ getVaultSeat(): ZCFSeat;
8
+ initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
9
+ publicSubscribers: {
10
+ vault: {
11
+ description: string;
12
+ subscriber: globalThis.Subscriber<VaultNotification>;
13
+ storagePath: Promise<string>;
14
+ };
15
+ };
16
+ invitationMakers: import("@endo/exo").Guarded<{
17
+ AdjustBalances(): Promise<Invitation<string, undefined>>;
18
+ CloseVault(): Promise<Invitation<string, undefined>>;
19
+ TransferVault(): Promise<Invitation<any, undefined>>;
20
+ }>;
21
+ vault: import("@endo/exo").Guarded<{
22
+ getPublicTopics(): {
23
+ vault: {
24
+ description: string;
25
+ subscriber: globalThis.Subscriber<VaultNotification>;
26
+ storagePath: Promise<string>;
27
+ };
28
+ };
29
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
30
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
31
+ makeTransferInvitation(): Promise<Invitation<any, undefined>>;
32
+ getCollateralAmount(): import("@agoric/ertp").NatAmount;
33
+ getCurrentDebt(): import("@agoric/ertp").NatAmount;
34
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
35
+ }>;
36
+ vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
37
+ }>;
38
+ liquidating(): void;
39
+ liquidated(): void;
40
+ abortLiquidation(): string;
41
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
42
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
43
+ makeTransferInvitation(): Promise<Invitation<VaultKit>>;
44
+ getCollateralAmount(): Amount<"nat">;
45
+ getCurrentDebt(): Amount<"nat">;
46
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
47
+ }>]>;
48
+ getSize: (keyPatt?: Pattern, valuePatt?: Pattern) => number;
49
+ values: (keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<import("@endo/exo").Guarded<{
50
+ getVaultSeat(): ZCFSeat;
51
+ initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
52
+ publicSubscribers: {
53
+ vault: {
54
+ description: string;
55
+ subscriber: globalThis.Subscriber<VaultNotification>;
56
+ storagePath: Promise<string>;
57
+ };
58
+ };
59
+ invitationMakers: import("@endo/exo").Guarded<{
60
+ AdjustBalances(): Promise<Invitation<string, undefined>>;
61
+ CloseVault(): Promise<Invitation<string, undefined>>;
62
+ TransferVault(): Promise<Invitation<any, undefined>>;
63
+ }>;
64
+ vault: import("@endo/exo").Guarded<{
65
+ getPublicTopics(): {
66
+ vault: {
67
+ description: string;
68
+ subscriber: globalThis.Subscriber<VaultNotification>;
69
+ storagePath: Promise<string>;
70
+ };
71
+ };
72
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
73
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
74
+ makeTransferInvitation(): Promise<Invitation<any, undefined>>;
75
+ getCollateralAmount(): import("@agoric/ertp").NatAmount;
76
+ getCurrentDebt(): import("@agoric/ertp").NatAmount;
77
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
78
+ }>;
79
+ vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
80
+ }>;
81
+ liquidating(): void;
82
+ liquidated(): void;
83
+ abortLiquidation(): string;
84
+ makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
85
+ makeCloseInvitation(): Promise<Invitation<string, undefined>>;
86
+ makeTransferInvitation(): Promise<Invitation<VaultKit>>;
87
+ getCollateralAmount(): Amount<"nat">;
88
+ getCurrentDebt(): Amount<"nat">;
89
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
90
+ }>>;
91
+ };
92
+ import type { Vault } from './vault.js';
93
+ //# sourceMappingURL=orderedVaultStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderedVaultStore.d.ts","sourceRoot":"","sources":["orderedVaultStore.js"],"names":[],"mappings":"AAiBO,6CADK,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;wBAGtB,MAAM,SACN,KAAK;uBAWL,MAAM,KACJ,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAkCgt1B,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EADpv1B;2BApDwB,YAAY"}
@@ -3,22 +3,20 @@ import { fromVaultKey, toVaultKey } from './storeUtils.js';
3
3
  /**
4
4
  * Used by prioritizedVaults to wrap the Collections API for this use case.
5
5
  *
6
- * Designed to be replaceable by naked Collections API when composite keys are available.
6
+ * Designed to be replaceable by naked Collections API when composite keys are
7
+ * available.
7
8
  *
8
- * In this module debts are encoded as the inverse quotient (collateral over debt) so that
9
- * greater collateralization sorts after lower. (Higher debt-to-collateral come
10
- * first.)
9
+ * In this module debts are encoded as the inverse quotient (collateral over
10
+ * debt) so that greater collateralization sorts after lower. (Higher
11
+ * debt-to-collateral come first.)
11
12
  */
12
13
 
13
- /** @typedef {import('./vault').Vault} Vault */
14
- /** @typedef {import('./storeUtils').CompositeKey} CompositeKey */
14
+ /** @import {Vault} from './vault.js' */
15
+ /** @import {CompositeKey} from './storeUtils.js' */
15
16
 
16
- /**
17
- * @param {MapStore<string, Vault>} store
18
- */
17
+ /** @param {MapStore<string, Vault>} store */
19
18
  export const makeOrderedVaultStore = store => {
20
19
  /**
21
- *
22
20
  * @param {string} vaultId
23
21
  * @param {Vault} vault
24
22
  */
@@ -31,7 +29,6 @@ export const makeOrderedVaultStore = store => {
31
29
  };
32
30
 
33
31
  /**
34
- *
35
32
  * @param {string} key
36
33
  * @returns {Vault}
37
34
  */
@@ -0,0 +1,140 @@
1
+ /** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
2
+ export const CHARGING_PERIOD_KEY: "ChargingPeriod";
3
+ export const RECORDING_PERIOD_KEY: "RecordingPeriod";
4
+ export const DEBT_LIMIT_KEY: "DebtLimit";
5
+ export const LIQUIDATION_MARGIN_KEY: "LiquidationMargin";
6
+ export const LIQUIDATION_PADDING_KEY: "LiquidationPadding";
7
+ export const LIQUIDATION_PENALTY_KEY: "LiquidationPenalty";
8
+ export const INTEREST_RATE_KEY: "InterestRate";
9
+ export const MINT_FEE_KEY: "MintFee";
10
+ export const MIN_INITIAL_DEBT_KEY: "MinInitialDebt";
11
+ export const SHORTFALL_INVITATION_KEY: "ShortfallInvitation";
12
+ export const REFERENCED_UI_KEY: "ReferencedUI";
13
+ export namespace vaultDirectorParamTypes {
14
+ let MinInitialDebt: "amount";
15
+ let ChargingPeriod: "nat";
16
+ let RecordingPeriod: "nat";
17
+ let ReferencedUI: "string";
18
+ }
19
+ export function makeVaultParamManager(publisherKit: import("@agoric/notifier").StoredPublisherKit<GovernanceSubscriptionState>, { debtLimit, interestRate, liquidationMargin, liquidationPadding, liquidationPenalty, mintFee, }: VaultManagerParamValues): import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
20
+ DebtLimit: "amount";
21
+ InterestRate: "ratio";
22
+ LiquidationPadding: "ratio";
23
+ LiquidationMargin: "ratio";
24
+ LiquidationPenalty: "ratio";
25
+ MintFee: "ratio";
26
+ }>;
27
+ /** @typedef {ReturnType<typeof makeVaultParamManager>} VaultParamManager */
28
+ export const vaultParamPattern: import("@endo/patterns").Matcher;
29
+ export function makeGovernedTerms({ bootstrapPaymentValue, electorateInvitationAmount, interestTiming, minInitialDebt, priceAuthority, reservePublicFacet, timer, shortfallInvitationAmount, referencedUi, }: {
30
+ electorateInvitationAmount: Amount<"set">;
31
+ minInitialDebt: Amount<"nat">;
32
+ bootstrapPaymentValue: bigint;
33
+ priceAuthority: ERef<PriceAuthority>;
34
+ timer: ERef<import("@agoric/time").TimerService>;
35
+ reservePublicFacet: AssetReservePublicFacet;
36
+ interestTiming: InterestTiming;
37
+ shortfallInvitationAmount: Amount<"set">;
38
+ referencedUi?: string;
39
+ }): {
40
+ priceAuthority: globalThis.ERef<PriceAuthority>;
41
+ reservePublicFacet: globalThis.GovernedPublicFacet<import("@endo/exo").Guarded<{
42
+ makeAddCollateralInvitation(): Promise<Invitation<string, never>>;
43
+ getPublicTopics(): {
44
+ metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("../reserve/assetReserveKit.js").MetricsNotification>;
45
+ };
46
+ }>>;
47
+ timerService: globalThis.ERef<import("@agoric/time").TimerService>;
48
+ governedParams: {
49
+ Electorate: {
50
+ type: "invitation";
51
+ value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
52
+ };
53
+ MinInitialDebt: {
54
+ type: "amount";
55
+ value: import("@agoric/ertp").NatAmount;
56
+ };
57
+ ShortfallInvitation: {
58
+ type: "invitation";
59
+ value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
60
+ };
61
+ ReferencedUI: {
62
+ type: "string";
63
+ value: string;
64
+ };
65
+ ChargingPeriod: {
66
+ type: "nat";
67
+ value: bigint;
68
+ };
69
+ RecordingPeriod: {
70
+ type: "nat";
71
+ value: bigint;
72
+ };
73
+ };
74
+ bootstrapPaymentValue: bigint;
75
+ };
76
+ export function provideVaultParamManagers(baggage: import("@agoric/vat-data").Baggage, marshaller: ERef<Marshaller>, managerParamOverrides: Record<string, VaultManagerParamOverrides>): {
77
+ /**
78
+ * @param {Brand} brand
79
+ * @param {StorageNode} storageNode
80
+ * @param {VaultManagerParamValues} initialParamValues
81
+ */
82
+ addParamManager(brand: Brand, storageNode: StorageNode, initialParamValues: VaultManagerParamValues): import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
83
+ DebtLimit: "amount";
84
+ InterestRate: "ratio";
85
+ LiquidationPadding: "ratio";
86
+ LiquidationMargin: "ratio";
87
+ LiquidationPenalty: "ratio";
88
+ MintFee: "ratio";
89
+ }>;
90
+ /** @param {Brand} brand */
91
+ get(brand: Brand): import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
92
+ DebtLimit: "amount";
93
+ InterestRate: "ratio";
94
+ LiquidationPadding: "ratio";
95
+ LiquidationMargin: "ratio";
96
+ LiquidationPenalty: "ratio";
97
+ MintFee: "ratio";
98
+ }>;
99
+ };
100
+ export type VaultDirectorParams = import("@agoric/governance/src/contractGovernance/typedParamManager.js").ParamTypesMapFromRecord<ReturnType<typeof makeVaultDirectorParams>>;
101
+ export type VaultParamManager = ReturnType<typeof makeVaultParamManager>;
102
+ export type VaultManagerParamOverrides = VaultManagerParamValues & {
103
+ brand: Brand;
104
+ };
105
+ import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
106
+ /**
107
+ * @param {Amount<'set'>} electorateInvitationAmount
108
+ * @param {Amount<'nat'>} minInitialDebt
109
+ * @param {Amount<'set'>} shortfallInvitationAmount
110
+ * @param {string} referencedUi
111
+ * @param {InterestTiming} interestTiming
112
+ */
113
+ declare function makeVaultDirectorParams(electorateInvitationAmount: Amount<"set">, minInitialDebt: Amount<"nat">, shortfallInvitationAmount: Amount<"set">, referencedUi: string, interestTiming: InterestTiming): {
114
+ Electorate: {
115
+ type: "invitation";
116
+ value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
117
+ };
118
+ MinInitialDebt: {
119
+ type: "amount";
120
+ value: import("@agoric/ertp").NatAmount;
121
+ };
122
+ ShortfallInvitation: {
123
+ type: "invitation";
124
+ value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
125
+ };
126
+ ReferencedUI: {
127
+ type: "string";
128
+ value: string;
129
+ };
130
+ ChargingPeriod: {
131
+ type: "nat";
132
+ value: bigint;
133
+ };
134
+ RecordingPeriod: {
135
+ type: "nat";
136
+ value: bigint;
137
+ };
138
+ };
139
+ export {};
140
+ //# sourceMappingURL=params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.d.ts","sourceRoot":"","sources":["params.js"],"names":[],"mappings":"AAiBA,8HAA8H;AAE9H,mDAAoD;AACpD,qDAAsD;AAEtD,yCAA0C;AAC1C,yDAA0D;AAC1D,2DAA4D;AAC5D,2DAA4D;AAC5D,+CAAgD;AAChD,qCAAsC;AACtC,oDAAqD;AACrD,6DAA8D;AAC9D,+CAAgD;;;;;;;AAkEzC,oDAHI,OAAO,kBAAkB,EAAE,kBAAkB,CAAC,2BAA2B,CAAC,oGAC1E,uBAAuB;;;;;;;GAoB9B;AACJ,4EAA4E;AAE5E,iEAYE;AAeK,8MAZI;IACN,0BAA0B,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,KAAK,EAAE,IAAI,CAAC,OAAO,cAAc,EAAE,YAAY,CAAC,CAAC;IACjD,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,cAAc,EAAE,cAAc,CAAC;IAC/B,yBAAyB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BH;AAeM,mDAJI,OAAO,kBAAkB,EAAE,OAAO,cAClC,IAAI,CAAC,UAAU,CAAC,yBAChB,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC;IA+CjD;;;;OAIG;2BAHQ,KAAK,eACL,WAAW,sBACX,uBAAuB;;;;;;;;IAOlC,2BAA2B;eAAf,KAAK;;;;;;;;EAKpB;kCAhKY,OAAO,gEAAgE,EAAE,uBAAuB,CACtG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAC3C;gCA8BQ,UAAU,CAAC,OAAO,qBAAqB,CAAC;yCAwDxC,uBAAuB,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE;oCA1JsC,4BAA4B;AAyB1H;;;;;;GAMG;AACH,qEANW,MAAM,CAAC,KAAK,CAAC,kBACb,MAAM,CAAC,KAAK,CAAC,6BACb,MAAM,CAAC,KAAK,CAAC,gBACb,MAAM,kBACN,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;EAgCxB"}
@@ -1,6 +1,6 @@
1
1
  // @jessie-check
2
2
 
3
- import './types.js';
3
+ /// <reference path="./types-ambient.js" />
4
4
 
5
5
  import {
6
6
  CONTRACT_ELECTORATE,
@@ -12,8 +12,11 @@ import { M, makeScalarMapStore } from '@agoric/store';
12
12
  import { TimeMath } from '@agoric/time';
13
13
  import { provideDurableMapStore } from '@agoric/vat-data';
14
14
  import { subtractRatios } from '@agoric/zoe/src/contractSupport/ratio.js';
15
+ import { makeTracer } from '@agoric/internal/src/index.js';
15
16
  import { amountPattern, ratioPattern } from '../contractSupport.js';
16
17
 
18
+ /** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
19
+
17
20
  export const CHARGING_PERIOD_KEY = 'ChargingPeriod';
18
21
  export const RECORDING_PERIOD_KEY = 'RecordingPeriod';
19
22
 
@@ -35,6 +38,8 @@ export const vaultDirectorParamTypes = {
35
38
  };
36
39
  harden(vaultDirectorParamTypes);
37
40
 
41
+ const trace = makeTracer('Vault Params');
42
+
38
43
  /**
39
44
  * @param {Amount<'set'>} electorateInvitationAmount
40
45
  * @param {Amount<'nat'>} minInitialDebt
@@ -75,7 +80,11 @@ const makeVaultDirectorParams = (
75
80
  };
76
81
  harden(makeVaultDirectorParams);
77
82
 
78
- /** @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager').ParamTypesMapFromRecord<ReturnType<typeof makeVaultDirectorParams>>} VaultDirectorParams */
83
+ /**
84
+ * @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMapFromRecord<
85
+ * ReturnType<typeof makeVaultDirectorParams>
86
+ * >} VaultDirectorParams
87
+ */
79
88
 
80
89
  /** @type {(liquidationMargin: Ratio) => Ratio} */
81
90
  const zeroRatio = liquidationMargin =>
@@ -122,20 +131,18 @@ export const vaultParamPattern = M.splitRecord(
122
131
 
123
132
  /**
124
133
  * @param {{
125
- * auctioneerPublicFacet: ERef<AuctioneerPublicFacet>,
126
- * electorateInvitationAmount: Amount<'set'>,
127
- * minInitialDebt: Amount<'nat'>,
128
- * bootstrapPaymentValue: bigint,
129
- * priceAuthority: ERef<PriceAuthority>,
130
- * timer: ERef<import('@agoric/time/src/types').TimerService>,
131
- * reservePublicFacet: AssetReservePublicFacet,
132
- * interestTiming: InterestTiming,
133
- * shortfallInvitationAmount: Amount<'set'>,
134
- * referencedUi?: string,
134
+ * electorateInvitationAmount: Amount<'set'>;
135
+ * minInitialDebt: Amount<'nat'>;
136
+ * bootstrapPaymentValue: bigint;
137
+ * priceAuthority: ERef<PriceAuthority>;
138
+ * timer: ERef<import('@agoric/time').TimerService>;
139
+ * reservePublicFacet: AssetReservePublicFacet;
140
+ * interestTiming: InterestTiming;
141
+ * shortfallInvitationAmount: Amount<'set'>;
142
+ * referencedUi?: string;
135
143
  * }} opts
136
144
  */
137
145
  export const makeGovernedTerms = ({
138
- auctioneerPublicFacet,
139
146
  bootstrapPaymentValue,
140
147
  electorateInvitationAmount,
141
148
  interestTiming,
@@ -147,7 +154,6 @@ export const makeGovernedTerms = ({
147
154
  referencedUi = 'NO REFERENCE',
148
155
  }) => {
149
156
  return harden({
150
- auctioneerPublicFacet,
151
157
  priceAuthority,
152
158
  reservePublicFacet,
153
159
  timerService: timer,
@@ -162,21 +168,34 @@ export const makeGovernedTerms = ({
162
168
  });
163
169
  };
164
170
  harden(makeGovernedTerms);
171
+
172
+ /** @typedef {VaultManagerParamValues & { brand: Brand }} VaultManagerParamOverrides */
173
+
165
174
  /**
166
- * Stop-gap which restores initial param values
167
- * UNTIL https://github.com/Agoric/agoric-sdk/issues/5200
175
+ * Stop-gap which restores initial param values UNTIL
176
+ * https://github.com/Agoric/agoric-sdk/issues/5200
168
177
  *
169
178
  * NB: changes from initial values will be lost upon restart
170
179
  *
171
180
  * @param {import('@agoric/vat-data').Baggage} baggage
172
181
  * @param {ERef<Marshaller>} marshaller
182
+ * @param {Record<string, VaultManagerParamOverrides>} managerParamOverrides
173
183
  */
174
- export const provideVaultParamManagers = (baggage, marshaller) => {
184
+ export const provideVaultParamManagers = (
185
+ baggage,
186
+ marshaller,
187
+ managerParamOverrides,
188
+ ) => {
175
189
  /** @type {MapStore<Brand, VaultParamManager>} */
176
190
  const managers = makeScalarMapStore();
177
191
 
178
192
  // the managers aren't durable but their arguments are
179
- /** @type {MapStore<Brand, {storageNode: StorageNode, initialParamValues: VaultManagerParamValues}>} */
193
+ /**
194
+ * @type {MapStore<
195
+ * Brand,
196
+ * { storageNode: StorageNode; initialParamValues: VaultManagerParamValues }
197
+ * >}
198
+ */
180
199
  const managerArgs = provideDurableMapStore(
181
200
  baggage,
182
201
  'vault param manager parts',
@@ -191,12 +210,23 @@ export const provideVaultParamManagers = (baggage, marshaller) => {
191
210
  return manager;
192
211
  };
193
212
 
194
- // restore from baggage
195
- [...managerArgs.entries()].map(([brand, args]) => makeManager(brand, args));
213
+ // restore from baggage, unless `managerParamOverrides` overrides.
214
+ for (const [brand, args] of managerArgs.entries()) {
215
+ const newInitial = managerParamOverrides
216
+ ? Object.values(managerParamOverrides).find(e => e.brand === brand)
217
+ : undefined;
218
+
219
+ if (newInitial) {
220
+ trace(`reviving params, override`, brand, newInitial);
221
+ makeManager(brand, { ...args, initialParamValues: newInitial });
222
+ } else {
223
+ trace(`reviving params, keeping`, brand, args.initialParamValues);
224
+ makeManager(brand, args);
225
+ }
226
+ }
196
227
 
197
228
  return {
198
229
  /**
199
- *
200
230
  * @param {Brand} brand
201
231
  * @param {StorageNode} storageNode
202
232
  * @param {VaultManagerParamValues} initialParamValues
@@ -206,9 +236,7 @@ export const provideVaultParamManagers = (baggage, marshaller) => {
206
236
  managerArgs.init(brand, args);
207
237
  return makeManager(brand, args);
208
238
  },
209
- /**
210
- * @param {Brand} brand
211
- */
239
+ /** @param {Brand} brand */
212
240
  get(brand) {
213
241
  return managers.get(brand);
214
242
  },