Skip to content
NAVIDocs
Open app
Skip to Content

Decentralized Oracle

Update a NAVI feed, check price freshness and interpret oracle events on Sui.

Overview

Anyone can push a price update to NAVI. The v5 update takes a Pyth Pro price object, a Supra oracle holder and a Switchboard aggregator. Each feed has its own provider configuration and validation rules. See the oracle interface for the argument order and feed lookup.

FAQ

What happens if I call functions from lending_core without updating prices?

A transaction can use a price that is still fresh. When the lending operation requires a price that is no longer valid, it aborts with 1502. The validity window comes from the PriceOracle object's update_interval. Refresh the relevant feeds before the lending call in the same transaction.

How is the oracle used in the lending protocol?

The protocol values collateral and debt with oracle prices to check a position's health factor during operations such as borrowing, withdrawing and liquidation.

Which prices should I update?

Include the assets used in the position's collateral and debt calculation. For example, if SUI and USDC back a USDT loan, refresh the feeds for all three assets.

What is the gas cost for updating prices?

Gas depends on the feeds and provider updates in the transaction. Simulate the complete transaction to estimate its cost.

How can I read the latest price from the oracle and check its validity?

Call oracle::oracle::get_token_price with the asset's numeric oracle ID.

public fun get_token_price(
    clock: &Clock,
    price_oracle: &PriceOracle,
    oracle_id: u8,
): (bool, u256, u8)

The tuple contains the validity flag, the integer price and its decimal precision. Check the flag before using the value.

Why can a v3 update leave the price unchanged?

Check the feed is enabled, then inspect events from oracle_pro::update_single_price_v3. OracleUnavailable flags unavailable provider data, InvalidOraclePrice reports a price outside the allowed checks, and PriceRegulation reports a deviation between providers. Refresh stale upstream data before retrying the NAVI update.

On this page