@bananapus/721-hook-v6 0.0.41 → 0.0.43

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 (77) 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 +60 -18
  6. package/src/JB721CheckpointsDeployer.sol +10 -5
  7. package/src/JB721TiersHook.sol +4 -1
  8. package/src/JB721TiersHookProjectDeployer.sol +68 -30
  9. package/src/JB721TiersHookStore.sol +1 -4
  10. package/src/interfaces/IJB721Checkpoints.sol +21 -14
  11. package/src/interfaces/IJB721CheckpointsDeployer.sol +6 -2
  12. package/src/interfaces/IJB721TiersHookProjectDeployer.sol +2 -0
  13. package/test/utils/AccessJBLib.sol +49 -0
  14. package/test/utils/ForTest_JB721TiersHook.sol +246 -0
  15. package/test/utils/TestBaseWorkflow.sol +213 -0
  16. package/test/utils/UnitTestSetup.sol +805 -0
  17. package/.gas-snapshot +0 -152
  18. package/ADMINISTRATION.md +0 -87
  19. package/ARCHITECTURE.md +0 -98
  20. package/AUDIT_INSTRUCTIONS.md +0 -77
  21. package/RISKS.md +0 -118
  22. package/SKILLS.md +0 -43
  23. package/STYLE_GUIDE.md +0 -610
  24. package/USER_JOURNEYS.md +0 -121
  25. package/assets/findings/nana-721-hook-v6-pashov-ai-audit-report-20260330-091257.md +0 -83
  26. package/slither-ci.config.json +0 -10
  27. package/test/721HookAttacks.t.sol +0 -408
  28. package/test/E2E/Pay_Mint_Redeem_E2E.t.sol +0 -985
  29. package/test/Fork.t.sol +0 -2346
  30. package/test/TestAuditGaps.sol +0 -1075
  31. package/test/TestCheckpoints.t.sol +0 -341
  32. package/test/TestSafeTransferReentrancy.t.sol +0 -305
  33. package/test/TestVotingUnitsLifecycle.t.sol +0 -313
  34. package/test/audit/AuditRegressions.t.sol +0 -83
  35. package/test/audit/CrossCurrencySplitNoPrices.t.sol +0 -123
  36. package/test/audit/FreshAudit.t.sol +0 -197
  37. package/test/audit/FutureTierPoC.t.sol +0 -39
  38. package/test/audit/FutureTierRemoval.t.sol +0 -47
  39. package/test/audit/Pass12L18.t.sol +0 -80
  40. package/test/audit/PayCreditsBypassTierSplits.t.sol +0 -200
  41. package/test/audit/ProjectDeployerAuth.t.sol +0 -266
  42. package/test/audit/RepoFindings.t.sol +0 -195
  43. package/test/audit/ReserveActivation.t.sol +0 -87
  44. package/test/audit/RetroactiveReserveBeneficiaryDilution.t.sol +0 -149
  45. package/test/audit/SameCurrencyDecimalMismatch.t.sol +0 -249
  46. package/test/audit/SplitCreditsMismatch.t.sol +0 -219
  47. package/test/audit/SplitFailureRedistribution.t.sol +0 -143
  48. package/test/audit/USDTVoidReturnCompat.t.sol +0 -301
  49. package/test/fork/ERC20CashOutFork.t.sol +0 -633
  50. package/test/fork/ERC20TierSplitFork.t.sol +0 -596
  51. package/test/fork/IssueTokensForSplitsFork.t.sol +0 -516
  52. package/test/invariants/TierLifecycleInvariant.t.sol +0 -188
  53. package/test/invariants/TieredHookStoreInvariant.t.sol +0 -86
  54. package/test/invariants/handlers/TierLifecycleHandler.sol +0 -300
  55. package/test/invariants/handlers/TierStoreHandler.sol +0 -165
  56. package/test/regression/BrokenTerminalDoesNotDos.t.sol +0 -277
  57. package/test/regression/CacheTierLookup.t.sol +0 -190
  58. package/test/regression/ProjectDeployerRulesets.t.sol +0 -358
  59. package/test/regression/ReserveBeneficiaryOverwrite.t.sol +0 -155
  60. package/test/regression/SplitDistributionBugs.t.sol +0 -751
  61. package/test/regression/SplitNoBeneficiary.t.sol +0 -140
  62. package/test/unit/AuditFixes_Unit.t.sol +0 -624
  63. package/test/unit/JB721CheckpointsDeployer_AccessControl.t.sol +0 -116
  64. package/test/unit/JB721TiersRulesetMetadataResolver.t.sol +0 -144
  65. package/test/unit/JBBitmap.t.sol +0 -170
  66. package/test/unit/JBIpfsDecoder.t.sol +0 -136
  67. package/test/unit/TierSupplyReserveCheck.t.sol +0 -221
  68. package/test/unit/adjustTier_Unit.t.sol +0 -1942
  69. package/test/unit/deployer_Unit.t.sol +0 -114
  70. package/test/unit/getters_constructor_Unit.t.sol +0 -593
  71. package/test/unit/mintFor_mintReservesFor_Unit.t.sol +0 -452
  72. package/test/unit/pay_CrossCurrency_Unit.t.sol +0 -530
  73. package/test/unit/pay_Unit.t.sol +0 -1661
  74. package/test/unit/redeem_Unit.t.sol +0 -473
  75. package/test/unit/relayBeneficiary_Unit.t.sol +0 -182
  76. package/test/unit/splitHookDistribution_Unit.t.sol +0 -604
  77. 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
- }