Skip to content

feat(claim-voting): implement DAO voting mechanism - #106

Merged
jhayniffy merged 2 commits into
InsurNiffy:mainfrom
zeekman:feat/claim-voting
Mar 25, 2026
Merged

feat(claim-voting): implement DAO voting mechanism#106
jhayniffy merged 2 commits into
InsurNiffy:mainfrom
zeekman:feat/claim-voting

Conversation

@zeekman

@zeekman zeekman commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

close #12

- Snapshot voter eligibility at claim-filing time (DataKey::ClaimVoters)
  Fairness rationale documented inline: holders who terminate mid-vote
  retain their ballot; late joiners cannot influence existing claims.

- Votes are immutable after first cast (DataKey::Vote written once).
  Prevents last-minute flip attacks; tally reconciliation is O(1).

- Running approve_votes / reject_votes updated transactionally inside
  vote_on_claim; no O(n) scan at finalization.

- Auto-finalization on simple majority inside vote_on_claim.
  finalize_claim() settles by plurality after vote_deadline; tie  Rejected.

- Events: ClaimFiled and VoteLogged carry enough data for the Next.js
  claim detail timeline. ClaimSettled emitted on state transition.

- ContractError enum with typed error codes; require_auth() on claimant
  and voter prevents address spoofing.

- Pause guard on file_claim and vote_on_claim via DataKey::Paused.

- test_seed_policy / test_remove_voter helpers gated behind testutils feature.

- 16 integration tests covering: non-voter rejection, double-vote,
  vote-flip, majority approve/reject, finalize after deadline, tie,
  snapshot isolation, mid-vote termination, adversarial bloat, events.
@drips-wave

drips-wave Bot commented Mar 24, 2026

Copy link
Copy Markdown

@zeekman 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

@jhayniffy
jhayniffy merged commit 87ea4f9 into InsurNiffy:main Mar 25, 2026
0 of 3 checks passed
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.

Contract — vote_on_claim: tokenless eligibility, vote storage, and running tallies

2 participants