Skip to content

chore: remove unused liquidations code and storage migration#339

Merged
antoncoding merged 2 commits intomasterfrom
chore/cleanup-unused-code
Jan 29, 2026
Merged

chore: remove unused liquidations code and storage migration#339
antoncoding merged 2 commits intomasterfrom
chore/cleanup-unused-code

Conversation

@starksama
Copy link
Copy Markdown
Collaborator

@starksama starksama commented Jan 29, 2026

Summary

Cleanup of unused code after migrating to Monarch API's everLiquidated field.

Removed Files (-1,049 lines)

Liquidations (no longer needed - using everLiquidated from market metrics)

  • src/hooks/queries/useMonarchLiquidationsQuery.ts — unused hook
  • src/hooks/queries/useLiquidationsQuery.ts — deprecated fallback
  • src/data-sources/morpho-api/liquidations.ts — unused data source
  • src/data-sources/subgraph/liquidations.ts — unused data source
  • app/api/monarch/liquidations/route.ts — unused API proxy

Storage Migration (migration period complete)

  • src/components/StorageMigrator.tsx — one-time migration component
  • src/utils/storage-migration.ts — migration utility

Updated Files

  • app/layout.tsx — removed StorageMigrator component
  • src/hooks/queries/useMarketMetricsQuery.ts — cleaned up deprecated comments

Verification

pnpm typecheck ✓
pnpm lint ✓

Summary by CodeRabbit

  • Refactor

    • Removed the liquidations data query stack and its server proxy — liquidations data will no longer be fetched via the removed flows.
    • Removed the legacy one-time localStorage migration system and related migration utilities.
    • Adjusted data refresh cadence: market metrics and market data now refresh less frequently (longer stale times / reduced polling).
  • Documentation

    • Updated documentation to reflect the revised data sources and polling cadence.

✏️ Tip: You can customize this high-level summary in your review settings.

Removed:
- useMonarchLiquidationsQuery (unused hook)
- useLiquidationsQuery (deprecated fallback)
- morpho-api/liquidations.ts (unused data source)
- subgraph/liquidations.ts (unused data source)
- app/api/monarch/liquidations route (unused API proxy)
- StorageMigrator component (migration complete)
- storage-migration.ts utility

Updated:
- app/layout.tsx: removed StorageMigrator
- useMarketMetricsQuery: cleaned up comments
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
monarch Ready Ready Preview, Comment Jan 29, 2026 7:36am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Deletes liquidation-related data pipeline and storage migration code: removes a Next.js API route, multiple liquidations data-source modules and hooks, the StorageMigrator component, and the storage-migration utilities; documentation and a few query polling intervals updated.

Changes

Cohort / File(s) Summary
Monarch API Route
app/api/monarch/liquidations/route.ts
Removed the GET route handler that proxied /v1/liquidations to Monarch (API key validation, chain_id handling, fetch, error handling, and revalidation).
Liquidations Data Sources
src/data-sources/morpho-api/liquidations.ts, src/data-sources/subgraph/liquidations.ts
Deleted Morpho GraphQL fetcher and Subgraph fetcher for liquidated market keys (pagination, types, aggregation, and error handling removed).
Liquidations Hooks
src/hooks/queries/useLiquidationsQuery.ts, src/hooks/queries/useMonarchLiquidationsQuery.ts
Removed React Query hooks that aggregated liquidations across networks and the monarch-liquidations hook with its response type.
Storage Migration
src/utils/storage-migration.ts, src/components/StorageMigrator.tsx
Removed the storage migration utilities, types, execution/orchestration logic, expiry handling, and the StorageMigrator React component that triggered migrations.
Layout & Minor Hook Docs/Timing
app/layout.tsx, src/hooks/queries/useMarketMetricsQuery.ts, src/hooks/useMarketData.ts, docs/TECHNICAL_OVERVIEW.md
Removed StorageMigrator from layout; adjusted market metrics docs and useMarketMetricsQuery docs; changed stale/refetch timings (useMarketMetricsQuery refetch from 1m→5m; useMarketData stale/refetch 2m→30s).

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: removal of unused liquidations code and completed storage migration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/cleanup-unused-code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- useMarketMetricsQuery: refetchInterval 1min → 5min (match staleTime)
- useMarketData: restore 30s staleTime for accuracy on market views
- docs: update TECHNICAL_OVERVIEW with correct hooks and timings
  - Add useMarketMetricsQuery (5 min stale)
  - Fix useLiquidationsQuery → useMarketLiquidations
  - Correct stale times to match code
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/hooks/queries/useMarketMetricsQuery.ts (1)

128-130: Docstring says 15 minutes, code says 5 minutes.

The JSDoc claims "cached for 15 minutes" but staleTime is actually 5 minutes. Consider updating the comment to match.

Proposed fix
 /**
  * Fetches enhanced market metrics from the Monarch monitoring API.
- * Pre-fetched and cached for 15 minutes.
+ * Pre-fetched and cached for 5 minutes.

@antoncoding antoncoding merged commit 07a176d into master Jan 29, 2026
4 checks passed
@antoncoding antoncoding deleted the chore/cleanup-unused-code branch January 29, 2026 07:40
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