Skip to content

Commit

Permalink
Allow zero payments
Browse files Browse the repository at this point in the history
  • Loading branch information
ScreamingHawk committed Jun 28, 2024
1 parent 0e5a15c commit 90c6751
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/payments/Payments.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,17 @@ contract Payments is Ownable, IPayments, IERC165 {
uint256 amount
) internal {
if (tokenType == TokenType.ERC1155) {
if (amount == 0) {
revert InvalidTokenTransfer();
}
// ERC-1155
IERC1155(tokenAddr).safeTransferFrom(from, to, tokenId, amount, "");
} else if (tokenType == TokenType.ERC721) {
// ERC-721
if (amount != 1) {
if (amount > 1) {
revert InvalidTokenTransfer();
}
IERC721Transfer(tokenAddr).safeTransferFrom(from, to, tokenId);
} else if (tokenType == TokenType.ERC20) {
// ERC-20
if (tokenId != 0 || amount == 0) {
if (tokenId != 0) {
revert InvalidTokenTransfer();
}
SafeTransferLib.safeTransferFrom(tokenAddr, from, to, amount);
Expand Down

0 comments on commit 90c6751

Please sign in to comment.