-
Notifications
You must be signed in to change notification settings - Fork 0
borrow & lending #16
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
borrow & lending #16
Conversation
✅ Deploy Preview for sovryn-layer ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
e5f30ac to
f2c0a59
Compare
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 borrow and lending functionality for a money market feature, along with supporting infrastructure improvements.
Key Changes:
- Added borrow and lend transaction flows with dialog UI components
- Implemented money market pool and reserve data fetching from on-chain contracts
- Enhanced caching system with Redis-based response caching and stale-while-revalidate support
- Added decimal formatting utilities (shortened and formatted representations)
Reviewed Changes
Copilot reviewed 54 out of 57 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/lib/decimal.ts | Added formatting methods for decimal display (formatted with separators, shortened with magnitude suffixes) |
| packages/shared/src/helpers.ts | Added address equality comparison helper |
| packages/sdk/src/types.ts | Refactored token types and expanded money market pool/reserve interfaces |
| packages/sdk/src/managers/money-market/money-market.manager.ts | New manager implementing borrow and supply operations with ERC20 and native token support |
| packages/sdk/src/lib/transaction.ts | Added approval transaction helper for ERC20 tokens |
| apps/web-app/src/components/MoneyMarket/components/BorrowDialog | New borrow dialog with form validation |
| apps/web-app/src/components/MoneyMarket/components/LendDialog | New lend dialog with form validation |
| apps/web-app/src/lib/transactions/store.ts | Enhanced transaction store with completion tracking and close callbacks |
| apps/indexer/src/app/plugins/cache.ts | New Redis-based caching plugin with background revalidation |
| apps/indexer/src/libs/loaders/money-market.ts | Added on-chain data fetching for pool reserves using contract ABIs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {balance && ( | ||
| <span className="ml-2 text-sm font-normal text-gray-400"> | ||
| (Balance:{' '} | ||
| {Decimal.from(balance.value, balance.decimals).toFormatted(88)}{' '} |
Copilot
AI
Nov 19, 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 magic number 88 for decimal places is unclear. Consider extracting this to a named constant (e.g., MAX_DISPLAY_DECIMALS) or adding a comment explaining why 88 decimal places are used for balance display.
| {Decimal.from(balance.value, balance.decimals).toFormatted(88)}{' '} | |
| {Decimal.from(balance.value, balance.decimals).toFormatted(MAX_DISPLAY_DECIMALS)}{' '} |
apps/web-app/src/components/MoneyMarket/components/LendAssetsList/LendAssetsList.tsx
Show resolved
Hide resolved
| // By default, don't cache error responses | ||
| if (reply.statusCode >= 400) return payload; |
Copilot
AI
Nov 19, 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 condition reply.statusCode >= 400 will prevent caching of both client errors (4xx) and server errors (5xx). Consider whether client errors like 404 should be cached differently from server errors like 500, as 404s are typically stable while 500s may be transient.
| // By default, don't cache error responses | |
| if (reply.statusCode >= 400) return payload; | |
| // By default, don't cache server error responses (5xx) | |
| if (reply.statusCode >= 500) return payload; |
https://sovryn.atlassian.net/browse/SOV-5236
https://sovryn.atlassian.net/browse/SOV-5221