Skip to content

feat: add member management to group treasury#65

Open
KingFRANKHOOD wants to merge 1 commit into
codebestia:mainfrom
KingFRANKHOOD:feat/add-member-management-to-group-treasury
Open

feat: add member management to group treasury#65
KingFRANKHOOD wants to merge 1 commit into
codebestia:mainfrom
KingFRANKHOOD:feat/add-member-management-to-group-treasury

Conversation

@KingFRANKHOOD
Copy link
Copy Markdown

@KingFRANKHOOD KingFRANKHOOD commented May 29, 2026

PR Summary: Add member management to Group Treasury (Closes #41)

Description

Implements member tracking for the group_treasury contract. The contract now manages a whitelist of members who can deposit, with admin-only controls for adding/removing members.

Changes

New contract crate: contracts/contracts/group_treasury/

  • storage.rs — DataKey enum (Admin, Members, Balance(Address)) plus MemberAddedEvent and MemberRemovedEvent event structs.
  • lib.rs — Eight public functions:
  • initialize(admin, members: Vec) — one-time init with initial member list
  • add_member(member) — admin only, prevents duplicates
  • remove_member(member) — admin only, panics "cannot remove admin" on self-removal, emits MemberRemovedEvent
  • deposit(from, amount) — requires membership + from.require_auth(), increments persistent balance
  • balance(address), members(), admin() — view functions
  • test.rs — 10 unit tests covering:
  • Happy path initialize / add / remove / deposit
  • Double-init guard
  • Duplicate member rejection
  • Non-member deposit → "unauthorized: not a member"
  • Admin self-removal → "cannot remove admin"
  • Removed member: balance preserved, future deposits blocked

Acceptance Criteria Checklist

  • Non-member deposit panics with auth error
  • Removing a member prevents future deposits but does not affect balance
  • Admin removal of self panics with "cannot remove admin"

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

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

@codebestia
Copy link
Copy Markdown
Owner

Please resolve the conflicts

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.

[CONTRACT] Add member management to Group Treasury

2 participants