Contract 0x4fee1274a9a5f8c58daf18f8545e4568c2db5769

 

TxHash Block Age From To Value [TxFee]
0x5a8c1e7bafc3c9b80cf8f35a21916b1467a45e4aa390b61029f4d73c759fccbe678523583 days 1 hr ago0x53f7c8abf7f3c26c38f5c5717dd25dd2dcd3e66e  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.000882361
0xaa3be5b0e4606b4dd7bfdbc2087df30adaa59d918be79925486a8cdeef7df7d5675819387 days 12 hrs ago0xb2beee0af1bd52252d1ae5de02722265a72ebc93  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.000882361
0x5c88935246b5487be597c577d7d29ed8e4bfbaf9712ac55551cbde80add295a9668961598 days 18 hrs ago0x97189815e12a402ab7a683d4d135d64266dc6e60  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001709331
0xfc20cdcca4f44f885c3ff450d9308ec3b32716a7fe6ccbb1968de6b4aba208a7668959098 days 18 hrs ago0x971a7535a9c6593f16b4eba4c3cbe993c3fdb064  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001645781
0xf5904ff508bb49c2e1461914521fc9a59775f386794bdd2b3f6e4fcd1fa63b9a668958698 days 18 hrs ago0xc570b482064380e478563a00c8133ce1734c06af  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001708921
0xce112b24d3e8467ffea411ac7f76497ec776505b47d09ee30ca3411ade7bf009668957998 days 18 hrs ago0x1b835a24e930cc59ac1d837e5634ef4392d06126  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001645371
0xb5bc5ad20f2f5284a2c1fcdcc9a2faff90eb51e6edb1f3065fce060e9a204547668630699 days 7 hrs ago0xc49ac07fbe5957a7725bd209b1c4342a1650a865  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.000875511
0xfecfccd23a9aa9882d2e6e20d5367ef7694a5f036c9b7f05fe1c2570b2d354466680075100 days 7 hrs ago0xc49ac07fbe5957a7725bd209b1c4342a1650a865  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.000875511
0x44c9872c6cd2779a5395dffe9e8b9693ec7f73c1f7de06dc51c00441c86ce9866673534101 days 9 hrs ago0xc49ac07fbe5957a7725bd209b1c4342a1650a865  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.000875511
0x80074334160ee584c641540ae08ae41229d266b4dce310680884f0cccb4672166667437102 days 9 hrs ago0xc49ac07fbe5957a7725bd209b1c4342a1650a865  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.000875511
0xc81bfc8b4c6858175ff907cd39b09e95bffc835de0133ccfbaae79ff11631fd66661314103 days 9 hrs ago0xc49ac07fbe5957a7725bd209b1c4342a1650a865  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.000875511
0xeb3e034e539f25ea534e84ef9fbb6bc9ed55e3c96b69f3bb9f3133ce1d319ea06661141103 days 10 hrs ago0x971a7535a9c6593f16b4eba4c3cbe993c3fdb064  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001645781
0xaff23158bafcf7c02e998d2e3d04687563d2a47fb69faac7965117f8291f3f706661097103 days 10 hrs ago0x971a7535a9c6593f16b4eba4c3cbe993c3fdb064  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001645781
0xfffa4155cb2fc4a334669873a096f997e4f2f78648578f8052f63a2aeaafc1e46661079103 days 10 hrs ago0x97189815e12a402ab7a683d4d135d64266dc6e60  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001709331
0xc4fc860de3af8444959e4f34d7aabad1042e1b5899dafe69c305d9edcf173aa76661070103 days 10 hrs ago0xe8205b4c5ab1f9040f36343c6b1319e8b10cdc50  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001709331
0xcd8421097b55e8023a23f10d3e85e986f1e3ac6130f102dd1409e19deda36b1e6661062103 days 10 hrs ago0x52ddb84994ef94d9371cfdbc1b4363ed710702c6  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001709331
0xb3bccf0ba531385db213ec6ebcdb1b6ac44cf63e6467eb7296e005dff9873af56661060103 days 10 hrs ago0x971a7535a9c6593f16b4eba4c3cbe993c3fdb064  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001645781
0xddabfc65f1e1b88fcd00a075c1ffc8b410a13b4099061494bd07d6d35c0ad8286661053103 days 10 hrs ago0xc570b482064380e478563a00c8133ce1734c06af  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001709331
0xba84d36d585a448c520f771feeee76fb087a2659e16df4f4b5f58cc2c55b054a6661046103 days 10 hrs ago0x1b835a24e930cc59ac1d837e5634ef4392d06126  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.001709331
0xb824b81bf072cee77e469da8cbeffdfb80d739444db6c2e03d3d1c1889b83f3e6660862103 days 11 hrs ago0x5e34ff528b109d77054642ea3cf01cc1cabb17a0  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.0002543151
0x22097a334cb260a1c63a2128ecfd110747e61289b49e4c514da976ee9743d61f6660862103 days 11 hrs ago0x8568dd62b455b1d9e5eb3e30ca3fc9005d0d4ccb  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.0002543151
0xabb9f409492886b3ccafd4652871fc078a09bad52ed53aa0325c589e2dba80266660862103 days 11 hrs ago0xb56379a4f4bf15369c7c03da798428e00a618ec7  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.0002543151
0x55a70582e2de090ea7fc3f1e0ffa8fe791b1f61d5a380c4e274c200bbd981fd46660737103 days 11 hrs ago0x01a334016d5dfd82599421ca66ce110f94a059b1  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.0002543151
0x49df5cc878cf2d66e1b23f78f9ed41a640877425140d922ebf482c56114a6faa6660737103 days 11 hrs ago0x32e1b59568f4514a12e99b08465c8dfe59ba312a  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.0002543151
0xcbc9805d0a53bc3b7c02f184ecb1e430954e32a954723622edd1b5f90c7d574a6660737103 days 11 hrs ago0x14fb315b3a5e89ae5387c322bdec0c7432272df9  IN   0x4fee1274a9a5f8c58daf18f8545e4568c2db57690 Ether0.0002543151
[ Download CSV Export 

Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0x5c88935246b5487be597c577d7d29ed8e4bfbaf9712ac55551cbde80add295a9668961598 days 18 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x97189815e12a402ab7a683d4d135d64266dc6e600.016 Ether
0xf5904ff508bb49c2e1461914521fc9a59775f386794bdd2b3f6e4fcd1fa63b9a668958698 days 18 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc570b482064380e478563a00c8133ce1734c06af0.104 Ether
0xb5bc5ad20f2f5284a2c1fcdcc9a2faff90eb51e6edb1f3065fce060e9a204547668630699 days 7 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc49ac07fbe5957a7725bd209b1c4342a1650a8650.0196 Ether
0xfecfccd23a9aa9882d2e6e20d5367ef7694a5f036c9b7f05fe1c2570b2d354466680075100 days 7 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc49ac07fbe5957a7725bd209b1c4342a1650a8650.0196 Ether
0x44c9872c6cd2779a5395dffe9e8b9693ec7f73c1f7de06dc51c00441c86ce9866673534101 days 9 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc49ac07fbe5957a7725bd209b1c4342a1650a8650.0196 Ether
0x80074334160ee584c641540ae08ae41229d266b4dce310680884f0cccb4672166667437102 days 9 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc49ac07fbe5957a7725bd209b1c4342a1650a8650.0196 Ether
0xc81bfc8b4c6858175ff907cd39b09e95bffc835de0133ccfbaae79ff11631fd66661314103 days 9 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc49ac07fbe5957a7725bd209b1c4342a1650a8650.0196 Ether
0xfffa4155cb2fc4a334669873a096f997e4f2f78648578f8052f63a2aeaafc1e46661079103 days 10 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x97189815e12a402ab7a683d4d135d64266dc6e600.036 Ether
0xc4fc860de3af8444959e4f34d7aabad1042e1b5899dafe69c305d9edcf173aa76661070103 days 10 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xe8205b4c5ab1f9040f36343c6b1319e8b10cdc500.032 Ether
0xcd8421097b55e8023a23f10d3e85e986f1e3ac6130f102dd1409e19deda36b1e6661062103 days 10 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x52ddb84994ef94d9371cfdbc1b4363ed710702c60.032 Ether
0xddabfc65f1e1b88fcd00a075c1ffc8b410a13b4099061494bd07d6d35c0ad8286661053103 days 10 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc570b482064380e478563a00c8133ce1734c06af0.208 Ether
0xba84d36d585a448c520f771feeee76fb087a2659e16df4f4b5f58cc2c55b054a6661046103 days 10 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x1b835a24e930cc59ac1d837e5634ef4392d061260.304 Ether
0xb824b81bf072cee77e469da8cbeffdfb80d739444db6c2e03d3d1c1889b83f3e6660862103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x5e34ff528b109d77054642ea3cf01cc1cabb17a00.032 Ether
0x22097a334cb260a1c63a2128ecfd110747e61289b49e4c514da976ee9743d61f6660862103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x8568dd62b455b1d9e5eb3e30ca3fc9005d0d4ccb0.576 Ether
0xabb9f409492886b3ccafd4652871fc078a09bad52ed53aa0325c589e2dba80266660862103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xb56379a4f4bf15369c7c03da798428e00a618ec70.288 Ether
0x55a70582e2de090ea7fc3f1e0ffa8fe791b1f61d5a380c4e274c200bbd981fd46660737103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x01a334016d5dfd82599421ca66ce110f94a059b10.224 Ether
0x49df5cc878cf2d66e1b23f78f9ed41a640877425140d922ebf482c56114a6faa6660737103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x32e1b59568f4514a12e99b08465c8dfe59ba312a0.128 Ether
0xcbc9805d0a53bc3b7c02f184ecb1e430954e32a954723622edd1b5f90c7d574a6660737103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x14fb315b3a5e89ae5387c322bdec0c7432272df90.224 Ether
0xa2eec711ea70388af5267883212cb3c30ddaa70972466ae93946b28aa2f0bbd46660737103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x753ca83cec200b47672d38d7b740b9b7f1b5cb730.544 Ether
0x0a74a9c83b050e13fade120094ab1b33b822f60bd4431661b55277d449e541c16660737103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x91145a740cab952f952dd8a53a882e149cf1a1aa0.448 Ether
0x2e7acdeceb6166050ea29066c0e4dc7b9b8b98bd7a98cd1e1f5c082c6c1b8b056660737103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x438e417b134bb053faeed119b96ff8a930c5f2d10.32 Ether
0x40eaa855b514d4fa8533ba6d5d5f7a90c5af17fd2aec890a6434b876975f04096660737103 days 11 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690x608cb0d548054c77ad605b06db4e20bf5c52877c0.072 Ether
0x2e509473015dc5060087a83fcfdaa45a7380f4b9e5b3cb6e6c47daa8df690d9c6655151104 days 9 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc49ac07fbe5957a7725bd209b1c4342a1650a8650.0196 Ether
0x5a8a22d10f1543671a9512bbb26105bb93e2a4f03defc32d7d1583cc482690936649001105 days 10 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc49ac07fbe5957a7725bd209b1c4342a1650a8650.0196 Ether
0x71cdb0d22af689f6ddc7da2758370bf04d93b1faa868da72107c1209d793ef606642951106 days 10 hrs ago0x4fee1274a9a5f8c58daf18f8545e4568c2db57690xc49ac07fbe5957a7725bd209b1c4342a1650a8650.0196 Ether
[ Download CSV Export 
Contract Source Code Verified (Exact Match)
Contract Name: EtherLife
Compiler Version: v0.4.25+commit.59dbf8f1
Optimization Enabled: Yes
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.24;

/**
 * @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) {
    if (a == 0) {
      return 0;
    }
    uint256 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 c;
  }

  /**
  * @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) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

/**
 * @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;


  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor () 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 transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }

}

contract EtherLife is Ownable
{   
    using SafeMath for uint;
    
    struct deposit {
        uint time;
        uint value;
        uint timeOfLastWithdraw;
    }
    
    mapping(address => deposit) public deposits;
    mapping(address => address) public parents;
    address[] public investors;
    
    uint public constant withdrawPeriod = 1 days;
    
    uint public constant minDepositSum = 100 finney; // 0.1 ether;
    
    event Deposit(address indexed from, uint256 value);
    event Withdraw(address indexed from, uint256 value);
    event ReferrerBonus(address indexed from, address indexed to, uint8 level, uint256 value);
    
    
    modifier checkSender() 
    {
        require(msg.sender != address(0));
        _;
    }

    
    function bytesToAddress(bytes source) internal pure returns(address parsedAddress) 
    {
        assembly {
            parsedAddress := mload(add(source,0x14))
        }
        return parsedAddress;
    }

    function () checkSender public payable 
    {
        if(msg.value == 0)
        {
            withdraw();
            return;
        }
        
        require(msg.value >= minDepositSum);
        
        checkReferrer(msg.sender);
        
        payFee(msg.value);
        addDeposit(msg.sender, msg.value);
        
        emit Deposit(msg.sender, msg.value);
        
        payRewards(msg.sender, msg.value);
    }
    
    function getInvestorsLength() public view returns (uint)
    {
        return investors.length;
    }
    
    function getParents(address investorAddress) public view returns (address[])
    {
        address[] memory refLevels = new address[](5);
        address current = investorAddress;
        
        for(uint8 i = 0; i < 5; i++)
        {
             current = parents[current];
             if(current == address(0)) break;
             refLevels[i] = current;
        }
        
        return refLevels;
    }
    
    function calculateRewardForLevel(uint8 level, uint value) public pure returns (uint)
    {
        if(level == 1) return value.div(50);           // 2%
        if(level == 2) return value.div(100);          // 1%
        if(level == 3) return value.div(200);          // 0.5%
        if(level == 4) return value.div(400);          // 0.25%
        if(level == 5) return value.div(400);          // 0.25%
        
        return 0;
    }
    
    function calculatWithdrawForPeriod(uint8 period, uint depositValue, uint periodsCount) public pure returns (uint)
    {
        if(period == 1)
        {
            return depositValue.div(25).mul(periodsCount);          // 4%
        }
        else if(period == 2)
        {
            return depositValue.mul(3).div(100).mul(periodsCount);  // 3%
        }
        else if(period == 3)
        {
            return depositValue.div(50).mul(periodsCount);          // 2%
        }
        else if(period == 4)
        {
            return depositValue.div(100).mul(periodsCount);         // 1%
        }
        else if(period == 5)
        {
            return depositValue.div(200).mul(periodsCount);         // 0.5%
        }
        
        return 0;
    }
    
    function calculateWithdraw(uint currentTime, uint depositTime, uint depositValue, uint timeOfLastWithdraw) public pure returns (uint)
    {
        if(currentTime - timeOfLastWithdraw < withdrawPeriod)
        {
            return 0;
        }
        
        uint timeEndOfPeriod1 = depositTime + 30 days;
        uint timeEndOfPeriod2 = depositTime + 60 days;
        uint timeEndOfPeriod3 = depositTime + 90 days;
        uint timeEndOfPeriod4 = depositTime + 120 days;
        

        uint sum = 0;
        uint timeEnd = 0;
        uint periodsCount = 0;
            
        if(timeOfLastWithdraw < timeEndOfPeriod1)
        {
            timeEnd = currentTime > timeEndOfPeriod1 ? timeEndOfPeriod1 : currentTime;
            (periodsCount, timeOfLastWithdraw) = calculatePeriodsCountAndNewTime(timeOfLastWithdraw, timeEnd);
            sum = calculatWithdrawForPeriod(1, depositValue, periodsCount);
        }
        
        if(timeOfLastWithdraw < timeEndOfPeriod2)
        {
            timeEnd = currentTime > timeEndOfPeriod2 ? timeEndOfPeriod2 : currentTime;
            (periodsCount, timeOfLastWithdraw) = calculatePeriodsCountAndNewTime(timeOfLastWithdraw, timeEnd);
            sum = sum.add(calculatWithdrawForPeriod(2, depositValue, periodsCount));
        }
        
        if(timeOfLastWithdraw < timeEndOfPeriod3)
        {
            timeEnd = currentTime > timeEndOfPeriod3 ? timeEndOfPeriod3 : currentTime;
            (periodsCount, timeOfLastWithdraw) = calculatePeriodsCountAndNewTime(timeOfLastWithdraw, timeEnd);
            sum = sum.add(calculatWithdrawForPeriod(3, depositValue, periodsCount));
        }
        
        if(timeOfLastWithdraw < timeEndOfPeriod4)
        {
            timeEnd = currentTime > timeEndOfPeriod4 ? timeEndOfPeriod4 : currentTime;
            (periodsCount, timeOfLastWithdraw) = calculatePeriodsCountAndNewTime(timeOfLastWithdraw, timeEnd);
            sum = sum.add(calculatWithdrawForPeriod(4, depositValue, periodsCount));
        }
        
        if(timeOfLastWithdraw >= timeEndOfPeriod4)
        {
            timeEnd = currentTime;
            (periodsCount, timeOfLastWithdraw) = calculatePeriodsCountAndNewTime(timeOfLastWithdraw, timeEnd);
            sum = sum.add(calculatWithdrawForPeriod(5, depositValue, periodsCount));
        }
         
        return sum;
    }
    
    function checkReferrer(address investorAddress) internal
    {
        if(deposits[investorAddress].value == 0 && msg.data.length == 20)
        {
            address referrerAddress = bytesToAddress(bytes(msg.data));
            require(referrerAddress != investorAddress);     
            require(deposits[referrerAddress].value > 0);        
            
            parents[investorAddress] = referrerAddress;
            investors.push(investorAddress);
        }
    }
    
    function payRewards(address investorAddress, uint depositValue) internal
    {   
        address[] memory parentAddresses = getParents(investorAddress);
        for(uint8 i = 0; i < parentAddresses.length; i++)
        {
            address parent = parentAddresses[i];
            if(parent == address(0)) break;
            
            uint rewardValue = calculateRewardForLevel(i + 1, depositValue);
            parent.transfer(rewardValue);
            
            emit ReferrerBonus(investorAddress, parent, i + 1, rewardValue);
        }
    }
    
    function addDeposit(address investorAddress, uint weiAmount) internal
    {   
        if(deposits[investorAddress].value == 0)
        {
            deposits[investorAddress].time = now;
            deposits[investorAddress].timeOfLastWithdraw = now;
            deposits[investorAddress].value = weiAmount;
        }
        else
        {
            if(now - deposits[investorAddress].timeOfLastWithdraw >= withdrawPeriod)
            {
                payWithdraw(investorAddress);
            }
            
            deposits[investorAddress].value = deposits[investorAddress].value.add(weiAmount);
            deposits[investorAddress].timeOfLastWithdraw = now;
        }
    }
    
    function payFee(uint weiAmount) internal
    {
        uint fee = weiAmount.mul(16).div(100); // 16%
        owner.transfer(fee);
    }
    
    function calculateNewTime(uint startTime, uint endTime) public pure returns (uint) 
    {
        uint periodsCount = endTime.sub(startTime).div(withdrawPeriod);
        return startTime.add(withdrawPeriod.mul(periodsCount));
    }
    
    function calculatePeriodsCountAndNewTime(uint startTime, uint endTime) public pure returns (uint, uint) 
    {
        uint periodsCount = endTime.sub(startTime).div(withdrawPeriod);
        uint newTime = startTime.add(withdrawPeriod.mul(periodsCount));
        return (periodsCount, newTime);
    }
    
    function payWithdraw(address to) internal
    {
        require(deposits[to].value > 0);
        
        uint sum = calculateWithdraw(now, deposits[to].time, deposits[to].value, deposits[to].timeOfLastWithdraw);
        require(sum > 0);
        
        deposits[to].timeOfLastWithdraw = calculateNewTime(deposits[to].time, now);
        
        to.transfer(sum);
        emit Withdraw(to, sum);
    }
    
    
    function withdraw() checkSender public returns (bool)
    {
        payWithdraw(msg.sender);
        return true;
    }
    
    
    function batchWithdraw(address[] to) onlyOwner public 
    {
        for(uint i = 0; i < to.length; i++)
        {
            payWithdraw(to[i]);
        }
    }
    
    function batchWithdraw(uint startIndex, uint length) onlyOwner public 
    {
        for(uint i = startIndex; i < length; i++)
        {
            payWithdraw(investors[i]);
        }
    }
}

Contract ABI
[{"constant":true,"inputs":[],"name":"withdrawPeriod","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"parents","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"startIndex","type":"uint256"},{"name":"length","type":"uint256"}],"name":"batchWithdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"investors","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address[]"}],"name":"batchWithdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"minDepositSum","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"startTime","type":"uint256"},{"name":"endTime","type":"uint256"}],"name":"calculatePeriodsCountAndNewTime","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"startTime","type":"uint256"},{"name":"endTime","type":"uint256"}],"name":"calculateNewTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"currentTime","type":"uint256"},{"name":"depositTime","type":"uint256"},{"name":"depositValue","type":"uint256"},{"name":"timeOfLastWithdraw","type":"uint256"}],"name":"calculateWithdraw","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"investorAddress","type":"address"}],"name":"getParents","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInvestorsLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"level","type":"uint8"},{"name":"value","type":"uint256"}],"name":"calculateRewardForLevel","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"period","type":"uint8"},{"name":"depositValue","type":"uint256"},{"name":"periodsCount","type":"uint256"}],"name":"calculatWithdrawForPeriod","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"deposits","outputs":[{"name":"time","type":"uint256"},{"name":"value","type":"uint256"},{"name":"timeOfLastWithdraw","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"level","type":"uint8"},{"indexed":false,"name":"value","type":"uint256"}],"name":"ReferrerBonus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

Contract Creation Code
608060405260008054600160a060020a03191633179055610f64806100256000396000f3006080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166312eb4f9a811461018457806318b13fb2146101ab57806330d02d83146101e85780633ccfd60b146102035780633feb5f2b1461022c578063431cc3dd1461024457806382f3dbe2146102995780638da5cb5b146102ae578063a087ae89146102c3578063a6567a9a146102f7578063a8ce6b7314610312578063a9fae42214610333578063e3cc65e2146103a4578063ebb9ba80146103b9578063f2fde38b146103d7578063fc5e2cce146103f8578063fc7e286d14610419575b3315156100fc57600080fd5b3415156101115761010b610458565b50610182565b67016345785d8a000034101561012657600080fd5b61012f33610475565b61013834610593565b61014233346105f7565b60408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a261018233346106d4565b005b34801561019057600080fd5b506101996107d4565b60408051918252519081900360200190f35b3480156101b757600080fd5b506101cc600160a060020a03600435166107db565b60408051600160a060020a039092168252519081900360200190f35b3480156101f457600080fd5b506101826004356024356107f6565b34801561020f57600080fd5b50610218610458565b604080519115158252519081900360200190f35b34801561023857600080fd5b506101cc60043561084d565b34801561025057600080fd5b5060408051602060048035808201358381028086018501909652808552610182953695939460249493850192918291850190849080828437509497506108759650505050505050565b3480156102a557600080fd5b506101996108c2565b3480156102ba57600080fd5b506101cc6108ce565b3480156102cf57600080fd5b506102de6004356024356108dd565b6040805192835260208301919091528051918290030190f35b34801561030357600080fd5b5061019960043560243561092b565b34801561031e57600080fd5b50610199600435602435604435606435610974565b34801561033f57600080fd5b50610354600160a060020a0360043516610ae6565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610390578181015183820152602001610378565b505050509050019250505060405180910390f35b3480156103b057600080fd5b50610199610b89565b3480156103c557600080fd5b5061019960ff60043516602435610b8f565b3480156103e357600080fd5b50610182600160a060020a0360043516610c35565b34801561040457600080fd5b5061019960ff60043516602435604435610cc9565b34801561042557600080fd5b5061043a600160a060020a0360043516610d93565b60408051938452602084019290925282820152519081900360600190f35b600033151561046657600080fd5b61046f33610db3565b50600190565b600160a060020a03811660009081526001602081905260408220015415801561049e5750601436145b1561058f576104dd6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843750610ece945050505050565b9050600160a060020a0380821690831614156104f857600080fd5b600160a060020a0381166000908152600160208190526040822001541161051e57600080fd5b600160a060020a038083166000818152600260205260408120805493851673ffffffffffffffffffffffffffffffffffffffff199485161790556003805460018101825591527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180549092161790555b5050565b60006105b760646105ab84601063ffffffff610ed516565b9063ffffffff610f0016565b60008054604051929350600160a060020a03169183156108fc0291849190818181858888f193505050501580156105f2573d6000803e3d6000fd5b505050565b600160a060020a03821660009081526001602081905260409091200154151561064757600160a060020a03821660009081526001602081905260409091204280825560028201550181905561058f565b600160a060020a0382166000908152600160205260409020600201546201518042919091031061067a5761067a82610db3565b600160a060020a038216600090815260016020819052604090912001546106a7908263ffffffff610f1716565b600160a060020a038316600090815260016020819052604090912090810191909155426002909101555050565b606060008060006106e486610ae6565b9350600092505b83518360ff1610156107cc57838360ff1681518110151561070857fe5b602090810290910101519150600160a060020a0382161515610729576107cc565b6107368360010186610b8f565b604051909150600160a060020a0383169082156108fc029083906000818181858888f1935050505015801561076f573d6000803e3d6000fd5b506040805160ff60018601168152602081018390528151600160a060020a0380861693908a16927f376b851abe2d6c4f73814c680eca625154aaa6aaeb7be7dcaf5dbee98c4295f2929081900390910190a36001909201916106eb565b505050505050565b6201518081565b600260205260009081526040902054600160a060020a031681565b60008054600160a060020a0316331461080e57600080fd5b50815b818110156105f25761084560038281548110151561082b57fe5b600091825260209091200154600160a060020a0316610db3565b600101610811565b600380548290811061085b57fe5b600091825260209091200154600160a060020a0316905081565b60008054600160a060020a0316331461088d57600080fd5b5060005b815181101561058f576108ba82828151811015156108ab57fe5b90602001906020020151610db3565b600101610891565b67016345785d8a000081565b600054600160a060020a031681565b60008080806108f9620151806105ab878963ffffffff610f2616565b915061091e610911620151808463ffffffff610ed516565b879063ffffffff610f1716565b9196919550909350505050565b600080610945620151806105ab858763ffffffff610f2616565b905061096a61095d620151808363ffffffff610ed516565b859063ffffffff610f1716565b91505b5092915050565b60008060008060008060008062015180898d0310156109965760009750610ad7565b50505062278d008801935050624f1a0087019150506276a7008601629e3400870160008080868910156109f157868c116109d0578b6109d2565b865b91506109de89836108dd565b995090506109ee60018b83610cc9565b92505b85891015610a3757858c11610a06578b610a08565b855b9150610a1489836108dd565b99509050610a34610a2760028c84610cc9565b849063ffffffff610f1716565b92505b84891015610a7057848c11610a4c578b610a4e565b845b9150610a5a89836108dd565b99509050610a6d610a2760038c84610cc9565b92505b83891015610aa957838c11610a85578b610a87565b835b9150610a9389836108dd565b99509050610aa6610a2760048c84610cc9565b92505b838910610ad3578b9150610abd89836108dd565b99509050610ad0610a2760058c84610cc9565b92505b8297505b50505050505050949350505050565b60408051600580825260c0820190925260609182916000918291906020820160a080388339019050509250849150600090505b60058160ff161015610b8057600160a060020a0391821660009081526002602052604090205490911690811515610b4f57610b80565b81838260ff16815181101515610b6157fe5b600160a060020a03909216602092830290910190910152600101610b19565b50909392505050565b60035490565b60008260ff1660011415610bb557610bae82603263ffffffff610f0016565b9050610c2f565b8260ff1660021415610bd257610bae82606463ffffffff610f0016565b8260ff1660031415610bef57610bae8260c863ffffffff610f0016565b8260ff1660041415610c0d57610bae8261019063ffffffff610f0016565b8260ff1660051415610c2b57610bae8261019063ffffffff610f0016565b5060005b92915050565b600054600160a060020a03163314610c4c57600080fd5b600160a060020a0381161515610c6157600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008360ff1660011415610cff57610cf882610cec85601963ffffffff610f0016565b9063ffffffff610ed516565b9050610d8c565b8360ff1660021415610d2557610cf882610cec60646105ab87600363ffffffff610ed516565b8360ff1660031415610d4657610cf882610cec85603263ffffffff610f0016565b8360ff1660041415610d6757610cf882610cec85606463ffffffff610f0016565b8360ff1660051415610d8857610cf882610cec8560c863ffffffff610f0016565b5060005b9392505050565b600160208190526000918252604090912080549181015460029091015483565b600160a060020a0381166000908152600160208190526040822001548110610dda57600080fd5b600160a060020a0382166000908152600160208190526040909120805491810154600290910154610e0e9242929091610974565b905060008111610e1d57600080fd5b600160a060020a038216600090815260016020526040902054610e40904261092b565b600160a060020a038316600081815260016020526040808220600201939093559151909183156108fc02918491818181858888f19350505050158015610e8a573d6000803e3d6000fd5b50604080518281529051600160a060020a038416917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364919081900360200190a25050565b6014015190565b600080831515610ee8576000915061096d565b50828202828482811515610ef857fe5b0414610d8c57fe5b6000808284811515610f0e57fe5b04949350505050565b600082820183811015610d8c57fe5b600082821115610f3257fe5b509003905600a165627a7a72305820486c2cd2c04e7afd7e5083b352de29cda69d5c9581df4365a267546049c6a6f10029


   Swarm Source:
bzzr://486c2cd2c04e7afd7e5083b352de29cda69d5c9581df4365a267546049c6a6f1
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.