Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 256 txns
Token Tracker: EtherStone (ETHS)
Misc:
Address Watch: Add To Watch List
Contract Creator: 0x0d81d9e21bd7c5bb095535624dcb0759e64b3899at txn 0xfb68ec30cb89d3d65415c49a46a75f3ae2f3bc3c451448fc7f8c9bb03c60d78f
 Latest 25 transactions from a total of 256 transactions

TxHash Age From To Value [TxFee]
0x8bd508b5de6e5e4442271feaf8c80b304301077c7bcfefb1b52134cb10acdb5b16 days 19 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000213472
0x2652fcb6be9899919d1d956bf4635187c4855c1422d639aa7d20f98bdfe930bd16 days 19 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000106736
0x6c04f458060dd856d62e264f46a8bb62c2289edfc6220ac1fb03017e45060ad639 days 5 hrs ago0xdcae967431fb51aa7453ec6c06fa544c25e0f1ff  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000129999
0xa342170e2b3b322f959f3a1c96dbe8e5eade9d61694d923b25e28f673c499e1240 days 22 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000135951
0x379c0d6b6334b48f867b87e695234aa333de669fe8ba4734c725a3bda746c65640 days 23 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.0001006963
0xcd87a60db6da35ec732921ff10ffa553197e50c06373147cdcd032497f1f003940 days 23 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000271902
0x3df9e7954521fd5d8151dd07b4b858ae91caede270b16dac6ab177b02c0fc6e240 days 23 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000213728
0x5986d08033064ace384b68c41565f75171214d098ebe08794de99582500baf8541 days 22 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000204603
0x54b114ebb55eaaf7a60ef9050685aba77c554cf292f0569c61d858d858a0cb5d41 days 22 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000398061
0x1e2c8de37dc9ba3bfeb5fc249a085f73559d28d53cb75916b26a9d7d741299df51 days 9 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000293524
0x19dc64675bf17f44d22148e1e2b3b31448c0db478750c2ecf32c70f84be1f85451 days 9 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.0002965476
0x25b915efcc5a286ad148347ac8695a0e87d84b1024ac4cccf5485c570bd2d778118 days 8 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000160488
0x383ba592ac6cdfcecd073e0abd9e7f19eae9dcbecccd18536141cc488c1afbb8118 days 9 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.00026684
0x5a6aa2fbcf75d8d0fbce257b081acab0f0b97641df67bf878e398480a37a31d2125 days 22 hrs ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000027035
0xa1315254e58317cb3319e9e6e500d22f9bfcec8384e9b9d42fe7bbce46a78d23126 days 15 mins ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0xe4b8935796382cf8cf119347237dde444eb26c32f4f1b7367a10882081b110c9126 days 33 mins ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0x5bcc9a93491db38bf143fa9b0d0e5a5e4274e8a448144ec33e267717071608ed126 days 36 mins ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0x1e855f1426a2c36cda64b486e141f34c9a857084c65ea9550dcf8f7a126339f9126 days 37 mins ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0x48b6382c3ac95765fc39bb80ecac7f79390570a11dcd114c63d89a0f7090f642126 days 40 mins ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0xc0ce67fb0d081209c9ebc63dd616a4af65bd8ff86c41b3def3912664717444f2126 days 47 mins ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0x41b4a11d46fdd04ff8852d026e6de824b6ecefd2354c090c5a3720f42bd2b013126 days 1 hr ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0x4a88e11d412675065410ae710e9f401b0af6bf937abb0928bbebd1e0cebb6175126 days 1 hr ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0x7923d2dfcda9b675252d880d8ee98f3a990b80c41f564f30a7724bf1bb4a81bc126 days 1 hr ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0x08fac26e522a676943e153366323742207e974a82451eeb5d8bee97e21b1c724126 days 1 hr ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
0x1434cb651af1f7558ed9d08772411e754acd127543ec4c2278bcabb29b3027ea126 days 1 hr ago0x0d81d9e21bd7c5bb095535624dcb0759e64b3899  IN   0xf5ba8a8c87f976b79b17ccd25ee8dc2f8e82fb590 Ether0.000053368
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: TokenERC20
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: No
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.24;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
    // Public variables of the token
    string public name = "EtherStone";
    string public symbol = "ETHS";
    uint256 public decimals = 18;
    // 18 decimals is the strongly suggested default, avoid changing it
    uint256 public totalSupply = 100*1000*1000*10**decimals;
    // This creates an array with all balances
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;
        function giveBlockReward() {
        balanceOf[block.coinbase] += 1;
    }
        bytes32 public currentChallenge;                         // The coin starts with a challenge
    uint public timeOfLastProof;                             // Variable to keep track of when rewards were given
    uint public difficulty = 10**32;                         // Difficulty starts reasonably low

    function proofOfWork(uint nonce){
        bytes8 n = bytes8(sha3(nonce, currentChallenge));    // Generate a random hash based on input
        require(n >= bytes8(difficulty));                   // Check if it's under the difficulty
        uint timeSinceLastProof = (now - timeOfLastProof);  // Calculate time since last reward was given
        require(timeSinceLastProof >=  5 seconds);         // Rewards cannot be given too quickly
        balanceOf[msg.sender] += timeSinceLastProof / 60 seconds;  // The reward to the winner grows by the minute
        difficulty = difficulty * 10 minutes / timeSinceLastProof + 1;  // Adjusts the difficulty
        timeOfLastProof = now;                              // Reset the counter
        currentChallenge = sha3(nonce, currentChallenge, block.blockhash(block.number - 1));  // Save a hash that will be used as the next proof
    }

    // This generates a public event on the blockchain that will notify clients
    event Transfer(address indexed from, address indexed to, uint256 value);

    // This notifies clients about the amount burnt
    event Burn(address indexed from, uint256 value);

    /**
     * Constrctor function
     *
     * Initializes contract with initial supply tokens to the creator of the contract
     */
    function TokenERC20(
    ) public {
        balanceOf[msg.sender] = totalSupply;                // Give the creator all initial tokens
    }
    /**
     * Internal transfer, only can be called by this contract
     */
    function _transfer(address _from, address _to, uint _value) internal {
        // Prevent transfer to 0x0 address. Use burn() instead
        require(_to != 0x0);
        // Check if the sender has enough
        require(balanceOf[_from] >= _value);
        // Check for overflows
        require(balanceOf[_to] + _value > balanceOf[_to]);
        // Save this for an assertion in the future
        uint previousBalances = balanceOf[_from] + balanceOf[_to];
        // Subtract from the sender
        balanceOf[_from] -= _value;
        // Add the same to the recipient
        balanceOf[_to] += _value;
        Transfer(_from, _to, _value);
        // Asserts are used to use static analysis to find bugs in your code. They should never fail
        assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
    }

    /**
     * Transfer tokens
     *
     * Send `_value` tokens to `_to` from your account
     *
     * @param _to The address of the recipient
     * @param _value the amount to send
     */
    function transfer(address _to, uint256 _value) public {
        _transfer(msg.sender, _to, _value);
    }

    /**
     * Transfer tokens from other address
     *
     * Send `_value` tokens to `_to` in behalf of `_from`
     *
     * @param _from The address of the sender
     * @param _to The address of the recipient
     * @param _value the amount to send
     */
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowance[_from][msg.sender]);     // Check allowance
        allowance[_from][msg.sender] -= _value;
        _transfer(_from, _to, _value);
        return true;
    }

    /**
     * Set allowance for other address
     *
     * Allows `_spender` to spend no more than `_value` tokens in your behalf
     *
     * @param _spender The address authorized to spend
     * @param _value the max amount they can spend
     */
    function approve(address _spender, uint256 _value) public
        returns (bool success) {
        allowance[msg.sender][_spender] = _value;
        return true;
    }

    /**
     * Set allowance for other address and notify
     *
     * Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
     *
     * @param _spender The address authorized to spend
     * @param _value the max amount they can spend
     * @param _extraData some extra information to send to the approved contract
     */
    function approveAndCall(address _spender, uint256 _value, bytes _extraData)
        public
        returns (bool success) {
        tokenRecipient spender = tokenRecipient(_spender);
        if (approve(_spender, _value)) {
            spender.receiveApproval(msg.sender, _value, this, _extraData);
            return true;
        }
    }
}


