With your contract configured and the interface installed, reading a price is a single view call. This page covers three reading patterns: single asset, batch, and derived pairs. Use whichever fits your protocol’s needs — or combine them.Documentation Index
Fetch the complete documentation index at: https://docs.ifalabs.com/llms.txt
Use this file to discover all available pages before exploring further.
Single Asset Price
The most common pattern. CallgetAssetInfo with a bytes32 asset ID and read the returned PriceFeed struct.
| Field | Type | Description |
|---|---|---|
price | int256 | Scaled price value. Divide by 10^(-decimal) to get the human-readable price. |
decimal | int8 | Negative scaling exponent. Stablecoin feeds use -18 — meaning divide by 1e18. |
lastUpdateTime | uint256 | Unix timestamp of the last on-chain update from the relayer network. |
info.price ≈ 1000000000000000000 (1e18) and info.decimal = -18, giving a human-readable price of $1.00.
Batch Price Read
If your protocol needs multiple prices in the same transaction — for example, valuing a multi-asset collateral basket — usegetAssetsInfo. One external call is always cheaper than multiple individual calls.
Derived Pair Prices
Derived pairs let you price one supported asset directly against another — for example, CNGN priced in USDT terms, or BRZ priced in USDC terms — without requiring a dedicated feed for every possible combination. IFÁ Labs computes derived prices on-chain using the two underlying USD feeds as intermediates.Single Derived Pair
Batch Derived Pairs
For protocols working across multiple cross-asset pairs:Understanding PairDirection
| Direction | Meaning | Use Case |
|---|---|---|
Forward | asset0 priced in asset1 terms | ”How much USDT is one CNGN worth?” |
Backward | asset1 priced in asset0 terms | ”How much CNGN is one USDT worth?” |
Derived pairs require both assets to have active, non-stale USD feeds. If either underlying feed is stale or missing, the derived pair calculation will revert. Always ensure both feeds are healthy before calling derived pair functions in critical paths.
Reading Prices Off-Chain
For backend services, scripts, or frontend applications reading prices without executing a transaction:Common Mistakes
These are the mistakes developers make most often when first reading from the oracle. All of them are avoidable. Not checkingexists before using the price. If exists is false, info.price is 0. Using that value without checking will silently execute your logic against a zero price.
Forgetting to apply the decimal scaling. info.price is not a dollar amount — it’s a scaled integer. 1000000000000000000 is $1.00, not one quintillion dollars. Always divide by 10^(-decimal) before using the value in human-facing output or fixed-point math.
Casting int256 to uint256 without checking sign. Current stablecoin feeds always return positive prices, but the type is int256. Cast safely: only cast after confirming info.price > 0, or use uint256(info.price) with the understanding that negative values would underflow.
Using the price without a staleness check. A returned price with exists = true is not automatically fresh. Always pair your read with a lastUpdateTime check before using the value in any logic with financial consequences. See Verify Price Integrity.
Next Steps
Handle Stale Data
Implement staleness guards and graceful degradation patterns.
Gas Optimization Tips
Reduce the gas footprint of your oracle integration.

