@agoric/inter-protocol 0.16.2-dev-75cc4e2.0 → 0.16.2-dev-fc1eb01.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-75cc4e2.0+75cc4e2",
3
+ "version": "0.16.2-dev-fc1eb01.0+fc1eb01",
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-75cc4e2.0+75cc4e2",
35
- "@agoric/governance": "0.10.4-dev-75cc4e2.0+75cc4e2",
36
- "@agoric/internal": "0.3.3-dev-75cc4e2.0+75cc4e2",
37
- "@agoric/notifier": "0.6.3-dev-75cc4e2.0+75cc4e2",
38
- "@agoric/store": "0.9.3-dev-75cc4e2.0+75cc4e2",
39
- "@agoric/time": "0.3.3-dev-75cc4e2.0+75cc4e2",
40
- "@agoric/vat-data": "0.5.3-dev-75cc4e2.0+75cc4e2",
41
- "@agoric/vats": "0.15.2-dev-75cc4e2.0+75cc4e2",
42
- "@agoric/zoe": "0.26.3-dev-75cc4e2.0+75cc4e2",
34
+ "@agoric/ertp": "0.16.3-dev-fc1eb01.0+fc1eb01",
35
+ "@agoric/governance": "0.10.4-dev-fc1eb01.0+fc1eb01",
36
+ "@agoric/internal": "0.3.3-dev-fc1eb01.0+fc1eb01",
37
+ "@agoric/notifier": "0.6.3-dev-fc1eb01.0+fc1eb01",
38
+ "@agoric/store": "0.9.3-dev-fc1eb01.0+fc1eb01",
39
+ "@agoric/time": "0.3.3-dev-fc1eb01.0+fc1eb01",
40
+ "@agoric/vat-data": "0.5.3-dev-fc1eb01.0+fc1eb01",
41
+ "@agoric/vats": "0.15.2-dev-fc1eb01.0+fc1eb01",
42
+ "@agoric/zoe": "0.26.3-dev-fc1eb01.0+fc1eb01",
43
43
  "@endo/captp": "^4.3.0",
44
44
  "@endo/errors": "^1.2.5",
45
45
  "@endo/eventual-send": "^1.2.5",
@@ -50,10 +50,10 @@
50
50
  "jessie.js": "^0.3.4"
51
51
  },
52
52
  "devDependencies": {
53
- "@agoric/smart-wallet": "0.5.4-dev-75cc4e2.0+75cc4e2",
54
- "@agoric/swingset-liveslots": "0.10.3-dev-75cc4e2.0+75cc4e2",
55
- "@agoric/swingset-vat": "0.32.3-dev-75cc4e2.0+75cc4e2",
56
- "@agoric/zone": "0.2.3-dev-75cc4e2.0+75cc4e2",
53
+ "@agoric/smart-wallet": "0.5.4-dev-fc1eb01.0+fc1eb01",
54
+ "@agoric/swingset-liveslots": "0.10.3-dev-fc1eb01.0+fc1eb01",
55
+ "@agoric/swingset-vat": "0.32.3-dev-fc1eb01.0+fc1eb01",
56
+ "@agoric/zone": "0.2.3-dev-fc1eb01.0+fc1eb01",
57
57
  "@endo/bundle-source": "^3.4.0",
58
58
  "@endo/init": "^1.1.4",
59
59
  "@endo/promise-kit": "^1.1.5",
@@ -84,5 +84,5 @@
84
84
  "typeCoverage": {
85
85
  "atLeast": 95.8
86
86
  },
87
- "gitHead": "75cc4e26530875f8d625722f3bd372dca656fa38"
87
+ "gitHead": "fc1eb016be5b8e66a8e7f228ce5c4b0611d47ea8"
88
88
  }
@@ -23,17 +23,21 @@ export function getManifestForReplaceAllElectorates({ economicCommitteeRef: _eco
23
23
  startUpgradable: boolean;
24
24
  };
25
25
  produce: {
26
+ econCharterKit: boolean;
26
27
  economicCommitteeKit: boolean;
27
- economicCommitteeCreatorFacet: string;
28
+ economicCommitteeCreatorFacet: boolean;
28
29
  };
29
30
  installation: {
30
31
  consume: {
31
- committee: string;
32
+ committee: boolean;
33
+ binaryVoteCounter: boolean;
34
+ econCommitteeCharter: boolean;
32
35
  };
33
36
  };
34
37
  instance: {
35
38
  produce: {
36
- economicCommittee: string;
39
+ economicCommittee: boolean;
40
+ econCommitteeCharter: boolean;
37
41
  };
38
42
  };
39
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"replaceElectorate.d.ts","sourceRoot":"","sources":["replaceElectorate.js"],"names":[],"mappings":"AAqPO,uDAlBI,sBAAsB,UAGtB;IACN,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACvC,yBAAyB,EAAE;YACzB,cAAc,EAAE,MAAM,EAAE,CAAC;YACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;SAC7B,CAAC;KACH,CAAC;CACH,GAGS,OAAO,CAAC,IAAI,CAAC,CA4DzB;AAIM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BL;4CA5TwC,qBAAqB"}
1
+ {"version":3,"file":"replaceElectorate.d.ts","sourceRoot":"","sources":["replaceElectorate.js"],"names":[],"mappings":"AAgXO,uDAlBI,sBAAsB,UAGtB;IACN,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACvC,yBAAyB,EAAE;YACzB,cAAc,EAAE,MAAM,EAAE,CAAC;YACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;SAC7B,CAAC;KACH,CAAC;CACH,GAGS,OAAO,CAAC,IAAI,CAAC,CAuEzB;AAIM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCL;4CA1cwC,qBAAqB"}
@@ -18,6 +18,7 @@ import {
18
18
  import { reserveThenDeposit } from './utils.js';
19
19
 
20
20
  /** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */
21
+ /** @import {EconCharterStartResult} from './econ-behaviors.js' */
21
22
  /** @import {CommitteeElectorateCreatorFacet} from '@agoric/governance/src/committee.js'; */
22
23
 
23
24
  const trace = (...args) => console.log('GovReplaceCommiteeAndCharter', ...args);
@@ -137,6 +138,45 @@ const inviteECMembers = async (
137
138
  await distributeInvitations(zip(values(voterAddresses), invitations));
138
139
  };
139
140
 
141
+ /**
142
+ * Invites members to the Economic Charter by creating and distributing charter
143
+ * member invitations to the specified voter addresses.
144
+ *
145
+ * @param {EconomyBootstrapPowers} powers - The bootstrap powers required for
146
+ * economic operations, including `namesByAddressAdmin` used for managing
147
+ * names and deposits.
148
+ * @param {{
149
+ * options: {
150
+ * voterAddresses: Record<string, string>;
151
+ * econCharterKit: {
152
+ * creatorFacet: {
153
+ * makeCharterMemberInvitation: () => Promise<Invitation>;
154
+ * };
155
+ * };
156
+ * };
157
+ * }} opts
158
+ * - The configuration object containing voter addresses and the econ charter kit
159
+ * for creating charter member invitations.
160
+ *
161
+ * @returns {Promise<void>} This function does not explicitly return a value. It
162
+ * processes all charter member invitations asynchronously.
163
+ */
164
+ const inviteToEconCharter = async (
165
+ { consume: { namesByAddressAdmin } },
166
+ { options: { voterAddresses, econCharterKit } },
167
+ ) => {
168
+ const { creatorFacet } = E.get(econCharterKit);
169
+
170
+ void Promise.all(
171
+ values(voterAddresses).map(async addr => {
172
+ const debugName = `econ charter member ${addr}`;
173
+ reserveThenDeposit(debugName, namesByAddressAdmin, addr, [
174
+ E(creatorFacet).makeCharterMemberInvitation(),
175
+ ]).catch(err => console.error(`failed deposit to ${debugName}`, err));
176
+ }),
177
+ );
178
+ };
179
+
140
180
  /**
141
181
  * Starts a new Economic Committee (EC) by creating an instance with the
142
182
  * provided committee specifications.
@@ -206,7 +246,6 @@ const startNewEconomicCommittee = async (
206
246
  const { instance, creatorFacet } = startResult;
207
247
 
208
248
  trace('Started new EC Committee Instance Successfully');
209
-
210
249
  economicCommitteeKit.reset();
211
250
  economicCommitteeKit.resolve(
212
251
  harden({ ...startResult, label: 'economicCommittee' }),
@@ -221,6 +260,90 @@ const startNewEconomicCommittee = async (
221
260
  return creatorFacet;
222
261
  };
223
262
 
263
+ /**
264
+ * Starts a new Economic Committee Charter by creating an instance with the
265
+ * provided committee specifications.
266
+ *
267
+ * @param {EconomyBootstrapPowers} powers - The resources and capabilities
268
+ * required to start the committee.
269
+ * @returns {Promise<EconCharterStartResult>} A promise that resolves to the
270
+ * charter kit result.
271
+ */
272
+ const startNewEconCharter = async ({
273
+ consume: { startUpgradable },
274
+ produce: { econCharterKit },
275
+ installation: {
276
+ consume: { binaryVoteCounter: counterP, econCommitteeCharter: installP },
277
+ },
278
+ instance: {
279
+ produce: { econCommitteeCharter },
280
+ },
281
+ }) => {
282
+ const [charterInstall, counterInstall] = await Promise.all([
283
+ installP,
284
+ counterP,
285
+ ]);
286
+ const terms = await harden({
287
+ binaryVoteCounterInstallation: counterInstall,
288
+ });
289
+
290
+ trace('Starting new EC Charter Instance');
291
+
292
+ const startResult = await E(startUpgradable)({
293
+ label: 'econCommitteeCharter',
294
+ installation: charterInstall,
295
+ terms,
296
+ });
297
+
298
+ trace('Started new EC Charter Instance Successfully');
299
+
300
+ econCommitteeCharter.reset();
301
+ econCommitteeCharter.resolve(E.get(startResult).instance);
302
+
303
+ econCharterKit.reset();
304
+ econCharterKit.resolve(startResult);
305
+ return startResult;
306
+ };
307
+
308
+ /**
309
+ * Adds governors to an existing Economic Committee Charter
310
+ *
311
+ * - @param {EconomyBootstrapPowers} powers - The resources and capabilities
312
+ * required to start the committee.
313
+ *
314
+ * @param {{
315
+ * options: {
316
+ * econCharterKit: EconCharterStartResult;
317
+ * };
318
+ * }} config
319
+ * - Configuration object containing the name and size of the committee.
320
+ *
321
+ * @returns {Promise<void>} A promise that resolves once all the governors have
322
+ * been successfully added to the economic charter
323
+ */
324
+ const addGovernorsToEconCharter = async (
325
+ { consume: { psmKit, governedContractKits } },
326
+ { options: { econCharterKit } },
327
+ ) => {
328
+ const { creatorFacet: ecCreatorFacet } = E.get(econCharterKit);
329
+
330
+ const psmKitMap = await psmKit;
331
+
332
+ for (const { psm, psmGovernorCreatorFacet, label } of psmKitMap.values()) {
333
+ await E(ecCreatorFacet).addInstance(psm, psmGovernorCreatorFacet, label);
334
+ }
335
+
336
+ const governedContractKitMap = await governedContractKits;
337
+
338
+ for (const {
339
+ instance,
340
+ governorCreatorFacet,
341
+ label,
342
+ } of governedContractKitMap.values()) {
343
+ await E(ecCreatorFacet).addInstance(instance, governorCreatorFacet, label);
344
+ }
345
+ };
346
+
224
347
  /**
225
348
  * Replaces the electorate for governance contracts by creating a new Economic
226
349
  * Committee and updating contracts with the new electorate's creator facet.
@@ -300,6 +423,17 @@ export const replaceAllElectorates = async (permittedPowers, config) => {
300
423
  });
301
424
 
302
425
  trace('Installed New Economic Committee');
426
+
427
+ const econCharterKit = await startNewEconCharter(permittedPowers);
428
+ await addGovernorsToEconCharter(permittedPowers, {
429
+ options: { econCharterKit },
430
+ });
431
+
432
+ await inviteToEconCharter(permittedPowers, {
433
+ options: { voterAddresses, econCharterKit },
434
+ });
435
+
436
+ trace('Installed New EC Charter');
303
437
  };
304
438
 
305
439
  harden(replaceAllElectorates);
@@ -321,14 +455,22 @@ export const getManifestForReplaceAllElectorates = async (
321
455
  startUpgradable: true,
322
456
  },
323
457
  produce: {
458
+ econCharterKit: true,
324
459
  economicCommitteeKit: true,
325
- economicCommitteeCreatorFacet: 'economicCommittee',
460
+ economicCommitteeCreatorFacet: true,
326
461
  },
327
462
  installation: {
328
- consume: { committee: 'zoe' },
463
+ consume: {
464
+ committee: true,
465
+ binaryVoteCounter: true,
466
+ econCommitteeCharter: true,
467
+ },
329
468
  },
330
469
  instance: {
331
- produce: { economicCommittee: 'economicCommittee' },
470
+ produce: {
471
+ economicCommittee: true,
472
+ econCommitteeCharter: true,
473
+ },
332
474
  },
333
475
  },
334
476
  },