Contract 0xA6EAd513D05347138184324392d8ceb24C116118

Contract Overview

Balance:
0 Ether
Txn Hash
Method
Block
From
To
Value
0x45c97ba9058abd618ed9d961a160cb76a07b2dc8a45a941ca1bb54b54fd098dfRequest Arbitrat...252355712021-06-03 8:35:28484 days 15 hrs ago0x32861c06ff9a7b16a841363de69a5307d1f25bc1 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.000935832
0x55258d45a17d98283342a02d22e217cb1c7d026e193c57867121c9994d5681f2Request Arbitrat...244608732021-04-25 15:40:12523 days 8 hrs ago0x32861c06ff9a7b16a841363de69a5307d1f25bc1 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.00087332
0x4707c5544e60384f69230700c37aa86638e85aefe2900bac8382ae1c4fce43a1Request Arbitrat...244608402021-04-25 15:37:56523 days 8 hrs ago0x10e20e1ba384a80fb27084230fb18a8729b29397 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.0008182
0x33e93cf6ea091baf8907392063b8f68c1cf1a7c8b2d3640724124822b7e152f6Request Arbitrat...134047182019-09-10 14:11:041116 days 9 hrs ago0x5e7b645d5bf86750cb1913122ba8a8545e2a9fd1 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.0046944111
0x52ad3cd2008d8c241b951441d6adaabf08ef0fc718ce19a7e1a0ef3922ccfe63Request Arbitrat...133005542019-09-05 18:14:281121 days 5 hrs ago0x27fe00a5a1212e9294b641ba860a383783016c67 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.000441791
0xf58d679d2e8200e4260e1530957f334279d5c9d7e977844bd536cad5ec0166a0Request Arbitrat...112319952019-05-29 14:51:081220 days 8 hrs ago0x2722592014c6eee912f4033568e4c036422822a5 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.0047014711
0x285e001bd7642d0e6dfb02b7ea4316a7bb8efeeeea5bf155832021906d0bca2bRequest Arbitrat...112153442019-05-28 19:49:321221 days 3 hrs ago0x91b9721294010676e0a46a45a462374c2a8f6314 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.004267910
0x5884712d780a15608368a9d61212709604041024645187578b6804c2fc71b627Request Arbitrat...112152552019-05-28 19:43:361221 days 4 hrs ago0x91b9721294010676e0a46a45a462374c2a8f6314 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.004267910
0x1fb2cf3281b84a5ed2c42bbf976154c23ab90fbc032e1da71c91fbeee5109a25Request Arbitrat...112149672019-05-28 19:24:241221 days 4 hrs ago0x91b9721294010676e0a46a45a462374c2a8f6314 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.004267910
0x535cf516622d053f896fa9e8e4ed3927877ad370b7de512ec3768a1bb2b4727bRequest Arbitrat...112148812019-05-28 19:18:401221 days 4 hrs ago0x91b9721294010676e0a46a45a462374c2a8f6314 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.0042747110
0xace88838f0a913ab36315dbfc9d1174f38e19e74ed085a54047954aabd995e0dRequest Arbitrat...112135432019-05-28 17:49:281221 days 5 hrs ago0x81c69a185076558c2766c79aa96b555df019c167 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.002137035
0x491aab274bb66dfdf180e76fb5121fec8ab47b67a094571a9d034880263cedb9Request Arbitrat...112125912019-05-28 16:46:001221 days 7 hrs ago0x81c69a185076558c2766c79aa96b555df019c167 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.002133955
0x5ad621ca4ac6d6aa8d239429f3469ce52ebd2f5501fadd5b5a9c5224a9afa519Request Arbitrat...112119432019-05-28 15:48:561221 days 7 hrs ago0x81c69a185076558c2766c79aa96b555df019c167 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.002133955
0x89ba889eefe17efc14049ffb5e01e05e56c2e0798bf7c1ecb60d87bb6f932a5aRequest Arbitrat...111979062019-05-28 0:06:481221 days 23 hrs ago0xac96570cf5bb71e557f117651ce4b100b6d06af8 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.001282413
0x406dc744ba17f05e2b0f26d85a74321e5026b5be29dcd935ec4bdc762e7c7c28Request Arbitrat...111977362019-05-27 23:55:281221 days 23 hrs ago0xac96570cf5bb71e557f117651ce4b100b6d06af8 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.001282413
0x21bb43f0ec053979eb9377bdfde34176c74e65f383a38cfb0345e3e2affa5dfaRequest Arbitrat...111976132019-05-27 23:47:161222 days 1 min ago0xac96570cf5bb71e557f117651ce4b100b6d06af8 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.001282413
0xe155aa26a70bfd9de9050533301ebc20569bb004007852ab066a2ae6484592d5Request Arbitrat...111966042019-05-27 22:40:001222 days 1 hr ago0x91b9721294010676e0a46a45a462374c2a8f6314 IN  0xa6ead513d05347138184324392d8ceb24c1161180.03 Ether0.002137035
0x4da0c63a6286635ea1bf0291bd68ac9db7980c73fc3f3b0b25abb7cf57483122Set Meta Evidenc...111042362019-05-23 16:01:281226 days 7 hrs ago0x27fe00a5a1212e9294b641ba860a383783016c67 IN  0xa6ead513d05347138184324392d8ceb24c1161180 Ether0.000019641
0xa8b6d078f529ea383e514d1082f3f7213e70760297a02baf36f0ded2035ec6350x60806040111036742019-05-23 15:24:001226 days 8 hrs ago0x27fe00a5a1212e9294b641ba860a383783016c67 IN  Contract Creation0 Ether0.001708861
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xaece25b2f32226b200f04ddbd6ecc669a9b78f18b3f64c689c93e4812694c678287873512021-12-15 22:25:12289 days 1 hr ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0x45c97ba9058abd618ed9d961a160cb76a07b2dc8a45a941ca1bb54b54fd098df252355712021-06-03 8:35:28484 days 15 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x50e35a1ed424ab9c0b8c7095b3d9ec2fb791a1680 Ether
0x45c97ba9058abd618ed9d961a160cb76a07b2dc8a45a941ca1bb54b54fd098df252355712021-06-03 8:35:28484 days 15 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f800.03 Ether
0x3c21204edc7e8817f47bd7d7a5dd976f03fd355060aa6147509ae45ca5a9a694249552622021-05-20 14:16:36498 days 9 hrs ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0x55258d45a17d98283342a02d22e217cb1c7d026e193c57867121c9994d5681f2244608732021-04-25 15:40:12523 days 8 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x50e35a1ed424ab9c0b8c7095b3d9ec2fb791a1680 Ether
0x55258d45a17d98283342a02d22e217cb1c7d026e193c57867121c9994d5681f2244608732021-04-25 15:40:12523 days 8 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f800.03 Ether
0x4707c5544e60384f69230700c37aa86638e85aefe2900bac8382ae1c4fce43a1244608402021-04-25 15:37:56523 days 8 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x50e35a1ed424ab9c0b8c7095b3d9ec2fb791a1680 Ether
0x4707c5544e60384f69230700c37aa86638e85aefe2900bac8382ae1c4fce43a1244608402021-04-25 15:37:56523 days 8 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f800.03 Ether
0x9aa3357000eebab6fe3f7dd870828b89cb3662fb6d703a9716607c65ac2cc507138884112019-10-03 1:28:161093 days 22 hrs ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0x33e93cf6ea091baf8907392063b8f68c1cf1a7c8b2d3640724124822b7e152f6134047182019-09-10 14:11:041116 days 9 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x50e35a1ed424ab9c0b8c7095b3d9ec2fb791a1680 Ether
0x33e93cf6ea091baf8907392063b8f68c1cf1a7c8b2d3640724124822b7e152f6134047182019-09-10 14:11:041116 days 9 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f800.03 Ether
0x35e60b0e8b8609a1079fd46f9901106f4191e20c50a0d6fa9ef82c473a0d5469133011092019-09-05 18:51:321121 days 4 hrs ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0x52ad3cd2008d8c241b951441d6adaabf08ef0fc718ce19a7e1a0ef3922ccfe63133005542019-09-05 18:14:281121 days 5 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x50e35a1ed424ab9c0b8c7095b3d9ec2fb791a1680 Ether
0x52ad3cd2008d8c241b951441d6adaabf08ef0fc718ce19a7e1a0ef3922ccfe63133005542019-09-05 18:14:281121 days 5 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f800.03 Ether
0x8faff3a72c393839b914fb8f306b11dc22da158039ef7e05ccc8caf360684a49112748692019-05-31 14:44:281218 days 9 hrs ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0xc1dbecbcff6ee06f16d829d0dc74449221872d49cc7e0e59eedeaba0cc8542f7112747182019-05-31 14:34:241218 days 9 hrs ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0xc1dbecbcff6ee06f16d829d0dc74449221872d49cc7e0e59eedeaba0cc8542f7112747182019-05-31 14:34:241218 days 9 hrs ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0x93e9671c7cb7a8ef071741549cd469e2a3b41158926c4e88f4a4af33450e22e4112745672019-05-31 14:24:201218 days 9 hrs ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0x93e9671c7cb7a8ef071741549cd469e2a3b41158926c4e88f4a4af33450e22e4112745672019-05-31 14:24:201218 days 9 hrs ago 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f80 0xa6ead513d05347138184324392d8ceb24c1161180 Ether
0xf58d679d2e8200e4260e1530957f334279d5c9d7e977844bd536cad5ec0166a0112319952019-05-29 14:51:081220 days 8 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x50e35a1ed424ab9c0b8c7095b3d9ec2fb791a1680 Ether
0xf58d679d2e8200e4260e1530957f334279d5c9d7e977844bd536cad5ec0166a0112319952019-05-29 14:51:081220 days 8 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f800.03 Ether
0x285e001bd7642d0e6dfb02b7ea4316a7bb8efeeeea5bf155832021906d0bca2b112153442019-05-28 19:49:321221 days 3 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x50e35a1ed424ab9c0b8c7095b3d9ec2fb791a1680 Ether
0x285e001bd7642d0e6dfb02b7ea4316a7bb8efeeeea5bf155832021906d0bca2b112153442019-05-28 19:49:321221 days 3 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f800.03 Ether
0x5884712d780a15608368a9d61212709604041024645187578b6804c2fc71b627112152552019-05-28 19:43:361221 days 4 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x50e35a1ed424ab9c0b8c7095b3d9ec2fb791a1680 Ether
0x5884712d780a15608368a9d61212709604041024645187578b6804c2fc71b627112152552019-05-28 19:43:361221 days 4 hrs ago 0xa6ead513d05347138184324392d8ceb24c116118 0x60b2abfdfad9c0873242f59f2a8c32a3cc682f800.03 Ether
[ Download CSV Export 
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xdae88f9b57dfa054f7eac894c91d7a809b1b7112

Contract Name:
RealitioArbitratorProxy

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2019-05-10
*/

pragma solidity ^0.4.24;

/**
 * @title ReailtioSafeMath256
 * @dev Math operations with safety checks that throw on error
 */
library RealitioSafeMath256 {
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }

  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

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

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

pragma solidity ^0.4.24;

/**
 * @title RealitioSafeMath32
 * @dev Math operations with safety checks that throw on error
 * @dev Copy of SafeMath but for uint32 instead of uint256
 * @dev Deleted functions we don't use
 */
library RealitioSafeMath32 {
  function add(uint32 a, uint32 b) internal pure returns (uint32) {
    uint32 c = a + b;
    assert(c >= a);
    return c;
  }
}

pragma solidity ^0.4.18;

contract BalanceHolder {

    mapping(address => uint256) public balanceOf;

    event LogWithdraw(
        address indexed user,
        uint256 amount
    );

    function withdraw() 
    public {
        uint256 bal = balanceOf[msg.sender];
        balanceOf[msg.sender] = 0;
        msg.sender.transfer(bal);
        emit LogWithdraw(msg.sender, bal);
    }

}

pragma solidity ^0.4.24;

contract Realitio is BalanceHolder {

    using RealitioSafeMath256 for uint256;
    using RealitioSafeMath32 for uint32;

    address constant NULL_ADDRESS = address(0);

    // History hash when no history is created, or history has been cleared
    bytes32 constant NULL_HASH = bytes32(0);

    // An unitinalized finalize_ts for a question will indicate an unanswered question.
    uint32 constant UNANSWERED = 0;

    // An unanswered reveal_ts for a commitment will indicate that it does not exist.
    uint256 constant COMMITMENT_NON_EXISTENT = 0;

    // Commit->reveal timeout is 1/8 of the question timeout (rounded down).
    uint32 constant COMMITMENT_TIMEOUT_RATIO = 8;

    event LogSetQuestionFee(
        address arbitrator,
        uint256 amount
    );

    event LogNewTemplate(
        uint256 indexed template_id,
        address indexed user, 
        string question_text
    );

    event LogNewQuestion(
        bytes32 indexed question_id,
        address indexed user, 
        uint256 template_id,
        string question,
        bytes32 indexed content_hash,
        address arbitrator, 
        uint32 timeout,
        uint32 opening_ts,
        uint256 nonce,
        uint256 created
    );

    event LogFundAnswerBounty(
        bytes32 indexed question_id,
        uint256 bounty_added,
        uint256 bounty,
        address indexed user 
    );

    event LogNewAnswer(
        bytes32 answer,
        bytes32 indexed question_id,
        bytes32 history_hash,
        address indexed user,
        uint256 bond,
        uint256 ts,
        bool is_commitment
    );

    event LogAnswerReveal(
        bytes32 indexed question_id, 
        address indexed user, 
        bytes32 indexed answer_hash, 
        bytes32 answer, 
        uint256 nonce, 
        uint256 bond
    );

    event LogNotifyOfArbitrationRequest(
        bytes32 indexed question_id,
        address indexed user 
    );

    event LogFinalize(
        bytes32 indexed question_id,
        bytes32 indexed answer
    );

    event LogClaim(
        bytes32 indexed question_id,
        address indexed user,
        uint256 amount
    );

    struct Question {
        bytes32 content_hash;
        address arbitrator;
        uint32 opening_ts;
        uint32 timeout;
        uint32 finalize_ts;
        bool is_pending_arbitration;
        uint256 bounty;
        bytes32 best_answer;
        bytes32 history_hash;
        uint256 bond;
    }

    // Stored in a mapping indexed by commitment_id, a hash of commitment hash, question, bond. 
    struct Commitment {
        uint32 reveal_ts;
        bool is_revealed;
        bytes32 revealed_answer;
    }

    // Only used when claiming more bonds than fits into a transaction
    // Stored in a mapping indexed by question_id.
    struct Claim {
        address payee;
        uint256 last_bond;
        uint256 queued_funds;
    }

    uint256 nextTemplateID = 0;
    mapping(uint256 => uint256) public templates;
    mapping(uint256 => bytes32) public template_hashes;
    mapping(bytes32 => Question) public questions;
    mapping(bytes32 => Claim) public question_claims;
    mapping(bytes32 => Commitment) public commitments;
    mapping(address => uint256) public arbitrator_question_fees; 

    modifier onlyArbitrator(bytes32 question_id) {
        require(msg.sender == questions[question_id].arbitrator, "msg.sender must be arbitrator");
        _;
    }

    modifier stateAny() {
        _;
    }

    modifier stateNotCreated(bytes32 question_id) {
        require(questions[question_id].timeout == 0, "question must not exist");
        _;
    }

    modifier stateOpen(bytes32 question_id) {
        require(questions[question_id].timeout > 0, "question must exist");
        require(!questions[question_id].is_pending_arbitration, "question must not be pending arbitration");
        uint32 finalize_ts = questions[question_id].finalize_ts;
        require(finalize_ts == UNANSWERED || finalize_ts > uint32(now), "finalization deadline must not have passed");
        uint32 opening_ts = questions[question_id].opening_ts;
        require(opening_ts == 0 || opening_ts <= uint32(now), "opening date must have passed"); 
        _;
    }

    modifier statePendingArbitration(bytes32 question_id) {
        require(questions[question_id].is_pending_arbitration, "question must be pending arbitration");
        _;
    }

    modifier stateOpenOrPendingArbitration(bytes32 question_id) {
        require(questions[question_id].timeout > 0, "question must exist");
        uint32 finalize_ts = questions[question_id].finalize_ts;
        require(finalize_ts == UNANSWERED || finalize_ts > uint32(now), "finalization dealine must not have passed");
        uint32 opening_ts = questions[question_id].opening_ts;
        require(opening_ts == 0 || opening_ts <= uint32(now), "opening date must have passed"); 
        _;
    }

    modifier stateFinalized(bytes32 question_id) {
        require(isFinalized(question_id), "question must be finalized");
        _;
    }

    modifier bondMustBeZero() {
        require(msg.value == 0, "bond must be zero");
        _;
    }

    modifier bondMustDouble(bytes32 question_id) {
        require(msg.value > 0, "bond must be positive"); 
        require(msg.value >= (questions[question_id].bond.mul(2)), "bond must be double at least previous bond");
        _;
    }

    modifier previousBondMustNotBeatMaxPrevious(bytes32 question_id, uint256 max_previous) {
        if (max_previous > 0) {
            require(questions[question_id].bond <= max_previous, "bond must exceed max_previous");
        }
        _;
    }

    /// @notice Constructor, sets up some initial templates
    /// @dev Creates some generalized templates for different question types used in the DApp.
    constructor() 
    public {
        createTemplate('{"title": "%s", "type": "bool", "category": "%s", "lang": "%s"}');
        createTemplate('{"title": "%s", "type": "uint", "decimals": 18, "category": "%s", "lang": "%s"}');
        createTemplate('{"title": "%s", "type": "single-select", "outcomes": [%s], "category": "%s", "lang": "%s"}');
        createTemplate('{"title": "%s", "type": "multiple-select", "outcomes": [%s], "category": "%s", "lang": "%s"}');
        createTemplate('{"title": "%s", "type": "datetime", "category": "%s", "lang": "%s"}');
    }

    /// @notice Function for arbitrator to set an optional per-question fee. 
    /// @dev The per-question fee, charged when a question is asked, is intended as an anti-spam measure.
    /// @param fee The fee to be charged by the arbitrator when a question is asked
    function setQuestionFee(uint256 fee) 
        stateAny() 
    external {
        arbitrator_question_fees[msg.sender] = fee;
        emit LogSetQuestionFee(msg.sender, fee);
    }

    /// @notice Create a reusable template, which should be a JSON document.
    /// Placeholders should use gettext() syntax, eg %s.
    /// @dev Template data is only stored in the event logs, but its block number is kept in contract storage.
    /// @param content The template content
    /// @return The ID of the newly-created template, which is created sequentially.
    function createTemplate(string content) 
        stateAny()
    public returns (uint256) {
        uint256 id = nextTemplateID;
        templates[id] = block.number;
        template_hashes[id] = keccak256(abi.encodePacked(content));
        emit LogNewTemplate(id, msg.sender, content);
        nextTemplateID = id.add(1);
        return id;
    }

    /// @notice Create a new reusable template and use it to ask a question
    /// @dev Template data is only stored in the event logs, but its block number is kept in contract storage.
    /// @param content The template content
    /// @param question A string containing the parameters that will be passed into the template to make the question
    /// @param arbitrator The arbitration contract that will have the final word on the answer if there is a dispute
    /// @param timeout How long the contract should wait after the answer is changed before finalizing on that answer
    /// @param opening_ts If set, the earliest time it should be possible to answer the question.
    /// @param nonce A user-specified nonce used in the question ID. Change it to repeat a question.
    /// @return The ID of the newly-created template, which is created sequentially.
    function createTemplateAndAskQuestion(
        string content, 
        string question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce 
    ) 
        // stateNotCreated is enforced by the internal _askQuestion
    public payable returns (bytes32) {
        uint256 template_id = createTemplate(content);
        return askQuestion(template_id, question, arbitrator, timeout, opening_ts, nonce);
    }

    /// @notice Ask a new question and return the ID
    /// @dev Template data is only stored in the event logs, but its block number is kept in contract storage.
    /// @param template_id The ID number of the template the question will use
    /// @param question A string containing the parameters that will be passed into the template to make the question
    /// @param arbitrator The arbitration contract that will have the final word on the answer if there is a dispute
    /// @param timeout How long the contract should wait after the answer is changed before finalizing on that answer
    /// @param opening_ts If set, the earliest time it should be possible to answer the question.
    /// @param nonce A user-specified nonce used in the question ID. Change it to repeat a question.
    /// @return The ID of the newly-created question, created deterministically.
    function askQuestion(uint256 template_id, string question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce) 
        // stateNotCreated is enforced by the internal _askQuestion
    public payable returns (bytes32) {

        require(templates[template_id] > 0, "template must exist");

        bytes32 content_hash = keccak256(abi.encodePacked(template_id, opening_ts, question));
        bytes32 question_id = keccak256(abi.encodePacked(content_hash, arbitrator, timeout, msg.sender, nonce));

        _askQuestion(question_id, content_hash, arbitrator, timeout, opening_ts);
        emit LogNewQuestion(question_id, msg.sender, template_id, question, content_hash, arbitrator, timeout, opening_ts, nonce, now);

        return question_id;
    }

    function _askQuestion(bytes32 question_id, bytes32 content_hash, address arbitrator, uint32 timeout, uint32 opening_ts) 
        stateNotCreated(question_id)
    internal {

        // A timeout of 0 makes no sense, and we will use this to check existence
        require(timeout > 0, "timeout must be positive"); 
        require(timeout < 365 days, "timeout must be less than 365 days"); 
        require(arbitrator != NULL_ADDRESS, "arbitrator must be set");

        uint256 bounty = msg.value;

        // The arbitrator can set a fee for asking a question. 
        // This is intended as an anti-spam defence.
        // The fee is waived if the arbitrator is asking the question.
        // This allows them to set an impossibly high fee and make users proxy the question through them.
        // This would allow more sophisticated pricing, question whitelisting etc.
        if (msg.sender != arbitrator) {
            uint256 question_fee = arbitrator_question_fees[arbitrator];
            require(bounty >= question_fee, "ETH provided must cover question fee"); 
            bounty = bounty.sub(question_fee);
            balanceOf[arbitrator] = balanceOf[arbitrator].add(question_fee);
        }

        questions[question_id].content_hash = content_hash;
        questions[question_id].arbitrator = arbitrator;
        questions[question_id].opening_ts = opening_ts;
        questions[question_id].timeout = timeout;
        questions[question_id].bounty = bounty;

    }

    /// @notice Add funds to the bounty for a question
    /// @dev Add bounty funds after the initial question creation. Can be done any time until the question is finalized.
    /// @param question_id The ID of the question you wish to fund
    function fundAnswerBounty(bytes32 question_id) 
        stateOpen(question_id)
    external payable {
        questions[question_id].bounty = questions[question_id].bounty.add(msg.value);
        emit LogFundAnswerBounty(question_id, msg.value, questions[question_id].bounty, msg.sender);
    }

    /// @notice Submit an answer for a question.
    /// @dev Adds the answer to the history and updates the current "best" answer.
    /// May be subject to front-running attacks; Substitute submitAnswerCommitment()->submitAnswerReveal() to prevent them.
    /// @param question_id The ID of the question
    /// @param answer The answer, encoded into bytes32
    /// @param max_previous If specified, reverts if a bond higher than this was submitted after you sent your transaction.
    function submitAnswer(bytes32 question_id, bytes32 answer, uint256 max_previous) 
        stateOpen(question_id)
        bondMustDouble(question_id)
        previousBondMustNotBeatMaxPrevious(question_id, max_previous)
    external payable {
        _addAnswerToHistory(question_id, answer, msg.sender, msg.value, false);
        _updateCurrentAnswer(question_id, answer, questions[question_id].timeout);
    }

    /// @notice Submit the hash of an answer, laying your claim to that answer if you reveal it in a subsequent transaction.
    /// @dev Creates a hash, commitment_id, uniquely identifying this answer, to this question, with this bond.
    /// The commitment_id is stored in the answer history where the answer would normally go.
    /// Does not update the current best answer - this is left to the later submitAnswerReveal() transaction.
    /// @param question_id The ID of the question
    /// @param answer_hash The hash of your answer, plus a nonce that you will later reveal
    /// @param max_previous If specified, reverts if a bond higher than this was submitted after you sent your transaction.
    /// @param _answerer If specified, the address to be given as the question answerer. Defaults to the sender.
    /// @dev Specifying the answerer is useful if you want to delegate the commit-and-reveal to a third-party.
    function submitAnswerCommitment(bytes32 question_id, bytes32 answer_hash, uint256 max_previous, address _answerer) 
        stateOpen(question_id)
        bondMustDouble(question_id)
        previousBondMustNotBeatMaxPrevious(question_id, max_previous)
    external payable {

        bytes32 commitment_id = keccak256(abi.encodePacked(question_id, answer_hash, msg.value));
        address answerer = (_answerer == NULL_ADDRESS) ? msg.sender : _answerer;

        require(commitments[commitment_id].reveal_ts == COMMITMENT_NON_EXISTENT, "commitment must not already exist");

        uint32 commitment_timeout = questions[question_id].timeout / COMMITMENT_TIMEOUT_RATIO;
        commitments[commitment_id].reveal_ts = uint32(now).add(commitment_timeout);

        _addAnswerToHistory(question_id, commitment_id, answerer, msg.value, true);

    }

    /// @notice Submit the answer whose hash you sent in a previous submitAnswerCommitment() transaction
    /// @dev Checks the parameters supplied recreate an existing commitment, and stores the revealed answer
    /// Updates the current answer unless someone has since supplied a new answer with a higher bond
    /// msg.sender is intentionally not restricted to the user who originally sent the commitment; 
    /// For example, the user may want to provide the answer+nonce to a third-party service and let them send the tx
    /// NB If we are pending arbitration, it will be up to the arbitrator to wait and see any outstanding reveal is sent
    /// @param question_id The ID of the question
    /// @param answer The answer, encoded as bytes32
    /// @param nonce The nonce that, combined with the answer, recreates the answer_hash you gave in submitAnswerCommitment()
    /// @param bond The bond that you paid in your submitAnswerCommitment() transaction
    function submitAnswerReveal(bytes32 question_id, bytes32 answer, uint256 nonce, uint256 bond) 
        stateOpenOrPendingArbitration(question_id)
    external {

        bytes32 answer_hash = keccak256(abi.encodePacked(answer, nonce));
        bytes32 commitment_id = keccak256(abi.encodePacked(question_id, answer_hash, bond));

        require(!commitments[commitment_id].is_revealed, "commitment must not have been revealed yet");
        require(commitments[commitment_id].reveal_ts > uint32(now), "reveal deadline must not have passed");

        commitments[commitment_id].revealed_answer = answer;
        commitments[commitment_id].is_revealed = true;

        if (bond == questions[question_id].bond) {
            _updateCurrentAnswer(question_id, answer, questions[question_id].timeout);
        }

        emit LogAnswerReveal(question_id, msg.sender, answer_hash, answer, nonce, bond);

    }

    function _addAnswerToHistory(bytes32 question_id, bytes32 answer_or_commitment_id, address answerer, uint256 bond, bool is_commitment) 
    internal 
    {
        bytes32 new_history_hash = keccak256(abi.encodePacked(questions[question_id].history_hash, answer_or_commitment_id, bond, answerer, is_commitment));

        // Update the current bond level, if there's a bond (ie anything except arbitration)
        if (bond > 0) {
            questions[question_id].bond = bond;
        }
        questions[question_id].history_hash = new_history_hash;

        emit LogNewAnswer(answer_or_commitment_id, question_id, new_history_hash, answerer, bond, now, is_commitment);
    }

    function _updateCurrentAnswer(bytes32 question_id, bytes32 answer, uint32 timeout_secs)
    internal {
        questions[question_id].best_answer = answer;
        questions[question_id].finalize_ts = uint32(now).add(timeout_secs);
    }

    /// @notice Notify the contract that the arbitrator has been paid for a question, freezing it pending their decision.
    /// @dev The arbitrator contract is trusted to only call this if they've been paid, and tell us who paid them.
    /// @param question_id The ID of the question
    /// @param requester The account that requested arbitration
    /// @param max_previous If specified, reverts if a bond higher than this was submitted after you sent your transaction.
    function notifyOfArbitrationRequest(bytes32 question_id, address requester, uint256 max_previous) 
        onlyArbitrator(question_id)
        stateOpen(question_id)
        previousBondMustNotBeatMaxPrevious(question_id, max_previous)
    external {
        require(questions[question_id].bond > 0, "Question must already have an answer when arbitration is requested");
        questions[question_id].is_pending_arbitration = true;
        emit LogNotifyOfArbitrationRequest(question_id, requester);
    }

    /// @notice Submit the answer for a question, for use by the arbitrator.
    /// @dev Doesn't require (or allow) a bond.
    /// If the current final answer is correct, the account should be whoever submitted it.
    /// If the current final answer is wrong, the account should be whoever paid for arbitration.
    /// However, the answerer stipulations are not enforced by the contract.
    /// @param question_id The ID of the question
    /// @param answer The answer, encoded into bytes32
    /// @param answerer The account credited with this answer for the purpose of bond claims
    function submitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address answerer) 
        onlyArbitrator(question_id)
        statePendingArbitration(question_id)
        bondMustBeZero
    external {

        require(answerer != NULL_ADDRESS, "answerer must be provided");
        emit LogFinalize(question_id, answer);

        questions[question_id].is_pending_arbitration = false;
        _addAnswerToHistory(question_id, answer, answerer, 0, false);
        _updateCurrentAnswer(question_id, answer, 0);

    }

    /// @notice Report whether the answer to the specified question is finalized
    /// @param question_id The ID of the question
    /// @return Return true if finalized
    function isFinalized(bytes32 question_id) 
    view public returns (bool) {
        uint32 finalize_ts = questions[question_id].finalize_ts;
        return ( !questions[question_id].is_pending_arbitration && (finalize_ts > UNANSWERED) && (finalize_ts <= uint32(now)) );
    }

    /// @notice (Deprecated) Return the final answer to the specified question, or revert if there isn't one
    /// @param question_id The ID of the question
    /// @return The answer formatted as a bytes32
    function getFinalAnswer(bytes32 question_id) 
        stateFinalized(question_id)
    external view returns (bytes32) {
        return questions[question_id].best_answer;
    }

    /// @notice Return the final answer to the specified question, or revert if there isn't one
    /// @param question_id The ID of the question
    /// @return The answer formatted as a bytes32
    function resultFor(bytes32 question_id) 
        stateFinalized(question_id)
    external view returns (bytes32) {
        return questions[question_id].best_answer;
    }


    /// @notice Return the final answer to the specified question, provided it matches the specified criteria.
    /// @dev Reverts if the question is not finalized, or if it does not match the specified criteria.
    /// @param question_id The ID of the question
    /// @param content_hash The hash of the question content (template ID + opening time + question parameter string)
    /// @param arbitrator The arbitrator chosen for the question (regardless of whether they are asked to arbitrate)
    /// @param min_timeout The timeout set in the initial question settings must be this high or higher
    /// @param min_bond The bond sent with the final answer must be this high or higher
    /// @return The answer formatted as a bytes32
    function getFinalAnswerIfMatches(
        bytes32 question_id, 
        bytes32 content_hash, address arbitrator, uint32 min_timeout, uint256 min_bond
    ) 
        stateFinalized(question_id)
    external view returns (bytes32) {
        require(content_hash == questions[question_id].content_hash, "content hash must match");
        require(arbitrator == questions[question_id].arbitrator, "arbitrator must match");
        require(min_timeout <= questions[question_id].timeout, "timeout must be long enough");
        require(min_bond <= questions[question_id].bond, "bond must be high enough");
        return questions[question_id].best_answer;
    }

    /// @notice Assigns the winnings (bounty and bonds) to everyone who gave the accepted answer
    /// Caller must provide the answer history, in reverse order
    /// @dev Works up the chain and assign bonds to the person who gave the right answer
    /// If someone gave the winning answer earlier, they must get paid from the higher bond
    /// That means we can't pay out the bond added at n until we have looked at n-1
    /// The first answer is authenticated by checking against the stored history_hash.
    /// One of the inputs to history_hash is the history_hash before it, so we use that to authenticate the next entry, etc
    /// Once we get to a null hash we'll know we're done and there are no more answers.
    /// Usually you would call the whole thing in a single transaction, but if not then the data is persisted to pick up later.
    /// @param question_id The ID of the question
    /// @param history_hashes Second-last-to-first, the hash of each history entry. (Final one should be empty).
    /// @param addrs Last-to-first, the address of each answerer or commitment sender
    /// @param bonds Last-to-first, the bond supplied with each answer or commitment
    /// @param answers Last-to-first, each answer supplied, or commitment ID if the answer was supplied with commit->reveal
    function claimWinnings(
        bytes32 question_id, 
        bytes32[] history_hashes, address[] addrs, uint256[] bonds, bytes32[] answers
    ) 
        stateFinalized(question_id)
    public {

        require(history_hashes.length > 0, "at least one history hash entry must be provided");

        // These are only set if we split our claim over multiple transactions.
        address payee = question_claims[question_id].payee; 
        uint256 last_bond = question_claims[question_id].last_bond; 
        uint256 queued_funds = question_claims[question_id].queued_funds; 

        // Starts as the hash of the final answer submitted. It'll be cleared when we're done.
        // If we're splitting the claim over multiple transactions, it'll be the hash where we left off last time
        bytes32 last_history_hash = questions[question_id].history_hash;

        bytes32 best_answer = questions[question_id].best_answer;

        uint256 i;
        for (i = 0; i < history_hashes.length; i++) {
        
            // Check input against the history hash, and see which of 2 possible values of is_commitment fits.
            bool is_commitment = _verifyHistoryInputOrRevert(last_history_hash, history_hashes[i], answers[i], bonds[i], addrs[i]);
            
            queued_funds = queued_funds.add(last_bond); 
            (queued_funds, payee) = _processHistoryItem(
                question_id, best_answer, queued_funds, payee, 
                addrs[i], bonds[i], answers[i], is_commitment);
 
            // Line the bond up for next time, when it will be added to somebody's queued_funds
            last_bond = bonds[i];
            last_history_hash = history_hashes[i];

        }
 
        if (last_history_hash != NULL_HASH) {
            // We haven't yet got to the null hash (1st answer), ie the caller didn't supply the full answer chain.
            // Persist the details so we can pick up later where we left off later.

            // If we know who to pay we can go ahead and pay them out, only keeping back last_bond
            // (We always know who to pay unless all we saw were unrevealed commits)
            if (payee != NULL_ADDRESS) {
                _payPayee(question_id, payee, queued_funds);
                queued_funds = 0;
            }

            question_claims[question_id].payee = payee;
            question_claims[question_id].last_bond = last_bond;
            question_claims[question_id].queued_funds = queued_funds;
        } else {
            // There is nothing left below us so the payee can keep what remains
            _payPayee(question_id, payee, queued_funds.add(last_bond));
            delete question_claims[question_id];
        }

        questions[question_id].history_hash = last_history_hash;

    }

    function _payPayee(bytes32 question_id, address payee, uint256 value) 
    internal {
        balanceOf[payee] = balanceOf[payee].add(value);
        emit LogClaim(question_id, payee, value);
    }

    function _verifyHistoryInputOrRevert(
        bytes32 last_history_hash,
        bytes32 history_hash, bytes32 answer, uint256 bond, address addr
    )
    internal pure returns (bool) {
        if (last_history_hash == keccak256(abi.encodePacked(history_hash, answer, bond, addr, true)) ) {
            return true;
        }
        if (last_history_hash == keccak256(abi.encodePacked(history_hash, answer, bond, addr, false)) ) {
            return false;
        } 
        revert("History input provided did not match the expected hash");
    }

    function _processHistoryItem(
        bytes32 question_id, bytes32 best_answer, 
        uint256 queued_funds, address payee, 
        address addr, uint256 bond, bytes32 answer, bool is_commitment
    )
    internal returns (uint256, address) {

        // For commit-and-reveal, the answer history holds the commitment ID instead of the answer.
        // We look at the referenced commitment ID and switch in the actual answer.
        if (is_commitment) {
            bytes32 commitment_id = answer;
            // If it's a commit but it hasn't been revealed, it will always be considered wrong.
            if (!commitments[commitment_id].is_revealed) {
                delete commitments[commitment_id];
                return (queued_funds, payee);
            } else {
                answer = commitments[commitment_id].revealed_answer;
                delete commitments[commitment_id];
            }
        }

        if (answer == best_answer) {

            if (payee == NULL_ADDRESS) {

                // The entry is for the first payee we come to, ie the winner.
                // They get the question bounty.
                payee = addr;
                queued_funds = queued_funds.add(questions[question_id].bounty);
                questions[question_id].bounty = 0;

            } else if (addr != payee) {

                // Answerer has changed, ie we found someone lower down who needs to be paid

                // The lower answerer will take over receiving bonds from higher answerer.
                // They should also be paid the takeover fee, which is set at a rate equivalent to their bond. 
                // (This is our arbitrary rule, to give consistent right-answerers a defence against high-rollers.)

                // There should be enough for the fee, but if not, take what we have.
                // There's an edge case involving weird arbitrator behaviour where we may be short.
                uint256 answer_takeover_fee = (queued_funds >= bond) ? bond : queued_funds;

                // Settle up with the old (higher-bonded) payee
                _payPayee(question_id, payee, queued_funds.sub(answer_takeover_fee));

                // Now start queued_funds again for the new (lower-bonded) payee
                payee = addr;
                queued_funds = answer_takeover_fee;

            }

        }

        return (queued_funds, payee);

    }

    /// @notice Convenience function to assign bounties/bonds for multiple questions in one go, then withdraw all your funds.
    /// Caller must provide the answer history for each question, in reverse order
    /// @dev Can be called by anyone to assign bonds/bounties, but funds are only withdrawn for the user making the call.
    /// @param question_ids The IDs of the questions you want to claim for
    /// @param lengths The number of history entries you will supply for each question ID
    /// @param hist_hashes In a single list for all supplied questions, the hash of each history entry.
    /// @param addrs In a single list for all supplied questions, the address of each answerer or commitment sender
    /// @param bonds In a single list for all supplied questions, the bond supplied with each answer or commitment
    /// @param answers In a single list for all supplied questions, each answer supplied, or commitment ID 
    function claimMultipleAndWithdrawBalance(
        bytes32[] question_ids, uint256[] lengths, 
        bytes32[] hist_hashes, address[] addrs, uint256[] bonds, bytes32[] answers
    ) 
        stateAny() // The finalization checks are done in the claimWinnings function
    public {
        
        uint256 qi;
        uint256 i;
        for (qi = 0; qi < question_ids.length; qi++) {
            bytes32 qid = question_ids[qi];
            uint256 ln = lengths[qi];
            bytes32[] memory hh = new bytes32[](ln);
            address[] memory ad = new address[](ln);
            uint256[] memory bo = new uint256[](ln);
            bytes32[] memory an = new bytes32[](ln);
            uint256 j;
            for (j = 0; j < ln; j++) {
                hh[j] = hist_hashes[i];
                ad[j] = addrs[i];
                bo[j] = bonds[i];
                an[j] = answers[i];
                i++;
            }
            claimWinnings(qid, hh, ad, bo, an);
        }
        withdraw();
    }

    /// @notice Returns the questions's content hash, identifying the question content
    /// @param question_id The ID of the question 
    function getContentHash(bytes32 question_id) 
    public view returns(bytes32) {
        return questions[question_id].content_hash;
    }

    /// @notice Returns the arbitrator address for the question
    /// @param question_id The ID of the question 
    function getArbitrator(bytes32 question_id) 
    public view returns(address) {
        return questions[question_id].arbitrator;
    }

    /// @notice Returns the timestamp when the question can first be answered
    /// @param question_id The ID of the question 
    function getOpeningTS(bytes32 question_id) 
    public view returns(uint32) {
        return questions[question_id].opening_ts;
    }

    /// @notice Returns the timeout in seconds used after each answer
    /// @param question_id The ID of the question 
    function getTimeout(bytes32 question_id) 
    public view returns(uint32) {
        return questions[question_id].timeout;
    }

    /// @notice Returns the timestamp at which the question will be/was finalized
    /// @param question_id The ID of the question 
    function getFinalizeTS(bytes32 question_id) 
    public view returns(uint32) {
        return questions[question_id].finalize_ts;
    }

    /// @notice Returns whether the question is pending arbitration
    /// @param question_id The ID of the question 
    function isPendingArbitration(bytes32 question_id) 
    public view returns(bool) {
        return questions[question_id].is_pending_arbitration;
    }

    /// @notice Returns the current total unclaimed bounty
    /// @dev Set back to zero once the bounty has been claimed
    /// @param question_id The ID of the question 
    function getBounty(bytes32 question_id) 
    public view returns(uint256) {
        return questions[question_id].bounty;
    }

    /// @notice Returns the current best answer
    /// @param question_id The ID of the question 
    function getBestAnswer(bytes32 question_id) 
    public view returns(bytes32) {
        return questions[question_id].best_answer;
    }

    /// @notice Returns the history hash of the question 
    /// @param question_id The ID of the question 
    /// @dev Updated on each answer, then rewound as each is claimed
    function getHistoryHash(bytes32 question_id) 
    public view returns(bytes32) {
        return questions[question_id].history_hash;
    }

    /// @notice Returns the highest bond posted so far for a question
    /// @param question_id The ID of the question 
    function getBond(bytes32 question_id) 
    public view returns(uint256) {
        return questions[question_id].bond;
    }

}

