Contract 0x29f39de98d750eb77b5fafb31b2837f079fce222

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x1d926f5a319676e6e3d2e554fa895add3e350c8fb29cc5cbfce93ebd64e6ca7a0x61010060202707672022-01-24 7:18:15314 days 7 hrs ago0x42fc1fe86e15eb56a2815e6230aa88efc87f5c15 IN  Create: RealitioHomeArbitrationProxy0 xDAI0.14818518
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RealitioHomeArbitrationProxy

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at gnosisscan.io on 2022-08-05
*/

// SPDX-License-Identifier: MIT

// File: @kleros/erc-792/contracts/erc-1497/IEvidence.sol

/**
 * @authors: [@ferittuncer, @hbarcelos]
 * @reviewers: []
 */
pragma solidity >=0.7;


/** @title IEvidence
 *  ERC-1497: Evidence Standard
 */
interface IEvidence {
    /**
     * @dev To be emitted when meta-evidence is submitted.
     * @param _metaEvidenceID Unique identifier of meta-evidence.
     * @param _evidence A link to the meta-evidence JSON.
     */
    event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence);

    /**
     * @dev To be raised when evidence is submitted. Should point to the resource (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(
        IArbitrator indexed _arbitrator,
        uint256 indexed _evidenceGroupID,
        address indexed _party,
        string _evidence
    );

    /**
     * @dev To be emitted 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(
        IArbitrator indexed _arbitrator,
        uint256 indexed _disputeID,
        uint256 _metaEvidenceID,
        uint256 _evidenceGroupID
    );
}

// File: @kleros/erc-792/contracts/IArbitrator.sol

/**
 * @authors: [@ferittuncer, @hbarcelos]
 * @reviewers: [@remedcu*]
 */

pragma solidity >=0.7;


/**
 * @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, may nbDisputes).
 * - Define the functions for cost display (arbitrationCost and appealCost).
 * - Allow giving rulings. For this a function must call arbitrable.rule(disputeID, ruling).
 */
interface IArbitrator {
    enum DisputeStatus {Waiting, Appealable, Solved}

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

    /**
     * @dev To be emitted when a dispute can be appealed.
     * @param _disputeID ID of the dispute.
     * @param _arbitrable The contract which created the dispute.
     */
    event AppealPossible(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);

