Files
grenadeandClaude Opus 5.5 8892f0a399
ci / gate (push) Successful in 4m32s
deploy / validate (push) Skipped
deploy / build (push) Successful in 9m51s
deploy / deploy-web (push) Successful in 6s
deploy / deploy-api (push) Successful in 17s
feat: on-chain context for each pause in quoting, and pool settings kept
Each of the newest pauses now says what happened on-chain around QTC
while it ran, so a reader can tell "not quoting but still trading" from
"offline":

- pool swaps by known solvers, with the QTC they sold into and bought
  out of the pool;
- direct pool swaps by anyone else;
- 1Click fills, which a pause should have none of;
- bridge deposits arriving on NEAR;
- the largest solver QTC holding at the pause's start and end, from the
  probe's own readings;
- changes to the pool's state or whitelist.

That last needs data that was not kept: the pool's state and whitelist
were read every minute and held only in memory. ref_pool_settings
(migration 0023) records them when either changes, and only a row with
a predecessor counts as a change. The first row is how the pool was
first seen.

Context is computed for the 12 newest pauses, a few aggregate queries
each. It is counts and amounts only, and the page says it does not
explain why quotes stopped.

Refs #45

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015tyzzRVjH9AdwGtYwsH5VC
2026-10-07 17:43:29 +03:00

20 lines
954 B
SQL

-- A Ref DCL pool's state and swap whitelist, kept when they change.
-- blackbeard/observer#45.
--
-- Both are read every minute (refdcl::pools) and were only ever held in memory,
-- so a pool paused, or a solver dropped from its whitelist, during a stretch
-- with no quotes would leave no trace afterwards. That is exactly the context
-- a pause needs: "the pool stopped" and "the quotes stopped while the pool ran"
-- are different events. A row is written only when either differs from the
-- latest one for the pool, so the table is a list of changes, and the first
-- row is the state as first seen.
create table ref_pool_settings (
chain text not null references chain (id) on delete cascade,
pool_id text not null,
at timestamptz not null,
state text not null,
-- Sorted, so equal whitelists compare equal.
whitelist jsonb not null,
primary key (chain, pool_id, at)
);