/**
 *  @title Arbitrator
 *  @author Clément Lesaege - <[email protected]>
 *  Bug Bounties: This code hasn't undertaken a bug bounty program yet.
 */

pragma solidity ^0.4.15;

/** @title Arbitrator
 *  Arbitrator abstract contract.
 *  When developing arbitrator contracts we need to:
 *  -Define the functions for dispute creation (createDispute) and appeal (appeal). Don't forget to store the arbitrated contract and the disputeID (which should be unique, use nbDisputes).
 *  -Define the functions for cost display (arbitrationCost and appealCost).
 *  -Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).
 */
contract Arbitrator {

    enum DisputeStatus {Waiting, Appealable, Solved}

    modifier requireArbitrationFee(bytes _extraData) {
        require(msg.value >= arbitrationCost(_extraData), "Not enough ETH to cover arbitration costs.");
        _;
    }
    modifier requireAppealFee(uint _disputeID, bytes _extraData) {
        require(msg.value >= appealCost(_disputeID, _extraData), "Not enough ETH to cover appeal costs.");
        _;
    }

    /** @dev To be raised when a dispute is created.
     *  @param _disputeID ID of the dispute.
     *  @param _arbitrable The contract which created the dispute.
     */
    event DisputeCreation(uint indexed _disputeID, Arbitrable indexed _arbitrable);

    /** @dev To be raised when a dispute can be appealed.
     *  @param _disputeID ID of the dispute.
     */
    event AppealPossible(uint indexed _disputeID, Arbitrable indexed _arbitrable);

    /** @dev To be raised when the current ruling is appealed.
     *  @param _disputeID ID of the dispute.
     *  @param _arbitrable The contract which created the dispute.
     */
    event AppealDecision(uint indexed _disputeID, Arbitrable indexed _arbitrable);

    /** @dev Create a dispute. Must be called by the arbitrable contract.
     *  Must be paid at least arbitrationCost(_extraData).
     *  @param _choices Amount of choices the arbitrator can make in this dispute.
     *  @param _extraData Can be used to give additional info on the dispute to be created.
     *  @return disputeID ID of the dispute created.
     */
    function createDispute(uint _choices, bytes _extraData) public requireArbitrationFee(_extraData) payable returns(uint disputeID) {}

    /** @dev Compute the cost of arbitration. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation.
     *  @param _extraData Can be used to give additional info on the dispute to be created.
     *  @return fee Amount to be paid.
     */
    function arbitrationCost(bytes _extraData) public view returns(uint fee);

    /** @dev Appeal a ruling. Note that it has to be called before the arbitrator contract calls rule.
     *  @param _disputeID ID of the dispute to be appealed.
     *  @param _extraData Can be used to give extra info on the appeal.
     */
    function appeal(uint _disputeID, bytes _extraData) public requireAppealFee(_disputeID,_extraData) payable {
        emit AppealDecision(_disputeID, Arbitrable(msg.sender));
    }

    /** @dev Compute the cost of appeal. It is recommended not to increase it often, as it can be higly time and gas consuming for the arbitrated contracts to cope with fee augmentation.
     *  @param _disputeID ID of the dispute to be appealed.
     *  @param _extraData Can be used to give additional info on the dispute to be created.
     *  @return fee Amount to be paid.
     */
    function appealCost(uint _disputeID, bytes _extraData) public view returns(uint fee);

    /** @dev Compute the start and end of the dispute's current or next appeal period, if possible.
     *  @param _disputeID ID of the dispute.
     *  @return The start and end of the period.
     */
    function appealPeriod(uint _disputeID) public view returns(uint start, uint end) {}

    /** @dev Return the status of a dispute.
     *  @param _disputeID ID of the dispute to rule.
     *  @return status The status of the dispute.
     */
    function disputeStatus(uint _disputeID) public view returns(DisputeStatus status);

    /** @dev Return the current ruling of a dispute. This is useful for parties to know if they should appeal.
     *  @param _disputeID ID of the dispute.
     *  @return ruling The ruling which has been given or the one which will be given if there is no appeal.
     */
    function currentRuling(uint _disputeID) public view returns(uint ruling);
}

