Overview
Balance: 0 Ether
Transactions: 4 txns
 Latest 4 txns

TxHash Age From To Value [TxFee]
0x952e3d60165629ee0223c5e7620aff1b802046e7333e90dbe722e0d2886ce0b110 days 19 hrs ago0xe9a909e60c7a26892f3f8b7c11817b732315c4d2  IN   0x529b30092c385225679e507fa12e210f14c0018f0 Ether0.000158435
0x3bd6d9597b3a62863d8b5cca699219d4f2da987fc9ab51f784b4dffee8ad5e3710 days 20 hrs ago0xf54749072b63f7c5e088fb6a8d7d2a8b33746d5e  IN   0x529b30092c385225679e507fa12e210f14c0018f0 Ether0.000442145
0xcf4dbc4b9ea5c6bc0fda78c8f2028dfd5004da71a83a065a430b848287fdd05310 days 20 hrs ago0x54b01acb5ecb078d1d69eb277b2510ae97aef5b1  IN   0x529b30092c385225679e507fa12e210f14c0018f0 Ether0.00044578
0x225f7b3b7504ab3db18536cf4ce9d04b1522723d214eabd18351bc270d44da0c10 days 20 hrs ago0xe9a909e60c7a26892f3f8b7c11817b732315c4d2  IN    Contract Creation0 Ether0.00902071
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 4 Internal Transactions

ParentTxHash Block Age From To Value
0x952e3d60165629ee0223c5e7620aff1b802046e7333e90dbe722e0d2886ce0b1481518310 days 19 hrs ago0x529b30092c385225679e507fa12e210f14c0018f0xe9a909e60c7a26892f3f8b7c11817b732315c4d20 Ether
0x952e3d60165629ee0223c5e7620aff1b802046e7333e90dbe722e0d2886ce0b1481518310 days 19 hrs ago0x529b30092c385225679e507fa12e210f14c0018f0x65fce5d0a3d6aea25622449b142306cf3b9866670 Ether
0x952e3d60165629ee0223c5e7620aff1b802046e7333e90dbe722e0d2886ce0b1481518310 days 19 hrs ago0x529b30092c385225679e507fa12e210f14c0018f0x65fce5d0a3d6aea25622449b142306cf3b9866670 Ether
0x952e3d60165629ee0223c5e7620aff1b802046e7333e90dbe722e0d2886ce0b1481518310 days 19 hrs ago0x529b30092c385225679e507fa12e210f14c0018f0x65fce5d0a3d6aea25622449b142306cf3b9866670 Ether
[ Download CSV Export  ] 
Contract Self Destruct Called At TxHash 0x952e3d60165629ee0223c5e7620aff1b802046e7333e90dbe722e0d2886ce0b1

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: MerkleAirdrop
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.20;

library SafeMath {
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }

  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 c;
  }

  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

contract Ownable {
  address public owner;


  event OwnershipRenounced(address indexed previousOwner);
  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 relinquish control of the contract.
   * @notice Renouncing to ownership will leave the contract without an owner.
   * It will not be possible to call the functions with the `onlyOwner`
   * modifier anymore.
   */
  function renounceOwnership() public onlyOwner {
    OwnershipRenounced(owner);
    owner = address(0);
  }

  /**
   * @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 {
    _transferOwnership(_newOwner);
  }

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address _newOwner) internal {
    require(_newOwner != address(0));
    OwnershipTransferred(owner, _newOwner);
    owner = _newOwner;
  }
}

contract ERC20Basic {
  function totalSupply() public view returns (uint256);
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
}

contract ERC20 is ERC20Basic {
  function allowance(address owner, address spender)
    public view returns (uint256);

  function transferFrom(address from, address to, uint256 value)
    public returns (bool);

  function approve(address spender, uint256 value) public returns (bool);
  event Approval(
    address indexed owner,
    address indexed spender,
    uint256 value
  );
}

contract BasicToken is ERC20Basic {
  using SafeMath for uint256;

  mapping(address => uint256) balances;

  uint256 totalSupply_;

  /**
  * @dev Total number of tokens in existence
  */
  function totalSupply() public view returns (uint256) {
    return totalSupply_;
  }

  /**
  * @dev Transfer token for a specified address
  * @param _to The address to transfer to.
  * @param _value The amount to be transferred.
  */
  function transfer(address _to, uint256 _value) public returns (bool) {
    require(_to != address(0));
    require(_value <= balances[msg.sender]);

    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    Transfer(msg.sender, _to, _value);
    return true;
  }

  /**
  * @dev Gets the balance of the specified address.
  * @param _owner The address to query the the balance of.
  * @return An uint256 representing the amount owned by the passed address.
  */
  function balanceOf(address _owner) public view returns (uint256) {
    return balances[_owner];
  }

}

