Skip to main content
pool-vault (NAV) and collateral-vault (loan-to-value and liquidation) both read prices through the same interface:
They don’t depend on a particular oracle. Anything implementing this interface can be passed to their existing 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-oracle for 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-oracle as its fallback. A vault has only one oracle address, so the adapter checks the feed first and falls back to manual-oracle when 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 as Other("XAU"), with set_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 = n averages the last n feed 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_threshold counts 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.