Indexer oracle /api/v1/oracle/price returns LUNC/USD exactly 100x too high #515
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#515
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
/api/v1/oracle/priceon the production indexer returns LUNC/USD scaled exactly 100× too high, while attributing the values to KuCoin/MEXC — whose real same-minute prices are 100× lower.Evidence (fetched within the same minute, 2026-08-10 ~16:06 UTC)
price_usd)/api/v1/market/orderbook/level1?symbol=LUNC-USDT)/api/v3/ticker/price?symbol=LUNCUSDT)The oracle's per-source values are precisely the real exchange prices × 100, so this looks like a unit/scaling bug in the fetcher (e.g. parsing a 1000LUNC or cents-denominated field, or a stray ×100), not a stale price.
Impact
Anything consuming this endpoint — dApp USD displays, charts, integrators valuing cLUNC inventory — overstates USD values by 100×. We caught it because our bot's portfolio meter suddenly claimed a ~$380 wallet was worth ~$38,000; a treasury or listing decision made off this feed would be off by the same factor.
Happy to retest once fixed.
Approved to fix. Likely cause is api confusing - the price api should be delivering ustc price. Breaking change to v1 approved (as we are still in non-economic phase) to change the api routes to /api/v1/oracle/price/ustc and /api/v1/oracle/price/lunc, with /api/v1/oracle/price listing available tickers such as {metadata: "... explain how to use the api here...", tickers:["ustc","lunc"]
mentioned in commit
aa59731ea0mentioned in merge request !1050
Fix implemented in !1050 (
fix/515-oracle-price-tickers).Breaking v1 change (as approved):
GET /api/v1/oracle/price→ catalog{ metadata, tickers: ["ustc","lunc"] }GET /api/v1/oracle/price/ustc//lunc→ ticker snapshots/history/{ticker}make verify-issue-515Please retest LUNC path against KuCoin/MEXC after indexer deploy.
mentioned in commit
92d5e3a105Merge sanity check (!1050 → main)
Merged via
glab mr merge 332after resolving a post-!1049 conflict inMakefile.PHONY(kept bothverify-issue-512andverify-issue-515). No automerge; CI wasci_quota_exceeded, not waited on.Local checks on the MR branch:
cargo test --lib oracle(11/11),cargo test --test api_oracle(10/10), Protocol/Trade frontend tests (33) — all passed.make verify-issue-515needs frontendnode_moduleson a fresh checkout.Acceptance vs #515
/api/v1/oracle/price+/history→ ticker catalog/price/{ustc|lunc}and/history/{ticker}getOraclePrice()→ USTC/USDRemaining gaps / follow-ups (ops, not code blockers)
20260811000000_oracle_prices_multi_ticker.sql(indexer auto-migrate on start), deploy indexer + frontend together, and notify integrators: bareGET /api/v1/oracle/priceis now a catalog, not a numeric price (use/price/ustcor/price/lunc).verify-issue-515bootstrap — Script bootstraps Postgres but not frontend deps; fresh checkouts fail the frontend step withvitest: not founduntilnpm installinfrontend-dapp./price/luncvs live KuCoin/MEXC LUNCUSDT after deploy (MR test plan).Please retest LUNC vs USTC scale on staging/prod after indexer deploy.
Retested — confirmed fixed, and thanks for the fast turnaround (filed → fixed in under a day).
Verification, same-minute against external references:
/api/v1/oracle/price/lunc/api/v1/oracle/price/ustcAlso happy to correct my own diagnosis: this was never a 100× scaling bug — the old unlabeled endpoint was serving USTC/USD, and consumers (us included) read it as LUNC/USD. The "exactly 100×" in my title was just the coincidental USTC:LUNC price ratio. Your fix — ticker in the path, both assets served explicitly — is the right structural cure, and having the bare
/priceendpoint return metadata instead of a number is a nice touch: any stale consumer breaks loudly instead of silently misreading forever.We've migrated our tooling to
/price/luncand keep independent exchange cross-checks as standard practice. Fine to close from our side.marked as related to #520
mentioned in issue #520
mentioned in issue #522
marked as related to #522
mentioned in merge request !1055
mentioned in issue #524
mentioned in issue #543
mentioned in issue #544
marked as related to #544
mentioned in issue #548
marked as related to #548
mentioned in issue #550
marked as related to #550
mentioned in issue #556
mentioned in issue #568
marked as related to #568
mentioned in issue #569
mentioned in issue #570
marked as related to #570
mentioned in issue #571
marked as related to #571
mentioned in issue #572
marked as related to #572
mentioned in issue #574
marked as related to #574
mentioned in issue #575
marked as related to #575
mentioned in issue #579
marked as related to #579
mentioned in issue #580
marked as related to #580
mentioned in merge request !1106
mentioned in issue #586
mentioned in issue #589
mentioned in issue #597
mentioned in issue #614
mentioned in issue #619
mentioned in issue #653
mentioned in issue #690
mentioned in issue #691