@bananapus/distributor-v6 0.0.27 → 0.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananapus/distributor-v6",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,12 +35,12 @@ contract JB721Distributor is JBDistributor, IJB721Distributor {
35
35
  // --------------------------- custom errors ------------------------- //
36
36
  //*********************************************************************//
37
37
 
38
- /// @notice Thrown when a claim batch repeats an NFT token ID.
39
- error JB721Distributor_DuplicateTokenId(uint256 tokenId);
40
-
41
38
  /// @notice Thrown when native ETH does not match the split hook context amount.
42
39
  error JB721Distributor_NativeAmountMismatch(uint256 msgValue, uint256 contextAmount);
43
40
 
41
+ /// @notice Thrown when claim batch NFT token IDs are not strictly increasing.
42
+ error JB721Distributor_TokenIdsNotIncreasing(uint256 previousTokenId, uint256 tokenId);
43
+
44
44
  /// @notice Thrown when native ETH is sent but context.token is not NATIVE_TOKEN.
45
45
  error JB721Distributor_TokenMismatch(address token, address expectedToken, uint256 msgValue);
46
46
 
@@ -547,21 +547,16 @@ contract JB721Distributor is JBDistributor, IJB721Distributor {
547
547
  /// @param hook The 721 hook whose NFT owners are claiming.
548
548
  /// @param tokenIds The NFT token IDs to check.
549
549
  function _requireCanClaimTokenIds(address hook, uint256[] calldata tokenIds) internal view {
550
- // Each requested NFT must currently belong to msg.sender and appear only once in the batch.
550
+ // Each requested NFT must currently belong to msg.sender and appear in strictly increasing order.
551
551
  for (uint256 i; i < tokenIds.length;) {
552
552
  uint256 tokenId = tokenIds[i];
553
553
 
554
- if (!_canClaim({hook: hook, tokenId: tokenId, account: msg.sender})) {
555
- revert JBDistributor_NoAccess({hook: hook, tokenId: tokenId, account: msg.sender});
554
+ if (i != 0 && tokenId <= tokenIds[i - 1]) {
555
+ revert JB721Distributor_TokenIdsNotIncreasing({previousTokenId: tokenIds[i - 1], tokenId: tokenId});
556
556
  }
557
557
 
558
- // Reject duplicates before reward accounting so one NFT cannot replay the same historical round.
559
- for (uint256 j = i + 1; j < tokenIds.length;) {
560
- if (tokenIds[j] == tokenId) revert JB721Distributor_DuplicateTokenId({tokenId: tokenId});
561
-
562
- unchecked {
563
- ++j;
564
- }
558
+ if (!_canClaim({hook: hook, tokenId: tokenId, account: msg.sender})) {
559
+ revert JBDistributor_NoAccess({hook: hook, tokenId: tokenId, account: msg.sender});
565
560
  }
566
561
 
567
562
  unchecked {