Commit Graph
12 Commits
Author SHA1 Message Date
zeekay c287fa46b3 docs: chain routes are /v1/chain
luxd serves chain APIs under one segment from constants.ChainAliasPrefix
(constants v1.6.4, node v1.36.181):

  /v1/bc/<alias>/...   -> /v1/chain/<alias>/...
  /ext/bc/<alias>/...  -> /v1/chain/<alias>/...

Observations keep their original addresses: a dated note or a recorded status
code is a fact about when it was written, not an instruction to follow.
2026-08-30 16:41:57 -07:00
zeekayandHanzo Dev 74f7996ba3 The trade count comes from the same read as the volume beside it
A token's page showed $74,100 of volume over zero transactions, and the protocol
claimed 16,062 trades above pools holding 14,827 of them. The volume had just
been made a fact about the whole swap table while the count was still a tally
kept as events arrived — and a tally drifts on every restart and re-index, which
is the argument that made poolCount derived in the first place.

Pool, token and protocol counts are folds of the same grouped read that answers
for volume, so the two columns cannot disagree. The tallies are deleted rather
than corrected: a second writer for a derived field is the defect, not its
arithmetic.

This makes txCount mean trades. Mints and burns stop counting toward it. That is
a narrowing, and it is the number a reader comparing it to the volume next to it
is owed. What a create handler owns is the registration itself, which is what its
tests assert now.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-14 07:55:52 -07:00
zeekayandHanzo Dev bba6bbe253 A pool's volume and the protocol's come from one answer
Valuing the history fixed the protocol's total and left every pool reporting the
window a pass had just read, so a landing page claimed $206,718 in all-time
volume above a list of pools claiming $4,159. Two sums of the same trades, taken
in different places over different sets, and the reader has no way to tell which
is which.

They are one question sliced two ways. The store groups the swap table by pool
in a single scan — the pool column has been indexed since a pool's own trade
history needed it — and the pass folds that: each pool takes its row, each token
takes the rows of the pools holding it, and the protocol takes the sum. What the
pass valued this time around stays in the log, where it says what the pass did
rather than what the chain has done.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-14 07:39:56 -07:00
zeekayandHanzo Dev 14b0771d1d Value the history, not just the last window of it
Promoting the trade value to a column made the sum honest and, in doing so,
showed what it was a sum of: 1,018,429 trades on this chain, of which the newest
50,000 had ever been priced. The other 95% were stored at zero — so the all-time
total was $4,048 where the newest window alone was $4,159, and every day before
that window was missing from every chart.

A pass now reads both ends of what it has not seen. The head keeps arriving
trades priced; the tail walks forward from a mark and covers the table a batch at
a time until it meets the head, after which it costs a query that returns
nothing. The mark records having LOOKED, not having priced: a trade whose tokens
reach no stablecoin can never be priced, and a mark that waited for one would
stop at it forever. It advances only once the values are on disk.

Days are written whole. A day row is replaced by the pass that writes it, and
both reads cut somewhere, so the day a cut lands in is dropped and comes back
from the other side. A read that came back short of its limit was not cut and
keeps everything — the case where the whole table fits in one window, which is
every small chain.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-14 07:07:13 -07:00
zeekayandHanzo Dev d3e86b3eb8 All-time volume is a sum over the swap table, not over a window
v1.2.47 replaced one window sum with the day series added up. Those rows are
folded from the same window, so their sum is that window again — a change that
read correctly and moved nothing. Live proof: the day series summed to exactly
the pass's own figure, and its trade counts to exactly the window size.

The value of a trade has always lived inside the swap's JSON document, where SQL
cannot reach it — this driver's amalgamation carries no JSON1, so json_extract
is not an escape either. So amountUSD joins timestamp and pool as a column: the
queryable projection of the document, written by both paths that touch a swap,
summed by one reader. What the protocol has traded is now one scan of one column
and covers every trade ever indexed.

