feat: add getChainlinkFeed address lookup - #14
Open
DhairyaSethi wants to merge 1 commit into
Open
Conversation
Chainlink demoted several live feeds to the `secondaryProxyAddress` of an SVR entry, which keeps the address answering on-chain while removing it as a `proxyAddress`. A consumer indexing the generated table by proxy alone can no longer resolve those addresses. The lookup covers both fields and reports `matchedOn` so a caller can tell whether it asked about the primary or the SVR secondary.
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.
Follow-up to #12.
Chainlink demoted several live feeds to the
secondaryProxyAddressof an SVR entry. The address keeps answering on-chain, but it is no longer any feed'sproxyAddress, so a consumer indexing the generated table by proxy alone stops resolving it. Seven Base feeds are in that state today (ETH, BTC, XRP, SOL, DOGE, ADA, LTC).getChainlinkFeed({ chainId, address })indexes both address fields, per chain, and returnsmatchedOn: "proxy" | "secondary":The SVR secondary is a different contract with different update behavior from the primary, so
matchedOnkeeps a caller from silently using one for the other. Unknown address or chain returnsundefined, since asking whether an arbitrary address is a feed is a normal question with a legitimate no.Details: the index is built lazily per chain and cached. A proxy match always wins over a secondary match, though the current table has no address serving both roles across all 17 chains. Name lookup is deliberately out of scope, since matching
"ETH / USD"againstSVR ETH / USDneeds a prefix rule that would hand callers an SVR contract they did not ask for.Follows the
ecosystem/explorers.tspattern of a hand-written module over generated data. The generator and the generated file are untouched.vitest runpasses (109 passed, 2 skipped, 5 new). Typecheck errors unchanged from main (26, all in seatbelt specs).