dexe-mcp 0.5.8 → 0.7.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 (91) hide show
  1. package/CHANGELOG.md +707 -536
  2. package/README.md +291 -270
  3. package/SECURITY.md +100 -46
  4. package/dist/config.d.ts +19 -0
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +79 -0
  7. package/dist/config.js.map +1 -1
  8. package/dist/governor/adapter.d.ts +90 -0
  9. package/dist/governor/adapter.d.ts.map +1 -0
  10. package/dist/governor/adapter.js +169 -0
  11. package/dist/governor/adapter.js.map +1 -0
  12. package/dist/governor/configs/compound.json +32 -0
  13. package/dist/governor/configs/optimism.json +28 -0
  14. package/dist/governor/configs/uniswap.json +32 -0
  15. package/dist/governor/encoder.d.ts +59 -0
  16. package/dist/governor/encoder.d.ts.map +1 -0
  17. package/dist/governor/encoder.js +290 -0
  18. package/dist/governor/encoder.js.map +1 -0
  19. package/dist/governor/index.d.ts +11 -0
  20. package/dist/governor/index.d.ts.map +1 -0
  21. package/dist/governor/index.js +20 -0
  22. package/dist/governor/index.js.map +1 -0
  23. package/dist/governor/loader.d.ts +42 -0
  24. package/dist/governor/loader.d.ts.map +1 -0
  25. package/dist/governor/loader.js +103 -0
  26. package/dist/governor/loader.js.map +1 -0
  27. package/dist/governor/tally.d.ts +48 -0
  28. package/dist/governor/tally.d.ts.map +1 -0
  29. package/dist/governor/tally.js +103 -0
  30. package/dist/governor/tally.js.map +1 -0
  31. package/dist/governor/tools/build.d.ts +3 -0
  32. package/dist/governor/tools/build.d.ts.map +1 -0
  33. package/dist/governor/tools/build.js +137 -0
  34. package/dist/governor/tools/build.js.map +1 -0
  35. package/dist/governor/tools/extras.d.ts +4 -0
  36. package/dist/governor/tools/extras.d.ts.map +1 -0
  37. package/dist/governor/tools/extras.js +197 -0
  38. package/dist/governor/tools/extras.js.map +1 -0
  39. package/dist/governor/tools/read.d.ts +4 -0
  40. package/dist/governor/tools/read.d.ts.map +1 -0
  41. package/dist/governor/tools/read.js +174 -0
  42. package/dist/governor/tools/read.js.map +1 -0
  43. package/dist/governor/tools/simulate.d.ts +6 -0
  44. package/dist/governor/tools/simulate.d.ts.map +1 -0
  45. package/dist/governor/tools/simulate.js +191 -0
  46. package/dist/governor/tools/simulate.js.map +1 -0
  47. package/dist/lib/broadcastGuards.d.ts +41 -0
  48. package/dist/lib/broadcastGuards.d.ts.map +1 -0
  49. package/dist/lib/broadcastGuards.js +85 -0
  50. package/dist/lib/broadcastGuards.js.map +1 -0
  51. package/dist/lib/ethersProvider.d.ts +96 -0
  52. package/dist/lib/ethersProvider.d.ts.map +1 -0
  53. package/dist/lib/ethersProvider.js +170 -0
  54. package/dist/lib/ethersProvider.js.map +1 -0
  55. package/dist/lib/signer.d.ts +2 -0
  56. package/dist/lib/signer.d.ts.map +1 -1
  57. package/dist/lib/signer.js +4 -0
  58. package/dist/lib/signer.js.map +1 -1
  59. package/dist/lib/walletconnect.d.ts +62 -0
  60. package/dist/lib/walletconnect.d.ts.map +1 -0
  61. package/dist/lib/walletconnect.js +184 -0
  62. package/dist/lib/walletconnect.js.map +1 -0
  63. package/dist/tools/flow.d.ts.map +1 -1
  64. package/dist/tools/flow.js +13 -0
  65. package/dist/tools/flow.js.map +1 -1
  66. package/dist/tools/getConfig.d.ts.map +1 -1
  67. package/dist/tools/getConfig.js +27 -0
  68. package/dist/tools/getConfig.js.map +1 -1
  69. package/dist/tools/inbox.js +8 -8
  70. package/dist/tools/index.d.ts.map +1 -1
  71. package/dist/tools/index.js +11 -1
  72. package/dist/tools/index.js.map +1 -1
  73. package/dist/tools/predict.js +17 -17
  74. package/dist/tools/safe.d.ts +5 -0
  75. package/dist/tools/safe.d.ts.map +1 -0
  76. package/dist/tools/safe.js +264 -0
  77. package/dist/tools/safe.js.map +1 -0
  78. package/dist/tools/simulate.d.ts +7 -0
  79. package/dist/tools/simulate.d.ts.map +1 -1
  80. package/dist/tools/simulate.js +8 -0
  81. package/dist/tools/simulate.js.map +1 -1
  82. package/dist/tools/subgraph.js +162 -162
  83. package/dist/tools/txSend.d.ts +2 -1
  84. package/dist/tools/txSend.d.ts.map +1 -1
  85. package/dist/tools/txSend.js +111 -3
  86. package/dist/tools/txSend.js.map +1 -1
  87. package/dist/tools/walletconnectStatus.d.ts +18 -0
  88. package/dist/tools/walletconnectStatus.d.ts.map +1 -0
  89. package/dist/tools/walletconnectStatus.js +132 -0
  90. package/dist/tools/walletconnectStatus.js.map +1 -0
  91. package/package.json +96 -92
