@openzeppelin/contracts-mcp 0.4.3 → 0.4.5

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/README.md CHANGED
@@ -19,6 +19,7 @@ Provides tools to generate smart contract source code for the following language
19
19
  | cairo | erc20, erc721, erc1155, account, multisig, governor, vesting, custom |
20
20
  | stellar | fungible, stablecoin, non-fungible |
21
21
  | stylus | erc20, erc721, erc1155 |
22
+ | uniswap-hooks | hooks (tool name is just `uniswap-hooks`) |
22
23
 
23
24
 
24
25
  ## Installation
package/dist/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export { registerSolidityTools } from './solidity/tools';
2
2
  export { registerCairoTools } from './cairo/tools';
3
3
  export { registerStellarTools } from './stellar/tools';
4
4
  export { registerStylusTools } from './stylus/tools';
5
+ export { registerUniswapHooksTools } from './uniswap-hooks/tools';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerStylusTools = exports.registerStellarTools = exports.registerCairoTools = exports.registerSolidityTools = void 0;
3
+ exports.registerUniswapHooksTools = exports.registerStylusTools = exports.registerStellarTools = exports.registerCairoTools = exports.registerSolidityTools = void 0;
4
4
  var tools_1 = require("./solidity/tools");
5
5
  Object.defineProperty(exports, "registerSolidityTools", { enumerable: true, get: function () { return tools_1.registerSolidityTools; } });
6
6
  var tools_2 = require("./cairo/tools");
@@ -9,4 +9,6 @@ var tools_3 = require("./stellar/tools");
9
9
  Object.defineProperty(exports, "registerStellarTools", { enumerable: true, get: function () { return tools_3.registerStellarTools; } });
10
10
  var tools_4 = require("./stylus/tools");
11
11
  Object.defineProperty(exports, "registerStylusTools", { enumerable: true, get: function () { return tools_4.registerStylusTools; } });
12
+ var tools_5 = require("./uniswap-hooks/tools");
13
+ Object.defineProperty(exports, "registerUniswapHooksTools", { enumerable: true, get: function () { return tools_5.registerUniswapHooksTools; } });
12
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0CAAyD;AAAhD,8GAAA,qBAAqB,OAAA;AAC9B,uCAAmD;AAA1C,2GAAA,kBAAkB,OAAA;AAC3B,yCAAuD;AAA9C,6GAAA,oBAAoB,OAAA;AAC7B,wCAAqD;AAA5C,4GAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0CAAyD;AAAhD,8GAAA,qBAAqB,OAAA;AAC9B,uCAAmD;AAA1C,2GAAA,kBAAkB,OAAA;AAC3B,yCAAuD;AAA9C,6GAAA,oBAAoB,OAAA;AAC7B,wCAAqD;AAA5C,4GAAA,mBAAmB,OAAA;AAC5B,+CAAkE;AAAzD,kHAAA,yBAAyB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,wBAAgB,YAAY,cAsB3B"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQpE,wBAAgB,YAAY,cAuB3B"}
package/dist/server.js CHANGED
@@ -6,6 +6,7 @@ const tools_js_1 = require("./solidity/tools.js");
6
6
  const tools_js_2 = require("./cairo/tools.js");
7
7
  const tools_js_3 = require("./stellar/tools.js");
8
8
  const tools_js_4 = require("./stylus/tools.js");
9
+ const tools_js_5 = require("./uniswap-hooks/tools.js");
9
10
  const package_json_1 = require("../package.json");
