Skip to content

draft: final zero-seed launch reads, response contract v7 - #191

Open
moodysalem wants to merge 21 commits into
mainfrom
eku-827/launch-endpoints
Open

moodysalem wants to merge 21 commits into
mainfrom
eku-827/launch-endpoints

Conversation

@moodysalem

@moodysalem moodysalem commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Current state (head 75ee5be)

Draft. Do not merge or deploy. It reads the indexer tables of EkuboProtocol/indexer#246 at 4a2587e.

  • Final launch only, response contract zero-seed-launch-api/v7. The v5 fixed-base and tick-rate models, vectors, goldens and replay scripts are removed.
  • GET /launches.
    • Filters: chainId (optional, across chains), status=all|trading|upcoming, owner (current owner), creator.
    • Ordering: order_by=market_cap|volume|sold_share|trade_count|created, applied in SQL over the whole filtered set before paging.
      • market_cap and volume rank priced launches by USD first, then fall back to quote amount, as the interface does.
      • Ties go newest first.
    • aggregates cover the same filtered set: launch_count, trade_count, and per-(chain, quote) raw volume and market_cap. USD totals add up only priced launches, and report excluded_launch_count. Different quote tokens are never summed together.
    • Paging: offset/limit, with total and totals{all,trading,upcoming}.
    • Invalid input returns 400 naming the parameter.
  • GET /launches/{chainId}/{poolId}.
    • Identity: pool key, token (decimals 18, name and symbol decoded from the packed words), quote token, controller, creator and owner.
    • logo_url: null when empty or not valid UTF-8, otherwise raw and never fetched.
    • All parameters as exact decimal strings, plus the spacing and aligned bounds (range).
    • Supply as requested, installed and sink. The sink is not a burn.
    • Status, fee schedule and current fee rate, and market data (price, market cap, volume and volume_usd, raised, sold share, trade count).
    • Detail-only: principal and fee ledger.
  • /swaps, /claims, /owners. Paged by after_event_id. Claims have one row per extension claim, with the periphery owner and recipient, plus totals.

Verification (local)

  • format:check, lint and typecheck pass.
  • bun test: 220 pass, 12 skip, 0 fail.
  • replay.postgres.test.ts against local Postgres: 1 test, 2,600 checks.
    • It loads the indexer's migrations, processors and DAO at 4a2587e and replays its anvil chain block by block, reading every route through the app.
    • Checked: empty and invalid logos become null; owner after transfers; claim sums equal both claim logs and are never doubled; paging; filters; totals; a reorg; and a second replay that serves identical bodies.

@moodysalem moodysalem changed the title launch list, detail, stats and swaps endpoints draft: zero-seed launch indexed reads Oct 11, 2026
moodysalem and others added 6 commits October 19, 2026 12:59
EKU-1523 preparation only; route/query integration follows. No handoff or release clearance.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Use screened local manifests, repeatable-read snapshots and separate Core principal/creator ledgers; hosted support remains disabled. Verify actual handlers against emitted local indexer replay, reorg/repair/idempotency and concurrent snapshot consistency.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
The edge cache folds integer-like path segments, so a path parameter must
mean the same thing in every hex or decimal spelling. Declare the launch
chainId as an int64 integer and accept the pool id as any hex or decimal
uint256, which keeps the launch routes inside the cache-key contract.
Format the launch sources, drop assertions the linter flags as unnecessary,
pin the replay to the rebased indexer head, and insert the API replay cases
whether the indexer harness closes its describe as `});` or across lines.
@moodysalem
moodysalem force-pushed the eku-827/launch-endpoints branch from 230afd4 to 661351c Compare October 19, 2026 17:06
@moodysalem
moodysalem marked this pull request as ready for review October 19, 2026 17:19
The indexed launch now carries decay_factor, a literal Q0.64 per-second
multiplier. fee_schedule.fee_rate follows the contract's normalized
exponential: powQ64 square-and-multiply flooring after every Q64 multiply,
final + floor((initial - final) * (b^t - b^D) / (2^64 - b^D)). The response
gains fee_schedule.decay_factor, so the contract version becomes
zero-seed-launch-api/v2.

Re-pin the local instances and ABI to evm-contracts b1cbb1c and the indexer
replay harness to its matching head. Tests reproduce the contract's fee rows,
chord counterexamples and all-second digests at six rates, and the replay
checks the served rate against the indexer's SQL fee_at.
Move the launch reads to the forward-only ZeroSeedLaunch and its periphery
at evm-contracts 4f1a306, over indexer schema zero-seed-launch-index/v2.
The response schema version is now zero-seed-launch-api/v3:

- quote_token.kind distinguishes native ETH (address 0, token0, 18
  decimals, no ERC-20 metadata) from an ERC-20 quote.
- fee_schedule.decay_factor is replaced by the fixed-base Q128 table with a
  600 s half-life; the TypeScript fee reproduces all 25,212 rows of the
  protocol's independent all-second vectors.
- creator is the owner at creation, owner the current transferable fee
  holder, controller the periphery; only periphery-controlled launches of
  the pinned instances are served.
- Claims are periphery payouts linked to the extension ledger event of the
  same transaction, counted once. A new owners endpoint lists transfers and
  the list accepts an owner filter.

The replay runner pins the new indexer head and fixture and checks every
handler against the chain state of each block, including a reorg across
transfers; its golden output is committed as a machine-readable example.
…nch schema v4)

ZeroSeedLaunch at evm-contracts 40af6cb takes the quote per launch
(LaunchParameters.quoteToken) instead of a constructor quote, and installs
at most the requested supply, minting the remainder to address(0).

- LaunchSummary gains supply {requested, installed, sink, sink_holder},
  validated (0 < installed <= requested, sink = requested - installed)
  before serving; principal.installed_supply is removed.
