@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.
- package/bundles/bundle-auctioneer-js-meta.json +181 -181
- package/bundles/bundle-auctioneer.js +1 -1
- package/bundles/bundle-econCommitteeCharter-js-meta.json +129 -129
- package/bundles/bundle-econCommitteeCharter.js +1 -1
- package/bundles/bundle-feeDistributor-js-meta.json +115 -115
- package/bundles/bundle-feeDistributor.js +1 -1
- package/bundles/bundle-fluxAggregatorKit-js-meta.json +169 -169
- package/bundles/bundle-fluxAggregatorKit.js +1 -1
- package/bundles/bundle-psm-js-meta.json +167 -167
- package/bundles/bundle-psm.js +1 -1
- package/bundles/bundle-reserve-js-meta.json +169 -169
- package/bundles/bundle-reserve.js +1 -1
- package/bundles/bundle-scaledPriceAuthority-js-meta.json +142 -142
- package/bundles/bundle-scaledPriceAuthority.js +1 -1
- package/bundles/bundle-vaultFactory-js-meta.json +200 -200
- package/bundles/bundle-vaultFactory.js +1 -1
- package/package.json +17 -17
- package/scripts/deploy-contracts.js +12 -2
- package/scripts/init-core.js +5 -6
- package/scripts/manual-price-feed.js +20 -15
- package/src/auction/auctionBook.d.ts +16 -13
- package/src/auction/auctionBook.d.ts.map +1 -1
- package/src/auction/auctionBook.js +68 -56
- package/src/auction/auctioneer.d.ts.map +1 -1
- package/src/auction/auctioneer.js +54 -42
- package/src/auction/offerBook.d.ts.map +1 -1
- package/src/auction/offerBook.js +12 -11
- package/src/auction/params.d.ts +1 -1
- package/src/auction/params.d.ts.map +1 -1
- package/src/auction/params.js +3 -5
- package/src/auction/scheduleMath.d.ts.map +1 -1
- package/src/auction/scheduleMath.js +13 -13
- package/src/auction/scheduler.d.ts +4 -4
- package/src/auction/scheduler.d.ts.map +1 -1
- package/src/auction/scheduler.js +20 -20
- package/src/auction/sortedOffers.d.ts.map +1 -1
- package/src/auction/sortedOffers.js +8 -7
- package/src/auction/util.d.ts +1 -1
- package/src/auction/util.js +4 -4
- package/src/clientSupport.d.ts +65 -27
- package/src/clientSupport.d.ts.map +1 -1
- package/src/clientSupport.js +92 -34
- package/src/contractSupport.js +5 -5
- package/src/econCommitteeCharter.d.ts +4 -6
- package/src/econCommitteeCharter.d.ts.map +1 -1
- package/src/econCommitteeCharter.js +7 -11
- package/src/feeDistributor.d.ts +8 -24
- package/src/feeDistributor.d.ts.map +1 -1
- package/src/feeDistributor.js +26 -28
- package/src/interest.d.ts +1 -0
- package/src/interest.d.ts.map +1 -1
- package/src/interest.js +22 -15
- package/src/price/fluxAggregatorContract.d.ts +1 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -1
- package/src/price/fluxAggregatorContract.js +24 -19
- package/src/price/fluxAggregatorKit.d.ts +23 -18
- package/src/price/fluxAggregatorKit.d.ts.map +1 -1
- package/src/price/fluxAggregatorKit.js +47 -32
- package/src/price/priceOracleKit.d.ts +2 -8
- package/src/price/priceOracleKit.d.ts.map +1 -1
- package/src/price/priceOracleKit.js +11 -13
- package/src/price/roundsManager.d.ts +28 -46
- package/src/price/roundsManager.d.ts.map +1 -1
- package/src/price/roundsManager.js +51 -63
- package/src/proposals/committee-proposal.d.ts.map +1 -1
- package/src/proposals/committee-proposal.js +5 -9
- package/src/proposals/core-proposal.d.ts.map +1 -1
- package/src/proposals/core-proposal.js +3 -5
- package/src/proposals/econ-behaviors.d.ts.map +1 -1
- package/src/proposals/econ-behaviors.js +55 -28
- package/src/proposals/price-feed-proposal.d.ts.map +1 -1
- package/src/proposals/price-feed-proposal.js +30 -11
- package/src/proposals/startPSM.d.ts.map +1 -1
- package/src/proposals/startPSM.js +24 -17
- package/src/proposals/utils.d.ts +1 -1
- package/src/proposals/utils.d.ts.map +1 -1
- package/src/proposals/utils.js +26 -7
- package/src/psm/psm.d.ts +14 -22
- package/src/psm/psm.d.ts.map +1 -1
- package/src/psm/psm.js +34 -31
- package/src/reserve/assetReserve.d.ts.map +1 -1
- package/src/reserve/assetReserve.js +16 -13
- package/src/reserve/assetReserveKit.d.ts +14 -26
- package/src/reserve/assetReserveKit.d.ts.map +1 -1
- package/src/reserve/assetReserveKit.js +13 -21
- package/src/tokens.d.ts +3 -3
- package/src/tokens.d.ts.map +1 -1
- package/src/tokens.js +5 -5
- package/src/typeGuards.d.ts +1 -3
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +1 -3
- package/src/vaultFactory/liquidation.d.ts.map +1 -1
- package/src/vaultFactory/liquidation.js +29 -16
- package/src/vaultFactory/math.d.ts.map +1 -1
- package/src/vaultFactory/math.js +8 -9
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -1
- package/src/vaultFactory/orderedVaultStore.js +6 -9
- package/src/vaultFactory/params.d.ts +1 -4
- package/src/vaultFactory/params.d.ts.map +1 -1
- package/src/vaultFactory/params.js +24 -18
- package/src/vaultFactory/prioritizedVaults.js +2 -2
- package/src/vaultFactory/proceeds.d.ts +3 -3
- package/src/vaultFactory/proceeds.d.ts.map +1 -1
- package/src/vaultFactory/proceeds.js +24 -18
- package/src/vaultFactory/storeUtils.d.ts +2 -6
- package/src/vaultFactory/storeUtils.d.ts.map +1 -1
- package/src/vaultFactory/storeUtils.js +8 -12
- package/src/vaultFactory/types.d.ts +16 -11
- package/src/vaultFactory/types.d.ts.map +1 -1
- package/src/vaultFactory/types.js +37 -27
- package/src/vaultFactory/vault.d.ts +103 -159
- package/src/vaultFactory/vault.d.ts.map +1 -1
- package/src/vaultFactory/vault.js +84 -85
- package/src/vaultFactory/vaultDirector.d.ts +21 -43
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
- package/src/vaultFactory/vaultDirector.js +30 -40
- package/src/vaultFactory/vaultFactory.d.ts +8 -6
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
- package/src/vaultFactory/vaultFactory.js +13 -11
- package/src/vaultFactory/vaultHolder.d.ts +12 -16
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
- package/src/vaultFactory/vaultHolder.js +7 -12
- package/src/vaultFactory/vaultKit.d.ts +1 -1
- package/src/vaultFactory/vaultKit.d.ts.map +1 -1
- package/src/vaultFactory/vaultKit.js +3 -2
- package/src/vaultFactory/vaultManager.d.ts +454 -68
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +120 -110
|
@@ -22,31 +22,36 @@ const trace = makeTracer('Vault', true);
|
|
|
22
22
|
/** @typedef {import('./storeUtils.js').NormalizedDebt} NormalizedDebt */
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* @file This has most of the logic for a Vault, to borrow Minted against
|
|
25
|
+
* @file This has most of the logic for a Vault, to borrow Minted against
|
|
26
|
+
* collateral.
|
|
26
27
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
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.
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
31
|
+
* A note on naming convention:
|
|
32
|
+
*
|
|
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
|
|
44
|
-
* LIQUIDATING
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* TRANSFER
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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
|
|
50
55
|
*/
|
|
51
56
|
export const Phase = /** @type {const} */ ({
|
|
52
57
|
ACTIVE: 'active',
|
|
@@ -58,7 +63,7 @@ export const Phase = /** @type {const} */ ({
|
|
|
58
63
|
|
|
59
64
|
/**
|
|
60
65
|
* @typedef {Phase[keyof Omit<typeof Phase, 'TRANSFER'>]} VaultPhase
|
|
61
|
-
* @type {{[K in VaultPhase]:
|
|
66
|
+
* @type {{ [K in VaultPhase]: VaultPhase[] }}
|
|
62
67
|
*/
|
|
63
68
|
const validTransitions = {
|
|
64
69
|
[Phase.ACTIVE]: [Phase.LIQUIDATING, Phase.CLOSED],
|
|
@@ -72,7 +77,8 @@ const validTransitions = {
|
|
|
72
77
|
*
|
|
73
78
|
* @typedef {object} VaultNotification
|
|
74
79
|
* @property {Amount<'nat'>} locked Amount of Collateral locked
|
|
75
|
-
* @property {{debt: Amount<'nat'
|
|
80
|
+
* @property {{ debt: Amount<'nat'>; stabilityFee: Ratio }} debtSnapshot 'debt'
|
|
81
|
+
* at the point the compounded stabilityFee was 'stabilityFee'
|
|
76
82
|
* @property {HolderPhase} vaultState
|
|
77
83
|
*/
|
|
78
84
|
|
|
@@ -87,27 +93,36 @@ const validTransitions = {
|
|
|
87
93
|
* @property {MintAndTransfer} mintAndTransfer
|
|
88
94
|
* @property {(amount: Amount, seat: ZCFSeat) => void} burn
|
|
89
95
|
* @property {() => Ratio} getCompoundedStabilityFee
|
|
90
|
-
* @property {(
|
|
96
|
+
* @property {(
|
|
97
|
+
* oldDebt: import('./storeUtils.js').NormalizedDebt,
|
|
98
|
+
* oldCollateral: Amount<'nat'>,
|
|
99
|
+
* vaultId: VaultId,
|
|
100
|
+
* vaultPhase: VaultPhase,
|
|
101
|
+
* vault: Vault,
|
|
102
|
+
* ) => void} handleBalanceChange
|
|
91
103
|
* @property {() => import('./vaultManager.js').GovernedParamGetters} getGovernedParams
|
|
92
104
|
*/
|
|
93
105
|
|
|
94
106
|
/**
|
|
95
107
|
* @typedef {Readonly<{
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
108
|
+
* idInManager: VaultId;
|
|
109
|
+
* manager: VaultManager;
|
|
110
|
+
* storageNode: StorageNode;
|
|
111
|
+
* vaultSeat: ZCFSeat;
|
|
100
112
|
* }>} ImmutableState
|
|
101
113
|
*/
|
|
102
114
|
|
|
103
115
|
/**
|
|
104
|
-
* Snapshot is of the debt and compounded interest when the principal was last
|
|
116
|
+
* Snapshot is of the debt and compounded interest when the principal was last
|
|
117
|
+
* changed.
|
|
105
118
|
*
|
|
106
119
|
* @typedef {{
|
|
107
|
-
* stabilityFeeSnapshot: Ratio
|
|
108
|
-
* phase: VaultPhase
|
|
109
|
-
* debtSnapshot: Amount<'nat'
|
|
110
|
-
* outerUpdater:
|
|
120
|
+
* stabilityFeeSnapshot: Ratio;
|
|
121
|
+
* phase: VaultPhase;
|
|
122
|
+
* debtSnapshot: Amount<'nat'>;
|
|
123
|
+
* outerUpdater:
|
|
124
|
+
* | import('@agoric/zoe/src/contractSupport/recorder.js').Recorder<VaultNotification>
|
|
125
|
+
* | null;
|
|
111
126
|
* }} MutableState
|
|
112
127
|
*/
|
|
113
128
|
|
|
@@ -195,7 +210,10 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
195
210
|
return AmountMath.makeEmpty(this.facets.helper.debtBrand());
|
|
196
211
|
},
|
|
197
212
|
/**
|
|
198
|
-
* @typedef {{
|
|
213
|
+
* @typedef {{
|
|
214
|
+
* give: { Collateral: Amount<'nat'>; Minted: Amount<'nat'> };
|
|
215
|
+
* want: { Collateral: Amount<'nat'>; Minted: Amount<'nat'> };
|
|
216
|
+
* }} FullProposal
|
|
199
217
|
*/
|
|
200
218
|
/**
|
|
201
219
|
* @param {ProposalRecord} partial
|
|
@@ -220,9 +238,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
220
238
|
//#endregion
|
|
221
239
|
|
|
222
240
|
//#region Phase logic
|
|
223
|
-
/**
|
|
224
|
-
* @param {VaultPhase} newPhase
|
|
225
|
-
*/
|
|
241
|
+
/** @param {VaultPhase} newPhase */
|
|
226
242
|
assignPhase(newPhase) {
|
|
227
243
|
const { state } = this;
|
|
228
244
|
|
|
@@ -262,12 +278,14 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
262
278
|
},
|
|
263
279
|
|
|
264
280
|
/**
|
|
265
|
-
* Update the debt balance and propagate upwards to
|
|
266
|
-
*
|
|
281
|
+
* Update the debt balance and propagate upwards to maintain aggregate
|
|
282
|
+
* debt and liquidation order.
|
|
267
283
|
*
|
|
268
|
-
* @param {NormalizedDebt} oldDebtNormalized - prior principal and all
|
|
284
|
+
* @param {NormalizedDebt} oldDebtNormalized - prior principal and all
|
|
285
|
+
* accrued interest, normalized to the launch of the vaultManager
|
|
269
286
|
* @param {Amount<'nat'>} oldCollateral - actual collateral
|
|
270
|
-
* @param {Amount<'nat'>} newDebtActual - actual principal and all
|
|
287
|
+
* @param {Amount<'nat'>} newDebtActual - actual principal and all
|
|
288
|
+
* accrued interest
|
|
271
289
|
*/
|
|
272
290
|
updateDebtAccounting(oldDebtNormalized, oldCollateral, newDebtActual) {
|
|
273
291
|
const { state, facets } = this;
|
|
@@ -283,10 +301,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
283
301
|
);
|
|
284
302
|
},
|
|
285
303
|
|
|
286
|
-
/**
|
|
287
|
-
*
|
|
288
|
-
* @param {ZCFSeat} seat
|
|
289
|
-
*/
|
|
304
|
+
/** @param {ZCFSeat} seat */
|
|
290
305
|
getCollateralAllocated(seat) {
|
|
291
306
|
return seat.getAmountAllocated(
|
|
292
307
|
'Collateral',
|
|
@@ -308,7 +323,6 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
308
323
|
},
|
|
309
324
|
|
|
310
325
|
/**
|
|
311
|
-
*
|
|
312
326
|
* @param {Amount<'nat'>} collateralAmount
|
|
313
327
|
* @param {Amount<'nat'>} proposedDebt
|
|
314
328
|
*/
|
|
@@ -321,10 +335,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
321
335
|
)} for ${q(collateralAmount)} collateral`;
|
|
322
336
|
},
|
|
323
337
|
|
|
324
|
-
/**
|
|
325
|
-
*
|
|
326
|
-
* @param {HolderPhase} newPhase
|
|
327
|
-
*/
|
|
338
|
+
/** @param {HolderPhase} newPhase */
|
|
328
339
|
getStateSnapshot(newPhase) {
|
|
329
340
|
const { state, facets } = this;
|
|
330
341
|
|
|
@@ -340,9 +351,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
340
351
|
});
|
|
341
352
|
},
|
|
342
353
|
|
|
343
|
-
/**
|
|
344
|
-
* call this whenever anything changes!
|
|
345
|
-
*/
|
|
354
|
+
/** call this whenever anything changes! */
|
|
346
355
|
updateUiState() {
|
|
347
356
|
const { state, facets } = this;
|
|
348
357
|
const { outerUpdater } = state;
|
|
@@ -370,9 +379,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
370
379
|
}
|
|
371
380
|
},
|
|
372
381
|
|
|
373
|
-
/**
|
|
374
|
-
* @param {ZCFSeat} seat
|
|
375
|
-
*/
|
|
382
|
+
/** @param {ZCFSeat} seat */
|
|
376
383
|
async closeHook(seat) {
|
|
377
384
|
const { state, facets } = this;
|
|
378
385
|
|
|
@@ -442,11 +449,11 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
442
449
|
},
|
|
443
450
|
|
|
444
451
|
/**
|
|
445
|
-
* Calculate the fee, the amount to mint and the resulting debt.
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
452
|
+
* Calculate the fee, the amount to mint and the resulting debt. The
|
|
453
|
+
* give and the want together reflect a delta, where typically one is
|
|
454
|
+
* zero because they come from the gave/want of an offer proposal. If
|
|
455
|
+
* the `want` is zero, the `fee` will also be zero, so the simple math
|
|
456
|
+
* works.
|
|
450
457
|
*
|
|
451
458
|
* @param {Amount<'nat'>} currentDebt
|
|
452
459
|
* @param {Amount<'nat'>} giveAmount
|
|
@@ -524,7 +531,6 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
524
531
|
},
|
|
525
532
|
|
|
526
533
|
/**
|
|
527
|
-
*
|
|
528
534
|
* @param {ZCFSeat} clientSeat
|
|
529
535
|
* @param {FullProposal} fp
|
|
530
536
|
* @param {ReturnType<typeof calculateDebtCosts>} costs
|
|
@@ -570,7 +576,6 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
570
576
|
},
|
|
571
577
|
|
|
572
578
|
/**
|
|
573
|
-
*
|
|
574
579
|
* @param {ZCFSeat} seat
|
|
575
580
|
* @returns {VaultKit}
|
|
576
581
|
*/
|
|
@@ -671,9 +676,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
671
676
|
return vaultKit;
|
|
672
677
|
},
|
|
673
678
|
|
|
674
|
-
/**
|
|
675
|
-
* Called by manager at start of liquidation.
|
|
676
|
-
*/
|
|
679
|
+
/** Called by manager at start of liquidation. */
|
|
677
680
|
liquidating() {
|
|
678
681
|
const { facets } = this;
|
|
679
682
|
|
|
@@ -683,8 +686,8 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
683
686
|
},
|
|
684
687
|
|
|
685
688
|
/**
|
|
686
|
-
* Called by manager at end of liquidation, at which point all debts
|
|
687
|
-
* covered.
|
|
689
|
+
* Called by manager at end of liquidation, at which point all debts
|
|
690
|
+
* have been covered.
|
|
688
691
|
*/
|
|
689
692
|
liquidated() {
|
|
690
693
|
const { facets } = this;
|
|
@@ -776,9 +779,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
776
779
|
);
|
|
777
780
|
},
|
|
778
781
|
|
|
779
|
-
/**
|
|
780
|
-
* @returns {Promise<Invitation>}
|
|
781
|
-
*/
|
|
782
|
+
/** @returns {Promise<Invitation>} */
|
|
782
783
|
makeTransferInvitation() {
|
|
783
784
|
const { state, facets } = this;
|
|
784
785
|
const { outerUpdater } = state;
|
|
@@ -810,10 +811,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
810
811
|
|
|
811
812
|
// for status/debugging
|
|
812
813
|
|
|
813
|
-
/**
|
|
814
|
-
*
|
|
815
|
-
* @returns {Amount<'nat'>}
|
|
816
|
-
*/
|
|
814
|
+
/** @returns {Amount<'nat'>} */
|
|
817
815
|
getCollateralAmount() {
|
|
818
816
|
const { state, facets } = this;
|
|
819
817
|
const { vaultSeat } = state;
|
|
@@ -827,15 +825,15 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
827
825
|
/**
|
|
828
826
|
* The actual current debt, including accrued interest.
|
|
829
827
|
*
|
|
830
|
-
* This looks like a simple getter but it does a lot of the heavy
|
|
831
|
-
* interest accrual. Rather than updating all records when
|
|
832
|
-
* the vault manager updates just its rolling
|
|
833
|
-
* calculate what the current debt is given
|
|
834
|
-
* what
|
|
835
|
-
*
|
|
836
|
-
* @see getNormalizedDebt
|
|
828
|
+
* This looks like a simple getter but it does a lot of the heavy
|
|
829
|
+
* lifting for interest accrual. Rather than updating all records when
|
|
830
|
+
* interest accrues, the vault manager updates just its rolling
|
|
831
|
+
* compounded interest. Here we calculate what the current debt is given
|
|
832
|
+
* what's recorded in this vault and what interest has compounded since
|
|
833
|
+
* this vault record was written.
|
|
837
834
|
*
|
|
838
835
|
* @returns {Amount<'nat'>}
|
|
836
|
+
* @see getNormalizedDebt
|
|
839
837
|
*/
|
|
840
838
|
getCurrentDebt() {
|
|
841
839
|
const { state } = this;
|
|
@@ -847,14 +845,15 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
847
845
|
},
|
|
848
846
|
|
|
849
847
|
/**
|
|
850
|
-
* The normalization puts all debts on a common time-independent scale
|
|
851
|
-
* the launch of this vault manager. This allows the manager to
|
|
852
|
-
* by their debt-to-collateral ratios without having to
|
|
853
|
-
* the interest accrues.
|
|
848
|
+
* The normalization puts all debts on a common time-independent scale
|
|
849
|
+
* since the launch of this vault manager. This allows the manager to
|
|
850
|
+
* order vaults by their debt-to-collateral ratios without having to
|
|
851
|
+
* mutate the debts as the interest accrues.
|
|
854
852
|
*
|
|
853
|
+
* @returns {import('./storeUtils.js').NormalizedDebt} as if the vault
|
|
854
|
+
* was open at the launch of this manager, before any interest
|
|
855
|
+
* accrued
|
|
855
856
|
* @see getActualDebAmount
|
|
856
|
-
*
|
|
857
|
-
* @returns {import('./storeUtils.js').NormalizedDebt} as if the vault was open at the launch of this manager, before any interest accrued
|
|
858
857
|
*/
|
|
859
858
|
getNormalizedDebt() {
|
|
860
859
|
const { state } = this;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prepare the VaultDirector kind, get or make the singleton
|
|
3
3
|
*
|
|
4
|
-
* @type {(
|
|
4
|
+
* @type {(
|
|
5
|
+
* ...pvdArgs: Parameters<typeof prepareVaultDirector>
|
|
6
|
+
* ) => ReturnType<ReturnType<typeof prepareVaultDirector>>}
|
|
5
7
|
*/
|
|
6
8
|
export const provideDirector: (baggage: MapStore<string, unknown>, zcf: import("./vaultFactory.js").VaultFactoryZCF, directorParamManager: VaultDirectorParamManager, debtMint: ZCFMint<"nat">, timer: ERef<import("@agoric/time/src/types").TimerService>, auctioneer: ERef<GovernedPublicFacet<{
|
|
7
9
|
getElectorate: () => Amount<"set">;
|
|
@@ -47,7 +49,7 @@ export type VaultDirectorParamManager = import('@agoric/governance/src/contractG
|
|
|
47
49
|
* @param {import('@agoric/ertp').Baggage} baggage
|
|
48
50
|
* @param {import('./vaultFactory.js').VaultFactoryZCF} zcf
|
|
49
51
|
* @param {VaultDirectorParamManager} directorParamManager
|
|
50
|
-
* @param {ZCFMint<
|
|
52
|
+
* @param {ZCFMint<'nat'>} debtMint
|
|
51
53
|
* @param {ERef<import('@agoric/time/src/types').TimerService>} timer
|
|
52
54
|
* @param {ERef<import('../auction/auctioneer.js').AuctioneerPublicFacet>} auctioneer
|
|
53
55
|
* @param {ERef<StorageNode>} storageNode
|
|
@@ -55,7 +57,7 @@ export type VaultDirectorParamManager = import('@agoric/governance/src/contractG
|
|
|
55
57
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
56
58
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeERecorderKit} makeERecorderKit
|
|
57
59
|
*/
|
|
58
|
-
declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: import('./vaultFactory.js').VaultFactoryZCF, directorParamManager: VaultDirectorParamManager, debtMint: ZCFMint<
|
|
60
|
+
declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: import('./vaultFactory.js').VaultFactoryZCF, directorParamManager: VaultDirectorParamManager, debtMint: ZCFMint<'nat'>, timer: ERef<import('@agoric/time/src/types').TimerService>, auctioneer: ERef<import('../auction/auctioneer.js').AuctioneerPublicFacet>, storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller>, makeRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit, makeERecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').MakeERecorderKit): () => {
|
|
59
61
|
creator: {
|
|
60
62
|
getParamMgrRetriever: () => {
|
|
61
63
|
/** @param {VaultFactoryParamPath} paramPath */
|
|
@@ -78,9 +80,7 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
78
80
|
MintFee: "ratio";
|
|
79
81
|
}> | VaultDirectorParamManager;
|
|
80
82
|
}>;
|
|
81
|
-
/**
|
|
82
|
-
* @param {string} name
|
|
83
|
-
*/
|
|
83
|
+
/** @param {string} name */
|
|
84
84
|
getInvitation(name: string): Promise<Invitation<R, A>>;
|
|
85
85
|
getLimitedCreatorFacet(): {
|
|
86
86
|
/**
|
|
@@ -114,7 +114,7 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
114
114
|
makeAdjustBalancesInvitation(): Promise<Invitation<R, A>>;
|
|
115
115
|
makeCloseInvitation(): Promise<Invitation<R, A>>;
|
|
116
116
|
makeTransferInvitation(): Promise<Invitation<R, A>>;
|
|
117
|
-
getCollateralAmount(): Amount<"nat">;
|
|
117
|
+
getCollateralAmount(): Amount<"nat">;
|
|
118
118
|
getCurrentDebt(): Amount<"nat">;
|
|
119
119
|
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
120
120
|
};
|
|
@@ -210,7 +210,7 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
210
210
|
makeAdjustBalancesInvitation(): Promise<Invitation<R, A>>;
|
|
211
211
|
makeCloseInvitation(): Promise<Invitation<R, A>>;
|
|
212
212
|
makeTransferInvitation(): Promise<Invitation<R, A>>;
|
|
213
|
-
getCollateralAmount(): Amount<"nat">;
|
|
213
|
+
getCollateralAmount(): Amount<"nat">;
|
|
214
214
|
getCurrentDebt(): Amount<"nat">;
|
|
215
215
|
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
216
216
|
};
|
|
@@ -270,9 +270,7 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
270
270
|
}>;
|
|
271
271
|
};
|
|
272
272
|
public: {
|
|
273
|
-
/**
|
|
274
|
-
* @param {Brand} brandIn
|
|
275
|
-
*/
|
|
273
|
+
/** @param {Brand} brandIn */
|
|
276
274
|
getCollateralManager(brandIn: Brand): {
|
|
277
275
|
makeVaultInvitation(): Promise<Invitation<R, A>>;
|
|
278
276
|
getQuotes(): import("@agoric/notifier").StoredNotifier<PriceQuote>;
|
|
@@ -294,26 +292,18 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
294
292
|
getPublicTopics(): {
|
|
295
293
|
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<MetricsNotification>;
|
|
296
294
|
};
|
|
297
|
-
/**
|
|
298
|
-
* subscription for the paramManager for the vaultFactory's electorate
|
|
299
|
-
*/
|
|
295
|
+
/** subscription for the paramManager for the vaultFactory's electorate */
|
|
300
296
|
getElectorateSubscription(): StoredSubscription<GovernanceSubscriptionState>;
|
|
301
|
-
/**
|
|
302
|
-
* @param {{ collateralBrand: Brand }} selector
|
|
303
|
-
*/
|
|
297
|
+
/** @param {{ collateralBrand: Brand }} selector */
|
|
304
298
|
getGovernedParams({ collateralBrand }: {
|
|
305
299
|
collateralBrand: Brand;
|
|
306
300
|
}): ERef<ParamStateRecord>;
|
|
307
|
-
/**
|
|
308
|
-
* @param {string} name
|
|
309
|
-
*/
|
|
301
|
+
/** @param {string} name */
|
|
310
302
|
getInvitationAmount(name: string): Amount<"set">;
|
|
311
303
|
};
|
|
312
304
|
helper: {
|
|
313
305
|
resetWakeupsForNextAuction(): Promise<void>;
|
|
314
|
-
/**
|
|
315
|
-
* Start non-durable processes (or restart if needed after vat restart)
|
|
316
|
-
*/
|
|
306
|
+
/** Start non-durable processes (or restart if needed after vat restart) */
|
|
317
307
|
start(): Promise<void>;
|
|
318
308
|
};
|
|
319
309
|
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
@@ -339,9 +329,7 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
339
329
|
MintFee: "ratio";
|
|
340
330
|
}> | VaultDirectorParamManager;
|
|
341
331
|
}>;
|
|
342
|
-
/**
|
|
343
|
-
* @param {string} name
|
|
344
|
-
*/
|
|
332
|
+
/** @param {string} name */
|
|
345
333
|
getInvitation(name: string): Promise<Invitation<R, A>>;
|
|
346
334
|
getLimitedCreatorFacet(): {
|
|
347
335
|
/**
|
|
@@ -375,7 +363,7 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
375
363
|
makeAdjustBalancesInvitation(): Promise<Invitation<R, A>>;
|
|
376
364
|
makeCloseInvitation(): Promise<Invitation<R, A>>;
|
|
377
365
|
makeTransferInvitation(): Promise<Invitation<R, A>>;
|
|
378
|
-
getCollateralAmount(): Amount<"nat">;
|
|
366
|
+
getCollateralAmount(): Amount<"nat">;
|
|
379
367
|
getCurrentDebt(): Amount<"nat">;
|
|
380
368
|
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
381
369
|
};
|
|
@@ -471,7 +459,7 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
471
459
|
makeAdjustBalancesInvitation(): Promise<Invitation<R, A>>;
|
|
472
460
|
makeCloseInvitation(): Promise<Invitation<R, A>>;
|
|
473
461
|
makeTransferInvitation(): Promise<Invitation<R, A>>;
|
|
474
|
-
getCollateralAmount(): Amount<"nat">;
|
|
462
|
+
getCollateralAmount(): Amount<"nat">;
|
|
475
463
|
getCurrentDebt(): Amount<"nat">;
|
|
476
464
|
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
477
465
|
};
|
|
@@ -531,9 +519,7 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
531
519
|
}>;
|
|
532
520
|
};
|
|
533
521
|
public: {
|
|
534
|
-
/**
|
|
535
|
-
* @param {Brand} brandIn
|
|
536
|
-
*/
|
|
522
|
+
/** @param {Brand} brandIn */
|
|
537
523
|
getCollateralManager(brandIn: Brand): {
|
|
538
524
|
makeVaultInvitation(): Promise<Invitation<R, A>>;
|
|
539
525
|
getQuotes(): import("@agoric/notifier").StoredNotifier<PriceQuote>;
|
|
@@ -555,26 +541,18 @@ declare function prepareVaultDirector(baggage: MapStore<string, unknown>, zcf: i
|
|
|
555
541
|
getPublicTopics(): {
|
|
556
542
|
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<MetricsNotification>;
|
|
557
543
|
};
|
|
558
|
-
/**
|
|
559
|
-
* subscription for the paramManager for the vaultFactory's electorate
|
|
560
|
-
*/
|
|
544
|
+
/** subscription for the paramManager for the vaultFactory's electorate */
|
|
561
545
|
getElectorateSubscription(): StoredSubscription<GovernanceSubscriptionState>;
|
|
562
|
-
/**
|
|
563
|
-
* @param {{ collateralBrand: Brand }} selector
|
|
564
|
-
*/
|
|
546
|
+
/** @param {{ collateralBrand: Brand }} selector */
|
|
565
547
|
getGovernedParams({ collateralBrand }: {
|
|
566
548
|
collateralBrand: Brand;
|
|
567
549
|
}): ERef<ParamStateRecord>;
|
|
568
|
-
/**
|
|
569
|
-
* @param {string} name
|
|
570
|
-
*/
|
|
550
|
+
/** @param {string} name */
|
|
571
551
|
getInvitationAmount(name: string): Amount<"set">;
|
|
572
552
|
};
|
|
573
553
|
helper: {
|
|
574
554
|
resetWakeupsForNextAuction(): Promise<void>;
|
|
575
|
-
/**
|
|
576
|
-
* Start non-durable processes (or restart if needed after vat restart)
|
|
577
|
-
*/
|
|
555
|
+
/** Start non-durable processes (or restart if needed after vat restart) */
|
|
578
556
|
start(): Promise<void>;
|
|
579
557
|
};
|
|
580
558
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaultDirector.d.ts","sourceRoot":"","sources":["vaultDirector.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vaultDirector.d.ts","sourceRoot":"","sources":["vaultDirector.js"],"names":[],"mappings":"AAkgBA;;;;;;GAMG;AACH;;;;;;;;;;;gFAzMY,+CAA+C;;;;;;;;;;;qhBAuMnD,WAAW,WAAW,2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