DEV Community

Neurobyteio. Agentrisk M2M
Neurobyteio. Agentrisk M2M

Posted on

I Added Live Sell Simulation to My Token Risk API — Here's What It Catches That Static Analysis Misses

Static honeypot detection has a blind spot: it reads contract code, not contract behavior. A token can look completely clean in its bytecode and still be unsellable in practice — some scammers design contracts to behave normally for the first N buys, then flip a switch that blocks sells entirely. No amount of reading _transfer() logic catches that in advance.

So I added a different kind of check to AgentRisk: instead of reading code, it actually simulates a sell right now, live, against the real pool.

How it works

Most tokens on Base trade through Uniswap V3, not V2. That matters here — V3 doesn't have a simple getAmountsOut() call like V2 does. Instead, I'm using Uniswap's QuoterV2 contract and its quoteExactInputSingle method, trying across the standard fee tiers (0.01%, 0.05%, 0.3%, 1%) until one resolves:

python
async def _simulate_sell(rpc_manager, token_address):
async def try_quote(w3):
for fee_value, fee_name in [(100, "0.01%"), (500, "0.05%"), (3000, "0.3%"), (10000, "1%")]:
try:
result = await w3.eth.call({
"to": QUOTER_V2_ADDRESS,
"data": build_quote_calldata(token_address, WETH, fee_value)
})
amount_out = int.from_bytes(result[:32], "big")
return {"sellable": True, "fee_tier": fee_name, "amount_out_weth": amount_out / 1e18}
except Exception:
continue
return {"sellable": False}
return await rpc_manager.call_with_fallback(try_quote)

No wallet needed, no gas spent, no real transaction — eth_call just asks "what would happen if" without committing anything.

What it actually caught

I tested it against a token already confirmed as a honeypot by static analysis (GoPlus flagged it, and it's independently verified on TokenSniffer):

json
{
"is_honeypot": true,
"sell_simulation": {"sellable": false}
}

Both signals agree — good, that's expected. But then I tested a normal, tradeable token where static analysis didn't have a strong opinion:

json
{
"is_honeypot": null,
"sell_simulation": {
"sellable": true,
"fee_tier": "1%",
"amount_out_weth": 0.000015
}
}

Here's the interesting part: GoPlus returned null for honeypot status — it genuinely didn't know. The live simulation gave a definitive, independent answer anyway. That's the actual value: not replacing static analysis, but backing it up with something that can't lie about the present moment.

Why this matters for autonomous agents specifically

A human trader might shrug at "unknown" and manually check DexScreener. An autonomous agent making a buy decision doesn't have that luxury — it either has a clear signal or it's flying blind. Live simulation turns "we don't know" into "we just checked, right now, for real."

Where this fits

AgentRisk is a pre-trade risk API for Base tokens — honeypot detection, deployer wallet freshness, brand impersonation, on-chain LP lock verification, and now live sell simulation. Paid per call via x402 (0.15 USDC), no signup. Listed on Coinbase's x402 Bazaar, base/skills, and Bankr's skill registry.

Repo: github.com/Neurobyteio/agentrisk
Try it: agentrisk.dev

Top comments (0)