dexe-mcp 0.1.5 → 0.2.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/.mcp.example.json +12 -2
- package/CHANGELOG.md +33 -0
- package/FUTURE.md +26 -5
- package/README.md +80 -195
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -1
- package/dist/config.js.map +1 -1
- package/dist/lib/addresses.d.ts +57 -0
- package/dist/lib/addresses.d.ts.map +1 -0
- package/dist/lib/addresses.js +83 -0
- package/dist/lib/addresses.js.map +1 -0
- package/dist/lib/calldata.d.ts +32 -0
- package/dist/lib/calldata.d.ts.map +1 -0
- package/dist/lib/calldata.js +28 -0
- package/dist/lib/calldata.js.map +1 -0
- package/dist/lib/govEnums.d.ts +12 -0
- package/dist/lib/govEnums.d.ts.map +1 -0
- package/dist/lib/govEnums.js +35 -0
- package/dist/lib/govEnums.js.map +1 -0
- package/dist/lib/ipfs.d.ts +60 -0
- package/dist/lib/ipfs.d.ts.map +1 -0
- package/dist/lib/ipfs.js +167 -0
- package/dist/lib/ipfs.js.map +1 -0
- package/dist/lib/multicall.d.ts +33 -0
- package/dist/lib/multicall.d.ts.map +1 -0
- package/dist/lib/multicall.js +46 -0
- package/dist/lib/multicall.js.map +1 -0
- package/dist/lib/proposalCatalog.d.ts +45 -0
- package/dist/lib/proposalCatalog.d.ts.map +1 -0
- package/dist/lib/proposalCatalog.js +416 -0
- package/dist/lib/proposalCatalog.js.map +1 -0
- package/dist/lib/subgraph.d.ts +15 -0
- package/dist/lib/subgraph.d.ts.map +1 -0
- package/dist/lib/subgraph.js +37 -0
- package/dist/lib/subgraph.js.map +1 -0
- package/dist/tools/dao.d.ts +4 -0
- package/dist/tools/dao.d.ts.map +1 -0
- package/dist/tools/dao.js +242 -0
- package/dist/tools/dao.js.map +1 -0
- package/dist/tools/daoDeploy.d.ts +4 -0
- package/dist/tools/daoDeploy.d.ts.map +1 -0
- package/dist/tools/daoDeploy.js +323 -0
- package/dist/tools/daoDeploy.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +24 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/ipfs.d.ts +6 -0
- package/dist/tools/ipfs.d.ts.map +1 -0
- package/dist/tools/ipfs.js +310 -0
- package/dist/tools/ipfs.js.map +1 -0
- package/dist/tools/proposal.d.ts +4 -0
- package/dist/tools/proposal.d.ts.map +1 -0
- package/dist/tools/proposal.js +199 -0
- package/dist/tools/proposal.js.map +1 -0
- package/dist/tools/proposalBuild.d.ts +4 -0
- package/dist/tools/proposalBuild.d.ts.map +1 -0
- package/dist/tools/proposalBuild.js +357 -0
- package/dist/tools/proposalBuild.js.map +1 -0
- package/dist/tools/proposalBuildComplex.d.ts +4 -0
- package/dist/tools/proposalBuildComplex.d.ts.map +1 -0
- package/dist/tools/proposalBuildComplex.js +700 -0
- package/dist/tools/proposalBuildComplex.js.map +1 -0
- package/dist/tools/proposalBuildInternal.d.ts +4 -0
- package/dist/tools/proposalBuildInternal.d.ts.map +1 -0
- package/dist/tools/proposalBuildInternal.js +211 -0
- package/dist/tools/proposalBuildInternal.js.map +1 -0
- package/dist/tools/proposalBuildMore.d.ts +4 -0
- package/dist/tools/proposalBuildMore.d.ts.map +1 -0
- package/dist/tools/proposalBuildMore.js +436 -0
- package/dist/tools/proposalBuildMore.js.map +1 -0
- package/dist/tools/proposalBuildOffchain.d.ts +4 -0
- package/dist/tools/proposalBuildOffchain.d.ts.map +1 -0
- package/dist/tools/proposalBuildOffchain.js +386 -0
- package/dist/tools/proposalBuildOffchain.js.map +1 -0
- package/dist/tools/read.d.ts +4 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/read.js +353 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/vote.d.ts +4 -0
- package/dist/tools/vote.d.ts.map +1 -0
- package/dist/tools/vote.js +196 -0
- package/dist/tools/vote.js.map +1 -0
- package/dist/tools/voteBuild.d.ts +4 -0
- package/dist/tools/voteBuild.d.ts.map +1 -0
- package/dist/tools/voteBuild.js +563 -0
- package/dist/tools/voteBuild.js.map +1 -0
- package/package.json +9 -4
- package/PLAN.md +0 -132
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Contract, Interface, isAddress } from "ethers";
|
|
3
|
+
import { RpcProvider } from "../rpc.js";
|
|
4
|
+
import { AddressBook, CONTRACT_NAMES } from "../lib/addresses.js";
|
|
5
|
+
import { multicall } from "../lib/multicall.js";
|
|
6
|
+
const POOL_FACTORY_ABI = [
|
|
7
|
+
"function predictGovAddresses(address deployer, string poolName) view returns (tuple(address govPool, address govTokenSale, address govToken, address distributionProposal, address expertNft, address nftMultiplier))",
|
|
8
|
+
];
|
|
9
|
+
const POOL_REGISTRY_ABI = [
|
|
10
|
+
"function isGovPool(address potentialPool) view returns (bool)",
|
|
11
|
+
];
|
|
12
|
+
const GOV_POOL_ABI = [
|
|
13
|
+
"function getHelperContracts() view returns (address settings, address userKeeper, address validators, address poolRegistry, address votePower)",
|
|
14
|
+
"function getNftContracts() view returns (address nftMultiplier, address expertNft, address dexeExpertNft, address babt)",
|
|
15
|
+
"function descriptionURL() view returns (string)",
|
|
16
|
+
"function name() view returns (string)",
|
|
17
|
+
];
|
|
18
|
+
const GOV_VALIDATORS_ABI = [
|
|
19
|
+
"function validatorsCount() view returns (uint256)",
|
|
20
|
+
];
|
|
21
|
+
export function registerDaoTools(server, ctx) {
|
|
22
|
+
const rpc = new RpcProvider(ctx.config);
|
|
23
|
+
function requireBook() {
|
|
24
|
+
const provider = rpc.requireProvider();
|
|
25
|
+
return new AddressBook({
|
|
26
|
+
provider,
|
|
27
|
+
chainId: ctx.config.chainId,
|
|
28
|
+
registryOverride: ctx.config.registryOverride,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
registerPredictAddresses(server, ctx, requireBook);
|
|
32
|
+
registerRegistryLookup(server, ctx, requireBook);
|
|
33
|
+
registerDaoInfo(server, ctx, rpc, requireBook);
|
|
34
|
+
}
|
|
35
|
+
function errorResult(message) {
|
|
36
|
+
return { content: [{ type: "text", text: message }], isError: true };
|
|
37
|
+
}
|
|
38
|
+
// ---------- dexe_dao_predict_addresses ----------
|
|
39
|
+
function registerPredictAddresses(server, ctx, requireBook) {
|
|
40
|
+
server.registerTool("dexe_dao_predict_addresses", {
|
|
41
|
+
title: "Predict addresses for a future DAO deployment",
|
|
42
|
+
description: "Calls `PoolFactory.predictGovAddresses(deployer, poolName)` and returns the six CREATE2-predicted addresses (govPool, govTokenSale, govToken, distributionProposal, expertNft, nftMultiplier). Useful for wiring configs before a DAO is actually deployed.",
|
|
43
|
+
inputSchema: {
|
|
44
|
+
deployer: z.string().describe("Address that will send the deployGovPool tx (tx.origin)"),
|
|
45
|
+
poolName: z.string().describe("Unique pool name — part of the CREATE2 salt"),
|
|
46
|
+
},
|
|
47
|
+
outputSchema: {
|
|
48
|
+
govPool: z.string(),
|
|
49
|
+
govTokenSale: z.string(),
|
|
50
|
+
govToken: z.string(),
|
|
51
|
+
distributionProposal: z.string(),
|
|
52
|
+
expertNft: z.string(),
|
|
53
|
+
nftMultiplier: z.string(),
|
|
54
|
+
},
|
|
55
|
+
}, async ({ deployer, poolName }) => {
|
|
56
|
+
if (!isAddress(deployer))
|
|
57
|
+
return errorResult(`Invalid deployer address: ${deployer}`);
|
|
58
|
+
if (!poolName || poolName.length === 0)
|
|
59
|
+
return errorResult("poolName must be non-empty");
|
|
60
|
+
try {
|
|
61
|
+
const book = requireBook();
|
|
62
|
+
const factoryAddr = await book.resolve(CONTRACT_NAMES.POOL_FACTORY);
|
|
63
|
+
const factory = new Contract(factoryAddr, POOL_FACTORY_ABI, book.provider);
|
|
64
|
+
const res = await factory.getFunction("predictGovAddresses").staticCall(deployer, poolName);
|
|
65
|
+
const structured = {
|
|
66
|
+
govPool: res.govPool,
|
|
67
|
+
govTokenSale: res.govTokenSale,
|
|
68
|
+
govToken: res.govToken,
|
|
69
|
+
distributionProposal: res.distributionProposal,
|
|
70
|
+
expertNft: res.expertNft,
|
|
71
|
+
nftMultiplier: res.nftMultiplier,
|
|
72
|
+
};
|
|
73
|
+
const text = `Predicted addresses for pool "${poolName}" deployed by ${deployer}:\n` +
|
|
74
|
+
` govPool : ${structured.govPool}\n` +
|
|
75
|
+
` govTokenSale : ${structured.govTokenSale}\n` +
|
|
76
|
+
` govToken : ${structured.govToken}\n` +
|
|
77
|
+
` distributionProposal : ${structured.distributionProposal}\n` +
|
|
78
|
+
` expertNft : ${structured.expertNft}\n` +
|
|
79
|
+
` nftMultiplier : ${structured.nftMultiplier}`;
|
|
80
|
+
return {
|
|
81
|
+
content: [{ type: "text", text }],
|
|
82
|
+
structuredContent: structured,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
return errorResult(`Failed to predict addresses: ${err instanceof Error ? err.message : String(err)}`);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// ---------- dexe_dao_registry_lookup ----------
|
|
91
|
+
function registerRegistryLookup(server, ctx, requireBook) {
|
|
92
|
+
server.registerTool("dexe_dao_registry_lookup", {
|
|
93
|
+
title: "Check whether an address is a DeXe GovPool",
|
|
94
|
+
description: "Calls `PoolRegistry.isGovPool(address)` on the configured chain. Returns true if the address is a registered DeXe DAO GovPool.",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
address: z.string().describe("Candidate GovPool address"),
|
|
97
|
+
},
|
|
98
|
+
outputSchema: {
|
|
99
|
+
address: z.string(),
|
|
100
|
+
isGovPool: z.boolean(),
|
|
101
|
+
poolRegistry: z.string(),
|
|
102
|
+
chainId: z.number(),
|
|
103
|
+
},
|
|
104
|
+
}, async ({ address }) => {
|
|
105
|
+
if (!isAddress(address))
|
|
106
|
+
return errorResult(`Invalid address: ${address}`);
|
|
107
|
+
try {
|
|
108
|
+
const book = requireBook();
|
|
109
|
+
const registryAddr = await book.resolve(CONTRACT_NAMES.POOL_REGISTRY);
|
|
110
|
+
const reg = new Contract(registryAddr, POOL_REGISTRY_ABI, book.provider);
|
|
111
|
+
const isGov = await reg.getFunction("isGovPool").staticCall(address);
|
|
112
|
+
const structured = {
|
|
113
|
+
address,
|
|
114
|
+
isGovPool: isGov,
|
|
115
|
+
poolRegistry: registryAddr,
|
|
116
|
+
chainId: ctx.config.chainId,
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{
|
|
121
|
+
type: "text",
|
|
122
|
+
text: `${address} ${isGov ? "IS" : "is NOT"} a GovPool on chainId=${ctx.config.chainId} (PoolRegistry=${registryAddr}).`,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
structuredContent: structured,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
return errorResult(`Registry lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// ---------- dexe_dao_info ----------
|
|
134
|
+
function registerDaoInfo(server, ctx, rpc, requireBook) {
|
|
135
|
+
server.registerTool("dexe_dao_info", {
|
|
136
|
+
title: "DAO overview — helpers, NFT contracts, validator count",
|
|
137
|
+
description: "Given a GovPool address, batch-reads helper addresses (settings/userKeeper/validators/poolRegistry/votePower), NFT contract addresses, description URL, and live validator count. One multicall RPC round-trip.",
|
|
138
|
+
inputSchema: {
|
|
139
|
+
govPool: z.string().describe("GovPool contract address"),
|
|
140
|
+
},
|
|
141
|
+
outputSchema: {
|
|
142
|
+
govPool: z.string(),
|
|
143
|
+
descriptionURL: z.string().nullable(),
|
|
144
|
+
helpers: z.object({
|
|
145
|
+
settings: z.string(),
|
|
146
|
+
userKeeper: z.string(),
|
|
147
|
+
validators: z.string(),
|
|
148
|
+
poolRegistry: z.string(),
|
|
149
|
+
votePower: z.string(),
|
|
150
|
+
}),
|
|
151
|
+
nftContracts: z.object({
|
|
152
|
+
nftMultiplier: z.string(),
|
|
153
|
+
expertNft: z.string(),
|
|
154
|
+
dexeExpertNft: z.string(),
|
|
155
|
+
babt: z.string(),
|
|
156
|
+
}),
|
|
157
|
+
validatorsCount: z.string().nullable(),
|
|
158
|
+
},
|
|
159
|
+
}, async ({ govPool }) => {
|
|
160
|
+
if (!isAddress(govPool))
|
|
161
|
+
return errorResult(`Invalid GovPool address: ${govPool}`);
|
|
162
|
+
try {
|
|
163
|
+
const provider = rpc.requireProvider();
|
|
164
|
+
const gpIface = new Interface(GOV_POOL_ABI);
|
|
165
|
+
const vIface = new Interface(GOV_VALIDATORS_ABI);
|
|
166
|
+
// Stage 1: helpers + nft contracts + descriptionURL
|
|
167
|
+
const stage1 = [
|
|
168
|
+
{ target: govPool, iface: gpIface, method: "getHelperContracts", args: [], allowFailure: true },
|
|
169
|
+
{ target: govPool, iface: gpIface, method: "getNftContracts", args: [], allowFailure: true },
|
|
170
|
+
{ target: govPool, iface: gpIface, method: "descriptionURL", args: [], allowFailure: true },
|
|
171
|
+
];
|
|
172
|
+
const [helpersR, nftR, descR] = await multicall(provider, stage1);
|
|
173
|
+
if (!helpersR?.success || !nftR?.success) {
|
|
174
|
+
return errorResult(`GovPool ${govPool} did not return helpers or NFT contracts — is it a valid GovPool? (registry lookup first via dexe_dao_registry_lookup)`);
|
|
175
|
+
}
|
|
176
|
+
const hv = helpersR.value;
|
|
177
|
+
const nv = nftR.value;
|
|
178
|
+
const helpers = {
|
|
179
|
+
settings: hv.settings,
|
|
180
|
+
userKeeper: hv.userKeeper,
|
|
181
|
+
validators: hv.validators,
|
|
182
|
+
poolRegistry: hv.poolRegistry,
|
|
183
|
+
votePower: hv.votePower,
|
|
184
|
+
};
|
|
185
|
+
const nftContracts = {
|
|
186
|
+
nftMultiplier: nv.nftMultiplier,
|
|
187
|
+
expertNft: nv.expertNft,
|
|
188
|
+
dexeExpertNft: nv.dexeExpertNft,
|
|
189
|
+
babt: nv.babt,
|
|
190
|
+
};
|
|
191
|
+
// Stage 2: validator count on the validators contract
|
|
192
|
+
let validatorsCount = null;
|
|
193
|
+
if (helpers.validators && isAddress(helpers.validators)) {
|
|
194
|
+
const [vcR] = await multicall(provider, [
|
|
195
|
+
{
|
|
196
|
+
target: helpers.validators,
|
|
197
|
+
iface: vIface,
|
|
198
|
+
method: "validatorsCount",
|
|
199
|
+
args: [],
|
|
200
|
+
allowFailure: true,
|
|
201
|
+
},
|
|
202
|
+
]);
|
|
203
|
+
if (vcR?.success && vcR.value != null) {
|
|
204
|
+
validatorsCount = vcR.value.toString();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const descriptionURL = descR?.success && typeof descR.value === "string" ? descR.value : null;
|
|
208
|
+
// Use requireBook so we fail clearly if chain support is missing — even
|
|
209
|
+
// though dao_info doesn't otherwise need the registry.
|
|
210
|
+
requireBook();
|
|
211
|
+
const structured = {
|
|
212
|
+
govPool,
|
|
213
|
+
descriptionURL,
|
|
214
|
+
helpers,
|
|
215
|
+
nftContracts,
|
|
216
|
+
validatorsCount,
|
|
217
|
+
};
|
|
218
|
+
const text = `GovPool ${govPool}\n` +
|
|
219
|
+
` descriptionURL: ${descriptionURL ?? "(none)"}\n` +
|
|
220
|
+
` validators: ${validatorsCount ?? "?"}\n\n` +
|
|
221
|
+
`Helpers:\n` +
|
|
222
|
+
` settings : ${helpers.settings}\n` +
|
|
223
|
+
` userKeeper : ${helpers.userKeeper}\n` +
|
|
224
|
+
` validators : ${helpers.validators}\n` +
|
|
225
|
+
` poolRegistry : ${helpers.poolRegistry}\n` +
|
|
226
|
+
` votePower : ${helpers.votePower}\n\n` +
|
|
227
|
+
`NFT contracts:\n` +
|
|
228
|
+
` nftMultiplier : ${nftContracts.nftMultiplier}\n` +
|
|
229
|
+
` expertNft : ${nftContracts.expertNft}\n` +
|
|
230
|
+
` dexeExpertNft : ${nftContracts.dexeExpertNft}\n` +
|
|
231
|
+
` babt : ${nftContracts.babt}`;
|
|
232
|
+
return {
|
|
233
|
+
content: [{ type: "text", text }],
|
|
234
|
+
structuredContent: structured,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
return errorResult(`dao_info failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=dao.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dao.js","sourceRoot":"","sources":["../../src/tools/dao.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAa,MAAM,qBAAqB,CAAC;AAE3D,MAAM,gBAAgB,GAAG;IACvB,uNAAuN;CAC/M,CAAC;AAEX,MAAM,iBAAiB,GAAG;IACxB,+DAA+D;CACvD,CAAC;AAEX,MAAM,YAAY,GAAG;IACnB,gJAAgJ;IAChJ,yHAAyH;IACzH,iDAAiD;IACjD,uCAAuC;CAC/B,CAAC;AAEX,MAAM,kBAAkB,GAAG;IACzB,mDAAmD;CAC3C,CAAC;AAEX,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,GAAgB;IAClE,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAExC,SAAS,WAAW;QAClB,MAAM,QAAQ,GAAG,GAAG,CAAC,eAAe,EAAE,CAAC;QACvC,OAAO,IAAI,WAAW,CAAC;YACrB,QAAQ;YACR,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO;YAC3B,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB;SAC9C,CAAC,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AK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA4FhD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAGhF"}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Interface, isAddress } from "ethers";
|
|
3
|
+
import { buildPayload } from "../lib/calldata.js";
|
|
4
|
+
import { ArtifactsMissingError } from "../artifacts.js";
|
|
5
|
+
import { AddressBook, CONTRACT_NAMES } from "../lib/addresses.js";
|
|
6
|
+
import { RpcProvider } from "../rpc.js";
|
|
7
|
+
/**
|
|
8
|
+
* Phase 5 — deploy a new DAO via `PoolFactory.deployGovPool(GovPoolDeployParams)`.
|
|
9
|
+
*
|
|
10
|
+
* The input struct is large and deeply nested. We load the PoolFactory ABI
|
|
11
|
+
* from the compiled Hardhat artifacts so encoding stays in lockstep with the
|
|
12
|
+
* on-chain contract — run `dexe_compile` before calling if artifacts are
|
|
13
|
+
* missing. Falls back to a hand-rolled tuple signature if artifacts are not
|
|
14
|
+
* available (the fallback is carefully matched to
|
|
15
|
+
* `contracts/interfaces/factory/IPoolFactory.sol`).
|
|
16
|
+
*
|
|
17
|
+
* VotePowerType enum: LINEAR_VOTES=0, POLYNOMIAL_VOTES=1, CUSTOM_VOTES=2.
|
|
18
|
+
*/
|
|
19
|
+
const VOTE_POWER_TYPES = ["LINEAR_VOTES", "POLYNOMIAL_VOTES", "CUSTOM_VOTES"];
|
|
20
|
+
const FALLBACK_POOL_FACTORY_ABI = [
|
|
21
|
+
"function deployGovPool(tuple(tuple(tuple(bool earlyCompletion, bool delegatedVotingAllowed, bool validatorsVote, uint64 duration, uint64 durationValidators, uint64 executionDelay, uint128 quorum, uint128 quorumValidators, uint256 minVotesForVoting, uint256 minVotesForCreating, tuple(address rewardToken, uint256 creationReward, uint256 executionReward, uint256 voteRewardsCoefficient) rewardsInfo, string executorDescription)[] proposalSettings, address[] additionalProposalExecutors) settingsParams, tuple(string name, string symbol, tuple(uint64 duration, uint64 executionDelay, uint128 quorum) proposalSettings, address[] validators, uint256[] balances) validatorsParams, tuple(address tokenAddress, address nftAddress, uint256 individualPower, uint256 nftsTotalSupply) userKeeperParams, tuple(string name, string symbol, address[] users, uint256 cap, uint256 mintedTotal, uint256[] amounts) tokenParams, tuple(uint8 voteType, bytes initData, address presetAddress) votePowerParams, address verifier, bool onlyBABTHolders, string descriptionURL, string name) parameters) returns (address)",
|
|
22
|
+
];
|
|
23
|
+
// ---------- input schemas ----------
|
|
24
|
+
const RewardsInfoSchema = z.object({
|
|
25
|
+
rewardToken: z.string(),
|
|
26
|
+
creationReward: z.string().default("0"),
|
|
27
|
+
executionReward: z.string().default("0"),
|
|
28
|
+
voteRewardsCoefficient: z.string().default("0"),
|
|
29
|
+
});
|
|
30
|
+
const MainProposalSettingsSchema = z.object({
|
|
31
|
+
earlyCompletion: z.boolean(),
|
|
32
|
+
delegatedVotingAllowed: z.boolean(),
|
|
33
|
+
validatorsVote: z.boolean(),
|
|
34
|
+
duration: z.string(),
|
|
35
|
+
durationValidators: z.string(),
|
|
36
|
+
executionDelay: z.string().default("0"),
|
|
37
|
+
quorum: z.string(),
|
|
38
|
+
quorumValidators: z.string(),
|
|
39
|
+
minVotesForVoting: z.string(),
|
|
40
|
+
minVotesForCreating: z.string(),
|
|
41
|
+
rewardsInfo: RewardsInfoSchema,
|
|
42
|
+
executorDescription: z.string().default(""),
|
|
43
|
+
});
|
|
44
|
+
const SettingsDeployParamsSchema = z.object({
|
|
45
|
+
proposalSettings: z.array(MainProposalSettingsSchema).min(1),
|
|
46
|
+
additionalProposalExecutors: z.array(z.string()).default([]),
|
|
47
|
+
});
|
|
48
|
+
const ValidatorProposalSettingsSchema = z.object({
|
|
49
|
+
duration: z.string(),
|
|
50
|
+
executionDelay: z.string().default("0"),
|
|
51
|
+
quorum: z.string(),
|
|
52
|
+
});
|
|
53
|
+
const ValidatorsDeployParamsSchema = z.object({
|
|
54
|
+
name: z.string(),
|
|
55
|
+
symbol: z.string(),
|
|
56
|
+
proposalSettings: ValidatorProposalSettingsSchema,
|
|
57
|
+
validators: z.array(z.string()).default([]),
|
|
58
|
+
balances: z.array(z.string()).default([]),
|
|
59
|
+
});
|
|
60
|
+
const UserKeeperDeployParamsSchema = z.object({
|
|
61
|
+
tokenAddress: z.string().default("0x0000000000000000000000000000000000000000"),
|
|
62
|
+
nftAddress: z.string().default("0x0000000000000000000000000000000000000000"),
|
|
63
|
+
individualPower: z.string().default("0"),
|
|
64
|
+
nftsTotalSupply: z.string().default("0"),
|
|
65
|
+
});
|
|
66
|
+
const TokenParamsSchema = z.object({
|
|
67
|
+
name: z.string().default(""),
|
|
68
|
+
symbol: z.string().default(""),
|
|
69
|
+
users: z.array(z.string()).default([]),
|
|
70
|
+
cap: z.string().default("0"),
|
|
71
|
+
mintedTotal: z.string().default("0"),
|
|
72
|
+
amounts: z.array(z.string()).default([]),
|
|
73
|
+
});
|
|
74
|
+
const VotePowerDeployParamsSchema = z.object({
|
|
75
|
+
voteType: z.enum(VOTE_POWER_TYPES),
|
|
76
|
+
initData: z.string().default("0x"),
|
|
77
|
+
presetAddress: z.string().default("0x0000000000000000000000000000000000000000"),
|
|
78
|
+
});
|
|
79
|
+
// ---------- register ----------
|
|
80
|
+
export function registerDaoDeployTools(server, ctx) {
|
|
81
|
+
const rpc = new RpcProvider(ctx.config);
|
|
82
|
+
registerBuildDeploy(server, ctx, rpc);
|
|
83
|
+
}
|
|
84
|
+
function errorResult(message) {
|
|
85
|
+
return { content: [{ type: "text", text: message }], isError: true };
|
|
86
|
+
}
|
|
87
|
+
function payloadResult(payload, extra) {
|
|
88
|
+
const lines = [
|
|
89
|
+
payload.description,
|
|
90
|
+
` to : ${payload.to}`,
|
|
91
|
+
` value: ${payload.value}`,
|
|
92
|
+
` data : ${payload.data.slice(0, 66)}…`,
|
|
93
|
+
];
|
|
94
|
+
if (extra?.predictedGovPool)
|
|
95
|
+
lines.push(` predicted govPool: ${extra.predictedGovPool}`);
|
|
96
|
+
if (extra?.note)
|
|
97
|
+
lines.push(`\n${extra.note}`);
|
|
98
|
+
return {
|
|
99
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
100
|
+
structuredContent: {
|
|
101
|
+
payload: { ...payload },
|
|
102
|
+
predictedGovPool: extra?.predictedGovPool ?? null,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function payloadOutputSchema() {
|
|
107
|
+
return {
|
|
108
|
+
payload: z.object({
|
|
109
|
+
to: z.string(),
|
|
110
|
+
data: z.string(),
|
|
111
|
+
value: z.string(),
|
|
112
|
+
chainId: z.number(),
|
|
113
|
+
description: z.string(),
|
|
114
|
+
}),
|
|
115
|
+
predictedGovPool: z.string().nullable(),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// ---------- dexe_dao_build_deploy ----------
|
|
119
|
+
function registerBuildDeploy(server, ctx, rpc) {
|
|
120
|
+
server.registerTool("dexe_dao_build_deploy", {
|
|
121
|
+
title: "Build calldata to deploy a new DAO (PoolFactory.deployGovPool)",
|
|
122
|
+
description: "Builds the `PoolFactory.deployGovPool(GovPoolDeployParams)` tx. Input mirrors the nested struct from `IPoolFactory.sol` — settings + validators + userKeeper + token + votePower + verifier + onlyBABTHolders + descriptionURL + name. If `poolFactory` is omitted, resolves via the configured ContractsRegistry. If `deployer` is provided AND RPC is configured, also returns `predictedGovPool` so you can wire it into follow-up txs before the DAO is actually deployed.\n\nPrefer running `dexe_compile` first so we encode against the compiled ABI (strict parity); the tool falls back to a hand-rolled tuple signature otherwise.",
|
|
123
|
+
inputSchema: {
|
|
124
|
+
poolFactory: z
|
|
125
|
+
.string()
|
|
126
|
+
.optional()
|
|
127
|
+
.describe("PoolFactory address override; defaults to ContractsRegistry lookup"),
|
|
128
|
+
deployer: z
|
|
129
|
+
.string()
|
|
130
|
+
.optional()
|
|
131
|
+
.describe("tx.origin expected to send the deploy — used only for predictedGovPool"),
|
|
132
|
+
params: z.object({
|
|
133
|
+
settingsParams: SettingsDeployParamsSchema,
|
|
134
|
+
validatorsParams: ValidatorsDeployParamsSchema,
|
|
135
|
+
userKeeperParams: UserKeeperDeployParamsSchema,
|
|
136
|
+
tokenParams: TokenParamsSchema,
|
|
137
|
+
votePowerParams: VotePowerDeployParamsSchema,
|
|
138
|
+
verifier: z.string().default("0x0000000000000000000000000000000000000000"),
|
|
139
|
+
onlyBABTHolders: z.boolean().default(false),
|
|
140
|
+
descriptionURL: z.string().describe("ipfs://<cid> of DAO metadata JSON"),
|
|
141
|
+
name: z.string().min(1),
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
144
|
+
outputSchema: payloadOutputSchema(),
|
|
145
|
+
}, async ({ poolFactory, deployer, params }) => {
|
|
146
|
+
// ---------- validate leaf addresses ----------
|
|
147
|
+
if (poolFactory && !isAddress(poolFactory))
|
|
148
|
+
return errorResult(`Invalid poolFactory: ${poolFactory}`);
|
|
149
|
+
if (deployer && !isAddress(deployer))
|
|
150
|
+
return errorResult(`Invalid deployer: ${deployer}`);
|
|
151
|
+
if (!isAddress(params.verifier))
|
|
152
|
+
return errorResult(`Invalid verifier: ${params.verifier}`);
|
|
153
|
+
if (!isAddress(params.userKeeperParams.tokenAddress))
|
|
154
|
+
return errorResult(`Invalid userKeeperParams.tokenAddress`);
|
|
155
|
+
if (!isAddress(params.userKeeperParams.nftAddress))
|
|
156
|
+
return errorResult(`Invalid userKeeperParams.nftAddress`);
|
|
157
|
+
if (!isAddress(params.votePowerParams.presetAddress))
|
|
158
|
+
return errorResult(`Invalid votePowerParams.presetAddress`);
|
|
159
|
+
for (const v of params.validatorsParams.validators) {
|
|
160
|
+
if (!isAddress(v))
|
|
161
|
+
return errorResult(`Invalid validator: ${v}`);
|
|
162
|
+
}
|
|
163
|
+
if (params.validatorsParams.validators.length !== params.validatorsParams.balances.length) {
|
|
164
|
+
return errorResult("validatorsParams.validators and .balances must be the same length");
|
|
165
|
+
}
|
|
166
|
+
for (const u of params.tokenParams.users) {
|
|
167
|
+
if (!isAddress(u))
|
|
168
|
+
return errorResult(`Invalid tokenParams.users entry: ${u}`);
|
|
169
|
+
}
|
|
170
|
+
if (params.tokenParams.users.length !== params.tokenParams.amounts.length) {
|
|
171
|
+
return errorResult("tokenParams.users and .amounts must be the same length");
|
|
172
|
+
}
|
|
173
|
+
// ---------- resolve PoolFactory address ----------
|
|
174
|
+
let factoryAddress = poolFactory;
|
|
175
|
+
if (!factoryAddress) {
|
|
176
|
+
try {
|
|
177
|
+
const provider = rpc.requireProvider();
|
|
178
|
+
const book = new AddressBook({
|
|
179
|
+
provider,
|
|
180
|
+
chainId: ctx.config.chainId,
|
|
181
|
+
registryOverride: ctx.config.registryOverride,
|
|
182
|
+
});
|
|
183
|
+
factoryAddress = await book.resolve(CONTRACT_NAMES.POOL_FACTORY);
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
return errorResult(`poolFactory address needed: pass it explicitly, or configure DEXE_RPC_URL so the ContractsRegistry lookup works. (${err instanceof Error ? err.message : String(err)})`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// ---------- build the tuple arg ----------
|
|
190
|
+
const paramsTuple = [
|
|
191
|
+
// settingsParams
|
|
192
|
+
[
|
|
193
|
+
params.settingsParams.proposalSettings.map((s) => [
|
|
194
|
+
s.earlyCompletion,
|
|
195
|
+
s.delegatedVotingAllowed,
|
|
196
|
+
s.validatorsVote,
|
|
197
|
+
BigInt(s.duration),
|
|
198
|
+
BigInt(s.durationValidators),
|
|
199
|
+
BigInt(s.executionDelay),
|
|
200
|
+
BigInt(s.quorum),
|
|
201
|
+
BigInt(s.quorumValidators),
|
|
202
|
+
BigInt(s.minVotesForVoting),
|
|
203
|
+
BigInt(s.minVotesForCreating),
|
|
204
|
+
[
|
|
205
|
+
s.rewardsInfo.rewardToken,
|
|
206
|
+
BigInt(s.rewardsInfo.creationReward),
|
|
207
|
+
BigInt(s.rewardsInfo.executionReward),
|
|
208
|
+
BigInt(s.rewardsInfo.voteRewardsCoefficient),
|
|
209
|
+
],
|
|
210
|
+
s.executorDescription,
|
|
211
|
+
]),
|
|
212
|
+
params.settingsParams.additionalProposalExecutors,
|
|
213
|
+
],
|
|
214
|
+
// validatorsParams
|
|
215
|
+
[
|
|
216
|
+
params.validatorsParams.name,
|
|
217
|
+
params.validatorsParams.symbol,
|
|
218
|
+
[
|
|
219
|
+
BigInt(params.validatorsParams.proposalSettings.duration),
|
|
220
|
+
BigInt(params.validatorsParams.proposalSettings.executionDelay),
|
|
221
|
+
BigInt(params.validatorsParams.proposalSettings.quorum),
|
|
222
|
+
],
|
|
223
|
+
params.validatorsParams.validators,
|
|
224
|
+
params.validatorsParams.balances.map((b) => BigInt(b)),
|
|
225
|
+
],
|
|
226
|
+
// userKeeperParams
|
|
227
|
+
[
|
|
228
|
+
params.userKeeperParams.tokenAddress,
|
|
229
|
+
params.userKeeperParams.nftAddress,
|
|
230
|
+
BigInt(params.userKeeperParams.individualPower),
|
|
231
|
+
BigInt(params.userKeeperParams.nftsTotalSupply),
|
|
232
|
+
],
|
|
233
|
+
// tokenParams
|
|
234
|
+
[
|
|
235
|
+
params.tokenParams.name,
|
|
236
|
+
params.tokenParams.symbol,
|
|
237
|
+
params.tokenParams.users,
|
|
238
|
+
BigInt(params.tokenParams.cap),
|
|
239
|
+
BigInt(params.tokenParams.mintedTotal),
|
|
240
|
+
params.tokenParams.amounts.map((a) => BigInt(a)),
|
|
241
|
+
],
|
|
242
|
+
// votePowerParams
|
|
243
|
+
[
|
|
244
|
+
VOTE_POWER_TYPES.indexOf(params.votePowerParams.voteType), // uint8 enum
|
|
245
|
+
params.votePowerParams.initData,
|
|
246
|
+
params.votePowerParams.presetAddress,
|
|
247
|
+
],
|
|
248
|
+
params.verifier,
|
|
249
|
+
params.onlyBABTHolders,
|
|
250
|
+
params.descriptionURL,
|
|
251
|
+
params.name,
|
|
252
|
+
];
|
|
253
|
+
// ---------- get ABI (artifact > fallback) ----------
|
|
254
|
+
let iface;
|
|
255
|
+
let ifaceSource;
|
|
256
|
+
try {
|
|
257
|
+
const records = ctx.artifacts.get("PoolFactory");
|
|
258
|
+
if (records.length > 0) {
|
|
259
|
+
iface = new Interface(records[0].abi);
|
|
260
|
+
ifaceSource = "compiled artifact";
|
|
261
|
+
// Sanity: ensure it has deployGovPool
|
|
262
|
+
try {
|
|
263
|
+
iface.getFunction("deployGovPool");
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
iface = new Interface(FALLBACK_POOL_FACTORY_ABI);
|
|
267
|
+
ifaceSource = "fallback (compiled artifact missing deployGovPool)";
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
iface = new Interface(FALLBACK_POOL_FACTORY_ABI);
|
|
272
|
+
ifaceSource = "fallback (artifacts not loaded — run dexe_compile for strict parity)";
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
if (err instanceof ArtifactsMissingError) {
|
|
277
|
+
iface = new Interface(FALLBACK_POOL_FACTORY_ABI);
|
|
278
|
+
ifaceSource = "fallback (no artifacts — run dexe_compile for strict parity)";
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
return errorResult(`Failed to load PoolFactory ABI: ${err instanceof Error ? err.message : String(err)}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// ---------- encode ----------
|
|
285
|
+
let payload;
|
|
286
|
+
try {
|
|
287
|
+
payload = buildPayload({
|
|
288
|
+
to: factoryAddress,
|
|
289
|
+
iface,
|
|
290
|
+
method: "deployGovPool",
|
|
291
|
+
args: [paramsTuple],
|
|
292
|
+
chainId: ctx.config.chainId,
|
|
293
|
+
contractLabel: "PoolFactory",
|
|
294
|
+
description: `PoolFactory.deployGovPool("${params.name}") via ${ifaceSource}`,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
catch (err) {
|
|
298
|
+
return errorResult(`deployGovPool encoding failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
299
|
+
}
|
|
300
|
+
// ---------- optional: predict govPool ----------
|
|
301
|
+
let predictedGovPool;
|
|
302
|
+
if (deployer && ctx.config.rpcUrl) {
|
|
303
|
+
try {
|
|
304
|
+
const provider = rpc.requireProvider();
|
|
305
|
+
const predictIface = new Interface([
|
|
306
|
+
"function predictGovAddresses(address deployer, string poolName) view returns (tuple(address govPool, address govTokenSale, address govToken, address distributionProposal, address expertNft, address nftMultiplier))",
|
|
307
|
+
]);
|
|
308
|
+
const { Contract } = await import("ethers");
|
|
309
|
+
const factory = new Contract(factoryAddress, predictIface, provider);
|
|
310
|
+
const res = await factory.getFunction("predictGovAddresses").staticCall(deployer, params.name);
|
|
311
|
+
predictedGovPool = res.govPool;
|
|
312
|
+
}
|
|
313
|
+
catch {
|
|
314
|
+
// best-effort; absence is not fatal
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
const note = ifaceSource.includes("fallback")
|
|
318
|
+
? "⚠️ Using fallback tuple ABI. For guaranteed parity, run dexe_compile to populate artifacts."
|
|
319
|
+
: "Encoded against compiled artifact — strict parity with deployed PoolFactory.";
|
|
320
|
+
return payloadResult(payload, { predictedGovPool, note });
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
//# sourceMappingURL=daoDeploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daoDeploy.js","sourceRoot":"","sources":["../../src/tools/daoDeploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,cA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AM,CAAC;gBACP,oCAAoC;YACtC,CAAC;QACH,CAAC;QAED,MAAM,IAAI,GACR,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC9B,CAAC,CAAC,8FAA8F;YAChG,CAAC,CAAC,8EAA8E,CAAC;QAErF,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAqB/C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAqBvE"}
|
package/dist/tools/index.js
CHANGED
|
@@ -4,6 +4,18 @@ import { SelectorIndex } from "../lib/selectors.js";
|
|
|
4
4
|
import { registerBuildTools } from "./build.js";
|
|
5
5
|
import { registerIntrospectTools } from "./introspect.js";
|
|
6
6
|
import { registerGovTools } from "./gov.js";
|
|
7
|
+
import { registerDaoTools } from "./dao.js";
|
|
8
|
+
import { registerProposalTools } from "./proposal.js";
|
|
9
|
+
import { registerVoteTools } from "./vote.js";
|
|
10
|
+
import { registerReadTools } from "./read.js";
|
|
11
|
+
import { registerIpfsTools } from "./ipfs.js";
|
|
12
|
+
import { registerProposalBuildTools } from "./proposalBuild.js";
|
|
13
|
+
import { registerProposalBuildMoreTools } from "./proposalBuildMore.js";
|
|
14
|
+
import { registerProposalBuildComplexTools } from "./proposalBuildComplex.js";
|
|
15
|
+
import { registerProposalBuildOffchainTools } from "./proposalBuildOffchain.js";
|
|
16
|
+
import { registerProposalBuildInternalTools } from "./proposalBuildInternal.js";
|
|
17
|
+
import { registerVoteBuildTools } from "./voteBuild.js";
|
|
18
|
+
import { registerDaoDeployTools } from "./daoDeploy.js";
|
|
7
19
|
/**
|
|
8
20
|
* Wire every dexe-mcp tool onto the given server instance. Builds the shared
|
|
9
21
|
* ToolContext (artifacts cache, hardhat runner, selector index) once so all
|
|
@@ -17,5 +29,17 @@ export function registerAll(server, config) {
|
|
|
17
29
|
registerBuildTools(server, ctx);
|
|
18
30
|
registerIntrospectTools(server, ctx);
|
|
19
31
|
registerGovTools(server, ctx);
|
|
32
|
+
registerDaoTools(server, ctx);
|
|
33
|
+
registerProposalTools(server, ctx);
|
|
34
|
+
registerVoteTools(server, ctx);
|
|
35
|
+
registerReadTools(server, ctx);
|
|
36
|
+
registerIpfsTools(server, ctx);
|
|
37
|
+
registerProposalBuildTools(server, ctx);
|
|
38
|
+
registerProposalBuildMoreTools(server, ctx);
|
|
39
|
+
registerProposalBuildComplexTools(server, ctx);
|
|
40
|
+
registerProposalBuildOffchainTools(server, ctx);
|
|
41
|
+
registerProposalBuildInternalTools(server, ctx);
|
|
42
|
+
registerVoteBuildTools(server, ctx);
|
|
43
|
+
registerDaoDeployTools(server, ctx);
|
|
20
44
|
}
|
|
21
45
|
//# sourceMappingURL=index.js.map
|