@bananapus/core-v6 0.0.36 → 0.0.38

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 (286) hide show
  1. package/foundry.lock +1 -7
  2. package/foundry.toml +1 -1
  3. package/package.json +19 -7
  4. package/src/JBController.sol +26 -5
  5. package/src/JBMultiTerminal.sol +85 -47
  6. package/src/JBTerminalStore.sol +6 -6
  7. package/src/interfaces/IJBController.sol +4 -1
  8. package/src/libraries/JBFees.sol +47 -9
  9. package/src/libraries/JBPayoutSplitGroupLib.sol +2 -2
  10. package/src/periphery/JBMatchingPriceFeed.sol +1 -1
  11. package/test/mock/MockMaliciousBeneficiary.sol +15 -15
  12. package/ADMINISTRATION.md +0 -103
  13. package/ARCHITECTURE.md +0 -133
  14. package/AUDIT_INSTRUCTIONS.md +0 -139
  15. package/RISKS.md +0 -215
  16. package/SKILLS.md +0 -55
  17. package/STYLE_GUIDE.md +0 -610
  18. package/USER_JOURNEYS.md +0 -215
  19. package/script/Deploy.s.sol +0 -124
  20. package/script/DeployPeriphery.s.sol +0 -354
  21. package/slither-ci.config.json +0 -10
  22. package/test/AuditFixes.t.sol +0 -808
  23. package/test/ComprehensiveInvariant.t.sol +0 -306
  24. package/test/CoreExploitTests.t.sol +0 -2741
  25. package/test/EconomicSimulation.t.sol +0 -348
  26. package/test/EntryPointPermutations.t.sol +0 -684
  27. package/test/FlashLoanAttacks.t.sol +0 -797
  28. package/test/PermissionEscalation.t.sol +0 -711
  29. package/test/PermissionsInvariant.t.sol +0 -403
  30. package/test/RulesetTransitions.t.sol +0 -713
  31. package/test/SplitLoopTests.t.sol +0 -752
  32. package/test/TestAccessToFunds.sol +0 -2683
  33. package/test/TestAuditResponseDesignProofs.sol +0 -434
  34. package/test/TestCashOut.sol +0 -198
  35. package/test/TestCashOutCountFor.sol +0 -271
  36. package/test/TestCashOutHooks.sol +0 -351
  37. package/test/TestCashOutTimingEdge.sol +0 -241
  38. package/test/TestDataHookFuzzing.sol +0 -524
  39. package/test/TestDurationUnderflow.sol +0 -233
  40. package/test/TestFeeFreeCashOutBypass.sol +0 -949
  41. package/test/TestFeeProcessingFailure.sol +0 -218
  42. package/test/TestFees.sol +0 -619
  43. package/test/TestForwardedTokenConsumption.sol +0 -425
  44. package/test/TestInterfaceSupport.sol +0 -81
  45. package/test/TestJBERC20Inheritance.sol +0 -103
  46. package/test/TestL2SequencerPriceFeed.sol +0 -292
  47. package/test/TestLaunchProject.sol +0 -188
  48. package/test/TestMetaTx.sol +0 -217
  49. package/test/TestMetadataOffsetOverflow.sol +0 -179
  50. package/test/TestMetadataParserLib.sol +0 -471
  51. package/test/TestMigrationHeldFees.sol +0 -255
  52. package/test/TestMintTokensOf.sol +0 -185
  53. package/test/TestMultiTerminalSurplus.sol +0 -348
  54. package/test/TestMultiTokenSurplus.sol +0 -202
  55. package/test/TestMultipleAccessLimits.sol +0 -664
  56. package/test/TestPayBurnRedeemFlow.sol +0 -195
  57. package/test/TestPayHooks.sol +0 -209
  58. package/test/TestPermissions.sol +0 -324
  59. package/test/TestPermissionsEdge.sol +0 -290
  60. package/test/TestPermit2DataHook.t.sol +0 -360
  61. package/test/TestPermit2Terminal.sol +0 -372
  62. package/test/TestRulesetQueueing.sol +0 -1025
  63. package/test/TestRulesetQueuingStress.sol +0 -806
  64. package/test/TestRulesetWeightCaching.sol +0 -178
  65. package/test/TestSplits.sol +0 -391
  66. package/test/TestTerminalMigration.sol +0 -274
  67. package/test/TestTerminalPreviewParity.sol +0 -208
  68. package/test/TestTokenFlow.sol +0 -191
  69. package/test/TestWeightCacheStaleAfterRejection.sol +0 -303
  70. package/test/WeirdTokenTests.t.sol +0 -817
  71. package/test/audit/CashOutReenterPay.t.sol +0 -501
  72. package/test/audit/CodexHeldFeeRounding.t.sol +0 -159
  73. package/test/audit/CrossTerminalSurplusSpoof.t.sol +0 -140
  74. package/test/audit/CycledSurplusAllowanceReset.t.sol +0 -184
  75. package/test/audit/FeeFreeSurplusLifecycle.t.sol +0 -399
  76. package/test/audit/FeeFreeSurplusStale.t.sol +0 -248
  77. package/test/audit/USDTVoidReturnCompat.t.sol +0 -525
  78. package/test/fork/TestChainlinkPriceFeedFork.sol +0 -254
  79. package/test/fork/TestSequencerPriceFeedFork.sol +0 -168
  80. package/test/fork/TestTerminalPreviewParityFork.sol +0 -108
  81. package/test/formal/BondingCurveProperties.t.sol +0 -420
  82. package/test/formal/FeeProperties.t.sol +0 -252
  83. package/test/invariants/Phase3DeepInvariant.t.sol +0 -412
  84. package/test/invariants/RulesetsInvariant.t.sol +0 -125
  85. package/test/invariants/TerminalStoreInvariant.t.sol +0 -227
  86. package/test/invariants/TokensInvariant.t.sol +0 -195
  87. package/test/invariants/handlers/ComprehensiveHandler.sol +0 -303
  88. package/test/invariants/handlers/EconomicHandler.sol +0 -377
  89. package/test/invariants/handlers/Phase3Handler.sol +0 -443
  90. package/test/invariants/handlers/RulesetsHandler.sol +0 -115
  91. package/test/invariants/handlers/TerminalStoreHandler.sol +0 -151
  92. package/test/invariants/handlers/TokensHandler.sol +0 -126
  93. package/test/regression/HoldFeesCashOutReserved.t.sol +0 -415
  94. package/test/regression/WeightCacheBoundary.t.sol +0 -291
  95. package/test/trees/JBController/burnTokensOf.tree +0 -9
  96. package/test/trees/JBController/claimTokensFor.tree +0 -5
  97. package/test/trees/JBController/deployERC20For.tree +0 -5
  98. package/test/trees/JBController/getRulesetOf.tree +0 -5
  99. package/test/trees/JBController/launchProjectFor.tree +0 -12
  100. package/test/trees/JBController/launchRulesetsFor.tree +0 -8
  101. package/test/trees/JBController/migrateController.tree +0 -12
  102. package/test/trees/JBController/mintTokensOf.tree +0 -12
  103. package/test/trees/JBController/payReservedTokenToTerminal.tree +0 -8
  104. package/test/trees/JBController/receiveMigrationFrom.tree +0 -4
  105. package/test/trees/JBController/sendReservedTokensToSplitsOf.tree +0 -12
  106. package/test/trees/JBController/setMetadataOf.tree +0 -5
  107. package/test/trees/JBController/setSplitGroupsOf.tree +0 -5
  108. package/test/trees/JBController/setTokenFor.tree +0 -5
  109. package/test/trees/JBController/transferCreditsFrom.tree +0 -8
  110. package/test/trees/JBDirectory/primaryTerminalOf.tree +0 -8
  111. package/test/trees/JBDirectory/setControllerOf.tree +0 -11
  112. package/test/trees/JBDirectory/setPrimaryTerminalOf.tree +0 -15
  113. package/test/trees/JBDirectory/setTerminalsOf.tree +0 -11
  114. package/test/trees/JBERC20/initialize.tree +0 -7
  115. package/test/trees/JBERC20/name.tree +0 -5
  116. package/test/trees/JBERC20/nonces.tree +0 -5
  117. package/test/trees/JBERC20/symbol.tree +0 -5
  118. package/test/trees/JBFeelessAddresses/setFeelessAddress.tree +0 -5
  119. package/test/trees/JBFeelessAddresses/supportsInterface.tree +0 -5
  120. package/test/trees/JBFundAccessLimits/payoutLimitOf.tree +0 -5
  121. package/test/trees/JBFundAccessLimits/payoutLimitsOf.tree +0 -8
  122. package/test/trees/JBFundAccessLimits/setFundAccessLimitsFor.tree +0 -18
  123. package/test/trees/JBFundAccessLimits/surplusAllowanceOf.tree +0 -5
  124. package/test/trees/JBFundAccessLimits/surplusAllowancesOf.tree +0 -8
  125. package/test/trees/JBMetadataResolver/getDataFor.tree +0 -8
  126. package/test/trees/JBMultiTerminal/accountingContextsOf.tree +0 -5
  127. package/test/trees/JBMultiTerminal/addAccountingContextsFor.tree +0 -10
  128. package/test/trees/JBMultiTerminal/addToBalanceOf.tree +0 -23
  129. package/test/trees/JBMultiTerminal/cashOutTokensOf.tree +0 -23
  130. package/test/trees/JBMultiTerminal/executePayout.tree +0 -32
  131. package/test/trees/JBMultiTerminal/executeProcessFee.tree +0 -14
  132. package/test/trees/JBMultiTerminal/migrateBalanceOf.tree +0 -12
  133. package/test/trees/JBMultiTerminal/pay.tree +0 -23
  134. package/test/trees/JBMultiTerminal/processHeldFeesOf.tree +0 -8
  135. package/test/trees/JBMultiTerminal/sendPayoutsOf.tree +0 -34
  136. package/test/trees/JBMultiTerminal/useAllowanceOf.tree +0 -16
  137. package/test/trees/JBPermissions/hasPermission.tree +0 -8
  138. package/test/trees/JBPermissions/hasPermissions.tree +0 -8
  139. package/test/trees/JBPermissions/setPermissionsFor.tree +0 -5
  140. package/test/trees/JBPrices/addPriceFeedFor.tree +0 -14
  141. package/test/trees/JBPrices/pricePerUnitOf.tree +0 -11
  142. package/test/trees/JBProjects/createFor.tree +0 -11
  143. package/test/trees/JBProjects/setTokenUriResolver.tree +0 -5
  144. package/test/trees/JBProjects/supportsInterface.tree +0 -9
  145. package/test/trees/JBProjects/tokenURI.tree +0 -5
  146. package/test/trees/JBRulesets/currentApprovalStatusForLatestRulesetOf.tree +0 -8
  147. package/test/trees/JBRulesets/currentOf.tree +0 -12
  148. package/test/trees/JBRulesets/getRulesetOf.tree +0 -5
  149. package/test/trees/JBRulesets/latestQueuedRulesetOf.tree +0 -10
  150. package/test/trees/JBRulesets/rulesetsOf.tree +0 -11
  151. package/test/trees/JBRulesets/upcomingRulesetOf.tree +0 -20
  152. package/test/trees/JBRulesets/updateRulesetWeightCache.tree +0 -5
  153. package/test/trees/JBSplits/setSplitGroupsOf.tree +0 -17
  154. package/test/trees/JBSplits/splitsOf.tree +0 -5
  155. package/test/trees/JBTerminalStore/currentReclaimableSurplusOf.tree +0 -16
  156. package/test/trees/JBTerminalStore/currentSurplusOf.tree +0 -25
  157. package/test/trees/JBTerminalStore/currentTotalSurplusOf.tree +0 -5
  158. package/test/trees/JBTerminalStore/recordCashOutsFor.tree +0 -16
  159. package/test/trees/JBTerminalStore/recordPaymentFrom.tree +0 -14
  160. package/test/trees/JBTerminalStore/recordPayoutFor.tree +0 -10
  161. package/test/trees/JBTerminalStore/recordTerminalMigration.tree +0 -5
  162. package/test/trees/JBTerminalStore/recordUsedAllowanceOf.tree +0 -10
  163. package/test/trees/JBTokens/burnFrom.tree +0 -10
  164. package/test/trees/JBTokens/claimTokensFor.tree +0 -10
  165. package/test/trees/JBTokens/deployERC20For.tree +0 -12
  166. package/test/trees/JBTokens/mintFor.tree +0 -10
  167. package/test/trees/JBTokens/setTokenFor.tree +0 -11
  168. package/test/trees/JBTokens/totalBalanceOf.tree +0 -5
  169. package/test/trees/JBTokens/totalSupplyOf.tree +0 -5
  170. package/test/trees/JBTokens/transferCreditsFrom.tree +0 -8
  171. package/test/trees/mintTokensOf.tree +0 -12
  172. package/test/units/static/JBChainlinkV3PriceFeed/TestPriceFeed.sol +0 -223
  173. package/test/units/static/JBController/JBControllerSetup.sol +0 -50
  174. package/test/units/static/JBController/TestBurnTokensOf.sol +0 -114
  175. package/test/units/static/JBController/TestClaimTokensFor.sol +0 -63
  176. package/test/units/static/JBController/TestDeployErc20For.sol +0 -86
  177. package/test/units/static/JBController/TestLaunchProjectFor.sol +0 -302
  178. package/test/units/static/JBController/TestLaunchRulesetsFor.sol +0 -342
  179. package/test/units/static/JBController/TestMigrateController.sol +0 -157
  180. package/test/units/static/JBController/TestMintTokensOfUnits.sol +0 -111
  181. package/test/units/static/JBController/TestOmnichainRulesetOperator.sol +0 -324
  182. package/test/units/static/JBController/TestPayReservedTokenToTerminal.sol +0 -74
  183. package/test/units/static/JBController/TestPreviewMintOf.sol +0 -117
  184. package/test/units/static/JBController/TestReceiveMigrationFrom.sol +0 -99
  185. package/test/units/static/JBController/TestRulesetViews.sol +0 -225
  186. package/test/units/static/JBController/TestSendReservedTokensToSplitsOf.sol +0 -615
  187. package/test/units/static/JBController/TestSetSplitGroupsOf.sol +0 -68
  188. package/test/units/static/JBController/TestSetTokenFor.sol +0 -239
  189. package/test/units/static/JBController/TestSetUriOf.sol +0 -57
  190. package/test/units/static/JBController/TestTransferCreditsFrom.sol +0 -169
  191. package/test/units/static/JBDeadline/TestDeadlineFuzz.sol +0 -211
  192. package/test/units/static/JBDirectory/JBDirectorySetup.sol +0 -26
  193. package/test/units/static/JBDirectory/TestPrimaryTerminalOf.sol +0 -126
  194. package/test/units/static/JBDirectory/TestSetControllerOf.sol +0 -183
  195. package/test/units/static/JBDirectory/TestSetControllerOfMigrationOrder.sol +0 -104
  196. package/test/units/static/JBDirectory/TestSetPrimaryTerminalOf.sol +0 -179
  197. package/test/units/static/JBDirectory/TestSetTerminalsOf.sol +0 -137
  198. package/test/units/static/JBERC20/JBERC20Setup.sol +0 -34
  199. package/test/units/static/JBERC20/SigUtils.sol +0 -36
  200. package/test/units/static/JBERC20/TestInitialize.sol +0 -60
  201. package/test/units/static/JBERC20/TestName.sol +0 -30
  202. package/test/units/static/JBERC20/TestNonces.sol +0 -62
  203. package/test/units/static/JBERC20/TestSymbol.sol +0 -31
  204. package/test/units/static/JBFeelessAdresses/JBFeelessSetup.sol +0 -22
  205. package/test/units/static/JBFeelessAdresses/TestInterfaces.sol +0 -30
  206. package/test/units/static/JBFeelessAdresses/TestSetFeelessAddress.sol +0 -35
  207. package/test/units/static/JBFees/TestFeesFuzz.sol +0 -79
  208. package/test/units/static/JBFixedPointNumber/TestAdjustDecimals.sol +0 -16
  209. package/test/units/static/JBFixedPointNumber/TestAdjustDecimalsFuzz.sol +0 -71
  210. package/test/units/static/JBFundAccessLimits/JBFundAccessSetup.sol +0 -24
  211. package/test/units/static/JBFundAccessLimits/TestFundAccessLimitsEdge.sol +0 -163
  212. package/test/units/static/JBFundAccessLimits/TestPayoutLimitOf.sol +0 -59
  213. package/test/units/static/JBFundAccessLimits/TestPayoutLimitsOf.sol +0 -101
  214. package/test/units/static/JBFundAccessLimits/TestSetFundAccessLimitsFor.sol +0 -189
  215. package/test/units/static/JBFundAccessLimits/TestSurplusAllowanceOf.sol +0 -64
  216. package/test/units/static/JBFundAccessLimits/TestSurplusAllowancesOf.sol +0 -102
  217. package/test/units/static/JBMetadataResolver/TestGetDataFor.sol +0 -90
  218. package/test/units/static/JBMetadataResolver/TestMetadataResolverEdgeCases.sol +0 -247
  219. package/test/units/static/JBMetadataResolver/TestMetadataResolverFuzz.sol +0 -229
  220. package/test/units/static/JBMultiTerminal/JBMultiTerminalSetup.sol +0 -50
  221. package/test/units/static/JBMultiTerminal/TestAccountingContextsOf.sol +0 -72
  222. package/test/units/static/JBMultiTerminal/TestAddAccountingContextsFor.sol +0 -289
  223. package/test/units/static/JBMultiTerminal/TestAddToBalanceOf.sol +0 -474
  224. package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +0 -624
  225. package/test/units/static/JBMultiTerminal/TestExecutePayout.sol +0 -578
  226. package/test/units/static/JBMultiTerminal/TestExecuteProcessFee.sol +0 -202
  227. package/test/units/static/JBMultiTerminal/TestMigrateBalanceOf.sol +0 -222
  228. package/test/units/static/JBMultiTerminal/TestPay.sol +0 -604
  229. package/test/units/static/JBMultiTerminal/TestPreviewCashOutFrom.sol +0 -117
  230. package/test/units/static/JBMultiTerminal/TestPreviewPayFor.sol +0 -114
  231. package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +0 -228
  232. package/test/units/static/JBMultiTerminal/TestSelfPayRevert.sol +0 -55
  233. package/test/units/static/JBMultiTerminal/TestSendPayoutsOf.sol +0 -257
  234. package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +0 -611
  235. package/test/units/static/JBPermissions/JBPermissionsSetup.sol +0 -20
  236. package/test/units/static/JBPermissions/TestHasPermission.sol +0 -50
  237. package/test/units/static/JBPermissions/TestHasPermissions.sol +0 -93
  238. package/test/units/static/JBPermissions/TestSetPermissionsFor.sol +0 -64
  239. package/test/units/static/JBPrices/JBPricesSetup.sol +0 -32
  240. package/test/units/static/JBPrices/TestAddPriceFeedFor.sol +0 -107
  241. package/test/units/static/JBPrices/TestPricePerUnitOf.sol +0 -132
  242. package/test/units/static/JBPrices/TestPrices.sol +0 -265
  243. package/test/units/static/JBProjects/JBProjectsSetup.sol +0 -22
  244. package/test/units/static/JBProjects/TestCreateFor.sol +0 -71
  245. package/test/units/static/JBProjects/TestInitialProject.sol +0 -21
  246. package/test/units/static/JBProjects/TestInterfaces.sol +0 -26
  247. package/test/units/static/JBProjects/TestSetResolver.sol +0 -37
  248. package/test/units/static/JBProjects/TestTokenUri.sol +0 -40
  249. package/test/units/static/JBRulesetMetadataResolver/TestSetCashOutTaxRateTo.sol +0 -108
  250. package/test/units/static/JBRulesets/JBRulesetsSetup.sol +0 -24
  251. package/test/units/static/JBRulesets/TestCurrentApprovalStatusForLatestRulesetOf.sol +0 -265
  252. package/test/units/static/JBRulesets/TestCurrentOf.sol +0 -242
  253. package/test/units/static/JBRulesets/TestGetRulesetOf.sol +0 -100
  254. package/test/units/static/JBRulesets/TestLatestQueuedRulesetOf.sol +0 -260
  255. package/test/units/static/JBRulesets/TestRulesets.sol +0 -632
  256. package/test/units/static/JBRulesets/TestRulesetsOf.sol +0 -37
  257. package/test/units/static/JBRulesets/TestUpcomingRulesetOf.sol +0 -522
  258. package/test/units/static/JBRulesets/TestUpdateRulesetWeightCache.sol +0 -96
  259. package/test/units/static/JBSplits/JBSplitsSetup.sol +0 -26
  260. package/test/units/static/JBSplits/TestSelfManagedSplitGroups.sol +0 -552
  261. package/test/units/static/JBSplits/TestSetSplitGroupsOf.sol +0 -377
  262. package/test/units/static/JBSplits/TestSplitsLockedEdge.sol +0 -267
  263. package/test/units/static/JBSplits/TestSplitsOf.sol +0 -24
  264. package/test/units/static/JBSplits/TestSplitsPacking.sol +0 -36
  265. package/test/units/static/JBSurplus/TestSurplusFuzz.sol +0 -160
  266. package/test/units/static/JBTerminalStore/JBTerminalStoreSetup.sol +0 -45
  267. package/test/units/static/JBTerminalStore/TestCurrentReclaimableSurplusOf.sol +0 -536
  268. package/test/units/static/JBTerminalStore/TestCurrentSurplusOf.sol +0 -463
  269. package/test/units/static/JBTerminalStore/TestCurrentTotalSurplusOf.sol +0 -135
  270. package/test/units/static/JBTerminalStore/TestPreviewCashOutFrom.sol +0 -476
  271. package/test/units/static/JBTerminalStore/TestPreviewPayFrom.sol +0 -494
  272. package/test/units/static/JBTerminalStore/TestRecordCashOutsFor.sol +0 -652
  273. package/test/units/static/JBTerminalStore/TestRecordPaymentFrom.sol +0 -744
  274. package/test/units/static/JBTerminalStore/TestRecordPayoutFor.sol +0 -289
  275. package/test/units/static/JBTerminalStore/TestRecordTerminalMigration.sol +0 -138
  276. package/test/units/static/JBTerminalStore/TestRecordUsedAllowanceOf.sol +0 -415
  277. package/test/units/static/JBTerminalStore/TestUint224Overflow.sol +0 -219
  278. package/test/units/static/JBTokens/JBTokensSetup.sol +0 -32
  279. package/test/units/static/JBTokens/TestBurnFrom.sol +0 -107
  280. package/test/units/static/JBTokens/TestClaimTokensFor.sol +0 -110
  281. package/test/units/static/JBTokens/TestDeployERC20ForUnits.sol +0 -92
  282. package/test/units/static/JBTokens/TestMintFor.sol +0 -100
  283. package/test/units/static/JBTokens/TestSetTokenFor.sol +0 -98
  284. package/test/units/static/JBTokens/TestTotalBalanceOf.sol +0 -65
  285. package/test/units/static/JBTokens/TestTotalSupplyOf.sol +0 -56
  286. package/test/units/static/JBTokens/TestTransferCreditsFrom.sol +0 -56
