feat: cross-chain price oracle integration#89
Merged
memplethee-lab merged 1 commit intoJun 24, 2026
Merged
Conversation
- 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
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements multi-chain price feed support across Ethereum, BSC, Polygon, Arbitrum, Optimism, and Avalanche with aggregation from multiple on-chain data sources.
Changes
PriceRecordentity — 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; emitsprice.deviationevent when any two sources diverge >5%PriceFeedController— two public endpoints:GET /price-feed/:chain/:asset— current aggregated priceGET /price-feed/:chain/:asset/history— historical records (up to 1000)OracleModule— wired in new service, controller, and entityAppModule— registeredPriceRecordentityBSC_RPC_URLtoenv.validation.tsand.env.exampleAcceptance Criteria
Closes #68