pool-vault (NAV) and collateral-vault (loan-to-value and liquidation) both read prices
through the same interface:
set_oracle, with no contract changes. Two implementations
ship with Ankara:
When to use which
- Use the SEP-40 adapter whenever the asset has a public price feed. For a vault’s financially consequential math (liquidations, NAV), a decentralized price removes the single Ankara-controlled key as a point of failure.
- Keep
manual-oraclefor assets without one. Most Ankara RWA tokens (a specific farm, a single invoice, one building) will never be on a public feed. An appraiser, warehouse or registrar posting a valuation is the right model for them. - Mixed vaults: use the adapter with
manual-oracleas its fallback. A vault has only one oracle address, so the adapter checks the feed first and falls back tomanual-oraclewhen the feed has no fresh price for a token. One address covers both kinds of asset.
sep40-oracle-adapter
- Asset mapping: by default a token is looked up on the feed as
Stellar(token). Map it to a different SAC, or to an off-chain ticker such asOther("XAU"), withset_token_feed. For example, a gold-receipt commodity token can be priced off the feed’s gold price. - Scaling: feed prices are rescaled from the feed’s
decimals()(14 for Reflector) to Ankara’s 1e18 convention. The feed’s base asset must be USD (or a USD stablecoin) for the result to be a USD price. - TWAP:
twap_records = naverages the lastnfeed records, which damps short-lived spikes before they reach liquidation logic. The limit is 20. - Timestamps: normalized to seconds. Feeds that report milliseconds are detected.
- Staleness: a feed price older than
staleness_thresholdcounts as missing, and the fallback (if any) takes over.
Look up the current Reflector feed contract IDs for testnet and mainnet in Reflector’s own
documentation. Choose the feed whose base asset is USD.