Skip to content

v3.6.0: Sell Share Over-Cashout Protection

Choose a tag to compare

@pwdel pwdel released this 08 Jul 04:02
b31b818

Highlights

  • Prevents repeated sell-share over-cashout by projecting the user's post-sale position before both quote and settlement.
  • Keeps the public API contract unchanged: unsafe sell attempts continue to use the existing 422 INSUFFICIENT_SHARES path.
  • Keeps quote behavior aligned with settlement by applying the same projection invariant to /v0/sell/quote and /v0/sell.
  • Preserves dust semantics: gross saleValue reduces position value, only netProceeds are credited to the user, and retained dust stays in market accounting.
  • Ensures rejected over-cashout attempts do not mutate balance, position, market dust, market volume, or the sell ledger.

Testing and Coverage

  • Added backend regression tests for valid dust sells, full-position sells, unsafe projected sells, and the reported buy/sell replay.
  • Added transaction-scoped repository coverage for sell projection.
  • Added executable HTTP integration coverage in integrationtest/scripts/sell-shares-overcashout.mjs, with a matching case document under integrationtest/cases/.

Other Changes Since v3.5.2

  • Traffic badge update workflow now opens pull requests instead of attempting to push directly to protected main.
  • README traffic badge metrics were refreshed through protected-branch PRs.