Fix #3: Prevent principal-sweeping on zero-side market resolution - #119
Open
funds0033-cmyk wants to merge 2 commits into
Open
Fix #3: Prevent principal-sweeping on zero-side market resolution#119funds0033-cmyk wants to merge 2 commits into
funds0033-cmyk wants to merge 2 commits into
Conversation
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>
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.
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
AccumulatedFeesinstead 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:
ForfeitedPool, separate from globalAccumulatedFees.freeze_marketduring that window to cancel the market, after which users withdraw their gross stake viacancel_refund.zero_sideis 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_marketfinalize_zero_sideget_forfeited_poolTests
Covers two-sided resolution, one-sided wins, empty-side refunds, blocked premature claims, market freeze, and confirms
withdraw_feescan't drain principal.Branch:
fix/issue-3-zero-side-resolution