🟡 Priority: High
Difficulty: Hard
Estimated Effort: 4-5 days
Relevant Files: contracts/src/lib.rs
Labels: enhancement, priority:high, logic
Requirements
-
Deterministic Rotations
- Currently,
payout(recipient) allows the admin to pick any member who hasn't received a payout. This allows the admin to play favorites.
- Implement strict on-chain enforcement of the payout order based on join order (or a pre-defined array).
-
Payout Queue State
- Replace the
HasReceivedPayout boolean map with a NextPayoutIndex integer in instance storage (starting at 0).
- The
Members vector already establishes an order (index 0, index 1, etc.).
-
Enforce Queue
- Modify
payout() (or trigger_payout()) so it no longer takes a recipient argument.
- Instead, it reads
NextPayoutIndex.
recipient = members.get(NextPayoutIndex).
- Execute the payout to that specific recipient.
- Increment
NextPayoutIndex by 1.
-
Cycle Boundaries
- When
NextPayoutIndex == Members.len(), the cycle is complete.
- The
reset_cycle() function should reset NextPayoutIndex to 0.
- Ensure
add_member and remove_member handle NextPayoutIndex gracefully (e.g., if a member is removed before their turn, shift the index or array).
-
Testing
- Unit test: 3 members join. Payout 1 goes to member 0. Payout 2 goes to member 1.
- Unit test: Attempt to bypass the queue (panics or automatically routes to the correct person).
- Unit test: Cycle completes, resets, and starts again with member 0.
- Target: 100% coverage on sequential payout logic.
🟡 Priority: High
Difficulty: Hard
Estimated Effort: 4-5 days
Relevant Files:
contracts/src/lib.rsLabels:
enhancement,priority:high,logicRequirements
Deterministic Rotations
payout(recipient)allows the admin to pick any member who hasn't received a payout. This allows the admin to play favorites.Payout Queue State
HasReceivedPayoutboolean map with aNextPayoutIndexinteger in instance storage (starting at 0).Membersvector already establishes an order (index 0, index 1, etc.).Enforce Queue
payout()(ortrigger_payout()) so it no longer takes arecipientargument.NextPayoutIndex.recipient = members.get(NextPayoutIndex).NextPayoutIndexby 1.Cycle Boundaries
NextPayoutIndex == Members.len(), the cycle is complete.reset_cycle()function should resetNextPayoutIndexto 0.add_memberandremove_memberhandleNextPayoutIndexgracefully (e.g., if a member is removed before their turn, shift the index or array).Testing