@agoric/inter-protocol 0.16.2-dev-a0c5f45.0 → 0.16.2-dev-3e909dc.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
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-3e909dc.0+3e909dc",
|
|
4
4
|
"description": "Core cryptoeconomy contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -31,28 +31,29 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@agoric/assert": "0.6.1-dev-
|
|
35
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
36
|
-
"@agoric/governance": "0.10.4-dev-
|
|
37
|
-
"@agoric/internal": "0.3.3-dev-
|
|
38
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
39
|
-
"@agoric/store": "0.9.3-dev-
|
|
40
|
-
"@agoric/time": "0.3.3-dev-
|
|
41
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
42
|
-
"@agoric/vats": "0.15.2-dev-
|
|
43
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
34
|
+
"@agoric/assert": "0.6.1-dev-3e909dc.0+3e909dc",
|
|
35
|
+
"@agoric/ertp": "0.16.3-dev-3e909dc.0+3e909dc",
|
|
36
|
+
"@agoric/governance": "0.10.4-dev-3e909dc.0+3e909dc",
|
|
37
|
+
"@agoric/internal": "0.3.3-dev-3e909dc.0+3e909dc",
|
|
38
|
+
"@agoric/notifier": "0.6.3-dev-3e909dc.0+3e909dc",
|
|
39
|
+
"@agoric/store": "0.9.3-dev-3e909dc.0+3e909dc",
|
|
40
|
+
"@agoric/time": "0.3.3-dev-3e909dc.0+3e909dc",
|
|
41
|
+
"@agoric/vat-data": "0.5.3-dev-3e909dc.0+3e909dc",
|
|
42
|
+
"@agoric/vats": "0.15.2-dev-3e909dc.0+3e909dc",
|
|
43
|
+
"@agoric/zoe": "0.26.3-dev-3e909dc.0+3e909dc",
|
|
44
44
|
"@endo/captp": "^3.1.4",
|
|
45
45
|
"@endo/eventual-send": "^0.17.5",
|
|
46
46
|
"@endo/far": "^0.2.21",
|
|
47
47
|
"@endo/marshal": "^0.8.8",
|
|
48
48
|
"@endo/nat": "^4.1.30",
|
|
49
|
+
"@endo/promise-kit": "^0.2.59",
|
|
49
50
|
"jessie.js": "^0.3.2"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
53
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
54
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
55
|
-
"@agoric/zone": "0.2.3-dev-
|
|
53
|
+
"@agoric/smart-wallet": "0.5.4-dev-3e909dc.0+3e909dc",
|
|
54
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-3e909dc.0+3e909dc",
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-dev-3e909dc.0+3e909dc",
|
|
56
|
+
"@agoric/zone": "0.2.3-dev-3e909dc.0+3e909dc",
|
|
56
57
|
"@endo/bundle-source": "^2.7.0",
|
|
57
58
|
"@endo/init": "^0.5.59",
|
|
58
59
|
"@endo/promise-kit": "^0.2.59",
|
|
@@ -84,5 +85,5 @@
|
|
|
84
85
|
"typeCoverage": {
|
|
85
86
|
"atLeast": 93.45
|
|
86
87
|
},
|
|
87
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "3e909dcf51841f5c062c6f31bc89cacae18394ff"
|
|
88
89
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./startPSM.js";
|
|
2
|
-
export function publishInterchainAssetFromBoardId({ consume: { board, agoricNamesAdmin } }:
|
|
2
|
+
export function publishInterchainAssetFromBoardId({ consume: { board, agoricNamesAdmin } }: BootstrapPowers, { options: { interchainAssetOptions } }: {
|
|
3
3
|
options: {
|
|
4
4
|
interchainAssetOptions: InterchainAssetOptions;
|
|
5
5
|
};
|
|
@@ -14,7 +14,7 @@ export function registerScaledPriceAuthority({ consume: { agoricNamesAdmin, star
|
|
|
14
14
|
interchainAssetOptions: InterchainAssetOptions;
|
|
15
15
|
};
|
|
16
16
|
}): Promise<void>;
|
|
17
|
-
export function addAssetToVault({ consume: { vaultFactoryKit, agoricNamesAdmin, auctioneerKit }, brand: { consume: { [Stable.symbol]: stableP }, }, instance: { consume: consumeInstance }, }: EconomyBootstrapPowers, { options: { debtLimitValue, interestRateValue, interchainAssetOptions, }, }: {
|
|
17
|
+
export function addAssetToVault({ consume: { vaultFactoryKit, agoricNamesAdmin, auctioneerKit, chainTimerService, }, brand: { consume: { [Stable.symbol]: stableP }, }, instance: { consume: consumeInstance }, }: EconomyBootstrapPowers, { options: { debtLimitValue, interestRateValue, interchainAssetOptions, }, }: {
|
|
18
18
|
options: {
|
|
19
19
|
interchainAssetOptions: InterchainAssetOptions;
|
|
20
20
|
debtLimitValue: bigint | number | string;
|
|
@@ -41,6 +41,7 @@ export function getManifestForAddAssetToVault({ restoreRef }: {
|
|
|
41
41
|
priceAuthority?: undefined;
|
|
42
42
|
auctioneerKit?: undefined;
|
|
43
43
|
vaultFactoryKit?: undefined;
|
|
44
|
+
chainTimerService?: undefined;
|
|
44
45
|
};
|
|
45
46
|
produce?: undefined;
|
|
46
47
|
installation?: undefined;
|
|
@@ -57,6 +58,7 @@ export function getManifestForAddAssetToVault({ restoreRef }: {
|
|
|
57
58
|
priceAuthority?: undefined;
|
|
58
59
|
auctioneerKit?: undefined;
|
|
59
60
|
vaultFactoryKit?: undefined;
|
|
61
|
+
chainTimerService?: undefined;
|
|
60
62
|
};
|
|
61
63
|
produce: {
|
|
62
64
|
bankMints: boolean;
|
|
@@ -82,6 +84,7 @@ export function getManifestForAddAssetToVault({ restoreRef }: {
|
|
|
82
84
|
reserveKit?: undefined;
|
|
83
85
|
auctioneerKit?: undefined;
|
|
84
86
|
vaultFactoryKit?: undefined;
|
|
87
|
+
chainTimerService?: undefined;
|
|
85
88
|
};
|
|
86
89
|
produce: {
|
|
87
90
|
scaledPriceAuthorityKits: boolean;
|
|
@@ -101,6 +104,7 @@ export function getManifestForAddAssetToVault({ restoreRef }: {
|
|
|
101
104
|
auctioneerKit: string;
|
|
102
105
|
vaultFactoryKit: string;
|
|
103
106
|
agoricNamesAdmin: boolean;
|
|
107
|
+
chainTimerService: boolean;
|
|
104
108
|
board?: undefined;
|
|
105
109
|
bankManager?: undefined;
|
|
106
110
|
reserveKit?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAssetToVault.d.ts","sourceRoot":"","sources":["addAssetToVault.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"addAssetToVault.d.ts","sourceRoot":"","sources":["addAssetToVault.js"],"names":[],"mappings":";AA0CO,4FALI,eAAe;IAEA,OAAO;QACiB,sBAAsB,EAA7D,sBAAsB;;0BAuBhC;AAQM,yKALI,sBAAsB;IAEP,OAAO;QACiB,sBAAsB,EAA7D,sBAAsB;;kBAoDhC;AAQM,wIALI,eAAe;IAEA,OAAO;QACiB,sBAAsB,EAA7D,sBAAsB;;kBAmGhC;AA+EM,mNAPI,sBAAsB;IAEP,OAAO;QACiB,sBAAsB,EAA7D,sBAAsB;QACmB,cAAc,EAAvD,MAAM,GAAG,MAAM,GAAG,MAAM;QACD,iBAAiB,EAAxC,MAAM;;kBAwEhB;AAEM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8EN;;;;;;;;aA7aa,MAAM;;;;;;;;;;;;;;;;qCAQN,OAAO,qBAAqB,EAAE,sBAAsB;uBAxB3C,gCAAgC"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
|
+
// @ts-check
|
|
2
3
|
|
|
4
|
+
import { ToFarFunction } from '@endo/captp';
|
|
5
|
+
import { Far } from '@endo/marshal';
|
|
3
6
|
import { AmountMath, AssetKind } from '@agoric/ertp';
|
|
4
7
|
import { deeplyFulfilledObject } from '@agoric/internal';
|
|
5
8
|
import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js';
|
|
6
9
|
import { parseRatio } from '@agoric/zoe/src/contractSupport/ratio.js';
|
|
7
10
|
import { E } from '@endo/far';
|
|
8
11
|
import { Stable } from '@agoric/internal/src/tokens.js';
|
|
12
|
+
import { TimeMath } from '@agoric/time/src/timeMath.js';
|
|
13
|
+
import { makePromiseKit } from '@endo/promise-kit';
|
|
14
|
+
|
|
9
15
|
import { instanceNameFor } from './price-feed-proposal.js';
|
|
10
16
|
import { reserveThenGetNames } from './utils.js';
|
|
11
17
|
|
|
12
18
|
export * from './startPSM.js';
|
|
13
19
|
|
|
20
|
+
const { quote: q } = assert;
|
|
21
|
+
|
|
14
22
|
/**
|
|
15
23
|
* @typedef {object} InterchainAssetOptions
|
|
16
24
|
* @property {string} [issuerBoardId]
|
|
@@ -24,8 +32,10 @@ export * from './startPSM.js';
|
|
|
24
32
|
* @property {number} [initialPrice]
|
|
25
33
|
*/
|
|
26
34
|
|
|
35
|
+
/** @typedef {import('./econ-behaviors.js').EconomyBootstrapPowers} EconomyBootstrapPowers */
|
|
36
|
+
|
|
27
37
|
/**
|
|
28
|
-
* @param {
|
|
38
|
+
* @param {BootstrapPowers} powers
|
|
29
39
|
* @param {object} config
|
|
30
40
|
* @param {object} config.options
|
|
31
41
|
* @param {InterchainAssetOptions} config.options.interchainAssetOptions
|
|
@@ -216,7 +226,74 @@ export const registerScaledPriceAuthority = async (
|
|
|
216
226
|
);
|
|
217
227
|
};
|
|
218
228
|
|
|
219
|
-
|
|
229
|
+
// wait a short while after end to allow things to settle
|
|
230
|
+
const BUFFER = 5n * 60n;
|
|
231
|
+
// let's insist on 20 minutes leeway for running the scripts
|
|
232
|
+
const COMPLETION = 20n * 60n;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* This function works around an issue identified in #8307 and #8296, and fixed
|
|
236
|
+
* in #8301. The fix is needed until #8301 makes it into production.
|
|
237
|
+
*
|
|
238
|
+
* If there is a liveSchedule, 1) run now if start is far enough away,
|
|
239
|
+
* otherwise, 2) run after endTime. If neither liveSchedule nor nextSchedule is
|
|
240
|
+
* defined, 3) run now. If there is only a nextSchedule, 4) run now if startTime
|
|
241
|
+
* is far enough away, else 5) run after endTime
|
|
242
|
+
*
|
|
243
|
+
* @param {import('../auction/scheduler.js').FullSchedule} schedules
|
|
244
|
+
* @param {ERef<import('@agoric/time/src/types').TimerService>} timer
|
|
245
|
+
* @param {() => void} thunk
|
|
246
|
+
*/
|
|
247
|
+
const whenQuiescent = async (schedules, timer, thunk) => {
|
|
248
|
+
const { nextAuctionSchedule, liveAuctionSchedule } = schedules;
|
|
249
|
+
const now = await E(timer).getCurrentTimestamp();
|
|
250
|
+
|
|
251
|
+
const waker = Far('addAssetWaker', { wake: () => thunk() });
|
|
252
|
+
|
|
253
|
+
if (liveAuctionSchedule) {
|
|
254
|
+
const safeStart = TimeMath.subtractAbsRel(
|
|
255
|
+
liveAuctionSchedule.startTime,
|
|
256
|
+
COMPLETION,
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
if (TimeMath.compareAbs(safeStart, now) < 0) {
|
|
260
|
+
// case 2
|
|
261
|
+
console.warn(
|
|
262
|
+
`Add Asset after live schedule's endtime: ${q(
|
|
263
|
+
liveAuctionSchedule.endTime,
|
|
264
|
+
)}`,
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
return E(timer).setWakeup(
|
|
268
|
+
TimeMath.addAbsRel(liveAuctionSchedule.endTime, BUFFER),
|
|
269
|
+
waker,
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (!liveAuctionSchedule && nextAuctionSchedule) {
|
|
275
|
+
const safeStart = TimeMath.subtractAbsRel(
|
|
276
|
+
nextAuctionSchedule.startTime,
|
|
277
|
+
COMPLETION,
|
|
278
|
+
);
|
|
279
|
+
if (TimeMath.compareAbs(safeStart, now) < 0) {
|
|
280
|
+
// case 5
|
|
281
|
+
console.warn(
|
|
282
|
+
`Add Asset after next schedule's endtime: ${q(
|
|
283
|
+
nextAuctionSchedule.endTime,
|
|
284
|
+
)}`,
|
|
285
|
+
);
|
|
286
|
+
return E(timer).setWakeup(
|
|
287
|
+
TimeMath.addAbsRel(nextAuctionSchedule.endTime, BUFFER),
|
|
288
|
+
waker,
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// cases 1, 3, and 4 fall through to here.
|
|
294
|
+
console.warn(`Add Asset immediately`, thunk);
|
|
295
|
+
return thunk();
|
|
296
|
+
};
|
|
220
297
|
|
|
221
298
|
/**
|
|
222
299
|
* @param {EconomyBootstrapPowers} powers
|
|
@@ -228,7 +305,12 @@ export const registerScaledPriceAuthority = async (
|
|
|
228
305
|
*/
|
|
229
306
|
export const addAssetToVault = async (
|
|
230
307
|
{
|
|
231
|
-
consume: {
|
|
308
|
+
consume: {
|
|
309
|
+
vaultFactoryKit,
|
|
310
|
+
agoricNamesAdmin,
|
|
311
|
+
auctioneerKit,
|
|
312
|
+
chainTimerService,
|
|
313
|
+
},
|
|
232
314
|
brand: {
|
|
233
315
|
consume: { [Stable.symbol]: stableP },
|
|
234
316
|
},
|
|
@@ -263,6 +345,20 @@ export const addAssetToVault = async (
|
|
|
263
345
|
// eslint-disable-next-line no-restricted-syntax -- allow this computed property
|
|
264
346
|
await consumeInstance[oracleInstanceName];
|
|
265
347
|
|
|
348
|
+
const auctioneerCreator = E.get(auctioneerKit).creatorFacet;
|
|
349
|
+
const schedules = await E(auctioneerCreator).getSchedule();
|
|
350
|
+
|
|
351
|
+
const finishPromiseKit = makePromiseKit();
|
|
352
|
+
const addBrandThenResolve = ToFarFunction('addBrandThenResolve', async () => {
|
|
353
|
+
await E(auctioneerCreator).addBrand(interchainIssuer, keyword);
|
|
354
|
+
finishPromiseKit.resolve(undefined);
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// schedules actions on a timer (or does it immediately).
|
|
358
|
+
// finishPromiseKit signals completion.
|
|
359
|
+
void whenQuiescent(schedules, chainTimerService, addBrandThenResolve);
|
|
360
|
+
await finishPromiseKit.promise;
|
|
361
|
+
|
|
266
362
|
const stable = await stableP;
|
|
267
363
|
const vaultFactoryCreator = E.get(vaultFactoryKit).creatorFacet;
|
|
268
364
|
await E(vaultFactoryCreator).addVaultType(interchainIssuer, keyword, {
|
|
@@ -277,8 +373,6 @@ export const addAssetToVault = async (
|
|
|
277
373
|
mintFee: makeRatio(50n, stable, 10_000n),
|
|
278
374
|
liquidationPenalty: makeRatio(1n, stable),
|
|
279
375
|
});
|
|
280
|
-
const auctioneerCreator = E.get(auctioneerKit).creatorFacet;
|
|
281
|
-
await E(auctioneerCreator).addBrand(interchainIssuer, keyword);
|
|
282
376
|
};
|
|
283
377
|
|
|
284
378
|
export const getManifestForAddAssetToVault = (
|
|
@@ -338,6 +432,7 @@ export const getManifestForAddAssetToVault = (
|
|
|
338
432
|
auctioneerKit: 'auctioneer',
|
|
339
433
|
vaultFactoryKit: 'vaultFactory',
|
|
340
434
|
agoricNamesAdmin: true,
|
|
435
|
+
chainTimerService: true,
|
|
341
436
|
},
|
|
342
437
|
brand: {
|
|
343
438
|
consume: { [Stable.symbol]: true },
|