Skip to content

Conversation

@secretmemelocker
Copy link
Collaborator

@secretmemelocker secretmemelocker commented Jan 18, 2026

Summary by CodeRabbit

  • New Features
    • Added an "Accrue Interest" action to the market header (lightning icon) with on-screen transaction notifications and automatic chain switching.
    • Positions tab now includes dedicated Suppliers and Borrowers tables.
    • Enhanced positions view with new columns: network, asset details, current APR/APY, accrued interest (with tooltip), collateral exposure, risk indicators, and per-position actions.

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

@vercel
Copy link
Contributor

vercel bot commented Jan 18, 2026

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

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 18, 2026

📝 Walkthrough

Walkthrough

Adds an "Accrue Interest" action to the Market header which triggers a chain-switch and Morpho contract call, and extends supplied positions UI with multiple new columns (chain, asset, APR/APY, accrued interest, collateral, risk, actions).

Changes

Cohort / File(s) Summary
Market header
src/features/market-detail/components/market-header.tsx
Added accrueInterest: () => void prop, imported lightning icon, and new "Accrue Interest" dropdown item that invokes the callback.
Accrue-interest flow & Market view
src/features/market-detail/market-view.tsx
Added chain switching (useSwitchChain), transaction wrapper (useTransactionWithToast), calldata encoding (encodeFunctionData) and handleAccrueInterest to call Morpho's accrueInterest. Wired accrueInterest into MarketHeader and refetch on success. Reorganized Positions tab to use consolidated SuppliersTable/BorrowersTable blocks.
Supplied positions UI
src/features/positions/components/supplied-morpho-blue-grouped-table.tsx
Added presentational columns: chain icon, loan asset details, current APR/APY, accrued interest (with loading/tooltip/zero-state), collateral exposure, aggregated risk indicators, and actions dropdown.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Header as MarketHeader
    participant View as MarketView
    participant Switcher as ChainSwitcher
    participant Contract as MorphoContract
    participant Toast as Toasts
    participant Data as MarketData

    User->>Header: Click "Accrue Interest"
    Header->>View: accrueInterest()
    View->>Switcher: switchChainAsync(targetChain)
    Switcher-->>View: chain switched
    View->>Contract: sendTransaction(calldata: accrueInterest)
    Contract-->>View: tx mined/confirmed
    View->>Toasts: show success
    View->>Data: refetch market
    Data-->>View: updated market state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 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 two main changes: adding an accrue interest button (implemented in market-header.tsx and market-view.tsx) and repositioning tables to the top of the positions tab (done in market-view.tsx).

✏️ 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 sml/qolFixes

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 18, 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: 1

Caution

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

⚠️ Outside diff range comments (2)
src/features/positions/components/supplied-morpho-blue-grouped-table.tsx (2)

227-230: Stop row toggle when clicking the Actions menu.
The row onClick will also fire when users open the Actions dropdown, which can toggle the row unexpectedly. Stop propagation on the Actions cell/button.

Suggested fix
-                    <TableCell
-                      data-label="Actions"
-                      className="justify-center px-4 py-3"
-                    >
+                    <TableCell
+                      data-label="Actions"
+                      className="justify-center px-4 py-3"
+                      onClick={(event) => event.stopPropagation()}
+                    >

Also applies to: 324-346


219-241: Conditionally render Image when network icon exists.
getNetworkImg can return undefined for unsupported chains. Next.js Image rejects empty string src, so the ?? '' fallback will error at runtime. Use conditional rendering instead.

Suggested fix
-              return (
+              const networkImg = getNetworkImg(groupedPosition.chainId);
+              return (
                 <Fragment key={rowKey}>
                   <TableRow
                     className="cursor-pointer hover:bg-gray-50"
                     onClick={() => toggleRow(rowKey)}
                   >
                     {/* Chain image */}
                     <TableCell className="w-10">
                       <div className="flex items-center justify-center">
-                        <Image
-                          src={getNetworkImg(groupedPosition.chainId) ?? ''}
-                          alt={`Chain ${groupedPosition.chainId}`}
-                          width={24}
-                          height={24}
-                        />
+                        {networkImg && (
+                          <Image
+                            src={networkImg}
+                            alt={`Chain ${groupedPosition.chainId}`}
+                            width={24}
+                            height={24}
+                          />
+                        )}
                       </div>
                     </TableCell>
🤖 Fix all issues with AI agents
In `@src/features/market-detail/market-view.tsx`:
- Around line 82-96: The success toast is shown too early because
handleAccrueInterest calls writeContractAsync directly and doesn't await the
transaction lifecycle or surface errors; instead route the action through the
transaction hook by calling sendAccrueInterest (or sendTransactionAsync returned
by useTransactionWithToast) and await it so pending/success/error toasts and
onSuccess/refetchMarket run after on-chain confirmation; update
handleAccrueInterest to call sendAccrueInterest with the same params you pass to
writeContractAsync, await the returned promise, and ensure errors are
caught/propagated (and apply the same change to other handlers that call
writeContractAsync directly, e.g., the similar handlers referenced around the
file that perform writes).

@antoncoding antoncoding merged commit d6c44d0 into master Jan 18, 2026
3 of 4 checks passed
@antoncoding antoncoding deleted the sml/qolFixes branch January 18, 2026 04:06
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.

3 participants