Skip to content

feat: cross-chain price oracle integration#89

Merged
memplethee-lab merged 1 commit into
SourceXXL:mainfrom
A6dulmalik:feature/68-cross-chain-price-oracle
Jun 24, 2026
Merged

feat: cross-chain price oracle integration#89
memplethee-lab merged 1 commit into
SourceXXL:mainfrom
A6dulmalik:feature/68-cross-chain-price-oracle

Conversation

@A6dulmalik

Copy link
Copy Markdown
Contributor

Summary

Implements multi-chain price feed support across Ethereum, BSC, Polygon, Arbitrum, Optimism, and Avalanche with aggregation from multiple on-chain data sources.

Changes

  • PriceRecord entity — stores historical prices per asset/chain with source breakdown, deviation flag, and timestamp (satisfies 2-year retention requirement via persistent DB)
  • PriceFeedService — fetches prices from Chainlink AggregatorV3, Band Protocol StdReference, and Uniswap V3 TWAP per chain; computes median as canonical price; emits price.deviation event when any two sources diverge >5%
  • PriceFeedController — two public endpoints:
    • GET /price-feed/:chain/:asset — current aggregated price
    • GET /price-feed/:chain/:asset/history — historical records (up to 1000)
  • OracleModule — wired in new service, controller, and entity
  • AppModule — registered PriceRecord entity
  • env — added BSC_RPC_URL to env.validation.ts and .env.example
  • 13 unit tests — coverage for aggregation logic, deviation alerting, persistence, and history queries

Acceptance Criteria

  • Price feeds available for 6 blockchains (ETH, BSC, POLY, ARB, OPT, AVAX)
  • Prices aggregated from 3 sources (Chainlink, Band, Uniswap TWAP)
  • Median price used as canonical source
  • Alerts triggered for price deviations >5% between sources
  • Historical price data persisted to DB
  • API returns current and historical prices for all supported chains

Closes #68

- Add PriceRecord entity with SupportedChain (ETH/BSC/POLY/ARB/OPT/AVAX) and PriceSource enums
- Add PriceFeedService with Chainlink, Band Protocol, and Uniswap V3 TWAP adapters
- Aggregate prices via median; emit price.deviation event when sources diverge >5%
- Persist all price fetches to price_records table for 2-year historical retention
- Add PriceFeedController: GET /price-feed/:chain/:asset and GET /price-feed/:chain/:asset/history
- Register PriceRecord entity in OracleModule and AppModule
- Add BSC_RPC_URL to env.validation.ts and .env.example
- Add 13 unit tests covering aggregation, deviation alerting, persistence, and history queries
@memplethee-lab memplethee-lab merged commit 9d45d5f into SourceXXL:main Jun 24, 2026
1 check passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 24, 2026
7 tasks
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.

Cross-Chain Price Oracle Integration

2 participants