@bananapus/core-v6 0.0.14 → 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 +150 -43
- package/foundry.toml +3 -3
- package/package.json +4 -4
- package/remappings.txt +1 -1
- package/script/Deploy.s.sol +23 -16
- package/script/DeployPeriphery.s.sol +71 -66
- package/script/helpers/CoreDeploymentLib.sol +84 -37
- package/src/JBChainlinkV3PriceFeed.sol +1 -0
- package/src/JBController.sol +19 -4
- 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 -1
- package/src/interfaces/IJBPayoutTerminal.sol +0 -1
- 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 -5
- package/test/{AuditExploits.t.sol → CoreExploitTests.t.sol} +35 -4
- package/test/EconomicSimulation.t.sol +10 -2
- package/test/EntryPointPermutations.t.sol +18 -5
- package/test/FlashLoanAttacks.t.sol +12 -2
- package/test/PermissionEscalation.t.sol +54 -22
- package/test/RulesetTransitions.t.sol +15 -1
- package/test/SplitLoopTests.t.sol +26 -5
- package/test/TestAccessToFunds.sol +17 -2
- package/test/TestCashOut.sol +15 -2
- package/test/TestCashOutCountFor.sol +1 -2
- package/test/TestCashOutHooks.sol +47 -25
- package/test/TestCashOutTimingEdge.sol +13 -1
- package/test/TestDurationUnderflow.sol +13 -1
- package/test/TestFeeProcessingFailure.sol +17 -7
- 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 +17 -11
- 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 +28 -2
- package/test/TestRulesetWeightCaching.sol +5 -2
- 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 +18 -2
- package/test/fork/TestChainlinkPriceFeedFork.sol +254 -0
- package/test/formal/BondingCurveProperties.t.sol +8 -2
- package/test/formal/FeeProperties.t.sol +7 -1
- package/test/helpers/JBTest.sol +7 -7
- package/test/helpers/TestBaseWorkflow.sol +84 -1
- package/test/invariants/Phase3DeepInvariant.t.sol +13 -5
- 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 -2
- package/test/invariants/handlers/RulesetsHandler.sol +5 -1
- package/test/invariants/handlers/TerminalStoreHandler.sol +6 -1
- package/test/invariants/handlers/TokensHandler.sol +1 -2
- package/test/mock/ERC2771ForwarderMock.sol +1 -1
- package/test/mock/MockERC20.sol +1 -3
- package/test/mock/MockMaliciousBeneficiary.sol +2 -2
- 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 +15 -4
- 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/{TestMetadataResolverM20M21.sol → TestMetadataResolverEdgeCases.sol} +6 -5
- 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 -2
- 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 +4 -2
- 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,28 @@
|
|
|
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 {IJBCashOutHook} from "../src/interfaces/IJBCashOutHook.sol";
|
|
6
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
7
|
+
import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.sol";
|
|
8
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
9
|
+
import {IJBRulesetDataHook} from "../src/interfaces/IJBRulesetDataHook.sol";
|
|
10
|
+
import {IJBToken} from "../src/interfaces/IJBToken.sol";
|
|
11
|
+
import {IJBTokens} from "../src/interfaces/IJBTokens.sol";
|
|
12
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
13
|
+
import {JBRulesetMetadataResolver} from "../src/libraries/JBRulesetMetadataResolver.sol";
|
|
14
|
+
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
15
|
+
import {JBAfterCashOutRecordedContext} from "../src/structs/JBAfterCashOutRecordedContext.sol";
|
|
16
|
+
import {JBCashOutHookSpecification} from "../src/structs/JBCashOutHookSpecification.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 {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
|
|
22
|
+
import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
|
|
23
|
+
import {JBTokenAmount} from "../src/structs/JBTokenAmount.sol";
|
|
24
|
+
import {mulDiv} from "@prb/math/src/Common.sol";
|
|
25
|
+
import {mul as UD60x18mul, unwrap as UD60x18unwrap, wrap as UD60x18wrap} from "@prb/math/src/UD60x18.sol";
|
|
5
26
|
|
|
6
27
|
contract TestCashOutHooks_Local is TestBaseWorkflow {
|
|
7
28
|
using JBRulesetMetadataResolver for JBRuleset;
|
|
@@ -149,18 +170,18 @@ contract TestCashOutHooks_Local is TestBaseWorkflow {
|
|
|
149
170
|
projectId: _projectId,
|
|
150
171
|
rulesetId: _ruleset.id,
|
|
151
172
|
cashOutCount: _beneficiaryTokenBalance / 2,
|
|
152
|
-
reclaimedAmount: JBTokenAmount(
|
|
153
|
-
JBConstants.NATIVE_TOKEN,
|
|
154
|
-
_terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
|
|
155
|
-
_terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
|
|
156
|
-
_halfPaid
|
|
157
|
-
),
|
|
158
|
-
forwardedAmount: JBTokenAmount(
|
|
159
|
-
JBConstants.NATIVE_TOKEN,
|
|
160
|
-
_terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
|
|
161
|
-
_terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
|
|
162
|
-
_halfPaid
|
|
163
|
-
),
|
|
173
|
+
reclaimedAmount: JBTokenAmount({
|
|
174
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
175
|
+
decimals: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
|
|
176
|
+
currency: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
|
|
177
|
+
value: _halfPaid
|
|
178
|
+
}),
|
|
179
|
+
forwardedAmount: JBTokenAmount({
|
|
180
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
181
|
+
decimals: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
|
|
182
|
+
currency: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
|
|
183
|
+
value: _halfPaid
|
|
184
|
+
}),
|
|
164
185
|
cashOutTaxRate: 0,
|
|
165
186
|
beneficiary: payable(address(this)),
|
|
166
187
|
hookMetadata: "",
|
|
@@ -263,18 +284,19 @@ contract TestCashOutHooks_Local is TestBaseWorkflow {
|
|
|
263
284
|
projectId: _projectId,
|
|
264
285
|
rulesetId: _ruleset.id,
|
|
265
286
|
cashOutCount: _beneficiaryTokenBalance / 2,
|
|
266
|
-
reclaimedAmount: JBTokenAmount(
|
|
267
|
-
JBConstants.NATIVE_TOKEN,
|
|
268
|
-
_terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
|
|
269
|
-
_terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
|
|
270
|
-
_beneficiaryAmount
|
|
271
|
-
),
|
|
272
|
-
forwardedAmount: JBTokenAmount(
|
|
273
|
-
JBConstants.NATIVE_TOKEN,
|
|
274
|
-
_terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
|
|
275
|
-
_terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
|
|
276
|
-
_forwardedAmount
|
|
277
|
-
),
|
|
287
|
+
reclaimedAmount: JBTokenAmount({
|
|
288
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
289
|
+
decimals: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
|
|
290
|
+
currency: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
|
|
291
|
+
value: _beneficiaryAmount
|
|
292
|
+
}),
|
|
293
|
+
forwardedAmount: JBTokenAmount({
|
|
294
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
295
|
+
decimals: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
|
|
296
|
+
currency: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
|
|
297
|
+
value: _forwardedAmount
|
|
298
|
+
}),
|
|
299
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
278
300
|
cashOutTaxRate: uint16(_customCashOutTaxRate),
|
|
279
301
|
beneficiary: payable(address(this)),
|
|
280
302
|
hookMetadata: "",
|
|
@@ -1,7 +1,19 @@
|
|
|
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 {JBTerminalStore} from "../src/JBTerminalStore.sol";
|
|
6
|
+
import {JBTokens} from "../src/JBTokens.sol";
|
|
7
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
8
|
+
import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.sol";
|
|
9
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
10
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
11
|
+
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
12
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.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";
|
|
5
17
|
import {JBCashOuts} from "../src/libraries/JBCashOuts.sol";
|
|
6
18
|
|
|
7
19
|
/// @notice Edge case tests for cross-ruleset cash outs and pending reserves inflation.
|
|
@@ -1,13 +1,25 @@
|
|
|
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 {JBRulesets} from "../src/JBRulesets.sol";
|
|
6
|
+
import {IJBDirectory} from "../src/interfaces/IJBDirectory.sol";
|
|
7
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
8
|
+
import {JBConstants} from "../src/libraries/JBConstants.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";
|
|
5
16
|
|
|
6
17
|
/// @notice Harness that exposes the internal `_simulateCycledRulesetBasedOn` for direct testing.
|
|
7
18
|
contract JBRulesetsHarness is JBRulesets {
|
|
8
19
|
constructor(IJBDirectory directory) JBRulesets(directory) {}
|
|
9
20
|
|
|
10
21
|
/// @notice Public wrapper for the internal function under test.
|
|
22
|
+
// forge-lint: disable-next-line(mixed-case-function)
|
|
11
23
|
function exposed_simulateCycledRulesetBasedOn(
|
|
12
24
|
uint256 projectId,
|
|
13
25
|
JBRuleset memory baseRuleset,
|
|
@@ -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 {JBMultiTerminal} from "../src/JBMultiTerminal.sol";
|
|
6
|
+
import {JBTerminalStore} from "../src/JBTerminalStore.sol";
|
|
7
|
+
import {JBTokens} from "../src/JBTokens.sol";
|
|
8
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
9
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
10
|
+
import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
|
|
11
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
12
|
+
import {JBFees} from "../src/libraries/JBFees.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";
|
|
5
20
|
|
|
6
21
|
/// @notice Tests for the fee processing try-catch path in JBMultiTerminal.
|
|
7
22
|
/// Proves that when fee payment reverts, the fee amount is credited back to
|
|
@@ -153,9 +168,6 @@ contract TestFeeProcessingFailure_Local is TestBaseWorkflow {
|
|
|
153
168
|
// For this test, verify the FeeReverted event is emitted when fee processing fails.
|
|
154
169
|
// We'll manipulate the directory to return address(0) for fee project's terminal.
|
|
155
170
|
|
|
156
|
-
// Record balance before payout.
|
|
157
|
-
uint256 projectBalanceBefore = _store.balanceOf(address(_terminal), _projectId, JBConstants.NATIVE_TOKEN);
|
|
158
|
-
|
|
159
171
|
// The fee is taken during sendPayoutsOf. Under normal conditions, it goes to project #1.
|
|
160
172
|
// The _processFee try-catch handles failures gracefully.
|
|
161
173
|
// We verify that the normal path works (fee is deducted from payout and sent to fee project).
|
|
@@ -168,8 +180,6 @@ contract TestFeeProcessingFailure_Local is TestBaseWorkflow {
|
|
|
168
180
|
minTokensPaidOut: 0
|
|
169
181
|
});
|
|
170
182
|
|
|
171
|
-
uint256 projectBalanceAfter = _store.balanceOf(address(_terminal), _projectId, JBConstants.NATIVE_TOKEN);
|
|
172
|
-
|
|
173
183
|
// Fee was deducted from the payout — project balance is now only the surplus (if any).
|
|
174
184
|
// The fee was 2.5% of the payout amount.
|
|
175
185
|
uint256 feeAmount = JBFees.feeAmountFrom({amountBeforeFee: PAY_AMOUNT, feePercent: _terminal.FEE()});
|
|
@@ -178,7 +188,7 @@ contract TestFeeProcessingFailure_Local is TestBaseWorkflow {
|
|
|
178
188
|
|
|
179
189
|
/// @notice Held fee processing: when fee payment reverts, the FeeReverted event is emitted
|
|
180
190
|
/// and the fee amount is credited back to the project balance via _recordAddedBalanceFor.
|
|
181
|
-
function test_heldFeeProcessing_revert_refundsToProject() external {
|
|
191
|
+
function test_heldFeeProcessing_revert_refundsToProject() external view {
|
|
182
192
|
// This test requires holdFees=true ruleset — we test the principle:
|
|
183
193
|
// When _processFee's try block reverts, the catch block calls _recordAddedBalanceFor.
|
|
184
194
|
// This returns the fee amount to the project's terminal store balance.
|
package/test/TestFees.sol
CHANGED
|
@@ -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 {IJBController} from "../src/interfaces/IJBController.sol";
|
|
6
|
+
import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.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 {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
11
|
+
import {JBCurrencyAmount} from "../src/structs/JBCurrencyAmount.sol";
|
|
12
|
+
import {JBFee} from "../src/structs/JBFee.sol";
|
|
13
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
|
|
14
|
+
import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
|
|
15
|
+
import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
|
|
16
|
+
import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
|
|
17
|
+
import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
|
|
5
18
|
|
|
6
19
|
// Projects can be launched.
|
|
7
20
|
contract TestFees_Local is TestBaseWorkflow {
|
|
@@ -1,10 +1,29 @@
|
|
|
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 {JBController} from "../src/JBController.sol";
|
|
6
|
+
import {JBDeadline} from "../src/JBDeadline.sol";
|
|
7
|
+
import {JBMultiTerminal} from "../src/JBMultiTerminal.sol";
|
|
8
|
+
import {JBProjects} from "../src/JBProjects.sol";
|
|
9
|
+
import {IJBCashOutTerminal} from "../src/interfaces/IJBCashOutTerminal.sol";
|
|
10
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
11
|
+
import {IJBFeeTerminal} from "../src/interfaces/IJBFeeTerminal.sol";
|
|
12
|
+
import {IJBMigratable} from "../src/interfaces/IJBMigratable.sol";
|
|
13
|
+
import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.sol";
|
|
14
|
+
import {IJBPayoutTerminal} from "../src/interfaces/IJBPayoutTerminal.sol";
|
|
15
|
+
import {IJBPermissioned} from "../src/interfaces/IJBPermissioned.sol";
|
|
16
|
+
import {IJBPermitTerminal} from "../src/interfaces/IJBPermitTerminal.sol";
|
|
17
|
+
import {IJBProjects} from "../src/interfaces/IJBProjects.sol";
|
|
18
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
19
|
+
import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
|
|
20
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
21
|
+
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
|
|
22
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
23
|
|
|
6
24
|
/// Contracts are introspective about the interfaces they adhere to.
|
|
7
25
|
contract TestEIP165_Local is TestBaseWorkflow {
|
|
26
|
+
// forge-lint: disable-next-line(screaming-snake-case-const)
|
|
8
27
|
bytes4 private constant _notSupportedInterface = 0xffffffff;
|
|
9
28
|
|
|
10
29
|
function testJBController() public view {
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
|
|
5
|
+
import {JBERC20} from "../src/JBERC20.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 {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
10
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.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";
|
|
5
15
|
|
|
6
16
|
import {ERC20Votes} from "../src/JBERC20.sol";
|
|
7
17
|
|
|
@@ -1,7 +1,19 @@
|
|
|
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 {IJBController} from "../src/interfaces/IJBController.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 {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";
|
|
5
17
|
|
|
6
18
|
// Projects can be launched.
|
|
7
19
|
contract TestLaunchProject_Local is TestBaseWorkflow {
|
package/test/TestMetaTx.sol
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
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 {JBTokens} from "../src/JBTokens.sol";
|
|
6
|
+
import {IJBCashOutTerminal} from "../src/interfaces/IJBCashOutTerminal.sol";
|
|
7
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
8
|
+
import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.sol";
|
|
9
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
10
|
+
import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
|
|
11
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
12
|
+
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
13
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
|
|
14
|
+
import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
|
|
15
|
+
import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
|
|
16
|
+
import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
|
|
17
|
+
import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
|
|
18
|
+
import {mul as UD60x18mul, unwrap as UD60x18unwrap, wrap as UD60x18wrap} from "@prb/math/src/UD60x18.sol";
|
|
5
19
|
import {ERC2771Forwarder} from "@openzeppelin/contracts/metatx/ERC2771Forwarder.sol";
|
|
6
20
|
import {ERC2771ForwarderMock, ForwardRequest} from "./mock/ERC2771ForwarderMock.sol";
|
|
7
21
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
|
+
import {MetadataResolverHelper} from "./helpers/MetadataResolverHelper.sol";
|
|
6
|
+
import {JBMetadataResolver} from "../src/libraries/JBMetadataResolver.sol";
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* @notice Test the `JBDelegateMetadata` library and helper contract.
|
|
@@ -62,9 +64,15 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
62
64
|
bytes[] memory _datas = new bytes[](10);
|
|
63
65
|
|
|
64
66
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
67
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
65
68
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
66
69
|
_datas[_i] = abi.encode(
|
|
67
|
-
|
|
70
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
71
|
+
bytes1(uint8(_i + 1)),
|
|
72
|
+
uint32(69),
|
|
73
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
74
|
+
bytes2(uint16(_i + 69)),
|
|
75
|
+
bytes32(uint256(type(uint256).max))
|
|
68
76
|
);
|
|
69
77
|
}
|
|
70
78
|
|
|
@@ -95,6 +103,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
95
103
|
bytes[] memory _datas = new bytes[](_numberOfIds);
|
|
96
104
|
|
|
97
105
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
106
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
98
107
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
99
108
|
_datas[_i] = abi.encode(type(uint256).max - _i);
|
|
100
109
|
}
|
|
@@ -122,7 +131,9 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
122
131
|
bytes[] memory _datas = new bytes[](_numberOfIds);
|
|
123
132
|
|
|
124
133
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
134
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
125
135
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
136
|
+
// forge-lint: disable-next-line(incorrect-shift)
|
|
126
137
|
_datas[_i] = abi.encode(69 << _i * 20);
|
|
127
138
|
}
|
|
128
139
|
|
|
@@ -133,6 +144,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
133
144
|
uint256 _data = abi.decode(_dataParsed, (uint256));
|
|
134
145
|
|
|
135
146
|
assertTrue(_found);
|
|
147
|
+
// forge-lint: disable-next-line(incorrect-shift)
|
|
136
148
|
assertEq(_data, 69 << _i * 20);
|
|
137
149
|
}
|
|
138
150
|
}
|
|
@@ -148,6 +160,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
148
160
|
bytes[] memory _datas = new bytes[](_numberOfIds);
|
|
149
161
|
|
|
150
162
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
163
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
151
164
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
152
165
|
_datas[_i] = abi.encode(type(uint256).max - _i);
|
|
153
166
|
}
|
|
@@ -166,6 +179,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
166
179
|
bytes[] memory _datas = new bytes[](_numberOfIds);
|
|
167
180
|
|
|
168
181
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
182
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
169
183
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
170
184
|
_datas[_i] = abi.encode(type(uint256).max - _i);
|
|
171
185
|
}
|
|
@@ -199,9 +213,15 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
199
213
|
bytes[] memory _datas = new bytes[](2);
|
|
200
214
|
|
|
201
215
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
216
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
202
217
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
203
218
|
_datas[_i] = abi.encode(
|
|
204
|
-
|
|
219
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
220
|
+
bytes1(uint8(_i + 1)),
|
|
221
|
+
uint32(69),
|
|
222
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
223
|
+
bytes2(uint16(_i + 69)),
|
|
224
|
+
bytes32(uint256(type(uint256).max))
|
|
205
225
|
);
|
|
206
226
|
}
|
|
207
227
|
|
|
@@ -210,6 +230,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
210
230
|
bytes memory _modifiedMetadata = parser.addDataToMetadata(
|
|
211
231
|
_metadata,
|
|
212
232
|
bytes4(uint32(type(uint32).max)),
|
|
233
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
213
234
|
abi.encode(bytes32(uint256(type(uint256).max)), bytes32(hex"123456"))
|
|
214
235
|
);
|
|
215
236
|
|
|
@@ -218,6 +239,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
218
239
|
|
|
219
240
|
assertTrue(_found);
|
|
220
241
|
assertEq(bytes32(uint256(type(uint256).max)), _a);
|
|
242
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
221
243
|
assertEq(bytes32(hex"123456"), _b);
|
|
222
244
|
|
|
223
245
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
@@ -243,6 +265,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
243
265
|
bytes[] memory _datas = new bytes[](_numberOfIds);
|
|
244
266
|
|
|
245
267
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
268
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
246
269
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
247
270
|
_datas[_i] = abi.encode(_i * 4);
|
|
248
271
|
}
|
|
@@ -304,6 +327,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
304
327
|
assertEq(_a, uint32(69));
|
|
305
328
|
assertEq(_b, bytes32(uint256(type(uint256).max)));
|
|
306
329
|
|
|
330
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
307
331
|
assertEq(uint256(bytes32(_modifiedMetadata)), _reserved);
|
|
308
332
|
}
|
|
309
333
|
|
|
@@ -339,6 +363,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
339
363
|
bytes[] memory _datas = new bytes[](_numberOfIds);
|
|
340
364
|
|
|
341
365
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
366
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
342
367
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
343
368
|
_datas[_i] = abi.encode(_i * 4);
|
|
344
369
|
}
|
|
@@ -383,6 +408,7 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
383
408
|
bytes[] memory _datas = new bytes[](_numberOfMetadatas);
|
|
384
409
|
|
|
385
410
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
411
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
386
412
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
387
413
|
}
|
|
388
414
|
|
|
@@ -420,10 +446,17 @@ contract JBDelegateMetadataLib_Test_Local is Test {
|
|
|
420
446
|
bytes[] memory _datas = new bytes[](10);
|
|
421
447
|
|
|
422
448
|
for (uint256 _i; _i < _ids.length; _i++) {
|
|
449
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
423
450
|
_ids[_i] = bytes4(uint32(_i + 1 * 1000));
|
|
424
451
|
|
|
452
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
425
453
|
_datas[_i] = abi.encodePacked(
|
|
426
|
-
|
|
454
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
455
|
+
bytes1(uint8(_i + 1)),
|
|
456
|
+
uint32(69),
|
|
457
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
458
|
+
bytes2(uint16(_i + 69)),
|
|
459
|
+
bytes32(uint256(type(uint256).max))
|
|
427
460
|
);
|
|
428
461
|
}
|
|
429
462
|
|
|
@@ -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 {JBMultiTerminal} from "../src/JBMultiTerminal.sol";
|
|
6
|
+
import {JBTerminalStore} from "../src/JBTerminalStore.sol";
|
|
7
|
+
import {JBTokens} from "../src/JBTokens.sol";
|
|
8
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
9
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
10
|
+
import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
|
|
11
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
12
|
+
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
13
|
+
import {JBCurrencyAmount} from "../src/structs/JBCurrencyAmount.sol";
|
|
14
|
+
import {JBFee} from "../src/structs/JBFee.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";
|
|
5
20
|
|
|
6
21
|
/// @notice Confirms held fees are stranded when a terminal migrates.
|
|
7
22
|
/// The migration calls addToBalanceOf with shouldReturnHeldFees: false,
|
|
@@ -144,11 +159,8 @@ contract TestMigrationHeldFees_Local is TestBaseWorkflow {
|
|
|
144
159
|
assertGt(heldFees.length, 0, "Should have held fees after payout");
|
|
145
160
|
|
|
146
161
|
// Step 3: Migrate balance to terminal2.
|
|
147
|
-
uint256 balanceBefore = _store.balanceOf(address(_terminal), _projectId, JBConstants.NATIVE_TOKEN);
|
|
148
|
-
|
|
149
162
|
vm.prank(_projectOwner);
|
|
150
|
-
|
|
151
|
-
_terminal.migrateBalanceOf(_projectId, JBConstants.NATIVE_TOKEN, IJBTerminal(address(_terminal2)));
|
|
163
|
+
_terminal.migrateBalanceOf(_projectId, JBConstants.NATIVE_TOKEN, IJBTerminal(address(_terminal2)));
|
|
152
164
|
|
|
153
165
|
// Step 4: Verify old terminal has no balance but still has held fees.
|
|
154
166
|
uint256 balanceAfter = _store.balanceOf(address(_terminal), _projectId, JBConstants.NATIVE_TOKEN);
|
|
@@ -231,16 +243,10 @@ contract TestMigrationHeldFees_Local is TestBaseWorkflow {
|
|
|
231
243
|
// Warp past holding period.
|
|
232
244
|
vm.warp(block.timestamp + 28 days + 1);
|
|
233
245
|
|
|
234
|
-
// Fee project balance before attempting to process.
|
|
235
|
-
uint256 feeBalanceBefore = _store.balanceOf(address(_terminal), 1, JBConstants.NATIVE_TOKEN);
|
|
236
|
-
|
|
237
246
|
// Try to process held fees — the fees still exist but the old terminal has no ETH.
|
|
238
247
|
// The _processFee try-catch will catch the revert and credit the fee amount back to the project.
|
|
239
248
|
_terminal.processHeldFeesOf(_projectId, JBConstants.NATIVE_TOKEN, 100);
|
|
240
249
|
|
|
241
|
-
// Fee project should NOT have received fees (old terminal had no ETH to transfer).
|
|
242
|
-
uint256 feeBalanceAfter = _store.balanceOf(address(_terminal), 1, JBConstants.NATIVE_TOKEN);
|
|
243
|
-
|
|
244
250
|
// The fee processing attempted but the terminal has no actual ETH.
|
|
245
251
|
// The _recordAddedBalanceFor in the catch block inflates the store balance
|
|
246
252
|
// without actual funds — this is a phantom balance.
|
|
@@ -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 {IJBController} from "../src/interfaces/IJBController.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBRulesetDataHook} from "../src/interfaces/IJBRulesetDataHook.sol";
|
|
8
|
+
import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
|
|
9
|
+
import {IJBTokens} from "../src/interfaces/IJBTokens.sol";
|
|
10
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
11
|
+
import {JBAccountingContext} from "../src/structs/JBAccountingContext.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 {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
|
|
17
|
+
import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
|
|
5
18
|
|
|
6
19
|
contract TestMintTokensOf_Local is TestBaseWorkflow {
|
|
7
20
|
uint8 private constant _WEIGHT_DECIMALS = 18;
|
|
@@ -1,7 +1,17 @@
|
|
|
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 {JBMultiTerminal} from "../src/JBMultiTerminal.sol";
|
|
6
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
7
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
8
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
10
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.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";
|
|
5
15
|
import {MockPriceFeed} from "./mock/MockPriceFeed.sol";
|
|
6
16
|
import {MockERC20} from "./mock/MockERC20.sol";
|
|
7
17
|
|
|
@@ -117,6 +127,7 @@ contract TestMultiTokenSurplus_Local is TestBaseWorkflow {
|
|
|
117
127
|
vm.prank(_beneficiary);
|
|
118
128
|
_usdc.approve(address(permit2()), usdcAmount);
|
|
119
129
|
vm.prank(_beneficiary);
|
|
130
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
120
131
|
permit2().approve(address(_usdc), address(_terminal), uint160(usdcAmount), type(uint48).max);
|
|
121
132
|
|
|
122
133
|
vm.prank(_beneficiary);
|
|
@@ -145,6 +156,7 @@ contract TestMultiTokenSurplus_Local is TestBaseWorkflow {
|
|
|
145
156
|
vm.prank(_beneficiary);
|
|
146
157
|
_usdc.approve(address(permit2()), usdcAmount);
|
|
147
158
|
vm.prank(_beneficiary);
|
|
159
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
148
160
|
permit2().approve(address(_usdc), address(_terminal), uint160(usdcAmount), type(uint48).max);
|
|
149
161
|
|
|
150
162
|
vm.prank(_beneficiary);
|
|
@@ -191,6 +203,7 @@ contract TestMultiTokenSurplus_Local is TestBaseWorkflow {
|
|
|
191
203
|
vm.prank(_beneficiary);
|
|
192
204
|
_usdc.approve(address(permit2()), usdcAmount);
|
|
193
205
|
vm.prank(_beneficiary);
|
|
206
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
194
207
|
permit2().approve(address(_usdc), address(_terminal), uint160(usdcAmount), type(uint48).max);
|
|
195
208
|
|
|
196
209
|
vm.prank(_beneficiary);
|
|
@@ -1,12 +1,32 @@
|
|
|
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 {JBFundAccessLimits} from "../src/JBFundAccessLimits.sol";
|
|
6
|
+
import {JBTerminalStore} from "../src/JBTerminalStore.sol";
|
|
7
|
+
import {JBTokens} from "../src/JBTokens.sol";
|
|
8
|
+
import {IJBController} from "../src/interfaces/IJBController.sol";
|
|
9
|
+
import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.sol";
|
|
10
|
+
import {IJBPriceFeed} from "../src/interfaces/IJBPriceFeed.sol";
|
|
11
|
+
import {IJBPrices} from "../src/interfaces/IJBPrices.sol";
|
|
12
|
+
import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
13
|
+
import {JBConstants} from "../src/libraries/JBConstants.sol";
|
|
14
|
+
import {JBCurrencyIds} from "../src/libraries/JBCurrencyIds.sol";
|
|
15
|
+
import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
|
|
16
|
+
import {JBCurrencyAmount} from "../src/structs/JBCurrencyAmount.sol";
|
|
17
|
+
import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.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 {mulDiv} from "@prb/math/src/Common.sol";
|
|
23
|
+
import {mul as UD60x18mul, unwrap as UD60x18unwrap, wrap as UD60x18wrap} from "@prb/math/src/UD60x18.sol";
|
|
5
24
|
import {MockPriceFeed} from "./mock/MockPriceFeed.sol";
|
|
6
25
|
|
|
7
26
|
contract TestMultipleAccessLimits_Local is TestBaseWorkflow {
|
|
8
27
|
uint32 private _nativeCurrency;
|
|
9
28
|
IJBController private _controller;
|
|
29
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
10
30
|
IJBMultiTerminal private __terminal;
|
|
11
31
|
IJBPrices private _prices;
|
|
12
32
|
JBTokens private _tokens;
|
|
@@ -225,6 +245,7 @@ contract TestMultipleAccessLimits_Local is TestBaseWorkflow {
|
|
|
225
245
|
});
|
|
226
246
|
}
|
|
227
247
|
|
|
248
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
228
249
|
function testFuzzedInvalidAllowanceCurrencyOrdering(uint24 ALLOWCURRENCY) external {
|
|
229
250
|
JBFundAccessLimitGroup[] memory _fundAccessLimitGroup = new JBFundAccessLimitGroup[](1);
|
|
230
251
|
JBCurrencyAmount[] memory _payoutLimits = new JBCurrencyAmount[](1);
|
|
@@ -336,6 +357,7 @@ contract TestMultipleAccessLimits_Local is TestBaseWorkflow {
|
|
|
336
357
|
uint224 _payoutLimit,
|
|
337
358
|
uint224 _surplusAllowance,
|
|
338
359
|
uint32 _payoutCurrency,
|
|
360
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
339
361
|
uint32 ALLOWCURRENCY
|
|
340
362
|
)
|
|
341
363
|
external
|