contract StandardToken is ERC20, BasicToken {

  mapping (address => mapping (address => uint256)) internal allowed;


  /**
   * @dev Transfer tokens from one address to another
   * @param _from address The address which you want to send tokens from
   * @param _to address The address which you want to transfer to
   * @param _value uint256 the amount of tokens to be transferred
   */
  function transferFrom(
    address _from,
    address _to,
    uint256 _value
  )
    public
    returns (bool)
  {
    require(_to != address(0));
    require(_value <= balances[_from]);
    require(_value <= allowed[_from][msg.sender]);

    balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(_value);
    allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
    Transfer(_from, _to, _value);
    return true;
  }

  /**
   * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
   * Beware that changing an allowance with this method brings the risk that someone may use both the old
   * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
   * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
   * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
   * @param _spender The address which will spend the funds.
   * @param _value The amount of tokens to be spent.
   */
  function approve(address _spender, uint256 _value) public returns (bool) {
    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
    return true;
  }

  /**
   * @dev Function to check the amount of tokens that an owner allowed to a spender.
   * @param _owner address The address which owns the funds.
   * @param _spender address The address which will spend the funds.
   * @return A uint256 specifying the amount of tokens still available for the spender.
   */
  function allowance(
    address _owner,
    address _spender
   )
    public
    view
    returns (uint256)
  {
    return allowed[_owner][_spender];
  }

  /**
   * @dev Increase the amount of tokens that an owner allowed to a spender.
   * approve should be called when allowed[_spender] == 0. To increment
   * allowed value is better to use this function to avoid 2 calls (and wait until
   * the first transaction is mined)
   * From MonolithDAO Token.sol
   * @param _spender The address which will spend the funds.
   * @param _addedValue The amount of tokens to increase the allowance by.
   */
  function increaseApproval(
    address _spender,
    uint256 _addedValue
  )
    public
    returns (bool)
  {
    allowed[msg.sender][_spender] = (
      allowed[msg.sender][_spender].add(_addedValue));
    Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

  /**
   * @dev Decrease the amount of tokens that an owner allowed to a spender.
   * approve should be called when allowed[_spender] == 0. To decrement
   * allowed value is better to use this function to avoid 2 calls (and wait until
   * the first transaction is mined)
   * From MonolithDAO Token.sol
   * @param _spender The address which will spend the funds.
   * @param _subtractedValue The amount of tokens to decrease the allowance by.
   */
  function decreaseApproval(
    address _spender,
    uint256 _subtractedValue
  )
    public
    returns (bool)
  {
    uint256 oldValue = allowed[msg.sender][_spender];
    if (_subtractedValue > oldValue) {
      allowed[msg.sender][_spender] = 0;
    } else {
      allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
    }
    Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

}

contract MintableToken is StandardToken, Ownable {
  event Mint(address indexed to, uint256 amount);
  event MintFinished();

  bool public mintingFinished = false;


  modifier canMint() {
    require(!mintingFinished);
    _;
  }

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

  /**
   * @dev Function to mint tokens
   * @param _to The address that will receive the minted tokens.
   * @param _amount The amount of tokens to mint.
   * @return A boolean that indicates if the operation was successful.
   */
  function mint(
    address _to,
    uint256 _amount
  )
    hasMintPermission
    canMint
    public
    returns (bool)
  {
    totalSupply_ = totalSupply_.add(_amount);
    balances[_to] = balances[_to].add(_amount);
    Mint(_to, _amount);
  }
}


contract MerkleAirdrop {

    address owner;
    bytes32 public merkleRoot;

    // address of contract, having "transfer" function
    // airdrop contract must have ENOUGH TOKENS in its balance to perform transfer
    MintableToken public tokenContract;

    // fix already minted addresses
    mapping (address => bool) spent;
    event AirdropTransfer(address addr, uint256 num);

    function MerkleAirdrop(address _tokenAddress, bytes32 _merkleRoot) public {
        owner = msg.sender;
        tokenContract = MintableToken(0x65fce5d0a3d6aea25622449b142306cf3b986667);
        merkleRoot = 0x882cdbe832a9f8bc7902964e98ce612fbd83a08d1a14b518cfade9246ad4628c;
    }
    function setRoot(bytes32 _merkleRoot) public {
        require(msg.sender == owner);
        merkleRoot = _merkleRoot;
    }

    function contractTokenBalance() public view returns(uint) {
        return tokenContract.balanceOf(address(this));
    }

    function claim_rest_of_tokens_and_selfdestruct() public returns(bool) {
        // only owner
        require(msg.sender == owner);
        require(tokenContract.balanceOf(address(this)) >= 0);
        require(tokenContract.transfer(owner, tokenContract.balanceOf(address(this))));
        selfdestruct(owner);
        return true;
    }

    function addressToAsciiString(address x) internal pure returns (string) {
        bytes memory s = new bytes(40);
        for (uint i = 0; i < 20; i++) {
            byte b = byte(uint8(uint(x) / (2**(8*(19 - i)))));
            byte hi = byte(uint8(b) / 16);
            byte lo = byte(uint8(b) - 16 * uint8(hi));
            s[2*i] = char(hi);
            s[2*i+1] = char(lo);
        }
        return string(s);
    }

    function char(byte b) internal pure returns (byte c) {
        if (b < 10) return byte(uint8(b) + 0x30);
        else return byte(uint8(b) + 0x57);
    }


    function uintToStr(uint i) internal pure returns (string){
        if (i == 0) return "0";
        uint j = i;
        uint length;
        while (j != 0){
            length++;
            j /= 10;
        }
        bytes memory bstr = new bytes(length);
        uint k = length - 1;
        while (i != 0){
            bstr[k--] = byte(48 + i % 10);
            i /= 10;
        }
        return string(bstr);
    }

    function leaf_from_address_and_num_tokens(address _a, uint256 _n) internal pure returns(bytes32 ) {
        string memory prefix = "0x";
        string memory space = " ";

        // file with addresses and tokens have this format: "0x123...DEF 999", where 999 - num tokens
        // function simply calculates hash of such a string, given the target adddres and num_tokens

        bytes memory _ba = bytes(prefix);
        bytes memory _bb = bytes(addressToAsciiString(_a));
        bytes memory _bc = bytes(space);
        bytes memory _bd = bytes(uintToStr(_n));
        string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length);
        bytes memory babcde = bytes(abcde);
        uint k = 0;
        for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
        for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
        for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
        for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];

        return bytes32(keccak256(abcde));
    }


    function getTokensByMerkleProof(bytes32[] _proof, address _who, uint256 _amount) public returns(bool) {
        require(spent[_who] != true);
        require(_amount > 0);
        // require(msg.sender = _who); // makes not possible to mint tokens for somebody, uncomment for more strict version

        if (!checkProof(_proof, leaf_from_address_and_num_tokens(_who, _amount))) {
            return false;
        }

        spent[_who] = true;

        if (tokenContract.transfer(_who, _amount) == true) {
            AirdropTransfer(_who, _amount);
            return true;
        }
        // throw if transfer fails, no need to spend gaz
        require(false);
    }

    function checkProof(bytes32[] proof, bytes32 hash) view internal returns (bool) {
        bytes32 el;
        bytes32 h = hash;

        for (uint i = 0; i <= proof.length - 1; i += 1) {
            el = proof[i];

            if (h < el) {
                h = keccak256(h, el);
            } else {
                h = keccak256(el, h);
            }
        }

        return h == merkleRoot;
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"merkleRoot","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proof","type":"bytes32[]"},{"name":"_who","type":"address"},{"name":"_amount","type":"uint256"}],"name":"getTokensByMerkleProof","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"claim_rest_of_tokens_and_selfdestruct","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"contractTokenBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_merkleRoot","type":"bytes32"}],"name":"setRoot","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_tokenAddress","type":"address"},{"name":"_merkleRoot","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"num","type":"uint256"}],"name":"AirdropTransfer","type":"event"}]

  Contract Creation Code Switch To Opcodes View
608060405234801561001057600080fd5b50604051604080610c4283390160405260008054600160a060020a03199081163317909155600280549091167365fce5d0a3d6aea25622449b142306cf3b9866671790557f882cdbe832a9f8bc7902964e98ce612fbd83a08d1a14b518cfade9246ad4628c600155610bbb806100876000396000f3006080604052600436106100775763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632eb4a7ab811461007c5780633215b483146100a35780633f28f24c1461011d57806355a373d6146101325780639e9aed6214610163578063dab5f34014610178575b600080fd5b34801561008857600080fd5b50610091610192565b60408051918252519081900360200190f35b3480156100af57600080fd5b50604080516020600480358082013583810280860185019096528085526101099536959394602494938501929182918501908490808284375094975050508335600160a060020a0316945050506020909101359050610198565b604080519115158252519081900360200190f35b34801561012957600080fd5b506101096102fc565b34801561013e57600080fd5b506101476104fb565b60408051600160a060020a039092168252519081900360200190f35b34801561016f57600080fd5b5061009161050a565b34801561018457600080fd5b506101906004356105a0565b005b60015481565b600160a060020a03821660009081526003602052604081205460ff161515600114156101c357600080fd5b600082116101d057600080fd5b6101e3846101de85856105bc565b610883565b15156101f1575060006102f5565b600160a060020a038084166000818152600360209081526040808320805460ff1916600117905560025481517fa9059cbb000000000000000000000000000000000000000000000000000000008152600481019590955260248501889052905194169363a9059cbb93604480820194918390030190829087803b15801561027757600080fd5b505af115801561028b573d6000803e3d6000fd5b505050506040513d60208110156102a157600080fd5b50511515600114156100775760408051600160a060020a03851681526020810184905281517f100b8658c21fe4c10650c23cfd2c97c97ac86370102510563d824216683256a5929181900390910190a15060015b9392505050565b60008054600160a060020a0316331461031457600080fd5b600254604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561037957600080fd5b505af115801561038d573d6000803e3d6000fd5b505050506040513d60208110156103a357600080fd5b505110156103b057600080fd5b60025460008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a039485169463a9059cbb9493169285926370a082319260248083019360209383900390910190829087803b15801561042457600080fd5b505af1158015610438573d6000803e3d6000fd5b505050506040513d602081101561044e57600080fd5b5051604080517c010000000000000000000000000000000000000000000000000000000063ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b1580156104b657600080fd5b505af11580156104ca573d6000803e3d6000fd5b505050506040513d60208110156104e057600080fd5b505115156104ed57600080fd5b600054600160a060020a0316ff5b600254600160a060020a031681565b600254604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561056f57600080fd5b505af1158015610583573d6000803e3d6000fd5b505050506040513d602081101561059957600080fd5b5051905090565b600054600160a060020a031633146105b757600080fd5b600155565b604080518082018252600281527f30780000000000000000000000000000000000000000000000000000000000006020808301919091528251808401909352600183527f2000000000000000000000000000000000000000000000000000000000000000908301526000918160608080808088806106398d610905565b96508895506106478c610a1f565b94508451865188518a510101016040519080825280601f01601f191660200182016040528015610681578160200160208202803883390190505b50935083925060009150600090505b87518110156106ee5787818151811015156106a757fe5b90602001015160f860020a900460f860020a0283838060010194508151811015156106ce57fe5b906020010190600160f860020a031916908160001a905350600101610690565b5060005b865181101561075057868181518110151561070957fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561073057fe5b906020010190600160f860020a031916908160001a9053506001016106f2565b5060005b85518110156107b257858181518110151561076b57fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561079257fe5b906020010190600160f860020a031916908160001a905350600101610754565b5060005b84518110156108145784818151811015156107cd57fe5b90602001015160f860020a900460f860020a0283838060010194508151811015156107f457fe5b906020010190600160f860020a031916908160001a9053506001016107b6565b836040518082805190602001908083835b602083106108445780518252601f199092019160209182019101610825565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209a505050505050505050505092915050565b60008082815b85516000190181116108f85785818151811015156108a357fe5b602090810290910101519250828210156108d557604080519283526020830184905280519283900301909120906108f0565b60408051848152602081019390935280519283900301909120905b600101610889565b5060015414949350505050565b60408051602880825260608083019093528291600091829182918291906020820161050080388339019050509450600093505b6014841015610a14578360130360080260020a87600160a060020a031681151561095e57fe5b0460f860020a02925060108360f860020a900460ff1681151561097d57fe5b0460f860020a0291508160f860020a90046010028360f860020a90040360f860020a0290506109ab82610b12565b85856002028151811015156109bc57fe5b906020010190600160f860020a031916908160001a9053506109dd81610b12565b85856002026001018151811015156109f157fe5b906020010190600160f860020a031916908160001a905350600190930192610938565b509295945050505050565b60606000808281851515610a685760408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201529450610b09565b8593505b8315610a8357600190920191600a84049350610a6c565b826040519080825280601f01601f191660200182016040528015610ab1578160200160208202803883390190505b5091505060001982015b8515610b0557815160001982019160f860020a6030600a8a060102918491908110610ae257fe5b906020010190600160f860020a031916908160001a905350600a86049550610abb565b8194505b50505050919050565b60007f0a000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000083161015610b76578160f860020a900460300160f860020a029050610b8a565b8160f860020a900460570160f860020a0290505b9190505600a165627a7a72305820c0d9d1a706eced9da7cc9e9fb4996d1f9763e350f7a742eba45a4a33b56733970029

   Swarm Source:
bzzr://c0d9d1a706eced9da7cc9e9fb4996d1f9763e350f7a742eba45a4a33b5673397

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward