Created
May 11, 2018 03:21
-
-
Save beenhero/c67a9dec2f27304fc26b0a8fd93e54a6 to your computer and use it in GitHub Desktop.
airdrop
This file contains hidden or 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.4.18; | |
import "./Ownable.sol"; | |
import "./Token.sol"; | |
contract Airdropper is Ownable { | |
function multisend(address _tokenAddr, address[] dests, uint256[] values) | |
public onlyOwner | |
returns (uint256) { | |
uint256 i = 0; | |
while (i < dests.length) { | |
Token(_tokenAddr).transfer(dests[i], values[i]); | |
i += 1; | |
} | |
return(i); | |
} | |
} | |
/// Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md | |
pragma solidity ^0.4.18; | |
/// @title Abstract token contract - Functions to be implemented by token contracts | |
contract Token { | |
/* | |
* Events | |
*/ | |
event Transfer(address indexed from, address indexed to, uint value); | |
event Approval(address indexed owner, address indexed spender, uint value); | |
/* | |
* Public functions | |
*/ | |
function transfer(address to, uint value) public returns (bool); | |
function transferFrom(address from, address to, uint value) public returns (bool); | |
function approve(address spender, uint value) public returns (bool); | |
function balanceOf(address owner) public constant returns (uint); | |
function allowance(address owner, address spender) public constant returns (uint); | |
function totalSupply() public constant returns (uint); | |
} | |
pragma solidity ^0.4.18; | |
/** | |
* @title Ownable | |
* @dev The Ownable contract has an owner address, and provides basic authorization control | |
* functions, this simplifies the implementation of "user permissions". | |
*/ | |
contract Ownable { | |
address public owner; | |
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); | |
/** | |
* @dev The Ownable constructor sets the original `owner` of the contract to the sender | |
* account. | |
*/ | |
function Ownable() public { | |
owner = msg.sender; | |
} | |
/** | |
* @dev Throws if called by any account other than the owner. | |
*/ | |
modifier onlyOwner() { | |
require(msg.sender == owner); | |
_; | |
} | |
/** | |
* @dev Allows the current owner to transfer control of the contract to a newOwner. | |
* @param newOwner The address to transfer ownership to. | |
*/ | |
function transferOwnership(address newOwner) public onlyOwner { | |
require(newOwner != address(0)); | |
OwnershipTransferred(owner, newOwner); | |
owner = newOwner; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment