@bananapus/distributor-v6 0.0.26 → 0.0.27
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 +1 -1
- package/src/JB721Distributor.sol +17 -3
package/package.json
CHANGED
package/src/JB721Distributor.sol
CHANGED
|
@@ -35,6 +35,9 @@ 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
|
+
|
|
38
41
|
/// @notice Thrown when native ETH does not match the split hook context amount.
|
|
39
42
|
error JB721Distributor_NativeAmountMismatch(uint256 msgValue, uint256 contextAmount);
|
|
40
43
|
|
|
@@ -544,10 +547,21 @@ contract JB721Distributor is JBDistributor, IJB721Distributor {
|
|
|
544
547
|
/// @param hook The 721 hook whose NFT owners are claiming.
|
|
545
548
|
/// @param tokenIds The NFT token IDs to check.
|
|
546
549
|
function _requireCanClaimTokenIds(address hook, uint256[] calldata tokenIds) internal view {
|
|
547
|
-
// Each requested NFT must currently belong to msg.sender.
|
|
550
|
+
// Each requested NFT must currently belong to msg.sender and appear only once in the batch.
|
|
548
551
|
for (uint256 i; i < tokenIds.length;) {
|
|
549
|
-
|
|
550
|
-
|
|
552
|
+
uint256 tokenId = tokenIds[i];
|
|
553
|
+
|
|
554
|
+
if (!_canClaim({hook: hook, tokenId: tokenId, account: msg.sender})) {
|
|
555
|
+
revert JBDistributor_NoAccess({hook: hook, tokenId: tokenId, account: msg.sender});
|
|
556
|
+
}
|
|
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
|
+
}
|
|
551
565
|
}
|
|
552
566
|
|
|
553
567
|
unchecked {
|