Skip to content

Add has_contributed_current_round view function#102

Open
WuXieSec wants to merge 1 commit intosorosave-protocol:mainfrom
WuXieSec:feat/has-contributed-current-round
Open

Add has_contributed_current_round view function#102
WuXieSec wants to merge 1 commit intosorosave-protocol:mainfrom
WuXieSec:feat/has-contributed-current-round

Conversation

@WuXieSec
Copy link
Copy Markdown

This PR adds a simplified view function to check if a member has contributed to the current round, as requested in #58.

Changes:

  • Add has_contributed_current_round(member, group_id) function
  • Returns boolean indicating if the member has contributed to the current round
  • Handles edge cases gracefully:
    • Returns false if group is not active
    • Returns false if member is not in the group
    • Returns false if round is not active
  • Includes comprehensive test coverage

Why this is useful:
The existing has_contributed(member, group_id, round) requires the caller to know the current round number. This new function simplifies the common case where you just want to check the current round.

Example use case:
Frontend can easily show "You have contributed this round" status without first querying the group to get the current round number.

Closes #58

Changes:
- Add has_contributed_current_round(member, group_id) function
- Returns boolean indicating if member contributed to current round
- Handles non-active groups (returns false)
- Handles non-members (returns false)
- Add comprehensive test coverage

This provides a simpler API for checking current round contributions
without requiring the caller to know the current round number.

Closes sorosave-protocol#58
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.

Add view function to check if member has contributed this round

1 participant