Skip to content

Commit

Permalink
claimAll() should allow empty array for tokens or nfts, but not both
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSamWitch committed Feb 15, 2024
1 parent 1be6332 commit 845e099
Show file tree
Hide file tree
Showing 2 changed files with 613 additions and 483 deletions.
17 changes: 15 additions & 2 deletions contracts/SamWitchOrderBook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,21 @@ contract SamWitchOrderBook is ISamWitchOrderBook, ERC1155Holder, UUPSUpgradeable
uint[] calldata _nftOrderIds,
uint[] calldata _tokenIds
) external override {
claimTokens(_brushOrderIds);
claimNFTs(_nftOrderIds, _tokenIds);
if (_brushOrderIds.length == 0 && _nftOrderIds.length == 0 && _tokenIds.length == 0) {
revert NothingToClaim();
}

if (_brushOrderIds.length + _nftOrderIds.length > MAX_CLAIMABLE_ORDERS) {
revert ClaimingTooManyOrders();
}

if (_brushOrderIds.length != 0) {
claimTokens(_brushOrderIds);
}

if (_nftOrderIds.length != 0) {
claimNFTs(_nftOrderIds, _tokenIds);
}
}

/// @notice Get the amount of tokens claimable for these orders
Expand Down
Loading

0 comments on commit 845e099

Please sign in to comment.