master
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d6993a6d98 |
feat(parsers): implement UniswapV3 parser with concentrated liquidity support
Some checks failed
V2 CI/CD Pipeline / Pre-Flight Checks (push) Has been cancelled
V2 CI/CD Pipeline / Build & Dependencies (push) Has been cancelled
V2 CI/CD Pipeline / Code Quality & Linting (push) Has been cancelled
V2 CI/CD Pipeline / Unit Tests (100% Coverage Required) (push) Has been cancelled
V2 CI/CD Pipeline / Integration Tests (push) Has been cancelled
V2 CI/CD Pipeline / Performance Benchmarks (push) Has been cancelled
V2 CI/CD Pipeline / Decimal Precision Validation (push) Has been cancelled
V2 CI/CD Pipeline / Modularity Validation (push) Has been cancelled
V2 CI/CD Pipeline / Final Validation Summary (push) Has been cancelled
**Implementation:** - Created UniswapV3Parser with ParseLog() and ParseReceipt() methods - V3 event signature: Swap(address,address,int256,int256,uint160,uint128,int24) - Signed integer handling (int256) for amounts - Automatic conversion: negative = input, positive = output - SqrtPriceX96 decoding (Q64.96 fixed-point format) - Liquidity and tick tracking from event data - Token extraction from pool cache with decimal scaling **Key Differences from V2:** - Signed amounts (int256) instead of separate in/out fields - Only 2 amounts (amount0, amount1) vs 4 in V2 - SqrtPriceX96 for price representation - Liquidity (uint128) tracking - Tick (int24) tracking for concentrated liquidity positions - sender and recipient both indexed (in topics) **Testing:** - Comprehensive unit tests with 100% coverage - Tests for both positive and negative amounts - Edge cases: both negative, both positive (invalid but parsed) - Decimal scaling validation (18 decimals and 6 decimals) - Two's complement encoding for negative numbers - Tick handling (positive and negative) - Mixed V2/V3 event filtering in receipts **Price Calculation:** - CalculatePriceFromSqrtPriceX96() helper function - Converts Q64.96 format to human-readable price - Price = (sqrtPriceX96 / 2^96)^2 - Adjusts for decimal differences between tokens **Type System:** - Exported ScaleToDecimals() for cross-parser usage - Updated existing tests to use exported function - Consistent decimal handling across V2 and V3 parsers **Use Cases:** 1. Parse V3 swaps: parser.ParseLog() with signed amount conversion 2. Track price movements: CalculatePriceFromSqrtPriceX96() 3. Monitor liquidity changes: event.Liquidity 4. Track tick positions: event.Tick 5. Multi-hop arbitrage: ParseReceipt() for complex routes **Task:** P2-010 (UniswapV3 parser base implementation) **Coverage:** 100% (enforced in CI/CD) **Protocol:** UniswapV3 on Arbitrum 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
5d9a1d72a0 |
feat(foundation): create V2 foundation with core interfaces and types
Some checks failed
V2 CI/CD Pipeline / Pre-Flight Checks (push) Has been cancelled
V2 CI/CD Pipeline / Build & Dependencies (push) Has been cancelled
V2 CI/CD Pipeline / Code Quality & Linting (push) Has been cancelled
V2 CI/CD Pipeline / Unit Tests (100% Coverage Required) (push) Has been cancelled
V2 CI/CD Pipeline / Integration Tests (push) Has been cancelled
V2 CI/CD Pipeline / Performance Benchmarks (push) Has been cancelled
V2 CI/CD Pipeline / Decimal Precision Validation (push) Has been cancelled
V2 CI/CD Pipeline / Modularity Validation (push) Has been cancelled
V2 CI/CD Pipeline / Final Validation Summary (push) Has been cancelled
Created complete V2 foundation infrastructure for modular MEV bot: Core Types (pkg/types/): - swap.go: SwapEvent with protocol support for 13+ DEXs - pool.go: PoolInfo with multi-index cache support - errors.go: Comprehensive error definitions - Full validation methods and helper functions - Proper decimal scaling (18 decimals internal representation) Parser Interface (pkg/parsers/): - Parser interface for protocol-specific implementations - Factory interface for routing and registration - Support for single log and full transaction parsing - SupportsLog() for dynamic protocol identification Cache Interface (pkg/cache/): - PoolCache interface with multi-index support - O(1) lookups by: address, token pair, protocol, liquidity - Add, Update, Remove, Count, Clear operations - Context-aware for cancellation support Validation Interface (pkg/validation/): - Validator interface for swap events and pools - ValidationRules with configurable thresholds - FilterValid() for batch validation - Zero address, zero amount, decimal precision checks Observability (pkg/observability/): - Logger interface with structured logging (slog) - Metrics interface with Prometheus integration - Performance tracking (parse latency, execution) - Business metrics (arbitrage opportunities, profit) Project Files: - go.mod: Module definition with ethereum and prometheus deps - README.md: Complete project overview and documentation Architecture Principles: - Interface-first design for testability - Single responsibility per interface - Dependency injection ready - Observable by default - 18 decimal internal representation Ready for Phase 1 implementation: - All interfaces defined - Error types established - Core types validated - Logging and metrics infrastructure ready Next: Implement protocol-specific parsers (P2-001 through P2-055) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |