Skip to content

refactor: extract _registerMember() and _isPreviousRoundTimedOut() helpers#150

Open
Tranquil-Flow wants to merge 1 commit into
devfrom
refactor/deduplicate-member-registration
Open

refactor: extract _registerMember() and _isPreviousRoundTimedOut() helpers#150
Tranquil-Flow wants to merge 1 commit into
devfrom
refactor/deduplicate-member-registration

Conversation

@Tranquil-Flow
Copy link
Copy Markdown

Summary

Closes #113

Extracts two internal helpers to eliminate duplicated logic:

  • _registerMember(id, member): consolidates the 5-line member registration pattern used in both create() and redeemInvite()
  • _isPreviousRoundTimedOut(id, circle, currentRound): consolidates the missed-deposit check duplicated across _deposit(), circleState(), and _isDecommissionable()

Behavior-preserving refactor. No functional changes.

Changes

  • _registerMember(): extracted from create() and redeemInvite()
  • _isPreviousRoundTimedOut(): extracted from _deposit(), circleState(), _isDecommissionable()
  • _isDecommissionable(): cleaned up expired-circle edge case handling with effectiveRound

Test plan

  • forge test passes (140 tests)
  • No behavioral changes — all existing tests pass without modification

#113)

Extract duplicated logic into internal helper functions to reduce code
duplication and improve maintainability:

- _registerMember(): deduplicates member registration in create() and redeemInvite()
- _isPreviousRoundTimedOut(): deduplicates missed-deposit checks across
  _deposit(), circleState(), and _isDecommissionable()

Adds NatSpec @dev documentation to both helpers. All 141 tests pass unchanged.

- Closes: #113
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.

Code duplication issues

1 participant