Skip to content

feat: option to hide locked markets#333

Merged
antoncoding merged 2 commits intomasterfrom
feat/locked-vault-detection
Jan 28, 2026
Merged

feat: option to hide locked markets#333
antoncoding merged 2 commits intomasterfrom
feat/locked-vault-detection

Conversation

@antoncoding
Copy link
Owner

@antoncoding antoncoding commented Jan 28, 2026

Summary by CodeRabbit

  • New Features

    • Added a "Show Locked Markets" toggle in market preferences, allowing users to filter out high-APY markets.
  • Improvements

    • Redesigned blacklisted markets interface with integrated search and pagination controls for improved usability and navigation.
  • Updates

    • Expanded the market blacklist to include additional high-risk markets.
    • Updated market filter descriptions for clarity.

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

@vercel
Copy link
Contributor

vercel bot commented Jan 28, 2026

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

Project Deployment Review Updated (UTC)
monarch Ready Ready Preview, Comment Jan 28, 2026 4:54am

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

Adds a "locked markets" filter feature that lets users toggle visibility of markets with exceptionally high APY (over 1500%). Includes a new feature flag in market preferences, UI toggles across settings panels, filter logic to identify locked markets, a refactor of the BlacklistedMarketsDetail component, and two new blacklisted market entries.

Changes

Cohort / File(s) Summary
Locked Markets Feature
src/constants/markets.ts, src/stores/useMarketPreferences.ts, src/utils/marketFilters.ts, src/hooks/useFilteredMarkets.ts
Added LOCKED_MARKET_APY_THRESHOLD constant (15 = 1500%), new showLockedMarkets state with setter, createLockedMarketFilter function, and integrated into the filtering pipeline
UI Toggles
src/features/positions/components/markets-filter-compact.tsx, src/modals/settings/monarch-settings/panels/FiltersPanel.tsx
Added "Show Locked Markets" toggles in compact filter modal and settings panel; updated "Show Unwhitelisted Markets" description text
Blacklist Management
src/modals/settings/monarch-settings/details/BlacklistedMarketsDetail.tsx
Major refactor: redesigned blacklist section styling with rounded cards, added search input to available markets, switched to paginated layout with per-row add buttons, improved text truncation handling
Market Data
src/utils/markets.ts
Added two blacklisted market entries (USDC/K on Arbitrum, sdeUSD/USDC from Elixir)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • feat: new landing page #170 — Adds foundational marketFilters module that this PR extends with the new showLockedMarkets option and locked market filtering logic
  • feat: add options to markets table #182 — Implements blacklist UI/logic; this PR builds on those blacklist mechanisms by adding entries and refactoring the detail component
  • feat: blacklist #179 — Adds default blacklisted market keys while this PR extends blacklist handling with search, pagination, and new entries

Suggested labels

feature request, ui

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature: adding an option to hide locked markets, which is the core change across all modified files.

✏️ 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 feat/locked-vault-detection

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.

@coderabbitai coderabbitai bot added feature request Specific feature ready to be implemented ui User interface labels Jan 28, 2026
Copy link

@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/modals/settings/monarch-settings/details/BlacklistedMarketsDetail.tsx (1)

60-66: Clamp currentPage when results shrink.

If the user is on a later page and the result set shrinks (e.g., after blacklisting), paginatedMarkets can go empty while results still exist. Clamp or reset the page when totalPages drops.

Proposed fix
 const totalPages = Math.ceil(filteredAvailableMarkets.length / ITEMS_PER_PAGE);
+useEffect(() => {
+  if (totalPages === 0) {
+    if (currentPage !== 1) setCurrentPage(1);
+    return;
+  }
+  if (currentPage > totalPages) {
+    setCurrentPage(totalPages);
+  }
+}, [totalPages, currentPage]);
 const paginatedMarkets = useMemo(() => {
   const startIndex = (currentPage - 1) * ITEMS_PER_PAGE;
   const endIndex = startIndex + ITEMS_PER_PAGE;
   return filteredAvailableMarkets.slice(startIndex, endIndex);
 }, [filteredAvailableMarkets, currentPage]);
🧹 Nitpick comments (2)
src/utils/marketFilters.ts (1)

110-120: Make non‑finite APY handling explicit.

Right now NaN/Infinity are implicitly treated as “locked” via the comparison. If that’s intended, make it explicit so the behavior is clear to readers.

Possible tweak
 return (market) => {
-  const supplyApy = market.state?.supplyApy ?? 0;
-  return supplyApy <= LOCKED_MARKET_APY_THRESHOLD;
+  const supplyApy = market.state?.supplyApy;
+  if (supplyApy === undefined || supplyApy === null) return true;
+  if (!Number.isFinite(supplyApy)) return false;
+  return supplyApy <= LOCKED_MARKET_APY_THRESHOLD;
 };
src/features/positions/components/markets-filter-compact.tsx (1)

145-165: Avoid hardcoding the APY threshold in copy.
Use the shared constant so UI stays in sync if the threshold changes.

Proposed change
-import { MONARCH_PRIMARY } from '@/constants/chartColors';
+import { MONARCH_PRIMARY } from '@/constants/chartColors';
+import { LOCKED_MARKET_APY_THRESHOLD } from '@/constants/markets';
...
-                  description="Display frozen markets with extreme APY (> 1500%)."
+                  description={`Display frozen markets with extreme APY (> ${LOCKED_MARKET_APY_THRESHOLD}%).`}

Copy link
Collaborator

@starksama starksama left a comment

Choose a reason for hiding this comment

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

Clean and straightforward implementation. Few notes:

What I like:

  • APY threshold approach is smart — way simpler than trying to detect locked vaults via on-chain state. supplyApy > 15 (1500%) catches dead/frozen markets without false positives on legit high-yield markets.
  • Filter composition pattern matches createUnknownTokenFilter / createUnknownOracleFilter exactly — easy to follow.
  • Default false (hidden) is the right UX — users don't want to see garbage 999999% APY markets unless they explicitly opt in.
  • BlacklistedMarketsDetail redesign looks tighter — the card-based layout with bg-surfacebg-surface-soft nesting is consistent with other settings panels.

Minor observations (non-blocking):

  • The account-actions-popover (DeBank link) is unrelated to locked markets — might be cleaner as a separate atomic commit, but fine to ship together.
  • LOCKED_MARKET_APY_THRESHOLD = 15 comment says "where 1.0 = 100%, so 15 = 1500%" which is clear. Just noting the Morpho API returns APY as a raw decimal (e.g. 0.05 = 5%), so the threshold is actually checking market.state.supplyApy > 15 which is > 1500% — confirmed correct.

LGTM ✅

@antoncoding antoncoding merged commit 084d168 into master Jan 28, 2026
4 checks passed
@antoncoding antoncoding deleted the feat/locked-vault-detection branch January 28, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Specific feature ready to be implemented ui User interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants