API/On-chain reference

price, pyth_oracle

price#

essey_sui::price — the price seam. Loan code reads only a Reading; a market accepts only Readings built with its own oracle witness and price object. Every refusal is here, not in the oracle adapters. See Prices.

publicnew#
Move
public fun new<W: drop>(_witness: W, feed_id: ID, spot_negative: bool, spot: u64, spot_conf: u64, spot_publish_s: u64, ema_negative: bool, ema: u64, ema_conf: u64, ema_publish_s: u64, expo_negative: bool, expo: u64, clock: &Clock): Reading

Needs: a value of the oracle's witness type W; the Reading records W, and a market accepts only Readings from its own oracle. Checks: both prices positive (ENonPositive); a negative exponent of at most 18 (EBadExponent); both prices at most 300 s from the clock (EStale); both confidence intervals at most 1% of the price (EWideConfidence).

A Reading has drop only — no store, no copy — so it lives for one transaction.

Views: oracle, feed_id, spot, ema, expo, publish_s, max_age_s() (300), max_conf_bps() (100).

Abort codes: 1 EStale, 2 EWideConfidence, 3 ENonPositive, 4 EBadExponent.

pyth_oracle#

essey_oracle_pyth::pyth_oracle — the testnet adapter for a Pyth price object.

Move
public fun read(obj: &PriceInfoObject, clock: &Clock): Reading
public fun read_inverse(obj: &PriceInfoObject, clock: &Clock): Reading

Needs: nothing. read returns the object's spot and EMA prices as a Reading for the object's id, under the PythOracle witness. read_inverse returns the inverse of the same object, whole units of the forward quote per one unit of the base, under the PythOracleInverse witness; the SUI loan market is created with that witness (loanMarkets.SUI.reader in GET /v1/private/config), so read's SUI/USD quote cannot satisfy it. These two are the only public ways to build a Pyth Reading; the mapping is private so no one can choose the price.

A transaction that needs a price calls read in the same transaction and passes the Reading on, as the owner's claim-default does.