Skip to main content
Glama
OpenZeppelin

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin

uniswap-hooks

Generate Uniswap v4 hook contracts with customizable lifecycle callbacks, permissions, and share token options using OpenZeppelin libraries.

Instructions

Make a Uniswap v4 hook contract using the OpenZeppelin Uniswap Hooks library.

Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hookYesThe name of the Uniswap hook. Available hooks: - BaseHook: Base hook implementation that defines all hook entry points, security and permission helpers. Based on the Uniswap v4 periphery implementation. Hook entry points must be overridden and implemented by the inheriting hook to be used, with respective flags set in getHookPermissions. - BaseAsyncSwap: Base implementation for async swaps that skip the v3-like swap implementation by taking the full swap input amount and returning a delta that nets out the specified amount to 0. Allows developers to implement arbitrary logic for executing swaps, including asynchronous swaps and custom swap-ordering. Mints ERC-6909 claim tokens for the specified currency and amount. - BaseCustomAccounting: Base implementation for custom accounting and hook-owned liquidity. Enables tokens to be deposited via the hook to allow control and flexibility over how liquidity is computed. The hook is the sole owner of the liquidity and manages fees over liquidity shares accordingly. Designed to work with a single pool key. - BaseCustomCurve: Base implementation for custom curves that overrides the default v3-like concentrated liquidity implementation. During a swap, calls a function to get the amount of tokens to be sent to the receiver. The return delta is then consumed and applied by the PoolManager. Does not include fee or salt mechanisms by default. - BaseDynamicFee: Base implementation to apply a dynamic fee via the PoolManager's updateDynamicLPFee function. Allows hooks to update LP fees dynamically based on external conditions. Includes a poke function that can be called by anyone to update the fee. Alternative names to refer to the hook: 'Dynamic pool fee'. - BaseOverrideFee: Base implementation for automatic dynamic fees applied before swaps. Allows hooks to override the pool's fee before a swap is processed using the override fee flag. The fee is calculated dynamically and applied to the swap. Alternative names to refer to the hook: 'Dynamic swap fee'. - BaseDynamicAfterFee: Base implementation for dynamic target hook fees applied after swaps. Enforces a dynamic target for the unspecified currency during beforeSwap, where if the swap outcome is better than the target, any positive difference is taken as a hook fee. Fees are handled or distributed by the hook via afterSwapHandler. Alternative names to refer to the hook: 'Swap target enforcer'. - BaseHookFee: Base implementation for applying hook fees to the unspecified currency of the swap. These fees are independent of the pool's LP fee and are charged as a percentage of the output amount after the swap completes. Fees are taken as ERC-6909 claims. - AntiSandwichHook: Implements sandwich-resistant AMM design that guarantees no swaps get filled at a price better than the price at the beginning of the slot window. Within a slot window, swaps impact the pool asymmetrically for buys and sells. Only protects swaps in the zeroForOne direction. Alternative names to refer to the hook: 'Sandwich resistance'. - LiquidityPenaltyHook: Just-in-Time (JIT) liquidity provisioning resistant hook that disincentivizes JIT attacks by penalizing LP fee collection during liquidity removal and disabling it during liquidity addition if liquidity was recently added. The penalty is donated to the pool's liquidity providers in range at the time of removal. Alternative names to refer to the hook: 'JIT liquidity resistance'. - LimitOrderHook: Limit Order Mechanism hook that allows users to place limit orders at specific ticks outside of the current price range. Orders will be filled if the pool's price crosses the order's tick. Orders can be cancelled at any time until filled. Once completely filled, the resulting liquidity can be withdrawn from the pool. - ReHypothecationHook: A Uniswap V4 hook that enables rehypothecation of liquidity positions. Allows users to deposit assets into yield-generating sources while providing liquidity to Uniswap pools Just-in-Time during swaps. Assets earn yield when idle and are temporarily injected as pool liquidity only when needed for swap execution, then immediately withdrawn back to yield sources. Users receive ERC20 shares representing their rehypothecated position. Alternative names to refer to the hook: 'Liquidity rehypothecation'. - BaseOracleHook: A hook that enables a Uniswap V4 pool to record price observations and expose an oracle interface. Records cumulative tick values and provides time-weighted average price data. Allows increasing observation cardinality to store more historical price data. Provides observe function to get cumulative tick values for specified time periods. - OracleHookWithV3Adapters: A hook that enables a Uniswap V4 pool to record price observations and expose an oracle interface with Uniswap V3-compatible adapters. Extends BaseOracleHook by automatically deploying standard and truncated V3 oracle adapters for each pool, making the oracle data compatible with existing V3 oracle interfaces and tools.
nameYesThe name of the contract
pausableYesWhether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response.
currencySettlerYesWhether to include the CurrencySettler utility to settle pending deltas with the PoolManager during flash accounting.
safeCastYesWhether to include the SafeCast library for safe integer conversions when handling balances or fees.
transientStorageYesWhether to include the TransientSlot and SlotDerivation helpers for temporary state that clears at the end of the transaction.
sharesYesConfiguration for optional share tokens exposed by the hook.
permissionsYesToggle lifecycle permissions to enable specific core hook callbacks. Required permissions are enforced automatically.
inputsYesHook-specific configuration inputs used by certain templates.
accessNoThe type of access control to provision. Ownable is a simple mechanism with a single account authorized for all privileged actions. Roles is a flexible mechanism with a separate role for each privileged action. A role can have many authorized accounts. Managed enables a central contract to define a policy that allows certain callers to access certain functions.
infoNoMetadata about the contract and author
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses that the tool returns source code in a Markdown code block and does not write to disk. However, it lacks details on side effects, permissions, or error handling for such a complex tool with 11 parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each serving a distinct purpose: action, output format, behavioral note. No redundancy, front-loaded with core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Description covers key aspects but lacks details on return value structure beyond 'Markdown code block'. Without an output schema, some guidance on what the generated code includes would be helpful given the tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with each parameter thoroughly documented. The description adds no additional meaning beyond the schema, so baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Make' and specific resource 'Uniswap v4 hook contract', and distinguishes itself from sibling tools that generate other contract types (e.g., erc20, account) on different platforms (cairo, solidity, etc.). The output as Markdown code block is explicitly mentioned.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for generating Uniswap v4 hooks but does not explicitly state when to use this tool versus alternatives. No comparison to sibling tools or exclusion criteria are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/OpenZeppelin/contracts-wizard'

If you have feedback or need assistance with the MCP directory API, please join our Discord server