/**
 *  @title IArbitrable
 *  @author Enrique Piqueras - <[email protected]>
 *  Bug Bounties: This code hasn't undertaken a bug bounty program yet.
 */

pragma solidity ^0.4.15;

/** @title IArbitrable
 *  Arbitrable interface.
 *  When developing arbitrable contracts, we need to:
 *  -Define the action taken when a ruling is received by the contract. We should do so in executeRuling.
 *  -Allow dispute creation. For this a function must:
 *      -Call arbitrator.createDispute.value(_fee)(_choices,_extraData);
 *      -Create the event Dispute(_arbitrator,_disputeID,_rulingOptions);
 */
interface IArbitrable {
    /** @dev To be emmited when meta-evidence is submitted.
     *  @param _metaEvidenceID Unique identifier of meta-evidence.
     *  @param _evidence A link to the meta-evidence JSON.
     */
    event MetaEvidence(uint indexed _metaEvidenceID, string _evidence);

    /** @dev To be emmited when a dispute is created to link the correct meta-evidence to the disputeID
     *  @param _arbitrator The arbitrator of the contract.
     *  @param _disputeID ID of the dispute in the Arbitrator contract.
     *  @param _metaEvidenceID Unique identifier of meta-evidence.
     *  @param _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.
     */
    event Dispute(Arbitrator indexed _arbitrator, uint indexed _disputeID, uint _metaEvidenceID, uint _evidenceGroupID);

