Skip to main content

Module inspector

Module inspector 

Source
Expand description

ERC20 Transfer-event capture for reconstructing balance deltas.

This module provides a revm::Inspector that watches logs emitted during a simulation, matches the canonical ERC20 Transfer(address,address,uint256) signature, and records each transfer. The captured transfers let callers compute net balance changes per token and account without re-reading storage after the call.

§Parsing assumptions

Transfers are decoded assuming the standard ERC20 event layout: from and to come from the indexed topics (via Address::from_word, i.e. the low 20 bytes of each 32-byte topic) and value is read from the first 32 data bytes. A non-standard or packed Transfer event (e.g. one that does not index from/to, or packs additional fields into the data) may parse incorrectly or be silently skipped.

Balance deltas are computed symmetrically: a self-transfer where from == to is both subtracted and added, netting to zero for that owner.

Structs§

TokenTransfer
A single ERC20 token transfer decoded from a Transfer log.
TransferInspector
Inspector that captures ERC20 Transfer events during EVM execution.

Functions§

parse_receipt_deltas
Parse ERC20 Transfer events from transaction receipt logs and compute balance deltas for the given owner address.