@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
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.6;
|
|
3
|
+
|
|
4
|
+
import {TestBaseWorkflow} from "../helpers/TestBaseWorkflow.sol";
|
|
5
|
+
import {IJBController} from "../../src/interfaces/IJBController.sol";
|
|
6
|
+
import {IJBRulesets} from "../../src/interfaces/IJBRulesets.sol";
|
|
7
|
+
import {IJBRulesetApprovalHook} from "../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
8
|
+
import {JBConstants} from "../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBRulesetMetadata} from "../../src/structs/JBRulesetMetadata.sol";
|
|
10
|
+
import {JBRulesetConfig} from "../../src/structs/JBRulesetConfig.sol";
|
|
11
|
+
import {JBRuleset} from "../../src/structs/JBRuleset.sol";
|
|
12
|
+
import {JBSplitGroup} from "../../src/structs/JBSplitGroup.sol";
|
|
13
|
+
import {JBFundAccessLimitGroup} from "../../src/structs/JBFundAccessLimitGroup.sol";
|
|
14
|
+
import {JBTerminalConfig} from "../../src/structs/JBTerminalConfig.sol";
|
|
15
|
+
import {JBRulesets} from "../../src/JBRulesets.sol";
|
|
16
|
+
|
|
17
|
+
import {mulDiv} from "@prb/math/src/Common.sol";
|
|
18
|
+
|
|
19
|
+
/// @notice Deterministic (non-fuzz) tests for the JBRulesets weight cache at the 20,000 iteration boundary.
|
|
20
|
+
/// The contract reverts with `JBRulesets_WeightCacheRequired` when the cycle gap exceeds the threshold
|
|
21
|
+
/// and the cache has not been populated. These tests verify:
|
|
22
|
+
/// 1. Exactly 20,000 cycles work without cache.
|
|
23
|
+
/// 2. 20,001 cycles revert without cache.
|
|
24
|
+
/// 3. Progressive `updateRulesetWeightCache()` calls unblock the revert.
|
|
25
|
+
/// 4. The cached weight equals the iteratively computed weight.
|
|
26
|
+
contract WeightCacheBoundary_Local is TestBaseWorkflow {
|
|
27
|
+
uint256 private constant _THRESHOLD = 20_000;
|
|
28
|
+
|
|
29
|
+
/// @dev 1-second duration makes each cycle = 1 second, so we can hit the boundary fast.
|
|
30
|
+
uint32 private constant _DURATION = 1;
|
|
31
|
+
|
|
32
|
+
/// @dev Tiny weight cut (0.1%) so the weight doesn't decay to zero over 20k cycles.
|
|
33
|
+
uint32 private constant _WEIGHT_CUT_PERCENT = 1_000_000; // 0.1% of MAX_WEIGHT_CUT_PERCENT (1e9)
|
|
34
|
+
|
|
35
|
+
uint112 private constant _INITIAL_WEIGHT = 1000e18;
|
|
36
|
+
|
|
37
|
+
IJBController private _controller;
|
|
38
|
+
IJBRulesets private _rulesets;
|
|
39
|
+
address private _projectOwner;
|
|
40
|
+
|
|
41
|
+
JBRulesetMetadata private _metadata;
|
|
42
|
+
|
|
43
|
+
function setUp() public override {
|
|
44
|
+
super.setUp();
|
|
45
|
+
|
|
46
|
+
_projectOwner = multisig();
|
|
47
|
+
_rulesets = jbRulesets();
|
|
48
|
+
_controller = jbController();
|
|
49
|
+
|
|
50
|
+
_metadata = JBRulesetMetadata({
|
|
51
|
+
reservedPercent: 0,
|
|
52
|
+
cashOutTaxRate: 0,
|
|
53
|
+
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
54
|
+
pausePay: false,
|
|
55
|
+
pauseCreditTransfers: false,
|
|
56
|
+
allowOwnerMinting: false,
|
|
57
|
+
allowSetCustomToken: false,
|
|
58
|
+
allowTerminalMigration: false,
|
|
59
|
+
allowSetTerminals: false,
|
|
60
|
+
ownerMustSendPayouts: false,
|
|
61
|
+
allowSetController: false,
|
|
62
|
+
allowAddAccountingContext: true,
|
|
63
|
+
allowAddPriceFeed: false,
|
|
64
|
+
holdFees: false,
|
|
65
|
+
useTotalSurplusForCashOuts: true,
|
|
66
|
+
useDataHookForPay: false,
|
|
67
|
+
useDataHookForCashOut: false,
|
|
68
|
+
dataHook: address(0),
|
|
69
|
+
metadata: 0
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// @dev Helper: launch a project with a 1-second duration and the given weight cut percent.
|
|
74
|
+
function _launchProject() internal returns (uint256 projectId) {
|
|
75
|
+
JBRulesetConfig[] memory configs = new JBRulesetConfig[](1);
|
|
76
|
+
configs[0].mustStartAtOrAfter = 0;
|
|
77
|
+
configs[0].duration = _DURATION;
|
|
78
|
+
configs[0].weight = _INITIAL_WEIGHT;
|
|
79
|
+
configs[0].weightCutPercent = _WEIGHT_CUT_PERCENT;
|
|
80
|
+
configs[0].approvalHook = IJBRulesetApprovalHook(address(0));
|
|
81
|
+
configs[0].metadata = _metadata;
|
|
82
|
+
configs[0].splitGroups = new JBSplitGroup[](0);
|
|
83
|
+
configs[0].fundAccessLimitGroups = new JBFundAccessLimitGroup[](0);
|
|
84
|
+
|
|
85
|
+
projectId = _controller.launchProjectFor({
|
|
86
|
+
owner: _projectOwner,
|
|
87
|
+
projectUri: "weightCacheBoundary",
|
|
88
|
+
rulesetConfigurations: configs,
|
|
89
|
+
terminalConfigurations: new JBTerminalConfig[](0),
|
|
90
|
+
memo: ""
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/// @dev Compute expected weight by iterating the cut percent `n` times on the initial weight.
|
|
95
|
+
function _expectedWeight(uint256 n) internal pure returns (uint256 weight) {
|
|
96
|
+
weight = _INITIAL_WEIGHT;
|
|
97
|
+
for (uint256 i; i < n; i++) {
|
|
98
|
+
weight = mulDiv(
|
|
99
|
+
weight, JBConstants.MAX_WEIGHT_CUT_PERCENT - _WEIGHT_CUT_PERCENT, JBConstants.MAX_WEIGHT_CUT_PERCENT
|
|
100
|
+
);
|
|
101
|
+
if (weight == 0) break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
106
|
+
// Test 1: Exactly 20,000 cycles works without cache
|
|
107
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
108
|
+
|
|
109
|
+
function test_exactlyAtThreshold_noCache_succeeds() public {
|
|
110
|
+
uint256 projectId = _launchProject();
|
|
111
|
+
|
|
112
|
+
// Warp forward exactly 20,000 durations.
|
|
113
|
+
vm.warp(block.timestamp + _DURATION * _THRESHOLD);
|
|
114
|
+
|
|
115
|
+
// currentOf should succeed — still within the iteration limit.
|
|
116
|
+
JBRuleset memory ruleset = _rulesets.currentOf(projectId);
|
|
117
|
+
|
|
118
|
+
// Verify weight matches the iterative calculation.
|
|
119
|
+
uint256 expected = _expectedWeight(_THRESHOLD);
|
|
120
|
+
assertEq(ruleset.weight, expected, "Weight at exactly 20,000 cycles should match iterative calculation");
|
|
121
|
+
assertTrue(ruleset.weight > 0, "Weight should not have decayed to zero at 20k cycles with 0.1% cut");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
125
|
+
// Test 2: 20,001 cycles reverts without cache
|
|
126
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
127
|
+
|
|
128
|
+
function test_aboveThreshold_noCache_reverts() public {
|
|
129
|
+
uint256 projectId = _launchProject();
|
|
130
|
+
|
|
131
|
+
// Warp forward 20,001 durations.
|
|
132
|
+
vm.warp(block.timestamp + _DURATION * (_THRESHOLD + 1));
|
|
133
|
+
|
|
134
|
+
// currentOf should revert because the iteration count exceeds the threshold.
|
|
135
|
+
vm.expectRevert(abi.encodeWithSelector(JBRulesets.JBRulesets_WeightCacheRequired.selector, projectId));
|
|
136
|
+
_rulesets.currentOf(projectId);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
140
|
+
// Test 3: Single cache call unblocks 20,001 cycles
|
|
141
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
142
|
+
|
|
143
|
+
function test_aboveThreshold_singleCacheCall_succeeds() public {
|
|
144
|
+
uint256 projectId = _launchProject();
|
|
145
|
+
uint256 rulesetId = _rulesets.latestRulesetIdOf(projectId);
|
|
146
|
+
|
|
147
|
+
// Warp forward 20,001 durations.
|
|
148
|
+
vm.warp(block.timestamp + _DURATION * (_THRESHOLD + 1));
|
|
149
|
+
|
|
150
|
+
// Without cache, this reverts.
|
|
151
|
+
vm.expectRevert(abi.encodeWithSelector(JBRulesets.JBRulesets_WeightCacheRequired.selector, projectId));
|
|
152
|
+
_rulesets.currentOf(projectId);
|
|
153
|
+
|
|
154
|
+
// Populate the cache.
|
|
155
|
+
_rulesets.updateRulesetWeightCache(projectId, rulesetId);
|
|
156
|
+
|
|
157
|
+
// Now currentOf should succeed.
|
|
158
|
+
JBRuleset memory ruleset = _rulesets.currentOf(projectId);
|
|
159
|
+
|
|
160
|
+
// Verify weight matches iterative calculation.
|
|
161
|
+
uint256 expected = _expectedWeight(_THRESHOLD + 1);
|
|
162
|
+
assertEq(ruleset.weight, expected, "Weight at 20,001 cycles should match after single cache call");
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
166
|
+
// Test 4: Progressive caching for large gaps (40,001 cycles)
|
|
167
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
168
|
+
|
|
169
|
+
function test_largeGap_progressiveCaching_succeeds() public {
|
|
170
|
+
uint256 projectId = _launchProject();
|
|
171
|
+
uint256 rulesetId = _rulesets.latestRulesetIdOf(projectId);
|
|
172
|
+
|
|
173
|
+
// Warp forward 40,001 durations (needs 2 cache calls).
|
|
174
|
+
vm.warp(block.timestamp + _DURATION * (_THRESHOLD * 2 + 1));
|
|
175
|
+
|
|
176
|
+
// Without cache, reverts.
|
|
177
|
+
vm.expectRevert(abi.encodeWithSelector(JBRulesets.JBRulesets_WeightCacheRequired.selector, projectId));
|
|
178
|
+
_rulesets.currentOf(projectId);
|
|
179
|
+
|
|
180
|
+
// First cache call: advances cache by up to 20,000 iterations.
|
|
181
|
+
_rulesets.updateRulesetWeightCache(projectId, rulesetId);
|
|
182
|
+
|
|
183
|
+
// Still reverts — we need another cache call to cover the remaining gap.
|
|
184
|
+
vm.expectRevert(abi.encodeWithSelector(JBRulesets.JBRulesets_WeightCacheRequired.selector, projectId));
|
|
185
|
+
_rulesets.currentOf(projectId);
|
|
186
|
+
|
|
187
|
+
// Second cache call: covers the rest.
|
|
188
|
+
_rulesets.updateRulesetWeightCache(projectId, rulesetId);
|
|
189
|
+
|
|
190
|
+
// Now it should succeed.
|
|
191
|
+
JBRuleset memory ruleset = _rulesets.currentOf(projectId);
|
|
192
|
+
|
|
193
|
+
// Verify weight matches iterative calculation.
|
|
194
|
+
uint256 expected = _expectedWeight(_THRESHOLD * 2 + 1);
|
|
195
|
+
assertEq(ruleset.weight, expected, "Weight at 40,001 cycles should match after two cache calls");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
199
|
+
// Test 5: Cache produces same weight as direct iteration
|
|
200
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
201
|
+
|
|
202
|
+
function test_cachedWeight_matchesDirect_atBoundary() public {
|
|
203
|
+
// Launch two identical projects.
|
|
204
|
+
uint256 projectA = _launchProject();
|
|
205
|
+
uint256 projectB = _launchProject();
|
|
206
|
+
|
|
207
|
+
uint256 rulesetIdB = _rulesets.latestRulesetIdOf(projectB);
|
|
208
|
+
|
|
209
|
+
// Warp to exactly 20,000 cycles (within threshold for both).
|
|
210
|
+
vm.warp(block.timestamp + _DURATION * _THRESHOLD);
|
|
211
|
+
|
|
212
|
+
// Project A: no cache, direct iteration.
|
|
213
|
+
JBRuleset memory rulesetA = _rulesets.currentOf(projectA);
|
|
214
|
+
|
|
215
|
+
// Project B: populate cache first, then query.
|
|
216
|
+
_rulesets.updateRulesetWeightCache(projectB, rulesetIdB);
|
|
217
|
+
JBRuleset memory rulesetB = _rulesets.currentOf(projectB);
|
|
218
|
+
|
|
219
|
+
// Both should produce identical weights.
|
|
220
|
+
assertEq(rulesetA.weight, rulesetB.weight, "Cached and uncached weights should be identical at threshold");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
224
|
+
// Test 6: Zero weightCutPercent — cache is no-op
|
|
225
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
226
|
+
|
|
227
|
+
function test_zeroWeightCut_cacheNoOp() public {
|
|
228
|
+
// Launch a project with zero weight cut.
|
|
229
|
+
JBRulesetConfig[] memory configs = new JBRulesetConfig[](1);
|
|
230
|
+
configs[0].mustStartAtOrAfter = 0;
|
|
231
|
+
configs[0].duration = _DURATION;
|
|
232
|
+
configs[0].weight = _INITIAL_WEIGHT;
|
|
233
|
+
configs[0].weightCutPercent = 0; // No decay
|
|
234
|
+
configs[0].approvalHook = IJBRulesetApprovalHook(address(0));
|
|
235
|
+
configs[0].metadata = _metadata;
|
|
236
|
+
configs[0].splitGroups = new JBSplitGroup[](0);
|
|
237
|
+
configs[0].fundAccessLimitGroups = new JBFundAccessLimitGroup[](0);
|
|
238
|
+
|
|
239
|
+
uint256 projectId = _controller.launchProjectFor({
|
|
240
|
+
owner: _projectOwner,
|
|
241
|
+
projectUri: "zeroCut",
|
|
242
|
+
rulesetConfigurations: configs,
|
|
243
|
+
terminalConfigurations: new JBTerminalConfig[](0),
|
|
244
|
+
memo: ""
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// Warp far beyond the threshold — since weightCutPercent = 0, no iterations needed.
|
|
248
|
+
vm.warp(block.timestamp + _DURATION * (_THRESHOLD * 5));
|
|
249
|
+
|
|
250
|
+
// Should succeed without any cache because the weight cut loop is skipped.
|
|
251
|
+
JBRuleset memory ruleset = _rulesets.currentOf(projectId);
|
|
252
|
+
assertEq(ruleset.weight, _INITIAL_WEIGHT, "Weight should remain unchanged with zero cut percent");
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
256
|
+
// Test 7: Cache with zero duration — updateRulesetWeightCache is no-op
|
|
257
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
258
|
+
|
|
259
|
+
function test_zeroDuration_cacheNoOp() public {
|
|
260
|
+
// Launch a project with zero duration.
|
|
261
|
+
JBRulesetConfig[] memory configs = new JBRulesetConfig[](1);
|
|
262
|
+
configs[0].mustStartAtOrAfter = 0;
|
|
263
|
+
configs[0].duration = 0; // Never expires
|
|
264
|
+
configs[0].weight = _INITIAL_WEIGHT;
|
|
265
|
+
configs[0].weightCutPercent = _WEIGHT_CUT_PERCENT;
|
|
266
|
+
configs[0].approvalHook = IJBRulesetApprovalHook(address(0));
|
|
267
|
+
configs[0].metadata = _metadata;
|
|
268
|
+
configs[0].splitGroups = new JBSplitGroup[](0);
|
|
269
|
+
configs[0].fundAccessLimitGroups = new JBFundAccessLimitGroup[](0);
|
|
270
|
+
|
|
271
|
+
uint256 projectId = _controller.launchProjectFor({
|
|
272
|
+
owner: _projectOwner,
|
|
273
|
+
projectUri: "zeroDuration",
|
|
274
|
+
rulesetConfigurations: configs,
|
|
275
|
+
terminalConfigurations: new JBTerminalConfig[](0),
|
|
276
|
+
memo: ""
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
uint256 rulesetId = _rulesets.latestRulesetIdOf(projectId);
|
|
280
|
+
|
|
281
|
+
// Warp far ahead.
|
|
282
|
+
vm.warp(block.timestamp + 1_000_000);
|
|
283
|
+
|
|
284
|
+
// updateRulesetWeightCache should be a no-op (returns without caching).
|
|
285
|
+
_rulesets.updateRulesetWeightCache(projectId, rulesetId);
|
|
286
|
+
|
|
287
|
+
// currentOf should succeed — zero duration means the same ruleset is always current.
|
|
288
|
+
JBRuleset memory ruleset = _rulesets.currentOf(projectId);
|
|
289
|
+
assertEq(ruleset.weight, _INITIAL_WEIGHT, "Weight should remain unchanged with zero duration");
|
|
290
|
+
}
|
|
291
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
|
|
5
4
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
5
|
import {JBChainlinkV3PriceFeed} from "../../../../src/JBChainlinkV3PriceFeed.sol";
|
|
7
6
|
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.sol";
|
|
5
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
6
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
7
|
+
import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
|
|
8
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
9
|
+
import {IJBPrices} from "../../../../src/interfaces/IJBPrices.sol";
|
|
10
|
+
import {IJBProjects} from "../../../../src/interfaces/IJBProjects.sol";
|
|
11
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
12
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
13
|
+
import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
|
|
5
14
|
import {JBTest} from "../../../helpers/JBTest.sol";
|
|
6
15
|
|
|
7
16
|
/*
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.sol";
|
|
5
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
6
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
7
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
8
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
9
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
10
|
+
import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
|
|
11
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
5
12
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
13
|
|
|
7
14
|
contract TestBurnTokensOf_Local is JBControllerSetup {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
5
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
6
|
+
import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
|
|
7
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
5
8
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
9
|
|
|
7
10
|
contract TestClaimTokensFor_Local is JBControllerSetup {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
5
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
6
|
+
import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
|
|
7
|
+
import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
|
|
8
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
9
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
10
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
11
|
|
|
7
12
|
contract TestDeployERC20For_Local is JBControllerSetup {
|
|
@@ -34,6 +39,7 @@ contract TestDeployERC20For_Local is JBControllerSetup {
|
|
|
34
39
|
function test_WhenCallerIsPermissionedAndSaltIsNonZero() external {
|
|
35
40
|
// it will deploy ERC20 and return IJBToken
|
|
36
41
|
|
|
42
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
37
43
|
bytes32 _nonZeroSalt = bytes32("somesalt");
|
|
38
44
|
bytes32 _encodedSalt = keccak256(abi.encodePacked(address(this), _nonZeroSalt));
|
|
39
45
|
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.sol";
|
|
5
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
6
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
7
|
+
import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
|
|
8
|
+
import {IJBProjects} from "../../../../src/interfaces/IJBProjects.sol";
|
|
9
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
10
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
11
|
+
import {IJBSplitHook} from "../../../../src/interfaces/IJBSplitHook.sol";
|
|
12
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
13
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
14
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
15
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
16
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
17
|
+
import {JBFundAccessLimitGroup} from "../../../../src/structs/JBFundAccessLimitGroup.sol";
|
|
18
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
19
|
+
import {JBRulesetConfig} from "../../../../src/structs/JBRulesetConfig.sol";
|
|
20
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
21
|
+
import {JBSplit} from "../../../../src/structs/JBSplit.sol";
|
|
22
|
+
import {JBSplitGroup} from "../../../../src/structs/JBSplitGroup.sol";
|
|
23
|
+
import {JBTerminalConfig} from "../../../../src/structs/JBTerminalConfig.sol";
|
|
24
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
25
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
26
|
|
|
7
27
|
contract TestLaunchProjectFor_Local is JBControllerSetup {
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.sol";
|
|
5
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
6
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
7
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
8
|
+
import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
|
|
9
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
10
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
11
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
12
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
13
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
14
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
15
|
+
import {JBCurrencyAmount} from "../../../../src/structs/JBCurrencyAmount.sol";
|
|
16
|
+
import {JBFundAccessLimitGroup} from "../../../../src/structs/JBFundAccessLimitGroup.sol";
|
|
17
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
18
|
+
import {JBRulesetConfig} from "../../../../src/structs/JBRulesetConfig.sol";
|
|
19
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
20
|
+
import {JBSplitGroup} from "../../../../src/structs/JBSplitGroup.sol";
|
|
21
|
+
import {JBTerminalConfig} from "../../../../src/structs/JBTerminalConfig.sol";
|
|
22
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
23
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
24
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
25
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
26
|
|
|
7
27
|
contract TestLaunchRulesetsFor_Local is JBControllerSetup {
|
|
@@ -1,7 +1,16 @@
|
|
|
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 {JBController} from "../../../../src/JBController.sol";
|
|
6
|
+
import {IJBMigratable} from "../../../../src/interfaces/IJBMigratable.sol";
|
|
7
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
8
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
9
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
10
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
11
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
12
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
13
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
14
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
15
|
|
|
7
16
|
contract TestMigrateController_Local is JBControllerSetup {
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.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 {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
9
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
10
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
11
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
12
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
13
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
14
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
15
|
|
|
7
16
|
contract TestMintTokensOfUnits_Local is JBControllerSetup {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.sol";
|
|
5
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
6
|
+
import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
|
|
7
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
8
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
9
|
|
|
7
10
|
contract TestExecutePayReservedTokenToTerminal_Local is JBControllerSetup {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.sol";
|
|
5
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
6
|
+
import {IJBMigratable} from "../../../../src/interfaces/IJBMigratable.sol";
|
|
7
|
+
import {IJBProjectUriRegistry} from "../../../../src/interfaces/IJBProjectUriRegistry.sol";
|
|
8
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
9
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
10
|
|
|
7
11
|
contract TestReceiveMigrationFrom_Local is JBControllerSetup {
|
|
@@ -1,7 +1,13 @@
|
|
|
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 {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
6
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
7
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
8
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
9
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
10
|
+
import {JBRulesetWithMetadata} from "../../../../src/structs/JBRulesetWithMetadata.sol";
|
|
5
11
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
12
|
|
|
7
13
|
/**
|
|
@@ -1,7 +1,27 @@
|
|
|
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 {JBController} from "../../../../src/JBController.sol";
|
|
6
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
7
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
8
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
9
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
10
|
+
import {IJBSplitHook} from "../../../../src/interfaces/IJBSplitHook.sol";
|
|
11
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
12
|
+
import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
|
|
13
|
+
import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
|
|
14
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
15
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
16
|
+
import {JBFundAccessLimitGroup} from "../../../../src/structs/JBFundAccessLimitGroup.sol";
|
|
17
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
18
|
+
import {JBRulesetConfig} from "../../../../src/structs/JBRulesetConfig.sol";
|
|
19
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
20
|
+
import {JBSplit} from "../../../../src/structs/JBSplit.sol";
|
|
21
|
+
import {JBSplitGroup} from "../../../../src/structs/JBSplitGroup.sol";
|
|
22
|
+
import {JBSplitHookContext} from "../../../../src/structs/JBSplitHookContext.sol";
|
|
23
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
24
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
25
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
26
|
|
|
7
27
|
contract TestSendReservedTokensToSplitsOf_Local is JBControllerSetup {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
5
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
6
|
+
import {IJBSplits} from "../../../../src/interfaces/IJBSplits.sol";
|
|
7
|
+
import {JBSplitGroup} from "../../../../src/structs/JBSplitGroup.sol";
|
|
8
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
9
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
10
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
11
|
|
|
7
12
|
contract TestSetSplitGroupsOf_Local is JBControllerSetup {
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.sol";
|
|
5
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
6
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
7
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
8
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
9
|
+
import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
|
|
10
|
+
import {IJBTokens} from "../../../../src/interfaces/IJBTokens.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 {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
16
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
17
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
18
|
|
|
7
19
|
contract TestSetTokenFor_Local is JBControllerSetup {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
5
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
6
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
7
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
8
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
9
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
10
|
|
|
7
11
|
contract TestSetUriOf_Local is JBControllerSetup {
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBController} from "../../../../src/JBController.sol";
|
|
5
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
6
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
7
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
8
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
9
|
+
import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
|
|
10
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
11
|
+
import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
12
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
13
|
+
import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
|
|
14
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
5
15
|
import {JBControllerSetup} from "./JBControllerSetup.sol";
|
|
6
16
|
|
|
7
17
|
contract TestTransferCreditsFrom_Local is JBControllerSetup {
|