feat: smart contract event monitoring system#576
Conversation
Implements comprehensive gas optimization toolkit for EVM chains: - GasOptimizer: Real-time gas price monitoring (EIP-1559 + legacy) with multi-chain support (Ethereum, Polygon, BSC, Arbitrum) - Estimator: Gas limit estimation with historical tracking, safety margins, and anomaly detection - Batcher: Transaction batching for ERC-20 transfers with gas savings estimation (up to 60% for 10+ transfers) - Predictor: Gas price prediction using linear regression, trend analysis, and low-traffic period detection Includes unit tests and documentation guide. Refs Spectral-Finance#76
- EventMonitor: real-time event tracking for EVM chains - Subscriber: contract event subscriptions with filtering and resume - Decoder: ABI-based log decoding with ERC-20/721/1155 auto-detection - Storage: persistent event storage with query interface - Alerts: rule-based event alerting (Discord, Telegram, webhooks) - Multi-chain support: Ethereum, Polygon, BSC, Arbitrum - 16K+ test suite covering all modules
|
Review-assist note for the
Suggested acceptance test slice: fake an RPC response with two logs across a block range, assert subscription polling decodes and stores both logs, advances |
|
Follow-up review-assist pass for the The current shape still looks promising, but these details seem worth tightening before maintainers try to verify the acceptance criteria:
Suggested focused verification slice: add fixtures for canonical ERC-20 |
|
Follow-up2 review assist for the
These are smaller than the RPC/persistence gaps already noted, but they are important for maintainer verification: alerts need to fire from subscribed events, and the documented public API should not silently no-op or crash on common input shapes. |
…ectral-Finance#576) Round 1 fixes: - Subscriber: implement real eth_getLogs RPC polling instead of telemetry-only placeholder - Storage: migrate from Agent to ETS-based persistent storage with disk persistence - Webhook: new module with HTTP POST delivery, retry, signature, dead letter queue Round 2 fixes: - Decoder: correct ERC-20 Approval event topic hash to keccak256('Approval(address,address,uint256)') - Storage: full ETS backend with persist/load, subscriber config storage for crash recovery - Webhook: exponential backoff retry, HMAC-SHA256 signature headers, dead letter queue Round 3 fixes: - Alerts: handle string operator keys from JSON/config (normalize to atoms before matching) - Event replay from block range via Subscriber.replay/2 with eth_getLogs - Subscription crash recovery via persisted state (load on init, save on terminate)
56df24c to
82e9157
Compare
Closes #75
Smart Contract Event Monitoring System
Modules
Stats
GitHub: @zp6