@agoric/inter-protocol 0.16.2-dev-7cc5def.0 → 0.16.2-u11.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/CHANGELOG.md +1041 -0
- package/bundles/bundle-auctioneer-js-meta.json +722 -0
- package/bundles/bundle-auctioneer.js +1 -0
- package/bundles/bundle-econCommitteeCharter-js-meta.json +222 -242
- package/bundles/bundle-econCommitteeCharter.js +1 -1
- package/bundles/bundle-feeDistributor-js-meta.json +458 -0
- package/bundles/bundle-feeDistributor.js +1 -0
- package/bundles/bundle-fluxAggregatorKit-js-meta.json +327 -343
- package/bundles/bundle-fluxAggregatorKit.js +1 -1
- package/bundles/bundle-psm-js-meta.json +308 -328
- package/bundles/bundle-psm.js +1 -1
- package/bundles/bundle-reserve-js-meta.json +662 -0
- package/bundles/bundle-reserve.js +1 -0
- package/bundles/bundle-scaledPriceAuthority-js-meta.json +542 -0
- package/bundles/bundle-scaledPriceAuthority.js +1 -0
- package/bundles/bundle-vaultFactory-js-meta.json +790 -0
- package/bundles/bundle-vaultFactory.js +1 -0
- package/package.json +31 -31
- package/scripts/add-collateral-core.js +112 -0
- package/scripts/build-bundles.js +21 -5
- package/scripts/deploy-contracts.js +100 -0
- package/scripts/init-core.js +198 -0
- package/scripts/invite-committee-core.js +42 -0
- package/scripts/manual-price-feed.js +117 -0
- package/scripts/price-feed-core.js +104 -0
- package/scripts/start-local-chain.sh +84 -0
- package/src/auction/auctionBook.js +56 -68
- package/src/auction/auctioneer.js +44 -56
- package/src/auction/offerBook.js +11 -12
- package/src/auction/params.js +5 -3
- package/src/auction/scheduleMath.js +13 -13
- package/src/auction/scheduler.js +32 -22
- package/src/auction/sortedOffers.js +7 -8
- package/src/auction/util.js +4 -4
- package/src/clientSupport.js +96 -152
- package/src/contractSupport.js +5 -5
- package/src/econCommitteeCharter.js +15 -16
- package/src/feeDistributor.js +33 -34
- package/src/interest.js +14 -20
- package/src/price/fluxAggregatorContract.js +45 -51
- package/src/price/fluxAggregatorKit.js +32 -47
- package/src/price/priceOracleKit.js +13 -11
- package/src/price/roundsManager.js +64 -52
- package/src/proposals/addAssetToVault.js +3 -15
- package/src/proposals/committee-proposal.js +9 -5
- package/src/proposals/core-proposal.js +7 -7
- package/src/proposals/econ-behaviors.js +32 -57
- package/src/proposals/price-feed-proposal.js +26 -59
- package/src/proposals/startEconCommittee.js +1 -1
- package/src/proposals/startPSM.js +22 -32
- package/src/proposals/utils.js +7 -26
- package/src/psm/psm.js +63 -69
- package/src/reserve/assetReserve.js +18 -27
- package/src/reserve/assetReserveKit.js +22 -14
- package/src/typeGuards.js +13 -0
- package/src/vaultFactory/liquidation.js +17 -30
- package/src/vaultFactory/math.js +9 -8
- package/src/vaultFactory/orderedVaultStore.js +9 -6
- package/src/vaultFactory/params.js +18 -24
- package/src/vaultFactory/prioritizedVaults.js +2 -2
- package/src/vaultFactory/proceeds.js +18 -24
- package/src/vaultFactory/storeUtils.js +12 -8
- package/src/vaultFactory/types.js +28 -38
- package/src/vaultFactory/vault.js +89 -88
- package/src/vaultFactory/vaultDirector.js +41 -33
- package/src/vaultFactory/vaultFactory.js +26 -33
- package/src/vaultFactory/vaultHolder.js +13 -8
- package/src/vaultFactory/vaultKit.js +2 -3
- package/src/vaultFactory/vaultManager.js +120 -138
- package/src/auction/auctionBook.d.ts +0 -83
- package/src/auction/auctionBook.d.ts.map +0 -1
- package/src/auction/auctioneer.d.ts +0 -75
- package/src/auction/auctioneer.d.ts.map +0 -1
- package/src/auction/offerBook.d.ts +0 -72
- package/src/auction/offerBook.d.ts.map +0 -1
- package/src/auction/params.d.ts +0 -142
- package/src/auction/params.d.ts.map +0 -1
- package/src/auction/scheduleMath.d.ts +0 -4
- package/src/auction/scheduleMath.d.ts.map +0 -1
- package/src/auction/scheduler.d.ts +0 -49
- package/src/auction/scheduler.d.ts.map +0 -1
- package/src/auction/sortedOffers.d.ts +0 -8
- package/src/auction/sortedOffers.d.ts.map +0 -1
- package/src/auction/util.d.ts +0 -30
- package/src/auction/util.d.ts.map +0 -1
- package/src/clientSupport.d.ts +0 -167
- package/src/clientSupport.d.ts.map +0 -1
- package/src/collectFees.d.ts +0 -2
- package/src/collectFees.d.ts.map +0 -1
- package/src/contractSupport.d.ts +0 -33
- package/src/contractSupport.d.ts.map +0 -1
- package/src/econCommitteeCharter.d.ts +0 -41
- package/src/econCommitteeCharter.d.ts.map +0 -1
- package/src/feeDistributor.d.ts +0 -212
- package/src/feeDistributor.d.ts.map +0 -1
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/interest-math.d.ts +0 -3
- package/src/interest-math.d.ts.map +0 -1
- package/src/interest.d.ts +0 -29
- package/src/interest.d.ts.map +0 -1
- package/src/price/fluxAggregatorContract.d.ts +0 -112
- package/src/price/fluxAggregatorContract.d.ts.map +0 -1
- package/src/price/fluxAggregatorKit.d.ts +0 -155
- package/src/price/fluxAggregatorKit.d.ts.map +0 -1
- package/src/price/priceOracleKit.d.ts +0 -52
- package/src/price/priceOracleKit.d.ts.map +0 -1
- package/src/price/roundsManager.d.ts +0 -330
- package/src/price/roundsManager.d.ts.map +0 -1
- package/src/proposals/addAssetToVault.d.ts +0 -155
- package/src/proposals/addAssetToVault.d.ts.map +0 -1
- package/src/proposals/committee-proposal.d.ts +0 -121
- 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/econ-behaviors.d.ts +0 -201
- package/src/proposals/econ-behaviors.d.ts.map +0 -1
- package/src/proposals/price-feed-proposal.d.ts +0 -83
- package/src/proposals/price-feed-proposal.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 -61
- package/src/proposals/startPSM.d.ts.map +0 -1
- package/src/proposals/utils.d.ts +0 -15
- package/src/proposals/utils.d.ts.map +0 -1
- package/src/provisionPool.d.ts +0 -165
- package/src/provisionPool.d.ts.map +0 -1
- package/src/provisionPool.js +0 -119
- package/src/provisionPoolKit.d.ts +0 -379
- package/src/provisionPoolKit.d.ts.map +0 -1
- package/src/provisionPoolKit.js +0 -461
- package/src/psm/psm.d.ts +0 -178
- package/src/psm/psm.d.ts.map +0 -1
- package/src/psm/types.d.ts +0 -2
- package/src/psm/types.d.ts.map +0 -1
- package/src/reserve/assetReserve.d.ts +0 -44
- package/src/reserve/assetReserve.d.ts.map +0 -1
- package/src/reserve/assetReserveKit.d.ts +0 -114
- package/src/reserve/assetReserveKit.d.ts.map +0 -1
- package/src/reserve/params.d.ts +0 -10
- package/src/reserve/params.d.ts.map +0 -1
- package/src/tokens.d.ts +0 -3
- package/src/tokens.d.ts.map +0 -1
- package/src/tokens.js +0 -5
- package/src/vaultFactory/burn.d.ts +0 -2
- package/src/vaultFactory/burn.d.ts.map +0 -1
- package/src/vaultFactory/liquidation.d.ts +0 -24
- package/src/vaultFactory/liquidation.d.ts.map +0 -1
- package/src/vaultFactory/math.d.ts +0 -10
- package/src/vaultFactory/math.d.ts.map +0 -1
- package/src/vaultFactory/orderedVaultStore.d.ts +0 -94
- package/src/vaultFactory/orderedVaultStore.d.ts.map +0 -1
- package/src/vaultFactory/params.d.ts +0 -159
- package/src/vaultFactory/params.d.ts.map +0 -1
- package/src/vaultFactory/prioritizedVaults.d.ts +0 -279
- package/src/vaultFactory/prioritizedVaults.d.ts.map +0 -1
- package/src/vaultFactory/proceeds.d.ts +0 -34
- package/src/vaultFactory/proceeds.d.ts.map +0 -1
- package/src/vaultFactory/storeUtils.d.ts +0 -25
- package/src/vaultFactory/storeUtils.d.ts.map +0 -1
- package/src/vaultFactory/type-imports.d.ts +0 -2
- package/src/vaultFactory/type-imports.d.ts.map +0 -1
- package/src/vaultFactory/types.d.ts +0 -137
- package/src/vaultFactory/types.d.ts.map +0 -1
- package/src/vaultFactory/vault.d.ts +0 -529
- package/src/vaultFactory/vault.d.ts.map +0 -1
- package/src/vaultFactory/vaultDirector.d.ts +0 -560
- package/src/vaultFactory/vaultDirector.d.ts.map +0 -1
- package/src/vaultFactory/vaultFactory.d.ts +0 -162
- package/src/vaultFactory/vaultFactory.d.ts.map +0 -1
- package/src/vaultFactory/vaultHolder.d.ts +0 -201
- package/src/vaultFactory/vaultHolder.d.ts.map +0 -1
- package/src/vaultFactory/vaultKit.d.ts +0 -32
- package/src/vaultFactory/vaultKit.d.ts.map +0 -1
- package/src/vaultFactory/vaultManager.d.ts +0 -554
- package/src/vaultFactory/vaultManager.d.ts.map +0 -1
|
@@ -44,34 +44,30 @@ const trace = makeTracer('VD', true);
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* @typedef {{
|
|
47
|
-
*
|
|
48
|
-
*
|
|
47
|
+
* collaterals: Brand[],
|
|
48
|
+
* rewardPoolAllocation: AmountKeywordRecord,
|
|
49
49
|
* }} MetricsNotification
|
|
50
50
|
*
|
|
51
|
-
* @typedef {Readonly<{
|
|
51
|
+
* @typedef {Readonly<{
|
|
52
|
+
* }>} ImmutableState
|
|
52
53
|
*
|
|
53
|
-
* @typedef {{
|
|
54
|
+
* @typedef {{
|
|
55
|
+
* }} MutableState
|
|
54
56
|
*
|
|
55
57
|
* @typedef {ImmutableState & MutableState} State
|
|
56
58
|
*
|
|
57
59
|
* @typedef {{
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* mintAndTransfer: MintAndTransfer;
|
|
63
|
-
* getShortfallReporter: () => Promise<
|
|
64
|
-
* import('../reserve/assetReserve.js').ShortfallReporter
|
|
65
|
-
* >;
|
|
60
|
+
* burnDebt: BurnDebt,
|
|
61
|
+
* getGovernedParams: (collateralBrand: Brand) => import('./vaultManager.js').GovernedParamGetters,
|
|
62
|
+
* mintAndTransfer: MintAndTransfer,
|
|
63
|
+
* getShortfallReporter: () => Promise<import('../reserve/assetReserve.js').ShortfallReporter>,
|
|
66
64
|
* }} FactoryPowersFacet
|
|
67
65
|
*
|
|
68
66
|
* @typedef {Readonly<{
|
|
69
67
|
* state: State;
|
|
70
68
|
* }>} MethodContext
|
|
71
69
|
*
|
|
72
|
-
* @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager').TypedParamManager<
|
|
73
|
-
* import('./params.js').VaultDirectorParams
|
|
74
|
-
* >} VaultDirectorParamManager
|
|
70
|
+
* @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager').TypedParamManager<import('./params.js').VaultDirectorParams>} VaultDirectorParamManager
|
|
75
71
|
*/
|
|
76
72
|
|
|
77
73
|
const shortfallInvitationKey = 'shortfallInvitation';
|
|
@@ -80,7 +76,7 @@ const shortfallInvitationKey = 'shortfallInvitation';
|
|
|
80
76
|
* @param {import('@agoric/ertp').Baggage} baggage
|
|
81
77
|
* @param {import('./vaultFactory.js').VaultFactoryZCF} zcf
|
|
82
78
|
* @param {VaultDirectorParamManager} directorParamManager
|
|
83
|
-
* @param {ZCFMint<
|
|
79
|
+
* @param {ZCFMint<"nat">} debtMint
|
|
84
80
|
* @param {ERef<import('@agoric/time/src/types').TimerService>} timer
|
|
85
81
|
* @param {ERef<import('../auction/auctioneer.js').AuctioneerPublicFacet>} auctioneer
|
|
86
82
|
* @param {ERef<StorageNode>} storageNode
|
|
@@ -130,7 +126,9 @@ const prepareVaultDirector = (
|
|
|
130
126
|
|
|
131
127
|
const managersNode = E(storageNode).makeChildNode('managers');
|
|
132
128
|
|
|
133
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* @returns {MetricsNotification}
|
|
131
|
+
*/
|
|
134
132
|
const sampleMetrics = () => {
|
|
135
133
|
return harden({
|
|
136
134
|
collaterals: Array.from(collateralManagers.keys()),
|
|
@@ -190,15 +188,15 @@ const prepareVaultDirector = (
|
|
|
190
188
|
},
|
|
191
189
|
|
|
192
190
|
/**
|
|
193
|
-
* Let the manager add rewards to the rewardPoolSeat without
|
|
194
|
-
* rewardPoolSeat to them.
|
|
191
|
+
* Let the manager add rewards to the rewardPoolSeat without
|
|
192
|
+
* exposing the rewardPoolSeat to them.
|
|
195
193
|
*
|
|
196
194
|
* @type {MintAndTransfer}
|
|
197
195
|
*/
|
|
198
196
|
mintAndTransfer: (mintReceiver, toMint, fee, nonMintTransfers) => {
|
|
199
197
|
const kept = AmountMath.subtract(toMint, fee);
|
|
200
198
|
debtMint.mintGains(harden({ Minted: toMint }), mintSeat);
|
|
201
|
-
/** @type {TransferPart[]} */
|
|
199
|
+
/** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */
|
|
202
200
|
const transfers = [
|
|
203
201
|
...nonMintTransfers,
|
|
204
202
|
[mintSeat, rewardPoolSeat, { Minted: fee }],
|
|
@@ -252,7 +250,6 @@ const prepareVaultDirector = (
|
|
|
252
250
|
metrics: makeRecorderTopic('Vault Factory metrics', metricsKit),
|
|
253
251
|
});
|
|
254
252
|
|
|
255
|
-
/** @param {(vm: VaultManager) => void} fn */
|
|
256
253
|
const allManagersDo = fn => {
|
|
257
254
|
for (const managerIndex of collateralManagers.values()) {
|
|
258
255
|
const vm = vaultManagers.get(managerIndex).self;
|
|
@@ -266,7 +263,9 @@ const prepareVaultDirector = (
|
|
|
266
263
|
});
|
|
267
264
|
};
|
|
268
265
|
|
|
269
|
-
/**
|
|
266
|
+
/**
|
|
267
|
+
* @returns {State}
|
|
268
|
+
*/
|
|
270
269
|
const initState = () => {
|
|
271
270
|
return {};
|
|
272
271
|
};
|
|
@@ -276,7 +275,7 @@ const prepareVaultDirector = (
|
|
|
276
275
|
*
|
|
277
276
|
* @param {import('./vaultFactory.js').VaultFactoryZCF} zcf
|
|
278
277
|
* @param {VaultDirectorParamManager} directorParamManager
|
|
279
|
-
* @param {ZCFMint<
|
|
278
|
+
* @param {ZCFMint<"nat">} debtMint
|
|
280
279
|
*/
|
|
281
280
|
const makeVaultDirector = prepareExoClassKit(
|
|
282
281
|
baggage,
|
|
@@ -331,7 +330,9 @@ const prepareVaultDirector = (
|
|
|
331
330
|
}
|
|
332
331
|
},
|
|
333
332
|
}),
|
|
334
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* @param {string} name
|
|
335
|
+
*/
|
|
335
336
|
getInvitation(name) {
|
|
336
337
|
return directorParamManager.getInternalParamValue(name);
|
|
337
338
|
},
|
|
@@ -423,7 +424,6 @@ const prepareVaultDirector = (
|
|
|
423
424
|
|
|
424
425
|
makeLiquidationWaker() {
|
|
425
426
|
return makeWaker('liquidationWaker', _timestamp => {
|
|
426
|
-
// XXX floating promise
|
|
427
427
|
allManagersDo(vm => vm.liquidateVaults(auctioneer));
|
|
428
428
|
});
|
|
429
429
|
},
|
|
@@ -440,7 +440,9 @@ const prepareVaultDirector = (
|
|
|
440
440
|
},
|
|
441
441
|
},
|
|
442
442
|
public: {
|
|
443
|
-
/**
|
|
443
|
+
/**
|
|
444
|
+
* @param {Brand} brandIn
|
|
445
|
+
*/
|
|
444
446
|
getCollateralManager(brandIn) {
|
|
445
447
|
collateralManagers.has(brandIn) ||
|
|
446
448
|
Fail`Not a supported collateral type ${brandIn}`;
|
|
@@ -461,16 +463,22 @@ const prepareVaultDirector = (
|
|
|
461
463
|
getPublicTopics() {
|
|
462
464
|
return topics;
|
|
463
465
|
},
|
|
464
|
-
/**
|
|
466
|
+
/**
|
|
467
|
+
* subscription for the paramManager for the vaultFactory's electorate
|
|
468
|
+
*/
|
|
465
469
|
getElectorateSubscription() {
|
|
466
470
|
return directorParamManager.getSubscription();
|
|
467
471
|
},
|
|
468
|
-
/**
|
|
472
|
+
/**
|
|
473
|
+
* @param {{ collateralBrand: Brand }} selector
|
|
474
|
+
*/
|
|
469
475
|
getGovernedParams({ collateralBrand }) {
|
|
470
476
|
// TODO use named getters of TypedParamManager
|
|
471
477
|
return vaultParamManagers.get(collateralBrand).getParams();
|
|
472
478
|
},
|
|
473
|
-
/**
|
|
479
|
+
/**
|
|
480
|
+
* @param {string} name
|
|
481
|
+
*/
|
|
474
482
|
getInvitationAmount(name) {
|
|
475
483
|
return directorParamManager.getInvitationAmount(name);
|
|
476
484
|
},
|
|
@@ -490,7 +498,9 @@ const prepareVaultDirector = (
|
|
|
490
498
|
rescheduleWaker,
|
|
491
499
|
);
|
|
492
500
|
},
|
|
493
|
-
/**
|
|
501
|
+
/**
|
|
502
|
+
* Start non-durable processes (or restart if needed after vat restart)
|
|
503
|
+
*/
|
|
494
504
|
async start() {
|
|
495
505
|
const { helper, machine } = this.facets;
|
|
496
506
|
|
|
@@ -515,9 +525,7 @@ harden(prepareVaultDirector);
|
|
|
515
525
|
/**
|
|
516
526
|
* Prepare the VaultDirector kind, get or make the singleton
|
|
517
527
|
*
|
|
518
|
-
* @type {(
|
|
519
|
-
* ...pvdArgs: Parameters<typeof prepareVaultDirector>
|
|
520
|
-
* ) => ReturnType<ReturnType<typeof prepareVaultDirector>>}
|
|
528
|
+
* @type {(...pvdArgs: Parameters<typeof prepareVaultDirector>) => ReturnType<ReturnType<typeof prepareVaultDirector>>}
|
|
521
529
|
*/
|
|
522
530
|
export const provideDirector = (...args) => {
|
|
523
531
|
const makeVaultDirector = prepareVaultDirector(...args);
|
|
@@ -34,46 +34,40 @@ import { provideDirector } from './vaultDirector.js';
|
|
|
34
34
|
const trace = makeTracer('VF', true);
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* @typedef {ZCF<
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* }
|
|
44
|
-
* >} VaultFactoryZCF
|
|
37
|
+
* @typedef {ZCF<GovernanceTerms<import('./params').VaultDirectorParams> & {
|
|
38
|
+
* auctioneerPublicFacet: import('../auction/auctioneer.js').AuctioneerPublicFacet,
|
|
39
|
+
* priceAuthority: ERef<PriceAuthority>,
|
|
40
|
+
* reservePublicFacet: AssetReservePublicFacet,
|
|
41
|
+
* timerService: import('@agoric/time/src/types').TimerService,
|
|
42
|
+
* }>} VaultFactoryZCF
|
|
45
43
|
*/
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
),
|
|
61
|
-
upgradability: 'canUpgrade',
|
|
62
|
-
};
|
|
63
|
-
harden(meta);
|
|
45
|
+
export const privateArgsShape = M.splitRecord(
|
|
46
|
+
harden({
|
|
47
|
+
marshaller: M.remotable('Marshaller'),
|
|
48
|
+
storageNode: StorageNodeShape,
|
|
49
|
+
}),
|
|
50
|
+
harden({
|
|
51
|
+
// only necessary on first invocation, not subsequent
|
|
52
|
+
feeMintAccess: FeeMintAccessShape,
|
|
53
|
+
initialPoserInvitation: InvitationShape,
|
|
54
|
+
initialShortfallInvitation: InvitationShape,
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
harden(privateArgsShape);
|
|
64
58
|
|
|
65
59
|
/**
|
|
66
60
|
* @param {VaultFactoryZCF} zcf
|
|
67
61
|
* @param {{
|
|
68
|
-
* feeMintAccess: FeeMintAccess
|
|
69
|
-
* initialPoserInvitation: Invitation
|
|
70
|
-
* initialShortfallInvitation: Invitation
|
|
71
|
-
* storageNode: ERef<StorageNode
|
|
72
|
-
* marshaller: ERef<Marshaller
|
|
62
|
+
* feeMintAccess: FeeMintAccess,
|
|
63
|
+
* initialPoserInvitation: Invitation,
|
|
64
|
+
* initialShortfallInvitation: Invitation,
|
|
65
|
+
* storageNode: ERef<StorageNode>,
|
|
66
|
+
* marshaller: ERef<Marshaller>,
|
|
73
67
|
* }} privateArgs
|
|
74
68
|
* @param {import('@agoric/ertp').Baggage} baggage
|
|
75
69
|
*/
|
|
76
|
-
export const
|
|
70
|
+
export const prepare = async (zcf, privateArgs, baggage) => {
|
|
77
71
|
trace('prepare start', privateArgs, [...baggage.keys()]);
|
|
78
72
|
const {
|
|
79
73
|
initialPoserInvitation,
|
|
@@ -151,6 +145,5 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
151
145
|
publicFacet: director.public,
|
|
152
146
|
});
|
|
153
147
|
};
|
|
154
|
-
harden(start);
|
|
155
148
|
|
|
156
|
-
/** @typedef {ContractOf<typeof
|
|
149
|
+
/** @typedef {ContractOf<typeof prepare>} VaultFactoryContract */
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* @file Use-object for the owner of a vault
|
|
3
|
+
*/
|
|
2
4
|
import { AmountShape } from '@agoric/ertp';
|
|
3
5
|
import { M, prepareExoClassKit } from '@agoric/vat-data';
|
|
4
6
|
import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js';
|
|
5
|
-
import { UnguardedHelperI } from '
|
|
7
|
+
import { UnguardedHelperI } from '../typeGuards.js';
|
|
6
8
|
|
|
7
9
|
const { Fail } = assert;
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* @typedef {{
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
+
* topicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<VaultNotification>,
|
|
14
|
+
* vault: Vault | null,
|
|
13
15
|
* }} State
|
|
14
16
|
*/
|
|
15
17
|
|
|
@@ -23,7 +25,7 @@ const HolderI = M.interface('holder', {
|
|
|
23
25
|
makeTransferInvitation: M.call().returns(M.promise()),
|
|
24
26
|
});
|
|
25
27
|
|
|
26
|
-
/** @type {{ [name: string]: [description: string, valueShape: Pattern] }} */
|
|
28
|
+
/** @type {{ [name: string]: [ description: string, valueShape: Pattern ] }} */
|
|
27
29
|
const PUBLIC_TOPICS = {
|
|
28
30
|
vault: ['Vault holder status', M.any()],
|
|
29
31
|
};
|
|
@@ -46,6 +48,7 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
|
46
48
|
}),
|
|
47
49
|
},
|
|
48
50
|
/**
|
|
51
|
+
*
|
|
49
52
|
* @param {Vault} vault
|
|
50
53
|
* @param {StorageNode} storageNode
|
|
51
54
|
* @returns {State}
|
|
@@ -58,7 +61,9 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
|
58
61
|
},
|
|
59
62
|
{
|
|
60
63
|
helper: {
|
|
61
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* @throws if this holder no longer owns the vault
|
|
66
|
+
*/
|
|
62
67
|
owned() {
|
|
63
68
|
const { vault } = this.state;
|
|
64
69
|
if (!vault) {
|
|
@@ -99,8 +104,8 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
|
99
104
|
return this.facets.helper.owned().makeCloseInvitation();
|
|
100
105
|
},
|
|
101
106
|
/**
|
|
102
|
-
* Starting a transfer revokes the vault holder. The associated updater
|
|
103
|
-
*
|
|
107
|
+
* Starting a transfer revokes the vault holder. The associated updater will
|
|
108
|
+
* get a special notification that the vault is being transferred.
|
|
104
109
|
*/
|
|
105
110
|
makeTransferInvitation() {
|
|
106
111
|
const vault = this.facets.helper.owned();
|
|
@@ -8,8 +8,7 @@ import { prepareVaultHolder } from './vaultHolder.js';
|
|
|
8
8
|
const trace = makeTracer('VK', true);
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Wrap the VaultHolder duration object in a record suitable for the result of
|
|
12
|
-
* an invitation.
|
|
11
|
+
* Wrap the VaultHolder duration object in a record suitable for the result of an invitation.
|
|
13
12
|
*
|
|
14
13
|
* @param {import('@agoric/ertp').Baggage} baggage
|
|
15
14
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
@@ -44,4 +43,4 @@ export const prepareVaultKit = (baggage, makeRecorderKit) => {
|
|
|
44
43
|
return makeVaultKit;
|
|
45
44
|
};
|
|
46
45
|
|
|
47
|
-
/** @typedef {ReturnType<ReturnType<typeof prepareVaultKit>>} VaultKit */
|
|
46
|
+
/** @typedef {(ReturnType<ReturnType<typeof prepareVaultKit>>)} VaultKit */
|