npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@openzeppelin/wizard-uniswap-hooks

v0.1.0

Published

A boilerplate generator to get started with OpenZeppelin Contracts for Uniswap Hooks

Readme

OpenZeppelin Contracts Wizard for Uniswap Hooks

NPM Package

Interactively build a Uniswap v4 Hook contract out of components from OpenZeppelin Uniswap Hooks and OpenZeppelin Contracts. Provide parameters and desired features for the hook template that you want, and the Wizard will generate all of the necessary code. The resulting code is ready to be compiled and deployed, or it can serve as a starting point and customized further with application specific logic.

This package provides a programmatic API. For a web interface, see https://wizard.openzeppelin.com

Installation

npm install @openzeppelin/wizard-uniswap-hooks

Hook templates

The following hook templates are supported:

  • BaseHook - Provides standard entry points, permission checks, and validation utilities for building hooks
  • BaseAsyncSwap - Enables asynchronous swap execution with separate fulfillment
  • BaseCustomAccounting - Allows custom liquidity accounting and shares management
  • BaseCustomCurve - Enables custom pricing curves and swap calculations
  • BaseDynamicFee - Provides dynamic fee calculation based on pool conditions
  • BaseOverrideFee - Allows overriding the pool's swap fee
  • BaseDynamicAfterFee - Implements dynamic fees with post-swap adjustments
  • BaseHookFee - Enables hooks to collect fees on swaps
  • AntiSandwichHook - Protects against sandwich attacks with penalty fees
  • LimitOrderHook - Implements limit order functionality
  • LiquidityPenaltyHook - Applies penalties to early liquidity removals
  • ReHypothecationHook - Enables yield generation from deposited liquidity

Examples

Import the hooks API from the @openzeppelin/wizard-uniswap-hooks package:

import { hooks } from '@openzeppelin/wizard-uniswap-hooks';

To generate the source code for a basic hook with all of the default settings:

const contract = hooks.print();

To generate the source code for a hook with a custom name and specific hook type:

const contract = hooks.print({
  name: 'MyDynamicFeeHook',
  hook: 'BaseDynamicFee',
});

To generate the source code for a hook with pausability and access control:

const contract = hooks.print({
  name: 'MyPausableHook',
  hook: 'BaseHook',
  pausable: true,
  access: 'ownable',
});

To generate the source code for a custom accounting hook with ERC20 shares:

const contract = hooks.print({
  name: 'MyLiquidityHook',
  hook: 'BaseCustomAccounting',
  shares: {
    options: 'ERC20',
    name: 'My Liquidity Shares',
    symbol: 'MLS',
  },
});

To generate the source code for a hook with specific permissions:

const contract = hooks.print({
  name: 'MySwapHook',
  hook: 'BaseHook',
  permissions: {
    beforeSwap: true,
    afterSwap: true,
    beforeInitialize: false,
    afterInitialize: false,
    beforeAddLiquidity: false,
    beforeRemoveLiquidity: false,
    afterAddLiquidity: false,
    afterRemoveLiquidity: false,
    beforeDonate: false,
    afterDonate: false,
    beforeSwapReturnDelta: false,
    afterSwapReturnDelta: false,
    afterAddLiquidityReturnDelta: false,
    afterRemoveLiquidityReturnDelta: false,
  },
});

To generate the source code for a hook with utility libraries:

const contract = hooks.print({
  name: 'MyAdvancedHook',
  hook: 'BaseHook',
  currencySettler: true,  // Includes CurrencySettler library
  safeCast: true,         // Includes SafeCast library
  transientStorage: true, // Includes TransientSlot and SlotDerivation libraries
});

Options Reference

The HooksOptions interface supports the following properties:

  • hook (HookName): The base hook template to extend. Default: 'BaseHook'
  • name (string): The name of the hook contract. Default: 'MyHook'
  • pausable (boolean): Whether to include emergency pause functionality. Default: false
  • access ('ownable' | 'roles' | 'managed' | false): Access control mechanism. Default: false
  • currencySettler (boolean): Include CurrencySettler library for currency operations. Default: false
  • safeCast (boolean): Include SafeCast library for safe type casting. Default: false
  • transientStorage (boolean): Include transient storage utilities. Default: false
  • shares (Shares): Configuration for token shares. Default: { options: false }
    • options (false | 'ERC20' | 'ERC6909' | 'ERC1155'): The token standard to use for shares
    • name (string, optional): Token name (for ERC20)
    • symbol (string, optional): Token symbol (for ERC20)
    • uri (string, optional): Token URI (for ERC1155)
  • permissions (Permissions): Hook lifecycle permissions bitmap with 14 different permissions. Default: all false
  • inputs (object): Hook-specific configuration inputs. Default: { blockNumberOffset: 10 }
  • info (Info, optional): Contract metadata (license, security contact)

Note: Upgradeability is not yet available for Uniswap v4 Hooks.