feat: implement reputation system for contributors - #142
Open
CodeMayor wants to merge 1 commit into
Open
Conversation
- Add ContributorReputation type, DataKey, storage, and functions to smart contract - Add ContributorReputationUpdated event for on-chain reputation tracking - Expose get_contributor_reputation and increase_contributor_reputation in contract interface - Add frontend reputation types (ContributorReputation, Badge) - Add reputation store (getContributorReputation, increaseContributorReputation) to task-workflow - Automatically increase reputation score when submissions are approved - Add GET /api/reputation?contributor=<address> API endpoint - Display reputation score and completed tasks count in ContributorProfileCard - System is extensible for future badges via Badge type
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.
Description
Implements a reputation system that rewards contributors based on completed tasks and successful submissions.
Smart Contract Changes
Added
ContributorReputationstruct tobase/types.rswithcontributor,score, andcompleted_tasksfieldsAdded
ContributorReputationUpdatedevent tobase/events.rsAdded
Reputation(Address)DataKey variant toautoshare_logic.rsImplemented
get_contributor_reputationandincrease_contributor_reputationfunctionsExposed both functions in the contract interface (
lib.rs)Frontend Changes
Added
frontend/src/types/reputation.tswithContributorReputation,Badge, andReputationApiResponsetypesAdded reputation store to
task-workflow.ts:getContributorReputation,increaseContributorReputation,getAllReputationsReputation automatically increases (+10 points) when a submission is approved via
approveSubmissionAdded
GET /api/reputation?contributor=<address>API endpointUpdated
ContributorProfileCardto display reputation score and completed tasks countAcceptance Criteria
[x] Reputation updates correctly (score increases on submission approval)
[x] API exposes contributor score (
GET /api/reputation?contributor=<address>)[x] Frontend displays reputation (in ContributorProfileCard)
[x] System is extensible for future badges (via
Badgetype and modular function design)Testing
All 299 existing tests pass
Build succeeds with no TypeScript errors
closes #131