@agoric/inter-protocol 0.16.2-upgrade-14-dev-0169c7e.0 → 0.16.2-upgrade-16-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 @@
|
|
|
1
|
+
{"version":3,"file":"prioritizedVaults.d.ts","sourceRoot":"","sources":["prioritizedVaults.js"],"names":[],"mappings":"AAuCO;;uBAgHiigB,OAAO,eAA0B,WAAW;;;;;;;;;YA3DllgB;;;;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAJH;;;;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;KA3DQ,KAAK,CAMf;AASI;;;;;;;;;;;YAwCL;;;;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAJH;;;;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;;wBAOQ,OAAO;;2BAgDohgB,OAAO,eAA0B,WAAW;;;;;;;;;gBA3DllgB;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;mEArBQ,MAAM,CAAC,KAAK,CAAC,WACb,MAAM;wBAlBJ,KAAK,GAAG,SAAS;uBA0BnB,MAAM;;;;;;;;;;;gBAQjB;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;sEAFQ,MAAM,CAAC,KAAK,CAAC,WACb,MAAM;;;;;;;;;;;gBAHjB;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAOQ,OAAO;;;;;;;;;;;gBAXlB;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;mEArBQ,MAAM,CAAC,KAAK,CAAC,WACb,MAAM;wBAlBJ,KAAK,GAAG,SAAS;uBA0BnB,MAAM;;;;;;;;;;;gBAQjB;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;sEAFQ,MAAM,CAAC,KAAK,CAAC,WACb,MAAM;;;;;;;;;;;gBAHjB;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAJH;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDJ;oCAtIiC,iBAAiB"}
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
normalizedCollRatio,
|
|
14
14
|
} from './storeUtils.js';
|
|
15
15
|
|
|
16
|
-
/** @
|
|
17
|
-
/** @
|
|
16
|
+
/** @import {Vault} from './vault.js' */
|
|
17
|
+
/** @import {NormalizedDebt} from './storeUtils.js' */
|
|
18
18
|
|
|
19
19
|
const trace = makeTracer('PVaults', true);
|
|
20
20
|
|
|
@@ -47,8 +47,8 @@ export const currentDebtToCollateral = vault =>
|
|
|
47
47
|
* Vaults, ordered by their debt ratio so that all the vaults below a threshold
|
|
48
48
|
* can be quickly found and liquidated.
|
|
49
49
|
*
|
|
50
|
-
* @param {MapStore<string, Vault>} store
|
|
51
|
-
*
|
|
50
|
+
* @param {MapStore<string, Vault>} store vault has a higher debt ratio than the
|
|
51
|
+
* previous highest
|
|
52
52
|
*/
|
|
53
53
|
export const makePrioritizedVaults = store => {
|
|
54
54
|
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;cATI,mBAAmB;eACnB,MAAM,CAAC,KAAK,CAAC;qBACb,MAAM,CAAC,KAAK,CAAC;;oBAEb,aAAa,EAAE;iBAEf,KAAK;IACH,gBAAgB,CA8N5B;;;;;;+BA1QY;IACZ,OAAW,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,kBAAsB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACtC,oBAAwB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACxC,oBAAwB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACxC,cAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,eAAmB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACnC,UAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,gBAAoB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,cAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,WAAe,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,YAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,gBAAoB,EAAE,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAAE,CAAC;IACtD,iBAAqB,EAAE,MAAM,EAAE,CAAC;CAC7B;4BAOS;IACZ,UAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,WAAe,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,WAAe,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: import("@endo/marshal").Passable) => string;
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} encoded
|
|
10
|
+
* @returns {PureData}
|
|
11
|
+
*/
|
|
12
|
+
export const decodeData: (encoded: string, skip?: number | undefined) => import("@endo/marshal").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,yEAA+C;AAO/C;;;GAGG;AACH,kDAkDmD,kBAClD,sCAnD8C;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,2EAJI,KAAK,UACL,KAAK,GACH,MAAM,CAiBlB;AAcM,8EALI,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,234 @@
|
|
|
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<import("@endo/exo").Guarded<{
|
|
35
|
+
getGovernedParams(): import("./vaultManager.js").GovernedParamGetters;
|
|
36
|
+
makeVaultKit(seat: ZCFSeat): Promise<{
|
|
37
|
+
publicSubscribers: {
|
|
38
|
+
vault: {
|
|
39
|
+
description: string;
|
|
40
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
41
|
+
storagePath: Promise<string>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
45
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
46
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
47
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
48
|
+
}>;
|
|
49
|
+
vault: import("@endo/exo").Guarded<{
|
|
50
|
+
getPublicTopics(): {
|
|
51
|
+
vault: {
|
|
52
|
+
description: string;
|
|
53
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
54
|
+
storagePath: Promise<string>;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
58
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
59
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
60
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
61
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
62
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
63
|
+
}>;
|
|
64
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
65
|
+
}>;
|
|
66
|
+
getCollateralQuote(): import("@agoric/zoe/tools/types.js").PriceQuote;
|
|
67
|
+
getPublicFacet(): import("@endo/exo").Guarded<{
|
|
68
|
+
makeVaultInvitation(): Promise<Invitation<{
|
|
69
|
+
publicSubscribers: {
|
|
70
|
+
vault: {
|
|
71
|
+
description: string;
|
|
72
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
73
|
+
storagePath: Promise<string>;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
77
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
78
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
79
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
80
|
+
}>;
|
|
81
|
+
vault: import("@endo/exo").Guarded<{
|
|
82
|
+
getPublicTopics(): {
|
|
83
|
+
vault: {
|
|
84
|
+
description: string;
|
|
85
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
86
|
+
storagePath: Promise<string>;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
90
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
91
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
92
|
+
getCollateralAmount(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
93
|
+
getCurrentDebt(): import("@agoric/ertp/src/types.js").NatAmount;
|
|
94
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
95
|
+
}>;
|
|
96
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
97
|
+
}, undefined>>;
|
|
98
|
+
getQuotes(): import("@agoric/notifier").StoredNotifier<import("@agoric/zoe/tools/types.js").PriceQuote>;
|
|
99
|
+
getCompoundedInterest(): Ratio;
|
|
100
|
+
getPublicTopics(): {
|
|
101
|
+
asset: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./vaultManager.js").AssetState>;
|
|
102
|
+
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./vaultManager.js").MetricsNotification>;
|
|
103
|
+
};
|
|
104
|
+
}>;
|
|
105
|
+
lockOraclePrices(): import("@agoric/zoe/tools/types.js").PriceQuote;
|
|
106
|
+
liquidateVaults(auctionPF: globalThis.ERef<globalThis.GovernedPublicFacet<{
|
|
107
|
+
getElectorate: () => import("@agoric/ertp/src/types.js").SetAmount<import("@endo/patterns").Key>;
|
|
108
|
+
getStartFrequency: () => RelativeTime;
|
|
109
|
+
getClockStep: () => RelativeTime;
|
|
110
|
+
getStartingRate: () => bigint;
|
|
111
|
+
getLowestRate: () => bigint;
|
|
112
|
+
getDiscountStep: () => bigint;
|
|
113
|
+
getAuctionStartDelay: () => RelativeTime;
|
|
114
|
+
getPriceLockPeriod: () => RelativeTime;
|
|
115
|
+
makeBidInvitation(collateralBrand: Brand<"nat">): Promise<Invitation<string, import("../auction/auctionBook.js").OfferSpec>>;
|
|
116
|
+
getSchedules(): {
|
|
117
|
+
liveAuctionSchedule: import("../auction/scheduler.js").Schedule | null;
|
|
118
|
+
nextAuctionSchedule: import("../auction/scheduler.js").Schedule | null;
|
|
119
|
+
};
|
|
120
|
+
getScheduleUpdates(): globalThis.Subscriber<import("../auction/scheduler.js").ScheduleNotification>;
|
|
121
|
+
getBookDataUpdates(brand: any): globalThis.Subscriber<import("../auction/auctionBook.js").BookDataNotification>;
|
|
122
|
+
getPublicTopics(brand: any): {
|
|
123
|
+
bookData: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("../auction/auctionBook.js").BookDataNotification>;
|
|
124
|
+
} | {
|
|
125
|
+
schedule: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("../auction/scheduler.js").ScheduleNotification>;
|
|
126
|
+
};
|
|
127
|
+
makeDepositInvitation: () => Promise<Invitation<string, {
|
|
128
|
+
goal: import("@agoric/ertp/src/types.js").NatAmount;
|
|
129
|
+
}>>;
|
|
130
|
+
}>>): Promise<void>;
|
|
131
|
+
}>>;
|
|
132
|
+
type VaultFactoryCreatorFacet = {
|
|
133
|
+
addVaultType: AddVaultType;
|
|
134
|
+
getRewardAllocation: () => Allocation;
|
|
135
|
+
makeCollectFeesInvitation: () => Promise<Invitation<string, never>>;
|
|
136
|
+
makeLiquidationWaker: () => import("@agoric/time").TimerWaker;
|
|
137
|
+
makePriceLockWaker: () => import("@agoric/time").TimerWaker;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Mint new debt `toMint` and transfer the `fee`
|
|
141
|
+
* portion to the vaultFactory's reward pool. Then reallocate over all the
|
|
142
|
+
* seat arguments and the rewardPoolSeat. Update the `totalDebt` if the
|
|
143
|
+
* reallocate succeeds.
|
|
144
|
+
*/
|
|
145
|
+
type MintAndTransfer = (mintReceiver: ZCFSeat, toMint: Amount<"nat">, fee: Amount<"nat">, transfers: TransferPart[]) => void;
|
|
146
|
+
/**
|
|
147
|
+
* Burn debt tokens off a seat and update the `totalDebt` if
|
|
148
|
+
* the reallocate succeeds.
|
|
149
|
+
*/
|
|
150
|
+
type BurnDebt = (toBurn: Amount, fromSeat: ZCFSeat) => void;
|
|
151
|
+
type GetVaultParams = {
|
|
152
|
+
getLiquidationMargin: () => Ratio;
|
|
153
|
+
getMintFee: () => Ratio;
|
|
154
|
+
getCollateralQuote: () => Promise<import("@agoric/zoe/tools/types.js").PriceQuote>;
|
|
155
|
+
/**
|
|
156
|
+
* - The annual interest rate on a debt
|
|
157
|
+
* position
|
|
158
|
+
*/
|
|
159
|
+
getInterestRate: () => Ratio;
|
|
160
|
+
/**
|
|
161
|
+
* - The period (in seconds) at
|
|
162
|
+
* which interest is charged to the debt position.
|
|
163
|
+
*/
|
|
164
|
+
getChargingPeriod: () => RelativeTime;
|
|
165
|
+
/**
|
|
166
|
+
* - The period (in seconds)
|
|
167
|
+
* at which interest is recorded to the debt position.
|
|
168
|
+
*/
|
|
169
|
+
getRecordingPeriod: () => RelativeTime;
|
|
170
|
+
};
|
|
171
|
+
type VaultId = string;
|
|
172
|
+
type InterestTiming = {
|
|
173
|
+
/**
|
|
174
|
+
* in seconds
|
|
175
|
+
*/
|
|
176
|
+
chargingPeriod: RelativeTime;
|
|
177
|
+
/**
|
|
178
|
+
* in seconds
|
|
179
|
+
*/
|
|
180
|
+
recordingPeriod: RelativeTime;
|
|
181
|
+
};
|
|
182
|
+
type LiquidationStrategy = {
|
|
183
|
+
keywordMapping: () => KeywordKeywordRecord;
|
|
184
|
+
makeProposal: (collateral: Amount, run: Amount) => Proposal;
|
|
185
|
+
makeInvitation: (debt: Amount) => Promise<Invitation>;
|
|
186
|
+
};
|
|
187
|
+
type Liquidator = {
|
|
188
|
+
makeLiquidateInvitation: () => Promise<Invitation<void, {
|
|
189
|
+
debt: Amount<"nat">;
|
|
190
|
+
penaltyRate: Ratio;
|
|
191
|
+
}>>;
|
|
192
|
+
};
|
|
193
|
+
type DebtStatus = {
|
|
194
|
+
latestInterestUpdate: Timestamp;
|
|
195
|
+
/**
|
|
196
|
+
* interest accrued since latestInterestUpdate
|
|
197
|
+
*/
|
|
198
|
+
interest: NatValue;
|
|
199
|
+
/**
|
|
200
|
+
* total including principal and interest
|
|
201
|
+
*/
|
|
202
|
+
newDebt: NatValue;
|
|
203
|
+
};
|
|
204
|
+
type Calculate = (debtStatus: DebtStatus, currentTime: Timestamp) => DebtStatus;
|
|
205
|
+
type CalculatorKit = {
|
|
206
|
+
/**
|
|
207
|
+
* calculate new debt for charging periods up to
|
|
208
|
+
* the present.
|
|
209
|
+
*/
|
|
210
|
+
calculate: Calculate;
|
|
211
|
+
/**
|
|
212
|
+
* calculate new debt for
|
|
213
|
+
* reporting periods up to the present. If some charging periods have elapsed
|
|
214
|
+
* that don't constitute whole reporting periods, the time is not updated past
|
|
215
|
+
* them and interest is not accumulated for them.
|
|
216
|
+
*/
|
|
217
|
+
calculateReportingPeriod: Calculate;
|
|
218
|
+
};
|
|
219
|
+
type VaultFactoryParamPath = {
|
|
220
|
+
key: "governedParams" | {
|
|
221
|
+
collateralBrand: Brand;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
import type { VaultNotification } from './vault.js';
|
|
225
|
+
import type { Vault } from './vault.js';
|
|
226
|
+
import type { VaultKit } from './vaultKit.js';
|
|
227
|
+
import type { VaultManager } from './vaultManager.js';
|
|
228
|
+
import type { CollateralManager } from './vaultManager.js';
|
|
229
|
+
import type { AssetReserveLimitedCreatorFacet } from '../reserve/assetReserve.js';
|
|
230
|
+
import type { AssetReservePublicFacet } from '../reserve/assetReserve.js';
|
|
231
|
+
import type { AuctioneerPublicFacet } from '../auction/auctioneer.js';
|
|
232
|
+
import type { Timestamp } from '@agoric/time';
|
|
233
|
+
import type { RelativeTime } from '@agoric/time';
|
|
234
|
+
//# 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;;uBA6Fg38B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAApqa,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;;;;kBAvFnviB,YAAY;yBACZ,MAAM,UAAU;+BAChB,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;;;;;;;;;;;;eAQX,MAAM;;;;;;;;;;;;oBAUN,MAAM,oBAAoB;kBAC1B,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,QAAQ;oBAC7C,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC;;;6BAKrC,MAAM,OAAO,CAC1B,UAAc,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAAC,WAAW,EAAE,KAAK,CAAA;KAAE,CAAC,CAC9D;;;;;;;cAMU,QAAQ;;;;aACR,QAAQ;;8BAKX,UAAU,6BAER,UAAU;;;;;;eAKT,SAAS;;;;;;;8BAET,SAAS;;6BAMT;IAAE,GAAG,EAAE,gBAAgB,GAAG;QAAE,eAAe,EAAE,KAAK,CAAA;KAAE,CAAA;CAAE;uCAjIhC,YAAY;2BACxB,YAAY;8BACT,eAAe;kCACX,mBAAmB;uCACd,mBAAmB;qDACL,4BAA4B;6CACpC,4BAA4B;2CAC9B,0BAA0B;+BACtC,cAAc;kCACX,cAAc"}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @typedef {import('./vault').VaultNotification} VaultNotification
|
|
5
|
-
* @typedef {import('./vault').Vault} Vault
|
|
6
|
-
* @typedef {import('./vaultKit').VaultKit} VaultKit
|
|
7
|
-
* @typedef {import('./vaultManager').VaultManager} VaultManager
|
|
8
|
-
* @typedef {import('./vaultManager').CollateralManager} CollateralManager
|
|
9
|
-
* @typedef {import('../reserve/assetReserve.js').AssetReserveLimitedCreatorFacet} AssetReserveCreatorFacet
|
|
10
|
-
* @typedef {import('../reserve/assetReserve.js').AssetReservePublicFacet} AssetReservePublicFacet
|
|
11
|
-
* @typedef {import('../auction/auctioneer.js').AuctioneerPublicFacet} AuctioneerPublicFacet
|
|
12
4
|
* @typedef {import('./vaultFactory.js').VaultFactoryContract['publicFacet']} VaultFactoryPublicFacet
|
|
13
|
-
*
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
5
|
+
* @import {VaultNotification} from './vault.js'
|
|
6
|
+
* @import {Vault} from './vault.js'
|
|
7
|
+
* @import {VaultKit} from './vaultKit.js'
|
|
8
|
+
* @import {VaultManager} from './vaultManager.js'
|
|
9
|
+
* @import {CollateralManager} from './vaultManager.js'
|
|
10
|
+
* @import {AssetReserveLimitedCreatorFacet} from '../reserve/assetReserve.js'
|
|
11
|
+
* @import {AssetReservePublicFacet} from '../reserve/assetReserve.js'
|
|
12
|
+
* @import {AuctioneerPublicFacet} from '../auction/auctioneer.js'
|
|
13
|
+
* @import {Timestamp} from '@agoric/time'
|
|
14
|
+
* @import {RelativeTime} from '@agoric/time'
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
|
-
* @typedef
|
|
18
|
+
* @typedef {object} AutoswapLocal
|
|
20
19
|
* @property {(amount: Amount, brand: Brand) => Amount} getInputPrice
|
|
21
20
|
* @property {() => Invitation} makeSwapInvitation
|
|
22
21
|
*/
|
|
@@ -24,13 +23,16 @@
|
|
|
24
23
|
/**
|
|
25
24
|
* @typedef {object} VaultManagerParamValues
|
|
26
25
|
* @property {Ratio} liquidationMargin - margin below which collateral will be
|
|
27
|
-
*
|
|
28
|
-
* @property {Ratio} liquidationPenalty - penalty charged upon liquidation as
|
|
29
|
-
*
|
|
30
|
-
* @property {Ratio}
|
|
31
|
-
*
|
|
26
|
+
* liquidated to satisfy the debt.
|
|
27
|
+
* @property {Ratio} liquidationPenalty - penalty charged upon liquidation as
|
|
28
|
+
* proportion of debt
|
|
29
|
+
* @property {Ratio} interestRate - annual interest rate charged on debt
|
|
30
|
+
* positions
|
|
31
|
+
* @property {Ratio} mintFee - The fee (in BasisPoints) charged when creating or
|
|
32
|
+
* increasing a debt position.
|
|
32
33
|
* @property {Amount<'nat'>} debtLimit
|
|
33
|
-
* @property {Ratio} [liquidationPadding] - vault must maintain this in order to
|
|
34
|
+
* @property {Ratio} [liquidationPadding] - vault must maintain this in order to
|
|
35
|
+
* remove collateral or add debt
|
|
34
36
|
*/
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -42,32 +44,29 @@
|
|
|
42
44
|
*/
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
|
-
* @typedef
|
|
47
|
+
* @typedef {object} VaultFactoryCreatorFacet
|
|
46
48
|
* @property {AddVaultType} addVaultType
|
|
47
49
|
* @property {() => Allocation} getRewardAllocation
|
|
48
50
|
* @property {() => Promise<Invitation<string, never>>} makeCollectFeesInvitation
|
|
49
|
-
* @property {() => import('@agoric/time
|
|
50
|
-
* @property {() => import('@agoric/time
|
|
51
|
+
* @property {() => import('@agoric/time').TimerWaker} makeLiquidationWaker
|
|
52
|
+
* @property {() => import('@agoric/time').TimerWaker} makePriceLockWaker
|
|
51
53
|
*/
|
|
52
54
|
|
|
53
55
|
/**
|
|
54
|
-
* @callback MintAndTransfer
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
56
|
+
* @callback MintAndTransfer Mint new debt `toMint` and transfer the `fee`
|
|
57
|
+
* portion to the vaultFactory's reward pool. Then reallocate over all the
|
|
58
|
+
* seat arguments and the rewardPoolSeat. Update the `totalDebt` if the
|
|
59
|
+
* reallocate succeeds.
|
|
58
60
|
* @param {ZCFSeat} mintReceiver
|
|
59
61
|
* @param {Amount<'nat'>} toMint
|
|
60
62
|
* @param {Amount<'nat'>} fee
|
|
61
|
-
* @param {
|
|
63
|
+
* @param {TransferPart[]} transfers
|
|
62
64
|
* @returns {void}
|
|
63
65
|
*/
|
|
64
66
|
|
|
65
67
|
/**
|
|
66
|
-
* @callback BurnDebt
|
|
67
|
-
*
|
|
68
|
-
* Burn debt tokens off a seat and update
|
|
69
|
-
* the `totalDebt` if the reallocate succeeds.
|
|
70
|
-
*
|
|
68
|
+
* @callback BurnDebt Burn debt tokens off a seat and update the `totalDebt` if
|
|
69
|
+
* the reallocate succeeds.
|
|
71
70
|
* @param {Amount} toBurn
|
|
72
71
|
* @param {ZCFSeat} fromSeat
|
|
73
72
|
* @returns {void}
|
|
@@ -77,17 +76,16 @@
|
|
|
77
76
|
* @typedef {object} GetVaultParams
|
|
78
77
|
* @property {() => Ratio} getLiquidationMargin
|
|
79
78
|
* @property {() => Ratio} getMintFee
|
|
80
|
-
* @property {() => Promise<PriceQuote>} getCollateralQuote
|
|
81
|
-
* @property {() => Ratio} getInterestRate - The annual interest rate on a debt
|
|
79
|
+
* @property {() => Promise<import('@agoric/zoe/tools/types.js').PriceQuote>} getCollateralQuote
|
|
80
|
+
* @property {() => Ratio} getInterestRate - The annual interest rate on a debt
|
|
81
|
+
* position
|
|
82
82
|
* @property {() => RelativeTime} getChargingPeriod - The period (in seconds) at
|
|
83
83
|
* which interest is charged to the debt position.
|
|
84
84
|
* @property {() => RelativeTime} getRecordingPeriod - The period (in seconds)
|
|
85
85
|
* at which interest is recorded to the debt position.
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
|
-
/**
|
|
89
|
-
* @typedef {string} VaultId
|
|
90
|
-
*/
|
|
88
|
+
/** @typedef {string} VaultId */
|
|
91
89
|
|
|
92
90
|
/**
|
|
93
91
|
* @typedef {object} InterestTiming
|
|
@@ -104,7 +102,9 @@
|
|
|
104
102
|
|
|
105
103
|
/**
|
|
106
104
|
* @typedef {object} Liquidator
|
|
107
|
-
* @property {() => Promise<
|
|
105
|
+
* @property {() => Promise<
|
|
106
|
+
* Invitation<void, { debt: Amount<'nat'>; penaltyRate: Ratio }>
|
|
107
|
+
* >} makeLiquidateInvitation
|
|
108
108
|
*/
|
|
109
109
|
|
|
110
110
|
/**
|
|
@@ -124,11 +124,11 @@
|
|
|
124
124
|
/**
|
|
125
125
|
* @typedef {object} CalculatorKit
|
|
126
126
|
* @property {Calculate} calculate calculate new debt for charging periods up to
|
|
127
|
-
*
|
|
127
|
+
* the present.
|
|
128
128
|
* @property {Calculate} calculateReportingPeriod calculate new debt for
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
129
|
+
* reporting periods up to the present. If some charging periods have elapsed
|
|
130
|
+
* that don't constitute whole reporting periods, the time is not updated past
|
|
131
|
+
* them and interest is not accumulated for them.
|
|
132
132
|
*/
|
|
133
133
|
|
|
134
|
-
/** @typedef {{key: 'governedParams' | {collateralBrand: Brand}}} VaultFactoryParamPath */
|
|
134
|
+
/** @typedef {{ key: 'governedParams' | { collateralBrand: Brand } }} VaultFactoryParamPath */
|