@agoric/inter-protocol 0.16.2-dev-d32d6ce.0 → 0.16.2-dev-13c10cc.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 +15 -15
- package/src/auction/auctionBook.d.ts.map +1 -1
- package/src/auction/auctionBook.js +21 -36
- package/src/auction/auctionMath.d.ts +17 -0
- package/src/auction/auctionMath.d.ts.map +1 -0
- package/src/auction/auctionMath.js +81 -0
- package/src/proposals/econ-behaviors.d.ts +2 -0
- package/src/proposals/econ-behaviors.d.ts.map +1 -1
- package/src/proposals/upgrade-vaults.d.ts.map +1 -1
- package/src/proposals/upgrade-vaults.js +37 -2
- package/src/vaultFactory/vaultFactory.d.ts +1 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
- package/src/vaultFactory/vaultFactory.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/inter-protocol",
|
|
3
|
-
"version": "0.16.2-dev-
|
|
3
|
+
"version": "0.16.2-dev-13c10cc.0+13c10cc",
|
|
4
4
|
"description": "Core cryptoeconomy contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
35
|
-
"@agoric/governance": "0.10.4-dev-
|
|
36
|
-
"@agoric/internal": "0.3.3-dev-
|
|
37
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
38
|
-
"@agoric/store": "0.9.3-dev-
|
|
39
|
-
"@agoric/time": "0.3.3-dev-
|
|
40
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
41
|
-
"@agoric/vats": "0.15.2-dev-
|
|
42
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
34
|
+
"@agoric/ertp": "0.16.3-dev-13c10cc.0+13c10cc",
|
|
35
|
+
"@agoric/governance": "0.10.4-dev-13c10cc.0+13c10cc",
|
|
36
|
+
"@agoric/internal": "0.3.3-dev-13c10cc.0+13c10cc",
|
|
37
|
+
"@agoric/notifier": "0.6.3-dev-13c10cc.0+13c10cc",
|
|
38
|
+
"@agoric/store": "0.9.3-dev-13c10cc.0+13c10cc",
|
|
39
|
+
"@agoric/time": "0.3.3-dev-13c10cc.0+13c10cc",
|
|
40
|
+
"@agoric/vat-data": "0.5.3-dev-13c10cc.0+13c10cc",
|
|
41
|
+
"@agoric/vats": "0.15.2-dev-13c10cc.0+13c10cc",
|
|
42
|
+
"@agoric/zoe": "0.26.3-dev-13c10cc.0+13c10cc",
|
|
43
43
|
"@endo/captp": "^4.2.2",
|
|
44
44
|
"@endo/errors": "^1.2.4",
|
|
45
45
|
"@endo/eventual-send": "^1.2.4",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"jessie.js": "^0.3.4"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
54
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
55
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
56
|
-
"@agoric/zone": "0.2.3-dev-
|
|
53
|
+
"@agoric/smart-wallet": "0.5.4-dev-13c10cc.0+13c10cc",
|
|
54
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-13c10cc.0+13c10cc",
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-dev-13c10cc.0+13c10cc",
|
|
56
|
+
"@agoric/zone": "0.2.3-dev-13c10cc.0+13c10cc",
|
|
57
57
|
"@endo/bundle-source": "^3.3.0",
|
|
58
58
|
"@endo/init": "^1.1.3",
|
|
59
59
|
"@endo/promise-kit": "^1.1.4",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"typeCoverage": {
|
|
85
85
|
"atLeast": 95.81
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "13c10ccbb5ee417be8af41688441a8e7c67c45c2"
|
|
88
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auctionBook.d.ts","sourceRoot":"","sources":["auctionBook.js"],"names":[],"mappings":"AA+EO,6CAHI,KAAK,CAAC,KAAK,CAAC,mBACZ,KAAK,CAAC,KAAK,CAAC,oCAiBtB;AAwBM,4CAJI,OAAO,OACP,GAAG,mBACH,OAAO,6CAA6C,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"auctionBook.d.ts","sourceRoot":"","sources":["auctionBook.js"],"names":[],"mappings":"AA+EO,6CAHI,KAAK,CAAC,KAAK,CAAC,mBACZ,KAAK,CAAC,KAAK,CAAC,oCAiBtB;AAwBM,4CAJI,OAAO,OACP,GAAG,mBACH,OAAO,6CAA6C,EAAE,eAAe,8IA+oBtE,UAAU,mJA/iBN,WAAW;;QAuBjB;;;;;;WAMG;+BAFQ,MAAM,SACN,KAAK,GAAG,SAAS;QAW5B;;;;;;;WAOG;2BAHQ,MAAM,kBACN,MAAM,SACN,KAAK,GAAG,SAAS;QAW5B;;;;;;WAMG;qBAFQ,OAAO,oBACP,MAAM,CAAC,KAAK,CAAC;QAgExB;;;;;;;;;;;WAWG;+BANQ,OAAO,SACP,KAAK,UACL,MAAM,CAAC,KAAK,CAAC,+BAErB;YAAsB,SAAS,EAAvB,OAAO;YACQ,YAAY;SAAC;QAsCvC;;;;;;;;;;;WAWG;mCANQ,OAAO,cACP,KAAK,UACL,MAAM,CAAC,KAAK,CAAC,+BAErB;YAAsB,SAAS,EAAvB,OAAO;YACQ,YAAY;SAAC;;;;;QA2GvC;;;;;;;;WAQG;+BAPQ,MAAM,CAAC,KAAK,CAAC,cACb,OAAO;QA6ElB,yCAAyC;mCAAlB,KAAK,GAAK,IAAI;;;;;QAsGrC;;;;WAIG;4BAHQ,SAAS,QACT,OAAO,aACP,OAAO;;;;;;;;;;;;GAqFqB,CAAC,MAAM,CAAC,CAItD;wBAzsBY;IACZ,MAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;CACvB,GAAG;IACN,YAAgB,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,CACE;IACR,UAAoB,EAAE,KAAK,CAAC;CACnB,GACD;IACR,eAAyB,EAAE,KAAK,CAAC;CACxB,CACJ;;;;;gBAyBQ,KAAK,GAAG,IAAI;;;;;uBACZ,KAAK,GAAG,IAAI;;;;;uBAEZ,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;;;;2BAEpB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;;;;oBAEpB,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS;;;;;qBAEzB,MAAM,CAAC,KAAK,CAAC;;;;;yBAEb,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;0BA6pBpB,UAAU,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;6BA3uBrC,kBAAkB;oCACiD,4BAA4B"}
|
|
@@ -12,7 +12,6 @@ import { assertAllDefined, makeTracer } from '@agoric/internal';
|
|
|
12
12
|
import {
|
|
13
13
|
atomicRearrange,
|
|
14
14
|
ceilMultiplyBy,
|
|
15
|
-
floorDivideBy,
|
|
16
15
|
makeRatioFromAmounts,
|
|
17
16
|
makeRecorderTopic,
|
|
18
17
|
multiplyRatios,
|
|
@@ -21,6 +20,7 @@ import {
|
|
|
21
20
|
import { observeNotifier } from '@agoric/notifier';
|
|
22
21
|
|
|
23
22
|
import { makeNatAmountShape } from '../contractSupport.js';
|
|
23
|
+
import { amountsToSettle } from './auctionMath.js';
|
|
24
24
|
import { preparePriceBook, prepareScaledBidBook } from './offerBook.js';
|
|
25
25
|
import {
|
|
26
26
|
isScaledBidPriceHigher,
|
|
@@ -282,39 +282,30 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
282
282
|
return makeEmpty(collateralBrand);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
/** @type {Amount<'nat'>} */
|
|
286
|
-
const initialCollateralTarget = AmountMath.min(
|
|
287
|
-
collateralWanted,
|
|
288
|
-
collateralAvailable,
|
|
289
|
-
);
|
|
290
|
-
|
|
291
285
|
const { curAuctionPrice, bidHoldingSeat, remainingProceedsGoal } =
|
|
292
286
|
this.state;
|
|
293
287
|
curAuctionPrice !== null ||
|
|
294
288
|
Fail`auctionPrice must be set before each round`;
|
|
295
289
|
assert(curAuctionPrice);
|
|
296
290
|
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
291
|
+
const { proceedsExpected, proceedsTarget, collateralTarget } =
|
|
292
|
+
amountsToSettle(
|
|
293
|
+
{
|
|
294
|
+
bidAlloc,
|
|
295
|
+
collateralWanted,
|
|
296
|
+
collateralAvailable,
|
|
297
|
+
curAuctionPrice,
|
|
298
|
+
remainingProceedsGoal,
|
|
299
|
+
},
|
|
300
|
+
trace,
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
if (proceedsExpected === null) {
|
|
302
304
|
seat.fail(Error('price fell to zero'));
|
|
303
305
|
return makeEmpty(collateralBrand);
|
|
304
306
|
}
|
|
305
307
|
|
|
306
|
-
|
|
307
|
-
const proceedsLimit = remainingProceedsGoal
|
|
308
|
-
? AmountMath.min(remainingProceedsGoal, minProceedsTarget)
|
|
309
|
-
: minProceedsTarget;
|
|
310
|
-
const isRaiseLimited =
|
|
311
|
-
remainingProceedsGoal ||
|
|
312
|
-
!AmountMath.isGTE(proceedsLimit, proceedsNeeded);
|
|
313
|
-
|
|
314
|
-
const [proceedsTarget, collateralTarget] = isRaiseLimited
|
|
315
|
-
? [proceedsLimit, floorDivideBy(proceedsLimit, curAuctionPrice)]
|
|
316
|
-
: [minProceedsTarget, initialCollateralTarget];
|
|
317
|
-
|
|
308
|
+
// check that the requested amount could be satisfied
|
|
318
309
|
const { Collateral } = seat.getProposal().want;
|
|
319
310
|
if (Collateral && AmountMath.isGTE(Collateral, collateralTarget)) {
|
|
320
311
|
seat.exit('unable to satisfy want');
|
|
@@ -335,7 +326,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
335
326
|
);
|
|
336
327
|
}
|
|
337
328
|
|
|
338
|
-
trace('
|
|
329
|
+
trace('settled', {
|
|
339
330
|
collateralTarget,
|
|
340
331
|
proceedsTarget,
|
|
341
332
|
remainingProceedsGoal: this.state.remainingProceedsGoal,
|
|
@@ -611,20 +602,14 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
611
602
|
const pricedOffers = priceBook.offersAbove(curAuctionPrice);
|
|
612
603
|
const scaledBidOffers = scaledBidBook.offersAbove(reduction);
|
|
613
604
|
|
|
614
|
-
const compareValues = (v1, v2) => {
|
|
615
|
-
if (v1 < v2) {
|
|
616
|
-
return -1;
|
|
617
|
-
} else if (v1 === v2) {
|
|
618
|
-
return 0;
|
|
619
|
-
} else {
|
|
620
|
-
return 1;
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
trace(`settling`, pricedOffers.length, scaledBidOffers.length);
|
|
624
605
|
// requested price or BidScaling gives no priority beyond specifying which
|
|
625
606
|
// round the order will be serviced in.
|
|
626
607
|
const prioritizedOffers = [...pricedOffers, ...scaledBidOffers].sort(
|
|
627
|
-
(a, b) =>
|
|
608
|
+
(a, b) => Number(a[1].seqNum - b[1].seqNum),
|
|
609
|
+
);
|
|
610
|
+
|
|
611
|
+
trace(
|
|
612
|
+
`settling ${prioritizedOffers.length} offers at ${curAuctionPrice} (priced ${pricedOffers.length}, scaled ${scaledBidOffers.length}) `,
|
|
628
613
|
);
|
|
629
614
|
|
|
630
615
|
const { remainingProceedsGoal } = state;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function amountsToSettle({ bidAlloc, collateralWanted, collateralAvailable, curAuctionPrice, remainingProceedsGoal, }: {
|
|
2
|
+
bidAlloc: Amount<"nat">;
|
|
3
|
+
collateralWanted: Amount<"nat">;
|
|
4
|
+
collateralAvailable: Amount<"nat">;
|
|
5
|
+
curAuctionPrice: Ratio;
|
|
6
|
+
remainingProceedsGoal: Amount<"nat"> | null;
|
|
7
|
+
}, log?: ((...msgs: any[]) => void) | undefined): {
|
|
8
|
+
proceedsExpected: null;
|
|
9
|
+
proceedsTarget?: undefined;
|
|
10
|
+
collateralTarget?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
proceedsExpected: import("@agoric/ertp/src/types.js").NatAmount;
|
|
13
|
+
proceedsTarget: import("@agoric/ertp/src/types.js").NatAmount;
|
|
14
|
+
collateralTarget: import("@agoric/ertp/src/types.js").NatAmount;
|
|
15
|
+
};
|
|
16
|
+
import type { Amount } from '@agoric/ertp/src/types.js';
|
|
17
|
+
//# sourceMappingURL=auctionMath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auctionMath.d.ts","sourceRoot":"","sources":["auctionMath.js"],"names":[],"mappings":"AAoBO,8HARJ;IAAyB,QAAQ,EAAzB,OAAO,KAAK,CAAC;IACI,gBAAgB,EAAjC,OAAO,KAAK,CAAC;IACI,mBAAmB,EAApC,OAAO,KAAK,CAAC;IACJ,eAAe,EAAxB,KAAK;IACmB,qBAAqB,EAA7C,OAAO,KAAK,CAAC,GAAG,IAAI;CAE5B,mBAAkB,GAAG,EAAE,KAAK,IAAI;;;;;;;;EA6DlC;4BAxEwB,2BAA2B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { AmountMath } from '@agoric/ertp';
|
|
2
|
+
import {
|
|
3
|
+
ceilMultiplyBy,
|
|
4
|
+
floorDivideBy,
|
|
5
|
+
} from '@agoric/zoe/src/contractSupport/index.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @import {Amount} from '@agoric/ertp/src/types.js';
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {object} p
|
|
13
|
+
* @param {Amount<'nat'>} p.bidAlloc current allocation of the bidding seat
|
|
14
|
+
* @param {Amount<'nat'>} p.collateralWanted want of the offer
|
|
15
|
+
* @param {Amount<'nat'>} p.collateralAvailable available to auction
|
|
16
|
+
* @param {Ratio} p.curAuctionPrice current auction price
|
|
17
|
+
* @param {Amount<'nat'> | null} p.remainingProceedsGoal amount still needing
|
|
18
|
+
* liquidating over multiple rounds; null indicates no limit
|
|
19
|
+
* @param {(...msgs: any[]) => void} [log]
|
|
20
|
+
*/
|
|
21
|
+
export const amountsToSettle = (
|
|
22
|
+
{
|
|
23
|
+
bidAlloc,
|
|
24
|
+
collateralWanted,
|
|
25
|
+
collateralAvailable,
|
|
26
|
+
curAuctionPrice,
|
|
27
|
+
remainingProceedsGoal,
|
|
28
|
+
},
|
|
29
|
+
log = () => {},
|
|
30
|
+
) => {
|
|
31
|
+
log('amountsToSettle', {
|
|
32
|
+
bidAlloc,
|
|
33
|
+
collateralWanted,
|
|
34
|
+
collateralAvailable,
|
|
35
|
+
curAuctionPrice,
|
|
36
|
+
remainingProceedsGoal,
|
|
37
|
+
});
|
|
38
|
+
const initialCollateralTarget = AmountMath.min(
|
|
39
|
+
collateralWanted,
|
|
40
|
+
collateralAvailable,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const proceedsExpected = ceilMultiplyBy(
|
|
44
|
+
initialCollateralTarget,
|
|
45
|
+
curAuctionPrice,
|
|
46
|
+
);
|
|
47
|
+
if (AmountMath.isEmpty(proceedsExpected)) {
|
|
48
|
+
return { proceedsExpected: null };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const targetByProceeds = proceedsLimit =>
|
|
52
|
+
AmountMath.min(
|
|
53
|
+
collateralAvailable,
|
|
54
|
+
floorDivideBy(proceedsLimit, curAuctionPrice),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const [proceedsTarget, collateralTarget] = (() => {
|
|
58
|
+
// proceeds cannot exceed what is needed or being offered
|
|
59
|
+
const proceedsBidded = AmountMath.min(proceedsExpected, bidAlloc);
|
|
60
|
+
if (remainingProceedsGoal) {
|
|
61
|
+
const goalProceeds = AmountMath.min(
|
|
62
|
+
remainingProceedsGoal,
|
|
63
|
+
proceedsBidded,
|
|
64
|
+
);
|
|
65
|
+
return [goalProceeds, targetByProceeds(goalProceeds)];
|
|
66
|
+
} else if (AmountMath.isGTE(proceedsBidded, proceedsExpected)) {
|
|
67
|
+
// initial collateral suffices
|
|
68
|
+
return [proceedsBidded, initialCollateralTarget];
|
|
69
|
+
} else {
|
|
70
|
+
return [proceedsBidded, targetByProceeds(proceedsBidded)];
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
|
|
74
|
+
assert(
|
|
75
|
+
AmountMath.isGTE(collateralAvailable, collateralTarget),
|
|
76
|
+
'target cannot exceed available',
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return { proceedsExpected, proceedsTarget, collateralTarget };
|
|
80
|
+
};
|
|
81
|
+
harden(amountsToSettle);
|
|
@@ -114,6 +114,7 @@ export type VaultFactoryPublicFacet = Awaited<ReturnType<(zcf: VaultFactoryZCF,
|
|
|
114
114
|
marshaller: ERef<Marshaller>;
|
|
115
115
|
auctioneerInstance: Instance;
|
|
116
116
|
managerParams: Record<string, import("../vaultFactory/params.js").VaultManagerParamOverrides>;
|
|
117
|
+
directorParamOverrides: [object];
|
|
117
118
|
}, baggage: import("@agoric/swingset-liveslots").Baggage) => Promise<{
|
|
118
119
|
creatorFacet: import("@endo/exo").Guarded<{
|
|
119
120
|
getParamMgrRetriever: () => {
|
|
@@ -355,6 +356,7 @@ export type EconomyBootstrapSpace = PromiseSpaceOf<{
|
|
|
355
356
|
marshaller: ERef<Marshaller>;
|
|
356
357
|
auctioneerInstance: Instance;
|
|
357
358
|
managerParams: Record<string, import("../vaultFactory/params.js").VaultManagerParamOverrides>;
|
|
359
|
+
directorParamOverrides: [object];
|
|
358
360
|
}, baggage: import("@agoric/swingset-liveslots").Baggage) => Promise<{
|
|
359
361
|
creatorFacet: import("@endo/exo").Guarded<{
|
|
360
362
|
getParamMgrRetriever: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"econ-behaviors.d.ts","sourceRoot":"","sources":["econ-behaviors.js"],"names":[],"mappings":"AAgBA,qCAAsC;AACtC,sCAA0C;AAC1C,qCAAsD;AACtD,sCAAqD;AAwE9C,mcADK,sBAAsB;;;;;;;;;;;;;;;;;;;;;;KA+FjC;AAUM,oDAPI,sBAAsB,CAAC,SAAS,CAAC,kDAEzC;IAAgC,cAAc;IACtB,OAAO;;;CAE/B,8BAAQ,MAAM,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EvB;AAUM,wSAPI,sBAAsB,UAE9B;IAAgC,cAAc;IACtB,OAAO;;;CAE/B,mBAAQ,MAAM,iBA6FhB;AAWM,wGALI,sBAAsB;;;;8BAuBhC;AAQM,mcAFI,sBAAsB,iBA0GhC;AAQM,+cAJI,sBAAsB,uBAE9B;IAAqB,aAAa,GAA1B,GAAG;CAAwB,iBA0HrC;sCAxmBa,OAAO,CAAC,UAAU;;;;;;;yCA2D2C,2BACpE
|
|
1
|
+
{"version":3,"file":"econ-behaviors.d.ts","sourceRoot":"","sources":["econ-behaviors.js"],"names":[],"mappings":"AAgBA,qCAAsC;AACtC,sCAA0C;AAC1C,qCAAsD;AACtD,sCAAqD;AAwE9C,mcADK,sBAAsB;;;;;;;;;;;;;;;;;;;;;;KA+FjC;AAUM,oDAPI,sBAAsB,CAAC,SAAS,CAAC,kDAEzC;IAAgC,cAAc;IACtB,OAAO;;;CAE/B,8BAAQ,MAAM,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EvB;AAUM,wSAPI,sBAAsB,UAE9B;IAAgC,cAAc;IACtB,OAAO;;;CAE/B,mBAAQ,MAAM,iBA6FhB;AAWM,wGALI,sBAAsB;;;;8BAuBhC;AAQM,mcAFI,sBAAsB,iBA0GhC;AAQM,+cAJI,sBAAsB,uBAE9B;IAAqB,aAAa,GAA1B,GAAG;CAAwB,iBA0HrC;sCAxmBa,OAAO,CAAC,UAAU;;;;;;;yCA2D2C,2BACpE;;mBAGW,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA/DL,CAAC,CAAC,aAAa,CAAC;;WAI3C,MAAM;SACN,QAAQ;iBACR,QAAQ;qBACR,OAAO,CACpB,UAAc,CACd,OAAa,CACb,UAAkB,CAAC,8BAAuB,CAAC,OAAO,CAAC,CAAC,CAC7C,CAAC,cAAc,CAAC,CAAC,wBAAwB,CAAC,CAC5C,CACF;6BACU,oBAAoB,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC;mBAC7D,UAAU;;4BAGV,kBAAkB,CAAC;yBA8f3B,cAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAyFy/N,yBAAgB;;;;;EAvlB/8N,CAAC;qCAG7D,eAAe,GAAG,mBAAmB,GAAG,qBAAqB;oCAG7D,cAAc,CAAC;IAC3B,oBAAwB,EAAE,oBAAoB,CAAC;IAC/C,6BAAiC,EAAE,OAAO,qCAAqC,EAAE,+BAA+B,CAAC;IACjH,iBAAqB,EAAE,mBACvB,cAAoB,sBAAsB,EAAE,KAAK,CAC5C,CAAC;IACN,qBAAyB,EAAE,QAAQ,CACnC,MAAY,EACZ,OAAa,sBAAsB,EAAE,oBAAoB,CACpD,CAAC;IACN,MAAU,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpC,qBAAyB,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,cAAkB,EAAE,sBAAsB,CAAC;IAC3C,UAAc,EAAE,kBAAkB,CAClC,2CAA0C,CAAC,OAAO,CAAC,CAC9C,CAAC;IACN,eAAmB,EAAE,kBAAkB;;;;;;;6CAmBmC,2BACpE;;uBAGW,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAvBG,CAAC;IACjD,aAAiB,EAAE,aAAa,CAAC;IACjC,gBAAoB,EAAE,aAAa,GAAG,SAAS,CAAC;IAChD,cAAkB,EAAE,QAAQ,CAAC;CAC1B,CAAC;qCAIQ,mBACZ,2CAAwC,CAAC,OAAO,CAAC,CAC9C;mCAGS,mBACZ,oDAAiD,CAAC,OAAO,CAAC,CACvD;uBAtEmB,gCAAgC;wCAKjB,qCAAqC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-vaults.d.ts","sourceRoot":"","sources":["upgrade-vaults.js"],"names":[],"mappings":"AAoCO,sCAHI,OAAO,oCAAoC,EAAE,sBAAsB,eACnE;IAAE,OAAO,EAAE;QAAE,SAAS,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"upgrade-vaults.d.ts","sourceRoot":"","sources":["upgrade-vaults.js"],"names":[],"mappings":"AAoCO,sCAHI,OAAO,oCAAoC,EAAE,sBAAsB,eACnE;IAAE,OAAO,EAAE;QAAE,SAAS,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,iBA6M1D;AASM,kDAHI,MAAM,uBACN,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GAuBZ"}
|
|
@@ -85,6 +85,32 @@ export const upgradeVaults = async (powers, { options }) => {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
const readCurrentDirectorParams = async () => {
|
|
89
|
+
const { publicFacet: directorPF } = kit;
|
|
90
|
+
|
|
91
|
+
await null;
|
|
92
|
+
|
|
93
|
+
const subscription = E(directorPF).getElectorateSubscription();
|
|
94
|
+
const notifier = makeNotifierFromAsyncIterable(subscription);
|
|
95
|
+
let { value, updateCount } = await notifier.getUpdateSince(0n);
|
|
96
|
+
// @ts-expect-error It's an amount.
|
|
97
|
+
while (AmountMath.isEmpty(value.current.MinInitialDebt.value)) {
|
|
98
|
+
({ value, updateCount } = await notifier.getUpdateSince(updateCount));
|
|
99
|
+
trace(
|
|
100
|
+
`minInitialDebt was empty, retried`,
|
|
101
|
+
value.current.MinInitialDebt.value,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return harden({
|
|
106
|
+
MinInitialDebt: value.current.MinInitialDebt.value,
|
|
107
|
+
ReferencedUI: value.current.ReferencedUI.value,
|
|
108
|
+
RecordingPeriod: value.current.RecordingPeriod.value,
|
|
109
|
+
ChargingPeriod: value.current.ChargingPeriod.value,
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const directorParamOverrides = await readCurrentDirectorParams();
|
|
113
|
+
|
|
88
114
|
const readManagerParams = async () => {
|
|
89
115
|
const { publicFacet: directorPF } = kit;
|
|
90
116
|
|
|
@@ -99,9 +125,17 @@ export const upgradeVaults = async (powers, { options }) => {
|
|
|
99
125
|
const notifier = makeNotifierFromAsyncIterable(subscription);
|
|
100
126
|
let { value, updateCount } = await notifier.getUpdateSince(0n);
|
|
101
127
|
// @ts-expect-error It's an amount.
|
|
102
|
-
|
|
128
|
+
if (AmountMath.isEmpty(value.current.DebtLimit.value)) {
|
|
129
|
+
// The parameters might have been empty at start, and the notifier might
|
|
130
|
+
// give the first state before the current state.
|
|
131
|
+
trace(`debtLimit was empty, retrying`, value.current.DebtLimit.value);
|
|
103
132
|
({ value, updateCount } = await notifier.getUpdateSince(updateCount));
|
|
104
|
-
|
|
133
|
+
|
|
134
|
+
// @ts-expect-error It's an amount.
|
|
135
|
+
if (AmountMath.isEmpty(value.current.DebtLimit.value)) {
|
|
136
|
+
trace('debtLimit was empty after retrying');
|
|
137
|
+
throw Error('🚨Governed parameters empty after retry, Giving up');
|
|
138
|
+
}
|
|
105
139
|
}
|
|
106
140
|
trace(kwd, 'params at', updateCount, 'are', value.current);
|
|
107
141
|
params[kwd] = harden({
|
|
@@ -138,6 +172,7 @@ export const upgradeVaults = async (powers, { options }) => {
|
|
|
138
172
|
initialPoserInvitation: poserInvitation,
|
|
139
173
|
initialShortfallInvitation: shortfallInvitation,
|
|
140
174
|
managerParams: managerParamValues,
|
|
175
|
+
directorParamOverrides,
|
|
141
176
|
});
|
|
142
177
|
|
|
143
178
|
const upgradeResult = await E(kit.adminFacet).upgradeContract(
|
|
@@ -17,6 +17,7 @@ export function start(zcf: VaultFactoryZCF, privateArgs: {
|
|
|
17
17
|
marshaller: ERef<Marshaller>;
|
|
18
18
|
auctioneerInstance: Instance;
|
|
19
19
|
managerParams: Record<string, import("./params.js").VaultManagerParamOverrides>;
|
|
20
|
+
directorParamOverrides: [object];
|
|
20
21
|
}, baggage: import("@agoric/swingset-liveslots").Baggage): Promise<{
|
|
21
22
|
creatorFacet: import("@endo/exo").Guarded<{
|
|
22
23
|
getParamMgrRetriever: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaultFactory.d.ts","sourceRoot":"","sources":["vaultFactory.js"],"names":[],"mappings":"AAmCA;;;;;;;;GAQG;AAEH,2BAA2B;AAC3B,mBADW,YAAY,CAerB;
|
|
1
|
+
{"version":3,"file":"vaultFactory.d.ts","sourceRoot":"","sources":["vaultFactory.js"],"names":[],"mappings":"AAmCA;;;;;;;;GAQG;AAEH,2BAA2B;AAC3B,mBADW,YAAY,CAerB;AAoBK,2BAhBI,eAAe,eACf;IACV,aAAiB,EAAE,aAAa,CAAC;IACjC,sBAA0B,EAAE,UAAU,CAAC;IACvC,0BAA8B,EAAE,UAAU,CAAC;IAC3C,WAAe,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,UAAc,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACjC,kBAAsB,EAAE,QAAQ,CAAC;IACjC,aAAiB,EAAE,MAAM,CACzB,MAAY,EACZ,OAAa,aAAa,EAAE,0BAA0B,CACjD,CAAC;IACN,sBAA0B,EAAE,CAAC,MAAM,CAAC,CAAC;CAClC,WACO,OAAO,4BAA4B,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFtD;8BAhIY,GAAG,CACf,eAAmB,CAAC,OAAO,UAAU,EAAE,mBAAmB,CAAC,GAAG;IAC9D,cAAoB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3C,kBAAwB,EAAE,uBAAuB,CAAC;IAClD,YAAkB,EAAE,OAAO,cAAc,EAAE,YAAY,CAAC;CACnD,CACF;mCA6HU,UAAU,CAAC,OAAO,KAAK,CAAC;gCAxIwD,4BAA4B;oCAA5B,4BAA4B"}
|
|
@@ -74,6 +74,7 @@ harden(meta);
|
|
|
74
74
|
* string,
|
|
75
75
|
* import('./params.js').VaultManagerParamOverrides
|
|
76
76
|
* >;
|
|
77
|
+
* directorParamOverrides: [object];
|
|
77
78
|
* }} privateArgs
|
|
78
79
|
* @param {import('@agoric/swingset-liveslots').Baggage} baggage
|
|
79
80
|
*/
|
|
@@ -86,6 +87,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
86
87
|
storageNode,
|
|
87
88
|
auctioneerInstance,
|
|
88
89
|
managerParams,
|
|
90
|
+
directorParamOverrides,
|
|
89
91
|
} = privateArgs;
|
|
90
92
|
|
|
91
93
|
trace('awaiting debtMint');
|
|
@@ -117,7 +119,6 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
117
119
|
marshaller,
|
|
118
120
|
);
|
|
119
121
|
/** a powerful object; can modify the invitation */
|
|
120
|
-
trace('awaiting makeParamManagerFromTerms');
|
|
121
122
|
const vaultDirectorParamManager = await makeParamManagerFromTerms(
|
|
122
123
|
{
|
|
123
124
|
publisher: governanceSubscriptionKit.publication,
|
|
@@ -129,6 +130,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
129
130
|
[SHORTFALL_INVITATION_KEY]: initialShortfallInvitation,
|
|
130
131
|
},
|
|
131
132
|
vaultDirectorParamTypes,
|
|
133
|
+
directorParamOverrides,
|
|
132
134
|
);
|
|
133
135
|
|
|
134
136
|
const director = provideDirector(
|