-
Notifications
You must be signed in to change notification settings - Fork 3
feat: implement SplitBaseV2 with bucket semantics and revenue tracking #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- RegistryV1: test pool registration, metadata updates, status changes - ExecutorV1: test pool registration, executor management, execution flow - Both tests verify UUPS upgradeability and access control
Tests now properly handle the requirement that ExecutorV1 must be the pool owner in SplitBaseV1 for the execute flow to work correctly.
Introduce formal type definitions for SplitBase domain model: - BucketType enum: TEAM, INVESTORS, TREASURY, REFERRALS, SECURITY_FUND, GRANTS, CUSTOM - SourceType enum: BASE_PAY, PROTOCOL_FEES, GRANTS, DONATIONS, PARTNERSHIPS, OTHER - DistributionRecord struct: immutable payout history with source attribution - BucketAllocation struct: per-bucket distribution metadata These types formalize the business concepts needed for transparent revenue distribution and enable rich analytics for dashboards and governance.
Update SplitBaseV1 function visibility to enable internal calls from V2: - createPool, addRecipient, updateRecipient, executePayout - getPool, getRecipient, getRecipientList This change maintains full backward compatibility while allowing V2 to inherit and extend V1 functionality without code duplication.
Major features: - Bucket-aware recipient management (TEAM, INVESTORS, TREASURY, etc.) - Revenue source attribution (BASE_PAY, PROTOCOL_FEES, GRANTS, etc.) - Distribution history with full metadata - BucketPayout events for per-category analytics - Backward compatible with V1 pools and functions Storage layout: - New mappings added at end of V1 storage - 44-slot storage gap for future versions - UUPS upgradeability maintained Query capabilities: - getBucketRecipients: filter recipients by category - getBucketTotalShares: calculate category allocation - getDistribution: retrieve historical payout records
Test suite covers: - Pool creation with metadata - Recipient management with bucket categorization - Multi-bucket distribution scenarios - Source-attributed payout execution - Distribution history tracking - Bucket-specific queries and analytics - V1/V2 backward compatibility - Mixed usage of V1 and V2 functions - Fuzz testing for precision across wide parameter ranges All 11 tests passing with 256 fuzz runs per test.
Architecture Guide (ARCHITECTURE.md): - Complete technical architecture overview - Core concept definitions (Source, Pool, Bucket, Recipient, Distribution) - Data flow diagrams and real-world examples - Event schema for analytics integration - Storage layout and upgradeability patterns - Integration examples (basic V1, advanced V2, Base Pay) - Security considerations and gas optimization notes Domain Model Guide (DOMAIN_MODEL.md): - Non-technical explanation of business concepts - Semantic advantages of bucket categorization - Complete worked example with DAO revenue distribution - Query patterns and analytics use cases - Migration path from V1 to V2 These docs enable integration partners and governance participants to understand SplitBase without reading Solidity code.
Forge script for upgrading existing SplitBaseV1 proxies to V2: - Deploys new SplitBaseV2 implementation - Executes upgradeToAndCall with initializeV2 - Outputs verification command for Basescan - Maintains storage compatibility with V1 Usage: PROXY_ADDRESS=0x... forge script script/UpgradeToV2.s.sol \ --rpc-url base_sepolia --broadcast --verify
- Switch from DeployProxy.s.sol to UpgradeToV2.s.sol - Automated upgradeToAndCall with initializeV2 - Enhanced output with V2 feature summary - Maintains backward compatibility with V1 pools
Split multi-argument console.log into separate calls to comply with forge-std console interface limits
Base Sepolia: - V2 Implementation: 0x2Ca555A7ACFE2da02099A6d950b8665A65f5c861 - Proxy: 0x62B52D21db12E4A709a49c043e31adfdAB41FB39 - Verified: https://sepolia.basescan.org/address/0x2ca555a7acfe2da02099a6d950b8665a65f5c861 Base Mainnet: - V2 Implementation: 0x13A8f49C41133A2f3D5E6cbb18626EE242b0E4f4 - Proxy: 0x9A1f27779561269Ac8bFFdd152D1F8f2C445FC3e - Verified: https://basescan.org/address/0x13a8f49c41133a2f3d5e6cbb18626ee242b0e4f4 Both contracts successfully upgraded via UUPS pattern with full backward compatibility. All V1 data preserved, V2 features now active.
- Add contract selection dropdown (SplitBase, Registry, Executor) - Auto-detect proxy address from deployments/ JSON - Support manual proxy address override - Dynamic script selection based on contract type
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Major upgrade introducing formal domain model for revenue distribution with bucket categorization, source attribution, and distribution history tracking.