đDecentralized Oracle
Efficient decentralized oracle designed by NAVI, audited by OtterSec and Veridise.
Overview
The NAVI decentralized oracle consistently produces stable and reliable prices by integrating data from multiple trusted oracle providers on Sui. Currently, we have selected Pyth and Supra as our price providers. To learn more, please refer to our medium post.
The Oracle operates on a PUSH model, allowing anyone to trigger updates. To ensure the protocol's security, we enforce a valid price interval of 15 seconds, meaning that any price older than 15 seconds is considered stale and not allowed. It is always recommended to update the price before using the NAVI lending protocol.
FAQ
What happens if I call functions from lending_core
without updating prices?
lending_core
without updating prices?The oracle's price can be updated by anyone. If a price update occurs within 15 seconds, everything should function as expected. However, if the price isn't updated within this interval, you will encounter an error with code 1502 due to stale prices. To avoid this, we recommend updating the price before performing any operations to ensure accuracy and timeliness.
How is the oracle used in the lending protocol?
The oracle provides real-time price feeds, which are essential for maintaining users' health factors. It ensures assets remain healthy by triggering liquidations only when necessary, protecting both users and the protocol from undercollateralized loans.
Which prices should I update?
We recommend updating all prices since the price update function is gas-efficient. However, you can opt to update only the prices of assets relevant to your account. For example, if you deposit USDC and SUI as collateral and want to borrow USDT, you only need to update the prices of USDC, SUI, and USDT.
What is the gas cost for updating prices?
The average gas cost for updating all prices is approximately 0.0013 SUI.
How can I read the latest price from the oracle and check its validity?
You can retrieve price information using the following function in the oracle::oracle
module:
The returned values are as follows:
price_validity
: A boolean indicating whether the price is fresh and valid.price_value
: The price itself.price_decimal
: The number of decimals in the price.
Why are prices not updated after calling update_single_price
?
Although rare, this can occur due to the oracle's safety mechanisms. Here are some potential reasons and troubleshooting steps:
OracleUnavailable
: Prices from providers are considered stale and are not applied. To resolve this, update prices via Pyth, then callupdate_single_price
again.InvalidOraclePrice
: The final price is deemed invalid due to extreme fluctuations or abnormal values.PriceRegulation
: The price difference from providers exceeds acceptable limits.
Check the emitted events for more details when encountering these issues.
Last updated