Expand description
Semioscan: Blockchain analytics library for EVM chains
Semioscan provides production-grade tools for:
- Gas cost calculation (L1 and L2 chains)
- Price extraction from DEX events
- Block window calculations
- Token event processing
§Domain Organization
types- Strong types for type safetyconfig- Configuration systemgas- Gas calculation domainprice- Price extraction domainblocks- Block window calculationsevents- Event processingprovider- Dynamic provider utilities for runtime chain selectiontransport- Transport layer utilities (rate limiting, etc.)cache- Caching infrastructure (internal)retrieval- Data orchestration (internal)tracing- Observability (internal)
Re-exports§
pub use config::constants;pub use config::ChainConfig;pub use config::SemioscanConfig;pub use config::SemioscanConfigBuilder;pub use errors::BlockWindowError;pub use errors::EventProcessingError;pub use errors::GasCalculationError;pub use errors::PriceCalculationError;pub use errors::RetrievalError;pub use errors::RpcError;pub use errors::SemioscanError;pub use price::PriceSource;pub use price::PriceSourceError;pub use price::SwapData;pub use transport::RateLimitLayer;pub use transport::RateLimitService;pub use transport::RetryConfig;pub use transport::RetryLayer;pub use transport::RetryLayerBuilder;pub use transport::RetryService;pub use provider::create_http_provider;pub use provider::create_typed_http_provider;pub use provider::network_type_for_chain;pub use provider::rate_limited_http_provider;pub use provider::simple_http_provider;pub use provider::AnyHttpProvider;pub use provider::ChainAwareProvider;pub use provider::ChainEndpoint;pub use provider::DynProviderBuilder;pub use provider::EthereumHttpProvider;pub use provider::NetworkType;pub use provider::OptimismHttpProvider;pub use provider::PooledProvider;pub use provider::ProviderConfig;pub use provider::ProviderPool;pub use provider::ProviderPoolBuilder;
Modules§
- blob
- EIP-4844 Blob Gas Utilities
- config
- Configuration for semioscan operations
- errors
- Error types for the semioscan library.
- price
- Price extraction from DEX swap events
- provider
- Dynamic provider utilities for runtime chain selection
- transport
- Transport layer utilities for Alloy providers.
Structs§
- Access
Sequence - Monotonic sequence number for deterministic LRU ordering
- Amount
Calculator - Calculator for ERC-20 token transfer amounts
- Amount
Result - Result of transfer amount calculation
- Approval
- ERC-20 Approval event
- Blob
Count - Represents the number of EIP-4844 blobs in a transaction
- Blob
GasAmount - Represents the amount of blob gas consumed by EIP-4844 transactions
- Blob
GasPrice - Blob gas price in wei per unit of blob gas (EIP-4844)
- Block
Count - Represents a count of blocks (not a block number)
- Block
Window Calculator - Calculates and caches daily block windows for blockchain queries
- Cache
Key - Key for caching daily block windows
- Cache
Stats - Statistics about cache performance
- Combined
Calculator - Combined
Data Result - Aggregated result for combined data retrieval over a block range.
- Daily
Block Window - Represents an inclusive block range for a specific UTC day on a blockchain
- Disk
Cache - Disk-based cache with file locking, versioning, and TTL support
- Ethereum
Receipt Adapter - Receipt adapter for Ethereum and Ethereum-like chains
- GasAmount
- Amount of gas consumed by a transaction
- GasBreakdown
- Detailed breakdown of gas costs for a transaction
- GasBreakdown
Builder - Builder for constructing GasBreakdown instances
- GasCache
- In-memory cache for gas cost calculation results
- GasCost
Calculator - GasCost
Result - Result of gas cost calculation over a block range
- GasPrice
- Gas price in wei per unit of gas
- L1Data
Fee - L1 data fee for L2 transactions
- MaxBlock
Range - Maximum block range for RPC queries
- Memory
Cache - In-memory cache with optional TTL and size limits
- NoOp
Cache - A no-operation cache that disables caching entirely
- Normalized
Amount - Token amount normalized by decimals (human-readable)
- Optimism
Receipt Adapter - Receipt adapter for Optimism Stack chains
- Percentage
- Represents a percentage value in the range [0.0, 1.0]
- Timestamp
Millis - Unix timestamp in milliseconds for high-precision cache ordering
- Token
Amount - Raw token amount (not normalized for decimals)
- Token
Decimals - ERC-20 token decimal precision
- Token
Price - Price of one token in USDC (or other stablecoin)
- Token
Set - Represents a set of unique token addresses
- Transaction
Count - Represents a count of blockchain transactions
- Transfer
- ERC-20 Transfer event
- Unix
Timestamp - Unix timestamp in seconds (always UTC)
- UsdValue
- Represents a USD-denominated value for amounts, balances, and prices
- WeiAmount
- Represents an amount of native currency (ETH, MATIC, etc.) in wei
Enums§
- Decimal
Precision - Decimal precision for blockchain values
- Event
Type - Type of ERC-20 event for gas calculation
- GasFor
Tx - Gas data for a single transaction
- UsdValue
Error - Errors that can occur when creating a USD value
Traits§
- Block
Window Cache - Trait for block window cache backends
- Receipt
Adapter - Trait for network-specific receipt handling
Functions§
- batch_
fetch_ balances - Batch fetch token balances for multiple (token, holder) pairs.
- batch_
fetch_ eth_ balances - Batch fetch ETH balances for multiple addresses.
- extract_
transferred_ to_ tokens - Extract tokens transferred to a router contract using default configuration
- extract_
transferred_ to_ tokens_ with_ config - Extract tokens transferred to a router contract with custom configuration
- get_
token_ decimal_ precision - Get the decimal precision for a specific token on a specific chain. Native tokens (Address::ZERO) use 18 decimals. Most USDC tokens use 6 decimals, but BSC Binance-Peg USDC uses 18 decimals.
- u256_
to_ bigdecimal - Convert U256 to BigDecimal with decimal scaling for database storage. This function properly handles large decimal places (like 18 for ETH) without overflow.
Type Aliases§
- Balance
Error - Error from a failed balance fetch: (token_address, holder_address, error_message)
- Balance
Query - Query for a token balance: (token_address, holder_address)
- Balance
Result - Result of a successful balance fetch: (token_address, holder_address, balance)