@agoric/inter-protocol 0.17.0 → 0.17.1-upgrade-23-dev-bd79330.0.bd79330

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 (148) hide show
  1. package/package.json +23 -27
  2. package/source-spec-registry.js +67 -0
  3. package/src/auction/util.d.ts +3 -1
  4. package/src/auction/util.d.ts.map +1 -1
  5. package/src/auction/util.js +1 -2
  6. package/src/clientSupport.d.ts +29 -73
  7. package/src/clientSupport.d.ts.map +1 -1
  8. package/src/clientSupport.js +25 -129
  9. package/src/collectFees.d.ts +4 -0
  10. package/src/collectFees.d.ts.map +1 -1
  11. package/src/collectFees.js +5 -2
  12. package/src/contractSupport.d.ts +10 -2
  13. package/src/contractSupport.d.ts.map +1 -1
  14. package/src/contractSupport.js +8 -3
  15. package/src/econCommitteeCharter.d.ts +19 -8
  16. package/src/econCommitteeCharter.d.ts.map +1 -1
  17. package/src/econCommitteeCharter.js +12 -12
  18. package/src/feeDistributor.d.ts +56 -52
  19. package/src/feeDistributor.d.ts.map +1 -1
  20. package/src/feeDistributor.js +5 -3
  21. package/src/index.js +0 -3
  22. package/src/interest-math.d.ts +1 -0
  23. package/src/interest-math.d.ts.map +1 -1
  24. package/src/interest-math.js +1 -2
  25. package/src/interest.d.ts +13 -1
  26. package/src/interest.d.ts.map +1 -1
  27. package/src/interest.js +6 -3
  28. package/src/price/fluxAggregatorContract.d.ts +38 -14
  29. package/src/price/fluxAggregatorContract.d.ts.map +1 -1
  30. package/src/price/fluxAggregatorContract.js +26 -12
  31. package/src/price/fluxAggregatorKit.d.ts +18 -8
  32. package/src/price/fluxAggregatorKit.d.ts.map +1 -1
  33. package/src/price/fluxAggregatorKit.js +22 -8
  34. package/src/price/priceOracleKit.d.ts +3 -1
  35. package/src/price/priceOracleKit.d.ts.map +1 -1
  36. package/src/price/priceOracleKit.js +3 -1
  37. package/src/price/roundsManager.d.ts +15 -8
  38. package/src/price/roundsManager.d.ts.map +1 -1
  39. package/src/price/roundsManager.js +9 -2
  40. package/src/proposals/addAssetToVault.js +17 -105
  41. package/src/proposals/committee-proposal.js +14 -14
  42. package/src/proposals/core-proposal.js +12 -37
  43. package/src/proposals/deploy-price-feeds.js +12 -5
  44. package/src/proposals/econ-behaviors.js +23 -154
  45. package/src/proposals/price-feed-proposal.js +14 -4
  46. package/src/proposals/replace-fee-distributor.js +8 -4
  47. package/src/proposals/replace-scaledPriceAuthorities.js +8 -2
  48. package/src/proposals/replaceElectorate.js +7 -1
  49. package/src/proposals/startEconCommittee.js +5 -1
  50. package/src/proposals/startPSM.js +15 -6
  51. package/src/proposals/upgrade-scaledPriceAuthorities.js +5 -0
  52. package/src/proposals/utils.d.ts +10 -4
  53. package/src/proposals/utils.d.ts.map +1 -1
  54. package/src/proposals/utils.js +16 -8
  55. package/src/proposals/withdraw-reserve-proposal.js +6 -1
  56. package/src/provisionPool.d.ts +36 -18
  57. package/src/provisionPool.d.ts.map +1 -1
  58. package/src/provisionPool.js +19 -12
  59. package/src/provisionPoolKit.d.ts +29 -77
  60. package/src/provisionPoolKit.d.ts.map +1 -1
  61. package/src/provisionPoolKit.js +33 -23
  62. package/src/psm/psm.d.ts +36 -24
  63. package/src/psm/psm.d.ts.map +1 -1
  64. package/src/psm/psm.js +19 -15
  65. package/src/reserve/assetReserve.d.ts +16 -6
  66. package/src/reserve/assetReserve.d.ts.map +1 -1
  67. package/src/reserve/assetReserve.js +17 -9
  68. package/src/reserve/assetReserveKit.d.ts +13 -10
  69. package/src/reserve/assetReserveKit.d.ts.map +1 -1
  70. package/src/reserve/assetReserveKit.js +7 -5
  71. package/src/reserve/params.d.ts +1 -1
  72. package/src/reserve/params.d.ts.map +1 -1
  73. package/src/reserve/params.js +1 -3
  74. package/src/vaultFactory/burn.d.ts +4 -1
  75. package/src/vaultFactory/burn.d.ts.map +1 -1
  76. package/src/vaultFactory/burn.js +5 -4
  77. package/src/vaultFactory/math.d.ts +2 -0
  78. package/src/vaultFactory/math.d.ts.map +1 -1
  79. package/src/vaultFactory/math.js +5 -3
  80. package/src/vaultFactory/orderedVaultStore.d.ts +36 -36
  81. package/src/vaultFactory/params.d.ts +37 -10
  82. package/src/vaultFactory/params.d.ts.map +1 -1
  83. package/src/vaultFactory/params.js +34 -13
  84. package/src/vaultFactory/prioritizedVaults.d.ts +98 -95
  85. package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -1
  86. package/src/vaultFactory/prioritizedVaults.js +3 -2
  87. package/src/vaultFactory/storeUtils.d.ts +8 -3
  88. package/src/vaultFactory/storeUtils.d.ts.map +1 -1
  89. package/src/vaultFactory/storeUtils.js +8 -4
  90. package/src/vaultFactory/{types-ambient.d.ts → types.d.ts} +40 -40
  91. package/src/vaultFactory/types.d.ts.map +1 -0
  92. package/src/vaultFactory/{types-ambient.js → types.js} +26 -25
  93. package/src/vaultFactory/vault.d.ts +51 -35
  94. package/src/vaultFactory/vault.d.ts.map +1 -1
  95. package/src/vaultFactory/vault.js +29 -17
  96. package/src/vaultFactory/vaultDirector.d.ts +102 -112
  97. package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
  98. package/src/vaultFactory/vaultDirector.js +40 -82
  99. package/src/vaultFactory/vaultFactory.d.ts +47 -95
  100. package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
  101. package/src/vaultFactory/vaultFactory.js +27 -27
  102. package/src/vaultFactory/vaultHolder.d.ts +62 -55
  103. package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
  104. package/src/vaultFactory/vaultHolder.js +10 -4
  105. package/src/vaultFactory/vaultKit.d.ts +15 -10
  106. package/src/vaultFactory/vaultKit.d.ts.map +1 -1
  107. package/src/vaultFactory/vaultKit.js +8 -7
  108. package/src/vaultFactory/vaultManager.d.ts +112 -262
  109. package/src/vaultFactory/vaultManager.d.ts.map +1 -1
  110. package/src/vaultFactory/vaultManager.js +42 -319
  111. package/NEWS.md +0 -0
  112. package/scripts/build-bundles.js +0 -22
  113. package/src/auction/auctionBook.d.ts +0 -147
  114. package/src/auction/auctionBook.d.ts.map +0 -1
  115. package/src/auction/auctionBook.js +0 -794
  116. package/src/auction/auctionMath.d.ts +0 -17
  117. package/src/auction/auctionMath.d.ts.map +0 -1
  118. package/src/auction/auctionMath.js +0 -81
  119. package/src/auction/auctioneer.d.ts +0 -70
  120. package/src/auction/auctioneer.d.ts.map +0 -1
  121. package/src/auction/auctioneer.js +0 -733
  122. package/src/auction/offerBook.d.ts +0 -46
  123. package/src/auction/offerBook.d.ts.map +0 -1
  124. package/src/auction/offerBook.js +0 -226
  125. package/src/auction/params.d.ts +0 -145
  126. package/src/auction/params.d.ts.map +0 -1
  127. package/src/auction/params.js +0 -176
  128. package/src/auction/scheduleMath.d.ts +0 -5
  129. package/src/auction/scheduleMath.d.ts.map +0 -1
  130. package/src/auction/scheduleMath.js +0 -169
  131. package/src/auction/scheduler.d.ts +0 -50
  132. package/src/auction/scheduler.d.ts.map +0 -1
  133. package/src/auction/scheduler.js +0 -376
  134. package/src/auction/sortedOffers.d.ts +0 -8
  135. package/src/auction/sortedOffers.d.ts.map +0 -1
  136. package/src/auction/sortedOffers.js +0 -137
  137. package/src/proposals/add-auction.js +0 -285
  138. package/src/proposals/upgrade-vaults.js +0 -207
  139. package/src/psm/types-ambient.d.ts +0 -2
  140. package/src/psm/types-ambient.d.ts.map +0 -1
  141. package/src/psm/types-ambient.js +0 -3
  142. package/src/vaultFactory/liquidation.d.ts +0 -25
  143. package/src/vaultFactory/liquidation.d.ts.map +0 -1
  144. package/src/vaultFactory/liquidation.js +0 -309
  145. package/src/vaultFactory/proceeds.d.ts +0 -35
  146. package/src/vaultFactory/proceeds.d.ts.map +0 -1
  147. package/src/vaultFactory/proceeds.js +0 -282
  148. package/src/vaultFactory/types-ambient.d.ts.map +0 -1
