@agoric/inter-protocol 0.14.1-dev-80bdc60.0 → 0.14.1-dev-effbf7f.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/inter-protocol",
3
- "version": "0.14.1-dev-80bdc60.0+80bdc60",
3
+ "version": "0.14.1-dev-effbf7f.0+effbf7f",
4
4
  "description": "Core cryptoeconomy contracts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -29,29 +29,29 @@
29
29
  },
30
30
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
31
31
  "dependencies": {
32
- "@agoric/assert": "0.6.1-dev-80bdc60.0+80bdc60",
33
- "@agoric/ertp": "0.16.1-dev-80bdc60.0+80bdc60",
34
- "@agoric/governance": "0.10.1-dev-80bdc60.0+80bdc60",
35
- "@agoric/internal": "0.3.1-dev-80bdc60.0+80bdc60",
36
- "@agoric/notifier": "0.6.1-dev-80bdc60.0+80bdc60",
37
- "@agoric/store": "0.9.1-dev-80bdc60.0+80bdc60",
38
- "@agoric/time": "0.3.1-dev-80bdc60.0+80bdc60",
39
- "@agoric/vat-data": "0.5.1-dev-80bdc60.0+80bdc60",
40
- "@agoric/vats": "0.14.1-dev-80bdc60.0+80bdc60",
41
- "@agoric/zoe": "0.26.1-dev-80bdc60.0+80bdc60",
32
+ "@agoric/assert": "0.6.1-dev-effbf7f.0+effbf7f",
33
+ "@agoric/ertp": "0.16.1-dev-effbf7f.0+effbf7f",
34
+ "@agoric/governance": "0.10.1-dev-effbf7f.0+effbf7f",
35
+ "@agoric/internal": "0.3.1-dev-effbf7f.0+effbf7f",
36
+ "@agoric/notifier": "0.6.1-dev-effbf7f.0+effbf7f",
37
+ "@agoric/store": "0.9.1-dev-effbf7f.0+effbf7f",
38
+ "@agoric/time": "0.3.1-dev-effbf7f.0+effbf7f",
39
+ "@agoric/vat-data": "0.5.1-dev-effbf7f.0+effbf7f",
40
+ "@agoric/vats": "0.14.1-dev-effbf7f.0+effbf7f",
41
+ "@agoric/zoe": "0.26.1-dev-effbf7f.0+effbf7f",
42
42
  "@endo/captp": "^3.1.1",
43
43
  "@endo/eventual-send": "^0.17.2",
44
44
  "@endo/far": "^0.2.18",
45
45
  "@endo/marshal": "^0.8.5",
46
46
  "@endo/nat": "^4.1.27",
47
- "agoric": "0.19.1-dev-80bdc60.0+80bdc60",
47
+ "agoric": "0.19.1-dev-effbf7f.0+effbf7f",
48
48
  "jessie.js": "^0.3.2"
49
49
  },
50
50
  "devDependencies": {
51
- "@agoric/deploy-script-support": "0.10.1-dev-80bdc60.0+80bdc60",
52
- "@agoric/smart-wallet": "0.5.1-dev-80bdc60.0+80bdc60",
53
- "@agoric/swingset-liveslots": "0.10.1-dev-80bdc60.0+80bdc60",
54
- "@agoric/swingset-vat": "0.32.1-dev-80bdc60.0+80bdc60",
51
+ "@agoric/deploy-script-support": "0.10.1-dev-effbf7f.0+effbf7f",
52
+ "@agoric/smart-wallet": "0.5.1-dev-effbf7f.0+effbf7f",
53
+ "@agoric/swingset-liveslots": "0.10.1-dev-effbf7f.0+effbf7f",
54
+ "@agoric/swingset-vat": "0.32.1-dev-effbf7f.0+effbf7f",
55
55
  "@endo/bundle-source": "^2.5.1",
56
56
  "@endo/init": "^0.5.56",
57
57
  "@endo/promise-kit": "^0.2.56",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "80bdc601d42ab5b1e832b57995e4659caef60892"
82
+ "gitHead": "effbf7f7a278863b88419e0a19ae19f0db4b30a0"
83
83
  }
@@ -1,9 +1,7 @@
1
1
  // @jessie-check
2
2
 
3
3
  import { AmountMath } from '@agoric/ertp';
4
- import { makeStoredPublisherKit, makeStoredPublishKit } from '@agoric/notifier';
5
4
  import { M } from '@agoric/store';
6
- import { E } from '@endo/eventual-send';
7
5
 
8
6
  const { Fail, quote: q } = assert;
9
7
 
