Skip to content

feat(contracts): add manual and merit-based winner selection#392

Open
heymide wants to merge 2 commits into
geevapp:mainfrom
heymide:feat/manual-merit-selection
Open

feat(contracts): add manual and merit-based winner selection#392
heymide wants to merge 2 commits into
geevapp:mainfrom
heymide:feat/manual-merit-selection

Conversation

@heymide

@heymide heymide commented Jun 28, 2026

Copy link
Copy Markdown

Close: #312

Pull Request Template

Description

Summary:

  1. contracts/geev-core/src/types.rs :

    • SelectionMethod enum with Random , Manual , and Merit variants
    • Giveaway struct with selection_method field
  2. contracts/geev-core/src/giveaway.rs :

    • create_giveaway_with_selection function for creating giveaways with non-random selection
    • finalize_manual_winners for manually selecting winners (only accessible by creator/admin)
    • finalize_merit_winners for selecting winners by reputation (only accessible by creator/admin)
    • Helper functions: ensure_ready_for_selection , ensure_creator_or_admin , validate_manual_winners , select_merit_winners , finalize_winners
  3. contracts/geev-core/src/test.rs :

    • Tests for manual winner selection
    • Tests for merit-based winner selection
    • Tests for authorization checks (only creator/admin can finalize non-random winners)
    • Tests to ensure random selection still works as expected

Checklist

  • I have tested my changes locally
  • I have updated documentation as needed
  • I have run npx prisma generate after schema changes
  • I have run npx prisma migrate dev or npx prisma migrate deploy as appropriate

Post-Merge Steps for Maintainers

If this PR includes changes to the Prisma schema:

  1. Run the following command to apply the migration to your database:

    npx prisma migrate deploy

    or, for local development:

    npx prisma migrate dev
  2. Ensure your CI pipeline runs the migration before tests (add this step if missing):

    - name: Run Prisma Migrate
      run: npx prisma migrate deploy
  3. Make sure the database user in CI has permission to run migrations.


If you have any questions, please comment on this PR.

@heymide

heymide commented Jun 28, 2026

Copy link
Copy Markdown
Author

Done, Close: #392

@3m1n3nc3 3m1n3nc3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, your CI is failing, skipping it does not fix the underlying issue. Your fork is behind the origin/main by 33 commits. Please update your fork, allow CI to run and fix any irelated issues.

Thank you.

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.

[Contracts] Add manual or merit-based winner selection

2 participants