Skip to content

Instantly share code, notes, and snippets.

@nanmu42
Created August 2, 2018 04:36
Show Gist options
  • Save nanmu42/f60964da53d968b6f479a9b06c606f11 to your computer and use it in GitHub Desktop.
Save nanmu42/f60964da53d968b6f479a9b06c606f11 to your computer and use it in GitHub Desktop.
Airdropper for any ERC20 contract
pragma solidity ^0.4.24;
interface Token {
function transfer(address _to, uint256 _value) external returns (bool);
}
contract onlyOwner {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
modifier isOwner {
require(msg.sender == owner);
_;
}
}
contract Campaigns is onlyOwner{
Token token;
event TransferredToken(address indexed to, uint256 value);
constructor(address _contract) public{
address _tokenAddr = _contract; //here pass address of your token
token = Token(_tokenAddr);
}
function sendResidualAmount(uint256 value) isOwner public returns(bool){
token.transfer(owner, value*10**18);
emit TransferredToken(msg.sender, value);
return true;
}
function sendAmount(address[] _user, uint256 value) isOwner public returns(bool){
for(uint i=0; i<_user.length; i++)
token.transfer(_user[i], value*10**18);
return true;
}
function sendIndividualAmount(address[] _user, uint256[] value) isOwner public returns(bool){
for(uint i=0; i<_user.length; i++)
token.transfer(_user[i], value[i]*10**18);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment