@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.
- package/foundry.lock +1 -7
- package/foundry.toml +1 -1
- package/package.json +19 -7
- package/src/JBChainlinkV3PriceFeed.sol +4 -1
- package/src/JBChainlinkV3SequencerPriceFeed.sol +4 -2
- package/src/JBController.sol +71 -44
- package/src/JBDeadline.sol +4 -4
- package/src/JBDirectory.sol +34 -32
- package/src/JBERC20.sol +5 -4
- package/src/JBFeelessAddresses.sol +6 -3
- package/src/JBFundAccessLimits.sol +25 -21
- package/src/JBMultiTerminal.sol +121 -84
- package/src/JBPermissions.sol +34 -37
- package/src/JBPrices.sol +23 -18
- package/src/JBProjects.sol +6 -3
- package/src/JBRulesets.sol +44 -41
- package/src/JBSplits.sol +18 -16
- package/src/JBTerminalStore.sol +32 -25
- package/src/JBTokens.sol +36 -26
- package/src/abstract/JBControlled.sol +3 -1
- package/src/abstract/JBPermissioned.sol +3 -1
- package/src/enums/JBApprovalStatus.sol +7 -1
- package/src/interfaces/IJBController.sol +7 -3
- package/src/interfaces/IJBDirectory.sol +3 -1
- package/src/interfaces/IJBMultiTerminal.sol +3 -2
- package/src/interfaces/IJBPermissions.sol +2 -1
- package/src/interfaces/IJBPrices.sol +3 -1
- package/src/interfaces/IJBRulesets.sol +2 -1
- package/src/interfaces/IJBSplits.sol +2 -1
- package/src/interfaces/IJBTerminal.sol +3 -1
- package/src/interfaces/IJBTerminalStore.sol +3 -1
- package/src/interfaces/IJBTokens.sol +2 -1
- package/src/libraries/JBCashOuts.sol +6 -1
- package/src/libraries/JBConstants.sol +12 -3
- package/src/libraries/JBCurrencyIds.sol +2 -0
- package/src/libraries/JBFees.sol +52 -10
- package/src/libraries/JBFixedPointNumber.sol +2 -0
- package/src/libraries/JBPayoutSplitGroupLib.sol +7 -4
- package/src/libraries/JBRulesetMetadataResolver.sol +4 -0
- package/src/libraries/JBSplitGroupIds.sol +2 -1
- package/src/libraries/JBSurplus.sol +3 -1
- package/src/periphery/JBMatchingPriceFeed.sol +3 -1
- package/src/structs/JBAccountingContext.sol +7 -4
- package/src/structs/JBFundAccessLimitGroup.sol +10 -17
- package/src/structs/JBRuleset.sol +18 -26
- package/src/structs/JBRulesetConfig.sol +13 -25
- package/src/structs/JBRulesetMetadata.sol +25 -32
- package/test/mock/MockMaliciousBeneficiary.sol +15 -15
- package/ADMINISTRATION.md +0 -103
- package/ARCHITECTURE.md +0 -133
- package/AUDIT_INSTRUCTIONS.md +0 -139
- package/RISKS.md +0 -215
- package/SKILLS.md +0 -55
- package/STYLE_GUIDE.md +0 -610
- package/USER_JOURNEYS.md +0 -215
- package/script/Deploy.s.sol +0 -124
- package/script/DeployPeriphery.s.sol +0 -354
- package/slither-ci.config.json +0 -10
- package/test/AuditFixes.t.sol +0 -808
- package/test/ComprehensiveInvariant.t.sol +0 -306
- package/test/CoreExploitTests.t.sol +0 -2741
- package/test/EconomicSimulation.t.sol +0 -348
- package/test/EntryPointPermutations.t.sol +0 -684
- package/test/FlashLoanAttacks.t.sol +0 -797
- package/test/PermissionEscalation.t.sol +0 -711
- package/test/PermissionsInvariant.t.sol +0 -403
- package/test/RulesetTransitions.t.sol +0 -713
- package/test/SplitLoopTests.t.sol +0 -752
- package/test/TestAccessToFunds.sol +0 -2683
- package/test/TestAuditResponseDesignProofs.sol +0 -434
- package/test/TestCashOut.sol +0 -198
- package/test/TestCashOutCountFor.sol +0 -271
- package/test/TestCashOutHooks.sol +0 -351
- package/test/TestCashOutTimingEdge.sol +0 -241
- package/test/TestDataHookFuzzing.sol +0 -524
- package/test/TestDurationUnderflow.sol +0 -233
- package/test/TestFeeFreeCashOutBypass.sol +0 -949
- package/test/TestFeeProcessingFailure.sol +0 -218
- package/test/TestFees.sol +0 -619
- package/test/TestForwardedTokenConsumption.sol +0 -425
- package/test/TestInterfaceSupport.sol +0 -81
- package/test/TestJBERC20Inheritance.sol +0 -103
- package/test/TestL2SequencerPriceFeed.sol +0 -292
- package/test/TestLaunchProject.sol +0 -188
- package/test/TestMetaTx.sol +0 -217
- package/test/TestMetadataOffsetOverflow.sol +0 -179
- package/test/TestMetadataParserLib.sol +0 -471
- package/test/TestMigrationHeldFees.sol +0 -255
- package/test/TestMintTokensOf.sol +0 -185
- package/test/TestMultiTerminalSurplus.sol +0 -348
- package/test/TestMultiTokenSurplus.sol +0 -202
- package/test/TestMultipleAccessLimits.sol +0 -664
- package/test/TestPayBurnRedeemFlow.sol +0 -195
- package/test/TestPayHooks.sol +0 -209
- package/test/TestPermissions.sol +0 -324
- package/test/TestPermissionsEdge.sol +0 -290
- package/test/TestPermit2DataHook.t.sol +0 -360
- package/test/TestPermit2Terminal.sol +0 -372
- package/test/TestRulesetQueueing.sol +0 -1025
- package/test/TestRulesetQueuingStress.sol +0 -806
- package/test/TestRulesetWeightCaching.sol +0 -178
- package/test/TestSplits.sol +0 -391
- package/test/TestTerminalMigration.sol +0 -274
- package/test/TestTerminalPreviewParity.sol +0 -208
- package/test/TestTokenFlow.sol +0 -191
- package/test/TestWeightCacheStaleAfterRejection.sol +0 -303
- package/test/WeirdTokenTests.t.sol +0 -817
- package/test/audit/CashOutReenterPay.t.sol +0 -501
- package/test/audit/CodexHeldFeeRounding.t.sol +0 -159
- package/test/audit/CodexMigrationFeeFailure.t.sol +0 -163
- package/test/audit/CrossTerminalSurplusSpoof.t.sol +0 -140
- package/test/audit/CycledSurplusAllowanceReset.t.sol +0 -184
- package/test/audit/FeeFreeSurplusLifecycle.t.sol +0 -399
- package/test/audit/FeeFreeSurplusStale.t.sol +0 -248
- package/test/audit/USDTVoidReturnCompat.t.sol +0 -525
- package/test/fork/TestChainlinkPriceFeedFork.sol +0 -254
- package/test/fork/TestSequencerPriceFeedFork.sol +0 -168
- package/test/fork/TestTerminalPreviewParityFork.sol +0 -108
- package/test/formal/BondingCurveProperties.t.sol +0 -420
- package/test/formal/FeeProperties.t.sol +0 -252
- package/test/invariants/Phase3DeepInvariant.t.sol +0 -412
- package/test/invariants/RulesetsInvariant.t.sol +0 -125
- package/test/invariants/TerminalStoreInvariant.t.sol +0 -227
- package/test/invariants/TokensInvariant.t.sol +0 -195
- package/test/invariants/handlers/ComprehensiveHandler.sol +0 -303
- package/test/invariants/handlers/EconomicHandler.sol +0 -377
- package/test/invariants/handlers/Phase3Handler.sol +0 -443
- package/test/invariants/handlers/RulesetsHandler.sol +0 -115
- package/test/invariants/handlers/TerminalStoreHandler.sol +0 -151
- package/test/invariants/handlers/TokensHandler.sol +0 -126
- package/test/regression/HoldFeesCashOutReserved.t.sol +0 -415
- package/test/regression/WeightCacheBoundary.t.sol +0 -291
- package/test/trees/JBController/burnTokensOf.tree +0 -9
- package/test/trees/JBController/claimTokensFor.tree +0 -5
- package/test/trees/JBController/deployERC20For.tree +0 -5
- package/test/trees/JBController/getRulesetOf.tree +0 -5
- package/test/trees/JBController/launchProjectFor.tree +0 -12
- package/test/trees/JBController/launchRulesetsFor.tree +0 -8
- package/test/trees/JBController/migrateController.tree +0 -12
- package/test/trees/JBController/mintTokensOf.tree +0 -12
- package/test/trees/JBController/payReservedTokenToTerminal.tree +0 -8
- package/test/trees/JBController/receiveMigrationFrom.tree +0 -4
- package/test/trees/JBController/sendReservedTokensToSplitsOf.tree +0 -12
- package/test/trees/JBController/setMetadataOf.tree +0 -5
- package/test/trees/JBController/setSplitGroupsOf.tree +0 -5
- package/test/trees/JBController/setTokenFor.tree +0 -5
- package/test/trees/JBController/transferCreditsFrom.tree +0 -8
- package/test/trees/JBDirectory/primaryTerminalOf.tree +0 -8
- package/test/trees/JBDirectory/setControllerOf.tree +0 -11
- package/test/trees/JBDirectory/setPrimaryTerminalOf.tree +0 -15
- package/test/trees/JBDirectory/setTerminalsOf.tree +0 -11
- package/test/trees/JBERC20/initialize.tree +0 -7
- package/test/trees/JBERC20/name.tree +0 -5
- package/test/trees/JBERC20/nonces.tree +0 -5
- package/test/trees/JBERC20/symbol.tree +0 -5
- package/test/trees/JBFeelessAddresses/setFeelessAddress.tree +0 -5
- package/test/trees/JBFeelessAddresses/supportsInterface.tree +0 -5
- package/test/trees/JBFundAccessLimits/payoutLimitOf.tree +0 -5
- package/test/trees/JBFundAccessLimits/payoutLimitsOf.tree +0 -8
- package/test/trees/JBFundAccessLimits/setFundAccessLimitsFor.tree +0 -18
- package/test/trees/JBFundAccessLimits/surplusAllowanceOf.tree +0 -5
- package/test/trees/JBFundAccessLimits/surplusAllowancesOf.tree +0 -8
- package/test/trees/JBMetadataResolver/getDataFor.tree +0 -8
- package/test/trees/JBMultiTerminal/accountingContextsOf.tree +0 -5
- package/test/trees/JBMultiTerminal/addAccountingContextsFor.tree +0 -10
- package/test/trees/JBMultiTerminal/addToBalanceOf.tree +0 -23
- package/test/trees/JBMultiTerminal/cashOutTokensOf.tree +0 -23
- package/test/trees/JBMultiTerminal/executePayout.tree +0 -32
- package/test/trees/JBMultiTerminal/executeProcessFee.tree +0 -14
- package/test/trees/JBMultiTerminal/migrateBalanceOf.tree +0 -12
- package/test/trees/JBMultiTerminal/pay.tree +0 -23
- package/test/trees/JBMultiTerminal/processHeldFeesOf.tree +0 -8
- package/test/trees/JBMultiTerminal/sendPayoutsOf.tree +0 -34
- package/test/trees/JBMultiTerminal/useAllowanceOf.tree +0 -16
- package/test/trees/JBPermissions/hasPermission.tree +0 -8
- package/test/trees/JBPermissions/hasPermissions.tree +0 -8
- package/test/trees/JBPermissions/setPermissionsFor.tree +0 -5
- package/test/trees/JBPrices/addPriceFeedFor.tree +0 -14
- package/test/trees/JBPrices/pricePerUnitOf.tree +0 -11
- package/test/trees/JBProjects/createFor.tree +0 -11
- package/test/trees/JBProjects/setTokenUriResolver.tree +0 -5
- package/test/trees/JBProjects/supportsInterface.tree +0 -9
- package/test/trees/JBProjects/tokenURI.tree +0 -5
- package/test/trees/JBRulesets/currentApprovalStatusForLatestRulesetOf.tree +0 -8
- package/test/trees/JBRulesets/currentOf.tree +0 -12
- package/test/trees/JBRulesets/getRulesetOf.tree +0 -5
- package/test/trees/JBRulesets/latestQueuedRulesetOf.tree +0 -10
- package/test/trees/JBRulesets/rulesetsOf.tree +0 -11
- package/test/trees/JBRulesets/upcomingRulesetOf.tree +0 -20
- package/test/trees/JBRulesets/updateRulesetWeightCache.tree +0 -5
- package/test/trees/JBSplits/setSplitGroupsOf.tree +0 -17
- package/test/trees/JBSplits/splitsOf.tree +0 -5
- package/test/trees/JBTerminalStore/currentReclaimableSurplusOf.tree +0 -16
- package/test/trees/JBTerminalStore/currentSurplusOf.tree +0 -25
- package/test/trees/JBTerminalStore/currentTotalSurplusOf.tree +0 -5
- package/test/trees/JBTerminalStore/recordCashOutsFor.tree +0 -16
- package/test/trees/JBTerminalStore/recordPaymentFrom.tree +0 -14
- package/test/trees/JBTerminalStore/recordPayoutFor.tree +0 -10
- package/test/trees/JBTerminalStore/recordTerminalMigration.tree +0 -5
- package/test/trees/JBTerminalStore/recordUsedAllowanceOf.tree +0 -10
- package/test/trees/JBTokens/burnFrom.tree +0 -10
- package/test/trees/JBTokens/claimTokensFor.tree +0 -10
- package/test/trees/JBTokens/deployERC20For.tree +0 -12
- package/test/trees/JBTokens/mintFor.tree +0 -10
- package/test/trees/JBTokens/setTokenFor.tree +0 -11
- package/test/trees/JBTokens/totalBalanceOf.tree +0 -5
- package/test/trees/JBTokens/totalSupplyOf.tree +0 -5
- package/test/trees/JBTokens/transferCreditsFrom.tree +0 -8
- package/test/trees/mintTokensOf.tree +0 -12
- package/test/units/static/JBChainlinkV3PriceFeed/TestPriceFeed.sol +0 -223
- package/test/units/static/JBController/JBControllerSetup.sol +0 -50
- package/test/units/static/JBController/TestBurnTokensOf.sol +0 -114
- package/test/units/static/JBController/TestClaimTokensFor.sol +0 -63
- package/test/units/static/JBController/TestDeployErc20For.sol +0 -86
- package/test/units/static/JBController/TestLaunchProjectFor.sol +0 -302
- package/test/units/static/JBController/TestLaunchRulesetsFor.sol +0 -342
- package/test/units/static/JBController/TestMigrateController.sol +0 -157
- package/test/units/static/JBController/TestMintTokensOfUnits.sol +0 -111
- package/test/units/static/JBController/TestOmnichainRulesetOperator.sol +0 -324
- package/test/units/static/JBController/TestPayReservedTokenToTerminal.sol +0 -74
- package/test/units/static/JBController/TestPreviewMintOf.sol +0 -117
- package/test/units/static/JBController/TestReceiveMigrationFrom.sol +0 -99
- package/test/units/static/JBController/TestRulesetViews.sol +0 -225
- package/test/units/static/JBController/TestSendReservedTokensToSplitsOf.sol +0 -615
- package/test/units/static/JBController/TestSetSplitGroupsOf.sol +0 -68
- package/test/units/static/JBController/TestSetTokenFor.sol +0 -239
- package/test/units/static/JBController/TestSetUriOf.sol +0 -57
- package/test/units/static/JBController/TestTransferCreditsFrom.sol +0 -169
- package/test/units/static/JBDeadline/TestDeadlineFuzz.sol +0 -211
- package/test/units/static/JBDirectory/JBDirectorySetup.sol +0 -26
- package/test/units/static/JBDirectory/TestPrimaryTerminalOf.sol +0 -126
- package/test/units/static/JBDirectory/TestSetControllerOf.sol +0 -183
- package/test/units/static/JBDirectory/TestSetControllerOfMigrationOrder.sol +0 -104
- package/test/units/static/JBDirectory/TestSetPrimaryTerminalOf.sol +0 -179
- package/test/units/static/JBDirectory/TestSetTerminalsOf.sol +0 -137
- package/test/units/static/JBERC20/JBERC20Setup.sol +0 -34
- package/test/units/static/JBERC20/SigUtils.sol +0 -36
- package/test/units/static/JBERC20/TestInitialize.sol +0 -60
- package/test/units/static/JBERC20/TestName.sol +0 -30
- package/test/units/static/JBERC20/TestNonces.sol +0 -62
- package/test/units/static/JBERC20/TestSymbol.sol +0 -31
- package/test/units/static/JBFeelessAdresses/JBFeelessSetup.sol +0 -22
- package/test/units/static/JBFeelessAdresses/TestInterfaces.sol +0 -30
- package/test/units/static/JBFeelessAdresses/TestSetFeelessAddress.sol +0 -35
- package/test/units/static/JBFees/TestFeesFuzz.sol +0 -79
- package/test/units/static/JBFixedPointNumber/TestAdjustDecimals.sol +0 -16
- package/test/units/static/JBFixedPointNumber/TestAdjustDecimalsFuzz.sol +0 -71
- package/test/units/static/JBFundAccessLimits/JBFundAccessSetup.sol +0 -24
- package/test/units/static/JBFundAccessLimits/TestFundAccessLimitsEdge.sol +0 -163
- package/test/units/static/JBFundAccessLimits/TestPayoutLimitOf.sol +0 -59
- package/test/units/static/JBFundAccessLimits/TestPayoutLimitsOf.sol +0 -101
- package/test/units/static/JBFundAccessLimits/TestSetFundAccessLimitsFor.sol +0 -189
- package/test/units/static/JBFundAccessLimits/TestSurplusAllowanceOf.sol +0 -64
- package/test/units/static/JBFundAccessLimits/TestSurplusAllowancesOf.sol +0 -102
- package/test/units/static/JBMetadataResolver/TestGetDataFor.sol +0 -90
- package/test/units/static/JBMetadataResolver/TestMetadataResolverEdgeCases.sol +0 -247
- package/test/units/static/JBMetadataResolver/TestMetadataResolverFuzz.sol +0 -229
- package/test/units/static/JBMultiTerminal/JBMultiTerminalSetup.sol +0 -50
- package/test/units/static/JBMultiTerminal/TestAccountingContextsOf.sol +0 -72
- package/test/units/static/JBMultiTerminal/TestAddAccountingContextsFor.sol +0 -289
- package/test/units/static/JBMultiTerminal/TestAddToBalanceOf.sol +0 -474
- package/test/units/static/JBMultiTerminal/TestCashOutTokensOf.sol +0 -624
- package/test/units/static/JBMultiTerminal/TestExecutePayout.sol +0 -578
- package/test/units/static/JBMultiTerminal/TestExecuteProcessFee.sol +0 -202
- package/test/units/static/JBMultiTerminal/TestMigrateBalanceOf.sol +0 -222
- package/test/units/static/JBMultiTerminal/TestPay.sol +0 -604
- package/test/units/static/JBMultiTerminal/TestPreviewCashOutFrom.sol +0 -117
- package/test/units/static/JBMultiTerminal/TestPreviewPayFor.sol +0 -114
- package/test/units/static/JBMultiTerminal/TestProcessHeldFeesOf.sol +0 -228
- package/test/units/static/JBMultiTerminal/TestSelfPayRevert.sol +0 -55
- package/test/units/static/JBMultiTerminal/TestSendPayoutsOf.sol +0 -257
- package/test/units/static/JBMultiTerminal/TestUseAllowanceOf.sol +0 -611
- package/test/units/static/JBPermissions/JBPermissionsSetup.sol +0 -20
- package/test/units/static/JBPermissions/TestHasPermission.sol +0 -50
- package/test/units/static/JBPermissions/TestHasPermissions.sol +0 -93
- package/test/units/static/JBPermissions/TestSetPermissionsFor.sol +0 -64
- package/test/units/static/JBPrices/JBPricesSetup.sol +0 -32
- package/test/units/static/JBPrices/TestAddPriceFeedFor.sol +0 -107
- package/test/units/static/JBPrices/TestPricePerUnitOf.sol +0 -132
- package/test/units/static/JBPrices/TestPrices.sol +0 -265
- package/test/units/static/JBProjects/JBProjectsSetup.sol +0 -22
- package/test/units/static/JBProjects/TestCreateFor.sol +0 -71
- package/test/units/static/JBProjects/TestInitialProject.sol +0 -21
- package/test/units/static/JBProjects/TestInterfaces.sol +0 -26
- package/test/units/static/JBProjects/TestSetResolver.sol +0 -37
- package/test/units/static/JBProjects/TestTokenUri.sol +0 -40
- package/test/units/static/JBRulesetMetadataResolver/TestSetCashOutTaxRateTo.sol +0 -108
- package/test/units/static/JBRulesets/JBRulesetsSetup.sol +0 -24
- package/test/units/static/JBRulesets/TestCurrentApprovalStatusForLatestRulesetOf.sol +0 -265
- package/test/units/static/JBRulesets/TestCurrentOf.sol +0 -242
- package/test/units/static/JBRulesets/TestGetRulesetOf.sol +0 -100
- package/test/units/static/JBRulesets/TestLatestQueuedRulesetOf.sol +0 -260
- package/test/units/static/JBRulesets/TestRulesets.sol +0 -632
- package/test/units/static/JBRulesets/TestRulesetsOf.sol +0 -37
- package/test/units/static/JBRulesets/TestUpcomingRulesetOf.sol +0 -522
- package/test/units/static/JBRulesets/TestUpdateRulesetWeightCache.sol +0 -96
- package/test/units/static/JBSplits/JBSplitsSetup.sol +0 -26
- package/test/units/static/JBSplits/TestSelfManagedSplitGroups.sol +0 -552
- package/test/units/static/JBSplits/TestSetSplitGroupsOf.sol +0 -377
- package/test/units/static/JBSplits/TestSplitsLockedEdge.sol +0 -267
- package/test/units/static/JBSplits/TestSplitsOf.sol +0 -24
- package/test/units/static/JBSplits/TestSplitsPacking.sol +0 -36
- package/test/units/static/JBSurplus/TestSurplusFuzz.sol +0 -160
- package/test/units/static/JBTerminalStore/JBTerminalStoreSetup.sol +0 -45
- package/test/units/static/JBTerminalStore/TestCurrentReclaimableSurplusOf.sol +0 -536
- package/test/units/static/JBTerminalStore/TestCurrentSurplusOf.sol +0 -463
- package/test/units/static/JBTerminalStore/TestCurrentTotalSurplusOf.sol +0 -135
- package/test/units/static/JBTerminalStore/TestPreviewCashOutFrom.sol +0 -476
- package/test/units/static/JBTerminalStore/TestPreviewPayFrom.sol +0 -494
- package/test/units/static/JBTerminalStore/TestRecordCashOutsFor.sol +0 -652
- package/test/units/static/JBTerminalStore/TestRecordPaymentFrom.sol +0 -744
- package/test/units/static/JBTerminalStore/TestRecordPayoutFor.sol +0 -289
- package/test/units/static/JBTerminalStore/TestRecordTerminalMigration.sol +0 -138
- package/test/units/static/JBTerminalStore/TestRecordUsedAllowanceOf.sol +0 -415
- package/test/units/static/JBTerminalStore/TestUint224Overflow.sol +0 -219
- package/test/units/static/JBTokens/JBTokensSetup.sol +0 -32
- package/test/units/static/JBTokens/TestBurnFrom.sol +0 -107
- package/test/units/static/JBTokens/TestClaimTokensFor.sol +0 -110
- package/test/units/static/JBTokens/TestDeployERC20ForUnits.sol +0 -92
- package/test/units/static/JBTokens/TestMintFor.sol +0 -100
- package/test/units/static/JBTokens/TestSetTokenFor.sol +0 -98
- package/test/units/static/JBTokens/TestTotalBalanceOf.sol +0 -65
- package/test/units/static/JBTokens/TestTotalSupplyOf.sol +0 -56
- package/test/units/static/JBTokens/TestTransferCreditsFrom.sol +0 -56
package/foundry.lock
CHANGED
package/foundry.toml
CHANGED
|
@@ -17,7 +17,7 @@ fail_on_revert = false
|
|
|
17
17
|
ethereum = "${RPC_ETHEREUM_MAINNET}"
|
|
18
18
|
|
|
19
19
|
[lint]
|
|
20
|
-
exclude_lints = ["
|
|
20
|
+
exclude_lints = ["mixed-case-variable", "pascal-case-struct"]
|
|
21
21
|
[fmt]
|
|
22
22
|
number_underscore = "thousands"
|
|
23
23
|
multiline_func_header = "all"
|
package/package.json
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/core-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/Bananapus/nana-core-v6"
|
|
8
8
|
},
|
|
9
|
+
"files": [
|
|
10
|
+
"CHANGELOG.md",
|
|
11
|
+
"foundry.lock",
|
|
12
|
+
"foundry.toml",
|
|
13
|
+
"references/",
|
|
14
|
+
"remappings.txt",
|
|
15
|
+
"script/helpers/",
|
|
16
|
+
"sphinx.lock",
|
|
17
|
+
"src/",
|
|
18
|
+
"test/helpers/",
|
|
19
|
+
"test/mock/"
|
|
20
|
+
],
|
|
9
21
|
"engines": {
|
|
10
22
|
"node": ">=20.0.0"
|
|
11
23
|
},
|
|
@@ -26,13 +38,13 @@
|
|
|
26
38
|
"artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'nana-core-v6'"
|
|
27
39
|
},
|
|
28
40
|
"dependencies": {
|
|
29
|
-
"@bananapus/permission-ids-v6": "
|
|
30
|
-
"@chainlink/contracts": "
|
|
31
|
-
"@openzeppelin/contracts": "
|
|
32
|
-
"@prb/math": "
|
|
33
|
-
"@uniswap/permit2": "github:Uniswap/permit2"
|
|
41
|
+
"@bananapus/permission-ids-v6": "0.0.22",
|
|
42
|
+
"@chainlink/contracts": "1.5.0",
|
|
43
|
+
"@openzeppelin/contracts": "5.6.1",
|
|
44
|
+
"@prb/math": "4.1.1",
|
|
45
|
+
"@uniswap/permit2": "github:Uniswap/permit2#cc56ad0f3439c502c246fc5cfcc3db92bb8b7219"
|
|
34
46
|
},
|
|
35
47
|
"devDependencies": {
|
|
36
|
-
"@sphinx-labs/plugins": "
|
|
48
|
+
"@sphinx-labs/plugins": "0.33.3"
|
|
37
49
|
}
|
|
38
50
|
}
|
|
@@ -6,7 +6,9 @@ import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interf
|
|
|
6
6
|
import {IJBPriceFeed} from "./interfaces/IJBPriceFeed.sol";
|
|
7
7
|
import {JBFixedPointNumber} from "./libraries/JBFixedPointNumber.sol";
|
|
8
8
|
|
|
9
|
-
/// @notice
|
|
9
|
+
/// @notice A price feed adapter that reads from a Chainlink V3 aggregator. Reverts if the price is stale (older than
|
|
10
|
+
/// `THRESHOLD` seconds), negative, or from an incomplete round — protecting against serving outdated oracle data.
|
|
11
|
+
/// Used by `JBPrices` to convert between currencies (e.g. ETH/USD).
|
|
10
12
|
contract JBChainlinkV3PriceFeed is IJBPriceFeed {
|
|
11
13
|
// A library that provides utility for fixed point numbers.
|
|
12
14
|
using JBFixedPointNumber for uint256;
|
|
@@ -60,6 +62,7 @@ contract JBChainlinkV3PriceFeed is IJBPriceFeed {
|
|
|
60
62
|
if (answeredInRound < roundId) revert JBChainlinkV3PriceFeed_IncompleteRound();
|
|
61
63
|
|
|
62
64
|
// Make sure the price's update threshold is met.
|
|
65
|
+
// forge-lint: disable-next-line(block-timestamp)
|
|
63
66
|
if (block.timestamp > THRESHOLD + updatedAt) {
|
|
64
67
|
revert JBChainlinkV3PriceFeed_StalePrice(block.timestamp, THRESHOLD, updatedAt);
|
|
65
68
|
}
|
|
@@ -6,8 +6,9 @@ import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interf
|
|
|
6
6
|
|
|
7
7
|
import {JBChainlinkV3PriceFeed} from "./JBChainlinkV3PriceFeed.sol";
|
|
8
8
|
|
|
9
|
-
/// @notice
|
|
10
|
-
///
|
|
9
|
+
/// @notice Extends `JBChainlinkV3PriceFeed` with L2 sequencer uptime checks (for Optimism, Arbitrum, etc.). Reverts if
|
|
10
|
+
/// the sequencer is down or has not been back online for at least `GRACE_PERIOD_TIME` seconds — preventing stale
|
|
11
|
+
/// prices from being used immediately after an outage.
|
|
11
12
|
contract JBChainlinkV3SequencerPriceFeed is JBChainlinkV3PriceFeed {
|
|
12
13
|
//*********************************************************************//
|
|
13
14
|
// --------------------------- custom errors ------------------------- //
|
|
@@ -64,6 +65,7 @@ contract JBChainlinkV3SequencerPriceFeed is JBChainlinkV3PriceFeed {
|
|
|
64
65
|
if (startedAt == 0) revert JBChainlinkV3SequencerPriceFeed_InvalidRound();
|
|
65
66
|
|
|
66
67
|
// Revert if sequencer has too recently restarted or is currently down.
|
|
68
|
+
// forge-lint: disable-next-line(block-timestamp)
|
|
67
69
|
if (block.timestamp <= GRACE_PERIOD_TIME + startedAt || answer != 0) {
|
|
68
70
|
revert JBChainlinkV3SequencerPriceFeed_SequencerDownOrRestarting(
|
|
69
71
|
block.timestamp, GRACE_PERIOD_TIME, startedAt
|
package/src/JBController.sol
CHANGED
|
@@ -41,8 +41,13 @@ import {JBSplitGroup} from "./structs/JBSplitGroup.sol";
|
|
|
41
41
|
import {JBSplitHookContext} from "./structs/JBSplitHookContext.sol";
|
|
42
42
|
import {JBTerminalConfig} from "./structs/JBTerminalConfig.sol";
|
|
43
43
|
|
|
44
|
-
/// @notice
|
|
45
|
-
///
|
|
44
|
+
/// @notice The orchestrator for every Juicebox project's lifecycle. Use the controller to launch a project, queue new
|
|
45
|
+
/// rulesets (funding cycles), mint or burn tokens, deploy an ERC-20, distribute reserved tokens, and manage
|
|
46
|
+
/// permissions. The controller coordinates between the terminal (money), rulesets (rules), tokens (issuance), and
|
|
47
|
+
/// splits (distribution).
|
|
48
|
+
/// @dev Supports ERC-2771 meta-transactions. Implements `IJBMigratable` for controller-to-controller migration.
|
|
49
|
+
/// An omnichain deployer address is trusted to launch and queue rulesets on behalf of any project for cross-chain
|
|
50
|
+
/// coordination.
|
|
46
51
|
contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigratable {
|
|
47
52
|
// A library that parses packed ruleset metadata into a friendlier format.
|
|
48
53
|
using JBRulesetMetadataResolver for JBRuleset;
|
|
@@ -166,8 +171,9 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
166
171
|
// ---------------------- external transactions ---------------------- //
|
|
167
172
|
//*********************************************************************//
|
|
168
173
|
|
|
169
|
-
/// @notice
|
|
170
|
-
/// @dev Can only be called by the project's owner or an
|
|
174
|
+
/// @notice Registers a price feed so the project can use a new currency for payout limits or surplus allowances.
|
|
175
|
+
/// @dev Can only be called by the project's owner or an operator with `ADD_PRICE_FEED` permission. The current
|
|
176
|
+
/// ruleset must have `allowAddPriceFeed` enabled.
|
|
171
177
|
/// @param projectId The ID of the project to add the feed for.
|
|
172
178
|
/// @param pricingCurrency The currency the feed's output price is in terms of.
|
|
173
179
|
/// @param unitCurrency The currency being priced by the feed.
|
|
@@ -234,9 +240,9 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
234
240
|
}
|
|
235
241
|
}
|
|
236
242
|
|
|
237
|
-
/// @notice Burns a
|
|
238
|
-
///
|
|
239
|
-
/// terminal.
|
|
243
|
+
/// @notice Burns a holder's project tokens (or credits), permanently removing them from supply. Used by terminals
|
|
244
|
+
/// during cash outs, or directly by holders who want to burn voluntarily.
|
|
245
|
+
/// @dev Can only be called by the holder, an operator with `BURN_TOKENS` permission, or a project terminal.
|
|
240
246
|
/// @param holder The address whose tokens are being burned.
|
|
241
247
|
/// @param projectId The ID of the project whose tokens are being burned.
|
|
242
248
|
/// @param tokenCount The number of tokens to burn.
|
|
@@ -269,8 +275,9 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
269
275
|
TOKENS.burnFrom({holder: holder, projectId: projectId, count: tokenCount});
|
|
270
276
|
}
|
|
271
277
|
|
|
272
|
-
/// @notice
|
|
273
|
-
///
|
|
278
|
+
/// @notice Converts internal credits into the project's ERC-20 token, transferring them to the beneficiary's
|
|
279
|
+
/// wallet. Credits and ERC-20 tokens are interchangeable — this just makes them transferable/tradeable.
|
|
280
|
+
/// @dev Can only be called by the credit holder or an operator with `CLAIM_TOKENS` permission.
|
|
274
281
|
/// @param holder The address to redeem credits from.
|
|
275
282
|
/// @param projectId The ID of the project whose tokens are being claimed.
|
|
276
283
|
/// @param tokenCount The number of tokens to claim.
|
|
@@ -290,9 +297,10 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
290
297
|
TOKENS.claimTokensFor({holder: holder, projectId: projectId, count: tokenCount, beneficiary: beneficiary});
|
|
291
298
|
}
|
|
292
299
|
|
|
293
|
-
/// @notice Deploys
|
|
294
|
-
///
|
|
295
|
-
/// @dev Can only be called by the project's owner or an
|
|
300
|
+
/// @notice Deploys a new ERC-20 token for a project. Once deployed, holders can claim their credits as this token.
|
|
301
|
+
/// Includes ERC20Votes (governance) and ERC20Permit (gasless approvals).
|
|
302
|
+
/// @dev Can only be called by the project's owner or an operator with `DEPLOY_ERC20` permission.
|
|
303
|
+
/// @dev Each project can only have one ERC-20 deployed — calling this again after deployment will revert.
|
|
296
304
|
/// @param projectId The ID of the project to deploy the ERC-20 for.
|
|
297
305
|
/// @param name The ERC-20's name.
|
|
298
306
|
/// @param symbol The ERC-20's symbol.
|
|
@@ -368,10 +376,11 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
368
376
|
}
|
|
369
377
|
}
|
|
370
378
|
|
|
371
|
-
/// @notice Creates a project
|
|
372
|
-
///
|
|
373
|
-
///
|
|
374
|
-
/// @dev Anyone can
|
|
379
|
+
/// @notice Creates a new Juicebox project in one transaction — mints the project NFT, queues initial rulesets,
|
|
380
|
+
/// and
|
|
381
|
+
/// configures terminals. This is the primary entry point for launching a project.
|
|
382
|
+
/// @dev Anyone can call this on behalf of any owner. Each sub-operation (mint, queue, configure) can also be done
|
|
383
|
+
/// individually if needed.
|
|
375
384
|
/// @param owner The project's owner. The project ERC-721 will be minted to this address.
|
|
376
385
|
/// @param projectUri The project's metadata URI. This is typically an IPFS hash, optionally with the `ipfs://`
|
|
377
386
|
/// prefix. This can be updated by the project's owner.
|
|
@@ -414,17 +423,19 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
414
423
|
});
|
|
415
424
|
}
|
|
416
425
|
|
|
417
|
-
/// @notice
|
|
418
|
-
///
|
|
419
|
-
/// @dev
|
|
420
|
-
/// @dev
|
|
426
|
+
/// @notice Queues the first rulesets for an existing project and configures its terminals. For projects that
|
|
427
|
+
/// already have active rulesets, use `queueRulesetsOf(...)` instead.
|
|
428
|
+
/// @dev Can only be called by the project's owner or an operator with `LAUNCH_RULESETS` permission.
|
|
429
|
+
/// @dev Each sub-operation can also be done individually if needed.
|
|
421
430
|
/// @param projectId The ID of the project to launch rulesets for.
|
|
431
|
+
/// @param projectUri The project's metadata URI. Pass an empty string to leave it unchanged.
|
|
422
432
|
/// @param rulesetConfigurations The rulesets to queue.
|
|
423
433
|
/// @param terminalConfigurations The terminals to set up.
|
|
424
434
|
/// @param memo A memo to pass along to the emitted event.
|
|
425
435
|
/// @return rulesetId The ID of the last successfully queued ruleset.
|
|
426
436
|
function launchRulesetsFor(
|
|
427
437
|
uint256 projectId,
|
|
438
|
+
string calldata projectUri,
|
|
428
439
|
JBRulesetConfig[] calldata rulesetConfigurations,
|
|
429
440
|
JBTerminalConfig[] calldata terminalConfigurations,
|
|
430
441
|
string calldata memo
|
|
@@ -455,11 +466,25 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
455
466
|
alsoGrantAccessIf: sender == OMNICHAIN_RULESET_OPERATOR
|
|
456
467
|
});
|
|
457
468
|
|
|
469
|
+
if (bytes(projectUri).length > 0) {
|
|
470
|
+
_requirePermissionAllowingOverrideFrom({
|
|
471
|
+
account: PROJECTS.ownerOf(projectId),
|
|
472
|
+
projectId: projectId,
|
|
473
|
+
permissionId: JBPermissionIds.SET_PROJECT_URI,
|
|
474
|
+
alsoGrantAccessIf: sender == OMNICHAIN_RULESET_OPERATOR
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
|
|
458
478
|
// If the project has already had rulesets, use `queueRulesetsOf(...)` instead.
|
|
459
479
|
if (RULESETS.latestRulesetIdOf(projectId) > 0) {
|
|
460
480
|
revert JBController_RulesetsAlreadyLaunched(projectId);
|
|
461
481
|
}
|
|
462
482
|
|
|
483
|
+
// If provided, set the project's metadata URI.
|
|
484
|
+
if (bytes(projectUri).length > 0) {
|
|
485
|
+
uriOf[projectId] = projectUri;
|
|
486
|
+
}
|
|
487
|
+
|
|
463
488
|
// Set this contract as the project's controller in the directory.
|
|
464
489
|
DIRECTORY.setControllerOf({projectId: projectId, controller: IERC165(this)});
|
|
465
490
|
|
|
@@ -470,7 +495,9 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
470
495
|
// slither-disable-next-line reentrancy-events
|
|
471
496
|
rulesetId = _queueRulesets({projectId: projectId, rulesetConfigurations: rulesetConfigurations});
|
|
472
497
|
|
|
473
|
-
emit LaunchRulesets({
|
|
498
|
+
emit LaunchRulesets({
|
|
499
|
+
rulesetId: rulesetId, projectId: projectId, projectUri: projectUri, memo: memo, caller: _msgSender()
|
|
500
|
+
});
|
|
474
501
|
}
|
|
475
502
|
|
|
476
503
|
/// @notice Migrate a project from this controller to another one.
|
|
@@ -490,12 +517,10 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
490
517
|
if (pendingReservedTokenBalance != 0) revert JBController_PendingReservedTokens(pendingReservedTokenBalance);
|
|
491
518
|
}
|
|
492
519
|
|
|
493
|
-
/// @notice
|
|
494
|
-
///
|
|
495
|
-
/// @dev Can
|
|
496
|
-
/// the
|
|
497
|
-
/// @dev If the ruleset's metadata has `allowOwnerMinting` set to `false`, this function can only be called by the
|
|
498
|
-
/// project's terminals or data hook.
|
|
520
|
+
/// @notice Mints new project tokens to a beneficiary. Optionally reserves a portion according to the ruleset's
|
|
521
|
+
/// reserved percent (which accumulates until `sendReservedTokensToSplitsOf` is called).
|
|
522
|
+
/// @dev Can be called by the project owner, an operator with `MINT_TOKENS` permission, a project terminal, or the
|
|
523
|
+
/// data hook. If `allowOwnerMinting` is false in the current ruleset, only terminals and the data hook can mint.
|
|
499
524
|
/// @param projectId The ID of the project whose tokens are being minted.
|
|
500
525
|
/// @param tokenCount The number of tokens to mint, including any reserved tokens.
|
|
501
526
|
/// @param beneficiary The address which will receive the (non-reserved) tokens.
|
|
@@ -576,9 +601,9 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
576
601
|
}
|
|
577
602
|
}
|
|
578
603
|
|
|
579
|
-
/// @notice
|
|
580
|
-
/// previous ruleset
|
|
581
|
-
/// @dev Can only be called by the project's owner or an
|
|
604
|
+
/// @notice Queues new rulesets to take effect after the current one ends. Each queued ruleset must be approved by
|
|
605
|
+
/// the previous ruleset's approval hook (if one is set) before it can take effect.
|
|
606
|
+
/// @dev Can only be called by the project's owner or an operator with `QUEUE_RULESETS` permission.
|
|
582
607
|
/// @param projectId The ID of the project to queue rulesets for.
|
|
583
608
|
/// @param rulesetConfigurations The rulesets to queue.
|
|
584
609
|
/// @param memo A memo to pass along to the emitted event.
|
|
@@ -610,17 +635,18 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
610
635
|
emit QueueRulesets({rulesetId: rulesetId, projectId: projectId, memo: memo, caller: _msgSender()});
|
|
611
636
|
}
|
|
612
637
|
|
|
613
|
-
/// @notice
|
|
614
|
-
///
|
|
615
|
-
/// the project
|
|
638
|
+
/// @notice Mints and distributes all pending reserved tokens to the project's reserved token split recipients.
|
|
639
|
+
/// Anyone can call this — it's permissionless.
|
|
640
|
+
/// @dev If splits don't add up to 100%, the remainder goes to the project owner.
|
|
616
641
|
/// @param projectId The ID of the project to send reserved tokens for.
|
|
617
642
|
/// @return The amount of reserved tokens minted and sent.
|
|
618
643
|
function sendReservedTokensToSplitsOf(uint256 projectId) external override returns (uint256) {
|
|
619
644
|
return _sendReservedTokensToSplitsOf(projectId);
|
|
620
645
|
}
|
|
621
646
|
|
|
622
|
-
/// @notice
|
|
623
|
-
///
|
|
647
|
+
/// @notice Configures how a project distributes payouts and reserved tokens. Locked splits from the current
|
|
648
|
+
/// configuration must be preserved in the new split groups.
|
|
649
|
+
/// @dev Can only be called by the project's owner or an operator with `SET_SPLIT_GROUPS` permission.
|
|
624
650
|
/// @param projectId The ID of the project to set the split groups of.
|
|
625
651
|
/// @param rulesetId The ID of the ruleset the split groups should be active in. Use a `rulesetId` of 0 to set the
|
|
626
652
|
/// default split groups, which are used when a ruleset has no splits set. If there are no default splits and no
|
|
@@ -698,8 +724,10 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
698
724
|
emit SetUri({projectId: projectId, uri: uri, caller: _msgSender()});
|
|
699
725
|
}
|
|
700
726
|
|
|
701
|
-
/// @notice
|
|
702
|
-
///
|
|
727
|
+
/// @notice Transfers internal credits (unclaimed tokens) from one address to another. Credits function like tokens
|
|
728
|
+
/// but live inside the protocol rather than as an ERC-20.
|
|
729
|
+
/// @dev Can only be called by the credit holder or an operator with `TRANSFER_CREDITS` permission. The current
|
|
730
|
+
/// ruleset must not have credit transfers paused.
|
|
703
731
|
/// @param holder The address to transfer credits from.
|
|
704
732
|
/// @param projectId The ID of the project whose credits are being transferred.
|
|
705
733
|
/// @param recipient The address to transfer credits to.
|
|
@@ -729,8 +757,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
729
757
|
// ------------------------- external views -------------------------- //
|
|
730
758
|
//*********************************************************************//
|
|
731
759
|
|
|
732
|
-
/// @notice
|
|
733
|
-
/// earliest.
|
|
760
|
+
/// @notice Returns a paginated history of a project's rulesets (with decoded metadata), sorted newest-first.
|
|
734
761
|
/// @param projectId The ID of the project to get the rulesets of.
|
|
735
762
|
/// @param startingId The ID of the ruleset to begin with. This will be the latest ruleset in the result. If the
|
|
736
763
|
/// `startingId` is 0, passed, the project's latest ruleset will be used.
|
|
@@ -768,7 +795,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
768
795
|
}
|
|
769
796
|
}
|
|
770
797
|
|
|
771
|
-
/// @notice
|
|
798
|
+
/// @notice Returns the ruleset currently governing a project, along with its decoded metadata.
|
|
772
799
|
/// @param projectId The ID of the project to get the current ruleset of.
|
|
773
800
|
/// @return ruleset The current ruleset's struct.
|
|
774
801
|
/// @return metadata The current ruleset's metadata.
|
|
@@ -844,21 +871,21 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
844
871
|
});
|
|
845
872
|
}
|
|
846
873
|
|
|
847
|
-
/// @notice
|
|
874
|
+
/// @notice Whether the project's current ruleset allows migrating to a different controller.
|
|
848
875
|
/// @param projectId The ID of the project to check.
|
|
849
876
|
/// @return A `bool` which is true if the project allows controllers to be set.
|
|
850
877
|
function setControllerAllowed(uint256 projectId) external view returns (bool) {
|
|
851
878
|
return _currentRulesetOf(projectId).expandMetadata().allowSetController;
|
|
852
879
|
}
|
|
853
880
|
|
|
854
|
-
/// @notice
|
|
881
|
+
/// @notice Whether the project's current ruleset allows changing its terminals.
|
|
855
882
|
/// @param projectId The ID of the project to check.
|
|
856
883
|
/// @return A `bool` which is true if the project allows terminals to be set.
|
|
857
884
|
function setTerminalsAllowed(uint256 projectId) external view returns (bool) {
|
|
858
885
|
return _currentRulesetOf(projectId).expandMetadata().allowSetTerminals;
|
|
859
886
|
}
|
|
860
887
|
|
|
861
|
-
/// @notice
|
|
888
|
+
/// @notice Returns the project's total token supply including tokens that have been reserved but not yet minted.
|
|
862
889
|
/// @param projectId The ID of the project to get the total token supply of.
|
|
863
890
|
/// @return The total supply of the project's token, including pending reserved tokens.
|
|
864
891
|
function totalTokenSupplyWithReservedTokensOf(uint256 projectId) external view override returns (uint256) {
|
|
@@ -866,7 +893,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
866
893
|
return TOKENS.totalSupplyOf(projectId) + pendingReservedTokenBalanceOf[projectId];
|
|
867
894
|
}
|
|
868
895
|
|
|
869
|
-
/// @notice
|
|
896
|
+
/// @notice Returns the ruleset that will take effect after the current one ends, along with its decoded metadata.
|
|
870
897
|
/// @dev If an upcoming ruleset isn't found, returns an empty ruleset with all properties set to 0.
|
|
871
898
|
/// @param projectId The ID of the project to get the next ruleset of.
|
|
872
899
|
/// @return ruleset The upcoming ruleset's struct.
|
package/src/JBDeadline.sol
CHANGED
|
@@ -7,10 +7,9 @@ import {JBApprovalStatus} from "./enums/JBApprovalStatus.sol";
|
|
|
7
7
|
import {IJBRulesetApprovalHook} from "./interfaces/IJBRulesetApprovalHook.sol";
|
|
8
8
|
import {JBRuleset} from "./structs/JBRuleset.sol";
|
|
9
9
|
|
|
10
|
-
/// @notice
|
|
11
|
-
/// seconds before the current ruleset ends
|
|
12
|
-
///
|
|
13
|
-
/// only if they are approved by the previous ruleset's approval hook.
|
|
10
|
+
/// @notice A ruleset approval hook that enforces a queuing deadline. If a new ruleset is not queued at least `DURATION`
|
|
11
|
+
/// seconds before the current ruleset ends, it is rejected and the existing rules continue. This gives token holders
|
|
12
|
+
/// a guaranteed notice period before any project configuration changes take effect.
|
|
14
13
|
/// @dev If `DURATION` is set longer than the ruleset's cycle duration, no queued ruleset can ever satisfy the deadline
|
|
15
14
|
/// and the current ruleset will effectively be locked in perpetuity. Choose a `DURATION` shorter than the shortest
|
|
16
15
|
/// cycle it will govern.
|
|
@@ -60,6 +59,7 @@ contract JBDeadline is IJBRulesetApprovalHook {
|
|
|
60
59
|
// If we've already passed the deadline, the ruleset is `Approved`.
|
|
61
60
|
return (ruleset.start - ruleset.id < DURATION)
|
|
62
61
|
? JBApprovalStatus.Failed
|
|
62
|
+
// forge-lint: disable-next-line(block-timestamp)
|
|
63
63
|
: (block.timestamp + DURATION < ruleset.start)
|
|
64
64
|
? JBApprovalStatus.ApprovalExpected
|
|
65
65
|
: JBApprovalStatus.Approved;
|
package/src/JBDirectory.sol
CHANGED
|
@@ -13,9 +13,11 @@ import {IJBPermissions} from "./interfaces/IJBPermissions.sol";
|
|
|
13
13
|
import {IJBProjects} from "./interfaces/IJBProjects.sol";
|
|
14
14
|
import {IJBTerminal} from "./interfaces/IJBTerminal.sol";
|
|
15
15
|
|
|
16
|
-
/// @notice
|
|
17
|
-
///
|
|
18
|
-
///
|
|
16
|
+
/// @notice The routing table for the protocol. Every project registers which terminals accept its payments and which
|
|
17
|
+
/// controller manages its rulesets and tokens. Frontends and other contracts use the directory to discover where to
|
|
18
|
+
/// send funds for a given project and token.
|
|
19
|
+
/// @dev Also manages controller migration — when a project upgrades its controller, the directory orchestrates the
|
|
20
|
+
/// handoff including `beforeReceiveMigrationFrom`, `migrate`, and `afterReceiveMigrationFrom` lifecycle hooks.
|
|
19
21
|
contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
20
22
|
//*********************************************************************//
|
|
21
23
|
// --------------------------- custom errors ------------------------- //
|
|
@@ -83,12 +85,14 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
83
85
|
// ---------------------- external transactions ---------------------- //
|
|
84
86
|
//*********************************************************************//
|
|
85
87
|
|
|
86
|
-
/// @notice
|
|
88
|
+
/// @notice Assign a new controller to a project. The controller dictates how the project's terminals interact with
|
|
89
|
+
/// its tokens and rulesets. If the project already has a controller, this triggers a full migration lifecycle
|
|
90
|
+
/// (`beforeReceiveMigrationFrom` → `migrate` → state update → `afterReceiveMigrationFrom`).
|
|
87
91
|
/// @dev Can only be called if:
|
|
88
|
-
/// - The ruleset's metadata has `allowSetController` enabled, and the
|
|
89
|
-
///
|
|
90
|
-
/// - OR the
|
|
91
|
-
/// - OR
|
|
92
|
+
/// - The ruleset's metadata has `allowSetController` enabled, and the caller is the project's owner or has
|
|
93
|
+
/// `SET_CONTROLLER` permission.
|
|
94
|
+
/// - OR the caller is the project's current controller.
|
|
95
|
+
/// - OR the caller `isAllowedToSetFirstController` and the project has no controller yet.
|
|
92
96
|
/// @param projectId The ID of the project whose controller is being set.
|
|
93
97
|
/// @param controller The address of the controller to set.
|
|
94
98
|
function setControllerOf(uint256 projectId, IERC165 controller) external override {
|
|
@@ -149,15 +153,13 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
/// @notice
|
|
153
|
-
/// controller
|
|
154
|
-
/// @dev Only this contract's owner can call this function.
|
|
155
|
-
///
|
|
156
|
-
///
|
|
157
|
-
/// @
|
|
158
|
-
/// @param
|
|
159
|
-
/// @param flag Whether the address is allowed to set first controllers for projects. Use `true` to allow and
|
|
160
|
-
/// `false` to not allow.
|
|
156
|
+
/// @notice Allow or disallow an address to set the first controller for new projects. Typically used to whitelist
|
|
157
|
+
/// deployer contracts (like `JBController`) that set a controller during `launchProjectFor`.
|
|
158
|
+
/// @dev Only this contract's owner can call this function. These addresses are vetted controllers and project
|
|
159
|
+
/// launchers. A project owner can always set their own controller — this list only governs *first* controller
|
|
160
|
+
/// assignment by third parties.
|
|
161
|
+
/// @param addr The address to allow or disallow.
|
|
162
|
+
/// @param flag Whether the address is allowed to set first controllers. `true` to allow, `false` to revoke.
|
|
161
163
|
function setIsAllowedToSetFirstController(address addr, bool flag) external override onlyOwner {
|
|
162
164
|
// Set the flag in the allowlist.
|
|
163
165
|
isAllowedToSetFirstController[addr] = flag;
|
|
@@ -165,11 +167,11 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
165
167
|
emit SetIsAllowedToSetFirstController({addr: addr, isAllowed: flag, caller: msg.sender});
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
/// @notice
|
|
169
|
-
///
|
|
170
|
-
/// @dev
|
|
171
|
-
///
|
|
172
|
-
/// `
|
|
170
|
+
/// @notice Designate which terminal should receive payments by default when someone pays a project in a specific
|
|
171
|
+
/// token. Useful when a project has multiple terminals that accept the same token.
|
|
172
|
+
/// @dev Can only be called by the project's owner or an address with `SET_PRIMARY_TERMINAL` permission. The
|
|
173
|
+
/// terminal must accept the token for this project. If the terminal isn't already in the project's terminal list,
|
|
174
|
+
/// it will be added automatically (requires `ADD_TERMINALS` permission).
|
|
173
175
|
/// @param projectId The ID of the project whose primary terminal is being set.
|
|
174
176
|
/// @param token The token to set the primary terminal for.
|
|
175
177
|
/// @param terminal The terminal being set as the primary terminal.
|
|
@@ -203,10 +205,10 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
203
205
|
emit SetPrimaryTerminal({projectId: projectId, token: token, terminal: terminal, caller: msg.sender});
|
|
204
206
|
}
|
|
205
207
|
|
|
206
|
-
/// @notice
|
|
207
|
-
///
|
|
208
|
-
/// the project's
|
|
209
|
-
///
|
|
208
|
+
/// @notice Replace a project's entire terminal list. Terminals are the contracts that accept payments and process
|
|
209
|
+
/// cash outs for a project. This overwrites the existing list.
|
|
210
|
+
/// @dev Can only be called by the project's owner, an address with `SET_TERMINALS` permission, or the project's
|
|
211
|
+
/// controller. Unless the caller is the controller, the ruleset must have `allowSetTerminals` enabled.
|
|
210
212
|
/// @param projectId The ID of the project whose terminals are being set.
|
|
211
213
|
/// @param terminals An array of terminal addresses to set for the project.
|
|
212
214
|
function setTerminalsOf(uint256 projectId, IJBTerminal[] calldata terminals) external override {
|
|
@@ -254,10 +256,9 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
254
256
|
// ------------------------- external views -------------------------- //
|
|
255
257
|
//*********************************************************************//
|
|
256
258
|
|
|
257
|
-
/// @notice
|
|
258
|
-
///
|
|
259
|
-
///
|
|
260
|
-
/// @dev Returns the zero address if no terminal accepts the token.
|
|
259
|
+
/// @notice Look up the terminal where payments in a given token should be sent for a project. Returns the
|
|
260
|
+
/// explicitly-set primary terminal, or falls back to the first terminal in the project's list that accepts the
|
|
261
|
+
/// token. Returns the zero address if no terminal accepts the token.
|
|
261
262
|
/// @param projectId The ID of the project to get the primary terminal of.
|
|
262
263
|
/// @param token The token that the terminal accepts.
|
|
263
264
|
/// @return The primary terminal's address.
|
|
@@ -298,7 +299,8 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
298
299
|
return IJBTerminal(address(0));
|
|
299
300
|
}
|
|
300
301
|
|
|
301
|
-
/// @notice
|
|
302
|
+
/// @notice Get all terminals registered for a project. Terminals are the contracts that hold a project's funds and
|
|
303
|
+
/// process payments and cash outs on its behalf.
|
|
302
304
|
/// @param projectId The ID of the project to get the terminals of.
|
|
303
305
|
/// @return An array of the project's terminal addresses.
|
|
304
306
|
function terminalsOf(uint256 projectId) external view override returns (IJBTerminal[] memory) {
|
|
@@ -309,7 +311,7 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
309
311
|
// -------------------------- public views --------------------------- //
|
|
310
312
|
//*********************************************************************//
|
|
311
313
|
|
|
312
|
-
/// @notice Check
|
|
314
|
+
/// @notice Check whether a specific terminal is in a project's registered terminal list.
|
|
313
315
|
/// @param projectId The ID of the project to check.
|
|
314
316
|
/// @param terminal The terminal to check for.
|
|
315
317
|
/// @return A flag indicating whether the project uses the terminal.
|
package/src/JBERC20.sol
CHANGED
|
@@ -15,10 +15,11 @@ import {IJBProjects} from "./interfaces/IJBProjects.sol";
|
|
|
15
15
|
import {IJBToken} from "./interfaces/IJBToken.sol";
|
|
16
16
|
import {IJBTokens} from "./interfaces/IJBTokens.sol";
|
|
17
17
|
|
|
18
|
-
/// @notice
|
|
19
|
-
///
|
|
20
|
-
///
|
|
21
|
-
/// @dev `
|
|
18
|
+
/// @notice The ERC-20 token implementation used by Juicebox projects. Includes ERC20Votes (governance delegation) and
|
|
19
|
+
/// ERC20Permit (gasless approvals). Deployed as a minimal clone via `JBController.deployERC20For` — once deployed,
|
|
20
|
+
/// holders can claim their internal credits into this transferable token.
|
|
21
|
+
/// @dev Only `JBTokens` can mint and burn. The project owner (via `SET_TOKEN_METADATA` permission) can rename the
|
|
22
|
+
/// token. Supports ERC-1271 signature validation for smart-contract wallets.
|
|
22
23
|
contract JBERC20 is ERC20Votes, ERC20Permit, JBPermissioned, IERC1271, IJBToken {
|
|
23
24
|
//*********************************************************************//
|
|
24
25
|
// --------------------------- custom errors ------------------------- //
|
|
@@ -6,7 +6,9 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
|
6
6
|
|
|
7
7
|
import {IJBFeelessAddresses} from "./interfaces/IJBFeelessAddresses.sol";
|
|
8
8
|
|
|
9
|
-
/// @notice
|
|
9
|
+
/// @notice A registry of addresses exempt from the protocol's 2.5% fee. Feeless addresses don't incur fees on
|
|
10
|
+
/// payouts they receive, surplus allowance they use, or cash outs where they are the beneficiary. Managed by the
|
|
11
|
+
/// contract owner (typically the protocol multisig).
|
|
10
12
|
contract JBFeelessAddresses is Ownable, IJBFeelessAddresses, IERC165 {
|
|
11
13
|
//*********************************************************************//
|
|
12
14
|
// --------------------- public stored properties -------------------- //
|
|
@@ -30,8 +32,9 @@ contract JBFeelessAddresses is Ownable, IJBFeelessAddresses, IERC165 {
|
|
|
30
32
|
// ---------------------- external transactions ---------------------- //
|
|
31
33
|
//*********************************************************************//
|
|
32
34
|
|
|
33
|
-
/// @notice
|
|
34
|
-
///
|
|
35
|
+
/// @notice Add or remove an address from the fee-exempt list. Feeless addresses don't pay the 2.5% protocol fee
|
|
36
|
+
/// on payouts received, surplus allowance used, or cash outs where they're the beneficiary.
|
|
37
|
+
/// @dev Can only be called by this contract's owner (typically the protocol multisig).
|
|
35
38
|
/// @param addr The address to set as feeless or not feeless.
|
|
36
39
|
/// @param flag Whether the address should be feeless (`true`) or not feeless (`false`).
|
|
37
40
|
function setFeelessAddress(address addr, bool flag) external virtual override onlyOwner {
|