Expand description
Storage slot identification and decoding utilities for Solidity storage layouts.
This module provides functionality to identify and decode storage slots based on Solidity storage layout information from the compiler.
Re-exportsΒ§
use crate::mapping_slots::MappingSlots;πuse alloy_dyn_abi::DynSolType;πuse alloy_dyn_abi::DynSolValue;πuse alloy_primitives::B256;πuse alloy_primitives::U256;πuse alloy_primitives::hex;πuse alloy_primitives::hex;πuse alloy_primitives::keccak256;πuse alloy_primitives::map::B256Map;πuse foundry_common_fmt::format_token_raw;πuse foundry_compilers::artifacts::Storage;πuse foundry_compilers::artifacts::StorageLayout;πuse foundry_compilers::artifacts::StorageType;πuse serde::Serialize;πuse serde::Serialize;πuse std::collections::BTreeMap;πuse std::str::FromStr;πuse std::sync::Arc;πuse tracing::trace;π
StructsΒ§
- Decoded
Slot Values - Decoded storage slot values
- Slot
Identifier - Storage slot identifier that uses Solidity [
StorageLayout] to identify storage slots. - Slot
Info - Information about a storage slot including its label, type, and decoded values.
- Storage
Type Info - Wrapper type that holds both the original type label and the parsed DynSolType.
ConstantsΒ§
- ENCODING_
BYTES - βbytesβ encoding type for bytes and string types, which use either inplace or keccak256 hash-based storage depending on length
- ENCODING_
DYN_ ARRAY - βdynamic_arrayβ encoding type for dynamic arrays, which uses keccak256 hash-based storage
- ENCODING_
INPLACE - βinplaceβ encoding type for variables that fit in one storage slot i.e 32 bytes
- ENCODING_
MAPPING - βmappingβ encoding type for Solidity mappings, which use keccak256 hash-based storage
FunctionsΒ§
- get_
array_ πbase_ indices - Returns the base indices for array types, e.g. β[0][0]β for 2D arrays.
- is_
struct - Checks if a given type label represents a struct type.
- parse_
sol_ πtype - Parses a storage type label into a [
DynSolType], returningNonefor labels that have no direct ABI equivalent (mappings, structs). - serialize_
mapping_ πkeys - Custom serializer for mapping keys
- serialize_
slot_ πtype - Custom serializer for StorageTypeInfo that only outputs the label