Skip to content
This repository was archived by the owner on Jun 12, 2026. It is now read-only.
This repository was archived by the owner on Jun 12, 2026. It is now read-only.

Handle vote rejection path in check_vote_threshold #3

Description

@0xdevcollins

Problem

check_vote_threshold() only handles the "Approve" path (option 0). If community voters choose "Reject" (option 1), the campaign stays in Submitted status forever — there is no explicit rejection handling.

Current Behavior

vote_campaign(voter, campaign_id, option_id=1)  // Vote "Reject"
check_vote_threshold(campaign_id)               // Fails with VoteThresholdNotMet
// Campaign stuck in Submitted forever

Expected Behavior

check_vote_threshold should:

  1. Check if voting period has ended
  2. If "Approve" threshold met → transition to Campaigning (existing behavior)
  3. If "Reject" threshold met OR voting period expired without approval → transition back to Draft with reason
  4. Emit CampaignVoteRejected event

Acceptance Criteria

  • Campaigns rejected by community vote return to Draft status
  • Creator is notified (via event) that their campaign was voted down
  • Voting session is cleaned up after rejection
  • Tests cover: approve path, reject path, expired-without-quorum path

Priority

High — Without this, rejected campaigns are orphaned forever.

Labels

crowdfunding, smart-contract, bug

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions