
Read Latest Price
Basic Example
import "ifapricefeed-interface/IIfaPriceFeed.sol";
contract MyProtocol {
IIfaPriceFeed public constant oracle = IIfaPriceFeed(0xA9F17344689C2c2328F94464998db1d3e35B80dC); // Base Mainnet
function getLatestUSDTPrice() external view returns (int256 price, int8 decimal, uint256 timestamp) {
bytes32 assetId = 0x6ca0cef6107263f3b09a51448617b659278cff744f0e702c24a2f88c91e65a0d; // USDT/USD
(IIfaPriceFeed.PriceFeed memory info, bool exists) = oracle.getAssetInfo(assetId);
require(exists, "Asset not supported");
return (info.price, info.decimal, info.lastUpdateTime);
}
}Interpreting the Returned Data
Batch Reading Multiple Prices
Last updated
Was this helpful?

