@bananapus/univ4-lp-split-hook-v6 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ADMINISTRATION.md CHANGED
@@ -33,23 +33,23 @@ Admin privileges and their scope in univ4-lp-split-hook-v6.
33
33
 
34
34
  | Function | Required Role | Permission ID | Scope | What It Does |
35
35
  |----------|--------------|---------------|-------|-------------|
36
- | `deployPool(projectId, terminalToken, amount0Min, amount1Min, minCashOutReturn)` | Project owner or SET_BUYBACK_POOL operator. **Becomes permissionless** when the current ruleset weight has decayed to 1/10th or less of `initialWeightOf[projectId]`. | `JBPermissionIds.SET_BUYBACK_POOL` (26) | Per-project, single terminal-token path | Creates a Uniswap V4 pool at the geometric mean of issuance/cashout rates. Cashes out a computed fraction of accumulated project tokens for terminal tokens, mints a concentrated LP position, and transitions the project from accumulation to burn mode. This permanently commits the hook instance to one terminal-token path for that project. |
37
- | `rebalanceLiquidity(projectId, terminalToken, ...)` | Project owner or SET_BUYBACK_POOL operator | `JBPermissionIds.SET_BUYBACK_POOL` (26) | Per-project, per-terminal-token | Burns the existing LP position NFT, collects and routes accrued fees, recalculates tick bounds from current issuance/cashout rates, and mints a new position with updated bounds. Reverts with `InsufficientLiquidity` if the new position would have zero liquidity. (Lines 559-658) |
38
- | `claimFeeTokensFor(projectId, beneficiary)` | Project owner or SET_BUYBACK_POOL operator | `JBPermissionIds.SET_BUYBACK_POOL` (26) | Per-project | Transfers accumulated fee-project tokens to the specified beneficiary address. Validates the caller's permission, not the beneficiary's identity. Zeroes `claimableFeeTokens[projectId]` before transferring. (Lines 441-456) |
39
- | `processSplitWith(context)` | JB Controller (system) | None (checked via `controllerOf`) | Per-project | Only callable by the project's registered controller. Accumulates project tokens (pre-deployment) or burns them (post-deployment). Validates `context.split.hook == address(this)`, `groupId == 1`, and controller identity. (Lines 534-555) |
40
- | `initialize(feeProjectId, feePercent)` | Anyone (once only) | None | Per-clone instance | Sets `FEE_PROJECT_ID` and `FEE_PERCENT` on a clone. Can only be called once per clone (`initialized` flag). In practice, called immediately by the deployer factory. (Lines 177-194) |
36
+ | `deployPool(projectId, terminalToken, minCashOutReturn)` | Project owner or SET_BUYBACK_POOL operator. **Becomes permissionless** when the current ruleset weight has decayed to 1/10th or less of `initialWeightOf[projectId]`. | `JBPermissionIds.SET_BUYBACK_POOL` (26) | Per-project, single terminal-token path | Creates a Uniswap V4 pool at the geometric mean of issuance/cashout rates. Cashes out a computed fraction of accumulated project tokens for terminal tokens, mints a concentrated LP position, and transitions the project from accumulation to burn mode. This permanently commits the hook instance to one terminal-token path for that project. |
37
+ | `rebalanceLiquidity(projectId, terminalToken, ...)` | Project owner or SET_BUYBACK_POOL operator | `JBPermissionIds.SET_BUYBACK_POOL` (26) | Per-project, per-terminal-token | Burns the existing LP position NFT, collects and routes accrued fees, recalculates tick bounds from current issuance/cashout rates, and mints a new position with updated bounds. Reverts with `InsufficientLiquidity` if the new position would have zero liquidity. (Lines 632-667) |
38
+ | `claimFeeTokensFor(projectId, beneficiary)` | Project owner or SET_BUYBACK_POOL operator | `JBPermissionIds.SET_BUYBACK_POOL` (26) | Per-project | Transfers accumulated fee-project tokens to the specified beneficiary address. Validates the caller's permission, not the beneficiary's identity. Zeroes `claimableFeeTokens[projectId]` before transferring. (Lines 490-505) |
39
+ | `processSplitWith(context)` | JB Controller (system) | None (checked via `controllerOf`) | Per-project | Only callable by the project's registered controller. Accumulates project tokens (pre-deployment) or burns them (post-deployment). Validates `context.split.hook == address(this)`, `groupId == 1`, and controller identity. (Lines 596-627) |
40
+ | `initialize(feeProjectId, feePercent)` | Anyone (once only) | None | Per-clone instance | Sets `FEE_PROJECT_ID` and `FEE_PERCENT` on a clone. Can only be called once per clone (`initialized` flag). In practice, called immediately by the deployer factory. (Lines 215-232) |
41
41
 
