@bananapus/721-hook-v6 0.0.8 → 0.0.9
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/SKILLS.md +2 -1
- package/package.json +5 -5
- package/src/JB721TiersHookStore.sol +8 -0
- package/src/interfaces/IJB721TiersHookStore.sol +7 -0
- package/src/libraries/JB721TiersHookLib.sol +21 -9
- package/src/structs/JB721TierConfig.sol +3 -1
- package/test/regression/L34_ReserveBeneficiaryOverwrite.t.sol +154 -0
- package/test/regression/L35_CacheTierLookup.t.sol +188 -0
- package/test/regression/L36_SplitNoBeneficiary.t.sol +146 -0
- package/test/unit/M6_TierSupplyCheck.t.sol +1 -1
package/SKILLS.md
CHANGED
|
@@ -140,7 +140,7 @@ Each tier has configurable voting power:
|
|
|
140
140
|
- Splits are registered via `JB721TiersHookLib._setSplitGroupsFor` when tiers with `splits` are added.
|
|
141
141
|
- In `beforePayRecordedWith`, `calculateSplitAmounts` decodes tier IDs from payer metadata, computes `mulDiv(price, splitPercent, SPLITS_TOTAL_PERCENT)` per tier, and returns the total to be forwarded to the hook.
|
|
142
142
|
- In `afterPayRecordedWith`, `distributeAll` distributes forwarded funds to each tier's split group recipients. Leftover after all splits goes back to the project's balance via `addToBalance`.
|
|
143
|
-
- Split recipients can be projects (via `terminal.pay` or `terminal.addToBalance`) or plain addresses (direct ETH transfer or `SafeERC20.safeTransfer`).
|
|
143
|
+
- Split recipients can be projects (via `terminal.pay` or `terminal.addToBalance`) or plain addresses (direct ETH transfer or `SafeERC20.safeTransfer`). Splits with no `projectId` and no `beneficiary` are skipped -- their share stays in the leftover and is routed to the project's own balance via `addToBalanceOf`, preventing a misconfigured split from bricking the payout distribution.
|
|
144
144
|
|
|
145
145
|
## Gotchas
|
|
146
146
|
|
|
@@ -160,6 +160,7 @@ Each tier has configurable voting power:
|
|
|
160
160
|
- The `_update` override in `JB721TiersHook` checks `tier.transfersPausable` and consults the current ruleset's metadata for `transfersPaused`. Transfers to `address(0)` (burns) are never blocked.
|
|
161
161
|
- **IERC2981 declared but not implemented**: `supportsInterface` returns `true` for `IERC2981`, but no `royaltyInfo` function is implemented. Callers querying `royaltyInfo` will get a revert. This appears intentional -- the interface is declared for future extension or to signal capability to marketplaces that may override behavior.
|
|
162
162
|
- **Tier splits**: Each tier can route a percentage of its mint price to configured split recipients. `splitPercent` is out of `JBConstants.SPLITS_TOTAL_PERCENT` (1,000,000,000). Split group IDs are `uint256(uint160(hookAddress)) | (uint256(tierId) << 160)`.
|
|
163
|
+
- **`useReserveBeneficiaryAsDefault` overwrites globally**: Adding a tier with `useReserveBeneficiaryAsDefault: true` silently overwrites `defaultReserveBeneficiaryOf` for ALL existing tiers that lack a tier-specific beneficiary. A `SetDefaultReserveBeneficiary` event is emitted when the default changes.
|
|
163
164
|
- **Removing tiers does not update the sorted list**: `recordRemoveTierIds` only marks tiers in the bitmap. Call `cleanTiers()` afterward to remove them from the iteration sequence.
|
|
164
165
|
- `JB721TiersHookStore` is a **shared singleton** -- all hook instances on the same chain use the same store, keyed by `address(hook)`.
|
|
165
166
|
- The `ERC721` abstract uses `_initialize(name, symbol)` instead of a constructor, making it clone-compatible. The standard `_owners` mapping is `internal` (not `private`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/721-hook-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'nana-721-hook-v6'"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@bananapus/address-registry-v6": "^0.0.
|
|
21
|
-
"@bananapus/core-v6": "^0.0.
|
|
22
|
-
"@bananapus/ownable-v6": "^0.0.
|
|
23
|
-
"@bananapus/permission-ids-v6": "^0.0.
|
|
20
|
+
"@bananapus/address-registry-v6": "^0.0.4",
|
|
21
|
+
"@bananapus/core-v6": "^0.0.9",
|
|
22
|
+
"@bananapus/ownable-v6": "^0.0.5",
|
|
23
|
+
"@bananapus/permission-ids-v6": "^0.0.4",
|
|
24
24
|
"@openzeppelin/contracts": "5.2.0",
|
|
25
25
|
"@prb/math": "^4.1.0",
|
|
26
26
|
"solady": "^0.1.8"
|
|
@@ -763,6 +763,10 @@ contract JB721TiersHookStore is IJB721TiersHookStore {
|
|
|
763
763
|
}
|
|
764
764
|
|
|
765
765
|
/// @notice Record newly added tiers.
|
|
766
|
+
/// @dev WARNING: If any tier in `tiersToAdd` has `useReserveBeneficiaryAsDefault` set to `true`, its
|
|
767
|
+
/// `reserveBeneficiary` will overwrite the hook's global `defaultReserveBeneficiaryOf`. This affects ALL existing
|
|
768
|
+
/// tiers that do not have a tier-specific reserve beneficiary set via `_reserveBeneficiaryOf`. Callers should be
|
|
769
|
+
/// aware of this side effect when using `adjustTiers` to add new tiers.
|
|
766
770
|
/// @param tiersToAdd The tiers to add.
|
|
767
771
|
/// @return tierIds The IDs of the tiers being added.
|
|
768
772
|
function recordAddTiers(JB721TierConfig[] calldata tiersToAdd)
|
|
@@ -884,8 +888,12 @@ contract JB721TiersHookStore is IJB721TiersHookStore {
|
|
|
884
888
|
// Set the reserve beneficiary if needed.
|
|
885
889
|
if (tierToAdd.reserveBeneficiary != address(0) && tierToAdd.reserveFrequency != 0) {
|
|
886
890
|
if (tierToAdd.useReserveBeneficiaryAsDefault) {
|
|
891
|
+
// WARNING: This overwrites the global default for ALL tiers without a tier-specific beneficiary.
|
|
887
892
|
if (defaultReserveBeneficiaryOf[msg.sender] != tierToAdd.reserveBeneficiary) {
|
|
888
893
|
defaultReserveBeneficiaryOf[msg.sender] = tierToAdd.reserveBeneficiary;
|
|
894
|
+
emit SetDefaultReserveBeneficiary({
|
|
895
|
+
hook: msg.sender, newBeneficiary: tierToAdd.reserveBeneficiary, caller: msg.sender
|
|
896
|
+
});
|
|
889
897
|
}
|
|
890
898
|
} else {
|
|
891
899
|
_reserveBeneficiaryOf[msg.sender][tierId] = tierToAdd.reserveBeneficiary;
|
|
@@ -9,6 +9,13 @@ import {JB721TiersHookFlags} from "../structs/JB721TiersHookFlags.sol";
|
|
|
9
9
|
interface IJB721TiersHookStore {
|
|
10
10
|
event CleanTiers(address indexed hook, address caller);
|
|
11
11
|
|
|
12
|
+
/// @notice Emitted when the default reserve beneficiary is changed.
|
|
13
|
+
/// @dev This affects ALL tiers that do not have a tier-specific reserve beneficiary set.
|
|
14
|
+
/// @param hook The 721 contract whose default reserve beneficiary was changed.
|
|
15
|
+
/// @param newBeneficiary The new default reserve beneficiary address.
|
|
16
|
+
/// @param caller The address that triggered the change.
|
|
17
|
+
event SetDefaultReserveBeneficiary(address indexed hook, address indexed newBeneficiary, address caller);
|
|
18
|
+
|
|
12
19
|
/// @notice Get the number of NFTs that the specified address owns from the specified 721 contract.
|
|
13
20
|
/// @param hook The 721 contract to get the balance within.
|
|
14
21
|
/// @param owner The address to check the balance of.
|
|
@@ -17,6 +17,7 @@ import {JBSplitGroup} from "@bananapus/core-v6/src/structs/JBSplitGroup.sol";
|
|
|
17
17
|
|
|
18
18
|
import {IJB721TiersHookStore} from "../interfaces/IJB721TiersHookStore.sol";
|
|
19
19
|
import {IJB721TokenUriResolver} from "../interfaces/IJB721TokenUriResolver.sol";
|
|
20
|
+
import {JB721Tier} from "../structs/JB721Tier.sol";
|
|
20
21
|
import {JB721TierConfig} from "../structs/JB721TierConfig.sol";
|
|
21
22
|
import {JBIpfsDecoder} from "./JBIpfsDecoder.sol";
|
|
22
23
|
|
|
@@ -52,6 +53,7 @@ library JB721TiersHookLib {
|
|
|
52
53
|
for (uint256 i; i < tierIdsToRemove.length; i++) {
|
|
53
54
|
emit RemoveTier({tierId: tierIdsToRemove[i], caller: caller});
|
|
54
55
|
}
|
|
56
|
+
// slither-disable-next-line reentrancy-events
|
|
55
57
|
store.recordRemoveTierIds(tierIdsToRemove);
|
|
56
58
|
}
|
|
57
59
|
|
|
@@ -141,12 +143,10 @@ library JB721TiersHookLib {
|
|
|
141
143
|
|
|
142
144
|
for (uint256 i; i < tierIdsToMint.length; i++) {
|
|
143
145
|
// slither-disable-next-line calls-loop
|
|
144
|
-
|
|
145
|
-
if (splitPercent != 0) {
|
|
146
|
-
// slither-disable-next-line calls-loop
|
|
147
|
-
uint256 price = store.tierOf(hook, tierIdsToMint[i], false).price;
|
|
146
|
+
JB721Tier memory tier = store.tierOf(hook, tierIdsToMint[i], false);
|
|
147
|
+
if (tier.splitPercent != 0) {
|
|
148
148
|
splitTierIds[splitTierCount] = tierIdsToMint[i];
|
|
149
|
-
splitAmounts[splitTierCount] = mulDiv(price, splitPercent, JBConstants.SPLITS_TOTAL_PERCENT);
|
|
149
|
+
splitAmounts[splitTierCount] = mulDiv(tier.price, tier.splitPercent, JBConstants.SPLITS_TOTAL_PERCENT);
|
|
150
150
|
totalSplitAmount += splitAmounts[splitTierCount];
|
|
151
151
|
splitTierCount++;
|
|
152
152
|
}
|
|
@@ -237,9 +237,13 @@ library JB721TiersHookLib {
|
|
|
237
237
|
for (uint256 j; j < tierSplits.length; j++) {
|
|
238
238
|
uint256 payoutAmount = mulDiv(amount, tierSplits[j].percent, leftoverPercentage);
|
|
239
239
|
if (payoutAmount != 0) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
// Only subtract from leftover if the split has a valid recipient.
|
|
241
|
+
// Splits with no projectId and no beneficiary are skipped — their share
|
|
242
|
+
// stays in leftoverAmount and is added to the project's balance below.
|
|
243
|
+
if (_sendPayoutToSplit(directory, tierSplits[j], token, payoutAmount, isNativeToken)) {
|
|
244
|
+
unchecked {
|
|
245
|
+
leftoverAmount -= payoutAmount;
|
|
246
|
+
}
|
|
243
247
|
}
|
|
244
248
|
}
|
|
245
249
|
unchecked {
|
|
@@ -252,6 +256,9 @@ library JB721TiersHookLib {
|
|
|
252
256
|
}
|
|
253
257
|
}
|
|
254
258
|
|
|
259
|
+
/// @notice Sends a payout to a split recipient.
|
|
260
|
+
/// @return sent Whether the funds were actually sent. Returns false if the split has no valid recipient
|
|
261
|
+
/// (no projectId and no beneficiary), so the caller can route the funds elsewhere.
|
|
255
262
|
function _sendPayoutToSplit(
|
|
256
263
|
IJBDirectory directory,
|
|
257
264
|
JBSplit memory split,
|
|
@@ -260,17 +267,19 @@ library JB721TiersHookLib {
|
|
|
260
267
|
bool isNativeToken
|
|
261
268
|
)
|
|
262
269
|
private
|
|
270
|
+
returns (bool sent)
|
|
263
271
|
{
|
|
264
272
|
if (split.projectId != 0) {
|
|
265
273
|
// slither-disable-next-line calls-loop
|
|
266
274
|
IJBTerminal terminal = directory.primaryTerminalOf(split.projectId, token);
|
|
267
|
-
if (address(terminal) == address(0)) return;
|
|
275
|
+
if (address(terminal) == address(0)) return false;
|
|
268
276
|
|
|
269
277
|
if (split.preferAddToBalance) {
|
|
270
278
|
_terminalAddToBalance(terminal, split.projectId, token, amount, isNativeToken);
|
|
271
279
|
} else {
|
|
272
280
|
_terminalPay(terminal, split.projectId, token, amount, split.beneficiary, isNativeToken);
|
|
273
281
|
}
|
|
282
|
+
return true;
|
|
274
283
|
} else if (split.beneficiary != address(0)) {
|
|
275
284
|
if (isNativeToken) {
|
|
276
285
|
// slither-disable-next-line arbitrary-send-eth,calls-loop
|
|
@@ -279,7 +288,10 @@ library JB721TiersHookLib {
|
|
|
279
288
|
} else {
|
|
280
289
|
SafeERC20.safeTransfer(IERC20(token), split.beneficiary, amount);
|
|
281
290
|
}
|
|
291
|
+
return true;
|
|
282
292
|
}
|
|
293
|
+
// No projectId and no beneficiary — return false so the funds go to the project's balance.
|
|
294
|
+
return false;
|
|
283
295
|
}
|
|
284
296
|
|
|
285
297
|
function _addToBalance(
|
|
@@ -18,7 +18,9 @@ import {JBSplit} from "@bananapus/core-v6/src/structs/JBSplit.sol";
|
|
|
18
18
|
/// @custom:member allowOwnerMint A boolean indicating whether the contract's owner can mint NFTs from this tier
|
|
19
19
|
/// on-demand.
|
|
20
20
|
/// @custom:member useReserveBeneficiaryAsDefault A boolean indicating whether this tier's `reserveBeneficiary` should
|
|
21
|
-
/// be stored as the default beneficiary for all tiers.
|
|
21
|
+
/// be stored as the default beneficiary for all tiers. WARNING: Setting this to `true` overwrites the global
|
|
22
|
+
/// `defaultReserveBeneficiaryOf` for the hook, which affects ALL existing tiers that do not have a tier-specific
|
|
23
|
+
/// reserve beneficiary. Use with caution when calling `adjustTiers` on hooks with existing tiers.
|
|
22
24
|
/// @custom:member transfersPausable A boolean indicating whether transfers for NFTs in tier can be paused.
|
|
23
25
|
/// @custom:member useVotingUnits A boolean indicating whether the `votingUnits` should be used to calculate voting
|
|
24
26
|
/// power. If `useVotingUnits` is false, voting power is based on the tier's price.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.26;
|
|
3
|
+
|
|
4
|
+
import "../utils/UnitTestSetup.sol";
|
|
5
|
+
import {IJB721TiersHookStore} from "../../src/interfaces/IJB721TiersHookStore.sol";
|
|
6
|
+
|
|
7
|
+
/// @notice Regression test for L-34: defaultReserveBeneficiaryOf is globally overwritten when adding a tier with
|
|
8
|
+
/// useReserveBeneficiaryAsDefault=true.
|
|
9
|
+
contract Test_L34_ReserveBeneficiaryOverwrite is UnitTestSetup {
|
|
10
|
+
using stdStorage for StdStorage;
|
|
11
|
+
|
|
12
|
+
address alice = makeAddr("alice");
|
|
13
|
+
address bob = makeAddr("bob");
|
|
14
|
+
|
|
15
|
+
/// @notice Verify that adding a tier with useReserveBeneficiaryAsDefault=true overwrites the global default
|
|
16
|
+
/// and emits the SetDefaultReserveBeneficiary event.
|
|
17
|
+
function test_addTierWithDefaultBeneficiary_overwritesGlobal() public {
|
|
18
|
+
ForTest_JB721TiersHook testHook = _initializeForTestHook(0);
|
|
19
|
+
IJB721TiersHookStore hookStore = testHook.STORE();
|
|
20
|
+
|
|
21
|
+
// Add tier 1: alice as default reserve beneficiary.
|
|
22
|
+
JB721TierConfig[] memory tier1Configs = new JB721TierConfig[](1);
|
|
23
|
+
tier1Configs[0].price = 1 ether;
|
|
24
|
+
tier1Configs[0].initialSupply = uint32(100);
|
|
25
|
+
tier1Configs[0].category = uint24(1);
|
|
26
|
+
tier1Configs[0].encodedIPFSUri = bytes32(uint256(0x1234));
|
|
27
|
+
tier1Configs[0].reserveFrequency = 5;
|
|
28
|
+
tier1Configs[0].reserveBeneficiary = alice;
|
|
29
|
+
tier1Configs[0].useReserveBeneficiaryAsDefault = true;
|
|
30
|
+
|
|
31
|
+
vm.prank(address(testHook));
|
|
32
|
+
uint256[] memory tier1Ids = hookStore.recordAddTiers(tier1Configs);
|
|
33
|
+
|
|
34
|
+
// Verify alice is the default reserve beneficiary.
|
|
35
|
+
assertEq(hookStore.defaultReserveBeneficiaryOf(address(testHook)), alice);
|
|
36
|
+
|
|
37
|
+
// Verify tier 1 uses alice as its reserve beneficiary (via the default).
|
|
38
|
+
assertEq(hookStore.reserveBeneficiaryOf(address(testHook), tier1Ids[0]), alice);
|
|
39
|
+
|
|
40
|
+
// Add tier 2: no useReserveBeneficiaryAsDefault, with a per-tier beneficiary.
|
|
41
|
+
JB721TierConfig[] memory tier2Configs = new JB721TierConfig[](1);
|
|
42
|
+
tier2Configs[0].price = 2 ether;
|
|
43
|
+
tier2Configs[0].initialSupply = uint32(100);
|
|
44
|
+
tier2Configs[0].category = uint24(2);
|
|
45
|
+
tier2Configs[0].encodedIPFSUri = bytes32(uint256(0x5678));
|
|
46
|
+
tier2Configs[0].reserveFrequency = 5;
|
|
47
|
+
tier2Configs[0].reserveBeneficiary = bob;
|
|
48
|
+
tier2Configs[0].useReserveBeneficiaryAsDefault = false;
|
|
49
|
+
|
|
50
|
+
vm.prank(address(testHook));
|
|
51
|
+
uint256[] memory tier2Ids = hookStore.recordAddTiers(tier2Configs);
|
|
52
|
+
|
|
53
|
+
// Default should still be alice.
|
|
54
|
+
assertEq(hookStore.defaultReserveBeneficiaryOf(address(testHook)), alice);
|
|
55
|
+
|
|
56
|
+
// Tier 2 should use bob (tier-specific).
|
|
57
|
+
assertEq(hookStore.reserveBeneficiaryOf(address(testHook), tier2Ids[0]), bob);
|
|
58
|
+
|
|
59
|
+
// Now add tier 3: bob as the NEW default reserve beneficiary.
|
|
60
|
+
// This should overwrite the default, affecting tier 1 which relies on the default.
|
|
61
|
+
JB721TierConfig[] memory tier3Configs = new JB721TierConfig[](1);
|
|
62
|
+
tier3Configs[0].price = 3 ether;
|
|
63
|
+
tier3Configs[0].initialSupply = uint32(100);
|
|
64
|
+
tier3Configs[0].category = uint24(3);
|
|
65
|
+
tier3Configs[0].encodedIPFSUri = bytes32(uint256(0x9ABC));
|
|
66
|
+
tier3Configs[0].reserveFrequency = 5;
|
|
67
|
+
tier3Configs[0].reserveBeneficiary = bob;
|
|
68
|
+
tier3Configs[0].useReserveBeneficiaryAsDefault = true;
|
|
69
|
+
|
|
70
|
+
vm.prank(address(testHook));
|
|
71
|
+
uint256[] memory tier3Ids = hookStore.recordAddTiers(tier3Configs);
|
|
72
|
+
|
|
73
|
+
// Default should now be bob.
|
|
74
|
+
assertEq(hookStore.defaultReserveBeneficiaryOf(address(testHook)), bob);
|
|
75
|
+
|
|
76
|
+
// Tier 1 should now resolve to bob (the new default), NOT alice.
|
|
77
|
+
// This is the documented global overwrite behavior.
|
|
78
|
+
assertEq(hookStore.reserveBeneficiaryOf(address(testHook), tier1Ids[0]), bob);
|
|
79
|
+
|
|
80
|
+
// Tier 2 should still use bob (tier-specific, unaffected by default change).
|
|
81
|
+
assertEq(hookStore.reserveBeneficiaryOf(address(testHook), tier2Ids[0]), bob);
|
|
82
|
+
|
|
83
|
+
// Tier 3 should also resolve to bob (via the default).
|
|
84
|
+
assertEq(hookStore.reserveBeneficiaryOf(address(testHook), tier3Ids[0]), bob);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// @notice Verify that the SetDefaultReserveBeneficiary event is emitted when the default changes.
|
|
88
|
+
function test_addTierWithDefaultBeneficiary_emitsEvent() public {
|
|
89
|
+
ForTest_JB721TiersHook testHook = _initializeForTestHook(0);
|
|
90
|
+
IJB721TiersHookStore hookStore = testHook.STORE();
|
|
91
|
+
|
|
92
|
+
JB721TierConfig[] memory tierConfigs = new JB721TierConfig[](1);
|
|
93
|
+
tierConfigs[0].price = 1 ether;
|
|
94
|
+
tierConfigs[0].initialSupply = uint32(100);
|
|
95
|
+
tierConfigs[0].category = uint24(1);
|
|
96
|
+
tierConfigs[0].encodedIPFSUri = bytes32(uint256(0x1234));
|
|
97
|
+
tierConfigs[0].reserveFrequency = 5;
|
|
98
|
+
tierConfigs[0].reserveBeneficiary = alice;
|
|
99
|
+
tierConfigs[0].useReserveBeneficiaryAsDefault = true;
|
|
100
|
+
|
|
101
|
+
// Expect the SetDefaultReserveBeneficiary event.
|
|
102
|
+
vm.expectEmit(true, true, false, true, address(hookStore));
|
|
103
|
+
emit IJB721TiersHookStore.SetDefaultReserveBeneficiary({
|
|
104
|
+
hook: address(testHook), newBeneficiary: alice, caller: address(testHook)
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
vm.prank(address(testHook));
|
|
108
|
+
hookStore.recordAddTiers(tierConfigs);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// @notice Verify that no event is emitted when the beneficiary is already the same.
|
|
112
|
+
function test_addTierWithSameDefaultBeneficiary_noEvent() public {
|
|
113
|
+
ForTest_JB721TiersHook testHook = _initializeForTestHook(0);
|
|
114
|
+
IJB721TiersHookStore hookStore = testHook.STORE();
|
|
115
|
+
|
|
116
|
+
// First, set alice as the default.
|
|
117
|
+
JB721TierConfig[] memory tier1Configs = new JB721TierConfig[](1);
|
|
118
|
+
tier1Configs[0].price = 1 ether;
|
|
119
|
+
tier1Configs[0].initialSupply = uint32(100);
|
|
120
|
+
tier1Configs[0].category = uint24(1);
|
|
121
|
+
tier1Configs[0].encodedIPFSUri = bytes32(uint256(0x1234));
|
|
122
|
+
tier1Configs[0].reserveFrequency = 5;
|
|
123
|
+
tier1Configs[0].reserveBeneficiary = alice;
|
|
124
|
+
tier1Configs[0].useReserveBeneficiaryAsDefault = true;
|
|
125
|
+
|
|
126
|
+
vm.prank(address(testHook));
|
|
127
|
+
hookStore.recordAddTiers(tier1Configs);
|
|
128
|
+
|
|
129
|
+
// Now add another tier with the same default — no event should be emitted.
|
|
130
|
+
JB721TierConfig[] memory tier2Configs = new JB721TierConfig[](1);
|
|
131
|
+
tier2Configs[0].price = 2 ether;
|
|
132
|
+
tier2Configs[0].initialSupply = uint32(100);
|
|
133
|
+
tier2Configs[0].category = uint24(2);
|
|
134
|
+
tier2Configs[0].encodedIPFSUri = bytes32(uint256(0x5678));
|
|
135
|
+
tier2Configs[0].reserveFrequency = 5;
|
|
136
|
+
tier2Configs[0].reserveBeneficiary = alice;
|
|
137
|
+
tier2Configs[0].useReserveBeneficiaryAsDefault = true;
|
|
138
|
+
|
|
139
|
+
// Record the logs to verify no SetDefaultReserveBeneficiary event is emitted.
|
|
140
|
+
vm.recordLogs();
|
|
141
|
+
|
|
142
|
+
vm.prank(address(testHook));
|
|
143
|
+
hookStore.recordAddTiers(tier2Configs);
|
|
144
|
+
|
|
145
|
+
Vm.Log[] memory logs = vm.getRecordedLogs();
|
|
146
|
+
for (uint256 i; i < logs.length; i++) {
|
|
147
|
+
// SetDefaultReserveBeneficiary event signature.
|
|
148
|
+
assertTrue(
|
|
149
|
+
logs[i].topics[0] != keccak256("SetDefaultReserveBeneficiary(address,address,address)"),
|
|
150
|
+
"SetDefaultReserveBeneficiary should not be emitted when beneficiary unchanged"
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.26;
|
|
3
|
+
|
|
4
|
+
import "../utils/UnitTestSetup.sol";
|
|
5
|
+
import {IJB721TiersHookStore} from "../../src/interfaces/IJB721TiersHookStore.sol";
|
|
6
|
+
import {JB721TiersHookLib} from "../../src/libraries/JB721TiersHookLib.sol";
|
|
7
|
+
|
|
8
|
+
/// @notice Regression test for L-35: calculateSplitAmounts cached the tierOf result to avoid a duplicate external call.
|
|
9
|
+
/// Verifies that the cached tier lookup returns the same split amounts as reading price and splitPercent individually.
|
|
10
|
+
contract Test_L35_CacheTierLookup is UnitTestSetup {
|
|
11
|
+
using stdStorage for StdStorage;
|
|
12
|
+
|
|
13
|
+
/// @notice Verify that calculateSplitAmounts returns correct per-tier amounts when multiple tiers have different
|
|
14
|
+
/// prices and split percentages. This exercises the cached `tier` variable introduced by L-35.
|
|
15
|
+
function test_calculateSplitAmounts_multiTier_correctAmounts() public {
|
|
16
|
+
ForTest_JB721TiersHook testHook = _initializeForTestHook(0);
|
|
17
|
+
IJB721TiersHookStore hookStore = testHook.STORE();
|
|
18
|
+
|
|
19
|
+
// Add 3 tiers with different prices and split percents.
|
|
20
|
+
JB721TierConfig[] memory tierConfigs = new JB721TierConfig[](3);
|
|
21
|
+
|
|
22
|
+
// Tier A: 1 ETH, 25% split -> 0.25 ETH
|
|
23
|
+
tierConfigs[0].price = 1 ether;
|
|
24
|
+
tierConfigs[0].initialSupply = uint32(100);
|
|
25
|
+
tierConfigs[0].category = uint24(1);
|
|
26
|
+
tierConfigs[0].encodedIPFSUri = bytes32(uint256(0x1111));
|
|
27
|
+
tierConfigs[0].splitPercent = 250_000_000; // 25%
|
|
28
|
+
|
|
29
|
+
// Tier B: 2 ETH, 50% split -> 1 ETH
|
|
30
|
+
tierConfigs[1].price = 2 ether;
|
|
31
|
+
tierConfigs[1].initialSupply = uint32(100);
|
|
32
|
+
tierConfigs[1].category = uint24(2);
|
|
33
|
+
tierConfigs[1].encodedIPFSUri = bytes32(uint256(0x2222));
|
|
34
|
+
tierConfigs[1].splitPercent = 500_000_000; // 50%
|
|
35
|
+
|
|
36
|
+
// Tier C: 0.5 ETH, 100% split -> 0.5 ETH
|
|
37
|
+
tierConfigs[2].price = 0.5 ether;
|
|
38
|
+
tierConfigs[2].initialSupply = uint32(100);
|
|
39
|
+
tierConfigs[2].category = uint24(3);
|
|
40
|
+
tierConfigs[2].encodedIPFSUri = bytes32(uint256(0x3333));
|
|
41
|
+
tierConfigs[2].splitPercent = 1_000_000_000; // 100%
|
|
42
|
+
|
|
43
|
+
vm.prank(address(testHook));
|
|
44
|
+
uint256[] memory tierIds = hookStore.recordAddTiers(tierConfigs);
|
|
45
|
+
|
|
46
|
+
// Build payer metadata requesting all 3 tiers.
|
|
47
|
+
uint16[] memory mintIds = new uint16[](3);
|
|
48
|
+
mintIds[0] = uint16(tierIds[0]);
|
|
49
|
+
mintIds[1] = uint16(tierIds[1]);
|
|
50
|
+
mintIds[2] = uint16(tierIds[2]);
|
|
51
|
+
bytes memory payerMetadata = _buildPayerMetadata(address(testHook), mintIds);
|
|
52
|
+
|
|
53
|
+
JBBeforePayRecordedContext memory context = JBBeforePayRecordedContext({
|
|
54
|
+
terminal: mockTerminalAddress,
|
|
55
|
+
payer: beneficiary,
|
|
56
|
+
amount: JBTokenAmount({
|
|
57
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
58
|
+
value: 3.5 ether,
|
|
59
|
+
decimals: 18,
|
|
60
|
+
currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
61
|
+
}),
|
|
62
|
+
projectId: projectId,
|
|
63
|
+
rulesetId: 0,
|
|
64
|
+
beneficiary: beneficiary,
|
|
65
|
+
weight: 10e18,
|
|
66
|
+
reservedPercent: 5000,
|
|
67
|
+
metadata: payerMetadata
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
(, JBPayHookSpecification[] memory specs) = testHook.beforePayRecordedWith(context);
|
|
71
|
+
|
|
72
|
+
// Total split = 0.25 + 1.0 + 0.5 = 1.75 ETH
|
|
73
|
+
assertEq(specs[0].amount, 1.75 ether, "Total split amount should be 1.75 ETH");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// @notice Verify that a tier with splitPercent == 0 contributes nothing to the total, even when cached.
|
|
77
|
+
function test_calculateSplitAmounts_zeroSplitSkipped() public {
|
|
78
|
+
ForTest_JB721TiersHook testHook = _initializeForTestHook(0);
|
|
79
|
+
IJB721TiersHookStore hookStore = testHook.STORE();
|
|
80
|
+
|
|
81
|
+
// Tier A: 1 ETH, 50% split
|
|
82
|
+
// Tier B: 3 ETH, 0% split (should be skipped)
|
|
83
|
+
JB721TierConfig[] memory tierConfigs = new JB721TierConfig[](2);
|
|
84
|
+
tierConfigs[0].price = 1 ether;
|
|
85
|
+
tierConfigs[0].initialSupply = uint32(100);
|
|
86
|
+
tierConfigs[0].category = uint24(1);
|
|
87
|
+
tierConfigs[0].encodedIPFSUri = bytes32(uint256(0xAAAA));
|
|
88
|
+
tierConfigs[0].splitPercent = 500_000_000; // 50%
|
|
89
|
+
|
|
90
|
+
tierConfigs[1].price = 3 ether;
|
|
91
|
+
tierConfigs[1].initialSupply = uint32(100);
|
|
92
|
+
tierConfigs[1].category = uint24(2);
|
|
93
|
+
tierConfigs[1].encodedIPFSUri = bytes32(uint256(0xBBBB));
|
|
94
|
+
tierConfigs[1].splitPercent = 0; // 0%
|
|
95
|
+
|
|
96
|
+
vm.prank(address(testHook));
|
|
97
|
+
uint256[] memory tierIds = hookStore.recordAddTiers(tierConfigs);
|
|
98
|
+
|
|
99
|
+
uint16[] memory mintIds = new uint16[](2);
|
|
100
|
+
mintIds[0] = uint16(tierIds[0]);
|
|
101
|
+
mintIds[1] = uint16(tierIds[1]);
|
|
102
|
+
bytes memory payerMetadata = _buildPayerMetadata(address(testHook), mintIds);
|
|
103
|
+
|
|
104
|
+
JBBeforePayRecordedContext memory context = JBBeforePayRecordedContext({
|
|
105
|
+
terminal: mockTerminalAddress,
|
|
106
|
+
payer: beneficiary,
|
|
107
|
+
amount: JBTokenAmount({
|
|
108
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
109
|
+
value: 4 ether,
|
|
110
|
+
decimals: 18,
|
|
111
|
+
currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
112
|
+
}),
|
|
113
|
+
projectId: projectId,
|
|
114
|
+
rulesetId: 0,
|
|
115
|
+
beneficiary: beneficiary,
|
|
116
|
+
weight: 10e18,
|
|
117
|
+
reservedPercent: 5000,
|
|
118
|
+
metadata: payerMetadata
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
(, JBPayHookSpecification[] memory specs) = testHook.beforePayRecordedWith(context);
|
|
122
|
+
|
|
123
|
+
// Only tier A contributes: 1 ETH * 50% = 0.5 ETH
|
|
124
|
+
assertEq(specs[0].amount, 0.5 ether, "Only non-zero split tiers should contribute");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/// @notice Verify that duplicate tier IDs in metadata produce correct cumulative split amounts.
|
|
128
|
+
/// The cached tier lookup must handle the same tier appearing multiple times.
|
|
129
|
+
function test_calculateSplitAmounts_duplicateTierIds() public {
|
|
130
|
+
ForTest_JB721TiersHook testHook = _initializeForTestHook(0);
|
|
131
|
+
IJB721TiersHookStore hookStore = testHook.STORE();
|
|
132
|
+
|
|
133
|
+
// Single tier: 1 ETH, 30% split
|
|
134
|
+
JB721TierConfig[] memory tierConfigs = new JB721TierConfig[](1);
|
|
135
|
+
tierConfigs[0].price = 1 ether;
|
|
136
|
+
tierConfigs[0].initialSupply = uint32(100);
|
|
137
|
+
tierConfigs[0].category = uint24(1);
|
|
138
|
+
tierConfigs[0].encodedIPFSUri = bytes32(uint256(0xCCCC));
|
|
139
|
+
tierConfigs[0].splitPercent = 300_000_000; // 30%
|
|
140
|
+
|
|
141
|
+
vm.prank(address(testHook));
|
|
142
|
+
uint256[] memory tierIds = hookStore.recordAddTiers(tierConfigs);
|
|
143
|
+
|
|
144
|
+
// Request the same tier twice in metadata.
|
|
145
|
+
uint16[] memory mintIds = new uint16[](2);
|
|
146
|
+
mintIds[0] = uint16(tierIds[0]);
|
|
147
|
+
mintIds[1] = uint16(tierIds[0]);
|
|
148
|
+
bytes memory payerMetadata = _buildPayerMetadata(address(testHook), mintIds);
|
|
149
|
+
|
|
150
|
+
JBBeforePayRecordedContext memory context = JBBeforePayRecordedContext({
|
|
151
|
+
terminal: mockTerminalAddress,
|
|
152
|
+
payer: beneficiary,
|
|
153
|
+
amount: JBTokenAmount({
|
|
154
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
155
|
+
value: 2 ether,
|
|
156
|
+
decimals: 18,
|
|
157
|
+
currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
158
|
+
}),
|
|
159
|
+
projectId: projectId,
|
|
160
|
+
rulesetId: 0,
|
|
161
|
+
beneficiary: beneficiary,
|
|
162
|
+
weight: 10e18,
|
|
163
|
+
reservedPercent: 5000,
|
|
164
|
+
metadata: payerMetadata
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
(, JBPayHookSpecification[] memory specs) = testHook.beforePayRecordedWith(context);
|
|
168
|
+
|
|
169
|
+
// 2 x (1 ETH * 30%) = 0.6 ETH
|
|
170
|
+
assertEq(specs[0].amount, 0.6 ether, "Duplicate tier IDs should each contribute their split amount");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Helper: build payer metadata for tier IDs.
|
|
174
|
+
function _buildPayerMetadata(
|
|
175
|
+
address hookAddress,
|
|
176
|
+
uint16[] memory tierIdsToMint
|
|
177
|
+
)
|
|
178
|
+
internal
|
|
179
|
+
view
|
|
180
|
+
returns (bytes memory)
|
|
181
|
+
{
|
|
182
|
+
bytes[] memory data = new bytes[](1);
|
|
183
|
+
data[0] = abi.encode(false, tierIdsToMint);
|
|
184
|
+
bytes4[] memory ids = new bytes4[](1);
|
|
185
|
+
ids[0] = metadataHelper.getId("pay", hookAddress);
|
|
186
|
+
return metadataHelper.createMetadata(ids, data);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.26;
|
|
3
|
+
|
|
4
|
+
import "../utils/UnitTestSetup.sol";
|
|
5
|
+
import {IJB721TiersHookStore} from "../../src/interfaces/IJB721TiersHookStore.sol";
|
|
6
|
+
import {JB721TiersHookLib} from "../../src/libraries/JB721TiersHookLib.sol";
|
|
7
|
+
import {JBSplit} from "@bananapus/core-v6/src/structs/JBSplit.sol";
|
|
8
|
+
import {IJBSplitHook} from "@bananapus/core-v6/src/interfaces/IJBSplitHook.sol";
|
|
9
|
+
import {IJBSplits} from "@bananapus/core-v6/src/interfaces/IJBSplits.sol";
|
|
10
|
+
import {IJBController} from "@bananapus/core-v6/src/interfaces/IJBController.sol";
|
|
11
|
+
import {IJBTerminal} from "@bananapus/core-v6/src/interfaces/IJBTerminal.sol";
|
|
12
|
+
|
|
13
|
+
/// @notice Regression test for L-36: Split with no beneficiary and no projectId should route funds to the project's
|
|
14
|
+
/// balance instead of silently dropping them.
|
|
15
|
+
contract Test_L36_SplitNoBeneficiary is UnitTestSetup {
|
|
16
|
+
using stdStorage for StdStorage;
|
|
17
|
+
|
|
18
|
+
address mockSplits = makeAddr("mockSplits");
|
|
19
|
+
address mockProjectTerminal = makeAddr("mockProjectTerminal");
|
|
20
|
+
|
|
21
|
+
function setUp() public override {
|
|
22
|
+
super.setUp();
|
|
23
|
+
vm.etch(mockSplits, new bytes(0x69));
|
|
24
|
+
vm.etch(mockProjectTerminal, new bytes(0x69));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// @notice Verify that a split with projectId==0 and beneficiary==address(0) routes funds to the project's
|
|
28
|
+
/// balance.
|
|
29
|
+
function test_splitWithNoBeneficiary_routesToProjectBalance() public {
|
|
30
|
+
ForTest_JB721TiersHook testHook = _initializeForTestHook(0);
|
|
31
|
+
IJB721TiersHookStore hookStore = testHook.STORE();
|
|
32
|
+
|
|
33
|
+
// Add a tier with 50% split.
|
|
34
|
+
JB721TierConfig[] memory tierConfigs = new JB721TierConfig[](1);
|
|
35
|
+
tierConfigs[0].price = 1 ether;
|
|
36
|
+
tierConfigs[0].initialSupply = uint32(100);
|
|
37
|
+
tierConfigs[0].category = uint24(1);
|
|
38
|
+
tierConfigs[0].encodedIPFSUri = bytes32(uint256(0x1234));
|
|
39
|
+
tierConfigs[0].splitPercent = 500_000_000; // 50%
|
|
40
|
+
|
|
41
|
+
vm.prank(address(testHook));
|
|
42
|
+
uint256[] memory tierIds = hookStore.recordAddTiers(tierConfigs);
|
|
43
|
+
|
|
44
|
+
// Mock directory checks.
|
|
45
|
+
mockAndExpect(
|
|
46
|
+
address(mockJBDirectory),
|
|
47
|
+
abi.encodeWithSelector(IJBDirectory.isTerminalOf.selector, projectId, mockTerminalAddress),
|
|
48
|
+
abi.encode(true)
|
|
49
|
+
);
|
|
50
|
+
mockAndExpect(
|
|
51
|
+
address(mockJBDirectory),
|
|
52
|
+
abi.encodeWithSelector(IJBDirectory.controllerOf.selector, projectId),
|
|
53
|
+
abi.encode(mockJBController)
|
|
54
|
+
);
|
|
55
|
+
mockAndExpect(mockJBController, abi.encodeWithSelector(IJBController.SPLITS.selector), abi.encode(mockSplits));
|
|
56
|
+
|
|
57
|
+
// Mock splits: a split with projectId==0 and beneficiary==address(0).
|
|
58
|
+
JBSplit[] memory splits = new JBSplit[](1);
|
|
59
|
+
splits[0] = JBSplit({
|
|
60
|
+
percent: uint32(JBConstants.SPLITS_TOTAL_PERCENT),
|
|
61
|
+
projectId: 0,
|
|
62
|
+
beneficiary: payable(address(0)),
|
|
63
|
+
preferAddToBalance: false,
|
|
64
|
+
lockedUntil: 0,
|
|
65
|
+
hook: IJBSplitHook(address(0))
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
uint256 groupId = uint256(uint160(address(testHook))) | (uint256(tierIds[0]) << 160);
|
|
69
|
+
mockAndExpect(
|
|
70
|
+
mockSplits, abi.encodeWithSelector(IJBSplits.splitsOf.selector, projectId, 0, groupId), abi.encode(splits)
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
// Mock the project's primary terminal for addToBalanceOf (this is the fallback for no-recipient splits).
|
|
74
|
+
mockAndExpect(
|
|
75
|
+
address(mockJBDirectory),
|
|
76
|
+
abi.encodeWithSelector(IJBDirectory.primaryTerminalOf.selector, projectId, JBConstants.NATIVE_TOKEN),
|
|
77
|
+
abi.encode(mockProjectTerminal)
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// Expect addToBalanceOf to be called on the project's terminal with the split amount (0.5 ether).
|
|
81
|
+
vm.expectCall(
|
|
82
|
+
mockProjectTerminal,
|
|
83
|
+
0.5 ether,
|
|
84
|
+
abi.encodeWithSelector(
|
|
85
|
+
IJBTerminal.addToBalanceOf.selector, projectId, JBConstants.NATIVE_TOKEN, 0.5 ether, false, "", ""
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
// Mock the addToBalanceOf call to succeed.
|
|
89
|
+
vm.mockCall(mockProjectTerminal, abi.encodeWithSelector(IJBTerminal.addToBalanceOf.selector), abi.encode());
|
|
90
|
+
|
|
91
|
+
// Build payer metadata.
|
|
92
|
+
uint16[] memory mintIds = new uint16[](1);
|
|
93
|
+
mintIds[0] = uint16(tierIds[0]);
|
|
94
|
+
bytes memory payerMetadata = _buildPayerMetadata(address(testHook), mintIds);
|
|
95
|
+
|
|
96
|
+
// Build hook metadata (per-tier split breakdown from beforePayRecordedWith).
|
|
97
|
+
uint16[] memory splitTierIds = new uint16[](1);
|
|
98
|
+
splitTierIds[0] = uint16(tierIds[0]);
|
|
99
|
+
uint256[] memory splitAmounts = new uint256[](1);
|
|
100
|
+
splitAmounts[0] = 0.5 ether;
|
|
101
|
+
|
|
102
|
+
JBAfterPayRecordedContext memory payContext = JBAfterPayRecordedContext({
|
|
103
|
+
payer: beneficiary,
|
|
104
|
+
projectId: projectId,
|
|
105
|
+
rulesetId: 0,
|
|
106
|
+
amount: JBTokenAmount({
|
|
107
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
108
|
+
value: 1 ether,
|
|
109
|
+
decimals: 18,
|
|
110
|
+
currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
111
|
+
}),
|
|
112
|
+
forwardedAmount: JBTokenAmount({
|
|
113
|
+
token: JBConstants.NATIVE_TOKEN,
|
|
114
|
+
value: 0.5 ether,
|
|
115
|
+
decimals: 18,
|
|
116
|
+
currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
117
|
+
}),
|
|
118
|
+
weight: 10e18,
|
|
119
|
+
newlyIssuedTokenCount: 0,
|
|
120
|
+
beneficiary: beneficiary,
|
|
121
|
+
hookMetadata: abi.encode(splitTierIds, splitAmounts),
|
|
122
|
+
payerMetadata: payerMetadata
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
vm.deal(mockTerminalAddress, 1 ether);
|
|
126
|
+
vm.prank(mockTerminalAddress);
|
|
127
|
+
// Should NOT revert — funds should be routed to the project's balance.
|
|
128
|
+
testHook.afterPayRecordedWith{value: 0.5 ether}(payContext);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Helper: build payer metadata for tier IDs.
|
|
132
|
+
function _buildPayerMetadata(
|
|
133
|
+
address hookAddress,
|
|
134
|
+
uint16[] memory tierIdsToMint
|
|
135
|
+
)
|
|
136
|
+
internal
|
|
137
|
+
view
|
|
138
|
+
returns (bytes memory)
|
|
139
|
+
{
|
|
140
|
+
bytes[] memory data = new bytes[](1);
|
|
141
|
+
data[0] = abi.encode(false, tierIdsToMint);
|
|
142
|
+
bytes4[] memory ids = new bytes4[](1);
|
|
143
|
+
ids[0] = metadataHelper.getId("pay", hookAddress);
|
|
144
|
+
return metadataHelper.createMetadata(ids, data);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -4,7 +4,7 @@ pragma solidity 0.8.26;
|
|
|
4
4
|
import "../utils/UnitTestSetup.sol";
|
|
5
5
|
|
|
6
6
|
/// @title M6_TierSupplyCheck
|
|
7
|
-
/// @notice Tests
|
|
7
|
+
/// @notice Tests that the supply check accounts for pending reserves when minting paid NFTs.
|
|
8
8
|
/// Without the `1 +` in the supply check, the last available slot can be consumed by a paid mint, making
|
|
9
9
|
/// pending reserves unmintable (recordMintReservesFor reverts decrementing remainingSupply past zero).
|
|
10
10
|
contract M6_TierSupplyCheck is UnitTestSetup {
|