-
Notifications
You must be signed in to change notification settings - Fork 0
/
BulkSend.sol
32 lines (29 loc) · 1.27 KB
/
BulkSend.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC777/IERC777.sol';
contract BulkSend {
/**
* Send a given amount of tokens to multiple recipients
* @param _token the address of the token contract
* @param _recipients the list of recipents
* @param _amount the amount of tokens to send to each recipient
* @param _data the data to attach to each send
*/
function send(IERC777 _token, address[] memory _recipients, uint256 _amount, bytes memory _data) public {
for (uint256 i = 0; i < _recipients.length; i++) {
_token.operatorSend(msg.sender, _recipients[i], _amount, _data, "");
}
}
/**
* Send individual amounts of tokens to multiple recipients
* @param _token the address of the token contract
* @param _recipients the list of recipents
* @param _amounts the amount of tokens to send to each recipient
* @param _data the data to attach to each send
*/
function sendAmounts(IERC777 _token, address[] memory _recipients, uint256[] memory _amounts, bytes memory _data) public {
for (uint256 i = 0; i < _recipients.length; i++) {
_token.operatorSend(msg.sender, _recipients[i], _amounts[i], _data, "");
}
}
}