defi-amm-security

Eliminate critical security vulnerabilities in Solidity AMM and DeFi liquidity pool contracts.

2|Updated May 11, 2026
One-click install
npx skills add https://github.com/himanshu231204/AI_Research_agent --skill defi-amm-security-himanshu231204
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defi-amm-security
Source: https://github.com/himanshu231204/AI_Research_agent/tree/main/.opencode/skills/defi-amm-security
Command: npx skills add https://github.com/himanshu231204/AI_Research_agent --skill defi-amm-security-himanshu231204

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solidity AMM and DeFi liquidity pool contracts are high-value targets for critical exploits that can drain user funds, including reentrancy attacks, donation/inflation attacks, oracle manipulation, and slippage flaws. This Skill eliminates the risk of overlooking these high-severity vulnerabilities during development or audit.

Core Features & Use Cases

  • Comprehensive Vulnerability Checklist: Covers all critical AMM security gaps including reentrancy, CEI ordering, share math flaws, oracle manipulation, slippage, admin control weaknesses, and integer overflow risks.
  • Hardened Implementation Patterns: Provides audited, production-ready code examples for withdraw, deposit, swap, and admin functions to replace vulnerable hand-rolled logic.
  • Use Case: Use this when writing, auditing, or reviewing any Solidity AMM, liquidity pool, or DeFi swap contract to ensure all common attack vectors are mitigated before mainnet deployment.

Quick Start

Use the defi-amm-security skill to review your Solidity AMM contract's deposit and withdraw functions for reentrancy and share math vulnerabilities.

Frequently Asked Questions about defi-amm-security

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

FAQPage Schema
How do I secure a Solidity AMM contract against reentrancy and donation attacks?

To secure Solidity AMM contracts against reentrancy and donation attacks, implement reentrancy guards, enforce strict CEI ordering, and apply safe share math patterns in deposit and withdraw functions to prevent fund loss.

What common vulnerabilities should I audit for in DeFi liquidity pool smart contracts?

When auditing DeFi liquidity pool smart contracts, check for reentrancy flaws, CEI ordering issues, share math vulnerabilities, TWAP oracle manipulation, missing slippage controls, and weak access-gated admin functions.

How do I prevent oracle manipulation in automated market maker swap functions?

Prevent oracle manipulation in AMM swap functions by integrating secure TWAP oracle usage and enforcing robust slippage controls to resist price manipulation and protect token balances during swaps.

Does this security checklist apply to LP vaults and custom swap protocols?

Yes, this security checklist applies directly to Solidity LP vaults, custom swap protocols, and other DeFi contracts holding token balances, covering critical vulnerabilities from integer overflow to admin control weaknesses.

What is the safest way to calculate LP shares in a liquidity pool deposit function?

The safest way to calculate LP shares in a liquidity pool deposit function is using audited, production-ready safe share math patterns that prevent inflation attacks and ensure accurate proportional token balance accounting.