Skip to content

Conversation

@DanielSchiavini
Copy link
Collaborator

@DanielSchiavini DanielSchiavini commented May 22, 2025

@vercel
Copy link

vercel bot commented May 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
curve-dapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 1:42pm
curve-dapp-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 1:42pm

Copy link
Contributor

Copilot AI left a 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 isBalancedAmounts to distinguish between wallet-based, form-based, or disabled modes.
  • Implements calculateBalancedValues in FieldsDeposit.tsx to recalculate token proportions when a single input changes.
  • Updates logging in curvejs.ts and bumps the @curvefi/api dependency.

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 isBalancedAmounts now holds a string union or false, which can be confusing. Consider renaming to balanceMode or 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 calculateBalancedValues to 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 log call signature was changed from passing a boolean to wrapping isWrapped in an object. Verify that downstream log parsers and monitoring tools handle this new shape as expected.
log('depositBalancedAmounts', p.name, { isWrapped })

mimaklas
mimaklas previously approved these changes May 23, 2025
@DanielSchiavini DanielSchiavini merged commit 112e02b into main May 26, 2025
11 checks passed
@DanielSchiavini DanielSchiavini deleted the feat/balanced-values branch May 26, 2025 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants