@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,26 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTerminalStore} from "../../../../src/JBTerminalStore.sol";
5
+ import {IJBCashOutHook} from "../../../../src/interfaces/IJBCashOutHook.sol";
6
+ import {IJBController} from "../../../../src/interfaces/IJBController.sol";
7
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
8
+ import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
9
+ import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
10
+ import {IJBRulesetDataHook} from "../../../../src/interfaces/IJBRulesetDataHook.sol";
11
+ import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
12
+ import {IJBTerminal} from "../../../../src/interfaces/IJBTerminal.sol";
13
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
14
+ import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
15
+ import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
16
+ import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
17
+ import {JBBeforeCashOutRecordedContext} from "../../../../src/structs/JBBeforeCashOutRecordedContext.sol";
18
+ import {JBCashOutHookSpecification} from "../../../../src/structs/JBCashOutHookSpecification.sol";
19
+ import {JBCurrencyAmount} from "../../../../src/structs/JBCurrencyAmount.sol";
20
+ import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
21
+ import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
22
+ import {JBTokenAmount} from "../../../../src/structs/JBTokenAmount.sol";
23
+ import {mulDiv} from "@prb/math/src/Common.sol";
5
24
  import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
6
25
 
7
26
  contract TestRecordCashOutsFor_Local is JBTerminalStoreSetup {
@@ -317,6 +336,7 @@ contract TestRecordCashOutsFor_Local is JBTerminalStoreSetup {
317
336
  cashOutCount: _cashOutCount,
318
337
  accountingContext: _accountingContexts,
319
338
  balanceAccountingContexts: _balanceContexts,
339
+ beneficiaryIsFeeless: false,
320
340
  metadata: ""
321
341
  });
322
342
  }
@@ -350,6 +370,7 @@ contract TestRecordCashOutsFor_Local is JBTerminalStoreSetup {
350
370
  cashOutCount: _cashOutCount,
351
371
  accountingContext: _accountingContexts,
352
372
  balanceAccountingContexts: _balanceContexts,
373
+ beneficiaryIsFeeless: false,
353
374
  metadata: ""
354
375
  });
355
376
 
@@ -401,6 +422,7 @@ contract TestRecordCashOutsFor_Local is JBTerminalStoreSetup {
401
422
  surplus: _reclaimedTokenAmount,
402
423
  useTotalSurplus: true,
403
424
  cashOutTaxRate: 0,
425
+ beneficiaryIsFeeless: false,
404
426
  metadata: ""
405
427
  });
406
428
 
@@ -423,6 +445,7 @@ contract TestRecordCashOutsFor_Local is JBTerminalStoreSetup {
423
445
  cashOutCount: _cashOutCount,
424
446
  accountingContext: _accountingContexts,
425
447
  balanceAccountingContexts: _balanceContexts,
448
+ beneficiaryIsFeeless: false,
426
449
  metadata: ""
427
450
  });
428
451
 
@@ -468,10 +491,78 @@ contract TestRecordCashOutsFor_Local is JBTerminalStoreSetup {
468
491
  cashOutCount: _cashOutCount,
469
492
  accountingContext: _accountingContexts,
470
493
  balanceAccountingContexts: _balanceContexts,
494
+ beneficiaryIsFeeless: false,
471
495
  metadata: ""
472
496
  });
473
497
  }
474
498
 
499
+ function test_GivenBeneficiaryIsFeeless_DataHookReceivesTrue()
500
+ external
501
+ whenCurrentRulesetUseTotalSurplusForCashOutsEqTrueWithHook
502
+ {
503
+ // it will pass beneficiaryIsFeeless=true through to the data hook context
504
+
505
+ // mock JBController totalTokenSupplyWithReservedTokensOf
506
+ mockExpect(
507
+ address(_controller),
508
+ abi.encodeCall(IJBController.totalTokenSupplyWithReservedTokensOf, (_projectId)),
509
+ abi.encode(_totalSupply)
510
+ );
511
+
512
+ // call params
513
+ JBAccountingContext memory _accountingContexts =
514
+ JBAccountingContext({token: address(_token), decimals: 18, currency: _currency});
515
+ JBAccountingContext[] memory _balanceContexts = new JBAccountingContext[](1);
516
+
517
+ _balanceContexts[0] = JBAccountingContext({token: address(_token), decimals: 18, currency: _currency});
518
+
519
+ uint256 _cashOutCount = 1e18;
520
+ uint256 expectedCashOuts = mulDiv(3e18, _cashOutCount, _totalSupply);
521
+
522
+ // Create the expected context — beneficiaryIsFeeless should be true.
523
+ JBBeforeCashOutRecordedContext memory _context = JBBeforeCashOutRecordedContext({
524
+ terminal: address(this),
525
+ holder: address(this),
526
+ projectId: _projectId,
527
+ rulesetId: uint48(block.timestamp),
528
+ cashOutCount: _cashOutCount,
529
+ totalSupply: _totalSupply,
530
+ surplus: JBTokenAmount({
531
+ token: _accountingContexts.token,
532
+ value: 3e18,
533
+ decimals: _accountingContexts.decimals,
534
+ currency: _accountingContexts.currency
535
+ }),
536
+ useTotalSurplus: true,
537
+ cashOutTaxRate: 0,
538
+ beneficiaryIsFeeless: true,
539
+ metadata: ""
540
+ });
541
+
542
+ // return data
543
+ JBCashOutHookSpecification[] memory _spec = new JBCashOutHookSpecification[](1);
544
+ _spec[0] = JBCashOutHookSpecification({hook: _cashOutHook, amount: 0, metadata: ""});
545
+
546
+ // The mock will only match if the context has beneficiaryIsFeeless=true.
547
+ mockExpect(
548
+ address(_dataHook),
549
+ abi.encodeCall(IJBRulesetDataHook.beforeCashOutRecordedWith, (_context)),
550
+ abi.encode(0, 1e18, _totalSupply, _spec)
551
+ );
552
+
553
+ (, uint256 reclaimed,,) = _store.recordCashOutFor({
554
+ holder: address(this),
555
+ projectId: _projectId,
556
+ cashOutCount: _cashOutCount,
557
+ accountingContext: _accountingContexts,
558
+ balanceAccountingContexts: _balanceContexts,
559
+ beneficiaryIsFeeless: true,
560
+ metadata: ""
561
+ });
562
+
563
+ assertEq(expectedCashOuts, reclaimed);
564
+ }
565
+
475
566
  // Probably unnecessary even though it may give us a bit of cov %.. skipping for now