@@ -1,137 +0,0 @@
1
- // @jessie-check
2
-
3
- import { Fail } from '@endo/errors';
4
- import {
5
- makeRatio,
6
- ratioToNumber,
7
- } from '@agoric/zoe/src/contractSupport/index.js';
8
- import { M, mustMatch } from '@agoric/store';
9
- import { RatioShape } from '@agoric/ertp';
10
-
11
- import { decodeData, encodeData } from '../vaultFactory/storeUtils.js';
12
-
13
- /**
14
- * @file we use a floating point representation of the price or rate as the
15
- * first part of the key in the store. The second part is the sequence number
16
- * of the bid, but it doesn't matter for sorting. When we retrieve multiple
17
- * bids, it's only by bid value, so we don't care how the sequence numbers
18
- * sort.
19
- *
20
- * We take advantage of the fact that encodeData takes a passable and turns it
21
- * into a sort key. Arrays of passable data sort like composite keys.
22
- */
23
-
24
- /**
25
- * Return a sort key that will compare based only on price. Price is the prefix
26
- * of the complete sort key, which is sufficient to find offers below a cutoff.
27
- *
28
- * @param {Ratio} offerPrice
29
- */
30
- export const toPartialOfferKey = offerPrice => {
31
- assert(offerPrice);
32
- const mostSignificantPart = ratioToNumber(offerPrice);
33
- return encodeData(harden([mostSignificantPart, 0n]));
34
- };
35
-
36
- /**
37
- * Return a sort key that distinguishes by Price and sequence number
38
- *
39
- * @param {Ratio} offerPrice IST/collateral
40
- * @param {bigint} sequenceNumber
41
- * @returns {string} lexically sortable string in which highest price is first,
42
- * ties will be broken by sequenceNumber of offer
43
- */
44
- export const toPriceOfferKey = (offerPrice, sequenceNumber) => {
45
- mustMatch(offerPrice, RatioShape);
46
- offerPrice.numerator.brand !== offerPrice.denominator.brand ||
47
- Fail`offer prices must have different numerator and denominator`;
48
- mustMatch(sequenceNumber, M.nat());
49
-
50
- const mostSignificantPart = ratioToNumber(offerPrice);
51
- return encodeData(harden([mostSignificantPart, sequenceNumber]));
52
- };
53
-
54
- /**
55
- * @param {number} floatPrice
56
- * @param {Brand<'nat'>} numBrand
57
- * @param {Brand<'nat'>} denomBrand
58
- * @param {number} useDecimals
59
- * @returns {Ratio}
60
- */
61
- const priceRatioFromFloat = (floatPrice, numBrand, denomBrand, useDecimals) => {
62
- const denominatorValue = 10 ** useDecimals;
63
- return makeRatio(
64
- BigInt(Math.round(floatPrice * denominatorValue)),
65
- numBrand,
66
- BigInt(denominatorValue),
67
- denomBrand,
68
- );
69
- };
70
-
71
- const bidScalingRatioFromKey = (bidScaleFloat, numBrand, useDecimals) => {
72
- const denominatorValue = 10 ** useDecimals;
73
- return makeRatio(
74
- BigInt(Math.round(bidScaleFloat * denominatorValue)),
75
- numBrand,
76
- BigInt(denominatorValue),
77
- );
78
- };
79
-
80
- /**
81
- * fromPriceOfferKey is only used for diagnostics.
82
- *
83
- * @param {string} key
84
- * @param {Brand<'nat'>} numBrand
85
- * @param {Brand<'nat'>} denomBrand
86
- * @param {number} useDecimals
87
- * @returns {[normalizedPrice: Ratio, sequenceNumber: bigint]}
88
- */
89
- export const fromPriceOfferKey = (key, numBrand, denomBrand, useDecimals) => {
90
- // @ts-expect-error XXX
91
- const [pricePart, sequenceNumberPart] = decodeData(key);
92
- return [
93
- priceRatioFromFloat(pricePart, numBrand, denomBrand, useDecimals),
94
- sequenceNumberPart,
95
- ];
96
- };
97
-
98
- /** @type {(rate: Ratio) => string} */
99
- export const toBidScalingComparator = rate => {
100
- assert(rate);
101
- const mostSignificantPart = ratioToNumber(rate);
102
- return encodeData(harden([mostSignificantPart, 0n]));
103
- };
104
-
105
- /**
106
- * Sorts offers expressed as percentage of the current oracle price.
107
- *
108
- * @param {Ratio} rate discount/markup rate expressed as a ratio IST/IST
109
- * @param {bigint} sequenceNumber
110
- * @returns {string} lexically sortable string in which highest price is first,
111
- * ties will be broken by sequenceNumber of offer
112
- */
113
- export const toScaledRateOfferKey = (rate, sequenceNumber) => {
114
- mustMatch(rate, RatioShape);
115
- rate.numerator.brand === rate.denominator.brand ||
116
- Fail`bid scaling rate must have the same numerator and denominator`;
117
- mustMatch(sequenceNumber, M.nat());
118
-
119
- const mostSignificantPart = ratioToNumber(rate);
120
- return encodeData(harden([mostSignificantPart, sequenceNumber]));
121
- };
122
-
123
- /**
124
- * fromScaledRateOfferKey is only used for diagnostics.
125
- *
126
- * @param {string} key
127
- * @param {Brand} brand
128
- * @param {number} useDecimals
129
- * @returns {[normalizedPrice: Ratio, sequenceNumber: bigint]}
130
- */
131
- export const fromScaledRateOfferKey = (key, brand, useDecimals) => {
132
- const [bidScalingPart, sequenceNumberPart] = decodeData(key);
133
- return [
134
- bidScalingRatioFromKey(bidScalingPart, brand, useDecimals),
135
- sequenceNumberPart,
136
- ];
137
- };
@@ -1,285 +0,0 @@
1
- import { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
2
- import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
3
- import { Stable } from '@agoric/internal/src/tokens.js';
4
- import { E } from '@endo/far';
5
- import { makeGovernedTerms as makeGovernedATerms } from '../auction/params.js';
6
- import { provideRetiredInstances } from './utils.js';
7
-
8
- const trace = makeTracer('NewAuction', true);
9
-
10
- /**
11
- * @typedef {PromiseSpaceOf<{
12
- * auctionUpgradeNewInstance: Instance;
13
- * auctionUpgradeNewGovCreator: any;
14
- * newContractGovBundleId: string;
15
- * retiredContractInstances: MapStore<string, Instance>;
16
- * }>} interlockPowers
17
- */
18
-
19
- /**
20
- * @param {import('./econ-behaviors.js').EconomyBootstrapPowers &
21
- * interlockPowers} powers
22
- * @param {{
23
- * options: {
24
- * contractGovernorRef: { bundleID: string };
25
- * contractGovernorInstallation: Installation;
26
- * };
27
- * }} options
28
- */
29
- export const addAuction = async (
30
- {
31
- consume: {
32
- agoricNamesAdmin,
33
- auctioneerKit: legacyKitP,
34
- board,
35
- chainStorage,
36
- chainTimerService,
37
- economicCommitteeCreatorFacet: electorateCreatorFacet,
38
- governedContractKits: governedContractKitsP,
39
- priceAuthority8400,
40
- retiredContractInstances: retiredContractInstancesP,
41
- zoe,
42
- },
43
- produce: {
44
- auctioneerKit: produceAuctioneerKit,
45
- auctionUpgradeNewInstance,
46
- auctionUpgradeNewGovCreator,
47
- newContractGovBundleId,
48
- retiredContractInstances: produceRetiredInstances,
49
- },
50
- instance: {
51
- consume: { reserve: reserveInstance },
52
- produce: { auctioneer: auctionInstance },
53
- },
54
- installation: {
55
- consume: { auctioneer: auctioneerInstallationP },
56
- },
57
- issuer: {
58
- consume: { [Stable.symbol]: stableIssuerP },
59
- },
60
- },
61
- {
62
- options: {
63
- contractGovernorRef: contractGovernorBundle,
64
- contractGovernorInstallation,
65
- },
66
- },
67
- ) => {
68
- trace('addAuction start');
69
- const STORAGE_PATH = 'auction';
70
-
71
- const poserInvitationP = E(electorateCreatorFacet).getPoserInvitation();
72
- const [
73
- initialPoserInvitation,
74
- electorateInvitationAmount,
75
- stableIssuer,
76
- legacyKit,
77
- auctioneerInstallation,
78
- ] = await Promise.all([
79
- poserInvitationP,
80
- E(E(zoe).getInvitationIssuer()).getAmountOf(poserInvitationP),
81
- stableIssuerP,
82
- legacyKitP,
83
- auctioneerInstallationP,
84
- ]);
85
-
86
- const retiredInstances = await provideRetiredInstances(
87
- retiredContractInstancesP,
88
- produceRetiredInstances,
89
- );
90
-
91
- const governedContractKits = await governedContractKitsP;
92
- trace('has', governedContractKits.has(legacyKit.instance));
93
- if (governedContractKits.has(legacyKit.instance)) {
94
- // bootstrap tests start having already run this upgrade. Actual upgrades on
95
- // mainNet or testnets should start with the promiseSpace post upgrade-17,
96
- // which doesn't have this entry in the map.
97
- trace(
98
- '⚠️ WARNING: not expected during chain upgrade. It IS normal during bootstrap tests',
99
- );
100
- } else {
101
- // @ts-expect-error The original auctioneerKit had everything it needs
102
- governedContractKits.init(legacyKit.instance, legacyKit);
103
- }
104
-
105
- // save the auctioneer instance so we can manage it later
106
- const boardID = await E(board).getId(legacyKit.instance);
107
- const identifier = `auctioneer-${boardID}`;
108
- retiredInstances.init(identifier, legacyKit.instance);
109
-
110
- // Each field has an extra layer of type + value:
111
- // AuctionStartDelay: { type: 'relativeTime', value: { relValue: 2n, timerBrand: Object [Alleged: timerBrand] {} } }
112
- /** @type {any} */
113
- const paramValues = await E(legacyKit.publicFacet).getGovernedParams();
114
- const params = harden({
115
- StartFrequency: paramValues.StartFrequency.value,
116
- ClockStep: paramValues.ClockStep.value,
117
- StartingRate: paramValues.StartingRate.value,
118
- LowestRate: paramValues.LowestRate.value,
119
- DiscountStep: paramValues.DiscountStep.value,
120
- AuctionStartDelay: paramValues.AuctionStartDelay.value,
121
- PriceLockPeriod: paramValues.PriceLockPeriod.value,
122
- });
123
- const timerBrand = await E(chainTimerService).getTimerBrand();
124
-
125
- const storageNode = await makeStorageNodeChild(chainStorage, STORAGE_PATH);
126
- const marshaller = await E(board).getReadonlyMarshaller();
127
-
128
- const reservePublicFacet = await E(zoe).getPublicFacet(reserveInstance);
129
-
130
- const auctionTerms = makeGovernedATerms(
131
- { storageNode, marshaller },
132
- chainTimerService,
133
- priceAuthority8400,
134
- reservePublicFacet,
135
- {
136
- ...params,
137
- ElectorateInvitationAmount: electorateInvitationAmount,
138
- TimerBrand: timerBrand,
139
- },
140
- );
141
-
142
- const governorTerms = await deeplyFulfilledObject(
143
- harden({
144
- timer: chainTimerService,
145
- governedContractInstallation: auctioneerInstallation,
146
- governed: {
147
- terms: auctionTerms,
148
- issuerKeywordRecord: { Bid: stableIssuer },
149
- storageNode,
150
- marshaller,
151
- label: 'auctioneer',
152
- },
153
- }),
154
- );
155
-
156
- const bundleIdFromZoe = await E(zoe).getBundleIDFromInstallation(
157
- contractGovernorInstallation,
158
- );
159
- trace('governor bundle ID', bundleIdFromZoe, contractGovernorBundle.bundleID);
160
-
161
- /** @type {GovernorStartedInstallationKit<typeof auctioneerInstallationP>} */
162
- const governorStartResult = await E(zoe).startInstance(
163
- contractGovernorInstallation,
164
- undefined,
165
- governorTerms,
166
- harden({
167
- electorateCreatorFacet,
168
- governed: {
169
- initialPoserInvitation,
170
- storageNode,
171
- marshaller,
172
- },
173
- }),
174
- 'auctioneer.governor',
175
- );
176
-
177
- const [
178
- governedInstance,
179
- governedCreatorFacet,
180
- governedPublicFacet,
181
- governedAdminFacet,
182
- ] = await Promise.all([
183
- E(governorStartResult.creatorFacet).getInstance(),
184
- E(governorStartResult.creatorFacet).getCreatorFacet(),
185
- E(governorStartResult.creatorFacet).getPublicFacet(),
186
- E(governorStartResult.creatorFacet).getAdminFacet(),
187
- ]);
188
-
189
- const allIssuers = await E(zoe).getIssuers(legacyKit.instance);
190
- const { Bid: _istIssuer, ...auctionIssuers } = allIssuers;
191
- await Promise.all(
192
- Object.keys(auctionIssuers).map(kwd =>
193
- E(governedCreatorFacet).addBrand(
194
- /** @type {Issuer<'nat'>} */ (auctionIssuers[kwd]),
195
- kwd,
196
- ),
197
- ),
198
- );
199
-
200
- const kit = harden({
201
- label: 'auctioneer',
202
- creatorFacet: governedCreatorFacet,
203
- adminFacet: governedAdminFacet,
204
- publicFacet: governedPublicFacet,
205
- instance: governedInstance,
206
-
207
- governor: governorStartResult.instance,
208
- governorCreatorFacet: governorStartResult.creatorFacet,
209
- governorAdminFacet: governorStartResult.adminFacet,
210
- });
211
- produceAuctioneerKit.reset();
212
- produceAuctioneerKit.resolve(kit);
213
-
214
- auctionInstance.reset();
215
- await auctionInstance.resolve(governedInstance);
216
- // belt and suspenders; the above is supposed to also do this
217
- await E(E(agoricNamesAdmin).lookupAdmin('instance')).update(
218
- 'auctioneer',
219
- governedInstance,
220
- );
221
-
222
- governedContractKits.init(kit.instance, kit);
223
- auctionUpgradeNewInstance.resolve(governedInstance);
224
- auctionUpgradeNewGovCreator.resolve(kit.governorCreatorFacet);
225
- newContractGovBundleId.resolve(contractGovernorBundle.bundleID);
226
- };
227
-
228
- export const ADD_AUCTION_MANIFEST = harden({
229
- [addAuction.name]: {
230
- consume: {
231
- agoricNamesAdmin: true,
232
- auctioneerKit: true,
233
- board: true,
234
- chainStorage: true,
235
- chainTimerService: true,
236
- econCharterKit: true,
237
- economicCommitteeCreatorFacet: true,
238
- governedContractKits: true,
239
- priceAuthority8400: true,
240
- retiredContractInstances: true,
241
- zoe: true,
242
- },
243
- produce: {
244
- auctioneerKit: true,
245
- auctionUpgradeNewInstance: true,
246
- auctionUpgradeNewGovCreator: true,
247
- newContractGovBundleId: true,
248
- retiredContractInstances: true,
249
- },
250
- instance: {
251
- consume: { reserve: true },
252
- produce: { auctioneer: true },
253
- },
254
- installation: {
255
- consume: { contractGovernor: true, auctioneer: true },
256
- },
257
- issuer: {
258
- consume: { [Stable.symbol]: true },
259
- },
260
- },
261
- });
262
-
263
- /**
264
- * Add a new auction to a chain that already has one.
265
- *
266
- * @param {object} utils
267
- * @param {any} utils.restoreRef
268
- * @param {any} addAuctionOptions
269
- */
270
- export const getManifestForAddAuction = async (
271
- { restoreRef },
272
- { auctioneerRef, contractGovernorRef },
273
- ) => {
274
- const contractGovernorInstallation = restoreRef(contractGovernorRef);
275
- return {
276
- manifest: ADD_AUCTION_MANIFEST,
277
- // XXX we should be able to receive contractGovernorInstallation via
278
- // installations.consume, but the received installation isn't right.
279
- options: { contractGovernorRef, contractGovernorInstallation },
280
- installations: {
281
- auctioneer: restoreRef(auctioneerRef),
282
- contractGovernor: restoreRef(contractGovernorRef),
283
- },
284
- };
285
- };
@@ -1,207 +0,0 @@
1
- /**
2
- * @file this core-eval proposal is specific to the upgrade-18 scenario,
3
- * handling tasks beyond generic Vault Factory null upgrade. For a reusable
4
- * proposal, see upgrade-vaultFactory-proposal.js.
5
- */
6
-
7
- import { E } from '@endo/far';
8
- import { makeNotifierFromAsyncIterable } from '@agoric/notifier';
9
- import { makeTracer } from '@agoric/internal/src/index.js';
10
- import { Fail } from '@endo/errors';
11
- import { TimeMath } from '@agoric/time';
12
-
13
- const trace = makeTracer('upgrade Vaults proposal');
14
-
15
- /**
16
- * @typedef {PromiseSpaceOf<{
17
- * priceAuthority8400: Instance;
18
- * auctionUpgradeNewInstance: Instance;
19
- * newContractGovBundleId: string;
20
- * }>} interlockPowers
21
- */
22
-
23
- /**
24
- * @param {import('../../src/proposals/econ-behaviors').EconomyBootstrapPowers &
25
- * interlockPowers} powers
26
- * @param {{
27
- * options: {
28
- * VaultFactoryBundle: { bundleID: string };
29
- * };
30
- * }} options
31
- */
32
- export const upgradeVaults = async (
33
- {
34
- consume: {
35
- auctionUpgradeNewInstance,
36
- chainTimerService,
37
- economicCommitteeCreatorFacet: electorateCreatorFacet,
38
- reserveKit,
39
- vaultFactoryKit,
40
- zoe,
41
- priceAuthority8400,
42
- newContractGovBundleId: newContractGovBundleIdP,
43
- },
44
- produce: {
45
- auctionUpgradeNewInstance: auctionUpgradeNewInstanceProducer,
46
- newContractGovBundleId: newContractGovBundleIdErasor,
47
- },
48
- },
49
- { options: { VaultFactoryBundle: vaultBundleRef } },
50
- ) => {
51
- const kit = await vaultFactoryKit;
52
- const { instance: directorInstance } = kit;
53
- const allBrands = await E(zoe).getBrands(directorInstance);
54
- const { Minted: _istBrand, ...vaultBrands } = allBrands;
55
-
56
- await priceAuthority8400;
57
-
58
- /** @type {Instance<import('../auction/auctioneer.js').start>} */
59
- const auctionNewInstance = await auctionUpgradeNewInstance;
60
- auctionUpgradeNewInstanceProducer.reset();
61
- const publicFacet = E(zoe).getPublicFacet(auctionNewInstance);
62
- const schedules = await E(publicFacet).getSchedules();
63
- const now = await E(chainTimerService).getCurrentTimestamp();
64
- (schedules.nextAuctionSchedule &&
65
- TimeMath.compareAbs(schedules.nextAuctionSchedule.startTime, now) > 0) ||
66
- Fail`Expected next start time in the future ${schedules.nextAuctionSchedule?.startTime}`;
67
-
68
- const readCurrentDirectorParams = async () => {
69
- const { publicFacet: directorPF } = kit;
70
-
71
- await null;
72
-
73
- const subscription = E(directorPF).getElectorateSubscription();
74
- const notifier = makeNotifierFromAsyncIterable(subscription);
75
- const { updateCount } = await notifier.getUpdateSince();
76
-
77
- // subscribeAfter(<some known state>) retrieves the latest value.
78
- const after = await E(subscription).subscribeAfter(updateCount);
79
- const { current } = after.head.value;
80
-
81
- return harden({
82
- MinInitialDebt: current.MinInitialDebt.value,
83
- ReferencedUI: current.ReferencedUI.value,
84
- RecordingPeriod: current.RecordingPeriod.value,
85
- ChargingPeriod: current.ChargingPeriod.value,
86
- });
87
- };
88
- const directorParamOverrides = await readCurrentDirectorParams();
89
- trace({ directorParamOverrides });
90
-
91
- const readManagerParams = async () => {
92
- const { publicFacet: directorPF } = kit;
93
-
94
- await null;
95
-
96
- const params = {};
97
- for (const kwd of Object.keys(vaultBrands)) {
98
- const collateralBrand = vaultBrands[kwd];
99
-
100
- const governedParams = await E(directorPF).getGovernedParams({
101
- collateralBrand,
102
- });
103
- trace({ kwd, governedParams });
104
- params[kwd] = harden({
105
- brand: collateralBrand,
106
- debtLimit: governedParams.DebtLimit.value,
107
- interestRate: governedParams.InterestRate.value,
108
- liquidationMargin: governedParams.LiquidationMargin.value,
109
- liquidationPadding: governedParams.LiquidationPadding.value,
110
- liquidationPenalty: governedParams.LiquidationPenalty.value,
111
- mintFee: governedParams.MintFee.value,
112
- });
113
- trace(kwd, params[kwd]);
114
- }
115
- return params;
116
- };
117
- const managerParamValues = await readManagerParams();
118
-
119
- // upgrade the vaultFactory
120
- const upgradeVaultFactory = async () => {
121
- // @ts-expect-error cast XXX privateArgs missing from type
122
- const { privateArgs } = kit;
123
-
124
- const shortfallInvitation = await E(
125
- E.get(reserveKit).creatorFacet,
126
- ).makeShortfallReportingInvitation();
127
-
128
- const poserInvitation = await E(
129
- electorateCreatorFacet,
130
- ).getPoserInvitation();
131
-
132
- /** @type {import('../../src/vaultFactory/vaultFactory').VaultFactoryContract['privateArgs']} */
133
- const newPrivateArgs = harden({
134
- ...privateArgs,
135
- auctioneerInstance: auctionNewInstance,
136
- initialPoserInvitation: poserInvitation,
137
- initialShortfallInvitation: shortfallInvitation,
138
- managerParams: managerParamValues,
139
- directorParamOverrides,
140
- });
141
-
142
- const upgradeResult = await E(kit.adminFacet).upgradeContract(
143
- vaultBundleRef.bundleID,
144
- newPrivateArgs,
145
- );
146
-
147
- trace('upgraded vaultFactory.', upgradeResult);
148
- };
149
- await upgradeVaultFactory();
150
-
151
- // @ts-expect-error It's saved in econ-behaviors.js:startVaultFactory()
152
- const vaultFactoryPrivateArgs = kit.privateArgs;
153
- trace('restarting governor');
154
-
155
- const [ecf, newContractGovBundleId] = await Promise.all([
156
- electorateCreatorFacet,
157
- newContractGovBundleIdP,
158
- ]);
159
- newContractGovBundleIdErasor.reset();
160
-
161
- // upgrade vaultFactory governor. Won't be needed next time: see #10063
162
- await E(kit.governorAdminFacet).upgradeContract(
163
- newContractGovBundleId,
164
- harden({
165
- electorateCreatorFacet: ecf,
166
- governed: vaultFactoryPrivateArgs,
167
- }),
168
- );
169
-
170
- trace('restarted governor');
171
- };
172
-
173
- const uV = 'upgradeVaults';
174
- /**
175
- * Return the manifest, installations, and options for upgrading Vaults.
176
- *
177
- * @param {object} utils
178
- * @param {any} utils.restoreRef
179
- * @param {any} vaultUpgradeOptions
180
- */
181
- export const getManifestForUpgradeVaults = async (
182
- { restoreRef },
183
- { VaultFactoryRef },
184
- ) => {
185
- return {
186
- manifest: {
187
- [upgradeVaults.name]: {
188
- consume: {
189
- priceAuthority8400: uV,
190
- auctionUpgradeNewInstance: uV,
191
- chainTimerService: uV,
192
- economicCommitteeCreatorFacet: uV,
193
- reserveKit: uV,
194
- vaultFactoryKit: uV,
195
- zoe: uV,
196
- newContractGovBundleId: uV,
197
- },
198
- produce: {
199
- auctionUpgradeNewInstance: uV,
200
- newContractGovBundleId: uV,
201
- },
202
- },
203
- },
204
- installations: { VaultFactory: restoreRef(VaultFactoryRef) },
205
- options: { VaultFactoryBundle: VaultFactoryRef },
206
- };
207
- };
@@ -1,2 +0,0 @@
1
- import type { PsmPublicFacet } from './psm.js';
2
- //# sourceMappingURL=types-ambient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":"oCAEkC,UAAU"}
@@ -1,3 +0,0 @@
1
- // @jessie-check
2
-
3
- /** @import {PsmPublicFacet} from './psm.js' */
@@ -1,25 +0,0 @@
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
- import type { SetStore } from '@agoric/store';
24
- import type { MapStore } from '@agoric/store';
25
- //# sourceMappingURL=liquidation.d.ts.map
@@ -1 +0,0 @@
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,SAAS,KAAK,CAAC,aACf,KAAK,CAAC,KAAK,CAAC,mBACZ,KAAK,CAAC,KAAK,CAAC,GACV;IACR,SAAS,EAAE,SACf,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;kCAnS8D,cAAc;gCAAd,cAAc;gCAChD,4BAA4B;8BAFpB,eAAe;8BAAf,eAAe"}