    /** @dev To be raised when evidence are submitted. Should point to the ressource (evidences are not to be stored on chain due to gas considerations).
     *  @param _arbitrator The arbitrator of the contract.
     *  @param _evidenceGroupID Unique identifier of the evidence group the evidence belongs to.
     *  @param _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party.
     *  @param _evidence A URI to the evidence JSON file whose name should be its keccak256 hash followed by .json.
     */
    event Evidence(Arbitrator indexed _arbitrator, uint indexed _evidenceGroupID, address indexed _party, string _evidence);

    /** @dev To be raised when a ruling is given.
     *  @param _arbitrator The arbitrator giving the ruling.
     *  @param _disputeID ID of the dispute in the Arbitrator contract.
     *  @param _ruling The ruling which was given.
     */
    event Ruling(Arbitrator indexed _arbitrator, uint indexed _disputeID, uint _ruling);

    /** @dev Give a ruling for a dispute. Must be called by the arbitrator.
     *  The purpose of this function is to ensure that the address calling it has the right to rule on the contract.
     *  @param _disputeID ID of the dispute in the Arbitrator contract.
     *  @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting to make a decision".
     */
    function rule(uint _disputeID, uint _ruling) public;
}

/**
 *  @title Arbitrable
 *  @author Clément Lesaege - <[email protected]>
 *  Bug Bounties: This code hasn't undertaken a bug bounty program yet.
 */

