Agent Skill · Limit Break

lbamm-position-hook

Generate complete ILimitBreakAMMLiquidityHook Solidity implementations for per-position liquidity policies

Provider: Limit Break Path in repo: SKILL.md

Skill body

LBAMM Position Hook Generator

Generate a complete ILimitBreakAMMLiquidityHook implementation based on the user’s requirements. Position hooks enforce per-position policies on liquidity operations (add, remove, collect fees).

Project Setup

Before generating code, check the user’s project is configured:

  1. Foundry: foundry.toml must exist. If not: forge init
  2. LBAMM Core: lib/lbamm-core/ must exist. If not: forge install limitbreakinc/lbamm-core
  3. Remappings: remappings.txt needs @limitbreak/lbamm-core/=lib/lbamm-core/. Append if missing – do not overwrite existing entries.
  4. Local testing: LBAMM is in audit and not yet on public networks. For local testing, use lbamm-examples – see lbamm-protocol/references/local-dev.md. Generated scripts should read addresses from environment variables (vm.envAddress) so they work with the local Anvil deployment.

Instructions

  1. Parse requirements from $ARGUMENTS – identify what the position hook should do (time-lock liquidity, KYC-gate LP positions, charge deposit/withdrawal fees, track rewards, etc.)

  2. Resolve ambiguities before generating – if $ARGUMENTS references external contracts without addresses (e.g., “a KYC registry”, “a reward token”, “an NFT collection”), ask whether to use an existing contract (get the address) or create one. Clarify time-lock durations, fee amounts, or other values if unspecified and impactful. Ask in a single message. If clear, proceed.

  3. Determine which callbacks are needed:
    • validatePositionAddLiquidity – validate/gate LP deposits, charge deposit fees
    • validatePositionRemoveLiquidity – validate/gate LP withdrawals, charge withdrawal fees
    • validatePositionCollectFees – validate fee collection, charge fees on fee claims
  4. Generate a complete Solidity contract that:
    • Uses pragma solidity 0.8.24;
    • Implements ILimitBreakAMMLiquidityHook
    • Implements all three callback functions (unused ones can be minimal pass-through)
    • Implements liquidityHookManifestUri()
    • Includes appropriate state management and access control
    • Stores the LBAMM core address for caller validation
  5. Explain the position identity impact – the hook address becomes part of the base position ID:
    basePositionId = keccak256(abi.encodePacked(provider, liquidityHook, poolId))
    

    Different hooks create different positions even for the same provider and pool. This means positions created with this hook are distinct from positions without it.

  6. Explain fee behavior:
    • All three callbacks return (hookFee0, hookFee1)
    • Hook fees are accrued in core, not transferred immediately
    • Fees across all hook tiers are aggregated and compared against maxHookFee0/maxHookFee1 set by the caller
    • Return (0, 0) from callbacks that don’t charge fees

Reference Files

When to Use This vs Other Hook Skills

Key Rules

Dependencies

@limitbreak/lbamm-core/src/interfaces/hooks/ILimitBreakAMMLiquidityHook.sol
@limitbreak/lbamm-core/src/DataTypes.sol

Skill frontmatter

user-invocable: true disable-model-invocation: true argument-hint: [description of desired position hook behavior]