@@ -1,684 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity ^0.8.6;
3
-
4
- import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
- import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
6
- import {JBRulesetMetadataResolver} from "../src/libraries/JBRulesetMetadataResolver.sol";
7
- import {JBCurrencyAmount} from "../src/structs/JBCurrencyAmount.sol";
8
- import {JBFee} from "../src/structs/JBFee.sol";
9
- import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
10
- import {JBRuleset} from "../src/structs/JBRuleset.sol";
11
- import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
12
- import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
13
- import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
14
- import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
15
- import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
16
- import {JBConstants} from "../src/libraries/JBConstants.sol";
17
-
18
- /// @title EntryPointPermutations
19
- /// @notice Systematically tests every JBMultiTerminal external function with edge-case parameters
20
- /// that invariant handlers skip (because handlers use try/catch).
21
- /// ~25 tests across 6 function groups: pay, cashOut, sendPayouts, useAllowance,
22
- /// processHeldFees, addToBalance.
23
- contract EntryPointPermutations_Local is TestBaseWorkflow {
24
- using JBRulesetMetadataResolver for JBRuleset;
25
-
26
- uint256 public projectStandard; // Normal project with funds
27
- uint256 public projectPaused; // Project with pausePay=true
28
- uint256 public projectMaxTax; // Project with cashOutTaxRate=10000 (max)
29
- address public owner;
30
-
31
- function setUp() public override {
32
- super.setUp();
33
- owner = multisig();
34
-
35
- // Fee project #1
36
- _launchFeeProject();
37
-
38
- // Standard project: 20% reserved, 30% cashOutTax, 5 ETH payout limit, 3 ETH surplus allowance
39
- projectStandard = _launchProject(
40
- 2000, // reservedPercent
41
- 3000, // cashOutTaxRate
42
- false, // pausePay
43
- true, // holdFees
44
- 5 ether, // payoutLimit
45
- 3 ether // surplusAllowance
46
- );
47
-
48
- // Paused project
49
- projectPaused = _launchProject(0, 0, true, false, 0, 0);
50
-
51
- // Max tax project
52
- projectMaxTax = _launchProject(0, 10_000, false, false, 0, 0);
53
-
54
- // Seed the standard project with some ETH
55
- vm.deal(owner, 100 ether);
56
- vm.prank(owner);
57
- jbMultiTerminal().pay{value: 10 ether}(projectStandard, JBConstants.NATIVE_TOKEN, 10 ether, owner, 0, "", "");
58
-
59
- // Seed the max tax project
60
- vm.prank(owner);
61
- jbMultiTerminal().pay{value: 5 ether}(projectMaxTax, JBConstants.NATIVE_TOKEN, 5 ether, owner, 0, "", "");
62
- }
63
-
64
- // =========================================================================
65
- // pay() edge cases
66
- // =========================================================================
67
-
68
- /// @notice pay() with zero amount — for native token, msg.value=0 is accepted (mints 0 tokens).
69
- function test_pay_zeroAmount() public {
70
- uint256 tokens = jbMultiTerminal().pay{value: 0}(projectStandard, JBConstants.NATIVE_TOKEN, 0, owner, 0, "", "");
71
- assertEq(tokens, 0, "Zero amount payment should mint 0 tokens");
72
- }
73
-
74
- /// @notice pay() with max uint amount (msg.value caps it for native token).
75
- function test_pay_maxUintAmount() public {
76
- uint256 amount = 1 ether;
77
- vm.deal(address(this), amount);
78
- // For native token, amount param is overridden by msg.value, so this should work
79
- uint256 tokens = jbMultiTerminal().pay{value: amount}(
80
- projectStandard, JBConstants.NATIVE_TOKEN, type(uint256).max, address(this), 0, "", ""
81
- );
82
- assertGt(tokens, 0, "Should mint tokens for payment");
83
- }
84
-
85
- /// @notice pay() to a project with no ruleset should revert.
86
- function test_pay_nonExistentProject() public {
87
- vm.deal(address(this), 1 ether);
88
- vm.expectRevert();
89
- jbMultiTerminal().pay{value: 1 ether}(999, JBConstants.NATIVE_TOKEN, 1 ether, address(this), 0, "", "");
90
- }
91
-
92
- /// @notice pay() to a project with pausePay=true should revert.
93
- function test_pay_pausedProject() public {
94
- vm.deal(address(this), 1 ether);
95
- vm.expectRevert();
96
- jbMultiTerminal().pay{value: 1 ether}(
97
- projectPaused, JBConstants.NATIVE_TOKEN, 1 ether, address(this), 0, "", ""
98
- );
99
- }
100
-
101
- /// @notice pay() with zero beneficiary — should use msg.sender.
102
- function test_pay_zeroBeneficiary() public {
103
- vm.deal(address(this), 1 ether);
104
- // Zero beneficiary defaults to msg.sender in the terminal
105
- uint256 tokens = jbMultiTerminal().pay{value: 1 ether}(
106
- projectStandard, JBConstants.NATIVE_TOKEN, 1 ether, address(0), 0, "", ""
107
- );
108
- // Tokens go to msg.sender (address(this)) when beneficiary is address(0)
109
- assertGt(tokens, 0, "Should mint tokens even with zero beneficiary");
110
- }
111
-
112
- /// @notice pay() with same payer and beneficiary.
113
- function test_pay_samePagerAndBeneficiary() public {
114
- address payer = address(0x5000);
115
- vm.deal(payer, 2 ether);
116
-
117
- vm.prank(payer);
118
- uint256 tokens =
119
- jbMultiTerminal().pay{value: 1 ether}(projectStandard, JBConstants.NATIVE_TOKEN, 1 ether, payer, 0, "", "");
120
- assertGt(tokens, 0, "Should mint tokens for self-payment");
121
- }
122
-
123
- /// @notice pay() with minReturnedTokens higher than what's possible should revert.
124
- function test_pay_minReturnedTokensTooHigh() public {
125
- vm.deal(address(this), 1 ether);
126
- // With 1 ETH and weight=1000e18, expect 1000e18 tokens (minus reserved).
127
- // Asking for type(uint256).max should revert.
128
- vm.expectRevert();
129
- jbMultiTerminal().pay{value: 1 ether}(
130
- projectStandard, JBConstants.NATIVE_TOKEN, 1 ether, address(this), type(uint256).max, "", ""
131
- );
132
- }
133
-
134
- // =========================================================================
135
- // cashOutTokensOf() edge cases
136
- // =========================================================================
137
-
138
- /// @notice cashOut with zero count — should return 0 reclaim (no-op).
139
- function test_cashOut_zeroCount() public {
140
- vm.prank(owner);
141
- uint256 reclaimed = jbMultiTerminal()
142
- .cashOutTokensOf({
143
- holder: owner,
144
- projectId: projectStandard,
145
- cashOutCount: 0,
146
- tokenToReclaim: JBConstants.NATIVE_TOKEN,
147
- minTokensReclaimed: 0,
148
- beneficiary: payable(owner),
149
- metadata: ""
150
- });
151
- assertEq(reclaimed, 0, "Zero count cash out should return 0");
152
- }
153
-
154
- /// @notice cashOut entire supply should succeed.
155
- function test_cashOut_entireSupply() public {
156
- uint256 balance = jbTokens().totalBalanceOf(owner, projectStandard);
157
- if (balance == 0) return;
158
-
159
- uint256 balanceBefore = owner.balance;
160
- vm.prank(owner);
161
- uint256 reclaimed = jbMultiTerminal()
162
- .cashOutTokensOf({
163
- holder: owner,
164
- projectId: projectStandard,
165
- cashOutCount: balance,
166
- tokenToReclaim: JBConstants.NATIVE_TOKEN,
167
- minTokensReclaimed: 0,
168
- beneficiary: payable(owner),
169
- metadata: ""
170
- });
171
-
172
- assertGt(reclaimed, 0, "Should reclaim something for entire supply cash out");
173
- assertGt(owner.balance, balanceBefore, "Owner balance should increase");
174
- }
175
-
176
- /// @notice cashOut more than balance should revert.
177
- function test_cashOut_moreThanBalance() public {
178
- uint256 balance = jbTokens().totalBalanceOf(owner, projectStandard);
179
-
180
- vm.prank(owner);
181
- vm.expectRevert();
182
- jbMultiTerminal()
183
- .cashOutTokensOf({
184
- holder: owner,
185
- projectId: projectStandard,
186
- cashOutCount: balance + 1,
187
- tokenToReclaim: JBConstants.NATIVE_TOKEN,
188
- minTokensReclaimed: 0,
189
- beneficiary: payable(owner),
190
- metadata: ""
191
- });
192
- }
193
-
194
- /// @notice cashOut with max tax rate should return 0 reclaim.
195
- function test_cashOut_maxTaxRateReturnsZero() public {
196
- uint256 balance = jbTokens().totalBalanceOf(owner, projectMaxTax);
197
- if (balance == 0) return;
198
-
199
- vm.prank(owner);
200
- uint256 reclaimed = jbMultiTerminal()
201
- .cashOutTokensOf({
202
- holder: owner,
203
- projectId: projectMaxTax,
204
- cashOutCount: balance,
205
- tokenToReclaim: JBConstants.NATIVE_TOKEN,
206
- minTokensReclaimed: 0,
207
- beneficiary: payable(owner),
208
- metadata: ""
209
- });
210
-
211
- assertEq(reclaimed, 0, "Max tax rate should return 0 reclaim");
212
- }
213
-
214
- /// @notice cashOut with minTokensReclaimed too high should revert.
215
- function test_cashOut_minTokensReclaimedTooHigh() public {
216
- uint256 balance = jbTokens().totalBalanceOf(owner, projectStandard);
217
- if (balance == 0) return;
218
-
219
- vm.prank(owner);
220
- vm.expectRevert();
221
- jbMultiTerminal()
222
- .cashOutTokensOf({
223
- holder: owner,
224
- projectId: projectStandard,
225
- cashOutCount: 1,
226
- tokenToReclaim: JBConstants.NATIVE_TOKEN,
227
- minTokensReclaimed: type(uint256).max,
228
- beneficiary: payable(owner),
229
- metadata: ""
230
- });
231
- }
232
-
233
- // =========================================================================
234
- // sendPayoutsOf() edge cases
235
- // =========================================================================
236
-
237
- /// @notice sendPayouts with exact limit should succeed.
238
- function test_sendPayouts_exactLimit() public {
239
- vm.prank(owner);
240
- uint256 amountPaidOut = jbMultiTerminal()
241
- .sendPayoutsOf({
242
- projectId: projectStandard,
243
- token: JBConstants.NATIVE_TOKEN,
244
- amount: 5 ether, // Exact payout limit
245
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
246
- minTokensPaidOut: 0
247
- });
248
-
249
- assertGt(amountPaidOut, 0, "Should pay out with exact limit");
250
- }
251
-
252
- /// @notice sendPayouts with 1 wei over limit should revert (not capped).
253
- function test_sendPayouts_overLimitReverts() public {
254
- vm.prank(owner);
255
- vm.expectRevert();
256
- jbMultiTerminal()
257
- .sendPayoutsOf({
258
- projectId: projectStandard,
259
- token: JBConstants.NATIVE_TOKEN,
260
- amount: 5 ether + 1, // 1 wei over limit
261
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
262
- minTokensPaidOut: 0
263
- });
264
- }
265
-
266
- /// @notice sendPayouts with zero amount should be a no-op or revert.
267
- function test_sendPayouts_zeroAmount() public {
268
- vm.prank(owner);
269
- uint256 amountPaidOut = jbMultiTerminal()
270
- .sendPayoutsOf({
271
- projectId: projectStandard,
272
- token: JBConstants.NATIVE_TOKEN,
273
- amount: 0,
274
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
275
- minTokensPaidOut: 0
276
- });
277
-
278
- assertEq(amountPaidOut, 0, "Zero amount should result in zero payout");
279
- }
280
-
281
- /// @notice sendPayouts with minTokensPaidOut too high should revert.
282
- function test_sendPayouts_minTokensPaidOutTooHigh() public {
283
- vm.prank(owner);
284
- vm.expectRevert();
285
- jbMultiTerminal()
286
- .sendPayoutsOf({
287
- projectId: projectStandard,
288
- token: JBConstants.NATIVE_TOKEN,
289
- amount: 1 ether,
290
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
291
- minTokensPaidOut: type(uint256).max
292
- });
293
- }
294
-
295
- // =========================================================================
296
- // useAllowanceOf() edge cases
297
- // =========================================================================
298
-
299
- /// @notice useAllowance with exact allowance should succeed.
300
- function test_useAllowance_exactAllowance() public {
301
- vm.prank(owner);
302
- uint256 netAmount = jbMultiTerminal()
303
- .useAllowanceOf({
304
- projectId: projectStandard,
305
- token: JBConstants.NATIVE_TOKEN,
306
- amount: 3 ether, // Exact surplus allowance
307
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
308
- minTokensPaidOut: 0,
309
- beneficiary: payable(owner),
310
- feeBeneficiary: payable(owner),
311
- memo: ""
312
- });
313
-
314
- assertGt(netAmount, 0, "Should use exact allowance successfully");
315
- }
316
-
317
- /// @notice useAllowance without permission should revert.
318
- function test_useAllowance_noPermission() public {
319
- address unauthorized = address(0x9999);
320
- vm.prank(unauthorized);
321
- vm.expectRevert();
322
- jbMultiTerminal()
323
- .useAllowanceOf({
324
- projectId: projectStandard,
325
- token: JBConstants.NATIVE_TOKEN,
326
- amount: 1 ether,
327
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
328
- minTokensPaidOut: 0,
329
- beneficiary: payable(unauthorized),
330
- feeBeneficiary: payable(unauthorized),
331
- memo: ""
332
- });
333
- }
334
-
335
- /// @notice useAllowance after payouts drained balance should revert or return 0.
336
- function test_useAllowance_afterPayoutsDrainedBalance() public {
337
- // First drain via payouts
338
- vm.prank(owner);
339
- jbMultiTerminal()
340
- .sendPayoutsOf({
341
- projectId: projectStandard,
342
- token: JBConstants.NATIVE_TOKEN,
343
- amount: 5 ether,
344
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
345
- minTokensPaidOut: 0
346
- });
347
-
348
- // Now try to use allowance — should fail or return small amount
349
- vm.prank(owner);
350
- try jbMultiTerminal()
351
- .useAllowanceOf({
352
- projectId: projectStandard,
353
- token: JBConstants.NATIVE_TOKEN,
354
- amount: 3 ether,
355
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
356
- minTokensPaidOut: 0,
357
- beneficiary: payable(owner),
358
- feeBeneficiary: payable(owner),
359
- memo: ""
360
- }) returns (
361
- uint256 netAmount
362
- ) {
363
- // If it succeeds, the amount should be reasonable
364
- assertLe(netAmount, 5 ether, "Net amount should be bounded");
365
- } catch {
366
- // Expected: may revert if insufficient surplus
367
- assertTrue(true, "Reverted as expected due to insufficient surplus");
368
- }
369
- }
370
-
371
- // =========================================================================
372
- // processHeldFeesOf() edge cases
373
- // =========================================================================
374
-
375
- /// @notice processHeldFees when no fees are held should be a no-op.
376
- function test_processHeldFees_noFeesHeld() public {
377
- // Project with holdFees=false shouldn't have any held fees
378
- jbMultiTerminal().processHeldFeesOf(projectPaused, JBConstants.NATIVE_TOKEN, 100);
379
- // Should not revert — just a no-op
380
- assertTrue(true, "No-op when no fees held");
381
- }
382
-
383
- /// @notice processHeldFees with count > available should process what's available.
384
- function test_processHeldFees_countExceedsAvailable() public {
385
- // First create some held fees via payouts on project with holdFees=true
386
- vm.prank(owner);
387
- jbMultiTerminal()
388
- .sendPayoutsOf({
389
- projectId: projectStandard,
390
- token: JBConstants.NATIVE_TOKEN,
391
- amount: 1 ether,
392
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
393
- minTokensPaidOut: 0
394
- });
395
-
396
- // Advance time past unlock period
397
- vm.warp(block.timestamp + 30 days);
398
-
399
- // Process with count=1000 (more than available)
400
- jbMultiTerminal().processHeldFeesOf(projectStandard, JBConstants.NATIVE_TOKEN, 1000);
401
- assertTrue(true, "Should handle count > available gracefully");
402
- }
403
-
404
- /// @notice processHeldFees before unlock period should skip locked fees.
405
- function test_processHeldFees_lockedFees() public {
406
- // Create held fees
407
- vm.prank(owner);
408
- jbMultiTerminal()
409
- .sendPayoutsOf({
410
- projectId: projectStandard,
411
- token: JBConstants.NATIVE_TOKEN,
412
- amount: 1 ether,
413
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
414
- minTokensPaidOut: 0
415
- });
416
-
417
- // Don't advance time — fees should still be locked
418
- // This should be a no-op since fees are locked
419
- jbMultiTerminal().processHeldFeesOf(projectStandard, JBConstants.NATIVE_TOKEN, 100);
420
- assertTrue(true, "Should skip locked fees without reverting");
421
- }
422
-
423
- // =========================================================================
424
- // addToBalanceOf() edge cases
425
- // =========================================================================
426
-
427
- /// @notice addToBalance with shouldReturnHeldFees=true and zero held fees.
428
- function test_addToBalance_returnFeesWithZeroHeld() public {
429
- // Add to balance on a project with no held fees
430
- vm.deal(address(this), 1 ether);
431
- jbMultiTerminal().addToBalanceOf{value: 1 ether}(
432
- projectStandard, JBConstants.NATIVE_TOKEN, 1 ether, true, "", ""
433
- );
434
-
435
- // Should succeed — just adds to balance without returning any fees
436
- uint256 balance =
437
- jbTerminalStore().balanceOf(address(jbMultiTerminal()), projectStandard, JBConstants.NATIVE_TOKEN);
438
- assertGt(balance, 0, "Balance should be non-zero after add");
439
- }
440
-
441
- /// @notice addToBalance with shouldReturnHeldFees=true after creating held fees.
442
- function test_addToBalance_returnFeesPartial() public {
443
- // Create held fees via payout
444
- vm.prank(owner);
445
- jbMultiTerminal()
446
- .sendPayoutsOf({
447
- projectId: projectStandard,
448
- token: JBConstants.NATIVE_TOKEN,
449
- amount: 2 ether,
450
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
451
- minTokensPaidOut: 0
452
- });
453
-
454
- // Check held fees exist
455
- JBFee[] memory feesBefore = jbMultiTerminal().heldFeesOf(projectStandard, JBConstants.NATIVE_TOKEN, 100);
456
-
457
- // Now add to balance with fee return
458
- vm.deal(address(this), 1 ether);
459
- jbMultiTerminal().addToBalanceOf{value: 1 ether}(
460
- projectStandard, JBConstants.NATIVE_TOKEN, 1 ether, true, "", ""
461
- );
462
-
463
- // Held fees should be reduced (partially or fully returned)
464
- jbMultiTerminal().heldFeesOf(projectStandard, JBConstants.NATIVE_TOKEN, 100);
465
-
466
- if (feesBefore.length > 0) {
467
- // Either fewer fees or smaller amounts
468
- assertTrue(true, "Fee return processed without revert");
469
- }
470
- }
471
-
472
- /// @notice addToBalance with shouldReturnHeldFees=false should not touch held fees.
473
- function test_addToBalance_noReturnDoesNotAffectHeldFees() public {
474
- // Create held fees
475
- vm.prank(owner);
476
- jbMultiTerminal()
477
- .sendPayoutsOf({
478
- projectId: projectStandard,
479
- token: JBConstants.NATIVE_TOKEN,
480
- amount: 1 ether,
481
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
482
- minTokensPaidOut: 0
483
- });
484
-
485
- JBFee[] memory feesBefore = jbMultiTerminal().heldFeesOf(projectStandard, JBConstants.NATIVE_TOKEN, 100);
486
- uint256 heldBefore;
487
- for (uint256 i = 0; i < feesBefore.length; i++) {
488
- heldBefore += feesBefore[i].amount;
489
- }
490
-
491
- // Add without returning fees
492
- vm.deal(address(this), 1 ether);
493
- jbMultiTerminal().addToBalanceOf{value: 1 ether}(
494
- projectStandard, JBConstants.NATIVE_TOKEN, 1 ether, false, "", ""
495
- );
496
-
497
- JBFee[] memory feesAfter = jbMultiTerminal().heldFeesOf(projectStandard, JBConstants.NATIVE_TOKEN, 100);
498
- uint256 heldAfter;
499
- for (uint256 i = 0; i < feesAfter.length; i++) {
500
- heldAfter += feesAfter[i].amount;
501
- }
502
-
503
- assertEq(heldBefore, heldAfter, "Held fees should not change when shouldReturnHeldFees=false");
504
- }
505
-
506
- /// @notice addToBalance with exact amount to return all held fees.
507
- function test_addToBalance_exactReturnAllHeldFees() public {
508
- // Create held fees via payout
509
- vm.prank(owner);
510
- jbMultiTerminal()
511
- .sendPayoutsOf({
512
- projectId: projectStandard,
513
- token: JBConstants.NATIVE_TOKEN,
514
- amount: 1 ether,
515
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
516
- minTokensPaidOut: 0
517
- });
518
-
519
- // Get total held fees
520
- JBFee[] memory fees = jbMultiTerminal().heldFeesOf(projectStandard, JBConstants.NATIVE_TOKEN, 100);
521
- uint256 totalHeld;
522
- for (uint256 i = 0; i < fees.length; i++) {
523
- totalHeld += fees[i].amount;
524
- }
525
-
526
- if (totalHeld > 0) {
527
- // Add back the exact amount of held fees
528
- vm.deal(address(this), totalHeld);
529
- jbMultiTerminal().addToBalanceOf{value: totalHeld}(
530
- projectStandard, JBConstants.NATIVE_TOKEN, totalHeld, true, "", ""
531
- );
532
-
533
- // All held fees should be returned
534
- assertTrue(true, "Exact return processed without revert");
535
- }
536
- }
537
-
538
- /// @notice addToBalance with zero amount — should it be a no-op?
539
- function test_addToBalance_zeroAmount() public {
540
- // Zero amount add to balance
541
- jbMultiTerminal().addToBalanceOf{value: 0}(projectStandard, JBConstants.NATIVE_TOKEN, 0, false, "", "");
542
- assertTrue(true, "Zero amount addToBalance should not revert");
543
- }
544
-
545
- // =========================================================================
546
- // Helpers
547
- // =========================================================================
548
-
549
- function _launchFeeProject() internal returns (uint256) {
550
- JBRulesetConfig[] memory ruleset = new JBRulesetConfig[](1);
551
- ruleset[0].mustStartAtOrAfter = 0;
552
- ruleset[0].duration = 0;
553
- ruleset[0].weight = uint112(1000e18);
554
- ruleset[0].weightCutPercent = 0;
555
- ruleset[0].approvalHook = IJBRulesetApprovalHook(address(0));
556
- ruleset[0].metadata = _meta(0, 0, false, false);
557
- ruleset[0].splitGroups = new JBSplitGroup[](0);
558
- ruleset[0].fundAccessLimitGroups = new JBFundAccessLimitGroup[](0);
559
-
560
- JBTerminalConfig[] memory termCfg = new JBTerminalConfig[](1);
561
- JBAccountingContext[] memory ctx = new JBAccountingContext[](1);
562
- ctx[0] = JBAccountingContext({
563
- token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
564
- });
565
- termCfg[0] = JBTerminalConfig({terminal: jbMultiTerminal(), accountingContextsToAccept: ctx});
566
-
567
- return jbController()
568
- .launchProjectFor({
569
- owner: owner,
570
- projectUri: "FeeProject",
571
- rulesetConfigurations: ruleset,
572
- terminalConfigurations: termCfg,
573
- memo: ""
574
- });
575
- }
576
-
577
- function _launchProject(
578
- uint16 reservedPercent,
579
- uint16 cashOutTaxRate,
580
- bool pausePay,
581
- bool holdFees,
582
- uint256 payoutLimit,
583
- uint256 surplusAllowance
584
- )
585
- internal
586
- returns (uint256)
587
- {
588
- JBRulesetConfig[] memory ruleset = new JBRulesetConfig[](1);
589
- ruleset[0].mustStartAtOrAfter = 0;
590
- ruleset[0].duration = 0;
591
- ruleset[0].weight = uint112(1000e18);
592
- ruleset[0].weightCutPercent = 0;
593
- ruleset[0].approvalHook = IJBRulesetApprovalHook(address(0));
594
- ruleset[0].metadata = _meta(reservedPercent, cashOutTaxRate, pausePay, holdFees);
595
- ruleset[0].splitGroups = new JBSplitGroup[](0);
596
-
597
- if (payoutLimit > 0 || surplusAllowance > 0) {
598
- JBFundAccessLimitGroup[] memory limits = new JBFundAccessLimitGroup[](1);
599
- JBCurrencyAmount[] memory payoutLimits;
600
- JBCurrencyAmount[] memory surplusAllowances;
601
-
602
- if (payoutLimit > 0) {
603
- payoutLimits = new JBCurrencyAmount[](1);
604
- payoutLimits[0] = JBCurrencyAmount({
605
- // forge-lint: disable-next-line(unsafe-typecast)
606
- amount: uint224(payoutLimit),
607
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
608
- });
609
- } else {
610
- payoutLimits = new JBCurrencyAmount[](0);
611
- }
612
-
613
- if (surplusAllowance > 0) {
614
- surplusAllowances = new JBCurrencyAmount[](1);
615
- surplusAllowances[0] = JBCurrencyAmount({
616
- // forge-lint: disable-next-line(unsafe-typecast)
617
- amount: uint224(surplusAllowance),
618
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
619
- });
620
- } else {
621
- surplusAllowances = new JBCurrencyAmount[](0);
622
- }
623
-
624
- limits[0] = JBFundAccessLimitGroup({
625
- terminal: address(jbMultiTerminal()),
626
- token: JBConstants.NATIVE_TOKEN,
627
- payoutLimits: payoutLimits,
628
- surplusAllowances: surplusAllowances
629
- });
630
- ruleset[0].fundAccessLimitGroups = limits;
631
- } else {
632
- ruleset[0].fundAccessLimitGroups = new JBFundAccessLimitGroup[](0);
633
- }
634
-
635
- JBTerminalConfig[] memory termCfg = new JBTerminalConfig[](1);
636
- JBAccountingContext[] memory ctx = new JBAccountingContext[](1);
637
- ctx[0] = JBAccountingContext({
638
- token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
639
- });
640
- termCfg[0] = JBTerminalConfig({terminal: jbMultiTerminal(), accountingContextsToAccept: ctx});
641
-
642
- return jbController()
643
- .launchProjectFor({
644
- owner: owner,
645
- projectUri: "Project",
646
- rulesetConfigurations: ruleset,
647
- terminalConfigurations: termCfg,
648
- memo: ""
649
- });
650
- }
651
-
652
- function _meta(
653
- uint16 reservedPercent,
654
- uint16 cashOutTaxRate,
655
- bool pausePay,
656
- bool holdFees
657
- )
658
- internal
659
- pure
660
- returns (JBRulesetMetadata memory)
661
- {
662
- return JBRulesetMetadata({
663
- reservedPercent: reservedPercent,
664
- cashOutTaxRate: cashOutTaxRate,
665
- baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
666
- pausePay: pausePay,
667
- pauseCreditTransfers: false,
668
- allowOwnerMinting: false,
669
- allowSetCustomToken: false,
670
- allowTerminalMigration: false,
671
- allowSetTerminals: false,
672
- ownerMustSendPayouts: false,
673
- allowSetController: false,
674
- allowAddAccountingContext: true,
675
- allowAddPriceFeed: false,
676
- holdFees: holdFees,
677
- useTotalSurplusForCashOuts: false,
678
- useDataHookForPay: false,
679
- useDataHookForCashOut: false,
680
- dataHook: address(0),
681
- metadata: 0
682
- });
683
- }
684
- }