dexe-mcp 0.1.5 → 0.3.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.
Files changed (111) hide show
  1. package/.mcp.example.json +12 -2
  2. package/CHANGELOG.md +84 -0
  3. package/FUTURE.md +26 -5
  4. package/README.md +105 -197
  5. package/dist/config.d.ts +12 -0
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +34 -1
  8. package/dist/config.js.map +1 -1
  9. package/dist/index.js +16 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/lib/addresses.d.ts +57 -0
  12. package/dist/lib/addresses.d.ts.map +1 -0
  13. package/dist/lib/addresses.js +83 -0
  14. package/dist/lib/addresses.js.map +1 -0
  15. package/dist/lib/calldata.d.ts +32 -0
  16. package/dist/lib/calldata.d.ts.map +1 -0
  17. package/dist/lib/calldata.js +28 -0
  18. package/dist/lib/calldata.js.map +1 -0
  19. package/dist/lib/govEnums.d.ts +12 -0
  20. package/dist/lib/govEnums.d.ts.map +1 -0
  21. package/dist/lib/govEnums.js +35 -0
  22. package/dist/lib/govEnums.js.map +1 -0
  23. package/dist/lib/ipfs.d.ts +60 -0
  24. package/dist/lib/ipfs.d.ts.map +1 -0
  25. package/dist/lib/ipfs.js +168 -0
  26. package/dist/lib/ipfs.js.map +1 -0
  27. package/dist/lib/markdownToSlate.d.ts +39 -0
  28. package/dist/lib/markdownToSlate.d.ts.map +1 -0
  29. package/dist/lib/markdownToSlate.js +203 -0
  30. package/dist/lib/markdownToSlate.js.map +1 -0
  31. package/dist/lib/multicall.d.ts +33 -0
  32. package/dist/lib/multicall.d.ts.map +1 -0
  33. package/dist/lib/multicall.js +46 -0
  34. package/dist/lib/multicall.js.map +1 -0
  35. package/dist/lib/proposalCatalog.d.ts +45 -0
  36. package/dist/lib/proposalCatalog.d.ts.map +1 -0
  37. package/dist/lib/proposalCatalog.js +416 -0
  38. package/dist/lib/proposalCatalog.js.map +1 -0
  39. package/dist/lib/signer.d.ts +12 -0
  40. package/dist/lib/signer.d.ts.map +1 -0
  41. package/dist/lib/signer.js +31 -0
  42. package/dist/lib/signer.js.map +1 -0
  43. package/dist/lib/subgraph.d.ts +15 -0
  44. package/dist/lib/subgraph.d.ts.map +1 -0
  45. package/dist/lib/subgraph.js +42 -0
  46. package/dist/lib/subgraph.js.map +1 -0
  47. package/dist/tools/dao.d.ts +4 -0
  48. package/dist/tools/dao.d.ts.map +1 -0
  49. package/dist/tools/dao.js +242 -0
  50. package/dist/tools/dao.js.map +1 -0
  51. package/dist/tools/daoDeploy.d.ts +4 -0
  52. package/dist/tools/daoDeploy.d.ts.map +1 -0
  53. package/dist/tools/daoDeploy.js +573 -0
  54. package/dist/tools/daoDeploy.js.map +1 -0
  55. package/dist/tools/flow.d.ts +5 -0
  56. package/dist/tools/flow.d.ts.map +1 -0
  57. package/dist/tools/flow.js +451 -0
  58. package/dist/tools/flow.js.map +1 -0
  59. package/dist/tools/index.d.ts.map +1 -1
  60. package/dist/tools/index.js +32 -0
  61. package/dist/tools/index.js.map +1 -1
  62. package/dist/tools/ipfs.d.ts +6 -0
  63. package/dist/tools/ipfs.d.ts.map +1 -0
  64. package/dist/tools/ipfs.js +376 -0
  65. package/dist/tools/ipfs.js.map +1 -0
  66. package/dist/tools/proposal.d.ts +4 -0
  67. package/dist/tools/proposal.d.ts.map +1 -0
  68. package/dist/tools/proposal.js +217 -0
  69. package/dist/tools/proposal.js.map +1 -0
  70. package/dist/tools/proposalBuild.d.ts +4 -0
  71. package/dist/tools/proposalBuild.d.ts.map +1 -0
  72. package/dist/tools/proposalBuild.js +372 -0
  73. package/dist/tools/proposalBuild.js.map +1 -0
  74. package/dist/tools/proposalBuildComplex.d.ts +4 -0
  75. package/dist/tools/proposalBuildComplex.d.ts.map +1 -0
  76. package/dist/tools/proposalBuildComplex.js +766 -0
  77. package/dist/tools/proposalBuildComplex.js.map +1 -0
  78. package/dist/tools/proposalBuildInternal.d.ts +4 -0
  79. package/dist/tools/proposalBuildInternal.d.ts.map +1 -0
  80. package/dist/tools/proposalBuildInternal.js +224 -0
  81. package/dist/tools/proposalBuildInternal.js.map +1 -0
  82. package/dist/tools/proposalBuildMore.d.ts +4 -0
  83. package/dist/tools/proposalBuildMore.d.ts.map +1 -0
  84. package/dist/tools/proposalBuildMore.js +457 -0
  85. package/dist/tools/proposalBuildMore.js.map +1 -0
  86. package/dist/tools/proposalBuildOffchain.d.ts +4 -0
  87. package/dist/tools/proposalBuildOffchain.d.ts.map +1 -0
  88. package/dist/tools/proposalBuildOffchain.js +389 -0
  89. package/dist/tools/proposalBuildOffchain.js.map +1 -0
  90. package/dist/tools/read.d.ts +4 -0
  91. package/dist/tools/read.d.ts.map +1 -0
  92. package/dist/tools/read.js +580 -0
  93. package/dist/tools/read.js.map +1 -0
  94. package/dist/tools/subgraph.d.ts +4 -0
  95. package/dist/tools/subgraph.d.ts.map +1 -0
  96. package/dist/tools/subgraph.js +404 -0
  97. package/dist/tools/subgraph.js.map +1 -0
  98. package/dist/tools/txSend.d.ts +5 -0
  99. package/dist/tools/txSend.d.ts.map +1 -0
  100. package/dist/tools/txSend.js +87 -0
  101. package/dist/tools/txSend.js.map +1 -0
  102. package/dist/tools/vote.d.ts +4 -0
  103. package/dist/tools/vote.d.ts.map +1 -0
  104. package/dist/tools/vote.js +196 -0
  105. package/dist/tools/vote.js.map +1 -0
  106. package/dist/tools/voteBuild.d.ts +4 -0
  107. package/dist/tools/voteBuild.d.ts.map +1 -0
  108. package/dist/tools/voteBuild.js +983 -0
  109. package/dist/tools/voteBuild.js.map +1 -0
  110. package/package.json +18 -5
  111. package/PLAN.md +0 -132
