-
Notifications
You must be signed in to change notification settings - Fork 45
feat: calculate balanced values based on form #978
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
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 extends deposit functionality to support balanced amount calculations driven by user form inputs in addition to existing wallet-based balances.
- Introduces a new union type for
isBalancedAmountsto distinguish between wallet-based, form-based, or disabled modes. - Implements
calculateBalancedValuesinFieldsDeposit.tsxto recalculate token proportions when a single input changes. - Updates logging in
curvejs.tsand bumps the@curvefi/apidependency.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/main/src/dex/store/createPoolDepositSlice.ts | Refine isBalancedAmounts check to only trigger on 'by-wallet' and type-annotate resetFormValues. |
| apps/main/src/dex/lib/curvejs.ts | Change log call to wrap isWrapped in an object. |
| apps/main/src/dex/components/PagePool/Deposit/types.ts | Change isBalancedAmounts from boolean to `'by-wallet' |
| apps/main/src/dex/components/PagePool/Deposit/components/FieldsDeposit.tsx | Add calculateBalancedValues, update form‐change handler, and adapt checkbox logic. |
| apps/main/package.json | Bump @curvefi/api from 2.66.26 to 2.66.28. |
Comments suppressed due to low confidence (3)
apps/main/src/dex/components/PagePool/Deposit/components/FieldsDeposit.tsx:85
- [nitpick] The variable
isBalancedAmountsnow holds a string union orfalse, which can be confusing. Consider renaming tobalanceModeor similar to reflect its multi-state nature.
const isBalancedAmounts = formValues.isBalancedAmounts
apps/main/src/dex/components/PagePool/Deposit/components/FieldsDeposit.tsx:30
- Add unit tests for
calculateBalancedValuesto verify correct proportion calculations and edge cases (e.g., zero balances or missing price data).
function calculateBalancedValues(
apps/main/src/dex/lib/curvejs.ts:476
- The
logcall signature was changed from passing a boolean to wrappingisWrappedin an object. Verify that downstream log parsers and monitoring tools handle this new shape as expected.
log('depositBalancedAmounts', p.name, { isWrapped })
Uh oh!
There was an error while loading. Please reload this page.