Build a hook

Build a hook

Write a new hook module, the limits it runs under, and how to submit it for review.

Every Robin Hook token runs one Uniswap v4 hook, and that hook runs up to eight modules: small contracts, each one a rule (a burn, a pot, a sell tax, a cap). Launchers pick modules in the launch form and in blueprints. If you have an idea the existing modules can't express, you can write a new one and send it for review. Accepted modules are deployed by us and offered to every launcher.

Blueprint or module?

A blueprint combines existing modules with your settings, needs no code and goes live as soon as you publish it. A module is new Solidity, so it goes through review before anyone can launch with it.

How a module works

A module is a singleton shared by every pool that picks it, keeping its state per pool id. Only the hook calls it. It never touches the Uniswap PoolManager itself: to take a fee it returns Credits (to an account, to 0x…dEaD to burn, or to the pool's liquidity), and the hook moves the value. Its swap callbacks run on the bonding curve and in the pool, so check ctx.phase when a rule only makes sense in one of them.

interface IHookModule {
    function capabilities() external view returns (uint16);   // which callbacks the hook makes
    function conflictGroups() external view returns (uint32); // rules that can't be combined
    function validateConfig(bytes calldata config) external view;  // revert = settings refused
    function onRegister(PoolId id, address token, address quote, address creator, bytes calldata config) external;

    function onBeforeSwap(SwapContext calldata ctx) external returns (uint24 extraFeePips, Credit[] memory credits);
    function onAfterSwap(SwapContext calldata ctx) external returns (Credit[] memory credits);
    function onTransfer(PoolId id, address token, address operator, address from, address to, uint256 amount) external;
    function onLiquidity(PoolId id, address sender, bool isAdd, ModifyLiquidityParams calldata params) external;
}

Limits every module runs under

LimitValueWhy
All modules' cuts together25% of each side of a tradeScaled down together, never a revert
LP fee (base + module surcharges)At most 30%No mix of hooks can make a token untradeable
Gas per callback200,000A module cannot eat the whole transaction
Failing on a sellIgnored unless the module declares BLOCKS_SELLSA buggy module can never stop holders from selling
Credits per callbackAt most 8Bounded bookkeeping for the hook
SettingsFrozen at launchNobody can change a token's rules later

What we look for

  • Built on the module base contract, open source (MIT or similar), with Foundry tests that launch a token, graduate it and trade through the rule.
  • No owner, no upgrade path, no proxy: the registry records the code hash at approval and a pool calls that code forever.
  • Bounded loops and storage per trade; gas well under the 200,000 budget.
  • Clear limits in validateConfig, so no setting can trap traders.
  • A new idea: a rule the current modules can't already express.

We turn down modules that can take holders' funds, block sells without a clear, time-limited reason, or depend on an off-chain operator without a fallback.

Submitting

  1. 1

    Write it

    Start from the module template and the interface above. Keep the repo public so we can read the code and run the tests.
  2. 2

    Send it

    Open the Submit a hook tab, fill in the form and sign it with your wallet (no transaction, no gas). Up to 3 submissions a day per connection and 2 per wallet.
  3. 3

    Review

    We read the code, run the tests and HookScan’s checks, and do a security pass. We contact you on the handle you gave.
  4. 4

    Go live

    Accepted modules are deployed from the reviewed commit, verified on Etherscan and registered by the protocol Safe. They then appear in every hook picker and can be used in blueprints.

The module template

The template and the full module sources are being published in a public repository. Until then, ask us for the template on X and we'll send it with the base contract and an example test.