-
Notifications
You must be signed in to change notification settings - Fork 59
fix: v2 balances #685
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
fix: v2 balances #685
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@rossgalloway That were a bit tricky ones! Pushed fix:
|
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 fixes a bug in the balances filtering logic by ensuring that vaults with a staking balance (even if their regular balance is zero) are correctly included, as well as cleaning up unused code.
- Updated hook import paths across multiple pages.
- Adjusted filtering logic in useFilteredVaults and useYearnBalances to correctly account for staking balances.
- Updated token type references from TYToken to TToken throughout affected files.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pages/vaults/index.tsx | Updated useFilteredVaults import to use @lib/hooks/useFilteredVaults. |
pages/vaults-beta/index.tsx | Minor reordering of CSS classes in the container div. |
pages/v3/index.tsx | Updated useFilteredVaults import to use @lib/hooks/useFilteredVaults. |
apps/vaults/components/table/CombinedVaultsTable.tsx | Updated useFilteredVaults import to use @lib/hooks/useFilteredVaults. |
apps/lib/hooks/useYearnToken.ts | Updated return type from TYToken to TToken. |
apps/lib/hooks/useFilteredVaults.ts | Added conditional logic for vault version filtering and updated dependencies. |
apps/lib/contexts/useYearn.tsx | Updated default token and aggregated vault maps for cumulated value calculation. |
apps/lib/contexts/useYearn.helper.tsx | Adjusted token filtering logic and onRefresh callback for balance updates. |
apps/lib/hooks/useFilteredVaults.ts
Outdated
if (v3 && !vault.version?.startsWith('3') && !vault.version?.startsWith('~3')) { | ||
return false; | ||
} | ||
if (!v3 && vault.version?.startsWith('3') && !vault.version?.startsWith('~3')) { |
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.
When v3 is false, the current condition only flags vaults starting with '3' but not those starting with '~3'. Consider replacing the '&&' with an '||' so that both cases are filtered out: if (!v3 && (vault.version?.startsWith('3') || vault.version?.startsWith('~3'))) { return false; }.
if (!v3 && vault.version?.startsWith('3') && !vault.version?.startsWith('~3')) { | |
if (!v3 && (vault.version?.startsWith('3') || vault.version?.startsWith('~3'))) { |
Copilot uses AI. Check for mistakes.
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.
@w84april can you confirm this and update if necessary. Otherwise, LGTM
Oops, thought we were good but found a new bug that we might as well address here: |
Description
There was a bug in balances filtering: if vault has staking balance, but not balance, it wasn't taken into consideration in sum amount.
Also removed some unused code to keep things cleaner
Related Issue
rossgalloway/ySHIP#78