Feature/claims withdrawal reopen - #272
Merged
jhayniffy merged 2 commits intoMar 29, 2026
Merged
Conversation
- Store instance quorum_bps (1–10_000); initialize default 5000; admin_set + QuorumUpdated event - Snapshot ClaimQuorumBps at file_claim; finalize/vote use R = ceil(E*Q/10000) cast-ballot quorum + plurality - Below R at deadline → Rejected; admin quorum changes do not alter open claims - Tests: boundary quorum, ACL, e2e/voting/rejection/storage updates - Frontend: voting.mdx, vote education/tally, vote schema helper; events catalog note
…it restore - Add ClaimStatus::Withdrawn (terminal); block finalize/process payout - withdraw_claim: claimant auth, Processing + zero tallies, open-claim clear - Persist per-claim rate-limit anchor in ClaimRateLimitPrev; restore on withdraw - Clean anchor when claim leaves Processing via vote/finalize/payout - Emit claim_withdrawn event; document for indexers in events.rs - Reuse validate errors: NotEligibleVoter (wrong claimant), ClaimAlreadyTerminal - Tests: success, post-vote reject, unauthorized, rate-limit refile, no finalize/pay - Frontend: Withdrawn in schemas, board badge, vote tally, i18n, claims.mdx Made-with: Cursor
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.
Summary
Adds claimant-only
withdraw_claimso a filing mistake can be undone before any vote is cast. After the first ballot, withdrawal is blocked. Withdrawn claims stay on-chain for audit, are not finalizable into approve/reject outcomes for payout, and are surfaced distinctly for indexers/UI.closes #197
Contract
ClaimStatus::Withdrawn(terminal):finalize_claim/vote_on_claimtreat as terminal;process_claimstill requiresApprovedonly.withdraw_claim(claimant, claim_id):claimantauth; only whileProcessingandapprove_votes + reject_votes == 0; clears open-claim flag; respectsclaims_pausedlike other claim mutators.ClaimWithdrawnevent:["niffyinsure", "claim_withdrawn", claim_id]withpolicy_id,claimant,at_ledger.ClaimRateLimitPrev(claim_id)snapshotsLastClaimLedgerbefore each successfulfile_claim; restored on withdraw (or last-ledger key removed if first-ever filing). Key cleared when leavingProcessingvia vote, finalize, or payout (no restore on those paths).contracterrorvariants): wrong caller →NotEligibleVoter; wrong status or any vote →ClaimAlreadyTerminal.map_quote_errorcopy updated accordingly.Tests
contracts/niffyinsure/tests/withdraw_claim.rs: success path; revert after first vote; non-claimant; rate-limit refile after withdraw; finalize +process_claimboth fail when withdrawn.Frontend / docs
Withdrawnin ZodClaimStatus+isTerminal; claims board / vote tally badges; education panel +claims.mdx(incl. rate limit does not persist after withdraw for per-holder spacing);en/esstatus strings; indexer note inevents.rs.How to verify