@@ -0,0 +1,573 @@
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
+ import { PinataClient } from "../lib/ipfs.js";
8
+ /**
9
+ * Phase 5 — deploy a new DAO via `PoolFactory.deployGovPool(GovPoolDeployParams)`.
10
+ *
11
+ * The input struct is large and deeply nested. We load the PoolFactory ABI
12
+ * from the compiled Hardhat artifacts so encoding stays in lockstep with the
13
+ * on-chain contract — run `dexe_compile` before calling if artifacts are
14
+ * missing. Falls back to a hand-rolled tuple signature if artifacts are not
15
+ * available (the fallback is carefully matched to
16
+ * `contracts/interfaces/factory/IPoolFactory.sol`).
17
+ *
18
+ * VotePowerType enum: LINEAR_VOTES=0, POLYNOMIAL_VOTES=1, CUSTOM_VOTES=2.
19
+ */
20
+ const VOTE_POWER_TYPES = ["LINEAR_VOTES", "POLYNOMIAL_VOTES", "CUSTOM_VOTES"];
21
+ // ---- Vote power initializer ABIs (must match deployed contracts) ----
22
+ // LinearPower.__LinearPower_init() — no args, just triggers OwnableUpgradeable
23
+ const LINEAR_POWER_ABI = [
24
+ "function __LinearPower_init()",
25
+ ];
26
+ // PolynomialPower.__PolynomialPower_init(uint256,uint256,uint256)
27
+ const POLYNOMIAL_POWER_ABI = [
28
+ "function __PolynomialPower_init(uint256 coefficient1, uint256 coefficient2, uint256 coefficient3)",
29
+ ];
30
+ /**
31
+ * Encode the initData for the vote power proxy based on voteType.
32
+ * The PoolFactory calls `.call(initData)` on the deployed proxy during
33
+ * `_initGovPool` — if initData is empty (`0x`), the proxy is never
34
+ * initialized and downstream calls revert.
35
+ */
36
+ function encodeVotePowerInitData(voteType, polynomialCoefficients) {
37
+ if (voteType === "LINEAR_VOTES") {
38
+ const iface = new Interface(LINEAR_POWER_ABI);
39
+ return iface.encodeFunctionData("__LinearPower_init", []);
40
+ }
41
+ if (voteType === "POLYNOMIAL_VOTES") {
42
+ if (!polynomialCoefficients) {
43
+ throw new Error("POLYNOMIAL_VOTES requires polynomialCoefficients (coefficient1, coefficient2, coefficient3)");
44
+ }
45
+ const iface = new Interface(POLYNOMIAL_POWER_ABI);
46
+ return iface.encodeFunctionData("__PolynomialPower_init", [
47
+ BigInt(polynomialCoefficients.coefficient1),
48
+ BigInt(polynomialCoefficients.coefficient2),
49
+ BigInt(polynomialCoefficients.coefficient3),
50
+ ]);
51
+ }
52
+ // CUSTOM_VOTES: caller provides raw initData or 0x (contract skips the call)
53
+ return "0x";
54
+ }
55
+ const FALLBACK_POOL_FACTORY_ABI = [
56
+ "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)",
57
+ ];
58
+ // ---------- input schemas ----------
59
+ const RewardsInfoSchema = z.object({
60
+ rewardToken: z.string().describe("Reward token address (use ZERO_ADDR if no rewards)"),
61
+ creationReward: z.string().default("0").describe("18-decimal wei token amount"),
62
+ executionReward: z.string().default("0").describe("18-decimal wei token amount"),
63
+ voteRewardsCoefficient: z.string().default("0").describe("25-decimal wei percentage"),
64
+ });
65
+ const MainProposalSettingsSchema = z.object({
66
+ earlyCompletion: z.boolean(),
67
+ delegatedVotingAllowed: z.boolean().describe("Contract-inverted: true = DISABLE delegation, false = ALLOW"),
68
+ validatorsVote: z.boolean(),
69
+ duration: z.string().describe("Voting duration in seconds (e.g. \"86400\" for 1 day)"),
70
+ durationValidators: z.string().describe("Validator voting duration in seconds"),
71
+ executionDelay: z.string().default("0").describe("Delay before execution in seconds"),
72
+ quorum: z.string().describe("25-decimal wei percentage (50% = \"500000000000000000000000000\")"),
73
+ quorumValidators: z.string().describe("25-decimal wei percentage"),
74
+ minVotesForVoting: z.string().describe("18-decimal wei token amount"),
75
+ minVotesForCreating: z.string().describe("18-decimal wei token amount"),
76
+ rewardsInfo: RewardsInfoSchema,
77
+ executorDescription: z.string().default("").describe("IPFS CID of settings JSON (auto-uploaded when empty and DEXE_PINATA_JWT is set)"),
78
+ });
79
+ const SettingsDeployParamsSchema = z.object({
80
+ proposalSettings: z.array(MainProposalSettingsSchema).min(1).max(5),
81
+ additionalProposalExecutors: z.array(z.string()).default([]),
82
+ });
83
+ const ValidatorProposalSettingsSchema = z.object({
84
+ duration: z.string().describe("Validator voting duration in seconds"),
85
+ executionDelay: z.string().default("0").describe("Delay before execution in seconds"),
86
+ quorum: z.string().describe("25-decimal wei percentage"),
87
+ });
88
+ const ValidatorsDeployParamsSchema = z.object({
89
+ name: z.string(),
90
+ symbol: z.string(),
91
+ proposalSettings: ValidatorProposalSettingsSchema,
92
+ validators: z.array(z.string()).default([]),
93
+ balances: z.array(z.string()).default([]),
94
+ });
95
+ const UserKeeperDeployParamsSchema = z.object({
96
+ tokenAddress: z.string().default("0x0000000000000000000000000000000000000000").describe("Existing ERC20 governance token (auto-wired to predicted govToken when creating new token)"),
97
+ nftAddress: z.string().default("0x0000000000000000000000000000000000000000"),
98
+ individualPower: z.string().default("0").describe("18-decimal wei — voting power per NFT"),
99
+ nftsTotalSupply: z.string().default("0").describe("Total NFT collection size (plain integer)"),
100
+ });
101
+ const TokenParamsSchema = z.object({
102
+ name: z.string().default("").describe("Gov token name (non-empty triggers token creation)"),
103
+ symbol: z.string().default(""),
104
+ users: z.array(z.string()).default([]).describe("Initial token recipient addresses"),
105
+ cap: z.string().default("0").describe("18-decimal wei token cap"),
106
+ mintedTotal: z.string().default("0").describe("18-decimal wei total initial mint"),
107
+ amounts: z.array(z.string()).default([]).describe("18-decimal wei amounts per recipient"),
108
+ });
109
+ const PolynomialCoefficientsSchema = z.object({
110
+ coefficient1: z.string().describe("Expert delegation coefficient (18-decimal wei)"),
111
+ coefficient2: z.string().describe("Expert coefficient (18-decimal wei)"),
112
+ coefficient3: z.string().describe("Holder coefficient (18-decimal wei)"),
113
+ });
114
+ const VotePowerDeployParamsSchema = z.object({
115
+ voteType: z.enum(VOTE_POWER_TYPES),
116
+ /** Raw initData override — only used for CUSTOM_VOTES. For LINEAR/POLYNOMIAL
117
+ * the tool auto-encodes the correct initializer calldata. */
118
+ initData: z.string().optional().describe("Raw hex initData — only for CUSTOM_VOTES. LINEAR/POLYNOMIAL are auto-encoded."),
119
+ presetAddress: z.string().default("0x0000000000000000000000000000000000000000"),
120
+ /** Required when voteType is POLYNOMIAL_VOTES. */
121
+ polynomialCoefficients: PolynomialCoefficientsSchema.optional().describe("Required for POLYNOMIAL_VOTES: the three curve coefficients (18-decimal wei strings)"),
122
+ });
123
+ // ---------- register ----------
124
+ export function registerDaoDeployTools(server, ctx) {
125
+ const rpc = new RpcProvider(ctx.config);
126
+ registerBuildDeploy(server, ctx, rpc);
127
+ }
128
+ function errorResult(message) {
129
+ return { content: [{ type: "text", text: message }], isError: true };
130
+ }
131
+ function payloadResult(payload, extra) {
132
+ const lines = [
133
+ payload.description,
134
+ ` to : ${payload.to}`,
135
+ ` value: ${payload.value}`,
136
+ ` data : ${payload.data.slice(0, 66)}…`,
137
+ ];
138
+ if (extra?.predictedGovPool)
139
+ lines.push(` predicted govPool: ${extra.predictedGovPool}`);
140
+ if (extra?.note)
141
+ lines.push(`\n${extra.note}`);
142
+ return {
143
+ content: [{ type: "text", text: lines.join("\n") }],
144
+ structuredContent: {
145
+ payload: { ...payload },
146
+ predictedGovPool: extra?.predictedGovPool ?? null,
147
+ },
148
+ };
149
+ }
150
+ function payloadOutputSchema() {
151
+ return {
152
+ payload: z.object({
153
+ to: z.string(),
154
+ data: z.string(),
155
+ value: z.string(),
156
+ chainId: z.number(),
157
+ description: z.string(),
158
+ }),
159
+ predictedGovPool: z.string().nullable(),
160
+ };
161
+ }
162
+ // ---------- dexe_dao_build_deploy ----------
163
+ function registerBuildDeploy(server, ctx, rpc) {
164
+ server.registerTool("dexe_dao_build_deploy", {
165
+ title: "Build calldata to deploy a new DAO (PoolFactory.deployGovPool)",
166
+ description: "Builds the `PoolFactory.deployGovPool(GovPoolDeployParams)` tx. Mirrors the frontend wizard at app.dexe.network/create-dao.\n\n" +
167
+ "**Proposal settings auto-expand:** Pass 1 setting → auto-expands to 5 (default, internal, validators, distributionProposal, tokenSale). " +
168
+ "DPSettings (index 3) forces `delegatedVotingAllowed: false` and `earlyCompletion: false`. Pass exactly 5 to override.\n\n" +
169
+ "**delegatedVotingAllowed inversion:** Contract semantics are inverted — pass `true` to DISABLE delegation, `false` to ALLOW it (matches frontend behavior).\n\n" +
170
+ "**Vote power initData:** Automatically encoded — do NOT pass `initData` for LINEAR or POLYNOMIAL types. " +
171
+ "For LINEAR_VOTES: auto-encodes `__LinearPower_init()`. " +
172
+ "For POLYNOMIAL_VOTES: auto-encodes `__PolynomialPower_init(c1,c2,c3)` — pass `polynomialCoefficients`. " +
173
+ "For CUSTOM_VOTES: pass `initData` manually (or omit if the custom contract skips init).\n\n" +
174
+ "**Predicted addresses:** `deployer` is always required. Tool calls `predictGovAddresses` and auto-wires: " +
175
+ "(1) `govToken` → `userKeeperParams.tokenAddress` when creating token, " +
176
+ "(2) `distributionProposal` + `govTokenSale` → `additionalProposalExecutors` always.\n\n" +
177
+ "**Validators defaults:** When no validators needed, omit `validatorsParams` — defaults to name='Validator Token', symbol='VT', empty list. " +
178
+ "`durationValidators`/`quorumValidators` in proposal settings fall back to `duration`/`quorum` when no validators.\n\n" +
179
+ "**Decimal conventions (must match frontend):**\n" +
180
+ "- `quorum`, `quorumValidators`, `voteRewardsCoefficient`: 25-decimal wei. 50% = `\"500000000000000000000000000\"` (50 × 10^25).\n" +
181
+ "- `minVotesForVoting`, `minVotesForCreating`, `creationReward`, `executionReward`, token `cap`/`mintedTotal`/`amounts`, `individualPower`: 18-decimal wei. 100 tokens = `\"100000000000000000000\"` (100 × 10^18).\n" +
182
+ "- `duration`, `durationValidators`, `executionDelay`: plain seconds as string. 1 day = `\"86400\"`.\n" +
183
+ "- `polynomialCoefficients` (coefficient1/2/3): 25-decimal wei.\n\n" +
184
+ "**executorDescription auto-upload:** When `DEXE_PINATA_JWT` is configured and `executorDescription` is empty, " +
185
+ "the tool auto-uploads proposal settings JSON to IPFS and sets the CID (matching frontend behavior). " +
186
+ "Without this, the DAO's proposal settings won't display correctly in the frontend UI.\n\n" +
187
+ "Prefer running `dexe_compile` first for strict ABI parity.",
188
+ inputSchema: {
189
+ poolFactory: z
190
+ .string()
191
+ .optional()
192
+ .describe("PoolFactory address override; defaults to ContractsRegistry lookup"),
193
+ deployer: z
194
+ .string()
195
+ .describe("tx.origin that will send the deploy tx — required for address prediction"),
196
+ params: z.object({
197
+ settingsParams: SettingsDeployParamsSchema,
198
+ validatorsParams: ValidatorsDeployParamsSchema.optional(),
199
+ userKeeperParams: UserKeeperDeployParamsSchema,
200
+ tokenParams: TokenParamsSchema,
201
+ votePowerParams: VotePowerDeployParamsSchema,
202
+ verifier: z.string().default("0x0000000000000000000000000000000000000000"),
203
+ onlyBABTHolders: z.boolean().default(false),
204
+ descriptionURL: z.string().describe("ipfs://<cid> of DAO metadata JSON"),
205
+ name: z.string().min(1),
206
+ }),
207
+ },
208
+ outputSchema: payloadOutputSchema(),
209
+ }, async ({ poolFactory, deployer, params }) => {
210
+ const isTokenCreation = params.tokenParams.name.length > 0;
211
+ const hasValidators = !!(params.validatorsParams && params.validatorsParams.validators.length > 0);
212
+ // ---------- auto-encode vote power initData ----------
213
+ let votePowerInitData;
214
+ try {
215
+ if (params.votePowerParams.voteType === "CUSTOM_VOTES") {
216
+ // CUSTOM_VOTES: use caller-provided initData (contract skips .call for custom)
217
+ votePowerInitData = params.votePowerParams.initData ?? "0x";
218
+ }
219
+ else {
220
+ // LINEAR / POLYNOMIAL: auto-encode the correct initializer
221
+ votePowerInitData = encodeVotePowerInitData(params.votePowerParams.voteType, params.votePowerParams.polynomialCoefficients);
222
+ }
223
+ }
224
+ catch (err) {
225
+ return errorResult(`Failed to encode vote power initData: ${err instanceof Error ? err.message : String(err)}`);
226
+ }
227
+ // ---------- default validatorsParams when omitted ----------
228
+ const VT_SUFFIX = "-VT";
229
+ const rawValidatorsParams = params.validatorsParams ?? {
230
+ name: "Validator Token",
231
+ symbol: "VT",
232
+ proposalSettings: {
233
+ duration: params.settingsParams.proposalSettings[0].duration,
234
+ executionDelay: params.settingsParams.proposalSettings[0].executionDelay,
235
+ quorum: params.settingsParams.proposalSettings[0].quorum,
236
+ },
237
+ validators: [],
238
+ balances: [],
239
+ };
240
+ // Bug #11: Frontend appends "-VT" suffix to validator token name and symbol.
241
+ // The form UI always stores name/symbol with the suffix already included.
242
+ // Replicate that here: if the suffix isn't already present, append it.
243
+ const validatorsParams = {
244
+ ...rawValidatorsParams,
245
+ name: rawValidatorsParams.name.endsWith(VT_SUFFIX)
246
+ ? rawValidatorsParams.name
247
+ : rawValidatorsParams.name + VT_SUFFIX,
248
+ symbol: rawValidatorsParams.symbol.endsWith(VT_SUFFIX)
249
+ ? rawValidatorsParams.symbol
250
+ : rawValidatorsParams.symbol + VT_SUFFIX,
251
+ };
252
+ // ---------- validate leaf addresses ----------
253
+ if (poolFactory && !isAddress(poolFactory))
254
+ return errorResult(`Invalid poolFactory: ${poolFactory}`);
255
+ if (!isAddress(deployer))
256
+ return errorResult(`Invalid deployer: ${deployer}`);
257
+ if (isTokenCreation && params.tokenParams.users.length === 0)
258
+ return errorResult("tokenParams.users must have at least one recipient when creating a new token");
259
+ if (!isAddress(params.verifier))
260
+ return errorResult(`Invalid verifier: ${params.verifier}`);
261
+ if (!isAddress(params.userKeeperParams.tokenAddress))
262
+ return errorResult(`Invalid userKeeperParams.tokenAddress`);
263
+ if (!isAddress(params.userKeeperParams.nftAddress))
264
+ return errorResult(`Invalid userKeeperParams.nftAddress`);
265
+ if (!isAddress(params.votePowerParams.presetAddress))
266
+ return errorResult(`Invalid votePowerParams.presetAddress`);
267
+ for (const v of validatorsParams.validators) {
268
+ if (!isAddress(v))
269
+ return errorResult(`Invalid validator: ${v}`);
270
+ }
271
+ if (validatorsParams.validators.length !== validatorsParams.balances.length) {
272
+ return errorResult("validatorsParams.validators and .balances must be the same length");
273
+ }
274
+ for (const u of params.tokenParams.users) {
275
+ if (!isAddress(u))
276
+ return errorResult(`Invalid tokenParams.users entry: ${u}`);
277
+ }
278
+ if (params.tokenParams.users.length !== params.tokenParams.amounts.length) {
279
+ return errorResult("tokenParams.users and .amounts must be the same length");
280
+ }
281
+ // ---------- resolve PoolFactory address ----------
282
+ let factoryAddress = poolFactory;
283
+ if (!factoryAddress) {
284
+ try {
285
+ const provider = rpc.requireProvider();
286
+ const book = new AddressBook({
287
+ provider,
288
+ chainId: ctx.config.chainId,
289
+ registryOverride: ctx.config.registryOverride,
290
+ });
291
+ factoryAddress = await book.resolve(CONTRACT_NAMES.POOL_FACTORY);
292
+ }
293
+ catch (err) {
294
+ 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)})`);
295
+ }
296
+ }
297
+ // ---------- predict addresses (always required — wires executors) ----------
298
+ let predictedGovPool;
299
+ let predictedGovToken;
300
+ let predictedDistribution;
301
+ let predictedTokenSale;
302
+ try {
303
+ const provider = rpc.requireProvider();
304
+ const predictIface = new Interface([
305
+ "function predictGovAddresses(address deployer, string poolName) view returns (tuple(address govPool, address govTokenSale, address govToken, address distributionProposal, address expertNft, address nftMultiplier))",
306
+ ]);
307
+ const { Contract } = await import("ethers");
308
+ const factory = new Contract(factoryAddress, predictIface, provider);
309
+ const res = await factory.getFunction("predictGovAddresses").staticCall(deployer, params.name);
310
+ predictedGovPool = res.govPool;
311
+ predictedGovToken = res.govToken;
312
+ predictedDistribution = res.distributionProposal;
313
+ predictedTokenSale = res.govTokenSale;
314
+ }
315
+ catch (err) {
316
+ return errorResult(`Failed to predict gov addresses: ${err instanceof Error ? err.message : String(err)}`);
317
+ }
318
+ const ZERO = "0x0000000000000000000000000000000000000000";
319
+ // Wire predicted govToken into userKeeperParams when creating a new token
320
+ const effectiveTokenAddress = isTokenCreation && predictedGovToken
321
+ ? predictedGovToken
322
+ : params.userKeeperParams.tokenAddress;
323
+ // Bug #12: When "use governance token for rewards" is checked, the frontend
324
+ // sets rewardToken to the predicted govToken address. When creating a new
325
+ // token, the address isn't known at input time, so callers pass ZERO_ADDR.
326
+ // Detect this case: rewardToken is zero BUT reward amounts are non-zero
327
+ // → substitute the predicted govToken address (matching frontend behavior).
328
+ if (isTokenCreation && predictedGovToken) {
329
+ const hasRewardAmounts = (r) => BigInt(r.creationReward) > 0n || BigInt(r.executionReward) > 0n || BigInt(r.voteRewardsCoefficient) > 0n;
330
+ for (const s of params.settingsParams.proposalSettings) {
331
+ if ((s.rewardsInfo.rewardToken === ZERO || s.rewardsInfo.rewardToken === "") &&
332
+ hasRewardAmounts(s.rewardsInfo)) {
333
+ s.rewardsInfo.rewardToken = predictedGovToken;
334
+ }
335
+ }
336
+ }
337
+ // Always wire predicted distribution + tokenSale into additionalProposalExecutors
338
+ const effectiveExecutors = [...params.settingsParams.additionalProposalExecutors];
339
+ if (predictedDistribution && !effectiveExecutors.includes(predictedDistribution))
340
+ effectiveExecutors.push(predictedDistribution);
341
+ if (predictedTokenSale && !effectiveExecutors.includes(predictedTokenSale))
342
+ effectiveExecutors.push(predictedTokenSale);
343
+ // Validate: after wiring, at least one governance asset must be non-zero
344
+ if (effectiveTokenAddress === ZERO && params.userKeeperParams.nftAddress === ZERO) {
345
+ return errorResult("GovUK requires at least one governance asset: set userKeeperParams.tokenAddress (existing ERC20), userKeeperParams.nftAddress (existing ERC721), or provide tokenParams.name to create a new token");
346
+ }
347
+ // ---------- auto-expand proposal settings (1 → 5) ----------
348
+ let expandedSettings = params.settingsParams.proposalSettings;
349
+ if (expandedSettings.length === 1) {
350
+ const base = expandedSettings[0];
351
+ const baseWithValidatorFallback = {
352
+ ...base,
353
+ validatorsVote: true,
354
+ durationValidators: hasValidators ? base.durationValidators : base.duration,
355
+ quorumValidators: hasValidators ? base.quorumValidators : base.quorum,
356
+ };
357
+ const dpSettings = {
358
+ ...baseWithValidatorFallback,
359
+ delegatedVotingAllowed: false,
360
+ earlyCompletion: false,
361
+ };
362
+ expandedSettings = [
363
+ baseWithValidatorFallback, // [0] default
364
+ baseWithValidatorFallback, // [1] internal
365
+ baseWithValidatorFallback, // [2] validators
366
+ dpSettings, // [3] distributionProposal
367
+ baseWithValidatorFallback, // [4] tokenSale
368
+ ];
369
+ }
370
+ else if (expandedSettings.length !== 5) {
371
+ return errorResult(`proposalSettings must be 1 (auto-expand to 5) or exactly 5. Got ${expandedSettings.length}.`);
372
+ }
373
+ // ---------- auto-upload executorDescription to IPFS (when Pinata configured) ----------
374
+ // The frontend uploads each proposal settings object as JSON to IPFS and stores
375
+ // the CID as `executorDescription`. Without this, DAOs display broken metadata in
376
+ // the UI. We replicate the frontend's behavior: for each settings slot, if
377
+ // executorDescription is empty and Pinata is available, upload the settings JSON
378
+ // and set executorDescription = "ipfs://<cid>".
379
+ //
380
+ // The uploaded JSON shape matches the frontend exactly:
381
+ // { earlyCompletion, delegatedVotingAllowed, validatorsVote, duration, durationValidators,
382
+ // quorum, quorumValidators, minVotesForVoting, minVotesForCreating, executionDelay,
383
+ // rewardsInfo: { rewardToken, creationReward, executionReward, voteRewardsCoefficient } }
384
+ let pinataWarning = "";
385
+ if (ctx.config.pinataJwt) {
386
+ const pinata = new PinataClient(ctx.config.pinataJwt);
387
+ // We only auto-upload for default (index 0) and DP (index 3) settings,
388
+ // matching the frontend which shares the same CID across default/internal/validators/tokenSale
389
+ // and a separate CID for DP settings.
390
+ const settingsToUpload = [
391
+ { index: 0, label: "default" },
392
+ { index: 3, label: "distributionProposal" },
393
+ ];
394
+ for (const { index, label } of settingsToUpload) {
395
+ const s = expandedSettings[index];
396
+ if (!s.executorDescription || s.executorDescription === "") {
397
+ try {
398
+ // Bug #13: Frontend includes minVotesForReadProposalDiscussion and
399
+ // minVotesForCreatingComment in the settings JSON uploaded to IPFS.
400
+ // Defaults from frontend: 0 (read) and 1e18 (comment = 1 token).
401
+ const settingsJson = {
402
+ earlyCompletion: s.earlyCompletion,
403
+ delegatedVotingAllowed: s.delegatedVotingAllowed,
404
+ validatorsVote: s.validatorsVote,
405
+ duration: s.duration,
406
+ durationValidators: s.durationValidators,
407
+ quorum: s.quorum,
408
+ quorumValidators: s.quorumValidators,
409
+ minVotesForVoting: s.minVotesForVoting,
410
+ minVotesForCreating: s.minVotesForCreating,
411
+ executionDelay: s.executionDelay,
412
+ rewardsInfo: {
413
+ rewardToken: s.rewardsInfo.rewardToken,
414
+ creationReward: s.rewardsInfo.creationReward,
415
+ executionReward: s.rewardsInfo.executionReward,
416
+ voteRewardsCoefficient: s.rewardsInfo.voteRewardsCoefficient,
417
+ },
418
+ minVotesForReadProposalDiscussion: "0",
419
+ minVotesForCreatingComment: "1000000000000000000",
420
+ };
421
+ const res = await pinata.pinJson(settingsJson, {
422
+ name: `dao-settings-${label}:${params.name.slice(0, 40)}`,
423
+ });
424
+ const cid = `ipfs://${res.cid}`;
425
+ // Apply the CID to the relevant slots (frontend shares CIDs across slots)
426
+ if (index === 0) {
427
+ // Default CID shared across: default(0), internal(1), validators(2), tokenSale(4)
428
+ expandedSettings[0] = { ...expandedSettings[0], executorDescription: cid };
429
+ expandedSettings[1] = { ...expandedSettings[1], executorDescription: cid };
430
+ expandedSettings[2] = { ...expandedSettings[2], executorDescription: cid };
431
+ expandedSettings[4] = { ...expandedSettings[4], executorDescription: cid };
432
+ }
433
+ else {
434
+ // DP settings get their own CID
435
+ expandedSettings[3] = { ...expandedSettings[3], executorDescription: cid };
436
+ }
437
+ }
438
+ catch (err) {
439
+ pinataWarning += `\n⚠️ Failed to upload ${label} executorDescription: ${err instanceof Error ? err.message : String(err)}`;
440
+ }
441
+ }
442
+ }
443
+ }
444
+ else {
445
+ // Check if any executorDescription is missing — warn about UI impact
446
+ const missingDesc = expandedSettings.some((s) => !s.executorDescription || s.executorDescription === "");
447
+ if (missingDesc) {
448
+ pinataWarning =
449
+ "\n⚠️ DEXE_PINATA_JWT not configured — executorDescription fields are empty. " +
450
+ "DAOs created without executorDescription will display broken proposal settings in the frontend UI. " +
451
+ "Set DEXE_PINATA_JWT to enable auto-upload.";
452
+ }
453
+ }
454
+ // ---------- build the tuple arg ----------
455
+ const paramsTuple = [
456
+ // settingsParams
457
+ [
458
+ expandedSettings.map((s) => [
459
+ s.earlyCompletion,
460
+ s.delegatedVotingAllowed,
461
+ s.validatorsVote,
462
+ BigInt(s.duration),
463
+ BigInt(s.durationValidators),
464
+ BigInt(s.executionDelay),
465
+ BigInt(s.quorum),
466
+ BigInt(s.quorumValidators),
467
+ BigInt(s.minVotesForVoting),
468
+ BigInt(s.minVotesForCreating),
469
+ [
470
+ s.rewardsInfo.rewardToken,
471
+ BigInt(s.rewardsInfo.creationReward),
472
+ BigInt(s.rewardsInfo.executionReward),
473
+ BigInt(s.rewardsInfo.voteRewardsCoefficient),
474
+ ],
475
+ s.executorDescription,
476
+ ]),
477
+ effectiveExecutors,
478
+ ],
479
+ // validatorsParams
480
+ [
481
+ validatorsParams.name,
482
+ validatorsParams.symbol,
483
+ [
484
+ BigInt(validatorsParams.proposalSettings.duration),
485
+ BigInt(validatorsParams.proposalSettings.executionDelay),
486
+ BigInt(validatorsParams.proposalSettings.quorum),
487
+ ],
488
+ validatorsParams.validators,
489
+ validatorsParams.balances.map((b) => BigInt(b)),
490
+ ],
491
+ // userKeeperParams
492
+ [
493
+ effectiveTokenAddress,
494
+ params.userKeeperParams.nftAddress,
495
+ BigInt(params.userKeeperParams.individualPower),
496
+ BigInt(params.userKeeperParams.nftsTotalSupply),
497
+ ],
498
+ // tokenParams
499
+ [
500
+ params.tokenParams.name,
501
+ params.tokenParams.symbol,
502
+ params.tokenParams.users,
503
+ BigInt(params.tokenParams.cap),
504
+ BigInt(params.tokenParams.mintedTotal),
505
+ params.tokenParams.amounts.map((a) => BigInt(a)),
506
+ ],
507
+ // votePowerParams
508
+ [
509
+ VOTE_POWER_TYPES.indexOf(params.votePowerParams.voteType), // uint8 enum
510
+ votePowerInitData,
511
+ params.votePowerParams.presetAddress,
512
+ ],
513
+ params.verifier,
514
+ params.onlyBABTHolders,
515
+ params.descriptionURL.replace(/^ipfs:\/\//, ""),
516
+ params.name,
517
+ ];
518
+ // ---------- get ABI (artifact > fallback) ----------
519
+ let iface;
520
+ let ifaceSource;
521
+ try {
522
+ const records = ctx.artifacts.get("PoolFactory");
523
+ if (records.length > 0) {
524
+ iface = new Interface(records[0].abi);
525
+ ifaceSource = "compiled artifact";
526
+ // Sanity: ensure it has deployGovPool
527
+ try {
528
+ iface.getFunction("deployGovPool");
529
+ }
530
+ catch {
531
+ iface = new Interface(FALLBACK_POOL_FACTORY_ABI);
532
+ ifaceSource = "fallback (compiled artifact missing deployGovPool)";
533
+ }
534
+ }
535
+ else {
536
+ iface = new Interface(FALLBACK_POOL_FACTORY_ABI);
537
+ ifaceSource = "fallback (artifacts not loaded — run dexe_compile for strict parity)";
538
+ }
539
+ }
540
+ catch (err) {
541
+ if (err instanceof ArtifactsMissingError) {
542
+ iface = new Interface(FALLBACK_POOL_FACTORY_ABI);
543
+ ifaceSource = "fallback (no artifacts — run dexe_compile for strict parity)";
544
+ }
545
+ else {
546
+ return errorResult(`Failed to load PoolFactory ABI: ${err instanceof Error ? err.message : String(err)}`);
547
+ }
548
+ }
549
+ // ---------- encode ----------
550
+ let payload;
551
+ try {
552
+ payload = buildPayload({
553
+ to: factoryAddress,
554
+ iface,
555
+ method: "deployGovPool",
556
+ args: [paramsTuple],
557
+ chainId: ctx.config.chainId,
558
+ contractLabel: "PoolFactory",
559
+ description: `PoolFactory.deployGovPool("${params.name}") via ${ifaceSource}`,
560
+ });
561
+ }
562
+ catch (err) {
563
+ return errorResult(`deployGovPool encoding failed: ${err instanceof Error ? err.message : String(err)}`);
564
+ }
565
+ let note = ifaceSource.includes("fallback")
566
+ ? "⚠️ Using fallback tuple ABI. For guaranteed parity, run dexe_compile to populate artifacts."
567
+ : "Encoded against compiled artifact — strict parity with deployed PoolFactory.";
568
+ if (pinataWarning)
569
+ note += pinataWarning;
570
+ return payloadResult(payload, { predictedGovPool, note });
571
+ });
572
+ }
573
+ //# 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,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;GAWG;AAEH,MAAM,gBAAgB,GAAG,CAAC,cAAc,EAAE,kBAAkB,EAAE,cAAc,CAAU,CAAC;AAEvF,wEAAwE;AACxE,+EAA+E;AAC/E,MAAM,gBAAgB,GAAG;IACvB,+BAA+B;CACvB,CAAC;AAEX,kEAAkE;AAClE,MAAM,oBAAoB,GAAG;IAC3B,mGAAmG;CAC3F,CAAC;AAEX;;;;;GAKG;AACH,SAAS,uBAAuB,CAC9B,QAA2C,EAC3C,sBAA6F;IAE7F,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,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,CAAC;iBAAM,CAAC;gBACN,OAAO,WAAW,CAChB,mCAAmC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACtF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,+BAA+B;QAC/B,IAAI,OAAkB,CAAC;QACvB,IAAI,CAAC;YACH,OAAO,GAAG,YAAY,CAAC;gBACrB,EAAE,EAAE,cAAc;gBAClB,KAAK;gBACL,MAAM,EAAE,eAAe;gBACvB,IAAI,EAAE,CAAC,WAAW,CAAC;gBACnB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO;gBAC3B,aAAa,EAAE,aAAa;gBAC5B,WAAW,EAAE,8BAA8B,MAAM,CAAC,IAAI,UAAU,WAAW,EAAE;aAC9E,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAChB,kCAAkC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACrF,CAAC;QACJ,CAAC;QAED,IAAI,IAAI,GACN,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC9B,CAAC,CAAC,8FAA8F;YAChG,CAAC,CAAC,8EAA8E,CAAC;QACrF,IAAI,aAAa;YAAE,IAAI,IAAI,aAAa,CAAC;QAEzC,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { ToolContext } from "./context.js";
3
+ import { SignerManager } from "../lib/signer.js";
4
+ export declare function registerFlowTools(server: McpServer, ctx: ToolContext, signer: SignerManager): void;
5
+ //# sourceMappingURL=flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../src/tools/flow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAkLjD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,aAAa,GACpB,IAAI,CAkYN"}