# MEV Sandwich Risk Analyzer

> MEV Sandwich Risk Analyzer is a paid API for AI agents from api.fadeandco.workers.dev, paid per call via x402, $0.003/call, status unknown (last checked 2026-10-29).

Calculates the theoretical maximum sandwich-attack profit for a swap in a constant-product DEX pool, based on current reserves and slippage tolerance, and suggests an optimal slippage setting.

## Facts

- Endpoint: GET https://api.fadeandco.workers.dev/api/agent-intel/mev-sandwich-risk-analyzer?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/mev-sandwich-risk-analyzer-7b263294
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_6et2-CSKkub7fAd8GoHGa

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability mev-sandwich-risk-analyzer-7b263294
```

Example prompt: Before I swap 10000 USDC on the Base pool at address 0x6cdcb1c4a4d1c3c6d054b27ac5b77e89eafb971d, can you analyze the sandwich attack risk and tell me the worst-case front-run profit and the best slippage tolerance I should set?

## When to prefer this

Use this endpoint when you need a fast, theoretical worst-case MEV sandwich risk estimate for a constant-product AMM pool before executing a swap. It is ideal for DeFi agents, trading bots, or wallet UIs that want to warn users about front-running risk and recommend an appropriate slippage setting. It does not require mempool access or real-time bot competition data, so it gives a conservative upper-bound estimate rather than a prediction. Prefer this over general DeFi analytics when you specifically need sandwich attack profit calculations tied to current pool reserves from DexScreener.

## Known failure modes

- Invalid or unrecognized pool address — API may return an error or empty reserves
- Pool not found on DexScreener for the given chain — returns error or null data
- Amount set to zero or negative — undefined behavior or error response
- Slippage tolerance outside 0-50% range — may return validation error
- Chain name not supported by DexScreener — lookup fails
- Non-constant-product pool (e.g. concentrated liquidity, stable swap) — model results will be inaccurate as computation assumes x*y=k

## How this service works

Theoretical sandwich-attack profit for a swap of a given size in one DEX pool, at the pool's current reserves (DexScreener) and the swap's slippage tolerance: the largest front-run that still lets the victim's trade succeed, and the profit it would give. Constant-product pools only, no mempool view, no competing bots: a worst-case estimate, not a prediction. Suggests a slippage tolerance.

## Output

Returns a JSON object with: the DEX name, pool address, chain, trade side, victim input amount, victim's expected and minimum output, victim price impact percentage, maximum front-run size in token units, theoretical sandwich profit (in quote token units and as percentage of victim trade size), a risk label (e.g. NO_PROFITABLE_SANDWICH or a risk tier), the suggested slippage tolerance percentage, and metadata including the DexScreener source URL, computation model description, and timestamp.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "pair",
      "amount"
     ],
     "properties": {
      "pair": {
       "type": "string",
       "description": "Pool (pair) address"
      },
      "side": {
       "type": "string",
       "description": "sell = victim gives base token; buy = victim gives quote token (default sell)"
      },
      "chain": {
       "type": "string",
       "description": "DexScreener chain name, e.g. base, ethereum (default base)"
      },
      "amount": {
       "type": "string",
       "description": "Victim's input amount in that token's units"
      },
      "feePct": {
       "type": "string",
       "description": "Pool fee in percent, 0 to 5 (default 0.3)"
      },
      "slippagePct": {
       "type": "string",
       "description": "Victim's slippage tolerance in percent, 0 to 50 (default 1)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "dex": "aerodrome",
  "note": "Worst-case theory at current reserves. Real sandwiches face competition and gas costs.",
  "pair": "0x6cdcb1c4a4d1c3c6d054b27ac5b77e89eafb971d",
  "risk": "NO_PROFITABLE_SANDWICH",
  "side": "sell",
  "chain": "base",
  "model": "constant-product x*y=k, worst case, no competing bots",
  "source": "https://api.dexscreener.com/latest/dex/pairs/base/0x6cdcb1c4a4d1c3c6d054b27ac5b77e89eafb971d",
  "checkedAt": "2026-10-23T09:35:18.707Z",
  "victimAmount": 10000,
  "victimMinOut": 7731.07539839,
  "maxFrontRunSize": 37037.702559,
  "theoreticalProfit": 0,
  "victimExpectedOut": 7809.16706908,
  "victimSlippagePct": 1,
  "suggestedSlippagePct": 0.54,
  "victimPriceImpactPct": 0.4355,
  "profitAsPctOfVictimSize": 0
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/mev-sandwich-risk-analyzer-7b263294/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.fadeandco.workers.dev](https://www.zero.xyz/host/api.fadeandco.workers.dev/llms.txt)
