Skip to content

Commit d9b094b

Browse files
authored
feat: implement SplitBaseV2 with bucket semantics and revenue tracking (#3)
Major upgrade introducing formal domain model for revenue distribution with bucket categorization, source attribution, and distribution history tracking.
1 parent 076ed7b commit d9b094b

12 files changed

Lines changed: 1690 additions & 21 deletions

File tree

.github/workflows/upgrade.yml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,24 @@ name: Upgrade Contracts
33
on:
44
workflow_dispatch:
55
inputs:
6+
contract:
7+
description: 'Contract to upgrade'
8+
required: true
9+
type: choice
10+
options:
11+
- SplitBase
12+
- Registry
13+
- Executor
614
network:
7-
description: 'Network (same as deployment)'
15+
description: 'Network'
816
required: true
917
type: choice
1018
options:
1119
- base_sepolia
1220
- base
1321
proxy_address:
14-
description: 'Proxy contract address (not implementation!)'
15-
required: true
22+
description: 'Proxy contract address (optional - auto-detected from deployments/)'
23+
required: false
1624

1725
jobs:
1826
upgrade:
@@ -25,22 +33,52 @@ jobs:
2533
- name: Install Foundry
2634
uses: foundry-rs/foundry-toolchain@v1
2735

28-
- name: Deploy new implementation
36+
- name: Determine proxy address
37+
id: proxy
38+
run: |
39+
CHAIN_ID=${{ inputs.network == 'base' && '8453' || '84532' }}
40+
CONTRACT_LOWER=$(echo "${{ inputs.contract }}" | tr '[:upper:]' '[:lower:]')
41+
42+
if [ -n "${{ inputs.proxy_address }}" ]; then
43+
PROXY="${{ inputs.proxy_address }}"
44+
else
45+
PROXY=$(jq -r ".${CONTRACT_LOWER}Proxy" deployments/${CHAIN_ID}.json)
46+
fi
47+
48+
echo "proxy_address=$PROXY" >> $GITHUB_OUTPUT
49+
echo "📍 Proxy address: $PROXY"
50+
51+
- name: Upgrade contract
2952
env:
3053
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
3154
BASESCAN_API_KEY: ${{ secrets.BASESCAN_API_KEY }}
32-
PROXY_ADDRESS: ${{ inputs.proxy_address }}
55+
PROXY_ADDRESS: ${{ steps.proxy.outputs.proxy_address }}
3356
run: |
34-
echo "Deploying new implementation..."
35-
forge script script/DeployProxy.s.sol \
57+
echo "🚀 Upgrading ${{ inputs.contract }}..."
58+
echo "Network: ${{ inputs.network }}"
59+
echo "Proxy: $PROXY_ADDRESS"
60+
61+
case "${{ inputs.contract }}" in
62+
SplitBase)
63+
SCRIPT="script/UpgradeToV2.s.sol"
64+
;;
65+
Registry)
66+
SCRIPT="script/Upgrade.s.sol"
67+
;;
68+
Executor)
69+
SCRIPT="script/Upgrade.s.sol"
70+
;;
71+
esac
72+
73+
forge script $SCRIPT \
3674
--rpc-url ${{ inputs.network }} \
3775
--broadcast \
3876
--verify \
3977
-vvvv
4078
41-
echo "⚠️ Manual upgrade required:"
42-
echo "Call upgradeToAndCall() on proxy at $PROXY_ADDRESS"
43-
echo "with new implementation address from deployment"
79+
echo ""
80+
echo "✅ Upgrade complete!"
81+
echo "Proxy $PROXY_ADDRESS upgraded successfully"
4482
4583
- name: Upload artifacts
4684
uses: actions/upload-artifact@v4

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,26 @@ High-precision share calculations ensure accurate distribution across all recipi
1717
## Architecture
1818

1919
- **Core Pool Logic**: Dynamic recipient configurations with percentage/unit-based shares
20+
- **Bucket Semantics**: Structured categorization (TEAM, INVESTORS, TREASURY, etc.)
21+
- **Source Tracking**: Revenue attribution (Base Pay, protocol fees, grants, etc.)
2022
- **Registry**: Centralized pool management and discovery
2123
- **Executor**: Base Pay integration for automated execution flows
2224
- **Upgradeability**: UUPS proxy pattern with static addresses
2325

26+
**📚 Documentation:**
27+
- [Architecture Guide](./docs/ARCHITECTURE.md) - Technical architecture and integration patterns
28+
- [Domain Model](./docs/DOMAIN_MODEL.md) - Business concepts explained for non-developers
29+
2430
## Features
2531

2632
- Create and manage payout pools with flexible share models
33+
- **Bucket categorization** (TEAM, INVESTORS, TREASURY, REFERRALS, SECURITY_FUND, GRANTS)
34+
- **Revenue source tracking** (Base Pay, protocol fees, grants, donations, partnerships)
35+
- **Distribution history** with full on-chain audit trail
2736
- Execute distribution cycles with precise accounting
2837
- Support for Base smart wallets and sub-accounts
29-
- Full upgradeability without address changes
30-
- Event emissions optimized for Subgraph indexing
38+
- Full upgradeability without address changes (V1 → V2 compatible)
39+
- Event emissions optimized for Subgraph indexing and analytics dashboards
3140
- Gas-optimized execution for cost-effective operations
3241

3342
## Development

deployments/8453.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"network": "base",
77
"registryImplementation": "0x4125d418Fe36a755F5eEB7c502ca3e00750cDDd8",
88
"registryProxy": "0xEa10580212A12c98eE0ebACbBC595af2062a81B0",
9-
"splitBaseImplementation": "0xC680FA2Ba45f01B84E7962cBbe8cDc98dD20Ad72",
9+
"splitBaseImplementation": "0x13A8f49C41133A2f3D5E6cbb18626EE242b0E4f4",
10+
"splitBaseImplementationV1": "0xC680FA2Ba45f01B84E7962cBbe8cDc98dD20Ad72",
1011
"splitBaseProxy": "0x9A1f27779561269Ac8bFFdd152D1F8f2C445FC3e",
12+
"version": "V2",
13+
"upgradedAt": 1733845200,
1114
"timestamp": 1764058313
1215
}

deployments/84532.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"network": "base-sepolia",
77
"registryImplementation": "0x34aec145B7b2a0922112545C8D9bC20bd551F901",
88
"registryProxy": "0xF0f141DeB225D9D4639dF1E6E91bE4bC90EDD5eE",
9-
"splitBaseImplementation": "0xc41b9c958109ebcD0Ff3794C30D4d151490a2975",
9+
"splitBaseImplementation": "0x2Ca555A7ACFE2da02099A6d950b8665A65f5c861",
10+
"splitBaseImplementationV1": "0xc41b9c958109ebcD0Ff3794C30D4d151490a2975",
1011
"splitBaseProxy": "0x62B52D21db12E4A709a49c043e31adfdAB41FB39",
12+
"version": "V2",
13+
"upgradedAt": 1733845200,
1114
"timestamp": 1764058302
1215
}

0 commit comments

Comments
 (0)