@agoric/inter-protocol 0.16.1 → 0.16.2-dev-8c14632.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/README.md +1 -1
- package/bundles/bundle-auctioneer-js-meta.json +285 -285
- package/bundles/bundle-auctioneer.js +1 -1
- package/bundles/bundle-econCommitteeCharter-js-meta.json +201 -201
- package/bundles/bundle-econCommitteeCharter.js +1 -1
- package/bundles/bundle-feeDistributor-js-meta.json +201 -201
- package/bundles/bundle-feeDistributor.js +1 -1
- package/bundles/bundle-fluxAggregatorKit-js-meta.json +307 -307
- package/bundles/bundle-fluxAggregatorKit.js +1 -1
- package/bundles/bundle-psm-js-meta.json +264 -264
- package/bundles/bundle-psm.js +1 -1
- package/bundles/bundle-reserve-js-meta.json +295 -295
- package/bundles/bundle-reserve.js +1 -1
- package/bundles/bundle-scaledPriceAuthority-js-meta.json +225 -225
- package/bundles/bundle-scaledPriceAuthority.js +1 -1
- package/bundles/bundle-vaultFactory-js-meta.json +346 -346
- package/bundles/bundle-vaultFactory.js +1 -1
- package/package.json +20 -19
- package/scripts/add-STARS.js +43 -0
- package/scripts/add-collateral-core.js +2 -2
- package/src/auction/scheduler.js +2 -12
- package/src/interest-math.js +13 -13
- package/src/interest.js +24 -24
- package/src/price/fluxAggregatorContract.js +4 -8
- package/src/proposals/addAssetToVault.js +19 -7
- package/src/proposals/price-feed-proposal.js +29 -15
- package/src/proposals/startPSM.js +6 -4
- package/src/reserve/assetReserve.js +2 -2
- package/src/vaultFactory/params.js +4 -4
- package/src/vaultFactory/storeUtils.js +11 -7
- package/src/vaultFactory/types.js +4 -4
- package/src/vaultFactory/vault.js +18 -13
- package/src/vaultFactory/vaultDirector.js +2 -0
- package/src/vaultFactory/vaultManager.js +47 -40
|
@@ -131,15 +131,15 @@ harden(fromVaultKey);
|
|
|
131
131
|
* For use by `normalizedCollRatioKey` and tests.
|
|
132
132
|
*
|
|
133
133
|
* @param {PriceQuote} quote
|
|
134
|
-
* @param {Ratio}
|
|
134
|
+
* @param {Ratio} compoundedStabilityFee
|
|
135
135
|
* @param {Ratio} margin
|
|
136
136
|
* @returns {number}
|
|
137
137
|
*/
|
|
138
|
-
export const normalizedCollRatio = (quote,
|
|
138
|
+
export const normalizedCollRatio = (quote, compoundedStabilityFee, margin) => {
|
|
139
139
|
const amountIn = getAmountIn(quote).value;
|
|
140
140
|
const amountOut = getAmountOut(quote).value;
|
|
141
|
-
const interestNumerator =
|
|
142
|
-
const interestBase =
|
|
141
|
+
const interestNumerator = compoundedStabilityFee.numerator.value;
|
|
142
|
+
const interestBase = compoundedStabilityFee.denominator.value;
|
|
143
143
|
const numerator = multiply(
|
|
144
144
|
margin.numerator.value,
|
|
145
145
|
multiply(amountIn, interestNumerator),
|
|
@@ -159,13 +159,17 @@ harden(normalizedCollRatio);
|
|
|
159
159
|
* out the numerator and the denominator, and divide only once.
|
|
160
160
|
*
|
|
161
161
|
* @param {PriceQuote} quote
|
|
162
|
-
* @param {Ratio}
|
|
162
|
+
* @param {Ratio} compoundedStabilityFee
|
|
163
163
|
* @param {Ratio} margin
|
|
164
164
|
* @returns {string} lexically sortable string in which highest
|
|
165
165
|
* debt-to-collateral is earliest
|
|
166
166
|
*/
|
|
167
|
-
export const normalizedCollRatioKey = (
|
|
168
|
-
|
|
167
|
+
export const normalizedCollRatioKey = (
|
|
168
|
+
quote,
|
|
169
|
+
compoundedStabilityFee,
|
|
170
|
+
margin,
|
|
171
|
+
) => {
|
|
172
|
+
const collRatio = normalizedCollRatio(quote, compoundedStabilityFee, margin);
|
|
169
173
|
return `${encodeNumber(collRatio)}:`;
|
|
170
174
|
};
|
|
171
175
|
harden(normalizedCollRatioKey);
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @property {Ratio} liquidationMargin - margin below which collateral will be
|
|
27
27
|
* liquidated to satisfy the debt.
|
|
28
28
|
* @property {Ratio} liquidationPenalty - penalty charged upon liquidation as proportion of debt
|
|
29
|
-
* @property {Ratio}
|
|
29
|
+
* @property {Ratio} stabilityFee - annual interest rate charged on debt positions
|
|
30
30
|
* @property {Ratio} mintFee - The fee (in BasisPoints) charged when creating
|
|
31
31
|
* or increasing a debt position.
|
|
32
32
|
* @property {Amount<'nat'>} debtLimit
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
* @property {() => Ratio} getLiquidationMargin
|
|
79
79
|
* @property {() => Ratio} getMintFee
|
|
80
80
|
* @property {() => Promise<PriceQuote>} getCollateralQuote
|
|
81
|
-
* @property {() => Ratio}
|
|
81
|
+
* @property {() => Ratio} getStabilityFee - The annual interest rate on a debt position
|
|
82
82
|
* @property {() => RelativeTime} getChargingPeriod - The period (in seconds) at
|
|
83
83
|
* which interest is charged to the debt position.
|
|
84
84
|
* @property {() => RelativeTime} getRecordingPeriod - The period (in seconds)
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* @typedef {object} DebtStatus
|
|
112
|
-
* @property {Timestamp}
|
|
113
|
-
* @property {NatValue} interest interest accrued since
|
|
112
|
+
* @property {Timestamp} latestStabilityFeeUpdate
|
|
113
|
+
* @property {NatValue} interest interest accrued since latestStabilityFeeUpdate
|
|
114
114
|
* @property {NatValue} newDebt total including principal and interest
|
|
115
115
|
*/
|
|
116
116
|
|
|
@@ -72,7 +72,7 @@ const validTransitions = {
|
|
|
72
72
|
*
|
|
73
73
|
* @typedef {object} VaultNotification
|
|
74
74
|
* @property {Amount<'nat'>} locked Amount of Collateral locked
|
|
75
|
-
* @property {{debt: Amount<'nat'>,
|
|
75
|
+
* @property {{debt: Amount<'nat'>, stabilityFee: Ratio}} debtSnapshot 'debt' at the point the compounded stabilityFee was 'stabilityFee'
|
|
76
76
|
* @property {HolderPhase} vaultState
|
|
77
77
|
*/
|
|
78
78
|
|
|
@@ -86,7 +86,7 @@ const validTransitions = {
|
|
|
86
86
|
* @property {() => Brand<'nat'>} getDebtBrand
|
|
87
87
|
* @property {MintAndTransfer} mintAndTransfer
|
|
88
88
|
* @property {(amount: Amount, seat: ZCFSeat) => void} burn
|
|
89
|
-
* @property {() => Ratio}
|
|
89
|
+
* @property {() => Ratio} getCompoundedStabilityFee
|
|
90
90
|
* @property {(oldDebt: import('./storeUtils.js').NormalizedDebt, oldCollateral: Amount<'nat'>, vaultId: VaultId, vaultPhase: VaultPhase, vault: Vault) => void} handleBalanceChange
|
|
91
91
|
* @property {() => import('./vaultManager.js').GovernedParamGetters} getGovernedParams
|
|
92
92
|
*/
|
|
@@ -104,7 +104,7 @@ const validTransitions = {
|
|
|
104
104
|
* Snapshot is of the debt and compounded interest when the principal was last changed.
|
|
105
105
|
*
|
|
106
106
|
* @typedef {{
|
|
107
|
-
*
|
|
107
|
+
* stabilityFeeSnapshot: Ratio,
|
|
108
108
|
* phase: VaultPhase,
|
|
109
109
|
* debtSnapshot: Amount<'nat'>,
|
|
110
110
|
* outerUpdater: import('@agoric/zoe/src/contractSupport/recorder.js').Recorder<VaultNotification> | null,
|
|
@@ -132,7 +132,7 @@ const VaultStateShape = harden({
|
|
|
132
132
|
phase: M.any(),
|
|
133
133
|
storageNode: M.any(),
|
|
134
134
|
vaultSeat: M.any(),
|
|
135
|
-
|
|
135
|
+
stabilityFeeSnapshot: M.any(),
|
|
136
136
|
debtSnapshot: M.any(),
|
|
137
137
|
});
|
|
138
138
|
|
|
@@ -174,7 +174,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
174
174
|
vaultSeat: zcf.makeEmptySeatKit().zcfSeat,
|
|
175
175
|
|
|
176
176
|
// Two values from the same moment
|
|
177
|
-
|
|
177
|
+
stabilityFeeSnapshot: manager.getCompoundedStabilityFee(),
|
|
178
178
|
debtSnapshot: AmountMath.makeEmpty(manager.getDebtBrand()),
|
|
179
179
|
});
|
|
180
180
|
},
|
|
@@ -257,7 +257,8 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
257
257
|
|
|
258
258
|
// update local state
|
|
259
259
|
state.debtSnapshot = newDebt;
|
|
260
|
-
state.
|
|
260
|
+
state.stabilityFeeSnapshot =
|
|
261
|
+
state.manager.getCompoundedStabilityFee();
|
|
261
262
|
},
|
|
262
263
|
|
|
263
264
|
/**
|
|
@@ -327,10 +328,11 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
327
328
|
getStateSnapshot(newPhase) {
|
|
328
329
|
const { state, facets } = this;
|
|
329
330
|
|
|
330
|
-
const { debtSnapshot: debt,
|
|
331
|
+
const { debtSnapshot: debt, stabilityFeeSnapshot: stabilityFee } =
|
|
332
|
+
state;
|
|
331
333
|
/** @type {VaultNotification} */
|
|
332
334
|
return harden({
|
|
333
|
-
debtSnapshot: { debt,
|
|
335
|
+
debtSnapshot: { debt, stabilityFee },
|
|
334
336
|
locked: facets.self.getCollateralAmount(),
|
|
335
337
|
// newPhase param is so that makeTransferInvitation can finish without setting the vault's phase
|
|
336
338
|
// TODO refactor https://github.com/Agoric/agoric-sdk/issues/4415
|
|
@@ -785,7 +787,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
785
787
|
helper.updateDebtSnapshot(self.getCurrentDebt());
|
|
786
788
|
const {
|
|
787
789
|
debtSnapshot: debt,
|
|
788
|
-
|
|
790
|
+
stabilityFeeSnapshot: stabilityFee,
|
|
789
791
|
phase,
|
|
790
792
|
} = state;
|
|
791
793
|
if (outerUpdater) {
|
|
@@ -795,7 +797,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
795
797
|
state.outerUpdater = null;
|
|
796
798
|
}
|
|
797
799
|
const transferState = {
|
|
798
|
-
debtSnapshot: { debt,
|
|
800
|
+
debtSnapshot: { debt, stabilityFee },
|
|
799
801
|
locked: self.getCollateralAmount(),
|
|
800
802
|
vaultState: phase,
|
|
801
803
|
};
|
|
@@ -839,8 +841,8 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
839
841
|
const { state } = this;
|
|
840
842
|
return calculateCurrentDebt(
|
|
841
843
|
state.debtSnapshot,
|
|
842
|
-
state.
|
|
843
|
-
state.manager.
|
|
844
|
+
state.stabilityFeeSnapshot,
|
|
845
|
+
state.manager.getCompoundedStabilityFee(),
|
|
844
846
|
);
|
|
845
847
|
},
|
|
846
848
|
|
|
@@ -857,7 +859,10 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => {
|
|
|
857
859
|
getNormalizedDebt() {
|
|
858
860
|
const { state } = this;
|
|
859
861
|
// @ts-expect-error cast
|
|
860
|
-
return reverseInterest(
|
|
862
|
+
return reverseInterest(
|
|
863
|
+
state.debtSnapshot,
|
|
864
|
+
state.stabilityFeeSnapshot,
|
|
865
|
+
);
|
|
861
866
|
},
|
|
862
867
|
},
|
|
863
868
|
},
|
|
@@ -250,6 +250,7 @@ const prepareVaultDirector = (
|
|
|
250
250
|
metrics: makeRecorderTopic('Vault Factory metrics', metricsKit),
|
|
251
251
|
});
|
|
252
252
|
|
|
253
|
+
/** @param {(vm: VaultManager) => void} fn */
|
|
253
254
|
const allManagersDo = fn => {
|
|
254
255
|
for (const managerIndex of collateralManagers.values()) {
|
|
255
256
|
const vm = vaultManagers.get(managerIndex).self;
|
|
@@ -424,6 +425,7 @@ const prepareVaultDirector = (
|
|
|
424
425
|
|
|
425
426
|
makeLiquidationWaker() {
|
|
426
427
|
return makeWaker('liquidationWaker', _timestamp => {
|
|
428
|
+
// XXX floating promise
|
|
427
429
|
allManagersDo(vm => vm.liquidateVaults(auctioneer));
|
|
428
430
|
});
|
|
429
431
|
},
|
|
@@ -95,16 +95,16 @@ const trace = makeTracer('VM');
|
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* @typedef {{
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
98
|
+
* compoundedStabilityFee: Ratio,
|
|
99
|
+
* stabilityFee: Ratio,
|
|
100
|
+
* latestStabilityFeeUpdate: Timestamp,
|
|
101
101
|
* }} AssetState
|
|
102
102
|
*
|
|
103
103
|
* @typedef {{
|
|
104
104
|
* getChargingPeriod: () => RelativeTime,
|
|
105
105
|
* getRecordingPeriod: () => RelativeTime,
|
|
106
106
|
* getDebtLimit: () => Amount<'nat'>,
|
|
107
|
-
*
|
|
107
|
+
* getStabilityFee: () => Ratio,
|
|
108
108
|
* getLiquidationPadding: () => Ratio,
|
|
109
109
|
* getLiquidationMargin: () => Ratio,
|
|
110
110
|
* getLiquidationPenalty: () => Ratio,
|
|
@@ -138,8 +138,8 @@ const trace = makeTracer('VM');
|
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* @typedef {{
|
|
141
|
-
*
|
|
142
|
-
*
|
|
141
|
+
* compoundedStabilityFee: Ratio,
|
|
142
|
+
* latestStabilityFeeUpdate: Timestamp,
|
|
143
143
|
* numLiquidationsCompleted: number,
|
|
144
144
|
* numLiquidationsAborted: number,
|
|
145
145
|
* totalCollateral: Amount<'nat'>,
|
|
@@ -230,8 +230,8 @@ export const prepareVaultManagerKit = (
|
|
|
230
230
|
return harden({
|
|
231
231
|
...params,
|
|
232
232
|
...immutable,
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
compoundedStabilityFee: makeRatio(100n, debtBrand), // starts at 1.0, no interest
|
|
234
|
+
latestStabilityFeeUpdate: startTimeStamp,
|
|
235
235
|
numLiquidationsCompleted: 0,
|
|
236
236
|
numLiquidationsAborted: 0,
|
|
237
237
|
totalCollateral: zeroCollateral,
|
|
@@ -255,7 +255,7 @@ export const prepareVaultManagerKit = (
|
|
|
255
255
|
makeVaultInvitation: M.call().returns(M.promise()),
|
|
256
256
|
getPublicTopics: M.call().returns(TopicsRecordShape),
|
|
257
257
|
getQuotes: M.call().returns(NotifierShape),
|
|
258
|
-
|
|
258
|
+
getCompoundedStabilityFee: M.call().returns(RatioShape),
|
|
259
259
|
}),
|
|
260
260
|
helper: M.interface(
|
|
261
261
|
'helper',
|
|
@@ -276,7 +276,7 @@ export const prepareVaultManagerKit = (
|
|
|
276
276
|
getAssetSubscriber: M.call().returns(SubscriberShape),
|
|
277
277
|
getCollateralBrand: M.call().returns(BrandShape),
|
|
278
278
|
getDebtBrand: M.call().returns(BrandShape),
|
|
279
|
-
|
|
279
|
+
getCompoundedStabilityFee: M.call().returns(RatioShape),
|
|
280
280
|
scopeDescription: M.call(M.string()).returns(M.string()),
|
|
281
281
|
handleBalanceChange: M.call(
|
|
282
282
|
AmountShape,
|
|
@@ -319,8 +319,8 @@ export const prepareVaultManagerKit = (
|
|
|
319
319
|
const ephemera = collateralEphemera(this.state.collateralBrand);
|
|
320
320
|
return ephemera.storedQuotesNotifier;
|
|
321
321
|
},
|
|
322
|
-
|
|
323
|
-
return this.state.
|
|
322
|
+
getCompoundedStabilityFee() {
|
|
323
|
+
return this.state.compoundedStabilityFee;
|
|
324
324
|
},
|
|
325
325
|
getPublicTopics() {
|
|
326
326
|
const { assetTopicKit, metricsTopicKit } = this.state;
|
|
@@ -400,7 +400,7 @@ export const prepareVaultManagerKit = (
|
|
|
400
400
|
// throw. See https://github.com/Agoric/agoric-sdk/issues/4317
|
|
401
401
|
void observeNotifier(quoteNotifier, {
|
|
402
402
|
updateState(value) {
|
|
403
|
-
trace('
|
|
403
|
+
trace('storing new quote', value.quoteAmount.value);
|
|
404
404
|
ephemera.storedCollateralQuote = value;
|
|
405
405
|
},
|
|
406
406
|
fail(reason) {
|
|
@@ -419,9 +419,9 @@ export const prepareVaultManagerKit = (
|
|
|
419
419
|
updateTime,
|
|
420
420
|
});
|
|
421
421
|
|
|
422
|
-
const
|
|
422
|
+
const stabilityFee = factoryPowers
|
|
423
423
|
.getGovernedParams(collateralBrand)
|
|
424
|
-
.
|
|
424
|
+
.getStabilityFee();
|
|
425
425
|
|
|
426
426
|
// Update state with the results of charging interest
|
|
427
427
|
|
|
@@ -433,7 +433,7 @@ export const prepareVaultManagerKit = (
|
|
|
433
433
|
seatAllocationKeyword: 'Minted',
|
|
434
434
|
},
|
|
435
435
|
{
|
|
436
|
-
|
|
436
|
+
stabilityFee,
|
|
437
437
|
chargingPeriod: factoryPowers
|
|
438
438
|
.getGovernedParams(collateralBrand)
|
|
439
439
|
.getChargingPeriod(),
|
|
@@ -442,15 +442,15 @@ export const prepareVaultManagerKit = (
|
|
|
442
442
|
.getRecordingPeriod(),
|
|
443
443
|
},
|
|
444
444
|
{
|
|
445
|
-
|
|
446
|
-
|
|
445
|
+
latestStabilityFeeUpdate: state.latestStabilityFeeUpdate,
|
|
446
|
+
compoundedStabilityFee: state.compoundedStabilityFee,
|
|
447
447
|
totalDebt: state.totalDebt,
|
|
448
448
|
},
|
|
449
449
|
updateTime,
|
|
450
450
|
);
|
|
451
451
|
|
|
452
|
-
state.
|
|
453
|
-
state.
|
|
452
|
+
state.compoundedStabilityFee = changes.compoundedStabilityFee;
|
|
453
|
+
state.latestStabilityFeeUpdate = changes.latestStabilityFeeUpdate;
|
|
454
454
|
state.totalDebt = changes.totalDebt;
|
|
455
455
|
|
|
456
456
|
return facets.helper.assetNotify();
|
|
@@ -458,14 +458,14 @@ export const prepareVaultManagerKit = (
|
|
|
458
458
|
assetNotify() {
|
|
459
459
|
const { state } = this;
|
|
460
460
|
const { collateralBrand, assetTopicKit } = state;
|
|
461
|
-
const
|
|
461
|
+
const stabilityFee = factoryPowers
|
|
462
462
|
.getGovernedParams(collateralBrand)
|
|
463
|
-
.
|
|
463
|
+
.getStabilityFee();
|
|
464
464
|
/** @type {AssetState} */
|
|
465
465
|
const payload = harden({
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
compoundedStabilityFee: state.compoundedStabilityFee,
|
|
467
|
+
stabilityFee,
|
|
468
|
+
latestStabilityFeeUpdate: state.latestStabilityFeeUpdate,
|
|
469
469
|
});
|
|
470
470
|
return assetTopicKit.recorder.write(payload);
|
|
471
471
|
},
|
|
@@ -843,8 +843,8 @@ export const prepareVaultManagerKit = (
|
|
|
843
843
|
/**
|
|
844
844
|
* coefficient on existing debt to calculate new debt
|
|
845
845
|
*/
|
|
846
|
-
|
|
847
|
-
return this.state.
|
|
846
|
+
getCompoundedStabilityFee() {
|
|
847
|
+
return this.state.compoundedStabilityFee;
|
|
848
848
|
},
|
|
849
849
|
/**
|
|
850
850
|
* Called by a vault when its balances change.
|
|
@@ -963,7 +963,6 @@ export const prepareVaultManagerKit = (
|
|
|
963
963
|
|
|
964
964
|
try {
|
|
965
965
|
// TODO `await` is allowed until the above ordering is fixed
|
|
966
|
-
// eslint-disable-next-line @jessie.js/no-nested-await
|
|
967
966
|
const vaultKit = await vault.initVaultKit(seat, vaultStorageNode);
|
|
968
967
|
// initVaultKit calls back to handleBalanceChange() which will add the
|
|
969
968
|
// vault to prioritizedVaults
|
|
@@ -1037,7 +1036,7 @@ export const prepareVaultManagerKit = (
|
|
|
1037
1036
|
if (!storedCollateralQuote)
|
|
1038
1037
|
throw Fail`lockOraclePrices called before a collateral quote was available`;
|
|
1039
1038
|
trace(
|
|
1040
|
-
`
|
|
1039
|
+
`lockOraclePrices`,
|
|
1041
1040
|
getAmountIn(storedCollateralQuote),
|
|
1042
1041
|
getAmountOut(storedCollateralQuote),
|
|
1043
1042
|
);
|
|
@@ -1047,25 +1046,33 @@ export const prepareVaultManagerKit = (
|
|
|
1047
1046
|
return storedCollateralQuote;
|
|
1048
1047
|
},
|
|
1049
1048
|
/**
|
|
1050
|
-
* @param {AuctioneerPublicFacet} auctionPF
|
|
1049
|
+
* @param {ERef<AuctioneerPublicFacet>} auctionPF
|
|
1051
1050
|
*/
|
|
1052
1051
|
async liquidateVaults(auctionPF) {
|
|
1053
1052
|
const { state, facets } = this;
|
|
1054
1053
|
const { self, helper } = facets;
|
|
1055
1054
|
const {
|
|
1056
1055
|
collateralBrand,
|
|
1057
|
-
|
|
1056
|
+
compoundedStabilityFee,
|
|
1058
1057
|
debtBrand,
|
|
1059
1058
|
liquidatingVaults,
|
|
1060
1059
|
lockedQuote,
|
|
1061
1060
|
} = state;
|
|
1062
1061
|
trace(collateralBrand, 'considering liquidation');
|
|
1063
1062
|
|
|
1063
|
+
if (!lockedQuote) {
|
|
1064
|
+
// By design, the first cycle of auction may call this before a quote is locked
|
|
1065
|
+
// because the schedule is global at the vaultDirector level, and if a manager
|
|
1066
|
+
// starts after the price lock time there's nothing to be done.
|
|
1067
|
+
// NB: this message should not log repeatedly.
|
|
1068
|
+
console.error(
|
|
1069
|
+
'Skipping liquidation because no quote is locked yet (may happen with new manager)',
|
|
1070
|
+
);
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1064
1074
|
const { prioritizedVaults } = collateralEphemera(collateralBrand);
|
|
1065
|
-
|
|
1066
|
-
lockedQuote ||
|
|
1067
|
-
Fail`Must have locked a quote before liquidating vaults.`;
|
|
1068
|
-
assert(lockedQuote); // redundant with previous line
|
|
1075
|
+
prioritizedVaults || Fail`prioritizedVaults missing from ephemera`;
|
|
1069
1076
|
|
|
1070
1077
|
const liqMargin = self.getGovernedParams().getLiquidationMargin();
|
|
1071
1078
|
|
|
@@ -1075,7 +1082,7 @@ export const prepareVaultManagerKit = (
|
|
|
1075
1082
|
zcf,
|
|
1076
1083
|
{
|
|
1077
1084
|
quote: lockedQuote,
|
|
1078
|
-
interest:
|
|
1085
|
+
interest: compoundedStabilityFee,
|
|
1079
1086
|
margin: liqMargin,
|
|
1080
1087
|
},
|
|
1081
1088
|
prioritizedVaults,
|
|
@@ -1160,11 +1167,11 @@ export const prepareVaultManagerKit = (
|
|
|
1160
1167
|
helper.start();
|
|
1161
1168
|
void state.assetTopicKit.recorder.write(
|
|
1162
1169
|
harden({
|
|
1163
|
-
|
|
1164
|
-
|
|
1170
|
+
compoundedStabilityFee: state.compoundedStabilityFee,
|
|
1171
|
+
stabilityFee: factoryPowers
|
|
1165
1172
|
.getGovernedParams(state.collateralBrand)
|
|
1166
|
-
.
|
|
1167
|
-
|
|
1173
|
+
.getStabilityFee(),
|
|
1174
|
+
latestStabilityFeeUpdate: state.latestStabilityFeeUpdate,
|
|
1168
1175
|
}),
|
|
1169
1176
|
);
|
|
1170
1177
|
|