Skip to content

Title: fix: reverse fees/referrals/deposits on cancelled-market refunds, fix guardian emergency-pause and removal voting#1228

Open
chidinma000 wants to merge 1 commit into
solutions-plug:mainfrom
chidinma000:storage
Open

Title: fix: reverse fees/referrals/deposits on cancelled-market refunds, fix guardian emergency-pause and removal voting#1228
chidinma000 wants to merge 1 commit into
solutions-plug:mainfrom
chidinma000:storage

Conversation

@chidinma000

Copy link
Copy Markdown
Contributor

Body (saved to /private/tmp/.../scratchpad/pr_body.md):

Summary
Fix #1189: bets::withdraw_refund (the only reachable refund path) now reverses the protocol fee, reverses/removes referral rewards, and refunds the creator's creation_deposit on a cancelled market. Removed the dead, unreachable duplicate in cancellation.rs and fixed the lib.rs entrypoint, which was missing the outcome argument.
Fix #1190: emergency_pause now accumulates guardian votes in persistent storage and only pauses once aggregate voting power crosses the 2/3 threshold, instead of checking a single caller's own voting power.
Fix #1191: pausing now goes through a new circuit_breaker::force_pause helper so CircuitBreakerState is written and TTL-managed consistently via instance storage, removing the mismatched persistent-storage extend_ttl call.
Fix #1194: PendingGuardianRemoval gained a votes_against list — a majority-against vote now formally kills a removal proposal — and proposals expire after 7 days (GUARDIAN_REMOVAL_VOTE_WINDOW) if unresolved.
Test plan
cd contracts/predict-iq && cargo test bets
cd contracts/predict-iq && cargo test governance
cd contracts/predict-iq && cargo clippy --all-targets --all-features -- -D warnings
cd contracts/predict-iq && cargo build --release
Note: repo has pre-existing compile errors unrelated to this diff (missing markets::get_outcome_stake/set_outcome_stake, ConfigKey::MinimumBetAmount, CANCEL_OUTCOME_INDEX, moved-value bugs elsewhere in governance), plus a toolchain/target mismatch in .cargo/config.toml. These block a clean build until fixed separately.

Closes #1189
closes #1190
closes #1191
closes #1194

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@chidinma000 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! 🚀

Learn more about application limits

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