476
567
  /* function test_WhenTheCurrentRulesetUseTotalSurplusForCashOutsEqFalse() external {
477
568
  // it will use the standard surplus calculation
@@ -1,7 +1,21 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTerminalStore} from "../../../../src/JBTerminalStore.sol";
5
+ import {IJBPayHook} from "../../../../src/interfaces/IJBPayHook.sol";
6
+ import {IJBPrices} from "../../../../src/interfaces/IJBPrices.sol";
7
+ import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
8
+ import {IJBRulesetDataHook} from "../../../../src/interfaces/IJBRulesetDataHook.sol";
9
+ import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
10
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
11
+ import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
12
+ import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
13
+ import {JBBeforePayRecordedContext} from "../../../../src/structs/JBBeforePayRecordedContext.sol";
14
+ import {JBPayHookSpecification} from "../../../../src/structs/JBPayHookSpecification.sol";
15
+ import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
16
+ import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
17
+ import {JBTokenAmount} from "../../../../src/structs/JBTokenAmount.sol";
18
+ import {mulDiv} from "@prb/math/src/Common.sol";
5
19
  import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
6
20
 
7
21
  contract TestRecordPaymentFrom_Local is JBTerminalStoreSetup {
@@ -1,7 +1,19 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTerminalStore} from "../../../../src/JBTerminalStore.sol";
5
+ import {IJBController} from "../../../../src/interfaces/IJBController.sol";
6
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
7
+ import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
8
+ import {IJBPrices} from "../../../../src/interfaces/IJBPrices.sol";
9
+ import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
10
+ import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
11
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
12
+ import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
13
+ import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
14
+ import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
15
+ import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
16
+ import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
5
17
  import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
6
18
 
7
19
  contract TestRecordPayoutFor_Local is JBTerminalStoreSetup {
@@ -1,7 +1,14 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTerminalStore} from "../../../../src/JBTerminalStore.sol";
5
+ import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
6
+ import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
7
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
8
+ import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
9
+ import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
10
+ import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
11
+ import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
5
12
  import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
6
13
 
7
14
  contract TestRecordTerminalMigration_Local is JBTerminalStoreSetup {
@@ -1,7 +1,20 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTerminalStore} from "../../../../src/JBTerminalStore.sol";
5
+ import {IJBController} from "../../../../src/interfaces/IJBController.sol";
6
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
7
+ import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
8
+ import {IJBPrices} from "../../../../src/interfaces/IJBPrices.sol";
9
+ import {IJBRulesetApprovalHook} from "../../../../src/interfaces/IJBRulesetApprovalHook.sol";
10
+ import {IJBRulesets} from "../../../../src/interfaces/IJBRulesets.sol";
11
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
12
+ import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
13
+ import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
14
+ import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
15
+ import {JBCurrencyAmount} from "../../../../src/structs/JBCurrencyAmount.sol";
16
+ import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
17
+ import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
5
18
  import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
6
19
 
7
20
  contract TestRecordUsedAllowanceOf_Local is JBTerminalStoreSetup {
@@ -42,6 +55,7 @@ contract TestRecordUsedAllowanceOf_Local is JBTerminalStoreSetup {
42
55
  JBRulesetMetadata memory _metadata = JBRulesetMetadata({
43
56
  reservedPercent: 0,
44
57
  cashOutTaxRate: JBConstants.MAX_CASH_OUT_TAX_RATE,
58
+ // forge-lint: disable-next-line(unsafe-typecast)
45
59
  baseCurrency: uint32(uint160(_nativeAddress)),
46
60
  pausePay: false,
47
61
  pauseCreditTransfers: false,
@@ -144,6 +158,7 @@ contract TestRecordUsedAllowanceOf_Local is JBTerminalStoreSetup {
144
158
  JBRulesetMetadata memory _metadata = JBRulesetMetadata({
145
159
  reservedPercent: 0,
146
160
  cashOutTaxRate: JBConstants.MAX_CASH_OUT_TAX_RATE,
161
+ // forge-lint: disable-next-line(unsafe-typecast)
147
162
  baseCurrency: uint32(uint160(_nativeAddress)),
148
163
  pausePay: false,
149
164
  pauseCreditTransfers: false,
@@ -1,7 +1,21 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTerminalStore} from "../../../../src/JBTerminalStore.sol";
5
+ import {IJBController} from "../../../../src/interfaces/IJBController.sol";
6
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
7
+ import {IJBFundAccessLimits} from "../../../../src/interfaces/IJBFundAccessLimits.sol";
8
+ import {IJBPrices} from "../../../../src/interfaces/IJBPrices.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 {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
13
+ import {JBConstants} from "../../../../src/libraries/JBConstants.sol";
14
+ import {JBRulesetMetadataResolver} from "../../../../src/libraries/JBRulesetMetadataResolver.sol";
15
+ import {JBAccountingContext} from "../../../../src/structs/JBAccountingContext.sol";
16
+ import {JBCurrencyAmount} from "../../../../src/structs/JBCurrencyAmount.sol";
17
+ import {JBRuleset} from "../../../../src/structs/JBRuleset.sol";
18
+ import {JBRulesetMetadata} from "../../../../src/structs/JBRulesetMetadata.sol";
5
19
  import {JBTerminalStoreSetup} from "./JBTerminalStoreSetup.sol";
6
20
 
7
21
  contract TestUint224Overflow_Local is JBTerminalStoreSetup {
@@ -1,7 +1,11 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBERC20} from "../../../../src/JBERC20.sol";
5
+ import {JBTokens} from "../../../../src/JBTokens.sol";
6
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
7
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
8
+ import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
5
9
  import {JBTest} from "../../../helpers/JBTest.sol";
6
10
 
7
11
  /*
@@ -1,7 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTokens} from "../../../../src/JBTokens.sol";
5
+ import {JBControlled} from "../../../../src/abstract/JBControlled.sol";
6
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
7
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
5
8
  import {JBTokensSetup} from "./JBTokensSetup.sol";
6
9
 
7
10
  contract TestBurnFrom_Local is JBTokensSetup {
@@ -1,7 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTokens} from "../../../../src/JBTokens.sol";
5
+ import {JBControlled} from "../../../../src/abstract/JBControlled.sol";
6
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
7
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
5
8
  import {JBTokensSetup} from "./JBTokensSetup.sol";
6
9
 
7
10
  contract TestClaimTokensFor_Local is JBTokensSetup {
@@ -1,7 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTokens} from "../../../../src/JBTokens.sol";
5
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
6
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
7
+ import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
5
8
  import {JBTokensSetup} from "./JBTokensSetup.sol";
6
9
  import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
7
10
 
@@ -1,7 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTokens} from "../../../../src/JBTokens.sol";
5
+ import {JBControlled} from "../../../../src/abstract/JBControlled.sol";
6
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
7
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
5
8
  import {JBTokensSetup} from "./JBTokensSetup.sol";
6
9
 
7
10
  contract TestMintFor_Local is JBTokensSetup {
@@ -1,7 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTokens} from "../../../../src/JBTokens.sol";
5
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
6
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
7
+ import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
5
8
  import {JBTokensSetup} from "./JBTokensSetup.sol";
6
9
 
7
10
  contract TestSetTokenFor_Local is JBTokensSetup {
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
5
5
  import {JBTokensSetup} from "./JBTokensSetup.sol";
6
6
 
7
7
  contract TestTotalBalanceOf_Local is JBTokensSetup {
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {IJBToken} from "../../../../src/interfaces/IJBToken.sol";
5
5
  import {JBTokensSetup} from "./JBTokensSetup.sol";
6
6
 
7
7
  contract TestTotalSupplyOf_Local is JBTokensSetup {
@@ -1,7 +1,9 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.26;
3
3
 
4
- import /* {*} from */ "../../../helpers/TestBaseWorkflow.sol";
4
+ import {JBTokens} from "../../../../src/JBTokens.sol";
5
+ import {IJBDirectory} from "../../../../src/interfaces/IJBDirectory.sol";
6
+ import {IJBTokens} from "../../../../src/interfaces/IJBTokens.sol";
5
7
  import {JBTokensSetup} from "./JBTokensSetup.sol";
6
8
 
7
9
  contract TestTransferCreditsFrom_Local is JBTokensSetup {