@bananapus/core-v6 0.0.81 → 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 -10
- package/package.json +1 -1
- package/references/entrypoints.md +1 -1
- package/references/types-errors-events.md +8 -8
- 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 +26 -1
- 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 -3
- 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/libraries/JBMetadataResolver.sol +9 -1
- package/src/libraries/JBPayoutSplitGroupLib.sol +14 -0
- package/src/periphery/JBMatchingPriceFeed.sol +3 -1
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,14 +75,14 @@ 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
84
|
|
|
85
|
-
## Where
|
|
85
|
+
## Where state lives
|
|
86
86
|
|
|
87
87
|
- project identity and ownership: `JBProjects`
|
|
88
88
|
- controller and terminal routing: `JBDirectory`
|
|
@@ -92,7 +92,7 @@ The shortest reading path is:
|
|
|
92
92
|
|
|
93
93
|
When a flow is unclear, read the contract that owns the state before the contract that forwards into it.
|
|
94
94
|
|
|
95
|
-
## High-
|
|
95
|
+
## High-signal tests
|
|
96
96
|
|
|
97
97
|
1. `test/TestPayBurnRedeemFlow.sol`
|
|
98
98
|
2. `test/TestTerminalPreviewParity.sol`
|
|
@@ -122,11 +122,11 @@ Useful scripts:
|
|
|
122
122
|
- `npm run deploy:mainnets:periphery`
|
|
123
123
|
- `npm run deploy:testnets:periphery`
|
|
124
124
|
|
|
125
|
-
## Deployment
|
|
125
|
+
## Deployment notes
|
|
126
126
|
|
|
127
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.
|
|
128
128
|
|
|
129
|
-
## Repository
|
|
129
|
+
## Repository layout
|
|
130
130
|
|
|
131
131
|
```text
|
|
132
132
|
src/
|
|
@@ -139,7 +139,7 @@ script/
|
|
|
139
139
|
helpers/
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
## Risks
|
|
142
|
+
## Risks and notes
|
|
143
143
|
|
|
144
144
|
See [RISKS.md](./RISKS.md) for the full risk register. In short:
|
|
145
145
|
|
|
@@ -150,7 +150,7 @@ See [RISKS.md](./RISKS.md) for the full risk register. In short:
|
|
|
150
150
|
|
|
151
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.
|
|
152
152
|
|
|
153
|
-
## For AI
|
|
153
|
+
## For AI agents
|
|
154
154
|
|
|
155
155
|
- Start with `JBController`, `JBMultiTerminal`, and `JBTerminalStore`.
|
|
156
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
|
|
|
@@ -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
|
|-------------|------------|---------|
|
|
@@ -23,7 +23,7 @@ Use this file when you need deeper protocol reference material after the repo-lo
|
|
|
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
|
|-------|---------|---------|
|
|
@@ -143,7 +143,7 @@ Quick-reference for the most common `JBPermissionIds` values (from `@bananapus/p
|
|
|
143
143
|
|
|
144
144
|
IDs 22-33 are used by extension contracts (721 hook, buyback hook, router terminal, suckers).
|
|
145
145
|
|
|
146
|
-
## Common
|
|
146
|
+
## Common errors
|
|
147
147
|
|
|
148
148
|
Errors an agent is most likely to encounter. All are custom errors (revert with selector).
|
|
149
149
|
|
|
@@ -187,7 +187,7 @@ Errors an agent is most likely to encounter. All are custom errors (revert with
|
|
|
187
187
|
| `JBRulesets_InvalidWeightCutPercent` | `JBRulesets` | `weightCutPercent` exceeds `MAX_WEIGHT_CUT_PERCENT`. |
|
|
188
188
|
| `JBFundAccessLimits_InvalidPayoutLimitCurrencyOrdering` | `JBFundAccessLimits` | Payout limit currencies not in strictly increasing order. |
|
|
189
189
|
|
|
190
|
-
## Key
|
|
190
|
+
## Key events
|
|
191
191
|
|
|
192
192
|
The most important events for indexing and off-chain monitoring. Indexed params marked with `*`.
|
|
193
193
|
|
|
@@ -220,7 +220,7 @@ The most important events for indexing and off-chain monitoring. Indexed params
|
|
|
220
220
|
| `SetSplit` | `IJBSplits` | (projectId, rulesetId, groupId, split, caller) |
|
|
221
221
|
| `AddPriceFeed` | `IJBPrices` | (projectId, pricingCurrency, unitCurrency, feed, caller) |
|
|
222
222
|
|
|
223
|
-
## Hook
|
|
223
|
+
## Hook interface return types
|
|
224
224
|
|
|
225
225
|
### `IJBRulesetDataHook.beforePayRecordedWith()`
|
|
226
226
|
|
|
@@ -260,7 +260,7 @@ function hasMintPermissionFor(uint256 projectId, JBRuleset memory ruleset, addre
|
|
|
260
260
|
|
|
261
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).
|
|
262
262
|
|
|
263
|
-
## Example
|
|
263
|
+
## Example integration
|
|
264
264
|
|
|
265
265
|
```solidity
|
|
266
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
|
);
|
package/src/JBMultiTerminal.sol
CHANGED
|
@@ -66,18 +66,43 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
66
66
|
// --------------------------- custom errors ------------------------- //
|
|
67
67
|
//*********************************************************************//
|
|
68
68
|
|
|
69
|
+
/// @notice Thrown when no terminal can be found to pay a fee in the given token.
|
|
69
70
|
error JBMultiTerminal_FeeTerminalNotFound(address token);
|
|
71
|
+
|
|
72
|
+
/// @notice Thrown when a payout split routes back into the project that is paying out.
|
|
70
73
|
error JBMultiTerminal_MintNotAllowed(uint256 projectId, address terminal);
|
|
74
|
+
|
|
75
|
+
/// @notice Thrown when native value is sent with an operation that does not accept it.
|
|
71
76
|
error JBMultiTerminal_NoMsgValueAllowed(uint256 value);
|
|
77
|
+
|
|
78
|
+
/// @notice Thrown when a value exceeds the allowed maximum.
|
|
72
79
|
error JBMultiTerminal_OverflowAlert(uint256 value, uint256 limit);
|
|
80
|
+
|
|
81
|
+
/// @notice Thrown when the Permit2 allowance is less than the amount being paid.
|
|
73
82
|
error JBMultiTerminal_PermitAllowanceNotEnough(uint256 amount, uint256 allowance);
|
|
83
|
+
|
|
84
|
+
/// @notice Thrown when no terminal can be found to pay a recipient project's split in the given token.
|
|
74
85
|
error JBMultiTerminal_RecipientProjectTerminalNotFound(uint256 projectId, address token);
|
|
86
|
+
|
|
87
|
+
/// @notice Thrown when a token transfer reenters during a balance-delta measurement.
|
|
75
88
|
error JBMultiTerminal_ReentrantTokenTransfer(address token);
|
|
89
|
+
|
|
90
|
+
/// @notice Thrown when a split hook does not support the `IJBSplitHook` interface.
|
|
76
91
|
error JBMultiTerminal_SplitHookInvalid(IJBSplitHook hook);
|
|
92
|
+
|
|
93
|
+
/// @notice Thrown when an approved temporary allowance was not fully consumed by the spender.
|
|
77
94
|
error JBMultiTerminal_TemporaryAllowanceNotConsumed(address token, address spender, uint256 allowance);
|
|
95
|
+
|
|
96
|
+
/// @notice Thrown when migrating a terminal to itself.
|
|
78
97
|
error JBMultiTerminal_TerminalMigrationToSelf(uint256 projectId, address token);
|
|
98
|
+
|
|
99
|
+
/// @notice Thrown when the terminal being migrated to does not accept the same token.
|
|
79
100
|
error JBMultiTerminal_TerminalTokensIncompatible(uint256 projectId, address token, IJBTerminal terminal);
|
|
101
|
+
|
|
102
|
+
/// @notice Thrown when the terminal does not accept the given token.
|
|
80
103
|
error JBMultiTerminal_TokenNotAccepted(address token);
|
|
104
|
+
|
|
105
|
+
/// @notice Thrown when a value is less than the required minimum.
|
|
81
106
|
error JBMultiTerminal_UnderMin(uint256 value, uint256 min);
|
|
82
107
|
|
|
83
108
|
//*********************************************************************//
|
|
@@ -109,7 +134,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
109
134
|
/// @notice The contract that stores and manages the terminal's data.
|
|
110
135
|
IJBTerminalStore public immutable override STORE;
|
|
111
136
|
|
|
112
|
-
/// @notice The contract
|
|
137
|
+
/// @notice The contract that manages token minting and burning.
|
|
113
138
|
IJBTokens public immutable override TOKENS;
|
|
114
139
|
|
|
115
140
|
//*********************************************************************//
|
package/src/JBPermissions.sol
CHANGED
|
@@ -17,8 +17,13 @@ contract JBPermissions is ERC2771Context, IJBPermissions {
|
|
|
17
17
|
// --------------------------- custom errors ------------------------- //
|
|
18
18
|
//*********************************************************************//
|
|
19
19
|
|
|
20
|
+
/// @notice Thrown when attempting to set the reserved permission ID 0.
|
|
20
21
|
error JBPermissions_NoZeroPermission(address account, address operator, uint256 projectId);
|
|
22
|
+
|
|
23
|
+
/// @notice Thrown when a permission ID is greater than the maximum of 255.
|
|
21
24
|
error JBPermissions_PermissionIdOutOfBounds(uint256 permissionId);
|
|
25
|
+
|
|
26
|
+
/// @notice Thrown when the caller is not the account and lacks ROOT permission to set permissions on its behalf.
|
|
22
27
|
error JBPermissions_Unauthorized(address account, address operator, uint256 projectId, uint256 permissionId);
|
|
23
28
|
|
|
24
29
|
//*********************************************************************//
|
package/src/JBPrices.sol
CHANGED
|
@@ -23,10 +23,19 @@ contract JBPrices is JBControlled, JBPermissioned, ERC2771Context, Ownable, IJBP
|
|
|
23
23
|
// --------------------------- custom errors ------------------------- //
|
|
24
24
|
//*********************************************************************//
|
|
25
25
|
|
|
26
|
+
/// @notice Thrown when adding a price feed that is already registered for the same currency pair.
|
|
26
27
|
error JBPrices_PriceFeedAlreadyAdded(IJBPriceFeed feed);
|
|
28
|
+
|
|
29
|
+
/// @notice Thrown when no configured price feed can be found for the requested currency pair.
|
|
27
30
|
error JBPrices_PriceFeedNotFound(uint256 projectId, uint256 pricingCurrency, uint256 unitCurrency);
|
|
31
|
+
|
|
32
|
+
/// @notice Thrown when the provided price feed is the zero address.
|
|
28
33
|
error JBPrices_ZeroPriceFeed();
|
|
34
|
+
|
|
35
|
+
/// @notice Thrown when the pricing currency provided is zero.
|
|
29
36
|
error JBPrices_ZeroPricingCurrency(uint256 projectId, uint256 pricingCurrency);
|
|
37
|
+
|
|
38
|
+
/// @notice Thrown when the unit currency provided is zero.
|
|
30
39
|
error JBPrices_ZeroUnitCurrency(uint256 projectId, uint256 unitCurrency);
|
|
31
40
|
|
|
32
41
|
//*********************************************************************//
|
package/src/JBProjects.sol
CHANGED
|
@@ -18,8 +18,13 @@ contract JBProjects is ERC721, ERC2771Context, Ownable, IJBProjects {
|
|
|
18
18
|
// --------------------------- custom errors ------------------------- //
|
|
19
19
|
//*********************************************************************//
|
|
20
20
|
|
|
21
|
+
/// @notice Thrown when the configured creation fee exceeds the allowed maximum.
|
|
21
22
|
error JBProjects_CreationFeeExceedsMax(uint256 fee, uint256 max);
|
|
23
|
+
|
|
24
|
+
/// @notice Thrown when the native value sent does not equal the required creation fee.
|
|
22
25
|
error JBProjects_InvalidCreationFee(uint256 value, uint256 requiredFee);
|
|
26
|
+
|
|
27
|
+
/// @notice Thrown when a non-zero creation fee is configured without a fee receiver.
|
|
23
28
|
error JBProjects_ZeroCreationFeeReceiver();
|
|
24
29
|
|
|
25
30
|
//*********************************************************************//
|
package/src/JBRulesets.sol
CHANGED
|
@@ -25,11 +25,23 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
25
25
|
// --------------------------- custom errors ------------------------- //
|
|
26
26
|
//*********************************************************************//
|
|
27
27
|
|
|
28
|
+
/// @notice Thrown when the approval hook is not a contract or does not support the `IJBRulesetApprovalHook`
|
|
29
|
+
/// interface.
|
|
28
30
|
error JBRulesets_InvalidRulesetApprovalHook(IJBRulesetApprovalHook hook);
|
|
31
|
+
|
|
32
|
+
/// @notice Thrown when the ruleset duration exceeds the uint32 maximum.
|
|
29
33
|
error JBRulesets_InvalidRulesetDuration(uint256 duration, uint256 limit);
|
|
34
|
+
|
|
35
|
+
/// @notice Thrown when the ruleset's start plus duration exceeds the uint48 maximum.
|
|
30
36
|
error JBRulesets_InvalidRulesetEndTime(uint256 timestamp, uint256 limit);
|
|
37
|
+
|
|
38
|
+
/// @notice Thrown when the ruleset weight exceeds the uint112 maximum.
|
|
31
39
|
error JBRulesets_InvalidWeight(uint256 weight, uint256 limit);
|
|
40
|
+
|
|
41
|
+
/// @notice Thrown when the weight cut percent exceeds 100%.
|
|
32
42
|
error JBRulesets_InvalidWeightCutPercent(uint256 percent);
|
|
43
|
+
|
|
44
|
+
/// @notice Thrown when too many weight-cut iterations remain and the weight cache must be populated first.
|
|
33
45
|
error JBRulesets_WeightCacheRequired(uint256 projectId);
|
|
34
46
|
|
|
35
47
|
//*********************************************************************//
|
|
@@ -396,8 +408,8 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
396
408
|
// Get a reference to the approval status.
|
|
397
409
|
JBApprovalStatus approvalStatus = _approvalStatusOf({projectId: projectId, ruleset: ruleset});
|
|
398
410
|
|
|
399
|
-
// While the ruleset has
|
|
400
|
-
// the ruleset that the latest is based on, which has the latest approved configuration.
|
|
411
|
+
// While the ruleset has an approval hook that isn't approved or if it hasn't yet started, get a reference
|
|
412
|
+
// to the ruleset that the latest is based on, which has the latest approved configuration.
|
|
401
413
|
while (
|
|
402
414
|
(approvalStatus != JBApprovalStatus.Approved && approvalStatus != JBApprovalStatus.Empty)
|
|
403
415
|
// forge-lint: disable-next-line(block-timestamp)
|
|
@@ -472,7 +484,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
472
484
|
// Keep a reference to its approval status.
|
|
473
485
|
JBApprovalStatus approvalStatus;
|
|
474
486
|
|
|
475
|
-
// If an upcoming approvable ruleset has been queued, and
|
|
487
|
+
// If an upcoming approvable ruleset has been queued, and its approval status is Approved or ApprovalExpected,
|
|
476
488
|
// return its ruleset struct
|
|
477
489
|
if (upcomingApprovableRulesetId != 0) {
|
|
478
490
|
ruleset = _getStructFor({projectId: projectId, rulesetId: upcomingApprovableRulesetId, withMetadata: true});
|
|
@@ -495,7 +507,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
495
507
|
ruleset = _getStructFor({projectId: projectId, rulesetId: latestRulesetIdOf[projectId], withMetadata: true});
|
|
496
508
|
|
|
497
509
|
// If the latest ruleset starts in the future, it must start in the distant future
|
|
498
|
-
// Since
|
|
510
|
+
// Since it's not the upcoming approvable ruleset. In this case, base the upcoming ruleset on the base
|
|
499
511
|
// ruleset.
|
|
500
512
|
// forge-lint: disable-next-line(block-timestamp)
|
|
501
513
|
while (ruleset.start > block.timestamp) {
|
|
@@ -723,7 +735,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
723
735
|
// Get a reference to the approval status.
|
|
724
736
|
JBApprovalStatus approvalStatus = _approvalStatusOf({projectId: projectId, ruleset: baseRuleset});
|
|
725
737
|
|
|
726
|
-
// If the base ruleset has started but wasn't approved if
|
|
738
|
+
// If the base ruleset has started but wasn't approved if an approval hook exists
|
|
727
739
|
// OR it hasn't started but is currently approved
|
|
728
740
|
// OR it hasn't started but it is likely to be approved and takes place before the proposed one,
|
|
729
741
|
// set the struct to be the ruleset it's based on, which carries the latest approved ruleset.
|
package/src/JBSplits.sol
CHANGED
|
@@ -19,8 +19,13 @@ contract JBSplits is JBControlled, IJBSplits {
|
|
|
19
19
|
// --------------------------- custom errors ------------------------- //
|
|
20
20
|
//*********************************************************************//
|
|
21
21
|
|
|
22
|
+
/// @notice Thrown when a new set of splits omits a still-locked split from the previous set.
|
|
22
23
|
error JBSplits_PreviousLockedSplitsNotIncluded(uint256 projectId, uint256 rulesetId);
|
|
24
|
+
|
|
25
|
+
/// @notice Thrown when the splits in a group sum to more than 100%.
|
|
23
26
|
error JBSplits_TotalPercentExceeds100(uint256 projectId, uint256 rulesetId, uint256 groupId, uint256 percentTotal);
|
|
27
|
+
|
|
28
|
+
/// @notice Thrown when a split is configured with a percent of zero.
|
|
24
29
|
error JBSplits_ZeroSplitPercent(uint256 projectId, uint256 rulesetId, uint256 groupId, uint256 splitIndex);
|
|
25
30
|
|
|
26
31
|
//*********************************************************************//
|
package/src/JBTerminalStore.sol
CHANGED
|
@@ -39,22 +39,48 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
39
39
|
// --------------------------- custom errors ------------------------- //
|
|
40
40
|
//*********************************************************************//
|
|
41
41
|
|
|
42
|
+
/// @notice Thrown when setting an accounting context for a token that already has one.
|
|
42
43
|
error JBTerminalStore_AccountingContextAlreadySet(address token);
|
|
44
|
+
|
|
45
|
+
/// @notice Thrown when a token's provided decimals do not match the decimals it reports.
|
|
43
46
|
error JBTerminalStore_AccountingContextDecimalsMismatch(
|
|
44
47
|
address token, uint256 providedDecimals, uint256 expectedDecimals
|
|
45
48
|
);
|
|
49
|
+
|
|
50
|
+
/// @notice Thrown when a token's decimals are outside the supported range.
|
|
46
51
|
error JBTerminalStore_AccountingContextDecimalsOutOfRange(address token, uint256 decimals);
|
|
52
|
+
|
|
53
|
+
/// @notice Thrown when the project's current ruleset does not allow adding accounting contexts.
|
|
47
54
|
error JBTerminalStore_AddingAccountingContextNotAllowed(uint256 projectId, uint256 rulesetId, address terminal);
|
|
55
|
+
|
|
56
|
+
/// @notice Thrown when the used surplus allowance exceeds the amount the controller granted.
|
|
48
57
|
error JBTerminalStore_InadequateControllerAllowance(uint256 amount, uint256 allowance);
|
|
49
58
|
|
|
59
|
+
/// @notice Thrown when the amount to use exceeds the terminal's recorded balance or surplus.
|
|
50
60
|
error JBTerminalStore_InadequateTerminalStoreBalance(uint256 amount, uint256 balance);
|
|
61
|
+
|
|
62
|
+
/// @notice Thrown when cashing out more tokens than the effective total supply.
|
|
51
63
|
error JBTerminalStore_InsufficientTokens(uint256 count, uint256 totalSupply);
|
|
64
|
+
|
|
65
|
+
/// @notice Thrown when a hook specification asks to forward more than the amount paid.
|
|
52
66
|
error JBTerminalStore_InvalidAmountToForwardHook(uint256 amount, uint256 paidAmount);
|
|
67
|
+
|
|
68
|
+
/// @notice Thrown when a hook specification is flagged as a no-op but carries a non-zero amount.
|
|
53
69
|
error JBTerminalStore_NoopHookSpecHasAmount(uint256 amount);
|
|
70
|
+
|
|
71
|
+
/// @notice Thrown when the project has no current ruleset.
|
|
54
72
|
error JBTerminalStore_RulesetNotFound(uint256 projectId);
|
|
73
|
+
|
|
74
|
+
/// @notice Thrown when paying a project whose current ruleset pauses payments.
|
|
55
75
|
error JBTerminalStore_RulesetPaymentPaused(uint256 projectId, uint256 rulesetId);
|
|
76
|
+
|
|
77
|
+
/// @notice Thrown when the project's current ruleset does not allow terminal migration.
|
|
56
78
|
error JBTerminalStore_TerminalMigrationNotAllowed(uint256 projectId, uint256 rulesetId);
|
|
79
|
+
|
|
80
|
+
/// @notice Thrown when a value to record exceeds the uint224 maximum.
|
|
57
81
|
error JBTerminalStore_Uint224Overflow(uint256 value);
|
|
82
|
+
|
|
83
|
+
/// @notice Thrown when an accounting context's currency is zero.
|
|
58
84
|
error JBTerminalStore_ZeroAccountingContextCurrency(address token);
|
|
59
85
|
|
|
60
86
|
//*********************************************************************//
|
|
@@ -465,7 +491,7 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
465
491
|
revert JBTerminalStore_InadequateTerminalStoreBalance({amount: amountPaidOut, balance: currentBalance});
|
|
466
492
|
}
|
|
467
493
|
|
|
468
|
-
//
|
|
494
|
+
// Remove the paid out funds from the project's token balance.
|
|
469
495
|
unchecked {
|
|
470
496
|
balanceOf[msg.sender][projectId][token] = currentBalance - amountPaidOut;
|
|
471
497
|
}
|
|
@@ -1137,7 +1163,7 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
1137
1163
|
if (weight == 0) return (ruleset, 0, hookSpecifications, balanceDiff);
|
|
1138
1164
|
|
|
1139
1165
|
// If the terminal should base its weight on a currency other than the terminal's currency, determine the
|
|
1140
|
-
// factor. The weight is always a fixed point
|
|
1166
|
+
// factor. The weight is always a fixed point number with 18 decimals. To ensure this, the ratio should use the
|
|
1141
1167
|
// same
|
|
1142
1168
|
// number of decimals as the `amount`.
|
|
1143
1169
|
uint256 weightRatio = amount.currency == ruleset.baseCurrency()
|
|
@@ -1330,7 +1356,7 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
1330
1356
|
: mulDiv({
|
|
1331
1357
|
x: surplus,
|
|
1332
1358
|
y: 10 ** _MAX_FIXED_POINT_FIDELITY, // Use `_MAX_FIXED_POINT_FIDELITY` to keep as much of the
|
|
1333
|
-
//
|
|
1359
|
+
// surplus's fidelity as possible when converting.
|
|
1334
1360
|
denominator: PRICES.pricePerUnitOf({
|
|
1335
1361
|
projectId: projectId,
|
|
1336
1362
|
pricingCurrency: accountingContext.currency,
|
package/src/JBTokens.sol
CHANGED
|
@@ -19,16 +19,37 @@ contract JBTokens is JBControlled, IJBTokens {
|
|
|
19
19
|
// --------------------------- custom errors ------------------------- //
|
|
20
20
|
//*********************************************************************//
|
|
21
21
|
|
|
22
|
+
/// @notice Thrown when deploying a token with an empty name.
|
|
22
23
|
error JBTokens_EmptyName(uint256 projectId);
|
|
24
|
+
|
|
25
|
+
/// @notice Thrown when deploying a token with an empty symbol.
|
|
23
26
|
error JBTokens_EmptySymbol(uint256 projectId);
|
|
27
|
+
|
|
28
|
+
/// @notice Thrown when the token to set is the zero address.
|
|
24
29
|
error JBTokens_EmptyToken(uint256 projectId);
|
|
30
|
+
|
|
31
|
+
/// @notice Thrown when burning more credits than the holder's credit balance.
|
|
25
32
|
error JBTokens_InsufficientCredits(uint256 count, uint256 creditBalance);
|
|
33
|
+
|
|
34
|
+
/// @notice Thrown when burning more tokens than the holder's combined token and credit balance.
|
|
26
35
|
error JBTokens_InsufficientTokensToBurn(uint256 count, uint256 tokenBalance);
|
|
36
|
+
|
|
37
|
+
/// @notice Thrown when minting would push the total supply past the uint208 maximum.
|
|
27
38
|
error JBTokens_OverflowAlert(uint256 value, uint256 limit);
|
|
39
|
+
|
|
40
|
+
/// @notice Thrown when the project already has a token set.
|
|
28
41
|
error JBTokens_ProjectAlreadyHasToken(IJBToken token);
|
|
42
|
+
|
|
43
|
+
/// @notice Thrown when the token is already in use by another project.
|
|
29
44
|
error JBTokens_TokenAlreadyBeingUsed(uint256 projectId);
|
|
45
|
+
|
|
46
|
+
/// @notice Thrown when the token reports that it cannot be added to the project.
|
|
30
47
|
error JBTokens_TokenCantBeAdded(uint256 projectId);
|
|
48
|
+
|
|
49
|
+
/// @notice Thrown when the project has no token set.
|
|
31
50
|
error JBTokens_TokenNotFound(uint256 projectId);
|
|
51
|
+
|
|
52
|
+
/// @notice Thrown when the token does not use 18 decimals.
|
|
32
53
|
error JBTokens_TokensMustHave18Decimals(uint256 decimals);
|
|
33
54
|
|
|
34
55
|
//*********************************************************************//
|
|
@@ -12,6 +12,7 @@ abstract contract JBControlled is IJBControlled {
|
|
|
12
12
|
// --------------------------- custom errors -------------------------- //
|
|
13
13
|
//*********************************************************************//
|
|
14
14
|
|
|
15
|
+
/// @notice Thrown when the caller is not the controller of the specified project.
|
|
15
16
|
error JBControlled_ControllerUnauthorized(address controller);
|
|
16
17
|
|
|
17
18
|
//*********************************************************************//
|
|
@@ -14,6 +14,7 @@ abstract contract JBPermissioned is Context, IJBPermissioned {
|
|
|
14
14
|
// --------------------------- custom errors -------------------------- //
|
|
15
15
|
//*********************************************************************//
|
|
16
16
|
|
|
17
|
+
/// @notice Thrown when the sender lacks the required permission from the account to perform the operation.
|
|
17
18
|
error JBPermissioned_Unauthorized(address account, address sender, uint256 projectId, uint256 permissionId);
|
|
18
19
|
|
|
19
20
|
//*********************************************************************//
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
4
|
/// @notice The lifecycle states a queued ruleset can be in relative to its approval hook.
|
|
5
|
-
/// @dev `Empty` — no ruleset exists.
|
|
6
|
-
///
|
|
7
|
-
///
|
|
8
|
-
/// `
|
|
9
|
-
///
|
|
10
|
-
/// ruleset continues.
|
|
5
|
+
/// @dev `Empty` — no ruleset exists.
|
|
6
|
+
/// `Upcoming` — queued but not yet eligible for approval check.
|
|
7
|
+
/// `Active` — currently governing the project.
|
|
8
|
+
/// `ApprovalExpected` — the deadline hasn't passed yet, expected to be approved.
|
|
9
|
+
/// `Approved` — passed the approval hook and will take effect.
|
|
10
|
+
/// `Failed` — rejected by the approval hook; the previous ruleset continues.
|
|
11
11
|
enum JBApprovalStatus {
|
|
12
12
|
Empty,
|
|
13
13
|
Upcoming,
|
|
@@ -25,9 +25,16 @@ pragma solidity 0.8.28;
|
|
|
25
25
|
* +-----------------------+
|
|
26
26
|
*/
|
|
27
27
|
library JBMetadataResolver {
|
|
28
|
+
/// @notice Thrown when the data to add is not padded to a multiple of 32 bytes.
|
|
28
29
|
error JBMetadataResolver_DataNotPadded(uint256 dataLength);
|
|
30
|
+
|
|
31
|
+
/// @notice Thrown when the IDs and datas arrays have mismatched lengths.
|
|
29
32
|
error JBMetadataResolver_LengthMismatch(uint256 idsLength, uint256 datasLength);
|
|
33
|
+
|
|
34
|
+
/// @notice Thrown when the metadata offset exceeds the maximum addressable offset of 255.
|
|
30
35
|
error JBMetadataResolver_MetadataTooLong(uint256 offset, uint256 maxOffset);
|
|
36
|
+
|
|
37
|
+
/// @notice Thrown when the metadata is shorter than the minimum required length.
|
|
31
38
|
error JBMetadataResolver_MetadataTooShort(uint256 metadataLength, uint256 minMetadataLength);
|
|
32
39
|
|
|
33
40
|
// Constants alphabetized per STYLE_GUIDE; trailing comments document derivation.
|
|
@@ -260,7 +267,7 @@ library JBMetadataResolver {
|
|
|
260
267
|
if (parsedId == id) {
|
|
261
268
|
// Are we at the end of the lookup table (either at the start of data's or next offset is 0/in the
|
|
262
269
|
// padding)
|
|
263
|
-
// If not, only return until from this offset to the
|
|
270
|
+
// If not, only return until from this offset to the beginning of the next offset
|
|
264
271
|
uint256 end = (i + NEXT_ID_OFFSET >= firstOffset * WORD_SIZE || metadata[i + NEXT_ID_OFFSET] == 0)
|
|
265
272
|
? metadata.length
|
|
266
273
|
: uint256(uint8(metadata[i + NEXT_ID_OFFSET])) * WORD_SIZE;
|
|
@@ -295,6 +302,7 @@ library JBMetadataResolver {
|
|
|
295
302
|
/// @param start The start index to slice at.
|
|
296
303
|
/// @param end The end index to slice at.
|
|
297
304
|
/// @param slicedBytes The sliced array.
|
|
305
|
+
/// @return slicedBytes The sliced array.
|
|
298
306
|
function _sliceBytes(bytes memory data, uint256 start, uint256 end)
|
|
299
307
|
private
|
|
300
308
|
pure
|
|
@@ -44,8 +44,22 @@ interface IJBPayoutSplitGroupExecutor {
|
|
|
44
44
|
/// @dev Extracted as an external library to reduce `JBMultiTerminal` bytecode size. Called via DELEGATECALL, so events
|
|
45
45
|
/// are emitted from the terminal's address.
|
|
46
46
|
library JBPayoutSplitGroupLib {
|
|
47
|
+
/// @notice A payout to a split reverted, so the amount was returned to the project's balance.
|
|
48
|
+
/// @param projectId The ID of the project whose payout reverted.
|
|
49
|
+
/// @param split The split that was being paid when the revert occurred.
|
|
50
|
+
/// @param amount The amount that was being sent to the split.
|
|
51
|
+
/// @param reason The reason the payout reverted.
|
|
52
|
+
/// @param caller The address that called the payout function.
|
|
47
53
|
event PayoutReverted(uint256 indexed projectId, JBSplit split, uint256 amount, bytes reason, address caller);
|
|
48
54
|
|
|
55
|
+
/// @notice A payout was sent to a split.
|
|
56
|
+
/// @param projectId The ID of the project that the payout was made from.
|
|
57
|
+
/// @param rulesetId The ID of the ruleset the split belongs to.
|
|
58
|
+
/// @param group The group the split belongs to.
|
|
59
|
+
/// @param split The split that was paid.
|
|
60
|
+
/// @param amount The amount that was sent to the split.
|
|
61
|
+
/// @param netAmount The amount that the split recipient actually received, after fees.
|
|
62
|
+
/// @param caller The address that called the payout function.
|
|
49
63
|
event SendPayoutToSplit(
|
|
50
64
|
uint256 indexed projectId,
|
|
51
65
|
uint256 indexed rulesetId,
|
|
@@ -8,7 +8,9 @@ import {IJBPriceFeed} from "../interfaces/IJBPriceFeed.sol";
|
|
|
8
8
|
contract JBMatchingPriceFeed is IJBPriceFeed {
|
|
9
9
|
constructor() {}
|
|
10
10
|
|
|
11
|
-
/// @
|
|
11
|
+
/// @notice Gets the current price (per 1 unit) from the feed.
|
|
12
|
+
/// @param decimals The number of decimals the return value should use.
|
|
13
|
+
/// @return The current unit price from the feed, as a fixed point number with the specified number of decimals.
|
|
12
14
|
function currentUnitPrice(uint256 decimals) public view virtual override returns (uint256) {
|
|
13
15
|
return 10 ** decimals;
|
|
14
16
|
}
|