@@ -0,0 +1,174 @@
1
+ import { z } from "zod";
2
+ import { isAddress } from "ethers";
3
+ import { governorContract, votesContract, readProposal, readQuorum, readVotingPower, } from "../adapter.js";
4
+ import { loadGovernorConfigs, resolveGovernor } from "../loader.js";
5
+ function ok(data) {
6
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
7
+ }
8
+ function err(message) {
9
+ return { content: [{ type: "text", text: message }], isError: true };
10
+ }
11
+ const governorIdSchema = z
12
+ .string()
13
+ .min(1)
14
+ .describe("Governor id (e.g. 'uniswap') or 0x-prefixed governor contract address.");
15
+ const addressArg = (desc) => z.string().refine((s) => isAddress(s), { message: "must be a 0x-prefixed 20-byte address" }).describe(desc);
16
+ const proposalIdArg = (desc) => z
17
+ .string()
18
+ .refine((s) => {
19
+ try {
20
+ BigInt(s);
21
+ return true;
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ }, { message: "must be a uint256 (decimal or 0x-hex) string" })
27
+ .describe(desc);
28
+ export function registerGovernorReadTools(server, rpc) {
29
+ registerListGovernors(server);
30
+ registerGetProposal(server, rpc);
31
+ registerGetVotingPower(server, rpc);
32
+ registerGetQuorum(server, rpc);
33
+ registerGetProposalThreshold(server, rpc);
34
+ }
35
+ function registerListGovernors(server) {
36
+ server.registerTool("dexe_gov_list_governors", {
37
+ title: "List configured external Governor DAOs",
38
+ description: "Returns all DAOs registered under src/governor/configs/. Each entry is the static config (chainId, governor address, voting token, voting params, timelock). Read-only, no RPC.",
39
+ inputSchema: {},
40
+ }, async () => {
41
+ try {
42
+ const all = [...loadGovernorConfigs().values()];
43
+ return ok(all);
44
+ }
45
+ catch (e) {
46
+ return err(`failed to load governor configs: ${e.message}`);
47
+ }
48
+ });
49
+ }
50
+ function registerGetProposal(server, rpc) {
51
+ server.registerTool("dexe_gov_get_proposal", {
52
+ title: "Read OpenZeppelin Governor proposal state + tallies",
53
+ description: "Returns ProposalState (string + numeric enum), proposalSnapshot block, proposalDeadline block, and proposalVotes (for/against/abstain) for the given proposalId on a configured Governor.",
54
+ inputSchema: {
55
+ governor: governorIdSchema,
56
+ proposalId: proposalIdArg("Proposal id as decimal string (Governor uses uint256, often the bytes32 keccak hash interpreted as uint256)."),
57
+ },
58
+ }, async ({ governor, proposalId }) => {
59
+ try {
60
+ const cfg = resolveGovernor(governor);
61
+ const provider = rpc.requireProvider(cfg.chainId);
62
+ const c = governorContract(provider, cfg);
63
+ const pid = BigInt(proposalId);
64
+ const readout = await readProposal(c, cfg, pid);
65
+ return ok({
66
+ governor: cfg.id,
67
+ governorAddress: cfg.governorAddress,
68
+ chainId: cfg.chainId,
69
+ governorVersion: cfg.governorVersion,
70
+ proposalId,
71
+ ...readout,
72
+ });
73
+ }
74
+ catch (e) {
75
+ return err(`dexe_gov_get_proposal failed: ${e.message}`);
76
+ }
77
+ });
78
+ }
79
+ function registerGetVotingPower(server, rpc) {
80
+ server.registerTool("dexe_gov_get_voting_power", {
81
+ title: "Read IVotes voting power for an account",
82
+ description: "Calls IVotes.getPastVotes(account, blockNumber) on the configured Governor's voting token. Falls back to IVotes.getVotes(account) when blockNumber is omitted. Decimals reported alongside raw wei value.",
83
+ inputSchema: {
84
+ governor: governorIdSchema,
85
+ account: addressArg("0x-prefixed account address."),
86
+ blockNumber: z
87
+ .number()
88
+ .int()
89
+ .nonnegative()
90
+ .optional()
91
+ .describe("Snapshot block. When omitted, current voting power via getVotes(account) is returned."),
92
+ },
93
+ }, async ({ governor, account, blockNumber }) => {
94
+ try {
95
+ const cfg = resolveGovernor(governor);
96
+ const provider = rpc.requireProvider(cfg.chainId);
97
+ const c = votesContract(provider, cfg);
98
+ const { power, method } = await readVotingPower(c, cfg, account, blockNumber);
99
+ return ok({
100
+ governor: cfg.id,
101
+ account,
102
+ blockNumber: blockNumber ?? "latest",
103
+ votingToken: cfg.votingToken,
104
+ votingPower: { raw: power.toString(), decimals: cfg.votingToken.decimals },
105
+ method,
106
+ });
107
+ }
108
+ catch (e) {
109
+ return err(`dexe_gov_get_voting_power failed: ${e.message}`);
110
+ }
111
+ });
112
+ }
113
+ function registerGetQuorum(server, rpc) {
114
+ server.registerTool("dexe_gov_get_quorum", {
115
+ title: "Read Governor quorum threshold at a snapshot block",
116
+ description: "Calls Governor.quorum(blockNumber). When blockNumber is omitted, uses the latest block. Also returns the config-derived quorumNumerator/quorumDenominator for cross-check.",
117
+ inputSchema: {
118
+ governor: governorIdSchema,
119
+ blockNumber: z
120
+ .number()
121
+ .int()
122
+ .nonnegative()
123
+ .optional()
124
+ .describe("Snapshot block; latest when omitted."),
125
+ },
126
+ }, async ({ governor, blockNumber }) => {
127
+ try {
128
+ const cfg = resolveGovernor(governor);
129
+ const provider = rpc.requireProvider(cfg.chainId);
130
+ const c = governorContract(provider, cfg);
131
+ const block = blockNumber ?? (await provider.getBlockNumber());
132
+ const { quorum, method } = await readQuorum(c, cfg, block);
133
+ return ok({
134
+ governor: cfg.id,
135
+ governorVersion: cfg.governorVersion,
136
+ blockNumber: block,
137
+ quorum: quorum.toString(),
138
+ method,
139
+ configured: {
140
+ numerator: cfg.votingParams.quorumNumerator,
141
+ denominator: cfg.votingParams.quorumDenominator,
142
+ },
143
+ });
144
+ }
145
+ catch (e) {
146
+ return err(`dexe_gov_get_quorum failed: ${e.message}`);
147
+ }
148
+ });
149
+ }
150
+ function registerGetProposalThreshold(server, rpc) {
151
+ server.registerTool("dexe_gov_get_proposal_threshold", {
152
+ title: "Read Governor proposalThreshold()",
153
+ description: "Calls Governor.proposalThreshold() — minimum voting power required to submit a proposal. Returns raw uint256 and config-derived value (when present) for cross-check.",
154
+ inputSchema: {
155
+ governor: governorIdSchema,
156
+ },
157
+ }, async ({ governor }) => {
158
+ try {
159
+ const cfg = resolveGovernor(governor);
160
+ const provider = rpc.requireProvider(cfg.chainId);
161
+ const c = governorContract(provider, cfg);
162
+ const threshold = await c.getFunction("proposalThreshold").staticCall();
163
+ return ok({
164
+ governor: cfg.id,
165
+ proposalThreshold: { raw: threshold.toString(), decimals: cfg.votingToken.decimals },
166
+ configured: cfg.votingParams.proposalThreshold ?? null,
167
+ });
168
+ }
169
+ catch (e) {
170
+ return err(`dexe_gov_get_proposal_threshold failed: ${e.message}`);
171
+ }
172
+ });
173
+ }
174
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/governor/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpE,SAAS,EAAE,CAAC,IAAa;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACvF,CAAC;AAED,SAAS,GAAG,CAAC,OAAe;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAChF,CAAC;AAED,MAAM,gBAA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,CAAC;YACX,OAAO,GAAG,CAAC,+BAAgC,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,4BAA4B,CAAC,MAAiB,EAAE,GAAgB;IACvE,MAAM,CAAC,YAAY,CACjB,iCAAiC,EACjC;QACE,KAAK,EAAE,mCAAmC;QAC1C,WAAW,EACT,uKAAuK;QACzK,WAAW,EAAE;YACX,QAAQ,EAAE,gBAAgB;SAC3B;KACF,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;YACtC,MAAM,QAAQ,GAAG,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAClD,MAAM,CAAC,GAAG,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAC1C,MAAM,SAAS,GAAW,MAAM,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,UAAU,EAAE,CAAC;YAChF,OAAO,EAAE,CAAC;gBACR,QAAQ,EAAE,GAAG,CAAC,EAAE;gBAChB,iBAAiB,EAAE,EAAE,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE;gBACpF,UAAU,EAAE,GAAG,CAAC,YAAY,CAAC,iBAAiB,IAAI,IAAI;aACvD,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,GAAG,CAAC,2CAA4C,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { RpcProvider } from "../../rpc.js";
3
+ import { decodeGovernorWrite } from "../encoder.js";
4
+ export declare function registerGovernorSimulateTools(server: McpServer, rpc: RpcProvider): void;
5
+ export { decodeGovernorWrite };
6
+ //# sourceMappingURL=simulate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../../src/governor/tools/simulate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAgB,mBAAmB,EAAyB,MAAM,eAAe,CAAC;AAyDzF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAGvF;AAqJD,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,191 @@
1
+ import { z } from "zod";
2
+ import { Interface, ZeroAddress, toUtf8String } from "ethers";
3
+ import { resolveGovernor } from "../loader.js";
4
+ import { governorContract, isBravo, projectVoteImpact, readProposal, readQuorum, stateName } from "../adapter.js";
5
+ import { buildExecute, decodeGovernorWrite } from "../encoder.js";
6
+ const ERROR_STRING_SELECTOR = "0x08c379a0";
7
+ const PANIC_SELECTOR = "0x4e487b71";
8
+ function ok(data) {
9
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
10
+ }
11
+ function err(message) {
12
+ return { content: [{ type: "text", text: message }], isError: true };
13
+ }
14
+ function decodeRevert(data) {
15
+ if (!data || data === "0x")
16
+ return null;
17
+ if (data.startsWith(ERROR_STRING_SELECTOR)) {
18
+ try {
19
+ const iface = new Interface(["function Error(string)"]);
20
+ const [reason] = iface.decodeFunctionData("Error", data);
21
+ return reason;
22
+ }
23
+ catch {
24
+ try {
25
+ return toUtf8String("0x" + data.slice(10 + 64 + 64));
26
+ }
27
+ catch {
28
+ return data;
29
+ }
30
+ }
31
+ }
32
+ if (data.startsWith(PANIC_SELECTOR)) {
33
+ try {
34
+ const code = BigInt("0x" + data.slice(10));
35
+ const known = {
36
+ "1": "assert(false)",
37
+ "17": "arithmetic overflow/underflow",
38
+ "18": "division or modulo by zero",
39
+ "33": "invalid enum conversion",
40
+ "34": "invalid storage byte array access",
41
+ "49": "pop() on empty array",
42
+ "50": "array index out of bounds",
43
+ "65": "out-of-memory allocation",
44
+ "81": "call to uninitialized internal function",
45
+ };
46
+ const hint = known[code.toString()];
47
+ return `Panic(0x${code.toString(16)})${hint ? ` — ${hint}` : ""}`;
48
+ }
49
+ catch {
50
+ return `Panic(${data.slice(10)})`;
51
+ }
52
+ }
53
+ return data;
54
+ }
55
+ const governorIdSchema = z
56
+ .string()
57
+ .min(1)
58
+ .describe("Governor id (e.g. 'uniswap', 'compound', 'optimism') or 0x-prefixed governor contract address.");
59
+ const uintLikeSchema = z.union([z.string(), z.number()]);
60
+ export function registerGovernorSimulateTools(server, rpc) {
61
+ registerSimulateProposal(server, rpc);
62
+ registerSimulateVoteImpact(server, rpc);
63
+ }
64
+ function registerSimulateProposal(server, rpc) {
65
+ server.registerTool("dexe_gov_simulate_proposal", {
66
+ title: "Dry-run Governor.execute() via eth_call",
67
+ description: "Encodes Governor.execute() for the given proposal (Bravo: proposalId; OZ: targets/values/calldatas + description or hash) and performs eth_call against the configured RPC. Returns {success, revertReason, decodedCall, currentState}. Note: this is a single-block dry-run, NOT a full fork-and-time-warp; proposals still in Queued state with unmet timelock ETA will return a revert with the timelock error. For full execution sim, run against a forked node with time advanced past the ETA.",
68
+ inputSchema: {
69
+ governor: governorIdSchema,
70
+ proposalId: z.string().optional().describe("Required on Bravo. For OZ, optional — provided for state lookup."),
71
+ targets: z.array(z.string()).optional().describe("OZ only."),
72
+ values: z.array(uintLikeSchema).optional().describe("OZ only."),
73
+ calldatas: z.array(z.string()).optional().describe("OZ only."),
74
+ description: z.string().optional().describe("OZ only. Auto-hashed."),
75
+ descriptionHash: z.string().optional().describe("OZ only. Use when description is unknown."),
76
+ from: z
77
+ .string()
78
+ .optional()
79
+ .describe("Caller for eth_call. Defaults to 0x0 — execute() is anyone-callable on both families."),
80
+ msgValue: uintLikeSchema.optional(),
81
+ },
82
+ }, async (args) => {
83
+ try {
84
+ const cfg = resolveGovernor(args.governor);
85
+ const provider = rpc.requireProvider(cfg.chainId);
86
+ const queueExec = {
87
+ proposalId: args.proposalId,
88
+ targets: args.targets,
89
+ values: args.values,
90
+ calldatas: args.calldatas,
91
+ description: args.description,
92
+ descriptionHash: args.descriptionHash,
93
+ };
94
+ const built = buildExecute(cfg, queueExec, args.msgValue);
95
+ const txReq = {
96
+ to: built.to,
97
+ from: args.from ?? ZeroAddress,
98
+ value: "0x" + BigInt(built.value).toString(16),
99
+ data: built.data,
100
+ };
101
+ let currentState = null;
102
+ if (args.proposalId) {
103
+ try {
104
+ const c = governorContract(provider, cfg);
105
+ const idx = Number(await c.getFunction("state").staticCall(BigInt(args.proposalId)));
106
+ currentState = { index: idx, name: stateName(idx) };
107
+ }
108
+ catch {
109
+ currentState = null;
110
+ }
111
+ }
112
+ try {
113
+ await provider.call(txReq);
114
+ return ok({
115
+ governor: cfg.id,
116
+ governorVersion: cfg.governorVersion,
117
+ success: true,
118
+ currentState,
119
+ executeCalldata: built,
120
+ });
121
+ }
122
+ catch (e) {
123
+ const reason = decodeRevert(e?.data ?? e?.info?.error?.data ?? e?.error?.data);
124
+ return ok({
125
+ governor: cfg.id,
126
+ governorVersion: cfg.governorVersion,
127
+ success: false,
128
+ revertReason: reason ?? (e instanceof Error ? e.message : String(e)),
129
+ currentState,
130
+ executeCalldata: built,
131
+ });
132
+ }
133
+ }
134
+ catch (e) {
135
+ return err(`dexe_gov_simulate_proposal failed: ${e.message}`);
136
+ }
137
+ });
138
+ }
139
+ function registerSimulateVoteImpact(server, rpc) {
140
+ server.registerTool("dexe_gov_simulate_vote_impact", {
141
+ title: "Project proposal outcome after a hypothetical vote",
142
+ description: "Reads current vote tallies + quorum, then projects what the outcome would be if `weight` units of voting power were cast with `support` (0=Against, 1=For, 2=Abstain). Pure projection — no on-chain side effects. Returns currentTallies, projectedTallies, quorumMet, willPass.",
143
+ inputSchema: {
144
+ governor: governorIdSchema,
145
+ proposalId: z.string(),
146
+ support: z.number().int().min(0).max(2),
147
+ weight: z.string().describe("Hypothetical vote weight in wei (decimal string)."),
148
+ },
149
+ }, async ({ governor, proposalId, support, weight }) => {
150
+ try {
151
+ const cfg = resolveGovernor(governor);
152
+ const provider = rpc.requireProvider(cfg.chainId);
153
+ const c = governorContract(provider, cfg);
154
+ const pid = BigInt(proposalId);
155
+ const readout = await readProposal(c, cfg, pid);
156
+ const { quorum, method: quorumMethod } = await readQuorum(c, cfg, Number(readout.snapshotBlock));
157
+ const w = BigInt(weight);
158
+ const cur = {
159
+ against: BigInt(readout.votes.against),
160
+ for: BigInt(readout.votes.for),
161
+ abstain: BigInt(readout.votes.abstain),
162
+ };
163
+ const { projected: proj, quorumMet, willPass } = projectVoteImpact(isBravo(cfg), cur, support, w, quorum);
164
+ return ok({
165
+ governor: cfg.id,
166
+ governorVersion: cfg.governorVersion,
167
+ proposalId,
168
+ currentState: readout.state,
169
+ quorum: { required: quorum.toString(), method: quorumMethod },
170
+ currentTallies: {
171
+ against: cur.against.toString(),
172
+ for: cur.for.toString(),
173
+ abstain: cur.abstain.toString(),
174
+ },
175
+ hypothetical: { support, weight },
176
+ projectedTallies: {
177
+ against: proj.against.toString(),
178
+ for: proj.for.toString(),
179
+ abstain: proj.abstain.toString(),
180
+ },
181
+ projection: { quorumMet, willPass },
182
+ });
183
+ }
184
+ catch (e) {
185
+ return err(`dexe_gov_simulate_vote_impact failed: ${e.message}`);
186
+ }
187
+ });
188
+ }
189
+ // Re-export so build.test can verify decode integration in one place.
190
+ export { decodeGovernorWrite };
191
+ //# sourceMappingURL=simulate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate.js","sourceRoot":"","sources":["../../../src/governor/tools/simulate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EA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AAe,EAAE,GAAG,CAAC,eAAe;gBACpC,UAAU;gBACV,YAAY,EAAE,OAAO,CAAC,KAAK;gBAC3B,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;gBAC7D,cAAc,EAAE;oBACd,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE;oBAC/B,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE;oBACvB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE;iBAChC;gBACD,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;gBACjC,gBAAgB,EAAE;oBAChB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;oBAChC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;oBACxB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;iBACjC;gBACD,UAAU,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;aACpC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,GAAG,CAAC,yCAA0C,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { DexeConfig } from "../config.js";
2
+ /**
3
+ * Signer broadcast guards. A single `runBroadcastGuards` chains opt-in checks
4
+ * that run before every `wallet.sendTransaction()` — both the single-shot
5
+ * `dexe_tx_send` and the shared composite-flow loop (`sendOrCollect`). Each
6
+ * guard is a no-op when its env var is unset, so the default (calldata) posture
7
+ * is unchanged. They only bite once a `DEXE_PRIVATE_KEY` is configured and a
8
+ * broadcast is attempted.
9
+ *
10
+ * B6 destination allowlist — `DEXE_SIGNER_ALLOWLIST`
11
+ * B7 value cap — `DEXE_SIGNER_MAX_VALUE_WEI`
12
+ * B9 auto-simulation — eth_call preflight, abort on revert
13
+ * B10 rate limit — `DEXE_SIGNER_MAX_BROADCASTS_PER_MIN`
14
+ *
15
+ * B6/B7/B10 are stateless and safe on any broadcast. B9 simulates against
16
+ * *current* chain state, so it is unsound for dependent multi-step sequences
17
+ * (e.g. approve→deposit→createProposal): step N would be simmed before step
18
+ * N-1 is mined and falsely "revert". Composite flows therefore pass
19
+ * `skipSimulation: true`; the security-relevant guards still apply.
20
+ */
21
+ /** Transaction about to be broadcast. `from`/`chainId` come from the resolved signer. */
22
+ export interface BroadcastTx {
23
+ to: string;
24
+ data: string;
25
+ /** Wei value as decimal string. */
26
+ value: string;
27
+ chainId: number;
28
+ /** Signer address — used as the `from` for the B9 eth_call. */
29
+ from: string;
30
+ }
31
+ /** Thrown when a guard refuses a broadcast. `guard` is the backlog id (B6/B7/B9/B10). */
32
+ export declare class BroadcastGuardError extends Error {
33
+ readonly guard: string;
34
+ constructor(guard: string, message: string);
35
+ }
36
+ /** Reset the B10 window. Test-only. */
37
+ export declare function __resetBroadcastWindow(): void;
38
+ export declare function runBroadcastGuards(tx: BroadcastTx, cfg: DexeConfig, opts?: {
39
+ skipSimulation?: boolean;
40
+ }): Promise<void>;
41
+ //# sourceMappingURL=broadcastGuards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcastGuards.d.ts","sourceRoot":"","sources":["../../src/lib/broadcastGuards.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C;;;;;;;;;;;;;;;;;;GAkBG;AAEH,yFAAyF;AACzF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yFAAyF;AACzF,qBAAa,mBAAoB,SAAQ,KAAK;IAE1C,QAAQ,CAAC,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM;CAKlB;AASD,uCAAuC;AACvC,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,UAAU,EACf,IAAI,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,GAClC,OAAO,CAAC,IAAI,CAAC,CA6Ef"}
@@ -0,0 +1,85 @@
1
+ import pLimit from "p-limit";
2
+ import { RpcProvider } from "../rpc.js";
3
+ import { simulateCalldata } from "../tools/simulate.js";
4
+ /** Thrown when a guard refuses a broadcast. `guard` is the backlog id (B6/B7/B9/B10). */
5
+ export class BroadcastGuardError extends Error {
6
+ guard;
7
+ constructor(guard, message) {
8
+ super(message);
9
+ this.guard = guard;
10
+ this.name = "BroadcastGuardError";
11
+ }
12
+ }
13
+ // ---- B10 sliding-window state -------------------------------------------
14
+ // Module-scoped so the window survives across tool calls for the process
15
+ // lifetime. Serialized through p-limit(1) so concurrent broadcasts cannot
16
+ // race the prune/append on the timestamp array.
17
+ const rateLimitGate = pLimit(1);
18
+ const broadcastTimestamps = [];
19
+ /** Reset the B10 window. Test-only. */
20
+ export function __resetBroadcastWindow() {
21
+ broadcastTimestamps.length = 0;
22
+ }
23
+ export async function runBroadcastGuards(tx, cfg, opts) {
24
+ // ---- B6: destination allowlist ----------------------------------------
25
+ if (cfg.signerAllowlist && cfg.signerAllowlist.length > 0) {
26
+ const to = tx.to.toLowerCase();
27
+ if (!cfg.signerAllowlist.includes(to)) {
28
+ throw new BroadcastGuardError("B6", `Destination ${tx.to} is not in DEXE_SIGNER_ALLOWLIST (${cfg.signerAllowlist.length} allowed). ` +
29
+ `Refusing to broadcast.`);
30
+ }
31
+ }
32
+ // ---- B7: value cap ----------------------------------------------------
33
+ if (cfg.signerMaxValueWei !== undefined) {
34
+ const v = BigInt(tx.value);
35
+ if (v > cfg.signerMaxValueWei) {
36
+ throw new BroadcastGuardError("B7", `Value ${v.toString()} wei exceeds DEXE_SIGNER_MAX_VALUE_WEI cap of ${cfg.signerMaxValueWei.toString()} wei. ` +
37
+ `Refusing to broadcast.`);
38
+ }
39
+ }
40
+ // ---- B9: auto-simulation (eth_call preflight) -------------------------
41
+ // Reuses the shared sim core; aborts before spending gas if the call would
42
+ // revert. Must run against the SAME chain the broadcast targets — otherwise
43
+ // the preflight is meaningless (sims one chain, sends to another). The shared
44
+ // `simulateCalldata` resolves its provider via the config's default chain and
45
+ // takes no chainId, so hand it a config view whose default IS `tx.chainId`.
46
+ // Skipped for dependent multi-step composite flows (see header).
47
+ if (!opts?.skipSimulation) {
48
+ const simCfg = tx.chainId === cfg.defaultChainId
49
+ ? cfg
50
+ : { ...cfg, defaultChainId: tx.chainId, chainId: tx.chainId };
51
+ const rpc = new RpcProvider(simCfg);
52
+ const sim = await simulateCalldata(rpc, {
53
+ to: tx.to,
54
+ data: tx.data,
55
+ value: tx.value,
56
+ from: tx.from,
57
+ });
58
+ // Only a *genuine* revert aborts. A transport/RPC failure (sim.networkError)
59
+ // means the call never ran — fail open rather than wedge a valid broadcast
60
+ // and mislabel an infra hiccup as a revert.
61
+ if (!sim.success && !sim.networkError) {
62
+ throw new BroadcastGuardError("B9", `Pre-broadcast simulation (eth_call) reverted: ${sim.revertReason ?? "unknown"}. ` +
63
+ `Aborting before spending gas.`);
64
+ }
65
+ }
66
+ // ---- B10: rate limit (N per rolling 60s) ------------------------------
67
+ if (cfg.signerMaxBroadcastsPerMin !== undefined) {
68
+ const cap = cfg.signerMaxBroadcastsPerMin;
69
+ await rateLimitGate(() => {
70
+ const now = Date.now();
71
+ const cutoff = now - 60_000;
72
+ while (broadcastTimestamps.length > 0 && broadcastTimestamps[0] < cutoff) {
73
+ broadcastTimestamps.shift();
74
+ }
75
+ if (broadcastTimestamps.length >= cap) {
76
+ const oldest = broadcastTimestamps[0];
77
+ const waitS = Math.ceil((oldest + 60_000 - now) / 1000);
78
+ throw new BroadcastGuardError("B10", `Broadcast rate limit reached: ${cap} per minute (DEXE_SIGNER_MAX_BROADCASTS_PER_MIN). ` +
79
+ `Retry in ~${waitS}s.`);
80
+ }
81
+ broadcastTimestamps.push(now);
82
+ });
83
+ }
84
+ }
85
+ //# sourceMappingURL=broadcastGuards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcastGuards.js","sourceRoot":"","sources":["../../src/lib/broadcastGuards.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAiCxD,yFAAyF;AACzF,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAEjC;IADX,YACW,KAAa,EACtB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,UAAK,GAAL,KAAK,CAAQ;QAItB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,4EAA4E;AAC5E,yEAAyE;AACzE,0EAA0E;AAC1E,gDAAgD;AAChD,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,mBAAmB,GAAa,EAAE,CAAC;AAEzC,uCAAuC;AACvC,MAAM,UAAU,sBAAsB;IACpC,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,EAAe,EACf,GAAe,EACf,IAAmC;IAEnC,0EAA0E;IAC1E,IAAI,GAAG,CAAC,eAAe,IAAI,GAAG,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,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type TypedDataField } from "ethers";
2
+ /**
3
+ * Ethers layer for the Safe{Wallet} multisig integration. Houses everything
4
+ * the `dexe_safe_*` tools need that is *not* a tool registration:
5
+ *
6
+ * - the Safe Smart Account read ABI + `readSafeState`
7
+ * - the canonical `SafeTx` EIP-712 type set + domain + `computeSafeTxHash`
8
+ * - the chainId → Safe Transaction Service endpoint resolver
9
+ *
10
+ * Kept separate from `../rpc.ts` (which is the generic gov-tool provider cache)
11
+ * so the Safe-specific crypto stays in one auditable place.
12
+ */
13
+ export declare const SAFE_ABI: readonly ["function nonce() view returns (uint256)", "function getThreshold() view returns (uint256)", "function getOwners() view returns (address[])", "function isOwner(address owner) view returns (bool)", "function VERSION() view returns (string)"];
14
+ export interface SafeState {
15
+ safe: string;
16
+ nonce: bigint;
17
+ threshold: bigint;
18
+ owners: string[];
19
+ version: string;
20
+ }
21
+ /**
22
+ * Read the live Safe state (nonce, threshold, owners, version) over a single
23
+ * provider. Each call is independent; `VERSION` is best-effort because some
24
+ * very old singletons predate it.
25
+ */
26
+ export declare function readSafeState(provider: JsonRpcProvider, safeAddress: string): Promise<SafeState>;
27
+ /** CALL = 0, DELEGATECALL = 1. Safe rejects any other value. */
28
+ export declare const SAFE_OPERATION: {
29
+ readonly CALL: 0;
30
+ readonly DELEGATECALL: 1;
31
+ };
32
+ /**
33
+ * The `SafeTx` struct as signed by owners. Field order is consensus-critical:
34
+ * it must match `Safe.encodeTransactionData` exactly or the recovered signer
35
+ * will not be an owner and the service rejects the proposal.
36
+ */
37
+ export declare const SAFE_TX_TYPES: Record<string, TypedDataField[]>;
38
+ export interface SafeTx {
39
+ to: string;
40
+ value: string;
41
+ data: string;
42
+ operation: number;
43
+ safeTxGas: string;
44
+ baseGas: string;
45
+ gasPrice: string;
46
+ gasToken: string;
47
+ refundReceiver: string;
48
+ nonce: string;
49
+ }
50
+ /**
51
+ * EIP-712 domain for a Safe >= 1.3.0: `{ chainId, verifyingContract }`. Earlier
52
+ * singletons (< 1.3.0) used `{ verifyingContract }` only; those are not
53
+ * targeted here — `dexe_safe_*` assumes a modern (1.3.0 / 1.4.1) singleton.
54
+ */
55
+ export declare function safeTxDomain(chainId: number, safeAddress: string): TypedDataDomain;
56
+ /** Build a normalized SafeTx with the protocol defaults filled in. */
57
+ export declare function buildSafeTx(input: {
58
+ to: string;
59
+ value?: string;
60
+ data?: string;
61
+ operation?: number;
62
+ safeTxGas?: string;
63
+ baseGas?: string;
64
+ gasPrice?: string;
65
+ gasToken?: string;
66
+ refundReceiver?: string;
67
+ nonce: string | bigint;
68
+ }): SafeTx;
69
+ /**
70
+ * Deterministic `safeTxHash` — the value owners sign and the service indexes
71
+ * the transaction under. Equivalent to `Safe.getTransactionHash(...)` on-chain.
72
+ */
73
+ export declare function computeSafeTxHash(chainId: number, safeAddress: string, tx: SafeTx): string;
74
+ /**
75
+ * chainId → Safe Transaction Service "short name" used in the unified
76
+ * `https://api.safe.global/tx-service/<shortname>/api/v2` base. Sourced from
77
+ * the public Safe API reference. BSC testnet (97) has no hosted service — it
78
+ * must be supplied via `DEXE_SAFE_TX_SERVICE_URL`.
79
+ */
80
+ export declare const SAFE_TX_SERVICE_SHORTNAMES: Record<number, string>;
81
+ export interface SafeServiceEndpoint {
82
+ /** Base URL ending in `/api/v2` (no trailing slash). */
83
+ base: string;
84
+ /** Full POST target for creating a multisig transaction. */
85
+ multisigTransactions: (safe: string) => string;
86
+ /** True when the base was derived from the hosted api.safe.global service. */
87
+ hosted: boolean;
88
+ }
89
+ /**
90
+ * Resolve the Safe Transaction Service base for a chain. When
91
+ * `override` (DEXE_SAFE_TX_SERVICE_URL) is set it wins unconditionally — that
92
+ * is the escape hatch for self-hosted services and unsupported chains (e.g.
93
+ * BSC testnet). Throws when neither an override nor a known short name exists.
94
+ */
95
+ export declare function resolveSafeServiceEndpoint(chainId: number, override?: string): SafeServiceEndpoint;
96
+ //# sourceMappingURL=ethersProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ethersProvider.d.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