revm_primitives/eip7708.rs
1//! Constants for [EIP-7708](https://eips.ethereum.org/EIPS/eip-7708): ETH transfers emit a log.
2//!
3//! This EIP specifies that all ETH transfers (transactions, CALL, SELFDESTRUCT) emit a log,
4//! making ETH transfers trackable like ERC-20 tokens.
5
6use alloy_primitives::{address, b256, Address, B256};
7
8/// The system address used as the log emitter for ETH transfer events.
9///
10/// This matches the ERC-20 Transfer event format but uses a system address
11/// as the emitter since no contract actually emits these logs.
12pub const ETH_TRANSFER_LOG_ADDRESS: Address =
13 address!("0xfffffffffffffffffffffffffffffffffffffffe");
14
15/// The topic hash for the Transfer event: `keccak256("Transfer(address,address,uint256)")`.
16///
17/// This is the same topic used by ERC-20 tokens for transfer events, ensuring
18/// compatibility with existing indexing and tracking infrastructure.
19pub const ETH_TRANSFER_LOG_TOPIC: B256 =
20 b256!("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef");
21
22/// The topic hash for self-destruct to self events.
23///
24/// This is emitted when a contract self-destructs to itself, which doesn't
25/// involve an actual transfer but still needs to be logged.
26/// `keccak256("SelfBalanceLog(address,uint256)")`
27pub const SELFDESTRUCT_TO_SELF_LOG_TOPIC: B256 =
28 b256!("0x4bfaba3443c1a1836cd362418edc679fc96cae8449cbefccb6457cdf2c943083");