@bananapus/core-v6 0.0.37 → 0.0.39

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 (324) hide show
  1. package/foundry.lock +1 -7
  2. package/foundry.toml +1 -1
  3. package/package.json +19 -7
  4. package/src/JBChainlinkV3PriceFeed.sol +4 -1
  5. package/src/JBChainlinkV3SequencerPriceFeed.sol +4 -2
  6. package/src/JBController.sol +71 -44
  7. package/src/JBDeadline.sol +4 -4
  8. package/src/JBDirectory.sol +34 -32
  9. package/src/JBERC20.sol +5 -4
  10. package/src/JBFeelessAddresses.sol +6 -3
  11. package/src/JBFundAccessLimits.sol +25 -21
  12. package/src/JBMultiTerminal.sol +121 -84
  13. package/src/JBPermissions.sol +34 -37
  14. package/src/JBPrices.sol +23 -18
  15. package/src/JBProjects.sol +6 -3
  16. package/src/JBRulesets.sol +44 -41
  17. package/src/JBSplits.sol +18 -16
  18. package/src/JBTerminalStore.sol +32 -25
  19. package/src/JBTokens.sol +36 -26
  20. package/src/abstract/JBControlled.sol +3 -1
  21. package/src/abstract/JBPermissioned.sol +3 -1
  22. package/src/enums/JBApprovalStatus.sol +7 -1
  23. package/src/interfaces/IJBController.sol +7 -3
  24. package/src/interfaces/IJBDirectory.sol +3 -1
  25. package/src/interfaces/IJBMultiTerminal.sol +3 -2
  26. package/src/interfaces/IJBPermissions.sol +2 -1
  27. package/src/interfaces/IJBPrices.sol +3 -1
  28. package/src/interfaces/IJBRulesets.sol +2 -1
  29. package/src/interfaces/IJBSplits.sol +2 -1
  30. package/src/interfaces/IJBTerminal.sol +3 -1
  31. package/src/interfaces/IJBTerminalStore.sol +3 -1
  32. package/src/interfaces/IJBTokens.sol +2 -1
  33. package/src/libraries/JBCashOuts.sol +6 -1
  34. package/src/libraries/JBConstants.sol +12 -3
  35. package/src/libraries/JBCurrencyIds.sol +2 -0
  36. package/src/libraries/JBFees.sol +52 -10
  37. package/src/libraries/JBFixedPointNumber.sol +2 -0
  38. package/src/libraries/JBPayoutSplitGroupLib.sol +7 -4
  39. package/src/libraries/JBRulesetMetadataResolver.sol +4 -0
  40. package/src/libraries/JBSplitGroupIds.sol +2 -1
  41. package/src/libraries/JBSurplus.sol +3 -1
  42. package/src/periphery/JBMatchingPriceFeed.sol +3 -1
  43. package/src/structs/JBAccountingContext.sol +7 -4
  44. package/src/structs/JBFundAccessLimitGroup.sol +10 -17
  45. package/src/structs/JBRuleset.sol +18 -26
  46. package/src/structs/JBRulesetConfig.sol +13 -25
  47. package/src/structs/JBRulesetMetadata.sol +25 -32
  48. package/test/mock/MockMaliciousBeneficiary.sol +15 -15
  49. package/ADMINISTRATION.md +0 -103
  50. package/ARCHITECTURE.md +0 -133
  51. package/AUDIT_INSTRUCTIONS.md +0 -139
  52. package/RISKS.md +0 -215
  53. package/SKILLS.md +0 -55
  54. package/STYLE_GUIDE.md +0 -610
  55. package/USER_JOURNEYS.md +0 -215
  56. package/script/Deploy.s.sol +0 -124
  57. package/script/DeployPeriphery.s.sol +0 -354
  58. package/slither-ci.config.json +0 -10
  59. package/test/AuditFixes.t.sol +0 -808
  60. package/test/ComprehensiveInvariant.t.sol +0 -306
  61. package/test/CoreExploitTests.t.sol +0 -2741
  62. package/test/EconomicSimulation.t.sol +0 -348
  63. package/test/EntryPointPermutations.t.sol +0 -684
  64. package/test/FlashLoanAttacks.t.sol +0 -797
  65. package/test/PermissionEscalation.t.sol +0 -711
  66. package/test/PermissionsInvariant.t.sol +0 -403
  67. package/test/RulesetTransitions.t.sol +0 -713
  68. package/test/SplitLoopTests.t.sol +0 -752
  69. package/test/TestAccessToFunds.sol +0 -2683
  70. package/test/TestAuditResponseDesignProofs.sol +0 -434
  71. package/test/TestCashOut.sol +0 -198
  72. package/test/TestCashOutCountFor.sol +0 -271
  73. package/test/TestCashOutHooks.sol +0 -351
  74. package/test/TestCashOutTimingEdge.sol +0 -241
  75. package/test/TestDataHookFuzzing.sol +0 -524
  76. package/test/TestDurationUnderflow.sol +0 -233
  77. package/test/TestFeeFreeCashOutBypass.sol +0 -949
  78. package/test/TestFeeProcessingFailure.sol +0 -218
  79. package/test/TestFees.sol +0 -619
  80. package/test/TestForwardedTokenConsumption.sol +0 -425
  81. package/test/TestInterfaceSupport.sol +0 -81
  82. package/test/TestJBERC20Inheritance.sol +0 -103
  83. package/test/TestL2SequencerPriceFeed.sol +0 -292
  84. package/test/TestLaunchProject.sol +0 -188
  85. package/test/TestMetaTx.sol +0 -217
  86. package/test/TestMetadataOffsetOverflow.sol +0 -179
  87. package/test/TestMetadataParserLib.sol +0 -471
  88. package/test/TestMigrationHeldFees.sol +0 -255
  89. package/test/TestMintTokensOf.sol +0 -185
  90. package/test/TestMultiTerminalSurplus.sol +0 -348
  91. package/test/TestMultiTokenSurplus.sol +0 -202
  92. package/test/TestMultipleAccessLimits.sol +0 -664
  93. package/test/TestPayBurnRedeemFlow.sol +0 -195
  94. package/test/TestPayHooks.sol +0 -209
  95. package/test/TestPermissions.sol +0 -324
  96. package/test/TestPermissionsEdge.sol +0 -290
  97. package/test/TestPermit2DataHook.t.sol +0 -360
  98. package/test/TestPermit2Terminal.sol +0 -372
  99. package/test/TestRulesetQueueing.sol +0 -1025
  100. package/test/TestRulesetQueuingStress.sol +0 -806
  101. package/test/TestRulesetWeightCaching.sol +0 -178
  102. package/test/TestSplits.sol +0 -391
  103. package/test/TestTerminalMigration.sol +0 -274
  104. package/test/TestTerminalPreviewParity.sol +0 -208
  105. package/test/TestTokenFlow.sol +0 -191
  106. package/test/TestWeightCacheStaleAfterRejection.sol +0 -303
  107. package/test/WeirdTokenTests.t.sol +0 -817
  108. package/test/audit/CashOutReenterPay.t.sol +0 -501
  109. package/test/audit/CodexHeldFeeRounding.t.sol +0 -159
  110. package/test/audit/CodexMigrationFeeFailure.t.sol +0 -163
  111. package/test/audit/CrossTerminalSurplusSpoof.t.sol +0 -140
  112. package/test/audit/CycledSurplusAllowanceReset.t.sol +0 -184
  113. package/test/audit/FeeFreeSurplusLifecycle.t.sol +0 -399
  114. package/test/audit/FeeFreeSurplusStale.t.sol +0 -248
  115. package/test/audit/USDTVoidReturnCompat.t.sol +0 -525
  116. package/test/fork/TestChainlinkPriceFeedFork.sol +0 -254
  117. package/test/fork/TestSequencerPriceFeedFork.sol +0 -168
  118. package/test/fork/TestTerminalPreviewParityFork.sol +0 -108
  119. package/test/formal/BondingCurveProperties.t.sol +0 -420
  120. package/test/formal/FeeProperties.t.sol +0 -252
  121. package/test/invariants/Phase3DeepInvariant.t.sol +0 -412
  122. package/test/invariants/RulesetsInvariant.t.sol +0 -125
  123. package/test/invariants/TerminalStoreInvariant.t.sol +0 -227
  124. package/test/invariants/TokensInvariant.t.sol +0 -195
  125. package/test/invariants/handlers/ComprehensiveHandler.sol +0 -303
  126. package/test/invariants/handlers/EconomicHandler.sol +0 -377
  127. package/test/invariants/handlers/Phase3Handler.sol +0 -443
  128. package/test/invariants/handlers/RulesetsHandler.sol +0 -115
  129. package/test/invariants/handlers/TerminalStoreHandler.sol +0 -151
  130. package/test/invariants/handlers/TokensHandler.sol +0 -126
  131. package/test/regression/HoldFeesCashOutReserved.t.sol +0 -415
  132. package/test/regression/WeightCacheBoundary.t.sol +0 -291
  133. package/test/trees/JBController/burnTokensOf.tree +0 -9
  134. package/test/trees/JBController/claimTokensFor.tree +0 -5
  135. package/test/trees/JBController/deployERC20For.tree +0 -5
  136. package/test/trees/JBController/getRulesetOf.tree +0 -5
  137. package/test/trees/JBController/launchProjectFor.tree +0 -12
  138. package/test/trees/JBController/launchRulesetsFor.tree +0 -8
  139. package/test/trees/JBController/migrateController.tree +0 -12
  140. package/test/trees/JBController/mintTokensOf.tree +0 -12
  141. package/test/trees/JBController/payReservedTokenToTerminal.tree +0 -8
  142. package/test/trees/JBController/receiveMigrationFrom.tree +0 -4
  143. package/test/trees/JBController/sendReservedTokensToSplitsOf.tree +0 -12
  144. package/test/trees/JBController/setMetadataOf.tree +0 -5
  145. package/test/trees/JBController/setSplitGroupsOf.tree +0 -5
  146. package/test/trees/JBController/setTokenFor.tree +0 -5
  147. package/test/trees/JBController/transferCreditsFrom.tree +0 -8
  148. package/test/trees/JBDirectory/primaryTerminalOf.tree +0 -8
  149. package/test/trees/JBDirectory/setControllerOf.tree +0 -11
  150. package/test/trees/JBDirectory/setPrimaryTerminalOf.tree +0 -15
  151. package/test/trees/JBDirectory/setTerminalsOf.tree +0 -11
  152. package/test/trees/JBERC20/initialize.tree +0 -7
  153. package/test/trees/JBERC20/name.tree +0 -5
  154. package/test/trees/JBERC20/nonces.tree +0 -5
  155. package/test/trees/JBERC20/symbol.tree +0 -5
  156. package/test/trees/JBFeelessAddresses/setFeelessAddress.tree +0 -5
  157. package/test/trees/JBFeelessAddresses/supportsInterface.tree +0 -5
  158. package/test/trees/JBFundAccessLimits/payoutLimitOf.tree +0 -5
  159. package/test/trees/JBFundAccessLimits/payoutLimitsOf.tree +0 -8
  160. package/test/trees/JBFundAccessLimits/setFundAccessLimitsFor.tree +0 -18
  161. package/test/trees/JBFundAccessLimits/surplusAllowanceOf.tree +0 -5
  162. package/test/trees/JBFundAccessLimits/surplusAllowancesOf.tree +0 -8
  163. package/test/trees/JBMetadataResolver/getDataFor.tree +0 -8
  164. package/test/trees/JBMultiTerminal/accountingContextsOf.tree +0 -5
  165. package/test/trees/JBMultiTerminal/addAccountingContextsFor.tree +0 -10
  166. package/test/trees/JBMultiTerminal/addToBalanceOf.tree +0 -23
  167. package/test/trees/JBMultiTerminal/cashOutTokensOf.tree +0 -23
  168. package/test/trees/JBMultiTerminal/executePayout.tree +0 -32
  169. package/test/trees/JBMultiTerminal/executeProcessFee.tree +0 -14
  170. package/test/trees/JBMultiTerminal/migrateBalanceOf.tree +0 -12
  171. package/test/trees/JBMultiTerminal/pay.tree +0 -23
  172. package/test/trees/JBMultiTerminal/processHeldFeesOf.tree +0 -8
  173. package/test/trees/JBMultiTerminal/sendPayoutsOf.tree +0 -34
  174. package/test/trees/JBMultiTerminal/useAllowanceOf.tree +0 -16
  175. package/test/trees/JBPermissions/hasPermission.tree +0 -8
  176. package/test/trees/JBPermissions/hasPermissions.tree +0 -8
  177. package/test/trees/JBPermissions/setPermissionsFor.tree +0 -5
  178. package/test/trees/JBPrices/addPriceFeedFor.tree +0 -14
  179. package/test/trees/JBPrices/pricePerUnitOf.tree +0 -11
  180. package/test/trees/JBProjects/createFor.tree +0 -11
  181. package/test/trees/JBProjects/setTokenUriResolver.tree +0 -5
  182. package/test/trees/JBProjects/supportsInterface.tree +0 -9
  183. package/test/trees/JBProjects/tokenURI.tree +0 -5
  184. package/test/trees/JBRulesets/currentApprovalStatusForLatestRulesetOf.tree +0 -8
  185. package/test/trees/JBRulesets/currentOf.tree +0 -12
  186. package/test/trees/JBRulesets/getRulesetOf.tree +0 -5
  187. package/test/trees/JBRulesets/latestQueuedRulesetOf.tree +0 -10
  188. package/test/trees/JBRulesets/rulesetsOf.tree +0 -11
  189. package/test/trees/JBRulesets/upcomingRulesetOf.tree +0 -20
  190. package/test/trees/JBRulesets/updateRulesetWeightCache.tree +0 -5
  191. package/test/trees/JBSplits/setSplitGroupsOf.tree +0 -17
  192. package/test/trees/JBSplits/splitsOf.tree +0 -5
  193. package/test/trees/JBTerminalStore/currentReclaimableSurplusOf.tree +0 -16
  194. package/test/trees/JBTerminalStore/currentSurplusOf.tree +0 -25
  195. package/test/trees/JBTerminalStore/currentTotalSurplusOf.tree +0 -5
  196. package/test/trees/JBTerminalStore/recordCashOutsFor.tree +0 -16
  197. package/test/trees/JBTerminalStore/recordPaymentFrom.tree +0 -14
  198. package/test/trees/JBTerminalStore/recordPayoutFor.tree +0 -10
  199. package/test/trees/JBTerminalStore/recordTerminalMigration.tree +0 -5
  200. package/test/trees/JBTerminalStore/recordUsedAllowanceOf.tree +0 -10
  201. package/test/trees/JBTokens/burnFrom.tree +0 -10
  202. package/test/trees/JBTokens/claimTokensFor.tree +0 -10
  203. package/test/trees/JBTokens/deployERC20For.tree +0 -12
  204. package/test/trees/JBTokens/mintFor.tree +0 -10
  205. package/test/trees/JBTokens/setTokenFor.tree +0 -11
  206. package/test/trees/JBTokens/totalBalanceOf.tree +0 -5
  207. package/test/trees/JBTokens/totalSupplyOf.tree +0 -5
  208. package/test/trees/JBTokens/transferCreditsFrom.tree +0 -8
  209. package/test/trees/mintTokensOf.tree +0 -12
  210. package/test/units/static/JBChainlinkV3PriceFeed/TestPriceFeed.sol +0 -223
  211. package/test/units/static/JBController/JBControllerSetup.sol +0 -50
  212. package/test/units/static/JBController/TestBurnTokensOf.sol +0 -114
  213. package/test/units/static/JBController/TestClaimTokensFor.sol +0 -63
  214. package/test/units/static/JBController/TestDeployErc20For.sol +0 -86
  215. package/test/units/static/JBController/TestLaunchProjectFor.sol +0 -302
  216. package/test/units/static/JBController/TestLaunchRulesetsFor.sol +0 -342
  217. package/test/units/static/JBController/TestMigrateController.sol +0 -157
  218. package/test/units/static/JBController/TestMintTokensOfUnits.sol +0 -111
  219. package/test/units/static/JBController/TestOmnichainRulesetOperator.sol +0 -324
  220. package/test/units/static/JBController/TestPayReservedTokenToTerminal.sol +0 -74
  221. package/test/units/static/JBController/TestPreviewMintOf.sol +0 -117
  222. package/test/units/static/JBController/TestReceiveMigrationFrom.sol +0 -99
  223. package/test/units/static/JBController/TestRulesetViews.sol +0 -225
  224. package/test/units/static/JBController/TestSendReservedTokensToSplitsOf.sol +0 -615
  225. package/test/units/static/JBController/TestSetSplitGroupsOf.sol +0 -68
  226. package/test/units/static/JBController/TestSetTokenFor.sol +0 -239
  227. package/test/units/static/JBController/TestSetUriOf.sol +0 -57
  228. package/test/units/static/JBController/TestTransferCreditsFrom.sol +0 -169
  229. package/test/units/static/JBDeadline/TestDeadlineFuzz.sol +0 -211
  230. package/test/units/static/JBDirectory/JBDirectorySetup.sol +0 -26
  231. package/test/units/static/JBDirectory/TestPrimaryTerminalOf.sol +0 -126
  232. package/test/units/static/JBDirectory/TestSetControllerOf.sol +0 -183
  233. package/test/units/static/JBDirectory/TestSetControllerOfMigrationOrder.sol +0 -104
  234. package/test/units/static/JBDirectory/TestSetPrimaryTerminalOf.sol +0 -179
  235. package/test/units/static/JBDirectory/TestSetTerminalsOf.sol +0 -137
  236. package/test/units/static/JBERC20/JBERC20Setup.sol +0 -34
  237. package/test/units/static/JBERC20/SigUtils.sol +0 -36
  238. package/test/units/static/JBERC20/TestInitialize.sol +0 -60
  239. package/test/units/static/JBERC20/TestName.sol +0 -30
  240. package/test/units/static/JBERC20/TestNonces.sol +0 -62
  241. package/test/units/static/JBERC20/TestSymbol.sol +0 -31
  242. package/test/units/static/JBFeelessAdresses/JBFeelessSetup.sol +0 -22
  243. package/test/units/static/JBFeelessAdresses/TestInterfaces.sol +0 -30
  244. package/test/units/static/JBFeelessAdresses/TestSetFeelessAddress.sol +0 -35
  245. package/test/units/static/JBFees/TestFeesFuzz.sol +0 -79
  246. package/test/units/static/JBFixedPointNumber/TestAdjustDecimals.sol +0 -16
  247. package/test/units/static/JBFixedPointNumber/TestAdjustDecimalsFuzz.sol +0 -71
  248. package/test/units/static/JBFundAccessLimits/JBFundAccessSetup.sol +0 -24
  249. package/test/units/static/JBFundAccessLimits/TestFundAccessLimitsEdge.sol +0 -163
  250. package/test/units/static/JBFundAccessLimits/TestPayoutLimitOf.sol +0 -59
  251. package/test/units/static/JBFundAccessLimits/TestPayoutLimitsOf.sol +0 -101
  252. package/test/units/static/JBFundAccessLimits/TestSetFundAccessLimitsFor.sol +0 -189
  253. package/test/units/static/JBFundAccessLimits/TestSurplusAllowanceOf.sol +0 -64
  254. package/test/units/static/JBFundAccessLimits/TestSurplusAllowancesOf.sol +0 -102
  255. package/test/units/static/JBMetadataResolver/TestGetDataFor.sol +0 -90
  256. package/test/units/static/JBMetadataResolver/TestMetadataResolverEdgeCases.sol +0 -247
  257. package/test/units/static/JBMetadataResolver/TestMetadataResolverFuzz.sol +0 -229
  258. package/test/units/static/JBMultiTerminal/JBMultiTerminalSetup.sol +0 -50
  259. package/test/units/static/JBMultiTerminal/TestAccountingContextsOf.sol +0 -72
  260. package/test/units/static/JBMultiTerminal/TestAddAccountingContextsFor.sol +0 -289
  261. package/test/units/static/JBMultiTerminal/TestAddToBalanceOf.sol +0 -474
  262. package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +0 -624
  263. package/test/units/static/JBMultiTerminal/TestExecutePayout.sol +0 -578
  264. package/test/units/static/JBMultiTerminal/TestExecuteProcessFee.sol +0 -202
  265. package/test/units/static/JBMultiTerminal/TestMigrateBalanceOf.sol +0 -222
  266. package/test/units/static/JBMultiTerminal/TestPay.sol +0 -604
  267. package/test/units/static/JBMultiTerminal/TestPreviewCashOutFrom.sol +0 -117
  268. package/test/units/static/JBMultiTerminal/TestPreviewPayFor.sol +0 -114
  269. package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +0 -228
  270. package/test/units/static/JBMultiTerminal/TestSelfPayRevert.sol +0 -55
  271. package/test/units/static/JBMultiTerminal/TestSendPayoutsOf.sol +0 -257
  272. package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +0 -611
  273. package/test/units/static/JBPermissions/JBPermissionsSetup.sol +0 -20
  274. package/test/units/static/JBPermissions/TestHasPermission.sol +0 -50
  275. package/test/units/static/JBPermissions/TestHasPermissions.sol +0 -93
  276. package/test/units/static/JBPermissions/TestSetPermissionsFor.sol +0 -64
  277. package/test/units/static/JBPrices/JBPricesSetup.sol +0 -32
  278. package/test/units/static/JBPrices/TestAddPriceFeedFor.sol +0 -107
  279. package/test/units/static/JBPrices/TestPricePerUnitOf.sol +0 -132
  280. package/test/units/static/JBPrices/TestPrices.sol +0 -265
  281. package/test/units/static/JBProjects/JBProjectsSetup.sol +0 -22
  282. package/test/units/static/JBProjects/TestCreateFor.sol +0 -71
  283. package/test/units/static/JBProjects/TestInitialProject.sol +0 -21
  284. package/test/units/static/JBProjects/TestInterfaces.sol +0 -26
  285. package/test/units/static/JBProjects/TestSetResolver.sol +0 -37
  286. package/test/units/static/JBProjects/TestTokenUri.sol +0 -40
  287. package/test/units/static/JBRulesetMetadataResolver/TestSetCashOutTaxRateTo.sol +0 -108
  288. package/test/units/static/JBRulesets/JBRulesetsSetup.sol +0 -24
  289. package/test/units/static/JBRulesets/TestCurrentApprovalStatusForLatestRulesetOf.sol +0 -265
  290. package/test/units/static/JBRulesets/TestCurrentOf.sol +0 -242
  291. package/test/units/static/JBRulesets/TestGetRulesetOf.sol +0 -100
  292. package/test/units/static/JBRulesets/TestLatestQueuedRulesetOf.sol +0 -260
  293. package/test/units/static/JBRulesets/TestRulesets.sol +0 -632
  294. package/test/units/static/JBRulesets/TestRulesetsOf.sol +0 -37
  295. package/test/units/static/JBRulesets/TestUpcomingRulesetOf.sol +0 -522
  296. package/test/units/static/JBRulesets/TestUpdateRulesetWeightCache.sol +0 -96
  297. package/test/units/static/JBSplits/JBSplitsSetup.sol +0 -26
  298. package/test/units/static/JBSplits/TestSelfManagedSplitGroups.sol +0 -552
  299. package/test/units/static/JBSplits/TestSetSplitGroupsOf.sol +0 -377
  300. package/test/units/static/JBSplits/TestSplitsLockedEdge.sol +0 -267
  301. package/test/units/static/JBSplits/TestSplitsOf.sol +0 -24
  302. package/test/units/static/JBSplits/TestSplitsPacking.sol +0 -36
  303. package/test/units/static/JBSurplus/TestSurplusFuzz.sol +0 -160
  304. package/test/units/static/JBTerminalStore/JBTerminalStoreSetup.sol +0 -45
  305. package/test/units/static/JBTerminalStore/TestCurrentReclaimableSurplusOf.sol +0 -536
  306. package/test/units/static/JBTerminalStore/TestCurrentSurplusOf.sol +0 -463
  307. package/test/units/static/JBTerminalStore/TestCurrentTotalSurplusOf.sol +0 -135
  308. package/test/units/static/JBTerminalStore/TestPreviewCashOutFrom.sol +0 -476
  309. package/test/units/static/JBTerminalStore/TestPreviewPayFrom.sol +0 -494
  310. package/test/units/static/JBTerminalStore/TestRecordCashOutsFor.sol +0 -652
  311. package/test/units/static/JBTerminalStore/TestRecordPaymentFrom.sol +0 -744
  312. package/test/units/static/JBTerminalStore/TestRecordPayoutFor.sol +0 -289
  313. package/test/units/static/JBTerminalStore/TestRecordTerminalMigration.sol +0 -138
  314. package/test/units/static/JBTerminalStore/TestRecordUsedAllowanceOf.sol +0 -415
  315. package/test/units/static/JBTerminalStore/TestUint224Overflow.sol +0 -219
  316. package/test/units/static/JBTokens/JBTokensSetup.sol +0 -32
  317. package/test/units/static/JBTokens/TestBurnFrom.sol +0 -107
  318. package/test/units/static/JBTokens/TestClaimTokensFor.sol +0 -110
  319. package/test/units/static/JBTokens/TestDeployERC20ForUnits.sol +0 -92
  320. package/test/units/static/JBTokens/TestMintFor.sol +0 -100
  321. package/test/units/static/JBTokens/TestSetTokenFor.sol +0 -98
  322. package/test/units/static/JBTokens/TestTotalBalanceOf.sol +0 -65
  323. package/test/units/static/JBTokens/TestTotalSupplyOf.sol +0 -56
  324. package/test/units/static/JBTokens/TestTransferCreditsFrom.sol +0 -56