10
11
  function createServer() {
11
12
  const server = new mcp_js_1.McpServer({
@@ -13,7 +14,7 @@ function createServer() {
13
14
  version: package_json_1.version,
14
15
  }, {
15
16
  instructions: `\
16
- Tools are provided for different smart contract languages: Solidity, Starknet's Cairo, Stellar Soroban, and Arbitrum Stylus.
17
+ Tools are provided for different smart contract languages and frameworks: Solidity, Starknet's Cairo, Stellar Soroban, Arbitrum Stylus, and Uniswap v4 Hooks.
17
18
  Each tool generates a smart contract using recommended best practices with OpenZeppelin Contracts libraries, and returns the source code. The tools do not write to disk.
18
19
  If the user requests to create a new smart contract, use the appropriate tool to generate the contract.
19
20
  If the user asks to modify an existing smart contract, use these tools to determine the recommended patterns. Toggle the options in a tool to determine how different features affect the code, then apply the same types of changes to the user's contract.
@@ -23,6 +24,7 @@ If the user asks to modify an existing smart contract, use these tools to determ
23
24
  (0, tools_js_2.registerCairoTools)(server);
24
25
  (0, tools_js_3.registerStellarTools)(server);
25
26
  (0, tools_js_4.registerStylusTools)(server);
27
+ (0, tools_js_5.registerUniswapHooksTools)(server);
26
28
  return server;
27
29
  }
28
30
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAOA,oCAsBC;AA7BD,oEAAoE;AACpE,kDAA4D;AAC5D,+CAAsD;AACtD,iDAA0D;AAC1D,gDAAwD;AACxD,kDAA0C;AAE1C,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,kBAAS,CAC1B;QACE,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAP,sBAAO;KACR,EACD;QACE,YAAY,EAAE;;;;;CAKnB;KACI,CACF,CAAC;IAEF,IAAA,gCAAqB,EAAC,MAAM,CAAC,CAAC;IAC9B,IAAA,6BAAkB,EAAC,MAAM,CAAC,CAAC;IAC3B,IAAA,+BAAoB,EAAC,MAAM,CAAC,CAAC;IAC7B,IAAA,8BAAmB,EAAC,MAAM,CAAC,CAAC;IAE5B,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAQA,oCAuBC;AA/BD,oEAAoE;AACpE,kDAA4D;AAC5D,+CAAsD;AACtD,iDAA0D;AAC1D,gDAAwD;AACxD,uDAAqE;AACrE,kDAA0C;AAE1C,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,kBAAS,CAC1B;QACE,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAP,sBAAO;KACR,EACD;QACE,YAAY,EAAE;;;;;CAKnB;KACI,CACF,CAAC;IAEF,IAAA,gCAAqB,EAAC,MAAM,CAAC,CAAC;IAC9B,IAAA,6BAAkB,EAAC,MAAM,CAAC,CAAC;IAC3B,IAAA,+BAAoB,EAAC,MAAM,CAAC,CAAC;IAC7B,IAAA,8BAAmB,EAAC,MAAM,CAAC,CAAC;IAC5B,IAAA,oCAAyB,EAAC,MAAM,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { z } from 'zod';
2
+ export declare const commonSchema: {
3
+ readonly access: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"ownable">, z.ZodLiteral<"roles">]>, z.ZodLiteral<"managed">]>>;
4
+ readonly info: z.ZodOptional<z.ZodObject<{
5
+ securityContact: z.ZodOptional<z.ZodString>;
6
+ license: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ securityContact?: string | undefined;
9
+ license?: string | undefined;
10
+ }, {
11
+ securityContact?: string | undefined;
12
+ license?: string | undefined;
13
+ }>>;
14
+ };
15
+ export declare const hooksSchema: {
16
+ readonly access: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"ownable">, z.ZodLiteral<"roles">]>, z.ZodLiteral<"managed">]>>;
17
+ readonly info: z.ZodOptional<z.ZodObject<{
18
+ securityContact: z.ZodOptional<z.ZodString>;
19
+ license: z.ZodOptional<z.ZodString>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ securityContact?: string | undefined;
22
+ license?: string | undefined;
23
+ }, {
24
+ securityContact?: string | undefined;
25
+ license?: string | undefined;
26
+ }>>;
27
+ readonly hook: z.ZodEnum<["BaseHook" | "BaseAsyncSwap" | "BaseCustomAccounting" | "BaseCustomCurve" | "BaseDynamicFee" | "BaseOverrideFee" | "BaseDynamicAfterFee" | "BaseHookFee" | "AntiSandwichHook" | "LiquidityPenaltyHook" | "LimitOrderHook" | "ReHypothecationHook" | "BaseOracleHook" | "OracleHookWithV3Adapters", ...("BaseHook" | "BaseAsyncSwap" | "BaseCustomAccounting" | "BaseCustomCurve" | "BaseDynamicFee" | "BaseOverrideFee" | "BaseDynamicAfterFee" | "BaseHookFee" | "AntiSandwichHook" | "LiquidityPenaltyHook" | "LimitOrderHook" | "ReHypothecationHook" | "BaseOracleHook" | "OracleHookWithV3Adapters")[]]>;
28
+ readonly name: z.ZodString;
29
+ readonly pausable: z.ZodBoolean;
30
+ readonly currencySettler: z.ZodBoolean;
31
+ readonly safeCast: z.ZodBoolean;
32
+ readonly transientStorage: z.ZodBoolean;
33
+ readonly shares: z.ZodObject<{
34
+ options: z.ZodUnion<[z.ZodLiteral<false>, z.ZodEnum<["ERC20", "ERC6909", "ERC1155"]>]>;
35
+ name: z.ZodOptional<z.ZodString>;
36
+ symbol: z.ZodOptional<z.ZodString>;
37
+ uri: z.ZodOptional<z.ZodString>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ options: false | "ERC20" | "ERC1155" | "ERC6909";
40
+ symbol?: string | undefined;
41
+ name?: string | undefined;
42
+ uri?: string | undefined;
43
+ }, {
44
+ options: false | "ERC20" | "ERC1155" | "ERC6909";
45
+ symbol?: string | undefined;
46
+ name?: string | undefined;
47
+ uri?: string | undefined;
48
+ }>;
49
+ readonly permissions: z.ZodObject<{
50
+ beforeInitialize: z.ZodBoolean;
51
+ afterInitialize: z.ZodBoolean;
52
+ beforeAddLiquidity: z.ZodBoolean;
53
+ beforeRemoveLiquidity: z.ZodBoolean;
54
+ afterAddLiquidity: z.ZodBoolean;
55
+ afterRemoveLiquidity: z.ZodBoolean;
56
+ beforeSwap: z.ZodBoolean;
57
+ afterSwap: z.ZodBoolean;
58
+ beforeDonate: z.ZodBoolean;
59
+ afterDonate: z.ZodBoolean;
60
+ beforeSwapReturnDelta: z.ZodBoolean;
61
+ afterSwapReturnDelta: z.ZodBoolean;
62
+ afterAddLiquidityReturnDelta: z.ZodBoolean;
63
+ afterRemoveLiquidityReturnDelta: z.ZodBoolean;
64
+ }, "strip", z.ZodTypeAny, {
65
+ beforeInitialize: boolean;
66
+ afterInitialize: boolean;
67
+ beforeAddLiquidity: boolean;
68
+ beforeRemoveLiquidity: boolean;
69
+ afterAddLiquidity: boolean;
70
+ afterRemoveLiquidity: boolean;
71
+ beforeSwap: boolean;
72
+ afterSwap: boolean;
73
+ beforeDonate: boolean;
74
+ afterDonate: boolean;
75
+ beforeSwapReturnDelta: boolean;
76
+ afterSwapReturnDelta: boolean;
77
+ afterAddLiquidityReturnDelta: boolean;
78
+ afterRemoveLiquidityReturnDelta: boolean;
79
+ }, {
80
+ beforeInitialize: boolean;
81
+ afterInitialize: boolean;
82
+ beforeAddLiquidity: boolean;
83
+ beforeRemoveLiquidity: boolean;
84
+ afterAddLiquidity: boolean;
85
+ afterRemoveLiquidity: boolean;
86
+ beforeSwap: boolean;
87
+ afterSwap: boolean;
88
+ beforeDonate: boolean;
89
+ afterDonate: boolean;
90
+ beforeSwapReturnDelta: boolean;
91
+ afterSwapReturnDelta: boolean;
92
+ afterAddLiquidityReturnDelta: boolean;
93
+ afterRemoveLiquidityReturnDelta: boolean;
94
+ }>;
95
+ readonly inputs: z.ZodObject<{
96
+ blockNumberOffset: z.ZodNumber;
97
+ maxAbsTickDelta: z.ZodNumber;
98
+ }, "strip", z.ZodTypeAny, {
99
+ blockNumberOffset: number;
100
+ maxAbsTickDelta: number;
101
+ }, {
102
+ blockNumberOffset: number;
103
+ maxAbsTickDelta: number;
104
+ }>;
105
+ };
106
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/uniswap-hooks/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB,eAAO,MAAM,YAAY;;;;;;;;;;;;CAcS,CAAC;AAuCnC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWU,CAAC"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hooksSchema = exports.commonSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const wizard_common_1 = require("@openzeppelin/wizard-common");
6
+ const wizard_uniswap_hooks_1 = require("@openzeppelin/wizard-uniswap-hooks");
7
+ /**
8
+ * Static type assertions to ensure schemas satisfy the Wizard API types. Not called at runtime.
9
+ */
10
+ function _typeAssertions() {
11
+ const _assertions = {
12
+ Hooks: zod_1.z.object(exports.hooksSchema).parse({}),
13
+ };
14
+ }
15
+ const hookEnum = zod_1.z.enum(wizard_uniswap_hooks_1.HooksNames);
16
+ const sharesOptionsSchema = zod_1.z.union([zod_1.z.literal(false), zod_1.z.enum(wizard_uniswap_hooks_1.ShareOptions)]);
17
+ exports.commonSchema = {
18
+ access: zod_1.z
19
+ .literal('ownable')
20
+ .or(zod_1.z.literal('roles'))
21
+ .or(zod_1.z.literal('managed'))
22
+ .optional()
23
+ .describe(wizard_common_1.solidityCommonDescriptions.access),
24
+ info: zod_1.z
25
+ .object({
26
+ securityContact: zod_1.z.string().optional().describe(wizard_common_1.infoDescriptions.securityContact),
27
+ license: zod_1.z.string().optional().describe(wizard_common_1.infoDescriptions.license),
28
+ })
29
+ .optional()
30
+ .describe(wizard_common_1.infoDescriptions.info),
31
+ };
32
+ const sharesSchema = zod_1.z
33
+ .object({
34
+ options: sharesOptionsSchema.describe(wizard_common_1.uniswapHooksSharesDescriptions.options),
35
+ name: zod_1.z.string().optional().describe(wizard_common_1.uniswapHooksSharesDescriptions.name),
36
+ symbol: zod_1.z.string().optional().describe(wizard_common_1.uniswapHooksSharesDescriptions.symbol),
37
+ uri: zod_1.z.string().optional().describe(wizard_common_1.uniswapHooksSharesDescriptions.uri),
38
+ })
39
+ .describe(wizard_common_1.uniswapHooksDescriptions.shares);
40
+ const permissionsSchema = zod_1.z
41
+ .object({
42
+ beforeInitialize: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.beforeInitialize),
43
+ afterInitialize: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.afterInitialize),
44
+ beforeAddLiquidity: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.beforeAddLiquidity),
45
+ beforeRemoveLiquidity: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.beforeRemoveLiquidity),
46
+ afterAddLiquidity: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.afterAddLiquidity),
47
+ afterRemoveLiquidity: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.afterRemoveLiquidity),
48
+ beforeSwap: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.beforeSwap),
49
+ afterSwap: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.afterSwap),
50
+ beforeDonate: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.beforeDonate),
51
+ afterDonate: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.afterDonate),
52
+ beforeSwapReturnDelta: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.beforeSwapReturnDelta),
53
+ afterSwapReturnDelta: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.afterSwapReturnDelta),
54
+ afterAddLiquidityReturnDelta: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksPermissionDescriptions.afterAddLiquidityReturnDelta),
55
+ afterRemoveLiquidityReturnDelta: zod_1.z
56
+ .boolean()
57
+ .describe(wizard_common_1.uniswapHooksPermissionDescriptions.afterRemoveLiquidityReturnDelta),
58
+ })
59
+ .describe(wizard_common_1.uniswapHooksDescriptions.permissions);
60
+ const inputsSchema = zod_1.z
61
+ .object({
62
+ blockNumberOffset: zod_1.z.number().describe(wizard_common_1.uniswapHooksInputsDescriptions.blockNumberOffset),
63
+ maxAbsTickDelta: zod_1.z.number().describe(wizard_common_1.uniswapHooksInputsDescriptions.maxAbsTickDelta),
64
+ })
65
+ .describe(wizard_common_1.uniswapHooksDescriptions.inputs);
66
+ exports.hooksSchema = {
67
+ hook: hookEnum.describe(wizard_common_1.uniswapHooksDescriptions.hook),
68
+ name: zod_1.z.string().describe(wizard_common_1.commonDescriptions.name),
69
+ pausable: zod_1.z.boolean().describe(wizard_common_1.commonDescriptions.pausable),
70
+ currencySettler: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksDescriptions.currencySettler),
71
+ safeCast: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksDescriptions.safeCast),
72
+ transientStorage: zod_1.z.boolean().describe(wizard_common_1.uniswapHooksDescriptions.transientStorage),
73
+ shares: sharesSchema,
74
+ permissions: permissionsSchema,
75
+ inputs: inputsSchema,
76
+ ...exports.commonSchema,
77
+ };
78
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/uniswap-hooks/schemas.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,+DAQqC;AACrC,6EAAkG;AAElG;;GAEG;AACH,SAAS,eAAe;IACtB,MAAM,WAAW,GAEb;QACF,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,mBAAW,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;KACvC,CAAC;AACJ,CAAC;AAED,MAAM,QAAQ,GAAG,OAAC,CAAC,IAAI,CAAC,iCAAU,CAAC,CAAC;AAEpC,MAAM,mBAAmB,GAAG,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAC,CAAC,IAAI,CAAC,mCAAY,CAAC,CAAC,CAAC,CAAC;AAEjE,QAAA,YAAY,GAAG;IAC1B,MAAM,EAAE,OAAC;SACN,OAAO,CAAC,SAAS,CAAC;SAClB,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SACtB,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACxB,QAAQ,EAAE;SACV,QAAQ,CAAC,0CAA0B,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,OAAC;SACJ,MAAM,CAAC;QACN,eAAe,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgB,CAAC,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CAAwB,CAAC,IAAI,CAAC;IACtD,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkB,CAAC,IAAI,CAAC;IAClD,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,kCAAkB,CAAC,QAAQ,CAAC;IAC3D,eAAe,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,wCAAwB,CAAC,eAAe,CAAC;IAC/E,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,wCAAwB,CAAC,QAAQ,CAAC;IACjE,gBAAgB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,wCAAwB,CAAC,gBAAgB,CAAC;IACjF,MAAM,EAAE,YAAY;IACpB,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,YAAY;IACpB,GAAG,oBAAY;CACiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerUniswapHooks(server: McpServer): RegisteredTool;
3
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/uniswap-hooks/tools/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAMzF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CA0CtE"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerUniswapHooks = registerUniswapHooks;
4
+ const wizard_uniswap_hooks_1 = require("@openzeppelin/wizard-uniswap-hooks");
5
+ const schemas_1 = require("../schemas");
6
+ const utils_1 = require("../../utils");
7
+ const wizard_common_1 = require("@openzeppelin/wizard-common");
8
+ function registerUniswapHooks(server) {
9
+ return server.tool('uniswap-hooks', (0, utils_1.makeDetailedPrompt)(wizard_common_1.uniswapHooksPrompts.Hooks), schemas_1.hooksSchema, async ({ hook, name, pausable, currencySettler, safeCast, transientStorage, shares, permissions, inputs, access, info, }) => {
10
+ const opts = {
11
+ hook,
12
+ name,
13
+ pausable,
14
+ currencySettler,
15
+ safeCast,
16
+ transientStorage,
17
+ shares,
18
+ permissions,
19
+ inputs,
20
+ access,
21
+ info,
22
+ };
23
+ return {
24
+ content: [
25
+ {
26
+ type: 'text',
27
+ text: (0, utils_1.safePrintSolidityCodeBlock)(() => wizard_uniswap_hooks_1.hooks.print(opts)),
28
+ },
29
+ ],
30
+ };
31
+ });
32
+ }
33
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/uniswap-hooks/tools/hooks.ts"],"names":[],"mappings":";;AAMA,oDA0CC;AA/CD,6EAA8E;AAC9E,wCAAyC;AACzC,uCAA6E;AAC7E,+DAAkE;AAElE,SAAgB,oBAAoB,CAAC,MAAiB;IACpD,OAAO,MAAM,CAAC,IAAI,CAChB,eAAe,EACf,IAAA,0BAAkB,EAAC,mCAAmB,CAAC,KAAK,CAAC,EAC7C,qBAAW,EACX,KAAK,EAAE,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,MAAM,EACN,MAAM,EACN,IAAI,GACL,EAAE,EAAE;QACH,MAAM,IAAI,GAAiB;YACzB,IAAI;YACJ,IAAI;YACJ,QAAQ;YACR,eAAe;YACf,QAAQ;YACR,gBAAgB;YAChB,MAAM;YACN,WAAW;YACX,MAAM;YACN,MAAM;YACN,IAAI;SACL,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAA,kCAA0B,EAAC,GAAG,EAAE,CAAC,4BAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBAC1D;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerUniswapHooksTools(server: McpServer): void;
3
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/uniswap-hooks/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QAE1D"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerUniswapHooksTools = registerUniswapHooksTools;
4
+ const hooks_js_1 = require("./tools/hooks.js");
5
+ function registerUniswapHooksTools(server) {
6
+ (0, hooks_js_1.registerUniswapHooks)(server);
7
+ }
8
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/uniswap-hooks/tools.ts"],"names":[],"mappings":";;AAGA,8DAEC;AAJD,+CAAwD;AAExD,SAAgB,yBAAyB,CAAC,MAAiB;IACzD,IAAA,+BAAoB,EAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "@openzeppelin/contracts-mcp",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "OpenZeppelin Contracts MCP Server",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": "https://github.com/OpenZeppelin/contracts-wizard",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
- "bin": {
10
- "contracts-mcp": "dist/cli.js"
11
- },
9
+ "bin": "dist/cli.js",
12
10
  "ts:main": "src/index.ts",
13
11
  "files": [
14
12
  "LICENSE",
@@ -26,16 +24,17 @@
26
24
  },
27
25
  "dependencies": {
28
26
  "@modelcontextprotocol/sdk": "^1.11.1",
29
- "@openzeppelin/wizard-common": "^0.3.2",
30
- "@openzeppelin/wizard": "^0.10.3",
27
+ "@openzeppelin/wizard-common": "^0.3.3",
28
+ "@openzeppelin/wizard": "^0.10.4",
31
29
  "@openzeppelin/wizard-stylus": "^0.2.0",
32
30
  "@openzeppelin/wizard-stellar": "^0.4.4",
33
- "@openzeppelin/wizard-cairo": "^2.1.0"
31
+ "@openzeppelin/wizard-cairo": "^2.1.0",
32
+ "@openzeppelin/wizard-uniswap-hooks": "^0.1.0"
34
33
  },
35
34
  "devDependencies": {
36
35
  "@types/node": "^20.0.0",
37
- "typescript": "^5.0.0",
38
36
  "ava": "^6.0.0",
39
- "ts-node": "^10.4.0"
37
+ "ts-node": "^10.4.0",
38
+ "typescript": "^5.0.0"
40
39
  }
41
40
  }
package/src/index.ts CHANGED
@@ -2,3 +2,4 @@ export { registerSolidityTools } from './solidity/tools';
2
2
  export { registerCairoTools } from './cairo/tools';
3
3
  export { registerStellarTools } from './stellar/tools';
4
4
  export { registerStylusTools } from './stylus/tools';
5
+ export { registerUniswapHooksTools } from './uniswap-hooks/tools';
package/src/server.ts CHANGED
@@ -3,6 +3,7 @@ import { registerSolidityTools } from './solidity/tools.js';
3
3
  import { registerCairoTools } from './cairo/tools.js';
4
4
  import { registerStellarTools } from './stellar/tools.js';
5
5
  import { registerStylusTools } from './stylus/tools.js';
6
+ import { registerUniswapHooksTools } from './uniswap-hooks/tools.js';
6
7
  import { version } from '../package.json';
7
8
 
8
9
  export function createServer() {
@@ -13,7 +14,7 @@ export function createServer() {
13
14
  },
14
15
  {
15
16
  instructions: `\
16
- Tools are provided for different smart contract languages: Solidity, Starknet's Cairo, Stellar Soroban, and Arbitrum Stylus.
17
+ Tools are provided for different smart contract languages and frameworks: Solidity, Starknet's Cairo, Stellar Soroban, Arbitrum Stylus, and Uniswap v4 Hooks.
17
18
  Each tool generates a smart contract using recommended best practices with OpenZeppelin Contracts libraries, and returns the source code. The tools do not write to disk.
18
19
  If the user requests to create a new smart contract, use the appropriate tool to generate the contract.
19
20
  If the user asks to modify an existing smart contract, use these tools to determine the recommended patterns. Toggle the options in a tool to determine how different features affect the code, then apply the same types of changes to the user's contract.
@@ -25,6 +26,7 @@ If the user asks to modify an existing smart contract, use these tools to determ
25
26
  registerCairoTools(server);
26
27
  registerStellarTools(server);
27
28
  registerStylusTools(server);
29
+ registerUniswapHooksTools(server);
28
30
 
29
31
  return server;
30
32
  }
@@ -0,0 +1,92 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ commonDescriptions,
4
+ infoDescriptions,
5
+ uniswapHooksDescriptions,
6
+ uniswapHooksSharesDescriptions,
7
+ uniswapHooksPermissionDescriptions,
8
+ uniswapHooksInputsDescriptions,
9
+ solidityCommonDescriptions,
10
+ } from '@openzeppelin/wizard-common';
11
+ import { HooksNames, ShareOptions, type KindedOptions } from '@openzeppelin/wizard-uniswap-hooks';
12
+
13
+ /**
14
+ * Static type assertions to ensure schemas satisfy the Wizard API types. Not called at runtime.
15
+ */
16
+ function _typeAssertions() {
17
+ const _assertions: {
18
+ [K in keyof KindedOptions]: Omit<KindedOptions[K], 'kind'>;
19
+ } = {
20
+ Hooks: z.object(hooksSchema).parse({}),
21
+ };
22
+ }
23
+
24
+ const hookEnum = z.enum(HooksNames);
25
+
26
+ const sharesOptionsSchema = z.union([z.literal(false), z.enum(ShareOptions)]);
27
+
28
+ export const commonSchema = {
29
+ access: z
30
+ .literal('ownable')
31
+ .or(z.literal('roles'))
32
+ .or(z.literal('managed'))
33
+ .optional()
34
+ .describe(solidityCommonDescriptions.access),
35
+ info: z
36
+ .object({
37
+ securityContact: z.string().optional().describe(infoDescriptions.securityContact),
38
+ license: z.string().optional().describe(infoDescriptions.license),
39
+ })
40
+ .optional()
41
+ .describe(infoDescriptions.info),
42
+ } as const satisfies z.ZodRawShape;
43
+
44
+ const sharesSchema = z
45
+ .object({
46
+ options: sharesOptionsSchema.describe(uniswapHooksSharesDescriptions.options),
47
+ name: z.string().optional().describe(uniswapHooksSharesDescriptions.name),
48
+ symbol: z.string().optional().describe(uniswapHooksSharesDescriptions.symbol),
49
+ uri: z.string().optional().describe(uniswapHooksSharesDescriptions.uri),
50
+ })
51
+ .describe(uniswapHooksDescriptions.shares);
52
+
53
+ const permissionsSchema = z
54
+ .object({
55
+ beforeInitialize: z.boolean().describe(uniswapHooksPermissionDescriptions.beforeInitialize),
56
+ afterInitialize: z.boolean().describe(uniswapHooksPermissionDescriptions.afterInitialize),
57
+ beforeAddLiquidity: z.boolean().describe(uniswapHooksPermissionDescriptions.beforeAddLiquidity),
58
+ beforeRemoveLiquidity: z.boolean().describe(uniswapHooksPermissionDescriptions.beforeRemoveLiquidity),
59
+ afterAddLiquidity: z.boolean().describe(uniswapHooksPermissionDescriptions.afterAddLiquidity),
60
+ afterRemoveLiquidity: z.boolean().describe(uniswapHooksPermissionDescriptions.afterRemoveLiquidity),
61
+ beforeSwap: z.boolean().describe(uniswapHooksPermissionDescriptions.beforeSwap),
62
+ afterSwap: z.boolean().describe(uniswapHooksPermissionDescriptions.afterSwap),
63
+ beforeDonate: z.boolean().describe(uniswapHooksPermissionDescriptions.beforeDonate),
64
+ afterDonate: z.boolean().describe(uniswapHooksPermissionDescriptions.afterDonate),
65
+ beforeSwapReturnDelta: z.boolean().describe(uniswapHooksPermissionDescriptions.beforeSwapReturnDelta),
66
+ afterSwapReturnDelta: z.boolean().describe(uniswapHooksPermissionDescriptions.afterSwapReturnDelta),
67
+ afterAddLiquidityReturnDelta: z.boolean().describe(uniswapHooksPermissionDescriptions.afterAddLiquidityReturnDelta),
68
+ afterRemoveLiquidityReturnDelta: z
69
+ .boolean()
70
+ .describe(uniswapHooksPermissionDescriptions.afterRemoveLiquidityReturnDelta),
71
+ })
72
+ .describe(uniswapHooksDescriptions.permissions);
73
+
74
+ const inputsSchema = z
75
+ .object({
76
+ blockNumberOffset: z.number().describe(uniswapHooksInputsDescriptions.blockNumberOffset),
77
+ maxAbsTickDelta: z.number().describe(uniswapHooksInputsDescriptions.maxAbsTickDelta),
78
+ })
79
+ .describe(uniswapHooksDescriptions.inputs);
80
+
81
+ export const hooksSchema = {
82
+ hook: hookEnum.describe(uniswapHooksDescriptions.hook),
83
+ name: z.string().describe(commonDescriptions.name),
84
+ pausable: z.boolean().describe(commonDescriptions.pausable),
85
+ currencySettler: z.boolean().describe(uniswapHooksDescriptions.currencySettler),
86
+ safeCast: z.boolean().describe(uniswapHooksDescriptions.safeCast),
87
+ transientStorage: z.boolean().describe(uniswapHooksDescriptions.transientStorage),
88
+ shares: sharesSchema,
89
+ permissions: permissionsSchema,
90
+ inputs: inputsSchema,
91
+ ...commonSchema,
92
+ } as const satisfies z.ZodRawShape;
@@ -0,0 +1,49 @@
1
+ import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { hooks, type HooksOptions } from '@openzeppelin/wizard-uniswap-hooks';
3
+ import { hooksSchema } from '../schemas';
4
+ import { makeDetailedPrompt, safePrintSolidityCodeBlock } from '../../utils';
5
+ import { uniswapHooksPrompts } from '@openzeppelin/wizard-common';
6
+
7
+ export function registerUniswapHooks(server: McpServer): RegisteredTool {
8
+ return server.tool(
9
+ 'uniswap-hooks',
10
+ makeDetailedPrompt(uniswapHooksPrompts.Hooks),
11
+ hooksSchema,
12
+ async ({
13
+ hook,
14
+ name,
15
+ pausable,
16
+ currencySettler,
17
+ safeCast,
18
+ transientStorage,
19
+ shares,
20
+ permissions,
21
+ inputs,
22
+ access,
23
+ info,
24
+ }) => {
25
+ const opts: HooksOptions = {
26
+ hook,
27
+ name,
28
+ pausable,
29
+ currencySettler,
30
+ safeCast,
31
+ transientStorage,
32
+ shares,
33
+ permissions,
34
+ inputs,
35
+ access,
36
+ info,
37
+ };
38
+
39
+ return {
40
+ content: [
41
+ {
42
+ type: 'text',
43
+ text: safePrintSolidityCodeBlock(() => hooks.print(opts)),
44
+ },
45
+ ],
46
+ };
47
+ },
48
+ );
49
+ }
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { registerUniswapHooks } from './tools/hooks.js';
3
+
4
+ export function registerUniswapHooksTools(server: McpServer) {
5
+ registerUniswapHooks(server);
6
+ }