@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.
- package/foundry.lock +1 -7
- package/foundry.toml +1 -1
- package/package.json +20 -9
- package/script/Deploy.s.sol +2 -2
- package/src/JB721Checkpoints.sol +60 -18
- package/src/JB721CheckpointsDeployer.sol +10 -5
- package/src/JB721TiersHook.sol +4 -1
- package/src/JB721TiersHookProjectDeployer.sol +68 -30
- package/src/JB721TiersHookStore.sol +1 -4
- package/src/interfaces/IJB721Checkpoints.sol +21 -14
- package/src/interfaces/IJB721CheckpointsDeployer.sol +6 -2
- package/src/interfaces/IJB721TiersHookProjectDeployer.sol +2 -0
- package/test/utils/AccessJBLib.sol +49 -0
- package/test/utils/ForTest_JB721TiersHook.sol +246 -0
- package/test/utils/TestBaseWorkflow.sol +213 -0
- package/test/utils/UnitTestSetup.sol +805 -0
- package/.gas-snapshot +0 -152
- package/ADMINISTRATION.md +0 -87
- package/ARCHITECTURE.md +0 -98
- package/AUDIT_INSTRUCTIONS.md +0 -77
- package/RISKS.md +0 -118
- package/SKILLS.md +0 -43
- package/STYLE_GUIDE.md +0 -610
- package/USER_JOURNEYS.md +0 -121
- package/assets/findings/nana-721-hook-v6-pashov-ai-audit-report-20260330-091257.md +0 -83
- package/slither-ci.config.json +0 -10
- package/test/721HookAttacks.t.sol +0 -408
- package/test/E2E/Pay_Mint_Redeem_E2E.t.sol +0 -985
- package/test/Fork.t.sol +0 -2346
- package/test/TestAuditGaps.sol +0 -1075
- package/test/TestCheckpoints.t.sol +0 -341
- package/test/TestSafeTransferReentrancy.t.sol +0 -305
- package/test/TestVotingUnitsLifecycle.t.sol +0 -313
- package/test/audit/AuditRegressions.t.sol +0 -83
- package/test/audit/CrossCurrencySplitNoPrices.t.sol +0 -123
- package/test/audit/FreshAudit.t.sol +0 -197
- package/test/audit/FutureTierPoC.t.sol +0 -39
- package/test/audit/FutureTierRemoval.t.sol +0 -47
- package/test/audit/Pass12L18.t.sol +0 -80
- package/test/audit/PayCreditsBypassTierSplits.t.sol +0 -200
- package/test/audit/ProjectDeployerAuth.t.sol +0 -266
- package/test/audit/RepoFindings.t.sol +0 -195
- package/test/audit/ReserveActivation.t.sol +0 -87
- package/test/audit/RetroactiveReserveBeneficiaryDilution.t.sol +0 -149
- package/test/audit/SameCurrencyDecimalMismatch.t.sol +0 -249
- package/test/audit/SplitCreditsMismatch.t.sol +0 -219
- package/test/audit/SplitFailureRedistribution.t.sol +0 -143
- package/test/audit/USDTVoidReturnCompat.t.sol +0 -301
- package/test/fork/ERC20CashOutFork.t.sol +0 -633
- package/test/fork/ERC20TierSplitFork.t.sol +0 -596
- package/test/fork/IssueTokensForSplitsFork.t.sol +0 -516
- package/test/invariants/TierLifecycleInvariant.t.sol +0 -188
- package/test/invariants/TieredHookStoreInvariant.t.sol +0 -86
- package/test/invariants/handlers/TierLifecycleHandler.sol +0 -300
- package/test/invariants/handlers/TierStoreHandler.sol +0 -165
- package/test/regression/BrokenTerminalDoesNotDos.t.sol +0 -277
- package/test/regression/CacheTierLookup.t.sol +0 -190
- package/test/regression/ProjectDeployerRulesets.t.sol +0 -358
- package/test/regression/ReserveBeneficiaryOverwrite.t.sol +0 -155
- package/test/regression/SplitDistributionBugs.t.sol +0 -751
- package/test/regression/SplitNoBeneficiary.t.sol +0 -140
- package/test/unit/AuditFixes_Unit.t.sol +0 -624
- package/test/unit/JB721CheckpointsDeployer_AccessControl.t.sol +0 -116
- package/test/unit/JB721TiersRulesetMetadataResolver.t.sol +0 -144
- package/test/unit/JBBitmap.t.sol +0 -170
- package/test/unit/JBIpfsDecoder.t.sol +0 -136
- package/test/unit/TierSupplyReserveCheck.t.sol +0 -221
- package/test/unit/adjustTier_Unit.t.sol +0 -1942
- package/test/unit/deployer_Unit.t.sol +0 -114
- package/test/unit/getters_constructor_Unit.t.sol +0 -593
- package/test/unit/mintFor_mintReservesFor_Unit.t.sol +0 -452
- package/test/unit/pay_CrossCurrency_Unit.t.sol +0 -530
- package/test/unit/pay_Unit.t.sol +0 -1661
- package/test/unit/redeem_Unit.t.sol +0 -473
- package/test/unit/relayBeneficiary_Unit.t.sol +0 -182
- package/test/unit/splitHookDistribution_Unit.t.sol +0 -604
- 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
|
-
}
|