Skip to content

docs(lore-0173): the oracle feed every USD price depends on was never justified - #192

Merged
karczuRF merged 1 commit into
developfrom
docs/0173_oracle-feed-choice-undocumented
Aug 10, 2026
Merged

docs(lore-0173): the oracle feed every USD price depends on was never justified#192
karczuRF merged 1 commit into
developfrom
docs/0173_oracle-feed-choice-undocumented

Conversation

@karczuRF

Copy link
Copy Markdown
Collaborator

Raised while walking through the oracle path for 0167. The question "why this contract?" has no answer anywhere in the repo.

pub const REFLECTOR_CEX_DEX: &str = "CAFJZQWSED6YAWZU3GWRTOCNPPCGBN32L7QV43XX5LZLFTK6JLN34DLN";

A bare constant since ffc07e4, with no ADR behind it — and there are nine ADRs covering backfill strategy, PK design, the runtime framework and the CH host, but not the single external dependency the entire USD estate rests on.

⚠️ Worth stating plainly: Reflector is not an official Stellar oracle. SDF doesn't operate one. SEP-40 is a standard — the interface a price oracle should expose — and "SEP-40 compliant" reads as endorsement if you're not looking closely.

Alternatives were observed, never evaluated

0048 sampled real Soroban events and found four live feeds:

Contract Feed Keyed by
CALI2BYU…LE6M Reflector — Stellar on-chain assets token contract address
CBKGPWGK…CJZC Reflector — FX symbol
CAFJZQWS…4DLN Reflector — global crypto symbol ← chosen
CA526Y2N…XUSG RedStone bytes-encoded XDR

0048 records that they exist; 0039 records that we call one. Neither records a decision.

The one worth assessing

CALI2BYU…LE6M keys by Stellar token contract address, not global ticker — a materially different question. Our feed says what "USDC the ticker" trades at externally; that one would say what a specific Stellar asset is worth.

This bears on an unmarked assumption: reflector_key_to_identity asserts Reflector's USDC means USDC at the canonical Circle issuer. Almost certainly right — but 0165 measured 56 other issuers using the code USDC, about which our feed can say nothing. No test, no comment marking it as an assumption.

It may also be informative for 0172 (USDT/USDC at ~0.14 on SDEX): a Stellar-native oracle would corroborate or contradict the local market, and either answer tells us something.

This is not a proposal to switch. The current feed is plausibly right for a USD reference — you want the real-world dollar value, not a thin local market's opinion. The deliverable is a decision on the record.

Why now

0167 is about to snapshot these readings into a forever-retained table. Sanity-checking the source belongs before it becomes permanent history — and it's cheap while usd_rate is still empty and unconsumed.

Also in scope

  • A policy for config that already exists with no policy behind it: REFLECTOR_CONTRACT and SOROBAN_RPC_URL are both overridable, so we have the mechanism to switch and no documented answer to when.
  • Whether to poll a second feed as a cross-check — noting this isn't free: oracle_prices is keyed on oracle_name and could hold both, but 0167's usd_rate has no oracle column, so two feeds disagreeing at one timestamp needs a precedence rule first or the snapshot winner is arbitrary.
  • REFLECTOR_DECIMALS = 14 is another undocumented external assumption that happens to line up exactly with our Decimal(38,14).

… justified

The Reflector contract address has been a bare constant since ffc07e4 with no
ADR behind it. 0048 recorded that four live oracle feeds exist - two other
Reflector feeds plus RedStone - and 0039 recorded that we call one of them.
Neither records a decision, so alternatives were observed and never evaluated.

Also worth stating plainly: Reflector is NOT an official Stellar oracle. SDF
does not operate one. SEP-40 is a standard, and 'SEP-40 compliant' reads as
endorsement if you are not looking closely.

The alternative worth assessing is CALI2BYU (Reflector - Stellar on-chain
assets), which keys prices by token contract address rather than global ticker.
That answers a different question than ours does, and it bears on the unmarked
symbol->issuer assumption in reflector_key_to_identity - 0165 measured 56 other
issuers using the code USDC, about which our feed can say nothing. It may also
be informative for 0172.

Filed now because 0167 is about to snapshot these readings into a
forever-retained table. Sanity-checking the source belongs before it becomes
permanent history, and it is cheap while the table is still empty.

Explicitly not a proposal to switch feeds - the deliverable is a decision on the
record.
@karczuRF
karczuRF merged commit 81115cd into develop Aug 10, 2026
3 checks passed
@karczuRF
karczuRF deleted the docs/0173_oracle-feed-choice-undocumented branch August 10, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant