@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.
Files changed (231) hide show
  1. package/ADMINISTRATION.md +5 -1
  2. package/ARCHITECTURE.md +2 -1
  3. package/AUDIT_INSTRUCTIONS.md +342 -0
  4. package/CHANGE_LOG.md +375 -0
  5. package/README.md +6 -6
  6. package/RISKS.md +171 -50
  7. package/SKILLS.md +11 -6
  8. package/STYLE_GUIDE.md +16 -2
  9. package/USER_JOURNEYS.md +622 -0
  10. package/package.json +2 -2
  11. package/script/Deploy.s.sol +22 -13
  12. package/script/DeployPeriphery.s.sol +76 -52
  13. package/script/helpers/CoreDeploymentLib.sol +83 -35
  14. package/src/JBChainlinkV3PriceFeed.sol +1 -0
  15. package/src/JBController.sol +23 -3
  16. package/src/JBDeadline.sol +3 -0
  17. package/src/JBDirectory.sol +2 -1
  18. package/src/JBERC20.sol +12 -3
  19. package/src/JBFundAccessLimits.sol +12 -2
  20. package/src/JBMultiTerminal.sol +53 -10
  21. package/src/JBPermissions.sol +3 -0
  22. package/src/JBPrices.sol +8 -2
  23. package/src/JBProjects.sol +1 -1
  24. package/src/JBRulesets.sol +14 -0
  25. package/src/JBSplits.sol +14 -5
  26. package/src/JBTerminalStore.sol +57 -47
  27. package/src/JBTokens.sol +43 -4
  28. package/src/interfaces/IJBController.sol +6 -0
  29. package/src/interfaces/IJBPermitTerminal.sol +1 -0
  30. package/src/interfaces/IJBTerminalStore.sol +3 -0
  31. package/src/interfaces/IJBToken.sol +5 -0
  32. package/src/interfaces/IJBTokens.sol +13 -0
  33. package/src/libraries/JBFees.sol +2 -0
  34. package/src/libraries/JBMetadataResolver.sol +24 -7
  35. package/src/libraries/JBRulesetMetadataResolver.sol +21 -21
  36. package/src/structs/JBAccountingContext.sol +1 -0
  37. package/src/structs/JBAfterCashOutRecordedContext.sol +1 -0
  38. package/src/structs/JBAfterPayRecordedContext.sol +1 -0
  39. package/src/structs/JBBeforeCashOutRecordedContext.sol +5 -0
  40. package/src/structs/JBBeforePayRecordedContext.sol +1 -0
  41. package/src/structs/JBCashOutHookSpecification.sol +1 -0
  42. package/src/structs/JBCurrencyAmount.sol +1 -0
  43. package/src/structs/JBFee.sol +1 -0
  44. package/src/structs/JBFundAccessLimitGroup.sol +1 -0
  45. package/src/structs/JBPayHookSpecification.sol +1 -0
  46. package/src/structs/JBPermissionsData.sol +1 -0
  47. package/src/structs/JBRuleset.sol +1 -0
  48. package/src/structs/JBRulesetConfig.sol +1 -0
  49. package/src/structs/JBRulesetMetadata.sol +1 -0
  50. package/src/structs/JBRulesetWeightCache.sol +1 -0
  51. package/src/structs/JBRulesetWithMetadata.sol +1 -0
  52. package/src/structs/JBSingleAllowance.sol +1 -0
  53. package/src/structs/JBSplit.sol +1 -0
  54. package/src/structs/JBSplitGroup.sol +1 -0
  55. package/src/structs/JBSplitHookContext.sol +1 -0
  56. package/src/structs/JBTerminalConfig.sol +1 -0
  57. package/src/structs/JBTokenAmount.sol +1 -0
  58. package/test/ComprehensiveInvariant.t.sol +15 -2
  59. package/test/CoreExploitTests.t.sol +34 -1
  60. package/test/EconomicSimulation.t.sol +10 -2
  61. package/test/EntryPointPermutations.t.sol +17 -3
  62. package/test/FlashLoanAttacks.t.sol +12 -1
  63. package/test/PermissionEscalation.t.sol +53 -10
  64. package/test/RulesetTransitions.t.sol +15 -1
  65. package/test/SplitLoopTests.t.sol +25 -2
  66. package/test/TestAccessToFunds.sol +17 -2
  67. package/test/TestAuditResponseDesignProofs.sol +434 -0
  68. package/test/TestCashOut.sol +15 -1
  69. package/test/TestCashOutCountFor.sol +1 -1
  70. package/test/TestCashOutHooks.sol +47 -25
  71. package/test/TestCashOutTimingEdge.sol +13 -1
  72. package/test/TestDataHookFuzzing.sol +520 -0
  73. package/test/TestDurationUnderflow.sol +13 -1
  74. package/test/TestFeeFreeCashOutBypass.sol +617 -0
  75. package/test/TestFeeProcessingFailure.sol +16 -1
  76. package/test/TestFees.sol +14 -1
  77. package/test/TestInterfaceSupport.sol +20 -1
  78. package/test/TestJBERC20Inheritance.sol +11 -1
  79. package/test/TestL2SequencerPriceFeed.sol +292 -0
  80. package/test/TestLaunchProject.sol +13 -1
  81. package/test/TestMetaTx.sol +15 -1
  82. package/test/TestMetadataOffsetOverflow.sol +179 -0
  83. package/test/TestMetadataParserLib.sol +37 -4
  84. package/test/TestMigrationHeldFees.sol +16 -1
  85. package/test/TestMintTokensOf.sol +14 -1
  86. package/test/TestMultiTerminalSurplus.sol +348 -0
  87. package/test/TestMultiTokenSurplus.sol +14 -1
  88. package/test/TestMultipleAccessLimits.sol +23 -1
  89. package/test/TestPayBurnRedeemFlow.sol +16 -1
  90. package/test/TestPayHooks.sol +33 -14
  91. package/test/TestPermissions.sol +20 -1
  92. package/test/TestPermissionsEdge.sol +5 -1
  93. package/test/TestPermit2DataHook.t.sol +360 -0
  94. package/test/TestPermit2Terminal.sol +36 -3
  95. package/test/TestRulesetQueueing.sol +23 -1
  96. package/test/TestRulesetQueuingStress.sol +20 -1
  97. package/test/TestRulesetWeightCaching.sol +127 -125
  98. package/test/TestSplits.sol +23 -1
  99. package/test/TestTerminalMigration.sol +11 -1
  100. package/test/TestTokenFlow.sol +18 -1
  101. package/test/TestWeightCacheStaleAfterRejection.sol +15 -1
  102. package/test/WeirdTokenTests.t.sol +54 -1
  103. package/test/fork/TestChainlinkPriceFeedFork.sol +6 -1
  104. package/test/formal/BondingCurveProperties.t.sol +8 -1
  105. package/test/formal/FeeProperties.t.sol +7 -1
  106. package/test/helpers/JBTest.sol +1 -1
  107. package/test/helpers/TestBaseWorkflow.sol +84 -1
  108. package/test/invariants/Phase3DeepInvariant.t.sol +13 -2
  109. package/test/invariants/RulesetsInvariant.t.sol +12 -2
  110. package/test/invariants/TerminalStoreInvariant.t.sol +11 -2
  111. package/test/invariants/TokensInvariant.t.sol +13 -2
  112. package/test/invariants/handlers/ComprehensiveHandler.sol +19 -1
  113. package/test/invariants/handlers/EconomicHandler.sol +31 -1
  114. package/test/invariants/handlers/Phase3Handler.sol +31 -1
  115. package/test/invariants/handlers/RulesetsHandler.sol +5 -1
  116. package/test/invariants/handlers/TerminalStoreHandler.sol +6 -1
  117. package/test/invariants/handlers/TokensHandler.sol +1 -1
  118. package/test/mock/MockERC20.sol +0 -2
  119. package/test/mock/MockMaliciousBeneficiary.sol +2 -1
  120. package/test/mock/MockMaliciousSplitHook.sol +2 -1
  121. package/test/mock/MockPriceFeed.sol +1 -1
  122. package/test/regression/HoldFeesCashOutReserved.t.sol +415 -0
  123. package/test/regression/WeightCacheBoundary.t.sol +291 -0
  124. package/test/units/static/JBChainlinkV3PriceFeed/TestPriceFeed.sol +0 -1
  125. package/test/units/static/JBController/JBControllerSetup.sol +10 -1
  126. package/test/units/static/JBController/TestBurnTokensOf.sol +8 -1
  127. package/test/units/static/JBController/TestClaimTokensFor.sol +4 -1
  128. package/test/units/static/JBController/TestDeployErc20For.sol +7 -1
  129. package/test/units/static/JBController/TestLaunchProjectFor.sol +21 -1
  130. package/test/units/static/JBController/TestLaunchRulesetsFor.sol +21 -1
  131. package/test/units/static/JBController/TestMigrateController.sol +10 -1
  132. package/test/units/static/JBController/TestMintTokensOfUnits.sol +10 -1
  133. package/test/units/static/JBController/TestPayReservedTokenToTerminal.sol +4 -1
  134. package/test/units/static/JBController/TestReceiveMigrationFrom.sol +5 -1
  135. package/test/units/static/JBController/TestRulesetViews.sol +7 -1
  136. package/test/units/static/JBController/TestSendReservedTokensToSplitsOf.sol +21 -1
  137. package/test/units/static/JBController/TestSetSplitGroupsOf.sol +6 -1
  138. package/test/units/static/JBController/TestSetTokenFor.sol +13 -1
  139. package/test/units/static/JBController/TestSetUriOf.sol +5 -1
  140. package/test/units/static/JBController/TestTransferCreditsFrom.sol +11 -1
  141. package/test/units/static/JBDeadline/TestDeadlineFuzz.sol +12 -1
  142. package/test/units/static/JBDirectory/JBDirectorySetup.sol +4 -1
  143. package/test/units/static/JBDirectory/TestPrimaryTerminalOf.sol +5 -1
  144. package/test/units/static/JBDirectory/TestSetControllerOf.sol +11 -1
  145. package/test/units/static/JBDirectory/TestSetControllerOfMigrationOrder.sol +7 -1
  146. package/test/units/static/JBDirectory/TestSetPrimaryTerminalOf.sol +11 -1
  147. package/test/units/static/JBDirectory/TestSetTerminalsOf.sol +10 -1
  148. package/test/units/static/JBERC20/JBERC20Setup.sol +2 -1
  149. package/test/units/static/JBERC20/SigUtils.sol +2 -0
  150. package/test/units/static/JBERC20/TestInitialize.sol +1 -1
  151. package/test/units/static/JBERC20/TestName.sol +1 -1
  152. package/test/units/static/JBERC20/TestNonces.sol +3 -1
  153. package/test/units/static/JBERC20/TestSymbol.sol +1 -1
  154. package/test/units/static/JBFeelessAdresses/JBFeelessSetup.sol +2 -1
  155. package/test/units/static/JBFeelessAdresses/TestInterfaces.sol +2 -1
  156. package/test/units/static/JBFeelessAdresses/TestSetFeelessAddress.sol +1 -1
  157. package/test/units/static/JBFees/TestFeesFuzz.sol +1 -1
  158. package/test/units/static/JBFixedPointNumber/TestAdjustDecimals.sol +0 -1
  159. package/test/units/static/JBFixedPointNumber/TestAdjustDecimalsFuzz.sol +0 -1
  160. package/test/units/static/JBFundAccessLimits/JBFundAccessSetup.sol +3 -1
  161. package/test/units/static/JBFundAccessLimits/TestFundAccessLimitsEdge.sol +4 -1
  162. package/test/units/static/JBFundAccessLimits/TestPayoutLimitOf.sol +4 -1
  163. package/test/units/static/JBFundAccessLimits/TestPayoutLimitsOf.sol +8 -1
  164. package/test/units/static/JBFundAccessLimits/TestSetFundAccessLimitsFor.sol +8 -1
  165. package/test/units/static/JBFundAccessLimits/TestSurplusAllowanceOf.sol +4 -1
  166. package/test/units/static/JBFundAccessLimits/TestSurplusAllowancesOf.sol +7 -1
  167. package/test/units/static/JBMetadataResolver/TestGetDataFor.sol +1 -1
  168. package/test/units/static/JBMetadataResolver/TestMetadataResolverEdgeCases.sol +2 -1
  169. package/test/units/static/JBMetadataResolver/TestMetadataResolverFuzz.sol +2 -1
  170. package/test/units/static/JBMultiTerminal/JBMultiTerminalSetup.sol +12 -1
  171. package/test/units/static/JBMultiTerminal/TestAccountingContextsOf.sol +9 -1
  172. package/test/units/static/JBMultiTerminal/TestAddAccountingContextsFor.sol +18 -2
  173. package/test/units/static/JBMultiTerminal/TestAddToBalanceOf.sol +44 -9
  174. package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +48 -23
  175. package/test/units/static/JBMultiTerminal/TestExecutePayout.sol +18 -2
  176. package/test/units/static/JBMultiTerminal/TestExecuteProcessFee.sol +13 -3
  177. package/test/units/static/JBMultiTerminal/TestMigrateBalanceOf.sol +21 -4
  178. package/test/units/static/JBMultiTerminal/TestPay.sol +35 -7
  179. package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +206 -19
  180. package/test/units/static/JBMultiTerminal/TestSendPayoutsOf.sol +15 -1
  181. package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +297 -1
  182. package/test/units/static/JBPermissions/JBPermissionsSetup.sol +2 -1
  183. package/test/units/static/JBPermissions/TestHasPermission.sol +1 -1
  184. package/test/units/static/JBPermissions/TestHasPermissions.sol +1 -1
  185. package/test/units/static/JBPermissions/TestSetPermissionsFor.sol +3 -1
  186. package/test/units/static/JBPrices/JBPricesSetup.sol +6 -1
  187. package/test/units/static/JBPrices/TestAddPriceFeedFor.sol +6 -1
  188. package/test/units/static/JBPrices/TestPricePerUnitOf.sol +4 -1
  189. package/test/units/static/JBPrices/TestPrices.sol +4 -1
  190. package/test/units/static/JBProjects/JBProjectsSetup.sol +2 -1
  191. package/test/units/static/JBProjects/TestCreateFor.sol +3 -1
  192. package/test/units/static/JBProjects/TestInitialProject.sol +2 -1
  193. package/test/units/static/JBProjects/TestInterfaces.sol +0 -1
  194. package/test/units/static/JBProjects/TestSetResolver.sol +2 -1
  195. package/test/units/static/JBProjects/TestTokenUri.sol +3 -1
  196. package/test/units/static/JBRulesetMetadataResolver/TestSetCashOutTaxRateTo.sol +9 -1
  197. package/test/units/static/JBRulesets/JBRulesetsSetup.sol +3 -1
  198. package/test/units/static/JBRulesets/TestCurrentApprovalStatusForLatestRulesetOf.sol +9 -1
  199. package/test/units/static/JBRulesets/TestCurrentOf.sol +10 -1
  200. package/test/units/static/JBRulesets/TestGetRulesetOf.sol +7 -1
  201. package/test/units/static/JBRulesets/TestLatestQueuedRulesetOf.sol +9 -1
  202. package/test/units/static/JBRulesets/TestRulesets.sol +12 -1
  203. package/test/units/static/JBRulesets/TestRulesetsOf.sol +1 -1
  204. package/test/units/static/JBRulesets/TestUpcomingRulesetOf.sol +10 -1
  205. package/test/units/static/JBRulesets/TestUpdateRulesetWeightCache.sol +6 -1
  206. package/test/units/static/JBSplits/JBSplitsSetup.sol +3 -1
  207. package/test/units/static/JBSplits/TestSelfManagedSplitGroups.sol +63 -13
  208. package/test/units/static/JBSplits/TestSetSplitGroupsOf.sol +8 -1
  209. package/test/units/static/JBSplits/TestSplitsLockedEdge.sol +6 -1
  210. package/test/units/static/JBSplits/TestSplitsOf.sol +1 -1
  211. package/test/units/static/JBSplits/TestSplitsPacking.sol +5 -2
  212. package/test/units/static/JBSurplus/TestSurplusFuzz.sol +3 -1
  213. package/test/units/static/JBTerminalStore/JBTerminalStoreSetup.sol +5 -1
  214. package/test/units/static/JBTerminalStore/TestCurrentReclaimableSurplusOf.sol +14 -1
  215. package/test/units/static/JBTerminalStore/TestCurrentSurplusOf.sol +14 -1
  216. package/test/units/static/JBTerminalStore/TestCurrentTotalSurplusOf.sol +3 -1
  217. package/test/units/static/JBTerminalStore/TestRecordCashOutsFor.sol +92 -1
  218. package/test/units/static/JBTerminalStore/TestRecordPaymentFrom.sol +15 -1
  219. package/test/units/static/JBTerminalStore/TestRecordPayoutFor.sol +13 -1
  220. package/test/units/static/JBTerminalStore/TestRecordTerminalMigration.sol +8 -1
  221. package/test/units/static/JBTerminalStore/TestRecordUsedAllowanceOf.sol +16 -1
  222. package/test/units/static/JBTerminalStore/TestUint224Overflow.sol +15 -1
  223. package/test/units/static/JBTokens/JBTokensSetup.sol +5 -1
  224. package/test/units/static/JBTokens/TestBurnFrom.sol +4 -1
  225. package/test/units/static/JBTokens/TestClaimTokensFor.sol +4 -1
  226. package/test/units/static/JBTokens/TestDeployERC20ForUnits.sol +4 -1
  227. package/test/units/static/JBTokens/TestMintFor.sol +4 -1
  228. package/test/units/static/JBTokens/TestSetTokenFor.sol +4 -1
  229. package/test/units/static/JBTokens/TestTotalBalanceOf.sol +1 -1
  230. package/test/units/static/JBTokens/TestTotalSupplyOf.sol +1 -1
  231. package/test/units/static/JBTokens/TestTransferCreditsFrom.sol +3 -1
