Skip to content

Conversation

@timbrinded
Copy link
Collaborator

This pull request introduces several improvements and refactorings to the TQ Oracle codebase, focusing on price feed handling, adapter configuration, and code maintainability. The most notable changes are a major refactor of the Pyth price adapter to dynamically discover price feeds, removal of unused domain models, and updates to pipeline context and pricing logic to support configurable base assets.

Price Adapter Improvements

  • The Pyth price adapter (src/tq_oracle/adapters/price_adapters/pyth.py) was refactored to dynamically discover price feed IDs from the Hermes API instead of relying on hardcoded values. This allows for more flexible asset support and reduces maintenance overhead. The adapter now uses canonicalized addresses, validates staleness and confidence intervals, and provides clearer logging for missing or stale feeds. [1] [2]
  • The hardcoded PYTH_PRICE_FEED_IDS mapping in src/tq_oracle/constants.py was emptied to support dynamic discovery.

Pipeline and Context Updates

  • The pipeline context (src/tq_oracle/pipeline/context.py) now supports a configurable base_asset, with a new base_asset_required property to enforce its presence. The pricing pipeline (src/tq_oracle/pipeline/pricing.py) uses this base asset instead of a hardcoded value, improving flexibility for different vaults and assets. [1] [2] [3] [4]

Codebase Maintenance

  • The unused domain models (Asset, PricedAsset, TvlReport) were removed from src/tq_oracle/domain/__init__.py, simplifying the codebase.
  • The Chainlink validator was removed from the price validators registry as its feeds are not exhaustive, pending future triangulation logic.

Adapter and ABI Registry Updates

  • The Fee Manager ABI was added to src/tq_oracle/abi.py, with a loader function for future protocol support. [1] [2]
  • The CCTPBridgeAdapter was commented out from the check adapters registry, pending Hyperliquid support.

Minor Improvements

  • Logging and comments were clarified in several places, such as skipping Safe state checks if no address is configured.
  • Documentation was updated to remove the stETH/ETH peg assumption warning, as the new dynamic price logic addresses this limitation.

Copilot AI review requested due to automatic review settings November 4, 2025 13:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces dynamic base asset discovery and Pyth price feed resolution. The oracle now discovers the base asset from the FeeManager contract instead of hardcoding ETH, and dynamically resolves Pyth price feed IDs via API instead of using static mappings.

  • Adds base asset discovery via vault → FeeManager → baseAsset contract traversal
  • Implements dynamic Pyth feed ID resolution using Hermes API
  • Removes hardcoded Pyth price feed mappings and ETH-only assumptions

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/tq_oracle/pipeline/run.py Adds _discover_base_asset() function to fetch base asset from FeeManager contract
src/tq_oracle/pipeline/context.py Adds base_asset field and base_asset_required property to PipelineContext
src/tq_oracle/pipeline/pricing.py Updates to use dynamically discovered base asset instead of hardcoded ETH_ASSET
src/tq_oracle/adapters/price_adapters/pyth.py Refactored to support dynamic base assets and API-based feed ID resolution
src/tq_oracle/adapters/price_validators/pyth.py No functional changes (not shown in diff)
src/tq_oracle/settings.py Adds pyth_dynamic_discovery_enabled configuration flag
src/tq_oracle/constants.py Empties PYTH_PRICE_FEED_IDS dictionary and updates comment
src/tq_oracle/abi.py Adds FeeManager ABI loading function
src/tq_oracle/abis/FeeManager.json New FeeManager contract ABI file
tests/adapters/price_validators/test_pyth.py Updates test mocks to include discovery endpoint responses
src/tq_oracle/adapters/price_validators/init.py Removes ChainlinkValidator from active validators with explanatory comment
src/tq_oracle/adapters/check_adapters/init.py Disables CCTPBridgeAdapter with comment
src/tq_oracle/adapters/check_adapters/safe_state.py Removes redundant comment
src/tq_oracle/domain/init.py Deletes unused domain models (Asset, PricedAsset, TvlReport)
README.md Removes stETH/ETH peg assumption warning section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@timbrinded timbrinded merged commit 2d8e548 into master Nov 4, 2025
6 checks passed
@timbrinded timbrinded deleted the refactor/cleaner-chain-config branch November 4, 2025 14:33
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.

2 participants