Skip to content

SyncGateSimpleEarnSnapshot

Код: internal/worker/activities/sync_gate_simple_earn.go

Input (models.SyncGateSimpleEarnInput):

  • page_limit — размер страницы overview API, default 1000
  • max_pages — upper bound for pagination, default 20
  • search_coin — optional debug filter for one asset

Output (models.SyncGateSimpleEarnResult):

  • snapshot_at
  • projects_seen
  • projects_upserted
  • subpools_seen
  • subpools_upserted
  • quarantine_rows

Источник данных

  • Bootstrap page: https://www.gate.com/en-us/simple-earn
  • API: https://www.gate.com/apiw/v2/uni-loan/earn/market/list
  • DB: SQL function ingest_gate_simple_earn_snapshot($1::jsonb) + fct_gate_simple_earn_*

Особенности

  • для gate.com activity поднимает Playwright browser session, дает Gate выставить browser state и затем вызывает GET market/list через BrowserContext.Request();
  • для test/custom non-Gate URL используется fallback на обычный HTTP client;
  • запрос использует browser-like headers (Referer, User-Agent, sec-ch-*, Sec-Fetch-*) и fixed Gate query params;
  • detail route не нужен: overview payload уже несет embedded fixed_list и fixable_list;
  • 403/Access Denied классифицируется как non-retryable gate_simple_earn_access_denied;
  • идемпотентность обеспечивается UPSERT-семантикой ingest_gate_simple_earn_snapshot.

Связи

Наблюдаемость

  • Логи: gate_simple_earn_mapping_coverage, gate simple earn market list request failed
  • Quarantine table: fct_gate_simple_earn_quarantine