-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathBulkSender.sol
26 lines (23 loc) · 981 Bytes
/
BulkSender.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
pragma solidity ^0.4.18;
import './zeppelin-solidity/contracts/ownership/Ownable.sol';
import './zeppelin-solidity/contracts/token/SafeERC20.sol';
/**
* @dev A contract that can send multiple contracts to multiple addresses, at once.
*
* Based on OpenZeppelin framework. Uses the code of TokenTimelock as an example.
*/
contract BulkSender is Ownable {
using SafeERC20 for ERC20Basic;
/**
* @dev Transfer multiple batches for the same token to multiple addresses accordingly,
* from the ownership of the sender contract.
* Note: only the owner (creator) of this contract may call this.
*/
function bulkTransfer(ERC20Basic token, address[] toAddresses, uint256[] values) public onlyOwner returns (bool) {
require((toAddresses.length > 0) && (toAddresses.length == values.length));
for (uint i = 0; i < toAddresses.length; i++) {
token.safeTransfer(toAddresses[i], values[i]);
}
return true;
}
}