Verified contractPartial
AirDrop
Address0x75dcfa27a6e491cc64badd6c7a49cb73dd28eef5
- Balance
0 ETH
- Transactions
25
- Compiler
solc 0.4.16
- Same code
3 more contracts
Details
- Compiler
- solc 0.4.16+commit.d7661dd9
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: no, runtime code: yes
- Verified on Sourcify
- Created in block
- 5,885,339
- Creation transaction
- 0x5c57422ec8…cea302f175
- Main copy (most transactions)
- 0xd5f41331…27030667
AirDrop.sol
// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity ^0.4.16;
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
}
interface Token {
function transfer(address _to, uint256 _value) returns (bool);
function balanceOf(address _owner) constant returns (uint256 balance);
}
contract AirDrop is Ownable {
Token token;
event TransferredToken(address indexed to, uint256 value);
event FailedTransfer(address indexed to, uint256 value);
modifier whenDropIsActive() {
assert(isActive());
_;
}
function AirDrop () {
address _tokenAddr = 0x515669d308f887Fd83a471C7764F5d084886D34D;
token = Token(_tokenAddr);
}
function isActive() constant returns (bool) {
return (
tokensAvailable() > 0 // Tokens must be available to send
);
}
function sendTokens(address[] dests, uint256[] values) whenDropIsActive onlyOwner external {
uint256 i = 0;
while (i < dests.length) {
uint256 toSend = values[i] * 10**18;
sendInternally(dests[i] , toSend, values[i]);
i++;
}
}
function sendTokensSingleValue(address[] dests, uint256 value) whenDropIsActive onlyOwner external {
uint256 i = 0;
uint256 toSend = value * 10**18;
while (i < dests.length) {
sendInternally(dests[i] , toSend, value);
i++;
}
}
function sendInternally(address recipient, uint256 tokensToSend, uint256 valueToPresent) internal {
if(recipient == address(0)) return;
if(tokensAvailable() >= tokensToSend) {
token.transfer(recipient, tokensToSend);
TransferredToken(recipient, valueToPresent);
} else {
FailedTransfer(recipient, valueToPresent);
}
}
function tokensAvailable() constant returns (uint256) {
return token.balanceOf(this);
}
function destroy() onlyOwner {
uint256 balance = tokensAvailable();
require (balance > 0);
token.transfer(owner, balance);
selfdestruct(owner);
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.