Skip to content

feat: add getChainlinkFeed address lookup - #14

Open
DhairyaSethi wants to merge 1 commit into
mainfrom
feat/chainlink-feed-lookup
Open

feat: add getChainlinkFeed address lookup#14
DhairyaSethi wants to merge 1 commit into
mainfrom
feat/chainlink-feed-lookup

Conversation

@DhairyaSethi

Copy link
Copy Markdown
Member

Follow-up to #12.

Chainlink demoted several live feeds to the secondaryProxyAddress of an SVR entry. The address keeps answering on-chain, but it is no longer any feed's proxyAddress, 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 returns matchedOn: "proxy" | "secondary":

getChainlinkFeed({ chainId: 8453, address: "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70" })
// { proxyAddress: "0x50015f8b…", secondaryProxyAddress: "0x71041ddd…",
//   name: "SVR ETH / USD", decimals: 8, matchedOn: "secondary" }

The SVR secondary is a different contract with different update behavior from the primary, so matchedOn keeps a caller from silently using one for the other. Unknown address or chain returns undefined, 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" against SVR ETH / USD needs a prefix rule that would hand callers an SVR contract they did not ask for.

Follows the ecosystem/explorers.ts pattern of a hand-written module over generated data. The generator and the generated file are untouched.

vitest run passes (109 passed, 2 skipped, 5 new). Typecheck errors unchanged from main (26, all in seatbelt specs).

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.
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.

1 participant