@agoric/inter-protocol 0.17.0-u17.0 → 0.17.0-u18.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 +26 -26
- package/src/auction/auctionBook.d.ts +2 -2
- package/src/auction/auctionBook.d.ts.map +1 -1
- package/src/auction/auctionBook.js +26 -33
- package/src/auction/auctionMath.d.ts +3 -3
- package/src/auction/auctioneer.d.ts +9 -9
- package/src/auction/auctioneer.d.ts.map +1 -1
- package/src/auction/offerBook.d.ts.map +1 -1
- package/src/auction/params.d.ts +2 -2
- package/src/auction/scheduler.d.ts +4 -3
- package/src/auction/scheduler.d.ts.map +1 -1
- package/src/auction/scheduler.js +1 -1
- package/src/auction/util.d.ts +6 -8
- package/src/auction/util.d.ts.map +1 -1
- package/src/auction/util.js +4 -3
- package/src/clientSupport.d.ts.map +1 -1
- package/src/econCommitteeCharter.d.ts +4 -3
- package/src/econCommitteeCharter.d.ts.map +1 -1
- package/src/econCommitteeCharter.js +1 -1
- package/src/feeDistributor.d.ts.map +1 -1
- package/src/interest.d.ts.map +1 -1
- package/src/price/fluxAggregatorContract.d.ts +2 -1
- package/src/price/fluxAggregatorContract.d.ts.map +1 -1
- package/src/price/fluxAggregatorContract.js +2 -0
- package/src/price/fluxAggregatorKit.d.ts +1 -1
- package/src/price/fluxAggregatorKit.d.ts.map +1 -1
- package/src/price/priceOracleKit.d.ts.map +1 -1
- package/src/price/roundsManager.d.ts +6 -6
- package/src/price/roundsManager.d.ts.map +1 -1
- package/src/price/roundsManager.js +53 -4
- package/src/proposals/add-auction.d.ts +24 -10
- package/src/proposals/add-auction.d.ts.map +1 -1
- package/src/proposals/add-auction.js +69 -38
- package/src/proposals/addAssetToVault.d.ts +14 -1
- package/src/proposals/addAssetToVault.d.ts.map +1 -1
- package/src/proposals/addAssetToVault.js +22 -3
- package/src/proposals/deploy-price-feeds.d.ts +76 -0
- package/src/proposals/deploy-price-feeds.d.ts.map +1 -0
- package/src/proposals/deploy-price-feeds.js +316 -0
- package/src/proposals/econ-behaviors.d.ts +27 -27
- package/src/proposals/econ-behaviors.d.ts.map +1 -1
- package/src/proposals/price-feed-proposal.d.ts.map +1 -1
- package/src/proposals/price-feed-proposal.js +2 -1
- package/src/proposals/replace-scaledPriceAuthorities.d.ts +30 -0
- package/src/proposals/replace-scaledPriceAuthorities.d.ts.map +1 -0
- package/src/proposals/replace-scaledPriceAuthorities.js +124 -0
- package/src/proposals/replaceElectorate.d.ts +55 -0
- package/src/proposals/replaceElectorate.d.ts.map +1 -0
- package/src/proposals/replaceElectorate.js +521 -0
- package/src/proposals/upgrade-vaults.d.ts +16 -14
- package/src/proposals/upgrade-vaults.d.ts.map +1 -1
- package/src/proposals/upgrade-vaults.js +75 -91
- package/src/proposals/utils.d.ts +4 -2
- package/src/proposals/utils.d.ts.map +1 -1
- package/src/proposals/utils.js +10 -2
- package/src/provisionPool.d.ts +4 -8
- package/src/provisionPool.d.ts.map +1 -1
- package/src/provisionPoolKit.d.ts +10 -18
- package/src/provisionPoolKit.d.ts.map +1 -1
- package/src/psm/psm.d.ts +2 -2
- package/src/psm/psm.d.ts.map +1 -1
- package/src/reserve/assetReserve.d.ts.map +1 -1
- package/src/reserve/assetReserveKit.d.ts +1 -1
- package/src/reserve/assetReserveKit.d.ts.map +1 -1
- package/src/vaultFactory/liquidation.d.ts.map +1 -1
- package/src/vaultFactory/math.d.ts +4 -4
- package/src/vaultFactory/orderedVaultStore.d.ts +8 -8
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -1
- package/src/vaultFactory/params.d.ts +6 -6
- package/src/vaultFactory/params.d.ts.map +1 -1
- package/src/vaultFactory/prioritizedVaults.d.ts +17 -17
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -1
- package/src/vaultFactory/proceeds.d.ts.map +1 -1
- package/src/vaultFactory/storeUtils.d.ts +2 -2
- package/src/vaultFactory/storeUtils.d.ts.map +1 -1
- package/src/vaultFactory/types-ambient.d.ts.map +1 -1
- package/src/vaultFactory/vault.d.ts +30 -19
- package/src/vaultFactory/vault.d.ts.map +1 -1
- package/src/vaultFactory/vault.js +6 -5
- package/src/vaultFactory/vaultDirector.d.ts +18 -18
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
- package/src/vaultFactory/vaultFactory.d.ts +7 -7
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
- package/src/vaultFactory/vaultHolder.d.ts +6 -6
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
- package/src/vaultFactory/vaultKit.d.ts +2 -2
- package/src/vaultFactory/vaultManager.d.ts +18 -18
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export function replaceAllElectorates(permittedPowers: EconomyBootstrapPowers & interlockPowers, config: {
|
|
2
|
+
options: {
|
|
3
|
+
committeeName: string;
|
|
4
|
+
voterAddresses: Record<string, string>;
|
|
5
|
+
highPrioritySendersConfig: {
|
|
6
|
+
addressesToAdd: string[];
|
|
7
|
+
addressesToRemove: string[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
export function getManifestForReplaceAllElectorates({ economicCommitteeRef: _economicCommitteeRef }: {
|
|
12
|
+
economicCommitteeRef: any;
|
|
13
|
+
}, options: any): Promise<{
|
|
14
|
+
manifest: {
|
|
15
|
+
[x: string]: {
|
|
16
|
+
consume: {
|
|
17
|
+
auctionUpgradeNewGovCreator: boolean;
|
|
18
|
+
auctionUpgradeNewInstance: boolean;
|
|
19
|
+
psmKit: boolean;
|
|
20
|
+
governedContractKits: boolean;
|
|
21
|
+
chainStorage: boolean;
|
|
22
|
+
highPrioritySendersManager: boolean;
|
|
23
|
+
namesByAddressAdmin: boolean;
|
|
24
|
+
board: boolean;
|
|
25
|
+
startUpgradable: boolean;
|
|
26
|
+
};
|
|
27
|
+
produce: {
|
|
28
|
+
econCharterKit: boolean;
|
|
29
|
+
economicCommitteeKit: boolean;
|
|
30
|
+
economicCommitteeCreatorFacet: boolean;
|
|
31
|
+
auctionUpgradeNewGovCreator: boolean;
|
|
32
|
+
};
|
|
33
|
+
installation: {
|
|
34
|
+
consume: {
|
|
35
|
+
committee: boolean;
|
|
36
|
+
binaryVoteCounter: boolean;
|
|
37
|
+
econCommitteeCharter: boolean;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
instance: {
|
|
41
|
+
produce: {
|
|
42
|
+
economicCommittee: boolean;
|
|
43
|
+
econCommitteeCharter: boolean;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
options: any;
|
|
49
|
+
}>;
|
|
50
|
+
export type interlockPowers = PromiseSpaceOf<{
|
|
51
|
+
auctionUpgradeNewInstance: Instance;
|
|
52
|
+
auctionUpgradeNewGovCreator: any;
|
|
53
|
+
}>;
|
|
54
|
+
import type { EconomyBootstrapPowers } from './econ-behaviors.js';
|
|
55
|
+
//# sourceMappingURL=replaceElectorate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceElectorate.d.ts","sourceRoot":"","sources":["replaceElectorate.js"],"names":[],"mappings":"AAwZO,uDAlBI,sBAAsB,GAAG,eAAe,UAGxC;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCL;8BApNW,cAAc,CAAC;IACvB,yBAAyB,EAAE,QAAQ,CAAC;IACpC,2BAA2B,EAAE,GAAG,CAAC;CAClC,CAAC;4CApSqC,qBAAqB"}
|
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file A proposal to replace the EC committee and charter.
|
|
3
|
+
*
|
|
4
|
+
* This script manages configuration updates, distributes invitations, and
|
|
5
|
+
* establishes committees using specified voter addresses and related
|
|
6
|
+
* parameters.
|
|
7
|
+
*
|
|
8
|
+
* See `@agoric/builders/scripts/inter-protocol/replace-electorate-core.js` for
|
|
9
|
+
* the proposal builder.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// @ts-check
|
|
13
|
+
import { E } from '@endo/eventual-send';
|
|
14
|
+
import {
|
|
15
|
+
assertPathSegment,
|
|
16
|
+
makeStorageNodeChild,
|
|
17
|
+
} from '@agoric/internal/src/lib-chainStorage.js';
|
|
18
|
+
import { reserveThenDeposit } from './utils.js';
|
|
19
|
+
|
|
20
|
+
/** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */
|
|
21
|
+
/** @import {EconCharterStartResult} from './econ-behaviors.js' */
|
|
22
|
+
/** @import {CommitteeElectorateCreatorFacet} from '@agoric/governance/src/committee.js'; */
|
|
23
|
+
|
|
24
|
+
const trace = (...args) => console.log('GovReplaceCommiteeAndCharter', ...args);
|
|
25
|
+
|
|
26
|
+
const traced = (label, x) => {
|
|
27
|
+
trace(label, x);
|
|
28
|
+
return x;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const { values } = Object;
|
|
32
|
+
|
|
33
|
+
/** @type {<X, Y>(xs: X[], ys: Y[]) => [X, Y][]} */
|
|
34
|
+
const zip = (xs, ys) => xs.map((x, i) => [x, ys[i]]);
|
|
35
|
+
|
|
36
|
+
/** @type {(name: string) => string} */
|
|
37
|
+
const sanitizePathSegment = name => {
|
|
38
|
+
const candidate = name.replace(/[ ,]/g, '_');
|
|
39
|
+
assertPathSegment(candidate);
|
|
40
|
+
return candidate;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Handles the configuration updates for high-priority senders list by adding or
|
|
45
|
+
* removing addresses.
|
|
46
|
+
*
|
|
47
|
+
* @param {EconomyBootstrapPowers} powers - The bootstrap powers required for
|
|
48
|
+
* economic operations.
|
|
49
|
+
* @param {{
|
|
50
|
+
* options: {
|
|
51
|
+
* highPrioritySendersConfig: {
|
|
52
|
+
* addressesToAdd: string[];
|
|
53
|
+
* addressesToRemove: string[];
|
|
54
|
+
* };
|
|
55
|
+
* };
|
|
56
|
+
* }} config
|
|
57
|
+
* - The configuration object containing lists of addresses to add or remove.
|
|
58
|
+
*/
|
|
59
|
+
const handlehighPrioritySendersList = async (
|
|
60
|
+
{ consume: { highPrioritySendersManager: highPrioritySendersManagerP } },
|
|
61
|
+
{ options: { highPrioritySendersConfig } },
|
|
62
|
+
) => {
|
|
63
|
+
const HIGH_PRIORITY_SENDERS_NAMESPACE = 'economicCommittee';
|
|
64
|
+
const highPrioritySendersManager = await highPrioritySendersManagerP;
|
|
65
|
+
|
|
66
|
+
if (!highPrioritySendersManager) {
|
|
67
|
+
throw assert.error(`highPrioritySendersManager is not defined`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const { addressesToAdd, addressesToRemove } = highPrioritySendersConfig;
|
|
71
|
+
|
|
72
|
+
await Promise.all(
|
|
73
|
+
addressesToAdd.map(addr =>
|
|
74
|
+
E(highPrioritySendersManager).add(
|
|
75
|
+
HIGH_PRIORITY_SENDERS_NAMESPACE,
|
|
76
|
+
traced('High Priority Senders: adding', addr),
|
|
77
|
+
),
|
|
78
|
+
),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
await Promise.all(
|
|
82
|
+
addressesToRemove.map(addr =>
|
|
83
|
+
E(highPrioritySendersManager).remove(
|
|
84
|
+
HIGH_PRIORITY_SENDERS_NAMESPACE,
|
|
85
|
+
traced('High Priority Senders: removing', addr),
|
|
86
|
+
),
|
|
87
|
+
),
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Invites Economic Committee (EC) members by distributing voting invitations to
|
|
93
|
+
* the specified addresses.
|
|
94
|
+
*
|
|
95
|
+
* @param {EconomyBootstrapPowers} powers - The bootstrap powers required for
|
|
96
|
+
* economic operations, including `namesByAddressAdmin` used for managing
|
|
97
|
+
* names.
|
|
98
|
+
* @param {{
|
|
99
|
+
* options: {
|
|
100
|
+
* voterAddresses: Record<string, string>;
|
|
101
|
+
* economicCommitteeCreatorFacet: CommitteeElectorateCreatorFacet;
|
|
102
|
+
* };
|
|
103
|
+
* }} config
|
|
104
|
+
* - The configuration object containing voter addresses and the economic
|
|
105
|
+
* committee facet to create voter invitations.
|
|
106
|
+
*
|
|
107
|
+
* @returns {Promise<void>} A promise that resolves once the invitations have
|
|
108
|
+
* been distributed.
|
|
109
|
+
*/
|
|
110
|
+
const inviteECMembers = async (
|
|
111
|
+
{ consume: { namesByAddressAdmin } },
|
|
112
|
+
{ options: { voterAddresses = {}, economicCommitteeCreatorFacet } },
|
|
113
|
+
) => {
|
|
114
|
+
trace('Create invitations for new committee');
|
|
115
|
+
|
|
116
|
+
const invitations = await E(
|
|
117
|
+
economicCommitteeCreatorFacet,
|
|
118
|
+
).getVoterInvitations();
|
|
119
|
+
assert.equal(invitations.length, values(voterAddresses).length);
|
|
120
|
+
|
|
121
|
+
trace('Distribute invitations');
|
|
122
|
+
/** @param {[string, Promise<Invitation>][]} addrInvitations */
|
|
123
|
+
const distributeInvitations = async addrInvitations => {
|
|
124
|
+
await Promise.all(
|
|
125
|
+
addrInvitations.map(async ([addr, invitationP]) => {
|
|
126
|
+
const [voterInvitation] = await Promise.all([invitationP]);
|
|
127
|
+
trace('Sending voting invitations to', addr);
|
|
128
|
+
await reserveThenDeposit(
|
|
129
|
+
`econ committee member ${addr}`,
|
|
130
|
+
namesByAddressAdmin,
|
|
131
|
+
addr,
|
|
132
|
+
[voterInvitation],
|
|
133
|
+
);
|
|
134
|
+
}),
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
await distributeInvitations(zip(values(voterAddresses), invitations));
|
|
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
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Starts a new Economic Committee (EC) by creating an instance with the
|
|
182
|
+
* provided committee specifications.
|
|
183
|
+
*
|
|
184
|
+
* @param {EconomyBootstrapPowers} powers - The resources and capabilities
|
|
185
|
+
* required to start the committee.
|
|
186
|
+
* @param {{
|
|
187
|
+
* options: {
|
|
188
|
+
* committeeName: string;
|
|
189
|
+
* committeeSize: number;
|
|
190
|
+
* };
|
|
191
|
+
* }} config
|
|
192
|
+
* - Configuration object containing the name and size of the committee.
|
|
193
|
+
*
|
|
194
|
+
* @returns {Promise<CommitteeElectorateCreatorFacet>} A promise that resolves
|
|
195
|
+
* to the creator facet of the newly created EC instance.
|
|
196
|
+
*/
|
|
197
|
+
const startNewEconomicCommittee = async (
|
|
198
|
+
{
|
|
199
|
+
consume: { board, chainStorage, startUpgradable },
|
|
200
|
+
produce: { economicCommitteeKit, economicCommitteeCreatorFacet },
|
|
201
|
+
installation: {
|
|
202
|
+
consume: { committee },
|
|
203
|
+
},
|
|
204
|
+
instance: {
|
|
205
|
+
produce: { economicCommittee },
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
{ options: { committeeName, committeeSize } },
|
|
209
|
+
) => {
|
|
210
|
+
const COMMITTEES_ROOT = 'committees';
|
|
211
|
+
|
|
212
|
+
trace('startNewEconomicCommittee');
|
|
213
|
+
|
|
214
|
+
trace(`committeeName ${committeeName}`);
|
|
215
|
+
trace(`committeeSize ${committeeSize}`);
|
|
216
|
+
|
|
217
|
+
const committeesNode = await makeStorageNodeChild(
|
|
218
|
+
chainStorage,
|
|
219
|
+
COMMITTEES_ROOT,
|
|
220
|
+
);
|
|
221
|
+
const storageNode = await E(committeesNode).makeChildNode(
|
|
222
|
+
sanitizePathSegment(committeeName),
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
const marshaller = await E(board).getPublishingMarshaller();
|
|
226
|
+
|
|
227
|
+
trace('Starting new EC Committee Instance');
|
|
228
|
+
|
|
229
|
+
const privateArgs = {
|
|
230
|
+
storageNode,
|
|
231
|
+
marshaller,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const terms = {
|
|
235
|
+
committeeName,
|
|
236
|
+
committeeSize,
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const startResult = await E(startUpgradable)({
|
|
240
|
+
label: 'economicCommittee',
|
|
241
|
+
installation: committee,
|
|
242
|
+
privateArgs,
|
|
243
|
+
terms,
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
const { instance, creatorFacet } = startResult;
|
|
247
|
+
|
|
248
|
+
trace('Started new EC Committee Instance Successfully');
|
|
249
|
+
economicCommitteeKit.reset();
|
|
250
|
+
economicCommitteeKit.resolve(
|
|
251
|
+
harden({ ...startResult, label: 'economicCommittee' }),
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
economicCommittee.reset();
|
|
255
|
+
economicCommittee.resolve(instance);
|
|
256
|
+
|
|
257
|
+
economicCommitteeCreatorFacet.reset();
|
|
258
|
+
economicCommitteeCreatorFacet.resolve(creatorFacet);
|
|
259
|
+
|
|
260
|
+
return creatorFacet;
|
|
261
|
+
};
|
|
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
|
+
* @typedef {PromiseSpaceOf<{
|
|
310
|
+
* auctionUpgradeNewInstance: Instance;
|
|
311
|
+
* auctionUpgradeNewGovCreator: any;
|
|
312
|
+
* }>} interlockPowers
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Adds governors to an existing Economic Committee Charter
|
|
317
|
+
*
|
|
318
|
+
* @param {EconomyBootstrapPowers & interlockPowers} powers
|
|
319
|
+
*
|
|
320
|
+
* - The resources and capabilities required to start the committee.
|
|
321
|
+
*
|
|
322
|
+
* @param {{
|
|
323
|
+
* options: {
|
|
324
|
+
* econCharterKit: EconCharterStartResult;
|
|
325
|
+
* };
|
|
326
|
+
* }} options
|
|
327
|
+
* - Configuration object containing the name and size of the committee.
|
|
328
|
+
*
|
|
329
|
+
* @returns {Promise<void>} A promise that resolves once all the governors have
|
|
330
|
+
* been successfully added to the economic charter
|
|
331
|
+
*/
|
|
332
|
+
const addGovernorsToEconCharter = async (
|
|
333
|
+
{
|
|
334
|
+
consume: {
|
|
335
|
+
auctionUpgradeNewInstance: auctionUpgradeNewInstanceP,
|
|
336
|
+
auctionUpgradeNewGovCreator: auctionUpgradeNewGovCreatorP,
|
|
337
|
+
psmKit,
|
|
338
|
+
governedContractKits,
|
|
339
|
+
},
|
|
340
|
+
produce: {
|
|
341
|
+
auctionUpgradeNewGovCreator: auctionUpgradeNewGovCreatorProduce,
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
{ options: { econCharterKit } },
|
|
345
|
+
) => {
|
|
346
|
+
const { creatorFacet: ecCreatorFacet } = E.get(econCharterKit);
|
|
347
|
+
|
|
348
|
+
const psmKitMap = await psmKit;
|
|
349
|
+
|
|
350
|
+
for (const { psm, psmGovernorCreatorFacet, label } of psmKitMap.values()) {
|
|
351
|
+
await E(ecCreatorFacet).addInstance(psm, psmGovernorCreatorFacet, label);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const governedContractKitMap = await governedContractKits;
|
|
355
|
+
for (const {
|
|
356
|
+
instance,
|
|
357
|
+
governorCreatorFacet,
|
|
358
|
+
label,
|
|
359
|
+
} of governedContractKitMap.values()) {
|
|
360
|
+
// The auctioneer was updated in this same release, getting values directly
|
|
361
|
+
// (there might be more than one auctioneer instance, but the others don't
|
|
362
|
+
// need to be registered.)
|
|
363
|
+
if (label !== 'auctioneer') {
|
|
364
|
+
await E(ecCreatorFacet).addInstance(
|
|
365
|
+
instance,
|
|
366
|
+
governorCreatorFacet,
|
|
367
|
+
label,
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const [auctionUpgradeNewInstance, auctionUpgradeNewGovCreator] =
|
|
373
|
+
await Promise.all([
|
|
374
|
+
auctionUpgradeNewInstanceP,
|
|
375
|
+
auctionUpgradeNewGovCreatorP,
|
|
376
|
+
]);
|
|
377
|
+
// reset after use. auctionUpgradeNewInstance is reset by upgrade-vault.js
|
|
378
|
+
auctionUpgradeNewGovCreatorProduce.reset();
|
|
379
|
+
|
|
380
|
+
await E(ecCreatorFacet).addInstance(
|
|
381
|
+
auctionUpgradeNewInstance,
|
|
382
|
+
auctionUpgradeNewGovCreator,
|
|
383
|
+
'auctioneer',
|
|
384
|
+
);
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Replaces the electorate for governance contracts by creating a new Economic
|
|
389
|
+
* Committee and updating contracts with the new electorate's creator facet.
|
|
390
|
+
*
|
|
391
|
+
* @param {EconomyBootstrapPowers & interlockPowers} permittedPowers - The
|
|
392
|
+
* resources and capabilities needed for operations, including access to
|
|
393
|
+
* governance contracts and the PSM kit.
|
|
394
|
+
* @param {{
|
|
395
|
+
* options: {
|
|
396
|
+
* committeeName: string;
|
|
397
|
+
* voterAddresses: Record<string, string>;
|
|
398
|
+
* highPrioritySendersConfig: {
|
|
399
|
+
* addressesToAdd: string[];
|
|
400
|
+
* addressesToRemove: string[];
|
|
401
|
+
* };
|
|
402
|
+
* };
|
|
403
|
+
* }} config
|
|
404
|
+
* - Configuration object containing the committee details and governance options.
|
|
405
|
+
*
|
|
406
|
+
* @returns {Promise<void>} A promise that resolves when the electorate has been
|
|
407
|
+
* replaced.
|
|
408
|
+
*/
|
|
409
|
+
export const replaceAllElectorates = async (permittedPowers, config) => {
|
|
410
|
+
const { committeeName, voterAddresses, highPrioritySendersConfig } =
|
|
411
|
+
config.options;
|
|
412
|
+
|
|
413
|
+
const economicCommitteeCreatorFacet = await startNewEconomicCommittee(
|
|
414
|
+
permittedPowers,
|
|
415
|
+
{
|
|
416
|
+
options: {
|
|
417
|
+
committeeName,
|
|
418
|
+
committeeSize: values(voterAddresses).length,
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
const governedContractKitsMap =
|
|
424
|
+
await permittedPowers.consume.governedContractKits;
|
|
425
|
+
const psmKitMap = await permittedPowers.consume.psmKit;
|
|
426
|
+
|
|
427
|
+
const governanceDetails = [
|
|
428
|
+
...[...governedContractKitsMap.values()].map(governedContractKit => ({
|
|
429
|
+
creatorFacet: governedContractKit.governorCreatorFacet,
|
|
430
|
+
label: governedContractKit.label,
|
|
431
|
+
})),
|
|
432
|
+
...[...psmKitMap.values()].map(psmKit => ({
|
|
433
|
+
creatorFacet: psmKit.psmGovernorCreatorFacet,
|
|
434
|
+
label: psmKit.label,
|
|
435
|
+
})),
|
|
436
|
+
];
|
|
437
|
+
|
|
438
|
+
await Promise.all(
|
|
439
|
+
governanceDetails.map(async ({ creatorFacet, label }) => {
|
|
440
|
+
trace(`Getting PoserInvitation for ${label}...`);
|
|
441
|
+
const newElectoratePoser = await E(
|
|
442
|
+
economicCommitteeCreatorFacet,
|
|
443
|
+
).getPoserInvitation();
|
|
444
|
+
trace(`Successfully received newElectoratePoser for ${label}`);
|
|
445
|
+
|
|
446
|
+
trace(`Replacing electorate for ${label}`);
|
|
447
|
+
await E(creatorFacet).replaceElectorate(newElectoratePoser);
|
|
448
|
+
trace(`Successfully replaced electorate for ${label}`);
|
|
449
|
+
}),
|
|
450
|
+
);
|
|
451
|
+
|
|
452
|
+
await inviteECMembers(permittedPowers, {
|
|
453
|
+
options: {
|
|
454
|
+
voterAddresses,
|
|
455
|
+
economicCommitteeCreatorFacet,
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
await handlehighPrioritySendersList(permittedPowers, {
|
|
460
|
+
options: {
|
|
461
|
+
highPrioritySendersConfig,
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
trace('Installed New Economic Committee');
|
|
466
|
+
|
|
467
|
+
const econCharterKit = await startNewEconCharter(permittedPowers);
|
|
468
|
+
await addGovernorsToEconCharter(permittedPowers, {
|
|
469
|
+
options: { econCharterKit },
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
await inviteToEconCharter(permittedPowers, {
|
|
473
|
+
options: { voterAddresses, econCharterKit },
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
trace('Installed New EC Charter');
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
harden(replaceAllElectorates);
|
|
480
|
+
|
|
481
|
+
export const getManifestForReplaceAllElectorates = async (
|
|
482
|
+
{ economicCommitteeRef: _economicCommitteeRef },
|
|
483
|
+
options,
|
|
484
|
+
) => ({
|
|
485
|
+
manifest: {
|
|
486
|
+
[replaceAllElectorates.name]: {
|
|
487
|
+
consume: {
|
|
488
|
+
auctionUpgradeNewGovCreator: true,
|
|
489
|
+
auctionUpgradeNewInstance: true,
|
|
490
|
+
psmKit: true,
|
|
491
|
+
governedContractKits: true,
|
|
492
|
+
chainStorage: true,
|
|
493
|
+
highPrioritySendersManager: true,
|
|
494
|
+
namesByAddressAdmin: true,
|
|
495
|
+
// Rest of these are designed to be widely shared
|
|
496
|
+
board: true,
|
|
497
|
+
startUpgradable: true,
|
|
498
|
+
},
|
|
499
|
+
produce: {
|
|
500
|
+
econCharterKit: true,
|
|
501
|
+
economicCommitteeKit: true,
|
|
502
|
+
economicCommitteeCreatorFacet: true,
|
|
503
|
+
auctionUpgradeNewGovCreator: true,
|
|
504
|
+
},
|
|
505
|
+
installation: {
|
|
506
|
+
consume: {
|
|
507
|
+
committee: true,
|
|
508
|
+
binaryVoteCounter: true,
|
|
509
|
+
econCommitteeCharter: true,
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
instance: {
|
|
513
|
+
produce: {
|
|
514
|
+
economicCommittee: true,
|
|
515
|
+
econCommitteeCharter: true,
|
|
516
|
+
},
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
options: { ...options },
|
|
521
|
+
});
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
export function upgradeVaults({ consume: { auctionUpgradeNewInstance, chainTimerService, economicCommitteeCreatorFacet: electorateCreatorFacet, reserveKit, vaultFactoryKit, zoe,
|
|
1
|
+
export function upgradeVaults({ consume: { auctionUpgradeNewInstance, chainTimerService, economicCommitteeCreatorFacet: electorateCreatorFacet, reserveKit, vaultFactoryKit, zoe, priceAuthority8400, newContractGovBundleId: newContractGovBundleIdP, }, produce: { auctionUpgradeNewInstance: auctionUpgradeNewInstanceProducer, newContractGovBundleId: newContractGovBundleIdErasor, }, }: import("../../src/proposals/econ-behaviors").EconomyBootstrapPowers & interlockPowers, { options: { VaultFactoryBundle: vaultBundleRef } }: {
|
|
2
2
|
options: {
|
|
3
|
-
|
|
3
|
+
VaultFactoryBundle: {
|
|
4
4
|
bundleID: string;
|
|
5
5
|
};
|
|
6
6
|
};
|
|
7
7
|
}): Promise<void>;
|
|
8
|
-
export function getManifestForUpgradeVaults(
|
|
8
|
+
export function getManifestForUpgradeVaults({ restoreRef }: {
|
|
9
|
+
restoreRef: any;
|
|
10
|
+
}, { VaultFactoryRef }: any): Promise<{
|
|
9
11
|
manifest: {
|
|
10
12
|
[x: string]: {
|
|
11
13
|
consume: {
|
|
14
|
+
priceAuthority8400: string;
|
|
12
15
|
auctionUpgradeNewInstance: string;
|
|
13
16
|
chainTimerService: string;
|
|
14
17
|
economicCommitteeCreatorFacet: string;
|
|
15
18
|
reserveKit: string;
|
|
16
19
|
vaultFactoryKit: string;
|
|
17
20
|
zoe: string;
|
|
21
|
+
newContractGovBundleId: string;
|
|
18
22
|
};
|
|
19
23
|
produce: {
|
|
20
24
|
auctionUpgradeNewInstance: string;
|
|
21
|
-
|
|
22
|
-
installation: {
|
|
23
|
-
produce: {
|
|
24
|
-
VaultFactory: boolean;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
instance: {
|
|
28
|
-
consume: {
|
|
29
|
-
auctioneer: boolean;
|
|
30
|
-
};
|
|
25
|
+
newContractGovBundleId: string;
|
|
31
26
|
};
|
|
32
27
|
};
|
|
33
28
|
};
|
|
34
|
-
|
|
29
|
+
installations: {
|
|
30
|
+
VaultFactory: any;
|
|
31
|
+
};
|
|
32
|
+
options: {
|
|
33
|
+
VaultFactoryBundle: any;
|
|
34
|
+
};
|
|
35
35
|
}>;
|
|
36
36
|
export type interlockPowers = PromiseSpaceOf<{
|
|
37
|
+
priceAuthority8400: Instance;
|
|
37
38
|
auctionUpgradeNewInstance: Instance;
|
|
39
|
+
newContractGovBundleId: string;
|
|
38
40
|
}>;
|
|
39
41
|
//# sourceMappingURL=upgrade-vaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-vaults.d.ts","sourceRoot":"","sources":["upgrade-vaults.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgrade-vaults.d.ts","sourceRoot":"","sources":["upgrade-vaults.js"],"names":[],"mappings":"AAyBO,+XARI,OAAO,oCAAoC,EAAE,sBAAsB,GACvE,eAAe,uDACX;IACN,OAAO,EAAE;QACP,kBAAkB,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1C,CAAC;CACH,iBA8IH;AAUM,4DAHJ;IAAmB,UAAU,EAArB,GAAG;CACX,uBAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;GA4Bb;8BAhMY,cAAc,CAAC;IACvB,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,yBAAyB,EAAE,QAAQ,CAAC;IACpC,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC"}
|