@agoric/inter-protocol 0.16.2-other-dev-3eb1a1d.0 → 0.16.2-other-dev-d15096d.0.d15096d
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 +36 -35
- package/src/auction/auctionBook.d.ts +9 -7
- package/src/auction/auctionBook.d.ts.map +1 -1
- package/src/auction/auctionBook.js +58 -32
- package/src/auction/auctionMath.d.ts +1 -1
- package/src/auction/auctionMath.d.ts.map +1 -1
- package/src/auction/auctioneer.d.ts +19 -13
- package/src/auction/auctioneer.d.ts.map +1 -1
- package/src/auction/auctioneer.js +25 -12
- package/src/auction/offerBook.d.ts +3 -2
- package/src/auction/offerBook.d.ts.map +1 -1
- package/src/auction/offerBook.js +5 -1
- package/src/auction/params.d.ts +16 -7
- package/src/auction/params.d.ts.map +1 -1
- package/src/auction/params.js +12 -4
- package/src/auction/scheduleMath.d.ts +5 -3
- package/src/auction/scheduleMath.d.ts.map +1 -1
- package/src/auction/scheduleMath.js +11 -7
- package/src/auction/scheduler.d.ts +9 -4
- package/src/auction/scheduler.d.ts.map +1 -1
- package/src/auction/scheduler.js +14 -6
- package/src/auction/util.d.ts +2 -1
- package/src/auction/util.d.ts.map +1 -1
- package/src/auction/util.js +4 -1
- package/src/clientSupport.d.ts +29 -73
- package/src/clientSupport.d.ts.map +1 -1
- package/src/clientSupport.js +29 -128
- package/src/contractSupport.d.ts +2 -2
- package/src/contractSupport.d.ts.map +1 -1
- package/src/econCommitteeCharter.d.ts +15 -8
- package/src/econCommitteeCharter.d.ts.map +1 -1
- package/src/econCommitteeCharter.js +14 -8
- package/src/feeDistributor.d.ts +43 -49
- package/src/feeDistributor.d.ts.map +1 -1
- package/src/feeDistributor.js +7 -3
- package/src/index.js +1 -1
- package/src/interest-math.d.ts +1 -0
- package/src/interest-math.d.ts.map +1 -1
- package/src/interest-math.js +5 -1
- package/src/interest.d.ts +3 -1
- package/src/interest.d.ts.map +1 -1
- package/src/interest.js +2 -5
- package/src/price/README.md +1 -1
- package/src/price/fluxAggregatorContract.d.ts +20 -11
- package/src/price/fluxAggregatorContract.d.ts.map +1 -1
- package/src/price/fluxAggregatorContract.js +17 -9
- package/src/price/fluxAggregatorKit.d.ts +15 -9
- package/src/price/fluxAggregatorKit.d.ts.map +1 -1
- package/src/price/fluxAggregatorKit.js +15 -9
- package/src/price/priceOracleKit.d.ts +4 -2
- package/src/price/priceOracleKit.d.ts.map +1 -1
- package/src/price/priceOracleKit.js +7 -2
- package/src/price/roundsManager.d.ts +8 -6
- package/src/price/roundsManager.d.ts.map +1 -1
- package/src/price/roundsManager.js +5 -2
- package/src/proposals/add-auction.js +38 -4
- package/src/proposals/addAssetToVault.js +8 -4
- package/src/proposals/committee-proposal.js +10 -5
- package/src/proposals/core-proposal.js +9 -3
- package/src/proposals/deploy-price-feeds.js +35 -7
- package/src/proposals/econ-behaviors.js +33 -12
- package/src/proposals/price-feed-proposal.js +10 -3
- package/src/proposals/replace-fee-distributor.js +12 -6
- package/src/proposals/replaceElectorate.js +105 -16
- package/src/proposals/startEconCommittee.js +5 -1
- package/src/proposals/startPSM.js +7 -4
- package/src/proposals/upgrade-vaults.js +15 -5
- package/src/proposals/utils.d.ts +8 -4
- package/src/proposals/utils.d.ts.map +1 -1
- package/src/proposals/utils.js +32 -9
- package/src/proposals/withdraw-reserve-proposal.js +63 -0
- package/src/provisionPool.d.ts +34 -120
- package/src/provisionPool.d.ts.map +1 -1
- package/src/provisionPool.js +43 -21
- package/src/provisionPoolKit.d.ts +43 -328
- package/src/provisionPoolKit.d.ts.map +1 -1
- package/src/provisionPoolKit.js +210 -120
- package/src/psm/psm.d.ts +20 -13
- package/src/psm/psm.d.ts.map +1 -1
- package/src/psm/psm.js +18 -12
- package/src/reserve/assetReserve.d.ts +18 -6
- package/src/reserve/assetReserve.d.ts.map +1 -1
- package/src/reserve/assetReserve.js +26 -23
- package/src/reserve/assetReserveKit.d.ts +38 -6
- package/src/reserve/assetReserveKit.d.ts.map +1 -1
- package/src/reserve/assetReserveKit.js +117 -7
- package/src/reserve/params.d.ts +9 -3
- package/src/reserve/params.d.ts.map +1 -1
- package/src/reserve/params.js +8 -2
- package/src/vaultFactory/burn.d.ts +1 -1
- package/src/vaultFactory/burn.d.ts.map +1 -1
- package/src/vaultFactory/burn.js +1 -1
- package/src/vaultFactory/liquidation.d.ts +7 -3
- package/src/vaultFactory/liquidation.d.ts.map +1 -1
- package/src/vaultFactory/liquidation.js +14 -12
- package/src/vaultFactory/math.d.ts +1 -1
- package/src/vaultFactory/math.d.ts.map +1 -1
- package/src/vaultFactory/math.js +1 -1
- package/src/vaultFactory/orderedVaultStore.d.ts +21 -20
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -1
- package/src/vaultFactory/orderedVaultStore.js +4 -2
- package/src/vaultFactory/params.d.ts +25 -9
- package/src/vaultFactory/params.d.ts.map +1 -1
- package/src/vaultFactory/params.js +29 -11
- package/src/vaultFactory/prioritizedVaults.d.ts +70 -69
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -1
- package/src/vaultFactory/prioritizedVaults.js +5 -2
- package/src/vaultFactory/storeUtils.d.ts +2 -2
- package/src/vaultFactory/storeUtils.d.ts.map +1 -1
- package/src/vaultFactory/types-ambient.d.ts +2 -2
- package/src/vaultFactory/types-ambient.d.ts.map +1 -1
- package/src/vaultFactory/types-ambient.js +6 -2
- package/src/vaultFactory/vault.d.ts +34 -30
- package/src/vaultFactory/vault.d.ts.map +1 -1
- package/src/vaultFactory/vault.js +19 -15
- package/src/vaultFactory/vaultDirector.d.ts +81 -63
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
- package/src/vaultFactory/vaultDirector.js +38 -24
- package/src/vaultFactory/vaultFactory.d.ts +35 -22
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
- package/src/vaultFactory/vaultFactory.js +27 -17
- package/src/vaultFactory/vaultHolder.d.ts +77 -29
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
- package/src/vaultFactory/vaultHolder.js +12 -4
- package/src/vaultFactory/vaultKit.d.ts +12 -8
- package/src/vaultFactory/vaultKit.d.ts.map +1 -1
- package/src/vaultFactory/vaultKit.js +12 -5
- package/src/vaultFactory/vaultManager.d.ts +102 -88
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +86 -53
- package/src/proposals/add-auction.d.ts +0 -109
- package/src/proposals/add-auction.d.ts.map +0 -1
- package/src/proposals/addAssetToVault.d.ts +0 -173
- package/src/proposals/addAssetToVault.d.ts.map +0 -1
- package/src/proposals/committee-proposal.d.ts +0 -113
- package/src/proposals/committee-proposal.d.ts.map +0 -1
- package/src/proposals/core-proposal.d.ts +0 -149
- package/src/proposals/core-proposal.d.ts.map +0 -1
- package/src/proposals/deploy-price-feeds.d.ts +0 -76
- package/src/proposals/deploy-price-feeds.d.ts.map +0 -1
- package/src/proposals/econ-behaviors.d.ts +0 -541
- package/src/proposals/econ-behaviors.d.ts.map +0 -1
- package/src/proposals/price-feed-proposal.d.ts +0 -84
- package/src/proposals/price-feed-proposal.d.ts.map +0 -1
- package/src/proposals/replace-fee-distributor.d.ts +0 -48
- package/src/proposals/replace-fee-distributor.d.ts.map +0 -1
- package/src/proposals/replace-scaledPriceAuthorities.d.ts +0 -30
- package/src/proposals/replace-scaledPriceAuthorities.d.ts.map +0 -1
- package/src/proposals/replaceElectorate.d.ts +0 -55
- package/src/proposals/replaceElectorate.d.ts.map +0 -1
- package/src/proposals/startEconCommittee.d.ts +0 -34
- package/src/proposals/startEconCommittee.d.ts.map +0 -1
- package/src/proposals/startPSM.d.ts +0 -59
- package/src/proposals/startPSM.d.ts.map +0 -1
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +0 -24
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +0 -1
- package/src/proposals/upgrade-vaults.d.ts +0 -41
- package/src/proposals/upgrade-vaults.d.ts.map +0 -1
|
@@ -1,22 +1,28 @@
|
|
|
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
|
|
|
10
|
+
/**
|
|
11
|
+
* @import {Remote} from '@agoric/internal';
|
|
12
|
+
* @import {EconomyBootstrapPowers} from './econ-behaviors.js';
|
|
13
|
+
*/
|
|
14
|
+
|
|
9
15
|
/**
|
|
10
16
|
* @typedef {PromiseSpaceOf<{
|
|
11
17
|
* auctionUpgradeNewInstance: Instance;
|
|
12
18
|
* auctionUpgradeNewGovCreator: any;
|
|
13
19
|
* newContractGovBundleId: string;
|
|
20
|
+
* retiredContractInstances: MapStore<string, Instance>;
|
|
14
21
|
* }>} interlockPowers
|
|
15
22
|
*/
|
|
16
23
|
|
|
17
24
|
/**
|
|
18
|
-
* @param {
|
|
19
|
-
* interlockPowers} powers
|
|
25
|
+
* @param {EconomyBootstrapPowers & interlockPowers} powers
|
|
20
26
|
* @param {{
|
|
21
27
|
* options: {
|
|
22
28
|
* contractGovernorRef: { bundleID: string };
|
|
@@ -35,6 +41,7 @@ export const addAuction = async (
|
|
|
35
41
|
economicCommitteeCreatorFacet: electorateCreatorFacet,
|
|
36
42
|
governedContractKits: governedContractKitsP,
|
|
37
43
|
priceAuthority8400,
|
|
44
|
+
retiredContractInstances: retiredContractInstancesP,
|
|
38
45
|
zoe,
|
|
39
46
|
},
|
|
40
47
|
produce: {
|
|
@@ -42,6 +49,7 @@ export const addAuction = async (
|
|
|
42
49
|
auctionUpgradeNewInstance,
|
|
43
50
|
auctionUpgradeNewGovCreator,
|
|
44
51
|
newContractGovBundleId,
|
|
52
|
+
retiredContractInstances: produceRetiredInstances,
|
|
45
53
|
},
|
|
46
54
|
instance: {
|
|
47
55
|
consume: { reserve: reserveInstance },
|
|
@@ -79,6 +87,30 @@ export const addAuction = async (
|
|
|
79
87
|
auctioneerInstallationP,
|
|
80
88
|
]);
|
|
81
89
|
|
|
90
|
+
const retiredInstances = await provideRetiredInstances(
|
|
91
|
+
retiredContractInstancesP,
|
|
92
|
+
produceRetiredInstances,
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const governedContractKits = await governedContractKitsP;
|
|
96
|
+
trace('has', governedContractKits.has(legacyKit.instance));
|
|
97
|
+
if (governedContractKits.has(legacyKit.instance)) {
|
|
98
|
+
// bootstrap tests start having already run this upgrade. Actual upgrades on
|
|
99
|
+
// mainNet or testnets should start with the promiseSpace post upgrade-17,
|
|
100
|
+
// which doesn't have this entry in the map.
|
|
101
|
+
trace(
|
|
102
|
+
'⚠️ WARNING: not expected during chain upgrade. It IS normal during bootstrap tests',
|
|
103
|
+
);
|
|
104
|
+
} else {
|
|
105
|
+
// @ts-expect-error The original auctioneerKit had everything it needs
|
|
106
|
+
governedContractKits.init(legacyKit.instance, legacyKit);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// save the auctioneer instance so we can manage it later
|
|
110
|
+
const boardID = await E(board).getId(legacyKit.instance);
|
|
111
|
+
const identifier = `auctioneer-${boardID}`;
|
|
112
|
+
retiredInstances.init(identifier, legacyKit.instance);
|
|
113
|
+
|
|
82
114
|
// Each field has an extra layer of type + value:
|
|
83
115
|
// AuctionStartDelay: { type: 'relativeTime', value: { relValue: 2n, timerBrand: Object [Alleged: timerBrand] {} } }
|
|
84
116
|
/** @type {any} */
|
|
@@ -95,6 +127,7 @@ export const addAuction = async (
|
|
|
95
127
|
const timerBrand = await E(chainTimerService).getTimerBrand();
|
|
96
128
|
|
|
97
129
|
const storageNode = await makeStorageNodeChild(chainStorage, STORAGE_PATH);
|
|
130
|
+
/** @type {Remote<Marshaller>} */
|
|
98
131
|
const marshaller = await E(board).getReadonlyMarshaller();
|
|
99
132
|
|
|
100
133
|
const reservePublicFacet = await E(zoe).getPublicFacet(reserveInstance);
|
|
@@ -191,7 +224,6 @@ export const addAuction = async (
|
|
|
191
224
|
governedInstance,
|
|
192
225
|
);
|
|
193
226
|
|
|
194
|
-
const governedContractKits = await governedContractKitsP;
|
|
195
227
|
governedContractKits.init(kit.instance, kit);
|
|
196
228
|
auctionUpgradeNewInstance.resolve(governedInstance);
|
|
197
229
|
auctionUpgradeNewGovCreator.resolve(kit.governorCreatorFacet);
|
|
@@ -210,6 +242,7 @@ export const ADD_AUCTION_MANIFEST = harden({
|
|
|
210
242
|
economicCommitteeCreatorFacet: true,
|
|
211
243
|
governedContractKits: true,
|
|
212
244
|
priceAuthority8400: true,
|
|
245
|
+
retiredContractInstances: true,
|
|
213
246
|
zoe: true,
|
|
214
247
|
},
|
|
215
248
|
produce: {
|
|
@@ -217,6 +250,7 @@ export const ADD_AUCTION_MANIFEST = harden({
|
|
|
217
250
|
auctionUpgradeNewInstance: true,
|
|
218
251
|
auctionUpgradeNewGovCreator: true,
|
|
219
252
|
newContractGovBundleId: true,
|
|
253
|
+
retiredContractInstances: true,
|
|
220
254
|
},
|
|
221
255
|
instance: {
|
|
222
256
|
consume: { reserve: true },
|
|
@@ -7,7 +7,7 @@ import { Far } from '@endo/marshal';
|
|
|
7
7
|
import { AmountMath, AssetKind } from '@agoric/ertp';
|
|
8
8
|
import { deeplyFulfilledObject } from '@agoric/internal';
|
|
9
9
|
import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js';
|
|
10
|
-
import { parseRatio } from '@agoric/
|
|
10
|
+
import { parseRatio } from '@agoric/ertp/src/ratio.js';
|
|
11
11
|
import { E } from '@endo/far';
|
|
12
12
|
import { Stable } from '@agoric/internal/src/tokens.js';
|
|
13
13
|
import { TimeMath } from '@agoric/time/src/timeMath.js';
|
|
@@ -34,7 +34,11 @@ export * from './startPSM.js';
|
|
|
34
34
|
* @property {number} [initialPrice]
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @import {EconomyBootstrapPowers} from './econ-behaviors.js'
|
|
39
|
+
* @import {FullSchedule} from '../auction/scheduler.js';
|
|
40
|
+
* @import {TimerService} from '@agoric/time';
|
|
41
|
+
*/
|
|
38
42
|
|
|
39
43
|
/**
|
|
40
44
|
* @param {BootstrapPowers} powers
|
|
@@ -269,8 +273,8 @@ const COMPLETION = 20n * 60n;
|
|
|
269
273
|
* defined, 3) run now. If there is only a nextSchedule, 4) run now if startTime
|
|
270
274
|
* is far enough away, else 5) run after endTime
|
|
271
275
|
*
|
|
272
|
-
* @param {
|
|
273
|
-
* @param {ERef<
|
|
276
|
+
* @param {FullSchedule} schedules
|
|
277
|
+
* @param {ERef<TimerService>} timer
|
|
274
278
|
* @param {() => void} thunk
|
|
275
279
|
*/
|
|
276
280
|
const whenQuiescent = async (schedules, timer, thunk) => {
|
|
@@ -2,6 +2,11 @@ import { deeplyFulfilledObject } from '@agoric/internal';
|
|
|
2
2
|
import { E } from '@endo/far';
|
|
3
3
|
import { reserveThenDeposit } from './utils.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @import {EconomyBootstrapPowers} from './econ-behaviors.js';
|
|
7
|
+
* @import {EconCharterStartResult} from './econ-behaviors.js';
|
|
8
|
+
*/
|
|
9
|
+
|
|
5
10
|
const { values } = Object;
|
|
6
11
|
|
|
7
12
|
/** @type {<X, Y>(xs: X[], ys: Y[]) => [X, Y][]} */
|
|
@@ -10,7 +15,7 @@ const zip = (xs, ys) => xs.map((x, i) => [x, ys[i]]);
|
|
|
10
15
|
const EC_HIGH_PRIORITY_SENDERS_NAMESPACE = 'economicCommittee';
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
|
-
* @param {
|
|
18
|
+
* @param {EconomyBootstrapPowers} powers
|
|
14
19
|
* @param {{ options: { voterAddresses: Record<string, string> } }} param1
|
|
15
20
|
*/
|
|
16
21
|
export const inviteCommitteeMembers = async (
|
|
@@ -51,7 +56,7 @@ export const inviteCommitteeMembers = async (
|
|
|
51
56
|
|
|
52
57
|
harden(inviteCommitteeMembers);
|
|
53
58
|
|
|
54
|
-
/** @param {
|
|
59
|
+
/** @param {EconomyBootstrapPowers} powers */
|
|
55
60
|
export const startEconCharter = async ({
|
|
56
61
|
consume: { zoe },
|
|
57
62
|
produce: { econCharterKit },
|
|
@@ -72,7 +77,7 @@ export const startEconCharter = async ({
|
|
|
72
77
|
}),
|
|
73
78
|
);
|
|
74
79
|
|
|
75
|
-
/** @type {Promise<
|
|
80
|
+
/** @type {Promise<EconCharterStartResult>} */
|
|
76
81
|
const startResult = E(zoe).startInstance(
|
|
77
82
|
charterInstall,
|
|
78
83
|
undefined,
|
|
@@ -88,7 +93,7 @@ harden(startEconCharter);
|
|
|
88
93
|
/**
|
|
89
94
|
* Introduce charter to governed creator facets.
|
|
90
95
|
*
|
|
91
|
-
* @param {
|
|
96
|
+
* @param {EconomyBootstrapPowers} powers
|
|
92
97
|
*/
|
|
93
98
|
export const addGovernorsToEconCharter = async ({
|
|
94
99
|
consume: { reserveKit, vaultFactoryKit, econCharterKit, auctioneerKit },
|
|
@@ -126,7 +131,7 @@ export const addGovernorsToEconCharter = async ({
|
|
|
126
131
|
harden(addGovernorsToEconCharter);
|
|
127
132
|
|
|
128
133
|
/**
|
|
129
|
-
* @param {
|
|
134
|
+
* @param {EconomyBootstrapPowers} powers
|
|
130
135
|
* @param {{ options: { voterAddresses: Record<string, string> } }} param1
|
|
131
136
|
*/
|
|
132
137
|
export const inviteToEconCharter = async (
|
|
@@ -4,6 +4,12 @@ import { Stable } from '@agoric/internal/src/tokens.js';
|
|
|
4
4
|
import * as econBehaviors from './econ-behaviors.js';
|
|
5
5
|
import { ECON_COMMITTEE_MANIFEST } from './startEconCommittee.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @import {EconomyBootstrapPowers} from './econ-behaviors.js';
|
|
9
|
+
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js';
|
|
10
|
+
* @import {BootstrapManifestPermit} from '@agoric/vats/src/core/lib-boot.js';
|
|
11
|
+
*/
|
|
12
|
+
|
|
7
13
|
export * from './econ-behaviors.js';
|
|
8
14
|
export * from './startPSM.js';
|
|
9
15
|
export * from './startEconCommittee.js';
|
|
@@ -13,7 +19,7 @@ export * from './startEconCommittee.js';
|
|
|
13
19
|
// require updating a lot of tests. So for now, we just
|
|
14
20
|
// grab the kits afterward and store them.
|
|
15
21
|
|
|
16
|
-
/** @param {
|
|
22
|
+
/** @param {EconomyBootstrapPowers} powers */
|
|
17
23
|
export const storeInterContractStartKits = async ({
|
|
18
24
|
consume: {
|
|
19
25
|
contractKits,
|
|
@@ -50,9 +56,9 @@ export const storeInterContractStartKits = async ({
|
|
|
50
56
|
]);
|
|
51
57
|
};
|
|
52
58
|
|
|
53
|
-
/** @type {
|
|
59
|
+
/** @type {BootstrapManifest} */
|
|
54
60
|
const SHARED_MAIN_MANIFEST = harden({
|
|
55
|
-
/** @type {
|
|
61
|
+
/** @type {BootstrapManifestPermit} */
|
|
56
62
|
[econBehaviors.startVaultFactory.name]: {
|
|
57
63
|
consume: {
|
|
58
64
|
board: 'board',
|
|
@@ -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';
|
|
@@ -22,8 +23,11 @@ export const DEFAULT_CONTRACT_TERMS = {
|
|
|
22
23
|
maxSubmissionValue: 2 ** 256,
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
/**
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* @import {EconomyBootstrapPowers} from './econ-behaviors.js';
|
|
28
|
+
* @import {ChainlinkConfig} from '@agoric/inter-protocol/src/price/fluxAggregatorKit.js';
|
|
29
|
+
* @import {StartedInstanceKit} from '@agoric/zoe/src/zoeService/utils.js';
|
|
30
|
+
*/
|
|
27
31
|
/** @import {FluxStartFn} from '@agoric/inter-protocol/src/price/fluxAggregatorContract.js'; */
|
|
28
32
|
|
|
29
33
|
const trace = makeTracer('DeployPriceFeed', true);
|
|
@@ -84,10 +88,11 @@ export const ensureOracleBrand = async (
|
|
|
84
88
|
};
|
|
85
89
|
|
|
86
90
|
/**
|
|
87
|
-
* @param {EconomyBootstrapPowers
|
|
91
|
+
* @param {EconomyBootstrapPowers &
|
|
92
|
+
* PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance> }>} powers
|
|
88
93
|
* @param {{
|
|
89
94
|
* AGORIC_INSTANCE_NAME: string;
|
|
90
|
-
* contractTerms:
|
|
95
|
+
* contractTerms: ChainlinkConfig;
|
|
91
96
|
* brandIn: Brand<'nat'>;
|
|
92
97
|
* brandOut: Brand<'nat'>;
|
|
93
98
|
* }} config
|
|
@@ -96,6 +101,7 @@ export const ensureOracleBrand = async (
|
|
|
96
101
|
const startPriceAggregatorInstance = async (
|
|
97
102
|
{
|
|
98
103
|
consume: {
|
|
104
|
+
agoricNames,
|
|
99
105
|
board,
|
|
100
106
|
chainStorage,
|
|
101
107
|
chainTimerService,
|
|
@@ -103,8 +109,10 @@ const startPriceAggregatorInstance = async (
|
|
|
103
109
|
highPrioritySendersManager,
|
|
104
110
|
namesByAddressAdmin,
|
|
105
111
|
startGovernedUpgradable,
|
|
112
|
+
retiredContractInstances: retiredContractInstancesP,
|
|
106
113
|
},
|
|
107
114
|
instance: { produce: produceInstance },
|
|
115
|
+
produce: { retiredContractInstances: produceRetiredInstances },
|
|
108
116
|
},
|
|
109
117
|
{ AGORIC_INSTANCE_NAME, contractTerms, brandIn, brandOut },
|
|
110
118
|
installation,
|
|
@@ -139,6 +147,22 @@ const startPriceAggregatorInstance = async (
|
|
|
139
147
|
// @ts-expect-error GovernableStartFn vs. fluxAggregatorContract.js start
|
|
140
148
|
installation,
|
|
141
149
|
});
|
|
150
|
+
const retiredContractInstances = await provideRetiredInstances(
|
|
151
|
+
retiredContractInstancesP,
|
|
152
|
+
produceRetiredInstances,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
// save the instance so we can manage it later
|
|
156
|
+
const retiringInstance = await E(agoricNames).lookup(
|
|
157
|
+
'instance',
|
|
158
|
+
AGORIC_INSTANCE_NAME,
|
|
159
|
+
);
|
|
160
|
+
const boardID = await E(board).getId(retiringInstance);
|
|
161
|
+
retiredContractInstances.init(
|
|
162
|
+
`priceFeed-${AGORIC_INSTANCE_NAME}-${boardID}`,
|
|
163
|
+
retiringInstance,
|
|
164
|
+
);
|
|
165
|
+
|
|
142
166
|
produceInstance[AGORIC_INSTANCE_NAME].reset();
|
|
143
167
|
produceInstance[AGORIC_INSTANCE_NAME].resolve(governedKit.instance);
|
|
144
168
|
trace(
|
|
@@ -155,7 +179,7 @@ const startPriceAggregatorInstance = async (
|
|
|
155
179
|
);
|
|
156
180
|
trace('added', label, 'instance to econCharter');
|
|
157
181
|
|
|
158
|
-
/** @type {
|
|
182
|
+
/** @type {StartedInstanceKit<FluxStartFn>} */
|
|
159
183
|
// @ts-expect-error
|
|
160
184
|
const { instance, publicFacet, creatorFacet } = governedKit;
|
|
161
185
|
|
|
@@ -191,7 +215,9 @@ const distributeInvitations = async (
|
|
|
191
215
|
};
|
|
192
216
|
|
|
193
217
|
/**
|
|
194
|
-
* @param {EconomyBootstrapPowers &
|
|
218
|
+
* @param {EconomyBootstrapPowers &
|
|
219
|
+
* NamedVatPowers &
|
|
220
|
+
* PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance> }>} powers
|
|
195
221
|
* @param {{
|
|
196
222
|
* options: PriceFeedConfig & {
|
|
197
223
|
* priceAggregatorRef: { bundleID: string };
|
|
@@ -300,6 +326,7 @@ export const getManifestForPriceFeeds = async (
|
|
|
300
326
|
namesByAddressAdmin: t,
|
|
301
327
|
priceAuthority: t,
|
|
302
328
|
priceAuthorityAdmin: t,
|
|
329
|
+
retiredContractInstances: t,
|
|
303
330
|
startGovernedUpgradable: t,
|
|
304
331
|
startUpgradable: t,
|
|
305
332
|
zoe: t,
|
|
@@ -307,9 +334,10 @@ export const getManifestForPriceFeeds = async (
|
|
|
307
334
|
installation: { produce: { priceAggregator: t } },
|
|
308
335
|
instance: {
|
|
309
336
|
produce: t,
|
|
337
|
+
consume: t,
|
|
310
338
|
},
|
|
311
339
|
oracleBrand: { produce: t },
|
|
312
|
-
produce: { priceAuthority8400: t },
|
|
340
|
+
produce: { priceAuthority8400: t, retiredContractInstances: t },
|
|
313
341
|
},
|
|
314
342
|
},
|
|
315
343
|
options: { ...priceFeedOptions },
|
|
@@ -10,7 +10,20 @@ import { makeGovernedTerms as makeGovernedATerms } from '../auction/params.js';
|
|
|
10
10
|
import { makeReserveTerms } from '../reserve/params.js';
|
|
11
11
|
import { makeGovernedTerms as makeGovernedVFTerms } from '../vaultFactory/params.js';
|
|
12
12
|
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @import {GovernorCreatorFacet, GovernanceFacetKit, GovernorStartedInstallationKit} from '@agoric/governance/src/types.js';
|
|
15
|
+
* @import {StartedInstanceKit} from '@agoric/zoe/src/zoeService/utils.js';
|
|
16
|
+
* @import {AdminFacet} from '@agoric/zoe';
|
|
17
|
+
* @import {MapStore, SetStore} from '@agoric/store';
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Duplicated from vaultFactory/types-ambient.js to solve a CI problem.
|
|
21
|
+
// Not worth refactoring to DRY because vaultFactory is going away.
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {object} InterestTiming
|
|
24
|
+
* @property {import('@agoric/time').RelativeTime} chargingPeriod in seconds
|
|
25
|
+
* @property {import('@agoric/time').RelativeTime} recordingPeriod in seconds
|
|
26
|
+
*/
|
|
14
27
|
|
|
15
28
|
const trace = makeTracer('RunEconBehaviors', true);
|
|
16
29
|
|
|
@@ -25,20 +38,28 @@ export const SECONDS_PER_WEEK = 7n * SECONDS_PER_DAY;
|
|
|
25
38
|
/**
|
|
26
39
|
* @typedef {object} PSMKit
|
|
27
40
|
* @property {string} label
|
|
28
|
-
* @property {Instance} psm
|
|
29
|
-
* @property {Instance
|
|
41
|
+
* @property {Instance<typeof import('../psm/psm.js').start>} psm
|
|
42
|
+
* @property {Instance<
|
|
43
|
+
* typeof import('../../../governance/src/contractGovernor.js').start
|
|
44
|
+
* >} psmGovernor
|
|
30
45
|
* @property {Awaited<
|
|
31
46
|
* ReturnType<
|
|
32
47
|
* Awaited<
|
|
33
|
-
* ReturnType<import('../psm/psm.js')
|
|
48
|
+
* ReturnType<typeof import('../psm/psm.js').start>
|
|
34
49
|
* >['creatorFacet']['getLimitedCreatorFacet']
|
|
35
50
|
* >
|
|
36
51
|
* >} psmCreatorFacet
|
|
37
|
-
* @property {GovernorCreatorFacet<
|
|
52
|
+
* @property {GovernorCreatorFacet<
|
|
53
|
+
* typeof import('../../src/psm/psm.js').start
|
|
54
|
+
* >} psmGovernorCreatorFacet
|
|
38
55
|
* @property {AdminFacet} psmAdminFacet
|
|
39
56
|
*/
|
|
40
57
|
|
|
41
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {GovernanceFacetKit<
|
|
60
|
+
* typeof import('../auction/auctioneer.js').start
|
|
61
|
+
* >} AuctioneerKit
|
|
62
|
+
*/
|
|
42
63
|
|
|
43
64
|
/**
|
|
44
65
|
* @typedef {WellKnownSpaces & ChainBootstrapSpace & EconomyBootstrapSpace} EconomyBootstrapPowers
|
|
@@ -58,7 +79,7 @@ export const SECONDS_PER_WEEK = 7n * SECONDS_PER_DAY;
|
|
|
58
79
|
* anchorBalancePayments: MapStore<Brand, Payment<'nat'>>;
|
|
59
80
|
* econCharterKit: EconCharterStartResult;
|
|
60
81
|
* reserveKit: GovernanceFacetKit<
|
|
61
|
-
* import('../reserve/assetReserve.js')
|
|
82
|
+
* typeof import('../reserve/assetReserve.js').start
|
|
62
83
|
* >;
|
|
63
84
|
* vaultFactoryKit: GovernanceFacetKit<VFStart>;
|
|
64
85
|
* auctioneerKit: AuctioneerKit;
|
|
@@ -69,12 +90,12 @@ export const SECONDS_PER_WEEK = 7n * SECONDS_PER_DAY;
|
|
|
69
90
|
|
|
70
91
|
/**
|
|
71
92
|
* @typedef {StartedInstanceKit<
|
|
72
|
-
* import('../econCommitteeCharter.js')
|
|
93
|
+
* typeof import('../econCommitteeCharter.js').start
|
|
73
94
|
* >} EconCharterStartResult
|
|
74
95
|
*/
|
|
75
96
|
/**
|
|
76
97
|
* @typedef {StartedInstanceKit<
|
|
77
|
-
* import('@agoric/governance/src/committee.js')
|
|
98
|
+
* typeof import('@agoric/governance/src/committee.js').start
|
|
78
99
|
* >} CommitteeStartResult
|
|
79
100
|
*/
|
|
80
101
|
|
|
@@ -157,9 +178,10 @@ export const setupReserve = async ({
|
|
|
157
178
|
'reserve.governor',
|
|
158
179
|
);
|
|
159
180
|
|
|
160
|
-
const [creatorFacet, publicFacet, instance] = await Promise.all([
|
|
181
|
+
const [creatorFacet, publicFacet, adminFacet, instance] = await Promise.all([
|
|
161
182
|
E(g.creatorFacet).getCreatorFacet(),
|
|
162
183
|
E(g.creatorFacet).getPublicFacet(),
|
|
184
|
+
E(g.creatorFacet).getAdminFacet(),
|
|
163
185
|
E(g.publicFacet).getGovernedContract(),
|
|
164
186
|
]);
|
|
165
187
|
|
|
@@ -169,7 +191,7 @@ export const setupReserve = async ({
|
|
|
169
191
|
instance,
|
|
170
192
|
publicFacet,
|
|
171
193
|
creatorFacet,
|
|
172
|
-
adminFacet
|
|
194
|
+
adminFacet,
|
|
173
195
|
|
|
174
196
|
governor: g.instance,
|
|
175
197
|
governorCreatorFacet: g.creatorFacet,
|
|
@@ -463,7 +485,6 @@ export const startRewardDistributor = async ({
|
|
|
463
485
|
const instanceKit = await E(zoe).startInstance(
|
|
464
486
|
feeDistributor,
|
|
465
487
|
{ Fee: centralIssuer },
|
|
466
|
-
// @ts-expect-error XXX
|
|
467
488
|
feeDistributorTerms,
|
|
468
489
|
undefined,
|
|
469
490
|
'feeDistributor',
|
|
@@ -13,6 +13,11 @@ import {
|
|
|
13
13
|
reserveThenGetNames,
|
|
14
14
|
} from './utils.js';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @import {ChainlinkConfig} from '@agoric/inter-protocol/src/price/fluxAggregatorKit.js';
|
|
18
|
+
* @import {EconomyBootstrapPowers} from './econ-behaviors.js';
|
|
19
|
+
*/
|
|
20
|
+
|
|
16
21
|
// backwards compatibility
|
|
17
22
|
export { oracleBrandFeedName as instanceNameFor };
|
|
18
23
|
|
|
@@ -88,7 +93,7 @@ export const ensureOracleBrands = async (
|
|
|
88
93
|
* priceFeedOptions: {
|
|
89
94
|
* AGORIC_INSTANCE_NAME: string;
|
|
90
95
|
* oracleAddresses: string[];
|
|
91
|
-
* contractTerms:
|
|
96
|
+
* contractTerms: ChainlinkConfig;
|
|
92
97
|
* IN_BRAND_NAME: string;
|
|
93
98
|
* OUT_BRAND_NAME: string;
|
|
94
99
|
* priceAggregatorRef: Installation;
|
|
@@ -167,7 +172,9 @@ export const createPriceFeed = async (
|
|
|
167
172
|
/**
|
|
168
173
|
* @type {[
|
|
169
174
|
* [Brand<'nat'>, Brand<'nat'>],
|
|
170
|
-
* Installation<
|
|
175
|
+
* Installation<
|
|
176
|
+
* typeof import('@agoric/inter-protocol/src/price/fluxAggregatorContract.js').start
|
|
177
|
+
* >,
|
|
171
178
|
* Timer,
|
|
172
179
|
* ]}
|
|
173
180
|
*/
|
|
@@ -316,7 +323,7 @@ export const getManifestForPriceFeed = async (
|
|
|
316
323
|
});
|
|
317
324
|
|
|
318
325
|
/**
|
|
319
|
-
* @param {
|
|
326
|
+
* @param {EconomyBootstrapPowers} powers
|
|
320
327
|
* @param {object} [config]
|
|
321
328
|
* @param {object} [config.options]
|
|
322
329
|
* @param {string[]} [config.options.demoOracleAddresses]
|
|
@@ -3,12 +3,17 @@ import { Stable } from '@agoric/internal/src/tokens.js';
|
|
|
3
3
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
4
4
|
import { getInterfaceOf, E } from '@endo/far';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @import {EconomyBootstrapPowers} from './econ-behaviors';
|
|
8
|
+
* @import {start} from '@agoric/inter-protocol/src/feeDistributor.js';
|
|
9
|
+
*/
|
|
10
|
+
|
|
6
11
|
const trace = makeTracer('ReplaceFeeDistributer', true);
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
14
|
* Start the reward distributor.
|
|
10
15
|
*
|
|
11
|
-
* @param {
|
|
16
|
+
* @param {EconomyBootstrapPowers} powers
|
|
12
17
|
* @param {{
|
|
13
18
|
* options: {
|
|
14
19
|
* keywordShares: Record<string, bigint>;
|
|
@@ -76,9 +81,7 @@ export const replaceFeeDistributor = async (
|
|
|
76
81
|
});
|
|
77
82
|
|
|
78
83
|
/**
|
|
79
|
-
* @type {StartedInstanceKit<
|
|
80
|
-
* typeof import('@agoric/inter-protocol/src/feeDistributor.js').start
|
|
81
|
-
* >}
|
|
84
|
+
* @type {StartedInstanceKit<typeof start>}
|
|
82
85
|
*/
|
|
83
86
|
const instanceKit = await E(zoe).startInstance(
|
|
84
87
|
feeDistributor,
|
|
@@ -159,8 +162,8 @@ harden(replaceFeeDistributor);
|
|
|
159
162
|
|
|
160
163
|
const t = 'replaceFeeDistributor';
|
|
161
164
|
export const getManifestForReplaceFeeDistributor = async (
|
|
162
|
-
|
|
163
|
-
feeDistributorOptions,
|
|
165
|
+
{ restoreRef },
|
|
166
|
+
{ feeDistributorRef, ...feeDistributorOptions },
|
|
164
167
|
) => ({
|
|
165
168
|
manifest: {
|
|
166
169
|
[replaceFeeDistributor.name]: {
|
|
@@ -191,5 +194,8 @@ export const getManifestForReplaceFeeDistributor = async (
|
|
|
191
194
|
},
|
|
192
195
|
},
|
|
193
196
|
},
|
|
197
|
+
installations: {
|
|
198
|
+
feeDistributor: restoreRef(feeDistributorRef),
|
|
199
|
+
},
|
|
194
200
|
options: { ...feeDistributorOptions },
|
|
195
201
|
});
|