v4-security-foundations

Identify and mitigate security risks in Uniswap V4 hooks.

223|34|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/Uniswap/uniswap-ai --skill v4-security-foundations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: v4-security-foundations
Source: https://github.com/Uniswap/uniswap-ai/tree/main/packages/plugins/uniswap-hooks/skills/v4-security-foundations
Command: npx skills add https://github.com/Uniswap/uniswap-ai --skill v4-security-foundations

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provide actionable guidance and a security-first framework to prevent vulnerabilities in Uniswap V4 hooks during development and audits.

Core Features & Use Cases

  • Threat modeling and risk assessment for V4 hooks, including PoolKey, beforeSwap, afterSwap workflows.
  • Secure coding patterns, delta accounting, access control, and audit readiness for production hooks.
  • Use Case: A developer implementing a new V4 hook can reference the CRITICAL risks and template to ensure safe integration and pass pre-deployment checks.

Quick Start

Follow this guide to implement a secure V4 hook project starting from threat modeling to production-ready checks.

Frequently Asked Questions about v4-security-foundations

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

FAQPage Schema
What security risks should I look for when auditing Uniswap V4 hooks?

When auditing Uniswap V4 hooks, look for vulnerabilities in delta accounting, access control, and beforeSwap/afterSwap workflows. This framework provides threat modeling and risk matrices to identify critical fund loss vectors in PoolKey operations.

How do I implement secure delta accounting and access control in V4 hooks?

Implement secure delta accounting in V4 hooks by following guarded permission templates and enforcing strict access control on delta returns. This framework provides secure coding patterns to ensure balanced state transitions and prevent unauthorized pool interactions.

Does this V4 hook security framework include production-readiness checklists?

Yes, this V4 hook security framework includes production-readiness checklists. It provides pre-deployment checks and testing guidance to verify that beforeSwap/afterSwap hooks meet secure coding standards before mainnet activation.

What's the best way to threat model a Uniswap V4 hook before deployment?

The best way to threat model a Uniswap V4 hook is to map risks across PoolKey, beforeSwap, and afterSwap workflows. This framework generates risk matrices to systematically evaluate attack surfaces and enforce policy-compliant permissions.

Can I use this framework to audit existing V4 hooks or is it only for new development?

You can use this framework for both new development and auditing existing V4 hooks. It provides threat modeling, risk matrices, and secure coding patterns that apply equally to reviewing deployed hooks and building new policy-compliant templates.

Why do delta-return permissions cause fund loss in Uniswap V4 hooks?

Delta-return permissions cause fund loss in V4 hooks when unguarded access allows incorrect state transitions or unbalanced accounting. This framework enforces guarded permissions and secure delta accounting patterns to prevent these critical vulnerabilities.