Skip to content

Feat/839 842 factory endpoints - #895

Merged
Jayy4rl merged 5 commits into
StellarYield:mainfrom
hardcordev:feat/839-842-factory-endpoints
Jul 26, 2026
Merged

Feat/839 842 factory endpoints#895
Jayy4rl merged 5 commits into
StellarYield:mainfrom
hardcordev:feat/839-842-factory-endpoints

Conversation

@hardcordev

Copy link
Copy Markdown
Contributor

Adds four read endpoints under /api/v1/factory: admin transfer history,
vault creation rate, default vault parameters, and a paginated factory
event log.

Why this touches the indexer

#839 and #841 read from factory_admin_history and indexed_events.parsed_data
respectively, but the indexer never parsed the contract's adm_xfr
(admin_transferred) or def_upd (defaults_updated) events — so those tables
would stay empty/null forever. This PR adds the missing parsers and wiring,
following the same pattern as the existing zkme_upd/role_grt handlers.

Changes

  • Migration: factory_admin_history table (old_admin, new_admin, ledger,
    recorded_at) + index.
  • Indexer: parseAdminTransferredEvent / parseDefaultsUpdatedEvent, wired
    into processEvent. adm_xfr writes to factory_admin_history; def_upd is
    recorded to indexed_events.parsed_data. Documented in docs/events.md.
  • GET /api/v1/factory/admin-history — all transfers, recorded_at DESC,
    requireApiKey.
  • GET /api/v1/factory/vault-creation-rate — { last24h, last7d, last30d }
    vault counts by created_at.
  • GET /api/v1/factory/defaults — { defaultAsset, defaultZkmeVerifier,
    defaultCooperator }, nulls if no def_upd indexed yet.
  • GET /api/v1/factory/events — paginated (page/pageSize, max 100),
    ledger DESC, filtered to the factory contract, requireApiKey.
  • OpenAPI docs for all four endpoints.

Testing

  • New unit tests for all four controller functions (empty-history case,
    rolling-window counts, null-defaults case, pagination).
  • New parser tests for parseAdminTransferredEvent / parseDefaultsUpdatedEvent
    in the existing event-fixture suite.
  • npx tsc --noEmit: no new type errors (pre-existing unrelated errors in
    dead legacy files untouched by this PR).
  • Full test suite: pre-existing failures (e.g. missing EventEmitter import
    in services/user.ts, DB-less e2e tests) are unchanged by this diff — none
    are in files this PR touches.

Closes #839, closes #840, closes #841, closes #842

…te endpoints

Adds four read endpoints under /api/v1/factory: admin-history and events
(both requireApiKey-protected), defaults, and vault-creation-rate.

admin-history and defaults need data the indexer never captured, so this
also wires up the previously-unhandled adm_xfr and def_upd factory events:
adm_xfr now writes to a new factory_admin_history table, and def_upd is
recorded to indexed_events.parsed_data so /defaults can read it back.

Closes StellarYield#839, closes StellarYield#840, closes StellarYield#841, closes StellarYield#842
…eries

Ties on recorded_at/ledger are possible when multiple factory events land
in the same ledger, which would make pagination order nondeterministic.
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@hardcordev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Jayy4rl
Jayy4rl merged commit cd8c1ab into StellarYield:main Jul 26, 2026
5 of 6 checks passed
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.

Add factory event log endpoint Add factory default settings endpoint Add vault creation rate metric Add factory admin history endpoint

2 participants