@bananapus/721-hook-v6 0.0.42 → 0.0.45

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 (86) hide show
  1. package/foundry.lock +1 -7
  2. package/foundry.toml +1 -1
  3. package/package.json +20 -9
  4. package/script/Deploy.s.sol +2 -2
  5. package/src/JB721Checkpoints.sol +61 -19
  6. package/src/JB721CheckpointsDeployer.sol +10 -5
  7. package/src/JB721TiersHook.sol +66 -53
  8. package/src/JB721TiersHookDeployer.sol +8 -5
  9. package/src/JB721TiersHookProjectDeployer.sol +87 -46
  10. package/src/JB721TiersHookStore.sol +137 -107
  11. package/src/abstract/JB721Hook.sol +8 -6
  12. package/src/interfaces/IJB721Checkpoints.sol +21 -14
  13. package/src/interfaces/IJB721CheckpointsDeployer.sol +7 -3
  14. package/src/interfaces/IJB721TiersHook.sol +3 -3
  15. package/src/interfaces/IJB721TiersHookProjectDeployer.sol +4 -2
  16. package/src/interfaces/IJB721TiersHookStore.sol +11 -11
  17. package/src/libraries/JB721TiersHookLib.sol +1 -1
  18. package/src/structs/JB721TiersHookFlags.sol +1 -1
  19. package/src/structs/JBPayDataHookRulesetMetadata.sol +1 -1
  20. package/test/utils/AccessJBLib.sol +49 -0
  21. package/test/utils/ForTest_JB721TiersHook.sol +246 -0
  22. package/test/utils/TestBaseWorkflow.sol +213 -0
  23. package/test/utils/UnitTestSetup.sol +805 -0
  24. package/.gas-snapshot +0 -152
  25. package/ADMINISTRATION.md +0 -87
  26. package/ARCHITECTURE.md +0 -98
  27. package/AUDIT_INSTRUCTIONS.md +0 -77
  28. package/RISKS.md +0 -118
  29. package/SKILLS.md +0 -43
  30. package/STYLE_GUIDE.md +0 -610
  31. package/USER_JOURNEYS.md +0 -121
  32. package/assets/findings/nana-721-hook-v6-pashov-ai-audit-report-20260330-091257.md +0 -83
  33. package/slither-ci.config.json +0 -10
  34. package/test/721HookAttacks.t.sol +0 -408
  35. package/test/E2E/Pay_Mint_Redeem_E2E.t.sol +0 -985
  36. package/test/Fork.t.sol +0 -2346
  37. package/test/TestAuditGaps.sol +0 -1075
  38. package/test/TestCheckpoints.t.sol +0 -341
  39. package/test/TestSafeTransferReentrancy.t.sol +0 -305
  40. package/test/TestVotingUnitsLifecycle.t.sol +0 -313
  41. package/test/audit/AuditRegressions.t.sol +0 -83
  42. package/test/audit/CodexNemesisReserveSellout.t.sol +0 -66
  43. package/test/audit/CrossCurrencySplitNoPrices.t.sol +0 -123
  44. package/test/audit/FreshAudit.t.sol +0 -197
  45. package/test/audit/FutureTierPoC.t.sol +0 -39
  46. package/test/audit/FutureTierRemoval.t.sol +0 -47
  47. package/test/audit/Pass12L18.t.sol +0 -80
  48. package/test/audit/PayCreditsBypassTierSplits.t.sol +0 -200
  49. package/test/audit/ProjectDeployerAuth.t.sol +0 -266
  50. package/test/audit/RepoFindings.t.sol +0 -195
  51. package/test/audit/ReserveActivation.t.sol +0 -87
  52. package/test/audit/ReserveSlotProtection.t.sol +0 -273
  53. package/test/audit/RetroactiveReserveBeneficiaryDilution.t.sol +0 -149
  54. package/test/audit/SameCurrencyDecimalMismatch.t.sol +0 -249
  55. package/test/audit/SplitCreditsMismatch.t.sol +0 -219
  56. package/test/audit/SplitFailureRedistribution.t.sol +0 -143
  57. package/test/audit/USDTVoidReturnCompat.t.sol +0 -301
  58. package/test/fork/ERC20CashOutFork.t.sol +0 -633
  59. package/test/fork/ERC20TierSplitFork.t.sol +0 -596
  60. package/test/fork/IssueTokensForSplitsFork.t.sol +0 -516
  61. package/test/invariants/TierLifecycleInvariant.t.sol +0 -188
  62. package/test/invariants/TieredHookStoreInvariant.t.sol +0 -86
  63. package/test/invariants/handlers/TierLifecycleHandler.sol +0 -300
  64. package/test/invariants/handlers/TierStoreHandler.sol +0 -165
  65. package/test/regression/BrokenTerminalDoesNotDos.t.sol +0 -277
  66. package/test/regression/CacheTierLookup.t.sol +0 -190
  67. package/test/regression/ProjectDeployerRulesets.t.sol +0 -358
  68. package/test/regression/ReserveBeneficiaryOverwrite.t.sol +0 -155
  69. package/test/regression/SplitDistributionBugs.t.sol +0 -751
  70. package/test/regression/SplitNoBeneficiary.t.sol +0 -140
  71. package/test/unit/AuditFixes_Unit.t.sol +0 -624
  72. package/test/unit/JB721CheckpointsDeployer_AccessControl.t.sol +0 -116
  73. package/test/unit/JB721TiersRulesetMetadataResolver.t.sol +0 -144
  74. package/test/unit/JBBitmap.t.sol +0 -170
  75. package/test/unit/JBIpfsDecoder.t.sol +0 -136
  76. package/test/unit/TierSupplyReserveCheck.t.sol +0 -221
  77. package/test/unit/adjustTier_Unit.t.sol +0 -1942
  78. package/test/unit/deployer_Unit.t.sol +0 -114
  79. package/test/unit/getters_constructor_Unit.t.sol +0 -593
  80. package/test/unit/mintFor_mintReservesFor_Unit.t.sol +0 -452
  81. package/test/unit/pay_CrossCurrency_Unit.t.sol +0 -530
  82. package/test/unit/pay_Unit.t.sol +0 -1661
  83. package/test/unit/redeem_Unit.t.sol +0 -473
  84. package/test/unit/relayBeneficiary_Unit.t.sol +0 -182
  85. package/test/unit/splitHookDistribution_Unit.t.sol +0 -604
  86. package/test/unit/tierSplitRouting_Unit.t.sol +0 -757
