view — they cost no gas when called externally and have no side effects. This page is the complete reference for every function, struct, and enum in the contract interface.
Data Types
Before the function reference, the types returned by the contract:PriceFeed Struct
The primary return type for all single-asset price queries.
DerivedPair Struct
The return type for cross-asset pair calculations.
lastUpdateTime for a derived pair reflects the older of the two underlying feed timestamps — the derived price is only as fresh as its least-recently-updated component.
PairDirection Enum
Controls the direction of a derived pair calculation.
Functions
getAssetInfo
Fetches the current price feed for a single asset.
Returns:
Behaviour:
- Returns
exist = falsefor unrecognised asset IDs. Does not revert. assetInfofields are zero-valued whenexist = false. Always checkexistbefore usingassetInfo.- Safe to call with any
bytes32value — will never revert on invalid input.
getAssetsInfo
Batch version of getAssetInfo. Fetches price feeds for multiple assets in a single call.
Returns:
Behaviour:
- Results are returned in the same order as the input array.
- Each element in
existscorresponds to the same-index element ininfos. - Does not revert if an asset ID is unrecognised — returns
exists[i] = falsefor that element. - Always check
exists[i]before usinginfos[i].
getPairbyId
Computes a derived cross-asset price for a single pair.
Returns:
Behaviour:
- Both underlying USD feeds must exist and be non-zero. If either is missing, the function reverts.
- Self-pairing (same asset ID for both parameters) is blocked — reverts with an error.
lastUpdateTimereflects the older of the two underlying feed timestamps.
getPairsbyIdForward
Batch derived pair calculation — all pairs in the forward direction.
Returns: Array of
DerivedPair structs — same order as inputs.
Behaviour:
- Input arrays must be the same length. Mismatched lengths revert with
InvalidAssetIndexLength. - Each pair is computed independently. A failure in one pair reverts the entire call.
getPairsbyIdBackward
Batch derived pair calculation — all pairs in the backward direction.
Returns: Array of
DerivedPair structs in backward direction — asset1 priced in asset0 terms.
Behaviour: Identical to getPairsbyIdForward except direction is reversed for all pairs. Same length requirement and revert behaviour apply.
Example:
getPairsbyId
Batch derived pair calculation with per-pair direction control.
Returns: Array of
DerivedPair structs — each computed with its specified direction.
Behaviour:
- All three input arrays must be the same length. Mismatched lengths revert with
InvalidAssetOrDirectionLength. - Use this function when you need a mix of forward and backward pairs in a single call.
Custom Errors
The contract uses custom errors for gas-efficient reverts. These are the errors you may encounter when calling derived pair functions:
Note:
getAssetInfo and getAssetsInfo do not revert on unsupported assets — they return exist = false. Only derived pair functions can revert due to missing or invalid underlying feeds.
Quick Reference
Installing the Interface
The full interface with all types, functions, and natspec documentation is available via npm:Next Steps
Event Reference
Events emitted by the oracle contract for monitoring and indexing.
Complete Example Contract
See all functions used together in a production-ready integration.

