@agoric/inter-protocol 0.16.2-upgrade-14-dev-c8f9e7b.0 → 0.16.2-upgrade-16-fi-dev-8879538.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/package.json +41 -34
- package/scripts/build-bundles.js +5 -21
- package/src/auction/auctionBook.d.ts +84 -0
- package/src/auction/auctionBook.d.ts.map +1 -0
- package/src/auction/auctionBook.js +135 -103
- package/src/auction/auctioneer.d.ts +83 -0
- package/src/auction/auctioneer.d.ts.map +1 -0
- package/src/auction/auctioneer.js +63 -49
- 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 +149 -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 +17 -15
- package/src/auction/scheduler.d.ts +49 -0
- package/src/auction/scheduler.d.ts.map +1 -0
- package/src/auction/scheduler.js +51 -43
- package/src/auction/sortedOffers.d.ts +8 -0
- package/src/auction/sortedOffers.d.ts.map +1 -0
- package/src/auction/sortedOffers.js +9 -7
- package/src/auction/util.d.ts +32 -0
- package/src/auction/util.d.ts.map +1 -0
- package/src/auction/util.js +6 -4
- package/src/clientSupport.d.ts +167 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +97 -40
- 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 +14 -12
- package/src/econCommitteeCharter.d.ts +39 -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 +21 -16
- package/src/price/README.md +13 -0
- package/src/price/fluxAggregatorContract.d.ts +70 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -0
- package/src/price/fluxAggregatorContract.js +62 -55
- package/src/price/fluxAggregatorKit.d.ts +103 -0
- package/src/price/fluxAggregatorKit.d.ts.map +1 -0
- package/src/price/fluxAggregatorKit.js +50 -37
- package/src/price/priceOracleKit.d.ts +38 -0
- package/src/price/priceOracleKit.d.ts.map +1 -0
- package/src/price/priceOracleKit.js +11 -13
- package/src/price/roundsManager.d.ts +238 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +77 -82
- package/src/proposals/README.md +2 -3
- package/src/proposals/add-auction.d.ts +69 -0
- package/src/proposals/add-auction.d.ts.map +1 -0
- package/src/proposals/add-auction.js +181 -0
- package/src/proposals/addAssetToVault.d.ts +160 -0
- package/src/proposals/addAssetToVault.d.ts.map +1 -0
- package/src/proposals/addAssetToVault.js +172 -38
- 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/econ-behaviors.d.ts +1169 -0
- package/src/proposals/econ-behaviors.d.ts.map +1 -0
- package/src/proposals/econ-behaviors.js +66 -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 +108 -51
- 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 +38 -27
- 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 +35 -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 +17 -0
- package/src/proposals/utils.d.ts.map +1 -0
- package/src/proposals/utils.js +34 -7
- package/src/provisionPool.d.ts +167 -0
- package/src/provisionPool.d.ts.map +1 -0
- package/src/provisionPool.js +122 -0
- package/src/provisionPoolKit.d.ts +770 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +463 -0
- package/src/psm/psm.d.ts +122 -0
- package/src/psm/psm.d.ts.map +1 -0
- package/src/psm/psm.js +73 -69
- 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 +18 -24
- 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 +163 -0
- package/src/vaultFactory/liquidation.d.ts.map +1 -0
- package/src/vaultFactory/liquidation.js +36 -22
- 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 +360 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +8 -11
- package/src/vaultFactory/params.d.ts +145 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +52 -24
- package/src/vaultFactory/prioritizedVaults.d.ts +992 -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 +234 -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 +402 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +99 -93
- package/src/vaultFactory/vaultDirector.d.ts +388 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +61 -50
- package/src/vaultFactory/vaultFactory.d.ts +277 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +49 -32
- package/src/vaultFactory/vaultHolder.d.ts +270 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +10 -14
- package/src/vaultFactory/vaultKit.d.ts +102 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +5 -4
- package/src/vaultFactory/vaultManager.d.ts +819 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +248 -151
- package/CHANGELOG.md +0 -1066
- package/exported.js +0 -2
- package/scripts/add-collateral-core.js +0 -113
- package/scripts/deploy-contracts.js +0 -100
- package/scripts/init-core.js +0 -200
- 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
|
@@ -21,8 +21,8 @@ const sanitizePathSegment = name => {
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* @param {import('./econ-behaviors').EconomyBootstrapPowers} powers
|
|
25
|
-
* @param {object}
|
|
24
|
+
* @param {import('./econ-behaviors.js').EconomyBootstrapPowers} powers
|
|
25
|
+
* @param {object} config
|
|
26
26
|
* @param {object} [config.options]
|
|
27
27
|
* @param {EconCommitteeOptions} [config.options.econCommitteeOptions]
|
|
28
28
|
*/
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export function startPSM({ vatParameters: { chainStorageEntries }, consume: { agoricNamesAdmin, board, diagnostics, zoe, feeMintAccess: feeMintAccessP, economicCommitteeCreatorFacet, econCharterKit, provisionPoolStartResult, chainStorage, chainTimerService, psmKit, anchorBalancePayments: anchorBalancePaymentsP, }, produce: { psmKit: producepsmKit }, installation: { consume: { contractGovernor, psm: psmInstall }, }, brand: { consume: { [Stable.symbol]: mintedP }, }, }: WellKnownSpaces & ChainBootstrapSpace & EconomyBootstrapSpace & ChainStorageVatParams, { options: { anchorOptions }, WantMintedFeeBP, GiveMintedFeeBP, MINT_LIMIT, }?: {
|
|
2
|
+
WantMintedFeeBP?: bigint | undefined;
|
|
3
|
+
GiveMintedFeeBP?: bigint | undefined;
|
|
4
|
+
MINT_LIMIT?: bigint | undefined;
|
|
5
|
+
options?: {
|
|
6
|
+
anchorOptions?: AnchorOptions;
|
|
7
|
+
} | undefined;
|
|
8
|
+
} | undefined): Promise<void>;
|
|
9
|
+
export function makeAnchorAsset({ vatParameters: { chainStorageEntries }, consume: { agoricNamesAdmin, bankManager, startUpgradable, anchorBalancePayments, }, installation: { consume: { mintHolder }, }, produce: { testFirstAnchorKit, anchorBalancePayments: produceAnchorBalancePayments, }, }: WellKnownSpaces & ChainBootstrapSpace & EconomyBootstrapSpace & ChainStorageVatParams, { options: { anchorOptions } }: {
|
|
10
|
+
options: {
|
|
11
|
+
anchorOptions?: AnchorOptions;
|
|
12
|
+
};
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
/** @import {EconomyBootstrapSpace} from './econ-behaviors.js' */
|
|
15
|
+
export const INVITE_PSM_COMMITTEE_MANIFEST: BootstrapManifest;
|
|
16
|
+
/** @type {BootstrapManifest} */
|
|
17
|
+
export const PSM_MANIFEST: BootstrapManifest;
|
|
18
|
+
export function getManifestForPsmGovernance({ restoreRef }: {
|
|
19
|
+
restoreRef: any;
|
|
20
|
+
}, { installKeys }: {
|
|
21
|
+
installKeys: any;
|
|
22
|
+
}): {
|
|
23
|
+
manifest: {};
|
|
24
|
+
installations: {
|
|
25
|
+
econCommitteeCharter: any;
|
|
26
|
+
contractGovernor: any;
|
|
27
|
+
committee: any;
|
|
28
|
+
binaryVoteCounter: any;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export function getManifestForPsm({ restoreRef }: {
|
|
32
|
+
restoreRef: any;
|
|
33
|
+
}, { installKeys, anchorOptions }: {
|
|
34
|
+
installKeys: any;
|
|
35
|
+
anchorOptions: any;
|
|
36
|
+
}): {
|
|
37
|
+
manifest: BootstrapManifest;
|
|
38
|
+
installations: {
|
|
39
|
+
psm: any;
|
|
40
|
+
mintHolder: any;
|
|
41
|
+
};
|
|
42
|
+
options: {
|
|
43
|
+
anchorOptions: any;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export type AnchorOptions = {
|
|
47
|
+
denom?: string | undefined;
|
|
48
|
+
keyword?: string | undefined;
|
|
49
|
+
decimalPlaces?: number | undefined;
|
|
50
|
+
proposedName?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
import { inviteCommitteeMembers } from './committee-proposal.js';
|
|
53
|
+
import { startEconCharter } from './committee-proposal.js';
|
|
54
|
+
import { inviteToEconCharter } from './committee-proposal.js';
|
|
55
|
+
import type { EconomyBootstrapSpace } from './econ-behaviors.js';
|
|
56
|
+
import { Stable } from '@agoric/internal/src/tokens.js';
|
|
57
|
+
import type { BootstrapManifest } from '@agoric/vats/src/core/lib-boot.js';
|
|
58
|
+
export { inviteCommitteeMembers, startEconCharter, inviteToEconCharter };
|
|
59
|
+
//# sourceMappingURL=startPSM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startPSM.d.ts","sourceRoot":"","sources":["startPSM.js"],"names":[],"mappings":"AAuFO;;;;;wBAFsB,aAAa;;8BAsMzC;AAuBM,4ZAFI;IAAE,OAAO,EAAE;QAAE,aAAa,CAAC,EAAE,aAAa,CAAA;KAAE,CAAA;CAAE,iBAoGxD;AAGD,iEAAiE;AAEjE,8DAiBE;AAEF,gCAAgC;AAChC,6CA4CE;AAGK;;;;;;;;;;;;EAaN;AAEM;;;;;;;;;;;;;;EAcN;;;;;;;uCAleM,yBAAyB;iCAAzB,yBAAyB;oCAAzB,yBAAyB;2CAgYS,qBAAqB;uBAxYvC,gCAAgC;uCAUlB,mCAAmC"}
|
|
@@ -6,14 +6,14 @@ import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance';
|
|
|
6
6
|
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
|
|
7
7
|
import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js';
|
|
8
8
|
import { E } from '@endo/far';
|
|
9
|
-
import { Stable } from '@agoric/vats/src/tokens.js';
|
|
10
9
|
import {
|
|
11
10
|
makeHistoryReviver,
|
|
12
11
|
makeBoardRemote,
|
|
13
12
|
slotToBoardRemote,
|
|
14
|
-
} from '@agoric/
|
|
13
|
+
} from '@agoric/internal/src/marshal.js';
|
|
15
14
|
import { deeplyFulfilledObject } from '@agoric/internal';
|
|
16
15
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
16
|
+
import { Stable } from '@agoric/internal/src/tokens.js';
|
|
17
17
|
|
|
18
18
|
import { reserveThenGetNamePaths } from './utils.js';
|
|
19
19
|
|
|
@@ -23,9 +23,9 @@ import {
|
|
|
23
23
|
inviteToEconCharter,
|
|
24
24
|
} from './committee-proposal.js';
|
|
25
25
|
|
|
26
|
-
/** @
|
|
27
|
-
/** @
|
|
28
|
-
/** @
|
|
26
|
+
/** @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js' */
|
|
27
|
+
/** @import {MetricsNotification} from '../psm/psm.js' */
|
|
28
|
+
/** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */
|
|
29
29
|
|
|
30
30
|
const BASIS_POINTS = 10000n;
|
|
31
31
|
const { details: X } = assert;
|
|
@@ -35,10 +35,13 @@ export { inviteCommitteeMembers, startEconCharter, inviteToEconCharter };
|
|
|
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,23 @@ export const makeAnchorAsset = async (
|
|
|
345
347
|
}),
|
|
346
348
|
);
|
|
347
349
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
350
|
+
const { creatorFacet: mint, publicFacet: issuer } = /**
|
|
351
|
+
* @type {{
|
|
352
|
+
* creatorFacet: ERef<Mint<'nat'>>;
|
|
353
|
+
* publicFacet: ERef<Issuer<'nat'>>;
|
|
354
|
+
* }}
|
|
355
|
+
*/ (
|
|
356
|
+
await E(startUpgradable)({
|
|
357
|
+
installation: mintHolder,
|
|
358
|
+
label: keyword,
|
|
359
|
+
terms,
|
|
360
|
+
})
|
|
361
|
+
);
|
|
355
362
|
|
|
356
363
|
const brand = await E(issuer).getBrand();
|
|
357
364
|
const kit = harden({ mint, issuer, brand });
|
|
358
365
|
|
|
366
|
+
// @ts-expect-error XXX AssetIssuerKit
|
|
359
367
|
testFirstAnchorKit.resolve(kit);
|
|
360
368
|
|
|
361
369
|
const toSlotReviver = makeHistoryReviver(
|
|
@@ -363,23 +371,25 @@ export const makeAnchorAsset = async (
|
|
|
363
371
|
slotToBoardRemote,
|
|
364
372
|
);
|
|
365
373
|
const metricsKey = `${stablePsmKey}.${keyword}.metrics`;
|
|
366
|
-
|
|
374
|
+
const maybeReviveMetrics = async () => {
|
|
375
|
+
if (!toSlotReviver.has(metricsKey)) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
367
378
|
const metrics = toSlotReviver.getItem(metricsKey);
|
|
368
379
|
produceAnchorBalancePayments.resolve(
|
|
369
380
|
makeScalarBigMapStore('Anchor balance payments', { durable: true }),
|
|
370
381
|
);
|
|
371
382
|
// XXX this rule should only apply to the 1st await
|
|
372
|
-
// eslint-disable-next-line @jessie.js/no-nested-await
|
|
373
383
|
const anchorPaymentMap = await anchorBalancePayments;
|
|
374
384
|
|
|
375
385
|
// TODO: validate that `metrics.anchorPoolBalance.value` is
|
|
376
386
|
// pass-by-copy PureData (e.g., contains no remotables).
|
|
377
|
-
// eslint-disable-next-line @jessie.js/no-nested-await
|
|
378
387
|
const pmt = await E(mint).mintPayment(
|
|
379
388
|
AmountMath.make(brand, metrics.anchorPoolBalance.value),
|
|
380
389
|
);
|
|
381
390
|
anchorPaymentMap.init(brand, pmt);
|
|
382
|
-
}
|
|
391
|
+
};
|
|
392
|
+
await maybeReviveMetrics();
|
|
383
393
|
|
|
384
394
|
await Promise.all([
|
|
385
395
|
E(E(agoricNamesAdmin).lookupAdmin('issuer')).update(keyword, kit.issuer),
|
|
@@ -388,13 +398,14 @@ export const makeAnchorAsset = async (
|
|
|
388
398
|
denom,
|
|
389
399
|
keyword,
|
|
390
400
|
proposedName,
|
|
401
|
+
// @ts-expect-error XXX AssetIssuerKit
|
|
391
402
|
kit, // with mint
|
|
392
403
|
),
|
|
393
404
|
]);
|
|
394
405
|
};
|
|
395
406
|
harden(makeAnchorAsset);
|
|
396
407
|
|
|
397
|
-
/** @
|
|
408
|
+
/** @import {EconomyBootstrapSpace} from './econ-behaviors.js' */
|
|
398
409
|
|
|
399
410
|
export const INVITE_PSM_COMMITTEE_MANIFEST = harden(
|
|
400
411
|
/** @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,35 @@
|
|
|
1
|
+
export function upgradeVaults(powers: import("../../src/proposals/econ-behaviors").EconomyBootstrapPowers, { options }: {
|
|
2
|
+
options: {
|
|
3
|
+
vaultsRef: {
|
|
4
|
+
bundleID: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export function getManifestForUpgradeVaults(_ign: object, vaultUpgradeOptions: any): Promise<{
|
|
9
|
+
manifest: {
|
|
10
|
+
[x: string]: {
|
|
11
|
+
consume: {
|
|
12
|
+
agoricNamesAdmin: string;
|
|
13
|
+
newAuctioneerKit: string;
|
|
14
|
+
economicCommitteeCreatorFacet: string;
|
|
15
|
+
priceAuthority: string;
|
|
16
|
+
reserveKit: string;
|
|
17
|
+
vaultFactoryKit: string;
|
|
18
|
+
board: string;
|
|
19
|
+
zoe: string;
|
|
20
|
+
};
|
|
21
|
+
produce: {
|
|
22
|
+
auctioneerKit: string;
|
|
23
|
+
newAuctioneerKit: string;
|
|
24
|
+
};
|
|
25
|
+
instance: {
|
|
26
|
+
produce: {
|
|
27
|
+
auctioneer: string;
|
|
28
|
+
newAuctioneerKit: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
options: any;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=upgrade-vaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-vaults.d.ts","sourceRoot":"","sources":["upgrade-vaults.js"],"names":[],"mappings":"AA8BO,sCAHI,OAAO,oCAAoC,EAAE,sBAAsB,eACnE;IAAE,OAAO,EAAE;QAAE,SAAS,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,iBA+I1D;AASM,kDAHI,MAAM,uBACN,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GAuBZ"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { E } from '@endo/far';
|
|
2
|
+
import { makeNotifierFromAsyncIterable } from '@agoric/notifier';
|
|
3
|
+
import { AmountMath } from '@agoric/ertp/src/index.js';
|
|
4
|
+
import { makeTracer } from '@agoric/internal/src/index.js';
|
|
5
|
+
|
|
6
|
+
const trace = makeTracer('upgrade Vaults proposal');
|
|
7
|
+
|
|
8
|
+
// stand-in for Promise.any() which isn't available at this point.
|
|
9
|
+
const any = promises =>
|
|
10
|
+
new Promise((resolve, reject) => {
|
|
11
|
+
for (const promise of promises) {
|
|
12
|
+
promise.then(resolve);
|
|
13
|
+
}
|
|
14
|
+
void Promise.allSettled(promises).then(results => {
|
|
15
|
+
const rejects = results.filter(({ status }) => status === 'rejected');
|
|
16
|
+
if (rejects.length === results.length) {
|
|
17
|
+
// @ts-expect-error TypeScript doesn't know enough
|
|
18
|
+
const messages = rejects.map(({ message }) => message);
|
|
19
|
+
const aggregate = new Error(messages.join(';'));
|
|
20
|
+
// @ts-expect-error TypeScript doesn't know enough
|
|
21
|
+
aggregate.errors = rejects.map(({ reason }) => reason);
|
|
22
|
+
reject(aggregate);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param {import('../../src/proposals/econ-behaviors').EconomyBootstrapPowers} powers
|
|
29
|
+
* @param {{ options: { vaultsRef: { bundleID: string } } }} options
|
|
30
|
+
*/
|
|
31
|
+
export const upgradeVaults = async (powers, { options }) => {
|
|
32
|
+
const {
|
|
33
|
+
consume: {
|
|
34
|
+
agoricNamesAdmin,
|
|
35
|
+
newAuctioneerKit: auctioneerKitP,
|
|
36
|
+
priceAuthority,
|
|
37
|
+
vaultFactoryKit,
|
|
38
|
+
zoe,
|
|
39
|
+
economicCommitteeCreatorFacet: electorateCreatorFacet,
|
|
40
|
+
reserveKit,
|
|
41
|
+
},
|
|
42
|
+
produce: {
|
|
43
|
+
auctioneerKit: auctioneerKitProducer,
|
|
44
|
+
newAuctioneerKit: tempAuctioneerKit,
|
|
45
|
+
},
|
|
46
|
+
instance: {
|
|
47
|
+
produce: { auctioneer: auctioneerProducer },
|
|
48
|
+
},
|
|
49
|
+
} = powers;
|
|
50
|
+
const { vaultsRef } = options;
|
|
51
|
+
const kit = await vaultFactoryKit;
|
|
52
|
+
const auctioneerKit = await auctioneerKitP;
|
|
53
|
+
const { instance: directorInstance } = kit;
|
|
54
|
+
const allBrands = await E(zoe).getBrands(directorInstance);
|
|
55
|
+
const { Minted: istBrand, ...vaultBrands } = allBrands;
|
|
56
|
+
|
|
57
|
+
const bundleID = vaultsRef.bundleID;
|
|
58
|
+
console.log(`upgradeVaults: bundleId`, bundleID);
|
|
59
|
+
/**
|
|
60
|
+
* @type {Promise<
|
|
61
|
+
* Installation<import('../../src/vaultFactory/vaultFactory.js')['start']>
|
|
62
|
+
* >}
|
|
63
|
+
*/
|
|
64
|
+
let installationP;
|
|
65
|
+
await null;
|
|
66
|
+
if (vaultsRef) {
|
|
67
|
+
if (bundleID) {
|
|
68
|
+
installationP = E(zoe).installBundleID(bundleID);
|
|
69
|
+
await E.when(
|
|
70
|
+
installationP,
|
|
71
|
+
installation =>
|
|
72
|
+
E(E(agoricNamesAdmin).lookupAdmin('installation')).update(
|
|
73
|
+
'vaultFactory',
|
|
74
|
+
installation,
|
|
75
|
+
),
|
|
76
|
+
err =>
|
|
77
|
+
console.error(`🚨 failed to update vaultFactory installation`, err),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const readManagerParams = async () => {
|
|
83
|
+
const { publicFacet: directorPF } = kit;
|
|
84
|
+
|
|
85
|
+
await null;
|
|
86
|
+
|
|
87
|
+
const params = {};
|
|
88
|
+
for (const kwd of Object.keys(vaultBrands)) {
|
|
89
|
+
const collateralBrand = vaultBrands[kwd];
|
|
90
|
+
const subscription = E(directorPF).getSubscription({
|
|
91
|
+
collateralBrand,
|
|
92
|
+
});
|
|
93
|
+
const notifier = makeNotifierFromAsyncIterable(subscription);
|
|
94
|
+
let { value, updateCount } = await notifier.getUpdateSince(0n);
|
|
95
|
+
// @ts-expect-error It's an amount.
|
|
96
|
+
while (AmountMath.isEmpty(value.current.DebtLimit.value)) {
|
|
97
|
+
({ value, updateCount } = await notifier.getUpdateSince(updateCount));
|
|
98
|
+
trace(`debtLimit was empty, retried`, value.current.DebtLimit.value);
|
|
99
|
+
}
|
|
100
|
+
trace(kwd, 'params at', updateCount, 'are', value.current);
|
|
101
|
+
params[kwd] = harden({
|
|
102
|
+
brand: collateralBrand,
|
|
103
|
+
debtLimit: value.current.DebtLimit.value,
|
|
104
|
+
interestRate: value.current.InterestRate.value,
|
|
105
|
+
liquidationMargin: value.current.LiquidationMargin.value,
|
|
106
|
+
liquidationPadding: value.current.LiquidationPadding.value,
|
|
107
|
+
liquidationPenalty: value.current.LiquidationPenalty.value,
|
|
108
|
+
mintFee: value.current.MintFee.value,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return params;
|
|
112
|
+
};
|
|
113
|
+
const managerParamValues = await readManagerParams();
|
|
114
|
+
|
|
115
|
+
// upgrade the vaultFactory
|
|
116
|
+
const upgradeVaultFactory = async () => {
|
|
117
|
+
// @ts-expect-error cast XXX privateArgs missing from type
|
|
118
|
+
const { privateArgs } = kit;
|
|
119
|
+
|
|
120
|
+
const shortfallInvitation = await E(
|
|
121
|
+
E.get(reserveKit).creatorFacet,
|
|
122
|
+
).makeShortfallReportingInvitation();
|
|
123
|
+
|
|
124
|
+
const poserInvitation = await E(
|
|
125
|
+
electorateCreatorFacet,
|
|
126
|
+
).getPoserInvitation();
|
|
127
|
+
/** @type {import('../../src/vaultFactory/vaultFactory').VaultFactoryContract['privateArgs']} */
|
|
128
|
+
const newPrivateArgs = harden({
|
|
129
|
+
...privateArgs,
|
|
130
|
+
// @ts-expect-error It has a value until reset after the upgrade
|
|
131
|
+
auctioneerInstance: auctioneerKit.instance,
|
|
132
|
+
initialPoserInvitation: poserInvitation,
|
|
133
|
+
initialShortfallInvitation: shortfallInvitation,
|
|
134
|
+
managerParams: managerParamValues,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const upgradeResult = await E(kit.adminFacet).upgradeContract(
|
|
138
|
+
bundleID,
|
|
139
|
+
newPrivateArgs,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
console.log('upgraded vaultFactory.', upgradeResult);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// Wait for at least one new price feed to be ready before upgrading Vaults
|
|
146
|
+
void E.when(
|
|
147
|
+
any(
|
|
148
|
+
Object.values(vaultBrands).map(brand =>
|
|
149
|
+
E(priceAuthority).quoteGiven(AmountMath.make(brand, 10n), istBrand),
|
|
150
|
+
),
|
|
151
|
+
),
|
|
152
|
+
async price => {
|
|
153
|
+
trace(`upgrading after delay`, price);
|
|
154
|
+
await upgradeVaultFactory();
|
|
155
|
+
auctioneerKitProducer.reset();
|
|
156
|
+
// @ts-expect-error auctioneerKit is non-null except between auctioneerKitProducer.reset() and auctioneerKitProducer.resolve()
|
|
157
|
+
auctioneerKitProducer.resolve(auctioneerKit);
|
|
158
|
+
auctioneerProducer.reset();
|
|
159
|
+
// @ts-expect-error auctioneerKit is non-null except between auctioneerKitProducer.reset() and auctioneerKitProducer.resolve()
|
|
160
|
+
auctioneerProducer.resolve(auctioneerKit.instance);
|
|
161
|
+
// We wanted it to be valid for only a short while.
|
|
162
|
+
tempAuctioneerKit.reset();
|
|
163
|
+
await E(E(agoricNamesAdmin).lookupAdmin('instance')).update(
|
|
164
|
+
'auctioneer',
|
|
165
|
+
// @ts-expect-error auctioneerKit is non-null except between auctioneerKitProducer.reset() and auctioneerKitProducer.resolve()
|
|
166
|
+
auctioneerKit.instance,
|
|
167
|
+
);
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
console.log(`upgradeVaults scheduled; waiting for priceFeeds`);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const uV = 'upgradeVaults';
|
|
175
|
+
/**
|
|
176
|
+
* Return the manifest, installations, and options for upgrading Vaults.
|
|
177
|
+
*
|
|
178
|
+
* @param {object} _ign
|
|
179
|
+
* @param {any} vaultUpgradeOptions
|
|
180
|
+
*/
|
|
181
|
+
export const getManifestForUpgradeVaults = async (
|
|
182
|
+
_ign,
|
|
183
|
+
vaultUpgradeOptions,
|
|
184
|
+
) => ({
|
|
185
|
+
manifest: {
|
|
186
|
+
[upgradeVaults.name]: {
|
|
187
|
+
consume: {
|
|
188
|
+
agoricNamesAdmin: uV,
|
|
189
|
+
newAuctioneerKit: uV,
|
|
190
|
+
economicCommitteeCreatorFacet: uV,
|
|
191
|
+
priceAuthority: uV,
|
|
192
|
+
reserveKit: uV,
|
|
193
|
+
vaultFactoryKit: uV,
|
|
194
|
+
board: uV,
|
|
195
|
+
zoe: uV,
|
|
196
|
+
},
|
|
197
|
+
produce: { auctioneerKit: uV, newAuctioneerKit: uV },
|
|
198
|
+
instance: { produce: { auctioneer: uV, newAuctioneerKit: uV } },
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
options: { ...vaultUpgradeOptions },
|
|
202
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
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: {
|
|
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
|
+
//# 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;IACV,OAAW,EAAE,IAAI,CAAC,OAAO,iCAAiC,EAAE,UAAU,CAAC,CAAC;CACrE;4BAEmB,MAAM;;;;;;;GAqD5B;AAEM,iFACsC;AAEtC,6DAC+B"}
|