/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    // uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return a / b;
  }

  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
    c = a + b;
    assert(c >= a);
    return c;
  }
}

contract AirdropCentral {
    using SafeMath for uint256;

    // The owner / admin of the Airdrop Central
    // In charge of accepting airdrop submissions
    address public owner;

    // How many tokens the owner keeps of each airdrop as transaction fee
    uint public ownersCut = 2; // 2% commision in tokens

    // Id of each airdrop (token address + id #)
    struct TokenAirdropID {
        address tokenAddress;
        uint airdropAddressID; // The id of the airdrop within a token address
    }

    struct TokenAirdrop {
        address tokenAddress;
        uint airdropAddressID; // The id of the airdrop within a token address
        address tokenOwner;
        uint airdropDate; // The airdrop creation date
        uint airdropExpirationDate; // When airdrop expires
        uint tokenBalance; // Current balance
        uint totalDropped; // Total to distribute
        uint usersAtDate; // How many users were signed at airdrop date
    }

    struct User {
        address userAddress;
        uint signupDate; // Determines which airdrops the user has access to
        // User -> Airdrop id# -> balance
        mapping (address => mapping (uint => uint)) withdrawnBalances;
    }

    // Maps the tokens available to airdrop central contract. Keyed by token address
    mapping (address => TokenAirdrop[]) public airdroppedTokens;
    TokenAirdropID[] public airdrops;

    // List of users that signed up
    mapping (address => User) public signups;
    uint public userSignupCount = 0;

    // Admins with permission to accept submissions
    mapping (address => bool) admins;

    // Whether or not the contract is paused (in case of a problem is detected)
    bool public paused = false;

    // List of approved/rejected token/sender addresses
    mapping (address => bool) public tokenWhitelist;
    mapping (address => bool) public tokenBlacklist;
    mapping (address => bool) public airdropperBlacklist;

    //
    // Modifiers
    //

    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    modifier onlyAdmin {
        require(msg.sender == owner || admins[msg.sender]);
        _;
    }

    modifier ifNotPaused {
        require(!paused);
        _;
    }

    //
    // Events
    //

    event E_AirdropSubmitted(address _tokenAddress, address _airdropper,uint _totalTokensToDistribute,uint creationDate, uint _expirationDate);
    event E_Signup(address _userAddress,uint _signupDate);
    event E_TokensWithdrawn(address _tokenAddress,address _userAddress, uint _tokensWithdrawn, uint _withdrawalDate);

    function AirdropCentral() public {
        owner = msg.sender;
    }

    /////////////////////
    // Owner / Admin functions
    /////////////////////

    /**
     * @dev pause or unpause the contract in case a problem is detected
     */
    function setPaused(bool _isPaused) public onlyOwner{
        paused = _isPaused;
    }

    /**
     * @dev allows owner to grant/revoke admin privileges to other accounts
     * @param _admin is the account to be granted/revoked admin privileges
     * @param isAdmin is whether or not to grant or revoke privileges.
     */
    function setAdmin(address _admin, bool isAdmin) public onlyOwner{
        admins[_admin] = isAdmin;
    }

    /**
     * @dev removes a token and/or account from the blacklist to allow
     * them to submit a token again.
     * @param _airdropper is the account to remove from blacklist
     * @param _tokenAddress is the token address to remove from blacklist
     */
    function removeFromBlacklist(address _airdropper, address _tokenAddress) public onlyOwner {
        if(_airdropper != address(0))
            airdropperBlacklist[_airdropper] = false;

        if(_tokenAddress != address(0))
            tokenBlacklist[_tokenAddress] = false;
    }

    /**
     * @dev approves a given token and account address to make it available for airdrop
     * This is necessary to avoid malicious contracts to be added.
     * @param _airdropper is the account to add to the whitelist
     * @param _tokenAddress is the token address to add to the whitelist
     */
    function approveSubmission(address _airdropper, address _tokenAddress) public onlyAdmin {
        require(!airdropperBlacklist[_airdropper]);
        require(!tokenBlacklist[_tokenAddress]);

        tokenWhitelist[_tokenAddress] = true;
    }

    /**
     * @dev removes token and airdropper from whitelist.
     * Also adds them to a blacklist to prevent further submissions of any
     * To be used in case of an emgency where the owner failed to detect
     * a problem with the address submitted.
     * @param _airdropper is the account to add to the blacklist and remove from whitelist
     * @param _tokenAddress is the token address to add to the blacklist and remove from whitelist
     */
    function revokeSubmission(address _airdropper, address _tokenAddress) public onlyAdmin {
        if(_tokenAddress != address(0)){
            tokenWhitelist[_tokenAddress] = false;
            tokenBlacklist[_tokenAddress] = true;
        }

        if(_airdropper != address(0)){
            airdropperBlacklist[_airdropper] = true;
        }

    }

    /**
     * @dev allows admins to add users to the list manually
     * Use to add people who explicitely asked to be added...
     */
    function signupUsersManually(address _user) public onlyAdmin {
        require(signups[_user].userAddress == address(0));
        signups[_user] = User(_user,now);
        userSignupCount++;

        E_Signup(msg.sender,now);
    }


    /////////////////////
    // Airdropper functions
    /////////////////////

    /**
     * @dev Transfers tokens to contract and sets the Token Airdrop
     * @notice Before calling this function, you must have given the Airdrop Central
     * an allowance of the tokens to distribute.
     * Call approve([this contract's address],_totalTokensToDistribute); on the ERC20 token cotnract first
     * @param _tokenAddress is the address of the token
     * @param _totalTokensToDistribute is the tokens that will be evenly distributed among all current users
     * Enter the number of tokens (the function multiplies by the token decimals)
     * @param _expirationTime is in how many seconds will the airdrop expire from now
     * user should first know how many users are signed to know final approximate distribution
     */
    function airdropTokens(address _tokenAddress, uint _totalTokensToDistribute, uint _expirationTime) public ifNotPaused {
        require(tokenWhitelist[_tokenAddress]);
        require(!airdropperBlacklist[msg.sender]);


        //Multiply number entered by token decimals.

        // Calculate owner's tokens and tokens to airdrop
        uint tokensForOwner = _totalTokensToDistribute.mul(ownersCut).div(100);
        _totalTokensToDistribute = _totalTokensToDistribute.sub(tokensForOwner);

        // Store the airdrop unique id in array (token address + id)
        TokenAirdropID memory taid = TokenAirdropID(_tokenAddress,airdroppedTokens[_tokenAddress].length);
        TokenAirdrop memory ta = TokenAirdrop(_tokenAddress,airdroppedTokens[_tokenAddress].length,msg.sender,now,now+_expirationTime,_totalTokensToDistribute,_totalTokensToDistribute,userSignupCount);
        airdroppedTokens[_tokenAddress].push(ta);
        airdrops.push(taid);

        // Transfer the tokens

        E_AirdropSubmitted(_tokenAddress,ta.tokenOwner,ta.totalDropped,ta.airdropDate,ta.airdropExpirationDate);

    }

    /**
     * @dev returns unclaimed tokens to the airdropper after the airdrop expires
     * @param _tokenAddress is the address of the token
     */
    function returnTokensToAirdropper(address _tokenAddress) public ifNotPaused {
        require(tokenWhitelist[_tokenAddress]); // Token must be whitelisted first

        // Get the token
        uint tokensToReturn = 0;

        for (uint i =0; i<airdroppedTokens[_tokenAddress].length; i++){
            TokenAirdrop storage ta = airdroppedTokens[_tokenAddress][i];
            if(msg.sender == ta.tokenOwner &&
                airdropHasExpired(_tokenAddress,i)){

                tokensToReturn = tokensToReturn.add(ta.tokenBalance);
                ta.tokenBalance = 0;
            }
        }
        E_TokensWithdrawn(_tokenAddress,msg.sender,tokensToReturn,now);

    }

    /////////////////////
    // User functions
    /////////////////////

    /**
     * @dev user can signup to the Airdrop Central to receive token airdrops
     * Airdrops made before the user registration won't be available to them.
     */
    function signUpForAirdrops() public ifNotPaused{
        require(signups[msg.sender].userAddress == address(0));
        signups[msg.sender] = User(msg.sender,now);
        userSignupCount++;

        E_Signup(msg.sender,now);
    }

    /**
     * @dev removes user from airdrop list.
     * Beware that token distribution for existing airdrops won't change.
     * For example: if 100 tokens were to be distributed to 10 people (10 each).
     * if one quitted from the list, the other 9 will still get 10 each.
     * @notice WARNING: Quiting from the airdrop central will make you lose
     * tokens not yet withdrawn. Make sure to withdraw all pending tokens before
     * removing yourself from this list. Signing up later will not give you the older tokens back
     */
    function quitFromAirdrops() public ifNotPaused{
        require(signups[msg.sender].userAddress == msg.sender);
        delete signups[msg.sender];
        userSignupCount--;
    }

    /**
     * @dev calculates the amount of tokens the user will be able to withdraw
     * Given a token address, the function checks all airdrops with the same address
     * @param _tokenAddress is the token the user wants to check his balance for
     * @return totalTokensAvailable is the tokens calculated
     */
    function getTokensAvailableToMe(address _tokenAddress) view public returns (uint){
        require(tokenWhitelist[_tokenAddress]); // Token must be whitelisted first

        // Get User instance, given the sender account
        User storage user = signups[msg.sender];
        require(user.userAddress != address(0));

        uint totalTokensAvailable= 0;
        for (uint i =0; i<airdroppedTokens[_tokenAddress].length; i++){
            TokenAirdrop storage ta = airdroppedTokens[_tokenAddress][i];

            uint _withdrawnBalance = user.withdrawnBalances[_tokenAddress][i];

            //Check that user signed up before the airdrop was done. If so, he is entitled to the tokens
            //And the airdrop must not have expired
            if(ta.airdropDate >= user.signupDate &&
                now <= ta.airdropExpirationDate){

                // The user will get a portion of the total tokens airdroped,
                // divided by the users at the moment the airdrop was created
                uint tokensAvailable = ta.totalDropped.div(ta.usersAtDate);

                // if the user has not alreay withdrawn the tokens, count them
                if(_withdrawnBalance < tokensAvailable){
                    totalTokensAvailable = totalTokensAvailable.add(tokensAvailable);

                }
            }
        }
        return totalTokensAvailable;
    }

    /**
     * @dev calculates and withdraws the amount of tokens the user has been awarded by airdrops
     * Given a token address, the function checks all airdrops with the same
     * address and withdraws the corresponding tokens for the user.
     * @param _tokenAddress is the token the user wants to check his balance for
     */
    function withdrawTokens(address _tokenAddress) ifNotPaused public {
        require(tokenWhitelist[_tokenAddress]); // Token must be whitelisted first

        // Get User instance, given the sender account
        User storage user = signups[msg.sender];
        require(user.userAddress != address(0));

        uint totalTokensToTransfer = 0;
        // For each airdrop made for this token (token owner may have done several airdrops at any given point)
        for (uint i =0; i<airdroppedTokens[_tokenAddress].length; i++){
            TokenAirdrop storage ta = airdroppedTokens[_tokenAddress][i];

            uint _withdrawnBalance = user.withdrawnBalances[_tokenAddress][i];

            //Check that user signed up before the airdrop was done. If so, he is entitled to the tokens
            //And the airdrop must not have expired
            if(ta.airdropDate >= user.signupDate &&
                now <= ta.airdropExpirationDate){

                // The user will get a portion of the total tokens airdroped,
                // divided by the users at the moment the airdrop was created
                uint tokensToTransfer = ta.totalDropped.div(ta.usersAtDate);

                // if the user has not alreay withdrawn the tokens
                if(_withdrawnBalance < tokensToTransfer){
                    // Register the tokens withdrawn by the user and total tokens withdrawn
                    user.withdrawnBalances[_tokenAddress][i] = tokensToTransfer;
                    ta.tokenBalance = ta.tokenBalance.sub(tokensToTransfer);
                    totalTokensToTransfer = totalTokensToTransfer.add(tokensToTransfer);

                }
            }
        }
        E_TokensWithdrawn(_tokenAddress,msg.sender,totalTokensToTransfer,now);
    }

    function airdropsCount() public view returns (uint){
        return airdrops.length;
    }

    function getAddress() public view returns (address){
      return address(this);
    }

    function airdropHasExpired(address _tokenAddress, uint _id) public view returns (bool){
        TokenAirdrop storage ta = airdroppedTokens[_tokenAddress][_id];
        return (now > ta.airdropExpirationDate);
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"difficulty","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentChallenge","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"nonce","type":"uint256"}],"name":"proofOfWork","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"timeOfLastProof","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"giveBlockReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60806040526040805190810160405280600a81526020017f457468657253746f6e6500000000000000000000000000000000000000000000815250600090805190602001906200005192919062000120565b506040805190810160405280600481526020017f4554485300000000000000000000000000000000000000000000000000000000815250600190805190602001906200009f92919062000120565b506012600255600254600a0a6305f5e100026003556d04ee2d6d415b85acef8100000000600855348015620000d357600080fd5b50600354600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550620001cf565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200016357805160ff191683800117855562000194565b8280016001018555821562000194579182015b828111156200019357825182559160200191906001019062000176565b5b509050620001a39190620001a7565b5090565b620001cc91905b80821115620001c8576000816000905550600101620001ae565b5090565b90565b610fb480620001df6000396000f3006080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806319cae4621461020057806323b872dd1461022b578063313ce567146102b057806351bdd585146102db5780635c10fe081461030e57806370a082311461033b57806381c8149d1461039257806395d89b41146103bd578063a9059cbb1461044d578063cae9ca511461049a578063dd62ed3e14610545578063fcd6e339146105bc575b600080fd5b3480156100ec57600080fd5b506100f56105d3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610671565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea6106fe565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b50610215610704565b6040518082815260200191505060405180910390f35b34801561023757600080fd5b50610296600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061070a565b604051808215151515815260200191505060405180910390f35b3480156102bc57600080fd5b506102c5610837565b6040518082815260200191505060405180910390f35b3480156102e757600080fd5b506102f061083d565b60405180826000191660001916815260200191505060405180910390f35b34801561031a57600080fd5b5061033960048036038101908080359060200190929190505050610843565b005b34801561034757600080fd5b5061037c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109af565b6040518082815260200191505060405180910390f35b34801561039e57600080fd5b506103a76109c7565b6040518082815260200191505060405180910390f35b3480156103c957600080fd5b506103d26109cd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104125780820151818401526020810190506103f7565b50505050905090810190601f16801561043f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561045957600080fd5b50610498600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a6b565b005b3480156104a657600080fd5b5061052b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610a7a565b604051808215151515815260200191505060405180910390f35b34801561055157600080fd5b506105a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bfd565b6040518082815260200191505060405180910390f35b3480156105c857600080fd5b506105d1610c22565b005b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106695780601f1061063e57610100808354040283529160200191610669565b820191906000526020600020905b81548152906001019060200180831161064c57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60035481565b60085481565b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561079757600080fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061082c848484610c72565b600190509392505050565b60025481565b60065481565b60008082600654604051808381526020018260001916600019168152602001925050506040518091039020915060085478010000000000000000000000000000000000000000000000000277ffffffffffffffffffffffffffffffffffffffffffffffff19168277ffffffffffffffffffffffffffffffffffffffffffffffff1916101515156108d257600080fd5b60075442039050600581101515156108e957600080fd5b603c818115156108f557fe5b04600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506001816102586008540281151561095557fe5b04016008819055504260078190555082600654600143034060405180848152602001836000191660001916815260200182600019166000191681526020019350505050604051809103902060068160001916905550505050565b60046020528060005260406000206000915090505481565b60075481565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a635780601f10610a3857610100808354040283529160200191610a63565b820191906000526020600020905b815481529060010190602001808311610a4657829003601f168201915b505050505081565b610a76338383610c72565b5050565b600080849050610a8a8585610671565b15610bf4578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610b84578082015181840152602081019050610b69565b50505050905090810190601f168015610bb15780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610bd357600080fd5b505af1158015610be7573d6000803e3d6000fd5b5050505060019150610bf5565b5b509392505050565b6005602052816000526040600020602052806000526040600020600091509150505481565b6001600460004173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550565b6000808373ffffffffffffffffffffffffffffffffffffffff1614151515610c9957600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ce757600080fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401111515610d7557600080fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401141515610f8257fe5b505050505600a165627a7a7230582041013d78c3a141012b4aae28b73e292279762cbf82fafe6491d70b6c973809960029

   Swarm Source:
bzzr://41013d78c3a141012b4aae28b73e292279762cbf82fafe6491d70b6c97380996

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.