@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,19 +1,20 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
3
|
import { makeMap } from 'jessie.js';
|
|
4
|
+
import { X } from '@endo/errors';
|
|
5
|
+
import { E } from '@endo/far';
|
|
4
6
|
import { AmountMath, AssetKind } from '@agoric/ertp';
|
|
5
7
|
import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance';
|
|
6
8
|
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
|
|
7
9
|
import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js';
|
|
8
|
-
import { E } from '@endo/far';
|
|
9
|
-
import { Stable } from '@agoric/vats/src/tokens.js';
|
|
10
10
|
import {
|
|
11
11
|
makeHistoryReviver,
|
|
12
12
|
makeBoardRemote,
|
|
13
13
|
slotToBoardRemote,
|
|
14
|
-
} from '@agoric/
|
|
14
|
+
} from '@agoric/internal/src/marshal.js';
|
|
15
15
|
import { deeplyFulfilledObject } from '@agoric/internal';
|
|
16
16
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
17
|
+
import { Stable } from '@agoric/internal/src/tokens.js';
|
|
17
18
|
|
|
18
19
|
import { reserveThenGetNamePaths } from './utils.js';
|
|
19
20
|
|
|
@@ -23,22 +24,24 @@ import {
|
|
|
23
24
|
inviteToEconCharter,
|
|
24
25
|
} from './committee-proposal.js';
|
|
25
26
|
|
|
26
|
-
/** @
|
|
27
|
-
/** @
|
|
28
|
-
/** @
|
|
27
|
+
/** @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js' */
|
|
28
|
+
/** @import {MetricsNotification} from '../psm/psm.js' */
|
|
29
|
+
/** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */
|
|
29
30
|
|
|
30
31
|
const BASIS_POINTS = 10000n;
|
|
31
|
-
const { details: X } = assert;
|
|
32
32
|
|
|
33
33
|
export { inviteCommitteeMembers, startEconCharter, inviteToEconCharter };
|
|
34
34
|
|
|
35
35
|
const stablePsmKey = `published.psm.${Stable.symbol}`;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* @param {
|
|
38
|
+
* @param {[key: string, value: string][]} chainStorageEntries
|
|
39
39
|
* @param {string} keyword
|
|
40
|
-
* @param {{ minted: Brand<'nat'
|
|
41
|
-
* @returns {{
|
|
40
|
+
* @param {{ minted: Brand<'nat'>; anchor: Brand<'nat'> }} brands
|
|
41
|
+
* @returns {{
|
|
42
|
+
* metrics?: MetricsNotification;
|
|
43
|
+
* governance?: GovernanceSubscriptionState;
|
|
44
|
+
* }}
|
|
42
45
|
*/
|
|
43
46
|
const findOldPSMState = (chainStorageEntries, keyword, brands) => {
|
|
44
47
|
// In this reviver, object references are revived as boardIDs
|
|
@@ -80,7 +83,7 @@ const findOldPSMState = (chainStorageEntries, keyword, brands) => {
|
|
|
80
83
|
* @param {bigint} [config.WantMintedFeeBP]
|
|
81
84
|
* @param {bigint} [config.GiveMintedFeeBP]
|
|
82
85
|
* @param {bigint} [config.MINT_LIMIT]
|
|
83
|
-
* @param {{ anchorOptions?: AnchorOptions }
|
|
86
|
+
* @param {{ anchorOptions?: AnchorOptions }} [config.options]
|
|
84
87
|
*/
|
|
85
88
|
export const startPSM = async (
|
|
86
89
|
{
|
|
@@ -273,7 +276,6 @@ export const startPSM = async (
|
|
|
273
276
|
governorFacets.creatorFacet,
|
|
274
277
|
instanceKey,
|
|
275
278
|
),
|
|
276
|
-
// @ts-expect-error TODO type for provisionPoolStartResult
|
|
277
279
|
E(E.get(provisionPoolStartResult).creatorFacet).initPSM(
|
|
278
280
|
anchorBrand,
|
|
279
281
|
newpsmKit.psm,
|
|
@@ -291,16 +293,16 @@ harden(startPSM);
|
|
|
291
293
|
*/
|
|
292
294
|
|
|
293
295
|
/**
|
|
294
|
-
* Make anchor issuer out of a Cosmos asset; presumably
|
|
295
|
-
*
|
|
296
|
+
* Make anchor issuer out of a Cosmos asset; presumably USDC over IBC. Add it to
|
|
297
|
+
* BankManager.
|
|
296
298
|
*
|
|
297
|
-
* Also, if vatParameters shows an anchorPoolBalance for this asset,
|
|
298
|
-
*
|
|
299
|
+
* Also, if vatParameters shows an anchorPoolBalance for this asset, mint a
|
|
300
|
+
* payment for that balance.
|
|
299
301
|
*
|
|
300
302
|
* TODO: address redundancy with publishInterchainAssetFromBank
|
|
301
303
|
*
|
|
302
304
|
* @param {EconomyBootstrapPowers & WellKnownSpaces & ChainStorageVatParams} powers
|
|
303
|
-
* @param {{options
|
|
305
|
+
* @param {{ options: { anchorOptions?: AnchorOptions } }} config
|
|
304
306
|
*/
|
|
305
307
|
export const makeAnchorAsset = async (
|
|
306
308
|
{
|
|
@@ -345,17 +347,27 @@ export const makeAnchorAsset = async (
|
|
|
345
347
|
}),
|
|
346
348
|
);
|
|
347
349
|
|
|
348
|
-
/**
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
350
|
+
/**
|
|
351
|
+
* @typedef {{
|
|
352
|
+
* creatorFacet: ERef<Mint<'nat'>>;
|
|
353
|
+
* publicFacet: ERef<Issuer<'nat'>>;
|
|
354
|
+
* }} PsmKit
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
const { creatorFacet: mint, publicFacet: issuer } =
|
|
358
|
+
/** @type {PsmKit} */
|
|
359
|
+
(
|
|
360
|
+
await E(startUpgradable)({
|
|
361
|
+
installation: mintHolder,
|
|
362
|
+
label: keyword,
|
|
363
|
+
terms,
|
|
364
|
+
})
|
|
365
|
+
);
|
|
355
366
|
|
|
356
367
|
const brand = await E(issuer).getBrand();
|
|
357
368
|
const kit = harden({ mint, issuer, brand });
|
|
358
369
|
|
|
370
|
+
// @ts-expect-error XXX AssetIssuerKit
|
|
359
371
|
testFirstAnchorKit.resolve(kit);
|
|
360
372
|
|
|
361
373
|
const toSlotReviver = makeHistoryReviver(
|
|
@@ -363,23 +375,25 @@ export const makeAnchorAsset = async (
|
|
|
363
375
|
slotToBoardRemote,
|
|
364
376
|
);
|
|
365
377
|
const metricsKey = `${stablePsmKey}.${keyword}.metrics`;
|
|
366
|
-
|
|
378
|
+
const maybeReviveMetrics = async () => {
|
|
379
|
+
if (!toSlotReviver.has(metricsKey)) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
367
382
|
const metrics = toSlotReviver.getItem(metricsKey);
|
|
368
383
|
produceAnchorBalancePayments.resolve(
|
|
369
384
|
makeScalarBigMapStore('Anchor balance payments', { durable: true }),
|
|
370
385
|
);
|
|
371
386
|
// XXX this rule should only apply to the 1st await
|
|
372
|
-
// eslint-disable-next-line @jessie.js/no-nested-await
|
|
373
387
|
const anchorPaymentMap = await anchorBalancePayments;
|
|
374
388
|
|
|
375
389
|
// TODO: validate that `metrics.anchorPoolBalance.value` is
|
|
376
390
|
// pass-by-copy PureData (e.g., contains no remotables).
|
|
377
|
-
// eslint-disable-next-line @jessie.js/no-nested-await
|
|
378
391
|
const pmt = await E(mint).mintPayment(
|
|
379
392
|
AmountMath.make(brand, metrics.anchorPoolBalance.value),
|
|
380
393
|
);
|
|
381
394
|
anchorPaymentMap.init(brand, pmt);
|
|
382
|
-
}
|
|
395
|
+
};
|
|
396
|
+
await maybeReviveMetrics();
|
|
383
397
|
|
|
384
398
|
await Promise.all([
|
|
385
399
|
E(E(agoricNamesAdmin).lookupAdmin('issuer')).update(keyword, kit.issuer),
|
|
@@ -388,13 +402,14 @@ export const makeAnchorAsset = async (
|
|
|
388
402
|
denom,
|
|
389
403
|
keyword,
|
|
390
404
|
proposedName,
|
|
405
|
+
// @ts-expect-error XXX AssetIssuerKit
|
|
391
406
|
kit, // with mint
|
|
392
407
|
),
|
|
393
408
|
]);
|
|
394
409
|
};
|
|
395
410
|
harden(makeAnchorAsset);
|
|
396
411
|
|
|
397
|
-
/** @
|
|
412
|
+
/** @import {EconomyBootstrapSpace} from './econ-behaviors.js' */
|
|
398
413
|
|
|
399
414
|
export const INVITE_PSM_COMMITTEE_MANIFEST = harden(
|
|
400
415
|
/** @type {BootstrapManifest} */ ({
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function upgradeScaledPriceAuthorities({ consume: { agoricNamesAdmin, contractKits: contractKitsP, instancePrivateArgs: instancePrivateArgsP, zoe, }, }: ChainBootstrapSpace, { options }: {
|
|
2
|
+
options: {
|
|
3
|
+
scaledPARef: {
|
|
4
|
+
bundleID: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export function getManifestForUpgradeScaledPriceAuthorities(_ign: any, upgradeSPAOptions: any): Promise<{
|
|
9
|
+
manifest: {
|
|
10
|
+
[x: string]: {
|
|
11
|
+
consume: {
|
|
12
|
+
agoricNamesAdmin: string;
|
|
13
|
+
contractKits: string;
|
|
14
|
+
instancePrivateArgs: string;
|
|
15
|
+
zoe: string;
|
|
16
|
+
};
|
|
17
|
+
instance: {
|
|
18
|
+
produce: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
options: any;
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=upgrade-scaledPriceAuthorities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-scaledPriceAuthorities.d.ts","sourceRoot":"","sources":["upgrade-scaledPriceAuthorities.js"],"names":[],"mappings":"AASO,gKAHI,mBAAmB,eACnB;IAAE,OAAO,EAAE;QAAE,WAAW,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,iBAiD5D;AAGM;;;;;;;;;;;;;;;GAkBL"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { makeTracer } from '@agoric/internal';
|
|
2
|
+
import { E } from '@endo/far';
|
|
3
|
+
|
|
4
|
+
const trace = makeTracer('upgradeScaledPA', true);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {ChainBootstrapSpace} powers
|
|
8
|
+
* @param {{ options: { scaledPARef: { bundleID: string } } }} options
|
|
9
|
+
*/
|
|
10
|
+
export const upgradeScaledPriceAuthorities = async (
|
|
11
|
+
{
|
|
12
|
+
consume: {
|
|
13
|
+
agoricNamesAdmin,
|
|
14
|
+
contractKits: contractKitsP,
|
|
15
|
+
instancePrivateArgs: instancePrivateArgsP,
|
|
16
|
+
zoe,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{ options },
|
|
20
|
+
) => {
|
|
21
|
+
trace('start');
|
|
22
|
+
const { scaledPARef } = options;
|
|
23
|
+
await null;
|
|
24
|
+
|
|
25
|
+
const bundleID = scaledPARef.bundleID;
|
|
26
|
+
if (scaledPARef && bundleID) {
|
|
27
|
+
await E.when(
|
|
28
|
+
E(zoe).installBundleID(bundleID),
|
|
29
|
+
installation =>
|
|
30
|
+
E(E(agoricNamesAdmin).lookupAdmin('installation')).update(
|
|
31
|
+
'scaledPriceAuthority',
|
|
32
|
+
installation,
|
|
33
|
+
),
|
|
34
|
+
err =>
|
|
35
|
+
console.error(
|
|
36
|
+
`🚨 failed to update scaledPriceAuthority installation`,
|
|
37
|
+
err,
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const [contractKits, instancePrivateArgs] = await Promise.all([
|
|
43
|
+
contractKitsP,
|
|
44
|
+
instancePrivateArgsP,
|
|
45
|
+
]);
|
|
46
|
+
/** @type {StartedInstanceKit<any>[]} */
|
|
47
|
+
const scaledPAKitEntries = Array.from(contractKits.values()).filter(
|
|
48
|
+
kit => kit.label && kit.label.match(/scaledPriceAuthority/),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
for (const kitEntry of scaledPAKitEntries) {
|
|
52
|
+
const { instance } = kitEntry;
|
|
53
|
+
const privateArgs = instancePrivateArgs.get(instance);
|
|
54
|
+
trace('upgrade scaledPriceAuthority', kitEntry.label);
|
|
55
|
+
await E(kitEntry.adminFacet).upgradeContract(bundleID, privateArgs);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const t = 'upgradeScaledPriceAuthority';
|
|
60
|
+
export const getManifestForUpgradeScaledPriceAuthorities = async (
|
|
61
|
+
_ign,
|
|
62
|
+
upgradeSPAOptions,
|
|
63
|
+
) => ({
|
|
64
|
+
manifest: {
|
|
65
|
+
[upgradeScaledPriceAuthorities.name]: {
|
|
66
|
+
consume: {
|
|
67
|
+
agoricNamesAdmin: t,
|
|
68
|
+
contractKits: t,
|
|
69
|
+
instancePrivateArgs: t,
|
|
70
|
+
zoe: t,
|
|
71
|
+
},
|
|
72
|
+
instance: {
|
|
73
|
+
produce: t,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
options: { ...upgradeSPAOptions },
|
|
78
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function upgradeVaults({ consume: { auctionUpgradeNewInstance, chainTimerService, economicCommitteeCreatorFacet: electorateCreatorFacet, reserveKit, vaultFactoryKit, zoe, priceAuthority8400, newContractGovBundleId: newContractGovBundleIdP, }, produce: { auctionUpgradeNewInstance: auctionUpgradeNewInstanceProducer, newContractGovBundleId: newContractGovBundleIdErasor, }, }: import("../../src/proposals/econ-behaviors").EconomyBootstrapPowers & interlockPowers, { options: { VaultFactoryBundle: vaultBundleRef } }: {
|
|
2
|
+
options: {
|
|
3
|
+
VaultFactoryBundle: {
|
|
4
|
+
bundleID: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export function getManifestForUpgradeVaults({ restoreRef }: {
|
|
9
|
+
restoreRef: any;
|
|
10
|
+
}, { VaultFactoryRef }: any): Promise<{
|
|
11
|
+
manifest: {
|
|
12
|
+
[x: string]: {
|
|
13
|
+
consume: {
|
|
14
|
+
priceAuthority8400: string;
|
|
15
|
+
auctionUpgradeNewInstance: string;
|
|
16
|
+
chainTimerService: string;
|
|
17
|
+
economicCommitteeCreatorFacet: string;
|
|
18
|
+
reserveKit: string;
|
|
19
|
+
vaultFactoryKit: string;
|
|
20
|
+
zoe: string;
|
|
21
|
+
newContractGovBundleId: string;
|
|
22
|
+
};
|
|
23
|
+
produce: {
|
|
24
|
+
auctionUpgradeNewInstance: string;
|
|
25
|
+
newContractGovBundleId: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
installations: {
|
|
30
|
+
VaultFactory: any;
|
|
31
|
+
};
|
|
32
|
+
options: {
|
|
33
|
+
VaultFactoryBundle: any;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
export type interlockPowers = PromiseSpaceOf<{
|
|
37
|
+
priceAuthority8400: Instance;
|
|
38
|
+
auctionUpgradeNewInstance: Instance;
|
|
39
|
+
newContractGovBundleId: string;
|
|
40
|
+
}>;
|
|
41
|
+
//# sourceMappingURL=upgrade-vaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-vaults.d.ts","sourceRoot":"","sources":["upgrade-vaults.js"],"names":[],"mappings":"AAyBO,+XARI,OAAO,oCAAoC,EAAE,sBAAsB,GACvE,eAAe,uDACX;IACN,OAAO,EAAE;QACP,kBAAkB,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1C,CAAC;CACH,iBA8IH;AAUM,4DAHJ;IAAmB,UAAU,EAArB,GAAG;CACX,uBAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;GA4Bb;8BAhMY,cAAc,CAAC;IACvB,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,yBAAyB,EAAE,QAAQ,CAAC;IACpC,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { E } from '@endo/far';
|
|
2
|
+
import { makeNotifierFromAsyncIterable } from '@agoric/notifier';
|
|
3
|
+
import { makeTracer } from '@agoric/internal/src/index.js';
|
|
4
|
+
import { Fail } from '@endo/errors';
|
|
5
|
+
import { TimeMath } from '@agoric/time';
|
|
6
|
+
|
|
7
|
+
const trace = makeTracer('upgrade Vaults proposal');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {PromiseSpaceOf<{
|
|
11
|
+
* priceAuthority8400: Instance;
|
|
12
|
+
* auctionUpgradeNewInstance: Instance;
|
|
13
|
+
* newContractGovBundleId: string;
|
|
14
|
+
* }>} interlockPowers
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {import('../../src/proposals/econ-behaviors').EconomyBootstrapPowers &
|
|
19
|
+
* interlockPowers} powers
|
|
20
|
+
* @param {{
|
|
21
|
+
* options: {
|
|
22
|
+
* VaultFactoryBundle: { bundleID: string };
|
|
23
|
+
* };
|
|
24
|
+
* }} options
|
|
25
|
+
*/
|
|
26
|
+
export const upgradeVaults = async (
|
|
27
|
+
{
|
|
28
|
+
consume: {
|
|
29
|
+
auctionUpgradeNewInstance,
|
|
30
|
+
chainTimerService,
|
|
31
|
+
economicCommitteeCreatorFacet: electorateCreatorFacet,
|
|
32
|
+
reserveKit,
|
|
33
|
+
vaultFactoryKit,
|
|
34
|
+
zoe,
|
|
35
|
+
priceAuthority8400,
|
|
36
|
+
newContractGovBundleId: newContractGovBundleIdP,
|
|
37
|
+
},
|
|
38
|
+
produce: {
|
|
39
|
+
auctionUpgradeNewInstance: auctionUpgradeNewInstanceProducer,
|
|
40
|
+
newContractGovBundleId: newContractGovBundleIdErasor,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{ options: { VaultFactoryBundle: vaultBundleRef } },
|
|
44
|
+
) => {
|
|
45
|
+
const kit = await vaultFactoryKit;
|
|
46
|
+
const { instance: directorInstance } = kit;
|
|
47
|
+
const allBrands = await E(zoe).getBrands(directorInstance);
|
|
48
|
+
const { Minted: _istBrand, ...vaultBrands } = allBrands;
|
|
49
|
+
|
|
50
|
+
await priceAuthority8400;
|
|
51
|
+
|
|
52
|
+
const auctionNewInstance = await auctionUpgradeNewInstance;
|
|
53
|
+
auctionUpgradeNewInstanceProducer.reset();
|
|
54
|
+
const publicFacet = E(zoe).getPublicFacet(auctionNewInstance);
|
|
55
|
+
/** @type {import('@agoric/inter-protocol/src/auction/scheduler.js').FullSchedule} */
|
|
56
|
+
const schedules = await E(publicFacet).getSchedules();
|
|
57
|
+
const now = await E(chainTimerService).getCurrentTimestamp();
|
|
58
|
+
(schedules.nextAuctionSchedule &&
|
|
59
|
+
TimeMath.compareAbs(schedules.nextAuctionSchedule.startTime, now) > 0) ||
|
|
60
|
+
Fail`Expected next start time in the future ${schedules.nextAuctionSchedule?.startTime}`;
|
|
61
|
+
|
|
62
|
+
const readCurrentDirectorParams = async () => {
|
|
63
|
+
const { publicFacet: directorPF } = kit;
|
|
64
|
+
|
|
65
|
+
await null;
|
|
66
|
+
|
|
67
|
+
const subscription = E(directorPF).getElectorateSubscription();
|
|
68
|
+
const notifier = makeNotifierFromAsyncIterable(subscription);
|
|
69
|
+
const { updateCount } = await notifier.getUpdateSince();
|
|
70
|
+
|
|
71
|
+
// subscribeAfter(<some known state>) retrieves the latest value.
|
|
72
|
+
const after = await E(subscription).subscribeAfter(updateCount);
|
|
73
|
+
const { current } = after.head.value;
|
|
74
|
+
|
|
75
|
+
return harden({
|
|
76
|
+
MinInitialDebt: current.MinInitialDebt.value,
|
|
77
|
+
ReferencedUI: current.ReferencedUI.value,
|
|
78
|
+
RecordingPeriod: current.RecordingPeriod.value,
|
|
79
|
+
ChargingPeriod: current.ChargingPeriod.value,
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const directorParamOverrides = await readCurrentDirectorParams();
|
|
83
|
+
trace({ directorParamOverrides });
|
|
84
|
+
|
|
85
|
+
const readManagerParams = async () => {
|
|
86
|
+
const { publicFacet: directorPF } = kit;
|
|
87
|
+
|
|
88
|
+
await null;
|
|
89
|
+
|
|
90
|
+
const params = {};
|
|
91
|
+
for (const kwd of Object.keys(vaultBrands)) {
|
|
92
|
+
const collateralBrand = vaultBrands[kwd];
|
|
93
|
+
|
|
94
|
+
/** @type {any} */
|
|
95
|
+
const governedParams = await E(directorPF).getGovernedParams({
|
|
96
|
+
collateralBrand,
|
|
97
|
+
});
|
|
98
|
+
trace({ kwd, governedParams });
|
|
99
|
+
params[kwd] = harden({
|
|
100
|
+
brand: collateralBrand,
|
|
101
|
+
debtLimit: governedParams.DebtLimit.value,
|
|
102
|
+
interestRate: governedParams.InterestRate.value,
|
|
103
|
+
liquidationMargin: governedParams.LiquidationMargin.value,
|
|
104
|
+
liquidationPadding: governedParams.LiquidationPadding.value,
|
|
105
|
+
liquidationPenalty: governedParams.LiquidationPenalty.value,
|
|
106
|
+
mintFee: governedParams.MintFee.value,
|
|
107
|
+
});
|
|
108
|
+
trace(kwd, params[kwd]);
|
|
109
|
+
}
|
|
110
|
+
return params;
|
|
111
|
+
};
|
|
112
|
+
const managerParamValues = await readManagerParams();
|
|
113
|
+
|
|
114
|
+
// upgrade the vaultFactory
|
|
115
|
+
const upgradeVaultFactory = async () => {
|
|
116
|
+
// @ts-expect-error cast XXX privateArgs missing from type
|
|
117
|
+
const { privateArgs } = kit;
|
|
118
|
+
|
|
119
|
+
const shortfallInvitation = await E(
|
|
120
|
+
E.get(reserveKit).creatorFacet,
|
|
121
|
+
).makeShortfallReportingInvitation();
|
|
122
|
+
|
|
123
|
+
const poserInvitation = await E(
|
|
124
|
+
electorateCreatorFacet,
|
|
125
|
+
).getPoserInvitation();
|
|
126
|
+
|
|
127
|
+
/** @type {import('../../src/vaultFactory/vaultFactory').VaultFactoryContract['privateArgs']} */
|
|
128
|
+
const newPrivateArgs = harden({
|
|
129
|
+
...privateArgs,
|
|
130
|
+
auctioneerInstance: auctionNewInstance,
|
|
131
|
+
initialPoserInvitation: poserInvitation,
|
|
132
|
+
initialShortfallInvitation: shortfallInvitation,
|
|
133
|
+
managerParams: managerParamValues,
|
|
134
|
+
directorParamOverrides,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const upgradeResult = await E(kit.adminFacet).upgradeContract(
|
|
138
|
+
vaultBundleRef.bundleID,
|
|
139
|
+
newPrivateArgs,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
trace('upgraded vaultFactory.', upgradeResult);
|
|
143
|
+
};
|
|
144
|
+
await upgradeVaultFactory();
|
|
145
|
+
|
|
146
|
+
// @ts-expect-error It's saved in econ-behaviors.js:startVaultFactory()
|
|
147
|
+
const vaultFactoryPrivateArgs = kit.privateArgs;
|
|
148
|
+
trace('restarting governor');
|
|
149
|
+
|
|
150
|
+
const [ecf, newContractGovBundleId] = await Promise.all([
|
|
151
|
+
electorateCreatorFacet,
|
|
152
|
+
newContractGovBundleIdP,
|
|
153
|
+
]);
|
|
154
|
+
newContractGovBundleIdErasor.reset();
|
|
155
|
+
|
|
156
|
+
// upgrade vaultFactory governor. Won't be needed next time: see #10063
|
|
157
|
+
await E(kit.governorAdminFacet).upgradeContract(
|
|
158
|
+
newContractGovBundleId,
|
|
159
|
+
harden({
|
|
160
|
+
electorateCreatorFacet: ecf,
|
|
161
|
+
governed: vaultFactoryPrivateArgs,
|
|
162
|
+
}),
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
trace('restarted governor');
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const uV = 'upgradeVaults';
|
|
169
|
+
/**
|
|
170
|
+
* Return the manifest, installations, and options for upgrading Vaults.
|
|
171
|
+
*
|
|
172
|
+
* @param {object} utils
|
|
173
|
+
* @param {any} utils.restoreRef
|
|
174
|
+
* @param {any} vaultUpgradeOptions
|
|
175
|
+
*/
|
|
176
|
+
export const getManifestForUpgradeVaults = async (
|
|
177
|
+
{ restoreRef },
|
|
178
|
+
{ VaultFactoryRef },
|
|
179
|
+
) => {
|
|
180
|
+
return {
|
|
181
|
+
manifest: {
|
|
182
|
+
[upgradeVaults.name]: {
|
|
183
|
+
consume: {
|
|
184
|
+
priceAuthority8400: uV,
|
|
185
|
+
auctionUpgradeNewInstance: uV,
|
|
186
|
+
chainTimerService: uV,
|
|
187
|
+
economicCommitteeCreatorFacet: uV,
|
|
188
|
+
reserveKit: uV,
|
|
189
|
+
vaultFactoryKit: uV,
|
|
190
|
+
zoe: uV,
|
|
191
|
+
newContractGovBundleId: uV,
|
|
192
|
+
},
|
|
193
|
+
produce: {
|
|
194
|
+
auctionUpgradeNewInstance: uV,
|
|
195
|
+
newContractGovBundleId: uV,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
installations: { VaultFactory: restoreRef(VaultFactoryRef) },
|
|
200
|
+
options: { VaultFactoryBundle: VaultFactoryRef },
|
|
201
|
+
};
|
|
202
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function reserveThenGetNamePaths(nameAdmin: ERef<import("@agoric/vats").NameAdmin>, paths: string[][]): Promise<any[]>;
|
|
2
|
+
export function reserveThenGetNames(nameAdmin: ERef<import("@agoric/vats").NameAdmin>, names: string[]): Promise<any[]>;
|
|
3
|
+
export function reserveThenDeposit(debugName: string, namesByAddressAdmin: ERef<import("@agoric/vats").NameAdmin>, addr: string, payments: ERef<Payment>[]): Promise<void>;
|
|
4
|
+
export function makeInstallCache(homeP: Promise<{
|
|
5
|
+
scratch: ERef<import("@agoric/internal/src/scratch.js").ScratchPad>;
|
|
6
|
+
}>, { installCacheKey, loadBundle }: {
|
|
7
|
+
loadBundle: (specifier: string) => Promise<{
|
|
8
|
+
default: Bundle;
|
|
9
|
+
}>;
|
|
10
|
+
installCacheKey?: string | undefined;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
wrapInstall: (install: any) => (mPath: any, bPath: any, opts: any) => Promise<any>;
|
|
13
|
+
saveCache: () => Promise<void>;
|
|
14
|
+
}>;
|
|
15
|
+
export function oracleBrandFeedName(inBrandName: any, outBrandName: any): string;
|
|
16
|
+
export function scaledPriceFeedName(issuerName: any): string;
|
|
17
|
+
/** @type {(name: string) => string} */
|
|
18
|
+
export const sanitizePathSegment: (name: string) => string;
|
|
19
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAYO,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"}
|
package/src/proposals/utils.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Fail } from '@endo/errors';
|
|
2
|
+
import { E } from '@endo/far';
|
|
1
3
|
import { WalletName } from '@agoric/internal';
|
|
2
4
|
import { getCopyMapEntries, makeCopyMap } from '@agoric/store';
|
|
3
|
-
import {
|
|
5
|
+
import { assertPathSegment } from '@agoric/internal/src/lib-chainStorage.js';
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
/** @import {CopyMap} from '@endo/patterns'; */
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* @param {ERef<import('@agoric/vats').NameAdmin>} nameAdmin
|
|
@@ -10,7 +12,6 @@ const { Fail } = assert;
|
|
|
10
12
|
*/
|
|
11
13
|
export const reserveThenGetNamePaths = async (nameAdmin, paths) => {
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
14
15
|
* @param {ERef<import('@agoric/vats').NameAdmin>} nextAdmin
|
|
15
16
|
* @param {string[]} path
|
|
16
17
|
*/
|
|
@@ -54,7 +55,7 @@ export const reserveThenGetNames = async (nameAdmin, names) =>
|
|
|
54
55
|
* @param {string} debugName
|
|
55
56
|
* @param {ERef<import('@agoric/vats').NameAdmin>} namesByAddressAdmin
|
|
56
57
|
* @param {string} addr
|
|
57
|
-
* @param {
|
|
58
|
+
* @param {ERef<Payment>[]} payments
|
|
58
59
|
*/
|
|
59
60
|
export const reserveThenDeposit = async (
|
|
60
61
|
debugName,
|
|
@@ -79,7 +80,15 @@ export const reserveThenDeposit = async (
|
|
|
79
80
|
);
|
|
80
81
|
};
|
|
81
82
|
|
|
82
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* @type {<T>(
|
|
85
|
+
* store: ERef<
|
|
86
|
+
* Map<string, T> | import('@agoric/internal/src/scratch.js').ScratchPad
|
|
87
|
+
* >,
|
|
88
|
+
* key: string,
|
|
89
|
+
* make: () => T,
|
|
90
|
+
* ) => Promise<T>}
|
|
91
|
+
*/
|
|
83
92
|
const provideWhen = async (store, key, make) => {
|
|
84
93
|
const found = await E(store).get(key);
|
|
85
94
|
if (found) {
|
|
@@ -91,21 +100,33 @@ const provideWhen = async (store, key, make) => {
|
|
|
91
100
|
};
|
|
92
101
|
|
|
93
102
|
/**
|
|
94
|
-
* @param {{
|
|
103
|
+
* @param {Promise<{
|
|
104
|
+
* scratch: ERef<import('@agoric/internal/src/scratch.js').ScratchPad>;
|
|
105
|
+
* }>} homeP
|
|
95
106
|
* @param {object} opts
|
|
96
|
-
* @param {(specifier: string) => Promise<{default: Bundle}>} opts.loadBundle
|
|
107
|
+
* @param {(specifier: string) => Promise<{ default: Bundle }>} opts.loadBundle
|
|
97
108
|
* @param {string} [opts.installCacheKey]
|
|
98
109
|
*/
|
|
99
110
|
export const makeInstallCache = async (
|
|
100
111
|
homeP,
|
|
101
112
|
{ installCacheKey = 'installCache', loadBundle },
|
|
102
113
|
) => {
|
|
103
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* @type {CopyMap<
|
|
116
|
+
* string,
|
|
117
|
+
* { installation: Installation; boardId: string; path?: string }
|
|
118
|
+
* >}
|
|
119
|
+
*/
|
|
104
120
|
const initial = await provideWhen(E.get(homeP).scratch, installCacheKey, () =>
|
|
105
121
|
makeCopyMap([]),
|
|
106
122
|
);
|
|
107
123
|
// ISSUE: getCopyMapEntries of CopyMap<K, V> loses K, V.
|
|
108
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* @type {Map<
|
|
126
|
+
* string,
|
|
127
|
+
* { installation: Installation; boardId: string; path?: string }
|
|
128
|
+
* >}
|
|
129
|
+
*/
|
|
109
130
|
const working = new Map(getCopyMapEntries(initial));
|
|
110
131
|
|
|
111
132
|
const saveCache = async () => {
|
|
@@ -137,3 +158,16 @@ export const makeInstallCache = async (
|
|
|
137
158
|
|
|
138
159
|
return { wrapInstall, saveCache };
|
|
139
160
|
};
|
|
161
|
+
|
|
162
|
+
export const oracleBrandFeedName = (inBrandName, outBrandName) =>
|
|
163
|
+
`${inBrandName}-${outBrandName} price feed`;
|
|
164
|
+
|
|
165
|
+
export const scaledPriceFeedName = issuerName =>
|
|
166
|
+
`scaledPriceAuthority-${issuerName}`;
|
|
167
|
+
|
|
168
|
+
/** @type {(name: string) => string} */
|
|
169
|
+
export const sanitizePathSegment = name => {
|
|
170
|
+
const candidate = name.replace(/ /g, '_');
|
|
171
|
+
assertPathSegment(candidate);
|
|
172
|
+
return candidate;
|
|
173
|
+
};
|