@@ -65,27 +63,6 @@ export const checkDebtLimit = (debtLimit, totalDebt, toMint) => {
65
63
  )} would hit total debt limit ${q(debtLimit)}`;
66
64
  };
67
65
 
68
- /**
69
- * @deprecated incompatible with durability; instead handle vstorage ephemerally on a durable PublishKit
70
- * @template T
71
- * @param {ERef<StorageNode>} storageNode
72
- * @param {ERef<Marshaller>} marshaller
73
- * @returns {MetricsPublisherKit<T>}
74
- */
75
- export const makeMetricsPublisherKit = (storageNode, marshaller) => {
76
- assert(
77
- storageNode && marshaller,
78
- 'makeMetricsPublisherKit missing storageNode or marshaller',
79
- );
80
- /** @type {import('@agoric/notifier').StoredPublisherKit<T>} */
81
- const kit = makeStoredPublisherKit(storageNode, marshaller, 'metrics');
82
- return {
83
- metricsPublication: kit.publisher,
84
- metricsSubscription: kit.subscriber,
85
- };
86
- };
87
- harden(makeMetricsPublisherKit);
88
-
89
66
  /**
90
67
  * @template T
91
68
  * @typedef {object} MetricsPublisherKit<T>
@@ -100,28 +77,6 @@ harden(makeMetricsPublisherKit);
100
77
  * @property {StoredSubscriber<T>} metricsSubscriber
101
78
  */
102
79
 
103
- /**
104
- * @deprecated incompatible with durability; instead handle vstorage ephemerally on a durable PublishKit
105
- * @template T
106
- * @param {ERef<StorageNode>} storageNode
107
- * @param {ERef<Marshaller>} marshaller
108
- * @returns {MetricsPublishKit<T>}
109
- */
110
- export const makeMetricsPublishKit = (storageNode, marshaller) => {
111
- assert(
112
- storageNode && marshaller,
113
- 'makeMetricsPublisherKit missing storageNode or marshaller',
114
- );
115
- const metricsNode = E(storageNode).makeChildNode('metrics');
116
- /** @type {StoredPublishKit<T>} */
117
- const kit = makeStoredPublishKit(metricsNode, marshaller);
118
- return {
119
- metricsPublisher: kit.publisher,
120
- metricsSubscriber: kit.subscriber,
121
- };
122
- };
123
- harden(makeMetricsPublishKit);
124
-
125
80
  /**
126
81
  * @param {Brand} brand must be a 'nat' brand, not checked
127
82
  * @param {NatValue} [min]
@@ -5,11 +5,7 @@
5
5
  */
6
6
  import { AmountMath } from '@agoric/ertp';
7
7
  import { assertAllDefined, makeTracer } from '@agoric/internal';
8
- import {
9
- makeNotifierFromSubscriber,
10
- observeNotifier,
11
- SubscriberShape,
12
- } from '@agoric/notifier';
8
+ import { makeNotifierFromSubscriber, observeNotifier } from '@agoric/notifier';
13
9
  import { M, makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data';
14
10
  import {
15
11
  defineRecorderKit,
@@ -208,8 +204,6 @@ export const prepareFluxAggregatorKit = async (
208
204
  creator: M.interface('fluxAggregator creatorFacet', {}, { sloppy: true }),
209
205
  public: M.interface('fluxAggregator publicFacet', {
210
206
  getPriceAuthority: M.call().returns(M.any()),
211
- getSubscriber: M.call().returns(SubscriberShape),
212
- getRoundStartNotifier: M.call().returns(SubscriberShape),
213
207
  getPublicTopics: M.call().returns({
214
208
  quotes: M.any(),
215
209
  latestRound: M.any(),
@@ -346,14 +340,6 @@ export const prepareFluxAggregatorKit = async (
346
340
  getPriceAuthority() {
347
341
  return priceAuthority;
348
342
  },
349
- /** @deprecated use getPublicTopics */
350
- getSubscriber: () => {
351
- return priceKit.subscriber;
352
- },
353
- /** @deprecated use getPublicTopics */
354
- getRoundStartNotifier() {
355
- return latestRoundKit.subscriber;
356
- },
357
343
  getPublicTopics() {
358
344
  return {
359
345
  quotes: makeRecorderTopic(
@@ -519,7 +519,7 @@ export const startAuctioneer = async (
519
519
  },
520
520
  },
521
521
  issuer: {
522
- consume: { [Stable.symbol]: runIssuerP },
522
+ consume: { [Stable.symbol]: stableIssuerP },
523
523
  },
524
524
  },
525
525
  {
@@ -539,11 +539,11 @@ export const startAuctioneer = async (
539
539
 
540
540
  const poserInvitationP = E(electorateCreatorFacet).getPoserInvitation();
541
541
 
542
- const [initialPoserInvitation, electorateInvitationAmount, runIssuer] =
542
+ const [initialPoserInvitation, electorateInvitationAmount, stableIssuer] =
543
543
  await Promise.all([
544
544
  poserInvitationP,
545
545
  E(E(zoe).getInvitationIssuer()).getAmountOf(poserInvitationP),
546
- runIssuerP,
546
+ stableIssuerP,
547
547
  ]);
548
548
 
549
549
  const timerBrand = await E(chainTimerService).getTimerBrand();
@@ -571,7 +571,7 @@ export const startAuctioneer = async (
571
571
  governedContractInstallation: auctionInstallation,
572
572
  governed: {
573
573
  terms: auctionTerms,
574
- issuerKeywordRecord: { Bid: runIssuer },
574
+ issuerKeywordRecord: { Bid: stableIssuer },
575
575
  storageNode,
576
576
  marshaller,
577
577
  label: 'auctioneer',
@@ -5,7 +5,6 @@ import { M, makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data';
5
5
  import { atomicTransfer } from '@agoric/zoe/src/contractSupport/atomicTransfer.js';
6
6
  import {
7
7
  makeRecorderTopic,
8
- SubscriberShape,
9
8
  TopicsRecordShape,
10
9
  } from '@agoric/zoe/src/contractSupport/topics.js';
11
10
  import { AmountKeywordRecordShape } from '@agoric/zoe/src/typeGuards.js';
@@ -57,7 +56,6 @@ export const prepareAssetReserveKit = async (
57
56
  }),
58
57
  public: M.interface('AssetReserve public', {
59
58
  makeAddCollateralInvitation: M.call().returns(M.promise()),
60
- getMetrics: M.call().returns(SubscriberShape),
61
59
  getPublicTopics: M.call().returns(TopicsRecordShape),
62
60
  }),
63
61
  shortfallReportingFacet: M.interface('AssetReserve shortfall reporter', {
@@ -189,7 +187,7 @@ export const prepareAssetReserveKit = async (
189
187
  await zcf.saveIssuer(issuer, keyword);
190
188
  },
191
189
 
192
- /** @deprecated use getPublicTopics metrics allocation */
190
+ /** XXX redundant with getPublicTopics metrics `allocation` */
193
191
  getAllocations() {
194
192
  return this.state.collateralSeat.getCurrentAllocation();
195
193
  },
@@ -239,10 +237,6 @@ export const prepareAssetReserveKit = async (
239
237
  };
240
238
  return zcf.makeInvitation(handler, 'Add Collateral');
241
239
  },
242
- /** @deprecated */
243
- getMetrics() {
244
- return this.state.metricsKit.subscriber;
245
- },
246
240
  getPublicTopics() {
247
241
  return {
248
242
  metrics: makeRecorderTopic(
@@ -90,20 +90,20 @@ sequenceDiagram
90
90
  participant caller
91
91
  participant reserveContract
92
92
  participant collateralSeat
93
- participant runMint
93
+ participant stableMint
94
94
  participant runSeat
95
95
  participant zcf
96
96
  participant ammPublicFacet
97
97
  participant liquidityInvite
98
98
 
99
- caller ->> reserveContract: addLiquidityToAmmPool(collateralAmount, runAmount)
99
+ caller ->> reserveContract: addLiquidityToAmmPool(collateralAmount, stableAmount)
100
100
  reserveContract ->> reserveContract: get collateralKeyword from collateralAmount.brand
101
101
  reserveContract ->> collateralSeat: get current allocation for collateralKeyword
102
102
  reserveContract ->> reserveContract: ensure current allocation for collateralKeyword is >= collateralAmount
103
103
 
104
104
 
105
105
  note right of reserveContract: create the IST
106
- reserveContract ->> runMint: mintGains of runAmount, and get runSeat
106
+ reserveContract ->> stableMint: mintGains of stableAmount, and get runSeat
107
107
  reserveContract ->> runSeat: increment collateralKeyword: collateralAmount
108
108
  reserveContract ->> collateralSeat: decrement collateralKeyword: collateralAmount
109
109
  reserveContract ->> zcf: reallocate(runSeat, collateralSeat)
@@ -112,7 +112,7 @@ note right of reserveContract: Add IST and collateral to the AMM
112
112
  reserveContract ->> ammPublicFacet: get invite for makeAddLiquidityAtRateInvitation
113
113
  reserveContract ->> reserveContract: create mapping, IST = central, collateralKeyword: secondary
114
114
  reserveContract ->> reserveContract: get liquidity brand for collateralKeyword
115
- reserveContract ->> reserveContract: terms mapping, give Central: runAmount, Secondary collateralAmount, want liquidity
115
+ reserveContract ->> reserveContract: terms mapping, give Central: stableAmount, Secondary collateralAmount, want liquidity
116
116
  reserveContract ->> zcf: offer
117
117
 
118
118
 
@@ -21,15 +21,6 @@
21
21
  * @property {() => Invitation} makeSwapInvitation
22
22
  */
23
23
 
24
- /**
25
- * @typedef {object} Collateral
26
- * @property {Ratio} liquidationMargin
27
- * @property {Ratio} stabilityFee
28
- * @property {Ratio} marketPrice
29
- * @property {Ratio} interestRate
30
- * @property {Brand} brand
31
- */
32
-
33
24
  /**
34
25
  * @typedef {object} VaultManagerParamValues
35
26
  * @property {Ratio} liquidationMargin - margin below which collateral will be
@@ -108,7 +99,7 @@
108
99
  * @typedef {object} LiquidationStrategy
109
100
  * @property {() => KeywordKeywordRecord} keywordMapping
110
101
  * @property {(collateral: Amount, run: Amount) => Proposal} makeProposal
111
- * @property {(runDebt: Amount) => Promise<Invitation>} makeInvitation
102
+ * @property {(debt: Amount) => Promise<Invitation>} makeInvitation
112
103
  */
113
104
 
114
105
  /**
@@ -15,9 +15,6 @@ import {
15
15
  import { assertKeywordName } from '@agoric/zoe/src/cleanProposal.js';
16
16
  import {
17
17
  atomicRearrange,
18
- getAmountIn,
19
- getAmountOut,
20
- makeRatioFromAmounts,
21
18
  makeRecorderTopic,
22
19
  provideEmptySeat,
23
20
  SubscriberShape,
@@ -299,9 +296,7 @@ export const prepareVaultDirector = (
299
296
  }),
300
297
  public: M.interface('public', {
301
298
  getCollateralManager: M.call(BrandShape).returns(M.remotable()),
302
- getCollaterals: M.call().returns(M.promise()),
303
- getMetrics: M.call().returns(SubscriberShape),
304
- getRunIssuer: M.call().returns(IssuerShape),
299
+ getDebtIssuer: M.call().returns(IssuerShape),
305
300
  getSubscription: M.call({ collateralBrand: BrandShape }).returns(
306
301
  SubscriberShape,
307
302
  ),
@@ -454,44 +449,10 @@ export const prepareVaultDirector = (
454
449
  /** @type {VaultManager} */
455
450
  return managerForCollateral(brandIn).getPublicFacet();
456
451
  },
457
- /**
458
- * @deprecated get `collaterals` list from metrics
459
- */
460
- async getCollaterals() {
461
- // should be collateralManagers.map((vm, brand) => ({
462
- return harden(
463
- Promise.all(
464
- [...collateralManagers.entries()].map(
465
- async ([brand, managerIndex]) => {
466
- const vm = vaultManagers.get(managerIndex).self;
467
- const priceQuote = await vm.getCollateralQuote();
468
- return {
469
- brand,
470
- interestRate: vm.getGovernedParams().getInterestRate(),
471
- liquidationMargin: vm
472
- .getGovernedParams()
473
- .getLiquidationMargin(),
474
- stabilityFee: vm.getGovernedParams().getMintFee(),
475
- marketPrice: makeRatioFromAmounts(
476
- getAmountOut(priceQuote),
477
- getAmountIn(priceQuote),
478
- ),
479
- };
480
- },
481
- ),
482
- ),
483
- );
484
- },
485
- /** @deprecated use getPublicTopics */
486
- getMetrics() {
487
- return metricsKit.subscriber;
488
- },
489
- getRunIssuer() {
452
+ getDebtIssuer() {
490
453
  return debtMint.getIssuerRecord().issuer;
491
454
  },
492
455
  /**
493
- * @deprecated get from the CollateralManager directly
494
- *
495
456
  * subscription for the paramManager for a particular vaultManager
496
457
  *
497
458
  * @param {{ collateralBrand: Brand }} selector
@@ -3,10 +3,7 @@
3
3
  */
4
4
  import { AmountShape } from '@agoric/ertp';
5
5
  import { M, prepareExoClassKit } from '@agoric/vat-data';
6
- import {
7
- SubscriberShape,
8
- TopicsRecordShape,
9
- } from '@agoric/zoe/src/contractSupport/index.js';
6
+ import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js';
10
7
  import { UnguardedHelperI } from '../typeGuards.js';
11
8
 
12
9
  const { Fail } = assert;
@@ -22,7 +19,6 @@ const HolderI = M.interface('holder', {
22
19
  getCollateralAmount: M.call().returns(AmountShape),
23
20
  getCurrentDebt: M.call().returns(AmountShape),
24
21
  getNormalizedDebt: M.call().returns(AmountShape),
25
- getSubscriber: M.call().returns(SubscriberShape),
26
22
  getPublicTopics: M.call().returns(TopicsRecordShape),
27
23
  makeAdjustBalancesInvitation: M.call().returns(M.promise()),
28
24
  makeCloseInvitation: M.call().returns(M.promise()),
@@ -91,10 +87,6 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
91
87
  },
92
88
  },
93
89
  holder: {
94
- /** @deprecated use getPublicTopics */
95
- getSubscriber() {
96
- return this.state.topicKit.subscriber;
97
- },
98
90
  getPublicTopics() {
99
91
  const { topicKit } = this.state;
100
92
  return harden({
@@ -73,6 +73,8 @@ const trace = makeTracer('VM');
73
73
  /**
74
74
  * @typedef {object} MetricsNotification
75
75
  *
76
+ * @property {Ratio | null} lockedQuote priceQuote that will be used for liquidation.
77
+ * Non-null from priceLock time until liquidation has taken place.
76
78
  * @property {number} numActiveVaults present count of vaults
77
79
  * @property {number} numLiquidatingVaults present count of liquidating vaults
78
80
  * @property {Amount<'nat'>} totalCollateral present sum of collateral across all vaults
@@ -254,8 +256,6 @@ export const prepareVaultManagerKit = (
254
256
  {
255
257
  collateral: M.interface('collateral', {
256
258
  makeVaultInvitation: M.call().returns(M.promise()),
257
- getSubscriber: M.call().returns(SubscriberShape),
258
- getMetrics: M.call().returns(SubscriberShape),
259
259
  getPublicTopics: M.call().returns(TopicsRecordShape),
260
260
  getQuotes: M.call().returns(NotifierShape),
261
261
  getCompoundedInterest: M.call().returns(RatioShape),
@@ -318,14 +318,6 @@ export const prepareVaultManagerKit = (
318
318
  }),
319
319
  );
320
320
  },
321
- /** @deprecated use getPublicTopics */
322
- getSubscriber() {
323
- return this.state.assetTopicKit.subscriber;
324
- },
325
- /** @deprecated use getPublicTopics */
326
- getMetrics() {
327
- return this.state.metricsTopicKit.subscriber;
328
- },
329
321
  getQuotes() {
330
322
  const ephemera = collateralEphemera(this.state.collateralBrand);
331
323
  return ephemera.storedQuotesNotifier;
@@ -609,6 +601,11 @@ export const prepareVaultManagerKit = (
609
601
  retainedCollateralSeat.getCurrentAllocation()?.Collateral ??
610
602
  AmountMath.makeEmpty(collateralBrand, 'nat');
611
603
 
604
+ const quote = state.lockedQuote;
605
+ const lockedQuoteRatio = quote
606
+ ? quoteAsRatio(quote.quoteAmount.value[0])
607
+ : null;
608
+
612
609
  /** @type {MetricsNotification} */
613
610
  const payload = harden({
614
611
  numActiveVaults: prioritizedVaults.getCount(),
@@ -625,6 +622,7 @@ export const prepareVaultManagerKit = (
625
622
  totalOverageReceived: state.totalOverageReceived,
626
623
  totalProceedsReceived: state.totalProceedsReceived,
627
624
  totalShortfallReceived: state.totalShortfallReceived,
625
+ lockedQuote: lockedQuoteRatio,
628
626
  });
629
627
 
630
628
  return E(metricsTopicKit.recorder).write(payload);
@@ -1231,7 +1229,7 @@ export const prepareVaultManagerKit = (
1231
1229
  },
1232
1230
 
1233
1231
  lockOraclePrices() {
1234
- const { state } = this;
1232
+ const { state, facets } = this;
1235
1233
  const { storedCollateralQuote } = collateralEphemera(
1236
1234
  state.collateralBrand,
1237
1235
  );
@@ -1244,6 +1242,7 @@ export const prepareVaultManagerKit = (
1244
1242
  );
1245
1243
 
1246
1244
  state.lockedQuote = storedCollateralQuote;
1245
+ facets.helper.writeMetrics();
1247
1246
  return storedCollateralQuote;
1248
1247
  },
1249
1248
  /**