@bananapus/core-v6 0.0.16 → 0.0.17

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.
Files changed (43) hide show
  1. package/ADMINISTRATION.md +1 -1
  2. package/ARCHITECTURE.md +2 -1
  3. package/AUDIT_INSTRUCTIONS.md +342 -0
  4. package/CHANGE_LOG.md +375 -0
  5. package/README.md +4 -4
  6. package/RISKS.md +171 -50
  7. package/SKILLS.md +9 -6
  8. package/USER_JOURNEYS.md +622 -0
  9. package/package.json +2 -2
  10. package/script/DeployPeriphery.s.sol +7 -1
  11. package/src/JBController.sol +5 -0
  12. package/src/JBDeadline.sol +3 -0
  13. package/src/JBDirectory.sol +2 -1
  14. package/src/JBMultiTerminal.sol +50 -9
  15. package/src/JBPermissions.sol +2 -0
  16. package/src/JBPrices.sol +8 -2
  17. package/src/JBRulesets.sol +3 -0
  18. package/src/JBSplits.sol +9 -5
  19. package/src/JBTerminalStore.sol +54 -47
  20. package/src/JBTokens.sol +3 -0
  21. package/src/interfaces/IJBTerminalStore.sol +3 -0
  22. package/src/libraries/JBFees.sol +2 -0
  23. package/src/libraries/JBMetadataResolver.sol +17 -4
  24. package/src/structs/JBBeforeCashOutRecordedContext.sol +4 -0
  25. package/test/TestAuditResponseDesignProofs.sol +434 -0
  26. package/test/TestDataHookFuzzing.sol +520 -0
  27. package/test/TestFeeFreeCashOutBypass.sol +617 -0
  28. package/test/TestL2SequencerPriceFeed.sol +292 -0
  29. package/test/TestMetadataOffsetOverflow.sol +179 -0
  30. package/test/TestMultiTerminalSurplus.sol +348 -0
  31. package/test/TestPermit2DataHook.t.sol +360 -0
  32. package/test/TestRulesetQueueing.sol +1 -2
  33. package/test/TestRulesetWeightCaching.sol +122 -124
  34. package/test/WeirdTokenTests.t.sol +37 -0
  35. package/test/regression/HoldFeesCashOutReserved.t.sol +415 -0
  36. package/test/regression/WeightCacheBoundary.t.sol +291 -0
  37. package/test/units/static/JBMultiTerminal/TestAddToBalanceOf.sol +2 -2
  38. package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +18 -17
  39. package/test/units/static/JBMultiTerminal/TestPay.sol +6 -4
  40. package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +206 -18
  41. package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +280 -0
  42. package/test/units/static/JBSplits/TestSelfManagedSplitGroups.sol +55 -12
  43. package/test/units/static/JBTerminalStore/TestRecordCashOutsFor.sol +72 -0
