Crate tempo_precompiles_macros

Crate tempo_precompiles_macros 

Source
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 structs
  • storable_alloy_ints! macro for generating alloy integer storage implementations
  • storable_alloy_bytes! macro for generating alloy FixedBytes storage implementations
  • storable_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 StorableType and Storable<1> implementations for alloy FixedBytes<N> types.
storable_alloy_ints
Generate StorableType and Storable<1> implementations for alloy integer types.
storable_arrays
Generate Storable implementations for fixed-size arrays of primitive types.
storable_nested_arrays
Generate Storable implementations for nested arrays of small primitive types.
storable_rust_ints
Generate StorableType and Storable<1> implementations for all standard integer types.

Structsยง

FieldInfo ๐Ÿ”’
Information extracted from a field in the storage schema

Enumsยง

FieldKind ๐Ÿ”’
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 Storable trait for structs with named fields.