@agoric/inter-protocol 0.16.2-other-dev-3eb1a1d.0 → 0.16.2-other-dev-d15096d.0.d15096d
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 +36 -35
- package/src/auction/auctionBook.d.ts +9 -7
- package/src/auction/auctionBook.d.ts.map +1 -1
- package/src/auction/auctionBook.js +58 -32
- package/src/auction/auctionMath.d.ts +1 -1
- package/src/auction/auctionMath.d.ts.map +1 -1
- package/src/auction/auctioneer.d.ts +19 -13
- package/src/auction/auctioneer.d.ts.map +1 -1
- package/src/auction/auctioneer.js +25 -12
- package/src/auction/offerBook.d.ts +3 -2
- package/src/auction/offerBook.d.ts.map +1 -1
- package/src/auction/offerBook.js +5 -1
- package/src/auction/params.d.ts +16 -7
- package/src/auction/params.d.ts.map +1 -1
- package/src/auction/params.js +12 -4
- package/src/auction/scheduleMath.d.ts +5 -3
- package/src/auction/scheduleMath.d.ts.map +1 -1
- package/src/auction/scheduleMath.js +11 -7
- package/src/auction/scheduler.d.ts +9 -4
- package/src/auction/scheduler.d.ts.map +1 -1
- package/src/auction/scheduler.js +14 -6
- package/src/auction/util.d.ts +2 -1
- package/src/auction/util.d.ts.map +1 -1
- package/src/auction/util.js +4 -1
- package/src/clientSupport.d.ts +29 -73
- package/src/clientSupport.d.ts.map +1 -1
- package/src/clientSupport.js +29 -128
- package/src/contractSupport.d.ts +2 -2
- package/src/contractSupport.d.ts.map +1 -1
- package/src/econCommitteeCharter.d.ts +15 -8
- package/src/econCommitteeCharter.d.ts.map +1 -1
- package/src/econCommitteeCharter.js +14 -8
- package/src/feeDistributor.d.ts +43 -49
- package/src/feeDistributor.d.ts.map +1 -1
- package/src/feeDistributor.js +7 -3
- package/src/index.js +1 -1
- package/src/interest-math.d.ts +1 -0
- package/src/interest-math.d.ts.map +1 -1
- package/src/interest-math.js +5 -1
- package/src/interest.d.ts +3 -1
- package/src/interest.d.ts.map +1 -1
- package/src/interest.js +2 -5
- package/src/price/README.md +1 -1
- package/src/price/fluxAggregatorContract.d.ts +20 -11
- package/src/price/fluxAggregatorContract.d.ts.map +1 -1
- package/src/price/fluxAggregatorContract.js +17 -9
- package/src/price/fluxAggregatorKit.d.ts +15 -9
- package/src/price/fluxAggregatorKit.d.ts.map +1 -1
- package/src/price/fluxAggregatorKit.js +15 -9
- package/src/price/priceOracleKit.d.ts +4 -2
- package/src/price/priceOracleKit.d.ts.map +1 -1
- package/src/price/priceOracleKit.js +7 -2
- package/src/price/roundsManager.d.ts +8 -6
- package/src/price/roundsManager.d.ts.map +1 -1
- package/src/price/roundsManager.js +5 -2
- package/src/proposals/add-auction.js +38 -4
- package/src/proposals/addAssetToVault.js +8 -4
- package/src/proposals/committee-proposal.js +10 -5
- package/src/proposals/core-proposal.js +9 -3
- package/src/proposals/deploy-price-feeds.js +35 -7
- package/src/proposals/econ-behaviors.js +33 -12
- package/src/proposals/price-feed-proposal.js +10 -3
- package/src/proposals/replace-fee-distributor.js +12 -6
- package/src/proposals/replaceElectorate.js +105 -16
- package/src/proposals/startEconCommittee.js +5 -1
- package/src/proposals/startPSM.js +7 -4
- package/src/proposals/upgrade-vaults.js +15 -5
- package/src/proposals/utils.d.ts +8 -4
- package/src/proposals/utils.d.ts.map +1 -1
- package/src/proposals/utils.js +32 -9
- package/src/proposals/withdraw-reserve-proposal.js +63 -0
- package/src/provisionPool.d.ts +34 -120
- package/src/provisionPool.d.ts.map +1 -1
- package/src/provisionPool.js +43 -21
- package/src/provisionPoolKit.d.ts +43 -328
- package/src/provisionPoolKit.d.ts.map +1 -1
- package/src/provisionPoolKit.js +210 -120
- package/src/psm/psm.d.ts +20 -13
- package/src/psm/psm.d.ts.map +1 -1
- package/src/psm/psm.js +18 -12
- package/src/reserve/assetReserve.d.ts +18 -6
- package/src/reserve/assetReserve.d.ts.map +1 -1
- package/src/reserve/assetReserve.js +26 -23
- package/src/reserve/assetReserveKit.d.ts +38 -6
- package/src/reserve/assetReserveKit.d.ts.map +1 -1
- package/src/reserve/assetReserveKit.js +117 -7
- package/src/reserve/params.d.ts +9 -3
- package/src/reserve/params.d.ts.map +1 -1
- package/src/reserve/params.js +8 -2
- package/src/vaultFactory/burn.d.ts +1 -1
- package/src/vaultFactory/burn.d.ts.map +1 -1
- package/src/vaultFactory/burn.js +1 -1
- package/src/vaultFactory/liquidation.d.ts +7 -3
- package/src/vaultFactory/liquidation.d.ts.map +1 -1
- package/src/vaultFactory/liquidation.js +14 -12
- package/src/vaultFactory/math.d.ts +1 -1
- package/src/vaultFactory/math.d.ts.map +1 -1
- package/src/vaultFactory/math.js +1 -1
- package/src/vaultFactory/orderedVaultStore.d.ts +21 -20
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -1
- package/src/vaultFactory/orderedVaultStore.js +4 -2
- package/src/vaultFactory/params.d.ts +25 -9
- package/src/vaultFactory/params.d.ts.map +1 -1
- package/src/vaultFactory/params.js +29 -11
- package/src/vaultFactory/prioritizedVaults.d.ts +70 -69
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -1
- package/src/vaultFactory/prioritizedVaults.js +5 -2
- package/src/vaultFactory/storeUtils.d.ts +2 -2
- package/src/vaultFactory/storeUtils.d.ts.map +1 -1
- package/src/vaultFactory/types-ambient.d.ts +2 -2
- package/src/vaultFactory/types-ambient.d.ts.map +1 -1
- package/src/vaultFactory/types-ambient.js +6 -2
- package/src/vaultFactory/vault.d.ts +34 -30
- package/src/vaultFactory/vault.d.ts.map +1 -1
- package/src/vaultFactory/vault.js +19 -15
- package/src/vaultFactory/vaultDirector.d.ts +81 -63
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
- package/src/vaultFactory/vaultDirector.js +38 -24
- package/src/vaultFactory/vaultFactory.d.ts +35 -22
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
- package/src/vaultFactory/vaultFactory.js +27 -17
- package/src/vaultFactory/vaultHolder.d.ts +77 -29
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
- package/src/vaultFactory/vaultHolder.js +12 -4
- package/src/vaultFactory/vaultKit.d.ts +12 -8
- package/src/vaultFactory/vaultKit.d.ts.map +1 -1
- package/src/vaultFactory/vaultKit.js +12 -5
- package/src/vaultFactory/vaultManager.d.ts +102 -88
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +86 -53
- package/src/proposals/add-auction.d.ts +0 -109
- package/src/proposals/add-auction.d.ts.map +0 -1
- package/src/proposals/addAssetToVault.d.ts +0 -173
- package/src/proposals/addAssetToVault.d.ts.map +0 -1
- package/src/proposals/committee-proposal.d.ts +0 -113
- package/src/proposals/committee-proposal.d.ts.map +0 -1
- package/src/proposals/core-proposal.d.ts +0 -149
- package/src/proposals/core-proposal.d.ts.map +0 -1
- package/src/proposals/deploy-price-feeds.d.ts +0 -76
- package/src/proposals/deploy-price-feeds.d.ts.map +0 -1
- package/src/proposals/econ-behaviors.d.ts +0 -541
- package/src/proposals/econ-behaviors.d.ts.map +0 -1
- package/src/proposals/price-feed-proposal.d.ts +0 -84
- package/src/proposals/price-feed-proposal.d.ts.map +0 -1
- package/src/proposals/replace-fee-distributor.d.ts +0 -48
- package/src/proposals/replace-fee-distributor.d.ts.map +0 -1
- package/src/proposals/replace-scaledPriceAuthorities.d.ts +0 -30
- package/src/proposals/replace-scaledPriceAuthorities.d.ts.map +0 -1
- package/src/proposals/replaceElectorate.d.ts +0 -55
- package/src/proposals/replaceElectorate.d.ts.map +0 -1
- package/src/proposals/startEconCommittee.d.ts +0 -34
- package/src/proposals/startEconCommittee.d.ts.map +0 -1
- package/src/proposals/startPSM.d.ts +0 -59
- package/src/proposals/startPSM.d.ts.map +0 -1
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +0 -24
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +0 -1
- package/src/proposals/upgrade-vaults.d.ts +0 -41
- package/src/proposals/upgrade-vaults.d.ts.map +0 -1
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
assertPathSegment,
|
|
16
16
|
makeStorageNodeChild,
|
|
17
17
|
} from '@agoric/internal/src/lib-chainStorage.js';
|
|
18
|
-
import { reserveThenDeposit } from './utils.js';
|
|
18
|
+
import { provideRetiredInstances, reserveThenDeposit } from './utils.js';
|
|
19
19
|
|
|
20
20
|
/** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */
|
|
21
21
|
/** @import {EconCharterStartResult} from './econ-behaviors.js' */
|
|
@@ -181,8 +181,10 @@ const inviteToEconCharter = async (
|
|
|
181
181
|
* Starts a new Economic Committee (EC) by creating an instance with the
|
|
182
182
|
* provided committee specifications.
|
|
183
183
|
*
|
|
184
|
-
* @param {EconomyBootstrapPowers
|
|
185
|
-
*
|
|
184
|
+
* @param {EconomyBootstrapPowers &
|
|
185
|
+
* PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance> }>} powers
|
|
186
|
+
* - The resources and capabilities required to start the committee.
|
|
187
|
+
*
|
|
186
188
|
* @param {{
|
|
187
189
|
* options: {
|
|
188
190
|
* committeeName: string;
|
|
@@ -196,12 +198,22 @@ const inviteToEconCharter = async (
|
|
|
196
198
|
*/
|
|
197
199
|
const startNewEconomicCommittee = async (
|
|
198
200
|
{
|
|
199
|
-
consume: {
|
|
200
|
-
|
|
201
|
+
consume: {
|
|
202
|
+
board,
|
|
203
|
+
chainStorage,
|
|
204
|
+
startUpgradable,
|
|
205
|
+
retiredContractInstances: retiredInstancesP,
|
|
206
|
+
},
|
|
207
|
+
produce: {
|
|
208
|
+
economicCommitteeKit,
|
|
209
|
+
economicCommitteeCreatorFacet,
|
|
210
|
+
retiredContractInstances: produceRetiredInstances,
|
|
211
|
+
},
|
|
201
212
|
installation: {
|
|
202
213
|
consume: { committee },
|
|
203
214
|
},
|
|
204
215
|
instance: {
|
|
216
|
+
consume: { economicCommittee: economicCommitteeOriginalP },
|
|
205
217
|
produce: { economicCommittee },
|
|
206
218
|
},
|
|
207
219
|
},
|
|
@@ -214,6 +226,19 @@ const startNewEconomicCommittee = async (
|
|
|
214
226
|
trace(`committeeName ${committeeName}`);
|
|
215
227
|
trace(`committeeSize ${committeeSize}`);
|
|
216
228
|
|
|
229
|
+
const retiredInstances = await provideRetiredInstances(
|
|
230
|
+
retiredInstancesP,
|
|
231
|
+
produceRetiredInstances,
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
// Record the retired electorate instance so we can manage it later.
|
|
235
|
+
const economicCommitteeOriginal = await economicCommitteeOriginalP;
|
|
236
|
+
const boardID = await E(board).getId(economicCommitteeOriginal);
|
|
237
|
+
retiredInstances.init(
|
|
238
|
+
`economicCommittee-${boardID}`,
|
|
239
|
+
economicCommitteeOriginal,
|
|
240
|
+
);
|
|
241
|
+
|
|
217
242
|
const committeesNode = await makeStorageNodeChild(
|
|
218
243
|
chainStorage,
|
|
219
244
|
COMMITTEES_ROOT,
|
|
@@ -264,33 +289,87 @@ const startNewEconomicCommittee = async (
|
|
|
264
289
|
* Starts a new Economic Committee Charter by creating an instance with the
|
|
265
290
|
* provided committee specifications.
|
|
266
291
|
*
|
|
267
|
-
* @param {EconomyBootstrapPowers
|
|
268
|
-
*
|
|
292
|
+
* @param {EconomyBootstrapPowers &
|
|
293
|
+
* PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance> }>} powers
|
|
294
|
+
* - The resources and capabilities required to start the committee.
|
|
295
|
+
*
|
|
269
296
|
* @returns {Promise<EconCharterStartResult>} A promise that resolves to the
|
|
270
297
|
* charter kit result.
|
|
271
298
|
*/
|
|
272
299
|
const startNewEconCharter = async ({
|
|
273
|
-
consume: {
|
|
274
|
-
|
|
300
|
+
consume: {
|
|
301
|
+
board,
|
|
302
|
+
startUpgradable,
|
|
303
|
+
contractKits: contractKitsP,
|
|
304
|
+
econCharterKit: econCharterKitP,
|
|
305
|
+
retiredContractInstances: retiredContractInstancesP,
|
|
306
|
+
},
|
|
307
|
+
produce: {
|
|
308
|
+
econCharterKit: produceEconCharterKit,
|
|
309
|
+
retiredContractInstances: produceRetiredInstances,
|
|
310
|
+
},
|
|
275
311
|
installation: {
|
|
276
312
|
consume: { binaryVoteCounter: counterP, econCommitteeCharter: installP },
|
|
277
313
|
},
|
|
278
314
|
instance: {
|
|
279
315
|
produce: { econCommitteeCharter },
|
|
316
|
+
consume: { econCommitteeCharter: previousInstanceP },
|
|
280
317
|
},
|
|
281
318
|
}) => {
|
|
282
|
-
const [
|
|
319
|
+
const [
|
|
320
|
+
charterInstall,
|
|
321
|
+
counterInstall,
|
|
322
|
+
previousInstance,
|
|
323
|
+
contractKits,
|
|
324
|
+
econCharterKit,
|
|
325
|
+
retiredInstances,
|
|
326
|
+
] = await Promise.all([
|
|
283
327
|
installP,
|
|
284
328
|
counterP,
|
|
329
|
+
previousInstanceP,
|
|
330
|
+
contractKitsP,
|
|
331
|
+
econCharterKitP,
|
|
332
|
+
provideRetiredInstances(retiredContractInstancesP, produceRetiredInstances),
|
|
285
333
|
]);
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
334
|
+
|
|
335
|
+
const label = 'econCommitteeCharter';
|
|
336
|
+
const previousCharterKit = { ...econCharterKit, label };
|
|
337
|
+
|
|
338
|
+
const boardID = await E(board).getId(previousCharterKit.instance);
|
|
339
|
+
const identifier = `${label}-${boardID}`;
|
|
340
|
+
trace('Saving previous EC Charter Instance', label);
|
|
341
|
+
|
|
342
|
+
// save the old charter instance kit so we can manage it later
|
|
343
|
+
if (retiredInstances.has(identifier)) {
|
|
344
|
+
// bootstrap tests start having already run this upgrade. Actual upgrades on
|
|
345
|
+
// mainNet or testnets should start with the promiseSpace post upgrade-17,
|
|
346
|
+
// which doesn't have this entry in the map.
|
|
347
|
+
trace(
|
|
348
|
+
'⚠️ WARNING: collision on storing Charter in retireInstances not' +
|
|
349
|
+
' expected during chain upgrade. It IS normal during bootstrap tests',
|
|
350
|
+
);
|
|
351
|
+
} else {
|
|
352
|
+
retiredInstances.init(identifier, previousCharterKit.instance);
|
|
353
|
+
}
|
|
354
|
+
if (contractKits.has(previousInstance)) {
|
|
355
|
+
// bootstrap tests start having already run this upgrade. Actual upgrades on
|
|
356
|
+
// mainNet or testnets should start with the promiseSpace post upgrade-17,
|
|
357
|
+
// which doesn't have this entry in the map.
|
|
358
|
+
trace(
|
|
359
|
+
'⚠️ WARNING: collision on storing Charter in contractKits not' +
|
|
360
|
+
' expected during chain upgrade. It IS normal during bootstrap tests',
|
|
361
|
+
);
|
|
362
|
+
} else {
|
|
363
|
+
contractKits.init(previousInstance, previousCharterKit);
|
|
364
|
+
}
|
|
289
365
|
|
|
290
366
|
trace('Starting new EC Charter Instance');
|
|
291
367
|
|
|
368
|
+
const terms = harden({
|
|
369
|
+
binaryVoteCounterInstallation: counterInstall,
|
|
370
|
+
});
|
|
292
371
|
const startResult = await E(startUpgradable)({
|
|
293
|
-
label
|
|
372
|
+
label,
|
|
294
373
|
installation: charterInstall,
|
|
295
374
|
terms,
|
|
296
375
|
});
|
|
@@ -300,8 +379,8 @@ const startNewEconCharter = async ({
|
|
|
300
379
|
econCommitteeCharter.reset();
|
|
301
380
|
econCommitteeCharter.resolve(E.get(startResult).instance);
|
|
302
381
|
|
|
303
|
-
|
|
304
|
-
|
|
382
|
+
produceEconCharterKit.reset();
|
|
383
|
+
produceEconCharterKit.resolve(startResult);
|
|
305
384
|
return startResult;
|
|
306
385
|
};
|
|
307
386
|
|
|
@@ -309,6 +388,7 @@ const startNewEconCharter = async ({
|
|
|
309
388
|
* @typedef {PromiseSpaceOf<{
|
|
310
389
|
* auctionUpgradeNewInstance: Instance;
|
|
311
390
|
* auctionUpgradeNewGovCreator: any;
|
|
391
|
+
* retiredContractInstances: MapStore<string, Instance>;
|
|
312
392
|
* }>} interlockPowers
|
|
313
393
|
*/
|
|
314
394
|
|
|
@@ -485,13 +565,17 @@ export const getManifestForReplaceAllElectorates = async (
|
|
|
485
565
|
manifest: {
|
|
486
566
|
[replaceAllElectorates.name]: {
|
|
487
567
|
consume: {
|
|
568
|
+
agoricNames: true,
|
|
488
569
|
auctionUpgradeNewGovCreator: true,
|
|
489
570
|
auctionUpgradeNewInstance: true,
|
|
490
571
|
psmKit: true,
|
|
572
|
+
contractKits: true,
|
|
573
|
+
econCharterKit: true,
|
|
491
574
|
governedContractKits: true,
|
|
492
575
|
chainStorage: true,
|
|
493
576
|
highPrioritySendersManager: true,
|
|
494
577
|
namesByAddressAdmin: true,
|
|
578
|
+
retiredContractInstances: true,
|
|
495
579
|
// Rest of these are designed to be widely shared
|
|
496
580
|
board: true,
|
|
497
581
|
startUpgradable: true,
|
|
@@ -501,6 +585,7 @@ export const getManifestForReplaceAllElectorates = async (
|
|
|
501
585
|
economicCommitteeKit: true,
|
|
502
586
|
economicCommitteeCreatorFacet: true,
|
|
503
587
|
auctionUpgradeNewGovCreator: true,
|
|
588
|
+
retiredContractInstances: true,
|
|
504
589
|
},
|
|
505
590
|
installation: {
|
|
506
591
|
consume: {
|
|
@@ -514,6 +599,10 @@ export const getManifestForReplaceAllElectorates = async (
|
|
|
514
599
|
economicCommittee: true,
|
|
515
600
|
econCommitteeCharter: true,
|
|
516
601
|
},
|
|
602
|
+
consume: {
|
|
603
|
+
economicCommittee: true,
|
|
604
|
+
econCommitteeCharter: true,
|
|
605
|
+
},
|
|
517
606
|
},
|
|
518
607
|
},
|
|
519
608
|
},
|
|
@@ -5,6 +5,10 @@ import {
|
|
|
5
5
|
} from '@agoric/internal/src/lib-chainStorage.js';
|
|
6
6
|
import { E } from '@endo/far';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @import {EconomyBootstrapPowers} from './econ-behaviors.js';
|
|
10
|
+
*/
|
|
11
|
+
|
|
8
12
|
const trace = makeTracer('RunEconCommittee', true);
|
|
9
13
|
|
|
10
14
|
/** @type {(name: string) => string} */
|
|
@@ -21,7 +25,7 @@ const sanitizePathSegment = name => {
|
|
|
21
25
|
*/
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
|
-
* @param {
|
|
28
|
+
* @param {EconomyBootstrapPowers} powers
|
|
25
29
|
* @param {object} config
|
|
26
30
|
* @param {object} [config.options]
|
|
27
31
|
* @param {EconCommitteeOptions} [config.options.econCommitteeOptions]
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
makeHistoryReviver,
|
|
12
12
|
makeBoardRemote,
|
|
13
13
|
slotToBoardRemote,
|
|
14
|
-
} from '@agoric/internal/src/marshal.js';
|
|
14
|
+
} from '@agoric/internal/src/marshal/board-client-utils.js';
|
|
15
15
|
import { deeplyFulfilledObject } from '@agoric/internal';
|
|
16
16
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
17
17
|
import { Stable } from '@agoric/internal/src/tokens.js';
|
|
@@ -24,7 +24,10 @@ import {
|
|
|
24
24
|
inviteToEconCharter,
|
|
25
25
|
} from './committee-proposal.js';
|
|
26
26
|
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js'
|
|
29
|
+
* @import {PSMKit} from './econ-behaviors.js';
|
|
30
|
+
*/
|
|
28
31
|
/** @import {MetricsNotification} from '../psm/psm.js' */
|
|
29
32
|
/** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */
|
|
30
33
|
|
|
@@ -249,7 +252,7 @@ export const startPSM = async (
|
|
|
249
252
|
};
|
|
250
253
|
await (oldState.metrics && restoreMetrics(oldState.metrics));
|
|
251
254
|
|
|
252
|
-
/** @type {
|
|
255
|
+
/** @type {PSMKit} */
|
|
253
256
|
const newpsmKit = harden({
|
|
254
257
|
label: instanceKey,
|
|
255
258
|
psm,
|
|
@@ -262,7 +265,7 @@ export const startPSM = async (
|
|
|
262
265
|
// Provide pattern with a promise.
|
|
263
266
|
producepsmKit.resolve(makeScalarBigMapStore('PSM Kits', { durable: true }));
|
|
264
267
|
|
|
265
|
-
/** @type {MapStore<Brand,
|
|
268
|
+
/** @type {MapStore<Brand, PSMKit>} */
|
|
266
269
|
const psmKitMap = await psmKit;
|
|
267
270
|
|
|
268
271
|
// TODO init into governedContractKits too to simplify testing
|
|
@@ -1,9 +1,21 @@
|
|
|
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
|
+
|
|
1
7
|
import { E } from '@endo/far';
|
|
2
8
|
import { makeNotifierFromAsyncIterable } from '@agoric/notifier';
|
|
3
9
|
import { makeTracer } from '@agoric/internal/src/index.js';
|
|
4
10
|
import { Fail } from '@endo/errors';
|
|
5
11
|
import { TimeMath } from '@agoric/time';
|
|
6
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @import {EconomyBootstrapPowers} from '../../src/proposals/econ-behaviors';
|
|
15
|
+
* @import {start} from '../auction/auctioneer.js';
|
|
16
|
+
* @import {VaultFactoryContract} from '../../src/vaultFactory/vaultFactory';
|
|
17
|
+
*/
|
|
18
|
+
|
|
7
19
|
const trace = makeTracer('upgrade Vaults proposal');
|
|
8
20
|
|
|
9
21
|
/**
|
|
@@ -15,8 +27,7 @@ const trace = makeTracer('upgrade Vaults proposal');
|
|
|
15
27
|
*/
|
|
16
28
|
|
|
17
29
|
/**
|
|
18
|
-
* @param {
|
|
19
|
-
* interlockPowers} powers
|
|
30
|
+
* @param {EconomyBootstrapPowers & interlockPowers} powers
|
|
20
31
|
* @param {{
|
|
21
32
|
* options: {
|
|
22
33
|
* VaultFactoryBundle: { bundleID: string };
|
|
@@ -49,10 +60,10 @@ export const upgradeVaults = async (
|
|
|
49
60
|
|
|
50
61
|
await priceAuthority8400;
|
|
51
62
|
|
|
63
|
+
/** @type {Instance<typeof start>} */
|
|
52
64
|
const auctionNewInstance = await auctionUpgradeNewInstance;
|
|
53
65
|
auctionUpgradeNewInstanceProducer.reset();
|
|
54
66
|
const publicFacet = E(zoe).getPublicFacet(auctionNewInstance);
|
|
55
|
-
/** @type {import('@agoric/inter-protocol/src/auction/scheduler.js').FullSchedule} */
|
|
56
67
|
const schedules = await E(publicFacet).getSchedules();
|
|
57
68
|
const now = await E(chainTimerService).getCurrentTimestamp();
|
|
58
69
|
(schedules.nextAuctionSchedule &&
|
|
@@ -91,7 +102,6 @@ export const upgradeVaults = async (
|
|
|
91
102
|
for (const kwd of Object.keys(vaultBrands)) {
|
|
92
103
|
const collateralBrand = vaultBrands[kwd];
|
|
93
104
|
|
|
94
|
-
/** @type {any} */
|
|
95
105
|
const governedParams = await E(directorPF).getGovernedParams({
|
|
96
106
|
collateralBrand,
|
|
97
107
|
});
|
|
@@ -124,7 +134,7 @@ export const upgradeVaults = async (
|
|
|
124
134
|
electorateCreatorFacet,
|
|
125
135
|
).getPoserInvitation();
|
|
126
136
|
|
|
127
|
-
/** @type {
|
|
137
|
+
/** @type {VaultFactoryContract['privateArgs']} */
|
|
128
138
|
const newPrivateArgs = harden({
|
|
129
139
|
...privateArgs,
|
|
130
140
|
auctioneerInstance: auctionNewInstance,
|
package/src/proposals/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function reserveThenGetNamePaths(nameAdmin: ERef<
|
|
2
|
-
export function reserveThenGetNames(nameAdmin: ERef<
|
|
3
|
-
export function reserveThenDeposit(debugName: string, namesByAddressAdmin: ERef<
|
|
1
|
+
export function reserveThenGetNamePaths(nameAdmin: ERef<NameAdmin>, paths: string[][]): Promise<any[]>;
|
|
2
|
+
export function reserveThenGetNames(nameAdmin: ERef<NameAdmin>, names: string[]): Promise<any[]>;
|
|
3
|
+
export function reserveThenDeposit(debugName: string, namesByAddressAdmin: ERef<NameAdmin>, addr: string, payments: ERef<Payment>[]): Promise<void>;
|
|
4
4
|
export function makeInstallCache(homeP: Promise<{
|
|
5
|
-
scratch: ERef<
|
|
5
|
+
scratch: ERef<ScratchPad>;
|
|
6
6
|
}>, { installCacheKey, loadBundle }: {
|
|
7
7
|
loadBundle: (specifier: string) => Promise<{
|
|
8
8
|
default: Bundle;
|
|
@@ -16,4 +16,8 @@ export function oracleBrandFeedName(inBrandName: any, outBrandName: any): string
|
|
|
16
16
|
export function scaledPriceFeedName(issuerName: any): string;
|
|
17
17
|
/** @type {(name: string) => string} */
|
|
18
18
|
export const sanitizePathSegment: (name: string) => string;
|
|
19
|
+
export function provideRetiredInstances(consume: Promise<MapStore>, produce: Producer<MapStore>): Promise<MapStore>;
|
|
20
|
+
import type { NameAdmin } from '@agoric/vats';
|
|
21
|
+
import type { ScratchPad } from '@agoric/internal/src/scratch.js';
|
|
22
|
+
import type { MapStore } from '@agoric/store';
|
|
19
23
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAkBO,mDAHI,IAAI,CAAC,SAAS,CAAC,SACf,MAAM,EAAE,EAAE,kBA+BpB;AAMM,+CAHI,IAAI,CAAC,SAAS,CAAC,SACf,MAAM,EAAE,kBAMhB;AAQI,8CALI,MAAM,uBACN,IAAI,CAAC,SAAS,CAAC,QACf,MAAM,YACN,IAAI,CAAC,OAAO,CAAC,EAAE,iBAuBzB;AA2BM,wCAPI,OAAO,CAAC;IACd,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;CAC3B,CAAC,mCAEF;IAAkE,UAAU,EAApE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,eAAe;CAAC;oCAkCD,UAAK,EAAE,UAAK,EAAE,SAAI;;GAkBzD;AAEM,iFACsC;AAEtC,6DAC+B;AAEtC,uCAAuC;AACvC,kCADW,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAKjC;AAUK,iDAJI,OAAO,CAAC,QAAQ,CAAC,WACjB,QAAQ,CAAC,QAAQ,CAAC,GAChB,OAAO,CAAC,QAAQ,CAAC,CAW7B;+BAzL2B,cAAc;gCACb,iCAAiC;8BAFzB,eAAe"}
|
package/src/proposals/utils.js
CHANGED
|
@@ -3,16 +3,22 @@ import { E } from '@endo/far';
|
|
|
3
3
|
import { WalletName } from '@agoric/internal';
|
|
4
4
|
import { getCopyMapEntries, makeCopyMap } from '@agoric/store';
|
|
5
5
|
import { assertPathSegment } from '@agoric/internal/src/lib-chainStorage.js';
|
|
6
|
+
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @import {CopyMap} from '@endo/patterns';
|
|
10
|
+
* @import {MapStore, SetStore} from '@agoric/store';
|
|
11
|
+
* @import {NameAdmin} from '@agoric/vats';
|
|
12
|
+
* @import {ScratchPad} from '@agoric/internal/src/scratch.js';
|
|
13
|
+
*/
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
|
-
* @param {ERef<
|
|
16
|
+
* @param {ERef<NameAdmin>} nameAdmin
|
|
11
17
|
* @param {string[][]} paths
|
|
12
18
|
*/
|
|
13
19
|
export const reserveThenGetNamePaths = async (nameAdmin, paths) => {
|
|
14
20
|
/**
|
|
15
|
-
* @param {ERef<
|
|
21
|
+
* @param {ERef<NameAdmin>} nextAdmin
|
|
16
22
|
* @param {string[]} path
|
|
17
23
|
*/
|
|
18
24
|
const nextPath = async (nextAdmin, path) => {
|
|
@@ -42,7 +48,7 @@ export const reserveThenGetNamePaths = async (nameAdmin, paths) => {
|
|
|
42
48
|
};
|
|
43
49
|
|
|
44
50
|
/**
|
|
45
|
-
* @param {ERef<
|
|
51
|
+
* @param {ERef<NameAdmin>} nameAdmin
|
|
46
52
|
* @param {string[]} names
|
|
47
53
|
*/
|
|
48
54
|
export const reserveThenGetNames = async (nameAdmin, names) =>
|
|
@@ -53,7 +59,7 @@ export const reserveThenGetNames = async (nameAdmin, names) =>
|
|
|
53
59
|
|
|
54
60
|
/**
|
|
55
61
|
* @param {string} debugName
|
|
56
|
-
* @param {ERef<
|
|
62
|
+
* @param {ERef<NameAdmin>} namesByAddressAdmin
|
|
57
63
|
* @param {string} addr
|
|
58
64
|
* @param {ERef<Payment>[]} payments
|
|
59
65
|
*/
|
|
@@ -82,9 +88,7 @@ export const reserveThenDeposit = async (
|
|
|
82
88
|
|
|
83
89
|
/**
|
|
84
90
|
* @type {<T>(
|
|
85
|
-
* store: ERef<
|
|
86
|
-
* Map<string, T> | import('@agoric/internal/src/scratch.js').ScratchPad
|
|
87
|
-
* >,
|
|
91
|
+
* store: ERef<Map<string, T> | ScratchPad>,
|
|
88
92
|
* key: string,
|
|
89
93
|
* make: () => T,
|
|
90
94
|
* ) => Promise<T>}
|
|
@@ -101,7 +105,7 @@ const provideWhen = async (store, key, make) => {
|
|
|
101
105
|
|
|
102
106
|
/**
|
|
103
107
|
* @param {Promise<{
|
|
104
|
-
* scratch: ERef<
|
|
108
|
+
* scratch: ERef<ScratchPad>;
|
|
105
109
|
* }>} homeP
|
|
106
110
|
* @param {object} opts
|
|
107
111
|
* @param {(specifier: string) => Promise<{ default: Bundle }>} opts.loadBundle
|
|
@@ -171,3 +175,22 @@ export const sanitizePathSegment = name => {
|
|
|
171
175
|
assertPathSegment(candidate);
|
|
172
176
|
return candidate;
|
|
173
177
|
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Idempotently provide an empty MapStore for the `retiredContractInstances`
|
|
181
|
+
* value in promise space
|
|
182
|
+
*
|
|
183
|
+
* @param {Promise<MapStore>} consume
|
|
184
|
+
* @param {Producer<MapStore>} produce
|
|
185
|
+
* @returns {Promise<MapStore>}
|
|
186
|
+
*/
|
|
187
|
+
export const provideRetiredInstances = async (consume, produce) => {
|
|
188
|
+
// Promise space has no way to look for an existing value other than awaiting a promise,
|
|
189
|
+
// but it does allow extra production so it's safe to do this redundantly.
|
|
190
|
+
produce.resolve(
|
|
191
|
+
makeScalarBigMapStore('retiredContractInstances', {
|
|
192
|
+
durable: true,
|
|
193
|
+
}),
|
|
194
|
+
);
|
|
195
|
+
return consume;
|
|
196
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { E } from '@endo/far';
|
|
2
|
+
import { makeTracer } from '@agoric/internal/src/debug.js';
|
|
3
|
+
import { reserveThenDeposit } from './utils.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {BootstrapPowers & {
|
|
7
|
+
* consume: {
|
|
8
|
+
* reserveKit: Promise<
|
|
9
|
+
* ReturnType<typeof import('../reserve/assetReserve.js').start>
|
|
10
|
+
* >;
|
|
11
|
+
* };
|
|
12
|
+
* }} powers
|
|
13
|
+
* @param {{ options: { address: string; count?: number } }} namedArgs
|
|
14
|
+
*/
|
|
15
|
+
export const inviteReserveWithdrawer = async (
|
|
16
|
+
{ consume: { namesByAddressAdmin, reserveKit } },
|
|
17
|
+
{ options: { address, count = 1 } },
|
|
18
|
+
) => {
|
|
19
|
+
const trace = makeTracer('InviteReserveWithdrawer');
|
|
20
|
+
|
|
21
|
+
const maybeGovernedCreatorFacetP = E.get(reserveKit).creatorFacet;
|
|
22
|
+
const creatorFacetP = E(maybeGovernedCreatorFacetP)
|
|
23
|
+
.getLimitedCreatorFacet()
|
|
24
|
+
.catch(err => {
|
|
25
|
+
trace('Failed to get limited creator facet:', err);
|
|
26
|
+
return maybeGovernedCreatorFacetP;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const makeInvitation = () =>
|
|
30
|
+
// @ts-expect-error tolerate translation from governed to limited creatorFacet
|
|
31
|
+
E(creatorFacetP).makeSingleWithdrawalInvitation();
|
|
32
|
+
|
|
33
|
+
const invitations = await Promise.all(
|
|
34
|
+
Array.from({ length: count }, makeInvitation),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// Deposit the invitations, but don't block in case the address does not yet
|
|
38
|
+
// have a smart wallet.
|
|
39
|
+
void reserveThenDeposit(
|
|
40
|
+
`reserve withdrawer ${address}`,
|
|
41
|
+
namesByAddressAdmin,
|
|
42
|
+
address,
|
|
43
|
+
invitations,
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
harden(inviteReserveWithdrawer);
|
|
47
|
+
|
|
48
|
+
export const getManifestForInviteWithdrawer = async (
|
|
49
|
+
{ restoreRef: _ },
|
|
50
|
+
{ address, count },
|
|
51
|
+
) => {
|
|
52
|
+
return {
|
|
53
|
+
manifest: {
|
|
54
|
+
[inviteReserveWithdrawer.name]: /** @type {const} */ ({
|
|
55
|
+
consume: {
|
|
56
|
+
namesByAddressAdmin: true,
|
|
57
|
+
reserveKit: true,
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
options: { address, count },
|
|
62
|
+
};
|
|
63
|
+
};
|