Skip to content

Conversation

@katyailil
Copy link
Owner

Major upgrade introducing formal domain model for revenue distribution with bucket categorization, source attribution, and distribution history tracking.

- 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
@katyailil katyailil merged commit d9b094b into main Dec 10, 2025
2 checks passed
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.

2 participants