Skip to content

Commit eac2fc4

Browse files
refactor(CampaignInstance): consolidate state variables into structs to resolve linter violations and stack depth issues
BREAKING CHANGE: State variable access patterns updated from direct access to struct member access - Group 24 state variables into 3 logical structs (CampaignCore, DonationConstraints, Counters) - Reduce state variable count from 24 to 11, resolving max-states-count linter violation - Eliminate stack too deep compilation errors by reducing parameter passing overhead - Remove redundant milestoneCount variable; derive from counters.nextMilestoneId - Update all function bodies to use struct member access (e.g., core.creator instead of getCreator) - Add interface compliance getter functions to maintain external API compatibility - Implement pull-based refund pattern with claimRefund() and batchRefund() functions - Fix type mismatch errors in comparison operations (totalRaised vs goalAmount, state vs CampaignState) - Optimize gas consumption by eliminating duplicate state writes - Improve code organization and maintainability through logical data grouping Affected functions: initializeCampaign, createMilestone, finalizeCampaign, donate, withdrawMilestoneFunds, pauseCampaign, resumeCampaign, cancelCampaign, and 40+ others Fixes: #[issue-number] - Stack too deep compiler error Fixes: #[issue-number] - Linter max-states-count violation (24 > 20 limit)
1 parent bf9c4cd commit eac2fc4

1 file changed

Lines changed: 901 additions & 316 deletions

File tree

0 commit comments

Comments
 (0)