PriceFeed and Oracle
The jAsset protocol utilizes Pyth Network as its decentralized oracle provider. The current prices are fetched from Pyth by the client and then passed to the contract mutations, which update the oracles via a Pyth interface. Consequently, the user pays the gas fee for the oracle update.
After updating the oracles, the PriceFeed assembles a price memory cache. This cache contains the prices of all relevant tokens and is used during execution. This schema optimizes gas consumption by ensuring that each price is requested from Pyth storage no more than once per execution.
If the last update of a token price is older than 5 minutes, the price feed is marked as untrusted. In this state, minting new debts is disabled, and only functions that increase the Total Collateral Ratio (TCR) and thus reduce system risk are permitted. Additionally, there is a fallback to a secondary price feed, which is directly written to the protocol by governance. This secondary feed is intended to cover pre-market and post-market hours, during which Pyth Network may not yet provide prices, but trading on NASDAQ has already started.
Last updated