agents/skills/injectable/dex-integration-security/SKILL.md
Protocol Type Trigger dex_integration (detected when recon finds swap|addLiquidity|removeLiquidity|IUniswapV2Router|ISwapRouter|amountOutMin|amountOutMinimum|slippage - AND the...
npx skillsauth add plamentsv/plamen dex-integration-securityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Protocol Type Trigger:
dex_integration(detected when recon finds: swap|addLiquidity|removeLiquidity|IUniswapV2Router|ISwapRouter|amountOutMin|amountOutMinimum|slippage - AND the protocol is NOT itself a DEX implementation) Inject Into: Breadth agents, depth-external, depth-edge-case Language: Primarily EVM; applicable to Sui PTB-based DEX interactions and Soroban DEX integrations (SoroSwap, Phoenix Protocol) Finding prefix:[DEX-N]
When decomposing this skill into depth agent investigation questions, map sections to domains:
Recon detects DEX integration patterns: swap, addLiquidity, removeLiquidity, IUniswapV2Router, ISwapRouter, amountOutMin, amountOutMinimum, slippage, exactInputSingle, exactInput, swapExactTokensForTokens - but the protocol itself is NOT a DEX/AMM implementation. This skill analyzes the CALLER's integration with an external DEX, not the DEX internals.
For each function that calls a DEX swap:
amountOutMin (or equivalent) user-provided or computed on-chain?amountOutMin adjusted to account for the fee deduction from the input amount?Tag: [TRACE:swap_call → amountOutMin_source={user/computed/hardcoded} → value_can_be_zero={YES/NO} → forwarded_through={functions}]
For each function that calls a DEX router:
deadline parameter passed to the DEX router?block.timestamp used as the deadline? (provides no MEV protection - always passes)type(uint256).max or equivalent? (same issue - no protection)Tag: [TRACE:router_call → deadline={value_or_source} → block.timestamp_used={YES/NO} → queue_delay_considered={YES/NO}]
For each DEX call that returns swap output amounts:
balanceOf delta: is the delta computed correctly (post-balance minus pre-balance in the same transaction)?removeLiquidity calls: are BOTH output token amounts validated?Tag: [TRACE:swap_return → checked={YES/NO} → fee_on_transfer_aware={YES/NO} → revert_handling={propagate/catch/ignore}]
Tag: [TRACE:pool_selection → hardcoded={YES/NO} → fee_tier={value} → pool_verified={YES/NO} → liquidity_assumption={documented/implicit}]
type(uint256).max) approval to the router?Tag: [TRACE:approval → scope={unlimited/exact} → router_upgradeable={YES/NO} → stale_revoked={YES/NO}]
amountOutMin = 0 in atomic flash loan context: If the entire operation reverts on net loss within the same transaction, zero slippage tolerance is acceptable (atomic protection guarantees revert on unfavorable outcome)block.timestamp deadline on private/protected functions: If the swap function is only callable by a trusted keeper within a controlled execution flow, MEV deadline protection may be enforced upstream| Section | Required | Completed? | Notes | |---------|----------|------------|-------| | 1. Slippage Parameter Analysis | YES | | Origin, forwarding, multi-hop | | 2. Deadline Enforcement | YES | | Value, queue delay, L2 | | 3. Return Value Handling | YES | | Actual vs expected, fee-on-transfer | | 4. Fee Tier and Pool Assumptions | IF hardcoded pool/fee tier | | Pool verification, liquidity | | 5. Router Approval Safety | IF protocol approves router | | Scope, mutability, stale approvals |
development
Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project documentation checks. Generates a scored Audit Readiness Report and optionally runs static analysis. Trigger on: "prepare for audit", "audit readiness", "pre-audit check", "audit prep", "NatSpec check", or any request to review a Solidity codebase before a security review.
development
Launch the Plamen deterministic Web3 security audit pipeline
development
Run the Plamen smart-contract audit wizard in Codex
testing
Launch the Plamen deterministic L1 infrastructure audit pipeline