Created
April 29, 2022 02:32
-
-
Save rhlc/258c27f98babf0d5a1850ab4aa301f37 to your computer and use it in GitHub Desktop.
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
pragma solidity ^0.8.0; | |
//SPDX-License-Identifier: MIT | |
interface IERC1155 { | |
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; | |
function balanceOf(address account) external view returns (uint256); | |
function allowance(address owner, address spender) external view returns (uint256); | |
function setApprovalForAll(address _operator, bool _approved) external; | |
} | |
// todo: implement setApprovalForAll | |
function bulkAirdropERC1155(IERC1155 _token, address[] calldata _to, uint256[] calldata _id, uint256[] calldata _amount) public { | |
require(_to.length == _id.length, "Receivers and IDs are different length"); | |
for(uint256 i=0; i<_to.length; i++){ | |
_token.safeTransferFrom(msg.sender, _to[i], _id[i], _amount[i], ""); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment