example-fork-detection
TEMPLATE — replace with the description of your rule. Should activate on the specific code patterns your fork has. Activate on `<your trigger keywords or…
Detect oracle manipulation risks — spot-price reads from AMMs, stale Chainlink answers, single-source dependence, TWAP gaming. Activate whenever code reads a price, conversion rate, exchange rate, or `getReserves`, `latestAnswer`, `latestRoundData`, `consult`, `quote`, `slot0`,
$ npx -y skills add omermaksutii/RugProof --skill oracle-manipulation --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/oracle-manipulationContext preview
The summary Claude sees to decide when to auto-load this skill.
Detect oracle manipulation risks — spot-price reads from AMMs, stale Chainlink answers, single-source dependence, TWAP gaming. Activate whenever code reads a price, conversion rate, exchange rate, or `getReserves`, `latestAnswer`, `latestRoundData`, `consult`, `quote`, `slot0`,
name: oracle-manipulation description: Detect oracle manipulation risks — spot-price reads from AMMs, stale Chainlink answers, single-source dependence, TWAP gaming. Activate whenever code reads a price, conversion rate, exchange rate, or `getReserves`, `latestAnswer`, `latestRoundData`, `consult`, `quote`, `slot0`, `observe`, `getAmountsOut`.
Any code that consumes a price feed or derives a price from on-chain state:
(uint112 r0, uint112 r1,) = pair.getReserves(); uint256 price = r1 * 1e18 / r0; // ← flash-loan manipulable in one block
(, int256 answer,,,) = feed.latestRoundData(); // ← ignores updatedAt and answeredInRound
Required checks:
int256 p = feed.latestAnswer(); // ← deprecated, prefer latestRoundData
Only one oracle, no fallback, no cross-check against a second source.
(uint160 sqrtPriceX96,,,,,,) = pool.slot0(); // ← spot, manipulable
Use `observe()` for TWAP with sufficient lookback (≥30min for shallow pools).
TWAP < 5 min on volatile assets or low-liquidity pools is gameable across two blocks.
Reading `getVirtualPrice` / `getReserves` mid-callback — see [[reentrancy]] §Read-only.
LP token price should use the *fair LP price* formula (Alpha Homora's method), not `reserve / totalSupply`.
Chainlink answers come in feed-specific decimals; mixing ETH/USD (8 decimals) with token (18 decimals) without normalizing produces silent off-by-1e10 errors.
On Arbitrum, Optimism, Base — must check `SequencerUptimeFeed` to avoid stale prices when sequencer is down.
| Pattern | Severity | |---|---| | Spot-price from AMM used in liquidation/mint | **Critical** | | Uniswap V3 `slot0` used for collateral pricing | **Critical** | | LP token priced via raw `reserve / totalSupply` | **Critical** | | `latestRoundData` without freshness/round checks | **High** | | Single oracle, no fallback, financial-critical path | **High** | | Sequencer uptime check missing on L2 | **High** | | Insufficient TWAP window (<5min on shallow pool) | **High** | | Stale heartbeat for known-volatile asset | **High** | | `latestAnswer` (deprecated) used | **Medium** | | Decimal-scaling mistake | **High** |
Rugproof your code before someone else does. 🌐 Live site: omermaksutii.github.io/RugProof 📦 Latest: v1.0.0 — 45 commands · 23 agents · 45 skills · 13 MCP servers · tested, offline-first, with rule packs, a benchmark, non-EVM coverage, and post-deploy
Repo: omermaksutii/RugProof
TEMPLATE — replace with the description of your rule. Should activate on the specific code patterns your fork has. Activate on `<your trigger keywords or…
Detect unsafe assumptions about Solady's gas-optimized ERC20/ERC2612 permit and DN404 metadata. Solady's ERC20 uses custom storage slots, returns bools via…
Detect front-runnable ownership initialization in Solady Ownable / OwnableRoles. Solady's `_initializeOwner` is a guarded one-time setter (it reverts with…
Detect Solady SafeTransferLib calls that assume the token has code. SafeTransferLib.safeTransfer/safeTransferFrom/safeApprove deliberately skip the EXTCODESIZE…
Detect Uniswap V4 hooks that fail to settle currency deltas with the PoolManager. Every credit/debit a hook creates (BeforeSwapDelta, afterSwap hookDelta,…
Detect Uniswap V4 hooks whose address-encoded permission flags don't match the callbacks the hook actually implements. In V4 the hook's permissions live in the…