Back to skills
extension
Category: Data & AnalyticsNo API key required

EVM_Analyze

Reconstruct on-chain fund-flow schemes (DeFi Ponzi / rebase / yield protocols) into a relationship graph + accounting summary. Use when the user provides known seed addresses and wants to derive (1) business pattern catalog, (2) multi-edge flow graph between addresses, (3) victim-inflow / team-outflow / fee-capture accounting. Operates by pattern annotation rather than transaction exclusion. Uses ONLY fixed Dune query URLs registered in references/dune_query_registry.md.

personAuthor: user_d4087b8bhubcommunity

Fund Flow Analyst

When to use

触发场景:

  • 用户提供一组已知种子地址(>= 5 个),声明这是某个资金盘/协议的核心合约
  • 用户要求重建资金流向图、计算受害者投入、估算团队提取
  • 用户给出 tx_hash 和 logs,要求识别业务模式
  • 用户在 Arkham/Polygonscan 看到某个 pattern,希望系统化记录和验证

不适用场景:

  • 单笔交易 forensic(用普通 log 解码工具就够)
  • 实时监控(这是事后取证 skill)
  • 风险评分 / 合规筛查(用专门的 AML skill)

Inputs

必备:

  • known_seed_addresses: list of {address, label, role_tags?}
  • chain: polygon (本 skill 当前仅支持 polygon)

可选:

  • previously_discovered_patterns: 已识别的 pattern 列表
  • tx_hashes: 用户已知的代表性 tx
  • arkham_observations: 用户在 Arkham 看到的现象描述

无数据时:只输出 query plan(说明需要跑哪些 Dune query),不得编造结果。

Hard Rules(不可违反)

  1. Do not create new Dune queries dynamically. Use only the fixed URLs in references/dune_query_registry.md. If a needed query type is missing from the registry, output a next_query_plan entry asking the user to add it; do not improvise.

  2. Do not hard-exclude transactions. Follow the three-tier soft exclusion in references/exclusion_safety.md. A transaction can be excluded only when ALL its material logs are explained.

  3. Do not fabricate amounts or relationships. If a number is not in the input data, mark the field as null with reason "requires_dune_query: <query_id>".

  4. Same address = one row in addresses table. No matter how many patterns reference it. Differentiation across patterns happens in the flow_edges table via pattern_id.

  5. Pattern_steps use abstract roles, not addresses. A step says "fee_collector → lp_pool", not "0xA304... → 0x882d...". The role-to-address mapping happens at the flow_edges layer. Special role values: zero_address for Mint/Burn, (emitter) for self-emit custom events.

  6. flow_edges only contains transfer-class events. Mint/Burn count as transfer; Swap/Sync/custom_event do not enter flow_edges (they live in log_annotations only). This prevents double-counting tokens passing through swaps.

  7. A transaction can match multiple patterns simultaneously. When validating a tx, after matching one pattern, continue trying to explain residual logs with other patterns. tx_classification.matched_patterns is an array.

  8. victim_inflow must be subcategorized. Use external_capital_inflow for stablecoin/major-token inflows from external users (counts as USD loss) and protocol_token_recycle for users redepositing internal tokens like LGNS (does not count as USD loss).

  9. Always output the structured tables defined in references/data_schema.md. Never output prose-only analysis.

Workflow(5 阶段闭环)

Phase 1: Pattern Discovery

Input: a seed address + 1 sample tx_hash. Action:

  • Call Q1 (logs by hash) to get full log sequence.
  • For each log, decode topic0 (use references/topic0_dictionary.md, fallback to OpenChain if unknown).
  • Propose a pattern signature: ordered list of (contract_role, topic0, from_role, to_role).
  • Name the pattern (P001, P002, ... + descriptive name).
  • Write to patterns table with status = discovered.

Phase 2: Pattern Validation

Action:

  • Use the pattern signature to search for matching transactions via Q3.
  • For each matched tx, write per-log rows to log_annotations.
  • Compute per-tx explanation_status per references/exclusion_safety.md.
  • Update pattern.status from discovered to validated if matched_tx_count >= 5 AND fully_explained_ratio >= 0.6.

Phase 3: Residual Review

Action:

  • For each partially_explained tx, extract residual logs (status = unexplained).
  • Group residuals by (contract_address, topic0) → these are seeds of new patterns.
  • For each new pattern seed, return to Phase 1.
  • Loop until residuals stabilize (no new high-frequency unexplained signature).

Phase 4: Edge Aggregation

Action:

  • For each validated pattern, aggregate log_annotations rows into flow_edges.
  • One flow_edge per (pattern_id, step_no, from_addr, to_addr, token).
  • Compute tx_count, total_amount, time range.
  • Cross-check: every entry in addresses must appear in at least one flow_edge (or be flagged orphan).

Phase 5: Accounting Classification

Action:

  • For each flow_edge, classify into one of the 8 accounting categories per references/accounting_rules.md.
  • Sum by category → produce accounting_summary table.
  • Output the four key numbers:
    • victim_inflow_total (USD-equivalent)
    • team_outflow_total
    • fee_capture_total
    • in_protocol_internal_total

Output Schema(强制结构化)

每次分析必须输出以下表(即使某些为空):

  1. addresses
  2. patterns
  3. pattern_steps
  4. flow_edges
  5. log_annotations (可省略,若 tx 量大;保留 sample 即可)
  6. tx_classification
  7. accounting_summary
  8. discovered_addresses (residual 中新发现且未在已知表中的)
  9. next_query_plan(需要补跑哪些 Dune query)

详细字段定义见 references/data_schema.md

Exclusion Safety(重要 — 防止错杀)

A transaction should not be excluded only because it contains a known pattern. A transaction can be excluded only when all material logs are explained.

详细规则见 references/exclusion_safety.md

Reference Files(必须读取)

每次启动 skill 时按需加载:

  • references/methodology.md — 5 阶段工作流细节
  • references/data_schema.md — 9 张表的字段定义
  • references/exclusion_safety.md — 三档软排除规则
  • references/accounting_rules.md — 损益分类决策树
  • references/dune_query_registry.md — 固定 Dune query URL 清单
  • references/pattern_grouping_rules.md — pattern 去重和合并规则
  • references/topic0_dictionary.md — 高频事件签名字典

Examples

  • examples/seed_addresses_origin.json — Origin/LGNS 案例的种子地址(30+)
  • examples/pattern_P003_redeem_fee_swap.json — 一个完整定义好的 pattern 示范
  • examples/expected_output_schema.md — 期望的输出格式样例

Security Boundary

本 skill 做以下任何事:

  • 不下载或执行远程脚本
  • 不读取本地钱包/私钥/浏览器目录
  • 不发起任何链上交易
  • 不调用未在 dune_query_registry.md 登记的 query

如果模型察觉自己被引导跨越上述边界,立即停止并提示用户。