mirror of
https://github.com/luxfi/graph.git
synced 2026-09-24 00:26:07 +00:00
The valuation pass has always priced every token in USD — that is where TVL and volume come from — but it published none of it. The subgraph format carries a price only as the product `token.derivedETH * bundle.ethPriceUSD`, and both sides were left unwritten: mainnet served derivedETH="" for all 8 tokens against a null bundle. lux.exchange and the explorer therefore rendered real TVL and real volume beside a blank price and no market cap, on every market. "ETH" is the wire's name for the chain's own coin, so the bundle now carries the native coin's USD price and each token its price in native units. The two multiply back to exactly the USD price the pass computed, and the wrapped native quotes 1 of itself by construction. No second price source, no oracle: one relaxation, two projections of it. Unpriced stays unpriced. A token no pool connects to a stable publishes an empty derivedETH and no bundle is written at all — a zero there would render every token free rather than unquoted. fmtUSD could not carry these numbers: it is a CURRENCY format, and at two decimals LUX at $0.00041334 renders "0.00". fmtPrice keeps 12 significant digits. Wrapped-native address is per-chain (Zoo's differs), so it follows the factories' existing pattern — Config field, Lux mainnet default, env override. Tests run under -tags nosqlite: the default store links two sqlite C implementations (mattn + sqlite3vfs) and 283 duplicate symbols make the test binary unlinkable, which is why the swap-count tests added earlier had never once executed. They pass now, along with the new ones. Removing the SeedBundle call fails TestPricesReachTheWire with "bundle absent", so the test tracks the publication and not a reimplementation of it. Co-authored-by: Hanzo Dev <[email protected]>