@agoric/governance 0.10.4-dev-cbcea8c.0.cbcea8c → 0.10.4-dev-04baeed.0.04baeed
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/governance",
|
|
3
|
-
"version": "0.10.4-dev-
|
|
3
|
+
"version": "0.10.4-dev-04baeed.0.04baeed",
|
|
4
4
|
"description": "Core governance support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
33
|
-
"@agoric/internal": "0.3.3-dev-
|
|
34
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
35
|
-
"@agoric/store": "0.9.3-dev-
|
|
36
|
-
"@agoric/time": "0.3.3-dev-
|
|
37
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
38
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
32
|
+
"@agoric/ertp": "0.16.3-dev-04baeed.0.04baeed",
|
|
33
|
+
"@agoric/internal": "0.3.3-dev-04baeed.0.04baeed",
|
|
34
|
+
"@agoric/notifier": "0.6.3-dev-04baeed.0.04baeed",
|
|
35
|
+
"@agoric/store": "0.9.3-dev-04baeed.0.04baeed",
|
|
36
|
+
"@agoric/time": "0.3.3-dev-04baeed.0.04baeed",
|
|
37
|
+
"@agoric/vat-data": "0.5.3-dev-04baeed.0.04baeed",
|
|
38
|
+
"@agoric/zoe": "0.26.3-dev-04baeed.0.04baeed",
|
|
39
39
|
"@endo/bundle-source": "^4.3.2",
|
|
40
40
|
"@endo/captp": "^4.5.1",
|
|
41
41
|
"@endo/errors": "^1.3.1",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"import-meta-resolve": "^4.1.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
50
|
+
"@agoric/swingset-vat": "0.32.3-dev-04baeed.0.04baeed",
|
|
51
51
|
"@endo/bundle-source": "^4.3.2",
|
|
52
52
|
"@endo/init": "^1.1.13",
|
|
53
53
|
"ava": "^7.0.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"typeCoverage": {
|
|
77
77
|
"atLeast": 89.5
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "04baeedd0adc9b2480dd9d272e8daffebc408662"
|
|
80
80
|
}
|
|
@@ -20,7 +20,7 @@ export namespace governanceSourceSpecRegistry {
|
|
|
20
20
|
let sourceSpec_2: string;
|
|
21
21
|
export { sourceSpec_2 as sourceSpec };
|
|
22
22
|
}
|
|
23
|
-
namespace
|
|
23
|
+
namespace econCommitteeCharter {
|
|
24
24
|
let bundleName_3: string;
|
|
25
25
|
export { bundleName_3 as bundleName };
|
|
26
26
|
let packagePath_3: string;
|
|
@@ -28,6 +28,14 @@ export namespace governanceSourceSpecRegistry {
|
|
|
28
28
|
let sourceSpec_3: string;
|
|
29
29
|
export { sourceSpec_3 as sourceSpec };
|
|
30
30
|
}
|
|
31
|
+
namespace puppetContractGovernor {
|
|
32
|
+
let bundleName_4: string;
|
|
33
|
+
export { bundleName_4 as bundleName };
|
|
34
|
+
let packagePath_4: string;
|
|
35
|
+
export { packagePath_4 as packagePath };
|
|
36
|
+
let sourceSpec_4: string;
|
|
37
|
+
export { sourceSpec_4 as sourceSpec };
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
export function getGovernanceSourceSpec(name: keyof typeof governanceSourceSpecRegistry): {
|
|
33
41
|
bundleName: string;
|
|
@@ -45,5 +53,9 @@ export function getGovernanceSourceSpec(name: keyof typeof governanceSourceSpecR
|
|
|
45
53
|
bundleName: string;
|
|
46
54
|
packagePath: string;
|
|
47
55
|
sourceSpec: string;
|
|
56
|
+
} | {
|
|
57
|
+
bundleName: string;
|
|
58
|
+
packagePath: string;
|
|
59
|
+
sourceSpec: string;
|
|
48
60
|
};
|
|
49
61
|
//# sourceMappingURL=source-spec-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-spec-registry.d.ts","sourceRoot":"","sources":["source-spec-registry.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-spec-registry.d.ts","sourceRoot":"","sources":["source-spec-registry.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCO,8CADK,MAAM,OAAO,4BAA4B;;;;;;;;;;;;;;;;;;;;EAEjB"}
|
package/source-spec-registry.js
CHANGED
|
@@ -22,6 +22,13 @@ export const governanceSourceSpecRegistry = {
|
|
|
22
22
|
packagePath: '@agoric/governance/src/contractGovernor.js',
|
|
23
23
|
sourceSpec: resolveSourceSpec('@agoric/governance/src/contractGovernor.js'),
|
|
24
24
|
},
|
|
25
|
+
econCommitteeCharter: {
|
|
26
|
+
bundleName: 'econCommitteeCharter',
|
|
27
|
+
packagePath: '@agoric/governance/src/econCommitteeCharter.js',
|
|
28
|
+
sourceSpec: resolveSourceSpec(
|
|
29
|
+
'@agoric/governance/src/econCommitteeCharter.js',
|
|
30
|
+
),
|
|
31
|
+
},
|
|
25
32
|
puppetContractGovernor: {
|
|
26
33
|
bundleName: 'puppetContractGovernor',
|
|
27
34
|
packagePath: '@agoric/governance/tools/puppetContractGovernor.js',
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {MapStore, SetStore} from '@agoric/store';
|
|
3
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
4
|
+
* @import {TimestampValue} from '@agoric/time';
|
|
5
|
+
* @import {ContractMeta, Installation, Instance, ZCF, ZCFSeat} from '@agoric/zoe';
|
|
6
|
+
* @import {GovernorCreatorFacet} from './types.js';
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @file This contract makes it possible for those who govern contracts to call
|
|
10
|
+
* for votes on changes. A more complete implementation would validate
|
|
11
|
+
* parameters, constrain deadlines and possibly split the ability to call for
|
|
12
|
+
* votes into separate capabilities for finer grain encapsulation.
|
|
13
|
+
*
|
|
14
|
+
* XXX There is nothing Inter-Protocol- or "econ"-specific in this module: it
|
|
15
|
+
* is a generic charter over arbitrary governed contracts. The
|
|
16
|
+
* `econCommitteeCharter` name (and the agoricNames registration that uses it)
|
|
17
|
+
* is kept for legacy clarity and on-chain continuity. Relocated from
|
|
18
|
+
* inter-protocol to @agoric/governance (refs #12719).
|
|
19
|
+
*/
|
|
20
|
+
export const INVITATION_MAKERS_DESC: "charter member invitation";
|
|
21
|
+
/** @type {ContractMeta<typeof start>} */
|
|
22
|
+
export const meta: ContractMeta<typeof start>;
|
|
23
|
+
export function start(zcf: ZCF<{
|
|
24
|
+
binaryVoteCounterInstallation: Installation;
|
|
25
|
+
}>, _privateArgs: undefined, baggage: Baggage): Promise<{
|
|
26
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
27
|
+
/**
|
|
28
|
+
* @param {Instance<unknown>} governedInstance
|
|
29
|
+
* @param {GovernorCreatorFacet<any>} governorFacet
|
|
30
|
+
* @param {string} [label] for diagnostic use only
|
|
31
|
+
*/
|
|
32
|
+
addInstance: (governedInstance: Instance<unknown>, governorFacet: GovernorCreatorFacet<any>, label?: string) => void;
|
|
33
|
+
makeCharterMemberInvitation: () => Promise<import("@agoric/zoe").Invitation<{
|
|
34
|
+
invitationMakers: import("@endo/exo").Guarded<{
|
|
35
|
+
VoteOnParamChange: () => Promise<import("@agoric/zoe").Invitation<import("./types.js").ContractGovernanceVoteResult, ParamChangesOfferArgs>>;
|
|
36
|
+
VoteOnPauseOffers: (instance: any, strings: any, deadline: any) => Promise<import("@agoric/zoe").Invitation<import("./types.js").ContractGovernanceVoteResult, undefined>>;
|
|
37
|
+
VoteOnApiCall: (instance: Instance<unknown>, methodName: string, methodArgs: string[], deadline: TimestampValue) => Promise<import("@agoric/zoe").Invitation<import("./types.js").ContractGovernanceVoteResult, undefined>>;
|
|
38
|
+
}>;
|
|
39
|
+
}, undefined>>;
|
|
40
|
+
}>;
|
|
41
|
+
}>;
|
|
42
|
+
export type ParamChangesOfferArgs = {
|
|
43
|
+
deadline: bigint;
|
|
44
|
+
instance: Instance<unknown>;
|
|
45
|
+
params: Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* paramPath is determined by contract
|
|
48
|
+
*/
|
|
49
|
+
path?: {
|
|
50
|
+
paramPath: unknown;
|
|
51
|
+
} | undefined;
|
|
52
|
+
};
|
|
53
|
+
import type { ContractMeta } from '@agoric/zoe';
|
|
54
|
+
import type { Installation } from '@agoric/zoe';
|
|
55
|
+
import type { ZCF } from '@agoric/zoe';
|
|
56
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
57
|
+
import type { Instance } from '@agoric/zoe';
|
|
58
|
+
import type { GovernorCreatorFacet } from './types.js';
|
|
59
|
+
import type { TimestampValue } from '@agoric/time';
|
|
60
|
+
//# sourceMappingURL=econCommitteeCharter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"econCommitteeCharter.d.ts","sourceRoot":"","sources":["econCommitteeCharter.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AAEH,qCAAsC,2BAA2B,CAAC;AAoBlE,yCAAyC;AACzC,mBADW,aAAa,OAAO,KAAK,CAAC,CAMnC;AAQK,2BAJI,IAAI;IAAE,6BAA6B,EAAE,YAAY,CAAA;CAAE,CAAC,gBACpD,SAAS,WACT,OAAO;;QAsHZ;;;;WAIG;wCAHQ,SAAS,OAAO,CAAC,iBACjB,qBAAqB,GAAG,CAAC,UACzB,MAAM;;;;;0CAzEV,SAAS,OAAO,CAAC,cACjB,MAAM,cACN,MAAM,EAAE,YACR,cAAc;;;;GAkF1B;;cAjKa,MAAM;cACN,SAAS,OAAO,CAAC;YACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;mBACV,OAAO;;;kCAxBmC,aAAa;kCAAb,aAAa;yBAAb,aAAa;6BAFxD,kBAAkB;8BAEyB,aAAa;0CAC3C,YAAY;oCAFlB,cAAc"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { M, mustMatch } from '@agoric/store';
|
|
2
|
+
import { TimestampShape } from '@agoric/time';
|
|
3
|
+
import { prepareExo, provideDurableMapStore } from '@agoric/vat-data';
|
|
4
|
+
import {
|
|
5
|
+
InstallationShape,
|
|
6
|
+
InstanceHandleShape,
|
|
7
|
+
} from '@agoric/zoe/src/typeGuards.js';
|
|
8
|
+
import { E } from '@endo/far';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @import {MapStore, SetStore} from '@agoric/store';
|
|
12
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
13
|
+
* @import {TimestampValue} from '@agoric/time';
|
|
14
|
+
* @import {ContractMeta, Installation, Instance, ZCF, ZCFSeat} from '@agoric/zoe';
|
|
15
|
+
* @import {GovernorCreatorFacet} from './types.js';
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @file This contract makes it possible for those who govern contracts to call
|
|
20
|
+
* for votes on changes. A more complete implementation would validate
|
|
21
|
+
* parameters, constrain deadlines and possibly split the ability to call for
|
|
22
|
+
* votes into separate capabilities for finer grain encapsulation.
|
|
23
|
+
*
|
|
24
|
+
* XXX There is nothing Inter-Protocol- or "econ"-specific in this module: it
|
|
25
|
+
* is a generic charter over arbitrary governed contracts. The
|
|
26
|
+
* `econCommitteeCharter` name (and the agoricNames registration that uses it)
|
|
27
|
+
* is kept for legacy clarity and on-chain continuity. Relocated from
|
|
28
|
+
* inter-protocol to @agoric/governance (refs #12719).
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export const INVITATION_MAKERS_DESC = 'charter member invitation';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {object} ParamChangesOfferArgs
|
|
35
|
+
* @property {bigint} deadline
|
|
36
|
+
* @property {Instance<unknown>} instance
|
|
37
|
+
* @property {Record<string, unknown>} params
|
|
38
|
+
* @property {{ paramPath: unknown }} [path] paramPath is determined by contract
|
|
39
|
+
*/
|
|
40
|
+
const ParamChangesOfferArgsShape = M.splitRecord(
|
|
41
|
+
{
|
|
42
|
+
deadline: TimestampShape,
|
|
43
|
+
instance: InstanceHandleShape,
|
|
44
|
+
params: M.recordOf(M.string(), M.any()),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
path: { paramPath: { key: M.any() } },
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
/** @type {ContractMeta<typeof start>} */
|
|
52
|
+
export const meta = {
|
|
53
|
+
customTermsShape: {
|
|
54
|
+
binaryVoteCounterInstallation: InstallationShape,
|
|
55
|
+
},
|
|
56
|
+
upgradability: 'canUpgrade',
|
|
57
|
+
};
|
|
58
|
+
harden(meta);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @param {ZCF<{ binaryVoteCounterInstallation: Installation }>} zcf
|
|
62
|
+
* @param {undefined} _privateArgs
|
|
63
|
+
* @param {Baggage} baggage
|
|
64
|
+
*/
|
|
65
|
+
export const start = async (zcf, _privateArgs, baggage) => {
|
|
66
|
+
const { binaryVoteCounterInstallation: counter } = zcf.getTerms();
|
|
67
|
+
/** @type {MapStore<Instance<unknown>, GovernorCreatorFacet<any>>} */
|
|
68
|
+
const instanceToGovernor = provideDurableMapStore(
|
|
69
|
+
baggage,
|
|
70
|
+
'instanceToGovernor',
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const makeParamInvitation = () => {
|
|
74
|
+
/**
|
|
75
|
+
* @param {ZCFSeat} seat
|
|
76
|
+
* @param {ParamChangesOfferArgs} args
|
|
77
|
+
*/
|
|
78
|
+
const voteOnParamChanges = (seat, args) => {
|
|
79
|
+
mustMatch(args, ParamChangesOfferArgsShape);
|
|
80
|
+
seat.exit();
|
|
81
|
+
|
|
82
|
+
const {
|
|
83
|
+
params,
|
|
84
|
+
instance,
|
|
85
|
+
deadline,
|
|
86
|
+
path = { paramPath: { key: 'governedApi' } },
|
|
87
|
+
} = args;
|
|
88
|
+
const governor = instanceToGovernor.get(instance);
|
|
89
|
+
return E(governor).voteOnParamChanges(counter, deadline, {
|
|
90
|
+
...path,
|
|
91
|
+
// @ts-expect-error XXX
|
|
92
|
+
changes: params,
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return zcf.makeInvitation(voteOnParamChanges, 'vote on param changes');
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const makeOfferFilterInvitation = (instance, strings, deadline) => {
|
|
100
|
+
const voteOnOfferFilterHandler = seat => {
|
|
101
|
+
seat.exit();
|
|
102
|
+
|
|
103
|
+
const governor = instanceToGovernor.get(instance);
|
|
104
|
+
return E(governor).voteOnOfferFilter(counter, deadline, strings);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return zcf.makeInvitation(voteOnOfferFilterHandler, 'vote on offer filter');
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {Instance<unknown>} instance
|
|
112
|
+
* @param {string} methodName
|
|
113
|
+
* @param {string[]} methodArgs
|
|
114
|
+
* @param {TimestampValue} deadline
|
|
115
|
+
*/
|
|
116
|
+
const makeApiInvocationInvitation = (
|
|
117
|
+
instance,
|
|
118
|
+
methodName,
|
|
119
|
+
methodArgs,
|
|
120
|
+
deadline,
|
|
121
|
+
) => {
|
|
122
|
+
const handler = seat => {
|
|
123
|
+
seat.exit();
|
|
124
|
+
|
|
125
|
+
const governor = instanceToGovernor.get(instance);
|
|
126
|
+
return E(governor).voteOnApiInvocation(
|
|
127
|
+
methodName,
|
|
128
|
+
methodArgs,
|
|
129
|
+
counter,
|
|
130
|
+
deadline,
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
return zcf.makeInvitation(handler, 'vote on API invocation');
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const MakerI = M.interface('Charter InvitationMakers', {
|
|
137
|
+
VoteOnParamChange: M.call().returns(M.promise()),
|
|
138
|
+
VoteOnPauseOffers: M.call(
|
|
139
|
+
InstanceHandleShape,
|
|
140
|
+
M.arrayOf(M.string()),
|
|
141
|
+
TimestampShape,
|
|
142
|
+
).returns(M.promise()),
|
|
143
|
+
VoteOnApiCall: M.call(
|
|
144
|
+
InstanceHandleShape,
|
|
145
|
+
M.string(),
|
|
146
|
+
M.arrayOf(M.any()),
|
|
147
|
+
TimestampShape,
|
|
148
|
+
).returns(M.promise()),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// durable so that when this contract is upgraded this ocap held
|
|
152
|
+
// by committee members (from their invitations) stay capable
|
|
153
|
+
const invitationMakers = prepareExo(
|
|
154
|
+
baggage,
|
|
155
|
+
'Charter Invitation Makers',
|
|
156
|
+
MakerI,
|
|
157
|
+
{
|
|
158
|
+
VoteOnParamChange: makeParamInvitation,
|
|
159
|
+
VoteOnPauseOffers: makeOfferFilterInvitation,
|
|
160
|
+
VoteOnApiCall: makeApiInvocationInvitation,
|
|
161
|
+
},
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const charterMemberHandler = seat => {
|
|
165
|
+
seat.exit();
|
|
166
|
+
return harden({ invitationMakers });
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const CharterCreatorI = M.interface('Charter creatorFacet', {
|
|
170
|
+
addInstance: M.call(InstanceHandleShape, M.any())
|
|
171
|
+
.optional(M.string())
|
|
172
|
+
.returns(),
|
|
173
|
+
makeCharterMemberInvitation: M.call().returns(M.promise()),
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const creatorFacet = prepareExo(
|
|
177
|
+
baggage,
|
|
178
|
+
'Charter creatorFacet',
|
|
179
|
+
CharterCreatorI,
|
|
180
|
+
{
|
|
181
|
+
/**
|
|
182
|
+
* @param {Instance<unknown>} governedInstance
|
|
183
|
+
* @param {GovernorCreatorFacet<any>} governorFacet
|
|
184
|
+
* @param {string} [label] for diagnostic use only
|
|
185
|
+
*/
|
|
186
|
+
addInstance: (governedInstance, governorFacet, label) => {
|
|
187
|
+
console.log('charter: adding instance', label);
|
|
188
|
+
instanceToGovernor.init(governedInstance, governorFacet);
|
|
189
|
+
},
|
|
190
|
+
makeCharterMemberInvitation: () =>
|
|
191
|
+
zcf.makeInvitation(charterMemberHandler, INVITATION_MAKERS_DESC),
|
|
192
|
+
},
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
return harden({ creatorFacet });
|
|
196
|
+
};
|
|
197
|
+
harden(start);
|