@agoric/inter-protocol 0.16.2-other-dev-8f8782b.0 → 0.16.2-other-dev-fbe72e7.0.fbe72e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +46 -39
- package/scripts/build-bundles.js +5 -21
- package/src/auction/auctionBook.d.ts +147 -0
- package/src/auction/auctionBook.d.ts.map +1 -0
- package/src/auction/auctionBook.js +182 -151
- package/src/auction/auctionMath.d.ts +17 -0
- package/src/auction/auctionMath.d.ts.map +1 -0
- package/src/auction/auctionMath.js +81 -0
- package/src/auction/auctioneer.d.ts +70 -0
- package/src/auction/auctioneer.d.ts.map +1 -0
- package/src/auction/auctioneer.js +72 -59
- package/src/auction/offerBook.d.ts +46 -0
- package/src/auction/offerBook.d.ts.map +1 -0
- package/src/auction/offerBook.js +17 -12
- package/src/auction/params.d.ts +145 -0
- package/src/auction/params.d.ts.map +1 -0
- package/src/auction/params.js +11 -9
- package/src/auction/scheduleMath.d.ts +5 -0
- package/src/auction/scheduleMath.d.ts.map +1 -0
- package/src/auction/scheduleMath.js +18 -16
- package/src/auction/scheduler.d.ts +50 -0
- package/src/auction/scheduler.d.ts.map +1 -0
- package/src/auction/scheduler.js +53 -47
- package/src/auction/sortedOffers.d.ts +8 -0
- package/src/auction/sortedOffers.d.ts.map +1 -0
- package/src/auction/sortedOffers.js +10 -9
- package/src/auction/util.d.ts +31 -0
- package/src/auction/util.d.ts.map +1 -0
- package/src/auction/util.js +12 -6
- package/src/clientSupport.d.ts +168 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +161 -98
- package/src/collectFees.d.ts +2 -0
- package/src/collectFees.d.ts.map +1 -0
- package/src/contractSupport.d.ts +28 -0
- package/src/contractSupport.d.ts.map +1 -0
- package/src/contractSupport.js +19 -13
- package/src/econCommitteeCharter.d.ts +43 -0
- package/src/econCommitteeCharter.d.ts.map +1 -0
- package/src/econCommitteeCharter.js +25 -20
- package/src/feeDistributor.d.ts +224 -0
- package/src/feeDistributor.d.ts.map +1 -0
- package/src/feeDistributor.js +41 -33
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +1 -0
- package/src/interest-math.d.ts +4 -0
- package/src/interest-math.d.ts.map +1 -0
- package/src/interest-math.js +5 -1
- package/src/interest.d.ts +30 -0
- package/src/interest.d.ts.map +1 -0
- package/src/interest.js +25 -23
- package/src/price/README.md +14 -1
- package/src/price/fluxAggregatorContract.d.ts +71 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -0
- package/src/price/fluxAggregatorContract.js +64 -55
- package/src/price/fluxAggregatorKit.d.ts +104 -0
- package/src/price/fluxAggregatorKit.d.ts.map +1 -0
- package/src/price/fluxAggregatorKit.js +55 -42
- package/src/price/priceOracleKit.d.ts +39 -0
- package/src/price/priceOracleKit.d.ts.map +1 -0
- package/src/price/priceOracleKit.js +17 -15
- package/src/price/roundsManager.d.ts +204 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +132 -85
- package/src/proposals/README.md +2 -3
- package/src/proposals/add-auction.js +285 -0
- package/src/proposals/addAssetToVault.js +192 -40
- package/src/proposals/committee-proposal.js +25 -31
- package/src/proposals/core-proposal.js +9 -11
- package/src/proposals/deploy-price-feeds.js +341 -0
- package/src/proposals/econ-behaviors.js +84 -49
- package/src/proposals/price-feed-proposal.js +109 -51
- package/src/proposals/replace-fee-distributor.js +198 -0
- package/src/proposals/replace-scaledPriceAuthorities.js +124 -0
- package/src/proposals/replaceElectorate.js +610 -0
- package/src/proposals/startEconCommittee.js +2 -2
- package/src/proposals/startPSM.js +44 -29
- package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
- package/src/proposals/upgrade-vaults.js +207 -0
- package/src/proposals/utils.d.ts +21 -0
- package/src/proposals/utils.d.ts.map +1 -0
- package/src/proposals/utils.js +66 -9
- package/src/proposals/withdraw-reserve-proposal.js +63 -0
- package/src/provisionPool.d.ts +69 -0
- package/src/provisionPool.d.ts.map +1 -0
- package/src/provisionPool.js +138 -0
- package/src/provisionPoolKit.d.ts +129 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +608 -0
- package/src/psm/psm.d.ts +133 -0
- package/src/psm/psm.d.ts.map +1 -0
- package/src/psm/psm.js +85 -79
- package/src/psm/types-ambient.d.ts +2 -0
- package/src/psm/types-ambient.d.ts.map +1 -0
- package/src/psm/types-ambient.js +3 -0
- package/src/reserve/assetReserve.d.ts +58 -0
- package/src/reserve/assetReserve.d.ts.map +1 -0
- package/src/reserve/assetReserve.js +42 -34
- package/src/reserve/assetReserveKit.d.ts +103 -0
- package/src/reserve/assetReserveKit.d.ts.map +1 -0
- package/src/reserve/assetReserveKit.js +134 -32
- package/src/reserve/params.d.ts +16 -0
- package/src/reserve/params.d.ts.map +1 -0
- package/src/reserve/params.js +8 -2
- package/src/tokens.d.ts +3 -0
- package/src/tokens.d.ts.map +1 -0
- package/src/tokens.js +5 -0
- package/src/vaultFactory/burn.d.ts +2 -0
- package/src/vaultFactory/burn.d.ts.map +1 -0
- package/src/vaultFactory/burn.js +1 -1
- package/src/vaultFactory/liquidation.d.ts +25 -0
- package/src/vaultFactory/liquidation.d.ts.map +1 -0
- package/src/vaultFactory/liquidation.js +37 -24
- package/src/vaultFactory/math.d.ts +11 -0
- package/src/vaultFactory/math.d.ts.map +1 -0
- package/src/vaultFactory/math.js +11 -10
- package/src/vaultFactory/orderedVaultStore.d.ts +94 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +9 -10
- package/src/vaultFactory/params.d.ts +143 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +56 -25
- package/src/vaultFactory/prioritizedVaults.d.ts +280 -0
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
- package/src/vaultFactory/prioritizedVaults.js +7 -4
- package/src/vaultFactory/proceeds.d.ts +35 -0
- package/src/vaultFactory/proceeds.d.ts.map +1 -0
- package/src/vaultFactory/proceeds.js +26 -18
- package/src/vaultFactory/storeUtils.d.ts +25 -0
- package/src/vaultFactory/storeUtils.d.ts.map +1 -0
- package/src/vaultFactory/storeUtils.js +10 -12
- package/src/vaultFactory/types-ambient.d.ts +137 -0
- package/src/vaultFactory/types-ambient.d.ts.map +1 -0
- package/src/vaultFactory/{types.js → types-ambient.js} +47 -44
- package/src/vaultFactory/vault.d.ts +344 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +107 -100
- package/src/vaultFactory/vaultDirector.d.ts +347 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +94 -64
- package/src/vaultFactory/vaultFactory.d.ts +250 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +56 -33
- package/src/vaultFactory/vaultHolder.d.ts +170 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +14 -15
- package/src/vaultFactory/vaultKit.d.ts +33 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +9 -4
- package/src/vaultFactory/vaultManager.d.ts +676 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +286 -167
- package/CHANGELOG.md +0 -1041
- package/exported.js +0 -2
- package/scripts/add-collateral-core.js +0 -112
- package/scripts/deploy-contracts.js +0 -100
- package/scripts/init-core.js +0 -198
- package/scripts/invite-committee-core.js +0 -42
- package/scripts/manual-price-feed.js +0 -117
- package/scripts/price-feed-core.js +0 -104
- package/scripts/start-local-chain.sh +0 -84
- package/src/psm/types.js +0 -3
- package/src/typeGuards.js +0 -13
- package/src/vaultFactory/type-imports.js +0 -4
|
@@ -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,69 @@ 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
|
+
/**
|
|
33
|
+
* @import {ContractMeta, FeeMintAccess, HandleOffer, Invitation, OfferHandler, TransferPart, ZCF, ZCFMint, ZCFSeat} from '@agoric/zoe';
|
|
34
|
+
* @import {ContractOf} from '@agoric/zoe/src/zoeService/utils.js';
|
|
35
|
+
* @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
|
|
36
|
+
*/
|
|
37
|
+
|
|
34
38
|
const trace = makeTracer('VF', true);
|
|
35
39
|
|
|
36
40
|
/**
|
|
37
|
-
* @typedef {ZCF<
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* @typedef {ZCF<
|
|
42
|
+
* GovernanceTerms<import('./params').VaultDirectorParams> & {
|
|
43
|
+
* priceAuthority: ERef<PriceAuthority>;
|
|
44
|
+
* reservePublicFacet: AssetReservePublicFacet;
|
|
45
|
+
* timerService: import('@agoric/time').TimerService;
|
|
46
|
+
* }
|
|
47
|
+
* >} VaultFactoryZCF
|
|
43
48
|
*/
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
/** @type {ContractMeta} */
|
|
51
|
+
export const meta = {
|
|
52
|
+
privateArgsShape: M.splitRecord(
|
|
53
|
+
{
|
|
54
|
+
marshaller: M.remotable('Marshaller'),
|
|
55
|
+
storageNode: StorageNodeShape,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
// only necessary on first invocation, not subsequent
|
|
59
|
+
feeMintAccess: FeeMintAccessShape,
|
|
60
|
+
initialPoserInvitation: InvitationShape,
|
|
61
|
+
initialShortfallInvitation: InvitationShape,
|
|
62
|
+
},
|
|
63
|
+
),
|
|
64
|
+
upgradability: 'canUpgrade',
|
|
65
|
+
};
|
|
66
|
+
harden(meta);
|
|
58
67
|
|
|
59
68
|
/**
|
|
60
69
|
* @param {VaultFactoryZCF} zcf
|
|
61
70
|
* @param {{
|
|
62
|
-
* feeMintAccess: FeeMintAccess
|
|
63
|
-
* initialPoserInvitation: Invitation
|
|
64
|
-
* initialShortfallInvitation: Invitation
|
|
65
|
-
* storageNode: ERef<StorageNode
|
|
66
|
-
* marshaller: ERef<Marshaller
|
|
71
|
+
* feeMintAccess: FeeMintAccess;
|
|
72
|
+
* initialPoserInvitation: Invitation;
|
|
73
|
+
* initialShortfallInvitation: Invitation;
|
|
74
|
+
* storageNode: ERef<StorageNode>;
|
|
75
|
+
* marshaller: ERef<Marshaller>;
|
|
76
|
+
* auctioneerInstance: Instance<import('../auction/auctioneer.js').start>;
|
|
77
|
+
* managerParams: Record<
|
|
78
|
+
* string,
|
|
79
|
+
* import('./params.js').VaultManagerParamOverrides
|
|
80
|
+
* >;
|
|
81
|
+
* directorParamOverrides: [object];
|
|
67
82
|
* }} privateArgs
|
|
68
|
-
* @param {import('@agoric/
|
|
83
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
69
84
|
*/
|
|
70
|
-
export const
|
|
85
|
+
export const start = async (zcf, privateArgs, baggage) => {
|
|
71
86
|
trace('prepare start', privateArgs, [...baggage.keys()]);
|
|
72
87
|
const {
|
|
73
88
|
initialPoserInvitation,
|
|
74
89
|
initialShortfallInvitation,
|
|
75
90
|
marshaller,
|
|
76
91
|
storageNode,
|
|
92
|
+
auctioneerInstance,
|
|
93
|
+
managerParams,
|
|
94
|
+
directorParamOverrides,
|
|
77
95
|
} = privateArgs;
|
|
78
96
|
|
|
79
97
|
trace('awaiting debtMint');
|
|
@@ -85,7 +103,10 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
85
103
|
mintedIssuerRecord: debtMint.getIssuerRecord(),
|
|
86
104
|
}));
|
|
87
105
|
|
|
88
|
-
const { timerService
|
|
106
|
+
const { timerService } = zcf.getTerms();
|
|
107
|
+
|
|
108
|
+
const zoe = zcf.getZoeService();
|
|
109
|
+
const auctioneerPublicFacet = E(zoe).getPublicFacet(auctioneerInstance);
|
|
89
110
|
|
|
90
111
|
const { makeRecorderKit, makeERecorderKit } = prepareRecorderKitMakers(
|
|
91
112
|
baggage,
|
|
@@ -102,7 +123,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
102
123
|
marshaller,
|
|
103
124
|
);
|
|
104
125
|
/** a powerful object; can modify the invitation */
|
|
105
|
-
trace('awaiting makeParamManagerFromTerms');
|
|
106
126
|
const vaultDirectorParamManager = await makeParamManagerFromTerms(
|
|
107
127
|
{
|
|
108
128
|
publisher: governanceSubscriptionKit.publication,
|
|
@@ -114,6 +134,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
114
134
|
[SHORTFALL_INVITATION_KEY]: initialShortfallInvitation,
|
|
115
135
|
},
|
|
116
136
|
vaultDirectorParamTypes,
|
|
137
|
+
directorParamOverrides,
|
|
117
138
|
);
|
|
118
139
|
|
|
119
140
|
const director = provideDirector(
|
|
@@ -128,6 +149,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
128
149
|
marshaller,
|
|
129
150
|
makeRecorderKit,
|
|
130
151
|
makeERecorderKit,
|
|
152
|
+
managerParams,
|
|
131
153
|
);
|
|
132
154
|
|
|
133
155
|
// cannot await because it would make remote calls during vat restart
|
|
@@ -145,5 +167,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
145
167
|
publicFacet: director.public,
|
|
146
168
|
});
|
|
147
169
|
};
|
|
170
|
+
harden(start);
|
|
148
171
|
|
|
149
|
-
/** @typedef {ContractOf<typeof
|
|
172
|
+
/** @typedef {ContractOf<typeof start>} VaultFactoryContract */
|
|
@@ -0,0 +1,170 @@
|
|
|
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(): globalThis.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<globalThis.Invitation<string, undefined>>;
|
|
13
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
14
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
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<globalThis.Invitation<string, undefined>>;
|
|
25
|
+
makeCloseInvitation(): Promise<globalThis.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<globalThis.Invitation</*elided*/ any>>;
|
|
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<globalThis.Invitation<string, undefined>>;
|
|
41
|
+
makeCloseInvitation(): Promise<globalThis.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(): globalThis.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<globalThis.Invitation<string, undefined>>;
|
|
61
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
62
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
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<globalThis.Invitation<string, undefined>>;
|
|
73
|
+
makeCloseInvitation(): Promise<globalThis.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<globalThis.Invitation</*elided*/ any>>;
|
|
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<globalThis.Invitation<string, undefined>>;
|
|
89
|
+
makeCloseInvitation(): Promise<globalThis.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<globalThis.Invitation<string, undefined>>;
|
|
99
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
100
|
+
TransferVault(): Promise<globalThis.Invitation<{
|
|
101
|
+
publicSubscribers: {
|
|
102
|
+
vault: {
|
|
103
|
+
description: string;
|
|
104
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
105
|
+
storagePath: Promise<string>;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
invitationMakers: import("@endo/exo").Guarded</*elided*/ any>;
|
|
109
|
+
vault: import("@endo/exo").Guarded<{
|
|
110
|
+
getPublicTopics(): {
|
|
111
|
+
vault: {
|
|
112
|
+
description: string;
|
|
113
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
114
|
+
storagePath: Promise<string>;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
118
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
119
|
+
/**
|
|
120
|
+
* Starting a transfer revokes the vault holder. The associated updater
|
|
121
|
+
* will get a special notification that the vault is being transferred.
|
|
122
|
+
*/
|
|
123
|
+
makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
124
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
125
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
126
|
+
getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
|
|
127
|
+
}>;
|
|
128
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
129
|
+
}>>;
|
|
130
|
+
};
|
|
131
|
+
holder: {
|
|
132
|
+
getPublicTopics(): {
|
|
133
|
+
vault: {
|
|
134
|
+
description: string;
|
|
135
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
136
|
+
storagePath: Promise<string>;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
140
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
141
|
+
/**
|
|
142
|
+
* Starting a transfer revokes the vault holder. The associated updater
|
|
143
|
+
* will get a special notification that the vault is being transferred.
|
|
144
|
+
*/
|
|
145
|
+
makeTransferInvitation(): Promise<globalThis.Invitation<{
|
|
146
|
+
publicSubscribers: {
|
|
147
|
+
vault: {
|
|
148
|
+
description: string;
|
|
149
|
+
subscriber: globalThis.Subscriber<VaultNotification>;
|
|
150
|
+
storagePath: Promise<string>;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
154
|
+
AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
|
|
155
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
156
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
157
|
+
}>;
|
|
158
|
+
vault: import("@endo/exo").Guarded</*elided*/ any>;
|
|
159
|
+
vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
|
|
160
|
+
}>>;
|
|
161
|
+
getCollateralAmount(): import("@agoric/ertp").NatAmount;
|
|
162
|
+
getCurrentDebt(): import("@agoric/ertp").NatAmount;
|
|
163
|
+
getNormalizedDebt(): import("./storeUtils").NormalizedDebt;
|
|
164
|
+
};
|
|
165
|
+
}>;
|
|
166
|
+
export type State = {
|
|
167
|
+
topicKit: import("@agoric/zoe/src/contractSupport/recorder.js").RecorderKit<VaultNotification>;
|
|
168
|
+
vault: Vault | null;
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=vaultHolder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vaultHolder.d.ts","sourceRoot":"","sources":["vaultHolder.js"],"names":[],"mappings":"AAqCO,4CAHI,OAAO,4BAA4B,EAAE,OAAO,mBAC5C,OAAO,6CAA6C,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;YAqExE;;;eAGG;;;;;;;;;;;;;;;;;;;QA3CH,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;oBAwCtD;;;uBAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAHH;;;mBAGG;;;;;;;;;;;;;;;;;;;QAHH;;;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,18 @@
|
|
|
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 '
|
|
6
|
+
import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js';
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @import {Key, Pattern} from '@endo/patterns';
|
|
10
|
+
*/
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @typedef {{
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* topicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<VaultNotification>;
|
|
15
|
+
* vault: Vault | null;
|
|
15
16
|
* }} State
|
|
16
17
|
*/
|
|
17
18
|
|
|
@@ -25,13 +26,13 @@ const HolderI = M.interface('holder', {
|
|
|
25
26
|
makeTransferInvitation: M.call().returns(M.promise()),
|
|
26
27
|
});
|
|
27
28
|
|
|
28
|
-
/** @type {{ [name: string]: [
|
|
29
|
+
/** @type {{ [name: string]: [description: string, valueShape: Pattern] }} */
|
|
29
30
|
const PUBLIC_TOPICS = {
|
|
30
31
|
vault: ['Vault holder status', M.any()],
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
|
-
* @param {import('@agoric/
|
|
35
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
35
36
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
36
37
|
*/
|
|
37
38
|
export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
@@ -48,22 +49,20 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
|
48
49
|
}),
|
|
49
50
|
},
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
52
|
* @param {Vault} vault
|
|
53
53
|
* @param {StorageNode} storageNode
|
|
54
54
|
* @returns {State}
|
|
55
55
|
*/
|
|
56
56
|
(vault, storageNode) => {
|
|
57
57
|
// must be the fully synchronous maker because the kit is held in durable state
|
|
58
|
+
// @ts-expect-error XXX Patterns
|
|
58
59
|
const topicKit = makeRecorderKit(storageNode, PUBLIC_TOPICS.vault[1]);
|
|
59
60
|
|
|
60
61
|
return { topicKit, vault };
|
|
61
62
|
},
|
|
62
63
|
{
|
|
63
64
|
helper: {
|
|
64
|
-
/**
|
|
65
|
-
* @throws if this holder no longer owns the vault
|
|
66
|
-
*/
|
|
65
|
+
/** @throws if this holder no longer owns the vault */
|
|
67
66
|
owned() {
|
|
68
67
|
const { vault } = this.state;
|
|
69
68
|
if (!vault) {
|
|
@@ -104,8 +103,8 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => {
|
|
|
104
103
|
return this.facets.helper.owned().makeCloseInvitation();
|
|
105
104
|
},
|
|
106
105
|
/**
|
|
107
|
-
* Starting a transfer revokes the vault holder. The associated updater
|
|
108
|
-
* get a special notification that the vault is being transferred.
|
|
106
|
+
* Starting a transfer revokes the vault holder. The associated updater
|
|
107
|
+
* will get a special notification that the vault is being transferred.
|
|
109
108
|
*/
|
|
110
109
|
makeTransferInvitation() {
|
|
111
110
|
const vault = this.facets.helper.owned();
|
|
@@ -0,0 +1,33 @@
|
|
|
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<globalThis.Invitation<string, undefined>>;
|
|
11
|
+
CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
|
|
12
|
+
TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
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<globalThis.Invitation<string, undefined>>;
|
|
23
|
+
makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
|
|
24
|
+
makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
|
|
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 = EReturn<EReturn<typeof prepareVaultKit>>;
|
|
32
|
+
import type { EReturn } from '@endo/far';
|
|
33
|
+
//# sourceMappingURL=vaultKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vaultKit.d.ts","sourceRoot":"","sources":["vaultKit.js"],"names":[],"mappings":"AAoBO,yCAHI,OAAO,4BAA4B,EAAE,OAAO,mBAC5C,OAAO,6CAA6C,EAAE,eAAe,WASnE,KAAK,eACL,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBvB;uBAEa,QAAQ,QAAQ,OAAO,eAAe,CAAC,CAAC;6BAxC5B,WAAW"}
|
|
@@ -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,14 @@ import { prepareVaultHolder } from './vaultHolder.js';
|
|
|
8
8
|
const trace = makeTracer('VK', true);
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* @import {EReturn} from '@endo/far';
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Wrap the VaultHolder duration object in a record suitable for the result of
|
|
16
|
+
* an invitation.
|
|
12
17
|
*
|
|
13
|
-
* @param {import('@agoric/
|
|
18
|
+
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
14
19
|
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
|
|
15
20
|
*/
|
|
16
21
|
export const prepareVaultKit = (baggage, makeRecorderKit) => {
|
|
@@ -43,4 +48,4 @@ export const prepareVaultKit = (baggage, makeRecorderKit) => {
|
|
|
43
48
|
return makeVaultKit;
|
|
44
49
|
};
|
|
45
50
|
|
|
46
|
-
/** @typedef {
|
|
51
|
+
/** @typedef {EReturn<EReturn<typeof prepareVaultKit>>} VaultKit */
|