Expand description
Procedural macros for generating type-safe EVM storage accessors.
This crate provides:
#[contract]macro that transforms a storage schema into a fully-functional contract#[derive(Storable)]macro for multi-slot storage structsstorable_alloy_ints!macro for generating alloy integer storage implementationsstorable_alloy_bytes!macro for generating alloy FixedBytes storage implementationsstorable_rust_ints!macro for generating standard Rust integer storage implementations
Modulesยง
- layout ๐
- packing ๐
- Shared code generation utilities for storage slot packing.
- storable ๐
- Implementation of the
#[derive(Storable)]macro. - storable_
primitives ๐ - Code generation for primitive type storage implementations.
- storable_
tests ๐ - Code generation for storage trait property tests.
- utils ๐
- Utility functions for the contract macro implementation.
Macrosยง
- gen_
storable_ tests - Generate comprehensive property tests for all storage types.
- gen_
test_ fields_ layout - Test helper macro for validating slots
- gen_
test_ fields_ struct - Test helper macro for validating slots
- storable_
alloy_ bytes - Generate
StorableTypeandStorable<1>implementations for alloyFixedBytes<N>types. - storable_
alloy_ ints - Generate
StorableTypeandStorable<1>implementations for alloy integer types. - storable_
arrays - Generate
Storableimplementations for fixed-size arrays of primitive types. - storable_
nested_ arrays - Generate
Storableimplementations for nested arrays of small primitive types. - storable_
rust_ ints - Generate
StorableTypeandStorable<1>implementations for all standard integer types.
Structsยง
- Field
Info ๐ - Information extracted from a field in the storage schema
Enumsยง
- Field
Kind ๐ - Classification of a field based on its type
Constantsยง
- RESERVED ๐
Functionsยง
- gen_
contract_ ๐output - Main code generation function with optional call trait generation
- gen_
contract_ ๐storage - Main code generation function for storage accessors
- parse_
fields ๐
Attribute Macrosยง
- contract
- Transforms a struct that represents a storage layout into a contract with helper methods to easily interact with the EVM storage. Its packing and encoding schemes aim to be an exact representation of the storage model used by Solidity.
Derive Macrosยง
- Storable
- Derives the
Storabletrait for structs with named fields.