Skip to content

Reject malformed decimal deposit amounts #1175

Description

@greatest0fallt1me

Summary

handleAmountChange strips non-digit/dot characters but allows multiple dots ('1.2.3' → NaN → 'Amount must be a valid number') and unlimited decimals, while USDC on Stellar supports 7 decimal places.

Why this matters

Users pasting amounts get confusing errors, and submitted amounts with >7 decimals would be rejected on-chain after approval.

Scope

Normalise to a single decimal point, cap fraction digits at 7, and handle locale commas. Show an inline hint when input is truncated.

Relevant code in CalloraOrg/Callora-Frontend:

  • src/App.tsx
  • src/utils/format.ts

Priority

Medium

Acceptance criteria

  • '1.2.3' is normalised to '1.23' or rejected with a clear message
  • More than 7 decimals are truncated with a hint
  • '10,5' is interpreted consistently
  • Deposit tests cover these inputs

Validation

npm test -- --run src/App.deposit.test.tsx

Non-goals

  • Typo-only, formatting-only, or cosmetic changes.
  • Unrelated refactors, dependency upgrades, or broad rewrites.
  • Removing safeguards or weakening validation to make tests pass.

Contributor application

Before coding, describe the affected modules, proposed state/invariant changes, test strategy, compatibility considerations, and an estimate. Wait for assignment before starting implementation.

PR requirements

Use a feature branch and include Closes #<issue-number>. Address every criterion, map criteria to code and tests, explain security and failure-mode handling, and ensure CI passes.

Quality review

A maintainer will assess correctness, completeness, test depth, compatibility, observability, and adverse-case handling. A substantive implementation is required; merge or CI status alone does not guarantee reward eligibility.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveStellar Wave Program issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions