@agoric/inter-protocol 0.16.1 → 0.16.2-calypso-dev-84eb287.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/README.md +6 -6
- package/package.json +41 -36
- package/scripts/build-bundles.js +5 -21
- package/src/auction/auctionBook.d.ts +147 -0
- package/src/auction/auctionBook.d.ts.map +1 -0
- package/src/auction/auctionBook.js +135 -103
- package/src/auction/auctioneer.d.ts +69 -0
- package/src/auction/auctioneer.d.ts.map +1 -0
- package/src/auction/auctioneer.js +63 -49
- package/src/auction/offerBook.d.ts +45 -0
- package/src/auction/offerBook.d.ts.map +1 -0
- package/src/auction/offerBook.js +13 -12
- package/src/auction/params.d.ts +144 -0
- package/src/auction/params.d.ts.map +1 -0
- package/src/auction/params.js +10 -9
- package/src/auction/scheduleMath.d.ts +5 -0
- package/src/auction/scheduleMath.d.ts.map +1 -0
- package/src/auction/scheduleMath.js +17 -15
- package/src/auction/scheduler.d.ts +49 -0
- package/src/auction/scheduler.d.ts.map +1 -0
- package/src/auction/scheduler.js +51 -43
- package/src/auction/sortedOffers.d.ts +8 -0
- package/src/auction/sortedOffers.d.ts.map +1 -0
- package/src/auction/sortedOffers.js +9 -7
- package/src/auction/util.d.ts +32 -0
- package/src/auction/util.d.ts.map +1 -0
- package/src/auction/util.js +6 -4
- package/src/clientSupport.d.ts +167 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +154 -96
- package/src/collectFees.d.ts +2 -0
- package/src/collectFees.d.ts.map +1 -0
- package/src/contractSupport.d.ts +28 -0
- package/src/contractSupport.d.ts.map +1 -0
- package/src/contractSupport.js +14 -12
- package/src/econCommitteeCharter.d.ts +39 -0
- package/src/econCommitteeCharter.d.ts.map +1 -0
- package/src/econCommitteeCharter.js +21 -20
- package/src/feeDistributor.d.ts +224 -0
- package/src/feeDistributor.d.ts.map +1 -0
- package/src/feeDistributor.js +37 -33
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +1 -0
- package/src/interest-math.d.ts +3 -0
- package/src/interest-math.d.ts.map +1 -0
- package/src/interest.d.ts +28 -0
- package/src/interest.d.ts.map +1 -0
- package/src/interest.js +21 -16
- package/src/price/README.md +13 -0
- package/src/price/fluxAggregatorContract.d.ts +70 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -0
- package/src/price/fluxAggregatorContract.js +62 -55
- package/src/price/fluxAggregatorKit.d.ts +103 -0
- package/src/price/fluxAggregatorKit.d.ts.map +1 -0
- package/src/price/fluxAggregatorKit.js +50 -37
- package/src/price/priceOracleKit.d.ts +38 -0
- package/src/price/priceOracleKit.d.ts.map +1 -0
- package/src/price/priceOracleKit.js +11 -13
- package/src/price/roundsManager.d.ts +204 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +79 -82
- package/src/proposals/README.md +2 -3
- package/src/proposals/add-auction.d.ts +69 -0
- package/src/proposals/add-auction.d.ts.map +1 -0
- package/src/proposals/add-auction.js +180 -0
- package/src/proposals/addAssetToVault.d.ts +160 -0
- package/src/proposals/addAssetToVault.d.ts.map +1 -0
- package/src/proposals/addAssetToVault.js +172 -38
- package/src/proposals/committee-proposal.d.ts +113 -0
- package/src/proposals/committee-proposal.d.ts.map +1 -0
- package/src/proposals/committee-proposal.js +25 -31
- package/src/proposals/core-proposal.d.ts +149 -0
- package/src/proposals/core-proposal.d.ts.map +1 -0
- package/src/proposals/core-proposal.js +9 -11
- package/src/proposals/econ-behaviors.d.ts +539 -0
- package/src/proposals/econ-behaviors.d.ts.map +1 -0
- package/src/proposals/econ-behaviors.js +64 -45
- package/src/proposals/price-feed-proposal.d.ts +84 -0
- package/src/proposals/price-feed-proposal.d.ts.map +1 -0
- package/src/proposals/price-feed-proposal.js +108 -51
- package/src/proposals/startEconCommittee.d.ts +34 -0
- package/src/proposals/startEconCommittee.d.ts.map +1 -0
- package/src/proposals/startEconCommittee.js +2 -2
- package/src/proposals/startPSM.d.ts +59 -0
- package/src/proposals/startPSM.d.ts.map +1 -0
- package/src/proposals/startPSM.js +38 -27
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +24 -0
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +1 -0
- package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
- package/src/proposals/upgrade-vaults.d.ts +35 -0
- package/src/proposals/upgrade-vaults.d.ts.map +1 -0
- package/src/proposals/upgrade-vaults.js +235 -0
- package/src/proposals/utils.d.ts +17 -0
- package/src/proposals/utils.d.ts.map +1 -0
- package/src/proposals/utils.js +34 -7
- package/src/provisionPool.d.ts +167 -0
- package/src/provisionPool.d.ts.map +1 -0
- package/src/provisionPool.js +122 -0
- package/src/provisionPoolKit.d.ts +367 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +522 -0
- package/src/psm/psm.d.ts +122 -0
- package/src/psm/psm.d.ts.map +1 -0
- package/src/psm/psm.js +73 -69
- package/src/psm/types-ambient.d.ts +2 -0
- package/src/psm/types-ambient.d.ts.map +1 -0
- package/src/psm/types-ambient.js +3 -0
- package/src/reserve/assetReserve.d.ts +47 -0
- package/src/reserve/assetReserve.d.ts.map +1 -0
- package/src/reserve/assetReserve.js +28 -19
- package/src/reserve/assetReserveKit.d.ts +74 -0
- package/src/reserve/assetReserveKit.d.ts.map +1 -0
- package/src/reserve/assetReserveKit.js +18 -24
- package/src/reserve/params.d.ts +10 -0
- package/src/reserve/params.d.ts.map +1 -0
- package/src/tokens.d.ts +3 -0
- package/src/tokens.d.ts.map +1 -0
- package/src/tokens.js +5 -0
- package/src/vaultFactory/burn.d.ts +2 -0
- package/src/vaultFactory/burn.d.ts.map +1 -0
- package/src/vaultFactory/burn.js +1 -1
- package/src/vaultFactory/liquidation.d.ts +23 -0
- package/src/vaultFactory/liquidation.d.ts.map +1 -0
- package/src/vaultFactory/liquidation.js +36 -22
- package/src/vaultFactory/math.d.ts +11 -0
- package/src/vaultFactory/math.d.ts.map +1 -0
- package/src/vaultFactory/math.js +10 -9
- package/src/vaultFactory/orderedVaultStore.d.ts +93 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +8 -11
- package/src/vaultFactory/params.d.ts +140 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +52 -24
- package/src/vaultFactory/prioritizedVaults.d.ts +279 -0
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
- package/src/vaultFactory/prioritizedVaults.js +4 -4
- package/src/vaultFactory/proceeds.d.ts +35 -0
- package/src/vaultFactory/proceeds.d.ts.map +1 -0
- package/src/vaultFactory/proceeds.js +26 -18
- package/src/vaultFactory/storeUtils.d.ts +25 -0
- package/src/vaultFactory/storeUtils.d.ts.map +1 -0
- package/src/vaultFactory/storeUtils.js +10 -12
- package/src/vaultFactory/types-ambient.d.ts +137 -0
- package/src/vaultFactory/types-ambient.d.ts.map +1 -0
- package/src/vaultFactory/{types.js → types-ambient.js} +42 -42
- package/src/vaultFactory/vault.d.ts +332 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +99 -93
- package/src/vaultFactory/vaultDirector.d.ts +340 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +63 -50
- package/src/vaultFactory/vaultFactory.d.ts +201 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +49 -32
- package/src/vaultFactory/vaultHolder.d.ts +126 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +10 -14
- package/src/vaultFactory/vaultKit.d.ts +32 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +5 -4
- package/src/vaultFactory/vaultManager.d.ts +674 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +249 -151
- package/CHANGELOG.md +0 -1033
- package/bundles/bundle-auctioneer-js-meta.json +0 -722
- package/bundles/bundle-auctioneer.js +0 -1
- package/bundles/bundle-econCommitteeCharter-js-meta.json +0 -514
- package/bundles/bundle-econCommitteeCharter.js +0 -1
- package/bundles/bundle-feeDistributor-js-meta.json +0 -458
- package/bundles/bundle-feeDistributor.js +0 -1
- package/bundles/bundle-fluxAggregatorKit-js-meta.json +0 -674
- package/bundles/bundle-fluxAggregatorKit.js +0 -1
- package/bundles/bundle-psm-js-meta.json +0 -666
- package/bundles/bundle-psm.js +0 -1
- package/bundles/bundle-reserve-js-meta.json +0 -662
- package/bundles/bundle-reserve.js +0 -1
- package/bundles/bundle-scaledPriceAuthority-js-meta.json +0 -542
- package/bundles/bundle-scaledPriceAuthority.js +0 -1
- package/bundles/bundle-vaultFactory-js-meta.json +0 -790
- package/bundles/bundle-vaultFactory.js +0 -1
- package/exported.js +0 -2
- package/scripts/add-collateral-core.js +0 -112
- package/scripts/deploy-contracts.js +0 -100
- package/scripts/init-core.js +0 -198
- package/scripts/invite-committee-core.js +0 -42
- package/scripts/manual-price-feed.js +0 -117
- package/scripts/price-feed-core.js +0 -104
- package/scripts/start-local-chain.sh +0 -84
- package/src/psm/types.js +0 -3
- package/src/typeGuards.js +0 -13
- package/src/vaultFactory/type-imports.js +0 -4
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prepare the VaultDirector kind, get or make the singleton
|
|
3
|
+
*
|
|
4
|
+
* @type {(
|
|
5
|
+
* ...pvdArgs: Parameters<typeof prepareVaultDirector>
|
|
6
|
+
* ) => ReturnType<ReturnType<typeof prepareVaultDirector>>}
|
|
7
|
+
*/
|
|
8
|
+
export const provideDirector: (...pvdArgs: Parameters<typeof prepareVaultDirector>) => ReturnType<ReturnType<typeof prepareVaultDirector>>;
|
|
9
|
+
export type MetricsNotification = {
|
|
10
|
+
collaterals: Brand[];
|
|
11
|
+
rewardPoolAllocation: AmountKeywordRecord;
|
|
12
|
+
};
|
|
13
|
+
export type ImmutableState = Readonly<{}>;
|
|
14
|
+
export type MutableState = {};
|
|
15
|
+
export type State = ImmutableState & MutableState;
|
|
16
|
+
export type FactoryPowersFacet = {
|
|
17
|
+
burnDebt: BurnDebt;
|
|
18
|
+
getGovernedParams: (collateralBrand: Brand) => import("./vaultManager.js").GovernedParamGetters;
|
|
19
|
+
mintAndTransfer: MintAndTransfer;
|
|
20
|
+
getShortfallReporter: () => Promise<import("../reserve/assetReserve.js").ShortfallReporter>;
|
|
21
|
+
};
|
|
22
|
+
export type MethodContext = Readonly<{
|
|
23
|
+
state: State;
|
|
24
|
+
}>;
|
|
25
|
+
export type VaultDirectorParamManager = import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<import("./params.js").VaultDirectorParams>;
|
|
26
|
+
/**
|
|
27
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
28
|
+
* @param {import('./vaultFactory.js').VaultFactoryZCF} zcf
|
|
29
|
+
* @param {VaultDirectorParamManager} directorParamManager
|
|
30
|
+
* @param {ZCFMint<'nat'>} debtMint
|
|
31
|
+
* @param {ERef<import('@agoric/time').TimerService>} timer
|
|
32
|
+
* @param {ERef<import('../auction/auctioneer.js').AuctioneerPublicFacet>} auctioneer
|
|
33
|
+
* @param {ERef<StorageNode>} storageNode
|
|
34
|
+
* @param {ERef<Marshaller>} marshaller
|
|
35
|
+
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
36
|
+
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeERecorderKit} makeERecorderKit
|
|
37
|
+
* @param managerParams
|
|
38
|
+
*/
|
|
39
|
+
declare function prepareVaultDirector(baggage: import("@agoric/swingset-liveslots").Baggage, zcf: import("./vaultFactory.js").VaultFactoryZCF, directorParamManager: VaultDirectorParamManager, debtMint: ZCFMint<"nat">, timer: ERef<import("@agoric/time").TimerService>, auctioneer: ERef<import("../auction/auctioneer.js").AuctioneerPublicFacet>, storageNode: ERef<StorageNode>, marshaller: ERef<Marshaller>, makeRecorderKit: import("@agoric/zoe/src/contractSupport/recorder.js").MakeRecorderKit, makeERecorderKit: import("@agoric/zoe/src/contractSupport/recorder.js").MakeERecorderKit, managerParams: any): () => import("@endo/exo").GuardedKit<{
|
|
40
|
+
creator: {
|
|
41
|
+
getParamMgrRetriever: () => {
|
|
42
|
+
/** @param {VaultFactoryParamPath} paramPath */
|
|
43
|
+
get: (paramPath?: VaultFactoryParamPath) => VaultDirectorParamManager | import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
|
|
44
|
+
DebtLimit: "amount";
|
|
45
|
+
InterestRate: "ratio";
|
|
46
|
+
LiquidationPadding: "ratio";
|
|
47
|
+
LiquidationMargin: "ratio";
|
|
48
|
+
LiquidationPenalty: "ratio";
|
|
49
|
+
MintFee: "ratio";
|
|
50
|
+
}>;
|
|
51
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
52
|
+
/** @param {VaultFactoryParamPath} paramPath */
|
|
53
|
+
get: (paramPath?: VaultFactoryParamPath) => VaultDirectorParamManager | import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
|
|
54
|
+
DebtLimit: "amount";
|
|
55
|
+
InterestRate: "ratio";
|
|
56
|
+
LiquidationPadding: "ratio";
|
|
57
|
+
LiquidationMargin: "ratio";
|
|
58
|
+
LiquidationPenalty: "ratio";
|
|
59
|
+
MintFee: "ratio";
|
|
60
|
+
}>;
|
|
61
|
+
}>;
|
|
62
|
+
/** @param {string} name */
|
|
63
|
+
getInvitation(name: string): Promise<Invitation<unknown, undefined>>;
|
|
64
|
+
getLimitedCreatorFacet(): import("@endo/exo").Guarded<{
|
|
65
|
+
/**
|
|
66
|
+
* @param {Issuer<'nat'>} collateralIssuer
|
|
67
|
+
* @param {Keyword} collateralKeyword
|
|
68
|
+
* @param {VaultManagerParamValues} initialParamValues
|
|
69
|
+
*/
|
|
70
|
+
addVaultType(collateralIssuer: Issuer<"nat">, collateralKeyword: Keyword, initialParamValues: VaultManagerParamValues): Promise<import("@endo/exo").Guarded<{
|
|
71
|
+
getGovernedParams(): import("./vaultManager.js").GovernedParamGetters;
|
|
72
|
+
makeVaultKit(seat: ZCFSeat): Promise<{
|
|
73
|
+
publicSubscribers: {
|
|
74
|
+
vault: {
|
|
75
|
+
description: string;
|
|
76
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
77
|
+
storagePath: Promise<string>;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
81
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
82
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
83
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
84
|
+
}>;
|
|
85
|
+
vault: import("@endo/exo").Guarded<{
|
|
86
|
+
getPublicTopics(): {
|
|
87
|
+
vault: {
|
|
88
|
+
description: string;
|
|
89
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
90
|
+
storagePath: Promise<string>;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
94
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
95
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
96
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
97
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
98
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
99
|
+
}>;
|
|
100
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
101
|
+
}>;
|
|
102
|
+
getCollateralQuote(): import("@agoric/zoe/tools/types.js").PriceQuote;
|
|
103
|
+
getPublicFacet(): import("@endo/exo").Guarded<{
|
|
104
|
+
makeVaultInvitation(): Promise<Invitation<{
|
|
105
|
+
publicSubscribers: {
|
|
106
|
+
vault: {
|
|
107
|
+
description: string;
|
|
108
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
109
|
+
storagePath: Promise<string>;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
113
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
114
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
115
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
116
|
+
}>;
|
|
117
|
+
vault: import("@endo/exo").Guarded<{
|
|
118
|
+
getPublicTopics(): {
|
|
119
|
+
vault: {
|
|
120
|
+
description: string;
|
|
121
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
122
|
+
storagePath: Promise<string>;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
126
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
127
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
128
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
129
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
130
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
131
|
+
}>;
|
|
132
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
133
|
+
}, undefined>>;
|
|
134
|
+
getQuotes(): import("@agoric/notifier").StoredNotifier<import("@agoric/zoe/tools/types.js").PriceQuote>;
|
|
135
|
+
getCompoundedInterest(): Ratio;
|
|
136
|
+
getPublicTopics(): {
|
|
137
|
+
asset: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./vaultManager.js").AssetState>;
|
|
138
|
+
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./vaultManager.js").MetricsNotification>;
|
|
139
|
+
};
|
|
140
|
+
}>;
|
|
141
|
+
lockOraclePrices(): import("@agoric/zoe/tools/types.js").PriceQuote;
|
|
142
|
+
liquidateVaults(auctionPF: ERef<AuctioneerPublicFacet>): Promise<void>;
|
|
143
|
+
}>>;
|
|
144
|
+
makeCollectFeesInvitation(): Promise<Invitation<string, undefined>>;
|
|
145
|
+
getRewardAllocation(): Allocation;
|
|
146
|
+
makeLiquidationWaker(): {
|
|
147
|
+
wake: (timestamp: any) => any;
|
|
148
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
149
|
+
wake: (timestamp: any) => any;
|
|
150
|
+
}>;
|
|
151
|
+
makeReschedulerWaker(): {
|
|
152
|
+
wake: (timestamp: any) => any;
|
|
153
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
154
|
+
wake: (timestamp: any) => any;
|
|
155
|
+
}>;
|
|
156
|
+
makePriceLockWaker(): {
|
|
157
|
+
wake: (timestamp: any) => any;
|
|
158
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
159
|
+
wake: (timestamp: any) => any;
|
|
160
|
+
}>;
|
|
161
|
+
setShortfallReporter(newInvitation: any): Promise<void>;
|
|
162
|
+
}>;
|
|
163
|
+
/** @returns {ERef<GovernedApis>} */
|
|
164
|
+
getGovernedApis(): ERef<GovernedApis>;
|
|
165
|
+
getGovernedApiNames(): never[];
|
|
166
|
+
setOfferFilter: (strings: any) => Promise<void>;
|
|
167
|
+
};
|
|
168
|
+
machine: {
|
|
169
|
+
/**
|
|
170
|
+
* @param {Issuer<'nat'>} collateralIssuer
|
|
171
|
+
* @param {Keyword} collateralKeyword
|
|
172
|
+
* @param {VaultManagerParamValues} initialParamValues
|
|
173
|
+
*/
|
|
174
|
+
addVaultType(collateralIssuer: Issuer<"nat">, collateralKeyword: Keyword, initialParamValues: VaultManagerParamValues): Promise<import("@endo/exo").Guarded<{
|
|
175
|
+
getGovernedParams(): import("./vaultManager.js").GovernedParamGetters;
|
|
176
|
+
makeVaultKit(seat: ZCFSeat): Promise<{
|
|
177
|
+
publicSubscribers: {
|
|
178
|
+
vault: {
|
|
179
|
+
description: string;
|
|
180
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
181
|
+
storagePath: Promise<string>;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
185
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
186
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
187
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
188
|
+
}>;
|
|
189
|
+
vault: import("@endo/exo").Guarded<{
|
|
190
|
+
getPublicTopics(): {
|
|
191
|
+
vault: {
|
|
192
|
+
description: string;
|
|
193
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
194
|
+
storagePath: Promise<string>;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
198
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
199
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
200
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
201
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
202
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
203
|
+
}>;
|
|
204
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
205
|
+
}>;
|
|
206
|
+
getCollateralQuote(): import("@agoric/zoe/tools/types.js").PriceQuote;
|
|
207
|
+
getPublicFacet(): import("@endo/exo").Guarded<{
|
|
208
|
+
makeVaultInvitation(): Promise<Invitation<{
|
|
209
|
+
publicSubscribers: {
|
|
210
|
+
vault: {
|
|
211
|
+
description: string;
|
|
212
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
213
|
+
storagePath: Promise<string>;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
217
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
218
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
219
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
220
|
+
}>;
|
|
221
|
+
vault: import("@endo/exo").Guarded<{
|
|
222
|
+
getPublicTopics(): {
|
|
223
|
+
vault: {
|
|
224
|
+
description: string;
|
|
225
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
226
|
+
storagePath: Promise<string>;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
230
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
231
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
232
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
233
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
234
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
235
|
+
}>;
|
|
236
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
237
|
+
}, undefined>>;
|
|
238
|
+
getQuotes(): import("@agoric/notifier").StoredNotifier<import("@agoric/zoe/tools/types.js").PriceQuote>;
|
|
239
|
+
getCompoundedInterest(): Ratio;
|
|
240
|
+
getPublicTopics(): {
|
|
241
|
+
asset: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./vaultManager.js").AssetState>;
|
|
242
|
+
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./vaultManager.js").MetricsNotification>;
|
|
243
|
+
};
|
|
244
|
+
}>;
|
|
245
|
+
lockOraclePrices(): import("@agoric/zoe/tools/types.js").PriceQuote;
|
|
246
|
+
liquidateVaults(auctionPF: ERef<AuctioneerPublicFacet>): Promise<void>;
|
|
247
|
+
}>>;
|
|
248
|
+
makeCollectFeesInvitation(): Promise<Invitation<string, undefined>>;
|
|
249
|
+
getRewardAllocation(): Allocation;
|
|
250
|
+
makeLiquidationWaker(): {
|
|
251
|
+
wake: (timestamp: any) => any;
|
|
252
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
253
|
+
wake: (timestamp: any) => any;
|
|
254
|
+
}>;
|
|
255
|
+
makeReschedulerWaker(): {
|
|
256
|
+
wake: (timestamp: any) => any;
|
|
257
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
258
|
+
wake: (timestamp: any) => any;
|
|
259
|
+
}>;
|
|
260
|
+
makePriceLockWaker(): {
|
|
261
|
+
wake: (timestamp: any) => any;
|
|
262
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
263
|
+
wake: (timestamp: any) => any;
|
|
264
|
+
}>;
|
|
265
|
+
setShortfallReporter(newInvitation: any): Promise<void>;
|
|
266
|
+
};
|
|
267
|
+
public: {
|
|
268
|
+
/** @param {Brand} brandIn */
|
|
269
|
+
getCollateralManager(brandIn: Brand): import("@endo/exo").Guarded<{
|
|
270
|
+
makeVaultInvitation(): Promise<Invitation<{
|
|
271
|
+
publicSubscribers: {
|
|
272
|
+
vault: {
|
|
273
|
+
description: string;
|
|
274
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
275
|
+
storagePath: Promise<string>;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
279
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
280
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
281
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
282
|
+
}>;
|
|
283
|
+
vault: import("@endo/exo").Guarded<{
|
|
284
|
+
getPublicTopics(): {
|
|
285
|
+
vault: {
|
|
286
|
+
description: string;
|
|
287
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
288
|
+
storagePath: Promise<string>;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
292
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
293
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
294
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
295
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
296
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
297
|
+
}>;
|
|
298
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
299
|
+
}, undefined>>;
|
|
300
|
+
getQuotes(): import("@agoric/notifier").StoredNotifier<import("@agoric/zoe/tools/types.js").PriceQuote>;
|
|
301
|
+
getCompoundedInterest(): Ratio;
|
|
302
|
+
getPublicTopics(): {
|
|
303
|
+
asset: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./vaultManager.js").AssetState>;
|
|
304
|
+
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./vaultManager.js").MetricsNotification>;
|
|
305
|
+
};
|
|
306
|
+
}>;
|
|
307
|
+
getDebtIssuer(): globalThis.Issuer<"nat", import("@endo/patterns").Key>;
|
|
308
|
+
/**
|
|
309
|
+
* subscription for the paramManager for a particular vaultManager
|
|
310
|
+
*
|
|
311
|
+
* @param {{ collateralBrand: Brand }} selector
|
|
312
|
+
*/
|
|
313
|
+
getSubscription({ collateralBrand }: {
|
|
314
|
+
collateralBrand: Brand;
|
|
315
|
+
}): globalThis.StoredSubscription<globalThis.GovernanceSubscriptionState>;
|
|
316
|
+
getPublicTopics(): {
|
|
317
|
+
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<MetricsNotification>;
|
|
318
|
+
};
|
|
319
|
+
/** subscription for the paramManager for the vaultFactory's electorate */
|
|
320
|
+
getElectorateSubscription(): globalThis.StoredSubscription<globalThis.GovernanceSubscriptionState>;
|
|
321
|
+
/**
|
|
322
|
+
* Note this works only for a collateral manager. For the director use,
|
|
323
|
+
* `getElectorateSubscription`
|
|
324
|
+
*
|
|
325
|
+
* @param {{ collateralBrand: Brand }} selector
|
|
326
|
+
*/
|
|
327
|
+
getGovernedParams({ collateralBrand }: {
|
|
328
|
+
collateralBrand: Brand;
|
|
329
|
+
}): globalThis.ERef<globalThis.ParamStateRecord>;
|
|
330
|
+
/** @param {string} name */
|
|
331
|
+
getInvitationAmount(name: string): import("@agoric/ertp/src/types.js").SetAmount<InvitationDetails>;
|
|
332
|
+
};
|
|
333
|
+
helper: {
|
|
334
|
+
resetWakeupsForNextAuction(): Promise<void>;
|
|
335
|
+
/** Start non-durable processes (or restart if needed after vat restart) */
|
|
336
|
+
start(): Promise<void>;
|
|
337
|
+
};
|
|
338
|
+
}>;
|
|
339
|
+
export {};
|
|
340
|
+
//# sourceMappingURL=vaultDirector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vaultDirector.d.ts","sourceRoot":"","sources":["vaultDirector.js"],"names":[],"mappings":"AAuhBA;;;;;;GAMG;AACH,8BAJU,CACT,GAAO,OAAO,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,KAChD,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAQzD;kCAtfW;IACZ,WAAe,EAAE,KAAK,EAAE,CAAC;IACzB,oBAAwB,EAAE,mBAAmB,CAAC;CAC3C;6BAGS,QAAQ,CAAC,EAAE,CAAC;2BAEZ,EAAE;oBAEF,cAAc,GAAG,YAAY;iCAE7B;IACZ,QAAY,EAAE,QAAQ,CAAC;IACvB,iBAAqB,EAAE,CACvB,eAAqB,EAAE,KAAK,KACnB,OAAO,mBAAmB,EAAE,oBAAoB,CAAC;IAC1D,eAAmB,EAAE,eAAe,CAAC;IACrC,oBAAwB,EAAE,MAAM,OAAO,CACvC,OAAa,4BAA4B,EAAE,iBAAiB,CACvD,CAAC;CACH;4BAGS,QAAQ,CAAC;IACrB,KAAS,EAAE,KAAK,CAAC;CACd,CAAC;wCAEQ,OAAO,gEAAgE,EAAE,iBAAiB,CACtG,OAAa,aAAa,EAAE,mBAAmB,CAC1C;AAKN;;;;;;;;;;;;GAYG;AACH,+CAZW,OAAO,4BAA4B,EAAE,OAAO,OAC5C,OAAO,mBAAmB,EAAE,eAAe,wBAC3C,yBAAyB,YACzB,OAAO,CAAC,KAAK,CAAC,SACd,IAAI,CAAC,OAAO,cAAc,EAAE,YAAY,CAAC,cACzC,IAAI,CAAC,OAAO,0BAA0B,EAAE,qBAAqB,CAAC,eAC9D,IAAI,CAAC,WAAW,CAAC,cACjB,IAAI,CAAC,UAAU,CAAC,mBAChB,OAAO,6CAA6C,EAAE,eAAe,oBACrE,OAAO,6CAA6C,EAAE,gBAAgB,oCAiIlE,WAAW;;;YA+Gd,+CAA+C;8BAAnC,qBAAqB;;;;;;;;;YAAjC,+CAA+C;8BAAnC,qBAAqB;;;;;;;;;QAarC,2BAA2B;4BAAf,MAAM;;YAmBlB;;;;eAIG;2CAHQ,MAAM,CAAC,KAAK,CAAC,qBACb,OAAO,sBACP,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAflC,oCAAoC;2BAAtB,IAAI,CAAC,YAAY,CAAC;;;;;QAYhC;;;;WAIG;uCAHQ,MAAM,CAAC,KAAK,CAAC,qBACb,OAAO,sBACP,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4FlC,6BAA6B;sCAAjB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAUjB;;;;WAIG;6CADQ;YAAE,eAAe,EAAE,KAAK,CAAA;SAAE;;;;QAQrC,0EAA0E;;QAI1E;;;;;WAKG;+CADQ;YAAE,eAAe,EAAE,KAAK,CAAA;SAAE;QAMrC,2BAA2B;kCAAf,MAAM;;;;QAoBlB,2EAA2E;;;GAmBlF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '@agoric/governance/exported.js';
|
|
1
|
+
/// <reference types="@agoric/governance/exported" />
|
|
2
|
+
/// <reference types="@agoric/zoe/exported" />
|
|
5
3
|
|
|
6
4
|
import { AmountMath, AmountShape, BrandShape, IssuerShape } from '@agoric/ertp';
|
|
7
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
GovernorFacetShape,
|
|
7
|
+
InvitationShape,
|
|
8
|
+
} from '@agoric/governance/src/typeGuards.js';
|
|
8
9
|
import { makeTracer } from '@agoric/internal';
|
|
9
10
|
import { M, mustMatch } from '@agoric/store';
|
|
10
11
|
import {
|
|
@@ -44,45 +45,52 @@ const trace = makeTracer('VD', true);
|
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* @typedef {{
|
|
47
|
-
*
|
|
48
|
-
*
|
|
48
|
+
* collaterals: Brand[];
|
|
49
|
+
* rewardPoolAllocation: AmountKeywordRecord;
|
|
49
50
|
* }} MetricsNotification
|
|
50
51
|
*
|
|
51
|
-
* @typedef {Readonly<{
|
|
52
|
-
* }>} ImmutableState
|
|
53
52
|
*
|
|
54
|
-
* @typedef {{
|
|
55
|
-
*
|
|
53
|
+
* @typedef {Readonly<{}>} ImmutableState
|
|
54
|
+
*
|
|
55
|
+
* @typedef {{}} MutableState
|
|
56
56
|
*
|
|
57
57
|
* @typedef {ImmutableState & MutableState} State
|
|
58
58
|
*
|
|
59
59
|
* @typedef {{
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
60
|
+
* burnDebt: BurnDebt;
|
|
61
|
+
* getGovernedParams: (
|
|
62
|
+
* collateralBrand: Brand,
|
|
63
|
+
* ) => import('./vaultManager.js').GovernedParamGetters;
|
|
64
|
+
* mintAndTransfer: MintAndTransfer;
|
|
65
|
+
* getShortfallReporter: () => Promise<
|
|
66
|
+
* import('../reserve/assetReserve.js').ShortfallReporter
|
|
67
|
+
* >;
|
|
64
68
|
* }} FactoryPowersFacet
|
|
65
69
|
*
|
|
70
|
+
*
|
|
66
71
|
* @typedef {Readonly<{
|
|
67
72
|
* state: State;
|
|
68
73
|
* }>} MethodContext
|
|
69
74
|
*
|
|
70
|
-
* @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager').TypedParamManager<
|
|
75
|
+
* @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').TypedParamManager<
|
|
76
|
+
* import('./params.js').VaultDirectorParams
|
|
77
|
+
* >} VaultDirectorParamManager
|
|
71
78
|
*/
|
|
72
79
|
|
|
73
80
|
const shortfallInvitationKey = 'shortfallInvitation';
|
|
74
81
|
|
|
75
82
|
/**
|
|
76
|
-
* @param {import('@agoric/
|
|
83
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
77
84
|
* @param {import('./vaultFactory.js').VaultFactoryZCF} zcf
|
|
78
85
|
* @param {VaultDirectorParamManager} directorParamManager
|
|
79
|
-
* @param {ZCFMint<
|
|
80
|
-
* @param {ERef<import('@agoric/time
|
|
86
|
+
* @param {ZCFMint<'nat'>} debtMint
|
|
87
|
+
* @param {ERef<import('@agoric/time').TimerService>} timer
|
|
81
88
|
* @param {ERef<import('../auction/auctioneer.js').AuctioneerPublicFacet>} auctioneer
|
|
82
89
|
* @param {ERef<StorageNode>} storageNode
|
|
83
90
|
* @param {ERef<Marshaller>} marshaller
|
|
84
91
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
85
92
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeERecorderKit} makeERecorderKit
|
|
93
|
+
* @param managerParams
|
|
86
94
|
*/
|
|
87
95
|
const prepareVaultDirector = (
|
|
88
96
|
baggage,
|
|
@@ -95,6 +103,7 @@ const prepareVaultDirector = (
|
|
|
95
103
|
marshaller,
|
|
96
104
|
makeRecorderKit,
|
|
97
105
|
makeERecorderKit,
|
|
106
|
+
managerParams,
|
|
98
107
|
) => {
|
|
99
108
|
/** @type {import('../reserve/assetReserve.js').ShortfallReporter} */
|
|
100
109
|
let shortfallReporter;
|
|
@@ -113,7 +122,11 @@ const prepareVaultDirector = (
|
|
|
113
122
|
// Non-durable map because param managers aren't durable.
|
|
114
123
|
// In the event they're needed they can be reconstructed from contract terms and off-chain data.
|
|
115
124
|
/** a powerful object; can modify parameters */
|
|
116
|
-
const vaultParamManagers = provideVaultParamManagers(
|
|
125
|
+
const vaultParamManagers = provideVaultParamManagers(
|
|
126
|
+
baggage,
|
|
127
|
+
marshaller,
|
|
128
|
+
managerParams,
|
|
129
|
+
);
|
|
117
130
|
|
|
118
131
|
const metricsNode = E(storageNode).makeChildNode('metrics');
|
|
119
132
|
|
|
@@ -126,9 +139,7 @@ const prepareVaultDirector = (
|
|
|
126
139
|
|
|
127
140
|
const managersNode = E(storageNode).makeChildNode('managers');
|
|
128
141
|
|
|
129
|
-
/**
|
|
130
|
-
* @returns {MetricsNotification}
|
|
131
|
-
*/
|
|
142
|
+
/** @returns {MetricsNotification} */
|
|
132
143
|
const sampleMetrics = () => {
|
|
133
144
|
return harden({
|
|
134
145
|
collaterals: Array.from(collateralManagers.keys()),
|
|
@@ -141,6 +152,7 @@ const prepareVaultDirector = (
|
|
|
141
152
|
const oldInvitation = baggage.has(shortfallInvitationKey)
|
|
142
153
|
? baggage.get(shortfallInvitationKey)
|
|
143
154
|
: undefined;
|
|
155
|
+
|
|
144
156
|
const newInvitation = await directorParamManager.getInternalParamValue(
|
|
145
157
|
SHORTFALL_INVITATION_KEY,
|
|
146
158
|
);
|
|
@@ -188,15 +200,15 @@ const prepareVaultDirector = (
|
|
|
188
200
|
},
|
|
189
201
|
|
|
190
202
|
/**
|
|
191
|
-
* Let the manager add rewards to the rewardPoolSeat without
|
|
192
|
-
*
|
|
203
|
+
* Let the manager add rewards to the rewardPoolSeat without exposing the
|
|
204
|
+
* rewardPoolSeat to them.
|
|
193
205
|
*
|
|
194
206
|
* @type {MintAndTransfer}
|
|
195
207
|
*/
|
|
196
208
|
mintAndTransfer: (mintReceiver, toMint, fee, nonMintTransfers) => {
|
|
197
209
|
const kept = AmountMath.subtract(toMint, fee);
|
|
198
210
|
debtMint.mintGains(harden({ Minted: toMint }), mintSeat);
|
|
199
|
-
/** @type {
|
|
211
|
+
/** @type {TransferPart[]} */
|
|
200
212
|
const transfers = [
|
|
201
213
|
...nonMintTransfers,
|
|
202
214
|
[mintSeat, rewardPoolSeat, { Minted: fee }],
|
|
@@ -250,6 +262,7 @@ const prepareVaultDirector = (
|
|
|
250
262
|
metrics: makeRecorderTopic('Vault Factory metrics', metricsKit),
|
|
251
263
|
});
|
|
252
264
|
|
|
265
|
+
/** @param {(vm: VaultManager) => void} fn */
|
|
253
266
|
const allManagersDo = fn => {
|
|
254
267
|
for (const managerIndex of collateralManagers.values()) {
|
|
255
268
|
const vm = vaultManagers.get(managerIndex).self;
|
|
@@ -263,9 +276,7 @@ const prepareVaultDirector = (
|
|
|
263
276
|
});
|
|
264
277
|
};
|
|
265
278
|
|
|
266
|
-
/**
|
|
267
|
-
* @returns {State}
|
|
268
|
-
*/
|
|
279
|
+
/** @returns {State} */
|
|
269
280
|
const initState = () => {
|
|
270
281
|
return {};
|
|
271
282
|
};
|
|
@@ -275,7 +286,7 @@ const prepareVaultDirector = (
|
|
|
275
286
|
*
|
|
276
287
|
* @param {import('./vaultFactory.js').VaultFactoryZCF} zcf
|
|
277
288
|
* @param {VaultDirectorParamManager} directorParamManager
|
|
278
|
-
* @param {ZCFMint<
|
|
289
|
+
* @param {ZCFMint<'nat'>} debtMint
|
|
279
290
|
*/
|
|
280
291
|
const makeVaultDirector = prepareExoClassKit(
|
|
281
292
|
baggage,
|
|
@@ -293,6 +304,7 @@ const prepareVaultDirector = (
|
|
|
293
304
|
makePriceLockWaker: M.call().returns(M.remotable('TimerWaker')),
|
|
294
305
|
makeLiquidationWaker: M.call().returns(M.remotable('TimerWaker')),
|
|
295
306
|
makeReschedulerWaker: M.call().returns(M.remotable('TimerWaker')),
|
|
307
|
+
setShortfallReporter: M.call(InvitationShape).returns(M.promise()),
|
|
296
308
|
}),
|
|
297
309
|
public: M.interface('public', {
|
|
298
310
|
getCollateralManager: M.call(BrandShape).returns(M.remotable()),
|
|
@@ -301,7 +313,7 @@ const prepareVaultDirector = (
|
|
|
301
313
|
SubscriberShape,
|
|
302
314
|
),
|
|
303
315
|
getElectorateSubscription: M.call().returns(SubscriberShape),
|
|
304
|
-
getGovernedParams: M.
|
|
316
|
+
getGovernedParams: M.callWhen({ collateralBrand: BrandShape }).returns(
|
|
305
317
|
M.record(),
|
|
306
318
|
),
|
|
307
319
|
getInvitationAmount: M.call(M.string()).returns(AmountShape),
|
|
@@ -330,9 +342,7 @@ const prepareVaultDirector = (
|
|
|
330
342
|
}
|
|
331
343
|
},
|
|
332
344
|
}),
|
|
333
|
-
/**
|
|
334
|
-
* @param {string} name
|
|
335
|
-
*/
|
|
345
|
+
/** @param {string} name */
|
|
336
346
|
getInvitation(name) {
|
|
337
347
|
return directorParamManager.getInternalParamValue(name);
|
|
338
348
|
},
|
|
@@ -378,9 +388,8 @@ const prepareVaultDirector = (
|
|
|
378
388
|
// zero-based index of the manager being made
|
|
379
389
|
const managerIndex = vaultManagers.length();
|
|
380
390
|
const managerId = `manager${managerIndex}`;
|
|
381
|
-
const managerStorageNode =
|
|
382
|
-
managerId
|
|
383
|
-
);
|
|
391
|
+
const managerStorageNode =
|
|
392
|
+
await E(managersNode).makeChildNode(managerId);
|
|
384
393
|
|
|
385
394
|
vaultParamManagers.addParamManager(
|
|
386
395
|
collateralBrand,
|
|
@@ -424,6 +433,7 @@ const prepareVaultDirector = (
|
|
|
424
433
|
|
|
425
434
|
makeLiquidationWaker() {
|
|
426
435
|
return makeWaker('liquidationWaker', _timestamp => {
|
|
436
|
+
// XXX floating promise
|
|
427
437
|
allManagersDo(vm => vm.liquidateVaults(auctioneer));
|
|
428
438
|
});
|
|
429
439
|
},
|
|
@@ -438,11 +448,15 @@ const prepareVaultDirector = (
|
|
|
438
448
|
allManagersDo(vm => vm.lockOraclePrices());
|
|
439
449
|
});
|
|
440
450
|
},
|
|
451
|
+
async setShortfallReporter(newInvitation) {
|
|
452
|
+
const zoe = zcf.getZoeService();
|
|
453
|
+
shortfallReporter = await E(
|
|
454
|
+
E(zoe).offer(newInvitation),
|
|
455
|
+
).getOfferResult();
|
|
456
|
+
},
|
|
441
457
|
},
|
|
442
458
|
public: {
|
|
443
|
-
/**
|
|
444
|
-
* @param {Brand} brandIn
|
|
445
|
-
*/
|
|
459
|
+
/** @param {Brand} brandIn */
|
|
446
460
|
getCollateralManager(brandIn) {
|
|
447
461
|
collateralManagers.has(brandIn) ||
|
|
448
462
|
Fail`Not a supported collateral type ${brandIn}`;
|
|
@@ -463,22 +477,21 @@ const prepareVaultDirector = (
|
|
|
463
477
|
getPublicTopics() {
|
|
464
478
|
return topics;
|
|
465
479
|
},
|
|
466
|
-
/**
|
|
467
|
-
* subscription for the paramManager for the vaultFactory's electorate
|
|
468
|
-
*/
|
|
480
|
+
/** subscription for the paramManager for the vaultFactory's electorate */
|
|
469
481
|
getElectorateSubscription() {
|
|
470
482
|
return directorParamManager.getSubscription();
|
|
471
483
|
},
|
|
472
484
|
/**
|
|
485
|
+
* Note this works only for a collateral manager. For the director use,
|
|
486
|
+
* `getElectorateSubscription`
|
|
487
|
+
*
|
|
473
488
|
* @param {{ collateralBrand: Brand }} selector
|
|
474
489
|
*/
|
|
475
490
|
getGovernedParams({ collateralBrand }) {
|
|
476
491
|
// TODO use named getters of TypedParamManager
|
|
477
492
|
return vaultParamManagers.get(collateralBrand).getParams();
|
|
478
493
|
},
|
|
479
|
-
/**
|
|
480
|
-
* @param {string} name
|
|
481
|
-
*/
|
|
494
|
+
/** @param {string} name */
|
|
482
495
|
getInvitationAmount(name) {
|
|
483
496
|
return directorParamManager.getInvitationAmount(name);
|
|
484
497
|
},
|
|
@@ -498,9 +511,7 @@ const prepareVaultDirector = (
|
|
|
498
511
|
rescheduleWaker,
|
|
499
512
|
);
|
|
500
513
|
},
|
|
501
|
-
/**
|
|
502
|
-
* Start non-durable processes (or restart if needed after vat restart)
|
|
503
|
-
*/
|
|
514
|
+
/** Start non-durable processes (or restart if needed after vat restart) */
|
|
504
515
|
async start() {
|
|
505
516
|
const { helper, machine } = this.facets;
|
|
506
517
|
|
|
@@ -525,7 +536,9 @@ harden(prepareVaultDirector);
|
|
|
525
536
|
/**
|
|
526
537
|
* Prepare the VaultDirector kind, get or make the singleton
|
|
527
538
|
*
|
|
528
|
-
* @type {(
|
|
539
|
+
* @type {(
|
|
540
|
+
* ...pvdArgs: Parameters<typeof prepareVaultDirector>
|
|
541
|
+
* ) => ReturnType<ReturnType<typeof prepareVaultDirector>>}
|
|
529
542
|
*/
|
|
530
543
|
export const provideDirector = (...args) => {
|
|
531
544
|
const makeVaultDirector = prepareVaultDirector(...args);
|