pragma solidity ^0.4.15;

/** @title Arbitrable
 *  Arbitrable abstract contract.
 *  When developing arbitrable contracts, we need to:
 *  -Define the action taken when a ruling is received by the contract. We should do so in executeRuling.
 *  -Allow dispute creation. For this a function must:
 *      -Call arbitrator.createDispute.value(_fee)(_choices,_extraData);
 *      -Create the event Dispute(_arbitrator,_disputeID,_rulingOptions);
 */
contract Arbitrable is IArbitrable {
    Arbitrator public arbitrator;
    bytes public arbitratorExtraData; // Extra data to require particular dispute and appeal behaviour.

    modifier onlyArbitrator {require(msg.sender == address(arbitrator), "Can only be called by the arbitrator."); _;}

    /** @dev Constructor. Choose the arbitrator.
     *  @param _arbitrator The arbitrator of the contract.
     *  @param _arbitratorExtraData Extra data for the arbitrator.
     */
    constructor(Arbitrator _arbitrator, bytes _arbitratorExtraData) public {
        arbitrator = _arbitrator;
        arbitratorExtraData = _arbitratorExtraData;
    }

    /** @dev Give a ruling for a dispute. Must be called by the arbitrator.
     *  The purpose of this function is to ensure that the address calling it has the right to rule on the contract.
     *  @param _disputeID ID of the dispute in the Arbitrator contract.
     *  @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting to make a decision".
     */
    function rule(uint _disputeID, uint _ruling) public onlyArbitrator {
        emit Ruling(Arbitrator(msg.sender),_disputeID,_ruling);

        executeRuling(_disputeID,_ruling);
    }


    /** @dev Execute a ruling of a dispute.
     *  @param _disputeID ID of the dispute in the Arbitrator contract.
     *  @param _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting to make a decision".
     */
    function executeRuling(uint _disputeID, uint _ruling) internal;
}

