1#![cfg_attr(not(test), warn(unused_crate_dependencies))]
13#![cfg_attr(not(feature = "std"), no_std)]
14
15#[cfg(not(feature = "std"))]
16extern crate alloc as std;
17
18pub mod constants;
19pub mod eip170;
20pub mod eip3860;
21pub mod eip4844;
22pub mod eip7702;
23pub mod eip7823;
24pub mod eip7825;
25pub mod eip7907;
26pub mod hardfork;
27mod once_lock;
28
29pub use constants::*;
30pub use once_lock::OnceLock;
31
32pub use alloy_primitives::map::{self, hash_map, hash_set, HashMap, HashSet};
35pub use alloy_primitives::{
36 self, address, b256, bytes, fixed_bytes, hex, hex_literal, keccak256, ruint, uint, Address,
37 Bytes, FixedBytes, Log, LogData, TxKind, B256, I128, I256, U128, U256,
38};
39
40pub type StorageKey = U256;
43
44pub type StorageValue = U256;
47
48pub const SHORT_ADDRESS_CAP: usize = 300;
50
51#[inline]
56pub fn short_address(address: &Address) -> Option<usize> {
57 if address.0[..18].iter().all(|b| *b == 0) {
58 let short_address = u16::from_be_bytes([address.0[18], address.0[19]]) as usize;
59 if short_address < SHORT_ADDRESS_CAP {
60 return Some(short_address);
61 }
62 }
63 None
64}
65
66pub const ONE_ETHER: u128 = 1_000_000_000_000_000_000;
68
69pub const ONE_GWEI: u128 = 1_000_000_000;