- The instance manifest carries no quote. A launch is served only when its
  own quote is native ETH or an ERC-20 in a reviewed list bound by chain,
  address and runtime codehash; list SQL screens on it before pagination.
  Hosted lists stay empty and hosted reads stay disabled.
- Queries read indexer schema zero-seed-launch-index/v3; ABI pins follow
  40af6cb.
- The replay runner pins the updated indexer harness and fixture, and the
  golden is regenerated from the actual handlers as v4.
Describe the requested/installed/sink supply, the removal of
principal.installed_supply, the reviewed ERC-20 quote list and the
replay pins and commands, and keep the launch tests lint-clean.
…r fees

The protocol now accepts every uint64 creator fee rate (2^64 - 1, just under
100%, is the maximum) and drops FeeTooHigh() from the interface. The
response shape is unchanged, so the contract stays zero-seed-launch-api/v4.

- Re-pin the ZeroSeedLaunch ABI (sha256 efae9388...e41e) and the local
  replay instance (extension 0x511b...6d8b, periphery 0x2f0b...ef64 and
  their runtime hashes); the periphery ABI and the local quote are unchanged.
- Fee fields (initial_fee, final_fee and both fee_rates) are validated as
  canonical decimal uint64 strings. An indexed swap fee rate above 2^64 - 1
  was previously served as is; it now fails as 500 like an out-of-range
  schedule fee, never wrapped or truncated. OpenAPI documents the range.
- Re-pin the emitted-state replay to indexer c78a48e (fixture sha256
  09d77457...4fcc), which adds two launches created normally at the maximum
  rate: native 2^64 - 1 -> 0.3% over 3600 s and ERC-20 flat at 2^64 - 1.
  The replay checks that the served instance equals the fixture's, that both
  launches serve 2^64 - 1 exactly (schedule, phase, swap rates, exact-input
  net floor(gross / 2^64), exact-output paid calculated * 2^64, ledgers and
  claims) and that a stored fee of 2^64 fails as 500.
- Regenerate the golden responses with both launches and test them, and
  unit-test the whole uint64 range and malformed fee encodings.
…llation

evm-contracts 43d6628 installs the exact largest token0 liquidity the
requested supply pays for; the shared helper it used before floored
lower * upper / 2^128 first and installed less at low prices. The API
serves the indexed liquidity and Core's position delta and never
recomputes the installation, so the response contract stays v4. A sink
of "0" is now possible when the requested supply is exactly installable.

- Re-pin the local instance (extension, periphery and their runtimes) and
  the emitted-state replay to indexer 91a7036 (fixture sha256
  ec308953...e7d9), which adds two ERC-20 token0 launches at low-price
  geometry: 1e30 over ticks -88080384..-85983232 at spacing 524288
  (liquidity 115073586432, sink 8589236567713153558) and an int128-scale
  supply over the full width at spacing 1 with no sink.
- The replay checks both against the chain after every block, their exact
  served supply and liquidity, list order, creator/owner filters and
  quote screening; regenerate the golden responses with both and test them.
…is 00140

main applied 00139_mev_capture_v21, so the unapplied zero-seed launch
migration was renumbered to 00140 with an unchanged schema. The replay
fixture and its SHA-256 are unchanged.
The replacement ZeroSeedLaunch revision (evm-contracts 3d6378f) replaces the
fee duration with a uint64 Q32.32 decayRateX32 toward a long-run floor.
fee_schedule becomes a union on model, the fee model of the launch's
deployment pin: fixed_base_duration_v1 keeps the v4 schedule and math
unchanged; tick_rate_v2 serves decay_rate_x32 as a decimal string, a display
half-life from an exact integer constant, the saturation second and phases
before_trading_start, decaying, at_floor and constant, with no end time.

Instance pins carry the model and the list/detail SQL screens it. Malformed
indexed schedules fail as 500. The TypeScript mirror is checked against the
contract's frozen v7 vectors, and the emitted-state replay runner now runs the
indexer's harness for each fee model and writes a golden response set for
each.
Drop the fixed-base and earlier tick-rate fee models, their pins, vectors and
goldens. Launches now carry the logo, every LaunchParameters field as exact
decimal strings, the derived spacing and aligned bounds, a trading status and
market data (price, market cap, raised, sold share, trade count). The list
spans chains with status, owner and creator filters, market-cap ordering,
offset paging and totals. Claims are one row per extension claim with the
periphery owner and recipient attached. Tests use the frozen 853b608 vectors.
replay.postgres.test.ts builds a loopback Postgres with the indexer's own
migrations, processors and DAO from its 853b608 local anvil chain and checks
every route against the raw logs and recorded chain state, including logos,
claims counted once, owner history, list filters, a reorg and an identical
second replay. It replaces the harness-splicing runner and writes the v6
golden responses.
@moodysalem moodysalem changed the title draft: zero-seed launch indexed reads draft: final zero-seed launch reads, response contract v6 Oct 26, 2026
Adds market.volume (|quote delta| summed over every LaunchSwapped, raw
quote units) and market.volume_usd, list order_by volume, sold_share and
trade_count ranked in SQL over the whole filtered set, and list
aggregates: per-quote raw totals, a USD total over priced launches only
and the count of launches left out of it.
…ters

The indexer now follows each launch token named by LaunchCreated and
refuses a creation whose mints were not stored first, so the replay builds
its filters with logStreamFilters and groups logs with the addresses
loadKnownAddresses returns. The v7 golden is regenerated against indexer
4a2587e; only source.indexer_commit changes.
@moodysalem moodysalem changed the title draft: final zero-seed launch reads, response contract v6 draft: final zero-seed launch reads, response contract v7 Oct 26, 2026
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.

2 participants