@bananapus/core-v6 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADMINISTRATION.md +5 -1
- package/ARCHITECTURE.md +2 -1
- package/AUDIT_INSTRUCTIONS.md +342 -0
- package/CHANGE_LOG.md +375 -0
- package/README.md +6 -6
- package/RISKS.md +171 -50
- package/SKILLS.md +11 -6
- package/STYLE_GUIDE.md +16 -2
- package/USER_JOURNEYS.md +622 -0
- package/package.json +2 -2
- package/script/Deploy.s.sol +22 -13
- package/script/DeployPeriphery.s.sol +76 -52
- package/script/helpers/CoreDeploymentLib.sol +83 -35
- package/src/JBChainlinkV3PriceFeed.sol +1 -0
- package/src/JBController.sol +23 -3
- package/src/JBDeadline.sol +3 -0
- package/src/JBDirectory.sol +2 -1
- package/src/JBERC20.sol +12 -3
- package/src/JBFundAccessLimits.sol +12 -2
- package/src/JBMultiTerminal.sol +53 -10
- package/src/JBPermissions.sol +3 -0
- package/src/JBPrices.sol +8 -2
- package/src/JBProjects.sol +1 -1
- package/src/JBRulesets.sol +14 -0
- package/src/JBSplits.sol +14 -5
- package/src/JBTerminalStore.sol +57 -47
- package/src/JBTokens.sol +43 -4
- package/src/interfaces/IJBController.sol +6 -0
- package/src/interfaces/IJBPermitTerminal.sol +1 -0
- package/src/interfaces/IJBTerminalStore.sol +3 -0
- package/src/interfaces/IJBToken.sol +5 -0
- package/src/interfaces/IJBTokens.sol +13 -0
- package/src/libraries/JBFees.sol +2 -0
- package/src/libraries/JBMetadataResolver.sol +24 -7
- package/src/libraries/JBRulesetMetadataResolver.sol +21 -21
- package/src/structs/JBAccountingContext.sol +1 -0
- package/src/structs/JBAfterCashOutRecordedContext.sol +1 -0
- package/src/structs/JBAfterPayRecordedContext.sol +1 -0
- package/src/structs/JBBeforeCashOutRecordedContext.sol +5 -0
- package/src/structs/JBBeforePayRecordedContext.sol +1 -0
- package/src/structs/JBCashOutHookSpecification.sol +1 -0
- package/src/structs/JBCurrencyAmount.sol +1 -0
- package/src/structs/JBFee.sol +1 -0
- package/src/structs/JBFundAccessLimitGroup.sol +1 -0
- package/src/structs/JBPayHookSpecification.sol +1 -0
- package/src/structs/JBPermissionsData.sol +1 -0
- package/src/structs/JBRuleset.sol +1 -0
- package/src/structs/JBRulesetConfig.sol +1 -0
- package/src/structs/JBRulesetMetadata.sol +1 -0
- package/src/structs/JBRulesetWeightCache.sol +1 -0
- package/src/structs/JBRulesetWithMetadata.sol +1 -0
- package/src/structs/JBSingleAllowance.sol +1 -0
- package/src/structs/JBSplit.sol +1 -0
- package/src/structs/JBSplitGroup.sol +1 -0
- package/src/structs/JBSplitHookContext.sol +1 -0
- package/src/structs/JBTerminalConfig.sol +1 -0
- package/src/structs/JBTokenAmount.sol +1 -0
- package/test/ComprehensiveInvariant.t.sol +15 -2
- package/test/CoreExploitTests.t.sol +34 -1
- package/test/EconomicSimulation.t.sol +10 -2
- package/test/EntryPointPermutations.t.sol +17 -3
- package/test/FlashLoanAttacks.t.sol +12 -1
- package/test/PermissionEscalation.t.sol +53 -10
- package/test/RulesetTransitions.t.sol +15 -1
- package/test/SplitLoopTests.t.sol +25 -2
- package/test/TestAccessToFunds.sol +17 -2
- package/test/TestAuditResponseDesignProofs.sol +434 -0
- package/test/TestCashOut.sol +15 -1
- package/test/TestCashOutCountFor.sol +1 -1
- package/test/TestCashOutHooks.sol +47 -25
- package/test/TestCashOutTimingEdge.sol +13 -1
- package/test/TestDataHookFuzzing.sol +520 -0
- package/test/TestDurationUnderflow.sol +13 -1
- package/test/TestFeeFreeCashOutBypass.sol +617 -0
- package/test/TestFeeProcessingFailure.sol +16 -1
- package/test/TestFees.sol +14 -1
- package/test/TestInterfaceSupport.sol +20 -1
- package/test/TestJBERC20Inheritance.sol +11 -1
- package/test/TestL2SequencerPriceFeed.sol +292 -0
- package/test/TestLaunchProject.sol +13 -1
- package/test/TestMetaTx.sol +15 -1
- package/test/TestMetadataOffsetOverflow.sol +179 -0
- package/test/TestMetadataParserLib.sol +37 -4
- package/test/TestMigrationHeldFees.sol +16 -1
- package/test/TestMintTokensOf.sol +14 -1
- package/test/TestMultiTerminalSurplus.sol +348 -0
- package/test/TestMultiTokenSurplus.sol +14 -1
- package/test/TestMultipleAccessLimits.sol +23 -1
- package/test/TestPayBurnRedeemFlow.sol +16 -1
- package/test/TestPayHooks.sol +33 -14
- package/test/TestPermissions.sol +20 -1
- package/test/TestPermissionsEdge.sol +5 -1
- package/test/TestPermit2DataHook.t.sol +360 -0
- package/test/TestPermit2Terminal.sol +36 -3
- package/test/TestRulesetQueueing.sol +23 -1
- package/test/TestRulesetQueuingStress.sol +20 -1
- package/test/TestRulesetWeightCaching.sol +127 -125
- package/test/TestSplits.sol +23 -1
- package/test/TestTerminalMigration.sol +11 -1
- package/test/TestTokenFlow.sol +18 -1
- package/test/TestWeightCacheStaleAfterRejection.sol +15 -1
- package/test/WeirdTokenTests.t.sol +54 -1
- package/test/fork/TestChainlinkPriceFeedFork.sol +6 -1
- package/test/formal/BondingCurveProperties.t.sol +8 -1
- package/test/formal/FeeProperties.t.sol +7 -1
- package/test/helpers/JBTest.sol +1 -1
- package/test/helpers/TestBaseWorkflow.sol +84 -1
- package/test/invariants/Phase3DeepInvariant.t.sol +13 -2
- package/test/invariants/RulesetsInvariant.t.sol +12 -2
- package/test/invariants/TerminalStoreInvariant.t.sol +11 -2
- package/test/invariants/TokensInvariant.t.sol +13 -2
- package/test/invariants/handlers/ComprehensiveHandler.sol +19 -1
- package/test/invariants/handlers/EconomicHandler.sol +31 -1
- package/test/invariants/handlers/Phase3Handler.sol +31 -1
- package/test/invariants/handlers/RulesetsHandler.sol +5 -1
- package/test/invariants/handlers/TerminalStoreHandler.sol +6 -1
- package/test/invariants/handlers/TokensHandler.sol +1 -1
- package/test/mock/MockERC20.sol +0 -2
- package/test/mock/MockMaliciousBeneficiary.sol +2 -1
- package/test/mock/MockMaliciousSplitHook.sol +2 -1
- package/test/mock/MockPriceFeed.sol +1 -1
- package/test/regression/HoldFeesCashOutReserved.t.sol +415 -0
- package/test/regression/WeightCacheBoundary.t.sol +291 -0
- package/test/units/static/JBChainlinkV3PriceFeed/TestPriceFeed.sol +0 -1
- package/test/units/static/JBController/JBControllerSetup.sol +10 -1
- package/test/units/static/JBController/TestBurnTokensOf.sol +8 -1
- package/test/units/static/JBController/TestClaimTokensFor.sol +4 -1
- package/test/units/static/JBController/TestDeployErc20For.sol +7 -1
- package/test/units/static/JBController/TestLaunchProjectFor.sol +21 -1
- package/test/units/static/JBController/TestLaunchRulesetsFor.sol +21 -1
- package/test/units/static/JBController/TestMigrateController.sol +10 -1
- package/test/units/static/JBController/TestMintTokensOfUnits.sol +10 -1
- package/test/units/static/JBController/TestPayReservedTokenToTerminal.sol +4 -1
- package/test/units/static/JBController/TestReceiveMigrationFrom.sol +5 -1
- package/test/units/static/JBController/TestRulesetViews.sol +7 -1
- package/test/units/static/JBController/TestSendReservedTokensToSplitsOf.sol +21 -1
- package/test/units/static/JBController/TestSetSplitGroupsOf.sol +6 -1
- package/test/units/static/JBController/TestSetTokenFor.sol +13 -1
- package/test/units/static/JBController/TestSetUriOf.sol +5 -1
- package/test/units/static/JBController/TestTransferCreditsFrom.sol +11 -1
- package/test/units/static/JBDeadline/TestDeadlineFuzz.sol +12 -1
- package/test/units/static/JBDirectory/JBDirectorySetup.sol +4 -1
- package/test/units/static/JBDirectory/TestPrimaryTerminalOf.sol +5 -1
- package/test/units/static/JBDirectory/TestSetControllerOf.sol +11 -1
- package/test/units/static/JBDirectory/TestSetControllerOfMigrationOrder.sol +7 -1
- package/test/units/static/JBDirectory/TestSetPrimaryTerminalOf.sol +11 -1
- package/test/units/static/JBDirectory/TestSetTerminalsOf.sol +10 -1
- package/test/units/static/JBERC20/JBERC20Setup.sol +2 -1
- package/test/units/static/JBERC20/SigUtils.sol +2 -0
- package/test/units/static/JBERC20/TestInitialize.sol +1 -1
- package/test/units/static/JBERC20/TestName.sol +1 -1
- package/test/units/static/JBERC20/TestNonces.sol +3 -1
- package/test/units/static/JBERC20/TestSymbol.sol +1 -1
- package/test/units/static/JBFeelessAdresses/JBFeelessSetup.sol +2 -1
- package/test/units/static/JBFeelessAdresses/TestInterfaces.sol +2 -1
- package/test/units/static/JBFeelessAdresses/TestSetFeelessAddress.sol +1 -1
- package/test/units/static/JBFees/TestFeesFuzz.sol +1 -1
- package/test/units/static/JBFixedPointNumber/TestAdjustDecimals.sol +0 -1
- package/test/units/static/JBFixedPointNumber/TestAdjustDecimalsFuzz.sol +0 -1
- package/test/units/static/JBFundAccessLimits/JBFundAccessSetup.sol +3 -1
- package/test/units/static/JBFundAccessLimits/TestFundAccessLimitsEdge.sol +4 -1
- package/test/units/static/JBFundAccessLimits/TestPayoutLimitOf.sol +4 -1
- package/test/units/static/JBFundAccessLimits/TestPayoutLimitsOf.sol +8 -1
- package/test/units/static/JBFundAccessLimits/TestSetFundAccessLimitsFor.sol +8 -1
- package/test/units/static/JBFundAccessLimits/TestSurplusAllowanceOf.sol +4 -1
- package/test/units/static/JBFundAccessLimits/TestSurplusAllowancesOf.sol +7 -1
- package/test/units/static/JBMetadataResolver/TestGetDataFor.sol +1 -1
- package/test/units/static/JBMetadataResolver/TestMetadataResolverEdgeCases.sol +2 -1
- package/test/units/static/JBMetadataResolver/TestMetadataResolverFuzz.sol +2 -1
- package/test/units/static/JBMultiTerminal/JBMultiTerminalSetup.sol +12 -1
- package/test/units/static/JBMultiTerminal/TestAccountingContextsOf.sol +9 -1
- package/test/units/static/JBMultiTerminal/TestAddAccountingContextsFor.sol +18 -2
- package/test/units/static/JBMultiTerminal/TestAddToBalanceOf.sol +44 -9
- package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +48 -23
- package/test/units/static/JBMultiTerminal/TestExecutePayout.sol +18 -2
- package/test/units/static/JBMultiTerminal/TestExecuteProcessFee.sol +13 -3
- package/test/units/static/JBMultiTerminal/TestMigrateBalanceOf.sol +21 -4
- package/test/units/static/JBMultiTerminal/TestPay.sol +35 -7
- package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +206 -19
- package/test/units/static/JBMultiTerminal/TestSendPayoutsOf.sol +15 -1
- package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +297 -1
- package/test/units/static/JBPermissions/JBPermissionsSetup.sol +2 -1
- package/test/units/static/JBPermissions/TestHasPermission.sol +1 -1
- package/test/units/static/JBPermissions/TestHasPermissions.sol +1 -1
- package/test/units/static/JBPermissions/TestSetPermissionsFor.sol +3 -1
- package/test/units/static/JBPrices/JBPricesSetup.sol +6 -1
- package/test/units/static/JBPrices/TestAddPriceFeedFor.sol +6 -1
- package/test/units/static/JBPrices/TestPricePerUnitOf.sol +4 -1
- package/test/units/static/JBPrices/TestPrices.sol +4 -1
- package/test/units/static/JBProjects/JBProjectsSetup.sol +2 -1
- package/test/units/static/JBProjects/TestCreateFor.sol +3 -1
- package/test/units/static/JBProjects/TestInitialProject.sol +2 -1
- package/test/units/static/JBProjects/TestInterfaces.sol +0 -1
- package/test/units/static/JBProjects/TestSetResolver.sol +2 -1
- package/test/units/static/JBProjects/TestTokenUri.sol +3 -1
- package/test/units/static/JBRulesetMetadataResolver/TestSetCashOutTaxRateTo.sol +9 -1
- package/test/units/static/JBRulesets/JBRulesetsSetup.sol +3 -1
- package/test/units/static/JBRulesets/TestCurrentApprovalStatusForLatestRulesetOf.sol +9 -1
- package/test/units/static/JBRulesets/TestCurrentOf.sol +10 -1
- package/test/units/static/JBRulesets/TestGetRulesetOf.sol +7 -1
- package/test/units/static/JBRulesets/TestLatestQueuedRulesetOf.sol +9 -1
- package/test/units/static/JBRulesets/TestRulesets.sol +12 -1
- package/test/units/static/JBRulesets/TestRulesetsOf.sol +1 -1
- package/test/units/static/JBRulesets/TestUpcomingRulesetOf.sol +10 -1
- package/test/units/static/JBRulesets/TestUpdateRulesetWeightCache.sol +6 -1
- package/test/units/static/JBSplits/JBSplitsSetup.sol +3 -1
- package/test/units/static/JBSplits/TestSelfManagedSplitGroups.sol +63 -13
- package/test/units/static/JBSplits/TestSetSplitGroupsOf.sol +8 -1
- package/test/units/static/JBSplits/TestSplitsLockedEdge.sol +6 -1
- package/test/units/static/JBSplits/TestSplitsOf.sol +1 -1
- package/test/units/static/JBSplits/TestSplitsPacking.sol +5 -2
- package/test/units/static/JBSurplus/TestSurplusFuzz.sol +3 -1
- package/test/units/static/JBTerminalStore/JBTerminalStoreSetup.sol +5 -1
- package/test/units/static/JBTerminalStore/TestCurrentReclaimableSurplusOf.sol +14 -1
- package/test/units/static/JBTerminalStore/TestCurrentSurplusOf.sol +14 -1
- package/test/units/static/JBTerminalStore/TestCurrentTotalSurplusOf.sol +3 -1
- package/test/units/static/JBTerminalStore/TestRecordCashOutsFor.sol +92 -1
- package/test/units/static/JBTerminalStore/TestRecordPaymentFrom.sol +15 -1
- package/test/units/static/JBTerminalStore/TestRecordPayoutFor.sol +13 -1
- package/test/units/static/JBTerminalStore/TestRecordTerminalMigration.sol +8 -1
- package/test/units/static/JBTerminalStore/TestRecordUsedAllowanceOf.sol +16 -1
- package/test/units/static/JBTerminalStore/TestUint224Overflow.sol +15 -1
- package/test/units/static/JBTokens/JBTokensSetup.sol +5 -1
- package/test/units/static/JBTokens/TestBurnFrom.sol +4 -1
- package/test/units/static/JBTokens/TestClaimTokensFor.sol +4 -1
- package/test/units/static/JBTokens/TestDeployERC20ForUnits.sol +4 -1
- package/test/units/static/JBTokens/TestMintFor.sol +4 -1
- package/test/units/static/JBTokens/TestSetTokenFor.sol +4 -1
- package/test/units/static/JBTokens/TestTotalBalanceOf.sol +1 -1
- package/test/units/static/JBTokens/TestTotalSupplyOf.sol +1 -1
- package/test/units/static/JBTokens/TestTransferCreditsFrom.sol +3 -1
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
|
|
5
|
+
import {JBPermissions} from "../src/JBPermissions.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 {JBCurrencyAmount} from "../src/structs/JBCurrencyAmount.sol";
|
|
10
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
|
|
11
|
+
import {JBPermissionsData} from "../src/structs/JBPermissionsData.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";
|
|
17
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
5
18
|
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
6
19
|
|
|
7
20
|
/// @notice Tests for permission system correctness: ROOT restrictions, wildcard, boundary IDs, escalation prevention.
|
|
@@ -38,6 +51,7 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
38
51
|
jbPermissions()
|
|
39
52
|
.setPermissionsFor(
|
|
40
53
|
projectOwner,
|
|
54
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
41
55
|
JBPermissionsData({operator: alice, projectId: uint64(projectId2), permissionIds: rootPerms})
|
|
42
56
|
);
|
|
43
57
|
}
|
|
@@ -175,13 +189,17 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
175
189
|
JBPermissions.JBPermissions_Unauthorized.selector,
|
|
176
190
|
projectOwner,
|
|
177
191
|
alice,
|
|
192
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
178
193
|
uint64(projectId2),
|
|
179
194
|
JBPermissionIds.ROOT
|
|
180
195
|
)
|
|
181
196
|
);
|
|
182
197
|
jbPermissions()
|
|
183
198
|
.setPermissionsFor(
|
|
184
|
-
|
|
199
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
200
|
+
projectOwner,
|
|
201
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
202
|
+
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: perms})
|
|
185
203
|
);
|
|
186
204
|
}
|
|
187
205
|
|
|
@@ -197,7 +215,10 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
197
215
|
vm.prank(alice);
|
|
198
216
|
jbPermissions()
|
|
199
217
|
.setPermissionsFor(
|
|
200
|
-
|
|
218
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
219
|
+
projectOwner,
|
|
220
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
221
|
+
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: perms})
|
|
201
222
|
);
|
|
202
223
|
|
|
203
224
|
// Verify Bob now has CASH_OUT_TOKENS
|
|
@@ -263,7 +284,10 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
263
284
|
vm.prank(projectOwner);
|
|
264
285
|
jbPermissions()
|
|
265
286
|
.setPermissionsFor(
|
|
266
|
-
|
|
287
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
288
|
+
projectOwner,
|
|
289
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
290
|
+
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: perms})
|
|
267
291
|
);
|
|
268
292
|
|
|
269
293
|
// Verify Bob has it
|
|
@@ -287,6 +311,7 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
287
311
|
jbPermissions()
|
|
288
312
|
.setPermissionsFor(
|
|
289
313
|
projectOwner,
|
|
314
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
290
315
|
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: emptyPerms})
|
|
291
316
|
);
|
|
292
317
|
|
|
@@ -317,7 +342,10 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
317
342
|
vm.prank(projectOwner);
|
|
318
343
|
jbPermissions()
|
|
319
344
|
.setPermissionsFor(
|
|
320
|
-
|
|
345
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
346
|
+
projectOwner,
|
|
347
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
348
|
+
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: perms})
|
|
321
349
|
);
|
|
322
350
|
|
|
323
351
|
bool hasPerm = jbPermissions()
|
|
@@ -357,7 +385,10 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
357
385
|
vm.expectRevert(abi.encodeWithSelector(JBPermissions.JBPermissions_NoZeroPermission.selector));
|
|
358
386
|
jbPermissions()
|
|
359
387
|
.setPermissionsFor(
|
|
360
|
-
|
|
388
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
389
|
+
projectOwner,
|
|
390
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
391
|
+
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: perms})
|
|
361
392
|
);
|
|
362
393
|
}
|
|
363
394
|
|
|
@@ -468,7 +499,10 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
468
499
|
vm.prank(projectOwner);
|
|
469
500
|
jbPermissions()
|
|
470
501
|
.setPermissionsFor(
|
|
471
|
-
|
|
502
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
503
|
+
projectOwner,
|
|
504
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
505
|
+
JBPermissionsData({operator: bob, projectId: uint64(pid), permissionIds: perms})
|
|
472
506
|
);
|
|
473
507
|
|
|
474
508
|
// Charlie (no permission) tries to send payouts — should fail because ownerMustSendPayouts
|
|
@@ -539,7 +573,10 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
539
573
|
vm.prank(projectOwner);
|
|
540
574
|
jbPermissions()
|
|
541
575
|
.setPermissionsFor(
|
|
542
|
-
|
|
576
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
577
|
+
projectOwner,
|
|
578
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
579
|
+
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: perms1})
|
|
543
580
|
);
|
|
544
581
|
|
|
545
582
|
assertTrue(
|
|
@@ -574,7 +611,10 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
574
611
|
vm.prank(projectOwner);
|
|
575
612
|
jbPermissions()
|
|
576
613
|
.setPermissionsFor(
|
|
577
|
-
|
|
614
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
615
|
+
projectOwner,
|
|
616
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
617
|
+
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: perms2})
|
|
578
618
|
);
|
|
579
619
|
|
|
580
620
|
// Bob should only have MINT_TOKENS, not the previous ones
|
|
@@ -628,7 +668,10 @@ contract PermissionEscalation_Local is TestBaseWorkflow {
|
|
|
628
668
|
vm.prank(projectOwner);
|
|
629
669
|
jbPermissions()
|
|
630
670
|
.setPermissionsFor(
|
|
631
|
-
|
|
671
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
672
|
+
projectOwner,
|
|
673
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
674
|
+
JBPermissionsData({operator: bob, projectId: uint64(projectId2), permissionIds: perms})
|
|
632
675
|
);
|
|
633
676
|
|
|
634
677
|
// Call from trusted forwarder with Bob appended as sender
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
|
|
5
|
+
import {JBApprovalStatus} from "../src/enums/JBApprovalStatus.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 {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 {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
|
|
15
|
+
import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
|
|
5
16
|
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
6
17
|
import {ERC165, IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
7
18
|
|
|
@@ -255,6 +266,7 @@ contract RulesetTransitions_Local is TestBaseWorkflow {
|
|
|
255
266
|
uint256[] memory tokensPerCycle = new uint256[](10);
|
|
256
267
|
for (uint256 i = 0; i < 10; i++) {
|
|
257
268
|
if (i > 0) vm.warp(block.timestamp + 1 days + 1);
|
|
269
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
258
270
|
tokensPerCycle[i] = _payProject(pid, address(uint160(0x6000 + i)), 1 ether);
|
|
259
271
|
}
|
|
260
272
|
|
|
@@ -660,6 +672,7 @@ contract RulesetTransitions_Local is TestBaseWorkflow {
|
|
|
660
672
|
|
|
661
673
|
/// @notice Approval hook that approves after a configurable delay.
|
|
662
674
|
contract DelayedApprovalHook is ERC165, IJBRulesetApprovalHook {
|
|
675
|
+
// forge-lint: disable-next-line(screaming-snake-case-immutable)
|
|
663
676
|
uint256 public immutable approvalDelay;
|
|
664
677
|
|
|
665
678
|
constructor(uint256 _approvalDelay) {
|
|
@@ -685,6 +698,7 @@ contract DelayedApprovalHook is ERC165, IJBRulesetApprovalHook {
|
|
|
685
698
|
|
|
686
699
|
/// @notice Approval hook that always rejects.
|
|
687
700
|
contract AlwaysRejectingHook is ERC165, IJBRulesetApprovalHook {
|
|
701
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
688
702
|
function DURATION() external pure override returns (uint256) {
|
|
689
703
|
return 0;
|
|
690
704
|
}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
|
|
5
|
+
import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBSplitHook} from "../src/interfaces/IJBSplitHook.sol";
|
|
8
|
+
import {IJBTokens} from "../src/interfaces/IJBTokens.sol";
|
|
9
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
10
|
+
import {JBRulesetMetadataResolver} from "../src/libraries/JBRulesetMetadataResolver.sol";
|
|
11
|
+
import {JBCurrencyAmount} from "../src/structs/JBCurrencyAmount.sol";
|
|
12
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
|
|
13
|
+
import {JBRuleset} from "../src/structs/JBRuleset.sol";
|
|
14
|
+
import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
|
|
15
|
+
import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
|
|
16
|
+
import {JBSplit} from "../src/structs/JBSplit.sol";
|
|
17
|
+
import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
|
|
18
|
+
import {JBSplitHookContext} from "../src/structs/JBSplitHookContext.sol";
|
|
19
|
+
import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
|
|
5
20
|
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
6
21
|
import {ERC165, IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
7
22
|
|
|
@@ -120,7 +135,8 @@ contract SplitLoopTests_Local is TestBaseWorkflow {
|
|
|
120
135
|
|
|
121
136
|
JBCurrencyAmount[] memory payoutLimits = new JBCurrencyAmount[](1);
|
|
122
137
|
payoutLimits[0] =
|
|
123
|
-
|
|
138
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
139
|
+
JBCurrencyAmount({amount: uint224(payoutLimit), currency: uint32(uint160(JBConstants.NATIVE_TOKEN))});
|
|
124
140
|
JBFundAccessLimitGroup[] memory fundAccessLimitGroups = new JBFundAccessLimitGroup[](1);
|
|
125
141
|
fundAccessLimitGroups[0] = JBFundAccessLimitGroup({
|
|
126
142
|
terminal: address(jbMultiTerminal()),
|
|
@@ -186,12 +202,14 @@ contract SplitLoopTests_Local is TestBaseWorkflow {
|
|
|
186
202
|
projectA = _launchProjectWithSplitsAndPayoutLimit(dummySplits, 10 ether);
|
|
187
203
|
|
|
188
204
|
// Now create B with split to A
|
|
205
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
189
206
|
splitsB[0].projectId = uint64(projectA);
|
|
190
207
|
projectB = _launchProjectWithSplitsAndPayoutLimit(splitsB, 10 ether);
|
|
191
208
|
|
|
192
209
|
// Update A's splits to point to B
|
|
193
210
|
(JBRuleset memory rulesetA,) = jbController().currentRulesetOf(projectA);
|
|
194
211
|
JBSplitGroup[] memory newSplitGroupsA = new JBSplitGroup[](1);
|
|
212
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
195
213
|
splitsA[0].projectId = uint64(projectB);
|
|
196
214
|
newSplitGroupsA[0] = JBSplitGroup({groupId: uint256(uint160(JBConstants.NATIVE_TOKEN)), splits: splitsA});
|
|
197
215
|
vm.prank(projectOwner);
|
|
@@ -372,6 +390,7 @@ contract SplitLoopTests_Local is TestBaseWorkflow {
|
|
|
372
390
|
uint256 pid = _launchProjectWithSplitsAndPayoutLimit(new JBSplit[](0), 10 ether);
|
|
373
391
|
|
|
374
392
|
// Update splits to point to self
|
|
393
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
375
394
|
splits[0].projectId = uint64(pid);
|
|
376
395
|
(JBRuleset memory ruleset,) = jbController().currentRulesetOf(pid);
|
|
377
396
|
JBSplitGroup[] memory newSplitGroups = new JBSplitGroup[](1);
|
|
@@ -404,12 +423,14 @@ contract SplitLoopTests_Local is TestBaseWorkflow {
|
|
|
404
423
|
uint256 numSplits = 200;
|
|
405
424
|
JBSplit[] memory splits = new JBSplit[](numSplits);
|
|
406
425
|
|
|
426
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
407
427
|
uint32 perSplitPercent = uint32(JBConstants.SPLITS_TOTAL_PERCENT / numSplits);
|
|
408
428
|
|
|
409
429
|
for (uint256 i = 0; i < numSplits; i++) {
|
|
410
430
|
splits[i] = JBSplit({
|
|
411
431
|
percent: perSplitPercent,
|
|
412
432
|
projectId: 0,
|
|
433
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
413
434
|
beneficiary: payable(address(uint160(0x3000 + i))),
|
|
414
435
|
preferAddToBalance: false,
|
|
415
436
|
lockedUntil: 0,
|
|
@@ -452,6 +473,7 @@ contract SplitLoopTests_Local is TestBaseWorkflow {
|
|
|
452
473
|
splits[i] = JBSplit({
|
|
453
474
|
percent: oneThird,
|
|
454
475
|
projectId: 0,
|
|
476
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
455
477
|
beneficiary: payable(address(uint160(0x4000 + i))),
|
|
456
478
|
preferAddToBalance: false,
|
|
457
479
|
lockedUntil: 0,
|
|
@@ -476,6 +498,7 @@ contract SplitLoopTests_Local is TestBaseWorkflow {
|
|
|
476
498
|
// Check no rounding loss greater than 3 wei (one per split)
|
|
477
499
|
uint256 totalPaidToSplits = 0;
|
|
478
500
|
for (uint256 i = 0; i < 3; i++) {
|
|
501
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
479
502
|
totalPaidToSplits += address(uint160(0x4000 + i)).balance;
|
|
480
503
|
}
|
|
481
504
|
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity >=0.8.6;
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import "
|
|
4
|
+
import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
|
|
5
|
+
import {MockERC20} from "./mock/MockERC20.sol";
|
|
6
|
+
import {JBTerminalStore} from "../src/JBTerminalStore.sol";
|
|
7
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
8
|
+
import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.sol";
|
|
9
|
+
import {IJBPrices} from "../src/interfaces/IJBPrices.sol";
|
|
10
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
11
|
+
import {IJBTokens} from "../src/interfaces/IJBTokens.sol";
|
|
12
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
13
|
+
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
14
|
+
import {JBCurrencyAmount} from "../src/structs/JBCurrencyAmount.sol";
|
|
15
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
|
|
16
|
+
import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
|
|
17
|
+
import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
|
|
18
|
+
import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
|
|
19
|
+
import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
|
|
20
|
+
import {mulDiv} from "@prb/math/src/Common.sol";
|
|
6
21
|
import {MockPriceFeed} from "./mock/MockPriceFeed.sol";
|
|
7
22
|
import {MaliciousAllowanceBeneficiary, MaliciousPayoutBeneficiary} from "./mock/MockMaliciousBeneficiary.sol";
|
|
8
23
|
|