@agoric/inter-protocol 0.16.2-other-dev-8f8782b.0 → 0.16.2-other-dev-fbe72e7.0.fbe72e7
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 +46 -39
- 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 +182 -151
- package/src/auction/auctionMath.d.ts +17 -0
- package/src/auction/auctionMath.d.ts.map +1 -0
- package/src/auction/auctionMath.js +81 -0
- package/src/auction/auctioneer.d.ts +70 -0
- package/src/auction/auctioneer.d.ts.map +1 -0
- package/src/auction/auctioneer.js +72 -59
- package/src/auction/offerBook.d.ts +46 -0
- package/src/auction/offerBook.d.ts.map +1 -0
- package/src/auction/offerBook.js +17 -12
- package/src/auction/params.d.ts +145 -0
- package/src/auction/params.d.ts.map +1 -0
- package/src/auction/params.js +11 -9
- package/src/auction/scheduleMath.d.ts +5 -0
- package/src/auction/scheduleMath.d.ts.map +1 -0
- package/src/auction/scheduleMath.js +18 -16
- package/src/auction/scheduler.d.ts +50 -0
- package/src/auction/scheduler.d.ts.map +1 -0
- package/src/auction/scheduler.js +53 -47
- package/src/auction/sortedOffers.d.ts +8 -0
- package/src/auction/sortedOffers.d.ts.map +1 -0
- package/src/auction/sortedOffers.js +10 -9
- package/src/auction/util.d.ts +31 -0
- package/src/auction/util.d.ts.map +1 -0
- package/src/auction/util.js +12 -6
- package/src/clientSupport.d.ts +168 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +161 -98
- 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 +19 -13
- package/src/econCommitteeCharter.d.ts +43 -0
- package/src/econCommitteeCharter.d.ts.map +1 -0
- package/src/econCommitteeCharter.js +25 -20
- package/src/feeDistributor.d.ts +224 -0
- package/src/feeDistributor.d.ts.map +1 -0
- package/src/feeDistributor.js +41 -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 +4 -0
- package/src/interest-math.d.ts.map +1 -0
- package/src/interest-math.js +5 -1
- package/src/interest.d.ts +30 -0
- package/src/interest.d.ts.map +1 -0
- package/src/interest.js +25 -23
- package/src/price/README.md +14 -1
- package/src/price/fluxAggregatorContract.d.ts +71 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -0
- package/src/price/fluxAggregatorContract.js +64 -55
- package/src/price/fluxAggregatorKit.d.ts +104 -0
- package/src/price/fluxAggregatorKit.d.ts.map +1 -0
- package/src/price/fluxAggregatorKit.js +55 -42
- package/src/price/priceOracleKit.d.ts +39 -0
- package/src/price/priceOracleKit.d.ts.map +1 -0
- package/src/price/priceOracleKit.js +17 -15
- package/src/price/roundsManager.d.ts +204 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +132 -85
- package/src/proposals/README.md +2 -3
- package/src/proposals/add-auction.js +285 -0
- package/src/proposals/addAssetToVault.js +192 -40
- package/src/proposals/committee-proposal.js +25 -31
- package/src/proposals/core-proposal.js +9 -11
- package/src/proposals/deploy-price-feeds.js +341 -0
- package/src/proposals/econ-behaviors.js +84 -49
- package/src/proposals/price-feed-proposal.js +109 -51
- package/src/proposals/replace-fee-distributor.js +198 -0
- package/src/proposals/replace-scaledPriceAuthorities.js +124 -0
- package/src/proposals/replaceElectorate.js +610 -0
- package/src/proposals/startEconCommittee.js +2 -2
- package/src/proposals/startPSM.js +44 -29
- package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
- package/src/proposals/upgrade-vaults.js +207 -0
- package/src/proposals/utils.d.ts +21 -0
- package/src/proposals/utils.d.ts.map +1 -0
- package/src/proposals/utils.js +66 -9
- package/src/proposals/withdraw-reserve-proposal.js +63 -0
- package/src/provisionPool.d.ts +69 -0
- package/src/provisionPool.d.ts.map +1 -0
- package/src/provisionPool.js +138 -0
- package/src/provisionPoolKit.d.ts +129 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +608 -0
- package/src/psm/psm.d.ts +133 -0
- package/src/psm/psm.d.ts.map +1 -0
- package/src/psm/psm.js +85 -79
- 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 +58 -0
- package/src/reserve/assetReserve.d.ts.map +1 -0
- package/src/reserve/assetReserve.js +42 -34
- package/src/reserve/assetReserveKit.d.ts +103 -0
- package/src/reserve/assetReserveKit.d.ts.map +1 -0
- package/src/reserve/assetReserveKit.js +134 -32
- package/src/reserve/params.d.ts +16 -0
- package/src/reserve/params.d.ts.map +1 -0
- package/src/reserve/params.js +8 -2
- 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 +25 -0
- package/src/vaultFactory/liquidation.d.ts.map +1 -0
- package/src/vaultFactory/liquidation.js +37 -24
- package/src/vaultFactory/math.d.ts +11 -0
- package/src/vaultFactory/math.d.ts.map +1 -0
- package/src/vaultFactory/math.js +11 -10
- package/src/vaultFactory/orderedVaultStore.d.ts +94 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +9 -10
- package/src/vaultFactory/params.d.ts +143 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +56 -25
- package/src/vaultFactory/prioritizedVaults.d.ts +280 -0
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
- package/src/vaultFactory/prioritizedVaults.js +7 -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} +47 -44
- package/src/vaultFactory/vault.d.ts +344 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +107 -100
- package/src/vaultFactory/vaultDirector.d.ts +347 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +94 -64
- package/src/vaultFactory/vaultFactory.d.ts +250 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +56 -33
- package/src/vaultFactory/vaultHolder.d.ts +170 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +14 -15
- package/src/vaultFactory/vaultKit.d.ts +33 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +9 -4
- package/src/vaultFactory/vaultManager.d.ts +676 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +286 -167
- package/CHANGELOG.md +0 -1041
- 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,280 @@
|
|
|
1
|
+
export function currentDebtToCollateral(vault: Vault): Ratio;
|
|
2
|
+
export function makePrioritizedVaults(store: MapStore<string, Vault>): {
|
|
3
|
+
addVault: (vaultId: VaultId, vault: Vault) => string;
|
|
4
|
+
entries: (keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<[string, import("@endo/exo").Guarded<{
|
|
5
|
+
getVaultSeat(): globalThis.ZCFSeat;
|
|
6
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
7
|
+
publicSubscribers: {
|
|
8
|
+
vault: {
|
|
9
|
+
description: string;
|
|
10
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
11
|
+
storagePath: Promise<string>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
15
|
+
AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
|
|
16
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
17
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
18
|
+
}>;
|
|
19
|
+
vault: import("@endo/exo").Guarded<{
|
|
20
|
+
getPublicTopics(): {
|
|
21
|
+
vault: {
|
|
22
|
+
description: string;
|
|
23
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
24
|
+
storagePath: Promise<string>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
28
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
29
|
+
makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
30
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
31
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
32
|
+
getNormalizedDebt(): NormalizedDebt;
|
|
33
|
+
}>;
|
|
34
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
35
|
+
}>;
|
|
36
|
+
liquidating(): void;
|
|
37
|
+
liquidated(): void;
|
|
38
|
+
abortLiquidation(): string;
|
|
39
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
40
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
41
|
+
makeTransferInvitation(): Promise<Invitation<VaultKit>>;
|
|
42
|
+
getCollateralAmount(): Amount<"nat">;
|
|
43
|
+
getCurrentDebt(): Amount<"nat">;
|
|
44
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
45
|
+
}>]>;
|
|
46
|
+
getCount: (keyPatt?: Pattern, valuePatt?: Pattern) => number;
|
|
47
|
+
hasVaultByAttributes: (oldDebt: NormalizedDebt, oldCollateral: Amount<"nat">, vaultId: string) => boolean;
|
|
48
|
+
highestRatio: () => Ratio | undefined;
|
|
49
|
+
removeVault: (key: string) => Vault;
|
|
50
|
+
removeVaultByAttributes: (oldDebt: NormalizedDebt, oldCollateral: Amount<"nat">, vaultId: string) => import("@endo/exo").Guarded<{
|
|
51
|
+
getVaultSeat(): globalThis.ZCFSeat;
|
|
52
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
53
|
+
publicSubscribers: {
|
|
54
|
+
vault: {
|
|
55
|
+
description: string;
|
|
56
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
57
|
+
storagePath: Promise<string>;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
61
|
+
AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
|
|
62
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
63
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
64
|
+
}>;
|
|
65
|
+
vault: import("@endo/exo").Guarded<{
|
|
66
|
+
getPublicTopics(): {
|
|
67
|
+
vault: {
|
|
68
|
+
description: string;
|
|
69
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
70
|
+
storagePath: Promise<string>;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
74
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
75
|
+
makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
76
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
77
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
78
|
+
getNormalizedDebt(): NormalizedDebt;
|
|
79
|
+
}>;
|
|
80
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
81
|
+
}>;
|
|
82
|
+
liquidating(): void;
|
|
83
|
+
liquidated(): void;
|
|
84
|
+
abortLiquidation(): string;
|
|
85
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
86
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
87
|
+
makeTransferInvitation(): Promise<Invitation<VaultKit>>;
|
|
88
|
+
getCollateralAmount(): Amount<"nat">;
|
|
89
|
+
getCurrentDebt(): Amount<"nat">;
|
|
90
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
91
|
+
}>;
|
|
92
|
+
removeVaultsBelow: ({ margin, quote, interest }: {
|
|
93
|
+
margin: any;
|
|
94
|
+
quote: any;
|
|
95
|
+
interest: any;
|
|
96
|
+
}) => MapStore<string, import("@endo/exo").Guarded<{
|
|
97
|
+
getVaultSeat(): globalThis.ZCFSeat;
|
|
98
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
99
|
+
publicSubscribers: {
|
|
100
|
+
vault: {
|
|
101
|
+
description: string;
|
|
102
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
103
|
+
storagePath: Promise<string>;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
107
|
+
AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
|
|
108
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
109
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
110
|
+
}>;
|
|
111
|
+
vault: import("@endo/exo").Guarded<{
|
|
112
|
+
getPublicTopics(): {
|
|
113
|
+
vault: {
|
|
114
|
+
description: string;
|
|
115
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
116
|
+
storagePath: Promise<string>;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
120
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
121
|
+
makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
122
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
123
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
124
|
+
getNormalizedDebt(): NormalizedDebt;
|
|
125
|
+
}>;
|
|
126
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
127
|
+
}>;
|
|
128
|
+
liquidating(): void;
|
|
129
|
+
liquidated(): void;
|
|
130
|
+
abortLiquidation(): string;
|
|
131
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
132
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
133
|
+
makeTransferInvitation(): Promise<Invitation<VaultKit>>;
|
|
134
|
+
getCollateralAmount(): Amount<"nat">;
|
|
135
|
+
getCurrentDebt(): Amount<"nat">;
|
|
136
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
137
|
+
}>>;
|
|
138
|
+
countVaultsBelow: (crKey: any) => number;
|
|
139
|
+
} & RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
140
|
+
addVault: (vaultId: VaultId, vault: Vault) => string;
|
|
141
|
+
entries: (keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<[string, import("@endo/exo").Guarded<{
|
|
142
|
+
getVaultSeat(): globalThis.ZCFSeat;
|
|
143
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
144
|
+
publicSubscribers: {
|
|
145
|
+
vault: {
|
|
146
|
+
description: string;
|
|
147
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
148
|
+
storagePath: Promise<string>;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
152
|
+
AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
|
|
153
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
154
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
155
|
+
}>;
|
|
156
|
+
vault: import("@endo/exo").Guarded<{
|
|
157
|
+
getPublicTopics(): {
|
|
158
|
+
vault: {
|
|
159
|
+
description: string;
|
|
160
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
161
|
+
storagePath: Promise<string>;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
165
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
166
|
+
makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
167
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
168
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
169
|
+
getNormalizedDebt(): NormalizedDebt;
|
|
170
|
+
}>;
|
|
171
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
172
|
+
}>;
|
|
173
|
+
liquidating(): void;
|
|
174
|
+
liquidated(): void;
|
|
175
|
+
abortLiquidation(): string;
|
|
176
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
177
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
178
|
+
makeTransferInvitation(): Promise<Invitation<VaultKit>>;
|
|
179
|
+
getCollateralAmount(): Amount<"nat">;
|
|
180
|
+
getCurrentDebt(): Amount<"nat">;
|
|
181
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
182
|
+
}>]>;
|
|
183
|
+
getCount: (keyPatt?: Pattern, valuePatt?: Pattern) => number;
|
|
184
|
+
hasVaultByAttributes: (oldDebt: NormalizedDebt, oldCollateral: Amount<"nat">, vaultId: string) => boolean;
|
|
185
|
+
highestRatio: () => Ratio | undefined;
|
|
186
|
+
removeVault: (key: string) => Vault;
|
|
187
|
+
removeVaultByAttributes: (oldDebt: NormalizedDebt, oldCollateral: Amount<"nat">, vaultId: string) => import("@endo/exo").Guarded<{
|
|
188
|
+
getVaultSeat(): globalThis.ZCFSeat;
|
|
189
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
190
|
+
publicSubscribers: {
|
|
191
|
+
vault: {
|
|
192
|
+
description: string;
|
|
193
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
194
|
+
storagePath: Promise<string>;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
198
|
+
AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
|
|
199
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
200
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
201
|
+
}>;
|
|
202
|
+
vault: import("@endo/exo").Guarded<{
|
|
203
|
+
getPublicTopics(): {
|
|
204
|
+
vault: {
|
|
205
|
+
description: string;
|
|
206
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
207
|
+
storagePath: Promise<string>;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
211
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
212
|
+
makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
213
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
214
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
215
|
+
getNormalizedDebt(): NormalizedDebt;
|
|
216
|
+
}>;
|
|
217
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
218
|
+
}>;
|
|
219
|
+
liquidating(): void;
|
|
220
|
+
liquidated(): void;
|
|
221
|
+
abortLiquidation(): string;
|
|
222
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
223
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
224
|
+
makeTransferInvitation(): Promise<Invitation<VaultKit>>;
|
|
225
|
+
getCollateralAmount(): Amount<"nat">;
|
|
226
|
+
getCurrentDebt(): Amount<"nat">;
|
|
227
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
228
|
+
}>;
|
|
229
|
+
removeVaultsBelow: ({ margin, quote, interest }: {
|
|
230
|
+
margin: any;
|
|
231
|
+
quote: any;
|
|
232
|
+
interest: any;
|
|
233
|
+
}) => MapStore<string, import("@endo/exo").Guarded<{
|
|
234
|
+
getVaultSeat(): globalThis.ZCFSeat;
|
|
235
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
236
|
+
publicSubscribers: {
|
|
237
|
+
vault: {
|
|
238
|
+
description: string;
|
|
239
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
240
|
+
storagePath: Promise<string>;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
244
|
+
AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
|
|
245
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
246
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
247
|
+
}>;
|
|
248
|
+
vault: import("@endo/exo").Guarded<{
|
|
249
|
+
getPublicTopics(): {
|
|
250
|
+
vault: {
|
|
251
|
+
description: string;
|
|
252
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
253
|
+
storagePath: Promise<string>;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
257
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
258
|
+
makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
259
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
260
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
261
|
+
getNormalizedDebt(): NormalizedDebt;
|
|
262
|
+
}>;
|
|
263
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
264
|
+
}>;
|
|
265
|
+
liquidating(): void;
|
|
266
|
+
liquidated(): void;
|
|
267
|
+
abortLiquidation(): string;
|
|
268
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
269
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
270
|
+
makeTransferInvitation(): Promise<Invitation<VaultKit>>;
|
|
271
|
+
getCollateralAmount(): Amount<"nat">;
|
|
272
|
+
getCurrentDebt(): Amount<"nat">;
|
|
273
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
274
|
+
}>>;
|
|
275
|
+
countVaultsBelow: (crKey: any) => number;
|
|
276
|
+
}>;
|
|
277
|
+
import type { Vault } from './vault.js';
|
|
278
|
+
import type { MapStore } from '@agoric/store';
|
|
279
|
+
import type { NormalizedDebt } from './storeUtils.js';
|
|
280
|
+
//# sourceMappingURL=prioritizedVaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prioritizedVaults.d.ts","sourceRoot":"","sources":["prioritizedVaults.js"],"names":[],"mappings":"AA0CO,+CAHI,KAAK,GACH,KAAK,CAMf;AASI,6CAHI,SAAS,MAAM,EAAE,KAAK,CAAC;wBAsDrB,OAAO,SACP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA9BL,cAAc,iBACd,MAAM,CAAC,KAAK,CAAC,WACb,MAAM;wBAlBJ,KAAK,GAAG,SAAS;uBA0BnB,MAAM,KACJ,KAAK;uCAQP,cAAc,iBACd,MAAM,CAAC,KAAK,CAAC,WACb,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAQN,OAAO,SACP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA9BL,cAAc,iBACd,MAAM,CAAC,KAAK,CAAC,WACb,MAAM;wBAlBJ,KAAK,GAAG,SAAS;uBA0BnB,MAAM,KACJ,KAAK;uCAQP,cAAc,iBACd,MAAM,CAAC,KAAK,CAAC,WACb,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDlB;2BAxIuB,YAAY;8BADT,eAAe;oCAET,iBAAiB"}
|
|
@@ -13,8 +13,11 @@ import {
|
|
|
13
13
|
normalizedCollRatio,
|
|
14
14
|
} from './storeUtils.js';
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @import {MapStore} from '@agoric/store';
|
|
18
|
+
* @import {Vault} from './vault.js';
|
|
19
|
+
* @import {NormalizedDebt} from './storeUtils.js';
|
|
20
|
+
*/
|
|
18
21
|
|
|
19
22
|
const trace = makeTracer('PVaults', true);
|
|
20
23
|
|
|
@@ -47,8 +50,8 @@ export const currentDebtToCollateral = vault =>
|
|
|
47
50
|
* Vaults, ordered by their debt ratio so that all the vaults below a threshold
|
|
48
51
|
* can be quickly found and liquidated.
|
|
49
52
|
*
|
|
50
|
-
* @param {MapStore<string, Vault>} store
|
|
51
|
-
*
|
|
53
|
+
* @param {MapStore<string, Vault>} store vault has a higher debt ratio than the
|
|
54
|
+
* previous highest
|
|
52
55
|
*/
|
|
53
56
|
export const makePrioritizedVaults = store => {
|
|
54
57
|
const vaults = makeOrderedVaultStore(store);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function calculateDistributionPlan({ proceeds, totalDebt, totalCollateral, oraclePriceAtStart, vaultsBalances, penaltyRate, }: {
|
|
2
|
+
proceeds: AmountKeywordRecord;
|
|
3
|
+
totalDebt: Amount<"nat">;
|
|
4
|
+
totalCollateral: Amount<"nat">;
|
|
5
|
+
oraclePriceAtStart: PriceDescription;
|
|
6
|
+
vaultsBalances: VaultBalances[];
|
|
7
|
+
penaltyRate: Ratio;
|
|
8
|
+
}): DistributionPlan;
|
|
9
|
+
/**
|
|
10
|
+
* The plan to execute for distributing proceeds of a liquidation.
|
|
11
|
+
*
|
|
12
|
+
* Vaults are referenced by index in the list sent to the calculator.
|
|
13
|
+
*/
|
|
14
|
+
export type DistributionPlan = {
|
|
15
|
+
overage: Amount<"nat">;
|
|
16
|
+
shortfallToReserve: Amount<"nat">;
|
|
17
|
+
collateralForReserve: Amount<"nat">;
|
|
18
|
+
actualCollateralSold: Amount<"nat">;
|
|
19
|
+
collateralSold: Amount<"nat">;
|
|
20
|
+
collatRemaining: Amount<"nat">;
|
|
21
|
+
debtToBurn: Amount<"nat">;
|
|
22
|
+
mintedForReserve: Amount<"nat">;
|
|
23
|
+
mintedProceeds: Amount<"nat">;
|
|
24
|
+
phantomDebt: Amount<"nat">;
|
|
25
|
+
totalPenalty: Amount<"nat">;
|
|
26
|
+
transfersToVault: [number, AmountKeywordRecord][];
|
|
27
|
+
vaultsToReinstate: number[];
|
|
28
|
+
};
|
|
29
|
+
export type VaultBalances = {
|
|
30
|
+
collateral: Amount<"nat">;
|
|
31
|
+
presaleDebt: Amount<"nat">;
|
|
32
|
+
currentDebt: Amount<"nat">;
|
|
33
|
+
};
|
|
34
|
+
import type { PriceDescription } from '@agoric/zoe/tools/types.js';
|
|
35
|
+
//# sourceMappingURL=proceeds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proceeds.d.ts","sourceRoot":"","sources":["proceeds.js"],"names":[],"mappings":"AA4DO,sIATJ;IAAoC,QAAQ,EAApC,mBAAmB;IACG,SAAS,EAA/B,MAAM,CAAC,KAAK,CAAC;IACS,eAAe,EAArC,MAAM,CAAC,KAAK,CAAC;IACY,kBAAkB,EAA3C,gBAAgB;IACQ,cAAc,EAAtC,aAAa,EAAE;IAED,WAAW,EAAzB,KAAK;CACb,GAAU,gBAAgB,CA8N5B;;;;;;+BA1QY;IACR,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,oBAAoB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,oBAAoB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,gBAAgB,EAAE,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAAE,CAAC;IAClD,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;4BAOS;IACR,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;CAC5B;sCA5B0F,4BAA4B"}
|
|
@@ -9,29 +9,36 @@ import {
|
|
|
9
9
|
import { quoteAsRatio, subtractToEmpty } from '../contractSupport.js';
|
|
10
10
|
import { liquidationResults } from './liquidation.js';
|
|
11
11
|
|
|
12
|
+
/** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* @typedef {{
|
|
14
|
-
* overage: Amount<'nat'
|
|
15
|
-
* shortfallToReserve: Amount<'nat'
|
|
16
|
-
* collateralForReserve: Amount<'nat'
|
|
17
|
-
* actualCollateralSold: Amount<'nat'
|
|
18
|
-
* collateralSold: Amount<'nat'
|
|
19
|
-
* collatRemaining: Amount<'nat'
|
|
20
|
-
* debtToBurn: Amount<'nat'
|
|
21
|
-
* mintedForReserve: Amount<'nat'
|
|
22
|
-
* mintedProceeds: Amount<'nat'
|
|
23
|
-
* phantomDebt: Amount<'nat'
|
|
24
|
-
* totalPenalty: Amount<'nat'
|
|
25
|
-
* transfersToVault:
|
|
26
|
-
* vaultsToReinstate:
|
|
16
|
+
* overage: Amount<'nat'>;
|
|
17
|
+
* shortfallToReserve: Amount<'nat'>;
|
|
18
|
+
* collateralForReserve: Amount<'nat'>;
|
|
19
|
+
* actualCollateralSold: Amount<'nat'>;
|
|
20
|
+
* collateralSold: Amount<'nat'>;
|
|
21
|
+
* collatRemaining: Amount<'nat'>;
|
|
22
|
+
* debtToBurn: Amount<'nat'>;
|
|
23
|
+
* mintedForReserve: Amount<'nat'>;
|
|
24
|
+
* mintedProceeds: Amount<'nat'>;
|
|
25
|
+
* phantomDebt: Amount<'nat'>;
|
|
26
|
+
* totalPenalty: Amount<'nat'>;
|
|
27
|
+
* transfersToVault: [number, AmountKeywordRecord][];
|
|
28
|
+
* vaultsToReinstate: number[];
|
|
27
29
|
* }} DistributionPlan
|
|
30
|
+
* The plan to execute for distributing proceeds of a liquidation.
|
|
28
31
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* Vaults are referenced by index in the list sent to the calculator.
|
|
32
|
+
* Vaults are referenced by index in the list sent to the calculator.
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {{
|
|
37
|
+
* collateral: Amount<'nat'>;
|
|
38
|
+
* presaleDebt: Amount<'nat'>;
|
|
39
|
+
* currentDebt: Amount<'nat'>;
|
|
40
|
+
* }} VaultBalances
|
|
41
|
+
*/
|
|
35
42
|
|
|
36
43
|
/**
|
|
37
44
|
* Liquidation.md describes how to process liquidation proceeds.
|
|
@@ -46,7 +53,8 @@ import { liquidationResults } from './liquidation.js';
|
|
|
46
53
|
* @param {Amount<'nat'>} inputs.totalDebt
|
|
47
54
|
* @param {Amount<'nat'>} inputs.totalCollateral
|
|
48
55
|
* @param {PriceDescription} inputs.oraclePriceAtStart
|
|
49
|
-
* @param {
|
|
56
|
+
* @param {VaultBalances[]} inputs.vaultsBalances ordered best to worst
|
|
57
|
+
* collateralized
|
|
50
58
|
* @param {Ratio} inputs.penaltyRate
|
|
51
59
|
* @returns {DistributionPlan}
|
|
52
60
|
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @import {PureData} from '@endo/marshal' */
|
|
2
|
+
/** @typedef {[normalizedCollateralization: number, vaultId: VaultId]} CompositeKey */
|
|
3
|
+
/**
|
|
4
|
+
* @param {PureData} key
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export const encodeData: (p: Passable) => string;
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} encoded
|
|
10
|
+
* @returns {PureData}
|
|
11
|
+
*/
|
|
12
|
+
export const decodeData: (encoded: string, skip?: number) => Passable;
|
|
13
|
+
export function toVaultKey(normalizedDebt: NormalizedDebt, collateral: Amount<"nat">, vaultId: VaultId): string;
|
|
14
|
+
export function fromVaultKey(key: string): [normalizedCollateralization: number, vaultId: VaultId];
|
|
15
|
+
export function normalizedCollRatio(quote: PriceQuote, compoundedInterest: Ratio, margin: Ratio): number;
|
|
16
|
+
export function normalizedCollRatioKey(quote: PriceQuote, compoundedInterest: Ratio, margin: Ratio): string;
|
|
17
|
+
export type CompositeKey = [normalizedCollateralization: number, vaultId: VaultId];
|
|
18
|
+
export type NormalizedDebt = Amount<"nat"> & {
|
|
19
|
+
normalized: true;
|
|
20
|
+
};
|
|
21
|
+
export type ActualDebt = Amount<"nat"> & {
|
|
22
|
+
normalized: false;
|
|
23
|
+
};
|
|
24
|
+
import type { PriceQuote } from '@agoric/zoe/tools/types.js';
|
|
25
|
+
//# sourceMappingURL=storeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storeUtils.d.ts","sourceRoot":"","sources":["storeUtils.js"],"names":[],"mappings":"AAuBA,8CAA8C;AAE9C,sFAAsF;AAOtF;;;GAGG;AACH,iDAA+C;AAO/C;;;GAGG;AACH,sEAA+C;AAkDxC,2CANI,cAAc,cACd,MAAM,CAAC,KAAK,CAAC,WACb,OAAO,GACL,MAAM,CAelB;AAOM,kCAHI,MAAM,GACJ,CAAC,2BAA2B,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAKnE;AAgBM,2CALI,UAAU,sBACV,KAAK,UACL,KAAK,GACH,MAAM,CAiBlB;AAcM,8CANI,UAAU,sBACV,KAAK,UACL,KAAK,GACH,MAAM,CAMlB;2BA9Ia,CAAC,2BAA2B,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;6BA4CvD,MAAM,CAAC,KAAK,CAAC,GAAG;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE;yBACpC,MAAM,CAAC,KAAK,CAAC,GAAG;IAAE,UAAU,EAAE,KAAK,CAAA;CAAE;gCA/D2C,4BAA4B"}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* API supports them.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
|
|
9
|
+
|
|
8
10
|
// XXX importing these that are declared to be used only for testing
|
|
9
11
|
// until @agoric/store supports composite keys
|
|
10
12
|
import { makeDecodePassable, makeEncodePassable } from '@endo/marshal';
|
|
@@ -19,13 +21,9 @@ const { multiply } = natSafeMath;
|
|
|
19
21
|
|
|
20
22
|
const trace = makeTracer('Store', true);
|
|
21
23
|
|
|
22
|
-
/**
|
|
23
|
-
* @typedef {import('@endo/marshal').PureData} PureData
|
|
24
|
-
*/
|
|
24
|
+
/** @import {PureData} from '@endo/marshal' */
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {[normalizedCollateralization: number, vaultId: VaultId]} CompositeKey
|
|
28
|
-
*/
|
|
26
|
+
/** @typedef {[normalizedCollateralization: number, vaultId: VaultId]} CompositeKey */
|
|
29
27
|
|
|
30
28
|
// `makeEncodePassable` has three named options:
|
|
31
29
|
// `encodeRemotable`, `encodeError`, and `encodePromise`.
|
|
@@ -69,12 +67,12 @@ const decodeNumber = encoded => {
|
|
|
69
67
|
};
|
|
70
68
|
|
|
71
69
|
// Type annotations to support static testing of amount values
|
|
72
|
-
/** @typedef {Amount<'nat'> & {normalized: true}} NormalizedDebt */
|
|
73
|
-
/** @typedef {Amount<'nat'> & {normalized: false}} ActualDebt */
|
|
70
|
+
/** @typedef {Amount<'nat'> & { normalized: true }} NormalizedDebt */
|
|
71
|
+
/** @typedef {Amount<'nat'> & { normalized: false }} ActualDebt */
|
|
74
72
|
|
|
75
73
|
/**
|
|
76
|
-
* Overcollateralized are greater than one.
|
|
77
|
-
*
|
|
74
|
+
* Overcollateralized are greater than one. The more undercollaterized the
|
|
75
|
+
* smaller in [0-1].
|
|
78
76
|
*
|
|
79
77
|
* @param {NormalizedDebt} normalizedDebt normalized (not actual) total debt
|
|
80
78
|
* @param {Amount<'nat'>} collateral
|
|
@@ -95,7 +93,7 @@ const collateralizationRatio = (normalizedDebt, collateral) => {
|
|
|
95
93
|
* @param {Amount<'nat'>} collateral
|
|
96
94
|
* @param {VaultId} vaultId
|
|
97
95
|
* @returns {string} lexically sortable string in which highest
|
|
98
|
-
*
|
|
96
|
+
* debt-to-collateral is earliest
|
|
99
97
|
*/
|
|
100
98
|
export const toVaultKey = (normalizedDebt, collateral, vaultId) => {
|
|
101
99
|
assert(normalizedDebt);
|
|
@@ -162,7 +160,7 @@ harden(normalizedCollRatio);
|
|
|
162
160
|
* @param {Ratio} compoundedInterest
|
|
163
161
|
* @param {Ratio} margin
|
|
164
162
|
* @returns {string} lexically sortable string in which highest
|
|
165
|
-
*
|
|
163
|
+
* debt-to-collateral is earliest
|
|
166
164
|
*/
|
|
167
165
|
export const normalizedCollRatioKey = (quote, compoundedInterest, margin) => {
|
|
168
166
|
const collRatio = normalizedCollRatio(quote, compoundedInterest, margin);
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
type VaultFactoryPublicFacet = import("./vaultFactory.js").VaultFactoryContract["publicFacet"];
|
|
2
|
+
type AutoswapLocal = {
|
|
3
|
+
getInputPrice: (amount: Amount, brand: Brand) => Amount;
|
|
4
|
+
makeSwapInvitation: () => Invitation;
|
|
5
|
+
};
|
|
6
|
+
type VaultManagerParamValues = {
|
|
7
|
+
/**
|
|
8
|
+
* - margin below which collateral will be
|
|
9
|
+
* liquidated to satisfy the debt.
|
|
10
|
+
*/
|
|
11
|
+
liquidationMargin: Ratio;
|
|
12
|
+
/**
|
|
13
|
+
* - penalty charged upon liquidation as
|
|
14
|
+
* proportion of debt
|
|
15
|
+
*/
|
|
16
|
+
liquidationPenalty: Ratio;
|
|
17
|
+
/**
|
|
18
|
+
* - annual interest rate charged on debt
|
|
19
|
+
* positions
|
|
20
|
+
*/
|
|
21
|
+
interestRate: Ratio;
|
|
22
|
+
/**
|
|
23
|
+
* - The fee (in BasisPoints) charged when creating or
|
|
24
|
+
* increasing a debt position.
|
|
25
|
+
*/
|
|
26
|
+
mintFee: Ratio;
|
|
27
|
+
debtLimit: Amount<"nat">;
|
|
28
|
+
/**
|
|
29
|
+
* - vault must maintain this in order to
|
|
30
|
+
* remove collateral or add debt
|
|
31
|
+
*/
|
|
32
|
+
liquidationPadding?: Ratio | undefined;
|
|
33
|
+
};
|
|
34
|
+
type AddVaultType = (collateralIssuer: Issuer, collateralKeyword: Keyword, params: VaultManagerParamValues) => Promise<VaultManager>;
|
|
35
|
+
type VaultFactoryCreatorFacet = {
|
|
36
|
+
addVaultType: AddVaultType;
|
|
37
|
+
getRewardAllocation: () => import("@agoric/zoe").Allocation;
|
|
38
|
+
makeCollectFeesInvitation: () => Promise<Invitation<string, never>>;
|
|
39
|
+
makeLiquidationWaker: () => import("@agoric/time").TimerWaker;
|
|
40
|
+
makePriceLockWaker: () => import("@agoric/time").TimerWaker;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Mint new debt `toMint` and transfer the `fee`
|
|
44
|
+
* portion to the vaultFactory's reward pool. Then reallocate over all the
|
|
45
|
+
* seat arguments and the rewardPoolSeat. Update the `totalDebt` if the
|
|
46
|
+
* reallocate succeeds.
|
|
47
|
+
*/
|
|
48
|
+
type MintAndTransfer = (mintReceiver: ZCFSeat, toMint: Amount<"nat">, fee: Amount<"nat">, transfers: TransferPart[]) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Burn debt tokens off a seat and update the `totalDebt` if
|
|
51
|
+
* the reallocate succeeds.
|
|
52
|
+
*/
|
|
53
|
+
type BurnDebt = (toBurn: Amount, fromSeat: ZCFSeat) => void;
|
|
54
|
+
type GetVaultParams = {
|
|
55
|
+
getLiquidationMargin: () => Ratio;
|
|
56
|
+
getMintFee: () => Ratio;
|
|
57
|
+
getCollateralQuote: () => Promise<import("@agoric/zoe/tools/types.js").PriceQuote>;
|
|
58
|
+
/**
|
|
59
|
+
* - The annual interest rate on a debt
|
|
60
|
+
* position
|
|
61
|
+
*/
|
|
62
|
+
getInterestRate: () => Ratio;
|
|
63
|
+
/**
|
|
64
|
+
* - The period (in seconds) at
|
|
65
|
+
* which interest is charged to the debt position.
|
|
66
|
+
*/
|
|
67
|
+
getChargingPeriod: () => RelativeTime;
|
|
68
|
+
/**
|
|
69
|
+
* - The period (in seconds)
|
|
70
|
+
* at which interest is recorded to the debt position.
|
|
71
|
+
*/
|
|
72
|
+
getRecordingPeriod: () => RelativeTime;
|
|
73
|
+
};
|
|
74
|
+
type VaultId = string;
|
|
75
|
+
type InterestTiming = {
|
|
76
|
+
/**
|
|
77
|
+
* in seconds
|
|
78
|
+
*/
|
|
79
|
+
chargingPeriod: RelativeTime;
|
|
80
|
+
/**
|
|
81
|
+
* in seconds
|
|
82
|
+
*/
|
|
83
|
+
recordingPeriod: RelativeTime;
|
|
84
|
+
};
|
|
85
|
+
type LiquidationStrategy = {
|
|
86
|
+
keywordMapping: () => KeywordKeywordRecord;
|
|
87
|
+
makeProposal: (collateral: Amount, run: Amount) => import("@agoric/zoe").Proposal;
|
|
88
|
+
makeInvitation: (debt: Amount) => Promise<Invitation>;
|
|
89
|
+
};
|
|
90
|
+
type Liquidator = {
|
|
91
|
+
makeLiquidateInvitation: () => Promise<Invitation<void, {
|
|
92
|
+
debt: Amount<"nat">;
|
|
93
|
+
penaltyRate: Ratio;
|
|
94
|
+
}>>;
|
|
95
|
+
};
|
|
96
|
+
type DebtStatus = {
|
|
97
|
+
latestInterestUpdate: Timestamp;
|
|
98
|
+
/**
|
|
99
|
+
* interest accrued since latestInterestUpdate
|
|
100
|
+
*/
|
|
101
|
+
interest: NatValue;
|
|
102
|
+
/**
|
|
103
|
+
* total including principal and interest
|
|
104
|
+
*/
|
|
105
|
+
newDebt: NatValue;
|
|
106
|
+
};
|
|
107
|
+
type Calculate = (debtStatus: DebtStatus, currentTime: Timestamp) => DebtStatus;
|
|
108
|
+
type CalculatorKit = {
|
|
109
|
+
/**
|
|
110
|
+
* calculate new debt for charging periods up to
|
|
111
|
+
* the present.
|
|
112
|
+
*/
|
|
113
|
+
calculate: Calculate;
|
|
114
|
+
/**
|
|
115
|
+
* calculate new debt for
|
|
116
|
+
* reporting periods up to the present. If some charging periods have elapsed
|
|
117
|
+
* that don't constitute whole reporting periods, the time is not updated past
|
|
118
|
+
* them and interest is not accumulated for them.
|
|
119
|
+
*/
|
|
120
|
+
calculateReportingPeriod: Calculate;
|
|
121
|
+
};
|
|
122
|
+
type VaultFactoryParamPath = {
|
|
123
|
+
key: "governedParams" | {
|
|
124
|
+
collateralBrand: Brand;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
import type { VaultNotification } from './vault.js';
|
|
128
|
+
import type { Vault } from './vault.js';
|
|
129
|
+
import type { VaultKit } from './vaultKit.js';
|
|
130
|
+
import type { VaultManager } from './vaultManager.js';
|
|
131
|
+
import type { CollateralManager } from './vaultManager.js';
|
|
132
|
+
import type { AssetReserveLimitedCreatorFacet } from '../reserve/assetReserve.js';
|
|
133
|
+
import type { AssetReservePublicFacet } from '../reserve/assetReserve.js';
|
|
134
|
+
import type { AuctioneerPublicFacet } from '../auction/auctioneer.js';
|
|
135
|
+
import type { Timestamp } from '@agoric/time';
|
|
136
|
+
import type { RelativeTime } from '@agoric/time';
|
|
137
|
+
//# sourceMappingURL=types-ambient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":"+BAGa,OAAO,mBAAmB,EAAE,oBAAoB,CAAC,aAAa,CAAC;;mBAe9D,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,MAAM;wBACxC,MAAM,UAAU;;;;;;;uBAKhB,KAAK;;;;;wBAEL,KAAK;;;;;kBAEL,KAAK;;;;;aAEL,KAAK;eAEL,MAAM,CAAC,KAAK,CAAC;;;;;;;uCAOhB,MAAM,qBACN,OAAO,UACP,uBAAuB,KACrB,OAAO,CAAC,YAAY,CAAC;;kBAKpB,YAAY;yBACZ,MAAM,OAAO,aAAa,EAAE,UAAU;+BACtC,MAAM,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;0BACxC,MAAM,OAAO,cAAc,EAAE,UAAU;wBACvC,MAAM,OAAO,cAAc,EAAE,UAAU;;;;;;;;sCAQ1C,OAAO,UACP,MAAM,CAAC,KAAK,CAAC,OACb,MAAM,CAAC,KAAK,CAAC,aACb,YAAY,EAAE,KACZ,IAAI;;;;;yBAMN,MAAM,YACN,OAAO,KACL,IAAI;;0BAKH,MAAM,KAAK;gBACX,MAAM,KAAK;wBACX,MAAM,OAAO,CAAC,OAAO,4BAA4B,EAAE,UAAU,CAAC;;;;;qBAC9D,MAAM,KAAK;;;;;uBAEX,MAAM,YAAY;;;;;wBAElB,MAAM,YAAY;;eAIlB,MAAM;;;;;oBAIN,YAAY;;;;qBACZ,YAAY;;;oBAKZ,MAAM,oBAAoB;kBAC1B,CACT,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,KACR,OAAO,aAAa,EAAE,QAAQ;oBACxB,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC;;;6BAKrC,MAAM,OAAO,CACtB,UAAU,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAAC,WAAW,EAAE,KAAK,CAAA;KAAE,CAAC,CAC9D;;;0BAKU,SAAS;;;;cACT,QAAQ;;;;aACR,QAAQ;;8BAKX,UAAU,eACV,SAAS,KACP,UAAU;;;;;;eAKT,SAAS;;;;;;;8BAET,SAAS;;6BAMT;IAAE,GAAG,EAAE,gBAAgB,GAAG;QAAE,eAAe,EAAE,KAAK,CAAA;KAAE,CAAA;CAAE;uCApIhC,YAAY;2BACxB,YAAY;8BACT,eAAe;kCACX,mBAAmB;uCACd,mBAAmB;qDACL,4BAA4B;6CACpC,4BAA4B;2CAC9B,0BAA0B;+BACtC,cAAc;kCACX,cAAc"}
|