@agoric/inter-protocol 0.16.2-upgrade-14-dev-0169c7e.0 → 0.16.2-upgrade-16-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
package/src/clientSupport.js
CHANGED
|
@@ -9,16 +9,22 @@ import { parseRatio } from '@agoric/zoe/src/contractSupport/ratio.js';
|
|
|
9
9
|
const COSMOS_UNIT = 1_000_000n;
|
|
10
10
|
const scaleDecimals = num => BigInt(num * Number(COSMOS_UNIT));
|
|
11
11
|
|
|
12
|
-
// TODO use '@satisfies" in TS 5.1 to make sure these each conform to OfferMaker interface
|
|
13
|
-
|
|
14
12
|
// NB: not really a Proposal because the brands are not remotes
|
|
15
13
|
// Instead they're copyRecord like "{"boardId":"board0257","iface":"Alleged: IST brand"}" to pass through the boardId
|
|
16
14
|
// mustMatch(harden(proposal), ProposalShape);
|
|
17
15
|
/**
|
|
18
16
|
* Give/want
|
|
19
17
|
*
|
|
20
|
-
* @param {Pick<
|
|
21
|
-
*
|
|
18
|
+
* @param {Pick<
|
|
19
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
20
|
+
* 'brand'
|
|
21
|
+
* >} agoricNames
|
|
22
|
+
* @param {| { giveMinted?: number; wantMinted?: number }
|
|
23
|
+
* | {
|
|
24
|
+
* collateralBrandKey: string;
|
|
25
|
+
* giveCollateral?: number;
|
|
26
|
+
* wantCollateral?: number;
|
|
27
|
+
* }} opts
|
|
22
28
|
* @returns {Proposal}
|
|
23
29
|
*/
|
|
24
30
|
const makeVaultProposal = ({ brand }, opts) => {
|
|
@@ -56,8 +62,16 @@ const makeVaultProposal = ({ brand }, opts) => {
|
|
|
56
62
|
};
|
|
57
63
|
|
|
58
64
|
/**
|
|
59
|
-
* @param {Pick<
|
|
60
|
-
*
|
|
65
|
+
* @param {Pick<
|
|
66
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
67
|
+
* 'brand'
|
|
68
|
+
* >} agoricNames
|
|
69
|
+
* @param {{
|
|
70
|
+
* offerId: string;
|
|
71
|
+
* wantMinted: number;
|
|
72
|
+
* giveCollateral: number;
|
|
73
|
+
* collateralBrandKey: string;
|
|
74
|
+
* }} opts
|
|
61
75
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
62
76
|
*/
|
|
63
77
|
const makeOpenOffer = ({ brand }, opts) => {
|
|
@@ -84,8 +98,18 @@ const makeOpenOffer = ({ brand }, opts) => {
|
|
|
84
98
|
};
|
|
85
99
|
|
|
86
100
|
/**
|
|
87
|
-
* @param {Pick<
|
|
88
|
-
*
|
|
101
|
+
* @param {Pick<
|
|
102
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
103
|
+
* 'brand'
|
|
104
|
+
* >} agoricNames
|
|
105
|
+
* @param {{
|
|
106
|
+
* offerId: string;
|
|
107
|
+
* collateralBrandKey?: string;
|
|
108
|
+
* giveCollateral?: number;
|
|
109
|
+
* wantCollateral?: number;
|
|
110
|
+
* giveMinted?: number;
|
|
111
|
+
* wantMinted?: number;
|
|
112
|
+
* }} opts
|
|
89
113
|
* @param {string} previousOffer
|
|
90
114
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
91
115
|
*/
|
|
@@ -107,8 +131,15 @@ const makeAdjustOffer = ({ brand }, opts, previousOffer) => {
|
|
|
107
131
|
};
|
|
108
132
|
|
|
109
133
|
/**
|
|
110
|
-
* @param {Pick<
|
|
111
|
-
*
|
|
134
|
+
* @param {Pick<
|
|
135
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
136
|
+
* 'brand'
|
|
137
|
+
* >} agoricNames
|
|
138
|
+
* @param {{
|
|
139
|
+
* offerId: string;
|
|
140
|
+
* collateralBrandKey?: string;
|
|
141
|
+
* giveMinted: number;
|
|
142
|
+
* }} opts
|
|
112
143
|
* @param {string} previousOffer
|
|
113
144
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
114
145
|
*/
|
|
@@ -128,7 +159,9 @@ const makeCloseOffer = ({ brand }, opts, previousOffer) => {
|
|
|
128
159
|
|
|
129
160
|
/**
|
|
130
161
|
* @param {string} vaultId
|
|
131
|
-
* @param {Promise<
|
|
162
|
+
* @param {Promise<
|
|
163
|
+
* import('@agoric/smart-wallet/src/smartWallet.js').CurrentWalletRecord
|
|
164
|
+
* >} currentP
|
|
132
165
|
* @returns {Promise<string>} offer id in which the vault was made
|
|
133
166
|
*/
|
|
134
167
|
export const lookupOfferIdForVault = async (vaultId, currentP) => {
|
|
@@ -143,11 +176,14 @@ export const lookupOfferIdForVault = async (vaultId, currentP) => {
|
|
|
143
176
|
};
|
|
144
177
|
|
|
145
178
|
/**
|
|
146
|
-
* @param {Record<
|
|
147
|
-
*
|
|
148
|
-
*
|
|
179
|
+
* @param {Record<
|
|
180
|
+
* string,
|
|
181
|
+
* import('@agoric/internal/src/marshal.js').BoardRemote
|
|
182
|
+
* >} brands
|
|
183
|
+
* @param {| { wantMinted: number; giveMinted?: undefined }
|
|
184
|
+
* | { giveMinted: number; wantMinted?: undefined }} opts
|
|
185
|
+
* @param {number} [fee]
|
|
149
186
|
* @param {string} [anchor]
|
|
150
|
-
* @returns {Proposal} XXX not a real proposal, uses BoardRemote
|
|
151
187
|
*/
|
|
152
188
|
const makePsmProposal = (brands, opts, fee = 0, anchor = 'AUSD') => {
|
|
153
189
|
const giving = 'giveMinted' in opts ? 'minted' : 'anchor';
|
|
@@ -173,10 +209,15 @@ const makePsmProposal = (brands, opts, fee = 0, anchor = 'AUSD') => {
|
|
|
173
209
|
};
|
|
174
210
|
|
|
175
211
|
/**
|
|
176
|
-
* @param {Pick<
|
|
212
|
+
* @param {Pick<
|
|
213
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
214
|
+
* 'brand'
|
|
215
|
+
* >} agoricNames
|
|
177
216
|
* @param {Instance} instance
|
|
178
|
-
* @param {{ offerId: string
|
|
179
|
-
*
|
|
217
|
+
* @param {{ offerId: string; feePct?: number; pair: [string, string] } & (
|
|
218
|
+
* | { wantMinted: number }
|
|
219
|
+
* | { giveMinted: number }
|
|
220
|
+
* )} opts
|
|
180
221
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
181
222
|
*/
|
|
182
223
|
const makePsmSwapOffer = ({ brand }, instance, opts) => {
|
|
@@ -202,15 +243,16 @@ const makePsmSwapOffer = ({ brand }, instance, opts) => {
|
|
|
202
243
|
instance,
|
|
203
244
|
publicInvitationMaker: method,
|
|
204
245
|
},
|
|
246
|
+
// @ts-expect-error BoardRemote not a Brand object
|
|
205
247
|
proposal,
|
|
206
248
|
};
|
|
207
249
|
};
|
|
208
250
|
|
|
209
251
|
/**
|
|
210
|
-
* @param {
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* }
|
|
252
|
+
* @param {Pick<
|
|
253
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
254
|
+
* 'brand' | 'vbankAsset'
|
|
255
|
+
* >} agoricNames
|
|
214
256
|
* @param {(msg: string) => Error} makeError error constructor
|
|
215
257
|
* @returns {(a: string) => Amount<'nat'>}
|
|
216
258
|
*/
|
|
@@ -250,17 +292,23 @@ export const makeParseAmount =
|
|
|
250
292
|
};
|
|
251
293
|
|
|
252
294
|
/**
|
|
253
|
-
* @param {Pick<
|
|
295
|
+
* @param {Pick<
|
|
296
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
297
|
+
* 'brand' | 'vbankAsset'
|
|
298
|
+
* >} agoricNames
|
|
254
299
|
* @param {{
|
|
255
|
-
* offerId: string
|
|
256
|
-
* give: string
|
|
257
|
-
* maxBuy: string
|
|
258
|
-
* wantMinimum?: string
|
|
259
|
-
* } & (
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
300
|
+
* offerId: string;
|
|
301
|
+
* give: string;
|
|
302
|
+
* maxBuy: string;
|
|
303
|
+
* wantMinimum?: string;
|
|
304
|
+
* } & (
|
|
305
|
+
* | {
|
|
306
|
+
* price: number;
|
|
307
|
+
* }
|
|
308
|
+
* | {
|
|
309
|
+
* discount: number; // -1 to 1. e.g. 0.10 for 10% discount, -0.05 for 5% markup
|
|
310
|
+
* }
|
|
311
|
+
* )} opts
|
|
264
312
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
265
313
|
*/
|
|
266
314
|
const makeBidOffer = (agoricNames, opts) => {
|
|
@@ -319,11 +367,14 @@ const makeBidOffer = (agoricNames, opts) => {
|
|
|
319
367
|
};
|
|
320
368
|
|
|
321
369
|
/**
|
|
322
|
-
* @param {Pick<
|
|
370
|
+
* @param {Pick<
|
|
371
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
372
|
+
* 'brand'
|
|
373
|
+
* >} agoricNames
|
|
323
374
|
* @param {{
|
|
324
|
-
* offerId: string
|
|
325
|
-
* give: number
|
|
326
|
-
* collateralBrandKey: string
|
|
375
|
+
* offerId: string;
|
|
376
|
+
* give: number;
|
|
377
|
+
* collateralBrandKey: string;
|
|
327
378
|
* }} opts
|
|
328
379
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
329
380
|
*/
|
|
@@ -331,6 +382,7 @@ const makeAddCollateralOffer = ({ brand }, opts) => {
|
|
|
331
382
|
/** @type {AmountKeywordRecord} */
|
|
332
383
|
const give = {
|
|
333
384
|
Collateral: AmountMath.make(
|
|
385
|
+
// @ts-expect-error BoardRemote not a Brand object
|
|
334
386
|
brand[opts.collateralBrandKey],
|
|
335
387
|
scaleDecimals(opts.give),
|
|
336
388
|
),
|
|
@@ -350,12 +402,11 @@ const makeAddCollateralOffer = ({ brand }, opts) => {
|
|
|
350
402
|
};
|
|
351
403
|
|
|
352
404
|
/**
|
|
353
|
-
*
|
|
354
405
|
* @param {unknown} _agoricNames
|
|
355
406
|
* @param {{
|
|
356
|
-
* offerId: string
|
|
357
|
-
* roundId?: bigint
|
|
358
|
-
* unitPrice: bigint
|
|
407
|
+
* offerId: string;
|
|
408
|
+
* roundId?: bigint;
|
|
409
|
+
* unitPrice: bigint;
|
|
359
410
|
* }} opts
|
|
360
411
|
* @param {string} previousOffer
|
|
361
412
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
@@ -375,6 +426,12 @@ const makePushPriceOffer = (_agoricNames, opts, previousOffer) => {
|
|
|
375
426
|
};
|
|
376
427
|
};
|
|
377
428
|
|
|
429
|
+
/**
|
|
430
|
+
* @satisfies {Record<
|
|
431
|
+
* string,
|
|
432
|
+
* Record<string, import('@agoric/smart-wallet/src/types.js').OfferMaker>
|
|
433
|
+
* >}
|
|
434
|
+
*/
|
|
378
435
|
export const Offers = {
|
|
379
436
|
auction: {
|
|
380
437
|
Bid: makeBidOffer,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectFees.d.ts","sourceRoot":"","sources":["collectFees.js"],"names":[],"mappings":"AAaO,+CANI,GAAG,WACH,OAAO,YACP,KAAK,WACL,MAAM,GACJ,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAYvC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export namespace amountPattern {
|
|
2
|
+
let brand: import("@endo/patterns").Matcher;
|
|
3
|
+
let value: import("@endo/patterns").Matcher;
|
|
4
|
+
}
|
|
5
|
+
export namespace ratioPattern {
|
|
6
|
+
export { amountPattern as numerator };
|
|
7
|
+
export { amountPattern as denominator };
|
|
8
|
+
}
|
|
9
|
+
export function addSubtract<A extends globalThis.Amount>(base: A, gain: A, loss: A): A;
|
|
10
|
+
export function subtractToEmpty<T extends globalThis.Amount>(left: T, right: T): T;
|
|
11
|
+
export function assertOnlyKeys(proposal: ProposalRecord, keys: string[]): void;
|
|
12
|
+
export function allEmpty(amounts: Amount[]): boolean;
|
|
13
|
+
export function checkDebtLimit(debtLimit: Amount<"nat">, totalDebt: Amount<"nat">, toMint: Amount<"nat">): void;
|
|
14
|
+
export function makeNatAmountShape(brand: Brand, min?: bigint | undefined): {
|
|
15
|
+
brand: globalThis.Brand;
|
|
16
|
+
value: import("@endo/patterns").Matcher;
|
|
17
|
+
};
|
|
18
|
+
export function quoteAsRatio(quoteAmount: Pick<PriceDescription, "amountIn" | "amountOut">): Ratio;
|
|
19
|
+
export type MetricsPublisherKit<T> = {
|
|
20
|
+
metricsPublication: IterationObserver<T>;
|
|
21
|
+
metricsSubscription: StoredSubscription<T>;
|
|
22
|
+
};
|
|
23
|
+
export type MetricsPublishKit<T> = {
|
|
24
|
+
metricsPublisher: Publisher<T>;
|
|
25
|
+
metricsSubscriber: StoredSubscriber<T>;
|
|
26
|
+
};
|
|
27
|
+
import type { PriceDescription } from '@agoric/zoe/tools/types.js';
|
|
28
|
+
//# sourceMappingURL=contractSupport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contractSupport.d.ts","sourceRoot":"","sources":["contractSupport.js"],"names":[],"mappings":";;;;;;;;AA6BO,4BAFM,CAAC,kCAAD,CAAC,AAHF,QAGC,CAAC,AAFF,QAEC,CAAC,AADF,GACC,CAAC,CAGyC;AAQhD,gCAFM,CAAC,kCAAD,CAAC,AAFF,SAEC,CAAC,AADF,GACC,CAAC,CAK2C;AAQlD,yCAHI,cAAc,QACd,MAAM,EAAE,QAQlB;AAMM,kCAHI,MAAM,EAAE,GACN,OAAO,CAInB;AAQM,0CALI,MAAM,CAAC,KAAK,CAAC,aACb,MAAM,CAAC,KAAK,CAAC,UACb,MAAM,CAAC,KAAK,CAAC,QASvB;AAoBM,0CAHI,KAAK;;;EAIsC;AAG/C,mGAC4D;gCAnBlC,CAAC;wBADpB,iBAAiB,CACE,CAAC,AADD,CAAC;yBACpB,kBAAkB,CAAC,CAAC,CAAC;;8BAOJ,CAAC;sBADlB,SAAS,CACQ,CAAC,AADP,CAAC;uBACZ,gBAAgB,CAAC,CAAC,CAAC;;sCApF6D,4BAA4B"}
|
package/src/contractSupport.js
CHANGED
|
@@ -4,6 +4,8 @@ import { AmountMath } from '@agoric/ertp';
|
|
|
4
4
|
import { M } from '@agoric/store';
|
|
5
5
|
import { makeRatioFromAmounts } from '@agoric/zoe/src/contractSupport/index.js';
|
|
6
6
|
|
|
7
|
+
/** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
|
|
8
|
+
|
|
7
9
|
const { Fail, quote: q } = assert;
|
|
8
10
|
|
|
9
11
|
export const amountPattern = harden({ brand: M.remotable(), value: M.any() });
|
|
@@ -13,17 +15,17 @@ export const ratioPattern = harden({
|
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
|
-
* Apply a delta to the `base` Amount, where the delta is represented as
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Apply a delta to the `base` Amount, where the delta is represented as an
|
|
19
|
+
* amount to gain and an amount to lose. Typically one of those will be empty
|
|
20
|
+
* because gain/loss comes from the give/want for a specific asset on a
|
|
21
|
+
* proposal. We use two Amounts because an Amount cannot represent a negative
|
|
22
|
+
* number (so we use a "loss" that will be subtracted).
|
|
21
23
|
*
|
|
22
|
-
* @template {
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {
|
|
26
|
-
* @returns {
|
|
24
|
+
* @template {Amount} A
|
|
25
|
+
* @param {A} base
|
|
26
|
+
* @param {A} gain
|
|
27
|
+
* @param {A} loss
|
|
28
|
+
* @returns {A}
|
|
27
29
|
*/
|
|
28
30
|
export const addSubtract = (base, gain, loss) =>
|
|
29
31
|
AmountMath.subtract(AmountMath.add(base, gain), loss);
|
|
@@ -77,14 +79,14 @@ export const checkDebtLimit = (debtLimit, totalDebt, toMint) => {
|
|
|
77
79
|
|
|
78
80
|
/**
|
|
79
81
|
* @template T
|
|
80
|
-
* @typedef {object} MetricsPublisherKit
|
|
82
|
+
* @typedef {object} MetricsPublisherKit
|
|
81
83
|
* @property {IterationObserver<T>} metricsPublication
|
|
82
84
|
* @property {StoredSubscription<T>} metricsSubscription
|
|
83
85
|
*/
|
|
84
86
|
|
|
85
87
|
/**
|
|
86
88
|
* @template T
|
|
87
|
-
* @typedef {object} MetricsPublishKit
|
|
89
|
+
* @typedef {object} MetricsPublishKit
|
|
88
90
|
* @property {Publisher<T>} metricsPublisher
|
|
89
91
|
* @property {StoredSubscriber<T>} metricsSubscriber
|
|
90
92
|
*/
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This contract makes it possible for those who govern contracts to call
|
|
3
|
+
* for votes on changes. A more complete implementation would validate
|
|
4
|
+
* parameters, constrain deadlines and possibly split the ability to call for
|
|
5
|
+
* votes into separate capabilities for finer grain encapsulation.
|
|
6
|
+
*/
|
|
7
|
+
export const INVITATION_MAKERS_DESC: "charter member invitation";
|
|
8
|
+
/** @type {ContractMeta} */
|
|
9
|
+
export const meta: ContractMeta;
|
|
10
|
+
export function start(zcf: ZCF<{
|
|
11
|
+
binaryVoteCounterInstallation: Installation;
|
|
12
|
+
}>, privateArgs: undefined, baggage: import("@agoric/vat-data").Baggage): Promise<{
|
|
13
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
14
|
+
/**
|
|
15
|
+
* @param {Instance} governedInstance
|
|
16
|
+
* @param {GovernorCreatorFacet<any>} governorFacet
|
|
17
|
+
* @param {string} [label] for diagnostic use only
|
|
18
|
+
*/
|
|
19
|
+
addInstance: (governedInstance: Instance, governorFacet: GovernorCreatorFacet<any>, label?: string | undefined) => void;
|
|
20
|
+
makeCharterMemberInvitation: () => Promise<Invitation<{
|
|
21
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
22
|
+
VoteOnParamChange: () => Promise<Invitation<import("@agoric/governance/src/types.js").ContractGovernanceVoteResult, ParamChangesOfferArgs>>;
|
|
23
|
+
VoteOnPauseOffers: (instance: any, strings: any, deadline: any) => Promise<Invitation<import("@agoric/governance/src/types.js").ContractGovernanceVoteResult, undefined>>;
|
|
24
|
+
VoteOnApiCall: (instance: Instance, methodName: string, methodArgs: string[], deadline: import("@agoric/time").TimestampValue) => Promise<Invitation<import("@agoric/governance/src/types.js").ContractGovernanceVoteResult, undefined>>;
|
|
25
|
+
}>;
|
|
26
|
+
}, undefined>>;
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
export type ParamChangesOfferArgs = {
|
|
30
|
+
deadline: bigint;
|
|
31
|
+
instance: Instance;
|
|
32
|
+
params: Record<string, unknown>;
|
|
33
|
+
path?: {
|
|
34
|
+
paramPath: {
|
|
35
|
+
key: string;
|
|
36
|
+
};
|
|
37
|
+
} | undefined;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=econCommitteeCharter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"econCommitteeCharter.d.ts","sourceRoot":"","sources":["econCommitteeCharter.js"],"names":[],"mappings":"AAaA;;;;;GAKG;AAEH,iEAAkE;AAoBlE,2BAA2B;AAC3B,mBADW,YAAY,CAMrB;AAQK,2BAJI,GAAG,CAAC;IAAE,6BAA6B,EAAE,YAAY,CAAA;CAAE,CAAC,eACpD,SAAS,WACT,OAAO,kBAAkB,EAAE,OAAO;;QAsHvC;;;;WAIG;wCAHQ,QAAQ,iBACR,oBAAoB,CAAC,GAAG,CAAC;;;;;0CAxE7B,QAAQ,cACR,MAAM,cACN,MAAM,EAAE,YACR,OAAO,cAAc,EAAE,cAAc;;;;GAkFjD;;cAjKa,MAAM;cACN,QAAQ;YACR,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;mBACV;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
|
+
/// <reference types="@agoric/governance/exported" />
|
|
3
|
+
/// <reference types="@agoric/zoe/exported" />
|
|
2
4
|
|
|
3
|
-
import '@agoric/governance/exported.js';
|
|
4
5
|
import { M, mustMatch } from '@agoric/store';
|
|
5
6
|
import { TimestampShape } from '@agoric/time';
|
|
6
7
|
import { prepareExo, provideDurableMapStore } from '@agoric/vat-data';
|
|
7
|
-
import '@agoric/zoe/exported.js';
|
|
8
|
-
import '@agoric/zoe/src/contracts/exported.js';
|
|
9
8
|
import {
|
|
10
9
|
InstallationShape,
|
|
11
10
|
InstanceHandleShape,
|
|
@@ -13,12 +12,10 @@ import {
|
|
|
13
12
|
import { E } from '@endo/far';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
|
-
* @file
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* constrain deadlines and possibly split the ability to call for votes into
|
|
21
|
-
* separate capabilities for finer grain encapsulation.
|
|
15
|
+
* @file This contract makes it possible for those who govern contracts to call
|
|
16
|
+
* for votes on changes. A more complete implementation would validate
|
|
17
|
+
* parameters, constrain deadlines and possibly split the ability to call for
|
|
18
|
+
* votes into separate capabilities for finer grain encapsulation.
|
|
22
19
|
*/
|
|
23
20
|
|
|
24
21
|
export const INVITATION_MAKERS_DESC = 'charter member invitation';
|
|
@@ -28,7 +25,7 @@ export const INVITATION_MAKERS_DESC = 'charter member invitation';
|
|
|
28
25
|
* @property {bigint} deadline
|
|
29
26
|
* @property {Instance} instance
|
|
30
27
|
* @property {Record<string, unknown>} params
|
|
31
|
-
* @property {{paramPath: { key: string }}} [path]
|
|
28
|
+
* @property {{ paramPath: { key: string } }} [path]
|
|
32
29
|
*/
|
|
33
30
|
const ParamChangesOfferArgsShape = M.splitRecord(
|
|
34
31
|
{
|
|
@@ -41,19 +38,21 @@ const ParamChangesOfferArgsShape = M.splitRecord(
|
|
|
41
38
|
},
|
|
42
39
|
);
|
|
43
40
|
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
/** @type {ContractMeta} */
|
|
42
|
+
export const meta = {
|
|
43
|
+
customTermsShape: {
|
|
44
|
+
binaryVoteCounterInstallation: InstallationShape,
|
|
45
|
+
},
|
|
46
|
+
upgradability: 'canUpgrade',
|
|
47
|
+
};
|
|
48
|
+
harden(meta);
|
|
50
49
|
|
|
51
50
|
/**
|
|
52
|
-
* @param {ZCF<{binaryVoteCounterInstallation: Installation}>} zcf
|
|
51
|
+
* @param {ZCF<{ binaryVoteCounterInstallation: Installation }>} zcf
|
|
53
52
|
* @param {undefined} privateArgs
|
|
54
53
|
* @param {import('@agoric/vat-data').Baggage} baggage
|
|
55
54
|
*/
|
|
56
|
-
export const
|
|
55
|
+
export const start = async (zcf, privateArgs, baggage) => {
|
|
57
56
|
const { binaryVoteCounterInstallation: counter } = zcf.getTerms();
|
|
58
57
|
/** @type {MapStore<Instance, GovernorCreatorFacet<any>>} */
|
|
59
58
|
const instanceToGovernor = provideDurableMapStore(
|
|
@@ -79,6 +78,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
79
78
|
const governor = instanceToGovernor.get(instance);
|
|
80
79
|
return E(governor).voteOnParamChanges(counter, deadline, {
|
|
81
80
|
...path,
|
|
81
|
+
// @ts-expect-error XXX
|
|
82
82
|
changes: params,
|
|
83
83
|
});
|
|
84
84
|
};
|
|
@@ -156,7 +156,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
156
156
|
return harden({ invitationMakers });
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
-
const
|
|
159
|
+
const CharterCreatorI = M.interface('Charter creatorFacet', {
|
|
160
160
|
addInstance: M.call(InstanceHandleShape, M.any())
|
|
161
161
|
.optional(M.string())
|
|
162
162
|
.returns(),
|
|
@@ -166,7 +166,7 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
166
166
|
const creatorFacet = prepareExo(
|
|
167
167
|
baggage,
|
|
168
168
|
'Charter creatorFacet',
|
|
169
|
-
|
|
169
|
+
CharterCreatorI,
|
|
170
170
|
{
|
|
171
171
|
/**
|
|
172
172
|
* @param {Instance} governedInstance
|
|
@@ -184,3 +184,4 @@ export const prepare = async (zcf, privateArgs, baggage) => {
|
|
|
184
184
|
|
|
185
185
|
return harden({ creatorFacet });
|
|
186
186
|
};
|
|
187
|
+
harden(start);
|