42
42
  ### JBUniswapV4LPSplitHookDeployer
43
43
 
44
44
  | Function | Required Role | Permission ID | Scope | What It Does |
45
45
  |----------|--------------|---------------|-------|-------------|
46
- | `deployHookFor(feeProjectId, feePercent, salt)` | Anyone | None | Global | Deploys a new hook clone via `LibClone`, calls `initialize()` on it, and registers it in the `JBAddressRegistry`. CREATE2 salt is scoped to `msg.sender`. (Lines 52-84) |
46
+ | `deployHookFor(feeProjectId, feePercent, salt)` | Anyone | None | Global | Deploys a new hook clone via `LibClone`, calls `initialize()` on it, and registers it in the `JBAddressRegistry`. CREATE2 salt is scoped to `msg.sender`. (Lines 53-85) |
47
47
 
48
48
  ### Permissionless Functions (No Privilege Required)
49
49
 
50
50
  | Function | Scope | What It Does |
51
51
  |----------|-------|-------------|
52
- | `collectAndRouteLPFees(projectId, terminalToken)` | Per-project, per-terminal-token | Collects accrued V4 position fees and routes them: `FEE_PERCENT` of terminal token fees to the fee project via `terminal.pay()`, the remainder to the original project via `addToBalanceOf()`. Project token fees are burned. Safe because funds always go to verified project terminals. (Lines 459-488) |
52
+ | `collectAndRouteLPFees(projectId, terminalToken)` | Per-project, per-terminal-token | Collects accrued V4 position fees and routes them: `FEE_PERCENT` of terminal token fees to the fee project via `terminal.pay()`, the remainder to the original project via `addToBalanceOf()`. Project token fees are burned. Safe because funds always go to verified project terminals. (Lines 509-549) |
53
53
  | `isPoolDeployed(projectId, terminalToken)` | View | Returns whether `tokenIdOf[projectId][terminalToken] != 0`. |
54
54
  | `poolKeyOf(projectId, terminalToken)` | View | Returns the stored `PoolKey` for a deployed pool. |
55
55
  | `supportsInterface(interfaceId)` | View | Returns `true` for `IJBUniswapV4LPSplitHook` and `IJBSplitHook`. |
@@ -63,19 +63,19 @@ These values are set at deploy time and cannot be changed afterward.
63
63
 
64
64
  | Parameter | Set In | Value Source |
65
65
  |-----------|--------|-------------|
66
- | `DIRECTORY` | Constructor (line 168) | JBDirectory address |
67
- | `TOKENS` | Constructor (line 169) | JBTokens address |
68
- | `POOL_MANAGER` | Constructor (line 170) | Uniswap V4 PoolManager address |
69
- | `POSITION_MANAGER` | Constructor (line 171) | Uniswap V4 PositionManager address |
70
- | `ORACLE_HOOK` | Constructor (line 183) | Oracle hook (`IHooks`) for all JB V4 pools. Set in `PoolKey.hooks` when creating pools. Provides TWAP via `observe()`. |
71
- | `PERMISSIONS` | Inherited from `JBPermissioned` constructor (line 161) | JBPermissions address |
66
+ | `DIRECTORY` | Constructor (line 202) | JBDirectory address |
67
+ | `TOKENS` | Constructor (line 207) | JBTokens address |
68
+ | `POOL_MANAGER` | Constructor (line 205) | Uniswap V4 PoolManager address |
69
+ | `POSITION_MANAGER` | Constructor (line 206) | Uniswap V4 PositionManager address |
70
+ | `ORACLE_HOOK` | Constructor (line 203) | Oracle hook (`IHooks`) for all JB V4 pools. Set in `PoolKey.hooks` when creating pools. Provides TWAP via `observe()`. |
71
+ | `PERMISSIONS` | Inherited from `JBPermissioned` constructor (line 195) | JBPermissions address |
72
72
 
