defi-amm-security

Audit Solidity AMM contracts for reentrancy, share accounting, and oracle risks.

Updated Sep 13, 2025
One-click install
npx skills add https://github.com/llmh333/employee_management_spring --skill defi-amm-security-llmh333
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defi-amm-security
Source: https://github.com/llmh333/employee_management_spring/tree/main/.gemini/skills/defi-amm-security
Command: npx skills add https://github.com/llmh333/employee_management_spring --skill defi-amm-security-llmh333

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps prevent critical security failures in Solidity AMM and liquidity-pool contracts by providing a practical checklist for auditing high-risk swap and share-accounting patterns.

Core Features & Use Cases

  • Reentrancy protection via CEI: Identify and fix unsafe external-call ordering in withdraw and other balance-releasing flows.
  • Safe share/reserve accounting: Detect donation or inflation attacks caused by using raw token balances directly in share math, and replace with internal accounting that measures actual received tokens.
  • Oracle, slippage, and admin hardening: Reduce oracle manipulation risk (prefer TWAP), enforce swap output minimums and deadlines, and ensure privileged functions are access-controlled.

Use case: you are reviewing a Uniswap-like AMM that includes deposit/withdraw plus admin fee and oracle update functions, and you want to systematically eliminate exploitable patterns before deployment.

Quick Start

Ask an AI auditor to review your AMM’s Solidity code against the defi-amm-security checklist for reentrancy, share/reserve math safety, oracle manipulation resistance, slippage/deadline enforcement, and admin access control.

Frequently Asked Questions about defi-amm-security

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

FAQPage Schema
How do I audit AMM smart contracts for reentrancy and reserve manipulation vulnerabilities?

To audit AMM smart contracts, apply Checks-Effects-Interactions (CEI) ordering for reentrancy defense and use internal accounting instead of raw balanceOf for share calculations to prevent reserve manipulation.

What causes donation and inflation attacks in DeFi liquidity pools?

Donation and inflation attacks in DeFi liquidity pools occur when using raw token balances directly in share math. They are prevented by using internal accounting that measures actual received tokens for share denominators.

How to prevent oracle manipulation in Solidity AMM swap contracts?

Prevent oracle manipulation in Solidity AMM swap contracts by preferring TWAP-style oracle reads over spot prices, and enforce slippage output minimums and deadlines on all swap entrypoints.

Does my Uniswap-like AMM need access control on fee and admin update functions?

Yes, your Uniswap-like AMM requires access-controlled admin paths on fee and oracle update functions. Hardened contracts ensure privileged functions cannot be exploited by unauthorized callers.

What is the best way to secure deposit, withdraw, and swap entrypoints in Solidity AMMs?

The best way to secure deposit, withdraw, and swap entrypoints in Solidity AMMs is applying hardened patterns: CEI-based reentrancy defenses, overflow-safe math primitives, slippage checks, and internal accounting for share calculations.