Consolidated price feed

Details about how to interact with the consolidated price feed

Interacting with the price feed

The main function to retrieve prices from with the consolidated price feed is:

function getPricesUSD(address[] tokenAddresses) view returns (uint256[])

It expectes an array of asset addresses and returns an array of prices, denominated in USD.

Example

Here is an example to retrieve the prices of (wrapped) Bitcoin and USDC. Note that this uses the Polygon asset addresses.

interface IConsolidatedPriceFeed {
    function getPricesUSD(address[] memory baseAssets) external view returns (uint256[] memory);
}

address oracle = IConsolidatedPriceFeed(0xBa116c6f9e631413847747dF3cF6Dc5cDD1455C7);

address[] memory assets = new address[](2);
assets[0] = 0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6; // WBTC
assets[1] = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174; // USDC
uint256[] memory prices = oracle.getPricesUSD(assets);

Deployed contracts

The consolidated price feed is currently deployed on the following networks:

Last updated