@agoric/inter-protocol 0.16.2-other-dev-1f26562.0 → 0.16.2-other-dev-3eb1a1d.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/README.md +6 -6
- package/package.json +42 -36
- package/scripts/build-bundles.js +5 -21
- package/src/auction/auctionBook.d.ts +147 -0
- package/src/auction/auctionBook.d.ts.map +1 -0
- package/src/auction/auctionBook.js +156 -150
- package/src/auction/auctionMath.d.ts +17 -0
- package/src/auction/auctionMath.d.ts.map +1 -0
- package/src/auction/auctionMath.js +81 -0
- package/src/auction/auctioneer.d.ts +69 -0
- package/src/auction/auctioneer.d.ts.map +1 -0
- package/src/auction/auctioneer.js +70 -59
- 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 +144 -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 +18 -16
- package/src/auction/scheduler.d.ts +50 -0
- package/src/auction/scheduler.d.ts.map +1 -0
- package/src/auction/scheduler.js +53 -47
- package/src/auction/sortedOffers.d.ts +8 -0
- package/src/auction/sortedOffers.d.ts.map +1 -0
- package/src/auction/sortedOffers.js +10 -9
- package/src/auction/util.d.ts +30 -0
- package/src/auction/util.d.ts.map +1 -0
- package/src/auction/util.js +9 -6
- package/src/clientSupport.d.ts +167 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +155 -97
- package/src/collectFees.d.ts +2 -0
- package/src/collectFees.d.ts.map +1 -0
- package/src/contractSupport.d.ts +28 -0
- package/src/contractSupport.d.ts.map +1 -0
- package/src/contractSupport.js +19 -13
- package/src/econCommitteeCharter.d.ts +40 -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 +23 -18
- package/src/price/README.md +13 -0
- package/src/price/fluxAggregatorContract.d.ts +71 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -0
- package/src/price/fluxAggregatorContract.js +64 -55
- package/src/price/fluxAggregatorKit.d.ts +103 -0
- package/src/price/fluxAggregatorKit.d.ts.map +1 -0
- package/src/price/fluxAggregatorKit.js +52 -40
- package/src/price/priceOracleKit.d.ts +38 -0
- package/src/price/priceOracleKit.d.ts.map +1 -0
- package/src/price/priceOracleKit.js +12 -14
- package/src/price/roundsManager.d.ts +204 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +131 -85
- package/src/proposals/README.md +2 -3
- package/src/proposals/add-auction.d.ts +109 -0
- package/src/proposals/add-auction.d.ts.map +1 -0
- package/src/proposals/add-auction.js +256 -0
- package/src/proposals/addAssetToVault.d.ts +173 -0
- package/src/proposals/addAssetToVault.d.ts.map +1 -0
- package/src/proposals/addAssetToVault.js +192 -40
- 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/deploy-price-feeds.d.ts +76 -0
- package/src/proposals/deploy-price-feeds.d.ts.map +1 -0
- package/src/proposals/deploy-price-feeds.js +316 -0
- package/src/proposals/econ-behaviors.d.ts +541 -0
- package/src/proposals/econ-behaviors.d.ts.map +1 -0
- package/src/proposals/econ-behaviors.js +64 -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 +109 -51
- package/src/proposals/replace-fee-distributor.d.ts +48 -0
- package/src/proposals/replace-fee-distributor.d.ts.map +1 -0
- package/src/proposals/replace-fee-distributor.js +195 -0
- package/src/proposals/replace-scaledPriceAuthorities.d.ts +30 -0
- package/src/proposals/replace-scaledPriceAuthorities.d.ts.map +1 -0
- package/src/proposals/replace-scaledPriceAuthorities.js +124 -0
- package/src/proposals/replaceElectorate.d.ts +55 -0
- package/src/proposals/replaceElectorate.d.ts.map +1 -0
- package/src/proposals/replaceElectorate.js +521 -0
- 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 +44 -29
- 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 +41 -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 +19 -0
- package/src/proposals/utils.d.ts.map +1 -0
- package/src/proposals/utils.js +43 -9
- package/src/provisionPool.d.ts +163 -0
- package/src/provisionPool.d.ts.map +1 -0
- package/src/provisionPool.js +122 -0
- package/src/provisionPoolKit.d.ts +359 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +522 -0
- package/src/psm/psm.d.ts +125 -0
- package/src/psm/psm.d.ts.map +1 -0
- package/src/psm/psm.js +80 -79
- package/src/psm/types-ambient.d.ts +2 -0
- package/src/psm/types-ambient.d.ts.map +1 -0
- package/src/psm/types-ambient.js +3 -0
- package/src/reserve/assetReserve.d.ts +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 +24 -30
- 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 +23 -0
- package/src/vaultFactory/liquidation.d.ts.map +1 -0
- package/src/vaultFactory/liquidation.js +37 -24
- package/src/vaultFactory/math.d.ts +11 -0
- package/src/vaultFactory/math.d.ts.map +1 -0
- package/src/vaultFactory/math.js +10 -9
- package/src/vaultFactory/orderedVaultStore.d.ts +93 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +8 -11
- package/src/vaultFactory/params.d.ts +140 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +52 -24
- package/src/vaultFactory/prioritizedVaults.d.ts +279 -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 +137 -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 +343 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +105 -99
- package/src/vaultFactory/vaultDirector.d.ts +341 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +86 -64
- package/src/vaultFactory/vaultFactory.d.ts +202 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +52 -33
- package/src/vaultFactory/vaultHolder.d.ts +126 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +11 -16
- package/src/vaultFactory/vaultKit.d.ts +32 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +5 -4
- package/src/vaultFactory/vaultManager.d.ts +674 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +257 -158
- package/CHANGELOG.md +0 -1041
- package/exported.js +0 -2
- package/scripts/add-collateral-core.js +0 -112
- package/scripts/deploy-contracts.js +0 -100
- package/scripts/init-core.js +0 -198
- package/scripts/invite-committee-core.js +0 -42
- package/scripts/manual-price-feed.js +0 -117
- package/scripts/price-feed-core.js +0 -104
- package/scripts/start-local-chain.sh +0 -84
- package/src/psm/types.js +0 -3
- package/src/typeGuards.js +0 -13
- package/src/vaultFactory/type-imports.js +0 -4
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '@agoric/zoe/exported.js';
|
|
5
|
-
import '@agoric/zoe/src/contracts/exported.js';
|
|
2
|
+
/// <reference types="@agoric/governance/exported" />
|
|
3
|
+
/// <reference types="@agoric/zoe/exported" />
|
|
6
4
|
|
|
7
5
|
// The vaultFactory owns a number of VaultManagers and a mint for Minted.
|
|
8
6
|
//
|
|
@@ -31,49 +29,65 @@ import { InvitationShape } from '../auction/params.js';
|
|
|
31
29
|
import { SHORTFALL_INVITATION_KEY, vaultDirectorParamTypes } from './params.js';
|
|
32
30
|
import { provideDirector } from './vaultDirector.js';
|
|
33
31
|
|
|
32
|
+
/** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
|
|
33
|
+
|
|
34
34
|
const trace = makeTracer('VF', true);
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* @typedef {ZCF<
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
37
|
+
* @typedef {ZCF<
|
|
38
|
+
* GovernanceTerms<import('./params').VaultDirectorParams> & {
|
|
39
|
+
* priceAuthority: ERef<PriceAuthority>;
|
|
40
|
+
* reservePublicFacet: AssetReservePublicFacet;
|
|
41
|
+
* timerService: import('@agoric/time').TimerService;
|
|
42
|
+
* }
|
|
43
|
+
* >} VaultFactoryZCF
|
|
43
44
|
*/
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
/** @type {ContractMeta} */
|
|
47
|
+
export const meta = {
|
|
48
|
+
privateArgsShape: M.splitRecord(
|
|
49
|
+
{
|
|
50
|
+
marshaller: M.remotable('Marshaller'),
|
|
51
|
+
storageNode: StorageNodeShape,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
// only necessary on first invocation, not subsequent
|
|
55
|
+
feeMintAccess: FeeMintAccessShape,
|
|
56
|
+
initialPoserInvitation: InvitationShape,
|
|
57
|
+
initialShortfallInvitation: InvitationShape,
|
|
58
|
+
},
|
|
59
|
+
),
|
|
60
|
+
upgradability: 'canUpgrade',
|
|
61
|
+
};
|
|
62
|
+
harden(meta);
|
|
58
63
|
|
|
59
64
|
/**
|
|
60
65
|
* @param {VaultFactoryZCF} zcf
|
|
61
66
|
* @param {{
|
|
62
|
-
* feeMintAccess: FeeMintAccess
|
|
63
|
-
* initialPoserInvitation: Invitation
|
|
64
|
-
* initialShortfallInvitation: Invitation
|
|
65
|
-
* storageNode: ERef<StorageNode
|
|
66
|
-
* marshaller: ERef<Marshaller
|
|
67
|
+
* feeMintAccess: FeeMintAccess;
|
|
68
|
+
* initialPoserInvitation: Invitation;
|
|
69
|
+
* initialShortfallInvitation: Invitation;
|
|
70
|
+
* storageNode: ERef<StorageNode>;
|
|
71
|
+
* marshaller: ERef<Marshaller>;
|
|
72
|
+
* auctioneerInstance: Instance;
|
|
73
|
+
* managerParams: Record<
|
|
74
|
+
* string,
|
|
75
|
+
* import('./params.js').VaultManagerParamOverrides
|
|
76
|
+
* >;
|
|
77
|
+
* directorParamOverrides: [object];
|
|
67
78
|
* }} privateArgs
|
|
68
|
-
* @param {import('@agoric/
|
|
79
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
69
80
|
*/
|
|
70
|
-
export const
|
|
81
|
+
export const start = async (zcf, privateArgs, baggage) => {
|
|
71
82
|
trace('prepare start', privateArgs, [...baggage.keys()]);
|
|
72
83
|
const {
|
|
73
84
|
initialPoserInvitation,
|
|
74
85
|
initialShortfallInvitation,
|
|
75
86
|
marshaller,
|
|
76
87
|
storageNode,
|
|
88
|
+
auctioneerInstance,
|
|
89
|
+
managerParams,
|
|
90
|
+
directorParamOverrides,
|
|
77
91
|
} = privateArgs;
|
|
78
92
|
|
|
79
93
|
trace('awaiting debtMint');
|
|
@@ -85,7 +99,10 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
85
99
|
mintedIssuerRecord: debtMint.getIssuerRecord(),
|
|
86
100
|
}));
|
|
87
101
|
|
|
88
|
-
const { timerService
|
|
102
|
+
const { timerService } = zcf.getTerms();
|
|
103
|
+
|
|
104
|
+
const zoe = zcf.getZoeService();
|
|
105
|
+
const auctioneerPublicFacet = E(zoe).getPublicFacet(auctioneerInstance);
|
|
89
106
|
|
|
90
107
|
const { makeRecorderKit, makeERecorderKit } = prepareRecorderKitMakers(
|
|
91
108
|
baggage,
|
|
@@ -102,7 +119,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
102
119
|
marshaller,
|
|
103
120
|
);
|
|
104
121
|
/** a powerful object; can modify the invitation */
|
|
105
|
-
trace('awaiting makeParamManagerFromTerms');
|
|
106
122
|
const vaultDirectorParamManager = await makeParamManagerFromTerms(
|
|
107
123
|
{
|
|
108
124
|
publisher: governanceSubscriptionKit.publication,
|
|
@@ -114,6 +130,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
114
130
|
[SHORTFALL_INVITATION_KEY]: initialShortfallInvitation,
|
|
115
131
|
},
|
|
116
132
|
vaultDirectorParamTypes,
|
|
133
|
+
directorParamOverrides,
|
|
117
134
|
);
|
|
118
135
|
|
|
119
136
|
const director = provideDirector(
|
|
@@ -128,6 +145,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
128
145
|
marshaller,
|
|
129
146
|
makeRecorderKit,
|
|
130
147
|
makeERecorderKit,
|
|
148
|
+
managerParams,
|
|
131
149
|
);
|
|
132
150
|
|
|
133
151
|
// cannot await because it would make remote calls during vat restart
|
|
@@ -145,5 +163,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
145
163
|
publicFacet: director.public,
|
|
146
164
|
});
|
|
147
165
|
};
|
|
166
|
+
harden(start);
|
|
148
167
|
|
|
149
|
-
/** @typedef {ContractOf<typeof
|
|
168
|
+
/** @typedef {ContractOf<typeof start>} VaultFactoryContract */
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export function prepareVaultHolder(baggage: import("@agoric/swingset-liveslots").Baggage, makeRecorderKit: import("@agoric/zoe/src/contractSupport/recorder.js").MakeRecorderKit): (vault: import("@endo/exo").Guarded<{
|
|
2
|
+
getVaultSeat(): ZCFSeat;
|
|
3
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
4
|
+
publicSubscribers: {
|
|
5
|
+
vault: {
|
|
6
|
+
description: string;
|
|
7
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
8
|
+
storagePath: Promise<string>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
12
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
13
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
14
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
15
|
+
}>;
|
|
16
|
+
vault: import("@endo/exo").Guarded<{
|
|
17
|
+
getPublicTopics(): {
|
|
18
|
+
vault: {
|
|
19
|
+
description: string;
|
|
20
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
21
|
+
storagePath: Promise<string>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
25
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
26
|
+
/**
|
|
27
|
+
* Starting a transfer revokes the vault holder. The associated updater
|
|
28
|
+
* will get a special notification that the vault is being transferred.
|
|
29
|
+
*/
|
|
30
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
31
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
32
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
33
|
+
getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
|
|
34
|
+
}>;
|
|
35
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
36
|
+
}>;
|
|
37
|
+
liquidating(): void;
|
|
38
|
+
liquidated(): void;
|
|
39
|
+
abortLiquidation(): string;
|
|
40
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
41
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
42
|
+
makeTransferInvitation(): Promise<Invitation<VaultKit>>;
|
|
43
|
+
getCollateralAmount(): Amount<"nat">;
|
|
44
|
+
getCurrentDebt(): Amount<"nat">;
|
|
45
|
+
getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
|
|
46
|
+
}>, storageNode: globalThis.StorageNode) => import("@endo/exo").GuardedKit<{
|
|
47
|
+
helper: {
|
|
48
|
+
/** @throws if this holder no longer owns the vault */
|
|
49
|
+
owned(): import("@endo/exo").Guarded<{
|
|
50
|
+
getVaultSeat(): ZCFSeat;
|
|
51
|
+
initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
|
|
52
|
+
publicSubscribers: {
|
|
53
|
+
vault: {
|
|
54
|
+
description: string;
|
|
55
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
56
|
+
storagePath: Promise<string>;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
60
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
61
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
62
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
63
|
+
}>;
|
|
64
|
+
vault: import("@endo/exo").Guarded<{
|
|
65
|
+
getPublicTopics(): {
|
|
66
|
+
vault: {
|
|
67
|
+
description: string;
|
|
68
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
69
|
+
storagePath: Promise<string>;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
73
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
74
|
+
/**
|
|
75
|
+
* Starting a transfer revokes the vault holder. The associated updater
|
|
76
|
+
* will get a special notification that the vault is being transferred.
|
|
77
|
+
*/
|
|
78
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
79
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
80
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
81
|
+
getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
|
|
82
|
+
}>;
|
|
83
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
84
|
+
}>;
|
|
85
|
+
liquidating(): void;
|
|
86
|
+
liquidated(): void;
|
|
87
|
+
abortLiquidation(): string;
|
|
88
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
89
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
90
|
+
makeTransferInvitation(): Promise<Invitation<VaultKit>>;
|
|
91
|
+
getCollateralAmount(): Amount<"nat">;
|
|
92
|
+
getCurrentDebt(): Amount<"nat">;
|
|
93
|
+
getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
|
|
94
|
+
}>;
|
|
95
|
+
getUpdater(): import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
96
|
+
};
|
|
97
|
+
invitationMakers: {
|
|
98
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
99
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
100
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
101
|
+
};
|
|
102
|
+
holder: {
|
|
103
|
+
getPublicTopics(): {
|
|
104
|
+
vault: {
|
|
105
|
+
description: string;
|
|
106
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
107
|
+
storagePath: Promise<string>;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
111
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
112
|
+
/**
|
|
113
|
+
* Starting a transfer revokes the vault holder. The associated updater
|
|
114
|
+
* will get a special notification that the vault is being transferred.
|
|
115
|
+
*/
|
|
116
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
117
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
118
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
119
|
+
getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
|
|
120
|
+
};
|
|
121
|
+
}>;
|
|
122
|
+
export type State = {
|
|
123
|
+
topicKit: import("@agoric/zoe/src/contractSupport/recorder.js").RecorderKit<VaultNotification>;
|
|
124
|
+
vault: Vault | null;
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=vaultHolder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vaultHolder.d.ts","sourceRoot":"","sources":["vaultHolder.js"],"names":[],"mappings":"AAiCO,4CAHI,OAAO,4BAA4B,EAAE,OAAO,mBAC5C,OAAO,6CAA6C,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;YAqExE;;;eAGG;;;;;;;;;;;;;;;;gCAqB4ywB,cAAiB;;;QAhEh0wB,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;oBAwCtD;;;uBAGG;;;;;;;;;;;;;;;;wCAqB4ywB,cAAiB;;;;;;;;;;;;;;;;;;;QAxBh0wB;;;WAGG;;;;;;GAoBV;oBAnHY;IACR,QAAQ,EAAE,OAAO,6CAA6C,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC/F,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
1
|
+
/** @file Use-object for the owner of a vault */
|
|
2
|
+
import { Fail } from '@endo/errors';
|
|
4
3
|
import { AmountShape } from '@agoric/ertp';
|
|
5
4
|
import { M, prepareExoClassKit } from '@agoric/vat-data';
|
|
6
5
|
import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js';
|
|
7
|
-
import { UnguardedHelperI } from '
|
|
8
|
-
|
|
9
|
-
const { Fail } = assert;
|
|
6
|
+
import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js';
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* @typedef {{
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* topicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<VaultNotification>;
|
|
11
|
+
* vault: Vault | null;
|
|
15
12
|
* }} State
|
|
16
13
|
*/
|
|
17
14
|
|
|
@@ -25,13 +22,13 @@ const HolderI = M.interface('holder', {
|
|
|
25
22
|
makeTransferInvitation: M.call().returns(M.promise()),
|
|
26
23
|
});
|
|
27
24
|
|
|
28
|
-
/** @type {{ [name: string]: [
|
|
25
|
+
/** @type {{ [name: string]: [description: string, valueShape: Pattern] }} */
|
|
29
26
|
const PUBLIC_TOPICS = {
|
|
30
27
|
vault: ['Vault holder status', M.any()],
|
|
31
28
|
};
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
|
-
* @param {import('@agoric/
|
|
31
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
35
32
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
36
33
|
*/
|
|
37
34
|
export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
@@ -48,22 +45,20 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
|
48
45
|
}),
|
|
49
46
|
},
|
|
50
47
|
/**
|
|
51
|
-
*
|
|
52
48
|
* @param {Vault} vault
|
|
53
49
|
* @param {StorageNode} storageNode
|
|
54
50
|
* @returns {State}
|
|
55
51
|
*/
|
|
56
52
|
(vault, storageNode) => {
|
|
57
53
|
// must be the fully synchronous maker because the kit is held in durable state
|
|
54
|
+
// @ts-expect-error XXX Patterns
|
|
58
55
|
const topicKit = makeRecorderKit(storageNode, PUBLIC_TOPICS.vault[1]);
|
|
59
56
|
|
|
60
57
|
return { topicKit, vault };
|
|
61
58
|
},
|
|
62
59
|
{
|
|
63
60
|
helper: {
|
|
64
|
-
/**
|
|
65
|
-
* @throws if this holder no longer owns the vault
|
|
66
|
-
*/
|
|
61
|
+
/** @throws if this holder no longer owns the vault */
|
|
67
62
|
owned() {
|
|
68
63
|
const { vault } = this.state;
|
|
69
64
|
if (!vault) {
|
|
@@ -104,8 +99,8 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
|
104
99
|
return this.facets.helper.owned().makeCloseInvitation();
|
|
105
100
|
},
|
|
106
101
|
/**
|
|
107
|
-
* Starting a transfer revokes the vault holder. The associated updater
|
|
108
|
-
* get a special notification that the vault is being transferred.
|
|
102
|
+
* Starting a transfer revokes the vault holder. The associated updater
|
|
103
|
+
* will get a special notification that the vault is being transferred.
|
|
109
104
|
*/
|
|
110
105
|
makeTransferInvitation() {
|
|
111
106
|
const vault = this.facets.helper.owned();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function prepareVaultKit(baggage: import("@agoric/swingset-liveslots").Baggage, makeRecorderKit: import("@agoric/zoe/src/contractSupport/recorder.js").MakeRecorderKit): (vault: Vault, storageNode: StorageNode) => {
|
|
2
|
+
publicSubscribers: {
|
|
3
|
+
vault: {
|
|
4
|
+
description: string;
|
|
5
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
6
|
+
storagePath: Promise<string>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
10
|
+
AdjustBalances(): Promise<Invitation<string, undefined>>;
|
|
11
|
+
CloseVault(): Promise<Invitation<string, undefined>>;
|
|
12
|
+
TransferVault(): Promise<Invitation<any, undefined>>;
|
|
13
|
+
}>;
|
|
14
|
+
vault: import("@endo/exo").Guarded<{
|
|
15
|
+
getPublicTopics(): {
|
|
16
|
+
vault: {
|
|
17
|
+
description: string;
|
|
18
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
19
|
+
storagePath: Promise<string>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
makeAdjustBalancesInvitation(): Promise<Invitation<string, undefined>>;
|
|
23
|
+
makeCloseInvitation(): Promise<Invitation<string, undefined>>;
|
|
24
|
+
makeTransferInvitation(): Promise<Invitation<any, undefined>>;
|
|
25
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
26
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
27
|
+
getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
|
|
28
|
+
}>;
|
|
29
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
30
|
+
};
|
|
31
|
+
export type VaultKit = ReturnType<ReturnType<typeof prepareVaultKit>>;
|
|
32
|
+
//# sourceMappingURL=vaultKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vaultKit.d.ts","sourceRoot":"","sources":["vaultKit.js"],"names":[],"mappings":"AAgBO,yCAHI,OAAO,4BAA4B,EAAE,OAAO,mBAC5C,OAAO,6CAA6C,EAAE,eAAe,WASnE,KAAK,eACL,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBvB;uBAEa,UAAU,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/// <reference types="@agoric/zoe/exported" />
|
|
4
4
|
|
|
5
5
|
import { makeTracer } from '@agoric/internal';
|
|
6
6
|
import { prepareVaultHolder } from './vaultHolder.js';
|
|
@@ -8,9 +8,10 @@ import { prepareVaultHolder } from './vaultHolder.js';
|
|
|
8
8
|
const trace = makeTracer('VK', true);
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Wrap the VaultHolder duration object in a record suitable for the result of
|
|
11
|
+
* Wrap the VaultHolder duration object in a record suitable for the result of
|
|
12
|
+
* an invitation.
|
|
12
13
|
*
|
|
13
|
-
* @param {import('@agoric/
|
|
14
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
14
15
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
15
16
|
*/
|
|
16
17
|
export const prepareVaultKit = (baggage, makeRecorderKit) => {
|
|
@@ -43,4 +44,4 @@ export const prepareVaultKit = (baggage, makeRecorderKit) => {
|
|
|
43
44
|
return makeVaultKit;
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
/** @typedef {
|
|
47
|
+
/** @typedef {ReturnType<ReturnType<typeof prepareVaultKit>>} VaultKit */
|