Reading prices
Find a PriceFeed contract address, connect using the Chainlink interface, and read the current price with proper validation.
Step 1: Find the Oracle Address
interface IOracleFactory {
function pairToOracle(string memory pair) external view returns (address);
function getOracleCount() external view returns (uint256);
}
function resolveFeed(address factory, string memory pair)
external view returns (address)
{
// Pair symbol must be passed in uppercase (e.g. "PSG/USDT").
return IOracleFactory(factory).pairToOracle(pair);
}Step 2: Connect Using the Interface
Step 3: Read the Price
Historical Data
Function
Returns
Events
Discovery Functions (OracleFactoryReader)
Function
Description
Last updated
Was this helpful?