@agoric/inter-protocol 0.16.2-upgrade-14-dev-c8f9e7b.0 → 0.16.2-upgrade-16-fi-dev-8879538.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/package.json +41 -34
- package/scripts/build-bundles.js +5 -21
- package/src/auction/auctionBook.d.ts +84 -0
- package/src/auction/auctionBook.d.ts.map +1 -0
- package/src/auction/auctionBook.js +135 -103
- package/src/auction/auctioneer.d.ts +83 -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 +149 -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 +97 -40
- 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 +238 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +77 -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 +181 -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 +1169 -0
- package/src/proposals/econ-behaviors.d.ts.map +1 -0
- package/src/proposals/econ-behaviors.js +66 -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 +202 -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 +770 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +463 -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 +163 -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 +360 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +8 -11
- package/src/vaultFactory/params.d.ts +145 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +52 -24
- package/src/vaultFactory/prioritizedVaults.d.ts +992 -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 +234 -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 +402 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +99 -93
- package/src/vaultFactory/vaultDirector.d.ts +388 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +61 -50
- package/src/vaultFactory/vaultFactory.d.ts +277 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +49 -32
- package/src/vaultFactory/vaultHolder.d.ts +270 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +10 -14
- package/src/vaultFactory/vaultKit.d.ts +102 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +5 -4
- package/src/vaultFactory/vaultManager.d.ts +819 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +248 -151
- package/CHANGELOG.md +0 -1066
- package/exported.js +0 -2
- package/scripts/add-collateral-core.js +0 -113
- package/scripts/deploy-contracts.js +0 -100
- package/scripts/init-core.js +0 -200
- 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,163 @@
|
|
|
1
|
+
export function setWakeupsForNextAuction(auctioneerPublicFacet: ERef<import("../auction/auctioneer.js").AuctioneerPublicFacet>, timer: globalThis.ERef<TimerService>, priceLockWaker: TimerWaker, liquidationWaker: TimerWaker, reschedulerWaker: TimerWaker): Promise<void>;
|
|
2
|
+
export function liquidationResults(debt: Amount<"nat">, minted: Amount<"nat">): {
|
|
3
|
+
overage: Amount<"nat">;
|
|
4
|
+
shortfall: Amount<"nat">;
|
|
5
|
+
};
|
|
6
|
+
export function watchForGovernanceChange(auctioneerPublicFacet: ERef<import("../auction/auctioneer.js").AuctioneerPublicFacet>, timer: globalThis.ERef<TimerService>, reschedulerWaker: TimerWaker): void;
|
|
7
|
+
export function getLiquidatableVaults(zcf: ZCF, collateralizationDetails: {
|
|
8
|
+
quote: PriceQuote;
|
|
9
|
+
interest: Ratio;
|
|
10
|
+
margin: Ratio;
|
|
11
|
+
}, prioritizedVaults: ReturnType<typeof import("./prioritizedVaults.js").makePrioritizedVaults>, liquidatingVaults: globalThis.SetStore<import("@endo/exo").Guarded<{
|
|
12
|
+
getVaultSeat(): ZCFSeat;
|
|
13
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
14
|
+
publicSubscribers: {
|
|
15
|
+
vault: {
|
|
16
|
+
description: string;
|
|
17
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
18
|
+
storagePath: Promise<string>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
22
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
23
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
24
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
25
|
+
}>;
|
|
26
|
+
vault: import("@endo/exo").Guarded<{
|
|
27
|
+
getPublicTopics(): {
|
|
28
|
+
vault: {
|
|
29
|
+
description: string;
|
|
30
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
31
|
+
storagePath: Promise<string>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
35
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
36
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
37
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
38
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
39
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
40
|
+
}>;
|
|
41
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
42
|
+
}>;
|
|
43
|
+
liquidating(): void;
|
|
44
|
+
liquidated(): void;
|
|
45
|
+
abortLiquidation(): string;
|
|
46
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
47
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
48
|
+
makeTransferInvitation(): Promise<Invitation<{
|
|
49
|
+
publicSubscribers: {
|
|
50
|
+
vault: {
|
|
51
|
+
description: string;
|
|
52
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
53
|
+
storagePath: Promise<string>;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
57
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
58
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
59
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
60
|
+
}>;
|
|
61
|
+
vault: import("@endo/exo").Guarded<{
|
|
62
|
+
getPublicTopics(): {
|
|
63
|
+
vault: {
|
|
64
|
+
description: string;
|
|
65
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
66
|
+
storagePath: Promise<string>;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
70
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
71
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
72
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
73
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
74
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
75
|
+
}>;
|
|
76
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
77
|
+
}, undefined>>;
|
|
78
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
79
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
80
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
81
|
+
}>>, debtBrand: Brand<"nat">, collateralBrand: Brand<"nat">): {
|
|
82
|
+
vaultData: globalThis.MapStore<import("@endo/exo").Guarded<{
|
|
83
|
+
getVaultSeat(): ZCFSeat;
|
|
84
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
85
|
+
publicSubscribers: {
|
|
86
|
+
vault: {
|
|
87
|
+
description: string;
|
|
88
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
89
|
+
storagePath: Promise<string>;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
93
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
94
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
95
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
96
|
+
}>;
|
|
97
|
+
vault: import("@endo/exo").Guarded<{
|
|
98
|
+
getPublicTopics(): {
|
|
99
|
+
vault: {
|
|
100
|
+
description: string;
|
|
101
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
102
|
+
storagePath: Promise<string>;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
106
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
107
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
108
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
109
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
110
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
111
|
+
}>;
|
|
112
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
113
|
+
}>;
|
|
114
|
+
liquidating(): void;
|
|
115
|
+
liquidated(): void;
|
|
116
|
+
abortLiquidation(): string;
|
|
117
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
118
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
119
|
+
makeTransferInvitation(): Promise<Invitation<{
|
|
120
|
+
publicSubscribers: {
|
|
121
|
+
vault: {
|
|
122
|
+
description: string;
|
|
123
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
124
|
+
storagePath: Promise<string>;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
128
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
129
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
130
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
131
|
+
}>;
|
|
132
|
+
vault: import("@endo/exo").Guarded<{
|
|
133
|
+
getPublicTopics(): {
|
|
134
|
+
vault: {
|
|
135
|
+
description: string;
|
|
136
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
137
|
+
storagePath: Promise<string>;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
141
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
142
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
143
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
144
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
145
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
146
|
+
}>;
|
|
147
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
148
|
+
}, undefined>>;
|
|
149
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
150
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
151
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
152
|
+
}>, {
|
|
153
|
+
collateralAmount: Amount<"nat">;
|
|
154
|
+
debtAmount: Amount<"nat">;
|
|
155
|
+
}>;
|
|
156
|
+
totalDebt: Amount<"nat">;
|
|
157
|
+
totalCollateral: Amount<"nat">;
|
|
158
|
+
liqSeat: ZCFSeat;
|
|
159
|
+
};
|
|
160
|
+
import type { TimerService } from '@agoric/time';
|
|
161
|
+
import type { TimerWaker } from '@agoric/time';
|
|
162
|
+
import type { PriceQuote } from '@agoric/zoe/tools/types.js';
|
|
163
|
+
//# sourceMappingURL=liquidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidation.d.ts","sourceRoot":"","sources":["liquidation.js"],"names":[],"mappings":"AAqJO,gEAPI,IAAI,CAAC,OAAO,0BAA0B,EAAE,qBAAqB,CAAC,iIAK5D,OAAO,CAAC,IAAI,CAAC,CAqCzB;AAQM,yCAJI,MAAM,CAAC,KAAK,CAAC,UACb,MAAM,CAAC,KAAK,CAAC,GACX;IAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;CAAE,CAYhE;AAWM,gEALI,IAAI,CAAC,OAAO,0BAA0B,EAAE,qBAAqB,CAAC,uEAG5D,IAAI,CA0BhB;AAwBM,2CArBI,GAAG;;cAGH,KAAK;YACL,KAAK;sBACL,UAAU,CACpB,cAAkB,wBAAwB,EAAE,qBAAqB,CAC9D;;uBA+DgoU,OAAO,eAA0B,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA7DrqU,KAAK,CAAC,KAAK,CAAC,mBACZ,KAAK,CAAC,KAAK,CAAC;;;2BA4D6mU,OAAO,eAA0B,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAxDrpU,MAAM,CAAC,KAAK,CAAC;oBAAc,MAAM,CAAC,KAAK,CAAC;;eAEnD,MAAM,CAAC,KAAK,CAAC;qBACP,MAAM,CAAC,KAAK,CAAC;aACrB,OAAO;EAkDpB;kCArS+B,cAAc;gCAChB,cAAc;gCAGkD,4BAA4B"}
|
|
@@ -13,16 +13,18 @@ import { makeCancelTokenMaker } from '../auction/util.js';
|
|
|
13
13
|
|
|
14
14
|
const trace = makeTracer('LIQ');
|
|
15
15
|
|
|
16
|
-
/** @
|
|
17
|
-
/** @
|
|
18
|
-
/** @
|
|
19
|
-
/** @
|
|
16
|
+
/** @import {TimerService} from '@agoric/time' */
|
|
17
|
+
/** @import {TimerWaker} from '@agoric/time' */
|
|
18
|
+
/** @import {CancelToken} from '@agoric/time' */
|
|
19
|
+
/** @import {RelativeTimeRecord} from '@agoric/time' */
|
|
20
|
+
/** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
|
|
20
21
|
|
|
21
22
|
const makeCancelToken = makeCancelTokenMaker('liq');
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* This will normally be set. If the schedule goes sideways, we'll unschedule
|
|
25
|
-
* all events and unset it. When auction params are changed, we'll restart the
|
|
26
|
+
* all events and unset it. When auction params are changed, we'll restart the
|
|
27
|
+
* schedule
|
|
26
28
|
*
|
|
27
29
|
* @type {object | undefined}
|
|
28
30
|
*/
|
|
@@ -47,15 +49,16 @@ const cancelWakeups = timer => {
|
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
|
-
* Schedule wakeups for the
|
|
52
|
+
* Schedule wakeups for the _next_ auction round.
|
|
51
53
|
*
|
|
52
|
-
* In practice, there are these cases to handle (with N as "live" and N+1 is
|
|
54
|
+
* In practice, there are these cases to handle (with N as "live" and N+1 is
|
|
55
|
+
* "next"):
|
|
53
56
|
*
|
|
54
|
-
* | when (now within the range)
|
|
55
|
-
* |
|
|
56
|
-
* | [start N, nominalStart N+1]
|
|
57
|
-
* | (nominalStart N+1, endTime N+1]
|
|
58
|
-
* | (endTime N+1, ∞)
|
|
57
|
+
* | when (now within the range) | what |
|
|
58
|
+
* | ------------------------------- | ---------------------------------------- |
|
|
59
|
+
* | [start N, nominalStart N+1] | good: schedule normally the three wakers |
|
|
60
|
+
* | (nominalStart N+1, endTime N+1] | recover: skip round N+1 and schedule N+2 |
|
|
61
|
+
* | (endTime N+1, ∞) | give up: wait for repair by governance |
|
|
59
62
|
*
|
|
60
63
|
* @param {object} opts
|
|
61
64
|
* @param {ERef<TimerService>} opts.timer
|
|
@@ -63,7 +66,7 @@ const cancelWakeups = timer => {
|
|
|
63
66
|
* @param {TimerWaker} opts.liquidationWaker
|
|
64
67
|
* @param {TimerWaker} opts.reschedulerWaker
|
|
65
68
|
* @param {import('../auction/scheduler.js').Schedule} opts.nextAuctionSchedule
|
|
66
|
-
* @param {import('@agoric/time
|
|
69
|
+
* @param {import('@agoric/time').TimestampRecord} opts.now
|
|
67
70
|
* @param {ParamStateRecord} opts.params
|
|
68
71
|
* @returns {void}
|
|
69
72
|
*/
|
|
@@ -132,7 +135,7 @@ const setWakeups = ({
|
|
|
132
135
|
};
|
|
133
136
|
|
|
134
137
|
/**
|
|
135
|
-
* Schedule wakeups for the
|
|
138
|
+
* Schedule wakeups for the _next_ auction round.
|
|
136
139
|
*
|
|
137
140
|
* Called by vaultDirector's resetWakeupsForNextAuction at start() and every
|
|
138
141
|
* time there's a "reschedule" wakeup.
|
|
@@ -185,7 +188,7 @@ harden(setWakeupsForNextAuction);
|
|
|
185
188
|
/**
|
|
186
189
|
* @param {Amount<'nat'>} debt
|
|
187
190
|
* @param {Amount<'nat'>} minted
|
|
188
|
-
* @returns {{ overage: Amount<'nat'
|
|
191
|
+
* @returns {{ overage: Amount<'nat'>; shortfall: Amount<'nat'> }}
|
|
189
192
|
*/
|
|
190
193
|
export const liquidationResults = (debt, minted) => {
|
|
191
194
|
if (AmountMath.isEmpty(minted)) {
|
|
@@ -240,15 +243,21 @@ export const watchForGovernanceChange = (
|
|
|
240
243
|
* @param {PriceQuote} collateralizationDetails.quote
|
|
241
244
|
* @param {Ratio} collateralizationDetails.interest
|
|
242
245
|
* @param {Ratio} collateralizationDetails.margin
|
|
243
|
-
* @param {ReturnType<
|
|
246
|
+
* @param {ReturnType<
|
|
247
|
+
* typeof import('./prioritizedVaults.js').makePrioritizedVaults
|
|
248
|
+
* >} prioritizedVaults
|
|
244
249
|
* @param {SetStore<Vault>} liquidatingVaults
|
|
245
250
|
* @param {Brand<'nat'>} debtBrand
|
|
246
251
|
* @param {Brand<'nat'>} collateralBrand
|
|
247
252
|
* @returns {{
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
253
|
+
* vaultData: MapStore<
|
|
254
|
+
* Vault,
|
|
255
|
+
* { collateralAmount: Amount<'nat'>; debtAmount: Amount<'nat'> }
|
|
256
|
+
* >;
|
|
257
|
+
* totalDebt: Amount<'nat'>;
|
|
258
|
+
* totalCollateral: Amount<'nat'>;
|
|
259
|
+
* liqSeat: ZCFSeat;
|
|
260
|
+
* }}
|
|
252
261
|
*/
|
|
253
262
|
export const getLiquidatableVaults = (
|
|
254
263
|
zcf,
|
|
@@ -261,13 +270,18 @@ export const getLiquidatableVaults = (
|
|
|
261
270
|
const vaultsToLiquidate = prioritizedVaults.removeVaultsBelow(
|
|
262
271
|
collateralizationDetails,
|
|
263
272
|
);
|
|
264
|
-
/**
|
|
273
|
+
/**
|
|
274
|
+
* @type {MapStore<
|
|
275
|
+
* Vault,
|
|
276
|
+
* { collateralAmount: Amount<'nat'>; debtAmount: Amount<'nat'> }
|
|
277
|
+
* >}
|
|
278
|
+
*/
|
|
265
279
|
const vaultData = makeScalarMapStore();
|
|
266
280
|
|
|
267
281
|
const { zcfSeat: liqSeat } = zcf.makeEmptySeatKit();
|
|
268
282
|
let totalDebt = AmountMath.makeEmpty(debtBrand);
|
|
269
283
|
let totalCollateral = AmountMath.makeEmpty(collateralBrand);
|
|
270
|
-
/** @type {
|
|
284
|
+
/** @type {TransferPart[]} */
|
|
271
285
|
const transfers = [];
|
|
272
286
|
|
|
273
287
|
for (const vault of vaultsToLiquidate.values()) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function calculateMinimumCollateralization(liquidationMargin: Ratio, liquidationPadding: Ratio): Ratio;
|
|
2
|
+
export function minimumPrice(quoteA: PriceQuote, quoteB?: PriceQuote | undefined): Ratio;
|
|
3
|
+
export function maxDebtForVault(quoteAmount: PriceQuote, liquidationMargin: Ratio, liquidationPadding: Ratio): Amount<"nat">;
|
|
4
|
+
export function calculateDebtCosts(currentDebt: Amount<"nat">, give: Amount<"nat">, want: Amount<"nat">, debtFee: Ratio): {
|
|
5
|
+
newDebt: import("@agoric/ertp/src/types.js").NatAmount;
|
|
6
|
+
toMint: import("@agoric/ertp/src/types.js").NatAmount;
|
|
7
|
+
fee: import("@agoric/ertp/src/types.js").NatAmount;
|
|
8
|
+
surplus: import("@agoric/ertp/src/types.js").NatAmount;
|
|
9
|
+
};
|
|
10
|
+
import type { PriceQuote } from '@agoric/zoe/tools/types.js';
|
|
11
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["math.js"],"names":[],"mappings":"AA4BO,qEAJI,KAAK,sBACL,KAAK,GACH,KAAK,CAKmC;AAS9C,mFAFM,KAAK,CAajB;AAYM,4EAJI,KAAK,sBACL,KAAK,GACH,MAAM,CAAC,KAAK,CAAC,CAczB;AAaM,gDALI,MAAM,CAAC,KAAK,CAAC,QACb,MAAM,CAAC,KAAK,CAAC,QACb,MAAM,CAAC,KAAK,CAAC,WACb,KAAK;;;;;EASf;gCA7E6F,4BAA4B"}
|
package/src/vaultFactory/math.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file calculations specific to the Vault Factory contract
|
|
5
|
-
*
|
|
4
|
+
* @file calculations specific to the Vault Factory contract See also
|
|
5
|
+
* ../interest-math.js
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { AmountMath } from '@agoric/ertp';
|
|
@@ -16,9 +16,11 @@ import {
|
|
|
16
16
|
import { priceFrom } from '../auction/util.js';
|
|
17
17
|
import { addSubtract } from '../contractSupport.js';
|
|
18
18
|
|
|
19
|
+
/** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
|
-
* Calculate the minimum collateralization given the liquidation margin and the
|
|
21
|
-
* from that liquidation threshold.
|
|
22
|
+
* Calculate the minimum collateralization given the liquidation margin and the
|
|
23
|
+
* "padding" from that liquidation threshold.
|
|
22
24
|
*
|
|
23
25
|
* @param {Ratio} liquidationMargin
|
|
24
26
|
* @param {Ratio} liquidationPadding
|
|
@@ -74,11 +76,10 @@ export const maxDebtForVault = (
|
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
|
-
* Calculate the fee, the amount to mint and the resulting debt.
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* so the simple math works.
|
|
79
|
+
* Calculate the fee, the amount to mint and the resulting debt. The give and
|
|
80
|
+
* the want together reflect a delta, where typically one is zero because they
|
|
81
|
+
* come from the gave/want of an offer proposal. If the `want` is zero, the
|
|
82
|
+
* `fee` will also be zero, so the simple math works.
|
|
82
83
|
*
|
|
83
84
|
* @param {Amount<'nat'>} currentDebt
|
|
84
85
|
* @param {Amount<'nat'>} give excess of currentDebt is returned in 'surplus'
|