@@ -1,7 +1,24 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity >=0.8.6;
3
3
 
4
- import /* {*} from */ "./helpers/TestBaseWorkflow.sol";
4
+ import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
+ import {IJBController} from "../src/interfaces/IJBController.sol";
6
+ import {IJBPayHook} from "../src/interfaces/IJBPayHook.sol";
7
+ import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
8
+ import {IJBRulesetDataHook} from "../src/interfaces/IJBRulesetDataHook.sol";
9
+ import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
10
+ import {JBConstants} from "../src/libraries/JBConstants.sol";
11
+ import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
12
+ import {JBAfterPayRecordedContext} from "../src/structs/JBAfterPayRecordedContext.sol";
13
+ import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
14
+ import {JBPayHookSpecification} from "../src/structs/JBPayHookSpecification.sol";
15
+ import {JBRuleset} from "../src/structs/JBRuleset.sol";
16
+ import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
17
+ import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
18
+ import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
19
+ import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
20
+ import {JBTokenAmount} from "../src/structs/JBTokenAmount.sol";
21
+ import {mulDiv} from "@prb/math/src/Common.sol";
5
22
 
6
23
  contract TestPayHooks_Local is TestBaseWorkflow {
7
24
  uint8 private constant _WEIGHT_DECIMALS = 18;
@@ -118,25 +135,27 @@ contract TestPayHooks_Local is TestBaseWorkflow {
118
135
  bytes memory _hookMetadata = bytes("Some data hook metadata");
119
136
 
120
137
  // Package up the specification struct.
121
- _specifications[i] = JBPayHookSpecification(IJBPayHook(_hookAddress), _payHookAmounts[i], _hookMetadata);
138
+ _specifications[i] = JBPayHookSpecification({
139
+ hook: IJBPayHook(_hookAddress), amount: _payHookAmounts[i], metadata: _hookMetadata
140
+ });
122
141
 
123
142
  // Keep a reference to the data that'll be received by the hook.
124
143
  JBAfterPayRecordedContext memory _postRecordPayContext = JBAfterPayRecordedContext({
125
144
  payer: _payer,
126
145
  projectId: _projectId,
127
146
  rulesetId: _ruleset.id,
128
- amount: JBTokenAmount(
129
- JBConstants.NATIVE_TOKEN,
130
- _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
131
- _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
132
- _nativePayAmount
133
- ),
134
- forwardedAmount: JBTokenAmount(
135
- JBConstants.NATIVE_TOKEN,
136
- _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
137
- _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
138
- _payHookAmounts[i]
139
- ),
147
+ amount: JBTokenAmount({
148
+ token: JBConstants.NATIVE_TOKEN,
149
+ decimals: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
150
+ currency: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
151
+ value: _nativePayAmount
152
+ }),
153
+ forwardedAmount: JBTokenAmount({
154
+ token: JBConstants.NATIVE_TOKEN,
155
+ decimals: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).decimals,
156
+ currency: _terminal.accountingContextForTokenOf(_projectId, JBConstants.NATIVE_TOKEN).currency,
157
+ value: _payHookAmounts[i]
158
+ }),
140
159
  weight: _WEIGHT,
141
160
  newlyIssuedTokenCount: mulDiv(_nativePayAmount, _DATA_HOOK_WEIGHT, 10 ** _NATIVE_TOKEN_DECIMALS),
142
161
  beneficiary: _beneficiary,
@@ -1,7 +1,24 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.6;
3
3
 
4
- import /* {*} from */ "./helpers/TestBaseWorkflow.sol";
4
+ import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
+ import {MockERC20} from "./mock/MockERC20.sol";
6
+ import {JBPermissions} from "../src/JBPermissions.sol";
7
+ import {JBPermissioned} from "../src/abstract/JBPermissioned.sol";
8
+ import {IJBController} from "../src/interfaces/IJBController.sol";
9
+ import {IJBPermissions} from "../src/interfaces/IJBPermissions.sol";
10
+ import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
11
+ import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
12
+ import {IJBToken} from "../src/interfaces/IJBToken.sol";
13
+ import {JBConstants} from "../src/libraries/JBConstants.sol";
14
+ import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
15
+ import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
16
+ import {JBPermissionsData} from "../src/structs/JBPermissionsData.sol";
17
+ import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
18
+ import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
19
+ import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
20
+ import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
21
+ import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
5
22
 
6
23
  contract TestPermissions_Local is TestBaseWorkflow {
7
24
  IJBController private _controller;
@@ -135,6 +152,7 @@ contract TestPermissions_Local is TestBaseWorkflow {
135
152
  address _op,
136
153
  uint56 _projectId,
137
154
  uint8 _checkedId,
155
+ // forge-lint: disable-next-line(mixed-case-variable)
138
156
  uint8[] memory _set_permissions
139
157
  )
140
158
  public
@@ -143,6 +161,7 @@ contract TestPermissions_Local is TestBaseWorkflow {
143
161
  vm.assume(_set_permissions.length != 0);
144
162
  vm.assume(_account != trustedForwarder());
145
163
 
164
+ // forge-lint: disable-next-line(mixed-case-variable)
146
165
  uint256[] memory _check_permissions = new uint256[](1);
147
166
  _check_permissions[0] = _checkedId;
148
167
 
@@ -1,7 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.6;
3
3
 
4
- import /* {*} from */ "./helpers/TestBaseWorkflow.sol";
4
+ import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
+ import {JBPermissions} from "../src/JBPermissions.sol";
6
+ import {JBPermissionsData} from "../src/structs/JBPermissionsData.sol";
7
+ import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
5
8
 
6
9
  /// @notice Defense-in-depth validation of JBPermissions ROOT escalation prevention.
7
10
  /// Verifies that ROOT operators cannot forward ROOT, cannot set wildcard permissions,
@@ -231,6 +234,7 @@ contract TestPermissionsEdge_Local is TestBaseWorkflow {
231
234
  uint256 idx;
232
235
  for (uint256 i = 1; i < 256; i++) {
233
236
  if ((bitmap >> i) & 1 == 1) {
237
+ // forge-lint: disable-next-line(unsafe-typecast)
234
238
  ids[idx] = uint8(i);
235
239
  idx++;
236
240
  }
@@ -0,0 +1,360 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8.6;
3
+
4
+ import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
+ import {MetadataResolverHelper} from "./helpers/MetadataResolverHelper.sol";
6
+ import {IJBController} from "../src/interfaces/IJBController.sol";
7
+ import {IJBPrices} from "../src/interfaces/IJBPrices.sol";
8
+ import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
9
+ import {IJBRulesetDataHook} from "../src/interfaces/IJBRulesetDataHook.sol";
10
+ import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
11
+ import {IJBTokens} from "../src/interfaces/IJBTokens.sol";
12
+ import {JBConstants} from "../src/libraries/JBConstants.sol";
13
+ import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
14
+ import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
15
+ import {JBPayHookSpecification} from "../src/structs/JBPayHookSpecification.sol";
16
+ import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
17
+ import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
18
+ import {JBSingleAllowance} from "../src/structs/JBSingleAllowance.sol";
19
+ import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
20
+ import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
21
+ import {IAllowanceTransfer, IPermit2} from "@uniswap/permit2/src/interfaces/IPermit2.sol";
22
+ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
23
+ import {MockPriceFeed} from "./mock/MockPriceFeed.sol";
24
+ import {mulDiv} from "@prb/math/src/Common.sol";
25
+
26
+ /// @notice Tests combining Permit2 ERC-20 transfers with data hook weight overrides.
27
+ contract TestPermit2DataHook_Local is TestBaseWorkflow {
28
+ uint112 private constant _WEIGHT = uint112(1000 * 10 ** 18);
29
+ address private constant _DATA_HOOK = address(bytes20(keccak256("permit2datahook")));
30
+
31
+ IJBController private _controller;
32
+ IJBTerminal private _terminal;
33
+ IJBPrices private _prices;
34
+ IJBTokens private _tokens;
35
+ IERC20 private _usdc;
36
+ IPermit2 private _permit2;
37
+ MetadataResolverHelper private _helper;
38
+ address private _projectOwner;
39
+
40
+ uint256 _projectId;
41
+
42
+ // Permit2 params.
43
+ // forge-lint: disable-next-line(mixed-case-variable)
44
+ bytes32 DOMAIN_SEPARATOR;
45
+ address from;
46
+ uint256 fromPrivateKey;
47
+
48
+ // Price.
49
+ uint256 _nativePricePerUsd = 0.0005 * 10 ** 18; // 1/2000
50
+
51
+ function setUp() public override {
52
+ super.setUp();
53
+
54
+ vm.label(_DATA_HOOK, "Data Hook");
55
+
56
+ _controller = jbController();
57
+ _projectOwner = multisig();
58
+ _terminal = jbMultiTerminal();
59
+ _prices = jbPrices();
60
+ _tokens = jbTokens();
61
+ _helper = metadataHelper();
62
+ _usdc = usdcToken();
63
+ _permit2 = permit2();
64
+
65
+ fromPrivateKey = 0x12341234;
66
+ from = vm.addr(fromPrivateKey);
67
+ DOMAIN_SEPARATOR = permit2().DOMAIN_SEPARATOR();
68
+
69
+ // First project: fee collector with data hook disabled.
70
+ JBRulesetMetadata memory _feeMetadata = JBRulesetMetadata({
71
+ reservedPercent: 0,
72
+ cashOutTaxRate: JBConstants.MAX_CASH_OUT_TAX_RATE,
73
+ baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
74
+ pausePay: false,
75
+ pauseCreditTransfers: false,
76
+ allowOwnerMinting: true,
77
+ allowSetCustomToken: true,
78
+ allowTerminalMigration: false,
79
+ allowSetTerminals: false,
80
+ ownerMustSendPayouts: false,
81
+ allowSetController: false,
82
+ allowAddAccountingContext: true,
83
+ allowAddPriceFeed: true,
84
+ holdFees: false,
85
+ useTotalSurplusForCashOuts: false,
86
+ useDataHookForPay: false,
87
+ useDataHookForCashOut: false,
88
+ dataHook: address(0),
89
+ metadata: 0
90
+ });
91
+
92
+ JBRulesetConfig[] memory _feeRulesetConfig = new JBRulesetConfig[](1);
93
+ _feeRulesetConfig[0].mustStartAtOrAfter = 0;
94
+ _feeRulesetConfig[0].duration = 0;
95
+ _feeRulesetConfig[0].weight = _WEIGHT;
96
+ _feeRulesetConfig[0].weightCutPercent = 0;
97
+ _feeRulesetConfig[0].approvalHook = IJBRulesetApprovalHook(address(0));
98
+ _feeRulesetConfig[0].metadata = _feeMetadata;
99
+ _feeRulesetConfig[0].splitGroups = new JBSplitGroup[](0);
100
+ _feeRulesetConfig[0].fundAccessLimitGroups = new JBFundAccessLimitGroup[](0);
101
+
102
+ JBTerminalConfig[] memory _terminalConfigurations = new JBTerminalConfig[](1);
103
+ JBAccountingContext[] memory _tokensToAccept = new JBAccountingContext[](2);
104
+ _tokensToAccept[0] = JBAccountingContext({
105
+ token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
106
+ });
107
+ _tokensToAccept[1] = JBAccountingContext({
108
+ token: address(usdcToken()), decimals: 6, currency: uint32(uint160(address(usdcToken())))
109
+ });
110
+ _terminalConfigurations[0] =
111
+ JBTerminalConfig({terminal: _terminal, accountingContextsToAccept: _tokensToAccept});
112
+
113
+ // Create fee project (project ID 1).
114
+ _controller.launchProjectFor({
115
+ owner: _projectOwner,
116
+ projectUri: "feeProject",
117
+ rulesetConfigurations: _feeRulesetConfig,
118
+ terminalConfigurations: _terminalConfigurations,
119
+ memo: ""
120
+ });
121
+
122
+ // Second project: data hook enabled for pay, uses USDC via Permit2.
123
+ JBRulesetMetadata memory _metadata = JBRulesetMetadata({
124
+ reservedPercent: 0,
125
+ cashOutTaxRate: JBConstants.MAX_CASH_OUT_TAX_RATE,
126
+ baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
127
+ pausePay: false,
128
+ pauseCreditTransfers: false,
129
+ allowOwnerMinting: true,
130
+ allowSetCustomToken: true,
131
+ allowTerminalMigration: false,
132
+ allowSetTerminals: false,
133
+ ownerMustSendPayouts: false,
134
+ allowSetController: false,
135
+ allowAddAccountingContext: true,
136
+ allowAddPriceFeed: true,
137
+ holdFees: false,
138
+ useTotalSurplusForCashOuts: false,
139
+ useDataHookForPay: true,
140
+ useDataHookForCashOut: false,
141
+ dataHook: _DATA_HOOK,
142
+ metadata: 0
143
+ });
144
+
145
+ JBRulesetConfig[] memory _rulesetConfig = new JBRulesetConfig[](1);
146
+ _rulesetConfig[0].mustStartAtOrAfter = 0;
147
+ _rulesetConfig[0].duration = 0;
148
+ _rulesetConfig[0].weight = _WEIGHT;
149
+ _rulesetConfig[0].weightCutPercent = 0;
150
+ _rulesetConfig[0].approvalHook = IJBRulesetApprovalHook(address(0));
151
+ _rulesetConfig[0].metadata = _metadata;
152
+ _rulesetConfig[0].splitGroups = new JBSplitGroup[](0);
153
+ _rulesetConfig[0].fundAccessLimitGroups = new JBFundAccessLimitGroup[](0);
154
+
155
+ _projectId = _controller.launchProjectFor({
156
+ owner: _projectOwner,
157
+ projectUri: "permit2DataHookProject",
158
+ rulesetConfigurations: _rulesetConfig,
159
+ terminalConfigurations: _terminalConfigurations,
160
+ memo: ""
161
+ });
162
+
163
+ vm.startPrank(_projectOwner);
164
+ MockPriceFeed _priceFeedNativeUsd = new MockPriceFeed(_nativePricePerUsd, 18);
165
+ vm.label(address(_priceFeedNativeUsd), "Mock Price Feed Native-USD");
166
+
167
+ _controller.addPriceFeed({
168
+ projectId: _projectId,
169
+ pricingCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
170
+ unitCurrency: uint32(uint160(address(usdcToken()))),
171
+ feed: _priceFeedNativeUsd
172
+ });
173
+
174
+ vm.stopPrank();
175
+ }
176
+
177
+ /// @notice Builds Permit2 metadata for the given coin amount and nonce.
178
+ function _buildPermit2Metadata(uint256 coins, uint48 nonce) internal view returns (bytes memory packedData) {
179
+ uint256 deadline = block.timestamp + 1 days;
180
+ // forge-lint: disable-next-line(unsafe-typecast)
181
+ uint48 expiration = uint48(block.timestamp + 1 days);
182
+
183
+ IAllowanceTransfer.PermitDetails memory details = IAllowanceTransfer.PermitDetails({
184
+ token: address(_usdc),
185
+ // forge-lint: disable-next-line(unsafe-typecast)
186
+ amount: uint160(coins),
187
+ expiration: expiration,
188
+ nonce: nonce
189
+ });
190
+
191
+ IAllowanceTransfer.PermitSingle memory permitSingle =
192
+ IAllowanceTransfer.PermitSingle({details: details, spender: address(_terminal), sigDeadline: deadline});
193
+
194
+ bytes memory sig = getPermitSignature(permitSingle, fromPrivateKey, DOMAIN_SEPARATOR);
195
+
196
+ JBSingleAllowance memory permitData = JBSingleAllowance({
197
+ sigDeadline: deadline,
198
+ // forge-lint: disable-next-line(unsafe-typecast)
199
+ amount: uint160(coins),
200
+ expiration: expiration,
201
+ nonce: nonce,
202
+ signature: sig
203
+ });
204
+
205
+ bytes4[] memory ids = new bytes4[](1);
206
+ bytes[] memory datas = new bytes[](1);
207
+ datas[0] = abi.encode(permitData);
208
+ ids[0] = _helper.getId("permit2", address(_terminal));
209
+
210
+ packedData = _helper.createMetadata(ids, datas);
211
+ }
212
+
213
+ /// @notice Pay via Permit2 with a data hook that returns the original weight -- tokens should match normal
214
+ /// issuance.
215
+ function test_permit2_withDataHook_paySucceeds() public {
216
+ uint256 _coins = 1_000_000; // 1 USDC (6 decimals)
217
+
218
+ // Data hook returns the original weight and empty hook specifications.
219
+ JBPayHookSpecification[] memory _emptySpecs = new JBPayHookSpecification[](0);
220
+ vm.mockCall(
221
+ _DATA_HOOK,
222
+ abi.encodeWithSelector(IJBRulesetDataHook.beforePayRecordedWith.selector),
223
+ abi.encode(uint256(_WEIGHT), _emptySpecs)
224
+ );
225
+
226
+ // Build Permit2 metadata.
227
+ bytes memory _packedData = _buildPermit2Metadata(_coins, 0);
228
+
229
+ // Setup: give coins and approve permit2 contract.
230
+ deal(address(_usdc), from, _coins);
231
+ vm.prank(from);
232
+ IERC20(address(_usdc)).approve(address(permit2()), _coins);
233
+
234
+ // Pay using Permit2 with data hook.
235
+ vm.prank(from);
236
+ uint256 _minted = _terminal.pay({
237
+ projectId: _projectId,
238
+ amount: _coins,
239
+ token: address(_usdc),
240
+ beneficiary: from,
241
+ minReturnedTokens: 0,
242
+ memo: "Permit2 + data hook",
243
+ metadata: _packedData
244
+ });
245
+
246
+ // Check: tokens were transferred.
247
+ assertEq(_usdc.balanceOf(address(_terminal)), _coins, "terminal should hold the USDC");
248
+
249
+ // Check: payer receives project tokens.
250
+ assertEq(_tokens.totalBalanceOf(from, _projectId), _minted, "payer should have minted tokens");
251
+
252
+ // Check: minted amount matches expected calculation.
253
+ // The baseCurrency is NATIVE_TOKEN (ETH), so USDC amounts get converted via price feed.
254
+ // 1 USDC = 0.0005 ETH (from _nativePricePerUsd). So 1e6 USDC = 0.0005e18 = 5e14 ETH.
255
+ // Token count = ethEquivalent * weight / 10^18
256
+ // ethEquivalent = _coins * 10^12 (6->18 decimals) * _nativePricePerUsd / 10^18
257
+ uint256 adjustedAmount = _coins * 10 ** 12; // adjust from 6 to 18 decimals
258
+ uint256 ethEquivalent = mulDiv(adjustedAmount, _nativePricePerUsd, 10 ** 18);
259
+ uint256 expectedTokens = mulDiv(ethEquivalent, _WEIGHT, 10 ** 18);
260
+ assertEq(_minted, expectedTokens, "minted tokens should match weight calculation");
261
+ }
262
+
263
+ /// @notice Pay via Permit2 with a data hook that modifies the weight (2x) -- tokens should reflect the modified
264
+ /// weight.
265
+ function test_permit2_withDataHook_hookModifiesWeight() public {
266
+ uint256 _coins = 500_000; // 0.5 USDC (6 decimals)
267
+
268
+ // Data hook returns 2x the original weight.
269
+ uint256 _modifiedWeight = uint256(_WEIGHT) * 2;
270
+ JBPayHookSpecification[] memory _emptySpecs = new JBPayHookSpecification[](0);
271
+ vm.mockCall(
272
+ _DATA_HOOK,
273
+ abi.encodeWithSelector(IJBRulesetDataHook.beforePayRecordedWith.selector),
274
+ abi.encode(_modifiedWeight, _emptySpecs)
275
+ );
276
+
277
+ // Build Permit2 metadata.
278
+ bytes memory _packedData = _buildPermit2Metadata(_coins, 0);
279
+
280
+ // Setup: give coins and approve permit2 contract.
281
+ deal(address(_usdc), from, _coins);
282
+ vm.prank(from);
283
+ IERC20(address(_usdc)).approve(address(permit2()), _coins);
284
+
285
+ // Pay using Permit2 with data hook.
286
+ vm.prank(from);
287
+ uint256 _minted = _terminal.pay({
288
+ projectId: _projectId,
289
+ amount: _coins,
290
+ token: address(_usdc),
291
+ beneficiary: from,
292
+ minReturnedTokens: 0,
293
+ memo: "Permit2 + modified weight",
294
+ metadata: _packedData
295
+ });
296
+
297
+ // Check: correct ERC-20 amount transferred via Permit2.
298
+ assertEq(_usdc.balanceOf(address(_terminal)), _coins, "terminal should hold the USDC");
299
+
300
+ // Check: tokens minted matches the MODIFIED weight (2x), not the original.
301
+ // USDC amounts are converted to ETH via price feed before token calculation.
302
+ // 500_000 USDC (0.5 USDC) = 0.00025 ETH = 2.5e14 at 18 decimals.
303
+ // Token count = ethEquivalent * modifiedWeight / 10^18
304
+ uint256 adjustedAmount = _coins * 10 ** 12; // adjust from 6 to 18 decimals
305
+ uint256 ethEquivalent = mulDiv(adjustedAmount, _nativePricePerUsd, 10 ** 18);
306
+ uint256 expectedTokens = mulDiv(ethEquivalent, _modifiedWeight, 10 ** 18);
307
+ assertEq(_minted, expectedTokens, "minted tokens should match 2x modified weight");
308
+
309
+ // Check: payer balance matches.
310
+ assertEq(_tokens.totalBalanceOf(from, _projectId), _minted, "payer should have all minted tokens");
311
+ }
312
+
313
+ /// Permit2 signature helpers.
314
+ /// (required because `permit2/test/utils/PermitSignature.sol` imports `draft-EIP712.sol` which is no longer a
315
+ /// draft.)
316
+
317
+ bytes32 public constant _PERMIT_DETAILS_TYPEHASH =
318
+ keccak256("PermitDetails(address token,uint160 amount,uint48 expiration,uint48 nonce)");
319
+
320
+ bytes32 public constant _PERMIT_SINGLE_TYPEHASH = keccak256(
321
+ "PermitSingle(PermitDetails details,address spender,uint256 sigDeadline)PermitDetails(address token,uint160 amount,uint48 expiration,uint48 nonce)"
322
+ );
323
+
324
+ function getPermitSignatureRaw(
325
+ IAllowanceTransfer.PermitSingle memory permitSingle,
326
+ uint256 privateKey,
327
+ bytes32 domainSeparator
328
+ )
329
+ internal
330
+ pure
331
+ returns (uint8 v, bytes32 r, bytes32 s)
332
+ {
333
+ bytes32 permitHash = keccak256(abi.encode(_PERMIT_DETAILS_TYPEHASH, permitSingle.details));
334
+
335
+ bytes32 msgHash = keccak256(
336
+ abi.encodePacked(
337
+ "\x19\x01",
338
+ domainSeparator,
339
+ keccak256(
340
+ abi.encode(_PERMIT_SINGLE_TYPEHASH, permitHash, permitSingle.spender, permitSingle.sigDeadline)
341
+ )
342
+ )
343
+ );
344
+
345
+ (v, r, s) = vm.sign(privateKey, msgHash);
346
+ }
347
+
348
+ function getPermitSignature(
349
+ IAllowanceTransfer.PermitSingle memory permitSingle,
350
+ uint256 privateKey,
351
+ bytes32 domainSeparator
352
+ )
353
+ internal
354
+ pure
355
+ returns (bytes memory sig)
356
+ {
357
+ (uint8 v, bytes32 r, bytes32 s) = getPermitSignatureRaw(permitSingle, privateKey, domainSeparator);
358
+ return bytes.concat(r, s, bytes1(v));
359
+ }
360
+ }
@@ -1,7 +1,23 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity >=0.8.6;
3
3
 
4
- import /* {*} from */ "./helpers/TestBaseWorkflow.sol";
4
+ import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
+ import {MetadataResolverHelper} from "./helpers/MetadataResolverHelper.sol";
6
+ import {JBMultiTerminal} from "../src/JBMultiTerminal.sol";
7
+ import {IJBController} from "../src/interfaces/IJBController.sol";
8
+ import {IJBPrices} from "../src/interfaces/IJBPrices.sol";
9
+ import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
10
+ import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
11
+ import {IJBTokens} from "../src/interfaces/IJBTokens.sol";
12
+ import {JBConstants} from "../src/libraries/JBConstants.sol";
13
+ import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
14
+ import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
15
+ import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
16
+ import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
17
+ import {JBSingleAllowance} from "../src/structs/JBSingleAllowance.sol";
18
+ import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
19
+ import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
20
+ import {IAllowanceTransfer, IPermit2} from "@uniswap/permit2/src/interfaces/IPermit2.sol";
5
21
  import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
6
22
  import {MockPriceFeed} from "./mock/MockPriceFeed.sol";
7
23
 
@@ -20,6 +36,7 @@ contract TestPermit2Terminal_Local is TestBaseWorkflow {
20
36
  uint256 _projectId;
21
37
 
22
38
  // Permit2 params.
39
+ // forge-lint: disable-next-line(mixed-case-variable)
23
40
  bytes32 DOMAIN_SEPARATOR;
24
41
  address from;
25
42
  uint256 fromPrivateKey;
@@ -126,7 +143,13 @@ contract TestPermit2Terminal_Local is TestBaseWorkflow {
126
143
 
127
144
  // Setup: prepare permit details for signing.
128
145
  IAllowanceTransfer.PermitDetails memory details = IAllowanceTransfer.PermitDetails({
129
- token: address(_usdc), amount: uint160(_coins), expiration: uint48(_expiration), nonce: 0
146
+ // forge-lint: disable-next-line(unsafe-typecast)
147
+ token: address(_usdc),
148
+ // forge-lint: disable-next-line(unsafe-typecast)
149
+ amount: uint160(_coins),
150
+ // forge-lint: disable-next-line(unsafe-typecast)
151
+ expiration: uint48(_expiration),
152
+ nonce: 0
130
153
  });
131
154
 
132
155
  IAllowanceTransfer.PermitSingle memory permit =
@@ -137,7 +160,9 @@ contract TestPermit2Terminal_Local is TestBaseWorkflow {
137
160
 
138
161
  JBSingleAllowance memory permitData = JBSingleAllowance({
139
162
  sigDeadline: _deadline,
163
+ // forge-lint: disable-next-line(unsafe-typecast)
140
164
  amount: uint160(_coins),
165
+ // forge-lint: disable-next-line(unsafe-typecast)
141
166
  expiration: uint48(_expiration),
142
167
  nonce: uint48(0),
143
168
  signature: sig
@@ -191,7 +216,13 @@ contract TestPermit2Terminal_Local is TestBaseWorkflow {
191
216
 
192
217
  // Setup: prepare permit details for signing.
193
218
  IAllowanceTransfer.PermitDetails memory details = IAllowanceTransfer.PermitDetails({
194
- token: address(_usdc), amount: uint160(_coins), expiration: uint48(_expiration), nonce: 0
219
+ // forge-lint: disable-next-line(unsafe-typecast)
220
+ token: address(_usdc),
221
+ // forge-lint: disable-next-line(unsafe-typecast)
222
+ amount: uint160(_coins),
223
+ // forge-lint: disable-next-line(unsafe-typecast)
224
+ expiration: uint48(_expiration),
225
+ nonce: 0
195
226
  });
196
227
 
197
228
  IAllowanceTransfer.PermitSingle memory permit =
@@ -202,7 +233,9 @@ contract TestPermit2Terminal_Local is TestBaseWorkflow {
202
233
 
203
234
  JBSingleAllowance memory permitData = JBSingleAllowance({
204
235
  sigDeadline: _deadline,
236
+ // forge-lint: disable-next-line(unsafe-typecast)
205
237
  amount: uint160(_coins),
238
+ // forge-lint: disable-next-line(unsafe-typecast)
206
239
  expiration: uint48(_expiration),
207
240
  nonce: uint48(0),
208
241
  signature: sig
@@ -1,7 +1,22 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.6;
3
3
 
4
- import /* {*} from */ "./helpers/TestBaseWorkflow.sol";
4
+ import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
+ import {JBController} from "../src/JBController.sol";
6
+ import {JBDeadline} from "../src/JBDeadline.sol";
7
+ import {JBRulesets} from "../src/JBRulesets.sol";
8
+ import {JBApprovalStatus} from "../src/enums/JBApprovalStatus.sol";
9
+ import {IJBController} from "../src/interfaces/IJBController.sol";
10
+ import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
11
+ import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
12
+ import {JBConstants} from "../src/libraries/JBConstants.sol";
13
+ import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
14
+ import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
15
+ import {JBRuleset} from "../src/structs/JBRuleset.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
  // A project's rulesets can be queued, and re-queued as long as the current ruleset approval hook approves.
7
22
  contract TestRulesetQueuing_Local is TestBaseWorkflow {
@@ -13,8 +28,11 @@ contract TestRulesetQueuing_Local is TestBaseWorkflow {
13
28
  IJBTerminal private _terminal;
14
29
  uint112 private _weight;
15
30
 
31
+ // forge-lint: disable-next-line(mixed-case-variable)
16
32
  uint256 private _DEADLINE_DURATION = 3 days;
33
+ // forge-lint: disable-next-line(mixed-case-variable)
17
34
  uint256 private _RULESET_DURATION_DAYS = 6;
35
+ // forge-lint: disable-next-line(unsafe-typecast, mixed-case-variable)
18
36
  uint32 private _RULESET_DURATION = uint32(_RULESET_DURATION_DAYS * 1 days);
19
37
 
20
38
  function setUp() public override {
@@ -779,6 +797,7 @@ contract TestRulesetQueuing_Local is TestBaseWorkflow {
779
797
  // Package up another config to overwrite.
780
798
  JBRulesetConfig[] memory _secondQueued = new JBRulesetConfig[](1);
781
799
 
800
+ // forge-lint: disable-next-line(unsafe-typecast)
782
801
  _secondQueued[0].mustStartAtOrAfter = uint48(block.timestamp + _DEADLINE_DURATION);
783
802
  _secondQueued[0].duration = _RULESET_DURATION;
784
803
  _secondQueued[0].weight = _weightSecondQueued;
@@ -805,10 +824,13 @@ contract TestRulesetQueuing_Local is TestBaseWorkflow {
805
824
  _duration = bound(_duration, 1, block.timestamp);
806
825
 
807
826
  JBRuleset memory _ruleset = JBRuleset({
827
+ // forge-lint: disable-next-line(unsafe-typecast)
808
828
  id: uint48(_rulesetId),
809
829
  basedOnId: 0,
810
830
  cycleNumber: 1,
831
+ // forge-lint: disable-next-line(unsafe-typecast)
811
832
  start: uint48(_start),
833
+ // forge-lint: disable-next-line(unsafe-typecast)
812
834
  duration: uint32(_duration),
813
835
  weight: 1,
814
836
  weightCutPercent: 0,