@bananapus/core-v6 0.0.15 → 0.0.16
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 +4 -0
- package/README.md +2 -2
- package/SKILLS.md +2 -0
- package/STYLE_GUIDE.md +16 -2
- package/package.json +2 -2
- package/script/Deploy.s.sol +22 -13
- package/script/DeployPeriphery.s.sol +70 -52
- package/script/helpers/CoreDeploymentLib.sol +83 -35
- package/src/JBChainlinkV3PriceFeed.sol +1 -0
- package/src/JBController.sol +18 -3
- package/src/JBERC20.sol +12 -3
- package/src/JBFundAccessLimits.sol +12 -2
- package/src/JBMultiTerminal.sol +3 -1
- package/src/JBPermissions.sol +1 -0
- package/src/JBProjects.sol +1 -1
- package/src/JBRulesets.sol +11 -0
- package/src/JBSplits.sol +5 -0
- package/src/JBTerminalStore.sol +3 -0
- package/src/JBTokens.sol +40 -4
- package/src/interfaces/IJBController.sol +6 -0
- package/src/interfaces/IJBPermitTerminal.sol +1 -0
- package/src/interfaces/IJBToken.sol +5 -0
- package/src/interfaces/IJBTokens.sol +13 -0
- package/src/libraries/JBMetadataResolver.sol +7 -3
- 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 +1 -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/TestCashOut.sol +15 -1
- package/test/TestCashOutCountFor.sol +1 -1
- package/test/TestCashOutHooks.sol +47 -25
- package/test/TestCashOutTimingEdge.sol +13 -1
- package/test/TestDurationUnderflow.sol +13 -1
- 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/TestLaunchProject.sol +13 -1
- package/test/TestMetaTx.sol +15 -1
- package/test/TestMetadataParserLib.sol +37 -4
- package/test/TestMigrationHeldFees.sol +16 -1
- package/test/TestMintTokensOf.sol +14 -1
- 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/TestPermit2Terminal.sol +36 -3
- package/test/TestRulesetQueueing.sol +24 -1
- package/test/TestRulesetQueuingStress.sol +20 -1
- package/test/TestRulesetWeightCaching.sol +5 -1
- 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 +17 -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/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 +42 -7
- package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +30 -6
- 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 +32 -6
- package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +0 -1
- package/test/units/static/JBMultiTerminal/TestSendPayoutsOf.sol +15 -1
- package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +17 -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 +8 -1
- 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 +20 -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,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
|
-
import "forge-std/Test.sol";
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
5
|
import {JBFees} from "../../src/libraries/JBFees.sol";
|
|
6
6
|
import {JBConstants} from "../../src/libraries/JBConstants.sol";
|
|
7
7
|
|
|
@@ -17,6 +17,7 @@ contract FeeProperties is Test {
|
|
|
17
17
|
// =========================================================================
|
|
18
18
|
/// @notice feeAmountFrom(a+b, fee) vs feeAmountFrom(a, fee) + feeAmountFrom(b, fee)
|
|
19
19
|
/// differ by at most 1 wei due to mulDiv rounding.
|
|
20
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
20
21
|
function check_fee_additivity(uint256 a, uint256 b, uint256 feePercent) public pure {
|
|
21
22
|
vm.assume(a > 0 && b > 0);
|
|
22
23
|
vm.assume(a <= type(uint128).max && b <= type(uint128).max);
|
|
@@ -53,6 +54,7 @@ contract FeeProperties is Test {
|
|
|
53
54
|
/// @notice feeAmountResultingIn(netAmount, fee) >= feeAmountFrom(netAmount + feeAmountResultingIn(netAmount, fee),
|
|
54
55
|
// fee) / The reverse fee is always >= the forward fee on the gross amount, ensuring
|
|
55
56
|
/// the protocol never undercharges when returning held fees.
|
|
57
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
56
58
|
function check_fee_returnConsistency(uint256 netAmount, uint256 feePercent) public pure {
|
|
57
59
|
vm.assume(netAmount > 0 && netAmount <= type(uint128).max);
|
|
58
60
|
vm.assume(feePercent > 0 && feePercent < MAX_FEE);
|
|
@@ -91,6 +93,7 @@ contract FeeProperties is Test {
|
|
|
91
93
|
/// The overshoot is bounded by MAX_FEE / (MAX_FEE - feePercent): the rounding
|
|
92
94
|
/// error in fee1 (at most 1 wei of net) gets amplified by the fee ratio when
|
|
93
95
|
/// computing the reverse fee, plus 1 for the reverse mulDiv rounding itself.
|
|
96
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
94
97
|
function check_fee_roundTrip(uint256 amount, uint256 feePercent) public pure {
|
|
95
98
|
vm.assume(amount > 0 && amount <= type(uint128).max);
|
|
96
99
|
vm.assume(feePercent > 0 && feePercent < MAX_FEE);
|
|
@@ -133,6 +136,7 @@ contract FeeProperties is Test {
|
|
|
133
136
|
// Property 4: Partial return monotonicity
|
|
134
137
|
// =========================================================================
|
|
135
138
|
/// @notice feeAmountResultingIn(a, fee) <= feeAmountResultingIn(b, fee) when a <= b.
|
|
139
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
136
140
|
function check_fee_partialReturnMonotonicity(uint256 a, uint256 b, uint256 feePercent) public pure {
|
|
137
141
|
vm.assume(a > 0 && b > 0);
|
|
138
142
|
vm.assume(a <= type(uint128).max && b <= type(uint128).max);
|
|
@@ -163,6 +167,7 @@ contract FeeProperties is Test {
|
|
|
163
167
|
/// fee = feeAmountFrom(heldFeeAmount, feePercent) <= heldFeeAmount.
|
|
164
168
|
/// This guarantees leftover = heldFeeAmount - fee never underflows, and
|
|
165
169
|
/// leftover + fee == heldFeeAmount (exact decomposition).
|
|
170
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
166
171
|
function check_fee_subtractionSafety(uint256 heldFeeAmount, uint256 feePercent) public pure {
|
|
167
172
|
vm.assume(heldFeeAmount > 0 && heldFeeAmount <= type(uint128).max);
|
|
168
173
|
vm.assume(feePercent > 0 && feePercent < MAX_FEE);
|
|
@@ -195,6 +200,7 @@ contract FeeProperties is Test {
|
|
|
195
200
|
/// @notice After N splits each paying fee, total fee error vs single-payment fee
|
|
196
201
|
/// is bounded by N wei. For N=10: sum(feeAmountFrom(amount/N, fee), N times)
|
|
197
202
|
/// vs feeAmountFrom(amount, fee) differ by at most N.
|
|
203
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
198
204
|
function check_fee_multiSplitAccumulation(uint256 amount, uint256 feePercent) public pure {
|
|
199
205
|
vm.assume(amount >= 10); // Must be divisible into 10 parts
|
|
200
206
|
vm.assume(amount <= type(uint128).max);
|
package/test/helpers/JBTest.sol
CHANGED
|
@@ -6,7 +6,7 @@ import {JBRulesetMetadata} from "../../src/structs/JBRulesetMetadata.sol";
|
|
|
6
6
|
import {JBRulesetMetadataResolver} from "../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
7
7
|
import {JBConstants} from "../../src/libraries/JBConstants.sol";
|
|
8
8
|
import {IJBRulesetApprovalHook} from "../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
9
|
-
import "lib/forge-std/src/Test.sol";
|
|
9
|
+
import {Test} from "lib/forge-std/src/Test.sol";
|
|
10
10
|
|
|
11
11
|
contract JBTest is Test {
|
|
12
12
|
using JBRulesetMetadataResolver for JBRulesetMetadata;
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// forge-lint: disable-next-line(unused-import)
|
|
5
|
+
import {Test} from "forge-std/Test.sol";
|
|
6
|
+
// forge-lint: disable-next-line(unused-import)
|
|
7
|
+
import {StdStorage, stdStorage} from "forge-std/StdStorage.sol";
|
|
5
8
|
|
|
9
|
+
// forge-lint: disable-next-line(unused-import)
|
|
6
10
|
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
11
|
+
// forge-lint: disable-next-line(unused-import)
|
|
7
12
|
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
|
|
13
|
+
// forge-lint: disable-next-line(unused-import)
|
|
8
14
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
15
|
+
// forge-lint: disable-next-line(unused-import)
|
|
9
16
|
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
|
|
17
|
+
// forge-lint: disable-next-line(unused-import)
|
|
10
18
|
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
|
|
19
|
+
// forge-lint: disable-next-line(unused-import)
|
|
11
20
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
21
|
+
// forge-lint: disable-next-line(unused-import)
|
|
12
22
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
23
|
+
// forge-lint: disable-next-line(unused-import)
|
|
13
24
|
import {ERC165, IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
25
|
+
// forge-lint: disable-next-line(unused-import)
|
|
14
26
|
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
27
|
+
// forge-lint: disable-next-line(unused-import)
|
|
15
28
|
import {JBControlled} from "../../src/abstract/JBControlled.sol";
|
|
29
|
+
// forge-lint: disable-next-line(unused-import)
|
|
16
30
|
import {JBPermissioned} from "../../src/abstract/JBPermissioned.sol";
|
|
17
31
|
import {JBController} from "../../src/JBController.sol";
|
|
18
32
|
import {JBDirectory} from "../../src/JBDirectory.sol";
|
|
@@ -26,70 +40,132 @@ import {JBProjects} from "../../src/JBProjects.sol";
|
|
|
26
40
|
import {JBSplits} from "../../src/JBSplits.sol";
|
|
27
41
|
import {JBERC20} from "../../src/JBERC20.sol";
|
|
28
42
|
import {JBTokens} from "../../src/JBTokens.sol";
|
|
43
|
+
// forge-lint: disable-next-line(unused-import)
|
|
29
44
|
import {JBDeadline} from "../../src/JBDeadline.sol";
|
|
45
|
+
// forge-lint: disable-next-line(unused-import)
|
|
30
46
|
import {JBApprovalStatus} from "../../src/enums/JBApprovalStatus.sol";
|
|
31
47
|
import {JBMultiTerminal} from "../../src/JBMultiTerminal.sol";
|
|
48
|
+
// forge-lint: disable-next-line(unused-import)
|
|
32
49
|
import {JBAccountingContext} from "../../src/structs/JBAccountingContext.sol";
|
|
50
|
+
// forge-lint: disable-next-line(unused-import)
|
|
33
51
|
import {JBCurrencyAmount} from "../../src/structs/JBCurrencyAmount.sol";
|
|
52
|
+
// forge-lint: disable-next-line(unused-import)
|
|
34
53
|
import {JBAfterPayRecordedContext} from "../../src/structs/JBAfterPayRecordedContext.sol";
|
|
54
|
+
// forge-lint: disable-next-line(unused-import)
|
|
35
55
|
import {JBAfterCashOutRecordedContext} from "../../src/structs/JBAfterCashOutRecordedContext.sol";
|
|
56
|
+
// forge-lint: disable-next-line(unused-import)
|
|
36
57
|
import {JBFee} from "../../src/structs/JBFee.sol";
|
|
58
|
+
// forge-lint: disable-next-line(unused-import)
|
|
37
59
|
import {JBFees} from "../../src/libraries/JBFees.sol";
|
|
60
|
+
// forge-lint: disable-next-line(unused-import)
|
|
38
61
|
import {JBMetadataResolver} from "../../src/libraries/JBMetadataResolver.sol";
|
|
62
|
+
// forge-lint: disable-next-line(unused-import)
|
|
39
63
|
import {JBCashOuts} from "../../src/libraries/JBCashOuts.sol";
|
|
64
|
+
// forge-lint: disable-next-line(unused-import)
|
|
40
65
|
import {JBFundAccessLimitGroup} from "../../src/structs/JBFundAccessLimitGroup.sol";
|
|
66
|
+
// forge-lint: disable-next-line(unused-import)
|
|
41
67
|
import {JBRuleset} from "../../src/structs/JBRuleset.sol";
|
|
68
|
+
// forge-lint: disable-next-line(unused-import)
|
|
42
69
|
import {JBRulesetWithMetadata} from "../../src/structs/JBRulesetWithMetadata.sol";
|
|
70
|
+
// forge-lint: disable-next-line(unused-import)
|
|
43
71
|
import {JBRulesetMetadata} from "../../src/structs/JBRulesetMetadata.sol";
|
|
72
|
+
// forge-lint: disable-next-line(unused-import)
|
|
44
73
|
import {JBRulesetConfig} from "../../src/structs/JBRulesetConfig.sol";
|
|
74
|
+
// forge-lint: disable-next-line(unused-import)
|
|
45
75
|
import {JBSplitGroup} from "../../src/structs/JBSplitGroup.sol";
|
|
76
|
+
// forge-lint: disable-next-line(unused-import)
|
|
46
77
|
import {JBPermissionsData} from "../../src/structs/JBPermissionsData.sol";
|
|
78
|
+
// forge-lint: disable-next-line(unused-import)
|
|
47
79
|
import {JBBeforePayRecordedContext} from "../../src/structs/JBBeforePayRecordedContext.sol";
|
|
80
|
+
// forge-lint: disable-next-line(unused-import)
|
|
48
81
|
import {JBBeforeCashOutRecordedContext} from "../../src/structs/JBBeforeCashOutRecordedContext.sol";
|
|
82
|
+
// forge-lint: disable-next-line(unused-import)
|
|
49
83
|
import {JBSplit} from "../../src/structs/JBSplit.sol";
|
|
84
|
+
// forge-lint: disable-next-line(unused-import)
|
|
50
85
|
import {JBTerminalConfig} from "../../src/structs/JBTerminalConfig.sol";
|
|
86
|
+
// forge-lint: disable-next-line(unused-import)
|
|
51
87
|
import {JBPayHookSpecification} from "../../src/structs/JBPayHookSpecification.sol";
|
|
88
|
+
// forge-lint: disable-next-line(unused-import)
|
|
52
89
|
import {JBCashOutHookSpecification} from "../../src/structs/JBCashOutHookSpecification.sol";
|
|
90
|
+
// forge-lint: disable-next-line(unused-import)
|
|
53
91
|
import {JBTokenAmount} from "../../src/structs/JBTokenAmount.sol";
|
|
92
|
+
// forge-lint: disable-next-line(unused-import)
|
|
54
93
|
import {JBSplitHookContext} from "../../src/structs/JBSplitHookContext.sol";
|
|
94
|
+
// forge-lint: disable-next-line(unused-import)
|
|
55
95
|
import {IJBToken} from "../../src/interfaces/IJBToken.sol";
|
|
96
|
+
// forge-lint: disable-next-line(unused-import)
|
|
56
97
|
import {JBSingleAllowance} from "../../src/structs/JBSingleAllowance.sol";
|
|
98
|
+
// forge-lint: disable-next-line(unused-import)
|
|
57
99
|
import {IJBController} from "../../src/interfaces/IJBController.sol";
|
|
100
|
+
// forge-lint: disable-next-line(unused-import)
|
|
58
101
|
import {IJBFeelessAddresses} from "../../src/interfaces/IJBFeelessAddresses.sol";
|
|
102
|
+
// forge-lint: disable-next-line(unused-import)
|
|
59
103
|
import {IJBFundAccessLimits} from "../../src/interfaces/IJBFundAccessLimits.sol";
|
|
104
|
+
// forge-lint: disable-next-line(unused-import)
|
|
60
105
|
import {IJBMigratable} from "../../src/interfaces/IJBMigratable.sol";
|
|
106
|
+
// forge-lint: disable-next-line(unused-import)
|
|
61
107
|
import {IJBPermissions} from "../../src/interfaces/IJBPermissions.sol";
|
|
108
|
+
// forge-lint: disable-next-line(unused-import)
|
|
62
109
|
import {IJBDirectoryAccessControl} from "../../src/interfaces/IJBDirectoryAccessControl.sol";
|
|
110
|
+
// forge-lint: disable-next-line(unused-import)
|
|
63
111
|
import {IJBTerminalStore} from "../../src/interfaces/IJBTerminalStore.sol";
|
|
112
|
+
// forge-lint: disable-next-line(unused-import)
|
|
64
113
|
import {IJBProjects} from "../../src/interfaces/IJBProjects.sol";
|
|
114
|
+
// forge-lint: disable-next-line(unused-import)
|
|
65
115
|
import {IJBRulesetApprovalHook} from "../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
116
|
+
// forge-lint: disable-next-line(unused-import)
|
|
66
117
|
import {IJBDirectory} from "../../src/interfaces/IJBDirectory.sol";
|
|
118
|
+
// forge-lint: disable-next-line(unused-import)
|
|
67
119
|
import {IJBRulesets} from "../../src/interfaces/IJBRulesets.sol";
|
|
120
|
+
// forge-lint: disable-next-line(unused-import)
|
|
68
121
|
import {IJBSplits} from "../../src/interfaces/IJBSplits.sol";
|
|
122
|
+
// forge-lint: disable-next-line(unused-import)
|
|
69
123
|
import {IJBTokenUriResolver} from "../../src/interfaces/IJBTokenUriResolver.sol";
|
|
124
|
+
// forge-lint: disable-next-line(unused-import)
|
|
70
125
|
import {IJBTokens} from "../../src/interfaces/IJBTokens.sol";
|
|
126
|
+
// forge-lint: disable-next-line(unused-import)
|
|
71
127
|
import {IJBSplitHook} from "../../src/interfaces/IJBSplitHook.sol";
|
|
128
|
+
// forge-lint: disable-next-line(unused-import)
|
|
72
129
|
import {IJBPayHook} from "../../src/interfaces/IJBPayHook.sol";
|
|
130
|
+
// forge-lint: disable-next-line(unused-import)
|
|
73
131
|
import {IJBRulesetDataHook} from "../../src/interfaces/IJBRulesetDataHook.sol";
|
|
132
|
+
// forge-lint: disable-next-line(unused-import)
|
|
74
133
|
import {IJBCashOutHook} from "../../src/interfaces/IJBCashOutHook.sol";
|
|
134
|
+
// forge-lint: disable-next-line(unused-import)
|
|
75
135
|
import {IJBRulesetDataHook} from "../../src/interfaces/IJBRulesetDataHook.sol";
|
|
136
|
+
// forge-lint: disable-next-line(unused-import)
|
|
76
137
|
import {IJBMultiTerminal} from "../../src/interfaces/IJBMultiTerminal.sol";
|
|
138
|
+
// forge-lint: disable-next-line(unused-import)
|
|
77
139
|
import {IJBCashOutTerminal} from "../../src/interfaces/IJBCashOutTerminal.sol";
|
|
140
|
+
// forge-lint: disable-next-line(unused-import)
|
|
78
141
|
import {IJBPayoutTerminal} from "../../src/interfaces/IJBPayoutTerminal.sol";
|
|
142
|
+
// forge-lint: disable-next-line(unused-import)
|
|
79
143
|
import {IJBPermitTerminal} from "../../src/interfaces/IJBPermitTerminal.sol";
|
|
144
|
+
// forge-lint: disable-next-line(unused-import)
|
|
80
145
|
import {IJBFeeTerminal} from "../../src/interfaces/IJBFeeTerminal.sol";
|
|
146
|
+
// forge-lint: disable-next-line(unused-import)
|
|
81
147
|
import {IJBTerminal} from "../../src/interfaces/IJBTerminal.sol";
|
|
148
|
+
// forge-lint: disable-next-line(unused-import)
|
|
82
149
|
import {IJBPriceFeed} from "../../src/interfaces/IJBPriceFeed.sol";
|
|
150
|
+
// forge-lint: disable-next-line(unused-import)
|
|
83
151
|
import {IJBPermissioned} from "../../src/interfaces/IJBPermissioned.sol";
|
|
152
|
+
// forge-lint: disable-next-line(unused-import)
|
|
84
153
|
import {IJBProjectUriRegistry} from "../../src/interfaces/IJBProjectUriRegistry.sol";
|
|
154
|
+
// forge-lint: disable-next-line(unused-import)
|
|
85
155
|
import {IJBRulesetApprovalHook} from "../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
156
|
+
// forge-lint: disable-next-line(unused-import)
|
|
86
157
|
import {IJBPrices} from "../../src/interfaces/IJBPrices.sol";
|
|
87
158
|
|
|
159
|
+
// forge-lint: disable-next-line(unused-import)
|
|
88
160
|
import {JBConstants} from "../../src/libraries/JBConstants.sol";
|
|
161
|
+
// forge-lint: disable-next-line(unused-import)
|
|
89
162
|
import {JBCurrencyIds} from "../../src/libraries/JBCurrencyIds.sol";
|
|
163
|
+
// forge-lint: disable-next-line(unused-import)
|
|
90
164
|
import {JBRulesetMetadataResolver} from "../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
165
|
+
// forge-lint: disable-next-line(unused-import)
|
|
91
166
|
import {JBSplitGroupIds} from "../../src/libraries/JBSplitGroupIds.sol";
|
|
92
167
|
|
|
168
|
+
// forge-lint: disable-next-line(unused-import)
|
|
93
169
|
import {IPermit2, IAllowanceTransfer} from "@uniswap/permit2/src/interfaces/IPermit2.sol";
|
|
94
170
|
import {DeployPermit2} from "@uniswap/permit2/test/utils/DeployPermit2.sol";
|
|
95
171
|
|
|
@@ -98,7 +174,9 @@ import {JBTest} from "./JBTest.sol";
|
|
|
98
174
|
|
|
99
175
|
import {MockERC20} from "./../mock/MockERC20.sol";
|
|
100
176
|
|
|
177
|
+
// forge-lint: disable-next-line(unused-import)
|
|
101
178
|
import {mulDiv} from "@prb/math/src/Common.sol";
|
|
179
|
+
// forge-lint: disable-next-line(unused-import)
|
|
102
180
|
import {mul as UD60x18mul, wrap as UD60x18wrap, unwrap as UD60x18unwrap} from "@prb/math/src/UD60x18.sol";
|
|
103
181
|
|
|
104
182
|
// Base contract for Juicebox system tests.
|
|
@@ -294,14 +372,19 @@ contract TestBaseWorkflow is JBTest, DeployPermit2 {
|
|
|
294
372
|
if (_nonce == 0x00) {
|
|
295
373
|
data = abi.encodePacked(bytes1(0xd6), bytes1(0x94), _origin, bytes1(0x80));
|
|
296
374
|
} else if (_nonce <= 0x7f) {
|
|
375
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
297
376
|
data = abi.encodePacked(bytes1(0xd6), bytes1(0x94), _origin, uint8(_nonce));
|
|
298
377
|
} else if (_nonce <= 0xff) {
|
|
378
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
299
379
|
data = abi.encodePacked(bytes1(0xd7), bytes1(0x94), _origin, bytes1(0x81), uint8(_nonce));
|
|
300
380
|
} else if (_nonce <= 0xffff) {
|
|
381
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
301
382
|
data = abi.encodePacked(bytes1(0xd8), bytes1(0x94), _origin, bytes1(0x82), uint16(_nonce));
|
|
302
383
|
} else if (_nonce <= 0xffffff) {
|
|
384
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
303
385
|
data = abi.encodePacked(bytes1(0xd9), bytes1(0x94), _origin, bytes1(0x83), uint24(_nonce));
|
|
304
386
|
} else {
|
|
387
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
305
388
|
data = abi.encodePacked(bytes1(0xda), bytes1(0x94), _origin, bytes1(0x84), uint32(_nonce));
|
|
306
389
|
}
|
|
307
390
|
bytes32 hash = keccak256(data);
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import "forge-std/StdInvariant.sol";
|
|
5
|
-
import
|
|
4
|
+
import {StdInvariant} from "forge-std/StdInvariant.sol";
|
|
5
|
+
import {TestBaseWorkflow} from "../helpers/TestBaseWorkflow.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBSplitHook} from "../../src/interfaces/IJBSplitHook.sol";
|
|
8
|
+
import {JBRulesetMetadataResolver} from "../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
9
|
+
import {JBCurrencyAmount} from "../../src/structs/JBCurrencyAmount.sol";
|
|
10
|
+
import {JBFundAccessLimitGroup} from "../../src/structs/JBFundAccessLimitGroup.sol";
|
|
11
|
+
import {JBRuleset} from "../../src/structs/JBRuleset.sol";
|
|
12
|
+
import {JBRulesetConfig} from "../../src/structs/JBRulesetConfig.sol";
|
|
13
|
+
import {JBRulesetMetadata} from "../../src/structs/JBRulesetMetadata.sol";
|
|
14
|
+
import {JBSplit} from "../../src/structs/JBSplit.sol";
|
|
15
|
+
import {JBSplitGroup} from "../../src/structs/JBSplitGroup.sol";
|
|
16
|
+
import {JBTerminalConfig} from "../../src/structs/JBTerminalConfig.sol";
|
|
6
17
|
import {Phase3Handler} from "./handlers/Phase3Handler.sol";
|
|
7
18
|
import {JBAccountingContext} from "../../src/structs/JBAccountingContext.sol";
|
|
8
19
|
import {JBConstants} from "../../src/libraries/JBConstants.sol";
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import "forge-std/StdInvariant.sol";
|
|
5
|
-
import
|
|
4
|
+
import {StdInvariant} from "forge-std/StdInvariant.sol";
|
|
5
|
+
import {TestBaseWorkflow} from "../helpers/TestBaseWorkflow.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {JBConstants} from "../../src/libraries/JBConstants.sol";
|
|
8
|
+
import {JBRulesetMetadataResolver} from "../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
9
|
+
import {JBAccountingContext} from "../../src/structs/JBAccountingContext.sol";
|
|
10
|
+
import {JBFundAccessLimitGroup} from "../../src/structs/JBFundAccessLimitGroup.sol";
|
|
11
|
+
import {JBRuleset} from "../../src/structs/JBRuleset.sol";
|
|
12
|
+
import {JBRulesetConfig} from "../../src/structs/JBRulesetConfig.sol";
|
|
13
|
+
import {JBRulesetMetadata} from "../../src/structs/JBRulesetMetadata.sol";
|
|
14
|
+
import {JBSplitGroup} from "../../src/structs/JBSplitGroup.sol";
|
|
15
|
+
import {JBTerminalConfig} from "../../src/structs/JBTerminalConfig.sol";
|
|
6
16
|
import {RulesetsHandler} from "./handlers/RulesetsHandler.sol";
|
|
7
17
|
|
|
8
18
|
/// @notice Invariant tests for JBRulesets cycling, weight decay, and monotonicity.
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import "forge-std/StdInvariant.sol";
|
|
5
|
-
import
|
|
4
|
+
import {StdInvariant} from "forge-std/StdInvariant.sol";
|
|
5
|
+
import {TestBaseWorkflow} from "../helpers/TestBaseWorkflow.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {JBConstants} from "../../src/libraries/JBConstants.sol";
|
|
8
|
+
import {JBRulesetMetadataResolver} from "../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
9
|
+
import {JBFundAccessLimitGroup} from "../../src/structs/JBFundAccessLimitGroup.sol";
|
|
10
|
+
import {JBRuleset} from "../../src/structs/JBRuleset.sol";
|
|
11
|
+
import {JBRulesetConfig} from "../../src/structs/JBRulesetConfig.sol";
|
|
12
|
+
import {JBRulesetMetadata} from "../../src/structs/JBRulesetMetadata.sol";
|
|
13
|
+
import {JBSplitGroup} from "../../src/structs/JBSplitGroup.sol";
|
|
14
|
+
import {JBTerminalConfig} from "../../src/structs/JBTerminalConfig.sol";
|
|
6
15
|
import {TerminalStoreHandler} from "./handlers/TerminalStoreHandler.sol";
|
|
7
16
|
import {JBAccountingContext} from "../../src/structs/JBAccountingContext.sol";
|
|
8
17
|
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import "forge-std/StdInvariant.sol";
|
|
5
|
-
import
|
|
4
|
+
import {StdInvariant} from "forge-std/StdInvariant.sol";
|
|
5
|
+
import {TestBaseWorkflow} from "../helpers/TestBaseWorkflow.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBToken} from "../../src/interfaces/IJBToken.sol";
|
|
8
|
+
import {JBConstants} from "../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBRulesetMetadataResolver} from "../../src/libraries/JBRulesetMetadataResolver.sol";
|
|
10
|
+
import {JBAccountingContext} from "../../src/structs/JBAccountingContext.sol";
|
|
11
|
+
import {JBFundAccessLimitGroup} from "../../src/structs/JBFundAccessLimitGroup.sol";
|
|
12
|
+
import {JBRuleset} from "../../src/structs/JBRuleset.sol";
|
|
13
|
+
import {JBRulesetConfig} from "../../src/structs/JBRulesetConfig.sol";
|
|
14
|
+
import {JBRulesetMetadata} from "../../src/structs/JBRulesetMetadata.sol";
|
|
15
|
+
import {JBSplitGroup} from "../../src/structs/JBSplitGroup.sol";
|
|
16
|
+
import {JBTerminalConfig} from "../../src/structs/JBTerminalConfig.sol";
|
|
6
17
|
import {TokensHandler} from "./handlers/TokensHandler.sol";
|
|
7
18
|
|
|
8
19
|
/// @notice Invariant tests for JBTokens supply and balance consistency.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import "forge-std/Test.sol";
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
5
|
import {JBConstants} from "../../../src/libraries/JBConstants.sol";
|
|
6
6
|
import {IJBMultiTerminal} from "../../../src/interfaces/IJBMultiTerminal.sol";
|
|
7
7
|
import {IJBTerminalStore} from "../../../src/interfaces/IJBTerminalStore.sol";
|
|
@@ -20,12 +20,19 @@ contract ComprehensiveHandler is Test {
|
|
|
20
20
|
address public projectOwner;
|
|
21
21
|
|
|
22
22
|
// Ghost variables for fund tracking
|
|
23
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
23
24
|
uint256 public ghost_totalPaidIn;
|
|
25
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
24
26
|
uint256 public ghost_totalCashedOut;
|
|
27
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
25
28
|
uint256 public ghost_totalPaidOut;
|
|
29
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
26
30
|
uint256 public ghost_totalAddedToBalance;
|
|
31
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
27
32
|
uint256 public ghost_totalAllowanceUsed;
|
|
33
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
28
34
|
uint256 public ghost_feeProjectBalanceLast;
|
|
35
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
29
36
|
uint256 public ghost_feeProjectBalanceDecreased; // should always be 0
|
|
30
37
|
|
|
31
38
|
// Track actors
|
|
@@ -34,15 +41,25 @@ contract ComprehensiveHandler is Test {
|
|
|
34
41
|
uint256 public constant NUM_ACTORS = 5;
|
|
35
42
|
|
|
36
43
|
// Operation counters for debugging
|
|
44
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
37
45
|
uint256 public callCount_pay;
|
|
46
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
38
47
|
uint256 public callCount_cashOut;
|
|
48
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
39
49
|
uint256 public callCount_sendPayouts;
|
|
50
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
40
51
|
uint256 public callCount_addToBalance;
|
|
52
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
41
53
|
uint256 public callCount_sendReservedTokens;
|
|
54
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
42
55
|
uint256 public callCount_useAllowance;
|
|
56
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
43
57
|
uint256 public callCount_burnTokens;
|
|
58
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
44
59
|
uint256 public callCount_claimCredits;
|
|
60
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
45
61
|
uint256 public callCount_advanceTime;
|
|
62
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
46
63
|
uint256 public callCount_processHeldFees;
|
|
47
64
|
|
|
48
65
|
constructor(
|
|
@@ -62,6 +79,7 @@ contract ComprehensiveHandler is Test {
|
|
|
62
79
|
|
|
63
80
|
// Create actor addresses
|
|
64
81
|
for (uint256 i = 0; i < NUM_ACTORS; i++) {
|
|
82
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
65
83
|
address actor = address(uint160(0x2000 + i));
|
|
66
84
|
actors.push(actor);
|
|
67
85
|
isActor[actor] = true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import "forge-std/Test.sol";
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
5
|
import {JBConstants} from "../../../src/libraries/JBConstants.sol";
|
|
6
6
|
import {IJBMultiTerminal} from "../../../src/interfaces/IJBMultiTerminal.sol";
|
|
7
7
|
import {IJBTerminalStore} from "../../../src/interfaces/IJBTerminalStore.sol";
|
|
@@ -25,25 +25,41 @@ contract EconomicHandler is Test {
|
|
|
25
25
|
address public projectOwner;
|
|
26
26
|
|
|
27
27
|
// Ghost variables for conservation tracking
|
|
28
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
28
29
|
uint256 public ghost_totalPaidInA;
|
|
30
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
29
31
|
uint256 public ghost_totalPaidInB;
|
|
32
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
30
33
|
uint256 public ghost_totalPaidInC;
|
|
34
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
31
35
|
uint256 public ghost_totalCashedOutA;
|
|
36
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
32
37
|
uint256 public ghost_totalCashedOutB;
|
|
38
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
33
39
|
uint256 public ghost_totalCashedOutC;
|
|
40
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
34
41
|
uint256 public ghost_totalPaidOutA;
|
|
42
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
35
43
|
uint256 public ghost_totalPaidOutB;
|
|
44
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
36
45
|
uint256 public ghost_totalPaidOutC;
|
|
46
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
37
47
|
uint256 public ghost_totalAddedToBalanceA;
|
|
38
48
|
|
|
39
49
|
// Fee project tracking
|
|
50
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
40
51
|
uint256 public ghost_feeProjectBalance;
|
|
52
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
41
53
|
uint256 public ghost_feeProjectBalancePrev;
|
|
54
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
42
55
|
bool public ghost_feeProjectBalanceDecreased;
|
|
43
56
|
|
|
44
57
|
// Cross-project split tracking
|
|
58
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
45
59
|
bool public ghost_splitCascadeOccurred;
|
|
60
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
46
61
|
uint256 public ghost_projectBBalanceBeforeSplit;
|
|
62
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
47
63
|
uint256 public ghost_projectBBalanceAfterSplit;
|
|
48
64
|
|
|
49
65
|
// Track actors
|
|
@@ -52,18 +68,31 @@ contract EconomicHandler is Test {
|
|
|
52
68
|
uint256 public constant NUM_ACTORS = 10;
|
|
53
69
|
|
|
54
70
|
// Operation counters
|
|
71
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
55
72
|
uint256 public callCount_payA;
|
|
73
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
56
74
|
uint256 public callCount_payB;
|
|
75
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
57
76
|
uint256 public callCount_payC;
|
|
77
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
58
78
|
uint256 public callCount_cashOutA;
|
|
79
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
59
80
|
uint256 public callCount_cashOutB;
|
|
81
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
60
82
|
uint256 public callCount_cashOutC;
|
|
83
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
61
84
|
uint256 public callCount_sendPayoutsA;
|
|
85
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
62
86
|
uint256 public callCount_sendPayoutsB;
|
|
87
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
63
88
|
uint256 public callCount_sendPayoutsC;
|
|
89
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
64
90
|
uint256 public callCount_addToBalanceA;
|
|
91
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
65
92
|
uint256 public callCount_sendReservedA;
|
|
93
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
66
94
|
uint256 public callCount_sendReservedC;
|
|
95
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
67
96
|
uint256 public callCount_advanceTime;
|
|
68
97
|
|
|
69
98
|
// Per-actor tracking
|
|
@@ -90,6 +119,7 @@ contract EconomicHandler is Test {
|
|
|
90
119
|
projectOwner = _projectOwner;
|
|
91
120
|
|
|
92
121
|
for (uint256 i = 0; i < NUM_ACTORS; i++) {
|
|
122
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
93
123
|
address actor = address(uint160(0x3000 + i));
|
|
94
124
|
actors.push(actor);
|
|
95
125
|
isActor[actor] = true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import "forge-std/Test.sol";
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
5
|
import {JBConstants} from "../../../src/libraries/JBConstants.sol";
|
|
6
6
|
import {JBFees} from "../../../src/libraries/JBFees.sol";
|
|
7
7
|
import {JBFee} from "../../../src/structs/JBFee.sol";
|
|
@@ -39,44 +39,73 @@ contract Phase3Handler is Test {
|
|
|
39
39
|
// =========================================================================
|
|
40
40
|
|
|
41
41
|
// Per-project total inflows/outflows
|
|
42
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
42
43
|
mapping(uint256 => uint256) public ghost_totalPaidIn;
|
|
44
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
43
45
|
mapping(uint256 => uint256) public ghost_totalCashedOut;
|
|
46
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
44
47
|
mapping(uint256 => uint256) public ghost_totalPaidOut;
|
|
48
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
45
49
|
mapping(uint256 => uint256) public ghost_totalAllowanceUsed;
|
|
50
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
46
51
|
mapping(uint256 => uint256) public ghost_totalAddedToBalance;
|
|
47
52
|
|
|
48
53
|
// Fee tracking (key innovation for strict invariants)
|
|
54
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
49
55
|
mapping(uint256 => uint256) public ghost_totalFeesDeducted;
|
|
56
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
50
57
|
mapping(uint256 => uint256) public ghost_totalFeesSentToProject1;
|
|
58
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
51
59
|
mapping(uint256 => uint256) public ghost_totalHeldFeeAmounts;
|
|
60
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
52
61
|
mapping(uint256 => uint256) public ghost_totalReturnedFees;
|
|
62
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
53
63
|
mapping(uint256 => uint256) public ghost_totalProcessedFees;
|
|
54
64
|
|
|
55
65
|
// Per-actor tracking
|
|
66
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
56
67
|
mapping(address => mapping(uint256 => uint256)) public ghost_actorContributed;
|
|
68
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
57
69
|
mapping(address => mapping(uint256 => uint256)) public ghost_actorExtracted;
|
|
58
70
|
|
|
59
71
|
// Token tracking
|
|
72
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
60
73
|
mapping(uint256 => uint256) public ghost_totalReservesSent;
|
|
61
74
|
|
|
62
75
|
// Global conservation
|
|
76
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
63
77
|
uint256 public ghost_globalInflows;
|
|
78
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
64
79
|
uint256 public ghost_globalOutflows;
|
|
65
80
|
|
|
66
81
|
// Operation counters
|
|
82
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
67
83
|
uint256 public callCount_pay2;
|
|
84
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
68
85
|
uint256 public callCount_pay3;
|
|
86
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
69
87
|
uint256 public callCount_cashOut2;
|
|
88
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
70
89
|
uint256 public callCount_cashOut3;
|
|
90
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
71
91
|
uint256 public callCount_sendPayouts2;
|
|
92
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
72
93
|
uint256 public callCount_useAllowance2;
|
|
94
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
73
95
|
uint256 public callCount_sendReserved2;
|
|
96
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
74
97
|
uint256 public callCount_processHeldFees2;
|
|
98
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
75
99
|
uint256 public callCount_addToBalanceReturn2;
|
|
100
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
76
101
|
uint256 public callCount_addToBalanceNoReturn2;
|
|
102
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
77
103
|
uint256 public callCount_burnTokens2;
|
|
104
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
78
105
|
uint256 public callCount_burnTokens3;
|
|
106
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
79
107
|
uint256 public callCount_claimCredits2;
|
|
108
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
80
109
|
uint256 public callCount_advanceTime;
|
|
81
110
|
|
|
82
111
|
constructor(
|
|
@@ -99,6 +128,7 @@ contract Phase3Handler is Test {
|
|
|
99
128
|
projectOwner = _projectOwner;
|
|
100
129
|
|
|
101
130
|
for (uint256 i = 0; i < NUM_ACTORS; i++) {
|
|
131
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
102
132
|
address actor = address(uint160(0x4000 + i));
|
|
103
133
|
actors.push(actor);
|
|
104
134
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import "forge-std/Test.sol";
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
5
|
import {JBConstants} from "../../../src/libraries/JBConstants.sol";
|
|
6
6
|
import {IJBRulesets} from "../../../src/interfaces/IJBRulesets.sol";
|
|
7
7
|
import {IJBController} from "../../../src/interfaces/IJBController.sol";
|
|
@@ -25,9 +25,13 @@ contract RulesetsHandler is Test {
|
|
|
25
25
|
address public projectOwner;
|
|
26
26
|
|
|
27
27
|
// Ghost: track the last observed cycle number and weight for monotonicity checks
|
|
28
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
28
29
|
uint48 public ghost_lastCycleNumber;
|
|
30
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
29
31
|
uint112 public ghost_lastWeight;
|
|
32
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
30
33
|
bool public ghost_hasLaunched;
|
|
34
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
31
35
|
uint256 public ghost_queueCount;
|
|
32
36
|
|
|
33
37
|
constructor(IJBRulesets _rulesets, IJBController _controller, uint256 _projectId, address _projectOwner) {
|