Skip to content

feat: midas oracles#493

Merged
antoncoding merged 1 commit intomasterfrom
feat/midas-oracle
Apr 7, 2026
Merged

feat: midas oracles#493
antoncoding merged 1 commit intomasterfrom
feat/midas-oracle

Conversation

@antoncoding
Copy link
Copy Markdown
Owner

@antoncoding antoncoding commented Apr 7, 2026

Summary by CodeRabbit

  • New Features

    • Added support for Midas as a price feed vendor in oracle information displays.
  • Bug Fixes

    • Improved tooltip handling for Midas oracle feeds to match Pyth Network behavior.
  • Refactor

    • Streamlined oracle vendor information retrieval logic to use a consolidated helper function across components, improving maintainability and consistency in how oracle data is processed.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
monarch Ready Ready Preview, Comment Apr 7, 2026 10:26am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Consolidates oracle vendor identification logic by introducing getOracleVendorInfo() helper that centralizes metadata-driven vendor classification. Replaces scattered calls to separate parsing utilities across components, filters, and utilities. Adds PriceFeedVendors.Midas enum value. Updates React Query cache key in metadata hook to include gist base URL.

Changes

Cohort / File(s) Summary
Oracle Vendor Info Consolidation
src/utils/oracle.ts
Added PriceFeedVendors.Midas enum and icon. Added emptyVendorInfo() helper and new exported getOracleVendorInfo() function to derive vendor info from oracle address/metadata. Extended mapProviderToVendor to recognize Midas providers.
Component Consumers
src/features/markets/components/markets-table-same-loan.tsx, src/features/markets/components/oracle-vendor-badge.tsx, src/features/markets/components/oracle/MarketOracle/FeedEntry.tsx
Updated to use getOracleVendorInfo() instead of separate metadata parsing calls. FeedEntry now treats Midas same as PythNetwork for tooltip routing.
Utility & Hook Updates
src/utils/marketFilters.ts, src/hooks/useOracleMetadata.ts
Replaced vendor parsing logic with getOracleVendorInfo() calls. Updated React Query cache key to include gist base URL for proper cache separation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #389: Modifies vendor-detection logic and metadata handling in oracle utilities
  • #376: Updates oracle vendor machinery and FeedEntry tooltip handling
  • #463: Performs similar refactor consolidating vendor classification to use metadata-backed helpers

Suggested labels

feature request, ui

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: midas oracles' directly reflects the main changes: adding Midas oracle support by introducing PriceFeedVendors.Midas, updating vendor parsing logic across components, and consolidating oracle metadata handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/midas-oracle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added feature request Specific feature ready to be implemented ui User interface labels Apr 7, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/utils/marketFilters.ts (1)

231-237: ⚠️ Potential issue | 🟡 Minor

Search still ignores tagged oracle labels.

getOracleVendorInfo() now exposes taggedVendors and the unknown state, but this branch still searches only the legacy vendors array. Markets that surface a tagged provider or "Unverified" in the oracle UI will not match the same text in search.