A database that predates the column gets it on the start that introduces it,
filled from the rows themselves. Empty, it would have zeroed every trade older
than the current window — the fix erasing the number it exists to correct — so
that is the case the test pins, and the ALTER failing is how a later start knows
the fill is done.

txCount is left where it is. It counts every interaction, mints and burns among
them, which is a different question from what has traded.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-14 06:48:41 -07:00
zeekayandHanzo Dev d46a6da07c Write down the two invariants a Token row has, and which sqlite to open
The unit and the predicate are both things you cannot infer from a field named
totalSupply, and getting either wrong is silent: one prints a valuation 10^18
out, the other prints a dash forever. The driver note is there because three
packages in this binary want to be sqlite and only one of them can have the
name.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-13 15:37:57 -07:00
zeekayandHanzo Dev db0bd14382 note how a swap gets a time, and what the day series is exact about
Co-authored-by: Hanzo Dev <[email protected]>
2026-08-11 11:32:00 -07:00
zeekayandHanzo Dev 2c785b0eb0 rpc: /ext/ -> /v1/ in graphd + CLOB indexer endpoints
The CLOB read base is `<node>/v1/bc/D/dex/...`, not /ext/. luxd serves
one prefix (node server/http/server.go baseURL = "/v1").

Measured 2026-07-27 on both fleets, each with a bogus-path control:
  mainnet luxd-1:9630 /v1/bc/C/rpc 200 0x17871 | /ext/ 404 | control 404
  devnet  luxd-2:9650 /v1/bc/C/rpc 200 0x1786f | /ext/ 404 | control 404
Ports come from each net's LuxNetwork CR spec.ports.http — never assume.

go vet ./... clean; go test ./indexer/ -run CLOB -> 3/3 PASS.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 17:58:17 -07:00
zeekay 27d1b84235 feat(indexer): native D-Chain CLOB source for the dex subgraph
The dex subgraph indexer only consumed EVM 0x9999 settlement logs (the
cross-chain settlement view). On a native-DEX deployment the trade engine
IS the D-Chain (dexvm): a trade is a consensus state transition matched at
Block.Verify, not an EVM event, so native fills never appear on the EVM RPC
and the dex subgraph stays empty (markets:null).

Add CLOBSource (indexer/clob.go): an orthogonal, READ-ONLY poller of the
D-Chain committed-state read RPC clob_get_{markets,trades,orders} that writes
the same Market/Fill/Order entities the existing dex resolvers serve. Enabled
by Config.DexRPC; empty preserves EVM-only behaviour. The two sources share
only the store and the entity shapes, so this is purely additive — the amm
(EVM) subgraph is untouched.

- markets <- clob_get_markets (per-market authoritative book summary; bound-
  market hex symbol decoded to its human pair, e.g. LUX/LUSD)
- fills   <- clob_get_trades?since=<h> (global height-ordered log; keyed
  height:seq -> idempotent; incremental by accepted height)
- orders  <- clob_get_orders?market=<id> (resting book per market)

Tests (httptest doubles serving the exact read.go JSON shapes captured live
from lux-devnet): markets/trades/orders ingest + symbol decode, incremental
cursor + idempotent re-read, and EVM-AMM no-regression with DexRPC set.
2026-06-22 15:48:53 -07:00
zeekay 223316ec3b docs(LLM.md): native 0x9999 DEX indexing + two-exchange-api-image topology 2026-06-21 14:34:02 -07:00
zooqueenandHanzo Dev 5783d1167f docs: tidy LLM.md indexes; CLAUDE.md -> LLM.md symlink convention
Co-authored-by: Hanzo Dev <[email protected]>
2026-06-17 09:54:03 -07:00
zooqueenandHanzo Dev 050748ea4e Add agent project docs (CLAUDE.md, LLM.md)
Co-authored-by: Hanzo Dev <[email protected]>
2026-05-31 21:57:56 -07:00