    /**
     * @dev To be emitted when the current ruling is appealed.
     * @param _disputeID ID of the dispute.
     * @param _arbitrable The contract which created the dispute.
     */
    event AppealDecision(uint256 indexed _disputeID, IArbitrable 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(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 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 cost Amount to be paid.
     */
    function arbitrationCost(bytes calldata _extraData) external view returns (uint256 cost);

    /**
     * @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(uint256 _disputeID, bytes calldata _extraData) external payable;

    /**
     * @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 cost Amount to be paid.
     */
    function appealCost(uint256 _disputeID, bytes calldata _extraData) external view returns (uint256 cost);

    /**
     * @dev Compute the start and end of the dispute's current or next appeal period, if possible. If not known or appeal is impossible: should return (0, 0).
     * @param _disputeID ID of the dispute.
     * @return start The start of the period.
     * @return end The end of the period.
     */
    function appealPeriod(uint256 _disputeID) external view returns (uint256 start, uint256 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(uint256 _disputeID) external 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(uint256 _disputeID) external view returns (uint256 ruling);
}

// File: @kleros/erc-792/contracts/IArbitrable.sol

/**
 * @authors: [@ferittuncer, @hbarcelos]
 * @reviewers: [@remedcu*]
 */
pragma solidity >=0.7;


/**
 * @title IArbitrable
 * Arbitrable interface.
 * When developing arbitrable contracts, we need to:
 * - Define the action taken when a ruling is received by the contract.
 * - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);
 */
interface IArbitrable {
    /**
     * @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(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _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(uint256 _disputeID, uint256 _ruling) external;
}

// File: localhost/contracts/src/ArbitrationProxyInterfaces.sol

pragma solidity ^0.7.2;



interface IHomeArbitrationProxy {
    /**
     * @notice To be emitted when the Realitio contract has been notified of an arbitration request.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     * @param _maxPrevious The maximum value of the previous bond for the question.
     */
    event RequestNotified(bytes32 indexed _questionID, address indexed _requester, uint256 _maxPrevious);

    /**
     * @notice To be emitted when arbitration request is rejected.
     * @dev This can happen if the current bond for the question is higher than maxPrevious
     * or if the question is already finalized.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     * @param _maxPrevious The maximum value of the current bond for the question.
     * @param _reason The reason why the request was rejected.
     */
    event RequestRejected(
        bytes32 indexed _questionID,
        address indexed _requester,
        uint256 _maxPrevious,
        string _reason
    );

    /**
     * @notice To be emitted when the arbitration request acknowledgement is sent to the Foreign Chain.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    event RequestAcknowledged(bytes32 indexed _questionID, address indexed _requester);

    /**
     * @notice To be emitted when the arbitration request is canceled.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    event RequestCanceled(bytes32 indexed _questionID, address indexed _requester);

    /**
     * @notice To be emitted when the dispute could not be created on the Foreign Chain.
     * @dev This will happen if the arbitration fee increases in between the arbitration request and acknowledgement.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    event ArbitrationFailed(bytes32 indexed _questionID, address indexed _requester);

    /**
     * @notice To be emitted when receiving the answer from the arbitrator.
     * @param _questionID The ID of the question.
     * @param _answer The answer from the arbitrator.
     */
    event ArbitratorAnswered(bytes32 indexed _questionID, bytes32 _answer);

    /**
     * @notice To be emitted when reporting the arbitrator answer to Realitio.
     * @param _questionID The ID of the question.
     */
    event ArbitrationFinished(bytes32 indexed _questionID);

    /**
     * @dev Receives the requested arbitration for a question. TRUSTED.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     * @param _maxPrevious The maximum value of the current bond for the question. The arbitration request will get rejected if the current bond is greater than _maxPrevious. If set to 0, _maxPrevious is ignored.
     */
    function receiveArbitrationRequest(
        bytes32 _questionID,
        address _requester,
        uint256 _maxPrevious
    ) external;

    /**
     * @notice Handles arbitration request after it has been notified to Realitio for a given question.
     * @dev This method exists because `receiveArbitrationRequest` is called by the AMB and cannot send messages back to it.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    function handleNotifiedRequest(bytes32 _questionID, address _requester) external;

    /**
     * @notice Handles arbitration request after it has been rejected.
     * @dev This method exists because `receiveArbitrationRequest` is called by the AMB and cannot send messages back to it.
     * Reasons why the request might be rejected:
     *  - The question does not exist
     *  - The question was not answered yet
     *  - The quesiton bond value changed while the arbitration was being requested
     *  - Another request was already accepted
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    function handleRejectedRequest(bytes32 _questionID, address _requester) external;

    /**
     * @notice Receives a failed attempt to request arbitration. TRUSTED.
     * @dev Currently this can happen only if the arbitration cost increased.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    function receiveArbitrationFailure(bytes32 _questionID, address _requester) external;

    /**
     * @notice Receives the answer to a specified question. TRUSTED.
     * @param _questionID The ID of the question.
     * @param _answer The answer from the arbitrator.
     */
    function receiveArbitrationAnswer(bytes32 _questionID, bytes32 _answer) external;
}

interface IForeignArbitrationProxy is IArbitrable, IEvidence {
    /**
     * @notice Should be emitted when the arbitration is requested.
     * @param _questionID The ID of the question with the request for arbitration.
     * @param _requester The address of the arbitration requester.
     * @param _maxPrevious The maximum value of the current bond for the question. The arbitration request will get rejected if the current bond is greater than _maxPrevious. If set to 0, _maxPrevious is ignored.
     */
    event ArbitrationRequested(bytes32 indexed _questionID, address indexed _requester, uint256 _maxPrevious);

    /**
     * @notice Should be emitted when the dispute is created.
     * @param _questionID The ID of the question with the request for arbitration.
     * @param _requester The address of the arbitration requester.
     * @param _disputeID The ID of the dispute.
     */
    event ArbitrationCreated(bytes32 indexed _questionID, address indexed _requester, uint256 indexed _disputeID);

    /**
     * @notice Should be emitted when the arbitration is canceled by the Home Chain.
     * @param _questionID The ID of the question with the request for arbitration.
     * @param _requester The address of the arbitration requester.
     */
    event ArbitrationCanceled(bytes32 indexed _questionID, address indexed _requester);

    /**
     * @notice Should be emitted when the dispute could not be created.
     * @dev This will happen if there is an increase in the arbitration fees
     * between the time the arbitration is made and the time it is acknowledged.
     * @param _questionID The ID of the question with the request for arbitration.
     * @param _requester The address of the arbitration requester.
     */
    event ArbitrationFailed(bytes32 indexed _questionID, address indexed _requester);

    /**
     * @notice Requests arbitration for the given question.
     * @param _questionID The ID of the question.
     * @param _maxPrevious The maximum value of the current bond for the question. The arbitration request will get rejected if the current bond is greater than _maxPrevious. If set to 0, _maxPrevious is ignored.
     */
    function requestArbitration(bytes32 _questionID, uint256 _maxPrevious) external payable;

    /**
     * @notice Receives the acknowledgement of the arbitration request for the given question and requester. TRUSTED.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    function receiveArbitrationAcknowledgement(bytes32 _questionID, address _requester) external;

    /**
     * @notice Receives the cancelation of the arbitration request for the given question and requester. TRUSTED.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    function receiveArbitrationCancelation(bytes32 _questionID, address _requester) external;

    /**
     * @notice Cancels the arbitration in case the dispute could not be created.
     * @param _questionID The ID of the question.
     * @param _requester The address of the arbitration requester.
     */
    function handleFailedDisputeCreation(bytes32 _questionID, address _requester) external;

    /**
     * @notice Gets the fee to create a dispute.
     * @param _questionID the ID of the question.
     * @return The fee to create a dispute.
     */
    function getDisputeFee(bytes32 _questionID) external view returns (uint256);
}

// File: localhost/contracts/src/dependencies/RealitioInterface.sol

/* solhint-disable var-name-mixedcase */

/** Interface of https://github.com/realitio/realitio-contracts/blob/master/truffle/contracts/Realitio_v2_1.sol original contract is to be reviewed.
 *  @reviewers: [@hbarcelos, @fnanni-0, @nix1g, @unknownunknown1]
 */


pragma solidity ^0.7.2;

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

    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
    );

    /**
     * @dev The arbitrator contract is trusted to only call this if they've been paid, and tell us who paid them.
     * @notice Notify the contract that the arbitrator has been paid for a question, freezing it pending their decision.
     * @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
    ) external;

    /**
     * @notice Cancel a previously-requested arbitration and extend the timeout
     * @dev Useful when doing arbitration across chains that can't be requested atomically
     * @param question_id The ID of the question
     */
    function cancelArbitration(bytes32 question_id) external;

    /**
     * @notice Submit the answer for a question, for use by the arbitrator, working out the appropriate winner based on the last answer details.
     * @dev Doesn't require (or allow) a bond.
     * @param question_id The ID of the question
     * @param answer The answer, encoded into bytes32
     * @param payee_if_wrong The account to be credited as winner if the last answer given is wrong, usually the account that paid the arbitrator
     * @param last_history_hash The history hash before the final one
     * @param last_answer_or_commitment_id The last answer given, or the commitment ID if it was a commitment.
     * @param last_answerer The address that supplied the last answer
     */
    function assignWinnerAndSubmitAnswerByArbitrator(
        bytes32 question_id,
        bytes32 answer,
        address payee_if_wrong,
        bytes32 last_history_hash,
        bytes32 last_answer_or_commitment_id,
        address last_answerer
    ) external;
}

// File: localhost/contracts/src/dependencies/IAMB.sol

pragma solidity ^0.7.2;

interface IAMB {
    function requireToPassMessage(
        address _contract,
        bytes memory _data,
        uint256 _gas
    ) external returns (bytes32);

