Skip to content

Fix #3: Prevent principal-sweeping on zero-side market resolution - #119

Open
funds0033-cmyk wants to merge 2 commits into
SPulse-Org:mainfrom
funds0033-cmyk:main
Open

Fix #3: Prevent principal-sweeping on zero-side market resolution#119
funds0033-cmyk wants to merge 2 commits into
SPulse-Org:mainfrom
funds0033-cmyk:main

Conversation

@funds0033-cmyk

@funds0033-cmyk funds0033-cmyk commented Aug 18, 2026

Copy link
Copy Markdown

Closes #3

Problem

When a resolver picked the empty (zero-participation) side of a one-sided market, the losing side's entire stake was swept into AccumulatedFees instead of being refunded — letting the resolver effectively steal the pool.

Changes

Resolving to an empty side is still allowed (one-sided markets stay resolvable), but that path can no longer take the pool:

  • Provenance: empty-side principal now goes into a per-market ForfeitedPool, separate from global AccumulatedFees.
  • Refunds: losers get their net stake back via the payout ledger; the protocol keeps only the standard 2% fee.
  • Dispute window: 24h delay before claims or fee release. Admin can call freeze_market during that window to cancel the market, after which users withdraw their gross stake via cancel_refund.
  • Event: zero_side is now emitted so this resolution pattern is visible off-chain.
  • withdraw_fees: restricted to real platform fees only — can no longer drain swept principal.

New entrypoints

  • freeze_market
  • finalize_zero_side
  • get_forfeited_pool

Tests

Covers two-sided resolution, one-sided wins, empty-side refunds, blocked premature claims, market freeze, and confirms withdraw_fees can't drain principal.

Branch: fix/issue-3-zero-side-resolution

funds0033-cmyk and others added 2 commits August 18, 2026 11:13
Keep the forfeited-pool / dispute-window path, take main's pause ABI, and assign unique error codes so pause, duration, and zero-side errors no longer share 26.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

[CRITICAL] resolve_market lets a resolver sweep the entire pool to fees by resolving to the empty side — griefing / fund theft

1 participant