Overview
The SmartDrop Soroban contract emits events for every airdrop operation (creation, claim, expiry). This service needs to index those events so the API can answer queries like "what is the claim status for address X" without making live RPC calls on every request.
Events to Index
Based on the Soroban contract (see smartdrop-contracts):
| Contract Event |
Data |
airdrop_created |
airdrop_id, creator, token, total_amount, expiry_ledger |
recipient_added |
airdrop_id, recipient, amount |
token_claimed |
airdrop_id, recipient, amount, ledger |
airdrop_expired |
airdrop_id, unclaimed_amount |
Architecture
Soroban RPC (getEvents) → EventPoller → EventParser → PostgreSQL → REST API
- Poll
soroban_rpc.getEvents for the contract address every 5 seconds
- Persist the last indexed ledger in DB to survive restarts
- Store raw XDR + decoded event in
contract_events table
- Expose indexed data via new API endpoints
New Endpoints
GET /api/v1/airdrops/:id/status
GET /api/v1/airdrops/:id/recipients
GET /api/v1/recipients/:address/claims
GET /api/v1/indexer/status (lag, last_ledger, events_count)
Acceptance Criteria
Overview
The SmartDrop Soroban contract emits events for every airdrop operation (creation, claim, expiry). This service needs to index those events so the API can answer queries like "what is the claim status for address X" without making live RPC calls on every request.
Events to Index
Based on the Soroban contract (see
smartdrop-contracts):airdrop_createdrecipient_addedtoken_claimedairdrop_expiredArchitecture
soroban_rpc.getEventsfor the contract address every 5 secondscontract_eventstableNew Endpoints
Acceptance Criteria
src/indexer/eventPoller.jspolls Soroban RPC/api/v1/indexer/status