Afrilance emits on-chain events for monitoring and integrations.
Event Handling & Data Synchronization
Instead of relying on traditional indexing solutions, AfriLance uses a custom on-chain event watcher built into the backend for real-time synchronization.
Our Approach
- Event Watcher Pattern: The backend continuously listens to relevant smart contract events using ethers.js getLogs with intelligent block range management.
- Safe & Reliable: Includes automatic handling for pruned history, reorgs, and RPC failover.
- Real-time Updates: Events (e.g., PaylinkCreated, PaylinkPaid, JobCreated, Approved, etc.) are processed immediately and stored in Supabase.
Why We Chose This Approach
- Full control over data processing and business logic
- No dependency on external indexing services (The Graph, custom indexers, etc.)
- Lower latency and cost for our use case
- Better debugging and maintainability
- Works reliably on both BNB Testnet and Base Sepolia
This event-driven architecture powers both Escrow and Paylink products, ensuring accurate and timely updates across the frontend, database, and Telegram notifications.
Escrow Events