@agoric/inter-protocol 0.16.2-dev-8bcf6af.0 → 0.16.2-dev-8baf0aa.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 +193 -181
- package/bundles/bundle-auctioneer.js +1 -1
- package/bundles/bundle-econCommitteeCharter-js-meta.json +141 -129
- package/bundles/bundle-econCommitteeCharter.js +1 -1
- package/bundles/bundle-feeDistributor-js-meta.json +127 -115
- package/bundles/bundle-feeDistributor.js +1 -1
- package/bundles/bundle-fluxAggregatorKit-js-meta.json +181 -169
- package/bundles/bundle-fluxAggregatorKit.js +1 -1
- package/bundles/bundle-psm-js-meta.json +179 -167
- package/bundles/bundle-psm.js +1 -1
- package/bundles/bundle-reserve-js-meta.json +178 -166
- package/bundles/bundle-reserve.js +1 -1
- package/bundles/bundle-scaledPriceAuthority-js-meta.json +148 -136
- package/bundles/bundle-scaledPriceAuthority.js +1 -1
- package/bundles/bundle-vaultFactory-js-meta.json +210 -198
- package/bundles/bundle-vaultFactory.js +1 -1
- package/package.json +17 -17
- package/scripts/add-collateral-core.js +2 -2
- package/src/interest-math.d.ts +1 -1
- package/src/interest-math.d.ts.map +1 -1
- package/src/interest-math.js +13 -13
- package/src/interest.d.ts +6 -6
- package/src/interest.d.ts.map +1 -1
- package/src/interest.js +25 -26
- package/src/proposals/addAssetToVault.d.ts +5 -5
- package/src/proposals/addAssetToVault.js +5 -5
- package/src/vaultFactory/params.d.ts +5 -5
- package/src/vaultFactory/params.js +4 -4
- package/src/vaultFactory/storeUtils.d.ts +2 -2
- package/src/vaultFactory/storeUtils.d.ts.map +1 -1
- package/src/vaultFactory/storeUtils.js +7 -11
- package/src/vaultFactory/types.d.ts +4 -4
- package/src/vaultFactory/types.d.ts.map +1 -1
- package/src/vaultFactory/types.js +4 -4
- package/src/vaultFactory/vault.d.ts +11 -11
- package/src/vaultFactory/vault.d.ts.map +1 -1
- package/src/vaultFactory/vault.js +14 -19
- package/src/vaultFactory/vaultDirector.d.ts +10 -10
- package/src/vaultFactory/vaultFactory.d.ts +4 -4
- package/src/vaultFactory/vaultManager.d.ts +38 -38
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +35 -34
- package/CHANGELOG.md +0 -1033
|
@@ -106,16 +106,16 @@ const trace = makeTracer('VM');
|
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* @typedef {{
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
109
|
+
* compoundedInterest: Ratio;
|
|
110
|
+
* interestRate: Ratio;
|
|
111
|
+
* latestInterestUpdate: Timestamp;
|
|
112
112
|
* }} AssetState
|
|
113
113
|
*
|
|
114
114
|
* @typedef {{
|
|
115
115
|
* getChargingPeriod: () => RelativeTime;
|
|
116
116
|
* getRecordingPeriod: () => RelativeTime;
|
|
117
117
|
* getDebtLimit: () => Amount<'nat'>;
|
|
118
|
-
*
|
|
118
|
+
* getInterestRate: () => Ratio;
|
|
119
119
|
* getLiquidationPadding: () => Ratio;
|
|
120
120
|
* getLiquidationMargin: () => Ratio;
|
|
121
121
|
* getLiquidationPenalty: () => Ratio;
|
|
@@ -149,8 +149,8 @@ const trace = makeTracer('VM');
|
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* @typedef {{
|
|
152
|
-
*
|
|
153
|
-
*
|
|
152
|
+
* compoundedInterest: Ratio;
|
|
153
|
+
* latestInterestUpdate: Timestamp;
|
|
154
154
|
* numLiquidationsCompleted: number;
|
|
155
155
|
* numLiquidationsAborted: number;
|
|
156
156
|
* totalCollateral: Amount<'nat'>;
|
|
@@ -242,8 +242,8 @@ export const prepareVaultManagerKit = (
|
|
|
242
242
|
return harden({
|
|
243
243
|
...params,
|
|
244
244
|
...immutable,
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
compoundedInterest: makeRatio(100n, debtBrand), // starts at 1.0, no interest
|
|
246
|
+
latestInterestUpdate: startTimeStamp,
|
|
247
247
|
numLiquidationsCompleted: 0,
|
|
248
248
|
numLiquidationsAborted: 0,
|
|
249
249
|
totalCollateral: zeroCollateral,
|
|
@@ -267,7 +267,7 @@ export const prepareVaultManagerKit = (
|
|
|
267
267
|
makeVaultInvitation: M.call().returns(M.promise()),
|
|
268
268
|
getPublicTopics: M.call().returns(TopicsRecordShape),
|
|
269
269
|
getQuotes: M.call().returns(NotifierShape),
|
|
270
|
-
|
|
270
|
+
getCompoundedInterest: M.call().returns(RatioShape),
|
|
271
271
|
}),
|
|
272
272
|
helper: M.interface(
|
|
273
273
|
'helper',
|
|
@@ -288,7 +288,7 @@ export const prepareVaultManagerKit = (
|
|
|
288
288
|
getAssetSubscriber: M.call().returns(SubscriberShape),
|
|
289
289
|
getCollateralBrand: M.call().returns(BrandShape),
|
|
290
290
|
getDebtBrand: M.call().returns(BrandShape),
|
|
291
|
-
|
|
291
|
+
getCompoundedInterest: M.call().returns(RatioShape),
|
|
292
292
|
scopeDescription: M.call(M.string()).returns(M.string()),
|
|
293
293
|
handleBalanceChange: M.call(
|
|
294
294
|
AmountShape,
|
|
@@ -331,8 +331,8 @@ export const prepareVaultManagerKit = (
|
|
|
331
331
|
const ephemera = collateralEphemera(this.state.collateralBrand);
|
|
332
332
|
return ephemera.storedQuotesNotifier;
|
|
333
333
|
},
|
|
334
|
-
|
|
335
|
-
return this.state.
|
|
334
|
+
getCompoundedInterest() {
|
|
335
|
+
return this.state.compoundedInterest;
|
|
336
336
|
},
|
|
337
337
|
getPublicTopics() {
|
|
338
338
|
const { assetTopicKit, metricsTopicKit } = this.state;
|
|
@@ -427,9 +427,9 @@ export const prepareVaultManagerKit = (
|
|
|
427
427
|
updateTime,
|
|
428
428
|
});
|
|
429
429
|
|
|
430
|
-
const
|
|
430
|
+
const interestRate = factoryPowers
|
|
431
431
|
.getGovernedParams(collateralBrand)
|
|
432
|
-
.
|
|
432
|
+
.getInterestRate();
|
|
433
433
|
|
|
434
434
|
// Update state with the results of charging interest
|
|
435
435
|
|
|
@@ -441,7 +441,7 @@ export const prepareVaultManagerKit = (
|
|
|
441
441
|
seatAllocationKeyword: 'Minted',
|
|
442
442
|
},
|
|
443
443
|
{
|
|
444
|
-
|
|
444
|
+
interestRate,
|
|
445
445
|
chargingPeriod: factoryPowers
|
|
446
446
|
.getGovernedParams(collateralBrand)
|
|
447
447
|
.getChargingPeriod(),
|
|
@@ -450,15 +450,15 @@ export const prepareVaultManagerKit = (
|
|
|
450
450
|
.getRecordingPeriod(),
|
|
451
451
|
},
|
|
452
452
|
{
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
latestInterestUpdate: state.latestInterestUpdate,
|
|
454
|
+
compoundedInterest: state.compoundedInterest,
|
|
455
455
|
totalDebt: state.totalDebt,
|
|
456
456
|
},
|
|
457
457
|
updateTime,
|
|
458
458
|
);
|
|
459
459
|
|
|
460
|
-
state.
|
|
461
|
-
state.
|
|
460
|
+
state.compoundedInterest = changes.compoundedInterest;
|
|
461
|
+
state.latestInterestUpdate = changes.latestInterestUpdate;
|
|
462
462
|
state.totalDebt = changes.totalDebt;
|
|
463
463
|
|
|
464
464
|
return facets.helper.assetNotify();
|
|
@@ -466,14 +466,14 @@ export const prepareVaultManagerKit = (
|
|
|
466
466
|
assetNotify() {
|
|
467
467
|
const { state } = this;
|
|
468
468
|
const { collateralBrand, assetTopicKit } = state;
|
|
469
|
-
const
|
|
469
|
+
const interestRate = factoryPowers
|
|
470
470
|
.getGovernedParams(collateralBrand)
|
|
471
|
-
.
|
|
471
|
+
.getInterestRate();
|
|
472
472
|
/** @type {AssetState} */
|
|
473
473
|
const payload = harden({
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
compoundedInterest: state.compoundedInterest,
|
|
475
|
+
interestRate,
|
|
476
|
+
latestInterestUpdate: state.latestInterestUpdate,
|
|
477
477
|
});
|
|
478
478
|
return assetTopicKit.recorder.write(payload);
|
|
479
479
|
},
|
|
@@ -853,8 +853,8 @@ export const prepareVaultManagerKit = (
|
|
|
853
853
|
return `${descriptionScope}: ${base}`;
|
|
854
854
|
},
|
|
855
855
|
/** coefficient on existing debt to calculate new debt */
|
|
856
|
-
|
|
857
|
-
return this.state.
|
|
856
|
+
getCompoundedInterest() {
|
|
857
|
+
return this.state.compoundedInterest;
|
|
858
858
|
},
|
|
859
859
|
/**
|
|
860
860
|
* Called by a vault when its balances change.
|
|
@@ -1051,7 +1051,7 @@ export const prepareVaultManagerKit = (
|
|
|
1051
1051
|
);
|
|
1052
1052
|
|
|
1053
1053
|
state.lockedQuote = storedCollateralQuote;
|
|
1054
|
-
facets.helper.writeMetrics();
|
|
1054
|
+
void facets.helper.writeMetrics();
|
|
1055
1055
|
return storedCollateralQuote;
|
|
1056
1056
|
},
|
|
1057
1057
|
/** @param {ERef<AuctioneerPublicFacet>} auctionPF */
|
|
@@ -1060,7 +1060,7 @@ export const prepareVaultManagerKit = (
|
|
|
1060
1060
|
const { self, helper } = facets;
|
|
1061
1061
|
const {
|
|
1062
1062
|
collateralBrand,
|
|
1063
|
-
|
|
1063
|
+
compoundedInterest,
|
|
1064
1064
|
debtBrand,
|
|
1065
1065
|
liquidatingVaults,
|
|
1066
1066
|
lockedQuote,
|
|
@@ -1089,7 +1089,7 @@ export const prepareVaultManagerKit = (
|
|
|
1089
1089
|
zcf,
|
|
1090
1090
|
{
|
|
1091
1091
|
quote: lockedQuote,
|
|
1092
|
-
interest:
|
|
1092
|
+
interest: compoundedInterest,
|
|
1093
1093
|
margin: liqMargin,
|
|
1094
1094
|
},
|
|
1095
1095
|
prioritizedVaults,
|
|
@@ -1101,6 +1101,7 @@ export const prepareVaultManagerKit = (
|
|
|
1101
1101
|
state.lockedQuote = undefined;
|
|
1102
1102
|
|
|
1103
1103
|
if (vaultData.getSize() === 0) {
|
|
1104
|
+
void helper.writeMetrics();
|
|
1104
1105
|
return;
|
|
1105
1106
|
}
|
|
1106
1107
|
trace(
|
|
@@ -1164,7 +1165,7 @@ export const prepareVaultManagerKit = (
|
|
|
1164
1165
|
liquidatingVaults.delete(vault);
|
|
1165
1166
|
}
|
|
1166
1167
|
|
|
1167
|
-
|
|
1168
|
+
void helper.writeMetrics();
|
|
1168
1169
|
},
|
|
1169
1170
|
},
|
|
1170
1171
|
},
|
|
@@ -1174,11 +1175,11 @@ export const prepareVaultManagerKit = (
|
|
|
1174
1175
|
helper.start();
|
|
1175
1176
|
void state.assetTopicKit.recorder.write(
|
|
1176
1177
|
harden({
|
|
1177
|
-
|
|
1178
|
-
|
|
1178
|
+
compoundedInterest: state.compoundedInterest,
|
|
1179
|
+
interestRate: factoryPowers
|
|
1179
1180
|
.getGovernedParams(state.collateralBrand)
|
|
1180
|
-
.
|
|
1181
|
-
|
|
1181
|
+
.getInterestRate(),
|
|
1182
|
+
latestInterestUpdate: state.latestInterestUpdate,
|
|
1182
1183
|
}),
|
|
1183
1184
|
);
|
|
1184
1185
|
|