    function maxGasPerTx() external view returns (uint256);

    function messageSender() external view returns (address);

    function messageSourceChainId() external view returns (bytes32);

    function messageId() external view returns (bytes32);
}

// File: localhost/contracts/src/RealitioHomeArbitrationProxy.sol


/**
 *  @authors: [@hbarcelos]
 *  @reviewers: [@ferittuncer*, @fnanni-0, @nix1g, @epiqueras*, @clesaege, @unknownunknown1]
 */

pragma solidity ^0.7.2;




/**
 * @title Arbitration proxy for Realitio on the side-chain side (A.K.A. the Home Chain).
 * @dev This contract is meant to be deployed to side-chains (i.e.: xDAI) in which Reality.eth is deployed.
 */
contract RealitioHomeArbitrationProxy is IHomeArbitrationProxy {
    /// @dev The address of the Realitio contract (v2.1+ required). TRUSTED.
    RealitioInterface public immutable realitio;

    /// @dev ArbitraryMessageBridge contract address. TRUSTED.
    IAMB public immutable amb;

    /// @dev Address of the counter-party proxy on the Foreign Chain. TRUSTED.
    address public immutable foreignProxy;

    /// @dev The chain ID where the foreign proxy is deployed.
    bytes32 public immutable foreignChainId;

    /// @dev Metadata for Realitio interface.
    string public constant metadata = '{"foreignProxy":true}';

    enum Status {None, Rejected, Notified, AwaitingRuling, Ruled, Finished}

    struct Request {
        Status status;
        bytes32 arbitratorAnswer;
    }

    /// @dev Associates an arbitration request with a question ID and a requester address. requests[questionID][requester]
    mapping(bytes32 => mapping(address => Request)) public requests;

    /// @dev Associates a question ID with the requester who succeeded in requesting arbitration. questionIDToRequester[questionID]
    mapping(bytes32 => address) public questionIDToRequester;

    modifier onlyForeignProxy() {
        require(msg.sender == address(amb), "Only AMB allowed");
        require(amb.messageSourceChainId() == foreignChainId, "Only foreign chain allowed");
        require(amb.messageSender() == foreignProxy, "Only foreign proxy allowed");
        _;
    }

    /**
     * @notice Creates an arbitration proxy on the home chain.
     * @param _amb ArbitraryMessageBridge contract address.
     * @param _foreignProxy The address of the proxy.
     * @param _foreignChainId The ID of the chain where the foreign proxy is deployed.
     * @param _realitio Realitio contract address.
     */
    constructor(
        IAMB _amb,
        address _foreignProxy,
        bytes32 _foreignChainId,
        RealitioInterface _realitio
    ) {
        amb = _amb;
        foreignProxy = _foreignProxy;
        foreignChainId = _foreignChainId;
        realitio = _realitio;
    }

    /**
     * @dev Receives the requested arbitration for a question. TRUSTED.
     * @param _questionID The ID of the question.
     * @param _requester The address of the user that requested arbitration.
     * @param _maxPrevious The maximum value of the previous bond for the question.
     */
    function receiveArbitrationRequest(
        bytes32 _questionID,
        address _requester,
        uint256 _maxPrevious
    ) external override onlyForeignProxy {
        Request storage request = requests[_questionID][_requester];
        require(request.status == Status.None, "Request already exists");

        try realitio.notifyOfArbitrationRequest(_questionID, _requester, _maxPrevious) {
            request.status = Status.Notified;
            questionIDToRequester[_questionID] = _requester;

            emit RequestNotified(_questionID, _requester, _maxPrevious);
        } catch Error(string memory reason) {
            /*
             * Will fail if:
             *  - The question does not exist.
             *  - The question was not answered yet.
             *  - Another request was already accepted.
             *  - Someone increased the bond on the question to a value > _maxPrevious
             */
            request.status = Status.Rejected;

            emit RequestRejected(_questionID, _requester, _maxPrevious, reason);
        } catch {
            // In case `reject` did not have a reason string or some other error happened
            request.status = Status.Rejected;

            emit RequestRejected(_questionID, _requester, _maxPrevious, "");
        }
    }

    /**
     * @notice Handles arbitration request after it has been notified to Realitio for a given question.
     * @dev This method exists because `receiveArbitrationRequest` is called by the AMB and cannot send messages back to it.
     * @param _questionID The ID of the question.
     * @param _requester The address of the user that requested arbitration.
     */
    function handleNotifiedRequest(bytes32 _questionID, address _requester) external override {
        Request storage request = requests[_questionID][_requester];
        require(request.status == Status.Notified, "Invalid request status");

        request.status = Status.AwaitingRuling;

        bytes4 selector = IForeignArbitrationProxy(0).receiveArbitrationAcknowledgement.selector;
        bytes memory data = abi.encodeWithSelector(selector, _questionID, _requester);
        amb.requireToPassMessage(foreignProxy, data, amb.maxGasPerTx());

        emit RequestAcknowledged(_questionID, _requester);
    }

    /**
     * @notice Handles arbitration request after it has been rejected.
     * @dev This method exists because `receiveArbitrationRequest` is called by the AMB and cannot send messages back to it.
     * Reasons why the request might be rejected:
     *  - The question does not exist
     *  - The question was not answered yet
     *  - The quesiton bond value changed while the arbitration was being requested
     *  - Another request was already accepted
     * @param _questionID The ID of the question.
     * @param _requester The address of the user that requested arbitration.
     */
    function handleRejectedRequest(bytes32 _questionID, address _requester) external override {
        Request storage request = requests[_questionID][_requester];
        require(request.status == Status.Rejected, "Invalid request status");

        // At this point, only the request.status is set, simply reseting the status to Status.None is enough.
        request.status = Status.None;

        bytes4 selector = IForeignArbitrationProxy(0).receiveArbitrationCancelation.selector;
        bytes memory data = abi.encodeWithSelector(selector, _questionID, _requester);
        amb.requireToPassMessage(foreignProxy, data, amb.maxGasPerTx());

        emit RequestCanceled(_questionID, _requester);
    }

    /**
     * @notice Receives a failed attempt to request arbitration. TRUSTED.
     * @dev Currently this can happen only if the arbitration cost increased.
     * @param _questionID The ID of the question.
     * @param _requester The address of the user that requested arbitration.
     */
    function receiveArbitrationFailure(bytes32 _questionID, address _requester) external override onlyForeignProxy {
        Request storage request = requests[_questionID][_requester];
        require(request.status == Status.AwaitingRuling, "Invalid request status");

        // At this point, only the request.status is set, simply reseting the status to Status.None is enough.
        request.status = Status.None;

        realitio.cancelArbitration(_questionID);

        emit ArbitrationFailed(_questionID, _requester);
    }

    /**
     * @notice Receives the answer to a specified question. TRUSTED.
     * @param _questionID The ID of the question.
     * @param _answer The answer from the arbitrator.
     */
    function receiveArbitrationAnswer(bytes32 _questionID, bytes32 _answer) external override onlyForeignProxy {
        address requester = questionIDToRequester[_questionID];
        Request storage request = requests[_questionID][requester];
        require(request.status == Status.AwaitingRuling, "Invalid request status");

        request.status = Status.Ruled;
        request.arbitratorAnswer = _answer;

        emit ArbitratorAnswered(_questionID, _answer);
    }

    /**
     * @notice Reports the answer provided by the arbitrator to a specified question.
     * @dev The Realitio contract validates the input parameters passed to this method,
     * so making this publicly accessible is safe.
     * @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 _lastAnswerer The last answerer to the question in the Realitio contract.
     */
    function reportArbitrationAnswer(
        bytes32 _questionID,
        bytes32 _lastHistoryHash,
        bytes32 _lastAnswerOrCommitmentID,
        address _lastAnswerer
    ) external {
        address requester = questionIDToRequester[_questionID];
        Request storage request = requests[_questionID][requester];
        require(request.status == Status.Ruled, "Arbitrator has not ruled yet");

        realitio.assignWinnerAndSubmitAnswerByArbitrator(
            _questionID,
            request.arbitratorAnswer,
            requester,
            _lastHistoryHash,
            _lastAnswerOrCommitmentID,
            _lastAnswerer
        );

        request.status = Status.Finished;

        emit ArbitrationFinished(_questionID);
    }
}

Contract ABI

[{"inputs":[{"internalType":"contract IAMB","name":"_amb","type":"address"},{"internalType":"address","name":"_foreignProxy","type":"address"},{"internalType":"bytes32","name":"_foreignChainId","type":"bytes32"},{"internalType":"contract RealitioInterface","name":"_realitio","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"indexed":true,"internalType":"address","name":"_requester","type":"address"}],"name":"ArbitrationFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_questionID","type":"bytes32"}],"name":"ArbitrationFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"_answer","type":"bytes32"}],"name":"ArbitratorAnswered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"indexed":true,"internalType":"address","name":"_requester","type":"address"}],"name":"RequestAcknowledged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"indexed":true,"internalType":"address","name":"_requester","type":"address"}],"name":"RequestCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"indexed":true,"internalType":"address","name":"_requester","type":"address"},{"indexed":false,"internalType":"uint256","name":"_maxPrevious","type":"uint256"}],"name":"RequestNotified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"indexed":true,"internalType":"address","name":"_requester","type":"address"},{"indexed":false,"internalType":"uint256","name":"_maxPrevious","type":"uint256"},{"indexed":false,"internalType":"string","name":"_reason","type":"string"}],"name":"RequestRejected","type":"event"},{"inputs":[],"name":"amb","outputs":[{"internalType":"contract IAMB","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"foreignChainId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"foreignProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"internalType":"address","name":"_requester","type":"address"}],"name":"handleNotifiedRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"internalType":"address","name":"_requester","type":"address"}],"name":"handleRejectedRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"metadata","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"questionIDToRequester","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"realitio","outputs":[{"internalType":"contract RealitioInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"internalType":"bytes32","name":"_answer","type":"bytes32"}],"name":"receiveArbitrationAnswer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"internalType":"address","name":"_requester","type":"address"}],"name":"receiveArbitrationFailure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"internalType":"address","name":"_requester","type":"address"},{"internalType":"uint256","name":"_maxPrevious","type":"uint256"}],"name":"receiveArbitrationRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_questionID","type":"bytes32"},{"internalType":"bytes32","name":"_lastHistoryHash","type":"bytes32"},{"internalType":"bytes32","name":"_lastAnswerOrCommitmentID","type":"bytes32"},{"internalType":"address","name":"_lastAnswerer","type":"address"}],"name":"reportArbitrationAnswer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"name":"requests","outputs":[{"internalType":"enum RealitioHomeArbitrationProxy.Status","name":"status","type":"uint8"},{"internalType":"bytes32","name":"arbitratorAnswer","type":"bytes32"}],"stateMutability":"view","type":"function"}]

