@bananapus/core-v6 0.0.16 → 0.0.18
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 +1 -1
- package/ARCHITECTURE.md +2 -1
- package/AUDIT_INSTRUCTIONS.md +342 -0
- package/CHANGE_LOG.md +400 -0
- package/README.md +4 -4
- package/RISKS.md +171 -50
- package/SKILLS.md +9 -6
- package/USER_JOURNEYS.md +622 -0
- package/package.json +2 -2
- package/script/DeployPeriphery.s.sol +7 -1
- package/src/JBController.sol +5 -0
- package/src/JBDeadline.sol +3 -0
- package/src/JBDirectory.sol +2 -1
- package/src/JBMultiTerminal.sol +50 -9
- package/src/JBPermissions.sol +2 -0
- package/src/JBPrices.sol +8 -2
- package/src/JBRulesets.sol +3 -0
- package/src/JBSplits.sol +9 -5
- package/src/JBTerminalStore.sol +54 -47
- package/src/JBTokens.sol +3 -0
- package/src/interfaces/IJBTerminalStore.sol +3 -0
- package/src/libraries/JBFees.sol +2 -0
- package/src/libraries/JBMetadataResolver.sol +17 -4
- package/src/structs/JBBeforeCashOutRecordedContext.sol +4 -0
- package/test/TestAuditResponseDesignProofs.sol +434 -0
- package/test/TestDataHookFuzzing.sol +520 -0
- package/test/TestFeeFreeCashOutBypass.sol +617 -0
- package/test/TestL2SequencerPriceFeed.sol +292 -0
- package/test/TestMetadataOffsetOverflow.sol +179 -0
- package/test/TestMultiTerminalSurplus.sol +348 -0
- package/test/TestPermit2DataHook.t.sol +360 -0
- package/test/TestRulesetQueueing.sol +1 -2
- package/test/TestRulesetWeightCaching.sol +122 -124
- package/test/WeirdTokenTests.t.sol +37 -0
- package/test/regression/HoldFeesCashOutReserved.t.sol +415 -0
- package/test/regression/WeightCacheBoundary.t.sol +291 -0
- package/test/units/static/JBMultiTerminal/TestAddToBalanceOf.sol +2 -2
- package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +18 -17
- package/test/units/static/JBMultiTerminal/TestPay.sol +6 -4
- package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +206 -18
- package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +280 -0
- package/test/units/static/JBSplits/TestSelfManagedSplitGroups.sol +55 -12
- package/test/units/static/JBTerminalStore/TestRecordCashOutsFor.sol +72 -0
- package/docs/book.css +0 -13
- package/docs/book.toml +0 -12
- package/docs/solidity.min.js +0 -74
- package/docs/src/README.md +0 -703
- package/docs/src/SUMMARY.md +0 -94
- package/docs/src/src/JBChainlinkV3PriceFeed.sol/contract.JBChainlinkV3PriceFeed.md +0 -83
- package/docs/src/src/JBChainlinkV3SequencerPriceFeed.sol/contract.JBChainlinkV3SequencerPriceFeed.md +0 -88
- package/docs/src/src/JBController.sol/contract.JBController.md +0 -1121
- package/docs/src/src/JBDeadline.sol/contract.JBDeadline.md +0 -84
- package/docs/src/src/JBDirectory.sol/contract.JBDirectory.md +0 -294
- package/docs/src/src/JBERC20.sol/contract.JBERC20.md +0 -190
- package/docs/src/src/JBFeelessAddresses.sol/contract.JBFeelessAddresses.md +0 -80
- package/docs/src/src/JBFundAccessLimits.sol/contract.JBFundAccessLimits.md +0 -253
- package/docs/src/src/JBMultiTerminal.sol/contract.JBMultiTerminal.md +0 -1472
- package/docs/src/src/JBPermissions.sol/contract.JBPermissions.md +0 -199
- package/docs/src/src/JBPrices.sol/contract.JBPrices.md +0 -154
- package/docs/src/src/JBProjects.sol/contract.JBProjects.md +0 -131
- package/docs/src/src/JBRulesets.sol/contract.JBRulesets.md +0 -677
- package/docs/src/src/JBSplits.sol/contract.JBSplits.md +0 -237
- package/docs/src/src/JBTerminalStore.sol/contract.JBTerminalStore.md +0 -591
- package/docs/src/src/JBTokens.sol/contract.JBTokens.md +0 -353
- package/docs/src/src/README.md +0 -25
- package/docs/src/src/abstract/JBControlled.sol/abstract.JBControlled.md +0 -64
- package/docs/src/src/abstract/JBPermissioned.sol/abstract.JBPermissioned.md +0 -84
- package/docs/src/src/abstract/README.md +0 -5
- package/docs/src/src/enums/JBApprovalStatus.sol/enum.JBApprovalStatus.md +0 -17
- package/docs/src/src/enums/README.md +0 -4
- package/docs/src/src/interfaces/IJBCashOutHook.sol/interface.IJBCashOutHook.md +0 -29
- package/docs/src/src/interfaces/IJBCashOutTerminal.sol/interface.IJBCashOutTerminal.md +0 -57
- package/docs/src/src/interfaces/IJBControlled.sol/interface.IJBControlled.md +0 -12
- package/docs/src/src/interfaces/IJBController.sol/interface.IJBController.md +0 -334
- package/docs/src/src/interfaces/IJBDirectory.sol/interface.IJBDirectory.md +0 -108
- package/docs/src/src/interfaces/IJBDirectoryAccessControl.sol/interface.IJBDirectoryAccessControl.md +0 -19
- package/docs/src/src/interfaces/IJBFeeTerminal.sol/interface.IJBFeeTerminal.md +0 -91
- package/docs/src/src/interfaces/IJBFeelessAddresses.sol/interface.IJBFeelessAddresses.md +0 -26
- package/docs/src/src/interfaces/IJBFundAccessLimits.sol/interface.IJBFundAccessLimits.md +0 -88
- package/docs/src/src/interfaces/IJBMigratable.sol/interface.IJBMigratable.md +0 -29
- package/docs/src/src/interfaces/IJBMultiTerminal.sol/interface.IJBMultiTerminal.md +0 -50
- package/docs/src/src/interfaces/IJBPayHook.sol/interface.IJBPayHook.md +0 -28
- package/docs/src/src/interfaces/IJBPayoutTerminal.sol/interface.IJBPayoutTerminal.md +0 -105
- package/docs/src/src/interfaces/IJBPermissioned.sol/interface.IJBPermissioned.md +0 -12
- package/docs/src/src/interfaces/IJBPermissions.sol/interface.IJBPermissions.md +0 -74
- package/docs/src/src/interfaces/IJBPermitTerminal.sol/interface.IJBPermitTerminal.md +0 -15
- package/docs/src/src/interfaces/IJBPriceFeed.sol/interface.IJBPriceFeed.md +0 -12
- package/docs/src/src/interfaces/IJBPrices.sol/interface.IJBPrices.md +0 -74
- package/docs/src/src/interfaces/IJBProjectUriRegistry.sol/interface.IJBProjectUriRegistry.md +0 -19
- package/docs/src/src/interfaces/IJBProjects.sol/interface.IJBProjects.md +0 -49
- package/docs/src/src/interfaces/IJBRulesetApprovalHook.sol/interface.IJBRulesetApprovalHook.md +0 -35
- package/docs/src/src/interfaces/IJBRulesetDataHook.sol/interface.IJBRulesetDataHook.md +0 -97
- package/docs/src/src/interfaces/IJBRulesets.sol/interface.IJBRulesets.md +0 -165
- package/docs/src/src/interfaces/IJBSplitHook.sol/interface.IJBSplitHook.md +0 -31
- package/docs/src/src/interfaces/IJBSplits.sol/interface.IJBSplits.md +0 -35
- package/docs/src/src/interfaces/IJBTerminal.sol/interface.IJBTerminal.md +0 -141
- package/docs/src/src/interfaces/IJBTerminalStore.sol/interface.IJBTerminalStore.md +0 -198
- package/docs/src/src/interfaces/IJBToken.sol/interface.IJBToken.md +0 -54
- package/docs/src/src/interfaces/IJBTokenUriResolver.sol/interface.IJBTokenUriResolver.md +0 -12
- package/docs/src/src/interfaces/IJBTokens.sol/interface.IJBTokens.md +0 -151
- package/docs/src/src/interfaces/README.md +0 -33
- package/docs/src/src/libraries/JBCashOuts.sol/library.JBCashOuts.md +0 -40
- package/docs/src/src/libraries/JBConstants.sol/library.JBConstants.md +0 -52
- package/docs/src/src/libraries/JBCurrencyIds.sol/library.JBCurrencyIds.md +0 -19
- package/docs/src/src/libraries/JBFees.sol/library.JBFees.md +0 -52
- package/docs/src/src/libraries/JBFixedPointNumber.sol/library.JBFixedPointNumber.md +0 -12
- package/docs/src/src/libraries/JBMetadataResolver.sol/library.JBMetadataResolver.md +0 -242
- package/docs/src/src/libraries/JBRulesetMetadataResolver.sol/library.JBRulesetMetadataResolver.md +0 -180
- package/docs/src/src/libraries/JBSplitGroupIds.sol/library.JBSplitGroupIds.md +0 -14
- package/docs/src/src/libraries/JBSurplus.sol/library.JBSurplus.md +0 -44
- package/docs/src/src/libraries/README.md +0 -12
- package/docs/src/src/periphery/JBDeadline1Day.sol/contract.JBDeadline1Day.md +0 -15
- package/docs/src/src/periphery/JBDeadline3Days.sol/contract.JBDeadline3Days.md +0 -15
- package/docs/src/src/periphery/JBDeadline3Hours.sol/contract.JBDeadline3Hours.md +0 -15
- package/docs/src/src/periphery/JBDeadline7Days.sol/contract.JBDeadline7Days.md +0 -15
- package/docs/src/src/periphery/JBMatchingPriceFeed.sol/contract.JBMatchingPriceFeed.md +0 -22
- package/docs/src/src/periphery/README.md +0 -8
- package/docs/src/src/structs/JBAccountingContext.sol/struct.JBAccountingContext.md +0 -20
- package/docs/src/src/structs/JBAfterCashOutRecordedContext.sol/struct.JBAfterCashOutRecordedContext.md +0 -43
- package/docs/src/src/structs/JBAfterPayRecordedContext.sol/struct.JBAfterPayRecordedContext.md +0 -42
- package/docs/src/src/structs/JBBeforeCashOutRecordedContext.sol/struct.JBBeforeCashOutRecordedContext.md +0 -45
- package/docs/src/src/structs/JBBeforePayRecordedContext.sol/struct.JBBeforePayRecordedContext.md +0 -41
- package/docs/src/src/structs/JBCashOutHookSpecification.sol/struct.JBCashOutHookSpecification.md +0 -22
- package/docs/src/src/structs/JBCurrencyAmount.sol/struct.JBCurrencyAmount.md +0 -17
- package/docs/src/src/structs/JBFee.sol/struct.JBFee.md +0 -20
- package/docs/src/src/structs/JBFundAccessLimitGroup.sol/struct.JBFundAccessLimitGroup.md +0 -39
- package/docs/src/src/structs/JBPayHookSpecification.sol/struct.JBPayHookSpecification.md +0 -22
- package/docs/src/src/structs/JBPermissionsData.sol/struct.JBPermissionsData.md +0 -21
- package/docs/src/src/structs/JBRuleset.sol/struct.JBRuleset.md +0 -55
- package/docs/src/src/structs/JBRulesetConfig.sol/struct.JBRulesetConfig.md +0 -51
- package/docs/src/src/structs/JBRulesetMetadata.sol/struct.JBRulesetMetadata.md +0 -79
- package/docs/src/src/structs/JBRulesetWeightCache.sol/struct.JBRulesetWeightCache.md +0 -16
- package/docs/src/src/structs/JBRulesetWithMetadata.sol/struct.JBRulesetWithMetadata.md +0 -16
- package/docs/src/src/structs/JBSingleAllowance.sol/struct.JBSingleAllowance.md +0 -26
- package/docs/src/src/structs/JBSplit.sol/struct.JBSplit.md +0 -49
- package/docs/src/src/structs/JBSplitGroup.sol/struct.JBSplitGroup.md +0 -17
- package/docs/src/src/structs/JBSplitHookContext.sol/struct.JBSplitHookContext.md +0 -29
- package/docs/src/src/structs/JBTerminalConfig.sol/struct.JBTerminalConfig.md +0 -16
- package/docs/src/src/structs/JBTokenAmount.sol/struct.JBTokenAmount.md +0 -23
- package/docs/src/src/structs/README.md +0 -25
package/CHANGE_LOG.md
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
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
|
+
### 0.2 JBMultiTerminal -- Fee-Free Cashout Bypass Prevention
|
|
14
|
+
|
|
15
|
+
A new `_feeFreeSurplusOf` mapping (`projectId => token => uint256`) tracks cumulative fee-free intra-terminal payouts received by each project. When a split payout lands on the same terminal (intra-terminal routing, i.e. `terminal == this`), the net payout amount is added to `_feeFreeSurplusOf[projectId][token]`. During a cashout with `cashOutTaxRate == 0`, fees are now charged on the reclaim amount up to the tracked fee-free surplus (and the tracker is decremented accordingly). Cashouts beyond the fee-free surplus remain fee-free. This closes a round-trip fee bypass where funds could be routed fee-free into a project via an intra-terminal split payout and then cashed out fee-free via a zero-tax cashout.
|
|
16
|
+
|
|
17
|
+
### 0.3 JBBeforeCashOutRecordedContext -- beneficiaryIsFeeless Field
|
|
18
|
+
|
|
19
|
+
A `bool beneficiaryIsFeeless` field was added to the `JBBeforeCashOutRecordedContext` struct (before the `metadata` field). `recordCashOutFor` in `IJBTerminalStore` gained a corresponding `bool beneficiaryIsFeeless` parameter. The terminal passes the result of its feeless address check, allowing data hooks to skip their own fees when the beneficiary is already feeless (e.g., project-to-project routing via the router terminal). This is a **breaking change** to both the struct layout and the `recordCashOutFor` function signature.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1. Breaking Changes
|
|
24
|
+
|
|
25
|
+
### 1.1 Interface Signature Changes
|
|
26
|
+
|
|
27
|
+
#### IJBRulesets
|
|
28
|
+
|
|
29
|
+
| Change | v5 | v6 |
|
|
30
|
+
|--------|----|----|
|
|
31
|
+
| `updateRulesetWeightCache` signature | `updateRulesetWeightCache(uint256 projectId)` | `updateRulesetWeightCache(uint256 projectId, uint256 rulesetId)` |
|
|
32
|
+
|
|
33
|
+
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).
|
|
34
|
+
|
|
35
|
+
#### IJBTerminalStore
|
|
36
|
+
|
|
37
|
+
| Change | v5 | v6 |
|
|
38
|
+
|--------|----|----|
|
|
39
|
+
| `currentReclaimableSurplusOf` parameter rename | `uint256 tokenCount` (4-param overload) | `uint256 cashOutCount` |
|
|
40
|
+
| `recordCashOutFor` new parameter | No `beneficiaryIsFeeless` parameter | `bool beneficiaryIsFeeless` added after `balanceAccountingContexts` |
|
|
41
|
+
|
|
42
|
+
The parameter was renamed from `tokenCount` to `cashOutCount` in the simple 4-parameter overload.
|
|
43
|
+
|
|
44
|
+
`recordCashOutFor` gained a `bool beneficiaryIsFeeless` parameter so the terminal can pass through its feeless address check to data hooks via the `JBBeforeCashOutRecordedContext` struct.
|
|
45
|
+
|
|
46
|
+
#### IJBPayoutTerminal
|
|
47
|
+
|
|
48
|
+
| Change | v5 | v6 |
|
|
49
|
+
|--------|----|----|
|
|
50
|
+
| `sendPayoutsOf` return value | `returns (uint256 netLeftoverPayoutAmount)` | `returns (uint256 amountPaidOut)` |
|
|
51
|
+
|
|
52
|
+
The return variable name was corrected from `netLeftoverPayoutAmount` to `amountPaidOut` to match the actual implementation semantics (total amount paid out). The v5 implementation already returned the total amount from `STORE.recordPayoutFor()`, not the leftover — only the interface had the misleading name.
|
|
53
|
+
|
|
54
|
+
#### IJBController
|
|
55
|
+
|
|
56
|
+
| Change | v5 | v6 |
|
|
57
|
+
|--------|----|----|
|
|
58
|
+
| `launchProjectFor` terminal configs | `JBTerminalConfig[] memory terminalConfigurations` | `JBTerminalConfig[] calldata terminalConfigurations` |
|
|
59
|
+
| `launchRulesetsFor` terminal configs | `JBTerminalConfig[] memory terminalConfigurations` | `JBTerminalConfig[] calldata terminalConfigurations` |
|
|
60
|
+
|
|
61
|
+
Parameters changed from `memory` to `calldata` for gas efficiency.
|
|
62
|
+
|
|
63
|
+
#### IJBSplits
|
|
64
|
+
|
|
65
|
+
| Change | v5 | v6 |
|
|
66
|
+
|--------|----|----|
|
|
67
|
+
| `setSplitGroupsOf` splits param | `JBSplitGroup[] memory splitGroups` | `JBSplitGroup[] calldata splitGroups` |
|
|
68
|
+
|
|
69
|
+
#### IJBFundAccessLimits
|
|
70
|
+
|
|
71
|
+
| Change | v5 | v6 |
|
|
72
|
+
|--------|----|----|
|
|
73
|
+
| `setFundAccessLimitsFor` param | `JBFundAccessLimitGroup[] memory fundAccessLimitGroups` | `JBFundAccessLimitGroup[] calldata fundAccessLimitGroups` |
|
|
74
|
+
|
|
75
|
+
### 1.2 Removed Errors
|
|
76
|
+
|
|
77
|
+
| Contract | v5 Error | v6 Replacement |
|
|
78
|
+
|----------|----------|----------------|
|
|
79
|
+
| `JBMultiTerminal` | `JBMultiTerminal_ZeroAccountingContextDecimals()` | `JBMultiTerminal_AccountingContextDecimalsMismatch()` |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 2. New Features
|
|
84
|
+
|
|
85
|
+
### 2.1 New Functions
|
|
86
|
+
|
|
87
|
+
#### IJBController / JBController
|
|
88
|
+
|
|
89
|
+
| Function | Description |
|
|
90
|
+
|----------|-------------|
|
|
91
|
+
| `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. |
|
|
92
|
+
| `afterReceiveMigrationFrom(IERC165 from, uint256 projectId)` | Called by the directory after this controller has been set as the active controller. Added to the `IJBMigratable` interface. |
|
|
93
|
+
|
|
94
|
+
#### IJBTokens / JBTokens
|
|
95
|
+
|
|
96
|
+
| Function | Description |
|
|
97
|
+
|----------|-------------|
|
|
98
|
+
| `setTokenMetadataFor(uint256 projectId, string name, string symbol)` | Sets the name and symbol of a project's token. Only callable by the project's controller. |
|
|
99
|
+
|
|
100
|
+
#### IJBToken / JBERC20
|
|
101
|
+
|
|
102
|
+
| Function | Description |
|
|
103
|
+
|----------|-------------|
|
|
104
|
+
| `setMetadata(string name, string symbol)` | Sets the token's name and symbol. Only callable by the token's owner (JBTokens). |
|
|
105
|
+
|
|
106
|
+
#### IJBMigratable
|
|
107
|
+
|
|
108
|
+
| Function | Description |
|
|
109
|
+
|----------|-------------|
|
|
110
|
+
| `afterReceiveMigrationFrom(IERC165 from, uint256 projectId)` | New lifecycle hook called after a controller migration completes. |
|
|
111
|
+
|
|
112
|
+
#### JBCashOuts (Library)
|
|
113
|
+
|
|
114
|
+
| Function | Description |
|
|
115
|
+
|----------|-------------|
|
|
116
|
+
| `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. |
|
|
117
|
+
|
|
118
|
+
### 2.2 New Events
|
|
119
|
+
|
|
120
|
+
| Contract | Event |
|
|
121
|
+
|----------|-------|
|
|
122
|
+
| `IJBTokens` | `SetTokenMetadata(uint256 indexed projectId, string name, string symbol, address caller)` |
|
|
123
|
+
| `IJBPermitTerminal` | `Permit2AllowanceFailed(address indexed token, address indexed owner, bytes reason)` |
|
|
124
|
+
|
|
125
|
+
### 2.3 New Errors
|
|
126
|
+
|
|
127
|
+
| Contract | Error |
|
|
128
|
+
|----------|-------|
|
|
129
|
+
| `JBController` | `JBController_TerminalTokensNotTransferred()` |
|
|
130
|
+
| `JBMultiTerminal` | `JBMultiTerminal_AccountingContextDecimalsMismatch()` |
|
|
131
|
+
| `JBRulesets` | `JBRulesets_WeightCacheRequired(uint256 projectId)` |
|
|
132
|
+
| `JBTerminalStore` | `JBTerminalStore_Uint224Overflow(uint256 value)` |
|
|
133
|
+
| `JBCashOuts` | `JBCashOuts_DesiredOutputNotAchievable()` |
|
|
134
|
+
| `JBERC20` | `JBERC20_AlreadyInitialized()` |
|
|
135
|
+
|
|
136
|
+
### 2.4 New Permission IDs
|
|
137
|
+
|
|
138
|
+
| Permission | Description |
|
|
139
|
+
|------------|-------------|
|
|
140
|
+
| `LAUNCH_RULESETS` | Required for `launchRulesetsFor`. In v5, `QUEUE_RULESETS` was used. |
|
|
141
|
+
| `SET_TOKEN_METADATA` | Required for `setTokenMetadataOf`. |
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 3. Event Changes
|
|
146
|
+
|
|
147
|
+
### 3.1 New Events
|
|
148
|
+
|
|
149
|
+
See section 2.2 above.
|
|
150
|
+
|
|
151
|
+
### 3.2 Modified Events
|
|
152
|
+
|
|
153
|
+
| Contract | Event | Change |
|
|
154
|
+
|----------|-------|--------|
|
|
155
|
+
| `IJBCashOutTerminal` | `CashOutTokens` | Event order changed in the interface (moved before `HookAfterRecordCashOut`); NatSpec added. No field changes. |
|
|
156
|
+
| `IJBCashOutTerminal` | `HookAfterRecordCashOut` | Event order changed in the interface (moved after `CashOutTokens`); NatSpec added. No field changes. |
|
|
157
|
+
|
|
158
|
+
### 3.3 All Interfaces Gained NatSpec
|
|
159
|
+
|
|
160
|
+
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.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 4. Error Changes
|
|
165
|
+
|
|
166
|
+
### 4.1 Errors with Added Parameters (More Informative Reverts)
|
|
167
|
+
|
|
168
|
+
| Contract | v5 | v6 |
|
|
169
|
+
|----------|----|----|
|
|
170
|
+
| `JBController` | `JBController_AddingPriceFeedNotAllowed()` | `JBController_AddingPriceFeedNotAllowed(uint256 projectId)` |
|
|
171
|
+
| `JBController` | `JBController_MintNotAllowedAndNotTerminalOrHook()` | `JBController_MintNotAllowedAndNotTerminalOrHook(address caller)` |
|
|
172
|
+
| `JBController` | `JBController_RulesetsAlreadyLaunched()` | `JBController_RulesetsAlreadyLaunched(uint256 projectId)` |
|
|
173
|
+
| `JBController` | `JBController_RulesetSetTokenNotAllowed()` | `JBController_RulesetSetTokenNotAllowed(uint256 projectId)` |
|
|
174
|
+
| `JBMultiTerminal` | `JBMultiTerminal_FeeTerminalNotFound()` | `JBMultiTerminal_FeeTerminalNotFound(address token)` |
|
|
175
|
+
| `JBMultiTerminal` | `JBMultiTerminal_TerminalTokensIncompatible()` | `JBMultiTerminal_TerminalTokensIncompatible(uint256 projectId, address token, IJBTerminal terminal)` |
|
|
176
|
+
| `JBDirectory` | `JBDirectory_SetControllerNotAllowed()` | `JBDirectory_SetControllerNotAllowed(uint256 projectId)` |
|
|
177
|
+
| `JBDirectory` | `JBDirectory_SetTerminalsNotAllowed()` | `JBDirectory_SetTerminalsNotAllowed(uint256 projectId)` |
|
|
178
|
+
| `JBSplits` | `JBSplits_PreviousLockedSplitsNotIncluded()` | `JBSplits_PreviousLockedSplitsNotIncluded(uint256 projectId, uint256 rulesetId)` |
|
|
179
|
+
| `JBTokens` | `JBTokens_EmptyToken()` | `JBTokens_EmptyToken(uint256 projectId)` |
|
|
180
|
+
| `JBTerminalStore` | `JBTerminalStore_RulesetNotFound()` | `JBTerminalStore_RulesetNotFound(uint256 projectId)` |
|
|
181
|
+
| `JBPermissions` | `JBPermissions_Unauthorized()` | `JBPermissions_Unauthorized(address account, address operator, uint256 projectId, uint256 permissionId)` |
|
|
182
|
+
|
|
183
|
+
### 4.2 Renamed Errors
|
|
184
|
+
|
|
185
|
+
| Contract | v5 | v6 |
|
|
186
|
+
|----------|----|----|
|
|
187
|
+
| `JBMultiTerminal` | `JBMultiTerminal_ZeroAccountingContextDecimals()` | `JBMultiTerminal_AccountingContextDecimalsMismatch()` |
|
|
188
|
+
|
|
189
|
+
### 4.3 Removed Errors
|
|
190
|
+
|
|
191
|
+
| Contract | Error | Notes |
|
|
192
|
+
|----------|-------|-------|
|
|
193
|
+
| `JBMultiTerminal` | `JBMultiTerminal_ZeroAccountingContextDecimals()` | Replaced by `AccountingContextDecimalsMismatch` |
|
|
194
|
+
|
|
195
|
+
### 4.4 New Errors
|
|
196
|
+
|
|
197
|
+
See section 2.3 above.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 5. Struct Changes
|
|
202
|
+
|
|
203
|
+
All structs are identical between v5 and v6 except:
|
|
204
|
+
|
|
205
|
+
| Struct | Change |
|
|
206
|
+
|--------|--------|
|
|
207
|
+
| `JBBeforeCashOutRecordedContext` | New `bool beneficiaryIsFeeless` field added before `metadata`. Indicates whether the cash out's beneficiary is a feeless address, allowing data hooks to skip their own fees for in-protocol routing. |
|
|
208
|
+
|
|
209
|
+
Other struct-level differences (non-functional):
|
|
210
|
+
- `forge-lint: disable-next-line(pascal-case-struct)` comments added to all struct definitions.
|
|
211
|
+
- `JBSplit`: Additional NatSpec documentation on the `beneficiary` field behavior when set to `address(0)`.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 6. Enum Changes
|
|
216
|
+
|
|
217
|
+
`JBApprovalStatus` is **identical** between v5 and v6.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 7. Library Changes
|
|
222
|
+
|
|
223
|
+
### JBCashOuts
|
|
224
|
+
|
|
225
|
+
| Change | Description |
|
|
226
|
+
|--------|-------------|
|
|
227
|
+
| **New function** `minCashOutCountFor` | Inverse bonding curve calculation using binary search. Returns the minimum tokens to cash out for a desired output. |
|
|
228
|
+
| **New error** `JBCashOuts_DesiredOutputNotAchievable` | Thrown when the cash out tax rate is 100% and no output is possible. |
|
|
229
|
+
| **Bug fix**: Early return for zero `cashOutCount` | `cashOutFrom` now returns `0` immediately when `cashOutCount == 0` (v5 would compute with zero). |
|
|
230
|
+
|
|
231
|
+
### JBMetadataResolver
|
|
232
|
+
|
|
233
|
+
| Change | Description |
|
|
234
|
+
|--------|-------------|
|
|
235
|
+
| Assembly blocks marked `"memory-safe"` | All inline assembly blocks now use the `assembly ("memory-safe")` annotation. |
|
|
236
|
+
| **Bug fix**: `_sliceBytes` copy loop | The loop bound changed from `end` (absolute source offset) to `length` (relative), preventing over-copy past the allocated buffer. |
|
|
237
|
+
| **Bug fix**: Overflow protection | Offset increment now checks for `> 255` overflow before casting to `uint8`, reverting with `JBMetadataResolver_MetadataTooLong()`. |
|
|
238
|
+
| **Bug fix**: Memory alignment | Free memory pointer in `_sliceBytes` now rounds up to 32-byte boundary to prevent overlapping allocations. |
|
|
239
|
+
| Empty input handling | `createMetadata` now returns empty bytes for empty input arrays. |
|
|
240
|
+
| Named parameters in `_sliceBytes` calls | All calls now use named parameters (`data:`, `start:`, `end:`). |
|
|
241
|
+
|
|
242
|
+
### JBRulesetMetadataResolver
|
|
243
|
+
|
|
244
|
+
| Change | Description |
|
|
245
|
+
|--------|-------------|
|
|
246
|
+
| Bit 77 comment fix | Changed from "allow controller migration" to "owner must send payouts" to match actual bit semantics. |
|
|
247
|
+
| `baseCurrency` range comment fix | Changed from `0-16777215` (24-bit) to `0-4294967295` (32-bit). |
|
|
248
|
+
| `currency` range comment fix | Changed from `0-4294967296` to `0-4294967295`. |
|
|
249
|
+
| Named field syntax | `expandMetadata()` now uses named field syntax (`reservedPercent:`, etc.) instead of positional. |
|
|
250
|
+
|
|
251
|
+
### JBFees
|
|
252
|
+
|
|
253
|
+
| Change | Description |
|
|
254
|
+
|--------|-------------|
|
|
255
|
+
| NatSpec improvements | Clarified that `feeAmountFrom` forward-calculates and `feeAmountIn` back-calculates. Added documentation about rounding bounds. |
|
|
256
|
+
|
|
257
|
+
### JBSurplus
|
|
258
|
+
|
|
259
|
+
| Change | Description |
|
|
260
|
+
|--------|-------------|
|
|
261
|
+
| Typo fix | `termainls` -> `terminals`. |
|
|
262
|
+
|
|
263
|
+
### JBConstants, JBFixedPointNumber, JBSplitGroupIds, JBCurrencyIds
|
|
264
|
+
|
|
265
|
+
No changes.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 8. Implementation Changes (Non-Interface)
|
|
270
|
+
|
|
271
|
+
### 8.1 JBController
|
|
272
|
+
|
|
273
|
+
| Change | Description |
|
|
274
|
+
|--------|-------------|
|
|
275
|
+
| **Migration lifecycle** | `afterReceiveMigrationFrom` added — called by directory after migration completes (validates caller is directory). |
|
|
276
|
+
| **`launchRulesetsFor` permission** | Changed from `QUEUE_RULESETS` to `LAUNCH_RULESETS`. |
|
|
277
|
+
| **Split token transfer assertion** | `assert(allowance == 0)` replaced with explicit `revert JBController_TerminalTokensNotTransferred()`. |
|
|
278
|
+
| **Code organization** | External views moved after external transactions. Internal views moved to end of file. |
|
|
279
|
+
|
|
280
|
+
### 8.2 JBMultiTerminal
|
|
281
|
+
|
|
282
|
+
| Change | Description |
|
|
283
|
+
|--------|-------------|
|
|
284
|
+
| **Decimal validation** | `ZeroAccountingContextDecimals` renamed to `AccountingContextDecimalsMismatch`. Non-standard ERC-20s that revert on `decimals()` bypass validation (documented). |
|
|
285
|
+
| **Permit2 failure event** | Failed Permit2 allowance approvals now emit `Permit2AllowanceFailed` instead of silently catching. |
|
|
286
|
+
| **Migration held fees** | Migration intentionally does not transfer held fees (documented: held fees belong to fee beneficiary, not the migrating project). |
|
|
287
|
+
| **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. |
|
|
288
|
+
| **Split payout documentation** | Failed split payouts documented as consuming payout limit by design. |
|
|
289
|
+
| **Fee-free cashout bypass prevention** | New `_feeFreeSurplusOf` mapping tracks cumulative fee-free intra-terminal payouts per project/token. During zero-tax cashouts, fees are charged up to this tracked amount (then decremented), preventing round-trip fee bypass. See Section 0.2. |
|
|
290
|
+
| **beneficiaryIsFeeless passthrough** | `cashOutTokensOf` now passes `_isFeeless(beneficiary)` to `recordCashOutFor`, which forwards it to data hooks via `JBBeforeCashOutRecordedContext.beneficiaryIsFeeless`. |
|
|
291
|
+
|
|
292
|
+
### 8.3 JBRulesets
|
|
293
|
+
|
|
294
|
+
| Change | Description |
|
|
295
|
+
|--------|-------------|
|
|
296
|
+
| **Cache threshold** | `_WEIGHT_CUT_MULTIPLE_CACHE_LOOKUP_THRESHOLD` increased from `1,000` to `20,000`. |
|
|
297
|
+
| **Cache cap removed** | `_MAX_WEIGHT_CUT_MULTIPLE_CACHE_THRESHOLD` (`50,000`) removed entirely. |
|
|
298
|
+
| **Weight cache required** | `_deriveWeightFrom` now reverts with `JBRulesets_WeightCacheRequired(projectId)` when iteration count exceeds the threshold, instead of silently iterating. |
|
|
299
|
+
| **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. |
|
|
300
|
+
|
|
301
|
+
### 8.4 JBDirectory
|
|
302
|
+
|
|
303
|
+
| Change | Description |
|
|
304
|
+
|--------|-------------|
|
|
305
|
+
| **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. |
|
|
306
|
+
|
|
307
|
+
### 8.5 JBSplits
|
|
308
|
+
|
|
309
|
+
| Change | Description |
|
|
310
|
+
|--------|-------------|
|
|
311
|
+
| **Stale storage cleanup** | `_setSplitsOf` now deletes stale packed split data when the new split count is smaller than the previous count, preventing leftover storage from prior configurations. |
|
|
312
|
+
|
|
313
|
+
### 8.6 JBTokens
|
|
314
|
+
|
|
315
|
+
| Change | Description |
|
|
316
|
+
|--------|-------------|
|
|
317
|
+
| **Overflow check timing** | `mintFor` now checks `totalSupplyOf(projectId) + count > type(uint208).max` BEFORE minting (v5 checked after). |
|
|
318
|
+
|
|
319
|
+
### 8.7 JBERC20
|
|
320
|
+
|
|
321
|
+
| Change | Description |
|
|
322
|
+
|--------|-------------|
|
|
323
|
+
| **Named revert** | `initialize()` now reverts with `JBERC20_AlreadyInitialized()` instead of a bare `revert()`. |
|
|
324
|
+
|
|
325
|
+
### 8.8 JBChainlinkV3PriceFeed
|
|
326
|
+
|
|
327
|
+
| Change | Description |
|
|
328
|
+
|--------|-------------|
|
|
329
|
+
| **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. |
|
|
330
|
+
|
|
331
|
+
### 8.9 JBChainlinkV3SequencerPriceFeed
|
|
332
|
+
|
|
333
|
+
| Change | Description |
|
|
334
|
+
|--------|-------------|
|
|
335
|
+
| **Typo fix** | Error parameter `gradePeriodTime` corrected to `gracePeriodTime` in `JBChainlinkV3SequencerPriceFeed_SequencerDown`. |
|
|
336
|
+
| **Threshold docs** | Constructor parameter `threshold` documentation corrected from "blocks" to "seconds". |
|
|
337
|
+
|
|
338
|
+
### 8.10 Solidity Version
|
|
339
|
+
|
|
340
|
+
All contracts upgraded from `pragma solidity 0.8.23` to `pragma solidity 0.8.26`.
|
|
341
|
+
|
|
342
|
+
### 8.11 Named Arguments
|
|
343
|
+
|
|
344
|
+
Throughout the codebase, function calls were updated to use named argument syntax (e.g., `foo({bar: 1, baz: 2})`) for improved readability.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## 9. Migration Table
|
|
349
|
+
|
|
350
|
+
### Interfaces
|
|
351
|
+
|
|
352
|
+
| v5 | v6 | Notes |
|
|
353
|
+
|----|----|-------|
|
|
354
|
+
| `IJBController` | `IJBController` | Gained `setTokenMetadataOf`. `calldata` for terminal configs. |
|
|
355
|
+
| `IJBRulesets` | `IJBRulesets` | `updateRulesetWeightCache` gained `rulesetId` parameter |
|
|
356
|
+
| `IJBTerminalStore` | `IJBTerminalStore` | `tokenCount` renamed to `cashOutCount` in `currentReclaimableSurplusOf`. `recordCashOutFor` gained `beneficiaryIsFeeless` param. View functions reordered. |
|
|
357
|
+
| `IJBPayoutTerminal` | `IJBPayoutTerminal` | `sendPayoutsOf` returns `amountPaidOut` (was `netLeftoverPayoutAmount`). `SendPayoutToSplit` event moved. |
|
|
358
|
+
| `IJBPermitTerminal` | `IJBPermitTerminal` | Gained `Permit2AllowanceFailed` event |
|
|
359
|
+
| `IJBMigratable` | `IJBMigratable` | Gained `afterReceiveMigrationFrom` function |
|
|
360
|
+
| `IJBTokens` | `IJBTokens` | Gained `setTokenMetadataFor`, `SetTokenMetadata` event |
|
|
361
|
+
| `IJBToken` | `IJBToken` | Gained `setMetadata` function |
|
|
362
|
+
| `IJBSplits` | `IJBSplits` | `setSplitGroupsOf` param changed to `calldata` |
|
|
363
|
+
| `IJBFundAccessLimits` | `IJBFundAccessLimits` | `setFundAccessLimitsFor` param changed to `calldata` |
|
|
364
|
+
| `IJBFeelessAddresses` | `IJBFeelessAddresses` | Param names: `account` -> `addr`. NatSpec added. |
|
|
365
|
+
| All other interfaces | Same name | NatSpec documentation added. No functional changes. |
|
|
366
|
+
|
|
367
|
+
### Contracts
|
|
368
|
+
|
|
369
|
+
| v5 | v6 | Notes |
|
|
370
|
+
|----|----|-------|
|
|
371
|
+
| `JBController` | `JBController` | Token metadata, migration lifecycle (`afterReceiveMigrationFrom`), `LAUNCH_RULESETS` permission |
|
|
372
|
+
| `JBMultiTerminal` | `JBMultiTerminal` | Reentrancy hardening, decimal validation rename, Permit2 event, fee-free bypass prevention (`_feeFreeSurplusOf`), `beneficiaryIsFeeless` passthrough |
|
|
373
|
+
| `JBRulesets` | `JBRulesets` | Approval hook try/catch, weight cache changes, threshold increase |
|
|
374
|
+
| `JBDirectory` | `JBDirectory` | Migration ordering fix, afterReceiveMigration call |
|
|
375
|
+
| `JBTokens` | `JBTokens` | Token metadata support, overflow check timing |
|
|
376
|
+
| `JBERC20` | `JBERC20` | `setMetadata`, named revert |
|
|
377
|
+
| `JBDeadline` | `JBDeadline` | No functional changes |
|
|
378
|
+
| All others | Same name | Error parameter enrichment, named arguments, NatSpec |
|
|
379
|
+
|
|
380
|
+
### Libraries
|
|
381
|
+
|
|
382
|
+
| v5 | v6 | Notes |
|
|
383
|
+
|----|----|-------|
|
|
384
|
+
| `JBCashOuts` | `JBCashOuts` | Added `minCashOutCountFor` (inverse bonding curve) |
|
|
385
|
+
| `JBMetadataResolver` | `JBMetadataResolver` | Memory safety, overflow protection, copy loop fix |
|
|
386
|
+
| `JBRulesetMetadataResolver` | `JBRulesetMetadataResolver` | Comment fixes, named field syntax |
|
|
387
|
+
| `JBCurrencyIds` | `JBCurrencyIds` | No changes |
|
|
388
|
+
| All others | Same name | No changes |
|
|
389
|
+
|
|
390
|
+
### Structs
|
|
391
|
+
|
|
392
|
+
| v5 | v6 | Notes |
|
|
393
|
+
|----|----|-------|
|
|
394
|
+
| All 22 structs | Same names | All identical except `JBBeforeCashOutRecordedContext` (gained `beneficiaryIsFeeless` field). Lint comments added to all. |
|
|
395
|
+
|
|
396
|
+
### Enums
|
|
397
|
+
|
|
398
|
+
| v5 | v6 | Notes |
|
|
399
|
+
|----|----|-------|
|
|
400
|
+
| `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 `
|
|
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
|
|
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 (
|
|
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. |
|