Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughWide-ranging stylistic and small-surface edits: numeric literals reformatted with digit separators, template literals simplified to plain strings, some bindings made const/readonly, type import/export reorganized, default switch branches added, storage key exports centralized, and small parameter/identifier renames. No substantive runtime behavior changes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Areas to pay attention to:
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/utils/balance.ts (1)
37-38: Inconsistent numeric literal formatting.Lines 33-36 use underscores (
1_000_000_000,1_000_000) but these lines use1000without. Should be1_000to stay consistent.- } else if (Math.abs(num) >= 1000) { - return `${(num / 1000).toFixed(2)}K`; + } else if (Math.abs(num) >= 1_000) { + return `${(num / 1_000).toFixed(2)}K`;app/market/[chainId]/[marketid]/VolumeChart.tsx (1)
102-105: Consider storing the last point to avoid double.at(-1)Current code calls
data.at(-1)twice; you could store it once (and assert non‑null after the length check) for a tiny readability win:const last = data.at(-1)!; const current = volumeView === 'USD' ? last.y : Number(formatUnits(BigInt(last.y), market.loanAsset.decimals));Not critical, just a small tidy‑up.
src/utils/gtag.ts (1)
5-7: LocalWindowWithGtagtyping is cleaner; optional guard forlogEventThe
WindowWithGtagalias and local casts are a nice improvement over globally augmentingWindow.You might also mirror the
isClient()check fromlogPageviewinlogEventto avoid any accidental server‑sidewindowaccess; optional but a bit safer.export const logEvent = ({ action, category, label, value }: { action: string; category: string; label: string; value: number }) => { if (!isClient()) return; (window as WindowWithGtag).gtag('event', action, { event_category: category, event_label: label, value, }); };Also applies to: 14-17, 21-26
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (48)
app/market/[chainId]/[marketid]/RateChart.tsx(1 hunks)app/market/[chainId]/[marketid]/VolumeChart.tsx(2 hunks)app/market/[chainId]/[marketid]/content.tsx(0 hunks)app/markets/components/constants.ts(1 hunks)app/positions/components/RebalanceProcessModal.tsx(1 hunks)app/positions/report/components/ReportTable.tsx(1 hunks)app/rewards/components/RewardTable.tsx(1 hunks)biome.jsonc(2 hunks)scripts/generate-oracle-cache.ts(5 hunks)src/components/MarketOracle/GeneralFeedTooltip.tsx(1 hunks)src/components/TokenIcon.tsx(1 hunks)src/components/providers/QueryProvider.tsx(2 hunks)src/constants/markets.ts(1 hunks)src/constants/oracle/general-feeds/index.ts(0 hunks)src/constants/vaults/known_vaults.ts(4 hunks)src/contexts/MarketsContext.tsx(1 hunks)src/data-sources/morpho-api/historical.ts(1 hunks)src/data-sources/morpho-api/vaults.ts(1 hunks)src/data-sources/subgraph/market.ts(2 hunks)src/hooks/useAllowance.ts(1 hunks)src/hooks/useBorrowTransaction.ts(1 hunks)src/hooks/useFreshMarketsState.ts(2 hunks)src/hooks/useLiquidations.ts(3 hunks)src/hooks/useMarketBorrows.ts(2 hunks)src/hooks/useMarketData.ts(2 hunks)src/hooks/useMarketHistoricalData.ts(2 hunks)src/hooks/useMarketLiquidations.ts(2 hunks)src/hooks/useMarketSupplies.ts(2 hunks)src/hooks/useMultiMarketSupply.ts(1 hunks)src/hooks/usePermit2.ts(1 hunks)src/hooks/useRebalance.ts(1 hunks)src/hooks/useRepayTransaction.ts(1 hunks)src/hooks/useSupplyMarket.ts(1 hunks)src/hooks/useUserPosition.ts(4 hunks)src/hooks/useUserPositions.ts(1 hunks)src/hooks/useUserPositionsSummaryData.ts(3 hunks)src/hooks/useVaultV2Deposit.ts(1 hunks)src/services/statsService.ts(2 hunks)src/utils/balance.ts(1 hunks)src/utils/blockFinder.ts(1 hunks)src/utils/external.ts(1 hunks)src/utils/gtag.ts(1 hunks)src/utils/interest.ts(1 hunks)src/utils/merklApi.ts(1 hunks)src/utils/networks.ts(2 hunks)src/utils/oracle.ts(1 hunks)src/utils/positions.ts(2 hunks)src/utils/subgraph-urls.ts(1 hunks)
💤 Files with no reviewable changes (2)
- src/constants/oracle/general-feeds/index.ts
- app/market/[chainId]/[marketid]/content.tsx
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx,js,jsx,css,scss}
📄 CodeRabbit inference engine (AGENTS.md)
Run
pnpm format(Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Files:
src/hooks/useMultiMarketSupply.tssrc/services/statsService.tssrc/hooks/useRepayTransaction.tssrc/hooks/useMarketLiquidations.tssrc/utils/external.tssrc/utils/blockFinder.tssrc/hooks/useVaultV2Deposit.tssrc/hooks/useUserPositions.tssrc/hooks/useBorrowTransaction.tssrc/utils/subgraph-urls.tssrc/hooks/useMarketHistoricalData.tsapp/markets/components/constants.tssrc/hooks/useMarketSupplies.tsapp/positions/components/RebalanceProcessModal.tsxsrc/components/providers/QueryProvider.tsxsrc/constants/vaults/known_vaults.tssrc/utils/positions.tssrc/contexts/MarketsContext.tsxsrc/hooks/useFreshMarketsState.tssrc/utils/gtag.tsapp/market/[chainId]/[marketid]/RateChart.tsxsrc/hooks/useUserPositionsSummaryData.tssrc/hooks/useAllowance.tssrc/constants/markets.tsapp/rewards/components/RewardTable.tsxsrc/utils/oracle.tssrc/hooks/useRebalance.tsapp/positions/report/components/ReportTable.tsxsrc/hooks/useSupplyMarket.tssrc/hooks/useMarketBorrows.tssrc/data-sources/morpho-api/vaults.tssrc/hooks/usePermit2.tsscripts/generate-oracle-cache.tssrc/utils/interest.tssrc/hooks/useLiquidations.tssrc/hooks/useUserPosition.tssrc/components/TokenIcon.tsxsrc/hooks/useMarketData.tssrc/components/MarketOracle/GeneralFeedTooltip.tsxapp/market/[chainId]/[marketid]/VolumeChart.tsxsrc/data-sources/subgraph/market.tssrc/utils/balance.tssrc/utils/networks.tssrc/utils/merklApi.tssrc/data-sources/morpho-api/historical.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use camelCase for helper function names (e.g.,
formatApr)
Files:
src/hooks/useMultiMarketSupply.tssrc/services/statsService.tssrc/hooks/useRepayTransaction.tssrc/hooks/useMarketLiquidations.tssrc/utils/external.tssrc/utils/blockFinder.tssrc/hooks/useVaultV2Deposit.tssrc/hooks/useUserPositions.tssrc/hooks/useBorrowTransaction.tssrc/utils/subgraph-urls.tssrc/hooks/useMarketHistoricalData.tssrc/hooks/useMarketSupplies.tssrc/components/providers/QueryProvider.tsxsrc/constants/vaults/known_vaults.tssrc/utils/positions.tssrc/contexts/MarketsContext.tsxsrc/hooks/useFreshMarketsState.tssrc/utils/gtag.tssrc/hooks/useUserPositionsSummaryData.tssrc/hooks/useAllowance.tssrc/constants/markets.tssrc/utils/oracle.tssrc/hooks/useRebalance.tssrc/hooks/useSupplyMarket.tssrc/hooks/useMarketBorrows.tssrc/data-sources/morpho-api/vaults.tssrc/hooks/usePermit2.tssrc/utils/interest.tssrc/hooks/useLiquidations.tssrc/hooks/useUserPosition.tssrc/components/TokenIcon.tsxsrc/hooks/useMarketData.tssrc/components/MarketOracle/GeneralFeedTooltip.tsxsrc/data-sources/subgraph/market.tssrc/utils/balance.tssrc/utils/networks.tssrc/utils/merklApi.tssrc/data-sources/morpho-api/historical.ts
src/hooks/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When building on-chain hooks, mirror
useERC20ApprovalanduseTransactionWithToastpatterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls
Files:
src/hooks/useMultiMarketSupply.tssrc/hooks/useRepayTransaction.tssrc/hooks/useMarketLiquidations.tssrc/hooks/useVaultV2Deposit.tssrc/hooks/useUserPositions.tssrc/hooks/useBorrowTransaction.tssrc/hooks/useMarketHistoricalData.tssrc/hooks/useMarketSupplies.tssrc/hooks/useFreshMarketsState.tssrc/hooks/useUserPositionsSummaryData.tssrc/hooks/useAllowance.tssrc/hooks/useRebalance.tssrc/hooks/useSupplyMarket.tssrc/hooks/useMarketBorrows.tssrc/hooks/usePermit2.tssrc/hooks/useLiquidations.tssrc/hooks/useUserPosition.tssrc/hooks/useMarketData.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
ESLint (Airbnb + Next.js) enforces hook safety and import hygiene
Files:
src/hooks/useMultiMarketSupply.tssrc/services/statsService.tssrc/hooks/useRepayTransaction.tssrc/hooks/useMarketLiquidations.tssrc/utils/external.tssrc/utils/blockFinder.tssrc/hooks/useVaultV2Deposit.tssrc/hooks/useUserPositions.tssrc/hooks/useBorrowTransaction.tssrc/utils/subgraph-urls.tssrc/hooks/useMarketHistoricalData.tsapp/markets/components/constants.tssrc/hooks/useMarketSupplies.tsapp/positions/components/RebalanceProcessModal.tsxsrc/components/providers/QueryProvider.tsxsrc/constants/vaults/known_vaults.tssrc/utils/positions.tssrc/contexts/MarketsContext.tsxsrc/hooks/useFreshMarketsState.tssrc/utils/gtag.tsapp/market/[chainId]/[marketid]/RateChart.tsxsrc/hooks/useUserPositionsSummaryData.tssrc/hooks/useAllowance.tssrc/constants/markets.tsapp/rewards/components/RewardTable.tsxsrc/utils/oracle.tssrc/hooks/useRebalance.tsapp/positions/report/components/ReportTable.tsxsrc/hooks/useSupplyMarket.tssrc/hooks/useMarketBorrows.tssrc/data-sources/morpho-api/vaults.tssrc/hooks/usePermit2.tsscripts/generate-oracle-cache.tssrc/utils/interest.tssrc/hooks/useLiquidations.tssrc/hooks/useUserPosition.tssrc/components/TokenIcon.tsxsrc/hooks/useMarketData.tssrc/components/MarketOracle/GeneralFeedTooltip.tsxapp/market/[chainId]/[marketid]/VolumeChart.tsxsrc/data-sources/subgraph/market.tssrc/utils/balance.tssrc/utils/networks.tssrc/utils/merklApi.tssrc/data-sources/morpho-api/historical.ts
app/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Next.js routes must live under
app/directory
Files:
app/markets/components/constants.tsapp/positions/components/RebalanceProcessModal.tsxapp/market/[chainId]/[marketid]/RateChart.tsxapp/rewards/components/RewardTable.tsxapp/positions/report/components/ReportTable.tsxapp/market/[chainId]/[marketid]/VolumeChart.tsx
**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Use PascalCase for React component file names (e.g.,
VaultBanner.tsx)
Files:
app/positions/components/RebalanceProcessModal.tsxsrc/components/providers/QueryProvider.tsxsrc/contexts/MarketsContext.tsxapp/market/[chainId]/[marketid]/RateChart.tsxapp/rewards/components/RewardTable.tsxapp/positions/report/components/ReportTable.tsxsrc/components/TokenIcon.tsxsrc/components/MarketOracle/GeneralFeedTooltip.tsxapp/market/[chainId]/[marketid]/VolumeChart.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{tsx,jsx}: Keep Tailwind class lists lean and dedupe variants withtailwind-merge
All toggles must use the sharedIconSwitchcomponent from@/components/common/IconSwitchfor consistent sizing and animation
Files:
app/positions/components/RebalanceProcessModal.tsxsrc/components/providers/QueryProvider.tsxsrc/contexts/MarketsContext.tsxapp/market/[chainId]/[marketid]/RateChart.tsxapp/rewards/components/RewardTable.tsxapp/positions/report/components/ReportTable.tsxsrc/components/TokenIcon.tsxsrc/components/MarketOracle/GeneralFeedTooltip.tsxapp/market/[chainId]/[marketid]/VolumeChart.tsx
src/constants/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use SCREAMING_SNAKE_CASE for shared constants
Files:
src/constants/vaults/known_vaults.tssrc/constants/markets.ts
scripts/**/*
📄 CodeRabbit inference engine (AGENTS.md)
Smart-contract scripts and artifacts belong in
scripts/
Files:
scripts/generate-oracle-cache.ts
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to src/**/*.{ts,tsx} : Use camelCase for helper function names (e.g., `formatApr`)
📚 Learning: 2024-10-07T14:38:04.384Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 57
File: src/hooks/useRebalance.ts:112-114
Timestamp: 2024-10-07T14:38:04.384Z
Learning: In `src/hooks/useRebalance.ts`, adding a delay is necessary because Rabby wallet cannot handle sequential requests.
Applied to files:
src/hooks/useRepayTransaction.tssrc/hooks/useBorrowTransaction.tssrc/hooks/useRebalance.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : When building on-chain hooks, mirror `useERC20Approval` and `useTransactionWithToast` patterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls
Applied to files:
src/hooks/useRepayTransaction.tssrc/hooks/useBorrowTransaction.tssrc/hooks/useAllowance.tssrc/hooks/useRebalance.tssrc/hooks/useLiquidations.ts
📚 Learning: 2024-10-23T16:17:02.841Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 77
File: src/graphql/queries.ts:168-193
Timestamp: 2024-10-23T16:17:02.841Z
Learning: In `src/graphql/queries.ts`, handling only `MarketTransferTransactionData` is intentional at this time.
Applied to files:
src/hooks/useMarketLiquidations.tssrc/hooks/useMarketHistoricalData.tssrc/contexts/MarketsContext.tsxsrc/hooks/useMarketBorrows.tssrc/hooks/useMarketData.tssrc/data-sources/subgraph/market.tssrc/data-sources/morpho-api/historical.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to src/constants/**/*.{ts,tsx,js,jsx} : Use SCREAMING_SNAKE_CASE for shared constants
Applied to files:
app/markets/components/constants.ts
📚 Learning: 2024-12-16T02:01:51.219Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 97
File: app/positions/components/onboarding/OnboardingContext.tsx:36-43
Timestamp: 2024-12-16T02:01:51.219Z
Learning: In `app/positions/components/onboarding/OnboardingContext.tsx`, the `defaultStep` variable is no longer needed and can be removed.
Applied to files:
app/positions/components/RebalanceProcessModal.tsx
📚 Learning: 2024-10-12T09:23:16.495Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 63
File: app/markets/components/MarketRowDetail.tsx:49-52
Timestamp: 2024-10-12T09:23:16.495Z
Learning: When rendering oracle feeds in `ExpandedMarketDetail` (`app/markets/components/MarketRowDetail.tsx`), prefer explicit rendering over iterating keys when dealing with a small number of feeds.
Applied to files:
src/contexts/MarketsContext.tsxsrc/utils/oracle.tssrc/hooks/useMarketData.tssrc/components/MarketOracle/GeneralFeedTooltip.tsx
📚 Learning: 2024-11-20T07:21:06.756Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 83
File: app/settings/page.tsx:8-16
Timestamp: 2024-11-20T07:21:06.756Z
Learning: In `app/settings/page.tsx`, the default value for `usePermit2` is intentionally set to `true`.
Applied to files:
src/hooks/useSupplyMarket.tssrc/hooks/usePermit2.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Applied to files:
biome.jsonc
📚 Learning: 2025-11-13T20:32:48.908Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 183
File: app/positions/components/RebalanceModal.tsx:301-308
Timestamp: 2025-11-13T20:32:48.908Z
Learning: The TokenIcon component in the codebase accepts a `symbol` prop as part of its valid interface, in addition to `address`, `chainId`, `width`, `height`, and other props.
Applied to files:
src/components/TokenIcon.tsx
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{tsx,jsx} : All toggles must use the shared `IconSwitch` component from `@/components/common/IconSwitch` for consistent sizing and animation
Applied to files:
src/components/TokenIcon.tsx
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Review `docs/Styling.md` before touching UI to stay aligned with Monarch design tokens and component patterns
Applied to files:
src/components/TokenIcon.tsx
🧬 Code graph analysis (3)
src/utils/external.ts (1)
src/utils/networks.ts (1)
getNetworkName(200-203)
src/contexts/MarketsContext.tsx (1)
src/utils/types.ts (1)
Market(293-345)
src/data-sources/subgraph/market.ts (1)
src/utils/types.ts (1)
MarketWarning(83-87)
🔇 Additional comments (54)
src/components/TokenIcon.tsx (1)
55-57: tokenSource string change is safeOnly the string literal syntax changed; text and behavior stay the same. Looks good.
app/markets/components/constants.ts (1)
18-32: Numeric separators look goodUnderscores keep the gas values the same and make them easier to read; fits the lint/format goal.
src/utils/external.ts (1)
4-4: Const binding is appropriate here
networkis not reassigned, so switching toconstis a clean, no-op lint improvement. Looks good.biome.jsonc (3)
7-7: Verify lineWidth alignment with team's Prettier config.The Biome lineWidth is set to 140, but learnings indicate Prettier uses 100-character width for formatting. Confirm this intentional difference doesn't conflict with your formatting pipeline.
93-93: Reasonable rule disable.Turning off
useDefaultSwitchClausealigns with your documented team preference to keep switch statements flexible during migration.
115-115: Reasonable rule disable.Disabling
useIndexOfin the complexity rules fits the gentle migration strategy noted in your comments.src/services/statsService.ts (1)
92-92: Inconsistency between AI summary and actual code.The AI summary states the log messages "consistently emit 'Sample transaction' (without the trailing colon)," but both modified lines (92 and 155) retain colons:
'Sample transaction:'and'Sample transaction structure:'. These messages are also semantically different, not consistent. Please verify the actual intent of these changes.Also applies to: 155-155
src/constants/vaults/known_vaults.ts (1)
87-87: LGTM — numeric separator formatting improves readability.All chainId literals are updated consistently with underscores, which is a standard practice in modern TypeScript for large numeric values. No functional impact.
Also applies to: 122-122, 227-227, 290-290, 297-297
src/utils/networks.ts (1)
13-13: LGTM — numeric separator formatting is safe.Both enum and constant numeric values are updated with underscores for readability. No logic changes, and the file is widely imported without risk of functional regression.
Also applies to: 34-34
app/positions/report/components/ReportTable.tsx (2)
57-57: Numeric literal formatting looks good.The change from
86400to86_400improves readability for the seconds-per-day constant. This aligns with the PR's lint objectives and maintains semantic equivalence.
147-147: Verify Prettier formatting was applied.There are trailing spaces in className values (lines 147, 165, 181:
"mt-1 text-lg ") that suggest Prettier may not have been run on this file. Per the coding guidelines, ensurepnpm formatis executed with the configured settings (2-space indentation, 100-character width, single quotes).Confirm that Prettier formatting has been applied to this file by running
pnpm formatbefore finalizing the PR.Also applies to: 165-165, 181-181
src/contexts/MarketsContext.tsx (1)
166-167: Solid const-by-default refactoring.Converting
lettoconsthere is correct—both arrays are only mutated (via.push()) and never reassigned, so this prevents accidental reassignment bugs while keeping the mutation semantics intact.src/hooks/useLiquidations.ts (2)
24-24: Good immutability improvement.Changing to
constprevents accidental reassignment while still allowing the intended mutation viapush.
39-39: LGTM! Consistent string formatting.Replacing template literals with single-quoted strings where no interpolation occurs aligns with Prettier configuration.
Also applies to: 55-55
src/utils/merklApi.ts (1)
6-6: Good immutability enforcement.Making
baseUrlreadonly is appropriate since it's assigned once in the constructor and never modified.src/utils/blockFinder.ts (1)
10-14: Good immutability enforcement.All three fields are assigned once in the constructor and never modified, so marking them readonly is appropriate.
src/hooks/useUserPositionsSummaryData.ts (1)
29-29: LGTM—purely cosmetic improvements to numeric readability.The underscore formatting on direct numeric literals improves clarity without affecting behavior. The pattern of leaving arithmetic expressions like
5 * 60 * 1000intact is sensible, since those are self-documenting. All values are correct, and the formatting aligns with Prettier standards.Also applies to: 129-129, 151-151
scripts/generate-oracle-cache.ts (1)
47-51: Logging template → string literal changes look goodAcross these ranges the only change is from backtick template literals to plain string literals while keeping the same arguments and formatting, so runtime behavior and error diagnostics stay the same. Fits the linting goal without side effects.
Also applies to: 60-63, 87-95, 137-143, 153-161
app/positions/components/RebalanceProcessModal.tsx (1)
24-30: Permit2 detail text change is behavior‑neutralTemplate literal was replaced by an equivalent plain string; no runtime or UI change.
src/utils/positions.ts (2)
176-184: Error log in fetchPositionsSnapshots unchanged in effectOnly the string literal syntax changed; the logged message and context object remain the same.
255-262: Error log in fetchMarketSnapshot unchanged in effectSame message text and metadata are logged; just a template → plain string swap.
src/hooks/useSupplyMarket.ts (1)
82-82: LGTM!Numeric separator improves readability.
src/hooks/useVaultV2Deposit.ts (1)
86-86: LGTM!Consistent with other hooks.
src/constants/markets.ts (1)
1-2: LGTM!Numeric separator applied to constant. Naming follows SCREAMING_SNAKE_CASE as expected.
src/hooks/useMarketData.ts (2)
51-51: LGTM!Plain string is appropriate since no interpolation is needed.
61-61: LGTM!Same rationale - no interpolation needed.
src/components/providers/QueryProvider.tsx (2)
16-16: LGTM!Clearer that this is 30,000ms.
27-27: LGTM!Consistent formatting for the retry delay cap.
src/hooks/useMultiMarketSupply.ts (1)
48-48: LGTM!Consistent with other Permit2 usages across hooks.
src/utils/interest.ts (1)
12-12: LGTM. Underscore separator improves readability for the seconds-in-a-day constant.app/market/[chainId]/[marketid]/RateChart.tsx (1)
93-93: LGTM. Consistent formatting with86_400used elsewhere in the codebase.src/hooks/useMarketHistoricalData.ts (2)
35-35: LGTM. Plain string is appropriate here since there's no interpolation.
46-46: LGTM. Same pattern as above.src/data-sources/morpho-api/vaults.ts (1)
5-5: LGTM. Underscore on42_161(Arbitrum) improves readability.src/hooks/useRepayTransaction.ts (1)
53-53: LGTM. Underscore formatting for 10-second interval.src/hooks/useUserPositions.ts (1)
231-231: LGTM. Underscore formatting for 30-second stale time.src/utils/subgraph-urls.ts (1)
30-30: LGTM!Plain string is correct here—no interpolation needed.
src/hooks/useMarketSupplies.ts (1)
48-48: LGTM!Plain strings for static log messages are fine. Error objects still passed correctly.
Also applies to: 58-58
src/hooks/useFreshMarketsState.ts (1)
9-9: LGTM!Underscores improve readability for millisecond values.
Also applies to: 117-117
src/hooks/usePermit2.ts (1)
28-28: LGTM!Formatting change only.
src/hooks/useBorrowTransaction.ts (1)
60-60: LGTM!Consistent with the formatting in usePermit2.ts.
src/hooks/useRebalance.ts (1)
55-55: LGTM!Underscore formatting improves readability.
src/hooks/useMarketLiquidations.ts (2)
33-33: LGTM!Plain string is appropriate here since there's no interpolation.
44-44: LGTM!Consistent with the other error log format change above.
src/hooks/useMarketBorrows.ts (2)
48-48: LGTM!Plain string without interpolation.
58-58: LGTM!Consistent formatting.
app/rewards/components/RewardTable.tsx (1)
47-48: LGTM!Plain strings are fine here - no interpolation needed.
src/hooks/useUserPosition.ts (1)
90-90: Console error message tweaks look goodBacktick → single‑quoted strings keep the same message content and behavior; matches the repo’s string style.
Also applies to: 101-101, 134-134, 145-145
src/hooks/useAllowance.ts (1)
24-24: Numeric separator change is fineUsing
10_000forrefetchIntervalimproves readability with no runtime change.app/market/[chainId]/[marketid]/VolumeChart.tsx (1)
330-340: Historical averages map simplification looks goodDropping the fragment and mapping directly to
<div>s keeps the JSX flatter without changing output.src/data-sources/morpho-api/historical.ts (1)
3-5: Type import/re‑export cleanup looks goodPulling
TimeseriesOptions/TimeseriesDataPointfrom@/utils/typesand re‑exporting them here keeps types centralized without changing behavior.src/utils/oracle.ts (1)
4-5: General feed imports aligned with new types moduleSeparating the runtime imports from the
GeneralPriceFeedtype import keeps the oracle utils in sync with the newgeneral-feeds/typeslayout. No behavior change.src/components/MarketOracle/GeneralFeedTooltip.tsx (1)
4-4: UpdatedGeneralPriceFeedimport path is consistentImporting
GeneralPriceFeedfrom the dedicatedgeneral-feeds/typesmodule matches the new oracle typings setup; component behavior is unchanged.src/data-sources/subgraph/market.ts (1)
135-135: Const forwarningsis correct
warningsis only mutated via.pushand never reassigned, soconstis valid and keeps intent clear. No behavior change.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/utils/gtag.ts (1)
19-26: Add isClient() and gtag existence checks.This function is missing both the server-side check and the gtag existence check that
logPageviewhas. This could cause errors on SSR or if the analytics script doesn't load.Apply this diff:
export const logEvent = ({ action, category, label, value }: { action: string; category: string; label: string; value: number }) => { + if (!isClient()) { + return; + } + const gtag = (window as WindowWithGtag).gtag; + if (!gtag) { + return; + } // eslint-disable-next-line @typescript-eslint/no-unsafe-call - (window as WindowWithGtag).gtag('event', action, { + gtag('event', action, { event_category: category, event_label: label, value: value, }); };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
package.json(1 hunks)src/data-sources/morpho-api/historical.ts(1 hunks)src/utils/gtag.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx,css,scss}
📄 CodeRabbit inference engine (AGENTS.md)
Run
pnpm format(Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Files:
src/utils/gtag.tssrc/data-sources/morpho-api/historical.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use camelCase for helper function names (e.g.,
formatApr)
Files:
src/utils/gtag.tssrc/data-sources/morpho-api/historical.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
ESLint (Airbnb + Next.js) enforces hook safety and import hygiene
Files:
src/utils/gtag.tssrc/data-sources/morpho-api/historical.ts
🧠 Learnings (2)
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Applied to files:
package.json
📚 Learning: 2024-10-23T16:17:02.841Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 77
File: src/graphql/queries.ts:168-193
Timestamp: 2024-10-23T16:17:02.841Z
Learning: In `src/graphql/queries.ts`, handling only `MarketTransferTransactionData` is intentional at this time.
Applied to files:
src/data-sources/morpho-api/historical.ts
🔇 Additional comments (3)
src/data-sources/morpho-api/historical.ts (1)
3-3: Consolidated type import is correctImporting
TimeseriesOptionsandTimeseriesDataPointalongside the other market types from@/utils/typesmatches their usage below and keeps types centralized. No issues from this change.package.json (1)
14-14: Good addition of typecheck to build workflow.Adding type checking to the lint:check and the new standalone typecheck script improves type safety in your CI/CD pipeline. The
tsc --noEmitconfiguration is correct.Also applies to: 21-21
src/utils/gtag.ts (1)
5-7: Cleaner than global augmentation.The local type alias approach is more modular and avoids polluting the global namespace.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
biome.jsonc (1)
182-182: Commenting outnoShadowworks, but clarify intent.Commenting rather than removing signals "we may revisit this"—good for migration. Add a brief comment if the reasoning differs from other disabled rules (or is it just phase 2 work?).
Example:
- // "noShadow": "off", + // "noShadow": "off", // TODO: Phase 2 migrationsrc/components/Input/Input.tsx (1)
61-64: Good rename, but update the console label.The catch parameter rename to
erris clearer. However, the console.log label still says'e'but logserr. Update it to match.- console.log('e', err); + console.log('err', err);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
biome.jsonc(2 hunks)package.json(1 hunks)scripts/generate-redstone-data.ts(2 hunks)src/components/Input/Input.tsx(1 hunks)src/components/layout/header/ListItem.tsx(1 hunks)src/hooks/useUserBalances.ts(1 hunks)src/hooks/useVaultV2.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx,js,jsx,css,scss}
📄 CodeRabbit inference engine (AGENTS.md)
Run
pnpm format(Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Files:
src/hooks/useVaultV2.tssrc/hooks/useUserBalances.tssrc/components/layout/header/ListItem.tsxsrc/components/Input/Input.tsxscripts/generate-redstone-data.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use camelCase for helper function names (e.g.,
formatApr)
Files:
src/hooks/useVaultV2.tssrc/hooks/useUserBalances.tssrc/components/layout/header/ListItem.tsxsrc/components/Input/Input.tsx
src/hooks/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When building on-chain hooks, mirror
useERC20ApprovalanduseTransactionWithToastpatterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls
Files:
src/hooks/useVaultV2.tssrc/hooks/useUserBalances.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
ESLint (Airbnb + Next.js) enforces hook safety and import hygiene
Files:
src/hooks/useVaultV2.tssrc/hooks/useUserBalances.tssrc/components/layout/header/ListItem.tsxsrc/components/Input/Input.tsxscripts/generate-redstone-data.ts
**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Use PascalCase for React component file names (e.g.,
VaultBanner.tsx)
Files:
src/components/layout/header/ListItem.tsxsrc/components/Input/Input.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{tsx,jsx}: Keep Tailwind class lists lean and dedupe variants withtailwind-merge
All toggles must use the sharedIconSwitchcomponent from@/components/common/IconSwitchfor consistent sizing and animation
Files:
src/components/layout/header/ListItem.tsxsrc/components/Input/Input.tsx
scripts/**/*
📄 CodeRabbit inference engine (AGENTS.md)
Smart-contract scripts and artifacts belong in
scripts/
Files:
scripts/generate-redstone-data.ts
🧠 Learnings (4)
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.tsx : Use PascalCase for React component file names (e.g., `VaultBanner.tsx`)
Applied to files:
src/hooks/useVaultV2.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Applied to files:
package.jsonbiome.jsonc
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{tsx,jsx} : Keep Tailwind class lists lean and dedupe variants with `tailwind-merge`
Applied to files:
package.json
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : ESLint (Airbnb + Next.js) enforces hook safety and import hygiene
Applied to files:
package.jsonbiome.jsonc
🔇 Additional comments (8)
src/components/layout/header/ListItem.tsx (1)
5-34: Inner function rename looks goodRenaming the inner function to
ListItemComponentkeeps the export name intact and makes stack traces clearer, with no behavior change. All good here.scripts/generate-redstone-data.ts (1)
101-133: Param rename keeps behavior and improves clarityUpdating the JSDoc, parameter name, and conditional to
isFundamentalFeedmatches the existingisFundamentalhelper usage and makes the boolean’s meaning clearer without changing behavior.biome.jsonc (2)
102-102: Configuration looks appropriate for migration phase.Keeping
useIndexOfdisabled with a note about the single error is reasonable—defer, don't block. Same approach for other single-error rules.
1-257: Configuration aligns with team preferences and migration strategy.The overall setup is thoughtfully structured: strict correctness rules enabled, opinionated style/complexity rules disabled during migration, and detailed comments for each decision. This is a sensible phased approach. No conflicts flagged with Prettier or ESLint learnings (Biome is separate).
package.json (2)
7-7: Confirm styling checks are no longer part of the main check pipeline.The changes address the past redundancy issue by decoupling
typecheckinto its own script (line 21) and removing it fromlint:check(line 14 now just callsbiome check). However,stylelint:checkhas been removed from the maincheckcommand (line 7).Is this intentional? The stylelint scripts still exist (lines 16–17), but they won't run as part of routine checks anymore.
Also applies to: 14-14, 21-21
14-14: Minor: clarify intent of removing the "." argument.Line 14 changed from
biome check .tobiome check. Both forms should work, but confirm whether this is just a style preference or has functional implications.src/hooks/useUserBalances.ts (1)
44-47: LGTM! Better naming.Renaming the parameter to
errorDataclarifies it holds the error response body, not regular data.src/hooks/useVaultV2.ts (1)
233-237: Alias and trimming change is solidAliasing to
newName/newSymbolavoids shadowing the outername/symbolvalues in this hook, and trimming before buildingcallskeeps whitespace-only inputs from triggering a tx while preserving existing behavior.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/common/IconSwitch.tsx (1)
2-25: React types referenced without React namespace importThe code uses
React.ComponentType(lines 14–16),React.ButtonHTMLAttributes(line 25),React.KeyboardEvent(line 124), andReact.CSSProperties(lines 135, 143), but only imports named hooks from React. TypeScript will fail to resolve theReactnamespace.Add a type-only React import:
'use client'; +import type React from 'react'; import { useCallback, useState } from 'react';
🧹 Nitpick comments (9)
src/utils/gtag.ts (2)
5-7: LocalWindowWithGtagalias looks goodNice move away from global window augmentation. If you later want a bit more type safety, you could narrow
gtagto something like((...args: unknown[]) => void) | undefinedinstead ofany, but this is fine for now.
24-32: Consistent guarding pattern inlogEventMirroring the
logPageviewguard pattern here is solid and keeps analytics failures from breaking the app. If this grows, consider a tiny helper likegetGtag()to share the guard logic, but not required.src/components/WithdrawModalContent.tsx (1)
122-173: Connected / not‑connected branching looks correct; button disable condition can be trimmedThe
isConnected ? … : <AccountConnect />structure reads clearly and matches the expected UX.Inside the connected branch, the withdraw button is only rendered when
isConnectedis true, so this part of the predicate is redundant:isDisabled={!isConnected || isConfirming || !withdrawAmount}You can simplify to:
isDisabled={isConfirming || !withdrawAmount}to keep the condition minimal and avoid dead checks.
src/utils/balance.ts (2)
25-45: formatReadable param reassignment fix is fine; precision use is a small nitUsing
_numwith a localnumavoids param reassignment and keeps the existing string‑parsing path intact. One small thought:precisiononly affects values< 1000, while theB/M/Kbranches always usetoFixed(2); if you ever want a single precision knob, you could passprecisioninto thosetoFixedcalls too.
51-56: formatSimple helper looks good; locale/precision are currently baked inImplementation is straightforward and works for
number | bigint. If you later need different locales or fraction ranges, consider exposing them as optional parameters instead of hardcoding'en-us'and2..4here.app/positions/components/onboarding/SetupPositions.tsx (1)
96-97: Parameter rename with immediate reassignment is slightly unusual.The
_newPercentageparameter is immediately assigned to a localnewPercentagevariable. This pattern works but adds an extra step. Consider keeping the parameter name asnewPercentagedirectly if there's no specific linting requirement.If there's no linting constraint, you could simplify to:
- (marketKey: string, _newPercentage: number) => { - let newPercentage = _newPercentage; - + (marketKey: string, newPercentage: number) => { // If the input is invalid (NaN), set it to 0 if (Number.isNaN(newPercentage)) { - newPercentage = 0; + newPercentage = 0; // Note: can't reassign const parameter in this flow }Actually, the
letis needed for the NaN reassignment on line 101, so the pattern makes sense.src/components/Borrow/AddCollateralAndBorrow.tsx (1)
356-356: Use strict equality for consistency.
borrowAmount == 0nuses loose equality. While it works for bigints, strict===is more consistent with the codebase style.-{collateralAmount > 0n && borrowAmount == 0n ? 'Add Collateral' : 'Borrow'} +{collateralAmount > 0n && borrowAmount === 0n ? 'Add Collateral' : 'Borrow'}src/components/Borrow/WithdrawCollateralAndRepay.tsx (1)
334-340: Mixed bigint comparison styles.Line 338 uses
withdrawAmount > 0(number), butwithdrawAmountisbigint. Works via coercion but inconsistent with other comparisons using0n.{isLoadingPermit2 ? 'Loading...' : !isApproved && !permit2Authorized ? 'Approve & Repay' - : withdrawAmount > 0 + : withdrawAmount > 0n ? 'Withdraw & Repay' : 'Repay'}app/positions/components/RebalanceModal.tsx (1)
91-95: Tidy invalid-market error message formattingLogic is fine, but when both markets are missing the message becomes
Invalid "From" Market"To" Market(no separator). You can keep the same behavior while making the string cleaner.For example:
- if (!fromMarket || !toMarket) { - const errorMessage = `Invalid ${fromMarket ? '' : '"From" Market'}${toMarket ? '' : '"To" Market'}`; + if (!fromMarket || !toMarket) { + const missingLabels = [ + fromMarket ? null : '"From" Market', + toMarket ? null : '"To" Market', + ].filter(Boolean); + const errorMessage = `Invalid ${missingLabels.join(' and ')}`;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (39)
AGENTS.md(1 hunks)app/HomePage.tsx(2 hunks)app/admin/stats/components/AssetMetricsTable.tsx(1 hunks)app/admin/stats/components/TransactionsTable.tsx(1 hunks)app/api/block/route.ts(0 hunks)app/autovault/[chainId]/[vaultAddress]/components/DepositToVaultModal.tsx(2 hunks)app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx(2 hunks)app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx(2 hunks)app/market/[chainId]/[marketid]/VolumeChart.tsx(3 hunks)app/markets/components/markets.tsx(4 hunks)app/positions/components/PositionsContent.tsx(1 hunks)app/positions/components/PositionsSummaryTable.tsx(2 hunks)app/positions/components/RebalanceModal.tsx(1 hunks)app/positions/components/onboarding/SetupPositions.tsx(1 hunks)biome.jsonc(2 hunks)src/components/Borrow/AddCollateralAndBorrow.tsx(3 hunks)src/components/Borrow/WithdrawCollateralAndRepay.tsx(3 hunks)src/components/Status/LoadingScreen.tsx(1 hunks)src/components/SupplyModalContent.tsx(2 hunks)src/components/SupplyModalV2.tsx(1 hunks)src/components/WithdrawModalContent.tsx(2 hunks)src/components/common/IconSwitch.tsx(4 hunks)src/components/common/MarketsTableWithSameLoanAsset.tsx(3 hunks)src/components/layout/header/ListItem.tsx(3 hunks)src/components/ui/button.tsx(2 hunks)src/components/ui/pagination.tsx(3 hunks)src/data-sources/subgraph/historical.ts(1 hunks)src/hooks/usePagination.ts(2 hunks)src/hooks/usePositionReport.ts(1 hunks)src/hooks/useStaredMarkets.ts(3 hunks)src/hooks/useSupplyMarket.ts(2 hunks)src/hooks/useUserMarketsCache.ts(3 hunks)src/hooks/useUserTransactions.ts(2 hunks)src/hooks/useVaultV2Deposit.ts(2 hunks)src/utils/balance.ts(2 hunks)src/utils/external.ts(1 hunks)src/utils/gtag.ts(1 hunks)src/utils/positions.ts(2 hunks)src/utils/storageKeys.ts(1 hunks)
💤 Files with no reviewable changes (1)
- app/api/block/route.ts
✅ Files skipped from review due to trivial changes (2)
- src/components/SupplyModalContent.tsx
- app/autovault/[chainId]/[vaultAddress]/components/DepositToVaultModal.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
- app/market/[chainId]/[marketid]/VolumeChart.tsx
- src/components/layout/header/ListItem.tsx
- src/utils/external.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx,js,jsx,css,scss}
📄 CodeRabbit inference engine (AGENTS.md)
Run
pnpm format(Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Files:
src/hooks/usePagination.tssrc/hooks/usePositionReport.tssrc/components/Borrow/AddCollateralAndBorrow.tsxsrc/hooks/useStaredMarkets.tsapp/admin/stats/components/AssetMetricsTable.tsxapp/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsxsrc/utils/gtag.tssrc/hooks/useUserTransactions.tssrc/components/ui/pagination.tsxapp/positions/components/PositionsSummaryTable.tsxsrc/components/WithdrawModalContent.tsxsrc/hooks/useSupplyMarket.tsapp/markets/components/markets.tsxsrc/components/common/MarketsTableWithSameLoanAsset.tsxsrc/data-sources/subgraph/historical.tsapp/positions/components/onboarding/SetupPositions.tsxapp/positions/components/RebalanceModal.tsxapp/positions/components/PositionsContent.tsxsrc/components/SupplyModalV2.tsxsrc/utils/storageKeys.tsapp/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsxsrc/hooks/useUserMarketsCache.tssrc/components/common/IconSwitch.tsxsrc/utils/positions.tssrc/components/ui/button.tsxapp/admin/stats/components/TransactionsTable.tsxapp/HomePage.tsxsrc/hooks/useVaultV2Deposit.tssrc/components/Status/LoadingScreen.tsxsrc/utils/balance.tssrc/components/Borrow/WithdrawCollateralAndRepay.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use camelCase for helper function names (e.g.,
formatApr)
Files:
src/hooks/usePagination.tssrc/hooks/usePositionReport.tssrc/components/Borrow/AddCollateralAndBorrow.tsxsrc/hooks/useStaredMarkets.tssrc/utils/gtag.tssrc/hooks/useUserTransactions.tssrc/components/ui/pagination.tsxsrc/components/WithdrawModalContent.tsxsrc/hooks/useSupplyMarket.tssrc/components/common/MarketsTableWithSameLoanAsset.tsxsrc/data-sources/subgraph/historical.tssrc/components/SupplyModalV2.tsxsrc/utils/storageKeys.tssrc/hooks/useUserMarketsCache.tssrc/components/common/IconSwitch.tsxsrc/utils/positions.tssrc/components/ui/button.tsxsrc/hooks/useVaultV2Deposit.tssrc/components/Status/LoadingScreen.tsxsrc/utils/balance.tssrc/components/Borrow/WithdrawCollateralAndRepay.tsx
src/hooks/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When building on-chain hooks, mirror
useERC20ApprovalanduseTransactionWithToastpatterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls
Files:
src/hooks/usePagination.tssrc/hooks/usePositionReport.tssrc/hooks/useStaredMarkets.tssrc/hooks/useUserTransactions.tssrc/hooks/useSupplyMarket.tssrc/hooks/useUserMarketsCache.tssrc/hooks/useVaultV2Deposit.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
ESLint (Airbnb + Next.js) enforces hook safety and import hygiene
Files:
src/hooks/usePagination.tssrc/hooks/usePositionReport.tssrc/components/Borrow/AddCollateralAndBorrow.tsxsrc/hooks/useStaredMarkets.tsapp/admin/stats/components/AssetMetricsTable.tsxapp/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsxsrc/utils/gtag.tssrc/hooks/useUserTransactions.tssrc/components/ui/pagination.tsxapp/positions/components/PositionsSummaryTable.tsxsrc/components/WithdrawModalContent.tsxsrc/hooks/useSupplyMarket.tsapp/markets/components/markets.tsxsrc/components/common/MarketsTableWithSameLoanAsset.tsxsrc/data-sources/subgraph/historical.tsapp/positions/components/onboarding/SetupPositions.tsxapp/positions/components/RebalanceModal.tsxapp/positions/components/PositionsContent.tsxsrc/components/SupplyModalV2.tsxsrc/utils/storageKeys.tsapp/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsxsrc/hooks/useUserMarketsCache.tssrc/components/common/IconSwitch.tsxsrc/utils/positions.tssrc/components/ui/button.tsxapp/admin/stats/components/TransactionsTable.tsxapp/HomePage.tsxsrc/hooks/useVaultV2Deposit.tssrc/components/Status/LoadingScreen.tsxsrc/utils/balance.tssrc/components/Borrow/WithdrawCollateralAndRepay.tsx
**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Use PascalCase for React component file names (e.g.,
VaultBanner.tsx)
Files:
src/components/Borrow/AddCollateralAndBorrow.tsxapp/admin/stats/components/AssetMetricsTable.tsxapp/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsxsrc/components/ui/pagination.tsxapp/positions/components/PositionsSummaryTable.tsxsrc/components/WithdrawModalContent.tsxapp/markets/components/markets.tsxsrc/components/common/MarketsTableWithSameLoanAsset.tsxapp/positions/components/onboarding/SetupPositions.tsxapp/positions/components/RebalanceModal.tsxapp/positions/components/PositionsContent.tsxsrc/components/SupplyModalV2.tsxapp/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsxsrc/components/common/IconSwitch.tsxsrc/components/ui/button.tsxapp/admin/stats/components/TransactionsTable.tsxapp/HomePage.tsxsrc/components/Status/LoadingScreen.tsxsrc/components/Borrow/WithdrawCollateralAndRepay.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{tsx,jsx}: Keep Tailwind class lists lean and dedupe variants withtailwind-merge
All toggles must use the sharedIconSwitchcomponent from@/components/common/IconSwitchfor consistent sizing and animation
Files:
src/components/Borrow/AddCollateralAndBorrow.tsxapp/admin/stats/components/AssetMetricsTable.tsxapp/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsxsrc/components/ui/pagination.tsxapp/positions/components/PositionsSummaryTable.tsxsrc/components/WithdrawModalContent.tsxapp/markets/components/markets.tsxsrc/components/common/MarketsTableWithSameLoanAsset.tsxapp/positions/components/onboarding/SetupPositions.tsxapp/positions/components/RebalanceModal.tsxapp/positions/components/PositionsContent.tsxsrc/components/SupplyModalV2.tsxapp/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsxsrc/components/common/IconSwitch.tsxsrc/components/ui/button.tsxapp/admin/stats/components/TransactionsTable.tsxapp/HomePage.tsxsrc/components/Status/LoadingScreen.tsxsrc/components/Borrow/WithdrawCollateralAndRepay.tsx
app/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Next.js routes must live under
app/directory
Files:
app/admin/stats/components/AssetMetricsTable.tsxapp/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsxapp/positions/components/PositionsSummaryTable.tsxapp/markets/components/markets.tsxapp/positions/components/onboarding/SetupPositions.tsxapp/positions/components/RebalanceModal.tsxapp/positions/components/PositionsContent.tsxapp/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsxapp/admin/stats/components/TransactionsTable.tsxapp/HomePage.tsx
🧠 Learnings (14)
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Applied to files:
AGENTS.mdbiome.jsonc
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Use `pnpm` for dependency installation to maintain lockfile parity
Applied to files:
AGENTS.md
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Rebase onto `main` and run `pnpm check` before opening a pull request
Applied to files:
AGENTS.md
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.test.{ts,tsx} : Add regression coverage for protocol-critical flows (transactions, risk filters) mirroring real network scenarios
Applied to files:
src/hooks/useUserTransactions.tssrc/utils/positions.ts
📚 Learning: 2024-10-23T16:17:02.841Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 77
File: src/graphql/queries.ts:168-193
Timestamp: 2024-10-23T16:17:02.841Z
Learning: In `src/graphql/queries.ts`, handling only `MarketTransferTransactionData` is intentional at this time.
Applied to files:
src/hooks/useUserTransactions.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : When building on-chain hooks, mirror `useERC20Approval` and `useTransactionWithToast` patterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls
Applied to files:
src/hooks/useUserTransactions.tssrc/hooks/useSupplyMarket.tssrc/hooks/useVaultV2Deposit.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{tsx,jsx} : All toggles must use the shared `IconSwitch` component from `@/components/common/IconSwitch` for consistent sizing and animation
Applied to files:
src/components/ui/pagination.tsxsrc/components/common/IconSwitch.tsxsrc/components/ui/button.tsx
📚 Learning: 2024-11-25T09:39:42.148Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 87
File: app/home/HomePage.tsx:17-39
Timestamp: 2024-11-25T09:39:42.148Z
Learning: In `app/home/HomePage.tsx`, the `useEffect` hook depends on `[showCustomized]` because changing `showCustomized` triggers updates to the yield and risk terms.
Applied to files:
app/positions/components/PositionsSummaryTable.tsxapp/markets/components/markets.tsxsrc/components/common/MarketsTableWithSameLoanAsset.tsx
📚 Learning: 2024-11-20T07:19:08.123Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 83
File: src/hooks/useERC20Approval.ts:45-59
Timestamp: 2024-11-20T07:19:08.123Z
Learning: In `src/hooks/useERC20Approval.ts`, the `approve` function intentionally does not wait for the transaction receipt after `sendTransactionAsync` to allow Safe to batch execute transactions.
Applied to files:
src/hooks/useSupplyMarket.tssrc/hooks/useVaultV2Deposit.ts
📚 Learning: 2024-10-12T09:23:16.495Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 63
File: app/markets/components/MarketRowDetail.tsx:49-52
Timestamp: 2024-10-12T09:23:16.495Z
Learning: When rendering oracle feeds in `ExpandedMarketDetail` (`app/markets/components/MarketRowDetail.tsx`), prefer explicit rendering over iterating keys when dealing with a small number of feeds.
Applied to files:
app/markets/components/markets.tsxsrc/components/common/MarketsTableWithSameLoanAsset.tsxapp/positions/components/PositionsContent.tsx
📚 Learning: 2024-12-16T02:01:51.219Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 97
File: app/positions/components/onboarding/OnboardingContext.tsx:36-43
Timestamp: 2024-12-16T02:01:51.219Z
Learning: In `app/positions/components/onboarding/OnboardingContext.tsx`, the `defaultStep` variable is no longer needed and can be removed.
Applied to files:
app/positions/components/onboarding/SetupPositions.tsxsrc/components/Status/LoadingScreen.tsx
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.tsx : Use PascalCase for React component file names (e.g., `VaultBanner.tsx`)
Applied to files:
app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : ESLint (Airbnb + Next.js) enforces hook safety and import hygiene
Applied to files:
src/components/common/IconSwitch.tsxbiome.jsonc
📚 Learning: 2024-12-08T12:10:17.127Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 94
File: src/components/supplyModal.tsx:449-452
Timestamp: 2024-12-08T12:10:17.127Z
Learning: The 'solid' variant is defined in the new `Button` component and is a valid variant.
Applied to files:
src/components/ui/button.tsx
🧬 Code graph analysis (10)
src/hooks/usePagination.ts (1)
src/utils/storageKeys.ts (1)
storageKeys(1-26)
src/components/Borrow/AddCollateralAndBorrow.tsx (1)
src/components/common/Button.tsx (1)
Button(4-54)
src/hooks/useStaredMarkets.ts (1)
src/utils/storageKeys.ts (1)
storageKeys(1-26)
app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx (1)
app/autovault/[chainId]/[vaultAddress]/components/settings/AgentListItem.tsx (1)
AgentListItem(10-27)
app/positions/components/PositionsSummaryTable.tsx (2)
src/hooks/useLocalStorage.ts (1)
useLocalStorage(4-63)src/utils/storageKeys.ts (1)
storageKeys(1-26)
app/markets/components/markets.tsx (3)
src/hooks/useLocalStorage.ts (1)
useLocalStorage(4-63)src/utils/storageKeys.ts (1)
storageKeys(1-26)src/constants/markets.ts (2)
DEFAULT_MIN_SUPPLY_USD(1-1)DEFAULT_MIN_LIQUIDITY_USD(2-2)
src/components/common/MarketsTableWithSameLoanAsset.tsx (3)
src/hooks/useLocalStorage.ts (1)
useLocalStorage(4-63)src/utils/storageKeys.ts (1)
storageKeys(1-26)src/constants/markets.ts (2)
DEFAULT_MIN_SUPPLY_USD(1-1)DEFAULT_MIN_LIQUIDITY_USD(2-2)
app/positions/components/PositionsContent.tsx (1)
app/positions/components/PositionsSummaryTable.tsx (1)
PositionsSummaryTable(109-470)
src/hooks/useUserMarketsCache.ts (1)
src/utils/storageKeys.ts (1)
storageKeys(1-26)
src/components/Borrow/WithdrawCollateralAndRepay.tsx (1)
src/components/common/Button.tsx (1)
Button(4-54)
🔇 Additional comments (36)
AGENTS.md (1)
12-12: Documentation update is clear.Line 12 appropriately documents the targeted linting command following the consolidation described in the PR. The distinction between
pnpm check(comprehensive: format + ESLint + Stylelint) andpnpm lint(targeted to specific file types) is well-articulated.src/components/SupplyModalV2.tsx (1)
51-52: LGTM!Removing the unnecessary
elseafter early return is clean. Logic is identical, just follows the no-else-return pattern.biome.jsonc (2)
171-171: Clarify the noShadow rule change.The rule is now commented out (disabled), but the comment "noShadow is now commented out" is a bit redundant with the syntax. Was this intentional to completely remove the configuration, or should it remain as an explicit
"noShadow": "off"setting?
34-186: Verify ESLint vs. Biome tooling alignment.The learnings mention ESLint (Airbnb + Next.js) enforcement for hook safety and import hygiene on TypeScript/JavaScript files, but this PR is adjusting Biome configuration. Confirm whether:
- ESLint and Biome are running simultaneously, or if the project is migrating from ESLint to Biome.
- The relaxed Biome rules (especially
useIndexOf,noShadow, and others) align with your migration strategy and don't create blind spots for issues that ESLint would have caught.This matters because disabling rules across both tools could hide legitimate bugs during the transition period.
src/utils/positions.ts (2)
176-185: Logging change is purely cosmeticSwapping the template literal for a plain string keeps the log shape identical; no behavior change here.
249-256: Consistent error log styleSame as above: message string change only, structured payload untouched. Looks good.
src/utils/gtag.ts (1)
13-18: Safe guard aroundwindow.gtaginlogPageview
isClient()plus the null-check ongtagavoids crashes when the analytics script is missing or blocked; the local variable also keeps the call site clean. All good here.src/data-sources/subgraph/historical.ts (1)
74-81: NaN guard rewrite keeps behavior, improves readabilitySwitching to
isNaN(value) ? 0 : valuefrom the negated form is equivalent here and easier to read; looks good.src/hooks/usePositionReport.ts (1)
37-51: Param rename + localendDatelooks goodUsing
_endDateas the parameter and a localendDatevariable keeps behavior the same while avoiding parameter mutation, which fits typical lint rules againstno-param-reassign. No issues spotted.src/hooks/useSupplyMarket.ts (2)
82-82: LGTM - readability improvement.Digit separator makes the interval value clearer.
264-286: LGTM - improves UI consistency.Explicitly setting the step to 'supplying' when already approved ensures the modal displays the correct state regardless of the approval path taken.
src/hooks/useVaultV2Deposit.ts (2)
86-86: LGTM!Numeric separator improves readability without changing behavior.
229-231: LGTM!The explicit approval check clarifies the flow. When already approved, it skips directly to depositing, which is correct since no approval transaction is needed. The built-in 800ms delay at line 162 applies to all paths.
src/utils/balance.ts (1)
58-60: Bigint min helper is correct and clearThe comparison logic is correct, side‑effect free, and reads easily.
src/components/common/IconSwitch.tsx (2)
102-106: State initialization change is safeUsing the named
useStateimport instead ofReact.useStatepreserves the same uncontrolled vs controlled behavior here; no functional change.
113-131: Callbacks and dependency arrays look correct
handleToggleandhandleKeyDownuseuseCallbackwith appropriate dependency lists; click and keyboard handling behavior is unchanged and stays accessible.app/admin/stats/components/TransactionsTable.tsx (1)
170-173: LGTM!The sort logic refactor is correct. The ascending case returns early, so the descending comparison executes unconditionally for the desc case.
src/components/ui/button.tsx (1)
1-1: LGTM!Clean refactor to use direct
forwardRefimport instead of namespace access. No functional change.Also applies to: 38-38
app/admin/stats/components/AssetMetricsTable.tsx (1)
79-82: LGTM!Sort logic refactor matches the pattern in TransactionsTable. The ascending case returns early, leaving the descending comparison to execute unconditionally.
src/components/Status/LoadingScreen.tsx (1)
65-76: LGTM!The typing animation control flow has been reorganized to check deletion first, but the observable behavior remains identical.
app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx (1)
151-309: LGTM!Inverting the conditional to show the main content when caps exist is more readable. No functional change.
src/hooks/useUserTransactions.ts (1)
103-104: LGTM!Removing the else blocks is clean since the success case returns early. Functionally equivalent to the previous implementation.
Also applies to: 134-135
app/HomePage.tsx (1)
105-120: LGTM!Typing animation refactored consistently with LoadingScreen.tsx. The control flow reorganization preserves the deletion → typing → pause cycle.
src/components/Borrow/AddCollateralAndBorrow.tsx (2)
83-96: LTV guard logic looks good.Clean refactor - explicit else branch for the zero case improves readability.
317-323: Invalid button variant.
variant="solid"isn't defined in the Button component. Available variants persrc/components/common/Button.tsx:default,cta,secondary,interactive,ghost,subtle.<Button onPress={switchToNetwork} className="min-w-32" - variant="solid" + variant="cta" > Switch Chain </Button>⛔ Skipped due to learnings
Learnt from: antoncoding Repo: antoncoding/monarch PR: 94 File: src/components/supplyModal.tsx:449-452 Timestamp: 2024-12-08T12:10:17.127Z Learning: The 'solid' variant is defined in the new `Button` component and is a valid variant.src/components/Borrow/WithdrawCollateralAndRepay.tsx (2)
105-118: LTV guard refactor is consistent.Matches the pattern in AddCollateralAndBorrow.tsx.
306-312: Invalid button variant.Same issue as AddCollateralAndBorrow.tsx -
variant="solid"isn't defined.<Button onPress={switchToNetwork} className="min-w-32" - variant="solid" + variant="cta" > Switch Chain </Button>⛔ Skipped due to learnings
Learnt from: antoncoding Repo: antoncoding/monarch PR: 94 File: src/components/supplyModal.tsx:449-452 Timestamp: 2024-12-08T12:10:17.127Z Learning: The 'solid' variant is defined in the new `Button` component and is a valid variant.src/utils/storageKeys.ts (1)
1-26: Clean consolidation.Single object with
as constis better than scattered exports. Enables IDE autocomplete and keeps keys in one place.app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx (1)
113-203: UI restructure looks solid.Edit/read-only branching is clearer. Per-item loading states (
allocatorToAdd/allocatorToRemove) prevent action on the specific item being processed while allowing interaction with others.src/hooks/useUserMarketsCache.ts (1)
3-3: LGTM — storage key centralization.The migration to
storageKeys.CacheMarketPositionKeysis consistent with the broader refactor.Also applies to: 18-18, 31-31
src/hooks/usePagination.ts (1)
3-3: LGTM — storage key centralization.The migration to
storageKeys.MarketEntriesPerPageKeyfollows the same centralization pattern.Also applies to: 14-14, 22-22
src/components/common/MarketsTableWithSameLoanAsset.tsx (1)
27-27: LGTM — storage key centralization.All localStorage keys now correctly reference the centralized
storageKeysobject.Also applies to: 672-685, 705-713
src/hooks/useStaredMarkets.ts (1)
4-4: LGTM — storage key centralization + defensive coding.The migration to
storageKeys.MarketFavoritesKeyis consistent. The explicitreturn []on line 12 ensures a safe fallback on error.Also applies to: 8-14, 26-26, 38-38
app/positions/components/PositionsSummaryTable.tsx (1)
26-26: LGTM — storage key centralization.The migration to
storageKeys.PositionsShowEmptyKeyandstorageKeys.PositionsShowCollateralExposureKeyis correct.Also applies to: 124-128
app/markets/components/markets.tsx (1)
31-31: LGTM — storage key centralization.All localStorage keys consistently migrated to the centralized
storageKeysobject.Also applies to: 81-82, 95-96, 101-106, 110-114, 116-116, 120-120, 134-134
app/positions/components/RebalanceModal.tsx (1)
78-82: The comparisonscaledAmount <= 0works correctly in JavaScript.parseUnitsreturns abigint, and JavaScript coercesbigint <= numbercomparisons without throwing a TypeError. The condition correctly evaluates totruewhen the amount is zero or negative. No fix is required.Likely an incorrect or invalid review comment.
Summary by CodeRabbit
New Features
Bug Fixes
Chores
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.