Skip to main content
This page is the complete reference for every public function exposed by the IFÁ Labs Sui Move oracle package. All functions are read-only — they do not modify on-chain state and do not require gas when called via devInspectTransactionBlock. For the EVM function reference, see Function Reference.

Package Structure

The IFÁ Labs Sui oracle package (ifa_oracle) contains three modules: Consumers only need price_feed and bytes32. The verifier module is used by the IFÁ Labs relayer infrastructure — not by protocol integrators.
Looking for a real example of these functions in production? The Sui Swap Contract consumes get_asset_info and get_pair_by_id directly for pricing every deposit, withdrawal, and swap.

Data Types

PriceFeed

The primary struct returned by all single-asset price queries.
last_update_time is in milliseconds on Sui. When comparing against clock::timestamp_ms(clock), use millisecond thresholds. 3_600_000 is 1 hour — not 3_600.

DerivedPair

The return type for all cross-asset pair calculations.
The derived pair decimal is always 30 regardless of which assets are involved. This differs from EVM where the decimal is per-asset. Always divide derived_price by 10^30.

Bytes32

A wrapper type for 32-byte asset identifiers.
Always construct using bytes32::new() — direct struct construction is not permitted outside the module.

Direction Constants

Used as the direction parameter in derived pair functions:

bytes32 Module

bytes32::new

Constructs a Bytes32 from a 32-byte vector<u8>. Aborts if the input is not exactly 32 bytes.
Parameters: Aborts: E_INVALID_BYTES32_LENGTH if value.length() != 32 Example:

bytes32::inner

Returns a reference to the inner vector<u8>.

bytes32::into_inner

Consumes the Bytes32 and returns the inner vector<u8>.

price_feed Module — Getter Functions

These functions extract fields from PriceFeed and DerivedPair structs.

price_feed::price

Returns the raw scaled price from a PriceFeed.
Example:

price_feed::price_decimal

Returns the scaling exponent from a PriceFeed.
Always returns 18 for all current IFÁ Labs feeds. Read dynamically — do not hardcode 18.

price_feed::last_update_time

Returns the last update timestamp in milliseconds from a PriceFeed.

price_feed::derived_pair_decimal

Returns the decimal from a DerivedPair. Always 30.

price_feed::derived_pair_last_update_time

Returns the last update timestamp from a DerivedPair in milliseconds. Reflects the older of the two underlying feed timestamps.

price_feed::derived_price

Returns the raw derived price from a DerivedPair. Always scaled by 10^30.

price_feed::is_fresh

Checks whether a price feed is within a given age threshold. Returns true if fresh, false if stale.
Parameters: Example:

price_feed Module — Query Functions

price_feed::get_asset_info

Fetches the current price feed for a single asset.
Parameters: Returns: Behaviour:
  • Does not abort on unsupported assets — returns (empty_price_feed, false).
  • Safe to call with any Bytes32 value.
  • Always check exists before using the returned PriceFeed.
Example:

price_feed::get_assets_info

Batch version of get_asset_info. Fetches price feeds for multiple assets in a single call.
Parameters: Returns: Behaviour:
  • Results are returned in the same order as the input vector.
  • Each exists[i] corresponds to prices[i].
  • Does not abort on unsupported assets — returns false in the exists vector for missing assets.
Example:

price_feed::get_pair_by_id

Computes a derived cross-asset price for a single pair.
Parameters: Returns: DerivedPair with decimal = 30 and derived_price scaled by 10^30. Aborts:
  • E_INVALID_ASSET_PAIRING — if asset_index_0 == asset_index_1 (self-pair)
  • E_INVALID_DIRECTION — if direction is not 0 or 1
  • E_INVALID_ASSET_INDEX — if either asset does not exist in the feed
This function aborts if either asset is missing — it does not return a false flag. Always verify both assets exist with get_asset_info before calling this function in production.
Example:

price_feed::get_pairs_by_id_forward

Batch derived pair calculation — all pairs in the forward direction.
Parameters: Returns: vector<DerivedPair> — same order as inputs. All pairs computed in forward direction. Aborts: E_INVALID_ASSET_INDEX_LENGTH if input arrays have different lengths. Example:

price_feed::get_pairs_by_id_backward

Batch derived pair calculation — all pairs in the backward direction.
Identical to get_pairs_by_id_forward except all pairs are computed in the backward direction (asset1 / asset0). Aborts: E_INVALID_ASSET_INDEX_LENGTH if input arrays have different lengths.

price_feed::get_pairs_by_id

Batch derived pair calculation with per-pair direction control.
Parameters: Aborts: E_INVALID_ASSET_OR_DIRECTION_INDEX_LENGTH if any of the three arrays have different lengths. Example:

Error Codes


Function Quick Reference


Next Steps

Read Latest Price (Sui)

Full integration examples using Move and the Sui TypeScript SDK.

Sui Swap Contract

See these exact functions used in a live liquidity pool.

Function Reference (EVM)

The equivalent reference for EVM contract functions.

Contract Addresses

All Sui object IDs and EVM contract addresses.