61010060405234801561001157600080fd5b506040516119033803806119038339818101604052608081101561003457600080fd5b508051602082015160408301516060938401516001600160601b031993851b841660a05291841b831660c05260e05290911b1660805260805160601c60a05160601c60c05160601c60e0516117ed610116600039806107e852806108a05280610f15528061143952508061051e528061065452806109955280610d11528061100a528061152e5250806103255280610629528061083952806108c152806109bf5280610ce65280610eae5280610f36528061103452806113d2528061145a52806115585250806103f3528061080c5280610b40528061118d52506117ed6000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806395e088fc1161008c578063c510faf711610066578063c510faf71461024e578063c77cccc9146102a2578063ccd6e8d2146102ce578063d75a86e014610300576100cf565b806395e088fc14610200578063bc8802a21461021a578063bf6569e014610222576100cf565b80631062b39a146100d45780631865fed1146100f8578063241a9f8214610115578063392f37e91461014f5780636e190f17146101cc57806391602fd7146101d4575b600080fd5b6100dc610323565b604080516001600160a01b039092168252519081900360200190f35b6100dc6004803603602081101561010e57600080fd5b5035610347565b61014d6004803603608081101561012b57600080fd5b50803590602081013590604081013590606001356001600160a01b0316610362565b005b6101576104eb565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610191578181015183820152602001610179565b50505050905090810190601f1680156101be5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100dc61051c565b61014d600480360360408110156101ea57600080fd5b50803590602001356001600160a01b0316610540565b6102086107e6565b60408051918252519081900360200190f35b6100dc61080a565b61014d6004803603604081101561023857600080fd5b50803590602001356001600160a01b031661082e565b61027a6004803603604081101561026457600080fd5b50803590602001356001600160a01b0316610bda565b6040518083600581111561028a57fe5b81526020018281526020019250505060405180910390f35b61014d600480360360408110156102b857600080fd5b50803590602001356001600160a01b0316610c01565b61014d600480360360608110156102e457600080fd5b508035906001600160a01b036020820135169060400135610ea3565b61014d6004803603604081101561031657600080fd5b50803590602001356113c7565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602052600090815260409020546001600160a01b031681565b6000848152600160209081526040808320548383528184206001600160a01b0390911680855292529091206004815460ff16600581111561039f57fe5b146103f1576040805162461bcd60e51b815260206004820152601c60248201527f41726269747261746f7220686173206e6f742072756c65642079657400000000604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d44e293c878360010154858989896040518763ffffffff1660e01b815260040180878152602001868152602001856001600160a01b03168152602001848152602001838152602001826001600160a01b031681526020019650505050505050600060405180830381600087803b15801561049557600080fd5b505af11580156104a9573d6000803e3d6000fd5b5050825460ff19166005178355505060405186907f2abf2fd86256e4607561adae782a4853682b6c0b976995a9a45c5fc3a175738690600090a2505050505050565b604051806040016040528060158152602001747b22666f726569676e50726f7879223a747275657d60581b81525081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000828152602081815260408083206001600160a01b038516845290915290206002815460ff16600581111561057257fe5b146105bd576040805162461bcd60e51b8152602060048201526016602482015275496e76616c696420726571756573742073746174757360501b604482015290519081900360640190fd5b805460ff1916600317815560408051602481018590526001600160a01b0384811660448084019190915283518084039091018152606490920183526020808301805163e742e2ed60e01b6001600160e01b039091168117909152845163e5789d0360e01b8152945190947f00000000000000000000000000000000000000000000000000000000000000009093169263dc8601b3927f0000000000000000000000000000000000000000000000000000000000000000928692869263e5789d0392600480840193829003018186803b15801561069857600080fd5b505afa1580156106ac573d6000803e3d6000fd5b505050506040513d60208110156106c257600080fd5b50516040516001600160e01b031960e086901b1681526001600160a01b038416600482019081526044820183905260606024830190815284516064840152845191929091608490910190602086019080838360005b8381101561072f578181015183820152602001610717565b50505050905090810190601f16801561075c5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b15801561077d57600080fd5b505af1158015610791573d6000803e3d6000fd5b505050506040513d60208110156107a757600080fd5b50506040516001600160a01b0385169086907fff09615c531ab8799ea1c67a0952ddbef1c864ef91d390995d0dc07656f4210f90600090a35050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461089e576040805162461bcd60e51b815260206004820152601060248201526f13db9b1e4810535088185b1b1bddd95960821b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639e307dff6040518163ffffffff1660e01b815260040160206040518083038186803b15801561091857600080fd5b505afa15801561092c573d6000803e3d6000fd5b505050506040513d602081101561094257600080fd5b505114610993576040805162461bcd60e51b815260206004820152601a60248201527913db9b1e48199bdc995a59db8818da185a5b88185b1b1bddd95960321b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d67bdd256040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1657600080fd5b505afa158015610a2a573d6000803e3d6000fd5b505050506040513d6020811015610a4057600080fd5b50516001600160a01b031614610a9a576040805162461bcd60e51b815260206004820152601a60248201527913db9b1e48199bdc995a59db881c1c9bde1e48185b1b1bddd95960321b604482015290519081900360640190fd5b6000828152602081815260408083206001600160a01b038516845290915290206003815460ff166005811115610acc57fe5b14610b17576040805162461bcd60e51b8152602060048201526016602482015275496e76616c696420726571756573742073746174757360501b604482015290519081900360640190fd5b805460ff1916815560408051630ebbdd2b60e41b81526004810185905290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163ebbdd2b091602480830192600092919082900301818387803b158015610b8757600080fd5b505af1158015610b9b573d6000803e3d6000fd5b50506040516001600160a01b03851692508591507f9beda0c81abc1c65da7685f113195974dfddb781dfde6263e5a1b13a5356ffad90600090a3505050565b60006020818152928152604080822090935290815220805460019091015460ff9091169082565b6000828152602081815260408083206001600160a01b038516845290915290206001815460ff166005811115610c3357fe5b14610c7e576040805162461bcd60e51b8152602060048201526016602482015275496e76616c696420726571756573742073746174757360501b604482015290519081900360640190fd5b805460ff1916815560408051602481018590526001600160a01b038481166044808401919091528351808403909101815260649092018352602080830180516001600160e01b03166317c4df9160e31b908117909152845163e5789d0360e01b8152945190947f00000000000000000000000000000000000000000000000000000000000000009093169263dc8601b3927f0000000000000000000000000000000000000000000000000000000000000000928692869263e5789d0392600480840193829003018186803b158015610d5557600080fd5b505afa158015610d69573d6000803e3d6000fd5b505050506040513d6020811015610d7f57600080fd5b50516040516001600160e01b031960e086901b1681526001600160a01b038416600482019081526044820183905260606024830190815284516064840152845191929091608490910190602086019080838360005b83811015610dec578181015183820152602001610dd4565b50505050905090810190601f168015610e195780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b158015610e3a57600080fd5b505af1158015610e4e573d6000803e3d6000fd5b505050506040513d6020811015610e6457600080fd5b50506040516001600160a01b0385169086907ff313a768599b60b7f8aedb7757d867d09463365b79b55b86ed3c961e6da5a24990600090a35050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610f13576040805162461bcd60e51b815260206004820152601060248201526f13db9b1e4810535088185b1b1bddd95960821b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639e307dff6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8d57600080fd5b505afa158015610fa1573d6000803e3d6000fd5b505050506040513d6020811015610fb757600080fd5b505114611008576040805162461bcd60e51b815260206004820152601a60248201527913db9b1e48199bdc995a59db8818da185a5b88185b1b1bddd95960321b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d67bdd256040518163ffffffff1660e01b815260040160206040518083038186803b15801561108b57600080fd5b505afa15801561109f573d6000803e3d6000fd5b505050506040513d60208110156110b557600080fd5b50516001600160a01b03161461110f576040805162461bcd60e51b815260206004820152601a60248201527913db9b1e48199bdc995a59db881c1c9bde1e48185b1b1bddd95960321b604482015290519081900360640190fd5b6000838152602081815260408083206001600160a01b0386168452909152812090815460ff16600581111561114057fe5b1461118b576040805162461bcd60e51b81526020600482015260166024820152755265717565737420616c72656164792065786973747360501b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f6a94ecb8585856040518463ffffffff1660e01b815260040180848152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b15801561120a57600080fd5b505af192505050801561121b575060015b61135257611227611711565b8061123257506112f3565b815460ff1916600117825560408051848152602080820183815284519383019390935283516001600160a01b0388169389937ff677e762f2ddc710deec335dd0cfa8a65cc9c9c351b268243be8629f2e8d1b5f93899388939160608401919085019080838360005b838110156112b257818101518382015260200161129a565b50505050905090810190601f1680156112df5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35061134d565b805460ff19166001178155604080518381526020810182905260008183015290516001600160a01b0385169186917ff677e762f2ddc710deec335dd0cfa8a65cc9c9c351b268243be8629f2e8d1b5f916060908290030190a35b6113c1565b805460ff1916600217815560008481526001602090815260409182902080546001600160a01b0387166001600160a01b0319909116811790915582518581529251909287927ff56e18fc84dbd66db78337b5bd0973943fa70c9b52243a540bdac79274f6682d92918290030190a35b50505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611437576040805162461bcd60e51b815260206004820152601060248201526f13db9b1e4810535088185b1b1bddd95960821b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639e307dff6040518163ffffffff1660e01b815260040160206040518083038186803b1580156114b157600080fd5b505afa1580156114c5573d6000803e3d6000fd5b505050506040513d60208110156114db57600080fd5b50511461152c576040805162461bcd60e51b815260206004820152601a60248201527913db9b1e48199bdc995a59db8818da185a5b88185b1b1bddd95960321b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d67bdd256040518163ffffffff1660e01b815260040160206040518083038186803b1580156115af57600080fd5b505afa1580156115c3573d6000803e3d6000fd5b505050506040513d60208110156115d957600080fd5b50516001600160a01b031614611633576040805162461bcd60e51b815260206004820152601a60248201527913db9b1e48199bdc995a59db881c1c9bde1e48185b1b1bddd95960321b604482015290519081900360640190fd5b6000828152600160209081526040808320548383528184206001600160a01b0390911680855292529091206003815460ff16600581111561167057fe5b146116bb576040805162461bcd60e51b8152602060048201526016602482015275496e76616c696420726571756573742073746174757360501b604482015290519081900360640190fd5b8054600460ff199091161781556001810183905560408051848152905185917f1813d15d8cef51cff8bbd419a8e13e0655c1babea320dea4174d5e7bc40c4294919081900360200190a250505050565b60e01c90565b600060443d1015611721576117b4565b600481823e6308c379a0611735825161170b565b1461173f576117b4565b6040513d600319016004823e80513d67ffffffffffffffff816024840111818411171561176f57505050506117b4565b8284019250825191508082111561178957505050506117b4565b503d830160208284010111156117a1575050506117b4565b601f01601f191681016020016040529150505b9056fea26469706673582212209eb28174838a2b0b1094dcd911ccd233a3c398d7f3cff9b9f5025853b2c6257a64736f6c6343000706003300000000000000000000000075df5af045d91108662d8080fd1fefad6aa0bb590000000000000000000000002f0895732bfacdcf2fdb19962fe609d0da695f210000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e78996a233895be74a66f451f1019ca9734205cc

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000075df5af045d91108662d8080fd1fefad6aa0bb590000000000000000000000002f0895732bfacdcf2fdb19962fe609d0da695f210000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e78996a233895be74a66f451f1019ca9734205cc

-----Decoded View---------------
Arg [0] : _amb (address): 0x75df5af045d91108662d8080fd1fefad6aa0bb59
Arg [1] : _foreignProxy (address): 0x2f0895732bfacdcf2fdb19962fe609d0da695f21
Arg [2] : _foreignChainId (bytes32): 0x0000000000000000000000000000000000000000000000000000000000000001
Arg [3] : _realitio (address): 0xe78996a233895be74a66f451f1019ca9734205cc

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000075df5af045d91108662d8080fd1fefad6aa0bb59
Arg [1] : 0000000000000000000000002f0895732bfacdcf2fdb19962fe609d0da695f21
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [3] : 000000000000000000000000e78996a233895be74a66f451f1019ca9734205cc


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.