{"id":19107454,"url":"https://github.com/smartcontractkit/feed-registry","last_synced_at":"2025-09-08T06:42:08.612Z","repository":{"id":67375276,"uuid":"347145168","full_name":"smartcontractkit/feed-registry","owner":"smartcontractkit","description":"Chainlink Feed Registry","archived":false,"fork":false,"pushed_at":"2021-07-15T14:09:48.000Z","size":1136,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":120,"default_branch":"master","last_synced_at":"2025-04-30T18:47:18.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.chain.link/docs/feed-registry","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartcontractkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-12T17:28:54.000Z","updated_at":"2024-11-21T01:34:17.000Z","dependencies_parsed_at":"2023-05-12T03:15:17.221Z","dependency_job_id":null,"html_url":"https://github.com/smartcontractkit/feed-registry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Ffeed-registry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Ffeed-registry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Ffeed-registry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Ffeed-registry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartcontractkit","download_url":"https://codeload.github.com/smartcontractkit/feed-registry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251765429,"owners_count":21640186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T04:12:41.375Z","updated_at":"2025-04-30T18:47:25.298Z","avatar_url":"https://github.com/smartcontractkit.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chainlink Feed Registry\n\nThe Chainlink Feed Registry is an on-chain mapping of assets to feeds. It enables you to query Chainlink price feeds from a pair of asset and denomination addresses directly, without needing to know the feed contract addresses. They enable smart contracts to retrieve the latest price of an asset in a single call, from a single contract.\n\n## Background\n\nDeFi protocols that use Chainlink often implement their own on-chain registry of token addresses to Chainlink feeds. To speed up integration and ensure that protocols use the correct feeds, the Feed Registry provides a canonical on-chain registry of assets to feeds.\n\n## Architecture\n\n![Feed Registry Architecture](https://user-images.githubusercontent.com/1084226/114042612-29f10d80-98b8-11eb-9868-5be7de01ea68.png)\n\nThe Feed Registry consists of the following contracts:\n\n- `FeedRegistry` is an on-chain mapping of `(address base, address quote)` pairs to Chainlink aggregator contracts.\n- `PairReadAccessController` is an access controller contract to allowlist specific contracts from reading the feed registry.\n- `Denominations` is an external library contract containing base and quote identifiers for assets that do not have a canonical Ethereum address.\n\n## Feed Registry price feed getters\n\nThe `FeedRegistry` implements a similar interface as the [`AggregatorProxy`](https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/AggregatorProxy.sol) contract, except it takes in two additional inputs: `base` and `quote`.\n\n```solidity\ninterface FeedRegistryInterface {\n\n  function latestAnswer(\n    address base,\n    address quote\n  )\n    external\n    view\n    returns (\n      int256 answer\n    );\n\n  ... other getters\n}\n```\n\nThe `address` type is used for `base` and `quote` after gathering feedback from multiple users. These `base` and `quote` address represent a specific pair. For example, to query the LINK / USD feed, you call:\n\n```solidity\nlatestAnswer(address base, address quote)\n```\n\nby supplying an `base` and `quote` parameter, with the LINK token address and the `Denominations.USD` address respectively.\n\n## Feed Registry price feed management\n\nThe `FeedRegistry` contract has the following setters to add / update / remove feeds to / from the registry:\n\n- `proposeFeed()`\n- `confirmFeed()`\n\nThese functions follow the same 2-step design that exists in other Chainlink contracts, such as `AggregatorProxy` and `ConfirmedOwner`.\n\n## Feed Registry round helpers\n\nA set of round helper functions help to simplify the process of querying historical round data, by surfacing more round information previously not captured in `AggregatorProxy` `Phase`s:\n\n- `getRoundFeed()` returns the underlying aggregator for a specific round\n- `getPhaseRange()` returns the starting and ending round ids of a phase\n- `getPreviousRoundId()` and `getNextRoundId()` provides hypermedia-like links to query previous and next rounds even across multiple phases.\n\n## Setup\n\n```sh\n$ yarn install\n```\n\nCreate a `.env` following the `.env.example`:\n\n```\nINFURA_API_KEY=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nMNEMONIC=here is where your twelve words mnemonic should be put my friend\n```\n\n### Compile\n\nCompile the smart contracts with Hardhat:\n\n```sh\n$ yarn compile\n```\n\n### TypeChain\n\nCompile the smart contracts and generate TypeChain artifacts:\n\n```sh\n$ yarn typechain\n```\n\n### Lint Solidity\n\nLint the Solidity code:\n\n```sh\n$ yarn lint:sol\n```\n\n### Lint TypeScript\n\nLint the TypeScript code:\n\n```sh\n$ yarn lint:ts\n```\n\n### Test\n\nRun the Mocha tests:\n\n```sh\n$ yarn test\n```\n\nTo run a single test:\n\n```sh\n$ yarn test test/FeedRegistry.test.ts\n```\n\n### Coverage\n\nGenerate the code coverage report:\n\n```sh\n$ yarn coverage\n```\n\n### Clean\n\nDelete the smart contract artifacts, the coverage reports and the Hardhat cache:\n\n```sh\n$ yarn clean\n```\n\n## Tooling\n\n- [Hardhat](https://github.com/nomiclabs/hardhat): compile and run the smart contracts on a local development network\n- [TypeChain](https://github.com/ethereum-ts/TypeChain): generate TypeScript types for smart contracts\n- [Ethers](https://github.com/ethers-io/ethers.js/): renowned Ethereum library and wallet implementation\n- [Waffle](https://github.com/EthWorks/Waffle): tooling for writing comprehensive smart contract tests\n- [Solhint](https://github.com/protofire/solhint): linter\n- [Solcover](https://github.com/sc-forks/solidity-coverage) code coverage\n- [Prettier Plugin Solidity](https://github.com/prettier-solidity/prettier-plugin-solidity): code formatter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Ffeed-registry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartcontractkit%2Ffeed-registry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Ffeed-registry/lists"}