@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.
Files changed (176) hide show
  1. package/CHANGELOG.md +1041 -0
  2. package/bundles/bundle-auctioneer-js-meta.json +722 -0
  3. package/bundles/bundle-auctioneer.js +1 -0
  4. package/bundles/bundle-econCommitteeCharter-js-meta.json +222 -242
  5. package/bundles/bundle-econCommitteeCharter.js +1 -1
  6. package/bundles/bundle-feeDistributor-js-meta.json +458 -0
  7. package/bundles/bundle-feeDistributor.js +1 -0
  8. package/bundles/bundle-fluxAggregatorKit-js-meta.json +327 -343
  9. package/bundles/bundle-fluxAggregatorKit.js +1 -1
  10. package/bundles/bundle-psm-js-meta.json +308 -328
  11. package/bundles/bundle-psm.js +1 -1
  12. package/bundles/bundle-reserve-js-meta.json +662 -0
  13. package/bundles/bundle-reserve.js +1 -0
  14. package/bundles/bundle-scaledPriceAuthority-js-meta.json +542 -0
  15. package/bundles/bundle-scaledPriceAuthority.js +1 -0
  16. package/bundles/bundle-vaultFactory-js-meta.json +790 -0
  17. package/bundles/bundle-vaultFactory.js +1 -0
  18. package/package.json +31 -31
  19. package/scripts/add-collateral-core.js +112 -0
  20. package/scripts/build-bundles.js +21 -5
  21. package/scripts/deploy-contracts.js +100 -0
  22. package/scripts/init-core.js +198 -0
  23. package/scripts/invite-committee-core.js +42 -0
  24. package/scripts/manual-price-feed.js +117 -0
  25. package/scripts/price-feed-core.js +104 -0
  26. package/scripts/start-local-chain.sh +84 -0
  27. package/src/auction/auctionBook.js +56 -68
  28. package/src/auction/auctioneer.js +44 -56
  29. package/src/auction/offerBook.js +11 -12
  30. package/src/auction/params.js +5 -3
  31. package/src/auction/scheduleMath.js +13 -13
  32. package/src/auction/scheduler.js +32 -22
  33. package/src/auction/sortedOffers.js +7 -8
  34. package/src/auction/util.js +4 -4
  35. package/src/clientSupport.js +96 -152
  36. package/src/contractSupport.js +5 -5
  37. package/src/econCommitteeCharter.js +15 -16
  38. package/src/feeDistributor.js +33 -34
  39. package/src/interest.js +14 -20
  40. package/src/price/fluxAggregatorContract.js +45 -51
  41. package/src/price/fluxAggregatorKit.js +32 -47
  42. package/src/price/priceOracleKit.js +13 -11
  43. package/src/price/roundsManager.js +64 -52
  44. package/src/proposals/addAssetToVault.js +3 -15
  45. package/src/proposals/committee-proposal.js +9 -5
  46. package/src/proposals/core-proposal.js +7 -7
  47. package/src/proposals/econ-behaviors.js +32 -57
  48. package/src/proposals/price-feed-proposal.js +26 -59
  49. package/src/proposals/startEconCommittee.js +1 -1
  50. package/src/proposals/startPSM.js +22 -32
  51. package/src/proposals/utils.js +7 -26
  52. package/src/psm/psm.js +63 -69
  53. package/src/reserve/assetReserve.js +18 -27
  54. package/src/reserve/assetReserveKit.js +22 -14
  55. package/src/typeGuards.js +13 -0
  56. package/src/vaultFactory/liquidation.js +17 -30
  57. package/src/vaultFactory/math.js +9 -8
  58. package/src/vaultFactory/orderedVaultStore.js +9 -6
  59. package/src/vaultFactory/params.js +18 -24
  60. package/src/vaultFactory/prioritizedVaults.js +2 -2
  61. package/src/vaultFactory/proceeds.js +18 -24
  62. package/src/vaultFactory/storeUtils.js +12 -8
  63. package/src/vaultFactory/types.js +28 -38
  64. package/src/vaultFactory/vault.js +89 -88
  65. package/src/vaultFactory/vaultDirector.js +41 -33
  66. package/src/vaultFactory/vaultFactory.js +26 -33
  67. package/src/vaultFactory/vaultHolder.js +13 -8
  68. package/src/vaultFactory/vaultKit.js +2 -3
  69. package/src/vaultFactory/vaultManager.js +120 -138
  70. package/src/auction/auctionBook.d.ts +0 -83
  71. package/src/auction/auctionBook.d.ts.map +0 -1
  72. package/src/auction/auctioneer.d.ts +0 -75
  73. package/src/auction/auctioneer.d.ts.map +0 -1
  74. package/src/auction/offerBook.d.ts +0 -72
  75. package/src/auction/offerBook.d.ts.map +0 -1
  76. package/src/auction/params.d.ts +0 -142
  77. package/src/auction/params.d.ts.map +0 -1
  78. package/src/auction/scheduleMath.d.ts +0 -4
  79. package/src/auction/scheduleMath.d.ts.map +0 -1
  80. package/src/auction/scheduler.d.ts +0 -49
  81. package/src/auction/scheduler.d.ts.map +0 -1
  82. package/src/auction/sortedOffers.d.ts +0 -8
  83. package/src/auction/sortedOffers.d.ts.map +0 -1
  84. package/src/auction/util.d.ts +0 -30
  85. package/src/auction/util.d.ts.map +0 -1
  86. package/src/clientSupport.d.ts +0 -167
  87. package/src/clientSupport.d.ts.map +0 -1
  88. package/src/collectFees.d.ts +0 -2
  89. package/src/collectFees.d.ts.map +0 -1
  90. package/src/contractSupport.d.ts +0 -33
  91. package/src/contractSupport.d.ts.map +0 -1
  92. package/src/econCommitteeCharter.d.ts +0 -41
  93. package/src/econCommitteeCharter.d.ts.map +0 -1
  94. package/src/feeDistributor.d.ts +0 -212
  95. package/src/feeDistributor.d.ts.map +0 -1
  96. package/src/index.d.ts +0 -2
  97. package/src/index.d.ts.map +0 -1
  98. package/src/interest-math.d.ts +0 -3
  99. package/src/interest-math.d.ts.map +0 -1
  100. package/src/interest.d.ts +0 -29
  101. package/src/interest.d.ts.map +0 -1
  102. package/src/price/fluxAggregatorContract.d.ts +0 -112
  103. package/src/price/fluxAggregatorContract.d.ts.map +0 -1
  104. package/src/price/fluxAggregatorKit.d.ts +0 -155
  105. package/src/price/fluxAggregatorKit.d.ts.map +0 -1
  106. package/src/price/priceOracleKit.d.ts +0 -52
  107. package/src/price/priceOracleKit.d.ts.map +0 -1
  108. package/src/price/roundsManager.d.ts +0 -330
  109. package/src/price/roundsManager.d.ts.map +0 -1
  110. package/src/proposals/addAssetToVault.d.ts +0 -155
  111. package/src/proposals/addAssetToVault.d.ts.map +0 -1
  112. package/src/proposals/committee-proposal.d.ts +0 -121
  113. package/src/proposals/committee-proposal.d.ts.map +0 -1
  114. package/src/proposals/core-proposal.d.ts +0 -149
  115. package/src/proposals/core-proposal.d.ts.map +0 -1
  116. package/src/proposals/econ-behaviors.d.ts +0 -201
  117. package/src/proposals/econ-behaviors.d.ts.map +0 -1
  118. package/src/proposals/price-feed-proposal.d.ts +0 -83
  119. package/src/proposals/price-feed-proposal.d.ts.map +0 -1
  120. package/src/proposals/startEconCommittee.d.ts +0 -34
  121. package/src/proposals/startEconCommittee.d.ts.map +0 -1
  122. package/src/proposals/startPSM.d.ts +0 -61
  123. package/src/proposals/startPSM.d.ts.map +0 -1
  124. package/src/proposals/utils.d.ts +0 -15
  125. package/src/proposals/utils.d.ts.map +0 -1
  126. package/src/provisionPool.d.ts +0 -165
  127. package/src/provisionPool.d.ts.map +0 -1
  128. package/src/provisionPool.js +0 -119
  129. package/src/provisionPoolKit.d.ts +0 -379
  130. package/src/provisionPoolKit.d.ts.map +0 -1
  131. package/src/provisionPoolKit.js +0 -461
  132. package/src/psm/psm.d.ts +0 -178
  133. package/src/psm/psm.d.ts.map +0 -1
  134. package/src/psm/types.d.ts +0 -2
  135. package/src/psm/types.d.ts.map +0 -1
  136. package/src/reserve/assetReserve.d.ts +0 -44
  137. package/src/reserve/assetReserve.d.ts.map +0 -1
  138. package/src/reserve/assetReserveKit.d.ts +0 -114
  139. package/src/reserve/assetReserveKit.d.ts.map +0 -1
  140. package/src/reserve/params.d.ts +0 -10
  141. package/src/reserve/params.d.ts.map +0 -1
  142. package/src/tokens.d.ts +0 -3
  143. package/src/tokens.d.ts.map +0 -1
  144. package/src/tokens.js +0 -5
  145. package/src/vaultFactory/burn.d.ts +0 -2
  146. package/src/vaultFactory/burn.d.ts.map +0 -1
  147. package/src/vaultFactory/liquidation.d.ts +0 -24
  148. package/src/vaultFactory/liquidation.d.ts.map +0 -1
  149. package/src/vaultFactory/math.d.ts +0 -10
  150. package/src/vaultFactory/math.d.ts.map +0 -1
  151. package/src/vaultFactory/orderedVaultStore.d.ts +0 -94
  152. package/src/vaultFactory/orderedVaultStore.d.ts.map +0 -1
  153. package/src/vaultFactory/params.d.ts +0 -159
  154. package/src/vaultFactory/params.d.ts.map +0 -1
  155. package/src/vaultFactory/prioritizedVaults.d.ts +0 -279
  156. package/src/vaultFactory/prioritizedVaults.d.ts.map +0 -1
  157. package/src/vaultFactory/proceeds.d.ts +0 -34
  158. package/src/vaultFactory/proceeds.d.ts.map +0 -1
  159. package/src/vaultFactory/storeUtils.d.ts +0 -25
  160. package/src/vaultFactory/storeUtils.d.ts.map +0 -1
  161. package/src/vaultFactory/type-imports.d.ts +0 -2
  162. package/src/vaultFactory/type-imports.d.ts.map +0 -1
  163. package/src/vaultFactory/types.d.ts +0 -137
  164. package/src/vaultFactory/types.d.ts.map +0 -1
  165. package/src/vaultFactory/vault.d.ts +0 -529
  166. package/src/vaultFactory/vault.d.ts.map +0 -1
  167. package/src/vaultFactory/vaultDirector.d.ts +0 -560
  168. package/src/vaultFactory/vaultDirector.d.ts.map +0 -1
  169. package/src/vaultFactory/vaultFactory.d.ts +0 -162
  170. package/src/vaultFactory/vaultFactory.d.ts.map +0 -1
  171. package/src/vaultFactory/vaultHolder.d.ts +0 -201
  172. package/src/vaultFactory/vaultHolder.d.ts.map +0 -1
  173. package/src/vaultFactory/vaultKit.d.ts +0 -32
  174. package/src/vaultFactory/vaultKit.d.ts.map +0 -1
  175. package/src/vaultFactory/vaultManager.d.ts +0 -554
  176. package/src/vaultFactory/vaultManager.d.ts.map +0 -1