/**
 *  https://contributing.kleros.io/smart-contract-workflow
 *  @reviewers: []
 *  @auditors: []
 *  @bounties: []
 *  @deployments: []
 */

pragma solidity ^0.4.24;

/**
 *  @title RealitioArbitratorProxy
 *  @author Enrique Piqueras - <[email protected]>
 *  @dev A Realitio arbitrator that is just a proxy for an ERC792 arbitrator.
 */
contract RealitioArbitratorProxy is Arbitrable {
    /* Events */

    /** @dev Emitted when arbitration is requested, to link dispute ID to question ID for UIs.
     *  @param _disputeID The ID of the dispute in the ERC792 arbitrator.
     *  @param _questionID The ID of the question.
     */
    event DisputeIDToQuestionID(uint indexed _disputeID, bytes32 _questionID);

    /* Storage */

    address public deployer;
    Realitio public realitio;
    mapping(uint => bytes32) public disputeIDToQuestionID;
    mapping(bytes32 => address) public questionIDToDisputer;
    mapping(bytes32 => bytes32) public questionIDToAnswer;
    mapping(bytes32 => bool) public questionIDToRuled;

    /* Constructor */

    /** @dev Constructs the RealitioArbitratorProxy contract.
     *  @param _arbitrator The address of the ERC792 arbitrator.
     *  @param _arbitratorExtraData The extra data used to raise a dispute in the ERC792 arbitrator.
     *  @param _realitio The address of the Realitio contract.
     */
    constructor(
        Arbitrator _arbitrator,
        bytes _arbitratorExtraData,
        Realitio _realitio
    ) Arbitrable(_arbitrator, _arbitratorExtraData) public {
        deployer = msg.sender;
        realitio = _realitio;
    }

    /* External */

    /** @dev Sets the meta evidence. Can only be called once.
     *  @param _metaEvidence The URI of the meta evidence file.
     */
    function setMetaEvidence(string _metaEvidence) external {
        require(msg.sender == deployer, "Can only be called once by the deployer of the contract.");
        deployer = address(0);
        emit MetaEvidence(0, _metaEvidence);
    }

    /** @dev Raise a dispute from a specified question.
     *  @param _questionID The ID of the question.
     *  @param _maxPrevious If specified, reverts if a bond higher than this was submitted after you sent your transaction.
     */
    function requestArbitration(bytes32 _questionID, uint _maxPrevious) external payable {
        uint disputeID = arbitrator.createDispute.value(msg.value)((2 ** 128) - 1, arbitratorExtraData);
        disputeIDToQuestionID[disputeID] = _questionID;
        questionIDToDisputer[_questionID] = msg.sender;
        realitio.notifyOfArbitrationRequest(_questionID, msg.sender, _maxPrevious);
        emit Dispute(arbitrator, disputeID, 0, 0);
        emit DisputeIDToQuestionID(disputeID, _questionID);
    }

    /** @dev Report the answer to a specified question from the ERC792 arbitrator to the Realitio contract.
     *  @param _questionID The ID of the question.
     *  @param _lastHistoryHash The history hash given with the last answer to the question in the Realitio contract.
     *  @param _lastAnswerOrCommitmentID The last answer given, or its commitment ID if it was a commitment, to the question in the Realitio contract.
     *  @param _lastBond The bond paid for the last answer to the question in the Realitio contract.
     *  @param _lastAnswerer The last answerer to the question in the Realitio contract.
     *  @param _isCommitment Wether the last answer to the question in the Realitio contract used commit or reveal or not. True if it did, false otherwise.
     */
    function reportAnswer(
        bytes32 _questionID,
        bytes32 _lastHistoryHash,
        bytes32 _lastAnswerOrCommitmentID,
        uint _lastBond,
        address _lastAnswerer,
        bool _isCommitment
    ) external {
        require(
            realitio.getHistoryHash(_questionID) == keccak256(_lastHistoryHash, _lastAnswerOrCommitmentID, _lastBond, _lastAnswerer, _isCommitment),
            "The hash of the history parameters supplied does not match the one stored in the Realitio contract."
        );
        require(questionIDToRuled[_questionID], "The arbitrator has not ruled yet.");

        realitio.submitAnswerByArbitrator(
            _questionID,
            questionIDToAnswer[_questionID],
            computeWinner(_questionID, _lastAnswerOrCommitmentID, _lastBond, _lastAnswerer, _isCommitment)
        );

        delete questionIDToDisputer[_questionID];
        delete questionIDToAnswer[_questionID];
        delete questionIDToRuled[_questionID];
    }

    /* External Views */

    /** @dev Get the fee for a dispute from a specified question.
     *  @param _questionID The ID of the question.
     *  @return fee The dispute's fee.
     */
    function getDisputeFee(bytes32 _questionID) external view returns (uint fee) {
        return arbitrator.arbitrationCost(arbitratorExtraData);
    }

    /* Internal */

    /** @dev Execute the ruling of a specified dispute.
     *  @param _disputeID The ID of the dispute in the ERC792 arbitrator.
     *  @param _ruling The ruling given by the ERC792 arbitrator. Note that 0 is reserved for "Unable/refused to arbitrate" and we map it to `bytes32(-1)` which has a similar connotation in Realitio.
     */
    function executeRuling(uint _disputeID, uint _ruling) internal {
        questionIDToAnswer[disputeIDToQuestionID[_disputeID]] = bytes32(_ruling == 0 ? uint(-1) : _ruling - 1);
        questionIDToRuled[disputeIDToQuestionID[_disputeID]] = true;
        delete disputeIDToQuestionID[_disputeID];
    }

    /* Private Views */

    /** @dev Computes the Realitio answerer, of a specified question, that should win. This function is needed to avoid the "stack too deep error".
     *  @param _questionID The ID of the question.
     *  @param _lastAnswerOrCommitmentID The last answer given, or its commitment ID if it was a commitment, to the question in the Realitio contract.
     *  @param _lastBond The bond paid for the last answer to the question in the Realitio contract.
     *  @param _lastAnswerer The last answerer to the question in the Realitio contract.
     *  @param _isCommitment Wether the last answer to the question in the Realitio contract used commit or reveal or not. True if it did, false otherwise.
     *  @return winner The computed winner.
     */
    function computeWinner(
        bytes32 _questionID,
        bytes32 _lastAnswerOrCommitmentID,
        uint _lastBond,
        address _lastAnswerer,
        bool _isCommitment
    ) private view returns(address winner) {
        bytes32 lastAnswer;
        bool isAnswered;
        if (_lastBond == 0) { // If the question hasn't been answered, nobody is ever right.
            isAnswered = false;
        } else if (_isCommitment) {
            (uint32 revealTS, bool isRevealed, bytes32 revealedAnswer) = realitio.commitments(_lastAnswerOrCommitmentID);
            if (isRevealed) {
                lastAnswer = revealedAnswer;
                isAnswered = true;
            } else {
                require(revealTS < uint32(now), "Arbitration cannot be done until the last answerer has had time to reveal its commitment.");
                isAnswered = false;
            }
        } else {
            lastAnswer = _lastAnswerOrCommitmentID;
            isAnswered = true;
        }

        return isAnswered && lastAnswer == questionIDToAnswer[_questionID] ? _lastAnswerer : questionIDToDisputer[_questionID];
    }
}

