Contract 0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb

Contract Overview

Balance:
5 wei
TxHash Block Age From To Value [TxFee]
0x70403cba8e09778b5b3c88bddcc7e646390cd1da4d796245d64e7f1b318a8092367128868 days 4 hrs ago0x0949dbf97b01bfeee588a6767376879fb0521b39 IN  0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether0.000043565
0x0cea0ac0bdaf2c79acf7cccf7c3d122419c908257f2be46ae1f9406456fe452d367128768 days 4 hrs ago0x0949dbf97b01bfeee588a6767376879fb0521b39 IN  0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether0.000043567
0xdab7d7c57e7652eb67434f88858b0c70e68b18b8073f87996bdd0726d40b3cfc367128668 days 4 hrs ago0x0949dbf97b01bfeee588a6767376879fb0521b39 IN  0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether0.000043857
0x78ec38725bbc78b58397444b455f8bf0bcc6eb9724804e7f5403e75f87d3fd77367128568 days 4 hrs ago0x0949dbf97b01bfeee588a6767376879fb0521b39 IN  0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether0.000377285
0xa3662c453c13a15a78aa416101e93b884335215d05c5e3c9886f2d40794cbb39367122668 days 4 hrs ago0x0949dbf97b01bfeee588a6767376879fb0521b39 IN  Contract Creation0 Ether0.002472919
[ 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
0xb0e60f4d32d9818d29c3732ff5ee571161c98900213c90ac0405cb2e5853c335376721951 days 12 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x7e3bfacae7eee301cd8be60462d270466c33deaa1309da30864b0a0de0c1a092373386057 days 7 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0x7e3bfacae7eee301cd8be60462d270466c33deaa1309da30864b0a0de0c1a092373386057 days 7 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x16841a2b62453d959522015b830cb9ea754db09dd3f48ce09dd9f710074f0320373385857 days 7 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x633976808984f13efc82787d69358383444539609186ff2d2a7b8a732114f425373362057 days 8 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0x633976808984f13efc82787d69358383444539609186ff2d2a7b8a732114f425373362057 days 8 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x7e043af09580aa78a37112310045b1860d108f331a11e0d7e2a5c1f2dd3e9515373361857 days 8 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x539449c442a3a6b9aa911cedd1ea0bf47bc629dbd1c5e5b0b56bfa1070ef7d10373338057 days 9 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0x539449c442a3a6b9aa911cedd1ea0bf47bc629dbd1c5e5b0b56bfa1070ef7d10373338057 days 9 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x18a2b6a8f2be5bc698c37f2639be9a0acf754cde2833dfda26a2cc4da463b94a373337857 days 9 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x857f4210774de5b7a5a4e67e71870a53d61ad86e10ed9135833197e849fd1543373314057 days 10 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0x857f4210774de5b7a5a4e67e71870a53d61ad86e10ed9135833197e849fd1543373314057 days 10 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x0eb8ee1e07c7f23cdbb92291322a0b1f9fe615ec93773df7e3b81cd4ba000d75373313857 days 10 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x3626772362e1c13a6298f5e1a9d26e5af4927fe5b536b123bf7eac18a847b489373290057 days 11 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0x3626772362e1c13a6298f5e1a9d26e5af4927fe5b536b123bf7eac18a847b489373290057 days 11 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0x3626772362e1c13a6298f5e1a9d26e5af4927fe5b536b123bf7eac18a847b489373290057 days 11 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x5ad1a614564f880e12cb9f6de3ba60f4c9b9cd14439bcec2e5b614d447245e84373289857 days 11 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x2b0ac91862fd759e4f99de545a2a3e3d2c5e31161a5e8efa224ebde584724732373266057 days 12 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0x2b0ac91862fd759e4f99de545a2a3e3d2c5e31161a5e8efa224ebde584724732373266057 days 12 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x439e1eb0bcf8d4b281ce745d5e54b8c46d3191a416429b4aff7c0709d8d09915373265857 days 12 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x103c04591d926407dddbd43af4a8ec588fd7064823501bc9a1e9f78519466e5a373242057 days 13 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0x103c04591d926407dddbd43af4a8ec588fd7064823501bc9a1e9f78519466e5a373242057 days 13 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0x9a82505daa7589798a044a172054c2b832e1aa3f205a58e24466de5b5c626411373241857 days 13 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
0xcae98beb37d03bbc6c8e3d61c4079045e552cc71cb291e447f74544bd7f1bf74373218157 days 14 hrs ago0x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0x02d812966fffd902b23eb03dfe11c9ce9bb105c00 Ether
0xcae98beb37d03bbc6c8e3d61c4079045e552cc71cb291e447f74544bd7f1bf74373218157 days 14 hrs ago0x02d812966fffd902b23eb03dfe11c9ce9bb105c00x5d7a9fb1fd7a199e548f44ad06ded4c7c327b2fb0 Ether
[ Download CSV Export 

Contract Source Code Verified (Exact Match)

Contract Name:
ThorMutual

Compiler Version
v0.4.25+commit.59dbf8f1

Optimization Enabled:
No

Runs (Optimizer):
200

Contract Source Code

pragma solidity ^0.4.25;
//pragma experimental ABIEncoderV2;

/**
* @title ThorMutual
* @author Leo
* @dev Thor Mutual for BTC, ETH, EOS, ERC20 and so on
*/


contract Utils {

    uint constant DAILY_PERIOD = 1;
    uint constant WEEKLY_PERIOD = 7;

    int constant PRICE_DECIMALS = 10 ** 8;

    int constant INT_MAX = 2 ** 255 - 1;

    uint constant UINT_MAX = 2 ** 256 - 1;

}

/**
 * @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 private _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 () internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

    /**
     * @return the address of the owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(isOwner());
        _;
    }

    /**
     * @return true if `msg.sender` is the owner of the contract.
     */
    function isOwner() public view returns (bool) {
        return 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 {
    //     emit OwnershipTransferred(_owner, address(0));
    //     _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));
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}


interface ThorMutualInterface {
    function getCurrentPeriod() external view returns(uint);
    function settle() external;
}


/**
 * @title ThorMutualToken
 * @dev Every ThorMutualToken contract is related with a specific token such as BTC/ETH/EOS/ERC20
 * functions, participants send ETH to this contract to take part in the Thor Mutual activity.
 */
contract ThorMutualToken is Ownable, Utils {
    string public thorMutualToken;

    // total deposit for a specific period
    mapping(uint => uint) amountOfDailyPeriod;

    // total deposit for a specific period
    mapping(uint => uint) amountOfWeeklyPeriod;

    // participant's total deposit fund
    mapping(address => uint) participantAmount;

    // participants
    address[] participants;

    // deposit info
    struct DepositInfo {
        uint blockTimeStamp;
        uint period;
        string token;
        uint amount;
    }

    // participant's total deposit history
    //mapping(address => DepositInfo[]) participantsHistory;
    mapping(address => uint[]) participantsHistoryTime;
    mapping(address => uint[]) participantsHistoryPeriod;
    mapping(address => uint[]) participantsHistoryAmount;

    // participant's total deposit fund for a specific period
    mapping(uint => mapping(address => uint)) participantAmountOfDailyPeriod;

    // participant's total deposit fund for a weekly period
    mapping(uint => mapping(address => uint)) participantAmountOfWeeklyPeriod;

    // participants for the daily period
    mapping(uint => address[]) participantsDaily;

    // participants for the weekly period
    mapping(uint => address[]) participantsWeekly;

    ThorMutualInterface public thorMutualContract;

    constructor(string _thorMutualToken, ThorMutualInterface _thorMutual) public {
        thorMutualToken = _thorMutualToken;
        thorMutualContract = _thorMutual;
    }

    event ThorDepositToken(address sender, uint256 amount);
    function() external payable {
        require(msg.value >= 0.001 ether);
        
        require(address(thorMutualContract) != address(0));
        address(thorMutualContract).transfer(msg.value);

        //uint currentPeriod;
        uint actualPeriod = 0;
        uint actualPeriodWeek = 0;

        actualPeriod = thorMutualContract.getCurrentPeriod();

        actualPeriodWeek = actualPeriod / WEEKLY_PERIOD;

        if (participantAmount[msg.sender] == 0) {
            participants.push(msg.sender);
        }

        if (participantAmountOfDailyPeriod[actualPeriod][msg.sender] == 0) {
            participantsDaily[actualPeriod].push(msg.sender);
        }

        if (participantAmountOfWeeklyPeriod[actualPeriodWeek][msg.sender] == 0) {
            participantsWeekly[actualPeriodWeek].push(msg.sender);
        }

        participantAmountOfDailyPeriod[actualPeriod][msg.sender] += msg.value;

        participantAmount[msg.sender] += msg.value;
        
        participantAmountOfWeeklyPeriod[actualPeriodWeek][msg.sender] += msg.value;

        amountOfDailyPeriod[actualPeriod] += msg.value;

        amountOfWeeklyPeriod[actualPeriodWeek] += msg.value;

        // DepositInfo memory depositInfo = DepositInfo(block.timestamp, actualPeriod, thorMutualToken, msg.value);

        // participantsHistory[msg.sender].push(depositInfo);

        participantsHistoryTime[msg.sender].push(block.timestamp);
        participantsHistoryPeriod[msg.sender].push(actualPeriod);
        participantsHistoryAmount[msg.sender].push(msg.value);

        emit ThorDepositToken(msg.sender, msg.value);
    }

    function setThorMutualContract(ThorMutualInterface _thorMutualContract) public onlyOwner{
        require(address(_thorMutualContract) != address(0));
        thorMutualContract = _thorMutualContract;
    }

    function getThorMutualContract() public view returns(address) {
        return thorMutualContract;
    }

    function setThorMutualToken(string _thorMutualToken) public onlyOwner {
        thorMutualToken = _thorMutualToken;
    }

    function getDepositDailyAmountofPeriod(uint period) external view returns(uint) {
        require(period >= 0);

        return amountOfDailyPeriod[period];
    }

    function getDepositWeeklyAmountofPeriod(uint period) external view returns(uint) {
        require(period >= 0);
        uint periodWeekly = period / WEEKLY_PERIOD;
        return amountOfWeeklyPeriod[periodWeekly];
    }

    function getParticipantsDaily(uint period) external view returns(address[], uint) {
        require(period >= 0);

        return (participantsDaily[period], participantsDaily[period].length);
    }

    function getParticipantsWeekly(uint period) external view returns(address[], uint) {
        require(period >= 0);

        uint periodWeekly = period / WEEKLY_PERIOD;
        return (participantsWeekly[periodWeekly], participantsWeekly[period].length);
    }

    function getParticipantAmountDailyPeriod(uint period, address participant) external view returns(uint) {
        require(period >= 0);

        return participantAmountOfDailyPeriod[period][participant];
    }

    function getParticipantAmountWeeklyPeriod(uint period, address participant) external view returns(uint) {
        require(period >= 0);

        uint periodWeekly = period / WEEKLY_PERIOD;
        return participantAmountOfWeeklyPeriod[periodWeekly][participant];
    }

    //function getParticipantHistory(address participant) public view returns(DepositInfo[]) {
    function getParticipantHistory(address participant) public view returns(uint[], uint[], uint[]) {

        return (participantsHistoryTime[participant], participantsHistoryPeriod[participant], participantsHistoryAmount[participant]);
        //return participantsHistory[participant];
    }

    function getSelfBalance() public view returns(uint) {
        return address(this).balance;
    }

    // function getAmountOfParticipantsDaily(uint period) external view returns(uint) {
    //     return participantsDaily[period].length;
    // }

    // function getAmountOfParticipantsWeekly(uint period) external view returns(uint) {
    //     return participantsWeekly[period].length;
    // }

}


interface ThorMutualTokenInterface {
    function getParticipantsDaily(uint period) external view returns(address[], uint);
    function getParticipantsWeekly(uint period) external view returns(address[], uint);
    function getDepositDailyAmountofPeriod(uint period) external view returns(uint);
    function getDepositWeeklyAmountofPeriod(uint period) external view returns(uint);
    function getParticipantAmountDailyPeriod(uint period, address participant) external view returns(uint);
    function getParticipantAmountWeeklyPeriod(uint period, address participant) external view returns(uint);
    // function getParticipantHistory(address participant) external view returns(uint[], uint[], uint[]);
    // function getAmountOfParticipantsDaily(uint period) external view returns(uint);
    // function getAmountOfParticipantsWeekly(uint period) external view returns(uint);
}

interface ThorMutualTokenPriceInterface {
    function getMaxDailyDrawdown(uint period) external view returns(address);
    function getMaxWeeklyDrawdown(uint period) external view returns(address);
}

interface ThorMutualWeeklyRewardInterface {
    function settleWeekly(address winner, uint amountWinner) external; 
}

contract ThorMutual is Ownable, Utils {

    string public thorMutual;

    // period update daily
    uint internal periodUpdateIndex = 0;

    // initial flag
    bool internal initialFlag = false;

    ThorMutualTokenPriceInterface public thorMutualTokenPrice;

    ThorMutualTokenInterface[] thorMutualTokens;

    ThorMutualWeeklyReward public thorMutualWeeklyReward;

    mapping(uint => address) winnerDailyTokens;
    mapping(uint => address) winnerWeeklyTokens;

    mapping(uint => uint) winnerDailyParticipantAmounts;
    mapping(uint => uint) winnerWeeklyParticipantAmounts;

    mapping(uint => uint) winnerDailyDepositAmounts;

    mapping(uint => address) winnerWeeklyAccounts;

    // daily winners' award
    mapping(uint => mapping(address => uint)) winnerDailyParticipantInfos;

    // weekly winners' award
    mapping(uint => mapping(address => uint)) winnerWeeklyParticipantInfos;

    // struct AwardInfo {
    //     address winner;
    //     uint awardAmount;
    // }

    // daily winners' address
    mapping(uint => address[]) winnerDailyParticipantAddrs;
    mapping(uint => uint[]) winnerDailyParticipantAwards;

    // weekly winners' info
    mapping(uint => address) winnerWeeklyParticipantAddrs;
    mapping(uint => uint) winnerWeeklyParticipantAwards;

    // 0.001 eth = 1 finney 
    // uint internal threadReward = 1 * 10 ** 15;

    // 
    uint internal distributeRatioOfDaily = 70;
    uint internal distributeRatioOfWeekly = 20;
    uint internal distributeRatioOfPlatform = 10;

    uint internal ratioWeekly = 5;

    // address of platform
    address internal rewardAddressOfPlatfrom;

    // // amount of participant for daily period
    // mapping(address => mapping(uint => uint)) amountOfDailyParticipants;

    // // amount of participant for weekly period
    // mapping(address => mapping(uint => uint)) amountOfWeeklyParticipants;

    constructor() public {
        thorMutual = "ThorMutual";
    }

    event DepositToken(address token, uint256 amount);
    function() external payable {
        emit DepositToken(msg.sender, msg.value);

        // amountOfDailyParticipants[msg.sender][periodUpdateIndex]++;
        // amountOfWeeklyParticipants[msg.sender][periodUpdateIndex / 7]++;
    }

    function setThorMutualParms(uint _distributeRatioOfDaily, uint _distributeRatioOfWeekly, uint _distributeRatioOfPlatform, uint _ratioWeekly) public onlyOwner {
        require(_distributeRatioOfDaily + _distributeRatioOfWeekly + _distributeRatioOfPlatform == 100);
        require(_ratioWeekly >= 0 && _ratioWeekly <= 10);

        distributeRatioOfDaily = _distributeRatioOfDaily;
        distributeRatioOfWeekly = _distributeRatioOfWeekly;
        distributeRatioOfPlatform = _distributeRatioOfPlatform;
        ratioWeekly = _ratioWeekly;
    }

    function getThorMutualParms() public view returns(uint, uint, uint, uint){
        return (distributeRatioOfDaily, distributeRatioOfWeekly, distributeRatioOfPlatform, ratioWeekly);
    }

    /**
     * @dev set thorMutualTokens' contract address
     * @param _thorMutualTokens _thorMutualTokens
     * @param _length _length
     */
    function setThorMutualTokenContracts(ThorMutualTokenInterface[] memory _thorMutualTokens, uint _length) public onlyOwner {
        require(_thorMutualTokens.length == _length);

        for (uint i = 0; i < _length; i++) {
            thorMutualTokens.push(_thorMutualTokens[i]);
        }
    }

    function initialPeriod() public {
        periodUpdateIndex++;
    }

    /**
     * @dev return periodUpdateIndex, periodActual
     * @return the index return periodUpdateIndex, periodActual
     */
    function getCurrentPeriod() public view returns(uint) {
        return periodUpdateIndex;
    }

    function settle() external {

        require(address(thorMutualTokenPrice) == msg.sender);

        if(initialFlag == false) {
            initialFlag = true;

            initialPeriod();

            return;
        }

        dailySettle();

        if(periodUpdateIndex % WEEKLY_PERIOD == 0){
            weeklySettle();
        }

        periodUpdateIndex++;
    }

    event ThorMutualRewardOfPlatfrom(address, uint256);

    function dailySettle() internal {

        require(periodUpdateIndex >= 1);

        address maxDrawdownThorMutualTokenAddress;

        maxDrawdownThorMutualTokenAddress = thorMutualTokenPrice.getMaxDailyDrawdown(periodUpdateIndex);

        if (maxDrawdownThorMutualTokenAddress == address(0)) {
            return;
        }

        winnerDailyTokens[periodUpdateIndex-1] = maxDrawdownThorMutualTokenAddress;

        ThorMutualTokenInterface maxDrawdownThorMutualToken = ThorMutualTokenInterface(maxDrawdownThorMutualTokenAddress);

        address[] memory winners;
        (winners, ) = maxDrawdownThorMutualToken.getParticipantsDaily(periodUpdateIndex - 1);
        uint winnersLength = winners.length;

        winnerDailyParticipantAmounts[periodUpdateIndex-1] = winnersLength;

        uint amountOfPeriod = 0;
        uint i = 0;
        for (i = 0; i < thorMutualTokens.length; i++) {
            amountOfPeriod += thorMutualTokens[i].getDepositDailyAmountofPeriod(periodUpdateIndex - 1);
        }

        winnerDailyDepositAmounts[periodUpdateIndex-1] = amountOfPeriod;

        uint rewardAmountOfDaily = amountOfPeriod * distributeRatioOfDaily / 100;
        uint rewardAmountOfPlatform = amountOfPeriod * distributeRatioOfPlatform / 100;
        uint rewardAmountOfWeekly = amountOfPeriod - rewardAmountOfDaily - rewardAmountOfPlatform;
        
        uint amountOfTokenAndPeriod = maxDrawdownThorMutualToken.getDepositDailyAmountofPeriod(periodUpdateIndex - 1);

        for (i = 0; i < winnersLength; i++) {
            address rewardParticipant = winners[i];

            uint depositAmountOfParticipant = maxDrawdownThorMutualToken.getParticipantAmountDailyPeriod(periodUpdateIndex - 1, rewardParticipant);

            uint rewardAmountOfParticipant = depositAmountOfParticipant * rewardAmountOfDaily / amountOfTokenAndPeriod;

            // if (rewardAmountOfParticipant > threadReward) {
            rewardParticipant.transfer(rewardAmountOfParticipant);

            // record winner's info
            winnerDailyParticipantInfos[periodUpdateIndex - 1][rewardParticipant] = rewardAmountOfParticipant;

            winnerDailyParticipantAddrs[periodUpdateIndex - 1].push(rewardParticipant);
            winnerDailyParticipantAwards[periodUpdateIndex - 1].push(rewardAmountOfParticipant);

            // }
        }

        rewardAddressOfPlatfrom.transfer(rewardAmountOfPlatform);
        emit ThorMutualRewardOfPlatfrom(rewardAddressOfPlatfrom, rewardAmountOfPlatform);

        address(thorMutualWeeklyReward).transfer(rewardAmountOfWeekly);

    }

    function weeklySettle() internal {

        require(periodUpdateIndex >= WEEKLY_PERIOD);

        address maxDrawdownThorMutualTokenAddress;

        maxDrawdownThorMutualTokenAddress = thorMutualTokenPrice.getMaxWeeklyDrawdown(periodUpdateIndex);

        if (maxDrawdownThorMutualTokenAddress == address(0)) {
            return;
        }

        uint weeklyPeriod = (periodUpdateIndex - 1) / WEEKLY_PERIOD;

        winnerWeeklyTokens[weeklyPeriod] = maxDrawdownThorMutualTokenAddress;

        ThorMutualTokenInterface maxDrawdownThorMutualToken = ThorMutualTokenInterface(maxDrawdownThorMutualTokenAddress);

        address[] memory participants;
        (participants, ) = maxDrawdownThorMutualToken.getParticipantsWeekly(periodUpdateIndex - 1);
        uint winnersLength = participants.length;

        winnerWeeklyParticipantAmounts[weeklyPeriod] = winnersLength;

        //address[] winners;
        address winner;
        uint maxDeposit = 0;

        for (uint i = 0; i < winnersLength; i++) {
            address rewardParticipant = participants[i];

            uint depositAmountOfParticipant = maxDrawdownThorMutualToken.getParticipantAmountWeeklyPeriod(periodUpdateIndex - 1, rewardParticipant);

            if(depositAmountOfParticipant > maxDeposit) {
                winner = rewardParticipant;
                maxDeposit = depositAmountOfParticipant;
            }

        }

        winnerWeeklyAccounts[weeklyPeriod] = winner;

        uint thorMutualWeeklyRewardFund = address(thorMutualWeeklyReward).balance;

        uint winnerWeeklyAward = thorMutualWeeklyRewardFund * ratioWeekly / 10;

        thorMutualWeeklyReward.settleWeekly(winner, winnerWeeklyAward);

        // record winner's info

        winnerWeeklyParticipantInfos[weeklyPeriod][winner] = winnerWeeklyAward;

        winnerWeeklyParticipantAddrs[weeklyPeriod] = winner;
        winnerWeeklyParticipantAwards[weeklyPeriod] = winnerWeeklyAward;

    }

    function getDailyWinnerTokenInfo(uint period) public view returns(address, uint, uint, address[], uint[]) {
        require(period >= 0 && period < periodUpdateIndex);

        address token = winnerDailyTokens[period];

        uint participantAmount = winnerDailyParticipantAmounts[period];

        uint depositAmount = winnerDailyDepositAmounts[period];

        return (token, participantAmount, depositAmount, winnerDailyParticipantAddrs[period], winnerDailyParticipantAwards[period]);
    }

    function getWeeklyWinnerTokenInfo(uint period) public view returns(address, uint, address, address, uint) {
        require(period >= 0 && period < periodUpdateIndex);

        uint actualPeriod = period / WEEKLY_PERIOD;

        address token = winnerWeeklyTokens[actualPeriod];

        uint participantAmount = winnerWeeklyParticipantAmounts[actualPeriod];

        address winner = winnerWeeklyAccounts[actualPeriod];

        return (token, participantAmount, winner, winnerWeeklyParticipantAddrs[actualPeriod], winnerWeeklyParticipantAwards[actualPeriod]);
    }

    function getDailyAndWeeklyWinnerInfo(uint period, address winner) public view returns(uint, uint){
        require(period >= 0 && period < periodUpdateIndex);

        uint periodWeekly = period / WEEKLY_PERIOD;

        return (winnerDailyParticipantInfos[period][winner], winnerWeeklyParticipantInfos[periodWeekly][winner]);
    }

    /**
     * @dev set thorMutualTokenPrice's contract address
     * @param _thorMutualTokenPrice _thorMutualTokenPrice
     */
    function setThorMutualTokenPrice(ThorMutualTokenPriceInterface _thorMutualTokenPrice) public onlyOwner {
        require(address(_thorMutualTokenPrice) != address(0));
        thorMutualTokenPrice = _thorMutualTokenPrice;
    }

    function setRewardAddressOfPlatfrom(address _rewardAddressOfPlatfrom) public onlyOwner {
        require(_rewardAddressOfPlatfrom != address(0));
        rewardAddressOfPlatfrom = _rewardAddressOfPlatfrom;
    }

    function setThorMutualWeeklyReward(address _thorMutualWeeklyReward) public onlyOwner {
        require(_thorMutualWeeklyReward != address(0));
        thorMutualWeeklyReward = ThorMutualWeeklyReward(_thorMutualWeeklyReward);
    }

    function getSelfBalance() public view returns(uint) {
        return address(this).balance;
    }

    // //function getParticipantHistory(address participant) public view returns(DepositInfo[]) {
    // function getParticipantHistory(address participant) public view returns(address[], uint[], uint[], uint[]) {

    //     address[] memory tokens;
    //     uint[] memory participantsHistoryTime;
    //     uint[] memory participantsHistoryPeriod;
    //     uint[] memory participantsHistoryAmount;
    //     for (uint i = 0; i < thorMutualTokens.length; i++) {
    //         uint[] memory tempParticipantsHistoryTime;
    //         uint[] memory tempParticipantsHistoryPeriod;
    //         uint[] memory tempParticipantsHistoryAmount;
    //         (tempParticipantsHistoryTime, tempParticipantsHistoryPeriod, tempParticipantsHistoryAmount) = thorMutualTokens[i].getParticipantHistory();

    //         for(uint j = 0; j < tempParticipantsHistoryTime.length; j++) {
    //             tokens.push(thorMutualTokens[i]);
    //             participantsHistoryTime.push(tempParticipantsHistoryTime[j]);
    //             participantsHistoryPeriod.push(tempParticipantsHistoryPeriod[j]);
    //             participantsHistoryAmount.push(tempParticipantsHistoryAmount[j]);
    //         }

    //     }

    //     return (tokens, participantsHistoryTime[participant], participantsHistoryPeriod[participant], participantsHistoryAmount[participant]);
    //     //return participantsHistory[participant];
    // }

}

contract ThorMutualWeeklyReward is Ownable, Utils {

    string public thorMutualWeeklyReward;

    address public thorMutual;

    constructor(ThorMutualInterface _thorMutual) public {
        thorMutualWeeklyReward = "ThorMutualWeeklyReward";
        thorMutual = address(_thorMutual);
    }

    event ThorMutualWeeklyRewardDeposit(uint256 amount);
    function() external payable {
        emit ThorMutualWeeklyRewardDeposit(msg.value);
    }

    event SettleWeekly(address winner, uint256 amount);
    function settleWeekly(address winner, uint amountWinner) external {

        require(msg.sender == thorMutual);
        require(winner != address(0));

        winner.transfer(amountWinner);

        emit SettleWeekly(winner, amountWinner);
    }

    function setThorMutualContract(address _thorMutualContract) public onlyOwner{
        require(_thorMutualContract != address(0));
        thorMutual = _thorMutualContract;
    }

    function getSelfBalance() public view returns(uint) {
        return address(this).balance;
    }

    function withdraw(address receiver, uint amount) public onlyOwner {
        require(receiver != address(0));

        receiver.transfer(amount);
    }

}

contract ThorMutualTokenPrice is Ownable, Utils {

    string public thorMutualTokenPrice;

    address[] internal tokensIncluded;
    mapping(address => bool) isTokenIncluded;

    ThorMutualInterface public thorMutualContract;

    struct TokenPrice{
        uint blockTimeStamp;
        uint price;
    }
    // mapping(address => TokenPrice) tokensPrice;

    mapping(uint => mapping(address => TokenPrice)) dailyTokensPrices;

    constructor(ThorMutualInterface _thorMutual) public {
        thorMutualTokenPrice = "ThorMutualTokenPrice";
        thorMutualContract = _thorMutual;
    }

    mapping(uint => int[]) dailyTokensPricesDrawdown;
    mapping(uint => int[]) weeklyTokensPricesDrawdown;

    mapping(uint =>ThorMutualTokenInterface) dailyTokenWinners;
    mapping(uint =>ThorMutualTokenInterface) weeklyTokenWinners;

    /**
     * @dev return all tokens included
     * @return string[], a list of tokens
     */
    function getTokensIncluded() public view returns(address[]) {
        return tokensIncluded;
    }

    function addTokenAndPrice(address _newToken, uint _price) public onlyOwner {
        require(!isTokenIncluded[_newToken]);

        uint actualPeriod;
        actualPeriod = thorMutualContract.getCurrentPeriod();

        isTokenIncluded[_newToken] = true;
        tokensIncluded.push(_newToken);
        TokenPrice memory tokenPrice = TokenPrice(block.timestamp, _price);
        // tokensPrice[_newToken] = tokenPrice;

        dailyTokensPrices[actualPeriod][_newToken] = tokenPrice;
    }

    /**
     * @dev set prices of a list of tokens
     * @param _tokens a list of tokens
     * @param _prices a list of prices, actual price * (10 ** 8)
     */
    function setTokensPrice(address[] memory _tokens, uint[] memory _prices, bool isSettle) public onlyOwner {

        uint length = _tokens.length;

        uint actualPeriod;
        actualPeriod = thorMutualContract.getCurrentPeriod();

        require(length == _prices.length);
        require(length == tokensIncluded.length);

        for (uint i = 0; i < length; i++) {
            address token = _tokens[i];
            require(isTokenIncluded[token]);
            TokenPrice memory tokenPrice = TokenPrice(block.timestamp, _prices[i]);
            // tokensPrice[token] = tokenPrice;

            dailyTokensPrices[actualPeriod][token] = tokenPrice;
        }

        // calculate tokens' maxDrawdown
        if (isSettle == true && actualPeriod >= 1) {
            //thorMutualContract.settle();
            calculateMaxDrawdown(actualPeriod);
        }
    }

    function calculateMaxDrawdown(uint period) internal {
        ThorMutualTokenInterface dailyWinnerToken;
        ThorMutualTokenInterface weeklyWinnerToken;
        (dailyWinnerToken,) = _getMaxDrawdown(DAILY_PERIOD, period);

        if(period % WEEKLY_PERIOD == 0) {
            (weeklyWinnerToken,) = _getMaxDrawdown(WEEKLY_PERIOD, period);
            weeklyTokenWinners[period / WEEKLY_PERIOD] = weeklyWinnerToken;
        }

        dailyTokenWinners[period] = dailyWinnerToken;
        
    }

    function settle() public onlyOwner {
        require(address(thorMutualContract) != address(0));
        thorMutualContract.settle();
    }

    /**
     * @dev get prices of a list of tokens
     * @param period period
     */

    function getTokenPriceOfPeriod(address token, uint period) public view returns(uint) {
        require(isTokenIncluded[token]);
        require(period >= 0);

        return dailyTokensPrices[period][token].price;

    }

    function setThorMutualContract(ThorMutualInterface _thorMutualContract) public onlyOwner {
        require(address(_thorMutualContract) != address(0));
        thorMutualContract = _thorMutualContract;
    }

    /**
     * @dev return the index of token with daily maximum drawdown
     * @return the index of token with maximum drawdown
     */
    function getMaxDailyDrawdown(uint period) external returns(ThorMutualTokenInterface) {

        return dailyTokenWinners[period];
    }

    /**
     * @dev return the index of token with weekly maximum drawdown
     * @return the index of token with maximum drawdown
     */
    function getMaxWeeklyDrawdown(uint period) external returns(ThorMutualTokenInterface) {

        return weeklyTokenWinners[period / WEEKLY_PERIOD];
    }

    /**
     * @dev return the index of token with maximum drawdown
     * @param period period
     * @return the index of token with maximum drawdown
     */
    function _getMaxDrawdown(uint period, uint actualPeriod) internal returns(ThorMutualTokenInterface, int) {

        uint currentPeriod = actualPeriod;
        uint oldPeriod = (actualPeriod - period);

        uint periodDrawdownMaxIndex = UINT_MAX;

        uint settlePeriod;

        int maxDrawdown = INT_MAX;
        // address[] memory particpantsOfToken;
        uint amountOfParticipant;

        for (uint i = 0; i < tokensIncluded.length; i++) {
            address token = tokensIncluded[i];

            
            if (period == DAILY_PERIOD) {
                settlePeriod = currentPeriod - 1;
                (, amountOfParticipant) = ThorMutualTokenInterface(token).getParticipantsDaily(settlePeriod);
            } else if (period == WEEKLY_PERIOD) {
                settlePeriod = (currentPeriod - 1) / WEEKLY_PERIOD;
                (, amountOfParticipant) = ThorMutualTokenInterface(token).getParticipantsWeekly(settlePeriod);
            }

            int currentPeriodPrice = int(dailyTokensPrices[currentPeriod][token].price);
            int oldPeriodPrice = int(dailyTokensPrices[oldPeriod][token].price);

            int drawdown = (currentPeriodPrice - oldPeriodPrice) * PRICE_DECIMALS / oldPeriodPrice;

            if (amountOfParticipant > 0) {
                if (drawdown < maxDrawdown) {
                    maxDrawdown = drawdown;
                    periodDrawdownMaxIndex = i;
                }
            }

            // daily drawdown data
            if (period == DAILY_PERIOD) {
                settlePeriod = currentPeriod - 1;
                dailyTokensPricesDrawdown[settlePeriod].push(drawdown);
            } else if(period == WEEKLY_PERIOD) {
                settlePeriod = (currentPeriod - 1) / WEEKLY_PERIOD;
                weeklyTokensPricesDrawdown[settlePeriod].push(drawdown);
            }

        }

        if (periodDrawdownMaxIndex == UINT_MAX) {
            return (ThorMutualTokenInterface(address(0)), maxDrawdown);
        }

        return (ThorMutualTokenInterface(tokensIncluded[periodDrawdownMaxIndex]), maxDrawdown);
    }
    
    function getDailyAndWeeklyPriceDrawdownInfo(uint period) public view returns(address[], int[], int[]) {
        uint periodWeekly = period / WEEKLY_PERIOD;
        return (tokensIncluded, dailyTokensPricesDrawdown[period], weeklyTokensPricesDrawdown[periodWeekly]);
    }

}

Contract ABI

[{"constant":true,"inputs":[],"name":"getSelfBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentPeriod","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"settle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_rewardAddressOfPlatfrom","type":"address"}],"name":"setRewardAddressOfPlatfrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"thorMutual","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_thorMutualTokens","type":"address[]"},{"name":"_length","type":"uint256"}],"name":"setThorMutualTokenContracts","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_thorMutualWeeklyReward","type":"address"}],"name":"setThorMutualWeeklyReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_distributeRatioOfDaily","type":"uint256"},{"name":"_distributeRatioOfWeekly","type":"uint256"},{"name":"_distributeRatioOfPlatform","type":"uint256"},{"name":"_ratioWeekly","type":"uint256"}],"name":"setThorMutualParms","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"period","type":"uint256"}],"name":"getWeeklyWinnerTokenInfo","outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"},{"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":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"thorMutualTokenPrice","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"thorMutualWeeklyReward","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getThorMutualParms","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_thorMutualTokenPrice","type":"address"}],"name":"setThorMutualTokenPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"period","type":"uint256"},{"name":"winner","type":"address"}],"name":"getDailyAndWeeklyWinnerInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"initialPeriod","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"period","type":"uint256"}],"name":"getDailyWinnerTokenInfo","outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"address[]"},{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"DepositToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"","type":"address"},{"indexed":false,"name":"","type":"uint256"}],"name":"ThorMutualRewardOfPlatfrom","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

Contract Creation Code

608060405260006002556000600360006101000a81548160ff02191690831515021790555060466012556014601355600a60145560056015553480156200004557600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36040805190810160405280600a81526020017f54686f724d757475616c00000000000000000000000000000000000000000000815250600190805190602001906200014f92919062000156565b5062000205565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200019957805160ff1916838001178555620001ca565b82800160010185558215620001ca579182015b82811115620001c9578251825591602001919060010190620001ac565b5b509050620001d99190620001dd565b5090565b6200020291905b80821115620001fe576000816000905550600101620001e4565b5090565b90565b61218780620002156000396000f300608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063048a5fed14610174578063086146d21461019f57806311da60b4146101ca578063491b3e34146101e15780635879875114610224578063587cf317146102b45780636386faf3146103245780636f8a5599146103675780638993e592146103b25780638da5cb5b146104935780638f32d59b146104ea5780639cb7dac0146105195780639e25cf2814610570578063c7624411146105c7578063cf818cfe14610607578063d895001e1461064a578063d98c4a46146106b2578063ec7987a2146106c9578063f2fde38b146107d4575b7f2d0c0a8842b9944ece1495eb61121621b5e36bd6af3bba0318c695f525aef79f3334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1005b34801561018057600080fd5b50610189610817565b6040518082815260200191505060405180910390f35b3480156101ab57600080fd5b506101b4610836565b6040518082815260200191505060405180910390f35b3480156101d657600080fd5b506101df610840565b005b3480156101ed57600080fd5b50610222600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061091d565b005b34801561023057600080fd5b506102396109b0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561027957808201518184015260208101905061025e565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102c057600080fd5b506103226004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190505050610a4e565b005b34801561033057600080fd5b50610365600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b0e565b005b34801561037357600080fd5b506103b060048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610ba1565b005b3480156103be57600080fd5b506103dd60048036038101908080359060200190929190505050610c06565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019550505050505060405180910390f35b34801561049f57600080fd5b506104a8610d23565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104f657600080fd5b506104ff610d4c565b604051808215151515815260200191505060405180910390f35b34801561052557600080fd5b5061052e610da3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057c57600080fd5b50610585610dc9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105d357600080fd5b506105dc610def565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b34801561061357600080fd5b50610648600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e0f565b005b34801561065657600080fd5b5061069560048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ea2565b604051808381526020018281526020019250505060405180910390f35b3480156106be57600080fd5b506106c7610f80565b005b3480156106d557600080fd5b506106f460048036038101908080359060200190929190505050610f94565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561077957808201518184015260208101905061075e565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156107bb5780820151818401526020810190506107a0565b5050505090500197505050505050505060405180910390f35b3480156107e057600080fd5b50610815600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611138565b005b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600254905090565b3373ffffffffffffffffffffffffffffffffffffffff16600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561089c57600080fd5b60001515600360009054906101000a900460ff16151514156108e0576001600360006101000a81548160ff0219169083151502179055506108db610f80565b61091b565b6108e8611157565b600060076002548115156108f857fe5b06141561090857610907611a1e565b5b6002600081548092919060010191905055505b565b610925610d4c565b151561093057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561096c57600080fd5b80601660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a465780601f10610a1b57610100808354040283529160200191610a46565b820191906000526020600020905b815481529060010190602001808311610a2957829003601f168201915b505050505081565b6000610a58610d4c565b1515610a6357600080fd5b818351141515610a7257600080fd5b600090505b81811015610b095760048382815181101515610a8f57fe5b9060200190602002015190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508080600101915050610a77565b505050565b610b16610d4c565b1515610b2157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b5d57600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610ba9610d4c565b1515610bb457600080fd5b60648284860101141515610bc757600080fd5b60008110158015610bd95750600a8111155b1515610be457600080fd5b8360128190555082601381905550816014819055508060158190555050505050565b6000806000806000806000806000808a10158015610c2557506002548a105b1515610c3057600080fd5b60078a811515610c3c57fe5b0493506007600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16925060096000858152602001908152602001600020549150600b600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508282826010600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166011600089815260200190815260200160002054985098509850985098505050505091939590929450565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080601254601354601454601554935093509350935090919293565b610e17610d4c565b1515610e2257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e5e57600080fd5b80600360016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000808510158015610eb8575060025485105b1515610ec357600080fd5b600785811515610ecf57fe5b049050600c600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600d600083815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205492509250509250929050565b600260008154809291906001019190505550565b60008060006060806000806000808910158015610fb2575060025489105b1515610fbd57600080fd5b600660008a815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600860008a8152602001908152602001600020549150600a60008a8152602001908152602001600020549050828282600e60008d8152602001908152602001600020600f60008e8152602001908152602001600020818054806020026020016040519081016040528092919081815260200182805480156110c957602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161107f575b505050505091508080548060200260200160405190810160405280929190818152602001828054801561111b57602002820191906000526020600020905b815481526020019060010190808311611107575b505050505090509750975097509750975050505091939590929450565b611140610d4c565b151561114b57600080fd5b61115481612061565b50565b600080606060008060008060008060008060008060016002541015151561117d57600080fd5b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166346dfe4f96002546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561121057600080fd5b505af1158015611224573d6000803e3d6000fd5b505050506040513d602081101561123a57600080fd5b81019080805190602001909291905050509c50600073ffffffffffffffffffffffffffffffffffffffff168d73ffffffffffffffffffffffffffffffffffffffff16141561128757611a0f565b8c60066000600160025403815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508c9b508b73ffffffffffffffffffffffffffffffffffffffff1663f3b0a5e16001600254036040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561135557600080fd5b505af1158015611369573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250604081101561139357600080fd5b8101908080516401000000008111156113ab57600080fd5b828101905060208101848111156113c157600080fd5b81518560208202830111640100000000821117156113de57600080fd5b50509291906020018051906020019092919050505050809b50508a51995089600860006001600254038152602001908152602001600020819055506000985060009750600097505b60048054905088101561152c5760048881548110151561144257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166384464a9f6001600254036040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156114e057600080fd5b505af11580156114f4573d6000803e3d6000fd5b505050506040513d602081101561150a57600080fd5b8101908080519060200190929190505050890198508780600101985050611426565b88600a600060016002540381526020019081526020016000208190555060646012548a0281151561155957fe5b04965060646014548a0281151561156c57fe5b04955085878a030394508b73ffffffffffffffffffffffffffffffffffffffff166384464a9f6001600254036040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156115ea57600080fd5b505af11580156115fe573d6000803e3d6000fd5b505050506040513d602081101561161457600080fd5b81019080805190602001909291905050509350600097505b898810156118af578a8881518110151561164257fe5b9060200190602002015192508b73ffffffffffffffffffffffffffffffffffffffff16635caeb576600160025403856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1580156116f657600080fd5b505af115801561170a573d6000803e3d6000fd5b505050506040513d602081101561172057600080fd5b810190808051906020019092919050505091508387830281151561174057fe5b0490508273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611789573d6000803e3d6000fd5b5080600c6000600160025403815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600e600060016002540381526020019081526020016000208390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600f60006001600254038152602001908152602001600020819080600181540180825580915050906001820390600052602060002001600090919290919091505550878060010198505061162c565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc879081150290604051600060405180830381858888f19350505050158015611917573d6000803e3d6000fd5b507f7a565b8c8c23ec3730e3ec16e344f89c9e3d524faeb202c52dc54b9a3ec2cfe3601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f19350505050158015611a0d573d6000803e3d6000fd5b505b50505050505050505050505050565b60008060006060600080600080600080600080600760025410151515611a4357600080fd5b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663624fca066002546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015611ad657600080fd5b505af1158015611aea573d6000803e3d6000fd5b505050506040513d6020811015611b0057600080fd5b81019080805190602001909291905050509b50600073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff161415611b4d57612053565b6007600160025403811515611b5e57fe5b049a508b600760008d815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508b99508973ffffffffffffffffffffffffffffffffffffffff1663949bcf2b6001600254036040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b158015611c2a57600080fd5b505af1158015611c3e573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506040811015611c6857600080fd5b810190808051640100000000811115611c8057600080fd5b82810190506020810184811115611c9657600080fd5b8151856020820283011164010000000082111715611cb357600080fd5b50509291906020018051906020019092919050505050809950508851975087600960008d81526020019081526020016000208190555060009550600094505b87851015611e15578885815181101515611d0857fe5b9060200190602002015193508973ffffffffffffffffffffffffffffffffffffffff16639082a3d1600160025403866040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015611dbc57600080fd5b505af1158015611dd0573d6000803e3d6000fd5b505050506040513d6020811015611de657600080fd5b8101908080519060200190929190505050925085831115611e08578396508295505b8480600101955050611cf2565b86600b60008d815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16319150600a6015548302811515611eb357fe5b049050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166399b5c6d688836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015611f7b57600080fd5b505af1158015611f8f573d6000803e3d6000fd5b5050505080600d60008d815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555086601060008d815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601160008d8152602001908152602001600020819055505b505050505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561209d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820a4bec4eaac3ad9305b7be22d2c4e7ae809d30072591575cce4cdb56db4f099af0029

Swarm Source

bzzr://a4bec4eaac3ad9305b7be22d2c4e7ae809d30072591575cce4cdb56db4f099af
Block Age Transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward