mev-frontrunning

Solid

Detect MEV exposure and front-running risks — sandwich attacks, missing commit-reveal, missing/manipulable deadlines, slippage absent, public mempool dependence. Activate on swaps, mints, liquidations, NFT mints with reveals, auctions, and any function whose ordering can extract value.

AI & Automation 38 stars 5 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
53
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# MEV / front-running detection ## When this applies - Swaps, mints, redemptions on AMMs / vaults - NFT mints with random/reveal mechanics - Auctions, Dutch auctions, English auctions - Liquidations - Trade routers - DEX aggregator paths - Any function with `amountOutMin` or slippage parameters ## Detection patterns ### Missing slippage parameter (HIGH) ```solidity function swap(address tokenIn, uint256 amountIn) external { router.swapExactTokensForTokens(amountIn, 0, path, msg.sender, block.timestamp); // ^ amountOutMin = 0 → 100% sandwichable } ``` ### Manipulable deadline (HIGH) ```solidity router.swap(..., block.timestamp); // ← deadline = now means no deadline at all ``` Searcher can delay your tx indefinitely. Use a real deadline (`block.timestamp + 15 min` or user-supplied). ### Permit + transferFrom front-running (MEDIUM) Submitting `permit()` separately from the consuming tx lets an MEV bot front-run the permit and grief the user. Bundle in one tx. ### Reveal-based randomness without commit-reveal (HIGH) ```solidity function mintRare() external { uint256 r = uint256(keccak256(abi.encode(block.timestamp, msg.sender))); if (r % 100 == 0) _mint(msg.sender, RARE_ID); // ← searcher can simulate and skip } ``` Searcher simulates → only sends tx if outcome is favorable. Use commit-reveal or Chainlink VRF. ### `block.prevrandao` / `block.difficulty` for randomness (HIGH) Proposer can manipulate post-merge `pre...

Details

Author
iktok90-design
Repository
iktok90-design/ai-smart-contract-auditor
Created
1 weeks ago
Last Updated
2 days ago
Language
JavaScript
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category