@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,12 +1,21 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBMultiTerminal} from "../../../../src/JBMultiTerminal.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
7
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
8
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
10
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
11
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
12
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
13
|
import {JBMultiTerminalSetup} from "./JBMultiTerminalSetup.sol";
|
|
6
14
|
|
|
7
15
|
contract TestAddAccountingContextsFor_Local is JBMultiTerminalSetup {
|
|
8
16
|
uint256 _projectId = 1;
|
|
9
17
|
address _usdc = makeAddr("USDC");
|
|
18
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
10
19
|
uint256 _usdcCurrency = uint32(uint160(_usdc));
|
|
11
20
|
|
|
12
21
|
function setUp() public {
|
|
@@ -35,8 +44,10 @@ contract TestAddAccountingContextsFor_Local is JBMultiTerminalSetup {
|
|
|
35
44
|
// it will revert ACCOUNTING_CONTEXT_ALREADY_SET
|
|
36
45
|
|
|
37
46
|
// Accounting Context to set
|
|
47
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
38
48
|
JBAccountingContext memory _context =
|
|
39
|
-
|
|
49
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
50
|
+
JBAccountingContext({token: _usdc, decimals: 18, currency: uint32(_usdcCurrency)});
|
|
40
51
|
|
|
41
52
|
// Find the storage slot
|
|
42
53
|
bytes32 contextSlot = keccak256(abi.encode(_projectId, uint256(0)));
|
|
@@ -65,6 +76,7 @@ contract TestAddAccountingContextsFor_Local is JBMultiTerminalSetup {
|
|
|
65
76
|
|
|
66
77
|
// call params
|
|
67
78
|
JBAccountingContext[] memory _tokens = new JBAccountingContext[](1);
|
|
79
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
68
80
|
_tokens[0] = JBAccountingContext({token: _usdc, decimals: 6, currency: uint32(uint160(_usdc))});
|
|
69
81
|
|
|
70
82
|
vm.expectRevert(
|
|
@@ -97,6 +109,7 @@ contract TestAddAccountingContextsFor_Local is JBMultiTerminalSetup {
|
|
|
97
109
|
|
|
98
110
|
// call params
|
|
99
111
|
JBAccountingContext[] memory _tokens = new JBAccountingContext[](1);
|
|
112
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
100
113
|
_tokens[0] = JBAccountingContext({token: _usdc, decimals: 6, currency: uint32(uint160(_usdc))});
|
|
101
114
|
|
|
102
115
|
_terminal.addAccountingContextsFor(_projectId, _tokens);
|
|
@@ -104,6 +117,7 @@ contract TestAddAccountingContextsFor_Local is JBMultiTerminalSetup {
|
|
|
104
117
|
JBAccountingContext memory _storedContext = _terminal.accountingContextForTokenOf(_projectId, _usdc);
|
|
105
118
|
assertEq(_storedContext.token, _usdc);
|
|
106
119
|
assertEq(_storedContext.decimals, 6);
|
|
120
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
107
121
|
assertEq(_storedContext.currency, uint32(uint160(_usdc)));
|
|
108
122
|
}
|
|
109
123
|
|
|
@@ -263,6 +277,7 @@ contract TestAddAccountingContextsFor_Local is JBMultiTerminalSetup {
|
|
|
263
277
|
_tokens[0] = JBAccountingContext({
|
|
264
278
|
token: someToken,
|
|
265
279
|
decimals: 17, // invalid- we will mock a return of 18 decimals
|
|
280
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
266
281
|
currency: uint32(uint160(someToken))
|
|
267
282
|
});
|
|
268
283
|
|
|
@@ -296,6 +311,7 @@ contract TestAddAccountingContextsFor_Local is JBMultiTerminalSetup {
|
|
|
296
311
|
|
|
297
312
|
// call params
|
|
298
313
|
JBAccountingContext[] memory _tokens = new JBAccountingContext[](1);
|
|
314
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
299
315
|
_tokens[0] = JBAccountingContext({token: someToken, decimals: 18, currency: uint32(uint160(0))});
|
|
300
316
|
|
|
301
317
|
// setup: return data
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBMultiTerminal} from "../../../../src/JBMultiTerminal.sol";
|
|
5
|
+
import {IJBFeeTerminal} from "../../../../src/interfaces/IJBFeeTerminal.sol";
|
|
6
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
7
|
+
import {IJBTerminalStore} from "../../../../src/interfaces/IJBTerminalStore.sol";
|
|
8
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBFees} from "../../../../src/libraries/JBFees.sol";
|
|
10
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
11
|
+
import {JBFee} from "../../../../src/structs/JBFee.sol";
|
|
12
|
+
import {JBSingleAllowance} from "../../../../src/structs/JBSingleAllowance.sol";
|
|
13
|
+
import {IAllowanceTransfer, IPermit2} from "@uniswap/permit2/src/interfaces/IPermit2.sol";
|
|
5
14
|
import {JBMultiTerminalSetup} from "./JBMultiTerminalSetup.sol";
|
|
6
15
|
|
|
7
16
|
contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
@@ -11,9 +20,12 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
11
20
|
// global constants
|
|
12
21
|
uint256 _projectId = 1;
|
|
13
22
|
address _native = JBConstants.NATIVE_TOKEN;
|
|
23
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
14
24
|
uint256 _nativeCurrency = uint32(uint160(_native));
|
|
15
25
|
address _usdc = makeAddr("USDC");
|
|
26
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
16
27
|
uint256 _usdcCurrency = uint32(uint160(_usdc));
|
|
28
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
17
29
|
uint256 _terminalUSDCBalance = 1e18;
|
|
18
30
|
|
|
19
31
|
// set by modifiers
|
|
@@ -25,6 +37,7 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
25
37
|
bool _shouldReturnHeldFees;
|
|
26
38
|
|
|
27
39
|
// Permit2 params.
|
|
40
|
+
// forge-lint: disable-next-line(mixed-case-variable)
|
|
28
41
|
bytes32 DOMAIN_SEPARATOR;
|
|
29
42
|
address from;
|
|
30
43
|
uint256 fromPrivateKey = 0x12341234;
|
|
@@ -37,8 +50,10 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
37
50
|
|
|
38
51
|
modifier whenNativeTokenIsAccepted() {
|
|
39
52
|
// Accounting Context to set
|
|
53
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
40
54
|
JBAccountingContext memory _context =
|
|
41
|
-
|
|
55
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
56
|
+
JBAccountingContext({token: _native, decimals: 18, currency: uint32(_nativeCurrency)});
|
|
42
57
|
|
|
43
58
|
// Find the storage slot
|
|
44
59
|
bytes32 contextSlot = keccak256(abi.encode(_projectId, uint256(0)));
|
|
@@ -55,8 +70,10 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
55
70
|
|
|
56
71
|
modifier whenShouldReturnHeldFeesEqTrue() {
|
|
57
72
|
// Accounting Context to set
|
|
73
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
58
74
|
JBAccountingContext memory _context =
|
|
59
|
-
|
|
75
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
76
|
+
JBAccountingContext({token: _native, decimals: 18, currency: uint32(_nativeCurrency)});
|
|
60
77
|
|
|
61
78
|
// Find the storage slot
|
|
62
79
|
bytes32 contextSlot = keccak256(abi.encode(_projectId, uint256(0)));
|
|
@@ -68,8 +85,8 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
68
85
|
JBAccountingContext memory _storedContext = _terminal.accountingContextForTokenOf(_projectId, _native);
|
|
69
86
|
assertEq(_storedContext.token, _native);
|
|
70
87
|
|
|
71
|
-
// Find the storage slot for fees array
|
|
72
|
-
bytes32 feeSlot = keccak256(abi.encode(_projectId, uint256(
|
|
88
|
+
// Find the storage slot for fees array (_heldFeesOf is at storage slot 3)
|
|
89
|
+
bytes32 feeSlot = keccak256(abi.encode(_projectId, uint256(3)));
|
|
73
90
|
bytes32 slotForArrayLength = keccak256(abi.encode(_native, feeSlot));
|
|
74
91
|
|
|
75
92
|
// Set the length of the fees array in the storage slot
|
|
@@ -222,8 +239,10 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
222
239
|
// it will revert NO_MSG_VALUE_ALLOWED
|
|
223
240
|
|
|
224
241
|
// Accounting Context to set
|
|
242
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
225
243
|
JBAccountingContext memory _context =
|
|
226
|
-
|
|
244
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
245
|
+
JBAccountingContext({token: _usdc, decimals: 18, currency: uint32(_usdcCurrency)});
|
|
227
246
|
|
|
228
247
|
// Find the storage slot
|
|
229
248
|
bytes32 contextSlot = keccak256(abi.encode(_projectId, uint256(0)));
|
|
@@ -249,8 +268,10 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
249
268
|
|
|
250
269
|
modifier whenPayMetadataContainsPermitData() {
|
|
251
270
|
// Accounting Context to set
|
|
271
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
252
272
|
JBAccountingContext memory _context =
|
|
253
|
-
|
|
273
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
274
|
+
JBAccountingContext({token: _usdc, decimals: 18, currency: uint32(_usdcCurrency)});
|
|
254
275
|
|
|
255
276
|
// Find the storage slot
|
|
256
277
|
bytes32 contextSlot = keccak256(abi.encode(_projectId, uint256(0)));
|
|
@@ -333,8 +354,15 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
333
354
|
payAmount = 1e18;
|
|
334
355
|
|
|
335
356
|
// Setup: prepare permit details for signing.
|
|
357
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
336
358
|
IAllowanceTransfer.PermitDetails memory details = IAllowanceTransfer.PermitDetails({
|
|
337
|
-
|
|
359
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
360
|
+
token: address(_usdc),
|
|
361
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
362
|
+
amount: uint160(payAmount),
|
|
363
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
364
|
+
expiration: uint48(expiration),
|
|
365
|
+
nonce: 0
|
|
338
366
|
});
|
|
339
367
|
|
|
340
368
|
IAllowanceTransfer.PermitSingle memory permit =
|
|
@@ -343,8 +371,15 @@ contract TestAddToBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
343
371
|
// Setup: sign permit details.
|
|
344
372
|
bytes memory sig = getPermitSignature(permit, fromPrivateKey, DOMAIN_SEPARATOR);
|
|
345
373
|
|
|
374
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
346
375
|
JBSingleAllowance memory permitData = JBSingleAllowance({
|
|
347
|
-
|
|
376
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
377
|
+
sigDeadline: deadline,
|
|
378
|
+
amount: uint160(1),
|
|
379
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
380
|
+
expiration: uint48(expiration),
|
|
381
|
+
nonce: uint48(0),
|
|
382
|
+
signature: sig
|
|
348
383
|
});
|
|
349
384
|
|
|
350
385
|
// Setup: prepare data for metadata helper.
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {MockERC20} from "../../../mock/MockERC20.sol";
|
|
5
|
+
import {JBMultiTerminal} from "../../../../src/JBMultiTerminal.sol";
|
|
6
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
7
|
+
import {IJBCashOutHook} from "../../../../src/interfaces/IJBCashOutHook.sol";
|
|
8
|
+
import {IJBCashOutTerminal} from "../../../../src/interfaces/IJBCashOutTerminal.sol";
|
|
9
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
10
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
11
|
+
import {IJBFeelessAddresses} from "../../../../src/interfaces/IJBFeelessAddresses.sol";
|
|
12
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
13
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
14
|
+
import {IJBTerminalStore} from "../../../../src/interfaces/IJBTerminalStore.sol";
|
|
15
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
16
|
+
import {JBFees} from "../../../../src/libraries/JBFees.sol";
|
|
17
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
18
|
+
import {JBAfterCashOutRecordedContext} from "../../../../src/structs/JBAfterCashOutRecordedContext.sol";
|
|
19
|
+
import {JBCashOutHookSpecification} from "../../../../src/structs/JBCashOutHookSpecification.sol";
|
|
20
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
21
|
+
import {JBTokenAmount} from "../../../../src/structs/JBTokenAmount.sol";
|
|
22
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
23
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
24
|
import {JBMultiTerminalSetup} from "./JBMultiTerminalSetup.sol";
|
|
6
25
|
|
|
7
26
|
contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
@@ -87,12 +106,15 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
87
106
|
metadata: 0
|
|
88
107
|
});
|
|
89
108
|
|
|
109
|
+
// mock feeless address check
|
|
110
|
+
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(true));
|
|
111
|
+
|
|
90
112
|
// mock call to JBTerminalStore recordCashOutFor
|
|
91
113
|
mockExpect(
|
|
92
114
|
address(store),
|
|
93
115
|
abi.encodeCall(
|
|
94
116
|
IJBTerminalStore.recordCashOutFor,
|
|
95
|
-
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, "")
|
|
117
|
+
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, true, "")
|
|
96
118
|
),
|
|
97
119
|
abi.encode(returnedRuleset, reclaimAmount, _maxCashOutTaxRate, hookSpecifications)
|
|
98
120
|
);
|
|
@@ -110,9 +132,6 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
110
132
|
// put code at mockToken address to pass OZ Address check
|
|
111
133
|
vm.etch(_mockToken, abi.encode(1));
|
|
112
134
|
|
|
113
|
-
// mock feeless address check
|
|
114
|
-
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(true));
|
|
115
|
-
|
|
116
135
|
_terminal.cashOutTokensOf(_holder, _projectId, _defaultAmount, _mockToken, _minReclaimed, _bene, "");
|
|
117
136
|
}
|
|
118
137
|
|
|
@@ -135,12 +154,15 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
135
154
|
metadata: 0
|
|
136
155
|
});
|
|
137
156
|
|
|
157
|
+
// mock feeless address check
|
|
158
|
+
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(true));
|
|
159
|
+
|
|
138
160
|
// mock call to JBTerminalStore recordCashOutFor
|
|
139
161
|
mockExpect(
|
|
140
162
|
address(store),
|
|
141
163
|
abi.encodeCall(
|
|
142
164
|
IJBTerminalStore.recordCashOutFor,
|
|
143
|
-
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, "")
|
|
165
|
+
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, true, "")
|
|
144
166
|
),
|
|
145
167
|
abi.encode(returnedRuleset, reclaimAmount, _maxCashOutTaxRate, hookSpecifications)
|
|
146
168
|
);
|
|
@@ -158,8 +180,6 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
158
180
|
// put code at mockToken address to pass OZ Address check
|
|
159
181
|
vm.etch(_mockToken, abi.encode(1));
|
|
160
182
|
|
|
161
|
-
// mock feeless address check
|
|
162
|
-
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(true));
|
|
163
183
|
vm.expectRevert(
|
|
164
184
|
abi.encodeWithSelector(JBMultiTerminal.JBMultiTerminal_UnderMinTokensReclaimed.selector, 1e9, 1e18)
|
|
165
185
|
);
|
|
@@ -189,12 +209,15 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
189
209
|
metadata: 0
|
|
190
210
|
});
|
|
191
211
|
|
|
212
|
+
// mock feeless address check
|
|
213
|
+
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(false));
|
|
214
|
+
|
|
192
215
|
// mock call to JBTerminalStore recordCashOutFor
|
|
193
216
|
mockExpect(
|
|
194
217
|
address(store),
|
|
195
218
|
abi.encodeCall(
|
|
196
219
|
IJBTerminalStore.recordCashOutFor,
|
|
197
|
-
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, "")
|
|
220
|
+
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, false, "")
|
|
198
221
|
),
|
|
199
222
|
abi.encode(returnedRuleset, reclaimAmount, _halfCashOutTaxRate, hookSpecifications)
|
|
200
223
|
);
|
|
@@ -212,9 +235,6 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
212
235
|
// put code at mockToken address to pass OZ Address check
|
|
213
236
|
vm.etch(_mockToken, abi.encode(1));
|
|
214
237
|
|
|
215
|
-
// mock feeless address check
|
|
216
|
-
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(false));
|
|
217
|
-
|
|
218
238
|
// get fee amount
|
|
219
239
|
uint256 tax = JBFees.feeAmountFrom(reclaimAmount, 25); // 25 = default fee)
|
|
220
240
|
uint256 transferredAmount = reclaimAmount - tax;
|
|
@@ -301,12 +321,14 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
301
321
|
metadata: 0
|
|
302
322
|
});
|
|
303
323
|
|
|
324
|
+
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(true));
|
|
325
|
+
|
|
304
326
|
// mock call to JBTerminalStore recordCashOutFor
|
|
305
327
|
mockExpect(
|
|
306
328
|
address(store),
|
|
307
329
|
abi.encodeCall(
|
|
308
330
|
IJBTerminalStore.recordCashOutFor,
|
|
309
|
-
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, "")
|
|
331
|
+
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, true, "")
|
|
310
332
|
),
|
|
311
333
|
abi.encode(returnedRuleset, reclaimAmount, _maxCashOutTaxRate, hookSpecifications)
|
|
312
334
|
);
|
|
@@ -321,16 +343,16 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
321
343
|
address(this), abi.encodeCall(IJBController.burnTokensOf, (_holder, _projectId, _defaultAmount, "")), ""
|
|
322
344
|
);
|
|
323
345
|
|
|
324
|
-
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(true));
|
|
325
|
-
|
|
326
346
|
mockExpect(
|
|
327
347
|
address(feelessAddresses),
|
|
328
348
|
abi.encodeCall(IJBFeelessAddresses.isFeeless, (address(_mockHook))),
|
|
329
349
|
abi.encode(true)
|
|
330
350
|
);
|
|
331
351
|
|
|
332
|
-
JBTokenAmount memory reclaimedAmount =
|
|
333
|
-
|
|
352
|
+
JBTokenAmount memory reclaimedAmount =
|
|
353
|
+
JBTokenAmount({token: address(_mockToken2), decimals: 0, currency: 0, value: reclaimAmount});
|
|
354
|
+
JBTokenAmount memory forwardedAmount =
|
|
355
|
+
JBTokenAmount({token: address(_mockToken2), decimals: 0, currency: 0, value: _defaultAmount});
|
|
334
356
|
|
|
335
357
|
// needed for hook call
|
|
336
358
|
JBAfterCashOutRecordedContext memory context = JBAfterCashOutRecordedContext({
|
|
@@ -402,12 +424,14 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
402
424
|
metadata: 0
|
|
403
425
|
});
|
|
404
426
|
|
|
427
|
+
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(true));
|
|
428
|
+
|
|
405
429
|
// mock call to JBTerminalStore recordCashOutFor
|
|
406
430
|
mockExpect(
|
|
407
431
|
address(store),
|
|
408
432
|
abi.encodeCall(
|
|
409
433
|
IJBTerminalStore.recordCashOutFor,
|
|
410
|
-
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, "")
|
|
434
|
+
(_holder, _projectId, _defaultAmount, mockTokenContext, mockBalanceContext, true, "")
|
|
411
435
|
),
|
|
412
436
|
abi.encode(returnedRuleset, reclaimAmount, _maxCashOutTaxRate, hookSpecifications)
|
|
413
437
|
);
|
|
@@ -422,8 +446,6 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
422
446
|
address(this), abi.encodeCall(IJBController.burnTokensOf, (_holder, _projectId, _defaultAmount, "")), ""
|
|
423
447
|
);
|
|
424
448
|
|
|
425
|
-
mockExpect(address(feelessAddresses), abi.encodeCall(IJBFeelessAddresses.isFeeless, (_bene)), abi.encode(true));
|
|
426
|
-
|
|
427
449
|
mockExpect(
|
|
428
450
|
address(feelessAddresses),
|
|
429
451
|
abi.encodeCall(IJBFeelessAddresses.isFeeless, (address(_mockHook))),
|
|
@@ -433,9 +455,12 @@ contract TestCashOutTokensOf_Local is JBMultiTerminalSetup {
|
|
|
433
455
|
uint256 hookTax = JBFees.feeAmountFrom(_defaultAmount, 25);
|
|
434
456
|
uint256 passedAfterTax = _defaultAmount - hookTax;
|
|
435
457
|
|
|
436
|
-
JBTokenAmount memory reclaimedAmount =
|
|
437
|
-
|
|
438
|
-
JBTokenAmount memory
|
|
458
|
+
JBTokenAmount memory reclaimedAmount =
|
|
459
|
+
JBTokenAmount({token: address(_mockToken2), decimals: 0, currency: 0, value: reclaimAmount});
|
|
460
|
+
JBTokenAmount memory forwardedAmount =
|
|
461
|
+
JBTokenAmount({token: address(_mockToken2), decimals: 0, currency: 0, value: passedAfterTax});
|
|
462
|
+
JBTokenAmount memory feeRepayAmount =
|
|
463
|
+
JBTokenAmount({token: address(_mockToken2), decimals: 0, currency: 0, value: hookTax});
|
|
439
464
|
|
|
440
465
|
// needed for hook call
|
|
441
466
|
JBAfterCashOutRecordedContext memory context = JBAfterCashOutRecordedContext({
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBMultiTerminal} from "../../../../src/JBMultiTerminal.sol";
|
|
5
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
6
|
+
import {IJBFeelessAddresses} from "../../../../src/interfaces/IJBFeelessAddresses.sol";
|
|
7
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
8
|
+
import {IJBSplitHook} from "../../../../src/interfaces/IJBSplitHook.sol";
|
|
9
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
10
|
+
import {IJBTerminalStore} from "../../../../src/interfaces/IJBTerminalStore.sol";
|
|
11
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
12
|
+
import {JBFees} from "../../../../src/libraries/JBFees.sol";
|
|
13
|
+
import {JBPayHookSpecification} from "../../../../src/structs/JBPayHookSpecification.sol";
|
|
14
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
15
|
+
import {JBSplit} from "../../../../src/structs/JBSplit.sol";
|
|
16
|
+
import {JBSplitHookContext} from "../../../../src/structs/JBSplitHookContext.sol";
|
|
17
|
+
import {JBTokenAmount} from "../../../../src/structs/JBTokenAmount.sol";
|
|
18
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
19
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
20
|
import {JBMultiTerminalSetup} from "./JBMultiTerminalSetup.sol";
|
|
6
21
|
|
|
7
22
|
contract TestExecutePayout_Local is JBMultiTerminalSetup {
|
|
@@ -344,7 +359,8 @@ contract TestExecutePayout_Local is JBMultiTerminalSetup {
|
|
|
344
359
|
});
|
|
345
360
|
|
|
346
361
|
// needed for next mock call returns
|
|
347
|
-
JBTokenAmount memory tokenAmount =
|
|
362
|
+
JBTokenAmount memory tokenAmount =
|
|
363
|
+
JBTokenAmount({token: _usdc, decimals: 0, currency: 0, value: _defaultAmount});
|
|
348
364
|
JBPayHookSpecification[] memory hookSpecifications = new JBPayHookSpecification[](0);
|
|
349
365
|
JBRuleset memory returnedRuleset = JBRuleset({
|
|
350
366
|
cycleNumber: 1,
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBMultiTerminal} from "../../../../src/JBMultiTerminal.sol";
|
|
5
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
6
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
7
|
+
import {IJBTerminalStore} from "../../../../src/interfaces/IJBTerminalStore.sol";
|
|
8
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
9
|
+
import {JBPayHookSpecification} from "../../../../src/structs/JBPayHookSpecification.sol";
|
|
10
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
11
|
+
import {JBTokenAmount} from "../../../../src/structs/JBTokenAmount.sol";
|
|
12
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
13
|
import {JBMultiTerminalSetup} from "./JBMultiTerminalSetup.sol";
|
|
6
14
|
|
|
7
15
|
contract TestExecuteProcessFee_Local is JBMultiTerminalSetup {
|
|
@@ -80,7 +88,8 @@ contract TestExecuteProcessFee_Local is JBMultiTerminalSetup {
|
|
|
80
88
|
// it will call internal _pay
|
|
81
89
|
|
|
82
90
|
// needed for next mock call returns
|
|
83
|
-
JBTokenAmount memory tokenAmount =
|
|
91
|
+
JBTokenAmount memory tokenAmount =
|
|
92
|
+
JBTokenAmount({token: _native, decimals: 0, currency: 0, value: _defaultAmount});
|
|
84
93
|
JBPayHookSpecification[] memory hookSpecifications = new JBPayHookSpecification[](0);
|
|
85
94
|
JBRuleset memory returnedRuleset = JBRuleset({
|
|
86
95
|
cycleNumber: 1,
|
|
@@ -143,7 +152,8 @@ contract TestExecuteProcessFee_Local is JBMultiTerminalSetup {
|
|
|
143
152
|
// it will call external pay with zero msgvalue
|
|
144
153
|
|
|
145
154
|
// needed for next mock call returns
|
|
146
|
-
JBTokenAmount memory tokenAmount =
|
|
155
|
+
JBTokenAmount memory tokenAmount =
|
|
156
|
+
JBTokenAmount({token: _usdc, decimals: 0, currency: 0, value: _defaultAmount});
|
|
147
157
|
JBPayHookSpecification[] memory hookSpecifications = new JBPayHookSpecification[](0);
|
|
148
158
|
JBRuleset memory returnedRuleset = JBRuleset({
|
|
149
159
|
cycleNumber: 1,
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {JBMultiTerminal} from "../../../../src/JBMultiTerminal.sol";
|
|
5
|
+
import {JBPermissioned} from "../../../../src/abstract/JBPermissioned.sol";
|
|
6
|
+
import {IJBPermissions} from "../../../../src/interfaces/IJBPermissions.sol";
|
|
7
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
8
|
+
import {IJBTerminalStore} from "../../../../src/interfaces/IJBTerminalStore.sol";
|
|
9
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
10
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
11
|
+
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
12
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
13
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
14
|
import {JBMultiTerminalSetup} from "./JBMultiTerminalSetup.sol";
|
|
6
15
|
|
|
7
16
|
contract TestMigrateBalanceOf_Local is JBMultiTerminalSetup {
|
|
@@ -9,8 +18,10 @@ contract TestMigrateBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
9
18
|
uint256 _defaultAmount = 1e18;
|
|
10
19
|
address _bene = makeAddr("beneficiary");
|
|
11
20
|
address _native = JBConstants.NATIVE_TOKEN;
|
|
21
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
12
22
|
uint256 _nativeCurrency = uint32(uint160(_native));
|
|
13
23
|
address _usdc = makeAddr("USDC");
|
|
24
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
14
25
|
uint256 _usdcCurrency = uint32(uint160(_usdc));
|
|
15
26
|
|
|
16
27
|
IJBTerminal _newTerminal = IJBTerminal(makeAddr("newTerminal"));
|
|
@@ -94,8 +105,10 @@ contract TestMigrateBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
94
105
|
// it will safeIncreaseAllowance and addToBalanceOf
|
|
95
106
|
|
|
96
107
|
// for next mock
|
|
108
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
97
109
|
JBAccountingContext memory _context =
|
|
98
|
-
|
|
110
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
111
|
+
JBAccountingContext({token: _usdc, decimals: 6, currency: uint32(_usdcCurrency)});
|
|
99
112
|
|
|
100
113
|
// mock call to the destination terminals accountingContextFor
|
|
101
114
|
mockExpect(
|
|
@@ -131,8 +144,10 @@ contract TestMigrateBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
131
144
|
// it will addToBalanceOf with value in msgvalue
|
|
132
145
|
|
|
133
146
|
// for next mock
|
|
147
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
134
148
|
JBAccountingContext memory _context =
|
|
135
|
-
|
|
149
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
150
|
+
JBAccountingContext({token: _native, decimals: 18, currency: uint32(_nativeCurrency)});
|
|
136
151
|
|
|
137
152
|
// mock call to the destination terminals accountingContextFor
|
|
138
153
|
mockExpect(
|
|
@@ -165,8 +180,10 @@ contract TestMigrateBalanceOf_Local is JBMultiTerminalSetup {
|
|
|
165
180
|
// it will not add to balance
|
|
166
181
|
|
|
167
182
|
// for next mock
|
|
183
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
168
184
|
JBAccountingContext memory _context =
|
|
169
|
-
|
|
185
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
186
|
+
JBAccountingContext({token: _native, decimals: 18, currency: uint32(_nativeCurrency)});
|
|
170
187
|
|
|
171
188
|
// mock call to the destination terminals accountingContextFor
|
|
172
189
|
mockExpect(
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.26;
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {MockERC20} from "../../../mock/MockERC20.sol";
|
|
5
|
+
import {JBMultiTerminal} from "../../../../src/JBMultiTerminal.sol";
|
|
6
|
+
import {IJBController} from "../../../../src/interfaces/IJBController.sol";
|
|
7
|
+
import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
|
|
8
|
+
import {IJBPayHook} from "../../../../src/interfaces/IJBPayHook.sol";
|
|
9
|
+
import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
|
|
10
|
+
import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
|
|
11
|
+
import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
|
|
12
|
+
import {IJBTerminalStore} from "../../../../src/interfaces/IJBTerminalStore.sol";
|
|
13
|
+
import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
|
|
14
|
+
import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
|
|
15
|
+
import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
|
|
16
|
+
import {JBAfterPayRecordedContext} from "../../../../src/structs/JBAfterPayRecordedContext.sol";
|
|
17
|
+
import {JBPayHookSpecification} from "../../../../src/structs/JBPayHookSpecification.sol";
|
|
18
|
+
import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
|
|
19
|
+
import {JBTokenAmount} from "../../../../src/structs/JBTokenAmount.sol";
|
|
20
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
21
|
+
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
5
22
|
import {JBMultiTerminalSetup} from "./JBMultiTerminalSetup.sol";
|
|
6
23
|
|
|
7
24
|
contract TestPay_Local is JBMultiTerminalSetup {
|
|
@@ -9,8 +26,10 @@ contract TestPay_Local is JBMultiTerminalSetup {
|
|
|
9
26
|
uint256 _defaultAmount = 1e18;
|
|
10
27
|
address _bene = makeAddr("beneficiary");
|
|
11
28
|
address _native = JBConstants.NATIVE_TOKEN;
|
|
29
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
12
30
|
uint32 _nativeCurrency = uint32(uint160(_native));
|
|
13
31
|
address _usdc = makeAddr("USDC");
|
|
32
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
14
33
|
uint32 _usdcCurrency = uint32(uint160(_usdc));
|
|
15
34
|
|
|
16
35
|
address _mockController = makeAddr("mc");
|
|
@@ -102,7 +121,8 @@ contract TestPay_Local is JBMultiTerminalSetup {
|
|
|
102
121
|
// it will revert UNDER_MIN_RETURNED_TOKENS
|
|
103
122
|
|
|
104
123
|
// needed for next mock call returns
|
|
105
|
-
JBTokenAmount memory tokenAmount =
|
|
124
|
+
JBTokenAmount memory tokenAmount =
|
|
125
|
+
JBTokenAmount({token: _native, decimals: 18, currency: uint32(_nativeCurrency), value: _defaultAmount});
|
|
106
126
|
JBPayHookSpecification[] memory hookSpecifications = new JBPayHookSpecification[](0);
|
|
107
127
|
JBRuleset memory returnedRuleset = JBRuleset({
|
|
108
128
|
cycleNumber: 1,
|
|
@@ -143,7 +163,8 @@ contract TestPay_Local is JBMultiTerminalSetup {
|
|
|
143
163
|
// it will mint tokens and emit Pay
|
|
144
164
|
|
|
145
165
|
// needed for next mock call returns
|
|
146
|
-
JBTokenAmount memory tokenAmount =
|
|
166
|
+
JBTokenAmount memory tokenAmount =
|
|
167
|
+
JBTokenAmount({token: _native, decimals: 18, currency: uint32(_nativeCurrency), value: _defaultAmount});
|
|
147
168
|
JBPayHookSpecification[] memory hookSpecifications = new JBPayHookSpecification[](0);
|
|
148
169
|
JBRuleset memory returnedRuleset = JBRuleset({
|
|
149
170
|
cycleNumber: 1,
|
|
@@ -229,8 +250,13 @@ contract TestPay_Local is JBMultiTerminalSetup {
|
|
|
229
250
|
_mockToken.approve(address(_mockHook), _defaultAmount);
|
|
230
251
|
|
|
231
252
|
// needed for next mock call returns
|
|
232
|
-
JBTokenAmount memory tokenAmount =
|
|
233
|
-
|
|
253
|
+
JBTokenAmount memory tokenAmount = JBTokenAmount({
|
|
254
|
+
// forge-lint: disable-next-line(unsafe-typecast)
|
|
255
|
+
token: address(_mockToken),
|
|
256
|
+
decimals: 6,
|
|
257
|
+
currency: uint32(_mockTokenCurrency),
|
|
258
|
+
value: _defaultAmount
|
|
259
|
+
});
|
|
234
260
|
JBPayHookSpecification[] memory hookSpecifications = new JBPayHookSpecification[](1);
|
|
235
261
|
hookSpecifications[0] = JBPayHookSpecification({hook: _mockHook, amount: _defaultAmount, metadata: ""});
|
|
236
262
|
|
|
@@ -320,7 +346,8 @@ contract TestPay_Local is JBMultiTerminalSetup {
|
|
|
320
346
|
// it will send ETH to the hook and emit HookAfterRecordPay and Pay
|
|
321
347
|
|
|
322
348
|
// needed for next mock call returns
|
|
323
|
-
JBTokenAmount memory tokenAmount =
|
|
349
|
+
JBTokenAmount memory tokenAmount =
|
|
350
|
+
JBTokenAmount({token: _native, decimals: 18, currency: uint32(_nativeCurrency), value: _defaultAmount});
|
|
324
351
|
JBPayHookSpecification[] memory hookSpecifications = new JBPayHookSpecification[](1);
|
|
325
352
|
hookSpecifications[0] = JBPayHookSpecification({hook: _mockHook, amount: _defaultAmount, metadata: ""});
|
|
326
353
|
|
|
@@ -452,7 +479,8 @@ contract TestPay_Local is JBMultiTerminalSetup {
|
|
|
452
479
|
// it will not transfer
|
|
453
480
|
|
|
454
481
|
// needed for next mock call returns
|
|
455
|
-
JBTokenAmount memory tokenAmount =
|
|
482
|
+
JBTokenAmount memory tokenAmount =
|
|
483
|
+
JBTokenAmount({token: _native, decimals: 18, currency: uint32(_nativeCurrency), value: _defaultAmount});
|
|
456
484
|
JBPayHookSpecification[] memory hookSpecifications = new JBPayHookSpecification[](0);
|
|
457
485
|
|
|
458
486
|
JBRuleset memory returnedRuleset = JBRuleset({
|