A few days ago, AgentRisk M2M's "live sell simulation" only worked if a token traded against WETH on Uniswap V3. Today it works across Uniswap V2, V3, V4, and Aerodrome (both classic AMM and Slipstream concentrated liquidity) — every major DEX architecture currently live on Base.
Here's what that journey looked like, because each architecture broke in a genuinely different way.
Where it started: one method, one quote token
The original implementation called Uniswap V3's QuoterV2 with a hardcoded WETH output token, looping through the four standard fee tiers. It worked — right up until I ran it against real, randomly-picked tokens instead of the ones I'd been testing with. Roughly half of them came back sellable: false, which turned out to be wrong. The tokens were fine. My assumption that everything quotes against WETH on Uniswap V3 was not.
Fix #1: stop assuming, start asking
DexScreener already tells you the real quote token and DEX for a pair — quoteToken.symbol and dexId. Instead of hardcoding WETH, the fix was to look up the actual highest-liquidity pair and use whatever it's actually quoted against (VIRTUAL, USDC, whatever). That alone fixed a chunk of false negatives.
Fix #2: two universal read methods instead of one fee-tier-guessing loop
Rather than keep looping through Uniswap-specific fee tiers, I switched to two methods that work across pool types, not specific protocols:
`python
V2-style AMM pools
result = await w3.eth.call({"to": pair, "data": "0x0902f1ac"}) # getReserves()
V3-style concentrated liquidity pools (works on both Uniswap V3 and Aerodrome Slipstream)
result = await w3.eth.call({"to": pair, "data": "0x3850c7bd"}) # slot0()`
getReserves() covers simple constant-product pools. slot0() reads the current price directly off any Uniswap-v3-shaped pool — Uniswap V3 or Aerodrome's Slipstream, since Slipstream is architecturally a v3 fork. This alone took coverage from "Uniswap-only" to "most of Base."
The Aerodrome detour: four factories, one confusing revert
Aerodrome Slipstream has shipped multiple pool factories over time. I found a live, liquid pool that reverted on every quoter call I tried — right selector, right tick spacing, still nothing. Turned out the pool was deployed by a different factory than the one my quoter contract was wired to. Verified by comparing factory() on the quoter against factory() on the pool itself — different addresses. This is apparently a known gotcha; Aerodrome's own dev docs warn against hardcoding factory addresses for exactly this reason. The slot0() approach sidesteps the whole problem, since it reads straight from the pool, not through a factory-bound quoter.
The last piece: Uniswap V4
V4 doesn't have per-pool contracts at all — every pool lives inside one singleton PoolManager, addressed by a PoolId (a bytes32 hash of the pool's parameters) instead of a normal address. DexScreener conveniently labels these pairs "v4" and returns the PoolId directly as the pairAddress field. From there, Uniswap's official StateView periphery contract exposes getSlot0(PoolId) for exactly this kind of off-chain read:
`python
selector = "c815641c" # getSlot0(bytes32)
data = "0x" + selector + pool_id[2:].zfill(64)
result = await w3.eth.call({"to": state_view_address, "data": data})
sqrt_price_x96 = int.from_bytes(result[0:32], "big")
`
Same sqrtPriceX96 math as everywhere else — just a different entry point.
Where it ended up
The live check now branches by what DexScreener reports about the pool (V4 label → StateView, otherwise try getReserves() then slot0()), instead of assuming a single protocol and quote asset. On a batch of newly-tested random Base tokens, it correctly returned a real answer for every single one — no more silent wrong answers, no more "unsupported."
Where this fits
AgentRisk M2M is a pre-trade risk API for Base tokens — honeypot detection, deployer wallet freshness, on-chain LP-lock verification, brand impersonation checks, and this sell simulation, plus cryptographically signed result receipts so other agents can verify a result without re-querying. Paid per call via x402 (0.15 USDC), or a free public UI with 3 free scans.
Repo: github.com/Neurobyteio/agentrisk
Try it: agentrisk.dev
Top comments (0)