@@ -1,114 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.28;
3
-
4
- // forge-lint: disable-next-line(unaliased-plain-import)
5
- import "@bananapus/address-registry-v6/src/JBAddressRegistry.sol";
6
- // forge-lint: disable-next-line(unaliased-plain-import)
7
- import "@bananapus/core-v6/src/interfaces/IJBController.sol";
8
- // forge-lint: disable-next-line(unaliased-plain-import)
9
- import "@bananapus/core-v6/src/interfaces/IJBRulesets.sol";
10
- // forge-lint: disable-next-line(unaliased-plain-import)
11
- import "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
12
- // forge-lint: disable-next-line(unaliased-plain-import)
13
- import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
14
-
15
- // forge-lint: disable-next-line(unaliased-plain-import)
16
- import "../../src/JB721TiersHookProjectDeployer.sol";
17
- // forge-lint: disable-next-line(unaliased-plain-import)
18
- import "../../src/JB721TiersHookStore.sol";
19
- // forge-lint: disable-next-line(unaliased-plain-import)
20
- import "../../src/interfaces/IJB721TiersHookProjectDeployer.sol";
21
- // forge-lint: disable-next-line(unaliased-plain-import)
22
- import "../../src/structs/JBLaunchProjectConfig.sol";
23
- // forge-lint: disable-next-line(unaliased-plain-import)
24
- import "../../src/structs/JB721InitTiersConfig.sol";
25
-
26
- // forge-lint: disable-next-line(unaliased-plain-import)
27
- import "../utils/UnitTestSetup.sol";
28
-
29
- /// @dev A minimal mock for IJBProjects whose `count()` can be bumped by the mock controller.
30
- contract MockJBProjectsCount {
31
- uint256 private _count;
32
- address private _owner;
33
-
34
- function setup(uint256 initialCount, address projectOwner) external {
35
- _count = initialCount;
36
- _owner = projectOwner;
37
- }
38
-
39
- function count() external view returns (uint256) {
40
- return _count;
41
- }
42
-
43
- function setCount(uint256 newCount) external {
44
- _count = newCount;
45
- }
46
-
47
- function ownerOf(uint256) external view returns (address) {
48
- return _owner;
49
- }
50
- }
51
-
52
- /// @dev A mock controller whose fallback bumps the projects mock count by 1 (simulating real behaviour)
53
- /// and returns a truthy value for any function call.
54
- contract MockLaunchController {
55
- MockJBProjectsCount private _projects;
56
-
57
- constructor(MockJBProjectsCount projects) {
58
- _projects = projects;
59
- }
60
-
61
- fallback() external payable {
62
- // Bump projects count by 1 -- simulates a new project being created.
63
- _projects.setCount(_projects.count() + 1);
64
- // Return `uint256(1)` which is truthy for the deployer's expected return.
65
- bytes memory result = abi.encode(uint256(1));
66
- assembly {
67
- return(add(result, 32), mload(result))
68
- }
69
- }
70
- }
71
-
72
- contract Test_ProjectDeployer_Unit is UnitTestSetup {
73
- using stdStorage for StdStorage;
74
-
75
- IJB721TiersHookProjectDeployer deployer;
76
-
77
- function setUp() public override {
78
- super.setUp();
79
-
80
- deployer = new JB721TiersHookProjectDeployer(
81
- IJBDirectory(mockJBDirectory), IJBPermissions(mockJBPermissions), jbHookDeployer, address(0)
82
- );
83
- }
84
-
85
- function test_launchProjectFor_shouldLaunchProject(uint256 previousProjectId, bytes32 salt) external {
86
- // Include launching the protocol project (project ID 1).
87
- previousProjectId = bound(previousProjectId, 0, type(uint88).max - 1);
88
-
89
- (JBDeploy721TiersHookConfig memory deploy721TiersHookConfig, JBLaunchProjectConfig memory launchProjectConfig) =
90
- createData();
91
-
92
- // Deploy a real MockJBProjectsCount implementation and etch its code onto the existing mockJBProjects address.
93
- // This is necessary because the hook's immutable PROJECTS is set to mockJBProjects during the hook
94
- // implementation's constructor (in UnitTestSetup.setUp). By etching real contract code there, both the
95
- // deployer's DIRECTORY.PROJECTS().count() path and the hook's PROJECTS.count() path hit the same contract.
96
- MockJBProjectsCount projectsImpl = new MockJBProjectsCount();
97
- vm.etch(mockJBProjects, address(projectsImpl).code);
98
- MockJBProjectsCount(mockJBProjects).setup(previousProjectId, owner);
99
-
100
- // Mock DIRECTORY.PROJECTS() to return mockJBProjects (which now has real code).
101
- vm.mockCall(mockJBDirectory, abi.encodeWithSelector(IJBDirectory.PROJECTS.selector), abi.encode(mockJBProjects));
102
-
103
- // Deploy a mock controller that bumps count when launchProjectFor is called.
104
- MockLaunchController mockController = new MockLaunchController(MockJBProjectsCount(mockJBProjects));
105
-
106
- // Launch the project using our mock controller that bumps count.
107
- (uint256 projectId,) = deployer.launchProjectFor(
108
- owner, deploy721TiersHookConfig, launchProjectConfig, IJBController(address(mockController)), salt
109
- );
110
-
111
- // Check: does the project have the correct project ID (the previous ID incremented by 1)?
112
- assertEq(previousProjectId, projectId - 1);
113
- }
114
- }