Contract ABI

[{"constant":false,"inputs":[{"name":"_metaEvidence","type":"string"}],"name":"setMetaEvidence","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"arbitratorExtraData","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"questionIDToDisputer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_disputeID","type":"uint256"},{"name":"_ruling","type":"uint256"}],"name":"rule","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_questionID","type":"bytes32"},{"name":"_lastHistoryHash","type":"bytes32"},{"name":"_lastAnswerOrCommitmentID","type":"bytes32"},{"name":"_lastBond","type":"uint256"},{"name":"_lastAnswerer","type":"address"},{"name":"_isCommitment","type":"bool"}],"name":"reportAnswer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"arbitrator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"questionIDToAnswer","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_questionID","type":"bytes32"}],"name":"getDisputeFee","outputs":[{"name":"fee","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_questionID","type":"bytes32"},{"name":"_maxPrevious","type":"uint256"}],"name":"requestArbitration","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"realitio","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"questionIDToRuled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"disputeIDToQuestionID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"deployer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_arbitrator","type":"address"},{"name":"_arbitratorExtraData","type":"bytes"},{"name":"_realitio","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_disputeID","type":"uint256"},{"indexed":false,"name":"_questionID","type":"bytes32"}],"name":"DisputeIDToQuestionID","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_metaEvidenceID","type":"uint256"},{"indexed":false,"name":"_evidence","type":"string"}],"name":"MetaEvidence","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_arbitrator","type":"address"},{"indexed":true,"name":"_disputeID","type":"uint256"},{"indexed":false,"name":"_metaEvidenceID","type":"uint256"},{"indexed":false,"name":"_evidenceGroupID","type":"uint256"}],"name":"Dispute","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_arbitrator","type":"address"},{"indexed":true,"name":"_evidenceGroupID","type":"uint256"},{"indexed":true,"name":"_party","type":"address"},{"indexed":false,"name":"_evidence","type":"string"}],"name":"Evidence","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_arbitrator","type":"address"},{"indexed":true,"name":"_disputeID","type":"uint256"},{"indexed":false,"name":"_ruling","type":"uint256"}],"name":"Ruling","type":"event"}]

60806040523480156200001157600080fd5b50604051620018a7380380620018a78339810180604052810190808051906020019092919080518201929190602001805190602001909291905050508282816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060019080519060200190620000a792919062000135565b50505033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050620001e4565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200017857805160ff1916838001178555620001a9565b82800160010185558215620001a9579182015b82811115620001a85782518255916020019190600101906200018b565b5b509050620001b89190620001bc565b5090565b620001e191905b80821115620001dd576000816000905550600101620001c3565b5090565b90565b6116b380620001f46000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302c891c5146100ca5780630c7ac7b6146101055780632c6bb04414610195578063311a6c56146102065780633f37773f1461023d5780636cc6cde1146102c0578063888dcad314610317578063a22352e214610364578063a829c3d1146103a9578063bc8802a2146103d7578063cc3ea6fa1461042e578063d521aa9f14610477578063d5f39488146104c0575b600080fd5b3480156100d657600080fd5b50610103600480360381019080803590602001908201803590602001919091929391929390505050610517565b005b34801561011157600080fd5b5061011a61069b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015a57808201518184015260208101905061013f565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a157600080fd5b506101c46004803603810190808035600019169060200190929190505050610739565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021257600080fd5b5061023b600480360381019080803590602001909291908035906020019092919050505061076c565b005b34801561024957600080fd5b506102be60048036038101908080356000191690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506108b3565b005b3480156102cc57600080fd5b506102d5610d8c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561032357600080fd5b506103466004803603810190808035600019169060200190929190505050610db1565b60405180826000191660001916815260200191505060405180910390f35b34801561037057600080fd5b506103936004803603810190808035600019169060200190929190505050610dc9565b6040518082815260200191505060405180910390f35b6103d5600480360381019080803560001916906020019092919080359060200190929190505050610f20565b005b3480156103e357600080fd5b506103ec6112ac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561043a57600080fd5b5061045d60048036038101908080356000191690602001909291905050506112d2565b604051808215151515815260200191505060405180910390f35b34801561048357600080fd5b506104a2600480360381019080803590602001909291905050506112f2565b60405180826000191660001916815260200191505060405180910390f35b3480156104cc57600080fd5b506104d561130a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610602576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001807f43616e206f6e6c792062652063616c6c6564206f6e636520627920746865206481526020017f65706c6f796572206f662074686520636f6e74726163742e000000000000000081525060400191505060405180910390fd5b6000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060007f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d8383604051808060200182810382528484828181526020019250808284378201915050935050505060405180910390a25050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107315780601f1061070657610100808354040283529160200191610731565b820191906000526020600020905b81548152906001019060200180831161071457829003601f168201915b505050505081565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610856576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f43616e206f6e6c792062652063616c6c6564206279207468652061726269747281526020017f61746f722e00000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b813373ffffffffffffffffffffffffffffffffffffffff167f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e75622276836040518082815260200191505060405180910390a36108af8282611330565b5050565b848484848460405180866000191660001916815260200185600019166000191681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140182151515157f010000000000000000000000000000000000000000000000000000000000000002815260010195505050505050604051809103902060001916600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166382ffa9f7886040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b1580156109f757600080fd5b505af1158015610a0b573d6000803e3d6000fd5b505050506040513d6020811015610a2157600080fd5b810190808051906020019092919050505060001916141515610b1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260638152602001807f5468652068617368206f662074686520686973746f727920706172616d65746581526020017f727320737570706c69656420646f6573206e6f74206d6174636820746865206f81526020017f6e652073746f72656420696e20746865205265616c6974696f20636f6e74726181526020017f63742e000000000000000000000000000000000000000000000000000000000081525060800191505060405180910390fd5b60076000876000191660001916815260200190815260200160002060009054906101000a900460ff161515610be0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f5468652061726269747261746f7220686173206e6f742072756c65642079657481526020017f2e0000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe92049d87600660008a6000191660001916815260200190815260200160002054610c488a898989896113fe565b6040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180846000191660001916815260200183600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019350505050600060405180830381600087803b158015610ce457600080fd5b505af1158015610cf8573d6000803e3d6000fd5b5050505060056000876000191660001916815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556006600087600019166000191681526020019081526020016000206000905560076000876000191660001916815260200190815260200160002060006101000a81549060ff0219169055505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60066020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f7434ea960016040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015610ebe5780601f10610e9357610100808354040283529160200191610ebe565b820191906000526020600020905b815481529060010190602001808311610ea157829003601f168201915b505092505050602060405180830381600087803b158015610ede57600080fd5b505af1158015610ef2573d6000803e3d6000fd5b505050506040513d6020811015610f0857600080fd5b81019080805190602001909291905050509050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c13517e1346fffffffffffffffffffffffffffffffff60016040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018060200182810382528381815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561102d5780601f106110025761010080835404028352916020019161102d565b820191906000526020600020905b81548152906001019060200180831161101057829003601f168201915b505093505050506020604051808303818588803b15801561104d57600080fd5b505af1158015611061573d6000803e3d6000fd5b50505050506040513d602081101561107857600080fd5b81019080805190602001909291905050509050826004600083815260200190815260200160002081600019169055503360056000856000191660001916815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6a94ecb8433856040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b1580156111d657600080fd5b505af11580156111ea573d6000803e3d6000fd5b50505050806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d600080604051808381526020018281526020019250505060405180910390a3807fcbb827f06aed2dd1e157f8e6b29f32604bc4e88360964014c4d4ad259f8d3fa88460405180826000191660001916815260200191505060405180910390a2505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60076020528060005260406000206000915054906101000a900460ff1681565b60046020528060005260406000206000915090505481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081146113415760018103611363565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b60010260066000600460008681526020019081526020016000205460001916600019168152602001908152602001600020816000191690555060016007600060046000868152602001908152602001600020546000191660001916815260200190815260200160002060006101000a81548160ff02191690831515021790555060046000838152602001908152602001600020600090555050565b60008060008060008060008914156114195760009350611601565b86156115f857600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663839df9458b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050606060405180830381600087803b1580156114b857600080fd5b505af11580156114cc573d6000803e3d6000fd5b505050506040513d60608110156114e257600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050925092509250811561151f57809450600193506115f3565b4263ffffffff168363ffffffff161015156115ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260598152602001807f4172626974726174696f6e2063616e6e6f7420626520646f6e6520756e74696c81526020017f20746865206c61737420616e73776572657220686173206861642074696d652081526020017f746f2072657665616c2069747320636f6d6d69746d656e742e0000000000000081525060600191505060405180910390fd5b600093505b611600565b899450600193505b5b8380156116305750600660008c6000191660001916815260200190815260200160002054600019168560001916145b61167557600560008c6000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611677565b875b95505050505050959450505050505600a165627a7a723058206144a0b7ab55da541a636aa56666e671a6083bdaa225f332a72e5f4fefc5e2ec002900000000000000000000000060b2abfdfad9c0873242f59f2a8c32a3cc682f80000000000000000000000000000000000000000000000000000000000000006000000000000000000000000050e35a1ed424ab9c0b8c7095b3d9ec2fb791a168000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000

