Skip to content

Instantly share code, notes, and snippets.

@yoyoismee
Created November 19, 2021 08:54
Show Gist options
  • Save yoyoismee/3202d1a0d8e9af0cd7e56b6064be7ed4 to your computer and use it in GitHub Desktop.
Save yoyoismee/3202d1a0d8e9af0cd7e56b6064be7ed4 to your computer and use it in GitHub Desktop.
NFTSender
// SPDX-License-Identifier: MIT
// AUTHOR: yoyoismee.eth
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// @notice an easy way to send multiple NFTs
contract NFTSender is ReentrancyGuard {
// @notice send multiple NFT
function sendNFT(
address nftAddress,
address[] memory recipients,
uint256[] memory tokenIDs
) public nonReentrant {
require(recipients.length == tokenIDs.length, "invalid input");
for (uint256 i = 0; i < recipients.length; i++) {
IERC721(nftAddress).safeTransferFrom(
msg.sender,
recipients[i],
tokenIDs[i]
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment