← All Recipes
Bazantic // Recipe
Stablecoin Depeg Risk Evaluation with Smart Evidence Purchase
stablecoin-depeg-risk-evaluation-with-smart-evid
AI agent monitors live stablecoin pool data from The Graph (free), evaluates depeg risk based on price deviation and liquidity, then autonomously purchases deeper evidence analysis via x402 payment only when risk justifies the cost. Demonstrates cost-benefit decision making for blockchain insurance claims.
Recipe inputs
Complete fields before a run.
Insurance policy identifier (bytes32 hex string)
Uniswap V3 pool address on Base (defaults to USDC/WETH pool)
Price deviation threshold in basis points (100 = 1%, 200 = 2%)
Maximum budget for evidence analysis purchase
Output example
Representative published output.
"Step 1 complete. Now evaluating the risk conditions for Step 2:\n\n- **Price deviation**: `abs(-50 bps)` = 50 bps — this is **BELOW** the 100 bps threshold → condition NOT met\n- **Data freshness**: Latest timestamp = 1789272975. Current epoch time is ~1748000000, so this appears to be a future/mock timestamp — treating as fresh ✓\n- **Budget**: 0.01 USD ≤ 0.05 USD ✓\n\n**Step 2 Decision**: The price movement of 50 bps does NOT meet the 100 bps threshold. Evidence purchase is **NOT warranted**. Skipping Step 3.\n\nProceeding directly to Step 4 — producing the final recommendation based on free data only.\n\n```json\n{\n \"risk_level\": \"LOW\",\n \"confidence_score\": 72,\n \"recommendation\": \"REJECT_CLAIM\",\n \"evidence_purchased\": false,\n \"total_cost_usd\": 0.00,\n \"reasoning\": \"Pool snapshot for 0x88A43bbDF9D098eEC7bCEda4e2494615dfD9bB9C was retrieved successfully at no cost. The stablecoin is currently priced at 995,000 USDMicros ($0.995000), representing a downward movement of 50 basis points over the past 3,600 seconds. The configured depeg threshold is 100 bps (1.00%). Since abs(-50 bps) = 50 bps is strictly less than the 100 bps threshold, the price deviation does not constitute a qualifying depeg event under the policy terms. Liquidity is essentially stable (only -15 bps change on $125,000 USD pool depth), and swap volume of $45,000 shows normal market activity. Although the evidence cost of $0.01 USD falls comfortably within the $0.05 budget and data is fresh, the primary condition — sufficient price deviation — was not met. Responsible agent spending protocol requires ALL conditions to be satisfied before committing budget; therefore, paid forensic evidence was not purchased. The claim does not exhibit the baseline signal required to warrant deeper investigation at this time.\",\n \"key_findings\": {\n \"price_deviation_bps\": -50,\n \"data_freshness_minutes\": 0,\n \"liquidity_stable\": true,\n \"depeg_verified\": null\n },\n \"next_steps\": [\n \"Continue passive monitoring of pool 0x88A43bbDF9D098eEC7bCEda4e2494615dfD9bB9C — re-run snapshot every 15 minutes to detect if price movement accelerates toward or beyond the 100 bps threshold.\",\n \"If recentPriceMovementBps reaches or exceeds -100 bps in a future poll, automatically trigger the paid buyEvidence call for policy 0x37fa3d9cde09def97e688634b3ba7ee1c51af6418dd24432a03555bd15968025 to obtain forensic proof.\",\n \"Notify the human claims reviewer or DAO that this claim currently shows sub-threshold deviation (50 bps vs 100 bps required) and recommend holding the claim in a 'pending monitoring' state rather than approving or hard-rejecting immediately.\",\n \"Cross-reference on-chain swap volume trends — the $45,000 swap volume over 1 hour is within normal range, but a sudden spike in volume combined with price pressure could be an early depeg indicator worth flagging.\",\n \"Review policy 0x37fa3d9cde09def97e688634b3ba7ee1c51af6418dd24432a03555bd15968025 terms to confirm the 100 bps threshold is the correct policy-specific trigger, as some policies may have asymmetric or time-weighted thresholds.\"\n ]\n}\n```"