Deployed ByteCode Sourcemap

47325:7240:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;48773:244;;8:9:-1;5:2;;;30:1;27;20:12;5:2;48773:244:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;45462:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;45462:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;45462:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;47855:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;47855:55:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;46452:186;;8:9:-1;5:2;;;30:1;27;20:12;5:2;46452:186:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;50577:1011;;8:9:-1;5:2;;;30:1;27;20:12;5:2;50577:1011:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;45427:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;45427:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;47917:53;;8:9:-1;5:2;;;30:1;27;20:12;5:2;47917:53:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;51792:150;;8:9:-1;5:2;;;30:1;27;20:12;5:2;51792:150:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49268:511;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;47764:24;;8:9:-1;5:2;;;30:1;27;20:12;5:2;47764:24:0;;;;;;;;;;;;;;;;;;;;;;;;;;;47977:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;47977:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;47795:53;;8:9:-1;5:2;;;30:1;27;20:12;5:2;47795:53:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;47734:23;;8:9:-1;5:2;;;30:1;27;20:12;5:2;47734:23:0;;;;;;;;;;;;;;;;;;;;;;;;;;;48773:244;48862:8;;;;;;;;;;;48848:22;;:10;:22;;;48840:91;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;48961:1;48942:8;;:21;;;;;;;;;;;;;;;;;;48992:1;48979:30;48995:13;;48979:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;48773:244;;:::o;45462:32::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;47855:55::-;;;;;;;;;;;;;;;;;;;;;;:::o;46452:186::-;45624:10;;;;;;;;;;;45602:33;;:10;:33;;;45594:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;46565:10;46553;46535:49;;;46576:7;46535:49;;;;;;;;;;;;;;;;;;46597:33;46611:10;46622:7;46597:13;:33::i;:::-;46452:186;;:::o;50577:1011::-;50893:16;50911:25;50938:9;50949:13;50964;50883:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;50843:135;;;:8;;;;;;;;;;;:23;;;50867:11;50843:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;50843:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;50843:36:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;50843:36:0;;;;;;;;;;;;;;;;:135;;;;50821:284;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;51124:17;:30;51142:11;51124:30;;;;;;;;;;;;;;;;;;;;;;;;;;;51116:76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;51205:8;;;;;;;;;;;:33;;;51253:11;51279:18;:31;51298:11;51279:31;;;;;;;;;;;;;;;;;;51325:94;51339:11;51352:25;51379:9;51390:13;51405;51325;:94::i;:::-;51205:225;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;51205:225:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;51205:225:0;;;;51450:20;:33;51471:11;51450:33;;;;;;;;;;;;;;;;;;51443:40;;;;;;;;;;;51501:18;:31;51520:11;51501:31;;;;;;;;;;;;;;;;;51494:38;;;51550:17;:30;51568:11;51550:30;;;;;;;;;;;;;;;;;;51543:37;;;;;;;;;;;50577:1011;;;;;;:::o;45427:28::-;;;;;;;;;;;;;:::o;47917:53::-;;;;;;;;;;;;;;;;;:::o;51792:150::-;51859:8;51887:10;;;;;;;;;;;:26;;;51914:19;51887:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;51887:47:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;51887:47:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;51887:47:0;;;;;;;;;;;;;;;;51880:54;;51792:150;;;:::o;49268:511::-;49364:14;49381:10;;;;;;;;;;;:24;;;49412:9;49423:14;49439:19;49381:78;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;49381:78:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;49381:78:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;49381:78:0;;;;;;;;;;;;;;;;49364:95;;49505:11;49470:21;:32;49492:9;49470:32;;;;;;;;;;;:46;;;;;;;49563:10;49527:20;:33;49548:11;49527:33;;;;;;;;;;;;;;;;;;:46;;;;;;;;;;;;;;;;;;49584:8;;;;;;;;;;;:35;;;49620:11;49633:10;49645:12;49584:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;49584:74:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;49584:74:0;;;;49694:9;49682:10;;;;;;;;;;;49674:36;;;49705:1;49708;49674:36;;;;;;;;;;;;;;;;;;;;;;;;49748:9;49726:45;49759:11;49726:45;;;;;;;;;;;;;;;;;;;;;;;;49268:511;;;:::o;47764:24::-;;;;;;;;;;;;;:::o;47977:49::-;;;;;;;;;;;;;;;;;;;;;;:::o;47795:53::-;;;;;;;;;;;;;;;;;:::o;47734:23::-;;;;;;;;;;;;;:::o;52314:305::-;52463:1;52452:7;:12;:37;;52488:1;52478:7;:11;52452:37;;;52472:2;52452:37;52444:46;;52388:18;:53;52407:21;:33;52429:10;52407:33;;;;;;;;;;;;52388:53;;;;;;;;;;;;;;;;;:102;;;;;;;52556:4;52501:17;:52;52519:21;:33;52541:10;52519:33;;;;;;;;;;;;52501:52;;;;;;;;;;;;;;;;;;:59;;;;;;;;;;;;;;;;;;52578:21;:33;52600:10;52578:33;;;;;;;;;;;52571:40;;;52314:305;;:::o;53410:1152::-;53621:14;53648:18;53677:15;53872;53889;53906:22;53720:1;53707:9;:14;53703:721;;;53814:5;53801:18;;53703:721;;;53841:13;53837:587;;;53932:8;;;;;;;;;;;:20;;;53953:25;53932:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;53932:47:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;53932:47:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;53932:47:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;53871:108;;;;;;53998:10;53994:316;;;54042:14;54029:27;;54088:4;54075:17;;53994:316;;;54159:3;54141:22;;:8;:22;;;54133:124;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54289:5;54276:18;;53994:316;53837:587;;;54355:25;54342:38;;54408:4;54395:17;;53837:587;53703:721;54443:10;:59;;;;;54471:18;:31;54490:11;54471:31;;;;;;;;;;;;;;;;;;54457:45;;;:10;:45;;;;54443:59;:111;;54521:20;:33;54542:11;54521:33;;;;;;;;;;;;;;;;;;;;;;;;;;;54443:111;;;54505:13;54443:111;54436:118;;53410:1152;;;;;;;;;;;;:::o

Swarm Source

bzzr://6144a0b7ab55da541a636aa56666e671a6083bdaa225f332a72e5f4fefc5e2ec
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.