Skip to content

enhancement: EVM native balance deltas require trace API support #147

@user1303836

Description

@user1303836

Summary

EVM `NativeBalanceDelta` extraction is intentionally unimplemented (documented in `adapters/src/evm_parser.rs:513-530`). The current workaround infers ETH transfers from the transaction-level `value` field, which is unreliable:

  1. Failed transactions: A tx with `value=1 ETH` that reverts is still recorded as transferred
  2. Internal transfers: Contract-to-contract ETH transfers are invisible without traces
  3. Wrapped ETH: Sending ETH to WETH contract is recorded as a transfer, not a mint
  4. Gas refunds and self-destructs: Not captured

Impact

  • No accurate ETH balance change tracking for any EVM chain
  • Tax software cannot compute correct ETH positions
  • Internal contract interactions (flashloans, DEX routing) are invisible

Recommended Approach

  1. Implement Bronze-layer trace ingestion (`debug_traceTransaction` or `trace_transaction`)
  2. Create `raw_evm_traces` table
  3. Extract pre/post balances from trace data for NativeBalanceDelta materialization
  4. Add E2E tests against mainnet fork with complex contract interactions

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthighHigh severity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions