@agoric/inter-protocol 0.17.0-u18.3 → 0.17.0-u18.5
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 +4 -4
- package/src/proposals/add-auction.d.ts +6 -1
- package/src/proposals/add-auction.d.ts.map +1 -1
- package/src/proposals/add-auction.js +31 -2
- package/src/proposals/deploy-price-feeds.d.ts +6 -1
- package/src/proposals/deploy-price-feeds.d.ts.map +1 -1
- package/src/proposals/deploy-price-feeds.js +28 -3
- package/src/proposals/replaceElectorate.d.ts +7 -0
- package/src/proposals/replaceElectorate.d.ts.map +1 -1
- package/src/proposals/replaceElectorate.js +35 -5
- package/src/proposals/utils.d.ts +1 -0
- package/src/proposals/utils.d.ts.map +1 -1
- package/src/proposals/utils.js +20 -0
- package/src/vaultFactory/vaultManager.d.ts +2 -2
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +52 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/inter-protocol",
|
|
3
|
-
"version": "0.17.0-u18.
|
|
3
|
+
"version": "0.17.0-u18.5",
|
|
4
4
|
"description": "Core cryptoeconomy contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@agoric/store": "^0.9.3-u18.0",
|
|
39
39
|
"@agoric/time": "^0.3.3-u18.0",
|
|
40
40
|
"@agoric/vat-data": "^0.5.3-u18.0",
|
|
41
|
-
"@agoric/vats": "^0.16.0-u18.
|
|
41
|
+
"@agoric/vats": "^0.16.0-u18.4",
|
|
42
42
|
"@agoric/zoe": "^0.26.3-u18.0",
|
|
43
43
|
"@endo/captp": "^4.4.2",
|
|
44
44
|
"@endo/errors": "^1.2.7",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"jessie.js": "^0.3.4"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@agoric/smart-wallet": "^0.5.4-u18.
|
|
53
|
+
"@agoric/smart-wallet": "^0.5.4-u18.4",
|
|
54
54
|
"@agoric/swingset-liveslots": "^0.10.3-u18.0",
|
|
55
55
|
"@agoric/swingset-vat": "^0.33.0-u18.0",
|
|
56
56
|
"@agoric/zone": "^0.3.0-u18.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"typeCoverage": {
|
|
85
85
|
"atLeast": 95.8
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "ff46c4aacd7b01ce8ea1fa14b77c187efa9a3b7f"
|
|
88
88
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function addAuction({ consume: { agoricNamesAdmin, auctioneerKit: legacyKitP, board, chainStorage, chainTimerService, economicCommitteeCreatorFacet: electorateCreatorFacet, governedContractKits: governedContractKitsP, priceAuthority8400, zoe, }, produce: { auctioneerKit: produceAuctioneerKit, auctionUpgradeNewInstance, auctionUpgradeNewGovCreator, newContractGovBundleId, }, instance: { consume: { reserve: reserveInstance }, produce: { auctioneer: auctionInstance }, }, installation: { consume: { auctioneer: auctioneerInstallationP }, }, issuer: { consume: { [Stable.symbol]: stableIssuerP }, }, }: import("./econ-behaviors.js").EconomyBootstrapPowers & interlockPowers, { options: { contractGovernorRef: contractGovernorBundle, contractGovernorInstallation, }, }: {
|
|
1
|
+
export function addAuction({ consume: { agoricNamesAdmin, auctioneerKit: legacyKitP, board, chainStorage, chainTimerService, economicCommitteeCreatorFacet: electorateCreatorFacet, governedContractKits: governedContractKitsP, priceAuthority8400, retiredContractInstances: retiredContractInstancesP, zoe, }, produce: { auctioneerKit: produceAuctioneerKit, auctionUpgradeNewInstance, auctionUpgradeNewGovCreator, newContractGovBundleId, retiredContractInstances: produceRetiredInstances, }, instance: { consume: { reserve: reserveInstance }, produce: { auctioneer: auctionInstance }, }, installation: { consume: { auctioneer: auctioneerInstallationP }, }, issuer: { consume: { [Stable.symbol]: stableIssuerP }, }, }: import("./econ-behaviors.js").EconomyBootstrapPowers & interlockPowers, { options: { contractGovernorRef: contractGovernorBundle, contractGovernorInstallation, }, }: {
|
|
2
2
|
options: {
|
|
3
3
|
contractGovernorRef: {
|
|
4
4
|
bundleID: string;
|
|
@@ -18,6 +18,7 @@ export const ADD_AUCTION_MANIFEST: {
|
|
|
18
18
|
economicCommitteeCreatorFacet: boolean;
|
|
19
19
|
governedContractKits: boolean;
|
|
20
20
|
priceAuthority8400: boolean;
|
|
21
|
+
retiredContractInstances: boolean;
|
|
21
22
|
zoe: boolean;
|
|
22
23
|
};
|
|
23
24
|
produce: {
|
|
@@ -25,6 +26,7 @@ export const ADD_AUCTION_MANIFEST: {
|
|
|
25
26
|
auctionUpgradeNewInstance: boolean;
|
|
26
27
|
auctionUpgradeNewGovCreator: boolean;
|
|
27
28
|
newContractGovBundleId: boolean;
|
|
29
|
+
retiredContractInstances: boolean;
|
|
28
30
|
};
|
|
29
31
|
instance: {
|
|
30
32
|
consume: {
|
|
@@ -62,6 +64,7 @@ export function getManifestForAddAuction({ restoreRef }: {
|
|
|
62
64
|
economicCommitteeCreatorFacet: boolean;
|
|
63
65
|
governedContractKits: boolean;
|
|
64
66
|
priceAuthority8400: boolean;
|
|
67
|
+
retiredContractInstances: boolean;
|
|
65
68
|
zoe: boolean;
|
|
66
69
|
};
|
|
67
70
|
produce: {
|
|
@@ -69,6 +72,7 @@ export function getManifestForAddAuction({ restoreRef }: {
|
|
|
69
72
|
auctionUpgradeNewInstance: boolean;
|
|
70
73
|
auctionUpgradeNewGovCreator: boolean;
|
|
71
74
|
newContractGovBundleId: boolean;
|
|
75
|
+
retiredContractInstances: boolean;
|
|
72
76
|
};
|
|
73
77
|
instance: {
|
|
74
78
|
consume: {
|
|
@@ -104,6 +108,7 @@ export type interlockPowers = PromiseSpaceOf<{
|
|
|
104
108
|
auctionUpgradeNewInstance: Instance;
|
|
105
109
|
auctionUpgradeNewGovCreator: any;
|
|
106
110
|
newContractGovBundleId: string;
|
|
111
|
+
retiredContractInstances: MapStore<string, Instance>;
|
|
107
112
|
}>;
|
|
108
113
|
import { Stable } from '@agoric/internal/src/tokens.js';
|
|
109
114
|
//# sourceMappingURL=add-auction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-auction.d.ts","sourceRoot":"","sources":["add-auction.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-auction.d.ts","sourceRoot":"","sources":["add-auction.js"],"names":[],"mappings":"AA4BO,0sBATI,OAAO,qBAAqB,EAAE,sBAAsB,GAC1D,eAAe,gGACT;IACN,OAAO,EAAE;QACP,mBAAmB,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1C,4BAA4B,EAAE,YAAY,CAAC;KAC5C,CAAC;CACH,iBAuMH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCG;AASI,yDAHJ;IAAmB,UAAU,EAArB,GAAG;CACX,0CAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBb;8BAlRY,cAAc,CAAC;IACvB,yBAAyB,EAAE,QAAQ,CAAC;IACpC,2BAA2B,EAAE,GAAG,CAAC;IACjC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wBAAwB,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACtD,CAAC;uBAbkB,gCAAgC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
|
|
2
2
|
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
|
|
3
|
-
import { E } from '@endo/far';
|
|
4
3
|
import { Stable } from '@agoric/internal/src/tokens.js';
|
|
4
|
+
import { E } from '@endo/far';
|
|
5
5
|
import { makeGovernedTerms as makeGovernedATerms } from '../auction/params.js';
|
|
6
|
+
import { provideRetiredInstances } from './utils.js';
|
|
6
7
|
|
|
7
8
|
const trace = makeTracer('NewAuction', true);
|
|
8
9
|
|
|
@@ -11,6 +12,7 @@ const trace = makeTracer('NewAuction', true);
|
|
|
11
12
|
* auctionUpgradeNewInstance: Instance;
|
|
12
13
|
* auctionUpgradeNewGovCreator: any;
|
|
13
14
|
* newContractGovBundleId: string;
|
|
15
|
+
* retiredContractInstances: MapStore<string, Instance>;
|
|
14
16
|
* }>} interlockPowers
|
|
15
17
|
*/
|
|
16
18
|
|
|
@@ -35,6 +37,7 @@ export const addAuction = async (
|
|
|
35
37
|
economicCommitteeCreatorFacet: electorateCreatorFacet,
|
|
36
38
|
governedContractKits: governedContractKitsP,
|
|
37
39
|
priceAuthority8400,
|
|
40
|
+
retiredContractInstances: retiredContractInstancesP,
|
|
38
41
|
zoe,
|
|
39
42
|
},
|
|
40
43
|
produce: {
|
|
@@ -42,6 +45,7 @@ export const addAuction = async (
|
|
|
42
45
|
auctionUpgradeNewInstance,
|
|
43
46
|
auctionUpgradeNewGovCreator,
|
|
44
47
|
newContractGovBundleId,
|
|
48
|
+
retiredContractInstances: produceRetiredInstances,
|
|
45
49
|
},
|
|
46
50
|
instance: {
|
|
47
51
|
consume: { reserve: reserveInstance },
|
|
@@ -79,6 +83,30 @@ export const addAuction = async (
|
|
|
79
83
|
auctioneerInstallationP,
|
|
80
84
|
]);
|
|
81
85
|
|
|
86
|
+
const retiredInstances = await provideRetiredInstances(
|
|
87
|
+
retiredContractInstancesP,
|
|
88
|
+
produceRetiredInstances,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const governedContractKits = await governedContractKitsP;
|
|
92
|
+
trace('has', governedContractKits.has(legacyKit.instance));
|
|
93
|
+
if (governedContractKits.has(legacyKit.instance)) {
|
|
94
|
+
// bootstrap tests start having already run this upgrade. Actual upgrades on
|
|
95
|
+
// mainNet or testnets should start with the promiseSpace post upgrade-17,
|
|
96
|
+
// which doesn't have this entry in the map.
|
|
97
|
+
trace(
|
|
98
|
+
'⚠️ WARNING: not expected during chain upgrade. It IS normal during bootstrap tests',
|
|
99
|
+
);
|
|
100
|
+
} else {
|
|
101
|
+
// @ts-expect-error The original auctioneerKit had everything it needs
|
|
102
|
+
governedContractKits.init(legacyKit.instance, legacyKit);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// save the auctioneer instance so we can manage it later
|
|
106
|
+
const boardID = await E(board).getId(legacyKit.instance);
|
|
107
|
+
const identifier = `auctioneer-${boardID}`;
|
|
108
|
+
retiredInstances.init(identifier, legacyKit.instance);
|
|
109
|
+
|
|
82
110
|
// Each field has an extra layer of type + value:
|
|
83
111
|
// AuctionStartDelay: { type: 'relativeTime', value: { relValue: 2n, timerBrand: Object [Alleged: timerBrand] {} } }
|
|
84
112
|
/** @type {any} */
|
|
@@ -191,7 +219,6 @@ export const addAuction = async (
|
|
|
191
219
|
governedInstance,
|
|
192
220
|
);
|
|
193
221
|
|
|
194
|
-
const governedContractKits = await governedContractKitsP;
|
|
195
222
|
governedContractKits.init(kit.instance, kit);
|
|
196
223
|
auctionUpgradeNewInstance.resolve(governedInstance);
|
|
197
224
|
auctionUpgradeNewGovCreator.resolve(kit.governorCreatorFacet);
|
|
@@ -210,6 +237,7 @@ export const ADD_AUCTION_MANIFEST = harden({
|
|
|
210
237
|
economicCommitteeCreatorFacet: true,
|
|
211
238
|
governedContractKits: true,
|
|
212
239
|
priceAuthority8400: true,
|
|
240
|
+
retiredContractInstances: true,
|
|
213
241
|
zoe: true,
|
|
214
242
|
},
|
|
215
243
|
produce: {
|
|
@@ -217,6 +245,7 @@ export const ADD_AUCTION_MANIFEST = harden({
|
|
|
217
245
|
auctionUpgradeNewInstance: true,
|
|
218
246
|
auctionUpgradeNewGovCreator: true,
|
|
219
247
|
newContractGovBundleId: true,
|
|
248
|
+
retiredContractInstances: true,
|
|
220
249
|
},
|
|
221
250
|
instance: {
|
|
222
251
|
consume: { reserve: true },
|
|
@@ -4,7 +4,9 @@ export function ensureOracleBrand({ namedVat: { consume: { agoricNames }, }, ora
|
|
|
4
4
|
name: string;
|
|
5
5
|
decimalPlaces: number;
|
|
6
6
|
}): Promise<Brand<"nat">>;
|
|
7
|
-
export function deployPriceFeeds(powers: EconomyBootstrapPowers & NamedVatPowers
|
|
7
|
+
export function deployPriceFeeds(powers: EconomyBootstrapPowers & NamedVatPowers & PromiseSpaceOf<{
|
|
8
|
+
retiredContractInstances: MapStore<string, Instance>;
|
|
9
|
+
}>, config: {
|
|
8
10
|
options: PriceFeedConfig & {
|
|
9
11
|
priceAggregatorRef: {
|
|
10
12
|
bundleID: string;
|
|
@@ -39,6 +41,7 @@ export function getManifestForPriceFeeds({ restoreRef: _restoreRef }: {
|
|
|
39
41
|
namesByAddressAdmin: string;
|
|
40
42
|
priceAuthority: string;
|
|
41
43
|
priceAuthorityAdmin: string;
|
|
44
|
+
retiredContractInstances: string;
|
|
42
45
|
startGovernedUpgradable: string;
|
|
43
46
|
startUpgradable: string;
|
|
44
47
|
zoe: string;
|
|
@@ -50,12 +53,14 @@ export function getManifestForPriceFeeds({ restoreRef: _restoreRef }: {
|
|
|
50
53
|
};
|
|
51
54
|
instance: {
|
|
52
55
|
produce: string;
|
|
56
|
+
consume: string;
|
|
53
57
|
};
|
|
54
58
|
oracleBrand: {
|
|
55
59
|
produce: string;
|
|
56
60
|
};
|
|
57
61
|
produce: {
|
|
58
62
|
priceAuthority8400: string;
|
|
63
|
+
retiredContractInstances: string;
|
|
59
64
|
};
|
|
60
65
|
};
|
|
61
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-price-feeds.d.ts","sourceRoot":"","sources":["deploy-price-feeds.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy-price-feeds.d.ts","sourceRoot":"","sources":["deploy-price-feeds.js"],"names":[],"mappings":"AAeA,8BAA8B;AAC9B,qCADW,eAAe,CAQxB;AA4CK,8HAJI,sBAAsB,GAAG,cAAc,2BACvC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAmBjC;AAgJM,yCAdI,sBAAsB,GAC5B,cAAc,GACd,cAAc,CAAC;IAAE,wBAAwB,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CAAE,CAAC,UAClE;IACN,OAAO,EAAE,eAAe,GAAG;QACzB,kBAAkB,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,WAAW,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,aAAa,CAAC,EAAE,eAAe,CAAC;QAChC,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH,iBAoEH;AAWM,sEAHJ;IAAmB,UAAU,EAArB,GAAG;CACX,oBAAQ,eAAe,GAAG;IAAE,kBAAkB,EAAE,GAAG,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA9QlC,MAAM,EAAE;sBACX,MAAM,EAAE;wBACN,OAAO,CAAC,eAAe,CAAC;4BA4QM,GAAG;;GAqCpD;8BApTW;IACR,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC1C;qCAV+B,uDAAuD;4CADhD,qBAAqB"}
|
|
@@ -5,6 +5,7 @@ import { E } from '@endo/far';
|
|
|
5
5
|
import { unitAmount } from '@agoric/zoe/src/contractSupport/priceQuote.js';
|
|
6
6
|
import {
|
|
7
7
|
oracleBrandFeedName,
|
|
8
|
+
provideRetiredInstances,
|
|
8
9
|
reserveThenDeposit,
|
|
9
10
|
sanitizePathSegment,
|
|
10
11
|
} from './utils.js';
|
|
@@ -84,7 +85,8 @@ export const ensureOracleBrand = async (
|
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
|
-
* @param {EconomyBootstrapPowers
|
|
88
|
+
* @param {EconomyBootstrapPowers &
|
|
89
|
+
* PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance> }>} powers
|
|
88
90
|
* @param {{
|
|
89
91
|
* AGORIC_INSTANCE_NAME: string;
|
|
90
92
|
* contractTerms: import('@agoric/inter-protocol/src/price/fluxAggregatorKit.js').ChainlinkConfig;
|
|
@@ -96,6 +98,7 @@ export const ensureOracleBrand = async (
|
|
|
96
98
|
const startPriceAggregatorInstance = async (
|
|
97
99
|
{
|
|
98
100
|
consume: {
|
|
101
|
+
agoricNames,
|
|
99
102
|
board,
|
|
100
103
|
chainStorage,
|
|
101
104
|
chainTimerService,
|
|
@@ -103,8 +106,10 @@ const startPriceAggregatorInstance = async (
|
|
|
103
106
|
highPrioritySendersManager,
|
|
104
107
|
namesByAddressAdmin,
|
|
105
108
|
startGovernedUpgradable,
|
|
109
|
+
retiredContractInstances: retiredContractInstancesP,
|
|
106
110
|
},
|
|
107
111
|
instance: { produce: produceInstance },
|
|
112
|
+
produce: { retiredContractInstances: produceRetiredInstances },
|
|
108
113
|
},
|
|
109
114
|
{ AGORIC_INSTANCE_NAME, contractTerms, brandIn, brandOut },
|
|
110
115
|
installation,
|
|
@@ -139,6 +144,22 @@ const startPriceAggregatorInstance = async (
|
|
|
139
144
|
// @ts-expect-error GovernableStartFn vs. fluxAggregatorContract.js start
|
|
140
145
|
installation,
|
|
141
146
|
});
|
|
147
|
+
const retiredContractInstances = await provideRetiredInstances(
|
|
148
|
+
retiredContractInstancesP,
|
|
149
|
+
produceRetiredInstances,
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
// save the instance so we can manage it later
|
|
153
|
+
const retiringInstance = await E(agoricNames).lookup(
|
|
154
|
+
'instance',
|
|
155
|
+
AGORIC_INSTANCE_NAME,
|
|
156
|
+
);
|
|
157
|
+
const boardID = await E(board).getId(retiringInstance);
|
|
158
|
+
retiredContractInstances.init(
|
|
159
|
+
`priceFeed-${AGORIC_INSTANCE_NAME}-${boardID}`,
|
|
160
|
+
retiringInstance,
|
|
161
|
+
);
|
|
162
|
+
|
|
142
163
|
produceInstance[AGORIC_INSTANCE_NAME].reset();
|
|
143
164
|
produceInstance[AGORIC_INSTANCE_NAME].resolve(governedKit.instance);
|
|
144
165
|
trace(
|
|
@@ -191,7 +212,9 @@ const distributeInvitations = async (
|
|
|
191
212
|
};
|
|
192
213
|
|
|
193
214
|
/**
|
|
194
|
-
* @param {EconomyBootstrapPowers &
|
|
215
|
+
* @param {EconomyBootstrapPowers &
|
|
216
|
+
* NamedVatPowers &
|
|
217
|
+
* PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance> }>} powers
|
|
195
218
|
* @param {{
|
|
196
219
|
* options: PriceFeedConfig & {
|
|
197
220
|
* priceAggregatorRef: { bundleID: string };
|
|
@@ -300,6 +323,7 @@ export const getManifestForPriceFeeds = async (
|
|
|
300
323
|
namesByAddressAdmin: t,
|
|
301
324
|
priceAuthority: t,
|
|
302
325
|
priceAuthorityAdmin: t,
|
|
326
|
+
retiredContractInstances: t,
|
|
303
327
|
startGovernedUpgradable: t,
|
|
304
328
|
startUpgradable: t,
|
|
305
329
|
zoe: t,
|
|
@@ -307,9 +331,10 @@ export const getManifestForPriceFeeds = async (
|
|
|
307
331
|
installation: { produce: { priceAggregator: t } },
|
|
308
332
|
instance: {
|
|
309
333
|
produce: t,
|
|
334
|
+
consume: t,
|
|
310
335
|
},
|
|
311
336
|
oracleBrand: { produce: t },
|
|
312
|
-
produce: { priceAuthority8400: t },
|
|
337
|
+
produce: { priceAuthority8400: t, retiredContractInstances: t },
|
|
313
338
|
},
|
|
314
339
|
},
|
|
315
340
|
options: { ...priceFeedOptions },
|
|
@@ -14,6 +14,7 @@ export function getManifestForReplaceAllElectorates({ economicCommitteeRef: _eco
|
|
|
14
14
|
manifest: {
|
|
15
15
|
[x: string]: {
|
|
16
16
|
consume: {
|
|
17
|
+
agoricNames: boolean;
|
|
17
18
|
auctionUpgradeNewGovCreator: boolean;
|
|
18
19
|
auctionUpgradeNewInstance: boolean;
|
|
19
20
|
psmKit: boolean;
|
|
@@ -21,6 +22,7 @@ export function getManifestForReplaceAllElectorates({ economicCommitteeRef: _eco
|
|
|
21
22
|
chainStorage: boolean;
|
|
22
23
|
highPrioritySendersManager: boolean;
|
|
23
24
|
namesByAddressAdmin: boolean;
|
|
25
|
+
retiredContractInstances: boolean;
|
|
24
26
|
board: boolean;
|
|
25
27
|
startUpgradable: boolean;
|
|
26
28
|
};
|
|
@@ -29,6 +31,7 @@ export function getManifestForReplaceAllElectorates({ economicCommitteeRef: _eco
|
|
|
29
31
|
economicCommitteeKit: boolean;
|
|
30
32
|
economicCommitteeCreatorFacet: boolean;
|
|
31
33
|
auctionUpgradeNewGovCreator: boolean;
|
|
34
|
+
retiredContractInstances: boolean;
|
|
32
35
|
};
|
|
33
36
|
installation: {
|
|
34
37
|
consume: {
|
|
@@ -42,6 +45,9 @@ export function getManifestForReplaceAllElectorates({ economicCommitteeRef: _eco
|
|
|
42
45
|
economicCommittee: boolean;
|
|
43
46
|
econCommitteeCharter: boolean;
|
|
44
47
|
};
|
|
48
|
+
consume: {
|
|
49
|
+
economicCommittee: boolean;
|
|
50
|
+
};
|
|
45
51
|
};
|
|
46
52
|
};
|
|
47
53
|
};
|
|
@@ -50,6 +56,7 @@ export function getManifestForReplaceAllElectorates({ economicCommitteeRef: _eco
|
|
|
50
56
|
export type interlockPowers = PromiseSpaceOf<{
|
|
51
57
|
auctionUpgradeNewInstance: Instance;
|
|
52
58
|
auctionUpgradeNewGovCreator: any;
|
|
59
|
+
retiredContractInstances: MapStore<string, Instance>;
|
|
53
60
|
}>;
|
|
54
61
|
import type { EconomyBootstrapPowers } from './econ-behaviors.js';
|
|
55
62
|
//# sourceMappingURL=replaceElectorate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceElectorate.d.ts","sourceRoot":"","sources":["replaceElectorate.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replaceElectorate.d.ts","sourceRoot":"","sources":["replaceElectorate.js"],"names":[],"mappings":"AAkbO,uDAlBI,sBAAsB,GAAG,eAAe,UAGxC;IACN,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACvC,yBAAyB,EAAE;YACzB,cAAc,EAAE,MAAM,EAAE,CAAC;YACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;SAC7B,CAAC;KACH,CAAC;CACH,GAGS,OAAO,CAAC,IAAI,CAAC,CAuEzB;AAIM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CL;8BAzNW,cAAc,CAAC;IACvB,yBAAyB,EAAE,QAAQ,CAAC;IACpC,2BAA2B,EAAE,GAAG,CAAC;IACjC,wBAAwB,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACtD,CAAC;4CA9TqC,qBAAqB"}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
assertPathSegment,
|
|
16
16
|
makeStorageNodeChild,
|
|
17
17
|
} from '@agoric/internal/src/lib-chainStorage.js';
|
|
18
|
-
import { reserveThenDeposit } from './utils.js';
|
|
18
|
+
import { provideRetiredInstances, reserveThenDeposit } from './utils.js';
|
|
19
19
|
|
|
20
20
|
/** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */
|
|
21
21
|
/** @import {EconCharterStartResult} from './econ-behaviors.js' */
|
|
@@ -181,8 +181,10 @@ const inviteToEconCharter = async (
|
|
|
181
181
|
* Starts a new Economic Committee (EC) by creating an instance with the
|
|
182
182
|
* provided committee specifications.
|
|
183
183
|
*
|
|
184
|
-
* @param {EconomyBootstrapPowers
|
|
185
|
-
*
|
|
184
|
+
* @param {EconomyBootstrapPowers &
|
|
185
|
+
* PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance> }>} powers
|
|
186
|
+
* - The resources and capabilities required to start the committee.
|
|
187
|
+
*
|
|
186
188
|
* @param {{
|
|
187
189
|
* options: {
|
|
188
190
|
* committeeName: string;
|
|
@@ -196,12 +198,22 @@ const inviteToEconCharter = async (
|
|
|
196
198
|
*/
|
|
197
199
|
const startNewEconomicCommittee = async (
|
|
198
200
|
{
|
|
199
|
-
consume: {
|
|
200
|
-
|
|
201
|
+
consume: {
|
|
202
|
+
board,
|
|
203
|
+
chainStorage,
|
|
204
|
+
startUpgradable,
|
|
205
|
+
retiredContractInstances: retiredInstancesP,
|
|
206
|
+
},
|
|
207
|
+
produce: {
|
|
208
|
+
economicCommitteeKit,
|
|
209
|
+
economicCommitteeCreatorFacet,
|
|
210
|
+
retiredContractInstances: produceRetiredInstances,
|
|
211
|
+
},
|
|
201
212
|
installation: {
|
|
202
213
|
consume: { committee },
|
|
203
214
|
},
|
|
204
215
|
instance: {
|
|
216
|
+
consume: { economicCommittee: economicCommitteeOriginalP },
|
|
205
217
|
produce: { economicCommittee },
|
|
206
218
|
},
|
|
207
219
|
},
|
|
@@ -214,6 +226,19 @@ const startNewEconomicCommittee = async (
|
|
|
214
226
|
trace(`committeeName ${committeeName}`);
|
|
215
227
|
trace(`committeeSize ${committeeSize}`);
|
|
216
228
|
|
|
229
|
+
const retiredInstances = await provideRetiredInstances(
|
|
230
|
+
retiredInstancesP,
|
|
231
|
+
produceRetiredInstances,
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
// Record the retired electorate instance so we can manage it later.
|
|
235
|
+
const economicCommitteeOriginal = await economicCommitteeOriginalP;
|
|
236
|
+
const boardID = await E(board).getId(economicCommitteeOriginal);
|
|
237
|
+
retiredInstances.init(
|
|
238
|
+
`economicCommittee-${boardID}`,
|
|
239
|
+
economicCommitteeOriginal,
|
|
240
|
+
);
|
|
241
|
+
|
|
217
242
|
const committeesNode = await makeStorageNodeChild(
|
|
218
243
|
chainStorage,
|
|
219
244
|
COMMITTEES_ROOT,
|
|
@@ -309,6 +334,7 @@ const startNewEconCharter = async ({
|
|
|
309
334
|
* @typedef {PromiseSpaceOf<{
|
|
310
335
|
* auctionUpgradeNewInstance: Instance;
|
|
311
336
|
* auctionUpgradeNewGovCreator: any;
|
|
337
|
+
* retiredContractInstances: MapStore<string, Instance>;
|
|
312
338
|
* }>} interlockPowers
|
|
313
339
|
*/
|
|
314
340
|
|
|
@@ -485,6 +511,7 @@ export const getManifestForReplaceAllElectorates = async (
|
|
|
485
511
|
manifest: {
|
|
486
512
|
[replaceAllElectorates.name]: {
|
|
487
513
|
consume: {
|
|
514
|
+
agoricNames: true,
|
|
488
515
|
auctionUpgradeNewGovCreator: true,
|
|
489
516
|
auctionUpgradeNewInstance: true,
|
|
490
517
|
psmKit: true,
|
|
@@ -492,6 +519,7 @@ export const getManifestForReplaceAllElectorates = async (
|
|
|
492
519
|
chainStorage: true,
|
|
493
520
|
highPrioritySendersManager: true,
|
|
494
521
|
namesByAddressAdmin: true,
|
|
522
|
+
retiredContractInstances: true,
|
|
495
523
|
// Rest of these are designed to be widely shared
|
|
496
524
|
board: true,
|
|
497
525
|
startUpgradable: true,
|
|
@@ -501,6 +529,7 @@ export const getManifestForReplaceAllElectorates = async (
|
|
|
501
529
|
economicCommitteeKit: true,
|
|
502
530
|
economicCommitteeCreatorFacet: true,
|
|
503
531
|
auctionUpgradeNewGovCreator: true,
|
|
532
|
+
retiredContractInstances: true,
|
|
504
533
|
},
|
|
505
534
|
installation: {
|
|
506
535
|
consume: {
|
|
@@ -514,6 +543,7 @@ export const getManifestForReplaceAllElectorates = async (
|
|
|
514
543
|
economicCommittee: true,
|
|
515
544
|
econCommitteeCharter: true,
|
|
516
545
|
},
|
|
546
|
+
consume: { economicCommittee: true },
|
|
517
547
|
},
|
|
518
548
|
},
|
|
519
549
|
},
|
package/src/proposals/utils.d.ts
CHANGED
|
@@ -16,4 +16,5 @@ export function oracleBrandFeedName(inBrandName: any, outBrandName: any): string
|
|
|
16
16
|
export function scaledPriceFeedName(issuerName: any): string;
|
|
17
17
|
/** @type {(name: string) => string} */
|
|
18
18
|
export const sanitizePathSegment: (name: string) => string;
|
|
19
|
+
export function provideRetiredInstances(consume: Promise<MapStore>, produce: Producer<MapStore>): Promise<MapStore>;
|
|
19
20
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAaO,mDAHI,IAAI,CAAC,OAAO,cAAc,EAAE,SAAS,CAAC,SACtC,MAAM,EAAE,EAAE,kBA+BpB;AAMM,+CAHI,IAAI,CAAC,OAAO,cAAc,EAAE,SAAS,CAAC,SACtC,MAAM,EAAE,kBAMhB;AAQI,8CALI,MAAM,uBACN,IAAI,CAAC,OAAO,cAAc,EAAE,SAAS,CAAC,QACtC,MAAM,YACN,IAAI,CAAC,OAAO,CAAC,EAAE,iBAuBzB;AA6BM,wCAPI,OAAO,CAAC;IACd,OAAO,EAAE,IAAI,CAAC,OAAO,iCAAiC,EAAE,UAAU,CAAC,CAAC;CACrE,CAAC,mCAEF;IAAkE,UAAU,EAApE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,eAAe;CAAC;;;GAoDxC;AAEM,iFACsC;AAEtC,6DAC+B;AAEtC,uCAAuC;AACvC,kCADW,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAKjC;AAUK,iDAJI,OAAO,CAAC,QAAQ,CAAC,WACjB,QAAQ,CAAC,QAAQ,CAAC,GAChB,OAAO,CAAC,QAAQ,CAAC,CAW7B"}
|
package/src/proposals/utils.js
CHANGED
|
@@ -3,6 +3,7 @@ import { E } from '@endo/far';
|
|
|
3
3
|
import { WalletName } from '@agoric/internal';
|
|
4
4
|
import { getCopyMapEntries, makeCopyMap } from '@agoric/store';
|
|
5
5
|
import { assertPathSegment } from '@agoric/internal/src/lib-chainStorage.js';
|
|
6
|
+
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
6
7
|
|
|
7
8
|
/** @import {CopyMap} from '@endo/patterns'; */
|
|
8
9
|
|
|
@@ -171,3 +172,22 @@ export const sanitizePathSegment = name => {
|
|
|
171
172
|
assertPathSegment(candidate);
|
|
172
173
|
return candidate;
|
|
173
174
|
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Idempotently provide an empty MapStore for the `retiredContractInstances`
|
|
178
|
+
* value in promise space
|
|
179
|
+
*
|
|
180
|
+
* @param {Promise<MapStore>} consume
|
|
181
|
+
* @param {Producer<MapStore>} produce
|
|
182
|
+
* @returns {Promise<MapStore>}
|
|
183
|
+
*/
|
|
184
|
+
export const provideRetiredInstances = async (consume, produce) => {
|
|
185
|
+
// Promise space has no way to look for an existing value other than awaiting a promise,
|
|
186
|
+
// but it does allow extra production so it's safe to do this redundantly.
|
|
187
|
+
produce.resolve(
|
|
188
|
+
makeScalarBigMapStore('retiredContractInstances', {
|
|
189
|
+
durable: true,
|
|
190
|
+
}),
|
|
191
|
+
);
|
|
192
|
+
return consume;
|
|
193
|
+
};
|
|
@@ -56,7 +56,7 @@ export function prepareVaultManagerKit(baggage: import("@agoric/swingset-liveslo
|
|
|
56
56
|
helper: {
|
|
57
57
|
/** Start non-durable processes (or restart if needed after vat restart) */
|
|
58
58
|
start(): void;
|
|
59
|
-
|
|
59
|
+
ensureQuoteNotifierWatched(): void;
|
|
60
60
|
/** @param {Timestamp} updateTime */
|
|
61
61
|
chargeAllVaults(updateTime: Timestamp): Promise<void>;
|
|
62
62
|
assetNotify(): Promise<void>;
|
|
@@ -314,7 +314,7 @@ export function prepareVaultManagerKit(baggage: import("@agoric/swingset-liveslo
|
|
|
314
314
|
helper: {
|
|
315
315
|
/** Start non-durable processes (or restart if needed after vat restart) */
|
|
316
316
|
start(): void;
|
|
317
|
-
|
|
317
|
+
ensureQuoteNotifierWatched(): void;
|
|
318
318
|
/** @param {Timestamp} updateTime */
|
|
319
319
|
chargeAllVaults(updateTime: Timestamp): Promise<void>;
|
|
320
320
|
assetNotify(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaultManager.d.ts","sourceRoot":"","sources":["vaultManager.js"],"names":[],"mappings":"AAqFO,mCANM,CAAC,EACQ,CAAC,SAAT,GAAG,EAAG,yBACT,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WACpB,OAAO,4BAA4B,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,WACzD,CAAC,iBAqBX;AAwHM,gDATI,OAAO,4BAA4B,EAAE,OAAO,uDAC5C;IACN,GAAG,EAAE,OAAO,mBAAmB,EAAE,eAAe,CAAC;IACjD,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7B,eAAe,EAAE,OAAO,6CAA6C,EAAE,eAAe,CAAC;IACvF,gBAAgB,EAAE,OAAO,6CAA6C,EAAE,gBAAgB,CAAC;IACzF,aAAa,EAAE,OAAO,oBAAoB,EAAE,kBAAkB,CAAC;CAChE,
|
|
1
|
+
{"version":3,"file":"vaultManager.d.ts","sourceRoot":"","sources":["vaultManager.js"],"names":[],"mappings":"AAqFO,mCANM,CAAC,EACQ,CAAC,SAAT,GAAG,EAAG,yBACT,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WACpB,OAAO,4BAA4B,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,WACzD,CAAC,iBAqBX;AAwHM,gDATI,OAAO,4BAA4B,EAAE,OAAO,uDAC5C;IACN,GAAG,EAAE,OAAO,mBAAmB,EAAE,eAAe,CAAC;IACjD,UAAU,EAAE,IA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AAE,MAAM,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,mBAAmB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,eAAe,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,oBAAoB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,qBAAqB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,sBAAsB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,UAAU,GAAG,SAAS,CAAC;CACrC;8BAmlCU,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;;;;;;;;2BAE/D,eAAe,CAAC,MAAM,CAAC;gCAMtB,eAAe,CAAC,YAAY,CAAC;oCA1rCT,iBAAiB;gCArC0C,4BAA4B;kCAsCzF,cAAc"}
|
|
@@ -227,6 +227,7 @@ export const prepareVaultManagerKit = (
|
|
|
227
227
|
{ zcf, marshaller, makeRecorderKit, factoryPowers },
|
|
228
228
|
) => {
|
|
229
229
|
const { priceAuthority, timerService, reservePublicFacet } = zcf.getTerms();
|
|
230
|
+
const watchedBrands = new Set();
|
|
230
231
|
|
|
231
232
|
const makeVault = prepareVault(baggage, makeRecorderKit, zcf);
|
|
232
233
|
|
|
@@ -424,52 +425,69 @@ export const prepareVaultManagerKit = (
|
|
|
424
425
|
},
|
|
425
426
|
});
|
|
426
427
|
|
|
427
|
-
void facets.helper.
|
|
428
|
+
void facets.helper.ensureQuoteNotifierWatched();
|
|
428
429
|
|
|
429
430
|
trace('helper.start() done');
|
|
430
431
|
},
|
|
431
|
-
|
|
432
|
+
ensureQuoteNotifierWatched() {
|
|
432
433
|
const { state } = this;
|
|
433
434
|
|
|
434
435
|
const { collateralBrand, collateralUnit, debtBrand, storageNode } =
|
|
435
436
|
state;
|
|
437
|
+
if (watchedBrands.has(collateralBrand)) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
watchedBrands.add(collateralBrand);
|
|
441
|
+
|
|
436
442
|
const ephemera = collateralEphemera(collateralBrand);
|
|
437
443
|
|
|
438
|
-
const
|
|
444
|
+
const quoteNotifierP = E(priceAuthority).makeQuoteNotifier(
|
|
439
445
|
collateralUnit,
|
|
440
446
|
debtBrand,
|
|
441
447
|
);
|
|
442
|
-
// @ts-expect-error XXX quotes
|
|
443
|
-
ephemera.storedQuotesNotifier = makeStoredNotifier(
|
|
444
|
-
// @ts-expect-error XXX quotes
|
|
445
|
-
quoteNotifier,
|
|
446
|
-
E(storageNode).makeChildNode('quotes'),
|
|
447
|
-
marshaller,
|
|
448
|
-
);
|
|
449
|
-
trace(
|
|
450
|
-
'helper.start() awaiting observe storedQuotesNotifier',
|
|
451
|
-
collateralBrand,
|
|
452
|
-
);
|
|
453
|
-
// NB: upon restart, there may not be a price for a while. If manager
|
|
454
|
-
// operations are permitted, ones that depend on price information
|
|
455
|
-
// will throw. See https://github.com/Agoric/agoric-sdk/issues/4317
|
|
456
|
-
const quoteWatcher = harden({
|
|
457
|
-
onFulfilled(value) {
|
|
458
|
-
trace('watcher updated price', value);
|
|
459
|
-
ephemera.storedCollateralQuote = value;
|
|
460
|
-
},
|
|
461
|
-
onRejected() {
|
|
462
|
-
// NOTE: drastic action, if the quoteNotifier fails, we don't know
|
|
463
|
-
// the value of the asset, nor do we know how long we'll be in
|
|
464
|
-
// ignorance. Best choice is to disable actions that require
|
|
465
|
-
// prices and restart when we have a new price. If we restart the
|
|
466
|
-
// notifier immediately, we'll trigger an infinite loop, so try
|
|
467
|
-
// to restart each time we get a request.
|
|
468
448
|
|
|
449
|
+
void E.when(
|
|
450
|
+
quoteNotifierP,
|
|
451
|
+
quoteNotifier => {
|
|
452
|
+
// @ts-expect-error XXX quotes
|
|
453
|
+
ephemera.storedQuotesNotifier = makeStoredNotifier(
|
|
454
|
+
// @ts-expect-error XXX quotes
|
|
455
|
+
quoteNotifier,
|
|
456
|
+
E(storageNode).makeChildNode('quotes'),
|
|
457
|
+
marshaller,
|
|
458
|
+
);
|
|
459
|
+
trace(
|
|
460
|
+
'helper.start() awaiting observe storedQuotesNotifier',
|
|
461
|
+
collateralBrand,
|
|
462
|
+
);
|
|
463
|
+
// NB: upon restart, there may not be a price for a while. If manager
|
|
464
|
+
// operations are permitted, ones that depend on price information
|
|
465
|
+
// will throw. See https://github.com/Agoric/agoric-sdk/issues/4317
|
|
466
|
+
const quoteWatcher = harden({
|
|
467
|
+
onFulfilled(value) {
|
|
468
|
+
trace('watcher updated price', value);
|
|
469
|
+
ephemera.storedCollateralQuote = value;
|
|
470
|
+
},
|
|
471
|
+
onRejected() {
|
|
472
|
+
// NOTE: drastic action, if the quoteNotifier fails, we don't know
|
|
473
|
+
// the value of the asset, nor do we know how long we'll be in
|
|
474
|
+
// ignorance. Best choice is to disable actions that require
|
|
475
|
+
// prices and restart when we have a new price. If we restart the
|
|
476
|
+
// notifier immediately, we'll trigger an infinite loop, so try
|
|
477
|
+
// to restart each time we get a request.
|
|
478
|
+
|
|
479
|
+
ephemera.storedCollateralQuote = null;
|
|
480
|
+
watchedBrands.delete(collateralBrand);
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
void watchQuoteNotifier(quoteNotifier, quoteWatcher);
|
|
484
|
+
},
|
|
485
|
+
e => {
|
|
486
|
+
trace('makeQuoteNotifier failed, resetting', e);
|
|
469
487
|
ephemera.storedCollateralQuote = null;
|
|
488
|
+
watchedBrands.delete(collateralBrand);
|
|
470
489
|
},
|
|
471
|
-
|
|
472
|
-
void watchQuoteNotifier(quoteNotifier, quoteWatcher);
|
|
490
|
+
);
|
|
473
491
|
},
|
|
474
492
|
/** @param {Timestamp} updateTime */
|
|
475
493
|
async chargeAllVaults(updateTime) {
|
|
@@ -841,7 +859,7 @@ export const prepareVaultManagerKit = (
|
|
|
841
859
|
const { collateralBrand } = state;
|
|
842
860
|
const { storedCollateralQuote } = collateralEphemera(collateralBrand);
|
|
843
861
|
if (!storedCollateralQuote) {
|
|
844
|
-
facets.helper.
|
|
862
|
+
facets.helper.ensureQuoteNotifierWatched();
|
|
845
863
|
|
|
846
864
|
// it might take an arbitrary amount of time to get a new quote
|
|
847
865
|
throw Fail`maxDebtFor called before a collateral quote was available for ${collateralBrand}`;
|
|
@@ -1088,7 +1106,7 @@ export const prepareVaultManagerKit = (
|
|
|
1088
1106
|
state.collateralBrand,
|
|
1089
1107
|
);
|
|
1090
1108
|
if (!storedCollateralQuote) {
|
|
1091
|
-
facets.helper.
|
|
1109
|
+
facets.helper.ensureQuoteNotifierWatched();
|
|
1092
1110
|
|
|
1093
1111
|
// it might take an arbitrary amount of time to get a new quote
|
|
1094
1112
|
throw Fail`getCollateralQuote called before a collateral quote was available`;
|
|
@@ -1107,7 +1125,7 @@ export const prepareVaultManagerKit = (
|
|
|
1107
1125
|
state.collateralBrand,
|
|
1108
1126
|
);
|
|
1109
1127
|
if (!storedCollateralQuote) {
|
|
1110
|
-
facets.helper.
|
|
1128
|
+
facets.helper.ensureQuoteNotifierWatched();
|
|
1111
1129
|
|
|
1112
1130
|
// it might take an arbitrary amount of time to get a new quote
|
|
1113
1131
|
throw Fail`lockOraclePrices called before a collateral quote was available for ${state.collateralBrand}`;
|