@agoric/inter-protocol 0.16.2-dev-6ad0038.0.6ad0038 → 0.16.2-dev-b95c1c8.0.b95c1c8

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