Risk engine
Deterministic prerequisites for review, with thresholds, failure behavior and blind spots.
Nine implemented checks · wallet gate closed
01The nine checks
lib/protection.ts supplies eight checks; the client appends price impact. Every failed row blocks Ready. The additional global release gate disables all wallet actions regardless of these results. User-facing details are shown below.
| Check / inputs | Pass rule | Failure text / blocking behavior | Limit |
|---|---|---|---|
| Wallet & network: account, chain | Connected AND chainId = 4663 | Wallet must be connected to Robinhood Chain. | RPC chain is separately checked. |
| Token balance: amount, balance | Defined; balance ≥ amount | Onchain balance must cover the exact input. | An observation, not a reservation. |
| Token integrity: current metadata | Current quote after canonical checks | Canonical token code, decimals and symbol must match. | Not an audited-bytecode proof. |
| Quote freshness: created, now | 0 ≤ age < 30,000 ms | Quotes expire after 30 seconds. | Freshness is not price fairness. |
| Executable route: quote, preparation, allowance | Current; accepted impact; min > 0; matching preparation; allowance valid | Only independently verified routes can proceed. | Approval-required is not swap-ready. |
| Slippage bounds: percent | 0.1 ≤ s ≤ 3; finite schema value | Allowed range: 0.1% to 3%. | No confidentiality or MEV guarantee. |
| Gas sufficiency: ETH, value, fee | Matching preparation; ETH ≥ value + fee | ETH must cover value and estimated network fees. | Fees can change. |
| Transaction simulation: preparation | Matching exact swap call succeeds | The exact transaction must simulate successfully. | Approval simulation alone does not pass swap simulation. |
| Price impact: quote impact | −1% ≤ I ≤ 5% | Execution blocked above 5% price impact or below -1% inconsistent impact. | Fee-inclusive spot comparison, no fair-price oracle. |
02Readiness and status transitions
Ready requires all nine booleans and the release gate. Caution covers a current quote with incomplete execution checks or approval required. Without a current quote the interface shows Unavailable. Changed inputs or errors remove readiness and require revalidation.
The current HIGH RISK branch requires an error beginning with “High risk”. Impact failure independently blocks the route but does not itself set that prefix, so it can show Caution instead. Status text is not a risk score. The current primary action reads Wallet testing paused.
03Blocking errors
Invalid amount/precision prevents quoting. Malformed response, changed parameters, expired timing, wrong RPC chain, expired onchain deadline, insufficient tokens, missing contract, router mismatch, failed approval simulation, failed swap simulation or insufficient ETH prevents preparation or sending.
The first actionable error is surfaced while read-only market data is retained where possible. User rejection is not confirmation. Pending receipt stays pending. Confirmed approval returns to quote/preparation, not automatic swap submission.
04Five distinct claims
A valid route passes the configured pair/pool/quote checks. An executable quote adds matching account preparation, funds, allowance, gas and accepted freshness/impact. Successful simulation means a call succeeded against observed state. Confirmed execution requires an actual successful receipt. Economic safety is a broader assessment that this engine does not provide.
Simulation cannot guarantee profit, fair price, MEV resistance, contract correctness or future inclusion. No external USD oracle, token valuation, honeypot classifier or comprehensive manipulation detector is implemented.