-
Notifications
You must be signed in to change notification settings - Fork 0
SOV-5257 money market list active positions #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for sovryn-layer ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements functionality to display active user positions in the money market interface by integrating real-time data from the blockchain and calculating comprehensive user metrics.
- Adds backend API endpoint to fetch and calculate user positions with detailed financial metrics
- Updates frontend components to display real user data instead of mock constants
- Downgrades @aave packages from 1.36.2 to 1.29.1 to use legacy ABI compatibility
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/lib/http-client.ts | Adds console.error logging for HTTP request failures |
| packages/shared/src/lib/decimal.ts | Adds pow method for decimal power calculations |
| packages/sdk/src/types.ts | Updates MoneyMarketPoolReserve interface and adds MoneyMarketPoolPosition and MoneyMarketUserSummary types |
| packages/sdk/src/managers/money-market/money-market.manager.ts | Adds listUserPositions method to fetch user position data |
| packages/sdk/src/constants.ts | Adds USD_DECIMALS constant |
| packages/sdk/package.json | Downgrades @aave packages to version 1.29.1 |
| apps/web-app/src/routes/money-market.tsx | Replaces mock data with real user positions from API |
| apps/web-app/src/routes/__root.tsx | Adds connection function to router context |
| apps/web-app/src/main.tsx | Provides getConnection function to router context |
| apps/web-app/src/integrations/wagmi/config.ts | Exports getConnection helper function |
| apps/web-app/src/components/ui/select.tsx | Reorders imports |
| apps/web-app/src/components/MoneyMarket/components/TopPanel/TopPanel.tsx | Adds loading skeleton states for pending data |
| apps/web-app/src/components/MoneyMarket/components/LendPositionsList/components/AssetsTable/AssetsTable.tsx | Updates to use MoneyMarketPoolPosition data instead of mock LendPosition type |
| apps/web-app/src/components/MoneyMarket/components/LendPositionsList/components/AssetsTable/AssetsTable.constants.tsx | Removes mock LEND_POSITIONS constant |
| apps/web-app/src/components/MoneyMarket/components/LendPositionsList/LendPositionsList.tsx | Updates to use MoneyMarketPoolPosition type and changes default accordion state to open |
| apps/web-app/src/components/MoneyMarket/components/LendDialog/LendDialog.tsx | Updates to use canBeCollateral property |
| apps/web-app/src/components/MoneyMarket/components/LendAssetsList/components/AssetsTable/AssetsTable.tsx | Updates to display liquidity data and use canBeCollateral property |
| apps/web-app/src/components/MoneyMarket/components/LendAssetsList/LendAssetsList.tsx | Removes zero balance filter functionality |
| apps/web-app/src/components/MoneyMarket/components/BorrowPositionsList/components/AssetsTable/AssetsTable.tsx | Updates to use MoneyMarketPoolPosition data and display APY selection |
| apps/web-app/src/components/MoneyMarket/components/BorrowPositionsList/components/AssetsTable/AssetsTable.constants.tsx | Removes mock BORROW_POSITIONS constant |
| apps/web-app/src/components/MoneyMarket/components/BorrowPositionsList/BorrowPositionsList.tsx | Updates to use MoneyMarketPoolPosition type and real data |
| apps/web-app/src/components/MoneyMarket/components/BorrowAssetsList/components/AssetsTable/AssetsTable.tsx | Updates to display liquidity data and use canBeBorrowed property |
| apps/web-app/src/components/MoneyMarket/MoneyMarket.constants.ts | Removes mock constant values |
| apps/web-app/package.json | Adds @wagmi/core dependency |
| apps/indexer/src/main.ts | Refactors to use zodFastify helper function |
| apps/indexer/src/libs/validators/validators.ts | Adds custom Zod validator for Ethereum addresses |
| apps/indexer/src/libs/utils/user-reserves.ts | Removes unused transformUserReservesData function |
| apps/indexer/src/libs/server.ts | Adds zodFastify helper to configure Fastify with Zod type provider |
| apps/indexer/src/libs/loaders/money-market.ts | Updates to use legacy @aave ABI and adds data transformation for reserves and user positions |
| apps/indexer/src/libs/aave/index.ts | Adds empty placeholder file |
| apps/indexer/src/env.ts | Adds RPC_BOB_TESTNET and NO_CACHE environment variables |
| apps/indexer/src/configs/constants.ts | Adds USD_DECIMALS constant |
| apps/indexer/src/configs/chains.ts | Adds configurable RPC URL for BOB Sepolia |
| apps/indexer/src/app/routes/root.ts | Updates to use ZodFastifyInstance type |
| apps/indexer/src/app/routes/_chain/routes.ts | Implements user positions endpoint with comprehensive calculations for financial metrics |
| apps/indexer/src/app/plugins/cache.ts | Adds BigInt serialization support and maybeCache helper function |
| apps/indexer/package.json | Adds @aave/math-utils and @aave/contract-helpers at version 1.29.1 |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| throw new Error(`Cannot convert to Decimal: ${value}`); | ||
| } | ||
|
|
||
| static pow(exponent: number): Decimal { |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The method name 'pow' is ambiguous as it suggests a general power operation, but it specifically calculates powers of 10. Consider renaming to 'pow10' or 'fromPowerOfTen' to better reflect its specific behavior.
| static pow(exponent: number): Decimal { | |
| static pow10(exponent: number): Decimal { |
| disabled={!asset.canToggleCollateral} | ||
| id={`collateral-${asset.token.address}`} | ||
| onClick={() => toggleCollateral(asset.id)} | ||
| // disabled={!asset} |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commented-out disabled attribute should either be properly implemented or removed. The comment 'disabled={!asset}' doesn't make sense as 'asset' will always be truthy in this context.
| // disabled={!asset} |
| value={String(asset.borrowApy)} | ||
| // onValueChange={(val) => | ||
| // handleApyTypeChange(asset, index, val) | ||
| // } |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented-out onValueChange handler suggests incomplete functionality. The Select component allows user interaction but doesn't respond to changes. Either implement the handler to enable APY type switching or make the Select read-only/disabled.
| symbol: 'todo', // todo | ||
| // symbol: ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] | ||
| // ? ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] | ||
| // : reserveRaw.symbol, |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded 'todo' value for symbol should be properly implemented. This will display 'todo' as the token symbol in the UI, which is incorrect.
| symbol: 'todo', // todo | |
| // symbol: ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] | |
| // ? ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] | |
| // : reserveRaw.symbol, | |
| symbol: ammSymbolMap && ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] | |
| ? ammSymbolMap[reserveRaw.underlyingAsset.toLowerCase()] | |
| : reserveRaw.symbol, |
| .toFixed(USD_DECIMALS), | ||
| canBeCollateral: item.usageAsCollateralEnabled, | ||
| isActive: item.isActive, | ||
| isFroze: item.isFrozen, |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'isFroze' to 'isFrozen'.
| isFroze: item.isFrozen, | |
| isFrozen: item.isFrozen, |
| isActive: item.isActive, | ||
| isFroze: item.isFrozen, | ||
| // eModes: item.eModes, | ||
| i: item, |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The property 'i' is ambiguous. Consider using a more descriptive name like 'rawItem' or 'formattedReserve', or remove it if it's not needed in the response.
| i: item, | |
| rawItem: item, |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| id: (item as any).id, |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of 'any' cast suggests the type definition is incomplete. The 'item' should have an 'id' property in its type definition rather than requiring a cast.
| .toFixed(USD_DECIMALS), | ||
| canBeCollateral: item.reserve.usageAsCollateralEnabled, | ||
| isActive: item.reserve.isActive, | ||
| isFroze: item.reserve.isFrozen, |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'isFroze' to 'isFrozen'.
| isFroze: item.reserve.isFrozen, | |
| isFrozen: item.reserve.isFrozen, |
No description provided.