Skip to content

feat: replace mock APY sources with real protocol fetchers (closes #157)#183

Merged
robertocarlous merged 1 commit into
Neurowealth:mainfrom
BernardOnuh:feat/real-protocol-fetchers
Jun 18, 2026
Merged

feat: replace mock APY sources with real protocol fetchers (closes #157)#183
robertocarlous merged 1 commit into
Neurowealth:mainfrom
BernardOnuh:feat/real-protocol-fetchers

Conversation

@BernardOnuh

Copy link
Copy Markdown
Contributor

Description

This PR replaces the mocked APY data in the scanner with real data fetchers from three Stellar protocols.

Closes #157

Changes Made

  • ✅ Added fetchWithRetry utility with timeout, retry, and circuit breaker support
  • ✅ Implemented real fetchBlendApy() using Blend Capital API
  • ✅ Implemented real fetchStellarDexApy() using Stellar Horizon API
  • ✅ Implemented real fetchLumaApy() using Luma Finance API
  • ✅ Added metrics tracking: fetch duration, failures per source, stale-rate detection
  • ✅ Added persistence to ProtocolRate table with raw response data
  • ✅ Added TVL filtering (minimum 10,000 USDC)
  • ✅ Added comprehensive error handling and logging

Implementation Details

  • Blend: Fetches USDC reserve supply APY from Blend Capital API
  • Stellar DEX: Aggregates weighted average fee APY from liquidity pools
  • Luma: Fetches USDC APY rates from Luma Finance API

Testing

  • All fetchers include timeout protection (5s)
  • Retry logic with exponential backoff (3 retries)
  • Circuit breaker prevents cascading failures
  • Graceful degradation if any protocol fails

Environment Variables Required

STELLAR_NETWORK=mainnet|testnet|futurenet
HORIZON_URL=https://horizon.stellar.org  # optional
BLEND_POOL_ID=GBUQWP3BOUZX34PISXEAMBNIZJLNCLVNX77MHAHVXHVVB4CMYAOK6BAC  # optional
LUMA_API_URL=https://api.luma.finance  # optional
USDC_ISSUER=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN  # optional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove mock protocol APY sources; implement real protocol rate fetchers

2 participants