@agoric/inter-protocol 0.16.2-other-dev-3eb1a1d.0 → 0.16.2-other-dev-d15096d.0.d15096d
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 +36 -35
- package/src/auction/auctionBook.d.ts +9 -7
- package/src/auction/auctionBook.d.ts.map +1 -1
- package/src/auction/auctionBook.js +58 -32
- package/src/auction/auctionMath.d.ts +1 -1
- package/src/auction/auctionMath.d.ts.map +1 -1
- package/src/auction/auctioneer.d.ts +19 -13
- package/src/auction/auctioneer.d.ts.map +1 -1
- package/src/auction/auctioneer.js +25 -12
- package/src/auction/offerBook.d.ts +3 -2
- package/src/auction/offerBook.d.ts.map +1 -1
- package/src/auction/offerBook.js +5 -1
- package/src/auction/params.d.ts +16 -7
- package/src/auction/params.d.ts.map +1 -1
- package/src/auction/params.js +12 -4
- package/src/auction/scheduleMath.d.ts +5 -3
- package/src/auction/scheduleMath.d.ts.map +1 -1
- package/src/auction/scheduleMath.js +11 -7
- package/src/auction/scheduler.d.ts +9 -4
- package/src/auction/scheduler.d.ts.map +1 -1
- package/src/auction/scheduler.js +14 -6
- package/src/auction/util.d.ts +2 -1
- package/src/auction/util.d.ts.map +1 -1
- package/src/auction/util.js +4 -1
- package/src/clientSupport.d.ts +29 -73
- package/src/clientSupport.d.ts.map +1 -1
- package/src/clientSupport.js +29 -128
- package/src/contractSupport.d.ts +2 -2
- package/src/contractSupport.d.ts.map +1 -1
- package/src/econCommitteeCharter.d.ts +15 -8
- package/src/econCommitteeCharter.d.ts.map +1 -1
- package/src/econCommitteeCharter.js +14 -8
- package/src/feeDistributor.d.ts +43 -49
- package/src/feeDistributor.d.ts.map +1 -1
- package/src/feeDistributor.js +7 -3
- package/src/index.js +1 -1
- package/src/interest-math.d.ts +1 -0
- package/src/interest-math.d.ts.map +1 -1
- package/src/interest-math.js +5 -1
- package/src/interest.d.ts +3 -1
- package/src/interest.d.ts.map +1 -1
- package/src/interest.js +2 -5
- package/src/price/README.md +1 -1
- package/src/price/fluxAggregatorContract.d.ts +20 -11
- package/src/price/fluxAggregatorContract.d.ts.map +1 -1
- package/src/price/fluxAggregatorContract.js +17 -9
- package/src/price/fluxAggregatorKit.d.ts +15 -9
- package/src/price/fluxAggregatorKit.d.ts.map +1 -1
- package/src/price/fluxAggregatorKit.js +15 -9
- package/src/price/priceOracleKit.d.ts +4 -2
- package/src/price/priceOracleKit.d.ts.map +1 -1
- package/src/price/priceOracleKit.js +7 -2
- package/src/price/roundsManager.d.ts +8 -6
- package/src/price/roundsManager.d.ts.map +1 -1
- package/src/price/roundsManager.js +5 -2
- package/src/proposals/add-auction.js +38 -4
- package/src/proposals/addAssetToVault.js +8 -4
- package/src/proposals/committee-proposal.js +10 -5
- package/src/proposals/core-proposal.js +9 -3
- package/src/proposals/deploy-price-feeds.js +35 -7
- package/src/proposals/econ-behaviors.js +33 -12
- package/src/proposals/price-feed-proposal.js +10 -3
- package/src/proposals/replace-fee-distributor.js +12 -6
- package/src/proposals/replaceElectorate.js +105 -16
- package/src/proposals/startEconCommittee.js +5 -1
- package/src/proposals/startPSM.js +7 -4
- package/src/proposals/upgrade-vaults.js +15 -5
- package/src/proposals/utils.d.ts +8 -4
- package/src/proposals/utils.d.ts.map +1 -1
- package/src/proposals/utils.js +32 -9
- package/src/proposals/withdraw-reserve-proposal.js +63 -0
- package/src/provisionPool.d.ts +34 -120
- package/src/provisionPool.d.ts.map +1 -1
- package/src/provisionPool.js +43 -21
- package/src/provisionPoolKit.d.ts +43 -328
- package/src/provisionPoolKit.d.ts.map +1 -1
- package/src/provisionPoolKit.js +210 -120
- package/src/psm/psm.d.ts +20 -13
- package/src/psm/psm.d.ts.map +1 -1
- package/src/psm/psm.js +18 -12
- package/src/reserve/assetReserve.d.ts +18 -6
- package/src/reserve/assetReserve.d.ts.map +1 -1
- package/src/reserve/assetReserve.js +26 -23
- package/src/reserve/assetReserveKit.d.ts +38 -6
- package/src/reserve/assetReserveKit.d.ts.map +1 -1
- package/src/reserve/assetReserveKit.js +117 -7
- package/src/reserve/params.d.ts +9 -3
- package/src/reserve/params.d.ts.map +1 -1
- package/src/reserve/params.js +8 -2
- package/src/vaultFactory/burn.d.ts +1 -1
- package/src/vaultFactory/burn.d.ts.map +1 -1
- package/src/vaultFactory/burn.js +1 -1
- package/src/vaultFactory/liquidation.d.ts +7 -3
- package/src/vaultFactory/liquidation.d.ts.map +1 -1
- package/src/vaultFactory/liquidation.js +14 -12
- package/src/vaultFactory/math.d.ts +1 -1
- package/src/vaultFactory/math.d.ts.map +1 -1
- package/src/vaultFactory/math.js +1 -1
- package/src/vaultFactory/orderedVaultStore.d.ts +21 -20
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -1
- package/src/vaultFactory/orderedVaultStore.js +4 -2
- package/src/vaultFactory/params.d.ts +25 -9
- package/src/vaultFactory/params.d.ts.map +1 -1
- package/src/vaultFactory/params.js +29 -11
- package/src/vaultFactory/prioritizedVaults.d.ts +70 -69
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -1
- package/src/vaultFactory/prioritizedVaults.js +5 -2
- package/src/vaultFactory/storeUtils.d.ts +2 -2
- package/src/vaultFactory/storeUtils.d.ts.map +1 -1
- package/src/vaultFactory/types-ambient.d.ts +2 -2
- package/src/vaultFactory/types-ambient.d.ts.map +1 -1
- package/src/vaultFactory/types-ambient.js +6 -2
- package/src/vaultFactory/vault.d.ts +34 -30
- package/src/vaultFactory/vault.d.ts.map +1 -1
- package/src/vaultFactory/vault.js +19 -15
- package/src/vaultFactory/vaultDirector.d.ts +81 -63
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
- package/src/vaultFactory/vaultDirector.js +38 -24
- package/src/vaultFactory/vaultFactory.d.ts +35 -22
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
- package/src/vaultFactory/vaultFactory.js +27 -17
- package/src/vaultFactory/vaultHolder.d.ts +77 -29
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
- package/src/vaultFactory/vaultHolder.js +12 -4
- package/src/vaultFactory/vaultKit.d.ts +12 -8
- package/src/vaultFactory/vaultKit.d.ts.map +1 -1
- package/src/vaultFactory/vaultKit.js +12 -5
- package/src/vaultFactory/vaultManager.d.ts +102 -88
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +86 -53
- package/src/proposals/add-auction.d.ts +0 -109
- package/src/proposals/add-auction.d.ts.map +0 -1
- package/src/proposals/addAssetToVault.d.ts +0 -173
- package/src/proposals/addAssetToVault.d.ts.map +0 -1
- package/src/proposals/committee-proposal.d.ts +0 -113
- package/src/proposals/committee-proposal.d.ts.map +0 -1
- package/src/proposals/core-proposal.d.ts +0 -149
- package/src/proposals/core-proposal.d.ts.map +0 -1
- package/src/proposals/deploy-price-feeds.d.ts +0 -76
- package/src/proposals/deploy-price-feeds.d.ts.map +0 -1
- package/src/proposals/econ-behaviors.d.ts +0 -541
- package/src/proposals/econ-behaviors.d.ts.map +0 -1
- package/src/proposals/price-feed-proposal.d.ts +0 -84
- package/src/proposals/price-feed-proposal.d.ts.map +0 -1
- package/src/proposals/replace-fee-distributor.d.ts +0 -48
- package/src/proposals/replace-fee-distributor.d.ts.map +0 -1
- package/src/proposals/replace-scaledPriceAuthorities.d.ts +0 -30
- package/src/proposals/replace-scaledPriceAuthorities.d.ts.map +0 -1
- package/src/proposals/replaceElectorate.d.ts +0 -55
- package/src/proposals/replaceElectorate.d.ts.map +0 -1
- package/src/proposals/startEconCommittee.d.ts +0 -34
- package/src/proposals/startEconCommittee.d.ts.map +0 -1
- package/src/proposals/startPSM.d.ts +0 -59
- package/src/proposals/startPSM.d.ts.map +0 -1
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +0 -24
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +0 -1
- package/src/proposals/upgrade-vaults.d.ts +0 -41
- package/src/proposals/upgrade-vaults.d.ts.map +0 -1
|
@@ -5,21 +5,26 @@ export function start(zcf: ZCF<GovernanceTerms<{}> & {
|
|
|
5
5
|
}>, privateArgs: {
|
|
6
6
|
feeMintAccess: FeeMintAccess;
|
|
7
7
|
initialPoserInvitation: Invitation;
|
|
8
|
-
marshaller:
|
|
9
|
-
storageNode:
|
|
8
|
+
marshaller: ERemote<Marshaller>;
|
|
9
|
+
storageNode: ERemote<StorageNode>;
|
|
10
10
|
}, baggage: Baggage): Promise<{
|
|
11
11
|
/** @type {GovernedCreatorFacet<typeof assetReserveKit.machine>} */
|
|
12
12
|
creatorFacet: GovernedCreatorFacet<import("@endo/exo").Guarded<{
|
|
13
13
|
addIssuer(issuer: Issuer, keyword: string): Promise<void>;
|
|
14
14
|
getAllocations(): Allocation;
|
|
15
|
-
makeShortfallReportingInvitation(): Promise<Invitation<import("@endo/exo").Guarded<{
|
|
15
|
+
makeShortfallReportingInvitation(): Promise<globalThis.Invitation<import("@endo/exo").Guarded<{
|
|
16
16
|
increaseLiquidationShortfall(shortfall: Amount<"nat">): void;
|
|
17
17
|
reduceLiquidationShortfall(reduction: Amount<"nat">): void;
|
|
18
18
|
}>, undefined>>;
|
|
19
|
+
makeSingleWithdrawalInvitation(): Promise<globalThis.Invitation<any, undefined>>;
|
|
20
|
+
makeRepeatableWithdrawalInvitation(): Promise<globalThis.Invitation<{
|
|
21
|
+
invitationMakers: Partial<any>;
|
|
22
|
+
}, undefined>>;
|
|
23
|
+
revokeOutstandingWithdrawalInvitations(): void;
|
|
19
24
|
}>>;
|
|
20
25
|
/** @type {GovernedPublicFacet<typeof assetReserveKit.public>} */
|
|
21
26
|
publicFacet: GovernedPublicFacet<import("@endo/exo").Guarded<{
|
|
22
|
-
makeAddCollateralInvitation(): Promise<Invitation<string, never>>;
|
|
27
|
+
makeAddCollateralInvitation(): Promise<globalThis.Invitation<string, never>>;
|
|
23
28
|
getPublicTopics(): {
|
|
24
29
|
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./assetReserveKit.js").MetricsNotification>;
|
|
25
30
|
};
|
|
@@ -38,10 +43,17 @@ export type AssetReserveLimitedCreatorFacet = {
|
|
|
38
43
|
getAllocations: () => Allocation;
|
|
39
44
|
makeShortfallReportingInvitation: () => Promise<Invitation<ShortfallReporter>>;
|
|
40
45
|
};
|
|
41
|
-
export type AssetReservePublicFacet =
|
|
46
|
+
export type AssetReservePublicFacet = EReturn<typeof start>["publicFacet"];
|
|
42
47
|
/**
|
|
43
48
|
* the creator facet for the governor
|
|
44
49
|
*/
|
|
45
|
-
export type AssetReserveCreatorFacet =
|
|
50
|
+
export type AssetReserveCreatorFacet = EReturn<typeof start>["creatorFacet"];
|
|
51
|
+
export type ReserveContract = ContractOf<typeof start>;
|
|
52
|
+
import type { ContractMeta } from '@agoric/zoe';
|
|
53
|
+
import type { FeeMintAccess } from '@agoric/zoe';
|
|
54
|
+
import type { ERemote } from '@agoric/internal';
|
|
46
55
|
import type { Baggage } from '@agoric/vat-data';
|
|
56
|
+
import type { Allocation } from '@agoric/zoe';
|
|
57
|
+
import type { EReturn } from '@endo/far';
|
|
58
|
+
import type { ContractOf } from '@agoric/zoe/src/zoeService/utils.js';
|
|
47
59
|
//# sourceMappingURL=assetReserve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetReserve.d.ts","sourceRoot":"","sources":["assetReserve.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assetReserve.d.ts","sourceRoot":"","sources":["assetReserve.js"],"names":[],"mappings":"AAqBA,yCAAyC;AACzC,mBADW,aAAa,OAAO,KAAK,CAAC,CAGnC;AA8BK,2BAbI,GAAG,CACT,eAAe,CAAC,EAAE,CAAC,GAAG;IACpB,YAAY,EAAE,CAAC,2BAA2B,CAAC,CAAC;CAC7C,CACF,eACO;IACN,aAAa,EAAE,aAAa,CAAC;IAC7B,sBAAsB,EAAE,UAAU,CAAC;IACnC,UAAU,EAAE,QAAQ,UAAU,CAAC,CAAC;IAChC,WAAW,EAAE,QAAQ,WAAW,CAAC,CAAC;CACnC,WACO,OAAO;IAuDd,mEAAmE;kBAAxD,oBAAoB;;;;;;;;;;;;OAAgC;IAE/D,iEAAiE;iBAAtD,mBAAmB;;;;;OAA+B;GAKhE;sCAtFY;IACR,4BAA4B,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,0BAA0B,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;;kCAwFU,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;gCAC3B,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;;;eAK3B,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI;oBACrC,MAAM,UAAU;sCAChB,MAAM,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;;sCAG5C,QAAQ,OAAO,KAAK,CAAb,CAAe,aAAa,CAAC;;;;uCAErC,QAAQ,OAAO,KAAK,CAAb,CAAe,cAAc,CAAC;8BAIpC,WAAW,OAAO,KAAK,CAAC;kCAxHkC,aAAa;mCAAb,aAAa;6BAJ3D,kBAAkB;6BAClB,kBAAkB;gCAG4B,aAAa;6BAF3D,WAAW;gCACR,qCAAqC"}
|
|
@@ -2,12 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
import { handleParamGovernance } from '@agoric/governance';
|
|
4
4
|
import { makeTracer } from '@agoric/internal';
|
|
5
|
+
import { wrapRemoteMarshaller } from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
5
6
|
import {
|
|
6
7
|
prepareRecorderKitMakers,
|
|
7
8
|
provideAll,
|
|
8
9
|
} from '@agoric/zoe/src/contractSupport/index.js';
|
|
9
10
|
import { prepareAssetReserveKit } from './assetReserveKit.js';
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @import {ERemote} from '@agoric/internal';
|
|
14
|
+
* @import {Baggage} from '@agoric/vat-data'
|
|
15
|
+
* @import {EReturn} from '@endo/far';
|
|
16
|
+
* @import {ContractOf} from '@agoric/zoe/src/zoeService/utils.js';
|
|
17
|
+
* @import {Allocation, ContractMeta, FeeMintAccess, Installation} from '@agoric/zoe';
|
|
18
|
+
*/
|
|
19
|
+
|
|
11
20
|
const trace = makeTracer('AR', true);
|
|
12
21
|
|
|
13
22
|
/** @type {ContractMeta<typeof start>} */
|
|
@@ -23,8 +32,6 @@ harden(meta);
|
|
|
23
32
|
* }} ShortfallReportingFacet
|
|
24
33
|
*/
|
|
25
34
|
|
|
26
|
-
/** @import {Baggage} from '@agoric/vat-data' */
|
|
27
|
-
|
|
28
35
|
/**
|
|
29
36
|
* Asset Reserve holds onto assets for the Inter Protocol, and can dispense it
|
|
30
37
|
* for various purposes under governance control.
|
|
@@ -40,8 +47,8 @@ harden(meta);
|
|
|
40
47
|
* @param {{
|
|
41
48
|
* feeMintAccess: FeeMintAccess;
|
|
42
49
|
* initialPoserInvitation: Invitation;
|
|
43
|
-
* marshaller:
|
|
44
|
-
* storageNode:
|
|
50
|
+
* marshaller: ERemote<Marshaller>;
|
|
51
|
+
* storageNode: ERemote<StorageNode>;
|
|
45
52
|
* }} privateArgs
|
|
46
53
|
* @param {Baggage} baggage
|
|
47
54
|
*/
|
|
@@ -52,27 +59,21 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
52
59
|
// accessed via the `state` object. The latter means updates are made directly
|
|
53
60
|
// to state and don't require reference to baggage.
|
|
54
61
|
|
|
62
|
+
const { marshaller: remoteMarshaller } = privateArgs;
|
|
63
|
+
const cachingMarshaller = wrapRemoteMarshaller(remoteMarshaller);
|
|
64
|
+
|
|
55
65
|
const { makeRecorderKit } = prepareRecorderKitMakers(
|
|
56
66
|
baggage,
|
|
57
|
-
|
|
67
|
+
cachingMarshaller,
|
|
58
68
|
);
|
|
59
69
|
|
|
60
|
-
/** @type {() => Promise<ZCFMint<'nat'>>} */
|
|
61
|
-
const takeFeeMint = async () => {
|
|
62
|
-
if (baggage.has('feeMint')) {
|
|
63
|
-
return baggage.get('feeMint');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const feeMintTemp = await zcf.registerFeeMint(
|
|
67
|
-
'Fee',
|
|
68
|
-
privateArgs.feeMintAccess,
|
|
69
|
-
);
|
|
70
|
-
baggage.init('feeMint', feeMintTemp);
|
|
71
|
-
return feeMintTemp;
|
|
72
|
-
};
|
|
73
|
-
trace('awaiting takeFeeMint');
|
|
74
|
-
const feeMint = await takeFeeMint();
|
|
75
70
|
const storageNode = await privateArgs.storageNode;
|
|
71
|
+
|
|
72
|
+
trace('awaiting feeMint');
|
|
73
|
+
const { feeMint } = await provideAll(baggage, {
|
|
74
|
+
feeMint: () => zcf.registerFeeMint('Fee', privateArgs.feeMintAccess),
|
|
75
|
+
});
|
|
76
|
+
|
|
76
77
|
const makeAssetReserveKit = await prepareAssetReserveKit(baggage, {
|
|
77
78
|
feeMint,
|
|
78
79
|
makeRecorderKit,
|
|
@@ -90,7 +91,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
90
91
|
privateArgs.initialPoserInvitation,
|
|
91
92
|
{},
|
|
92
93
|
privateArgs.storageNode,
|
|
93
|
-
|
|
94
|
+
cachingMarshaller,
|
|
94
95
|
);
|
|
95
96
|
|
|
96
97
|
const { governorFacet } = makeDurableGovernorFacet(
|
|
@@ -127,8 +128,10 @@ harden(start);
|
|
|
127
128
|
* @property {() => Promise<Invitation<ShortfallReporter>>} makeShortfallReportingInvitation
|
|
128
129
|
*/
|
|
129
130
|
|
|
130
|
-
/** @typedef {
|
|
131
|
+
/** @typedef {EReturn<typeof start>['publicFacet']} AssetReservePublicFacet */
|
|
131
132
|
/**
|
|
132
|
-
* @typedef {
|
|
133
|
+
* @typedef {EReturn<typeof start>['creatorFacet']} AssetReserveCreatorFacet
|
|
133
134
|
* the creator facet for the governor
|
|
134
135
|
*/
|
|
136
|
+
|
|
137
|
+
/** @typedef {ContractOf<typeof start>} ReserveContract */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function prepareAssetReserveKit(baggage:
|
|
1
|
+
export function prepareAssetReserveKit(baggage: Baggage, { feeMint, makeRecorderKit, storageNode, zcf }: {
|
|
2
2
|
feeMint: ZCFMint<"nat">;
|
|
3
|
-
makeRecorderKit:
|
|
4
|
-
storageNode: StorageNode
|
|
3
|
+
makeRecorderKit: MakeRecorderKit;
|
|
4
|
+
storageNode: ERemote<StorageNode>;
|
|
5
5
|
zcf: ZCF;
|
|
6
6
|
}): Promise<() => Promise<import("@endo/exo").GuardedKit<{
|
|
7
7
|
helper: {
|
|
@@ -21,6 +21,20 @@ export function prepareAssetReserveKit(baggage: import("@agoric/vat-data").Bagga
|
|
|
21
21
|
*/
|
|
22
22
|
burnFeesToReduceShortfall(reduction: Amount<"nat">): void;
|
|
23
23
|
};
|
|
24
|
+
withdrawalHandler: {
|
|
25
|
+
handle(seat: any): Promise<string>;
|
|
26
|
+
};
|
|
27
|
+
withdrawalFacet: {
|
|
28
|
+
Withdraw(): Promise<globalThis.Invitation<any, undefined>>;
|
|
29
|
+
};
|
|
30
|
+
repeatableWithdrawalHandler: {
|
|
31
|
+
/**
|
|
32
|
+
* @param {ZCFSeat} seat
|
|
33
|
+
*/
|
|
34
|
+
handle(seat: ZCFSeat): {
|
|
35
|
+
invitationMakers: Partial<any>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
24
38
|
machine: {
|
|
25
39
|
/**
|
|
26
40
|
* @param {Issuer} issuer
|
|
@@ -29,12 +43,17 @@ export function prepareAssetReserveKit(baggage: import("@agoric/vat-data").Bagga
|
|
|
29
43
|
addIssuer(issuer: Issuer, keyword: string): Promise<void>;
|
|
30
44
|
/** XXX redundant with getPublicTopics metrics `allocation` */
|
|
31
45
|
getAllocations(): Allocation;
|
|
32
|
-
makeShortfallReportingInvitation(): Promise<Invitation<import("@endo/exo").Guarded<{
|
|
46
|
+
makeShortfallReportingInvitation(): Promise<globalThis.Invitation<import("@endo/exo").Guarded<{
|
|
33
47
|
/** @param {Amount<'nat'>} shortfall */
|
|
34
48
|
increaseLiquidationShortfall(shortfall: Amount<"nat">): void;
|
|
35
49
|
/** @param {Amount<'nat'>} reduction */
|
|
36
50
|
reduceLiquidationShortfall(reduction: Amount<"nat">): void;
|
|
37
51
|
}>, undefined>>;
|
|
52
|
+
makeSingleWithdrawalInvitation(): Promise<globalThis.Invitation<any, undefined>>;
|
|
53
|
+
makeRepeatableWithdrawalInvitation(): Promise<globalThis.Invitation<{
|
|
54
|
+
invitationMakers: Partial<any>;
|
|
55
|
+
}, undefined>>;
|
|
56
|
+
revokeOutstandingWithdrawalInvitations(): void;
|
|
38
57
|
};
|
|
39
58
|
/**
|
|
40
59
|
* XXX missing governance public methods
|
|
@@ -42,7 +61,7 @@ export function prepareAssetReserveKit(baggage: import("@agoric/vat-data").Bagga
|
|
|
42
61
|
*/
|
|
43
62
|
public: {
|
|
44
63
|
/** Anyone can deposit any assets to the reserve */
|
|
45
|
-
makeAddCollateralInvitation(): Promise<Invitation<string, never>>;
|
|
64
|
+
makeAddCollateralInvitation(): Promise<globalThis.Invitation<string, never>>;
|
|
46
65
|
getPublicTopics(): {
|
|
47
66
|
metrics: import("@agoric/zoe/src/contractSupport").PublicTopic<MetricsNotification>;
|
|
48
67
|
};
|
|
@@ -70,5 +89,18 @@ export type MetricsNotification = {
|
|
|
70
89
|
*/
|
|
71
90
|
totalFeeBurned: Amount<"nat">;
|
|
72
91
|
};
|
|
73
|
-
export type AssetReserveKit =
|
|
92
|
+
export type AssetReserveKit = EReturn<EReturn<typeof prepareAssetReserveKit>>;
|
|
93
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
94
|
+
import type { ZCFMint } from '@agoric/zoe';
|
|
95
|
+
import type { MakeRecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
96
|
+
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
97
|
+
import type { ERemote } from '@agoric/internal';
|
|
98
|
+
import type { ZCF } from '@agoric/zoe';
|
|
99
|
+
import type { Brand } from '@agoric/ertp';
|
|
100
|
+
import type { Keyword } from '@agoric/zoe';
|
|
101
|
+
import type { Amount } from '@agoric/ertp';
|
|
102
|
+
import type { ZCFSeat } from '@agoric/zoe';
|
|
103
|
+
import type { Issuer } from '@agoric/ertp';
|
|
104
|
+
import type { AmountKeywordRecord } from '@agoric/zoe/src/zoeService/types.js';
|
|
105
|
+
import type { EReturn } from '@endo/far';
|
|
74
106
|
//# sourceMappingURL=assetReserveKit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetReserveKit.d.ts","sourceRoot":"","sources":["assetReserveKit.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assetReserveKit.d.ts","sourceRoot":"","sources":["assetReserveKit.js"],"names":[],"mappings":"AAmDO,gDARI,OAAO,kDACP;IACN,OAAO,EAAE,QAAQ,KAAK,CAAC,CAAC;IACxB,eAAe,EAAE,eAAe,CAAC;IACjC,WAAW,EAAE,QAAQ,WAAW,CAAC,CAAC;IAClC,GAAG,EAAE,GAAG,CAAC;CACV;;QA8GI,2BAA2B;kCAAf,KAAK;QAUjB;;;WAGG;gCAFQ,KAAK,WACL,OAAO;;;;QAqBlB;;;WAGG;6CAFQ,OAAO,KAAK,CAAC,GACX,IAAI;;;;;;;;;QAsDjB;;WAEG;qBADQ,OAAO;;;;;QAYlB;;;WAGG;0BAFQ,MAAM,WACN,MAAM;QAmBjB,8DAA8D;;;YA2E9D,uCAAuC;oDAA3B,OAAO,KAAK,CAAC;YAWzB,uCAAuC;kDAA3B,OAAO,KAAK,CAAC;;;;;;;;IArD3B;;;OAGG;;QAED,mDAAmD;;;;;;;QAqCnD,uCAAuC;gDAA3B,OAAO,KAAK,CAAC;QAWzB,uCAAuC;8CAA3B,OAAO,KAAK,CAAC;;KA8BhC;;iBA3Wa,mBAAmB;;;;;sBACnB,OAAO,KAAK,CAAC;;;;oBAEb,OAAO,KAAK,CAAC;;;;oBACb,OAAO,KAAK,CAAC;;8BAyWb,QAAQ,QAAQ,OAAO,sBAAsB,CAAC,CAAC;6BAnXnC,kBAAkB;6BADmB,aAAa;qCAE1C,6CAA6C;iCANjD,0CAA0C;6BADxB,kBAAkB;yBAKH,aAAa;2BAHpC,cAAc;6BAGS,aAAa;4BAHpC,cAAc;6BAGS,aAAa;4BAHpC,cAAc;yCAEhB,qCAAqC;6BALjD,WAAW"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { Fail, q } from '@endo/errors';
|
|
2
3
|
import { AmountMath, AmountShape, IssuerShape } from '@agoric/ertp';
|
|
3
4
|
import { makeTracer } from '@agoric/internal';
|
|
@@ -7,14 +8,27 @@ import {
|
|
|
7
8
|
makeRecorderTopic,
|
|
8
9
|
TopicsRecordShape,
|
|
9
10
|
} from '@agoric/zoe/src/contractSupport/topics.js';
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
AmountKeywordRecordShape,
|
|
13
|
+
OfferHandlerI,
|
|
14
|
+
} from '@agoric/zoe/src/typeGuards.js';
|
|
11
15
|
import { E } from '@endo/eventual-send';
|
|
12
16
|
import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js';
|
|
17
|
+
import { prepareRevocableMakerKit } from '@agoric/base-zone/zone-helpers.js';
|
|
18
|
+
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
13
19
|
|
|
14
20
|
const trace = makeTracer('ReserveKit', true);
|
|
15
21
|
|
|
16
22
|
/**
|
|
17
|
-
* @import {
|
|
23
|
+
* @import {EReturn} from '@endo/far';
|
|
24
|
+
* @import {TypedPattern, ERemote, Remote} from '@agoric/internal';
|
|
25
|
+
* @import {StorageNode} from '@agoric/internal/src/lib-chainStorage.js';
|
|
26
|
+
* @import {Amount, Brand, Issuer} from '@agoric/ertp';
|
|
27
|
+
* @import {MapStore, SetStore} from '@agoric/store';
|
|
28
|
+
* @import {AmountKeywordRecord} from '@agoric/zoe/src/zoeService/types.js';
|
|
29
|
+
* @import {ZCF, OfferHandler, Keyword, ZCFMint, ZCFSeat} from '@agoric/zoe';
|
|
30
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
31
|
+
* @import {MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
18
32
|
*/
|
|
19
33
|
|
|
20
34
|
/**
|
|
@@ -27,11 +41,11 @@ const trace = makeTracer('ReserveKit', true);
|
|
|
27
41
|
*/
|
|
28
42
|
|
|
29
43
|
/**
|
|
30
|
-
* @param {
|
|
44
|
+
* @param {Baggage} baggage
|
|
31
45
|
* @param {{
|
|
32
46
|
* feeMint: ZCFMint<'nat'>;
|
|
33
|
-
* makeRecorderKit:
|
|
34
|
-
* storageNode: StorageNode
|
|
47
|
+
* makeRecorderKit: MakeRecorderKit;
|
|
48
|
+
* storageNode: ERemote<StorageNode>;
|
|
35
49
|
* zcf: ZCF;
|
|
36
50
|
* }} powers
|
|
37
51
|
*/
|
|
@@ -43,6 +57,40 @@ export const prepareAssetReserveKit = async (
|
|
|
43
57
|
const feeKit = feeMint.getIssuerRecord();
|
|
44
58
|
const emptyAmount = AmountMath.makeEmpty(feeKit.brand);
|
|
45
59
|
|
|
60
|
+
const zone = makeDurableZone(baggage);
|
|
61
|
+
|
|
62
|
+
// Durable revocation bookkeeping for the revocable single and repeatable
|
|
63
|
+
// invitations.
|
|
64
|
+
/** @type {SetStore<{ revoke: () => boolean }>} */
|
|
65
|
+
const outstandingRevokers = zone.setStore('outstandingRevokers');
|
|
66
|
+
|
|
67
|
+
const { makeRevocableKit: makeRevocableWithdrawalFacet } =
|
|
68
|
+
prepareRevocableMakerKit(zone, 'WithdrawalFacet', ['Withdraw']);
|
|
69
|
+
|
|
70
|
+
const { makeRevocableKit: makeRevocableWithdrawalHandler } =
|
|
71
|
+
prepareRevocableMakerKit(zone, 'WithdrawalHandler', ['handle'], {
|
|
72
|
+
extraMethods: {
|
|
73
|
+
/**
|
|
74
|
+
* Add some additional cleanup to avoid proliferation of revokers for
|
|
75
|
+
* spent invitations.
|
|
76
|
+
*
|
|
77
|
+
* @param {ZCFSeat} seat
|
|
78
|
+
* @param {never} offerArgs
|
|
79
|
+
*/
|
|
80
|
+
handle(seat, offerArgs) {
|
|
81
|
+
const { revoker } = this.facets;
|
|
82
|
+
// We remove our outstanding revoker because we are consumed by Zoe
|
|
83
|
+
// and cannot be used again.
|
|
84
|
+
if (this.state.underlying === undefined) {
|
|
85
|
+
Fail`${q('WithdrawalHandler_caretaker')} revoked`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
outstandingRevokers.delete(revoker);
|
|
89
|
+
return this.state.underlying.handle(seat, offerArgs);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
46
94
|
const makeAssetReserveKitInternal = prepareExoClassKit(
|
|
47
95
|
baggage,
|
|
48
96
|
'AssetReserveKit',
|
|
@@ -51,10 +99,18 @@ export const prepareAssetReserveKit = async (
|
|
|
51
99
|
governedApis: M.interface('AssetReserve governedApis', {
|
|
52
100
|
burnFeesToReduceShortfall: M.call(AmountShape).returns(),
|
|
53
101
|
}),
|
|
102
|
+
withdrawalFacet: M.interface('AssetReserve withdrawalFacet', {
|
|
103
|
+
Withdraw: M.call().returns(M.promise()),
|
|
104
|
+
}),
|
|
105
|
+
withdrawalHandler: OfferHandlerI,
|
|
106
|
+
repeatableWithdrawalHandler: OfferHandlerI,
|
|
54
107
|
machine: M.interface('AssetReserve machine', {
|
|
55
108
|
addIssuer: M.call(IssuerShape, M.string()).returns(M.promise()),
|
|
56
109
|
getAllocations: M.call().returns(AmountKeywordRecordShape),
|
|
57
110
|
makeShortfallReportingInvitation: M.call().returns(M.promise()),
|
|
111
|
+
makeSingleWithdrawalInvitation: M.call().returns(M.promise()),
|
|
112
|
+
makeRepeatableWithdrawalInvitation: M.call().returns(M.promise()),
|
|
113
|
+
revokeOutstandingWithdrawalInvitations: M.call().returns(),
|
|
58
114
|
}),
|
|
59
115
|
public: M.interface('AssetReserve public', {
|
|
60
116
|
makeAddCollateralInvitation: M.call().returns(M.promise()),
|
|
@@ -65,7 +121,7 @@ export const prepareAssetReserveKit = async (
|
|
|
65
121
|
reduceLiquidationShortfall: M.call(AmountShape).returns(),
|
|
66
122
|
}),
|
|
67
123
|
},
|
|
68
|
-
/** @param {StorageNode} metricsNode */
|
|
124
|
+
/** @param {Remote<StorageNode>} metricsNode */
|
|
69
125
|
metricsNode => {
|
|
70
126
|
/**
|
|
71
127
|
* Used to look up the unique keyword for each brand, including Fee brand.
|
|
@@ -163,6 +219,44 @@ export const prepareAssetReserveKit = async (
|
|
|
163
219
|
facets.helper.writeMetrics();
|
|
164
220
|
},
|
|
165
221
|
},
|
|
222
|
+
withdrawalHandler: {
|
|
223
|
+
async handle(seat) {
|
|
224
|
+
const { collateralSeat } = this.state;
|
|
225
|
+
const { helper } = this.facets;
|
|
226
|
+
const { want } = seat.getProposal();
|
|
227
|
+
|
|
228
|
+
// COMMIT POINT
|
|
229
|
+
// UNTIL #10684: ability to terminate an incarnation w/o terminating the contract
|
|
230
|
+
zcf.atomicRearrange(harden([[collateralSeat, seat, want]]));
|
|
231
|
+
|
|
232
|
+
helper.writeMetrics();
|
|
233
|
+
seat.exit();
|
|
234
|
+
|
|
235
|
+
trace('withdrew collateral', want);
|
|
236
|
+
return 'withdrew Collateral from the Reserve';
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
withdrawalFacet: {
|
|
240
|
+
Withdraw() {
|
|
241
|
+
const { revoker, revocable: handler } =
|
|
242
|
+
makeRevocableWithdrawalHandler(this.facets.withdrawalHandler);
|
|
243
|
+
outstandingRevokers.add(revoker);
|
|
244
|
+
// @ts-expect-error Argument of type Guarded<
|
|
245
|
+
return zcf.makeInvitation(handler, 'Withdraw Collateral');
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
repeatableWithdrawalHandler: {
|
|
249
|
+
/**
|
|
250
|
+
* @param {ZCFSeat} seat
|
|
251
|
+
*/
|
|
252
|
+
handle(seat) {
|
|
253
|
+
seat.exit();
|
|
254
|
+
const { revoker, revocable: invitationMakers } =
|
|
255
|
+
makeRevocableWithdrawalFacet(this.facets.withdrawalFacet);
|
|
256
|
+
outstandingRevokers.add(revoker);
|
|
257
|
+
return harden({ invitationMakers });
|
|
258
|
+
},
|
|
259
|
+
},
|
|
166
260
|
machine: {
|
|
167
261
|
// add makeRedeemLiquidityTokensInvitation later. For now just store them
|
|
168
262
|
/**
|
|
@@ -202,6 +296,22 @@ export const prepareAssetReserveKit = async (
|
|
|
202
296
|
'getFacetForReportingShortfalls',
|
|
203
297
|
);
|
|
204
298
|
},
|
|
299
|
+
|
|
300
|
+
makeSingleWithdrawalInvitation() {
|
|
301
|
+
return this.facets.withdrawalFacet.Withdraw();
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
makeRepeatableWithdrawalInvitation() {
|
|
305
|
+
const handler = this.facets.repeatableWithdrawalHandler;
|
|
306
|
+
return zcf.makeInvitation(handler, 'Repeatable Withdraw Collateral');
|
|
307
|
+
},
|
|
308
|
+
|
|
309
|
+
revokeOutstandingWithdrawalInvitations() {
|
|
310
|
+
for (const revoker of outstandingRevokers.keys()) {
|
|
311
|
+
revoker.revoke();
|
|
312
|
+
}
|
|
313
|
+
outstandingRevokers.clear();
|
|
314
|
+
},
|
|
205
315
|
},
|
|
206
316
|
/**
|
|
207
317
|
* XXX missing governance public methods
|
|
@@ -288,4 +398,4 @@ export const prepareAssetReserveKit = async (
|
|
|
288
398
|
return makeAssetReserveKit;
|
|
289
399
|
};
|
|
290
400
|
harden(prepareAssetReserveKit);
|
|
291
|
-
/** @typedef {
|
|
401
|
+
/** @typedef {EReturn<EReturn<typeof prepareAssetReserveKit>>} AssetReserveKit */
|
package/src/reserve/params.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import {AdminFacet, ContractOf, InvitationAmount, ZCFMint} from '@agoric/zoe';
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @param {InvitationAmount} poserInvitationAmount
|
|
6
|
+
*/
|
|
7
|
+
export function makeReserveTerms(poserInvitationAmount: InvitationAmount): {
|
|
3
8
|
governedParams: {
|
|
4
9
|
Electorate: {
|
|
5
10
|
type: "invitation";
|
|
6
|
-
value:
|
|
11
|
+
value: import("@agoric/ertp").SetAmount<import("@agoric/zoe").InvitationDetails>;
|
|
7
12
|
};
|
|
8
13
|
};
|
|
9
14
|
};
|
|
15
|
+
import type { InvitationAmount } from '@agoric/zoe';
|
|
10
16
|
//# sourceMappingURL=params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["params.js"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["params.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,wDAFW,gBAAgB;;;;;;;EASzB;sCAbkE,aAAa"}
|
package/src/reserve/params.js
CHANGED
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @import {AdminFacet, ContractOf, InvitationAmount, ZCFMint} from '@agoric/zoe';
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {InvitationAmount} poserInvitationAmount
|
|
11
|
+
*/
|
|
12
|
+
const makeReserveTerms = poserInvitationAmount => ({
|
|
7
13
|
governedParams: harden({
|
|
8
14
|
[CONTRACT_ELECTORATE]: {
|
|
9
15
|
type: ParamTypes.INVITATION,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function paymentFromZCFMint(zcf: ZCF, zcfMint: ZCFMint, amount: Amount): Promise<globalThis.Payment<any>>;
|
|
1
|
+
export function paymentFromZCFMint(zcf: ZCF, zcfMint: ZCFMint, amount: Amount): Promise<globalThis.Payment<any, any>>;
|
|
2
2
|
//# sourceMappingURL=burn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"burn.d.ts","sourceRoot":"","sources":["burn.js"],"names":[],"mappings":"AAWO,wCAJI,GAAG,WACH,OAAO,UACP,MAAM,
|
|
1
|
+
{"version":3,"file":"burn.d.ts","sourceRoot":"","sources":["burn.js"],"names":[],"mappings":"AAWO,wCAJI,GAAG,WACH,OAAO,UACP,MAAM,yCAOhB"}
|
package/src/vaultFactory/burn.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export function setWakeupsForNextAuction(auctioneerPublicFacet: ERef<
|
|
1
|
+
export function setWakeupsForNextAuction(auctioneerPublicFacet: ERef<AuctioneerPublicFacet>, timer: ERef<TimerService>, priceLockWaker: TimerWaker, liquidationWaker: TimerWaker, reschedulerWaker: TimerWaker): Promise<void>;
|
|
2
2
|
export function liquidationResults(debt: Amount<"nat">, minted: Amount<"nat">): {
|
|
3
3
|
overage: Amount<"nat">;
|
|
4
4
|
shortfall: Amount<"nat">;
|
|
5
5
|
};
|
|
6
|
-
export function watchForGovernanceChange(auctioneerPublicFacet: ERef<
|
|
6
|
+
export function watchForGovernanceChange(auctioneerPublicFacet: ERef<AuctioneerPublicFacet>, timer: ERef<TimerService>, reschedulerWaker: TimerWaker): void;
|
|
7
7
|
export function getLiquidatableVaults(zcf: ZCF, collateralizationDetails: {
|
|
8
8
|
quote: PriceQuote;
|
|
9
9
|
interest: Ratio;
|
|
10
10
|
margin: Ratio;
|
|
11
|
-
}, prioritizedVaults: ReturnType<typeof
|
|
11
|
+
}, prioritizedVaults: ReturnType<typeof makePrioritizedVaults>, liquidatingVaults: SetStore<Vault>, debtBrand: Brand<"nat">, collateralBrand: Brand<"nat">): {
|
|
12
12
|
vaultData: MapStore<Vault, {
|
|
13
13
|
collateralAmount: Amount<"nat">;
|
|
14
14
|
debtAmount: Amount<"nat">;
|
|
@@ -17,7 +17,11 @@ export function getLiquidatableVaults(zcf: ZCF, collateralizationDetails: {
|
|
|
17
17
|
totalCollateral: Amount<"nat">;
|
|
18
18
|
liqSeat: ZCFSeat;
|
|
19
19
|
};
|
|
20
|
+
import type { AuctioneerPublicFacet } from '../auction/auctioneer.js';
|
|
20
21
|
import type { TimerService } from '@agoric/time';
|
|
21
22
|
import type { TimerWaker } from '@agoric/time';
|
|
22
23
|
import type { PriceQuote } from '@agoric/zoe/tools/types.js';
|
|
24
|
+
import type { makePrioritizedVaults } from './prioritizedVaults.js';
|
|
25
|
+
import type { SetStore } from '@agoric/store';
|
|
26
|
+
import type { MapStore } from '@agoric/store';
|
|
23
27
|
//# sourceMappingURL=liquidation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquidation.d.ts","sourceRoot":"","sources":["liquidation.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"liquidation.d.ts","sourceRoot":"","sources":["liquidation.js"],"names":[],"mappings":"AAwJO,gEAPI,IAAI,CAAC,qBAAqB,CAAC,SAC3B,IAAI,CAAC,YAAY,CAAC,kBAClB,UAAU,oBACV,UAAU,oBACV,UAAU,GACR,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,qBAAqB,CAAC,SAC3B,IAAI,CAAC,YAAY,CAAC,oBAClB,UAAU,GACR,IAAI,CA0BhB;AAsBM,2CAnBI,GAAG,4BAEX;IAA6C,KAAK,EAA1C,UAAU;IACsB,QAAQ,EAAxC,KAAK;IAC2B,MAAM,EAAtC,KAAK;CACb,qBAAQ,UAAU,CAAC,4BAA4B,CAAC,qBACxC,SAAS,KAAK,CAAC,aACf,KAAK,CAAC,KAAK,CAAC,mBACZ,KAAK,CAAC,KAAK,CAAC,GACV;IACR,SAAS,EAAE,SACf,KAAW,EACX;QAAQ,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;KAAE,CAC/D,CAAC;IACF,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;CAClB,CAiDH;2CAjSuC,0BAA0B;kCAJH,cAAc;gCAAd,cAAc;gCAChD,4BAA4B;2CAIjB,wBAAwB;8BAN3B,eAAe;8BAAf,eAAe"}
|
|
@@ -12,11 +12,15 @@ import { makeCancelTokenMaker } from '../auction/util.js';
|
|
|
12
12
|
|
|
13
13
|
const trace = makeTracer('LIQ');
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @import {MapStore, SetStore} from '@agoric/store';
|
|
17
|
+
* @import {RelativeTimeRecord, TimerService, TimerWaker} from '@agoric/time';
|
|
18
|
+
* @import {PriceQuote} from '@agoric/zoe/tools/types.js';
|
|
19
|
+
* @import {Schedule} from '../auction/scheduler.js';
|
|
20
|
+
* @import {TimestampRecord} from '@agoric/time';
|
|
21
|
+
* @import {AuctioneerPublicFacet} from '../auction/auctioneer.js';
|
|
22
|
+
* @import {makePrioritizedVaults} from './prioritizedVaults.js';
|
|
23
|
+
*/
|
|
20
24
|
|
|
21
25
|
const makeCancelToken = makeCancelTokenMaker('liq');
|
|
22
26
|
|
|
@@ -64,8 +68,8 @@ const cancelWakeups = timer => {
|
|
|
64
68
|
* @param {TimerWaker} opts.priceLockWaker
|
|
65
69
|
* @param {TimerWaker} opts.liquidationWaker
|
|
66
70
|
* @param {TimerWaker} opts.reschedulerWaker
|
|
67
|
-
* @param {
|
|
68
|
-
* @param {
|
|
71
|
+
* @param {Schedule} opts.nextAuctionSchedule
|
|
72
|
+
* @param {TimestampRecord} opts.now
|
|
69
73
|
* @param {ParamStateRecord} opts.params
|
|
70
74
|
* @returns {void}
|
|
71
75
|
*/
|
|
@@ -139,7 +143,7 @@ const setWakeups = ({
|
|
|
139
143
|
* Called by vaultDirector's resetWakeupsForNextAuction at start() and every
|
|
140
144
|
* time there's a "reschedule" wakeup.
|
|
141
145
|
*
|
|
142
|
-
* @param {ERef<
|
|
146
|
+
* @param {ERef<AuctioneerPublicFacet>} auctioneerPublicFacet
|
|
143
147
|
* @param {ERef<TimerService>} timer
|
|
144
148
|
* @param {TimerWaker} priceLockWaker
|
|
145
149
|
* @param {TimerWaker} liquidationWaker
|
|
@@ -205,7 +209,7 @@ harden(liquidationResults);
|
|
|
205
209
|
/**
|
|
206
210
|
* Watch governed params for change
|
|
207
211
|
*
|
|
208
|
-
* @param {ERef<
|
|
212
|
+
* @param {ERef<AuctioneerPublicFacet>} auctioneerPublicFacet
|
|
209
213
|
* @param {ERef<TimerService>} timer
|
|
210
214
|
* @param {TimerWaker} reschedulerWaker
|
|
211
215
|
* @returns {void}
|
|
@@ -242,9 +246,7 @@ export const watchForGovernanceChange = (
|
|
|
242
246
|
* @param {PriceQuote} collateralizationDetails.quote
|
|
243
247
|
* @param {Ratio} collateralizationDetails.interest
|
|
244
248
|
* @param {Ratio} collateralizationDetails.margin
|
|
245
|
-
* @param {ReturnType<
|
|
246
|
-
* typeof import('./prioritizedVaults.js').makePrioritizedVaults
|
|
247
|
-
* >} prioritizedVaults
|
|
249
|
+
* @param {ReturnType<typeof makePrioritizedVaults>} prioritizedVaults
|
|
248
250
|
* @param {SetStore<Vault>} liquidatingVaults
|
|
249
251
|
* @param {Brand<'nat'>} debtBrand
|
|
250
252
|
* @param {Brand<'nat'>} collateralBrand
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function calculateMinimumCollateralization(liquidationMargin: Ratio, liquidationPadding: Ratio): Ratio;
|
|
2
|
-
export function minimumPrice(quoteA: PriceQuote, quoteB?: PriceQuote
|
|
2
|
+
export function minimumPrice(quoteA: PriceQuote, quoteB?: PriceQuote): Ratio;
|
|
3
3
|
export function maxDebtForVault(quoteAmount: PriceQuote, liquidationMargin: Ratio, liquidationPadding: Ratio): Amount<"nat">;
|
|
4
4
|
export function calculateDebtCosts(currentDebt: Amount<"nat">, give: Amount<"nat">, want: Amount<"nat">, debtFee: Ratio): {
|
|
5
5
|
newDebt: import("@agoric/ertp").NatAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["math.js"],"names":[],"mappings":"AA4BO,qEAJI,KAAK,sBACL,KAAK,GACH,KAAK,CAKmC;AAS9C,qCAJI,UAAU,
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["math.js"],"names":[],"mappings":"AA4BO,qEAJI,KAAK,sBACL,KAAK,GACH,KAAK,CAKmC;AAS9C,qCAJI,UAAU,WACV,UAAU,GACR,KAAK,CAajB;AAYM,6CALI,UAAU,qBACV,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
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ceilMultiplyBy,
|
|
13
13
|
floorDivideBy,
|
|
14
14
|
ratioGTE,
|
|
15
|
-
} from '@agoric/
|
|
15
|
+
} from '@agoric/ertp/src/ratio.js';
|
|
16
16
|
import { priceFrom } from '../auction/util.js';
|
|
17
17
|
import { addSubtract } from '../contractSupport.js';
|
|
18
18
|
|