Skip to content

Instantly share code, notes, and snippets.

@maiiz
Created February 16, 2018 16:29
Show Gist options
  • Select an option

  • Save maiiz/f5aca555f2fe473e5b538cb3ac55aa47 to your computer and use it in GitHub Desktop.

Select an option

Save maiiz/f5aca555f2fe473e5b538cb3ac55aa47 to your computer and use it in GitHub Desktop.
multisend erc20 token
pragma solidity ^0.4.11;
/**
* @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;
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender != owner) {
revert();
}
_;
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
contract ERC20Basic {
uint public totalSupply;
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Airdropper is Ownable {
function multisend(address _tokenAddr, address[] dests, uint256[] values)
onlyOwner
public
returns (uint256) {
uint256 i = 0;
while (i < dests.length) {
ERC20(_tokenAddr).transfer(dests[i], values[i]);
i += 1;
}
return(i);
}
}
@rstormsf
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment