{"uid":"cap_rvkL9vVbB0_JCaKdly4oo","slug":"mev-sandwich-loss-upper-bound-b8127f31","name":"MEV Sandwich Loss Upper Bound","description":"Upper-bound CPMM price impact loss for size vs reserves. Call when pre-trade MEV/slippage stress without mempool access. Returns impact_fraction and loss_notional as deterministic JSON for $0.001 USDC via x402 on Base. First-party local math only—no RPC, live market feed, API keys, storage, or mediagen. Advisory only; the caller owns capital, risk, and production controls.","url":"https://api.delx.ai/api/v1/x402/mev-sandwich-upper","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"amount_in":{"type":"number","description":"Trade size in input asset units"},"reserve_in":{"type":"number","description":"Pool reserve of input asset"},"reserve_out":{"type":"number","description":"Pool reserve of output asset"}}},"responseSchema":{"type":"json","example":{"schema":"delx/util-mev-sandwich-upper/v1","loss_notional":0.990099009900991,"impact_fraction":0.00990099009900991}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_J-qRmy9s01qUKyHHoc88l","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes a deterministic upper-bound price impact loss for a CPMM trade given trade size and pool reserves, without any blockchain or mempool access.","exampleAgentPrompt":"Estimate the worst-case MEV sandwich loss for a trade of 500 tokens into a pool with 100,000 reserve_in and 200,000 reserve_out — give me the impact fraction and notional loss.","exampleUseCases":[{"title":"Pre-trade MEV stress test for DeFi bot","prompt":"Before my trading bot submits this swap of 1,000 USDC into the pool with 500,000 USDC reserve_in and 400,000 ETH reserve_out, what's the upper-bound sandwich loss I should expect?"},{"title":"Slippage guard for agent-executed swap","prompt":"I'm about to execute a trade with amount_in of 250 and pool reserves of 80,000 in and 120,000 out — calculate the maximum impact fraction and notional loss so I can decide whether to proceed."},{"title":"Reserve sizing analysis for liquidity provider","prompt":"If a whale trades 10,000 tokens into my pool that has 300,000 reserve_in and 300,000 reserve_out, what's the worst-case price impact fraction they could inflict as a sandwich attack?"}],"resultDescription":"Returns a deterministic JSON object containing impact_fraction (the fraction of trade value lost to price impact) and loss_notional (the absolute notional loss in input asset units), computed purely from local CPMM math with no external data sources.","failureModes":["Missing required fields (amount_in, reserve_in, reserve_out) return a validation error","Zero or negative reserve values may cause division-by-zero or undefined behavior","Extremely large trade sizes relative to reserves may return impact_fraction near or equal to 1","Payment failure via x402 protocol returns 402 before computation occurs"],"whenToPreferThis":"Choose this endpoint when you need a fast, deterministic, advisory upper-bound on MEV sandwich loss for a CPMM trade and have no access to mempool data or live market feeds. It is ideal for pre-trade risk checks in automated agents, parameter validation in DeFi bots, or stress-testing reserve assumptions — without requiring RPC calls, API keys, or any external infrastructure.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T01:10:59.578Z","isFirstParty":false}