Possible fix
-    const { vendors } = getOracleVendorInfo(market.oracleAddress, market.morphoBlue.chain.id, oracleMetadataMap);
-    const vendorsName = vendors.join(',');
+    const { coreVendors, taggedVendors, hasUnknown } = getOracleVendorInfo(
+      market.oracleAddress,
+      market.morphoBlue.chain.id,
+      oracleMetadataMap,
+    );
+    const vendorTerms = [...coreVendors, ...taggedVendors, ...(hasUnknown ? ['Unverified'] : [])].join(',');
     return (
       market.uniqueKey.toLowerCase().includes(lowercaseQuery) ||
       market.collateralAsset.symbol.toLowerCase().includes(lowercaseQuery) ||
       market.loanAsset.symbol.toLowerCase().includes(lowercaseQuery) ||
-      vendorsName.toLowerCase().includes(lowercaseQuery)
+      vendorTerms.toLowerCase().includes(lowercaseQuery)
     );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/marketFilters.ts` around lines 231 - 237, The search currently only
uses the legacy vendors array returned from getOracleVendorInfo, so tagged
vendor labels and the unknown/unverified state are ignored; update the logic
where vendorsName is built (after calling getOracleVendorInfo) to include
taggedVendors (and, if provided by getOracleVendorInfo, the unknown/unverified
indicator) by concatenating vendors + taggedVendors and/or the unknown label
into a single string before doing
vendorsName.toLowerCase().includes(lowercaseQuery), ensuring the branch that
checks market.uniqueKey, collateralAsset, loanAsset and vendorsName will match
tagged providers and "Unverified" text as well.
🧹 Nitpick comments (1)
src/utils/oracle.ts (1)

261-283: Keep lookup misses distinct from real empty vendor sets.

This helper returns emptyVendorInfo() for three different states: missing scanner metadata, unsupported/custom oracle metadata, and a resolved standard/meta oracle with no classified feeds. Once callers only see VendorInfo, those cases are indistinguishable, which makes downstream search/filter code easy to get wrong. A small discriminator like status: 'resolved' | 'missing' | 'unsupported' would make the contract safer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/oracle.ts` around lines 261 - 283, The function getOracleVendorInfo
conflates three distinct states into emptyVendorInfo(); change the VendorInfo
contract to include a status discriminator (e.g., status: 'resolved' | 'missing'
| 'unsupported') and return the appropriate status from getOracleVendorInfo:
return status 'missing' when oracleAddress or metadataMap is absent,
'unsupported' when metadata exists but has an unexpected type, and 'resolved'
when parseMetaOracleVendors or parsePriceFeedVendors produce the result. Update
emptyVendorInfo (or add helpers like missingVendorInfo/unsupportedVendorInfo) to
produce VendorInfo with the matching status, and ensure callers that consume
getOracleVendorInfo still read the new status field. Reference symbols:
getOracleVendorInfo, emptyVendorInfo, getOracleFromMetadata,
parseMetaOracleVendors, parsePriceFeedVendors, and OracleMetadataRecord.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/utils/marketFilters.ts`:
- Around line 231-237: The search currently only uses the legacy vendors array
returned from getOracleVendorInfo, so tagged vendor labels and the
unknown/unverified state are ignored; update the logic where vendorsName is
built (after calling getOracleVendorInfo) to include taggedVendors (and, if
provided by getOracleVendorInfo, the unknown/unverified indicator) by
concatenating vendors + taggedVendors and/or the unknown label into a single
string before doing vendorsName.toLowerCase().includes(lowercaseQuery), ensuring
the branch that checks market.uniqueKey, collateralAsset, loanAsset and
vendorsName will match tagged providers and "Unverified" text as well.

---

Nitpick comments:
In `@src/utils/oracle.ts`:
- Around line 261-283: The function getOracleVendorInfo conflates three distinct
states into emptyVendorInfo(); change the VendorInfo contract to include a
status discriminator (e.g., status: 'resolved' | 'missing' | 'unsupported') and
return the appropriate status from getOracleVendorInfo: return status 'missing'
when oracleAddress or metadataMap is absent, 'unsupported' when metadata exists
but has an unexpected type, and 'resolved' when parseMetaOracleVendors or
parsePriceFeedVendors produce the result. Update emptyVendorInfo (or add helpers
like missingVendorInfo/unsupportedVendorInfo) to produce VendorInfo with the
matching status, and ensure callers that consume getOracleVendorInfo still read
the new status field. Reference symbols: getOracleVendorInfo, emptyVendorInfo,
getOracleFromMetadata, parseMetaOracleVendors, parsePriceFeedVendors, and
OracleMetadataRecord.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ca0d41c7-c607-4768-8cb5-ca5f90ca5809

📥 Commits

Reviewing files that changed from the base of the PR and between 39b9ee0 and 0be15d9.

⛔ Files ignored due to path filters (1)
  • src/imgs/oracles/midas.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • src/features/markets/components/markets-table-same-loan.tsx
  • src/features/markets/components/oracle-vendor-badge.tsx
  • src/features/markets/components/oracle/MarketOracle/FeedEntry.tsx
  • src/hooks/useOracleMetadata.ts
  • src/utils/marketFilters.ts
  • src/utils/oracle.ts

Copy link
Copy Markdown
Collaborator

@starksama starksama left a comment

Choose a reason for hiding this comment

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

LGTM. I reviewed the diff and also ran targeted lint/typecheck plus a full production build locally. No blocking regressions jumped out to me.

@antoncoding antoncoding merged commit fcabb8c into master Apr 7, 2026
4 checks passed
@antoncoding antoncoding deleted the feat/midas-oracle branch April 7, 2026 10:40
@coderabbitai coderabbitai Bot mentioned this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Specific feature ready to be implemented ui User interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants