Repository navigation
fix: validate deposits, fix milestone progress, XLM precision, role-based redirect - #332
Merged
chonilius merged 3 commits intoAug 25, 2026
Conversation
- Add parseMoneyInput helper to validate monetary input strings against asset-specific precision limits (USDC: 2 decimals, XLM: 7 decimals) - Validate PoolDepositButton amount on every change and at submit time, disable button when invalid, normalize the value before sending to API - Thread pool.asset through to PoolDepositButton for precision-aware validation (fixes MergeFi#69) - Guard milestone progress pct calculation against budget <= 0 to prevent NaN/Infinity, clamp to 100% for over-funded milestones, show honest labels for unfunded and over-funded states (fixes MergeFi#75)
|
@brightcli-stack is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
…ased redirect - Add parseMoneyInput helper to validate deposit amounts against asset-specific precision (USDC: 2, XLM: 7 decimals), normalize output, and disable the Deposit button when invalid (fixes MergeFi#69) - Guard milestone progress pct against budget <= 0 to prevent NaN/Infinity, clamp to 100% for over-funded milestones, show honest labels (fixes MergeFi#75) - Make formatCurrency and StatCard branch maximumFractionDigits on asset: XLM gets 7 decimal places, USDC stays at 2 (fixes MergeFi#76) - Redirect CallbackClient post-login based on user.roles with precedence maintainer > sponsor > contributor, fallback to /dashboard/contributor for empty/missing roles or null user (fixes MergeFi#77)
|
@brightcli-stack Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #69
Fixes #75
Fixes #76
Fixes #77
What changed
parseMoneyInputhelper insrc/lib/utils.tsthat validates monetary input strings against asset-specific precision limits (USDC: 2 decimals, XLM: 7 decimals), rejects empty/zero/negative/non-finite/over-precision values, and returns a normalized canonical decimal stringPoolDepositButtonto accept anassetprop, validate the amount on every change and at submit time, disable the Deposit button when invalid, and send the normalized value to the APIpool.assetfrom the milestones page through toPoolDepositButtonpctcalculation againstbudget <= 0to prevent NaN/Infinity, clamped to 100% for over-funded milestones, and added honest labels ("Not yet funded", "Over-funded") for edge casesformatCurrencyand StatCard's internal currency formatter branchmaximumFractionDigitson asset: XLM gets 7 decimal places, USDC stays at 2CallbackClientto redirect post-login based onuser.roleswith precedence maintainer > sponsor > contributor, falling back to/dashboard/contributorfor empty/missing roles or null userWhy
PoolDepositButtonhad no client-side validation — empty, negative, zero, or non-numeric amounts were sent directly to the backendformatCurrencyhardcoded 2-decimal precision for all assets, silently discarding XLM's native 7-decimal precisionCallbackClientalways redirected to/dashboard/contributorregardless of the user's actual roles, forcing maintainers and sponsors to manually navigate to their dashboardHow to test
formatCurrency(12.3456789, "XLM")should show more than 2 decimal placesformatCurrency(0.0000005, "XLM")should not display as "0 XLM"roles: ["maintainer"]should be redirected to/dashboard/maintainer/dashboard/contributornpx jest src/lib/utils.test.ts src/app/auth/callback/CallbackClient.test.tsx— all tests pass