Created
November 19, 2021 08:54
-
-
Save yoyoismee/3202d1a0d8e9af0cd7e56b6064be7ed4 to your computer and use it in GitHub Desktop.
NFTSender
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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