defi-amm-security

Review Solidity AMM and liquidity pool contracts for reentrancy and oracle manipulation vulnerabilities.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/luongldptit/move-ticket --skill defi-amm-security-luongldptit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defi-amm-security
Source: https://github.com/luongldptit/move-ticket/tree/main/.agent/skills/defi-amm-security
Command: npx skills add https://github.com/luongldptit/move-ticket --skill defi-amm-security-luongldptit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solidity AMM and liquidity pool contracts are high-value targets for attackers, with common vulnerabilities like reentrancy, donation attacks, and oracle manipulation leading to catastrophic financial losses. This skill eliminates that risk by providing a vetted security checklist and hardened implementation patterns tailored specifically for DeFi AMM use cases.

Core Features & Use Cases

  • Comprehensive Security Checklist: Covers all critical AMM vulnerability categories including reentrancy, CEI ordering, donation/inflation attacks, oracle manipulation, slippage protection, admin controls, and integer math errors.
  • Hardened Code Patterns: Provides copy-safe Solidity implementation examples for secure deposit, withdraw, swap, and reserve math logic, eliminating the risk of hand-rolled vulnerability pitfalls.
  • Use Case: Use this skill when writing, auditing, or reviewing any Solidity AMM, liquidity pool, or DeFi swap contract to catch critical flaws before mainnet deployment.

Quick Start

Use the defi-amm-security skill to review your Solidity AMM contract's withdraw function for reentrancy and CEI ordering vulnerabilities, and apply the provided hardened implementation pattern to fix any identified issues.

Frequently Asked Questions about defi-amm-security

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

FAQPage Schema
How do I prevent reentrancy attacks in Solidity AMM and liquidity pool contracts?

To prevent reentrancy attacks in Solidity AMM contracts, you must follow Checks-Effects-Interactions (CEI) ordering and use a reentrancy guard. This skill provides hardened implementation patterns for secure withdraw and swap functions that eliminate reentrancy vulnerabilities.

What is a donation attack in DeFi liquidity pools and how do I secure against it?

A donation attack in DeFi liquidity pools manipulates reserve calculations by artificially inflating pool balances. This skill addresses donation and inflation attacks by providing secure reserve math logic and hardened Solidity implementation patterns that verify token transfers.

How do I integrate manipulation-resistant oracles into an automated market maker smart contract?

Integrating manipulation-resistant oracles into an AMM smart contract requires using time-weighted average price feeds rather than spot reserves. This skill provides security checklists and Solidity code patterns to prevent oracle manipulation during token swaps and reserve calculations.

How do I add slippage protection to a Solidity DeFi swap contract?

Adding slippage protection to a Solidity DeFi swap contract involves enforcing minimum output amounts for swaps and minimum liquidity token receipts for deposits. This skill provides hardened code patterns to implement slippage controls and secure safe ERC-20 transfer handling.

What are the best security practices for privileged function access controls in DeFi smart contracts?

The best security practices for privileged function access controls in DeFi smart contracts include strict role-based permissions and multi-signature admin gates. This skill provides a security checklist covering admin controls to prevent unauthorized access to AMM reserve calculations and liquidity withdrawals.

Can I use this security checklist to audit existing Solidity AMM contracts before mainnet deployment?

Yes, you can use this AMM security checklist to audit existing Solidity contracts before mainnet deployment. It supports DeFi code review workflows by identifying critical flaws in reentrancy protection, CEI ordering, and integer math errors across token swap and liquidity pool logic.