@bananapus/core-v6 0.0.77 → 0.0.78
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/package.json +1 -1
- package/src/JBDirectory.sol +1 -2
- package/src/JBMultiTerminal.sol +26 -18
package/package.json
CHANGED
package/src/JBDirectory.sol
CHANGED
|
@@ -91,7 +91,6 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
91
91
|
/// @dev Can only be called if:
|
|
92
92
|
/// - The ruleset's metadata has `allowSetController` enabled, and the caller is the project's owner or has
|
|
93
93
|
/// `SET_CONTROLLER` permission.
|
|
94
|
-
/// - OR the caller is the project's current controller.
|
|
95
94
|
/// - OR the caller `isAllowedToSetFirstController` and the project has no controller yet.
|
|
96
95
|
/// @param projectId The ID of the project to set the controller for.
|
|
97
96
|
/// @param controller The address of the controller to set.
|
|
@@ -112,7 +111,7 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
112
111
|
|
|
113
112
|
// Get a reference to a flag indicating whether the project is allowed to set its controller.
|
|
114
113
|
// Setting the controller is allowed if the project doesn't have a controller,
|
|
115
|
-
// OR if the
|
|
114
|
+
// OR if the current controller doesn't enforce access control,
|
|
116
115
|
// OR if the project's ruleset allows setting the controller.
|
|
117
116
|
bool allowSetController = address(currentController) == address(0)
|
|
118
117
|
|| !currentController.supportsInterface(type(IJBDirectoryAccessControl).interfaceId)
|
package/src/JBMultiTerminal.sol
CHANGED
|
@@ -1274,24 +1274,21 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1274
1274
|
// Cache whether the beneficiary is feeless.
|
|
1275
1275
|
bool beneficiaryIsFeeless = _isFeeless({addr: beneficiary, projectId: projectId});
|
|
1276
1276
|
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
tokenToReclaim: tokenToReclaim,
|
|
1287
|
-
beneficiaryIsFeeless: beneficiaryIsFeeless,
|
|
1288
|
-
metadata: metadata
|
|
1289
|
-
});
|
|
1277
|
+
// Record the cash out.
|
|
1278
|
+
(ruleset, reclaimAmount, cashOutTaxRate, hookSpecifications) = STORE.recordCashOutFor({
|
|
1279
|
+
holder: holder,
|
|
1280
|
+
projectId: projectId,
|
|
1281
|
+
cashOutCount: cashOutCount,
|
|
1282
|
+
tokenToReclaim: tokenToReclaim,
|
|
1283
|
+
beneficiaryIsFeeless: beneficiaryIsFeeless,
|
|
1284
|
+
metadata: metadata
|
|
1285
|
+
});
|
|
1290
1286
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1287
|
+
// Burn the project tokens. The controller is only needed for this burn, so it is fetched once and only when
|
|
1288
|
+
// there are tokens to burn.
|
|
1289
|
+
if (cashOutCount != 0) {
|
|
1290
|
+
_controllerOf(projectId)
|
|
1291
|
+
.burnTokensOf({holder: holder, projectId: projectId, tokenCount: cashOutCount, memo: ""});
|
|
1295
1292
|
}
|
|
1296
1293
|
|
|
1297
1294
|
// Keep a reference to the amount being reclaimed that is subject to fees.
|
|
@@ -2072,6 +2069,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
2072
2069
|
feeAmount = _feeAmountFrom(amount);
|
|
2073
2070
|
|
|
2074
2071
|
if (shouldHoldFees) {
|
|
2072
|
+
// The held-fee record stores the basis amount in a `uint224`. Reject a basis that wouldn't fit so it
|
|
2073
|
+
// can't silently truncate and corrupt the eventual fee processing/refund.
|
|
2074
|
+
_checkFitsIn({value: amount, max: type(uint224).max});
|
|
2075
|
+
|
|
2075
2076
|
// Store the gross amount so future repayments can recover the corresponding fee.
|
|
2076
2077
|
// Capture the in-flight `currentReferralProjectId` so attribution survives the 28-day hold window —
|
|
2077
2078
|
// by the time `processHeldFeesOf` runs, the transient slot has been cleared. The encoded
|
|
@@ -2136,7 +2137,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
2136
2137
|
}
|
|
2137
2138
|
|
|
2138
2139
|
// Make sure the amount being paid is less than the maximum permit2 allowance.
|
|
2139
|
-
|
|
2140
|
+
_checkFitsIn({value: amount, max: type(uint160).max});
|
|
2140
2141
|
|
|
2141
2142
|
// Otherwise we attempt to use the PERMIT2 method.
|
|
2142
2143
|
// forge-lint: disable-next-line(unsafe-typecast)
|
|
@@ -2346,6 +2347,13 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
2346
2347
|
// -------------------------- private helpers ------------------------ //
|
|
2347
2348
|
//*********************************************************************//
|
|
2348
2349
|
|
|
2350
|
+
/// @notice Revert if a value doesn't fit within a maximum, so a later narrowing cast can't silently truncate it.
|
|
2351
|
+
/// @param value The value to bound.
|
|
2352
|
+
/// @param max The largest value that fits the target width.
|
|
2353
|
+
function _checkFitsIn(uint256 value, uint256 max) private pure {
|
|
2354
|
+
if (value > max) revert JBMultiTerminal_OverflowAlert(value, max);
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2349
2357
|
/// @notice The terminal fee charged from a pre-fee `amount`.
|
|
2350
2358
|
/// @param amount The amount before the fee is applied.
|
|
2351
2359
|
/// @return The fee amount.
|