APE Price: $1.19 (-12.55%)

Contract Diff Checker

Contract Name:
BatchTransfer

Contract Source Code:

File 1 of 1 : BatchTransfer

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC721 {
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;
}

contract BatchTransfer {
    struct TransferData {
        address recipient;
        uint256[] tokenIds;
    }

    function batchTransfer(
        address collection,
        TransferData[] calldata transfers
    ) external {
        require(collection != address(0), "Invalid collection address");

        IERC721 erc721 = IERC721(collection);

        for (uint256 i = 0; i < transfers.length; i++) {
            TransferData calldata transferData = transfers[i];
            address recipient = transferData.recipient;
            uint256[] calldata tokenIds = transferData.tokenIds;

            for (uint256 j = 0; j < tokenIds.length; j++) {
                erc721.safeTransferFrom(msg.sender, recipient, tokenIds[j]);
            }
        }
    }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):