@agoric/inter-protocol 0.13.2-dev-52d161b.0 → 0.13.2-dev-470ca41.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/bundles/bundle-auctioneer-js-meta.json +113 -113
- package/bundles/bundle-auctioneer.js +1 -1
- package/bundles/bundle-econCommitteeCharter-js-meta.json +70 -70
- package/bundles/bundle-feeDistributor-js-meta.json +56 -56
- package/bundles/bundle-feeDistributor.js +1 -1
- package/bundles/bundle-fluxAggregator-js-meta.json +108 -108
- package/bundles/bundle-psm-js-meta.json +106 -106
- package/bundles/bundle-reserve-js-meta.json +104 -104
- package/bundles/bundle-scaledPriceAuthority-js-meta.json +75 -75
- package/bundles/bundle-stakeFactory-js-meta.json +112 -112
- package/bundles/bundle-vaultFactory-js-meta.json +132 -132
- package/bundles/bundle-vaultFactory.js +1 -1
- package/package.json +17 -17
- package/src/auction/auctionBook.js +15 -15
- package/src/auction/auctioneer.js +1 -1
- package/src/clientSupport.js +7 -8
- package/src/feeDistributor.js +1 -1
- package/src/proposals/econ-behaviors.js +14 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/inter-protocol",
|
|
3
|
-
"version": "0.13.2-dev-
|
|
3
|
+
"version": "0.13.2-dev-470ca41.0+470ca41",
|
|
4
4
|
"description": "Core cryptoeconomy contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,28 +29,28 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agoric/assert": "0.5.2-dev-
|
|
33
|
-
"@agoric/ertp": "0.15.4-dev-
|
|
34
|
-
"@agoric/governance": "0.9.2-dev-
|
|
35
|
-
"@agoric/internal": "0.2.2-dev-
|
|
36
|
-
"@agoric/notifier": "0.5.2-dev-
|
|
37
|
-
"@agoric/store": "0.8.4-dev-
|
|
38
|
-
"@agoric/time": "0.2.2-dev-
|
|
39
|
-
"@agoric/vat-data": "0.4.4-dev-
|
|
40
|
-
"@agoric/vats": "0.13.1-dev-
|
|
41
|
-
"@agoric/zoe": "0.25.4-dev-
|
|
32
|
+
"@agoric/assert": "0.5.2-dev-470ca41.0+470ca41",
|
|
33
|
+
"@agoric/ertp": "0.15.4-dev-470ca41.0+470ca41",
|
|
34
|
+
"@agoric/governance": "0.9.2-dev-470ca41.0+470ca41",
|
|
35
|
+
"@agoric/internal": "0.2.2-dev-470ca41.0+470ca41",
|
|
36
|
+
"@agoric/notifier": "0.5.2-dev-470ca41.0+470ca41",
|
|
37
|
+
"@agoric/store": "0.8.4-dev-470ca41.0+470ca41",
|
|
38
|
+
"@agoric/time": "0.2.2-dev-470ca41.0+470ca41",
|
|
39
|
+
"@agoric/vat-data": "0.4.4-dev-470ca41.0+470ca41",
|
|
40
|
+
"@agoric/vats": "0.13.1-dev-470ca41.0+470ca41",
|
|
41
|
+
"@agoric/zoe": "0.25.4-dev-470ca41.0+470ca41",
|
|
42
42
|
"@endo/captp": "^3.1.0",
|
|
43
43
|
"@endo/eventual-send": "^0.17.1",
|
|
44
44
|
"@endo/far": "^0.2.17",
|
|
45
45
|
"@endo/marshal": "^0.8.4",
|
|
46
46
|
"@endo/nat": "^4.1.26",
|
|
47
|
-
"agoric": "0.18.3-dev-
|
|
47
|
+
"agoric": "0.18.3-dev-470ca41.0+470ca41"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@agoric/deploy-script-support": "0.9.5-dev-
|
|
51
|
-
"@agoric/smart-wallet": "0.4.3-dev-
|
|
52
|
-
"@agoric/swingset-liveslots": "0.9.1-dev-
|
|
53
|
-
"@agoric/swingset-vat": "0.30.3-dev-
|
|
50
|
+
"@agoric/deploy-script-support": "0.9.5-dev-470ca41.0+470ca41",
|
|
51
|
+
"@agoric/smart-wallet": "0.4.3-dev-470ca41.0+470ca41",
|
|
52
|
+
"@agoric/swingset-liveslots": "0.9.1-dev-470ca41.0+470ca41",
|
|
53
|
+
"@agoric/swingset-vat": "0.30.3-dev-470ca41.0+470ca41",
|
|
54
54
|
"@endo/bundle-source": "^2.5.0",
|
|
55
55
|
"@endo/init": "^0.5.55",
|
|
56
56
|
"@endo/promise-kit": "^0.2.55",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "470ca4121d46170665958cd713ec9d22dac5eb9a"
|
|
80
80
|
}
|
|
@@ -54,7 +54,7 @@ const trace = makeTracer('AucBook', false);
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* @typedef {{
|
|
57
|
-
*
|
|
57
|
+
* maxBuy: Amount<'nat'>
|
|
58
58
|
* } & {
|
|
59
59
|
* exitAfterBuy?: boolean,
|
|
60
60
|
* } & ({
|
|
@@ -72,7 +72,7 @@ export const makeBidSpecShape = (currencyBrand, collateralBrand) => {
|
|
|
72
72
|
const currencyAmountShape = makeNatAmountShape(currencyBrand);
|
|
73
73
|
const collateralAmountShape = makeNatAmountShape(collateralBrand);
|
|
74
74
|
return M.splitRecord(
|
|
75
|
-
{
|
|
75
|
+
{ maxBuy: collateralAmountShape },
|
|
76
76
|
{
|
|
77
77
|
exitAfterBuy: M.boolean(),
|
|
78
78
|
// xxx should have exactly one of these properties
|
|
@@ -352,7 +352,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
352
352
|
*
|
|
353
353
|
* @param {ZCFSeat} seat
|
|
354
354
|
* @param {Ratio} price
|
|
355
|
-
* @param {Amount<'nat'>}
|
|
355
|
+
* @param {Amount<'nat'>} maxBuy
|
|
356
356
|
* @param {object} opts
|
|
357
357
|
* @param {boolean} opts.trySettle
|
|
358
358
|
* @param {boolean} [opts.exitAfterBuy]
|
|
@@ -360,7 +360,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
360
360
|
acceptPriceOffer(
|
|
361
361
|
seat,
|
|
362
362
|
price,
|
|
363
|
-
|
|
363
|
+
maxBuy,
|
|
364
364
|
{ trySettle, exitAfterBuy = false },
|
|
365
365
|
) {
|
|
366
366
|
const { priceBook, curAuctionPrice } = this.state;
|
|
@@ -370,15 +370,15 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
370
370
|
const settleIfPriceExists = () => {
|
|
371
371
|
if (curAuctionPrice !== null) {
|
|
372
372
|
return trySettle && ratioGTE(price, curAuctionPrice)
|
|
373
|
-
? helper.settle(seat,
|
|
374
|
-
: AmountMath.makeEmptyFromAmount(
|
|
373
|
+
? helper.settle(seat, maxBuy)
|
|
374
|
+
: AmountMath.makeEmptyFromAmount(maxBuy);
|
|
375
375
|
} else {
|
|
376
|
-
return AmountMath.makeEmptyFromAmount(
|
|
376
|
+
return AmountMath.makeEmptyFromAmount(maxBuy);
|
|
377
377
|
}
|
|
378
378
|
};
|
|
379
379
|
const collateralSold = settleIfPriceExists();
|
|
380
380
|
|
|
381
|
-
const stillWant = AmountMath.subtract(
|
|
381
|
+
const stillWant = AmountMath.subtract(maxBuy, collateralSold);
|
|
382
382
|
if (
|
|
383
383
|
(exitAfterBuy && !AmountMath.isEmpty(collateralSold)) ||
|
|
384
384
|
AmountMath.isEmpty(stillWant) ||
|
|
@@ -400,7 +400,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
400
400
|
*
|
|
401
401
|
* @param {ZCFSeat} seat
|
|
402
402
|
* @param {Ratio} bidScaling
|
|
403
|
-
* @param {Amount<'nat'>}
|
|
403
|
+
* @param {Amount<'nat'>} maxBuy
|
|
404
404
|
* @param {object} opts
|
|
405
405
|
* @param {boolean} opts.trySettle
|
|
406
406
|
* @param {boolean} [opts.exitAfterBuy]
|
|
@@ -408,7 +408,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
408
408
|
acceptScaledBidOffer(
|
|
409
409
|
seat,
|
|
410
410
|
bidScaling,
|
|
411
|
-
|
|
411
|
+
maxBuy,
|
|
412
412
|
{ trySettle, exitAfterBuy = false },
|
|
413
413
|
) {
|
|
414
414
|
trace('accept scaled bid offer');
|
|
@@ -427,13 +427,13 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
427
427
|
lockedPriceForRound,
|
|
428
428
|
)
|
|
429
429
|
) {
|
|
430
|
-
return helper.settle(seat,
|
|
430
|
+
return helper.settle(seat, maxBuy);
|
|
431
431
|
}
|
|
432
|
-
return AmountMath.makeEmptyFromAmount(
|
|
432
|
+
return AmountMath.makeEmptyFromAmount(maxBuy);
|
|
433
433
|
};
|
|
434
434
|
const collateralSold = settleIfPricesDefined();
|
|
435
435
|
|
|
436
|
-
const stillWant = AmountMath.subtract(
|
|
436
|
+
const stillWant = AmountMath.subtract(maxBuy, collateralSold);
|
|
437
437
|
if (
|
|
438
438
|
(exitAfterBuy && !AmountMath.isEmpty(collateralSold)) ||
|
|
439
439
|
AmountMath.isEmpty(stillWant) ||
|
|
@@ -664,7 +664,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
664
664
|
return helper.acceptPriceOffer(
|
|
665
665
|
seat,
|
|
666
666
|
bidSpec.offerPrice,
|
|
667
|
-
bidSpec.
|
|
667
|
+
bidSpec.maxBuy,
|
|
668
668
|
{
|
|
669
669
|
trySettle,
|
|
670
670
|
exitAfterBuy,
|
|
@@ -674,7 +674,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
674
674
|
return helper.acceptScaledBidOffer(
|
|
675
675
|
seat,
|
|
676
676
|
bidSpec.offerBidScaling,
|
|
677
|
-
bidSpec.
|
|
677
|
+
bidSpec.maxBuy,
|
|
678
678
|
{
|
|
679
679
|
trySettle,
|
|
680
680
|
exitAfterBuy,
|
package/src/clientSupport.js
CHANGED
|
@@ -209,7 +209,7 @@ const makePsmSwapOffer = (instance, brands, opts) => {
|
|
|
209
209
|
* @param {{
|
|
210
210
|
* offerId: string,
|
|
211
211
|
* give: string,
|
|
212
|
-
*
|
|
212
|
+
* maxBuy: string,
|
|
213
213
|
* wantMinimum?: string,
|
|
214
214
|
* parseAmount: (x: string) => Amount<'nat'>,
|
|
215
215
|
* } & ({
|
|
@@ -224,7 +224,7 @@ const makeBidOffer = (_brands, opts) => {
|
|
|
224
224
|
assertAllDefined({
|
|
225
225
|
offerId: opts.offerId,
|
|
226
226
|
give: opts.give,
|
|
227
|
-
|
|
227
|
+
maxBuy: opts.maxBuy,
|
|
228
228
|
});
|
|
229
229
|
const { parseAmount } = opts;
|
|
230
230
|
const proposal = {
|
|
@@ -234,7 +234,7 @@ const makeBidOffer = (_brands, opts) => {
|
|
|
234
234
|
: {}),
|
|
235
235
|
};
|
|
236
236
|
const istBrand = proposal.give.Currency.brand;
|
|
237
|
-
const
|
|
237
|
+
const maxBuy = parseAmount(opts.maxBuy);
|
|
238
238
|
|
|
239
239
|
const bounds = (x, lo, hi) => {
|
|
240
240
|
assert(x >= lo && x <= hi);
|
|
@@ -249,12 +249,11 @@ const makeBidOffer = (_brands, opts) => {
|
|
|
249
249
|
const offerArgs =
|
|
250
250
|
'price' in opts
|
|
251
251
|
? {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
offerPrice: parseRatio(opts.price, istBrand, desiredBuy.brand),
|
|
252
|
+
maxBuy: parseAmount(opts.maxBuy),
|
|
253
|
+
offerPrice: parseRatio(opts.price, istBrand, maxBuy.brand),
|
|
255
254
|
}
|
|
256
255
|
: {
|
|
257
|
-
|
|
256
|
+
maxBuy,
|
|
258
257
|
offerBidScaling: parseRatio(
|
|
259
258
|
(1 - bounds(opts.discount, -1, 1)).toFixed(2),
|
|
260
259
|
istBrand,
|
|
@@ -268,7 +267,7 @@ const makeBidOffer = (_brands, opts) => {
|
|
|
268
267
|
invitationSpec: {
|
|
269
268
|
source: 'agoricContract',
|
|
270
269
|
instancePath: ['auctioneer'],
|
|
271
|
-
callPipe: [['makeBidInvitation', [
|
|
270
|
+
callPipe: [['makeBidInvitation', [maxBuy.brand]]],
|
|
272
271
|
},
|
|
273
272
|
proposal,
|
|
274
273
|
offerArgs,
|
package/src/feeDistributor.js
CHANGED
|
@@ -316,7 +316,7 @@ export const makeFeeDistributor = (feeIssuer, terms) => {
|
|
|
316
316
|
},
|
|
317
317
|
|
|
318
318
|
/**
|
|
319
|
-
* @param {Record<Keyword, FeeDestination
|
|
319
|
+
* @param {Record<Keyword, ERef<FeeDestination>>} newDestinations
|
|
320
320
|
*/
|
|
321
321
|
setDestinations: async newDestinations => {
|
|
322
322
|
destinations = newDestinations;
|
|
@@ -396,7 +396,7 @@ export const startRewardDistributor = async ({
|
|
|
396
396
|
timerService,
|
|
397
397
|
collectionInterval: 60n * 60n, // 1 hour
|
|
398
398
|
keywordShares: {
|
|
399
|
-
RewardDistributor:
|
|
399
|
+
RewardDistributor: 0n,
|
|
400
400
|
Reserve: 1n,
|
|
401
401
|
},
|
|
402
402
|
}),
|
|
@@ -417,6 +417,12 @@ export const startRewardDistributor = async ({
|
|
|
417
417
|
return undefined;
|
|
418
418
|
});
|
|
419
419
|
|
|
420
|
+
/**
|
|
421
|
+
* @type {Awaited<
|
|
422
|
+
* ReturnType<typeof import('../feeDistributor.js').makeFeeDistributor>>
|
|
423
|
+
* & { adminFacet: AdminFacet, instance: Instance }
|
|
424
|
+
* }
|
|
425
|
+
*/
|
|
420
426
|
const instanceKit = await E(zoe).startInstance(
|
|
421
427
|
feeDistributor,
|
|
422
428
|
{ Fee: centralIssuer },
|
|
@@ -424,13 +430,15 @@ export const startRewardDistributor = async ({
|
|
|
424
430
|
undefined,
|
|
425
431
|
'feeDistributor',
|
|
426
432
|
);
|
|
433
|
+
/** @type {ERef<import('../feeDistributor.js').FeeDestination>} */
|
|
427
434
|
await E(instanceKit.creatorFacet).setDestinations({
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
435
|
+
...(rewardDistributorDepositFacet && {
|
|
436
|
+
RewardDistributor: E(
|
|
437
|
+
instanceKit.creatorFacet,
|
|
438
|
+
).makeDepositFacetDestination(rewardDistributorDepositFacet),
|
|
439
|
+
}),
|
|
433
440
|
Reserve: E(instanceKit.creatorFacet).makeOfferDestination(
|
|
441
|
+
zoe,
|
|
434
442
|
'Collateral',
|
|
435
443
|
E.get(reserveKit).publicFacet,
|
|
436
444
|
'makeAddCollateralInvitation',
|