73
73
  ### Clone-Level (initialize(), Per-Instance)
74
74
 
75
75
  | Parameter | Set In | Value Source |
76
76
  |-----------|--------|-------------|
77
- | `FEE_PROJECT_ID` | `initialize()` (line 192) | Project ID receiving LP fee share |
78
- | `FEE_PERCENT` | `initialize()` (line 193) | Basis points (0-10000) of LP fees routed to fee project |
77
+ | `FEE_PROJECT_ID` | `initialize()` (line 230) | Project ID receiving LP fee share |
78
+ | `FEE_PERCENT` | `initialize()` (line 231) | Basis points (0-10000) of LP fees routed to fee project |
79
79
 
80
80
  ### Protocol Constants (Hardcoded)
81
81
 
package/README.md CHANGED
@@ -130,8 +130,14 @@ test/
130
130
  IntegrationLifecycle.t.sol # Full end-to-end workflow
131
131
  Fork.t.sol # Fork tests with real V4 + JB core
132
132
  fork/GeomeanLPFork.t.sol # Geometric mean pricing fork tests
133
+ fork/TickBoundsAndFeeFork.t.sol # Tick bounds and fee fork tests
134
+ invariant/LPSplitHookInvariant.t.sol # Invariant/fuzz tests
133
135
  TestBaseV4.sol # Shared test infrastructure
134
- regression/ # Targeted regression tests
136
+ regression/
137
+ FeeProjectIdValidation.t.sol # Fee project ID validation
138
+ ReinitAfterRenounce.t.sol # Re-init after renounce
139
+ StaleTokenIdOf.t.sol # Stale tokenIdOf regression
140
+ TickBoundsInversion.t.sol # Tick bounds inversion
135
141
  script/
136
142
  Deploy.s.sol # Sphinx deployment script
137
143
  ```
package/SKILLS.md CHANGED
@@ -23,7 +23,7 @@ Juicebox reserved-token split hook that accumulates project tokens, deploys a Un
23
23
 
24
24
  | Function | What it does |
25
25
  |----------|-------------|
26
- | `deployPool(projectId, terminalToken, amount0Min, amount1Min, minCashOutReturn)` | Requires `SET_BUYBACK_POOL` permission unless the current ruleset's weight has decayed to 1/10th or less of `initialWeightOf[projectId]` (becomes permissionless). Creates V4 pool at geometric mean of [cashOut, issuance] rates. Computes optimal cash-out fraction, cashes out tokens via terminal, mints concentrated LP position, handles leftovers (burns project tokens, adds terminal tokens to project balance). Once a pool exists, a different `terminalToken` for the same project is rejected. |
26
+ | `deployPool(projectId, terminalToken, minCashOutReturn)` | Requires `SET_BUYBACK_POOL` permission unless the current ruleset's weight has decayed to 1/10th or less of `initialWeightOf[projectId]` (becomes permissionless). Creates V4 pool at geometric mean of [cashOut, issuance] rates. Computes optimal cash-out fraction, cashes out tokens via terminal, mints concentrated LP position, handles leftovers (burns project tokens, adds terminal tokens to project balance). Once a pool exists, a different `terminalToken` for the same project is rejected. |
27
27
 
28
28
  ### Fee Management
29
29
 
@@ -175,8 +175,6 @@ IJBUniswapV4LPSplitHook hook = deployer.deployHookFor({
175
175
  hook.deployPool({
176
176
  projectId: projectId,
177
177
  terminalToken: JBConstants.NATIVE_TOKEN, // ETH
178
- amount0Min: 0, // slippage (0 = no check)
179
- amount1Min: 0, // slippage (0 = no check)
180
178
  minCashOutReturn: 0 // 0 = auto 3% tolerance
181
179
  });
182
180
 
@@ -190,9 +188,7 @@ hook.rebalanceLiquidity({
190
188
  projectId: projectId,
191
189
  terminalToken: JBConstants.NATIVE_TOKEN,
192
190
  decreaseAmount0Min: 0,
193
- decreaseAmount1Min: 0,
194
- increaseAmount0Min: 0,
195
- increaseAmount1Min: 0
191
+ decreaseAmount1Min: 0
196
192
  });
197
193
 
198
194
  // --- Claim accumulated fee-project tokens (requires permission) ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananapus/univ4-lp-split-hook-v6",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",