aeonfun/aeon/deploy-uni-hook

Claude Code and agent skill by aeonfun/aeon

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Generate, simulate, audit, and deploy a Uniswap v4 hook + test pool from a brief, on any Uniswap v4 chain (every testnet and mainnet) - pre-audited templates or a from-scratch freeform hook (flags auto-derived; static audit + dangerous-pattern scan + a behavioral forge test + fork sim gate the deploy). Dry-run by default; explicit arm: to broadcast; testnet default, mainnet behind a double opt-in; records the deploy to main. Every deployed hook inherits a mandatory 10 bps AeonFee protocol fee.

Install

npx vskill@latest install aeonfun/aeon/deploy-uni-hook

SKILL.md

The same SKILL.md was published earlier as aeonfun/aeon/deploy-uni-hook.

${var} — the hook brief. Grammar: [arm:][template:<name>] [chain:<name>] <brief>
- ` (empty) → print help and exit DEPLOY_HOOK_EMPTY`.
- <brief> → dry-run: generate, compile, mine, and simulate. Never broadcasts. [default — no prefix]
- arm:<brief> → broadcast: do the full dry-run first, then deploy for real if the simulation passes.
- template:<name> → force a mode: dynamic | noop | skim (pre-audited templates) or freeform (build a whole hook from the prompt). Omit to auto-pick: a brief that matches a template uses it; anything else → freeform.
- chain:<name> → any Uniswap v4 chain in chains.tsv (run ./hook-deploy.sh chains to list). Default base-sepolia. Testnets: base-sepolia, unichain-sepolia, arbitrum-sepolia. Mainnets (testnet: false, e.g. base, ethereum, unichain, arbitrum, optimism, polygon, bnb, avalanche, ...) require BOTH arm: and an explicit chain: — the skill never targets mainnet by default. base-mainnet is accepted as an alias for base.

Today is ${today}. This skill turns a one-line brief into a live Uniswap v4 hook. It is built to be safe: it simulates every deploy before it broadcasts, it defaults to a dry-run on testnet, and it needs an explicit arm: to move on-chain.

Why this design

A hook binding is immutable and a bad hook can brick a pool or steal funds. So the gates sit BEFORE the deploy: two of them (dry-run then arm:), a mandatory simulation, and idempotent state. Everything after the broadcast is just recording what already happened — appended to memory/state/hook-deploys.json on main, no PR (there is nothing left to review). The Foundry flow is the proven one — mine a CREATE2 salt so the address carries the right hook-flag bits, deploy, initialize the pool, add liquidity, run one swap.

Safety contract (do not skip)

  1. Mainnet needs a triple lock. Never target a testnet: false chain unless ${var} has BOTH arm: AND an explicit chain:<mainnet-name> — AND the instance has HOOK_MAINNET_OK=1 set as a repo variable (a third, operator-level lock enforced inside hook-deploy.sh, exit 7; store it as a variable, not a secret - a secret value of 1 masks every 1 in the run log, so tx hashes and links print as ***). An instance that never authorized mainnet cannot broadcast there even if an armed message asks it to. This skill must only run on an instance whose inbound path is owner-gated (TELEGRAM_ALLOWED_USER_ID / the multi-channel allowlist) — a mainnet deploy spends real gas, so an untrusted sender must never be able to dispatch it. On a mainnet chain, first read the deployer balance with cast balance and abort (DEPLOY_HOOK_UNDERFUNDED) if it cannot cover the simulation's Estimated amount required; hook-deploy.sh independently enforces a funding floor (exit 8), an optional MAX_GAS_GWEI gas-price ceiling (exit 9), and warns if the deployer holds more than HOOK_MAX_FLOAT_ETH (default 0.25) — a deploy key must hold gas float only, never LP or treasury capital. Log a clear MAINNET warning in the output.
  2. Simulate before every broadcast. If the simulation reverts, do not broadcast. Report the revert and exit DEPLOY_HOOK_SIM_FAILED.
  3. Dry-run is the default. Broadcast only when ${var} starts with arm:.
  4. Key hygiene. The deployer key is a burner. Never print it. Never put it on a shell command line — always go through ./hook-deploy.sh, which reads it from the env inside the script.
  5. Idempotency. Before broadcasting, read memory/state/hook-deploys.json. If an identical brief already deployed within the last hour, do not re-deploy. The deploy script is also idempotent at the address level: it deploys to the canonical address (the first flag-matching CREATE2 salt for this exact (creationCode, flags, PoolManager)). If that address already holds code, an identical hook is already live, so the script logs ALREADY_DEPLOYED <addr> and does nothing — the runner reports the existing address instead of deploying a duplicate. (HookMiner itself skips occupied addresses, so without this check a re-run would silently deploy another copy at a new address.)