@@ -1,529 +0,0 @@
1
- export namespace Phase {
2
- let ACTIVE: "active";
3
- let LIQUIDATING: "liquidating";
4
- let CLOSED: "closed";
5
- let LIQUIDATED: "liquidated";
6
- let TRANSFER: "transfer";
7
- }
8
- /**
9
- * @typedef {Phase[keyof typeof Phase]} HolderPhase
10
- *
11
- * @typedef {object} VaultNotification
12
- * @property {Amount<'nat'>} locked Amount of Collateral locked
13
- * @property {{ debt: Amount<'nat'>; interest: Ratio }} debtSnapshot 'debt' at
14
- * the point the compounded interest was 'interest'
15
- * @property {HolderPhase} vaultState
16
- */
17
- /**
18
- * @typedef {object} VaultManager
19
- * @property {() => Subscriber<import('./vaultManager').AssetState>} getAssetSubscriber
20
- * @property {(collateralAmount: Amount) => Amount<'nat'>} maxDebtFor
21
- * @property {() => Brand} getCollateralBrand
22
- * @property {(base: string) => string} scopeDescription
23
- * @property {() => Brand<'nat'>} getDebtBrand
24
- * @property {MintAndTransfer} mintAndTransfer
25
- * @property {(amount: Amount, seat: ZCFSeat) => void} burn
26
- * @property {() => Ratio} getCompoundedInterest
27
- * @property {(
28
- * oldDebt: import('./storeUtils.js').NormalizedDebt,
29
- * oldCollateral: Amount<'nat'>,
30
- * vaultId: VaultId,
31
- * vaultPhase: VaultPhase,
32
- * vault: Vault,
33
- * ) => void} handleBalanceChange
34
- * @property {() => import('./vaultManager.js').GovernedParamGetters} getGovernedParams
35
- */
36
- /**
37
- * @typedef {Readonly<{
38
- * idInManager: VaultId;
39
- * manager: VaultManager;
40
- * storageNode: StorageNode;
41
- * vaultSeat: ZCFSeat;
42
- * }>} ImmutableState
43
- */
44
- /**
45
- * Snapshot is of the debt and compounded interest when the principal was last
46
- * changed.
47
- *
48
- * @typedef {{
49
- * interestSnapshot: Ratio;
50
- * phase: VaultPhase;
51
- * debtSnapshot: Amount<'nat'>;
52
- * outerUpdater:
53
- * | import('@agoric/zoe/src/contractSupport/recorder.js').Recorder<VaultNotification>
54
- * | null;
55
- * }} MutableState
56
- */
57
- export const VaultI: any;
58
- export function prepareVault(baggage: import('@agoric/ertp').Baggage, makeRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit, zcf: ZCF): (manager: VaultManager, idInManager: string, storageNode: StorageNode) => {
59
- helper: {
60
- collateralBrand(): Brand<AssetKind>;
61
- debtBrand(): Brand<"nat">;
62
- emptyCollateral(): Amount<"nat">;
63
- emptyDebt(): Amount<"nat">;
64
- /**
65
- * @typedef {{
66
- * give: { Collateral: Amount<'nat'>; Minted: Amount<'nat'> };
67
- * want: { Collateral: Amount<'nat'>; Minted: Amount<'nat'> };
68
- * }} FullProposal
69
- */
70
- /**
71
- * @param {ProposalRecord} partial
72
- * @returns {FullProposal}
73
- */
74
- fullProposal(partial: ProposalRecord): {
75
- give: {
76
- Collateral: Amount<'nat'>;
77
- Minted: Amount<'nat'>;
78
- };
79
- want: {
80
- Collateral: Amount<'nat'>;
81
- Minted: Amount<'nat'>;
82
- };
83
- };
84
- /** @param {VaultPhase} newPhase */
85
- assignPhase(newPhase: VaultPhase): void;
86
- assertActive(): void;
87
- assertCloseable(): void;
88
- /**
89
- * Called whenever the debt is paid or created through a transaction,
90
- * but not for interest accrual.
91
- *
92
- * @param {Amount<'nat'>} newDebt - principal and all accrued interest
93
- */
94
- updateDebtSnapshot(newDebt: Amount<'nat'>): void;
95
- /**
96
- * Update the debt balance and propagate upwards to maintain aggregate
97
- * debt and liquidation order.
98
- *
99
- * @param {NormalizedDebt} oldDebtNormalized - prior principal and all
100
- * accrued interest, normalized to the launch of the vaultManager
101
- * @param {Amount<'nat'>} oldCollateral - actual collateral
102
- * @param {Amount<'nat'>} newDebtActual - actual principal and all
103
- * accrued interest
104
- */
105
- updateDebtAccounting(oldDebtNormalized: NormalizedDebt, oldCollateral: Amount<'nat'>, newDebtActual: Amount<'nat'>): void;
106
- /** @param {ZCFSeat} seat */
107
- getCollateralAllocated(seat: ZCFSeat): Amount<any>;
108
- getMintedAllocated(seat: any): any;
109
- assertVaultHoldsNoMinted(): void;
110
- /**
111
- * @param {Amount<'nat'>} collateralAmount
112
- * @param {Amount<'nat'>} proposedDebt
113
- */
114
- assertSufficientCollateral(collateralAmount: Amount<'nat'>, proposedDebt: Amount<'nat'>): void;
115
- /** @param {HolderPhase} newPhase */
116
- getStateSnapshot(newPhase: HolderPhase): {
117
- debtSnapshot: {
118
- debt: Amount<"nat">;
119
- interest: Ratio;
120
- };
121
- locked: Amount<"nat">;
122
- vaultState: HolderPhase;
123
- };
124
- /** call this whenever anything changes! */
125
- updateUiState(): void;
126
- /** @param {ZCFSeat} seat */
127
- closeHook(seat: ZCFSeat): Promise<string>;
128
- /**
129
- * Calculate the fee, the amount to mint and the resulting debt. The
130
- * give and the want together reflect a delta, where typically one is
131
- * zero because they come from the gave/want of an offer proposal. If
132
- * the `want` is zero, the `fee` will also be zero, so the simple math
133
- * works.
134
- *
135
- * @param {Amount<'nat'>} currentDebt
136
- * @param {Amount<'nat'>} giveAmount
137
- * @param {Amount<'nat'>} wantAmount
138
- */
139
- debtFee(currentDebt: Amount<'nat'>, giveAmount: Amount<'nat'>, wantAmount: Amount<'nat'>): {
140
- newDebt: Amount<"nat">;
141
- toMint: Amount<"nat">;
142
- fee: Amount<"nat">;
143
- surplus: Amount<"nat">;
144
- };
145
- /**
146
- * Adjust principal and collateral (atomically for offer safety)
147
- *
148
- * @param {ZCFSeat} clientSeat
149
- * @returns {string} success message
150
- */
151
- adjustBalancesHook(clientSeat: ZCFSeat): string;
152
- /**
153
- * @param {ZCFSeat} clientSeat
154
- * @param {FullProposal} fp
155
- * @param {ReturnType<typeof calculateDebtCosts>} costs
156
- * @param {object} accounting
157
- * @param {NormalizedDebt} accounting.normalizedDebtPre
158
- * @param {Amount<'nat'>} accounting.collateralPre
159
- * @returns {string} success message
160
- */
161
- commitBalanceAdjustment(clientSeat: ZCFSeat, fp: {
162
- give: {
163
- Collateral: Amount<'nat'>;
164
- Minted: Amount<'nat'>;
165
- };
166
- want: {
167
- Collateral: Amount<'nat'>;
168
- Minted: Amount<'nat'>;
169
- };
170
- }, { newDebt, fee, surplus, toMint }: ReturnType<typeof calculateDebtCosts>, { normalizedDebtPre, collateralPre }: {
171
- normalizedDebtPre: NormalizedDebt;
172
- collateralPre: Amount<'nat'>;
173
- }): string;
174
- /**
175
- * @param {ZCFSeat} seat
176
- * @returns {VaultKit}
177
- */
178
- makeTransferInvitationHook(seat: ZCFSeat): VaultKit;
179
- };
180
- self: {
181
- getVaultSeat(): ZCFSeat;
182
- /**
183
- * @param {ZCFSeat} seat
184
- * @param {StorageNode} storageNode
185
- */
186
- initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
187
- publicSubscribers: {
188
- vault: {
189
- description: string;
190
- subscriber: Subscriber<VaultNotification>;
191
- storagePath: Promise<string>;
192
- };
193
- };
194
- invitationMakers: {
195
- AdjustBalances(): Promise<Invitation<R, A>>;
196
- CloseVault(): Promise<Invitation<R, A>>;
197
- TransferVault(): Promise<Invitation<R, A>>;
198
- };
199
- vault: {
200
- getPublicTopics(): {
201
- vault: {
202
- description: string;
203
- subscriber: Subscriber<VaultNotification>;
204
- storagePath: Promise<string>;
205
- };
206
- };
207
- makeAdjustBalancesInvitation(): Promise<Invitation<R, A>>;
208
- makeCloseInvitation(): Promise<Invitation<R, A>>;
209
- makeTransferInvitation(): Promise<Invitation<R, A>>;
210
- getCollateralAmount(): Amount<"nat">;
211
- getCurrentDebt(): Amount<"nat">;
212
- getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
213
- };
214
- vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
215
- }>;
216
- /** Called by manager at start of liquidation. */
217
- liquidating(): void;
218
- /**
219
- * Called by manager at end of liquidation, at which point all debts
220
- * have been covered.
221
- */
222
- liquidated(): void;
223
- /**
224
- * Called by vaultManager when the auction wasn't able to sell the
225
- * collateral. The liquidation fee was charged against the collateral,
226
- * but the debt will be restored and the vault will be active again.
227
- * Liquidation.md has details on the liquidation approach.
228
- */
229
- abortLiquidation(): string;
230
- makeAdjustBalancesInvitation(): Promise<Invitation<R, A>>;
231
- makeCloseInvitation(): Promise<Invitation<R, A>>;
232
- /** @returns {Promise<Invitation>} */
233
- makeTransferInvitation(): Promise<Invitation>;
234
- /** @returns {Amount<'nat'>} */
235
- getCollateralAmount(): Amount<'nat'>;
236
- /**
237
- * The actual current debt, including accrued interest.
238
- *
239
- * This looks like a simple getter but it does a lot of the heavy
240
- * lifting for interest accrual. Rather than updating all records when
241
- * interest accrues, the vault manager updates just its rolling
242
- * compounded interest. Here we calculate what the current debt is given
243
- * what's recorded in this vault and what interest has compounded since
244
- * this vault record was written.
245
- *
246
- * @returns {Amount<'nat'>}
247
- * @see getNormalizedDebt
248
- */
249
- getCurrentDebt(): Amount<'nat'>;
250
- /**
251
- * The normalization puts all debts on a common time-independent scale
252
- * since the launch of this vault manager. This allows the manager to
253
- * order vaults by their debt-to-collateral ratios without having to
254
- * mutate the debts as the interest accrues.
255
- *
256
- * @returns {import('./storeUtils.js').NormalizedDebt} as if the vault
257
- * was open at the launch of this manager, before any interest
258
- * accrued
259
- * @see getActualDebAmount
260
- */
261
- getNormalizedDebt(): import('./storeUtils.js').NormalizedDebt;
262
- };
263
- } & import("@endo/eventual-send").RemotableBrand<{}, {
264
- helper: {
265
- collateralBrand(): Brand<AssetKind>;
266
- debtBrand(): Brand<"nat">;
267
- emptyCollateral(): Amount<"nat">;
268
- emptyDebt(): Amount<"nat">;
269
- /**
270
- * @typedef {{
271
- * give: { Collateral: Amount<'nat'>; Minted: Amount<'nat'> };
272
- * want: { Collateral: Amount<'nat'>; Minted: Amount<'nat'> };
273
- * }} FullProposal
274
- */
275
- /**
276
- * @param {ProposalRecord} partial
277
- * @returns {FullProposal}
278
- */
279
- fullProposal(partial: ProposalRecord): {
280
- give: {
281
- Collateral: Amount<'nat'>;
282
- Minted: Amount<'nat'>;
283
- };
284
- want: {
285
- Collateral: Amount<'nat'>;
286
- Minted: Amount<'nat'>;
287
- };
288
- };
289
- /** @param {VaultPhase} newPhase */
290
- assignPhase(newPhase: VaultPhase): void;
291
- assertActive(): void;
292
- assertCloseable(): void;
293
- /**
294
- * Called whenever the debt is paid or created through a transaction,
295
- * but not for interest accrual.
296
- *
297
- * @param {Amount<'nat'>} newDebt - principal and all accrued interest
298
- */
299
- updateDebtSnapshot(newDebt: Amount<'nat'>): void;
300
- /**
301
- * Update the debt balance and propagate upwards to maintain aggregate
302
- * debt and liquidation order.
303
- *
304
- * @param {NormalizedDebt} oldDebtNormalized - prior principal and all
305
- * accrued interest, normalized to the launch of the vaultManager
306
- * @param {Amount<'nat'>} oldCollateral - actual collateral
307
- * @param {Amount<'nat'>} newDebtActual - actual principal and all
308
- * accrued interest
309
- */
310
- updateDebtAccounting(oldDebtNormalized: NormalizedDebt, oldCollateral: Amount<'nat'>, newDebtActual: Amount<'nat'>): void;
311
- /** @param {ZCFSeat} seat */
312
- getCollateralAllocated(seat: ZCFSeat): Amount<any>;
313
- getMintedAllocated(seat: any): any;
314
- assertVaultHoldsNoMinted(): void;
315
- /**
316
- * @param {Amount<'nat'>} collateralAmount
317
- * @param {Amount<'nat'>} proposedDebt
318
- */
319
- assertSufficientCollateral(collateralAmount: Amount<'nat'>, proposedDebt: Amount<'nat'>): void;
320
- /** @param {HolderPhase} newPhase */
321
- getStateSnapshot(newPhase: HolderPhase): {
322
- debtSnapshot: {
323
- debt: Amount<"nat">;
324
- interest: Ratio;
325
- };
326
- locked: Amount<"nat">;
327
- vaultState: HolderPhase;
328
- };
329
- /** call this whenever anything changes! */
330
- updateUiState(): void;
331
- /** @param {ZCFSeat} seat */
332
- closeHook(seat: ZCFSeat): Promise<string>;
333
- /**
334
- * Calculate the fee, the amount to mint and the resulting debt. The
335
- * give and the want together reflect a delta, where typically one is
336
- * zero because they come from the gave/want of an offer proposal. If
337
- * the `want` is zero, the `fee` will also be zero, so the simple math
338
- * works.
339
- *
340
- * @param {Amount<'nat'>} currentDebt
341
- * @param {Amount<'nat'>} giveAmount
342
- * @param {Amount<'nat'>} wantAmount
343
- */
344
- debtFee(currentDebt: Amount<'nat'>, giveAmount: Amount<'nat'>, wantAmount: Amount<'nat'>): {
345
- newDebt: Amount<"nat">;
346
- toMint: Amount<"nat">;
347
- fee: Amount<"nat">;
348
- surplus: Amount<"nat">;
349
- };
350
- /**
351
- * Adjust principal and collateral (atomically for offer safety)
352
- *
353
- * @param {ZCFSeat} clientSeat
354
- * @returns {string} success message
355
- */
356
- adjustBalancesHook(clientSeat: ZCFSeat): string;
357
- /**
358
- * @param {ZCFSeat} clientSeat
359
- * @param {FullProposal} fp
360
- * @param {ReturnType<typeof calculateDebtCosts>} costs
361
- * @param {object} accounting
362
- * @param {NormalizedDebt} accounting.normalizedDebtPre
363
- * @param {Amount<'nat'>} accounting.collateralPre
364
- * @returns {string} success message
365
- */
366
- commitBalanceAdjustment(clientSeat: ZCFSeat, fp: {
367
- give: {
368
- Collateral: Amount<'nat'>;
369
- Minted: Amount<'nat'>;
370
- };
371
- want: {
372
- Collateral: Amount<'nat'>;
373
- Minted: Amount<'nat'>;
374
- };
375
- }, { newDebt, fee, surplus, toMint }: ReturnType<typeof calculateDebtCosts>, { normalizedDebtPre, collateralPre }: {
376
- normalizedDebtPre: NormalizedDebt;
377
- collateralPre: Amount<'nat'>;
378
- }): string;
379
- /**
380
- * @param {ZCFSeat} seat
381
- * @returns {VaultKit}
382
- */
383
- makeTransferInvitationHook(seat: ZCFSeat): VaultKit;
384
- };
385
- self: {
386
- getVaultSeat(): ZCFSeat;
387
- /**
388
- * @param {ZCFSeat} seat
389
- * @param {StorageNode} storageNode
390
- */
391
- initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
392
- publicSubscribers: {
393
- vault: {
394
- description: string;
395
- subscriber: Subscriber<VaultNotification>;
396
- storagePath: Promise<string>;
397
- };
398
- };
399
- invitationMakers: {
400
- AdjustBalances(): Promise<Invitation<R, A>>;
401
- CloseVault(): Promise<Invitation<R, A>>;
402
- TransferVault(): Promise<Invitation<R, A>>;
403
- };
404
- vault: {
405
- getPublicTopics(): {
406
- vault: {
407
- description: string;
408
- subscriber: Subscriber<VaultNotification>;
409
- storagePath: Promise<string>;
410
- };
411
- };
412
- makeAdjustBalancesInvitation(): Promise<Invitation<R, A>>;
413
- makeCloseInvitation(): Promise<Invitation<R, A>>;
414
- makeTransferInvitation(): Promise<Invitation<R, A>>;
415
- getCollateralAmount(): Amount<"nat">;
416
- getCurrentDebt(): Amount<"nat">;
417
- getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
418
- };
419
- vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
420
- }>;
421
- /** Called by manager at start of liquidation. */
422
- liquidating(): void;
423
- /**
424
- * Called by manager at end of liquidation, at which point all debts
425
- * have been covered.
426
- */
427
- liquidated(): void;
428
- /**
429
- * Called by vaultManager when the auction wasn't able to sell the
430
- * collateral. The liquidation fee was charged against the collateral,
431
- * but the debt will be restored and the vault will be active again.
432
- * Liquidation.md has details on the liquidation approach.
433
- */
434
- abortLiquidation(): string;
435
- makeAdjustBalancesInvitation(): Promise<Invitation<R, A>>;
436
- makeCloseInvitation(): Promise<Invitation<R, A>>;
437
- /** @returns {Promise<Invitation>} */
438
- makeTransferInvitation(): Promise<Invitation>;
439
- /** @returns {Amount<'nat'>} */
440
- getCollateralAmount(): Amount<'nat'>;
441
- /**
442
- * The actual current debt, including accrued interest.
443
- *
444
- * This looks like a simple getter but it does a lot of the heavy
445
- * lifting for interest accrual. Rather than updating all records when
446
- * interest accrues, the vault manager updates just its rolling
447
- * compounded interest. Here we calculate what the current debt is given
448
- * what's recorded in this vault and what interest has compounded since
449
- * this vault record was written.
450
- *
451
- * @returns {Amount<'nat'>}
452
- * @see getNormalizedDebt
453
- */
454
- getCurrentDebt(): Amount<'nat'>;
455
- /**
456
- * The normalization puts all debts on a common time-independent scale
457
- * since the launch of this vault manager. This allows the manager to
458
- * order vaults by their debt-to-collateral ratios without having to
459
- * mutate the debts as the interest accrues.
460
- *
461
- * @returns {import('./storeUtils.js').NormalizedDebt} as if the vault
462
- * was open at the launch of this manager, before any interest
463
- * accrued
464
- * @see getActualDebAmount
465
- */
466
- getNormalizedDebt(): import('./storeUtils.js').NormalizedDebt;
467
- };
468
- }>;
469
- export type NormalizedDebt = import('./storeUtils.js').NormalizedDebt;
470
- export type VaultPhase = {
471
- readonly ACTIVE: "active";
472
- readonly LIQUIDATING: "liquidating";
473
- readonly CLOSED: "closed";
474
- readonly LIQUIDATED: "liquidated";
475
- readonly TRANSFER: "transfer";
476
- }[keyof Omit<typeof Phase, 'TRANSFER'>];
477
- export type HolderPhase = {
478
- readonly ACTIVE: "active";
479
- readonly LIQUIDATING: "liquidating";
480
- readonly CLOSED: "closed";
481
- readonly LIQUIDATED: "liquidated";
482
- readonly TRANSFER: "transfer";
483
- }[keyof typeof Phase];
484
- export type VaultNotification = {
485
- /**
486
- * Amount of Collateral locked
487
- */
488
- locked: Amount<'nat'>;
489
- /**
490
- * 'debt' at
491
- * the point the compounded interest was 'interest'
492
- */
493
- debtSnapshot: {
494
- debt: Amount<'nat'>;
495
- interest: Ratio;
496
- };
497
- vaultState: HolderPhase;
498
- };
499
- export type VaultManager = {
500
- getAssetSubscriber: () => Subscriber<import('./vaultManager').AssetState>;
501
- maxDebtFor: (collateralAmount: Amount) => Amount<'nat'>;
502
- getCollateralBrand: () => Brand;
503
- scopeDescription: (base: string) => string;
504
- getDebtBrand: () => Brand<'nat'>;
505
- mintAndTransfer: MintAndTransfer;
506
- burn: (amount: Amount, seat: ZCFSeat) => void;
507
- getCompoundedInterest: () => Ratio;
508
- handleBalanceChange: (oldDebt: import('./storeUtils.js').NormalizedDebt, oldCollateral: Amount<'nat'>, vaultId: VaultId, vaultPhase: VaultPhase, vault: Vault) => void;
509
- getGovernedParams: () => import('./vaultManager.js').GovernedParamGetters;
510
- };
511
- export type ImmutableState = Readonly<{
512
- idInManager: VaultId;
513
- manager: VaultManager;
514
- storageNode: StorageNode;
515
- vaultSeat: ZCFSeat;
516
- }>;
517
- /**
518
- * Snapshot is of the debt and compounded interest when the principal was last
519
- * changed.
520
- */
521
- export type MutableState = {
522
- interestSnapshot: Ratio;
523
- phase: VaultPhase;
524
- debtSnapshot: Amount<'nat'>;
525
- outerUpdater: import('@agoric/zoe/src/contractSupport/recorder.js').Recorder<VaultNotification> | null;
526
- };
527
- export type Vault = ReturnType<ReturnType<typeof prepareVault>>['self'];
528
- import { calculateDebtCosts } from './math.js';
529
- //# sourceMappingURL=vault.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["vault.js"],"names":[],"mappings":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