← Sol Node Labs

Build a fail-closed token risk preflight into a Base trading bot

An automated swap should not treat “the contract call succeeded” as evidence that the token is safe to buy or sell. A useful preflight combines independent signals, records missing evidence, and refuses execution when the evidence is incomplete.

Minimum decision rule: block the trade on honeypot evidence, excessive taxes, transfer restrictions, unverified source plus weak liquidity, dangerous owner controls, or unavailable critical data.

1. Normalize the asset and chain

Require an exact 20-byte EVM address, bind it to Base chain ID 8453, and reject symbols or names as identifiers. Cache only by chain plus normalized contract address.

2. Collect independent evidence

3. Fail closed on missing data

Timeouts and unavailable providers are not low-risk observations. Return a completeness field alongside the score and require the caller to decide whether degraded evidence is acceptable.

const decision = await riskPreflight({ chain: "base", token });

if (decision.dataCompleteness !== "complete") {
  return { execute: false, reason: "risk_evidence_incomplete" };
}
if (decision.flags.some(flag => BLOCKING_FLAGS.has(flag))) {
  return { execute: false, reason: "blocking_token_risk", flags: decision.flags };
}
if (decision.riskScore >= 40) {
  return { execute: false, reason: "risk_threshold_exceeded" };
}
return { execute: true, evidenceId: decision.evidenceId };

4. Preserve the evidence used to decide

Store timestamps, provider status, normalized inputs, raw signal summaries, the policy version, and the resulting action. Without that record, a bot cannot explain why a trade was allowed after market conditions change.

5. Keep the risk gate separate from execution

The risk component should return evidence and a deterministic recommendation. The execution component should enforce position size, slippage, approval, and transaction simulation independently.

Need this fitted to an existing bot?

Sol Node Labs offers a fixed-scope $49 USDC pilot that adds the preflight, fail-closed policy, and evidence logging to one existing workflow.

Request the integration pilot

This guide describes engineering controls, not financial advice or a guarantee of token safety.