Inputs and config

  • Templates: skills/deploy-uni-hook/templates/ - AeonFee.sol (the mandatory 10 bps protocol-fee base every hook inherits), DynamicFeeHook.sol, NoOpHook.sol, HookFeeHook.sol (pre-audited), Hook.sol + Hook.t.sol + hook.env.example (freeform scaffold, behavioral-test gate, manifest), plus DeployHook.s.sol, MockERC20.sol, foundry.toml, chains.tsv.
  • Chain config: skills/deploy-uni-hook/templates/chains.tsv is the single source of truth — TAB-separated name chainId testnet poolManager stateView rpc explorer alchemy, one row per Uniswap v4 chain (staged next to hook-deploy.sh, which reads it). memory/uni-deployments.md mirrors it for humans. To add a chain, append a row to chains.tsv.
  • Authenticated RPC: the rpc column is a public endpoint. When ALCHEMY_API_KEY is set and the row has an alchemy slug, hook-deploy.sh uses https://<slug>.g.alchemy.com/v2/$ALCHEMY_API_KEY instead — a trusted RPC matters for the mainnet sim + broadcast (a lying public RPC can fake a clean sim). Precedence: RPC_URL (override, for testing) > Alchemy key + slug > public rpc. The RPC path (where the key lives) is never printed — logs show host only.
  • Deploy helper: skills/deploy-uni-hook/hook-deploy.sh — the only sanctioned broadcast path (hides the key).
  • State: memory/state/hook-deploys.json — idempotency + the deploy ledger.
Template picker (when template: is not given)
Brief mentionsMode
fee, volatility, dynamic, surgedynamic
skim, hook fee, take a cut, revenueskim
"minimal" / "starter" / "empty"noop
game, leaderboard, points, crown, loyaltyfreeform (game rules in Labs routing)
anything else (novel logic the templates don't cover)freeform

Mandatory AeonFee (every hook)

Every hook this skill deploys inherits AeonFee (templates/AeonFee.sol): a MANDATORY 10 bps (0.10%) protocol fee taken in afterSwap on the swap's unspecified (output) currency and routed to AEON_FEE_RECIPIENT (0xF1E958db7D1e4C074377946018Ad645db4FB158e). The rate and recipient are compile-time constants and afterSwap is NOT virtual, so no hook can lower, skip, or redirect it. A hook adds its own post-swap logic through _afterSwapExtra (which runs AFTER the fee), and any hook fee it charges stacks ON TOP of the 10 bps.

Because the fee is a return-delta take(), EVERY aeon hook's address carries AFTER_SWAP + AFTER_SWAP_RETURNS_DELTA (0x44) - so no aeon hook is Uniswap Labs auto-routable; every one needs the allowlist / a UniswapX filler (see Labs routing below). This is the deliberate trade for a fee that can never be bypassed.

Labs routing

Uniswap Labs auto-routes a hooked pool unless the address starts with 0x91, or the hook uses beforeSwapReturnsDelta, afterSwapReturnsDelta, or dynamicFees. Anything in that set needs the allowlist form or a UniswapX filler. Because AeonFee makes every hook an afterSwapReturnsDelta take, no template auto-routes - all are allowlist.

TemplateFlagsLabs classic router
noop0xC4 (beforeSwap + AeonFee 0x44)allowlist (afterSwapReturnsDelta)
freeform default (_afterSwapExtra)0x44 (AeonFee)allowlist (afterSwapReturnsDelta)
dynamic0x10C4 (0x10C0 + AeonFee 0x04) + DYNAMIC_FEE_FLAGallowlist (dynamicFees + afterSwapReturnsDelta)
skim0x44 (AeonFee + own skim, same bits)allowlist (afterSwapReturnsDelta)

Game on a hook (freeform): the 10 bps fee already runs in the base afterSwap via take() - a freeform body must NOT implement afterSwap (put extra logic in _afterSwapExtra).

  1. The mandatory fee is always taken; a hook's own extra fee also goes in _afterSwapExtra and stacks on top.
  2. Game runs only when hookData names a player. Empty hookData (Labs Universal Router) = paid swap, no game, no revert.
  3. Never encode the game in amountSpecified, block number, or a required swap direction. Those revert the router and collect nothing.
  4. sender is the router, not the user. Do not key game state off sender.

Do not generate amount-suffix / block-echo / exact-out-only / direction-gate hooks unless the brief explicitly asks for a revert-gate. The miner skips 0x91... addresses.

Fleet audit rules (from aeon.fun hook audits)

These are standing defects measured on the live fleet. Freeform MUST NOT recreate them. The skim template is already patched.

Fee / `take()`:

  • Charge the MAGNITUDE of the unspecified delta. Exact-out makes that delta negative. if (unspecifiedAmount <= 0) return silently skips the fee on every exact-output swap (shared-base F1).
  • Widen to int256 before negating. -type(int128).min panics and bricks that swap.
  • poolManager.take(..., feeRecipient, ...) to an immutable recipient. NEVER address(this). No withdraw(). Custody was the CrownClash/LegacyLedger HIGH.
  • An extra skim helper must not copy a <= 0 early return (second copy of the sign guard).

Gates (only if the brief demands a revert-gate):

  • 0. A revert-gate hook that rejects the pre-broadcast seed probe on purpose must declare HOOK_REVERT_GATE=1 in $HOOKBUILD_DIR/hook.env. Without it, a skipped probe is treated as a bug and simulation exits 1 (DEPLOY_HOOK_SIM_FAILED). The flag's only effect is to permit that intentional SEED_SWAP_SKIPPED during simulate; it suppresses nothing else. During broadcast the condition only warns and continues (the hook, pool and liquidity are already onchain), so the receipt and explorer verification still run.
  • 1a. Value that moves on its own (block.number): a view helper answered at head N is wrong at execution N+1. Target the execution block.
  • 1b. Value that moves when someone swaps (price low byte): exact match + zero tolerance is a contention DoS. Need a band, or do not gate.
  • 1c. Shared counter an attacker can park, not advanced on failure: griefing primitive.
  • 2. A contract in the unlock frame can satisfy the predicate; a signed tx cannot. That binds the wrong party.
  • 5. Never compare raw amountSpecified to a token-denominated constant. The caller picks the specified currency via exact-in vs exact-out. Use a dimensionless bound (tick move / liquidity fraction).
  • 6. A "balance" / "skew" / "heavier-side" gate on the two virtual reserves is a raw-PRICE gate in disguise. StateLibrary gives amount0 = L*2^96/sqrtP and amount1 = L*sqrtP/2^96, so amount0/amount1 = 1/price and the liquidity L cancels exactly. Any test on the two reserves (b0 >= b1, a skew band, "which side is heavier") therefore reduces to comparing the pool's RAW price to an implicit 1.0, and raw price is token1/token0 in smallest units, so it is ~1.0 only for a same-decimals pair near parity. A USDC(6d)/WETH(18d) pool sits ~8 orders of magnitude off; two 18-dec tokens at price 2.0 are already outside a 10% band. Such a gate is permanently one-directional on every real pair: one whole leg reverts forever, and "every trade rebalances toward 50/50" is false (a full-range position is already 50/50 by value at any price). Fix: snapshot the pool's OWN reference (its sqrtPriceX96 at afterInitialize, or an explicit target ratio from the brief) and gate the current price against THAT, never a hard-coded 1.0. This needs the afterInitialize callback (adds flag bit 0x1000), so a price/balance/skew hook must include it in the callback set or it cannot know its own starting price.
  • Never balanceOf(poolManager): that is the v4 singleton's global inventory, not this pool. Use StateLibrary.
  • sender is the router. Do not treat it as the trader.

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
760
Repository forks
271
7-day trend score
33

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/aeonfun/aeon/deploy-uni-hook/badge)](https://verified-skill.com/skills/aeonfun/aeon/deploy-uni-hook)

Something wrong with this skill or its page? Tell us.