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 processingcache- 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;
Modules§
- config
- Configuration for semioscan operations
- errors
- Error types for the semioscan library.
- price
- Price extraction from DEX swap events
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
- 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
- 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§
- 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.