package/CHANGE_LOG.md ADDED
@@ -0,0 +1,375 @@
1
+ # nana-core-v6 Changelog (v5 -> v6)
2
+
3
+ This document describes all changes between `nana-core` (v5, Solidity 0.8.23) and `nana-core-v6` (v6, Solidity 0.8.26).
4
+
5
+ ---
6
+
7
+ ## 0. Post-Release Changes
8
+
9
+ ### 0.1 JBSplits -- Self-Auth GroupId Restriction
10
+
11
+ `setSplitGroupsOf` self-auth now requires the upper 96 bits of the `groupId` to be non-zero. The full self-auth check is: `uint160(groupId) == msg.sender && groupId >> 160 != 0`. GroupIds with zero upper 96 bits (bare addresses like `uint256(uint160(tokenAddress))`) are protocol-reserved for terminal payout groups and always require controller authorization. This prevents accepted token contracts from writing a project's payout splits without controller auth. The 721 hook is unaffected since it already uses `hookAddress | tierId << 160` (non-zero upper bits).
12
+
13
+ ---
14
+
15
+ ## 1. Breaking Changes
16
+
17
+ ### 1.1 Interface Signature Changes
18
+
19
+ #### IJBRulesets
20
+
21
+ | Change | v5 | v6 |
22
+ |--------|----|----|
23
+ | `updateRulesetWeightCache` signature | `updateRulesetWeightCache(uint256 projectId)` | `updateRulesetWeightCache(uint256 projectId, uint256 rulesetId)` |
24
+
25
+ A `rulesetId` parameter was added. Callers must now specify which ruleset to cache the weight for. This should be the ruleset that `currentOf()` actually uses (which may differ from `latestRulesetIdOf` if the latest was rejected by an approval hook).
26
+
27
+ #### IJBTerminalStore
28
+
29
+ | Change | v5 | v6 |
30
+ |--------|----|----|
31
+ | `currentReclaimableSurplusOf` parameter rename | `uint256 tokenCount` (4-param overload) | `uint256 cashOutCount` |
32
+
33
+ The parameter was renamed from `tokenCount` to `cashOutCount` in the simple 4-parameter overload.
34
+
35
+ #### IJBPayoutTerminal
36
+
37
+ | Change | v5 | v6 |
38
+ |--------|----|----|
39
+ | `sendPayoutsOf` return value | `returns (uint256 netLeftoverPayoutAmount)` | `returns (uint256 amountPaidOut)` |
40
+
41
+ The return value semantics changed: v5 returned the net leftover payout amount (sent to the project owner), while v6 returns the total amount paid out.
42
+
43
+ #### IJBController
44
+
45
+ | Change | v5 | v6 |
46
+ |--------|----|----|
47
+ | `launchProjectFor` terminal configs | `JBTerminalConfig[] memory terminalConfigurations` | `JBTerminalConfig[] calldata terminalConfigurations` |
48
+ | `launchRulesetsFor` terminal configs | `JBTerminalConfig[] memory terminalConfigurations` | `JBTerminalConfig[] calldata terminalConfigurations` |
49
+
50
+ Parameters changed from `memory` to `calldata` for gas efficiency.
51
+
52
+ #### IJBSplits
53
+
54
+ | Change | v5 | v6 |
55
+ |--------|----|----|
56
+ | `setSplitGroupsOf` splits param | `JBSplitGroup[] memory splitGroups` | `JBSplitGroup[] calldata splitGroups` |
57
+
58
+ #### IJBFundAccessLimits
59
+
60
+ | Change | v5 | v6 |
61
+ |--------|----|----|
62
+ | `setFundAccessLimitsFor` param | `JBFundAccessLimitGroup[] memory fundAccessLimitGroups` | `JBFundAccessLimitGroup[] calldata fundAccessLimitGroups` |
63
+
64
+ ### 1.2 Removed Errors
65
+
66
+ | Contract | v5 Error | v6 Replacement |
67
+ |----------|----------|----------------|
68
+ | `JBMultiTerminal` | `JBMultiTerminal_ZeroAccountingContextDecimals()` | `JBMultiTerminal_AccountingContextDecimalsMismatch()` |
69
+
70
+ ---
71
+
72
+ ## 2. New Features
73
+
74
+ ### 2.1 New Functions
75
+
76
+ #### IJBController / JBController
77
+
78
+ | Function | Description |
79
+ |----------|-------------|
80
+ | `setTokenMetadataOf(uint256 projectId, string name, string symbol)` | Sets the name and symbol of a project's ERC-20 token. Requires the `SET_TOKEN_METADATA` permission. |
81
+ | `afterReceiveMigrationFrom(IERC165 from, uint256 projectId)` | Called by the directory after this controller has been set as the active controller. Added to the `IJBMigratable` interface. |
82
+
83
+ #### IJBTokens / JBTokens
84
+
85
+ | Function | Description |
86
+ |----------|-------------|
87
+ | `setTokenMetadataFor(uint256 projectId, string name, string symbol)` | Sets the name and symbol of a project's token. Only callable by the project's controller. |
88
+
89
+ #### IJBToken / JBERC20
90
+
91
+ | Function | Description |
92
+ |----------|-------------|
93
+ | `setMetadata(string name, string symbol)` | Sets the token's name and symbol. Only callable by the token's owner (JBTokens). |
94
+
95
+ #### IJBMigratable
96
+
97
+ | Function | Description |
98
+ |----------|-------------|
99
+ | `afterReceiveMigrationFrom(IERC165 from, uint256 projectId)` | New lifecycle hook called after a controller migration completes. |
100
+
101
+ #### JBCashOuts (Library)
102
+
103
+ | Function | Description |
104
+ |----------|-------------|
105
+ | `minCashOutCountFor(uint256 surplus, uint256 desiredOutput, uint256 totalSupply, uint256 cashOutTaxRate)` | Inverse bonding curve: returns the minimum number of tokens to cash out to receive at least `desiredOutput`. Uses binary search for the general case. |
106
+
107
+ ### 2.2 New Events
108
+
109
+ | Contract | Event |
110
+ |----------|-------|
111
+ | `IJBTokens` | `SetTokenMetadata(uint256 indexed projectId, string name, string symbol, address caller)` |
112
+ | `IJBPermitTerminal` | `Permit2AllowanceFailed(address indexed token, address indexed owner, bytes reason)` |
113
+
114
+ ### 2.3 New Errors
115
+
116
+ | Contract | Error |
117
+ |----------|-------|
118
+ | `JBController` | `JBController_TerminalTokensNotTransferred()` |
119
+ | `JBMultiTerminal` | `JBMultiTerminal_AccountingContextDecimalsMismatch()` |
120
+ | `JBRulesets` | `JBRulesets_WeightCacheRequired(uint256 projectId)` |
121
+ | `JBTerminalStore` | `JBTerminalStore_Uint224Overflow(uint256 value)` |
122
+ | `JBCashOuts` | `JBCashOuts_DesiredOutputNotAchievable()` |
123
+ | `JBERC20` | `JBERC20_AlreadyInitialized()` |
124
+
125
+ ### 2.4 New Permission IDs
126
+
127
+ | Permission | Description |
128
+ |------------|-------------|
129
+ | `LAUNCH_RULESETS` | Required for `launchRulesetsFor`. In v5, `QUEUE_RULESETS` was used. |
130
+ | `SET_TOKEN_METADATA` | Required for `setTokenMetadataOf`. |
131
+
132
+ ---
133
+
134
+ ## 3. Event Changes
135
+
136
+ ### 3.1 New Events
137
+
138
+ See section 2.2 above.
139
+
140
+ ### 3.2 Modified Events
141
+
142
+ | Contract | Event | Change |
143
+ |----------|-------|--------|
144
+ | `IJBCashOutTerminal` | `CashOut` | Event order changed in the interface (moved before `HookAfterRecordCashOut`); NatSpec added. No field changes. |
145
+ | `IJBCashOutTerminal` | `HookAfterRecordCashOut` | Event order changed in the interface (moved after `CashOut`); NatSpec added. No field changes. |
146
+
147
+ ### 3.3 All Interfaces Gained NatSpec
148
+
149
+ Every interface file in v6 has comprehensive NatSpec documentation added to all functions, events, errors, and return values. This is a documentation-only change that does not affect the ABI.
150
+
151
+ ---
152
+
153
+ ## 4. Error Changes
154
+
155
+ ### 4.1 Errors with Added Parameters (More Informative Reverts)
156
+
157
+ | Contract | v5 | v6 |
158
+ |----------|----|----|
159
+ | `JBController` | `JBController_AddingPriceFeedNotAllowed()` | `JBController_AddingPriceFeedNotAllowed(uint256 projectId)` |
160
+ | `JBController` | `JBController_MintNotAllowedAndNotTerminalOrHook()` | `JBController_MintNotAllowedAndNotTerminalOrHook(address caller)` |
161
+ | `JBController` | `JBController_RulesetsAlreadyLaunched()` | `JBController_RulesetsAlreadyLaunched(uint256 projectId)` |
162
+ | `JBController` | `JBController_RulesetSetTokenNotAllowed()` | `JBController_RulesetSetTokenNotAllowed(uint256 projectId)` |
163
+ | `JBMultiTerminal` | `JBMultiTerminal_FeeTerminalNotFound()` | `JBMultiTerminal_FeeTerminalNotFound(address token)` |
164
+ | `JBMultiTerminal` | `JBMultiTerminal_TerminalTokensIncompatible()` | `JBMultiTerminal_TerminalTokensIncompatible(uint256 projectId, address token, IJBTerminal terminal)` |
165
+ | `JBDirectory` | `JBDirectory_SetControllerNotAllowed()` | `JBDirectory_SetControllerNotAllowed(uint256 projectId)` |
166
+ | `JBDirectory` | `JBDirectory_SetTerminalsNotAllowed()` | `JBDirectory_SetTerminalsNotAllowed(uint256 projectId)` |
167
+ | `JBSplits` | `JBSplits_PreviousLockedSplitsNotIncluded()` | `JBSplits_PreviousLockedSplitsNotIncluded(uint256 projectId, uint256 rulesetId)` |
168
+ | `JBTokens` | `JBTokens_EmptyToken()` | `JBTokens_EmptyToken(uint256 projectId)` |
169
+ | `JBTerminalStore` | `JBTerminalStore_RulesetNotFound()` | `JBTerminalStore_RulesetNotFound(uint256 projectId)` |
170
+ | `JBPermissions` | `JBPermissions_Unauthorized()` | `JBPermissions_Unauthorized(address account, address operator, uint256 projectId, uint256 permissionId)` |
171
+
172
+ ### 4.2 Renamed Errors
173
+
174
+ | Contract | v5 | v6 |
175
+ |----------|----|----|
176
+ | `JBMultiTerminal` | `JBMultiTerminal_ZeroAccountingContextDecimals()` | `JBMultiTerminal_AccountingContextDecimalsMismatch()` |
177
+
178
+ ### 4.3 Removed Errors
179
+
180
+ | Contract | Error | Notes |
181
+ |----------|-------|-------|
182
+ | `JBMultiTerminal` | `JBMultiTerminal_ZeroAccountingContextDecimals()` | Replaced by `AccountingContextDecimalsMismatch` |
183
+
184
+ ### 4.4 New Errors
185
+
186
+ See section 2.3 above.
187
+
188
+ ---
189
+
190
+ ## 5. Struct Changes
191
+
192
+ All structs are **identical** between v5 and v6. The only differences are:
193
+ - `forge-lint: disable-next-line(pascal-case-struct)` comments added to all struct definitions.
194
+ - `JBSplit`: Additional NatSpec documentation on the `beneficiary` field behavior when set to `address(0)`.
195
+
196
+ ---
197
+
198
+ ## 6. Enum Changes
199
+
200
+ `JBApprovalStatus` is **identical** between v5 and v6.
201
+
202
+ ---
203
+
204
+ ## 7. Library Changes
205
+
206
+ ### JBCashOuts
207
+
208
+ | Change | Description |
209
+ |--------|-------------|
210
+ | **New function** `minCashOutCountFor` | Inverse bonding curve calculation using binary search. Returns the minimum tokens to cash out for a desired output. |
211
+ | **New error** `JBCashOuts_DesiredOutputNotAchievable` | Thrown when the cash out tax rate is 100% and no output is possible. |
212
+ | **Bug fix**: Early return for zero `cashOutCount` | `cashOutFrom` now returns `0` immediately when `cashOutCount == 0` (v5 would compute with zero). |
213
+
214
+ ### JBMetadataResolver
215
+
216
+ | Change | Description |
217
+ |--------|-------------|
218
+ | Assembly blocks marked `"memory-safe"` | All inline assembly blocks now use the `assembly ("memory-safe")` annotation. |
219
+ | **Bug fix**: `_sliceBytes` copy loop | The loop bound changed from `end` (absolute source offset) to `length` (relative), preventing over-copy past the allocated buffer. |
220
+ | **Bug fix**: Overflow protection | Offset increment now checks for `> 255` overflow before casting to `uint8`, reverting with `JBMetadataResolver_MetadataTooLong()`. |
221
+ | **Bug fix**: Memory alignment | Free memory pointer in `_sliceBytes` now rounds up to 32-byte boundary to prevent overlapping allocations. |
222
+ | Empty input handling | `createMetadata` now returns empty bytes for empty input arrays. |
223
+ | Named parameters in `_sliceBytes` calls | All calls now use named parameters (`data:`, `start:`, `end:`). |
224
+
225
+ ### JBRulesetMetadataResolver
226
+
227
+ | Change | Description |
228
+ |--------|-------------|
229
+ | Bit 77 comment fix | Changed from "allow controller migration" to "owner must send payouts" to match actual bit semantics. |
230
+ | `baseCurrency` range comment fix | Changed from `0-16777215` (24-bit) to `0-4294967295` (32-bit). |
231
+ | `currency` range comment fix | Changed from `0-4294967296` to `0-4294967295`. |
232
+ | Named field syntax | `expandMetadata()` now uses named field syntax (`reservedPercent:`, etc.) instead of positional. |
233
+
234
+ ### JBFees
235
+
236
+ | Change | Description |
237
+ |--------|-------------|
238
+ | NatSpec improvements | Clarified that `feeAmountFrom` forward-calculates and `feeAmountIn` back-calculates. Added documentation about rounding bounds. |
239
+
240
+ ### JBSurplus
241
+
242
+ | Change | Description |
243
+ |--------|-------------|
244
+ | Typo fix | `termainls` -> `terminals`. |
245
+
246
+ ### JBConstants, JBFixedPointNumber, JBSplitGroupIds, JBCurrencyIds
247
+
248
+ No changes.
249
+
250
+ ---
251
+
252
+ ## 8. Implementation Changes (Non-Interface)
253
+
254
+ ### 8.1 JBController
255
+
256
+ | Change | Description |
257
+ |--------|-------------|
258
+ | **Migration lifecycle** | `afterReceiveMigrationFrom` added — called by directory after migration completes (validates caller is directory). |
259
+ | **`launchRulesetsFor` permission** | Changed from `QUEUE_RULESETS` to `LAUNCH_RULESETS`. |
260
+ | **Split token transfer assertion** | `assert(allowance == 0)` replaced with explicit `revert JBController_TerminalTokensNotTransferred()`. |
261
+ | **Code organization** | External views moved after external transactions. Internal views moved to end of file. |
262
+
263
+ ### 8.2 JBMultiTerminal
264
+
265
+ | Change | Description |
266
+ |--------|-------------|
267
+ | **Decimal validation** | `ZeroAccountingContextDecimals` renamed to `AccountingContextDecimalsMismatch`. Non-standard ERC-20s that revert on `decimals()` bypass validation (documented). |
268
+ | **Permit2 failure event** | Failed Permit2 allowance approvals now emit `Permit2AllowanceFailed` instead of silently catching. |
269
+ | **Migration held fees** | Migration intentionally does not transfer held fees (documented: held fees belong to fee beneficiary, not the migrating project). |
270
+ | **Held fee processing (reentrancy hardening)** | `processHeldFeesOf` now re-reads the storage index each iteration (instead of caching), deletes the entry before the external call, and updates the index before the external call. |
271
+ | **Split payout documentation** | Failed split payouts documented as consuming payout limit by design. |
272
+
273
+ ### 8.3 JBRulesets
274
+
275
+ | Change | Description |
276
+ |--------|-------------|
277
+ | **Cache threshold** | `_WEIGHT_CUT_MULTIPLE_CACHE_LOOKUP_THRESHOLD` increased from `1,000` to `20,000`. |
278
+ | **Cache cap removed** | `_MAX_WEIGHT_CUT_MULTIPLE_CACHE_THRESHOLD` (`50,000`) removed entirely. |
279
+ | **Weight cache required** | `_deriveWeightFrom` now reverts with `JBRulesets_WeightCacheRequired(projectId)` when iteration count exceeds the threshold, instead of silently iterating. |
280
+ | **Approval hook try/catch** | `_approvalStatusOf` now wraps the external `approvalHook.approvalStatusOf()` call in a try/catch. A reverting approval hook returns `JBApprovalStatus.Failed` instead of propagating the revert. This prevents a malicious or buggy approval hook from permanently freezing a project. |
281
+
282
+ ### 8.4 JBDirectory
283
+
284
+ | Change | Description |
285
+ |--------|-------------|
286
+ | **Migration ordering** | `setControllerOf` now calls `migrate()` on the old controller BEFORE updating `controllerOf` in storage (so `migrate()` runs while the directory still points to the old controller). After updating storage, it calls `afterReceiveMigrationFrom` on the new controller. |
287
+
288
+ ### 8.5 JBTokens
289
+
290
+ | Change | Description |
291
+ |--------|-------------|
292
+ | **Overflow check timing** | `mintFor` now checks `totalSupplyOf(projectId) + count > type(uint208).max` BEFORE minting (v5 checked after). |
293
+
294
+ ### 8.6 JBERC20
295
+
296
+ | Change | Description |
297
+ |--------|-------------|
298
+ | **Named revert** | `initialize()` now reverts with `JBERC20_AlreadyInitialized()` instead of a bare `revert()`. |
299
+
300
+ ### 8.7 JBChainlinkV3PriceFeed
301
+
302
+ | Change | Description |
303
+ |--------|-------------|
304
+ | **Incomplete round check order** | The check for `updatedAt == 0` (incomplete round) now runs BEFORE the stale price check, avoiding false stale errors on incomplete rounds. |
305
+
306
+ ### 8.8 JBChainlinkV3SequencerPriceFeed
307
+
308
+ | Change | Description |
309
+ |--------|-------------|
310
+ | **Typo fix** | Error parameter `gradePeriodTime` corrected to `gracePeriodTime` in `JBChainlinkV3SequencerPriceFeed_SequencerDown`. |
311
+ | **Threshold docs** | Constructor parameter `threshold` documentation corrected from "blocks" to "seconds". |
312
+
313
+ ### 8.9 Solidity Version
314
+
315
+ All contracts upgraded from `pragma solidity 0.8.23` to `pragma solidity 0.8.26`.
316
+
317
+ ### 8.10 Named Arguments
318
+
319
+ Throughout the codebase, function calls were updated to use named argument syntax (e.g., `foo({bar: 1, baz: 2})`) for improved readability.
320
+
321
+ ---
322
+
323
+ ## 9. Migration Table
324
+
325
+ ### Interfaces
326
+
327
+ | v5 | v6 | Notes |
328
+ |----|----|-------|
329
+ | `IJBController` | `IJBController` | Gained `setTokenMetadataOf`. `calldata` for terminal configs. |
330
+ | `IJBRulesets` | `IJBRulesets` | `updateRulesetWeightCache` gained `rulesetId` parameter |
331
+ | `IJBTerminalStore` | `IJBTerminalStore` | `tokenCount` renamed to `cashOutCount` in `currentReclaimableSurplusOf`. View functions reordered. |
332
+ | `IJBPayoutTerminal` | `IJBPayoutTerminal` | `sendPayoutsOf` returns `amountPaidOut` (was `netLeftoverPayoutAmount`). `SendPayoutToSplit` event moved. |
333
+ | `IJBPermitTerminal` | `IJBPermitTerminal` | Gained `Permit2AllowanceFailed` event |
334
+ | `IJBMigratable` | `IJBMigratable` | Gained `afterReceiveMigrationFrom` function |
335
+ | `IJBTokens` | `IJBTokens` | Gained `setTokenMetadataFor`, `SetTokenMetadata` event |
336
+ | `IJBToken` | `IJBToken` | Gained `setMetadata` function |
337
+ | `IJBSplits` | `IJBSplits` | `setSplitGroupsOf` param changed to `calldata` |
338
+ | `IJBFundAccessLimits` | `IJBFundAccessLimits` | `setFundAccessLimitsFor` param changed to `calldata` |
339
+ | `IJBFeelessAddresses` | `IJBFeelessAddresses` | Param names: `account` -> `addr`. NatSpec added. |
340
+ | All other interfaces | Same name | NatSpec documentation added. No functional changes. |
341
+
342
+ ### Contracts
343
+
344
+ | v5 | v6 | Notes |
345
+ |----|----|-------|
346
+ | `JBController` | `JBController` | Token metadata, migration lifecycle (`afterReceiveMigrationFrom`), `LAUNCH_RULESETS` permission |
347
+ | `JBMultiTerminal` | `JBMultiTerminal` | Reentrancy hardening, decimal validation rename, Permit2 event |
348
+ | `JBRulesets` | `JBRulesets` | Approval hook try/catch, weight cache changes, threshold increase |
349
+ | `JBDirectory` | `JBDirectory` | Migration ordering fix, afterReceiveMigration call |
350
+ | `JBTokens` | `JBTokens` | Token metadata support, overflow check timing |
351
+ | `JBERC20` | `JBERC20` | `setMetadata`, named revert |
352
+ | `JBDeadline` | `JBDeadline` | No functional changes |
353
+ | All others | Same name | Error parameter enrichment, named arguments, NatSpec |
354
+
355
+ ### Libraries
356
+
357
+ | v5 | v6 | Notes |
358
+ |----|----|-------|
359
+ | `JBCashOuts` | `JBCashOuts` | Added `minCashOutCountFor` (inverse bonding curve) |
360
+ | `JBMetadataResolver` | `JBMetadataResolver` | Memory safety, overflow protection, copy loop fix |
361
+ | `JBRulesetMetadataResolver` | `JBRulesetMetadataResolver` | Comment fixes, named field syntax |
362
+ | `JBCurrencyIds` | `JBCurrencyIds` | No changes |
363
+ | All others | Same name | No changes |
364
+
365
+ ### Structs
366
+
367
+ | v5 | v6 | Notes |
368
+ |----|----|-------|
369
+ | All 22 structs | Same names, same fields | Only lint comments added |
370
+
371
+ ### Enums
372
+
373
+ | v5 | v6 | Notes |
374
+ |----|----|-------|
375
+ | `JBApprovalStatus` | `JBApprovalStatus` | Identical |
package/README.md CHANGED
@@ -47,7 +47,7 @@ Each ruleset can define a `reservedPercent` (0-10,000 basis points). When tokens
47
47
 
