Skip to content

fix(makerbot): correct Orders tab Send/Receive preview amounts; never exceed balance#3215

Merged
ca333 merged 1 commit intodevfrom
fix-makerbot-values
Oct 23, 2025
Merged

fix(makerbot): correct Orders tab Send/Receive preview amounts; never exceed balance#3215
ca333 merged 1 commit intodevfrom
fix-makerbot-values

Conversation

@smk762
Copy link
Copy Markdown
Collaborator

@smk762 smk762 commented Oct 23, 2025

Closes #3210

Root cause: Preview path incorrectly squared the balance when deriving base amount; volume units (percentage/USD) weren’t applied; no clamping to spendable.

Resolution:

  • Compute base amount from TradeVolume:
  • Percentage: spendable * percentage (fraction 0–1).
  • USD: usdVolume / baseUsdPrice, then clamp to spendable.
  • Use live order available amounts when present.
  • Derive rel amount from USD price ratio with margin.

Scope: UI preview for makerbot Orders list only; no backend/API changes.

Confirmation test

  • Percentage case:
    • Set makerbot max volume to 10% and create an order; open Orders tab.
    • Expected “Send” = spendable(base) * 0.10, never > spendable.
  • USD case:
    • Set makerbot volume in USD (e.g., $100).
    • Expected “Send” ≈ $100 / baseUsdPrice, clamped to spendable.
  • Confirm existing orders use availableAmount and do not exceed balance.

Files touched

  • lib/bloc/market_maker_bot/market_maker_order_list/market_maker_bot_order_list_repository.dart

Checklist

  • Correct preview amounts for percentage-volume.
  • Correct preview amounts for USD-volume.
  • Values never exceed spendable balance.
  • Uses live order available amounts when present.
  • No new lints in modified file.

@smk762 smk762 requested review from CharlVS and takenagain October 23, 2025 09:23
@smk762 smk762 changed the base branch from main to dev October 23, 2025 09:25
@ca333 ca333 merged commit 142b132 into dev Oct 23, 2025
6 of 12 checks passed
@github-actions
Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit d76cda6):

https://walletrc--pull-3215-merge-6g4r2psn.web.app

(expires Thu, 30 Oct 2025 09:27:33 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Makerbot order values in "orders tab" exceed available balance

2 participants