@bananapus/core-v6 0.0.38 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/foundry.toml +1 -1
  2. package/package.json +1 -1
  3. package/src/JBChainlinkV3PriceFeed.sol +4 -1
  4. package/src/JBChainlinkV3SequencerPriceFeed.sol +4 -2
  5. package/src/JBController.sol +67 -58
  6. package/src/JBDeadline.sol +4 -4
  7. package/src/JBDirectory.sol +38 -36
  8. package/src/JBERC20.sol +10 -9
  9. package/src/JBFeelessAddresses.sol +6 -3
  10. package/src/JBFundAccessLimits.sol +26 -22
  11. package/src/JBMultiTerminal.sol +128 -125
  12. package/src/JBPermissions.sol +35 -38
  13. package/src/JBPrices.sol +25 -20
  14. package/src/JBProjects.sol +6 -3
  15. package/src/JBRulesets.sol +45 -42
  16. package/src/JBSplits.sol +19 -17
  17. package/src/JBTerminalStore.sol +57 -50
  18. package/src/JBTokens.sol +42 -32
  19. package/src/abstract/JBControlled.sol +3 -1
  20. package/src/abstract/JBPermissioned.sol +3 -1
  21. package/src/enums/JBApprovalStatus.sol +7 -1
  22. package/src/interfaces/IJBCashOutTerminal.sol +5 -5
  23. package/src/interfaces/IJBController.sol +13 -12
  24. package/src/interfaces/IJBDirectory.sol +3 -1
  25. package/src/interfaces/IJBMigratable.sol +5 -5
  26. package/src/interfaces/IJBMultiTerminal.sol +3 -2
  27. package/src/interfaces/IJBPayoutTerminal.sol +3 -3
  28. package/src/interfaces/IJBPermissions.sol +6 -5
  29. package/src/interfaces/IJBPermitTerminal.sol +1 -1
  30. package/src/interfaces/IJBPrices.sol +7 -5
  31. package/src/interfaces/IJBRulesets.sol +2 -1
  32. package/src/interfaces/IJBSplits.sol +2 -1
  33. package/src/interfaces/IJBTerminal.sol +13 -11
  34. package/src/interfaces/IJBTerminalStore.sol +23 -21
  35. package/src/interfaces/IJBTokens.sol +8 -7
  36. package/src/libraries/JBCashOuts.sol +8 -3
  37. package/src/libraries/JBConstants.sol +12 -3
  38. package/src/libraries/JBCurrencyIds.sol +2 -0
  39. package/src/libraries/JBFees.sol +5 -1
  40. package/src/libraries/JBFixedPointNumber.sol +2 -0
  41. package/src/libraries/JBPayoutSplitGroupLib.sol +10 -7
  42. package/src/libraries/JBRulesetMetadataResolver.sol +4 -0
  43. package/src/libraries/JBSplitGroupIds.sol +2 -1
  44. package/src/libraries/JBSurplus.sol +4 -2
  45. package/src/periphery/JBMatchingPriceFeed.sol +2 -0
  46. package/src/structs/JBAccountingContext.sol +7 -4
  47. package/src/structs/JBAfterCashOutRecordedContext.sol +8 -8
  48. package/src/structs/JBAfterPayRecordedContext.sol +5 -5
  49. package/src/structs/JBBeforeCashOutRecordedContext.sol +7 -7
  50. package/src/structs/JBBeforePayRecordedContext.sol +5 -5
  51. package/src/structs/JBFundAccessLimitGroup.sol +10 -17
  52. package/src/structs/JBPermissionsData.sol +3 -3
  53. package/src/structs/JBRuleset.sol +18 -26
  54. package/src/structs/JBRulesetConfig.sol +13 -25
  55. package/src/structs/JBRulesetMetadata.sol +25 -32
  56. package/src/structs/JBSplitHookContext.sol +2 -2
@@ -7,8 +7,12 @@ import {IJBFundAccessLimits} from "./interfaces/IJBFundAccessLimits.sol";
7
7
  import {JBCurrencyAmount} from "./structs/JBCurrencyAmount.sol";
8
8
  import {JBFundAccessLimitGroup} from "./structs/JBFundAccessLimitGroup.sol";
9
9
 
10
- /// @notice Stores and manages terminal fund access limits for each project.
11
- /// @dev See the `JBFundAccessLimitGroup` struct to learn about payout limits and surplus allowances.
10
+ /// @notice Controls how much a project can withdraw from its terminals each funding cycle. Two types of limits:
11
+ /// **Payout limits** cap how much can be distributed to splits and the project owner. **Surplus allowances** cap how
12
+ /// much the project owner can pull from the surplus (funds above payout limits). Both reset each ruleset cycle.
13
+ /// @dev Limits are denominated in a currency (which may differ from the held token) and resolved at withdrawal time
14
+ /// via `JBPrices`. An empty `fundAccessLimitGroups` array means zero access (not unlimited) — use `type(uint224).max`
15
+ /// for unlimited.
12
16
  contract JBFundAccessLimits is JBControlled, IJBFundAccessLimits {
13
17
  //*********************************************************************//
14
18
  // --------------------------- custom errors ------------------------- //
@@ -61,11 +65,12 @@ contract JBFundAccessLimits is JBControlled, IJBFundAccessLimits {
61
65
  // ---------------------- external transactions ---------------------- //
62
66
  //*********************************************************************//
63
67
 
64
- /// @notice Sets limits on the amount of funds a project can access from its terminals during a ruleset.
65
- /// @dev Only a project's controller can set its fund access limits.
66
- /// @dev Payout limits and surplus allowances must be specified in strictly increasing order (by currency) to
67
- /// prevent duplicates.
68
- /// @param projectId The ID of the project whose fund access limits are being set.
68
+ /// @notice Configure how much a project can withdraw from each of its terminals during a ruleset. Payout limits
69
+ /// cap how much can be distributed to splits/owner; surplus allowances cap how much extra the owner can pull from
70
+ /// surplus. Both reset each funding cycle.
71
+ /// @dev Only a project's controller can set fund access limits (called during `queueRulesetsOf`).
72
+ /// @dev Limits within each group must be sorted by currency in strictly increasing order to prevent duplicates.
73
+ /// @param projectId The ID of the project to set fund access limits for.
69
74
  /// @param rulesetId The ID of the ruleset that the limits will apply within.
70
75
  /// @param fundAccessLimitGroups An array containing payout limits and surplus allowances for each payment terminal.
71
76
  /// Amounts are fixed point numbers using the same number of decimals as the associated terminal.
@@ -152,14 +157,15 @@ contract JBFundAccessLimits is JBControlled, IJBFundAccessLimits {
152
157
  // ------------------------- external views -------------------------- //
153
158
  //*********************************************************************//
154
159
 
155
- /// @notice A project's payout limit for a given ruleset, terminal, token, and currency.
156
- /// @dev The fixed point return amount will use the same number of decimals as the `terminal`.
160
+ /// @notice Look up how much a project can distribute (via `sendPayoutsOf`) from a specific terminal and token,
161
+ /// denominated in a specific currency. Returns 0 if no limit is configured for that currency.
162
+ /// @dev The fixed point return amount uses the same number of decimals as the terminal.
157
163
  /// @param projectId The project's ID.
158
164
  /// @param rulesetId The ruleset's ID.
159
165
  /// @param terminal The terminal the payout limit applies to.
160
166
  /// @param token The token the payout limit applies to.
161
167
  /// @param currency The currency the payout limit is denominated in.
162
- /// @return payoutLimit The payout limit, as a fixed point number with the same number of decimals as the provided
168
+ /// @return payoutLimit The payout limit, as a fixed point number with the same number of decimals as the
163
169
  /// terminal.
164
170
  function payoutLimitOf(
165
171
  uint256 projectId,
@@ -195,10 +201,9 @@ contract JBFundAccessLimits is JBControlled, IJBFundAccessLimits {
195
201
  }
196
202
  }
197
203
 
198
- /// @notice A project's payout limits for a given ruleset, terminal, and token.
199
- /// @dev The total value of `token`s that a project can pay out from the terminal during the ruleset is dictated
200
- /// by a list of payout limits. Each payout limit is a fixed-point amount in terms of a currency.
201
- /// @dev The fixed point `amount`s returned will use the same number of decimals as the `terminal`.
204
+ /// @notice Get all payout limits for a project's terminal and token during a ruleset. A project can have multiple
205
+ /// payout limits denominated in different currencies (e.g. 10,000 USD + 5 ETH). Each is enforced independently.
206
+ /// @dev The fixed point `amount`s returned use the same number of decimals as the terminal.
202
207
  /// @param projectId The project's ID.
203
208
  /// @param rulesetId The ruleset's ID.
204
209
  /// @param terminal The terminal the payout limits apply to.
@@ -243,15 +248,16 @@ contract JBFundAccessLimits is JBControlled, IJBFundAccessLimits {
243
248
  }
244
249
  }
245
250
 
246
- /// @notice A project's surplus allowance for a given ruleset, terminal, token, and currency.
247
- /// @dev The fixed point return amount will use the same number of decimals as the `terminal`.
251
+ /// @notice Look up how much a project's owner can withdraw from the surplus (via `useAllowanceOf`) from a specific
252
+ /// terminal and token, denominated in a specific currency. Returns 0 if no allowance is configured.
253
+ /// @dev The fixed point return amount uses the same number of decimals as the terminal.
248
254
  /// @param projectId The project's ID.
249
255
  /// @param rulesetId The ruleset's ID.
250
256
  /// @param terminal The terminal the surplus allowance applies to.
251
257
  /// @param token The token the surplus allowance applies to.
252
258
  /// @param currency The currency that the surplus allowance is denominated in.
253
259
  /// @return surplusAllowance The surplus allowance, as a fixed point number with the same number of decimals as the
254
- /// provided terminal.
260
+ /// terminal.
255
261
  function surplusAllowanceOf(
256
262
  uint256 projectId,
257
263
  uint256 rulesetId,
@@ -287,11 +293,9 @@ contract JBFundAccessLimits is JBControlled, IJBFundAccessLimits {
287
293
  }
288
294
  }
289
295
 
290
- /// @notice A project's surplus allowances for a given ruleset, terminal, and token.
291
- /// @dev The total value of `token`s that a project can pay out from its surplus in a terminal during the ruleset
292
- /// is dictated by a list of surplus allowances. Each surplus allowance is a fixed-point amount in terms of a
293
- /// currency.
294
- /// @dev The fixed point `amount`s returned will use the same number of decimals as the `terminal`.
296
+ /// @notice Get all surplus allowances for a project's terminal and token during a ruleset. Like payout limits, a
297
+ /// project can have multiple surplus allowances in different currencies, each enforced independently.
298
+ /// @dev The fixed point `amount`s returned use the same number of decimals as the terminal.
295
299
  /// @param projectId The project's ID.
296
300
  /// @param rulesetId The ruleset's ID.
297
301
  /// @param terminal The terminal the surplus allowances apply to.