48
48
  `JBPermissions` lets addresses delegate specific capabilities to operators, scoped by project ID. Each permission ID grants access to specific functions. See [`JBPermissionIds`](https://github.com/Bananapus/nana-permission-ids-v6/blob/main/src/JBPermissionIds.sol) for the full list.
49
49
 
50
- - Permission ID `255` is `ROOT` and grants all permissions for the scoped project.
50
+ - Permission ID `1` is `ROOT` and grants all permissions for the scoped project.
51
51
  - Project ID `0` is a wildcard, granting permissions across all projects (cannot be combined with `ROOT` for safety).
52
52
  - ROOT operators can set non-ROOT permissions for other operators, but cannot grant ROOT or set wildcard-project permissions.
53
53
 
@@ -64,9 +64,9 @@ Hooks are customizable contracts that plug into protocol flows:
64
64
  ### Fees
65
65
 
66
66
  `JBMultiTerminal` charges a 2.5% fee (`FEE = 25` out of `MAX_FEE = 1000`) on:
67
- - Payouts to external addresses (not to other Juicebox projects).
67
+ - Payouts to external addresses (not to other Juicebox projects on the same terminal).
68
68
  - Surplus allowance usage.
69
- - Cash outs when the cash out tax rate is below 100%.
69
+ - Cash outs when the cash out tax rate is above 0%. When the cash out tax rate is 0%, fees apply only up to the project's accumulated fee-free intra-terminal payout surplus (`_feeFreeSurplusOf`) — once that surplus is consumed, subsequent cashouts are fee-free.
70
70
 
71
71
  Fees are paid to **project #1** (the fee beneficiary project, minted in the `JBProjects` constructor). Addresses on the `JBFeelessAddresses` allowlist are exempt from fees.
72
72
 
@@ -95,7 +95,7 @@ All contracts use Solidity `0.8.26`.
95
95
  | Contract | Description |
96
96
  |----------|-------------|
97
97
  | `JBProjects` | ERC-721 registry of projects. Minting an NFT creates a project. Optionally mints project #1 to a fee beneficiary owner. |
98
- | `JBPermissions` | Bitmap-based permission system. Accounts grant operators specific permissions scoped to project IDs. Supports ROOT (255) for all-permissions and wildcard project ID (0). |
98
+ | `JBPermissions` | Bitmap-based permission system. Accounts grant operators specific permissions scoped to project IDs. Supports ROOT (1) for all-permissions and wildcard project ID (0). |
99
99
  | `JBDirectory` | Maps each project to its controller and terminals. Entry point for looking up where to interact with a project. Manages an allowlist of addresses permitted to set a project's first controller. |
100
100
  | `JBController` | Coordinates rulesets, tokens, splits, and fund access limits. Entry point for launching projects, queuing rulesets, minting/burning tokens, deploying ERC-20s, updating token metadata, sending reserved tokens, setting project URIs, adding price feeds, and transferring credits. |
101
101
  | `JBMultiTerminal` | Accepts payments (native ETH and ERC-20s), processes cash outs, distributes payouts, manages surplus allowances, and handles fees. Integrates with Permit2 for ERC-20 approvals. |