@@ -1,178 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.6;
3
-
4
- import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
- import {IJBController} from "../src/interfaces/IJBController.sol";
6
- import {IJBRulesets} from "../src/interfaces/IJBRulesets.sol";
7
- import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
8
- import {JBConstants} from "../src/libraries/JBConstants.sol";
9
- import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
10
- import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
11
- import {JBRuleset} from "../src/structs/JBRuleset.sol";
12
- import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
13
- import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
14
- import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
15
-
16
- // A ruleset's weight can be cached to make larger intervals calculable while staying within the gas limit.
17
- contract TestRulesetWeightCaching_Local is TestBaseWorkflow {
18
- uint256 private constant _GAS_LIMIT = 30_000_000;
19
- uint8 private constant _WEIGHT_DECIMALS = 18; // FIXED
20
- uint256 private constant _DURATION = 1;
21
- uint256 private constant _WEIGHT_CUT_PERCENT = 1;
22
-
23
- IJBController private _controller;
24
- IJBRulesets private _rulesets;
25
- address private _projectOwner;
26
-
27
- JBRulesetMetadata private _metadata;
28
-
29
- function setUp() public override {
30
- super.setUp();
31
-
32
- _projectOwner = multisig();
33
- _rulesets = jbRulesets();
34
- _controller = jbController();
35
-
36
- _metadata = JBRulesetMetadata({
37
- reservedPercent: 0,
38
- cashOutTaxRate: 0,
39
- baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
40
- pausePay: false,
41
- pauseCreditTransfers: false,
42
- allowOwnerMinting: false,
43
- allowSetCustomToken: false,
44
- allowTerminalMigration: false,
45
- allowSetTerminals: false,
46
- ownerMustSendPayouts: false,
47
- allowSetController: false,
48
- allowAddAccountingContext: true,
49
- allowAddPriceFeed: false,
50
- holdFees: false,
51
- useTotalSurplusForCashOuts: true,
52
- useDataHookForPay: false,
53
- useDataHookForCashOut: false,
54
- dataHook: address(0),
55
- metadata: 0
56
- });
57
- }
58
-
59
- /// Test that caching a ruleset's weight yields the same result as computing it.
60
- /// @dev Bounded to 1,000 rulesets for CI speed. For full coverage (80,000), run:
61
- /// forge test --match-test testWeightCaching -vvv --fuzz-runs 8
62
- function testWeightCaching(uint256 _rulesetDiff) public {
63
- // Bound to a CI-friendly range. The cache threshold is 20,000 iterations;
64
- // 1,000 is enough to exercise the caching path without extreme gas usage.
65
- _rulesetDiff = bound(_rulesetDiff, 0, 1000);
66
-
67
- // Keep references to the projects.
68
- uint256 _projectId1;
69
- uint256 _projectId2;
70
-
71
- // Package up the ruleset configuration.
72
- JBRulesetConfig[] memory _rulesetConfigurations = new JBRulesetConfig[](1);
73
-
74
- {
75
- _rulesetConfigurations[0].mustStartAtOrAfter = 0;
76
- // forge-lint: disable-next-line(unsafe-typecast)
77
- _rulesetConfigurations[0].duration = uint32(_DURATION); // safe: _DURATION = 1
78
- _rulesetConfigurations[0].weight = uint112(1000 * 10 ** _WEIGHT_DECIMALS);
79
- // forge-lint: disable-next-line(unsafe-typecast)
80
- _rulesetConfigurations[0].weightCutPercent = uint32(_WEIGHT_CUT_PERCENT); // safe: _WEIGHT_CUT_PERCENT = 1
81
- _rulesetConfigurations[0].approvalHook = IJBRulesetApprovalHook(address(0));
82
- _rulesetConfigurations[0].metadata = _metadata;
83
- _rulesetConfigurations[0].splitGroups = new JBSplitGroup[](0);
84
- _rulesetConfigurations[0].fundAccessLimitGroups = new JBFundAccessLimitGroup[](0);
85
-
86
- // Create the project to test.
87
- _projectId1 = _controller.launchProjectFor({
88
- owner: _projectOwner,
89
- projectUri: "myIPFSHash",
90
- rulesetConfigurations: _rulesetConfigurations,
91
- terminalConfigurations: new JBTerminalConfig[](0),
92
- memo: ""
93
- });
94
-
95
- // Create the project to test.
96
- _projectId2 = _controller.launchProjectFor({
97
- owner: _projectOwner,
98
- projectUri: "myIPFSHash",
99
- rulesetConfigurations: _rulesetConfigurations,
100
- terminalConfigurations: new JBTerminalConfig[](0),
101
- memo: ""
102
- });
103
- }
104
-
105
- // Keep a reference to the current rulesets.
106
- JBRuleset memory _ruleset1 = jbRulesets().currentOf(_projectId1);
107
- JBRuleset memory _ruleset2 = jbRulesets().currentOf(_projectId2);
108
-
109
- // Go a few rolled over rulesets into the future.
110
- vm.warp(block.timestamp + (_DURATION * 10));
111
-
112
- // Keep a reference to the amount of gas before the caching call.
113
- uint256 _gasBeforeCache = gasleft();
114
-
115
- // Cache the weight in the second project using the latest ruleset ID.
116
- _rulesets.updateRulesetWeightCache(_projectId2, _rulesets.latestRulesetIdOf(_projectId2));
117
-
118
- // Keep a reference to the amount of gas spent on the call.
119
- uint256 _gasDiffCache = _gasBeforeCache - gasleft();
120
-
121
- // Make sure the difference is within the gas limit.
122
- assertLe(_gasDiffCache, _GAS_LIMIT);
123
-
124
- // Go many rolled over rulesets into the future.
125
- vm.warp(block.timestamp + (_DURATION * _rulesetDiff));
126
-
127
- // Cache the weight in the second project again.
128
- _rulesets.updateRulesetWeightCache(_projectId2, _rulesets.latestRulesetIdOf(_projectId2));
129
-
130
- // Inherit the weight (weight=1 is the inherit sentinel in the current API).
131
- _rulesetConfigurations[0].weight = 1;
132
-
133
- // Keep a reference to the amount of gas before the call.
134
- uint256 _gasBefore1 = gasleft();
135
-
136
- // Queue the ruleset.
137
- vm.startPrank(_projectOwner);
138
- _controller.queueRulesetsOf({projectId: _projectId1, rulesetConfigurations: _rulesetConfigurations, memo: ""});
139
-
140
- // Keep a reference to the amount of gas spent on the call.
141
- uint256 _gasDiff1 = _gasBefore1 - gasleft();
142
-
143
- // Make sure the difference is within the gas limit.
144
- assertLe(_gasDiff1, _GAS_LIMIT);
145
-
146
- // Keep a reference to the amount of gas before the call.
147
- uint256 _gasBefore2 = gasleft();
148
-
149
- _controller.queueRulesetsOf({projectId: _projectId2, rulesetConfigurations: _rulesetConfigurations, memo: ""});
150
- vm.stopPrank();
151
-
152
- // Keep a reference to the amount of gas spent on the call.
153
- uint256 _gasDiff2 = _gasBefore2 - gasleft();
154
-
155
- // Make sure the difference is within the gas limit.
156
- assertLe(_gasDiff2, _GAS_LIMIT);
157
-
158
- // Renew the reference to the current ruleset.
159
- _ruleset1 = jbRulesets().currentOf(_projectId1);
160
- _ruleset2 = jbRulesets().currentOf(_projectId2);
161
-
162
- // The cached call should have been cheaper.
163
- assertLe(_gasDiff2, _gasDiff1);
164
-
165
- // Make sure the rulesets have the same weight.
166
- assertEq(_ruleset1.weight, _ruleset2.weight);
167
-
168
- // Cache the weight in the second project again.
169
- _rulesets.updateRulesetWeightCache(_projectId2, _rulesets.latestRulesetIdOf(_projectId2));
170
-
171
- // Go many rolled over rulesets into the future.
172
- vm.warp(block.timestamp + (_DURATION * _rulesetDiff));
173
-
174
- // Queue the ruleset.
175
- vm.prank(_projectOwner);
176
- _controller.queueRulesetsOf({projectId: _projectId2, rulesetConfigurations: _rulesetConfigurations, memo: ""});
177
- }
178
- }
@@ -1,391 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity ^0.8.6;
3
-
4
- import {TestBaseWorkflow} from "./helpers/TestBaseWorkflow.sol";
5
- import {JBTerminalStore} from "../src/JBTerminalStore.sol";
6
- import {IJBController} from "../src/interfaces/IJBController.sol";
7
- import {IJBDirectory} from "../src/interfaces/IJBDirectory.sol";
8
- import {IJBMultiTerminal} from "../src/interfaces/IJBMultiTerminal.sol";
9
- import {IJBRulesetApprovalHook} from "../src/interfaces/IJBRulesetApprovalHook.sol";
10
- import {IJBSplitHook} from "../src/interfaces/IJBSplitHook.sol";
11
- import {IJBTerminal} from "../src/interfaces/IJBTerminal.sol";
12
- import {IJBTokens} from "../src/interfaces/IJBTokens.sol";
13
- import {JBConstants} from "../src/libraries/JBConstants.sol";
14
- import {JBSplitGroupIds} from "../src/libraries/JBSplitGroupIds.sol";
15
- import {JBAccountingContext} from "../src/structs/JBAccountingContext.sol";
16
- import {JBCurrencyAmount} from "../src/structs/JBCurrencyAmount.sol";
17
- import {JBFundAccessLimitGroup} from "../src/structs/JBFundAccessLimitGroup.sol";
18
- import {JBRulesetConfig} from "../src/structs/JBRulesetConfig.sol";
19
- import {JBRulesetMetadata} from "../src/structs/JBRulesetMetadata.sol";
20
- import {JBSplit} from "../src/structs/JBSplit.sol";
21
- import {JBSplitGroup} from "../src/structs/JBSplitGroup.sol";
22
- import {JBTerminalConfig} from "../src/structs/JBTerminalConfig.sol";
23
- import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
24
- import {mulDiv} from "@prb/math/src/Common.sol";
25
-
26
- contract TestSplits_Local is TestBaseWorkflow {
27
- IJBController private _controller;
28
- JBRulesetMetadata private _metadata;
29
- IJBMultiTerminal private _terminal;
30
- IJBTokens private _tokens;
31
- uint112 private _weight;
32
-
33
- address private _projectOwner;
34
- address payable private _splitsGuy;
35
- uint256 private _projectId;
36
- uint224 _nativePayoutLimit = 4 ether;
37
-
38
- function setUp() public override {
39
- super.setUp();
40
-
41
- _projectOwner = multisig();
42
- _terminal = jbMultiTerminal();
43
- _controller = jbController();
44
- _tokens = jbTokens();
45
- _splitsGuy = payable(makeAddr("guy"));
46
- _weight = 1000 * 10 ** 18;
47
-
48
- _metadata = JBRulesetMetadata({
49
- reservedPercent: JBConstants.MAX_RESERVED_PERCENT / 2,
50
- cashOutTaxRate: 0,
51
- baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
52
- pausePay: false,
53
- pauseCreditTransfers: false,
54
- allowOwnerMinting: false,
55
- allowSetCustomToken: false,
56
- allowTerminalMigration: false,
57
- allowSetTerminals: false,
58
- ownerMustSendPayouts: false,
59
- allowSetController: false,
60
- allowAddAccountingContext: true,
61
- allowAddPriceFeed: false,
62
- holdFees: false,
63
- useTotalSurplusForCashOuts: false,
64
- useDataHookForPay: false,
65
- useDataHookForCashOut: false,
66
- dataHook: address(0),
67
- metadata: 0
68
- });
69
-
70
- // Instantiate split parameters.
71
- JBSplitGroup[] memory _splitsGroup = new JBSplitGroup[](3);
72
- JBSplit[] memory _splits = new JBSplit[](2);
73
- JBSplit[] memory _reserveRateSplits = new JBSplit[](1);
74
-
75
- // Set up a payout split recipient.
76
- _splits[0] = JBSplit({
77
- preferAddToBalance: false,
78
- percent: JBConstants.SPLITS_TOTAL_PERCENT / 2,
79
- projectId: 0,
80
- beneficiary: _splitsGuy,
81
- lockedUntil: 0,
82
- hook: IJBSplitHook(address(0))
83
- });
84
-
85
- // A dummy used to check that splits groups of "0" cannot bypass payout limits.
86
- _splits[1] = JBSplit({
87
- preferAddToBalance: false,
88
- percent: JBConstants.SPLITS_TOTAL_PERCENT / 2,
89
- projectId: 0,
90
- beneficiary: _splitsGuy,
91
- lockedUntil: 0,
92
- hook: IJBSplitHook(address(0))
93
- });
94
-
95
- _splitsGroup[0] = JBSplitGroup({groupId: uint32(uint160(JBConstants.NATIVE_TOKEN)), splits: _splits});
96
-
97
- // A dummy used to check that splits groups of "0" cannot bypass payout limits.
98
- _splitsGroup[1] = JBSplitGroup({groupId: 0, splits: _splits});
99
-
100
- // Configure a reserve rate split recipient.
101
- _reserveRateSplits[0] = JBSplit({
102
- preferAddToBalance: false,
103
- percent: JBConstants.SPLITS_TOTAL_PERCENT,
104
- projectId: 0,
105
- beneficiary: _splitsGuy,
106
- lockedUntil: 0,
107
- hook: IJBSplitHook(address(0))
108
- });
109
-
110
- // Reserved rate split group.
111
- _splitsGroup[2] = JBSplitGroup({groupId: JBSplitGroupIds.RESERVED_TOKENS, splits: _reserveRateSplits});
112
-
113
- // Package up fund access limits.
114
- JBFundAccessLimitGroup[] memory _fundAccessLimitGroup = new JBFundAccessLimitGroup[](1);
115
- JBCurrencyAmount[] memory _payoutLimits = new JBCurrencyAmount[](1);
116
- JBCurrencyAmount[] memory _surplusAllowances = new JBCurrencyAmount[](1);
117
-
118
- _payoutLimits[0] =
119
- JBCurrencyAmount({amount: _nativePayoutLimit, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))});
120
- _surplusAllowances[0] = JBCurrencyAmount({amount: 2 ether, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))});
121
- _fundAccessLimitGroup[0] = JBFundAccessLimitGroup({
122
- terminal: address(_terminal),
123
- token: JBConstants.NATIVE_TOKEN,
124
- payoutLimits: _payoutLimits,
125
- surplusAllowances: _surplusAllowances
126
- });
127
-
128
- // Package up ruleset configuration.
129
- JBRulesetConfig[] memory _rulesetConfig = new JBRulesetConfig[](1);
130
- _rulesetConfig[0].mustStartAtOrAfter = 0;
131
- _rulesetConfig[0].duration = 0;
132
- _rulesetConfig[0].weight = _weight;
133
- _rulesetConfig[0].weightCutPercent = 0;
134
- _rulesetConfig[0].approvalHook = IJBRulesetApprovalHook(address(0));
135
- _rulesetConfig[0].metadata = _metadata;
136
- _rulesetConfig[0].splitGroups = _splitsGroup;
137
- _rulesetConfig[0].fundAccessLimitGroups = _fundAccessLimitGroup;
138
-
139
- // Package up terminal configuration.
140
- JBTerminalConfig[] memory _terminalConfigurations = new JBTerminalConfig[](1);
141
- JBAccountingContext[] memory _tokensToAccept = new JBAccountingContext[](1);
142
- _tokensToAccept[0] = JBAccountingContext({
143
- token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
144
- });
145
- _terminalConfigurations[0] =
146
- JBTerminalConfig({terminal: _terminal, accountingContextsToAccept: _tokensToAccept});
147
-
148
- // Dummy project to receive fees.
149
- _controller.launchProjectFor({
150
- owner: _projectOwner,
151
- projectUri: "myIPFSHash",
152
- rulesetConfigurations: _rulesetConfig,
153
- terminalConfigurations: _terminalConfigurations,
154
- memo: ""
155
- });
156
-
157
- _projectId = _controller.launchProjectFor({
158
- owner: _projectOwner,
159
- projectUri: "myIPFSHash",
160
- rulesetConfigurations: _rulesetConfig,
161
- terminalConfigurations: _terminalConfigurations,
162
- memo: ""
163
- });
164
- }
165
-
166
- function testSplitPayoutAndReservedPercentSplit() public {
167
- uint256 _nativePayAmount = 10 ether;
168
- address _payee = makeAddr("payee");
169
- vm.deal(_payee, _nativePayAmount);
170
- vm.prank(_payee);
171
-
172
- _terminal.pay{value: _nativePayAmount}({
173
- projectId: _projectId,
174
- amount: _nativePayAmount,
175
- token: JBConstants.NATIVE_TOKEN,
176
- beneficiary: _payee,
177
- minReturnedTokens: 0,
178
- memo: "Take my money!",
179
- metadata: new bytes(0)
180
- });
181
-
182
- // First payout meets our native token payout limit.
183
- _terminal.sendPayoutsOf({
184
- projectId: _projectId,
185
- amount: _nativePayoutLimit,
186
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
187
- token: JBConstants.NATIVE_TOKEN, // Unused.
188
- minTokensPaidOut: 0
189
- });
190
-
191
- // Calculate the amount returned after fees are processed.
192
- uint256 _beneficiaryNativeBalance =
193
- _nativePayoutLimit - mulDiv(_nativePayoutLimit, _terminal.FEE(), JBConstants.MAX_FEE);
194
-
195
- assertEq(_splitsGuy.balance, _beneficiaryNativeBalance);
196
-
197
- // Check that split groups of "0" don't extend the payout limit (keeping this out of a number test, for
198
- // brevity).
199
- vm.expectRevert(
200
- abi.encodeWithSelector(
201
- JBTerminalStore.JBTerminalStore_InadequateControllerPayoutLimit.selector,
202
- _nativePayoutLimit * 2,
203
- _nativePayoutLimit
204
- )
205
- );
206
-
207
- // First payout meets our native token payout limit.
208
- _terminal.sendPayoutsOf({
209
- projectId: _projectId,
210
- amount: _nativePayoutLimit,
211
- currency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
212
- token: JBConstants.NATIVE_TOKEN, // Unused.
213
- minTokensPaidOut: 0
214
- });
215
-
216
- vm.prank(_projectOwner);
217
- _controller.sendReservedTokensToSplitsOf(_projectId);
218
-
219
- // 10 native tokens paid -> 1000 per Eth, 10000 total, 50% reserve rate, 5000 tokens sent.
220
- uint256 _reserveRateDistributionAmount =
221
- mulDiv(_nativePayAmount, _weight, 10 ** 18) * _metadata.reservedPercent / JBConstants.MAX_RESERVED_PERCENT;
222
-
223
- assertEq(_tokens.totalBalanceOf(_splitsGuy, _projectId), _reserveRateDistributionAmount);
224
- }
225
-
226
- function testReservedPercentSplitTerminal_reverts() public {
227
- uint256 _amount = 100 ether;
228
- uint64 _mockProjectId = 9_999_999;
229
- address _mockTerminal = address(88_888_888);
230
- JBSplit[] memory _reserveRateSplits = new JBSplit[](1);
231
-
232
- // Configure a reserve rate split recipient.
233
- _reserveRateSplits[0] = JBSplit({
234
- preferAddToBalance: false,
235
- percent: JBConstants.SPLITS_TOTAL_PERCENT,
236
- projectId: _mockProjectId,
237
- beneficiary: _splitsGuy,
238
- lockedUntil: 0,
239
- hook: IJBSplitHook(address(0))
240
- });
241
-
242
- JBSplitGroup[] memory _splitsGroup = new JBSplitGroup[](1);
243
- _splitsGroup[0] = JBSplitGroup({groupId: JBSplitGroupIds.RESERVED_TOKENS, splits: _reserveRateSplits});
244
-
245
- _metadata = JBRulesetMetadata({
246
- reservedPercent: JBConstants.MAX_RESERVED_PERCENT,
247
- cashOutTaxRate: 0,
248
- baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
249
- pausePay: false,
250
- pauseCreditTransfers: false,
251
- allowOwnerMinting: true,
252
- allowSetCustomToken: true,
253
- allowTerminalMigration: false,
254
- allowSetTerminals: false,
255
- ownerMustSendPayouts: false,
256
- allowSetController: false,
257
- allowAddAccountingContext: true,
258
- allowAddPriceFeed: false,
259
- holdFees: false,
260
- useTotalSurplusForCashOuts: false,
261
- useDataHookForPay: false,
262
- useDataHookForCashOut: false,
263
- dataHook: address(0),
264
- metadata: 0
265
- });
266
-
267
- // Package up ruleset configuration.
268
- JBRulesetConfig[] memory _rulesetConfig = new JBRulesetConfig[](1);
269
- _rulesetConfig[0].mustStartAtOrAfter = 0;
270
- _rulesetConfig[0].duration = 0;
271
- _rulesetConfig[0].weight = _weight;
272
- _rulesetConfig[0].weightCutPercent = 0;
273
- _rulesetConfig[0].approvalHook = IJBRulesetApprovalHook(address(0));
274
- _rulesetConfig[0].metadata = _metadata;
275
- _rulesetConfig[0].splitGroups = _splitsGroup;
276
-
277
- // Create a new project.
278
- _projectId = _controller.launchProjectFor({
279
- owner: _projectOwner,
280
- projectUri: "myIPFSHash",
281
- rulesetConfigurations: _rulesetConfig,
282
- terminalConfigurations: new JBTerminalConfig[](0),
283
- memo: ""
284
- });
285
-
286
- // Deploy the token.
287
- vm.startPrank(_projectOwner);
288
- IERC20Metadata _token =
289
- IERC20Metadata(address(_controller.deployERC20For(_projectId, "Token", "Token", bytes32(0))));
290
-
291
- // Mint tokens with reservedPercent enabled.
292
- _controller.mintTokensOf({
293
- projectId: _projectId, tokenCount: _amount, beneficiary: _projectOwner, memo: "", useReservedPercent: true
294
- });
295
-
296
- // Mock the primary terminal of the mock project.
297
- vm.mockCall({
298
- callee: address(jbDirectory()),
299
- msgValue: 0,
300
- data: abi.encodeCall(IJBDirectory.primaryTerminalOf, (_mockProjectId, address(_token))),
301
- returnData: abi.encode(_mockTerminal)
302
- });
303
-
304
- // Make it revert on payment.
305
- vm.mockCallRevert({callee: _mockTerminal, data: abi.encode(IJBTerminal.pay.selector), revertData: ""});
306
-
307
- // Distribute the tokens to the reverting terminal.
308
- _controller.sendReservedTokensToSplitsOf(_projectId);
309
-
310
- // Assert that the terminal does *NOT* have any allowance.
311
- assertEq(_token.allowance(address(_controller), address(_mockTerminal)), 0);
312
-
313
- // Assert that the beneficiary did receive the tokens.
314
- assertEq(_token.balanceOf(_splitsGuy), _amount);
315
- }
316
-
317
- function testFuzzedSplitParameters(uint32 _currencyId, uint256 _multiplier) public {
318
- _multiplier = bound(_multiplier, 2, JBConstants.SPLITS_TOTAL_PERCENT);
319
-
320
- // Instantiate split parameters.
321
- JBSplitGroup[] memory _splitsGroup = new JBSplitGroup[](2);
322
- JBSplit[] memory _splits = new JBSplit[](2);
323
-
324
- // Set up a payout split recipient.
325
- _splits[0] = JBSplit({
326
- preferAddToBalance: false,
327
- // forge-lint: disable-next-line(unsafe-typecast)
328
- percent: uint32(JBConstants.SPLITS_TOTAL_PERCENT / _multiplier),
329
- projectId: 0,
330
- beneficiary: _splitsGuy,
331
- lockedUntil: 0,
332
- hook: IJBSplitHook(address(0))
333
- });
334
-
335
- // A dummy used to check that splits groups of "0" don't bypass payout limits.
336
- _splits[1] = JBSplit({
337
- preferAddToBalance: false,
338
- // forge-lint: disable-next-line(unsafe-typecast)
339
- percent: uint32(JBConstants.SPLITS_TOTAL_PERCENT / _multiplier),
340
- projectId: 0,
341
- beneficiary: _splitsGuy,
342
- lockedUntil: 0,
343
- hook: IJBSplitHook(address(0))
344
- });
345
-
346
- _splitsGroup[0] = JBSplitGroup({groupId: _currencyId, splits: _splits});
347
-
348
- // Package up fund access limits.
349
- JBFundAccessLimitGroup[] memory _fundAccessLimitGroup = new JBFundAccessLimitGroup[](1);
350
- JBCurrencyAmount[] memory _payoutLimits = new JBCurrencyAmount[](1);
351
- JBCurrencyAmount[] memory _surplusAllowances = new JBCurrencyAmount[](1);
352
-
353
- _payoutLimits[0] = JBCurrencyAmount({amount: _nativePayoutLimit, currency: _currencyId});
354
- _surplusAllowances[0] = JBCurrencyAmount({amount: 2 ether, currency: _currencyId});
355
- _fundAccessLimitGroup[0] = JBFundAccessLimitGroup({
356
- terminal: address(_terminal),
357
- token: JBConstants.NATIVE_TOKEN,
358
- payoutLimits: _payoutLimits,
359
- surplusAllowances: _surplusAllowances
360
- });
361
-
362
- // Package up ruleset configuration.
363
- JBRulesetConfig[] memory _rulesetConfig = new JBRulesetConfig[](1);
364
- _rulesetConfig[0].mustStartAtOrAfter = 0;
365
- _rulesetConfig[0].duration = 0;
366
- _rulesetConfig[0].weight = _weight;
367
- _rulesetConfig[0].weightCutPercent = 0;
368
- _rulesetConfig[0].approvalHook = IJBRulesetApprovalHook(address(0));
369
- _rulesetConfig[0].metadata = _metadata;
370
- _rulesetConfig[0].splitGroups = _splitsGroup;
371
- _rulesetConfig[0].fundAccessLimitGroups = _fundAccessLimitGroup;
372
-
373
- // Package up terminal configuration.
374
- JBTerminalConfig[] memory _terminalConfigurations = new JBTerminalConfig[](1);
375
- JBAccountingContext[] memory _tokensToAccept = new JBAccountingContext[](1);
376
- _tokensToAccept[0] = JBAccountingContext({
377
- token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
378
- });
379
- _terminalConfigurations[0] =
380
- JBTerminalConfig({terminal: _terminal, accountingContextsToAccept: _tokensToAccept});
381
-
382
- // Dummy project to receive fees.
383
- _controller.launchProjectFor({
384
- owner: _projectOwner,
385
- projectUri: "myIPFSHash",
386
- rulesetConfigurations: _rulesetConfig,
387
- terminalConfigurations: _terminalConfigurations,
388
- memo: ""
389
- });
390
- }
391
- }