Skip to content

Instantly share code, notes, and snippets.

@rhlc
Created April 29, 2022 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhlc/258c27f98babf0d5a1850ab4aa301f37 to your computer and use it in GitHub Desktop.
Save rhlc/258c27f98babf0d5a1850ab4aa301f37 to your computer and use it in GitHub Desktop.
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