v4-security-foundations

Review Uniswap v4 hook code for critical security vulnerabilities before deployment.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/lynnmeanslight/thahtay --skill v4-security-foundations-lynnmeanslight
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: v4-security-foundations
Source: https://github.com/lynnmeanslight/thahtay/tree/main/.agents/skills/v4-security-foundations
Command: npx skills add https://github.com/lynnmeanslight/thahtay --skill v4-security-foundations-lynnmeanslight

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Uniswap v4 hooks intercept every swap in a pool, and misimplemented hooks can lead to complete user fund loss through attack vectors like NoOp rug pulls, missing caller verification, and incorrect delta accounting. This skill provides security-first guidance to help developers build and audit v4 hooks that avoid these critical vulnerabilities.

Core Features & Use Cases

  • Threat Modeling & Permission Risk Matrix: Detailed breakdown of all 14 v4 hook permissions with associated risk levels, plus guidance on safe usage patterns for each.
  • Critical Vulnerability Mitigation: Step-by-step guidance to prevent the most dangerous v4 hook attacks, including NoOp rug pulls, missing PoolManager verification, and delta accounting mismatches.
  • Pre-Deployment Audit Resources: Comprehensive checklists, base hook templates, and gas budget guidelines to ensure hooks are safe for mainnet deployment.
  • Use Case: Ideal for developers building v4 hooks for perpetual futures exchanges, custom AMMs, JIT liquidity systems, or any contract that interacts with the Uniswap v4 PoolManager.

Quick Start

Use the v4-security-foundations skill to review your draft Uniswap v4 hook code for critical security flaws like missing caller checks and NoOp attack vectors before deploying to mainnet.

Frequently Asked Questions about v4-security-foundations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is a NoOp rug pull in Uniswap v4 hooks and how does it drain funds?

A NoOp rug pull in Uniswap v4 hooks occurs when a malicious hook intercepts a swap and returns a NoOp state, effectively bypassing token settlement while manipulating delta accounting to extract pool liquidity. Properly verifying the caller and enforcing strict delta accounting prevents this critical vulnerability.

How do I prevent delta accounting mismatches when building Uniswap v4 hooks?

To prevent delta accounting mismatches in Uniswap v4 hooks, enforce strict settlement rules where all token deltas are fully reconciled before the lock closes. Applying pre-deployment security validation and using base hook templates ensures your custom contract correctly balances PoolManager interactions.

What are the security risks of Uniswap v4 hook permissions for perpetual futures?

Uniswap v4 hook permissions for perpetual futures introduce risks like unauthorized caller access and fund drainage if misconfigured. Evaluating a threat modeling permission risk matrix for all 14 hook permissions identifies safe usage patterns to mitigate these vulnerabilities before mainnet deployment.

How do I audit a Uniswap v4 hook before deploying to mainnet?

Auditing a Uniswap v4 hook before mainnet deployment requires running through comprehensive security checklists, verifying caller authentication, and checking gas budget guidelines. Pre-deployment security validation identifies critical attack vectors like missing PoolManager verification and delta accounting flaws.

Can I use this security guidance for custom AMMs and intent-based trading systems?

Yes, this security guidance applies to custom AMMs, intent-based trading systems, and JIT liquidity systems interacting with the Uniswap v4 PoolManager. The threat modeling and permission risk assessments cover all PoolManager-interacting contracts to prevent fund-draining vulnerabilities.

Why does my Uniswap v4 hook fail the missing PoolManager verification check?

Uniswap v4 hooks fail the PoolManager verification check when they lack caller authentication, allowing unauthorized contracts to execute privileged hook logic. Adding strict caller verification ensures only the designated PoolManager can trigger your hook callbacks, preventing unauthorized fund manipulation.