Skip to content

Feat/reputation score#273

Merged
Kaylahray merged 3 commits intogeevapp:mainfrom
Birdmannn:feat/reputation-score
Mar 30, 2026
Merged

Feat/reputation score#273
Kaylahray merged 3 commits intogeevapp:mainfrom
Birdmannn:feat/reputation-score

Conversation

@Birdmannn
Copy link
Copy Markdown
Contributor

Pull Request Template

Description

Reputation Score

What changed

types.rs

  • Added DataKey::Reputation(Address) for persistent score storage.

profile.rs

  • Added pub(crate) fn increment_reputation(env, user) — a plain Rust function outside #[contractimpl], so it is never exposed in the contract ABI and cannot be called externally.
  • Added pub fn get_reputation(env, user) -> u64 — public read, defaults to 0.

giveaway.rs

  • distribute_prize calls ProfileContract::increment_reputation after marking the giveaway Completed, incrementing the creator's score by 1.

test.rs

  • test_reputation_starts_at_zero — new address has score 0.
  • test_reputation_increments_after_distribute_prize — score is 1 after a full giveaway cycle.
  • test_reputation_accumulates_across_giveaways — score is 2 after two completed giveaways.

Security note

increment_reputation is pub(crate) and lives outside #[contractimpl]. The Soroban macro only generates ABI entries for functions inside that block, so there is no on-chain entry point for it. The only code path that can call it is distribute_prize within the same crate.


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.
This PR closes #212

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

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

Copy link
Copy Markdown
Contributor

@Kaylahray Kaylahray left a comment

Choose a reason for hiding this comment

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

Thank you for contributing 🙋‍♀️💯

@Kaylahray Kaylahray merged commit eefef39 into geevapp:main Mar 30, 2026
2 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.

Reputation Score Storage

2 participants