@bananapus/core-v6 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADMINISTRATION.md +5 -1
- package/ARCHITECTURE.md +2 -1
- package/AUDIT_INSTRUCTIONS.md +342 -0
- package/CHANGE_LOG.md +375 -0
- package/README.md +6 -6
- package/RISKS.md +171 -50
- package/SKILLS.md +11 -6
- package/STYLE_GUIDE.md +16 -2
- package/USER_JOURNEYS.md +622 -0
- package/package.json +2 -2
- package/script/Deploy.s.sol +22 -13
- package/script/DeployPeriphery.s.sol +76 -52
- package/script/helpers/CoreDeploymentLib.sol +83 -35
- package/src/JBChainlinkV3PriceFeed.sol +1 -0
- package/src/JBController.sol +23 -3
- package/src/JBDeadline.sol +3 -0
- package/src/JBDirectory.sol +2 -1
- package/src/JBERC20.sol +12 -3
- package/src/JBFundAccessLimits.sol +12 -2
- package/src/JBMultiTerminal.sol +53 -10
- package/src/JBPermissions.sol +3 -0
- package/src/JBPrices.sol +8 -2
- package/src/JBProjects.sol +1 -1
- package/src/JBRulesets.sol +14 -0
- package/src/JBSplits.sol +14 -5
- package/src/JBTerminalStore.sol +57 -47
- package/src/JBTokens.sol +43 -4
- package/src/interfaces/IJBController.sol +6 -0
- package/src/interfaces/IJBPermitTerminal.sol +1 -0
- package/src/interfaces/IJBTerminalStore.sol +3 -0
- package/src/interfaces/IJBToken.sol +5 -0
- package/src/interfaces/IJBTokens.sol +13 -0
- package/src/libraries/JBFees.sol +2 -0
- package/src/libraries/JBMetadataResolver.sol +24 -7
- package/src/libraries/JBRulesetMetadataResolver.sol +21 -21
- package/src/structs/JBAccountingContext.sol +1 -0
- package/src/structs/JBAfterCashOutRecordedContext.sol +1 -0
- package/src/structs/JBAfterPayRecordedContext.sol +1 -0
- package/src/structs/JBBeforeCashOutRecordedContext.sol +5 -0
- package/src/structs/JBBeforePayRecordedContext.sol +1 -0
- package/src/structs/JBCashOutHookSpecification.sol +1 -0
- package/src/structs/JBCurrencyAmount.sol +1 -0
- package/src/structs/JBFee.sol +1 -0
- package/src/structs/JBFundAccessLimitGroup.sol +1 -0
- package/src/structs/JBPayHookSpecification.sol +1 -0
- package/src/structs/JBPermissionsData.sol +1 -0
- package/src/structs/JBRuleset.sol +1 -0
- package/src/structs/JBRulesetConfig.sol +1 -0
- package/src/structs/JBRulesetMetadata.sol +1 -0
- package/src/structs/JBRulesetWeightCache.sol +1 -0
- package/src/structs/JBRulesetWithMetadata.sol +1 -0
- package/src/structs/JBSingleAllowance.sol +1 -0
- package/src/structs/JBSplit.sol +1 -0
- package/src/structs/JBSplitGroup.sol +1 -0
- package/src/structs/JBSplitHookContext.sol +1 -0
- package/src/structs/JBTerminalConfig.sol +1 -0
- package/src/structs/JBTokenAmount.sol +1 -0
- package/test/ComprehensiveInvariant.t.sol +15 -2
- package/test/CoreExploitTests.t.sol +34 -1
- package/test/EconomicSimulation.t.sol +10 -2
- package/test/EntryPointPermutations.t.sol +17 -3
- package/test/FlashLoanAttacks.t.sol +12 -1
- package/test/PermissionEscalation.t.sol +53 -10
- package/test/RulesetTransitions.t.sol +15 -1
- package/test/SplitLoopTests.t.sol +25 -2
- package/test/TestAccessToFunds.sol +17 -2
- package/test/TestAuditResponseDesignProofs.sol +434 -0
- package/test/TestCashOut.sol +15 -1
- package/test/TestCashOutCountFor.sol +1 -1
- package/test/TestCashOutHooks.sol +47 -25
- package/test/TestCashOutTimingEdge.sol +13 -1
- package/test/TestDataHookFuzzing.sol +520 -0
- package/test/TestDurationUnderflow.sol +13 -1
- package/test/TestFeeFreeCashOutBypass.sol +617 -0
- package/test/TestFeeProcessingFailure.sol +16 -1
- package/test/TestFees.sol +14 -1
- package/test/TestInterfaceSupport.sol +20 -1
- package/test/TestJBERC20Inheritance.sol +11 -1
- package/test/TestL2SequencerPriceFeed.sol +292 -0
- package/test/TestLaunchProject.sol +13 -1
- package/test/TestMetaTx.sol +15 -1
- package/test/TestMetadataOffsetOverflow.sol +179 -0
- package/test/TestMetadataParserLib.sol +37 -4
- package/test/TestMigrationHeldFees.sol +16 -1
- package/test/TestMintTokensOf.sol +14 -1
- package/test/TestMultiTerminalSurplus.sol +348 -0
- package/test/TestMultiTokenSurplus.sol +14 -1
- package/test/TestMultipleAccessLimits.sol +23 -1
- package/test/TestPayBurnRedeemFlow.sol +16 -1
- package/test/TestPayHooks.sol +33 -14
- package/test/TestPermissions.sol +20 -1
- package/test/TestPermissionsEdge.sol +5 -1
- package/test/TestPermit2DataHook.t.sol +360 -0
- package/test/TestPermit2Terminal.sol +36 -3
- package/test/TestRulesetQueueing.sol +23 -1
- package/test/TestRulesetQueuingStress.sol +20 -1
- package/test/TestRulesetWeightCaching.sol +127 -125
- package/test/TestSplits.sol +23 -1
- package/test/TestTerminalMigration.sol +11 -1
- package/test/TestTokenFlow.sol +18 -1
- package/test/TestWeightCacheStaleAfterRejection.sol +15 -1
- package/test/WeirdTokenTests.t.sol +54 -1
- package/test/fork/TestChainlinkPriceFeedFork.sol +6 -1
- package/test/formal/BondingCurveProperties.t.sol +8 -1
- package/test/formal/FeeProperties.t.sol +7 -1
- package/test/helpers/JBTest.sol +1 -1
- package/test/helpers/TestBaseWorkflow.sol +84 -1
- package/test/invariants/Phase3DeepInvariant.t.sol +13 -2
- package/test/invariants/RulesetsInvariant.t.sol +12 -2
- package/test/invariants/TerminalStoreInvariant.t.sol +11 -2
- package/test/invariants/TokensInvariant.t.sol +13 -2
- package/test/invariants/handlers/ComprehensiveHandler.sol +19 -1
- package/test/invariants/handlers/EconomicHandler.sol +31 -1
- package/test/invariants/handlers/Phase3Handler.sol +31 -1
- package/test/invariants/handlers/RulesetsHandler.sol +5 -1
- package/test/invariants/handlers/TerminalStoreHandler.sol +6 -1
- package/test/invariants/handlers/TokensHandler.sol +1 -1
- package/test/mock/MockERC20.sol +0 -2
- package/test/mock/MockMaliciousBeneficiary.sol +2 -1
- package/test/mock/MockMaliciousSplitHook.sol +2 -1
- package/test/mock/MockPriceFeed.sol +1 -1
- package/test/regression/HoldFeesCashOutReserved.t.sol +415 -0
- package/test/regression/WeightCacheBoundary.t.sol +291 -0
- package/test/units/static/JBChainlinkV3PriceFeed/TestPriceFeed.sol +0 -1
- package/test/units/static/JBController/JBControllerSetup.sol +10 -1
- package/test/units/static/JBController/TestBurnTokensOf.sol +8 -1
- package/test/units/static/JBController/TestClaimTokensFor.sol +4 -1
- package/test/units/static/JBController/TestDeployErc20For.sol +7 -1
- package/test/units/static/JBController/TestLaunchProjectFor.sol +21 -1
- package/test/units/static/JBController/TestLaunchRulesetsFor.sol +21 -1
- package/test/units/static/JBController/TestMigrateController.sol +10 -1
- package/test/units/static/JBController/TestMintTokensOfUnits.sol +10 -1
- package/test/units/static/JBController/TestPayReservedTokenToTerminal.sol +4 -1
- package/test/units/static/JBController/TestReceiveMigrationFrom.sol +5 -1
- package/test/units/static/JBController/TestRulesetViews.sol +7 -1
- package/test/units/static/JBController/TestSendReservedTokensToSplitsOf.sol +21 -1
- package/test/units/static/JBController/TestSetSplitGroupsOf.sol +6 -1
- package/test/units/static/JBController/TestSetTokenFor.sol +13 -1
- package/test/units/static/JBController/TestSetUriOf.sol +5 -1
- package/test/units/static/JBController/TestTransferCreditsFrom.sol +11 -1
- package/test/units/static/JBDeadline/TestDeadlineFuzz.sol +12 -1
- package/test/units/static/JBDirectory/JBDirectorySetup.sol +4 -1
- package/test/units/static/JBDirectory/TestPrimaryTerminalOf.sol +5 -1
- package/test/units/static/JBDirectory/TestSetControllerOf.sol +11 -1
- package/test/units/static/JBDirectory/TestSetControllerOfMigrationOrder.sol +7 -1
- package/test/units/static/JBDirectory/TestSetPrimaryTerminalOf.sol +11 -1
- package/test/units/static/JBDirectory/TestSetTerminalsOf.sol +10 -1
- package/test/units/static/JBERC20/JBERC20Setup.sol +2 -1
- package/test/units/static/JBERC20/SigUtils.sol +2 -0
- package/test/units/static/JBERC20/TestInitialize.sol +1 -1
- package/test/units/static/JBERC20/TestName.sol +1 -1
- package/test/units/static/JBERC20/TestNonces.sol +3 -1
- package/test/units/static/JBERC20/TestSymbol.sol +1 -1
- package/test/units/static/JBFeelessAdresses/JBFeelessSetup.sol +2 -1
- package/test/units/static/JBFeelessAdresses/TestInterfaces.sol +2 -1
- package/test/units/static/JBFeelessAdresses/TestSetFeelessAddress.sol +1 -1
- package/test/units/static/JBFees/TestFeesFuzz.sol +1 -1
- package/test/units/static/JBFixedPointNumber/TestAdjustDecimals.sol +0 -1
- package/test/units/static/JBFixedPointNumber/TestAdjustDecimalsFuzz.sol +0 -1
- package/test/units/static/JBFundAccessLimits/JBFundAccessSetup.sol +3 -1
- package/test/units/static/JBFundAccessLimits/TestFundAccessLimitsEdge.sol +4 -1
- package/test/units/static/JBFundAccessLimits/TestPayoutLimitOf.sol +4 -1
- package/test/units/static/JBFundAccessLimits/TestPayoutLimitsOf.sol +8 -1
- package/test/units/static/JBFundAccessLimits/TestSetFundAccessLimitsFor.sol +8 -1
- package/test/units/static/JBFundAccessLimits/TestSurplusAllowanceOf.sol +4 -1
- package/test/units/static/JBFundAccessLimits/TestSurplusAllowancesOf.sol +7 -1
- package/test/units/static/JBMetadataResolver/TestGetDataFor.sol +1 -1
- package/test/units/static/JBMetadataResolver/TestMetadataResolverEdgeCases.sol +2 -1
- package/test/units/static/JBMetadataResolver/TestMetadataResolverFuzz.sol +2 -1
- package/test/units/static/JBMultiTerminal/JBMultiTerminalSetup.sol +12 -1
- package/test/units/static/JBMultiTerminal/TestAccountingContextsOf.sol +9 -1
- package/test/units/static/JBMultiTerminal/TestAddAccountingContextsFor.sol +18 -2
- package/test/units/static/JBMultiTerminal/TestAddToBalanceOf.sol +44 -9
- package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +48 -23
- package/test/units/static/JBMultiTerminal/TestExecutePayout.sol +18 -2
- package/test/units/static/JBMultiTerminal/TestExecuteProcessFee.sol +13 -3
- package/test/units/static/JBMultiTerminal/TestMigrateBalanceOf.sol +21 -4
- package/test/units/static/JBMultiTerminal/TestPay.sol +35 -7
- package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +206 -19
- package/test/units/static/JBMultiTerminal/TestSendPayoutsOf.sol +15 -1
- package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +297 -1
- package/test/units/static/JBPermissions/JBPermissionsSetup.sol +2 -1
- package/test/units/static/JBPermissions/TestHasPermission.sol +1 -1
- package/test/units/static/JBPermissions/TestHasPermissions.sol +1 -1
- package/test/units/static/JBPermissions/TestSetPermissionsFor.sol +3 -1
- package/test/units/static/JBPrices/JBPricesSetup.sol +6 -1
- package/test/units/static/JBPrices/TestAddPriceFeedFor.sol +6 -1
- package/test/units/static/JBPrices/TestPricePerUnitOf.sol +4 -1
- package/test/units/static/JBPrices/TestPrices.sol +4 -1
- package/test/units/static/JBProjects/JBProjectsSetup.sol +2 -1
- package/test/units/static/JBProjects/TestCreateFor.sol +3 -1
- package/test/units/static/JBProjects/TestInitialProject.sol +2 -1
- package/test/units/static/JBProjects/TestInterfaces.sol +0 -1
- package/test/units/static/JBProjects/TestSetResolver.sol +2 -1
- package/test/units/static/JBProjects/TestTokenUri.sol +3 -1
- package/test/units/static/JBRulesetMetadataResolver/TestSetCashOutTaxRateTo.sol +9 -1
- package/test/units/static/JBRulesets/JBRulesetsSetup.sol +3 -1
- package/test/units/static/JBRulesets/TestCurrentApprovalStatusForLatestRulesetOf.sol +9 -1
- package/test/units/static/JBRulesets/TestCurrentOf.sol +10 -1
- package/test/units/static/JBRulesets/TestGetRulesetOf.sol +7 -1
- package/test/units/static/JBRulesets/TestLatestQueuedRulesetOf.sol +9 -1
- package/test/units/static/JBRulesets/TestRulesets.sol +12 -1
- package/test/units/static/JBRulesets/TestRulesetsOf.sol +1 -1
- package/test/units/static/JBRulesets/TestUpcomingRulesetOf.sol +10 -1
- package/test/units/static/JBRulesets/TestUpdateRulesetWeightCache.sol +6 -1
- package/test/units/static/JBSplits/JBSplitsSetup.sol +3 -1
- package/test/units/static/JBSplits/TestSelfManagedSplitGroups.sol +63 -13
- package/test/units/static/JBSplits/TestSetSplitGroupsOf.sol +8 -1
- package/test/units/static/JBSplits/TestSplitsLockedEdge.sol +6 -1
- package/test/units/static/JBSplits/TestSplitsOf.sol +1 -1
- package/test/units/static/JBSplits/TestSplitsPacking.sol +5 -2
- package/test/units/static/JBSurplus/TestSurplusFuzz.sol +3 -1
- package/test/units/static/JBTerminalStore/JBTerminalStoreSetup.sol +5 -1
- package/test/units/static/JBTerminalStore/TestCurrentReclaimableSurplusOf.sol +14 -1
- package/test/units/static/JBTerminalStore/TestCurrentSurplusOf.sol +14 -1
- package/test/units/static/JBTerminalStore/TestCurrentTotalSurplusOf.sol +3 -1
- package/test/units/static/JBTerminalStore/TestRecordCashOutsFor.sol +92 -1
- package/test/units/static/JBTerminalStore/TestRecordPaymentFrom.sol +15 -1
- package/test/units/static/JBTerminalStore/TestRecordPayoutFor.sol +13 -1
- package/test/units/static/JBTerminalStore/TestRecordTerminalMigration.sol +8 -1
- package/test/units/static/JBTerminalStore/TestRecordUsedAllowanceOf.sol +16 -1
- package/test/units/static/JBTerminalStore/TestUint224Overflow.sol +15 -1
- package/test/units/static/JBTokens/JBTokensSetup.sol +5 -1
- package/test/units/static/JBTokens/TestBurnFrom.sol +4 -1
- package/test/units/static/JBTokens/TestClaimTokensFor.sol +4 -1
- package/test/units/static/JBTokens/TestDeployERC20ForUnits.sol +4 -1
- package/test/units/static/JBTokens/TestMintFor.sol +4 -1
- package/test/units/static/JBTokens/TestSetTokenFor.sol +4 -1
- package/test/units/static/JBTokens/TestTotalBalanceOf.sol +1 -1
- package/test/units/static/JBTokens/TestTotalSupplyOf.sol +1 -1
- package/test/units/static/JBTokens/TestTransferCreditsFrom.sol +3 -1
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBPrices} from "../../../../src/JBPrices.sol";
|
|
5
|
+
import {IJBPriceFeed} from "../../../../src/interfaces/IJBPriceFeed.sol";
|
|
6
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
5
7
|
import {JBPricesSetup} from "./JBPricesSetup.sol";
|
|
6
8
|
|
|
7
9
|
contract TestPricePerUnitOf_Local is JBPricesSetup {
|
|
8
10
|
IJBPriceFeed _feed = IJBPriceFeed(makeAddr("priceFeed"));
|
|
11
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
9
12
|
uint256 DEFAULT_PROJECT_ID = 0;
|
|
10
13
|
uint256 _projectId = 1;
|
|
11
14
|
uint256 _defaultDirectPrice = 1_000_000_000;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBPrices} from "../../../../src/JBPrices.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
7
|
+
import {mulDiv} from "@prb/math/src/Common.sol";
|
|
5
8
|
import {JBPricesSetup} from "./JBPricesSetup.sol";
|
|
6
9
|
import {MockPriceFeed} from "../../../mock/MockPriceFeed.sol";
|
|
7
10
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBProjects} from "../../../../src/JBProjects.sol";
|
|
5
|
+
import {IJBProjects} from "../../../../src/interfaces/IJBProjects.sol";
|
|
5
6
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
7
|
|
|
7
8
|
/*
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {StdStorage, stdStorage} from "forge-std/StdStorage.sol";
|
|
5
|
+
import {stdError} from "forge-std/StdError.sol";
|
|
6
|
+
import {IJBProjects} from "../../../../src/interfaces/IJBProjects.sol";
|
|
5
7
|
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
|
|
6
8
|
import {JBProjectsSetup} from "./JBProjectsSetup.sol";
|
|
7
9
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBProjects} from "../../../../src/JBProjects.sol";
|
|
5
|
+
import {IJBProjects} from "../../../../src/interfaces/IJBProjects.sol";
|
|
5
6
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
7
|
|
|
7
8
|
contract TestInitialProject_Local is JBTest {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {IJBProjects} from "../../../../src/interfaces/IJBProjects.sol";
|
|
5
|
+
import {IJBTokenUriResolver} from "../../../../src/interfaces/IJBTokenUriResolver.sol";
|
|
5
6
|
import {JBProjectsSetup} from "./JBProjectsSetup.sol";
|
|
6
7
|
|
|
7
8
|
contract TestSetTokenURIResolver_Local is JBProjectsSetup {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {StdStorage, stdStorage} from "forge-std/StdStorage.sol";
|
|
5
|
+
import {IJBTokenUriResolver} from "../../../../src/interfaces/IJBTokenUriResolver.sol";
|
|
6
|
+
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
|
|
5
7
|
import {JBProjectsSetup} from "./JBProjectsSetup.sol";
|
|
6
8
|
|
|
7
9
|
contract TestTokenURI_Local is JBProjectsSetup {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
5
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
6
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
7
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
5
8
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
9
|
|
|
7
10
|
contract TestSetCashOutTaxRateTo_Local is JBTest {
|
|
@@ -50,24 +53,29 @@ contract TestSetCashOutTaxRateTo_Local is JBTest {
|
|
|
50
53
|
uint256 _packed = _rulesMetadata.packRulesetMetadata();
|
|
51
54
|
|
|
52
55
|
// Reserved Rate
|
|
56
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
53
57
|
uint256 _reservedPercent = uint256(uint16(_packed >> 4));
|
|
54
58
|
|
|
55
59
|
// Cash out tax rate
|
|
60
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
56
61
|
uint256 _cashOutTaxRate = uint256(uint16(_packed >> 20));
|
|
57
62
|
|
|
58
63
|
assertEq(_reservedPercent, _fuzzReservedPercent);
|
|
59
64
|
assertEq(_cashOutTaxRate, _fuzzCashOutTaxRate);
|
|
60
65
|
|
|
61
66
|
for (uint256 _i = 68; _i < 81; _i++) {
|
|
67
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
62
68
|
uint256 _flag = uint256(uint16(_packed >> _i) & 1);
|
|
63
69
|
assertEq(_flag, 1);
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
// Data source address
|
|
73
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
67
74
|
address _packedDataHook = address(uint160(_packed >> 82));
|
|
68
75
|
assertEq(_packedDataHook, _hookAddress);
|
|
69
76
|
|
|
70
77
|
// Metadata
|
|
78
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
71
79
|
uint256 _packedMetadata = uint256(uint16(_packed >> 242));
|
|
72
80
|
assertEq(_packedMetadata, uint256(_fuzzMetadata));
|
|
73
81
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBRulesets} from "../../../../src/JBRulesets.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
5
7
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
8
|
|
|
7
9
|
/*
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBApprovalStatus} from "../../../../src/enums/JBApprovalStatus.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
8
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
10
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
11
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
12
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
13
|
import {JBRulesetsSetup} from "./JBRulesetsSetup.sol";
|
|
6
14
|
|
|
7
15
|
contract TestCurrentApprovalStatusForLatestRulesetOf_Local is JBRulesetsSetup {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBApprovalStatus} from "../../../../src/enums/JBApprovalStatus.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
8
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
10
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
11
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
12
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
13
|
import {JBRulesetsSetup} from "./JBRulesetsSetup.sol";
|
|
6
14
|
|
|
7
15
|
contract TestCurrentOf_Local is JBRulesetsSetup {
|
|
@@ -79,6 +87,7 @@ contract TestCurrentOf_Local is JBRulesetsSetup {
|
|
|
79
87
|
assertEq(_ruleset.id, 0);
|
|
80
88
|
}
|
|
81
89
|
|
|
90
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
82
91
|
modifier whenLatestRulesetIdDNEQZero() {
|
|
83
92
|
// put code at hook address
|
|
84
93
|
vm.etch(address(_mockApprovalHook), abi.encode(1));
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
5
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
6
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
7
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
8
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
9
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
10
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
5
11
|
import {JBRulesetsSetup} from "./JBRulesetsSetup.sol";
|
|
6
12
|
|
|
7
13
|
contract TestGetRulesetOf_Local is JBRulesetsSetup {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBApprovalStatus} from "../../../../src/enums/JBApprovalStatus.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
8
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
10
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
11
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
12
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
13
|
import {JBRulesetsSetup} from "./JBRulesetsSetup.sol";
|
|
6
14
|
|
|
7
15
|
contract TestLatestQueuedRulesetOf_Local is JBRulesetsSetup {
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {stdError} from "forge-std/StdError.sol";
|
|
5
|
+
import {JBRulesets} from "../../../../src/JBRulesets.sol";
|
|
6
|
+
import {JBApprovalStatus} from "../../../../src/enums/JBApprovalStatus.sol";
|
|
7
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
8
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
9
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
10
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
11
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
12
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
13
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
14
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
15
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
16
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
17
|
|
|
7
18
|
contract TestJBRulesetsUnits_Local is JBTest {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
5
5
|
import {JBRulesetsSetup} from "./JBRulesetsSetup.sol";
|
|
6
6
|
|
|
7
7
|
contract TestRulesetsOf_Local is JBRulesetsSetup {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBApprovalStatus} from "../../../../src/enums/JBApprovalStatus.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
8
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
10
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
11
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
12
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
13
|
import {JBRulesetsSetup} from "./JBRulesetsSetup.sol";
|
|
6
14
|
|
|
7
15
|
contract TestUpcomingOf_Local is JBRulesetsSetup {
|
|
@@ -79,6 +87,7 @@ contract TestUpcomingOf_Local is JBRulesetsSetup {
|
|
|
79
87
|
assertEq(_upcoming.id, 0);
|
|
80
88
|
}
|
|
81
89
|
|
|
90
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
82
91
|
modifier whenUpcomingRulesetIdDNEQZero() {
|
|
83
92
|
// put code at hook address
|
|
84
93
|
vm.etch(address(_mockApprovalHook), abi.encode(1));
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
5
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
6
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
7
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
8
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
9
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
5
10
|
import {JBRulesetsSetup} from "./JBRulesetsSetup.sol";
|
|
6
11
|
|
|
7
12
|
contract TestUpdateRulesetWeightCache_Local is JBRulesetsSetup {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBSplits} from "../../../../src/JBSplits.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
5
7
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
8
|
|
|
7
9
|
/*
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBSplits} from "../../../../src/JBSplits.sol";
|
|
5
|
+
import {JBControlled} from "../../../../src/abstract/JBControlled.sol";
|
|
6
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
7
|
+
import {IJBSplitHook} from "../../../../src/interfaces/IJBSplitHook.sol";
|
|
8
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
9
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
10
|
+
import {JBSplit} from "../../../../src/structs/JBSplit.sol";
|
|
11
|
+
import {JBSplitGroup} from "../../../../src/structs/JBSplitGroup.sol";
|
|
5
12
|
import {JBSplitsSetup} from "./JBSplitsSetup.sol";
|
|
6
13
|
|
|
7
14
|
contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
@@ -50,9 +57,9 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
50
57
|
// ──────────────────
|
|
51
58
|
|
|
52
59
|
function test_CallerCanSetSplitsInOwnGroupNamespace() external {
|
|
53
|
-
//
|
|
60
|
+
// Self-auth requires non-zero upper 96 bits + lower 160 bits == msg.sender.
|
|
54
61
|
address caller = makeAddr("hookContract");
|
|
55
|
-
uint256 groupId = uint256(uint160(caller));
|
|
62
|
+
uint256 groupId = (1 << 160) | uint256(uint160(caller));
|
|
56
63
|
|
|
57
64
|
JBSplitGroup[] memory groups = _makeSplitGroup(groupId, JBConstants.SPLITS_TOTAL_PERCENT / 2, _bene);
|
|
58
65
|
|
|
@@ -114,7 +121,7 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
114
121
|
function test_CallerCanSetMultipleSplitsInOwnGroup() external {
|
|
115
122
|
// Multiple splits in the same self-managed group.
|
|
116
123
|
address caller = makeAddr("hookContract");
|
|
117
|
-
uint256 groupId = uint256(uint160(caller));
|
|
124
|
+
uint256 groupId = (1 << 160) | uint256(uint160(caller));
|
|
118
125
|
|
|
119
126
|
address payable bene1 = payable(makeAddr("bene1"));
|
|
120
127
|
address payable bene2 = payable(makeAddr("bene2"));
|
|
@@ -151,7 +158,7 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
151
158
|
function test_CallerCanOverwriteOwnSplits() external {
|
|
152
159
|
// Caller can overwrite their own splits.
|
|
153
160
|
address caller = makeAddr("hookContract");
|
|
154
|
-
uint256 groupId = uint256(uint160(caller));
|
|
161
|
+
uint256 groupId = (1 << 160) | uint256(uint160(caller));
|
|
155
162
|
|
|
156
163
|
address payable beneOld = payable(makeAddr("beneOld"));
|
|
157
164
|
address payable beneNew = payable(makeAddr("beneNew"));
|
|
@@ -176,7 +183,7 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
176
183
|
function test_SelfManagedSplitsEmitSetSplitEvent() external {
|
|
177
184
|
// Setting self-managed splits emits SetSplit with correct caller.
|
|
178
185
|
address caller = makeAddr("hookContract");
|
|
179
|
-
uint256 groupId = uint256(uint160(caller));
|
|
186
|
+
uint256 groupId = (1 << 160) | uint256(uint160(caller));
|
|
180
187
|
|
|
181
188
|
JBSplitGroup[] memory groups = _makeSplitGroup(groupId, JBConstants.SPLITS_TOTAL_PERCENT, _bene);
|
|
182
189
|
|
|
@@ -190,7 +197,7 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
190
197
|
function test_SelfManagedSplitsWorkAcrossRulesets() external {
|
|
191
198
|
// Caller can set splits in the same group but different rulesets.
|
|
192
199
|
address caller = makeAddr("hookContract");
|
|
193
|
-
uint256 groupId = uint256(uint160(caller));
|
|
200
|
+
uint256 groupId = (1 << 160) | uint256(uint160(caller));
|
|
194
201
|
|
|
195
202
|
uint256 rulesetA = 100;
|
|
196
203
|
uint256 rulesetB = 200;
|
|
@@ -220,7 +227,7 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
220
227
|
|
|
221
228
|
function test_SelfManagedSplitsRevertOnZeroPercent() external {
|
|
222
229
|
address caller = makeAddr("hookContract");
|
|
223
|
-
uint256 groupId = uint256(uint160(caller));
|
|
230
|
+
uint256 groupId = (1 << 160) | uint256(uint160(caller));
|
|
224
231
|
|
|
225
232
|
JBSplitGroup[] memory groups = new JBSplitGroup[](1);
|
|
226
233
|
JBSplit[] memory splits = new JBSplit[](1);
|
|
@@ -241,7 +248,7 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
241
248
|
|
|
242
249
|
function test_SelfManagedSplitsRevertOnExcessPercent() external {
|
|
243
250
|
address caller = makeAddr("hookContract");
|
|
244
|
-
uint256 groupId = uint256(uint160(caller));
|
|
251
|
+
uint256 groupId = (1 << 160) | uint256(uint160(caller));
|
|
245
252
|
|
|
246
253
|
JBSplitGroup[] memory groups = new JBSplitGroup[](1);
|
|
247
254
|
JBSplit[] memory splits = new JBSplit[](2);
|
|
@@ -271,7 +278,7 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
271
278
|
function test_SelfManagedSplitsEnforceLocks() external {
|
|
272
279
|
// Locked splits in a self-managed group cannot be removed.
|
|
273
280
|
address caller = makeAddr("hookContract");
|
|
274
|
-
uint256 groupId = uint256(uint160(caller));
|
|
281
|
+
uint256 groupId = (1 << 160) | uint256(uint160(caller));
|
|
275
282
|
|
|
276
283
|
// Set a locked split.
|
|
277
284
|
JBSplitGroup[] memory groups = new JBSplitGroup[](1);
|
|
@@ -350,6 +357,46 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
350
357
|
_splits.setSplitGroupsOf(_projectId, _rulesetId, groups);
|
|
351
358
|
}
|
|
352
359
|
|
|
360
|
+
// ──────────────── Bare-address groupIds require controller auth
|
|
361
|
+
// ───────────────
|
|
362
|
+
|
|
363
|
+
function test_BareAddressGroupIdRequiresControllerEvenForMatchingSender() external {
|
|
364
|
+
// A contract cannot self-auth for groupId == uint256(uint160(self)) (upper 96 bits = 0).
|
|
365
|
+
// This prevents token contracts from hijacking terminal payout splits.
|
|
366
|
+
address caller = makeAddr("maliciousToken");
|
|
367
|
+
uint256 groupId = uint256(uint160(caller)); // bare address, upper bits = 0
|
|
368
|
+
|
|
369
|
+
JBSplitGroup[] memory groups = _makeSplitGroup(groupId, JBConstants.SPLITS_TOTAL_PERCENT, _bene);
|
|
370
|
+
|
|
371
|
+
_mockController(makeAddr("realController"));
|
|
372
|
+
|
|
373
|
+
vm.prank(caller);
|
|
374
|
+
vm.expectRevert(
|
|
375
|
+
abi.encodeWithSelector(
|
|
376
|
+
JBControlled.JBControlled_ControllerUnauthorized.selector, makeAddr("realController")
|
|
377
|
+
)
|
|
378
|
+
);
|
|
379
|
+
_splits.setSplitGroupsOf(_projectId, _rulesetId, groups);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function test_BareAddressGroupIdSucceedsWithControllerAuth() external {
|
|
383
|
+
// The controller CAN still set splits for bare-address groupIds (terminal payout groups).
|
|
384
|
+
address controller = makeAddr("controller");
|
|
385
|
+
address token = makeAddr("someToken");
|
|
386
|
+
uint256 groupId = uint256(uint160(token));
|
|
387
|
+
|
|
388
|
+
JBSplitGroup[] memory groups = _makeSplitGroup(groupId, JBConstants.SPLITS_TOTAL_PERCENT, _bene);
|
|
389
|
+
|
|
390
|
+
_mockController(controller);
|
|
391
|
+
|
|
392
|
+
vm.prank(controller);
|
|
393
|
+
_splits.setSplitGroupsOf(_projectId, _rulesetId, groups);
|
|
394
|
+
|
|
395
|
+
JBSplit[] memory result = _splits.splitsOf(_projectId, _rulesetId, groupId);
|
|
396
|
+
assertEq(result.length, 1);
|
|
397
|
+
assertEq(result[0].beneficiary, _bene);
|
|
398
|
+
}
|
|
399
|
+
|
|
353
400
|
// ───────────────────── Controller can still set any group
|
|
354
401
|
// ──────────────────
|
|
355
402
|
|
|
@@ -375,9 +422,10 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
375
422
|
// ─────────────────────────────
|
|
376
423
|
|
|
377
424
|
function test_MixedSelfManagedAndControllerGroupsInOneCall() external {
|
|
378
|
-
// A single setSplitGroupsOf call with one self-managed group and one controller-gated
|
|
425
|
+
// A single setSplitGroupsOf call with one self-managed group (non-zero upper bits) and one controller-gated
|
|
426
|
+
// group.
|
|
379
427
|
address caller = makeAddr("hookContract");
|
|
380
|
-
uint256 selfGroupId = uint256(uint160(caller));
|
|
428
|
+
uint256 selfGroupId = (1 << 160) | uint256(uint160(caller));
|
|
381
429
|
uint256 otherGroupId = 0;
|
|
382
430
|
|
|
383
431
|
// Mock: caller IS the controller.
|
|
@@ -420,7 +468,7 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
420
468
|
function test_MixedCallRevertsIfNonControllerSetsOtherGroup() external {
|
|
421
469
|
// A call with one self-managed group (ok) and one non-owned group (reverts) in the same call.
|
|
422
470
|
address caller = makeAddr("hookContract");
|
|
423
|
-
uint256 selfGroupId = uint256(uint160(caller));
|
|
471
|
+
uint256 selfGroupId = (1 << 160) | uint256(uint160(caller));
|
|
424
472
|
uint256 otherGroupId = 0;
|
|
425
473
|
|
|
426
474
|
_mockController(makeAddr("realController"));
|
|
@@ -465,6 +513,8 @@ contract TestSelfManagedSplitGroups_Local is JBSplitsSetup {
|
|
|
465
513
|
function testFuzz_AnyAddressCanSetOwnNamespace(address caller, uint96 upperBits, uint32 percent) external {
|
|
466
514
|
vm.assume(caller != address(0));
|
|
467
515
|
vm.assume(percent > 0 && percent <= JBConstants.SPLITS_TOTAL_PERCENT);
|
|
516
|
+
// Self-auth requires non-zero upper bits.
|
|
517
|
+
vm.assume(upperBits > 0);
|
|
468
518
|
|
|
469
519
|
uint256 groupId = (uint256(upperBits) << 160) | uint256(uint160(caller));
|
|
470
520
|
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBSplits} from "../../../../src/JBSplits.sol";
|
|
5
|
+
import {JBControlled} from "../../../../src/abstract/JBControlled.sol";
|
|
6
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
7
|
+
import {IJBSplitHook} from "../../../../src/interfaces/IJBSplitHook.sol";
|
|
8
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
9
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
10
|
+
import {JBSplit} from "../../../../src/structs/JBSplit.sol";
|
|
11
|
+
import {JBSplitGroup} from "../../../../src/structs/JBSplitGroup.sol";
|
|
5
12
|
import {JBSplitsSetup} from "./JBSplitsSetup.sol";
|
|
6
13
|
|
|
7
14
|
contract TestSetSplitGroupsOf_Local is JBSplitsSetup {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBSplits} from "../../../../src/JBSplits.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBSplitHook} from "../../../../src/interfaces/IJBSplitHook.sol";
|
|
7
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
8
|
+
import {JBSplit} from "../../../../src/structs/JBSplit.sol";
|
|
9
|
+
import {JBSplitGroup} from "../../../../src/structs/JBSplitGroup.sol";
|
|
5
10
|
import {JBSplitsSetup} from "./JBSplitsSetup.sol";
|
|
6
11
|
|
|
7
12
|
/// @notice Edge case tests for JBSplits lock enforcement.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBSplit} from "../../../../src/structs/JBSplit.sol";
|
|
5
5
|
import {JBSplitsSetup} from "./JBSplitsSetup.sol";
|
|
6
6
|
|
|
7
7
|
contract TestSplitsOf_Local is JBSplitsSetup {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import "src/JBSplits.sol";
|
|
5
|
-
import "
|
|
4
|
+
import {JBSplits} from "src/JBSplits.sol";
|
|
5
|
+
import {IJBDirectory} from "src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {JBConstants} from "src/libraries/JBConstants.sol";
|
|
7
|
+
import {JBSplit} from "src/structs/JBSplit.sol";
|
|
8
|
+
import {Test} from "forge-std/Test.sol";
|
|
6
9
|
|
|
7
10
|
contract TestSplitsPacking_Local is JBSplits, Test {
|
|
8
11
|
constructor() JBSplits(IJBDirectory(address(0))) {}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
5
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
6
|
+
import {ERC165, IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
7
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
8
|
import {JBSurplus} from "../../../../src/libraries/JBSurplus.sol";
|
|
7
9
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBTerminalStore} from "../../../../src/JBTerminalStore.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBPrices} from "../../../../src/interfaces/IJBPrices.sol";
|
|
7
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
8
|
+
import {IJBTerminalStore} from "../../../../src/interfaces/IJBTerminalStore.sol";
|
|
5
9
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
10
|
|
|
7
11
|
/*
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
|
|
7
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
8
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
9
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
10
|
+
import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
|
|
11
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
12
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
13
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
14
|
+
import {JBCurrencyAmount} from "../../../../src/structs/JBCurrencyAmount.sol";
|
|
15
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
16
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
17
|
+
import {mulDiv} from "@prb/math/src/Common.sol";
|
|
5
18
|
import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
|
|
6
19
|
import {JBCashOuts} from "../../../../src/libraries/JBCashOuts.sol";
|
|
7
20
|
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
|
|
7
|
+
import {IJBPrices} from "../../../../src/interfaces/IJBPrices.sol";
|
|
8
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
9
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
10
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
11
|
+
import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
|
|
12
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
13
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
14
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
15
|
+
import {JBCurrencyAmount} from "../../../../src/structs/JBCurrencyAmount.sol";
|
|
16
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
17
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
5
18
|
import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
|
|
6
19
|
|
|
7
20
|
contract TestCurrentSurplusOf_Local is JBTerminalStoreSetup {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
5
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
6
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
5
7
|
import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
|
|
6
8
|
|
|
7
9
|
contract TestCurrentTotalSurplusOf_Local is JBTerminalStoreSetup {
|