@bananapus/core-v6 0.0.80 → 0.0.82
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/README.md +10 -12
- package/package.json +1 -1
- package/references/entrypoints.md +4 -8
- package/references/types-errors-events.md +10 -12
- package/src/JBChainlinkV3PriceFeed.sol +5 -0
- package/src/JBChainlinkV3SequencerPriceFeed.sol +3 -0
- package/src/JBController.sol +35 -4
- package/src/JBDirectory.sol +9 -0
- package/src/JBERC20.sol +3 -0
- package/src/JBFeelessAddresses.sol +3 -0
- package/src/JBFundAccessLimits.sol +5 -0
- package/src/JBMultiTerminal.sol +31 -108
- package/src/JBPermissions.sol +5 -0
- package/src/JBPrices.sol +9 -0
- package/src/JBProjects.sol +5 -0
- package/src/JBRulesets.sol +17 -5
- package/src/JBSplits.sol +5 -0
- package/src/JBTerminalStore.sol +29 -115
- package/src/JBTokens.sol +21 -0
- package/src/abstract/JBControlled.sol +1 -0
- package/src/abstract/JBPermissioned.sol +1 -0
- package/src/enums/JBApprovalStatus.sol +6 -6
- package/src/interfaces/IJBCashOutTerminal.sol +1 -4
- package/src/interfaces/IJBMultiTerminal.sol +0 -13
- package/src/interfaces/IJBPayoutTerminal.sol +2 -8
- package/src/interfaces/IJBTerminalStore.sol +0 -56
- package/src/libraries/JBMetadataResolver.sol +9 -1
- package/src/libraries/JBPayoutSplitGroupLib.sol +14 -0
- package/src/periphery/JBMatchingPriceFeed.sol +3 -1
- package/src/structs/JBFee.sol +0 -10
- package/test/mock/MockMaliciousBeneficiary.sol +2 -4
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Use this repo when you need the protocol's canonical accounting and execution lo
|
|
|
36
36
|
|
|
37
37
|
If you only read one V6 repo before reading the rest, read this one.
|
|
38
38
|
|
|
39
|
-
## Mental
|
|
39
|
+
## Mental model
|
|
40
40
|
|
|
41
41
|
It helps to think about core in four layers:
|
|
42
42
|
|
|
@@ -54,7 +54,7 @@ The shortest reading path is:
|
|
|
54
54
|
3. `JBTerminalStore` for the accounting model
|
|
55
55
|
4. `JBDirectory` and `JBPermissions` for routing and authority
|
|
56
56
|
|
|
57
|
-
## Read
|
|
57
|
+
## Read these files first
|
|
58
58
|
|
|
59
59
|
1. `src/JBController.sol`
|
|
60
60
|
2. `src/JBMultiTerminal.sol`
|
|
@@ -63,7 +63,7 @@ The shortest reading path is:
|
|
|
63
63
|
5. `src/JBRulesets.sol`
|
|
64
64
|
6. `src/JBPermissions.sol`
|
|
65
65
|
|
|
66
|
-
## Key
|
|
66
|
+
## Key contracts
|
|
67
67
|
|
|
68
68
|
| Contract | Role |
|
|
69
69
|
| --- | --- |
|
|
@@ -75,26 +75,24 @@ The shortest reading path is:
|
|
|
75
75
|
| `JBPermissions` | Packed operator-permission registry. |
|
|
76
76
|
| `JBPrices` | Price-feed routing used by terminals and integrations. |
|
|
77
77
|
|
|
78
|
-
## Integration
|
|
78
|
+
## Integration traps
|
|
79
79
|
|
|
80
80
|
- `JBMultiTerminal` is multi-token and multi-terminal. Do not assume one token or one balance.
|
|
81
81
|
- Data hooks and cash-out hooks can change economics and side effects. They are part of the protocol surface.
|
|
82
82
|
- Permission checks are not always against the project owner. Some flows are scoped to the token holder instead.
|
|
83
83
|
- Preview and execution are intentionally close, but callers should still treat them as separate surfaces when hooks or routing can change behavior.
|
|
84
|
-
- Fee-bearing cash-out, payout, and allowance calls can carry a referral project ID. This credits fee volume; it does not redirect the fee itself.
|
|
85
84
|
|
|
86
|
-
## Where
|
|
85
|
+
## Where state lives
|
|
87
86
|
|
|
88
87
|
- project identity and ownership: `JBProjects`
|
|
89
88
|
- controller and terminal routing: `JBDirectory`
|
|
90
89
|
- ruleset history and activation: `JBRulesets`
|
|
91
90
|
- balances, surplus, fees, and reclaim accounting: `JBTerminalStore`
|
|
92
|
-
- referral fee-volume accounting: `JBTerminalStore`
|
|
93
91
|
- operator authority: `JBPermissions`
|
|
94
92
|
|
|
95
93
|
When a flow is unclear, read the contract that owns the state before the contract that forwards into it.
|
|
96
94
|
|
|
97
|
-
## High-
|
|
95
|
+
## High-signal tests
|
|
98
96
|
|
|
99
97
|
1. `test/TestPayBurnRedeemFlow.sol`
|
|
100
98
|
2. `test/TestTerminalPreviewParity.sol`
|
|
@@ -124,11 +122,11 @@ Useful scripts:
|
|
|
124
122
|
- `npm run deploy:mainnets:periphery`
|
|
125
123
|
- `npm run deploy:testnets:periphery`
|
|
126
124
|
|
|
127
|
-
## Deployment
|
|
125
|
+
## Deployment notes
|
|
128
126
|
|
|
129
127
|
This repo contains the main core deployments and periphery deployment helpers. Most other V6 packages assume these contracts exist first and treat them as the stable base layer.
|
|
130
128
|
|
|
131
|
-
## Repository
|
|
129
|
+
## Repository layout
|
|
132
130
|
|
|
133
131
|
```text
|
|
134
132
|
src/
|
|
@@ -141,7 +139,7 @@ script/
|
|
|
141
139
|
helpers/
|
|
142
140
|
```
|
|
143
141
|
|
|
144
|
-
## Risks
|
|
142
|
+
## Risks and notes
|
|
145
143
|
|
|
146
144
|
See [RISKS.md](./RISKS.md) for the full risk register. In short:
|
|
147
145
|
|
|
@@ -152,7 +150,7 @@ See [RISKS.md](./RISKS.md) for the full risk register. In short:
|
|
|
152
150
|
|
|
153
151
|
The easiest way to misread V6 is to treat core like a simple crowdfunding terminal. It is closer to a configurable accounting and settlement layer.
|
|
154
152
|
|
|
155
|
-
## For AI
|
|
153
|
+
## For AI agents
|
|
156
154
|
|
|
157
155
|
- Start with `JBController`, `JBMultiTerminal`, and `JBTerminalStore`.
|
|
158
156
|
- Keep controller configuration, terminal execution, and store accounting separate in your mental model.
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@ The core Juicebox V6 protocol on EVM: a modular system for launching treasury-ba
|
|
|
28
28
|
| `JBDeadline` | Approval hook: rejects rulesets queued within `DURATION` seconds of start. Ships as `JBDeadline3Hours`, `JBDeadline1Day`, `JBDeadline3Days`, `JBDeadline7Days`. |
|
|
29
29
|
| `JBMatchingPriceFeed` | Always returns 1:1. For equivalent currencies (e.g. ETH/NATIVE_TOKEN). |
|
|
30
30
|
|
|
31
|
-
## Key
|
|
31
|
+
## Key functions
|
|
32
32
|
|
|
33
33
|
### JBController
|
|
34
34
|
|
|
@@ -61,9 +61,9 @@ The core Juicebox V6 protocol on EVM: a modular system for launching treasury-ba
|
|
|
61
61
|
| Function | What it does |
|
|
62
62
|
|----------|--------------|
|
|
63
63
|
| `pay(uint256 projectId, address token, uint256 amount, address beneficiary, uint256 minReturnedTokens, string memo, bytes metadata)` | Pays a project. Mints project tokens to beneficiary based on ruleset weight. Returns token count. |
|
|
64
|
-
| `cashOutTokensOf(address holder, uint256 projectId, uint256 cashOutCount, address tokenToReclaim, uint256 minTokensReclaimed, address payable beneficiary, bytes metadata
|
|
65
|
-
| `sendPayoutsOf(uint256 projectId, address token, uint256 amount, uint256 currency, uint256 minTokensPaidOut
|
|
66
|
-
| `useAllowanceOf(uint256 projectId, address token, uint256 amount, uint256 currency, uint256 minTokensPaidOut, address payable beneficiary, address payable feeBeneficiary, string memo
|
|
64
|
+
| `cashOutTokensOf(address holder, uint256 projectId, uint256 cashOutCount, address tokenToReclaim, uint256 minTokensReclaimed, address payable beneficiary, bytes metadata)` | Burns project tokens and reclaims surplus terminal tokens via bonding curve. |
|
|
65
|
+
| `sendPayoutsOf(uint256 projectId, address token, uint256 amount, uint256 currency, uint256 minTokensPaidOut)` | Distributes payouts from the project's balance to its payout split group, up to the payout limit. |
|
|
66
|
+
| `useAllowanceOf(uint256 projectId, address token, uint256 amount, uint256 currency, uint256 minTokensPaidOut, address payable beneficiary, address payable feeBeneficiary, string memo)` | Withdraws from the project's surplus allowance to a beneficiary. The `feeBeneficiary` receives tokens minted by the fee payment. |
|
|
67
67
|
| `addToBalanceOf(uint256 projectId, address token, uint256 amount, bool shouldReturnHeldFees, string memo, bytes metadata)` | Adds funds to a project's balance without minting tokens. Can unlock held fees. |
|
|
68
68
|
| `migrateBalanceOf(uint256 projectId, address token, IJBTerminal to)` | Migrates a project's token balance to another terminal. Requires `allowTerminalMigration`. |
|
|
69
69
|
| `processHeldFeesOf(uint256 projectId, address token, uint256 count)` | Processes up to `count` held fees for a project, sending them to the fee beneficiary project. |
|
|
@@ -74,7 +74,6 @@ The core Juicebox V6 protocol on EVM: a modular system for launching treasury-ba
|
|
|
74
74
|
| `previewPayFor(uint256 projectId, address token, uint256 amount, address beneficiary, bytes metadata)` | Simulates a full payment including the reserved/beneficiary token split. Returns `(ruleset, beneficiaryTokenCount, reservedTokenCount, hookSpecifications)`. Composes `STORE.previewPayFrom` + `controller.previewMintOf`. |
|
|
75
75
|
| `previewCashOutFrom(address holder, uint256 projectId, uint256 cashOutCount, address tokenToReclaim, address payable beneficiary, bytes metadata)` | Simulates a full cash out including bonding curve and data hook effects. Cash-out data hooks may alter pricing inputs, but not the caller-supplied burn count. Returns `(ruleset, reclaimAmount, cashOutTaxRate, hookSpecifications)`. Delegates to `STORE.previewCashOutFrom`. |
|
|
76
76
|
| `heldFeesOf(uint256 projectId, address token, uint256 count)` | Returns up to `count` held fees for a project/token. |
|
|
77
|
-
| `currentReferralProjectId()` | Returns the in-flight packed referral `(chainId << 48) | projectId`, or 0 outside a fee-bearing call. |
|
|
78
77
|
|
|
79
78
|
### JBTerminalStore
|
|
80
79
|
|
|
@@ -94,11 +93,8 @@ The core Juicebox V6 protocol on EVM: a modular system for launching treasury-ba
|
|
|
94
93
|
| `currentTotalReclaimableSurplusOf(uint256 projectId, uint256 cashOutCount, uint256 decimals, uint256 currency)` | Convenience view: reclaimable surplus across all terminals and all tokens. |
|
|
95
94
|
| `currentSurplusOf(uint256 projectId, IJBTerminal[] terminals, address[] tokens, uint256 decimals, uint256 currency)` | Returns the current surplus across specified terminals and tokens. Empty arrays default to all. |
|
|
96
95
|
| `currentTotalSurplusOf(uint256 projectId, uint256 decimals, uint256 currency)` | Convenience view: total surplus across all terminals and all tokens. |
|
|
97
|
-
| `feeVolumeByReferralOf(address terminal, uint256 referralChainId, uint256 referralProjectId)` | Returns cumulative protocol fee volume credited to a referrer through a terminal. |
|
|
98
96
|
| `previewPayFrom(address terminal, address payer, JBTokenAmount amount, uint256 projectId, address beneficiary, bytes metadata)` | Simulates a payment without modifying state. Uses the explicit `terminal` parameter for balance/surplus lookups. Invokes data hooks if configured. Returns ruleset, token count, and hook specifications. |
|
|
99
97
|
| `previewCashOutFrom(address terminal, address holder, uint256 projectId, uint256 cashOutCount, address tokenToReclaim, bool beneficiaryIsFeeless, bytes metadata)` | Simulates a cash out without modifying state. Uses the explicit `terminal` parameter for balance/surplus lookups. Invokes data hooks if configured, including any pricing-only adjustments they return. Returns ruleset, reclaim amount, tax rate, and hook specifications. |
|
|
100
|
-
| `recordFeeReferralCreditOf(uint256 referralProjectId, JBTokenAmount amount)` | Credits normalized fee volume to a packed referral project for the calling terminal. No-ops for zero referral, zero amount, or missing price feed. |
|
|
101
|
-
| `totalFeeVolumeOf(address terminal)` | Returns total referral-creditable fee volume recorded for a terminal. |
|
|
102
98
|
|
|
103
99
|
### JBRulesets
|
|
104
100
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Use this file when you need deeper protocol reference material after the repo-local `SKILLS.md` has already routed you to `nana-core-v6`.
|
|
4
4
|
|
|
5
|
-
## Key
|
|
5
|
+
## Key types
|
|
6
6
|
|
|
7
7
|
| Struct/Enum | Key Fields | Used In |
|
|
8
8
|
|-------------|------------|---------|
|
|
@@ -17,13 +17,13 @@ Use this file when you need deeper protocol reference material after the repo-lo
|
|
|
17
17
|
| `JBCurrencyAmount` | `amount (uint224)`, `currency (uint32)` | Payout limits and surplus allowances |
|
|
18
18
|
| `JBFundAccessLimitGroup` | `terminal (address)`, `token (address)`, `payoutLimits (JBCurrencyAmount[])`, `surplusAllowances (JBCurrencyAmount[])` | `JBRulesetConfig.fundAccessLimitGroups` |
|
|
19
19
|
| `JBPermissionsData` | `operator (address)`, `projectId (uint64)`, `permissionIds (uint8[])` | `setPermissionsFor()` input |
|
|
20
|
-
| `JBFee` | `amount (uint224)`, `
|
|
20
|
+
| `JBFee` | `amount (uint224)`, `beneficiary (address)`, `unlockTimestamp (uint48)` | Held fees in `JBMultiTerminal` |
|
|
21
21
|
| `JBSingleAllowance` | `sigDeadline (uint256)`, `amount (uint160)`, `expiration (uint48)`, `nonce (uint48)`, `signature (bytes)` | Permit2 allowance in terminal payments |
|
|
22
22
|
| `JBRulesetWithMetadata` | `ruleset (JBRuleset)`, `metadata (JBRulesetMetadata)` | `allRulesetsOf()`, `currentRulesetOf()` return values |
|
|
23
23
|
| `JBRulesetWeightCache` | `weight (uint112)`, `weightCutMultiple (uint168)` | Weight caching for long-running rulesets in `JBRulesets` |
|
|
24
24
|
| `JBApprovalStatus` (enum) | `Empty`, `Upcoming`, `Active`, `ApprovalExpected`, `Approved`, `Failed` | Approval hook status for queued rulesets |
|
|
25
25
|
|
|
26
|
-
### Hook
|
|
26
|
+
### Hook structs
|
|
27
27
|
|
|
28
28
|
| Struct | Key Fields | Used In |
|
|
29
29
|
|--------|------------|---------|
|
|
@@ -53,13 +53,13 @@ Use this file when you need deeper protocol reference material after the repo-lo
|
|
|
53
53
|
| `1` | ETH |
|
|
54
54
|
| `2` | USD |
|
|
55
55
|
|
|
56
|
-
### Split
|
|
56
|
+
### Split group IDs (`JBSplitGroupIds`)
|
|
57
57
|
|
|
58
58
|
| ID | Group |
|
|
59
59
|
|----|-------|
|
|
60
60
|
| `1` | `RESERVED_TOKENS` -- reserved token distribution |
|
|
61
61
|
|
|
62
|
-
### Special
|
|
62
|
+
### Special values
|
|
63
63
|
|
|
64
64
|
| Value | Context | Meaning |
|
|
65
65
|
|-------|---------|---------|
|
|
@@ -93,8 +93,7 @@ Use this file when you need deeper protocol reference material after the repo-lo
|
|
|
93
93
|
- `JBProjects` constructor optionally mints project #1 to `feeProjectOwner` -- if `address(0)`, no fee project is created
|
|
94
94
|
- `JBMultiTerminal` derives `DIRECTORY` from the provided `store` in its constructor -- not passed directly
|
|
95
95
|
- `JBPrices.pricePerUnitOf()` checks project direct feeds, project inverse feeds, default direct feeds, then default inverse feeds. It skips feeds that revert or return zero.
|
|
96
|
-
- `useAllowanceOf()` takes
|
|
97
|
-
- `sendPayoutsOf()` and `cashOutTokensOf()` also take `uint256 referralProjectId`; pass `0` for no referral credit
|
|
96
|
+
- `useAllowanceOf()` takes 8 args including `address payable feeBeneficiary` -- do NOT omit it
|
|
98
97
|
- `JBFeelessAddresses.isFeelessFor()` takes 3 args: `(addr, projectId, caller)`. The optional hook can use `caller` to scope dynamic grants.
|
|
99
98
|
- Cash out tax rate of 0% = proportional (1:1) redemption; 100% = nothing reclaimable (all surplus locked). Do NOT confuse with a "cash out rate" where 100% means full redemption.
|
|
100
99
|
- `cashOutTaxRate` in `JBRulesetMetadata` is `uint16` (max 10,000 basis points), NOT 9-decimal precision
|
|
@@ -144,7 +143,7 @@ Quick-reference for the most common `JBPermissionIds` values (from `@bananapus/p
|
|
|
144
143
|
|
|
145
144
|
IDs 22-33 are used by extension contracts (721 hook, buyback hook, router terminal, suckers).
|
|
146
145
|
|
|
147
|
-
## Common
|
|
146
|
+
## Common errors
|
|
148
147
|
|
|
149
148
|
Errors an agent is most likely to encounter. All are custom errors (revert with selector).
|
|
150
149
|
|
|
@@ -188,7 +187,7 @@ Errors an agent is most likely to encounter. All are custom errors (revert with
|
|
|
188
187
|
| `JBRulesets_InvalidWeightCutPercent` | `JBRulesets` | `weightCutPercent` exceeds `MAX_WEIGHT_CUT_PERCENT`. |
|
|
189
188
|
| `JBFundAccessLimits_InvalidPayoutLimitCurrencyOrdering` | `JBFundAccessLimits` | Payout limit currencies not in strictly increasing order. |
|
|
190
189
|
|
|
191
|
-
## Key
|
|
190
|
+
## Key events
|
|
192
191
|
|
|
193
192
|
The most important events for indexing and off-chain monitoring. Indexed params marked with `*`.
|
|
194
193
|
|
|
@@ -214,7 +213,6 @@ The most important events for indexing and off-chain monitoring. Indexed params
|
|
|
214
213
|
| `ProcessFee` | `IJBFeeTerminal` | `projectId*`, `token*`, `amount*`, `wasHeld`, `beneficiary` |
|
|
215
214
|
| `ReturnHeldFees` | `IJBFeeTerminal` | `projectId*`, `token*`, `amount*`, `returnedFees`, `leftoverAmount` |
|
|
216
215
|
| `FeeReverted` | `IJBFeeTerminal` | `projectId*`, `token*`, `feeProjectId*`, `amount`, `reason` |
|
|
217
|
-
| `ReferralCredit` | `IJBTerminalStore` | `terminal*`, `referralChainId*`, `referralProjectId*`, `amount`, `newTotal` |
|
|
218
216
|
| `Create` | `IJBProjects` | `projectId*`, `owner*` |
|
|
219
217
|
| `SetTokenMetadata` | `IJBTokens` | `projectId*`, `name`, `symbol` |
|
|
220
218
|
| `OperatorPermissionsSet` | `IJBPermissions` | (operator, account, projectId, permissionIds, packed, caller) |
|
|
@@ -222,7 +220,7 @@ The most important events for indexing and off-chain monitoring. Indexed params
|
|
|
222
220
|
| `SetSplit` | `IJBSplits` | (projectId, rulesetId, groupId, split, caller) |
|
|
223
221
|
| `AddPriceFeed` | `IJBPrices` | (projectId, pricingCurrency, unitCurrency, feed, caller) |
|
|
224
222
|
|
|
225
|
-
## Hook
|
|
223
|
+
## Hook interface return types
|
|
226
224
|
|
|
227
225
|
### `IJBRulesetDataHook.beforePayRecordedWith()`
|
|
228
226
|
|
|
@@ -262,7 +260,7 @@ function hasMintPermissionFor(uint256 projectId, JBRuleset memory ruleset, addre
|
|
|
262
260
|
|
|
263
261
|
Returns whether `addr` is allowed to mint tokens for the project. Called by `JBController.mintTokensOf` when the caller is not the owner and `allowOwnerMinting` is false -- the data hook can grant mint permission to specific addresses (e.g. suckers for omnichain bridging).
|
|
264
262
|
|
|
265
|
-
## Example
|
|
263
|
+
## Example integration
|
|
266
264
|
|
|
267
265
|
```solidity
|
|
268
266
|
// SPDX-License-Identifier: MIT
|
|
@@ -17,8 +17,13 @@ contract JBChainlinkV3PriceFeed is IJBPriceFeed {
|
|
|
17
17
|
// --------------------------- custom errors ------------------------- //
|
|
18
18
|
//*********************************************************************//
|
|
19
19
|
|
|
20
|
+
/// @notice Thrown when the feed round is not finished or was not answered in the current round.
|
|
20
21
|
error JBChainlinkV3PriceFeed_IncompleteRound(uint80 roundId, uint80 answeredInRound, uint256 updatedAt);
|
|
22
|
+
|
|
23
|
+
/// @notice Thrown when the feed reports a non-positive price.
|
|
21
24
|
error JBChainlinkV3PriceFeed_NegativePrice(int256 price);
|
|
25
|
+
|
|
26
|
+
/// @notice Thrown when the feed's last update is older than the staleness threshold.
|
|
22
27
|
error JBChainlinkV3PriceFeed_StalePrice(uint256 timestamp, uint256 threshold, uint256 updatedAt);
|
|
23
28
|
|
|
24
29
|
//*********************************************************************//
|
|
@@ -14,7 +14,10 @@ contract JBChainlinkV3SequencerPriceFeed is JBChainlinkV3PriceFeed {
|
|
|
14
14
|
// --------------------------- custom errors ------------------------- //
|
|
15
15
|
//*********************************************************************//
|
|
16
16
|
|
|
17
|
+
/// @notice Thrown when the sequencer uptime round is invalid (e.g. the uptime contract is not yet initialized).
|
|
17
18
|
error JBChainlinkV3SequencerPriceFeed_InvalidRound(uint256 startedAt);
|
|
19
|
+
|
|
20
|
+
/// @notice Thrown when the L2 sequencer is down or has restarted too recently for the grace period to elapse.
|
|
18
21
|
error JBChainlinkV3SequencerPriceFeed_SequencerDownOrRestarting(
|
|
19
22
|
uint256 timestamp, uint256 gracePeriodTime, uint256 startedAt
|
|
20
23
|
);
|
package/src/JBController.sol
CHANGED
|
@@ -58,21 +58,52 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
58
58
|
// --------------------------- custom errors ------------------------- //
|
|
59
59
|
//*********************************************************************//
|
|
60
60
|
|
|
61
|
+
/// @notice Thrown when the project's current ruleset does not allow adding price feeds.
|
|
61
62
|
error JBController_AddingPriceFeedNotAllowed(uint256 projectId);
|
|
63
|
+
|
|
64
|
+
/// @notice Thrown when transferring credits while the current ruleset pauses credit transfers.
|
|
62
65
|
error JBController_CreditTransfersPaused(uint256 projectId, uint256 rulesetId);
|
|
66
|
+
|
|
67
|
+
/// @notice Thrown when the cash out tax rate exceeds the allowed maximum.
|
|
63
68
|
error JBController_InvalidCashOutTaxRate(uint256 rate, uint256 limit);
|
|
69
|
+
|
|
70
|
+
/// @notice Thrown when the native value sent does not equal the required creation fee.
|
|
64
71
|
error JBController_InvalidCreationFee(uint256 value, uint256 requiredFee);
|
|
72
|
+
|
|
73
|
+
/// @notice Thrown when the reserved percent exceeds the allowed maximum.
|
|
65
74
|
error JBController_InvalidReservedPercent(uint256 percent, uint256 limit);
|
|
75
|
+
|
|
76
|
+
/// @notice Thrown when the caller is not allowed to mint and is not a terminal or data hook for the project.
|
|
66
77
|
error JBController_MintNotAllowedAndNotTerminalOrHook(address caller);
|
|
78
|
+
|
|
79
|
+
/// @notice Thrown when there are no reserved tokens to send to splits.
|
|
67
80
|
error JBController_NoReservedTokens(uint256 projectId);
|
|
81
|
+
|
|
82
|
+
/// @notice Thrown when the caller is not the directory.
|
|
68
83
|
error JBController_OnlyDirectory(address sender, IJBDirectory directory);
|
|
84
|
+
|
|
85
|
+
/// @notice Thrown when migrating a project that still has pending reserved tokens.
|
|
69
86
|
error JBController_PendingReservedTokens(uint256 pendingReservedTokenBalance);
|
|
87
|
+
|
|
88
|
+
/// @notice Thrown when a reserved token split routes back into the same project via the terminal-payment path.
|
|
70
89
|
error JBController_ReservedTokenSplitProjectSameAsOwner(uint256 projectId);
|
|
90
|
+
|
|
91
|
+
/// @notice Thrown when launching rulesets for a project that has already launched.
|
|
71
92
|
error JBController_RulesetsAlreadyLaunched(uint256 projectId);
|
|
93
|
+
|
|
94
|
+
/// @notice Thrown when the ruleset configurations array is empty.
|
|
72
95
|
error JBController_RulesetsArrayEmpty(uint256 projectId, uint256 rulesetConfigurationCount);
|
|
96
|
+
|
|
97
|
+
/// @notice Thrown when the project's current ruleset does not allow setting a custom token.
|
|
73
98
|
error JBController_RulesetSetTokenNotAllowed(uint256 projectId);
|
|
99
|
+
|
|
100
|
+
/// @notice Thrown when the terminal did not pull the full token allowance during a payout.
|
|
74
101
|
error JBController_TerminalTokensNotTransferred(address terminal, address token, uint256 allowance);
|
|
102
|
+
|
|
103
|
+
/// @notice Thrown when attempting to burn zero tokens.
|
|
75
104
|
error JBController_ZeroTokensToBurn(uint256 projectId, address holder);
|
|
105
|
+
|
|
106
|
+
/// @notice Thrown when attempting to mint zero tokens.
|
|
76
107
|
error JBController_ZeroTokensToMint(uint256 projectId, address beneficiary);
|
|
77
108
|
|
|
78
109
|
//*********************************************************************//
|
|
@@ -707,7 +738,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
707
738
|
// If there's no current ruleset, get a reference to the upcoming one.
|
|
708
739
|
if (ruleset.id == 0) ruleset = _upcomingRulesetOf(projectId);
|
|
709
740
|
|
|
710
|
-
// If
|
|
741
|
+
// If the ruleset doesn't allow setting a custom token, the owner cannot change the token.
|
|
711
742
|
if (!ruleset.allowSetCustomToken()) revert JBController_RulesetSetTokenNotAllowed(projectId);
|
|
712
743
|
|
|
713
744
|
TOKENS.setTokenFor({projectId: projectId, token: token});
|
|
@@ -783,8 +814,8 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
783
814
|
|
|
784
815
|
/// @notice Returns a paginated history of a project's rulesets (with decoded metadata), sorted newest-first.
|
|
785
816
|
/// @param projectId The ID of the project to get the rulesets of.
|
|
786
|
-
/// @param startingId The ID of the ruleset to begin with. This will be the latest ruleset in the result.
|
|
787
|
-
///
|
|
817
|
+
/// @param startingId The ID of the ruleset to begin with. This will be the latest ruleset in the result.
|
|
818
|
+
/// If 0 is passed, the project's latest ruleset will be used.
|
|
788
819
|
/// @param size The maximum number of rulesets to return.
|
|
789
820
|
/// @return rulesets The array of rulesets with their metadata.
|
|
790
821
|
function allRulesetsOf(
|
|
@@ -1320,7 +1351,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
1320
1351
|
return RULESETS.currentOf(projectId);
|
|
1321
1352
|
}
|
|
1322
1353
|
|
|
1323
|
-
/// @notice Indicates whether the provided address has mint permission for the project
|
|
1354
|
+
/// @notice Indicates whether the provided address has mint permission for the project by way of the data hook.
|
|
1324
1355
|
/// @param projectId The ID of the project to check.
|
|
1325
1356
|
/// @param ruleset The ruleset to check.
|
|
1326
1357
|
/// @param addr The address to check.
|
package/src/JBDirectory.sol
CHANGED
|
@@ -23,10 +23,19 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
23
23
|
// --------------------------- custom errors ------------------------- //
|
|
24
24
|
//*********************************************************************//
|
|
25
25
|
|
|
26
|
+
/// @notice Thrown when the same terminal appears more than once in the provided terminals list.
|
|
26
27
|
error JBDirectory_DuplicateTerminals(IJBTerminal terminal);
|
|
28
|
+
|
|
29
|
+
/// @notice Thrown when the project ID is greater than the number of existing projects.
|
|
27
30
|
error JBDirectory_InvalidProjectIdInDirectory(uint256 projectId, uint256 limit);
|
|
31
|
+
|
|
32
|
+
/// @notice Thrown when the project's current controller does not allow setting a new controller.
|
|
28
33
|
error JBDirectory_SetControllerNotAllowed(uint256 projectId);
|
|
34
|
+
|
|
35
|
+
/// @notice Thrown when the project's current controller does not allow setting terminals.
|
|
29
36
|
error JBDirectory_SetTerminalsNotAllowed(uint256 projectId);
|
|
37
|
+
|
|
38
|
+
/// @notice Thrown when the terminal being set as primary does not accept the given token.
|
|
30
39
|
error JBDirectory_TokenNotAccepted(uint256 projectId, address token, IJBTerminal terminal);
|
|
31
40
|
|
|
32
41
|
//*********************************************************************//
|
package/src/JBERC20.sol
CHANGED
|
@@ -25,7 +25,10 @@ contract JBERC20 is ERC20Votes, ERC20Permit, JBPermissioned, IERC1271, IJBToken
|
|
|
25
25
|
// --------------------------- custom errors ------------------------- //
|
|
26
26
|
//*********************************************************************//
|
|
27
27
|
|
|
28
|
+
/// @notice Thrown when initializing a token that already has a name set, or when the provided name is empty.
|
|
28
29
|
error JBERC20_AlreadyInitialized(uint256 currentNameLength, uint256 newNameLength);
|
|
30
|
+
|
|
31
|
+
/// @notice Thrown when the caller is not the JBTokens contract that owns this token.
|
|
29
32
|
error JBERC20_Unauthorized(address caller, address tokens);
|
|
30
33
|
|
|
31
34
|
//*********************************************************************//
|
|
@@ -16,6 +16,7 @@ contract JBFeelessAddresses is Ownable, IJBFeelessAddresses, IERC165 {
|
|
|
16
16
|
// --------------------------- custom errors ------------------------- //
|
|
17
17
|
//*********************************************************************//
|
|
18
18
|
|
|
19
|
+
/// @notice Thrown when the provided feeless hook does not support the `IJBFeelessHook` interface.
|
|
19
20
|
error JBFeelessAddresses_InvalidFeelessHook(IJBFeelessHook hook);
|
|
20
21
|
|
|
21
22
|
//*********************************************************************//
|
|
@@ -33,6 +34,8 @@ contract JBFeelessAddresses is Ownable, IJBFeelessAddresses, IERC165 {
|
|
|
33
34
|
|
|
34
35
|
/// @notice Raw feeless status per project per address.
|
|
35
36
|
/// @dev `projectId = 0` stores the global (all-project) feeless status.
|
|
37
|
+
/// @custom:param projectId The ID of the project. A `projectId` of 0 is the global (all-project) key.
|
|
38
|
+
/// @custom:param addr The address whose feeless status is being stored.
|
|
36
39
|
mapping(uint256 projectId => mapping(address addr => bool)) internal _isFeelessFor;
|
|
37
40
|
|
|
38
41
|
//*********************************************************************//
|
|
@@ -18,12 +18,17 @@ contract JBFundAccessLimits is JBControlled, IJBFundAccessLimits {
|
|
|
18
18
|
// --------------------------- custom errors ------------------------- //
|
|
19
19
|
//*********************************************************************//
|
|
20
20
|
|
|
21
|
+
/// @notice Thrown when two fund access limit groups share the same terminal and token.
|
|
21
22
|
error JBFundAccessLimits_DuplicateFundAccessLimitGroup(
|
|
22
23
|
uint256 projectId, uint256 rulesetId, uint256 groupIndex, address terminal, address token
|
|
23
24
|
);
|
|
25
|
+
|
|
26
|
+
/// @notice Thrown when payout limits within a group are not ordered by ascending currency.
|
|
24
27
|
error JBFundAccessLimits_InvalidPayoutLimitCurrencyOrdering(
|
|
25
28
|
uint256 projectId, uint256 rulesetId, uint256 groupIndex, uint256 limitIndex
|
|
26
29
|
);
|
|
30
|
+
|
|
31
|
+
/// @notice Thrown when surplus allowances within a group are not ordered by ascending currency.
|
|
27
32
|
error JBFundAccessLimits_InvalidSurplusAllowanceCurrencyOrdering(
|
|
28
33
|
uint256 projectId, uint256 rulesetId, uint256 groupIndex, uint256 allowanceIndex
|
|
29
34
|
);
|