Contract 0x46038969D7DC0b17BC72137D07b4eDe43859DA45 4

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x76f6b78021f2f67f93e96a7de7eca673d1ece121fa4f4bb909d1a113303e97e20x60a06040261134252023-01-23 19:29:0014 days 15 hrs ago0x51edb9cc0a86a32870753e4de2c363aefcc25d8c IN  Create: Governance0 xDAI0.005289940524
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Governance

Compiler Version
v0.8.3+commit.8d00100c

Optimization Enabled:
Yes with 300 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : Governance.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;

import "./interfaces/IOracle.sol";
import "./interfaces/IERC20.sol";
import "usingtellor/contracts/UsingTellor.sol";

/**
 @author Tellor Inc.
 @title Governance
 @dev This is a governance contract to be used with TellorFlex. It handles disputing
 * Tellor oracle data and voting on those disputes
*/
contract Governance is UsingTellor {
    // Storage
    IOracle public oracle; // Tellor oracle contract
    IERC20 public token; // token used for dispute fees, same as reporter staking token
    address public oracleAddress; //tellorFlex address
    address public teamMultisig; // address of team multisig wallet, one of four stakeholder groups
    uint256 public voteCount; // total number of votes initiated
    bytes32 public autopayAddrsQueryId =
        keccak256(abi.encode("AutopayAddresses", abi.encode(bytes("")))); // query id for autopay addresses array
    mapping(uint256 => Dispute) private disputeInfo; // mapping of dispute IDs to the details of the dispute
    mapping(bytes32 => uint256) private openDisputesOnId; // mapping of a query ID to the number of disputes on that query ID
    mapping(uint256 => Vote) private voteInfo; // mapping of dispute IDs to the details of the vote
    mapping(bytes32 => uint256[]) private voteRounds; // mapping of vote identifier hashes to an array of dispute IDs
    mapping(address => uint256) private voteTallyByAddress; // mapping of addresses to the number of votes they have cast
    mapping(address => uint256[]) private disputeIdsByReporter; // mapping of reporter addresses to an array of dispute IDs

    enum VoteResult {
        FAILED,
        PASSED,
        INVALID
    } // status of a potential vote

    // Structs
    struct Dispute {
        bytes32 queryId; // query ID of disputed value
        uint256 timestamp; // timestamp of disputed value
        bytes value; // disputed value
        address disputedReporter; // reporter who submitted the disputed value
        uint256 slashedAmount; // amount of tokens slashed from reporter
    }

    struct Tally {
        uint256 doesSupport; // number of votes in favor
        uint256 against; // number of votes against
        uint256 invalidQuery; // number of votes for invalid
    }

    struct Vote {
        bytes32 identifierHash; // identifier hash of the vote
        uint256 voteRound; // the round of voting on a given dispute or proposal
        uint256 startDate; // timestamp of when vote was initiated
        uint256 blockNumber; // block number of when vote was initiated
        uint256 fee; // fee paid to initiate the vote round
        uint256 tallyDate; // timestamp of when the votes were tallied
        Tally tokenholders; // vote tally of tokenholders
        Tally users; // vote tally of users
        Tally reporters; // vote tally of reporters
        Tally teamMultisig; // vote tally of teamMultisig
        bool executed; // boolean of whether the vote was executed
        VoteResult result; // VoteResult after votes were tallied
        address initiator; // address which initiated dispute/proposal
        mapping(address => bool) voted; // mapping of address to whether or not they voted
    }

    // Events
    event NewDispute(
        uint256 _disputeId,
        bytes32 _queryId,
        uint256 _timestamp,
        address _reporter
    ); // Emitted when a new dispute is opened

    event Voted(
        uint256 _disputeId,
        bool _supports,
        address _voter,
        bool _invalidQuery
    ); // Emitted when an address casts their vote
    event VoteExecuted(uint256 _disputeId, VoteResult _result); // Emitted when a vote is executed
    event VoteTallied(
        uint256 _disputeId,
        VoteResult _result,
        address _initiator,
        address _reporter
    ); // Emitted when all casting for a vote is tallied

    /**
     * @dev Initializes contract parameters
     * @param _tellor address of tellor oracle contract to be governed
     * @param _teamMultisig address of tellor team multisig, one of four voting
     * stakeholder groups
     */
    constructor(address payable _tellor, address _teamMultisig)
        UsingTellor(_tellor)
    {
        oracle = IOracle(_tellor);
        token = IERC20(oracle.getTokenAddress());
        oracleAddress = _tellor;
        teamMultisig = _teamMultisig;
    }

    /**
     * @dev Initializes a dispute/vote in the system
     * @param _queryId being disputed
     * @param _timestamp being disputed
     */
    function beginDispute(bytes32 _queryId, uint256 _timestamp) external {
        // Ensure value actually exists
        require(
            oracle.getBlockNumberByTimestamp(_queryId, _timestamp) != 0,
            "no value exists at given timestamp"
        );
        bytes32 _hash = keccak256(abi.encodePacked(_queryId, _timestamp));
        // Push new vote round
        uint256 _disputeId = voteCount + 1;
        uint256[] storage _voteRounds = voteRounds[_hash];
        _voteRounds.push(_disputeId);

        // Create new vote and dispute
        Vote storage _thisVote = voteInfo[_disputeId];
        Dispute storage _thisDispute = disputeInfo[_disputeId];

        // Initialize dispute information - query ID, timestamp, value, etc.
        _thisDispute.queryId = _queryId;
        _thisDispute.timestamp = _timestamp;
        _thisDispute.disputedReporter = oracle.getReporterByTimestamp(
            _queryId,
            _timestamp
        );
        // Initialize vote information - hash, initiator, block number, etc.
        _thisVote.identifierHash = _hash;
        _thisVote.initiator = msg.sender;
        _thisVote.blockNumber = block.number;
        _thisVote.startDate = block.timestamp;
        _thisVote.voteRound = _voteRounds.length;
        disputeIdsByReporter[_thisDispute.disputedReporter].push(_disputeId);
        uint256 _disputeFee = getDisputeFee();
        if (_voteRounds.length == 1) {
            require(
                block.timestamp - _timestamp < 12 hours,
                "Dispute must be started within reporting lock time"
            );
            openDisputesOnId[_queryId]++;
            // calculate dispute fee based on number of open disputes on query ID
            _disputeFee = _disputeFee * 2**(openDisputesOnId[_queryId] - 1);
            // slash a single stakeAmount from reporter
            _thisDispute.slashedAmount = oracle.slashReporter(_thisDispute.disputedReporter, address(this));
            _thisDispute.value = oracle.retrieveData(_queryId, _timestamp);
            oracle.removeValue(_queryId, _timestamp);
        } else {
            uint256 _prevId = _voteRounds[_voteRounds.length - 2];
            require(
                block.timestamp - voteInfo[_prevId].tallyDate < 1 days,
                "New dispute round must be started within a day"
            );
            _disputeFee = _disputeFee * 2**(_voteRounds.length - 1);
            _thisDispute.slashedAmount = disputeInfo[_voteRounds[0]].slashedAmount;
            _thisDispute.value = disputeInfo[_voteRounds[0]].value;
        }
        if (_disputeFee > oracle.getStakeAmount()) {
          _disputeFee = oracle.getStakeAmount();
        }
        _thisVote.fee = _disputeFee;
        voteCount++;
        require(
            token.transferFrom(msg.sender, address(this), _disputeFee),
            "Fee must be paid"
        ); // This is the dispute fee. Returned if dispute passes
        emit NewDispute(
            _disputeId,
            _queryId,
            _timestamp,
            _thisDispute.disputedReporter
        );
    }

    /**
     * @dev Executes vote and transfers corresponding balances to initiator/reporter
     * @param _disputeId is the ID of the vote being executed
     */
    function executeVote(uint256 _disputeId) external {
        // Ensure validity of vote ID, vote has been executed, and vote must be tallied
        Vote storage _thisVote = voteInfo[_disputeId];
        require(_disputeId <= voteCount && _disputeId > 0, "Dispute ID must be valid");
        require(!_thisVote.executed, "Vote has already been executed");
        require(_thisVote.tallyDate > 0, "Vote must be tallied");
        // Ensure vote must be final vote and that time has to be pass (86400 = 24 * 60 * 60 for seconds in a day)
        require(
            voteRounds[_thisVote.identifierHash].length == _thisVote.voteRound,
            "Must be the final vote"
        );
        //The time  has to pass after the vote is tallied
        require(
            block.timestamp - _thisVote.tallyDate >= 1 days,
            "1 day has to pass after tally to allow for disputes"
        );
        _thisVote.executed = true;
        Dispute storage _thisDispute = disputeInfo[_disputeId];
        openDisputesOnId[_thisDispute.queryId]--;
        uint256 _i;
        uint256 _voteID;
        if (_thisVote.result == VoteResult.PASSED) {
            // If vote is in dispute and passed, iterate through each vote round and transfer the dispute to initiator
            for (
                _i = voteRounds[_thisVote.identifierHash].length;
                _i > 0;
                _i--
            ) {
                _voteID = voteRounds[_thisVote.identifierHash][_i - 1];
                _thisVote = voteInfo[_voteID];
                // If the first vote round, also make sure to transfer the reporter's slashed stake to the initiator
                if (_i == 1) {
                    token.transfer(
                        _thisVote.initiator,
                        _thisDispute.slashedAmount
                    );
                }
                token.transfer(_thisVote.initiator, _thisVote.fee);
            }
        } else if (_thisVote.result == VoteResult.INVALID) {
            // If vote is in dispute and is invalid, iterate through each vote round and transfer the dispute fee to initiator
            for (
                _i = voteRounds[_thisVote.identifierHash].length;
                _i > 0;
                _i--
            ) {
                _voteID = voteRounds[_thisVote.identifierHash][_i - 1];
                _thisVote = voteInfo[_voteID];
                token.transfer(_thisVote.initiator, _thisVote.fee);
            }
            // Transfer slashed tokens back to disputed reporter
            token.transfer(
                _thisDispute.disputedReporter,
                _thisDispute.slashedAmount
            );
        } else if (_thisVote.result == VoteResult.FAILED) {
            // If vote is in dispute and fails, iterate through each vote round and transfer the dispute fee to disputed reporter
            uint256 _reporterReward = 0;
            for (
                _i = voteRounds[_thisVote.identifierHash].length;
                _i > 0;
                _i--
            ) {
                _voteID = voteRounds[_thisVote.identifierHash][_i - 1];
                _thisVote = voteInfo[_voteID];
                _reporterReward += _thisVote.fee;
            }
            _reporterReward += _thisDispute.slashedAmount;
            token.transfer(_thisDispute.disputedReporter, _reporterReward);
        }
        emit VoteExecuted(_disputeId, voteInfo[_disputeId].result);
    }

    /**
     * @dev Tallies the votes and begins the 1 day challenge period
     * @param _disputeId is the dispute id
     */
    function tallyVotes(uint256 _disputeId) external {
        // Ensure vote has not been executed and that vote has not been tallied
        Vote storage _thisVote = voteInfo[_disputeId];
        require(_thisVote.tallyDate == 0, "Vote has already been tallied");
        require(_disputeId <= voteCount && _disputeId > 0, "Vote does not exist");
        // Determine appropriate vote duration dispute round
        // Vote time increases as rounds increase but only up to 6 days (withdrawal period)
        require(
            block.timestamp - _thisVote.startDate >=
                86400 * _thisVote.voteRound ||
                block.timestamp - _thisVote.startDate >= 86400 * 6,
            "Time for voting has not elapsed"
        );
        // Get total votes from each separate stakeholder group.  This will allow
        // normalization so each group's votes can be combined and compared to
        // determine the vote outcome.
        uint256 _tokenVoteSum = _thisVote.tokenholders.doesSupport +
            _thisVote.tokenholders.against +
            _thisVote.tokenholders.invalidQuery;
        uint256 _reportersVoteSum = _thisVote.reporters.doesSupport +
            _thisVote.reporters.against +
            _thisVote.reporters.invalidQuery;
        uint256 _multisigVoteSum = _thisVote.teamMultisig.doesSupport +
            _thisVote.teamMultisig.against +
            _thisVote.teamMultisig.invalidQuery;
        uint256 _usersVoteSum = _thisVote.users.doesSupport +
            _thisVote.users.against +
            _thisVote.users.invalidQuery;
        // Cannot divide by zero
        if (_tokenVoteSum == 0) {
            _tokenVoteSum++;
        }
        if (_reportersVoteSum == 0) {
            _reportersVoteSum++;
        }
        if (_multisigVoteSum == 0) {
            _multisigVoteSum++;
        }
        if (_usersVoteSum == 0) {
            _usersVoteSum++;
        }
        // Normalize and combine each stakeholder group votes
        uint256 _scaledDoesSupport = ((_thisVote.tokenholders.doesSupport *
            1e18) / _tokenVoteSum) +
            ((_thisVote.reporters.doesSupport * 1e18) / _reportersVoteSum) +
            ((_thisVote.teamMultisig.doesSupport * 1e18) / _multisigVoteSum) +
            ((_thisVote.users.doesSupport * 1e18) / _usersVoteSum);
        uint256 _scaledAgainst = ((_thisVote.tokenholders.against * 1e18) /
            _tokenVoteSum) +
            ((_thisVote.reporters.against * 1e18) / _reportersVoteSum) +
            ((_thisVote.teamMultisig.against * 1e18) / _multisigVoteSum) +
            ((_thisVote.users.against * 1e18) / _usersVoteSum);
        uint256 _scaledInvalid = ((_thisVote.tokenholders.invalidQuery * 1e18) /
            _tokenVoteSum) +
            ((_thisVote.reporters.invalidQuery * 1e18) / _reportersVoteSum) +
            ((_thisVote.teamMultisig.invalidQuery * 1e18) / _multisigVoteSum) +
            ((_thisVote.users.invalidQuery * 1e18) / _usersVoteSum);

        // If votes in support outweight the sum of against and invalid, result is passed
        if (_scaledDoesSupport > _scaledAgainst + _scaledInvalid) {
            _thisVote.result = VoteResult.PASSED;
        // If votes in against outweight the sum of support and invalid, result is failed
        } else if (_scaledAgainst > _scaledDoesSupport + _scaledInvalid) {
            _thisVote.result = VoteResult.FAILED;
        // Otherwise, result is invalid
        } else {
            _thisVote.result = VoteResult.INVALID;
        }

        _thisVote.tallyDate = block.timestamp; // Update time vote was tallied
        emit VoteTallied(
            _disputeId,
            _thisVote.result,
            _thisVote.initiator,
            disputeInfo[_disputeId].disputedReporter
        );
    }

    /**
     * @dev Enables the sender address to cast a vote
     * @param _disputeId is the ID of the vote
     * @param _supports is the address's vote: whether or not they support or are against
     * @param _invalidQuery is whether or not the dispute is valid
     */
    function vote(
        uint256 _disputeId,
        bool _supports,
        bool _invalidQuery
    ) public {
        // Ensure that dispute has not been executed and that vote does not exist and is not tallied
        require(_disputeId <= voteCount && _disputeId > 0, "Vote does not exist");
        Vote storage _thisVote = voteInfo[_disputeId];
        require(_thisVote.tallyDate == 0, "Vote has already been tallied");
        require(!_thisVote.voted[msg.sender], "Sender has already voted");
        // Update voting status and increment total queries for support, invalid, or against based on vote
        _thisVote.voted[msg.sender] = true;
        uint256 _tokenBalance = token.balanceOf(msg.sender);
        (, uint256 _stakedBalance, uint256 _lockedBalance, , , , , ) = oracle.getStakerInfo(msg.sender);
        _tokenBalance += _stakedBalance + _lockedBalance;
        if (_invalidQuery) {
            _thisVote.tokenholders.invalidQuery += _tokenBalance;
            _thisVote.reporters.invalidQuery += oracle
                .getReportsSubmittedByAddress(msg.sender);
            _thisVote.users.invalidQuery += _getUserTips(msg.sender);
            if (msg.sender == teamMultisig) {
                _thisVote.teamMultisig.invalidQuery += 1;
            }
        } else if (_supports) {
            _thisVote.tokenholders.doesSupport += _tokenBalance;
            _thisVote.reporters.doesSupport += oracle.getReportsSubmittedByAddress(msg.sender);
            _thisVote.users.doesSupport += _getUserTips(msg.sender);
            if (msg.sender == teamMultisig) {
                _thisVote.teamMultisig.doesSupport += 1;
            }
        } else {
            _thisVote.tokenholders.against += _tokenBalance;
            _thisVote.reporters.against += oracle.getReportsSubmittedByAddress(
                msg.sender
            );
            _thisVote.users.against += _getUserTips(msg.sender);
            if (msg.sender == teamMultisig) {
                _thisVote.teamMultisig.against += 1;
            }
        }
        voteTallyByAddress[msg.sender]++;
        emit Voted(_disputeId, _supports, msg.sender, _invalidQuery);
    }

    /**
     * @dev Enables the sender address to cast votes for multiple disputes
     * @param _disputeIds is an array of vote IDs
     * @param _supports is an array of the address's votes: whether or not they support or are against
     * @param _invalidQuery is array of whether or not the dispute is valid
     */
    function voteOnMultipleDisputes(
        uint256[] memory _disputeIds, 
        bool[] memory _supports, 
        bool[] memory _invalidQuery
    ) external {
        for (uint256 _i = 0; _i < _disputeIds.length; _i++) {
            vote(_disputeIds[_i], _supports[_i], _invalidQuery[_i]);
        }
    }

    // *****************************************************************************
    // *                                                                           *
    // *                               Getters                                     *
    // *                                                                           *
    // *****************************************************************************

    /**
     * @dev Determines if an address voted for a specific vote
     * @param _disputeId is the ID of the vote
     * @param _voter is the address of the voter to check for
     * @return bool of whether or note the address voted for the specific vote
     */
    function didVote(uint256 _disputeId, address _voter)
        external
        view
        returns (bool)
    {
        return voteInfo[_disputeId].voted[_voter];
    }

    /**
     * @dev Get the latest dispute fee
     */
    function getDisputeFee() public view returns (uint256) {
        return (oracle.getStakeAmount() / 10);
    }


    function getDisputesByReporter(address _reporter) external view returns (uint256[] memory) {
        return disputeIdsByReporter[_reporter];
    }

    /**
     * @dev Returns info on a dispute for a given ID
     * @param _disputeId is the ID of a specific dispute
     * @return bytes32 of the data ID of the dispute
     * @return uint256 of the timestamp of the dispute
     * @return bytes memory of the value being disputed
     * @return address of the reporter being disputed
     */
    function getDisputeInfo(uint256 _disputeId)
        external
        view
        returns (
            bytes32,
            uint256,
            bytes memory,
            address
        )
    {
        Dispute storage _d = disputeInfo[_disputeId];
        return (_d.queryId, _d.timestamp, _d.value, _d.disputedReporter);
    }

    /**
     * @dev Returns the number of open disputes for a specific query ID
     * @param _queryId is the ID of a specific data feed
     * @return uint256 of the number of open disputes for the query ID
     */
    function getOpenDisputesOnId(bytes32 _queryId)
        external
        view
        returns (uint256)
    {
        return openDisputesOnId[_queryId];
    }

    /**
     * @dev Returns the total number of votes
     * @return uint256 of the total number of votes
     */
    function getVoteCount() external view returns (uint256) {
        return voteCount;
    }

    /**
     * @dev Returns info on a vote for a given vote ID
     * @param _disputeId is the ID of a specific vote
     * @return bytes32 identifier hash of the vote
     * @return uint256[17] memory of the pertinent round info (vote rounds, start date, fee, etc.)
     * @return bool memory of both whether or not the vote was executed
     * @return VoteResult result of the vote
     * @return address memory of the vote initiator
     */
    function getVoteInfo(uint256 _disputeId)
        external
        view
        returns (
            bytes32,
            uint256[17] memory,
            bool,
            VoteResult,
            address
        )
    {
        Vote storage _v = voteInfo[_disputeId];
        return (
            _v.identifierHash,
            [
                _v.voteRound,
                _v.startDate,
                _v.blockNumber,
                _v.fee,
                _v.tallyDate,
                _v.tokenholders.doesSupport,
                _v.tokenholders.against,
                _v.tokenholders.invalidQuery,
                _v.users.doesSupport,
                _v.users.against,
                _v.users.invalidQuery,
                _v.reporters.doesSupport,
                _v.reporters.against,
                _v.reporters.invalidQuery,
                _v.teamMultisig.doesSupport,
                _v.teamMultisig.against,
                _v.teamMultisig.invalidQuery
            ],
            _v.executed,
            _v.result,
            _v.initiator
        );
    }

    /**
     * @dev Returns an array of voting rounds for a given vote
     * @param _hash is the identifier hash for a vote
     * @return uint256[] memory dispute IDs of the vote rounds
     */
    function getVoteRounds(bytes32 _hash)
        external
        view
        returns (uint256[] memory)
    {
        return voteRounds[_hash];
    }

    /**
     * @dev Returns the total number of votes cast by an address
     * @param _voter is the address of the voter to check for
     * @return uint256 of the total number of votes cast by the voter
     */
    function getVoteTallyByAddress(address _voter)
        external
        view
        returns (uint256)
    {
        return voteTallyByAddress[_voter];
    }

    // Internal
    /**
     * @dev Retrieves total tips contributed to autopay by a given address
     * @param _user address of the user to check the tip count for
     * @return _userTipTally uint256 of total tips contributed to autopay by the address
     */
    function _getUserTips(address _user) internal returns (uint256 _userTipTally) {
        // get autopay addresses array from oracle
        (bytes memory _autopayAddrsBytes, uint256 _timestamp) = getDataBefore(
            autopayAddrsQueryId,
            block.timestamp - 12 hours
        );
        if (_timestamp > 0) {
            address[] memory _autopayAddrs = abi.decode(
                _autopayAddrsBytes,
                (address[])
            );
            // iterate through autopay addresses retrieve tips by user address
            for (uint256 _i = 0; _i < _autopayAddrs.length; _i++) {
                (bool _success, bytes memory _returnData) = _autopayAddrs[_i]
                    .call(
                        abi.encodeWithSignature(
                            "getTipsByAddress(address)",
                            _user
                        )
                    );
                if (_success) {
                    _userTipTally += abi.decode(_returnData, (uint256));
                }
            }
        }
    }
}

File 2 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);

    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);
}

File 3 of 7 : IOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;

/**
 @author Tellor Inc.
 @title TellorFlex
 @dev This is a streamlined Tellor oracle system which handles staking, reporting,
 * slashing, and user data getters in one contract. This contract is controlled
 * by a single address known as 'governance', which could be an externally owned
 * account or a contract, allowing for a flexible, modular design.
*/
interface IOracle {
    /**
     * @dev Removes a value from the oracle.
     * Note: this function is only callable by the Governance contract.
     * @param _queryId is ID of the specific data feed
     * @param _timestamp is the timestamp of the data value to remove
     */
    function removeValue(bytes32 _queryId, uint256 _timestamp) external;

    /**
     * @dev Slashes a reporter and transfers their stake amount to the given recipient
     * Note: this function is only callable by the governance address.
     * @param _reporter is the address of the reporter being slashed
     * @param _recipient is the address receiving the reporter's stake
     * @return uint256 amount of token slashed and sent to recipient address
     */
    function slashReporter(address _reporter, address _recipient)
        external
        returns (uint256);

    // *****************************************************************************
    // *                                                                           *
    // *                               Getters                                     *
    // *                                                                           *
    // *****************************************************************************

    /**
     * @dev Returns the block number at a given timestamp
     * @param _queryId is ID of the specific data feed
     * @param _timestamp is the timestamp to find the corresponding block number for
     * @return uint256 block number of the timestamp for the given data ID
     */
    function getBlockNumberByTimestamp(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (uint256);

    /**
     * @dev Returns the address of the reporter who submitted a value for a data ID at a specific time
     * @param _queryId is ID of the specific data feed
     * @param _timestamp is the timestamp to find a corresponding reporter for
     * @return address of the reporter who reported the value for the data ID at the given timestamp
     */
    function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (address);

    /**
     * @dev Returns the number of values submitted by a specific reporter address
     * @param _reporter is the address of a reporter
     * @return uint256 of the number of values submitted by the given reporter
     */
    function getReportsSubmittedByAddress(address _reporter)
        external
        view
        returns (uint256);

    /**
     * @dev Returns amount required to report oracle values
     * @return uint256 stake amount
     */
    function getStakeAmount() external view returns (uint256);

    /**
     * @dev Allows users to retrieve all information about a staker
     * @param _stakerAddress address of staker inquiring about
     * @return uint startDate of staking
     * @return uint current amount staked
     * @return uint current amount locked for withdrawal
     * @return uint reward debt used to calculate staking rewards
     * @return uint reporter's last reported timestamp
     * @return uint total number of reports submitted by reporter
     * @return uint governance vote count when first staked
     * @return uint number of votes cast by staker when first staked
     */
    function getStakerInfo(address _stakerAddress)
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            uint256
        );

    /**
     * @dev Retrieves the latest value for the queryId before the specified timestamp
     * @param _queryId is the queryId to look up the value for
     * @param _timestamp before which to search for latest value
     * @return _ifRetrieve bool true if able to retrieve a non-zero value
     * @return _value the value retrieved
     * @return _timestampRetrieved the value's timestamp
     */
    function getDataBefore(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (
            bool _ifRetrieve,
            bytes memory _value,
            uint256 _timestampRetrieved
        );

    /**
     * @dev Returns the address of the token used for staking
     * @return address of the token used for staking
     */
    function getTokenAddress() external view returns (address);

    /**
     * @dev Retrieve value from oracle based on timestamp
     * @param _queryId being requested
     * @param _timestamp to retrieve data/value from
     * @return bytes value for timestamp submitted
     */
    function retrieveData(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (bytes memory);
}

File 4 of 7 : IERC2362.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/**
    * @dev EIP2362 Interface for pull oracles
    * https://github.com/tellor-io/EIP-2362
*/
interface IERC2362
{
	/**
	 * @dev Exposed function pertaining to EIP standards
	 * @param _id bytes32 ID of the query
	 * @return int,uint,uint returns the value, timestamp, and status code of query
	 */
	function valueFor(bytes32 _id) external view returns(int256,uint256,uint256);
}

File 5 of 7 : IMappingContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IMappingContract{
    function getTellorID(bytes32 _id) external view returns(bytes32);
}

File 6 of 7 : ITellor.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface ITellor {
    //Controller
    function addresses(bytes32) external view returns (address);

    function uints(bytes32) external view returns (uint256);

    function burn(uint256 _amount) external;

    function changeDeity(address _newDeity) external;

    function changeOwner(address _newOwner) external;
    function changeUint(bytes32 _target, uint256 _amount) external;

    function migrate() external;

    function mint(address _reciever, uint256 _amount) external;

    function init() external;

    function getAllDisputeVars(uint256 _disputeId)
        external
        view
        returns (
            bytes32,
            bool,
            bool,
            bool,
            address,
            address,
            address,
            uint256[9] memory,
            int256
        );

    function getDisputeIdByDisputeHash(bytes32 _hash)
        external
        view
        returns (uint256);

    function getDisputeUintVars(uint256 _disputeId, bytes32 _data)
        external
        view
        returns (uint256);

    function getLastNewValueById(uint256 _requestId)
        external
        view
        returns (uint256, bool);

    function retrieveData(uint256 _requestId, uint256 _timestamp)
        external
        view
        returns (uint256);

    function getNewValueCountbyRequestId(uint256 _requestId)
        external
        view
        returns (uint256);

    function getAddressVars(bytes32 _data) external view returns (address);

    function getUintVar(bytes32 _data) external view returns (uint256);

    function totalSupply() external view returns (uint256);

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function isMigrated(address _addy) external view returns (bool);

    function allowance(address _user, address _spender)
        external
        view
        returns (uint256);

    function allowedToTrade(address _user, uint256 _amount)
        external
        view
        returns (bool);

    function approve(address _spender, uint256 _amount) external returns (bool);

    function approveAndTransferFrom(
        address _from,
        address _to,
        uint256 _amount
    ) external returns (bool);

    function balanceOf(address _user) external view returns (uint256);

    function balanceOfAt(address _user, uint256 _blockNumber)
        external
        view
        returns (uint256);

    function transfer(address _to, uint256 _amount)
        external
        returns (bool success);

    function transferFrom(
        address _from,
        address _to,
        uint256 _amount
    ) external returns (bool success);

    function depositStake() external;

    function requestStakingWithdraw() external;

    function withdrawStake() external;

    function changeStakingStatus(address _reporter, uint256 _status) external;

    function slashReporter(address _reporter, address _disputer) external;

    function getStakerInfo(address _staker)
        external
        view
        returns (uint256, uint256);

    function getTimestampbyRequestIDandIndex(uint256 _requestId, uint256 _index)
        external
        view
        returns (uint256);

    function getNewCurrentVariables()
        external
        view
        returns (
            bytes32 _c,
            uint256[5] memory _r,
            uint256 _d,
            uint256 _t
        );

    function getNewValueCountbyQueryId(bytes32 _queryId)
        external
        view
        returns (uint256);

    function getTimestampbyQueryIdandIndex(bytes32 _queryId, uint256 _index)
        external
        view
        returns (uint256);

    function retrieveData(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (bytes memory);

    //Governance
    enum VoteResult {
        FAILED,
        PASSED,
        INVALID
    }

    function setApprovedFunction(bytes4 _func, bool _val) external;

    function beginDispute(bytes32 _queryId, uint256 _timestamp) external;

    function delegate(address _delegate) external;

    function delegateOfAt(address _user, uint256 _blockNumber)
        external
        view
        returns (address);

    function executeVote(uint256 _disputeId) external;

    function proposeVote(
        address _contract,
        bytes4 _function,
        bytes calldata _data,
        uint256 _timestamp
    ) external;

    function tallyVotes(uint256 _disputeId) external;

    function governance() external view returns (address);

    function updateMinDisputeFee() external;

    function verify() external pure returns (uint256);

    function vote(
        uint256 _disputeId,
        bool _supports,
        bool _invalidQuery
    ) external;

    function voteFor(
        address[] calldata _addys,
        uint256 _disputeId,
        bool _supports,
        bool _invalidQuery
    ) external;

    function getDelegateInfo(address _holder)
        external
        view
        returns (address, uint256);

    function isFunctionApproved(bytes4 _func) external view returns (bool);

    function isApprovedGovernanceContract(address _contract)
        external
        returns (bool);

    function getVoteRounds(bytes32 _hash)
        external
        view
        returns (uint256[] memory);

    function getVoteCount() external view returns (uint256);

    function getVoteInfo(uint256 _disputeId)
        external
        view
        returns (
            bytes32,
            uint256[9] memory,
            bool[2] memory,
            VoteResult,
            bytes memory,
            bytes4,
            address[2] memory
        );

    function getDisputeInfo(uint256 _disputeId)
        external
        view
        returns (
            uint256,
            uint256,
            bytes memory,
            address
        );

    function getOpenDisputesOnId(bytes32 _queryId)
        external
        view
        returns (uint256);

    function didVote(uint256 _disputeId, address _voter)
        external
        view
        returns (bool);

    //Oracle
    function getReportTimestampByIndex(bytes32 _queryId, uint256 _index)
        external
        view
        returns (uint256);

    function getValueByTimestamp(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (bytes memory);

    function getBlockNumberByTimestamp(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (uint256);

    function getReportingLock() external view returns (uint256);

    function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (address);

    function reportingLock() external view returns (uint256);

    function removeValue(bytes32 _queryId, uint256 _timestamp) external;
    function getTipsByUser(address _user) external view returns(uint256);
    function tipQuery(bytes32 _queryId, uint256 _tip, bytes memory _queryData) external;
    function submitValue(bytes32 _queryId, bytes calldata _value, uint256 _nonce, bytes memory _queryData) external;
    function burnTips() external;

    function changeReportingLock(uint256 _newReportingLock) external;
    function getReportsSubmittedByAddress(address _reporter) external view returns(uint256);
    function changeTimeBasedReward(uint256 _newTimeBasedReward) external;
    function getReporterLastTimestamp(address _reporter) external view returns(uint256);
    function getTipsById(bytes32 _queryId) external view returns(uint256);
    function getTimeBasedReward() external view returns(uint256);
    function getTimestampCountById(bytes32 _queryId) external view returns(uint256);
    function getTimestampIndexByTimestamp(bytes32 _queryId, uint256 _timestamp) external view returns(uint256);
    function getCurrentReward(bytes32 _queryId) external view returns(uint256, uint256);
    function getCurrentValue(bytes32 _queryId) external view returns(bytes memory);
    function getDataBefore(bytes32 _queryId, uint256 _timestamp) external view returns(bool _ifRetrieve, bytes memory _value, uint256 _timestampRetrieved);
    function getTimeOfLastNewValue() external view returns(uint256);
    function depositStake(uint256 _amount) external;
    function requestStakingWithdraw(uint256 _amount) external;

    //Test functions
    function changeAddressVar(bytes32 _id, address _addy) external;

    //parachute functions
    function killContract() external;

    function migrateFor(address _destination, uint256 _amount) external;

    function rescue51PercentAttack(address _tokenHolder) external;

    function rescueBrokenDataReporting() external;

    function rescueFailedUpdate() external;

    //Tellor 360
    function addStakingRewards(uint256 _amount) external;

    function _sliceUint(bytes memory _b)
        external
        pure
        returns (uint256 _number);

    function claimOneTimeTip(bytes32 _queryId, uint256[] memory _timestamps)
        external;

    function claimTip(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256[] memory _timestamps
    ) external;

    function fee() external view returns (uint256);

    function feedsWithFunding(uint256) external view returns (bytes32);

    function fundFeed(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256 _amount
    ) external;

    function getCurrentFeeds(bytes32 _queryId)
        external
        view
        returns (bytes32[] memory);

    function getCurrentTip(bytes32 _queryId) external view returns (uint256);

    function getDataAfter(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (bytes memory _value, uint256 _timestampRetrieved);

    function getDataFeed(bytes32 _feedId)
        external
        view
        returns (Autopay.FeedDetails memory);

    function getFundedFeeds() external view returns (bytes32[] memory);

    function getFundedQueryIds() external view returns (bytes32[] memory);

    function getIndexForDataAfter(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (bool _found, uint256 _index);

    function getIndexForDataBefore(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (bool _found, uint256 _index);

    function getMultipleValuesBefore(
        bytes32 _queryId,
        uint256 _timestamp,
        uint256 _maxAge,
        uint256 _maxCount
    )
        external
        view
        returns (uint256[] memory _values, uint256[] memory _timestamps);

    function getPastTipByIndex(bytes32 _queryId, uint256 _index)
        external
        view
        returns (Autopay.Tip memory);

    function getPastTipCount(bytes32 _queryId) external view returns (uint256);

    function getPastTips(bytes32 _queryId)
        external
        view
        returns (Autopay.Tip[] memory);

    function getQueryIdFromFeedId(bytes32 _feedId)
        external
        view
        returns (bytes32);

    function getRewardAmount(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256[] memory _timestamps
    ) external view returns (uint256 _cumulativeReward);

    function getRewardClaimedStatus(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256 _timestamp
    ) external view returns (bool);

    function getTipsByAddress(address _user) external view returns (uint256);

    function isInDispute(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (bool);

    function queryIdFromDataFeedId(bytes32) external view returns (bytes32);

    function queryIdsWithFunding(uint256) external view returns (bytes32);

    function queryIdsWithFundingIndex(bytes32) external view returns (uint256);

    function setupDataFeed(
        bytes32 _queryId,
        uint256 _reward,
        uint256 _startTime,
        uint256 _interval,
        uint256 _window,
        uint256 _priceThreshold,
        uint256 _rewardIncreasePerSecond,
        bytes memory _queryData,
        uint256 _amount
    ) external;

    function tellor() external view returns (address);

    function tip(
        bytes32 _queryId,
        uint256 _amount,
        bytes memory _queryData
    ) external;

    function tips(bytes32, uint256)
        external
        view
        returns (uint256 amount, uint256 timestamp);

    function token() external view returns (address);

    function userTipsTotal(address) external view returns (uint256);

    function valueFor(bytes32 _id)
        external
        view
        returns (
            int256 _value,
            uint256 _timestamp,
            uint256 _statusCode
        );
}

interface Autopay {
    struct FeedDetails {
        uint256 reward;
        uint256 balance;
        uint256 startTime;
        uint256 interval;
        uint256 window;
        uint256 priceThreshold;
        uint256 rewardIncreasePerSecond;
        uint256 feedsWithFundingIndex;
    }

    struct Tip {
        uint256 amount;
        uint256 timestamp;
    }
    function getStakeAmount() external view returns(uint256);
    function stakeAmount() external view returns(uint256);
    function token() external view returns(address);
}

File 7 of 7 : UsingTellor.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "./interface/ITellor.sol";
import "./interface/IERC2362.sol";
import "./interface/IMappingContract.sol";

/**
 @author Tellor Inc
 @title UsingTellor
 @dev This contract helps smart contracts read data from Tellor
 */
contract UsingTellor is IERC2362 {
    ITellor public tellor;
    IMappingContract public idMappingContract;

    /*Constructor*/
    /**
     * @dev the constructor sets the oracle address in storage
     * @param _tellor is the Tellor Oracle address
     */
    constructor(address payable _tellor) {
        tellor = ITellor(_tellor);
    }

    /*Getters*/
    /**
     * @dev Retrieves the next value for the queryId after the specified timestamp
     * @param _queryId is the queryId to look up the value for
     * @param _timestamp after which to search for next value
     * @return _value the value retrieved
     * @return _timestampRetrieved the value's timestamp
     */
    function getDataAfter(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (bytes memory _value, uint256 _timestampRetrieved)
    {
        (bool _found, uint256 _index) = getIndexForDataAfter(
            _queryId,
            _timestamp
        );
        if (!_found) {
            return ("", 0);
        }
        _timestampRetrieved = getTimestampbyQueryIdandIndex(_queryId, _index);
        _value = retrieveData(_queryId, _timestampRetrieved);
        return (_value, _timestampRetrieved);
    }

    /**
     * @dev Retrieves the latest value for the queryId before the specified timestamp
     * @param _queryId is the queryId to look up the value for
     * @param _timestamp before which to search for latest value
     * @return _value the value retrieved
     * @return _timestampRetrieved the value's timestamp
     */
    function getDataBefore(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (bytes memory _value, uint256 _timestampRetrieved)
    {
        (, _value, _timestampRetrieved) = tellor.getDataBefore(
            _queryId,
            _timestamp
        );
    }

    /**
     * @dev Retrieves latest array index of data before the specified timestamp for the queryId
     * @param _queryId is the queryId to look up the index for
     * @param _timestamp is the timestamp before which to search for the latest index
     * @return _found whether the index was found
     * @return _index the latest index found before the specified timestamp
     */
    // slither-disable-next-line calls-loop
    function getIndexForDataAfter(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (bool _found, uint256 _index)
    {
        uint256 _count = getNewValueCountbyQueryId(_queryId);
        if (_count == 0) return (false, 0);
        _count--;
        bool _search = true; // perform binary search
        uint256 _middle = 0;
        uint256 _start = 0;
        uint256 _end = _count;
        uint256 _timestampRetrieved;
        // checking boundaries to short-circuit the algorithm
        _timestampRetrieved = getTimestampbyQueryIdandIndex(_queryId, _end);
        if (_timestampRetrieved <= _timestamp) return (false, 0);
        _timestampRetrieved = getTimestampbyQueryIdandIndex(_queryId, _start);
        if (_timestampRetrieved > _timestamp) {
            // candidate found, check for disputes
            _search = false;
        }
        // since the value is within our boundaries, do a binary search
        while (_search) {
            _middle = (_end + _start) / 2;
            _timestampRetrieved = getTimestampbyQueryIdandIndex(
                _queryId,
                _middle
            );
            if (_timestampRetrieved > _timestamp) {
                // get immediate previous value
                uint256 _prevTime = getTimestampbyQueryIdandIndex(
                    _queryId,
                    _middle - 1
                );
                if (_prevTime <= _timestamp) {
                    // candidate found, check for disputes
                    _search = false;
                } else {
                    // look from start to middle -1(prev value)
                    _end = _middle - 1;
                }
            } else {
                // get immediate next value
                uint256 _nextTime = getTimestampbyQueryIdandIndex(
                    _queryId,
                    _middle + 1
                );
                if (_nextTime > _timestamp) {
                    // candidate found, check for disputes
                    _search = false;
                    _middle++;
                    _timestampRetrieved = _nextTime;
                } else {
                    // look from middle + 1(next value) to end
                    _start = _middle + 1;
                }
            }
        }
        // candidate found, check for disputed values
        if (!isInDispute(_queryId, _timestampRetrieved)) {
            // _timestampRetrieved is correct
            return (true, _middle);
        } else {
            // iterate forward until we find a non-disputed value
            while (
                isInDispute(_queryId, _timestampRetrieved) && _middle < _count
            ) {
                _middle++;
                _timestampRetrieved = getTimestampbyQueryIdandIndex(
                    _queryId,
                    _middle
                );
            }
            if (
                _middle == _count && isInDispute(_queryId, _timestampRetrieved)
            ) {
                return (false, 0);
            }
            // _timestampRetrieved is correct
            return (true, _middle);
        }
    }

    /**
     * @dev Retrieves latest array index of data before the specified timestamp for the queryId
     * @param _queryId is the queryId to look up the index for
     * @param _timestamp is the timestamp before which to search for the latest index
     * @return _found whether the index was found
     * @return _index the latest index found before the specified timestamp
     */
    // slither-disable-next-line calls-loop
    function getIndexForDataBefore(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (bool _found, uint256 _index)
    {
        return tellor.getIndexForDataBefore(_queryId, _timestamp);
    }

    /**
     * @dev Retrieves multiple uint256 values before the specified timestamp
     * @param _queryId the unique id of the data query
     * @param _timestamp the timestamp before which to search for values
     * @param _maxAge the maximum number of seconds before the _timestamp to search for values
     * @param _maxCount the maximum number of values to return
     * @return _values the values retrieved, ordered from oldest to newest
     * @return _timestamps the timestamps of the values retrieved
     */
    function getMultipleValuesBefore(
        bytes32 _queryId,
        uint256 _timestamp,
        uint256 _maxAge,
        uint256 _maxCount
    )
        public
        view
        returns (bytes[] memory _values, uint256[] memory _timestamps)
    {
        // get index of first possible value
        (bool _ifRetrieve, uint256 _startIndex) = getIndexForDataAfter(
            _queryId,
            _timestamp - _maxAge
        );
        // no value within range
        if (!_ifRetrieve) {
            return (new bytes[](0), new uint256[](0));
        }
        uint256 _endIndex;
        // get index of last possible value
        (_ifRetrieve, _endIndex) = getIndexForDataBefore(_queryId, _timestamp);
        // no value before _timestamp
        if (!_ifRetrieve) {
            return (new bytes[](0), new uint256[](0));
        }
        uint256 _valCount = 0;
        uint256 _index = 0;
        uint256[] memory _timestampsArrayTemp = new uint256[](_maxCount);
        // generate array of non-disputed timestamps within range
        while (_valCount < _maxCount && _endIndex + 1 - _index > _startIndex) {
            uint256 _timestampRetrieved = getTimestampbyQueryIdandIndex(
                _queryId,
                _endIndex - _index
            );
            if (!isInDispute(_queryId, _timestampRetrieved)) {
                _timestampsArrayTemp[_valCount] = _timestampRetrieved;
                _valCount++;
            }
            _index++;
        }

        bytes[] memory _valuesArray = new bytes[](_valCount);
        uint256[] memory _timestampsArray = new uint256[](_valCount);
        // retrieve values and reverse timestamps order
        for (uint256 _i = 0; _i < _valCount; _i++) {
            _timestampsArray[_i] = _timestampsArrayTemp[_valCount - 1 - _i];
            _valuesArray[_i] = retrieveData(_queryId, _timestampsArray[_i]);
        }
        return (_valuesArray, _timestampsArray);
    }

    /**
     * @dev Counts the number of values that have been submitted for the queryId
     * @param _queryId the id to look up
     * @return uint256 count of the number of values received for the queryId
     */
    function getNewValueCountbyQueryId(bytes32 _queryId)
        public
        view
        returns (uint256)
    {
        return tellor.getNewValueCountbyQueryId(_queryId);
    }

    /**
     * @dev Returns the address of the reporter who submitted a value for a data ID at a specific time
     * @param _queryId is ID of the specific data feed
     * @param _timestamp is the timestamp to find a corresponding reporter for
     * @return address of the reporter who reported the value for the data ID at the given timestamp
     */
    function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (address)
    {
        return tellor.getReporterByTimestamp(_queryId, _timestamp);
    }

    /**
     * @dev Gets the timestamp for the value based on their index
     * @param _queryId is the id to look up
     * @param _index is the value index to look up
     * @return uint256 timestamp
     */
    function getTimestampbyQueryIdandIndex(bytes32 _queryId, uint256 _index)
        public
        view
        returns (uint256)
    {
        return tellor.getTimestampbyQueryIdandIndex(_queryId, _index);
    }

    /**
     * @dev Determines whether a value with a given queryId and timestamp has been disputed
     * @param _queryId is the value id to look up
     * @param _timestamp is the timestamp of the value to look up
     * @return bool true if queryId/timestamp is under dispute
     */
    function isInDispute(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (bool)
    {
        return tellor.isInDispute(_queryId, _timestamp);
    }

    /**
     * @dev Retrieve value from oracle based on queryId/timestamp
     * @param _queryId being requested
     * @param _timestamp to retrieve data/value from
     * @return bytes value for query/timestamp submitted
     */
    function retrieveData(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (bytes memory)
    {
        return tellor.retrieveData(_queryId, _timestamp);
    }

    /**
     * @dev allows dev to set mapping contract for valueFor (EIP2362)
     * @param _addy address of mapping contract
     */
    function setIdMappingContract(address _addy) external {
        require(address(idMappingContract) == address(0));
        idMappingContract = IMappingContract(_addy);
    }

    /**
     * @dev Retrieve most recent int256 value from oracle based on queryId
     * @param _id being requested
     * @return _value most recent value submitted
     * @return _timestamp timestamp of most recent value
     * @return _statusCode 200 if value found, 404 if not found
     */
    function valueFor(bytes32 _id)
        external
        view
        override
        returns (
            int256 _value,
            uint256 _timestamp,
            uint256 _statusCode
        )
    {
        bytes32 _queryId = idMappingContract.getTellorID(_id);
        bytes memory _valueBytes;
        (_valueBytes, _timestamp) = getDataBefore(
            _queryId,
            block.timestamp + 1
        );
        if (_timestamp == 0) {
            return (0, 0, 404);
        }
        uint256 _valueUint = _sliceUint(_valueBytes);
        _value = int256(_valueUint);
        return (_value, _timestamp, 200);
    }

    // Internal functions
    /**
     * @dev Convert bytes to uint256
     * @param _b bytes value to convert to uint256
     * @return _number uint256 converted from bytes
     */
    function _sliceUint(bytes memory _b)
        internal
        pure
        returns (uint256 _number)
    {
        for (uint256 _i = 0; _i < _b.length; _i++) {
            _number = _number * 256 + uint8(_b[_i]);
        }
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 300
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address payable","name":"_tellor","type":"address"},{"internalType":"address","name":"_teamMultisig","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_disputeId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"address","name":"_reporter","type":"address"}],"name":"NewDispute","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_disputeId","type":"uint256"},{"indexed":false,"internalType":"enum Governance.VoteResult","name":"_result","type":"uint8"}],"name":"VoteExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_disputeId","type":"uint256"},{"indexed":false,"internalType":"enum Governance.VoteResult","name":"_result","type":"uint8"},{"indexed":false,"internalType":"address","name":"_initiator","type":"address"},{"indexed":false,"internalType":"address","name":"_reporter","type":"address"}],"name":"VoteTallied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_disputeId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"_supports","type":"bool"},{"indexed":false,"internalType":"address","name":"_voter","type":"address"},{"indexed":false,"internalType":"bool","name":"_invalidQuery","type":"bool"}],"name":"Voted","type":"event"},{"inputs":[],"name":"autopayAddrsQueryId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"beginDispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"},{"internalType":"address","name":"_voter","type":"address"}],"name":"didVote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"}],"name":"executeVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getDataAfter","outputs":[{"internalType":"bytes","name":"_value","type":"bytes"},{"internalType":"uint256","name":"_timestampRetrieved","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getDataBefore","outputs":[{"internalType":"bytes","name":"_value","type":"bytes"},{"internalType":"uint256","name":"_timestampRetrieved","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDisputeFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"}],"name":"getDisputeInfo","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reporter","type":"address"}],"name":"getDisputesByReporter","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getIndexForDataAfter","outputs":[{"internalType":"bool","name":"_found","type":"bool"},{"internalType":"uint256","name":"_index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getIndexForDataBefore","outputs":[{"internalType":"bool","name":"_found","type":"bool"},{"internalType":"uint256","name":"_index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"},{"internalType":"uint256","name":"_maxAge","type":"uint256"},{"internalType":"uint256","name":"_maxCount","type":"uint256"}],"name":"getMultipleValuesBefore","outputs":[{"internalType":"bytes[]","name":"_values","type":"bytes[]"},{"internalType":"uint256[]","name":"_timestamps","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getNewValueCountbyQueryId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getOpenDisputesOnId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getReporterByTimestamp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getTimestampbyQueryIdandIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVoteCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"}],"name":"getVoteInfo","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256[17]","name":"","type":"uint256[17]"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"enum Governance.VoteResult","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_hash","type":"bytes32"}],"name":"getVoteRounds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_voter","type":"address"}],"name":"getVoteTallyByAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"idMappingContract","outputs":[{"internalType":"contract IMappingContract","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"isInDispute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"retrieveData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addy","type":"address"}],"name":"setIdMappingContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"}],"name":"tallyVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"teamMultisig","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tellor","outputs":[{"internalType":"contract ITellor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"valueFor","outputs":[{"internalType":"int256","name":"_value","type":"int256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"},{"internalType":"uint256","name":"_statusCode","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"},{"internalType":"bool","name":"_supports","type":"bool"},{"internalType":"bool","name":"_invalidQuery","type":"bool"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voteCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_disputeIds","type":"uint256[]"},{"internalType":"bool[]","name":"_supports","type":"bool[]"},{"internalType":"bool[]","name":"_invalidQuery","type":"bool[]"}],"name":"voteOnMultipleDisputes","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405260006080908152620000189060c06200020f565b60408051601f1981840301815290829052620000379160200162000224565b604051602081830303815290604052805190602001206007553480156200005d57600080fd5b5060405162003eaf38038062003eaf833981016040819052620000809162000183565b600080546001600160a01b0384166001600160a01b0319918216811790925560028054909116821790556040805163021fd35d60e31b815290516310fe9ae891600480820192602092909190829003018186803b158015620000e157600080fd5b505afa158015620000f6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200011c91906200015d565b600380546001600160a01b03199081166001600160a01b03938416179091556004805482169483169490941790935560058054909316911617905562000279565b6000602082840312156200016f578081fd5b81516200017c8162000260565b9392505050565b6000806040838503121562000196578081fd5b8251620001a38162000260565b6020840151909250620001b68162000260565b809150509250929050565b60008151808452815b81811015620001e857602081850181015186830182015201620001ca565b81811115620001fa5782602083870101525b50601f01601f19169290920160200192915050565b6000602082526200017c6020830184620001c1565b600060408252601060408301526f4175746f70617941646472657373657360801b6060830152608060208301526200017c6080830184620001c1565b6001600160a01b03811681146200027657600080fd5b50565b613c2680620002896000396000f3fe608060405234801561001057600080fd5b50600436106102055760003560e01c8063a7c438bc1161011a578063dbc0c085116100ad578063f66f49c31161007c578063f66f49c3146104f1578063f78eea8314610504578063f98a4eca14610532578063fc0c546a14610545578063fcd4a5461461055857610205565b8063dbc0c085146104b0578063df133bca146104c3578063e07c5486146104d6578063e7b3387c146104e957610205565b8063c5958af9116100e9578063c5958af91461046b578063c63840711461048b578063ce5e11bf14610494578063d8add0f6146104a757610205565b8063a7c438bc146103ea578063a89ae4ba14610427578063bbf3e10b1461043a578063bdc7d9d81461044257610205565b806344e87f911161019d57806364ee3c6d1161016c57806364ee3c6d1461036c57806377b03e0d1461038d5780637dc0d1d0146103a05780638d824273146103b3578063a792765f146103d757610205565b806344e87f91146103005780634d318b0e146103235780634e9fe708146103365780636169c3081461034957610205565b80631f379acc116101d95780631f379acc14610290578063248638e5146102a357806329449085146102c35780632af8aae0146102ed57610205565b8062b121901461020a5780630e1596ef1461021f578063193b505b146102525780631959ad5b14610265575b600080fd5b61021d6102183660046133f7565b610579565b005b61023f61022d366004613575565b60009081526009602052604090205490565b6040519081526020015b60405180910390f35b61021d610260366004613323565b61061d565b600054610278906001600160a01b031681565b6040516001600160a01b039091168152602001610249565b61021d61029e3660046135a5565b610655565b6102b66102b1366004613575565b610f22565b604051610249919061380f565b6102d66102d13660046135a5565b610f84565b604080519215158352602083019190915201610249565b600154610278906001600160a01b031681565b61031361030e3660046135a5565b611013565b6040519015158152602001610249565b61021d610331366004613575565b61109e565b6102b6610344366004613323565b6115c6565b61035c610357366004613575565b611630565b6040516102499493929190613885565b61037f61037a3660046135a5565b611704565b6040516102499291906138d1565b61023f61039b366004613575565b61175d565b600254610278906001600160a01b031681565b6103c66103c1366004613575565b6117e0565b604051610249959493929190613822565b61037f6103e53660046135a5565b6118e5565b6103136103f836600461362a565b6000828152600a602090815260408083206001600160a01b038516845260130190915290205460ff1692915050565b600454610278906001600160a01b031681565b61023f61197b565b61023f610450366004613323565b6001600160a01b03166000908152600c602052604090205490565b61047e6104793660046135a5565b611a14565b60405161024991906138be565b61023f60065481565b61023f6104a23660046135a5565b611a9c565b61023f60075481565b600554610278906001600160a01b031681565b61021d6104d1366004613659565b611b20565b6102786104e43660046135a5565b6120fd565b60065461023f565b6102d66104ff3660046135a5565b612181565b610517610512366004613575565b61233d565b60408051938452602084019290925290820152606001610249565b61021d610540366004613575565b61240d565b600354610278906001600160a01b031681565b61056b6105663660046135c6565b612bec565b60405161024992919061379a565b60005b8351811015610617576106058482815181106105a857634e487b7160e01b600052603260045260246000fd5b60200260200101518483815181106105d057634e487b7160e01b600052603260045260246000fd5b60200260200101518484815181106105f857634e487b7160e01b600052603260045260246000fd5b6020026020010151611b20565b8061060f81613b83565b91505061057c565b50505050565b6001546001600160a01b03161561063357600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630935408d60e41b815260048101849052602481018390526001600160a01b039091169063935408d09060440160206040518083038186803b1580156106a057600080fd5b505afa1580156106b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d8919061358d565b6107345760405162461bcd60e51b815260206004820152602260248201527f6e6f2076616c75652065786973747320617420676976656e2074696d6573746160448201526106d760f41b60648201526084015b60405180910390fd5b6040805160208082018590528183018490528251808303840181526060909201909252805191012060065460009061076d906001613992565b6000838152600b60209081526040808320805460018082018355828652848620909101869055858552600a8452828520600890945293829020898155938401889055600254915163703e2a4360e11b8152600481018a905260248101899052949550939192916001600160a01b039091169063e07c54869060440160206040518083038186803b15801561080057600080fd5b505afa158015610814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610838919061333f565b600382810180546001600160a01b0319166001600160a01b0393841617815587855560128501805475ffffffffffffffffffffffffffffffffffffffff000019163362010000021790554391850191909155426002850155845460018581019190915590549091166000908152600d60209081526040822080549384018155825281209091018590556108c961197b565b845490915060011415610b335761a8c06108e38842613af4565b1061094b5760405162461bcd60e51b815260206004820152603260248201527f44697370757465206d75737420626520737461727465642077697468696e207260448201527165706f7274696e67206c6f636b2074696d6560701b606482015260840161072b565b600088815260096020526040812080549161096583613b83565b909155505060008881526009602052604090205461098590600190613af4565b610990906002613a07565b61099a9082613ad5565b600254600384015460405163137f0a8d60e21b81526001600160a01b0391821660048201523060248201529293501690634dfc2a3490604401602060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a25919061358d565b60048381019190915560025460405163c5958af960e01b81529182018a9052602482018990526001600160a01b03169063c5958af99060440160006040518083038186803b158015610a7657600080fd5b505afa158015610a8a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ab291908101906135f7565b8051610ac891600285019160209091019061310e565b506002546040516316d7b73f60e21b8152600481018a9052602481018990526001600160a01b0390911690635b5edcfc90604401600060405180830381600087803b158015610b1657600080fd5b505af1158015610b2a573d6000803e3d6000fd5b50505050610cc9565b83546000908590610b4690600290613af4565b81548110610b6457634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905062015180600a60008381526020019081526020016000206005015442610b979190613af4565b10610bfb5760405162461bcd60e51b815260206004820152602e60248201527f4e6577206469737075746520726f756e64206d7573742062652073746172746560448201526d642077697468696e20612064617960901b606482015260840161072b565b8454610c0990600190613af4565b610c14906002613a07565b610c1e9083613ad5565b91506008600086600081548110610c4557634e487b7160e01b600052603260045260246000fd5b906000526020600020015481526020019081526020016000206004015483600401819055506008600086600081548110610c8f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154815260200190815260200160002060020183600201908054610cbb90613b4e565b610cc6929190613192565b50505b600260009054906101000a90046001600160a01b03166001600160a01b031663722580b66040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1757600080fd5b505afa158015610d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4f919061358d565b811115610ddf57600260009054906101000a90046001600160a01b03166001600160a01b031663722580b66040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc919061358d565b90505b6004830181905560068054906000610df683613b83565b90915550506003546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b158015610e4d57600080fd5b505af1158015610e61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8591906134d4565b610ec45760405162461bcd60e51b815260206004820152601060248201526f119959481b5d5cdd081899481c185a5960821b604482015260640161072b565b600382015460408051878152602081018b90528082018a90526001600160a01b039092166060830152517f12b7317353cd7caa8eae8057464e3de356c1429d814fb3421797eccb190430449181900360800190a15050505050505050565b6000818152600b6020908152604091829020805483518184028101840190945280845260609392830182828015610f7857602002820191906000526020600020905b815481526020019060010190808311610f64575b50505050509050919050565b60008054604051632944908560e01b8152600481018590526024810184905282916001600160a01b031690632944908590604401604080518083038186803b158015610fcf57600080fd5b505afa158015610fe3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110079190613548565b915091505b9250929050565b600080546040516344e87f9160e01b815260048101859052602481018490526001600160a01b03909116906344e87f919060440160206040518083038186803b15801561105f57600080fd5b505afa158015611073573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109791906134d4565b9392505050565b6000818152600a602052604090206005810154156110fe5760405162461bcd60e51b815260206004820152601d60248201527f566f74652068617320616c7265616479206265656e2074616c6c696564000000604482015260640161072b565b60065482111580156111105750600082115b6111525760405162461bcd60e51b8152602060048201526013602482015272159bdd1948191bd95cc81b9bdd08195e1a5cdd606a1b604482015260640161072b565b60018101546111649062015180613ad5565b60028201546111739042613af4565b10158061119257506207e90081600201544261118f9190613af4565b10155b6111de5760405162461bcd60e51b815260206004820152601f60248201527f54696d6520666f7220766f74696e6720686173206e6f7420656c617073656400604482015260640161072b565b600881015460078201546006830154600092916111fa91613992565b6112049190613992565b600e830154600d840154600c8501549293506000926112239190613992565b61122d9190613992565b60118401546010850154600f86015492935060009261124c9190613992565b6112569190613992565b600b850154600a86015460098701549293506000926112759190613992565b61127f9190613992565b905083611294578361129081613b83565b9450505b826112a757826112a381613b83565b9350505b816112ba57816112b681613b83565b9250505b806112cd57806112c981613b83565b9150505b600985015460009082906112e990670de0b6b3a7640000613ad5565b6112f391906139aa565b600f870154849061130c90670de0b6b3a7640000613ad5565b61131691906139aa565b600c880154869061132f90670de0b6b3a7640000613ad5565b61133991906139aa565b6006890154889061135290670de0b6b3a7640000613ad5565b61135c91906139aa565b6113669190613992565b6113709190613992565b61137a9190613992565b90506000828760090160010154670de0b6b3a764000061139a9190613ad5565b6113a491906139aa565b601088015485906113bd90670de0b6b3a7640000613ad5565b6113c791906139aa565b600d89015487906113e090670de0b6b3a7640000613ad5565b6113ea91906139aa565b60078a0154899061140390670de0b6b3a7640000613ad5565b61140d91906139aa565b6114179190613992565b6114219190613992565b61142b9190613992565b90506000838860090160020154670de0b6b3a764000061144b9190613ad5565b61145591906139aa565b6011890154869061146e90670de0b6b3a7640000613ad5565b61147891906139aa565b600e8a0154889061149190670de0b6b3a7640000613ad5565b61149b91906139aa565b60088b01548a906114b490670de0b6b3a7640000613ad5565b6114be91906139aa565b6114c89190613992565b6114d29190613992565b6114dc9190613992565b90506114e88183613992565b83111561150d576012880180546001919061ff001916610100835b0217905550611548565b6115178184613992565b821115611536576012880180546000919061ff00191661010083611503565b60128801805461ff0019166102001790555b426005890155601288015460008a815260086020526040908190206003015490517fa2d4e500801849d40ad00f0f12ba92a5263f83ec68946e647be95cfbe581c7b6926115b3928d9260ff610100840416926001600160a01b03620100009091048116921690613907565b60405180910390a1505050505050505050565b6001600160a01b0381166000908152600d6020908152604091829020805483518184028101840190945280845260609392830182828015610f785760200282019190600052602060002090815481526020019060010190808311610f645750505050509050919050565b6000818152600860205260408120805460018201546003830154600284018054869560609587959194909391926001600160a01b0390911690829061167490613b4e565b80601f01602080910402602001604051908101604052809291908181526020018280546116a090613b4e565b80156116ed5780601f106116c2576101008083540402835291602001916116ed565b820191906000526020600020905b8154815290600101906020018083116116d057829003601f168201915b505050505091509450945094509450509193509193565b606060008060006117158686612181565b915091508161173c576000604051806020016040528060008152509093509350505061100c565b6117468682611a9c565b92506117528684611a14565b935050509250929050565b600080546040516377b03e0d60e01b8152600481018490526001600160a01b03909116906377b03e0d9060240160206040518083038186803b1580156117a257600080fd5b505afa1580156117b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117da919061358d565b92915050565b60006117ea61320d565b50506000908152600a60208181526040928390208054845161022081018652600183015481526002830154938101939093526003820154948301949094526004810154606083015260058101546080830152600681015460a0830152600781015460c0830152600881015460e083015260098101546101008084019190915292810154610120830152600b810154610140830152600c810154610160830152600d810154610180830152600e8101546101a0830152600f8101546101c083015260108101546101e08301526011810154610200830152601201549293909260ff8082169382041691620100009091046001600160a01b031690565b6000805460405163a792765f60e01b81526004810185905260248101849052606092916001600160a01b03169063a792765f9060440160006040518083038186803b15801561193357600080fd5b505afa158015611947573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261196f91908101906134f0565b90969095509350505050565b6000600a600260009054906101000a90046001600160a01b03166001600160a01b031663722580b66040518163ffffffff1660e01b815260040160206040518083038186803b1580156119cd57600080fd5b505afa1580156119e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a05919061358d565b611a0f91906139aa565b905090565b60005460405163c5958af960e01b815260048101849052602481018390526060916001600160a01b03169063c5958af99060440160006040518083038186803b158015611a6057600080fd5b505afa158015611a74573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261109791908101906135f7565b6000805460405163ce5e11bf60e01b815260048101859052602481018490526001600160a01b039091169063ce5e11bf9060440160206040518083038186803b158015611ae857600080fd5b505afa158015611afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611097919061358d565b6006548311158015611b325750600083115b611b745760405162461bcd60e51b8152602060048201526013602482015272159bdd1948191bd95cc81b9bdd08195e1a5cdd606a1b604482015260640161072b565b6000838152600a60205260409020600581015415611bd45760405162461bcd60e51b815260206004820152601d60248201527f566f74652068617320616c7265616479206265656e2074616c6c696564000000604482015260640161072b565b33600090815260138201602052604090205460ff1615611c365760405162461bcd60e51b815260206004820152601860248201527f53656e6465722068617320616c726561647920766f7465640000000000000000604482015260640161072b565b336000818152601383016020526040808220805460ff1916600117905560035490516370a0823160e01b8152600481019390935290916001600160a01b03909116906370a082319060240160206040518083038186803b158015611c9957600080fd5b505afa158015611cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd1919061358d565b600254604051630733bdef60e41b815233600482015291925060009182916001600160a01b03169063733bdef0906024016101006040518083038186803b158015611d1b57600080fd5b505afa158015611d2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d53919061369a565b505050505092509250508082611d699190613992565b611d739084613992565b92508415611e845782846006016002016000828254611d929190613992565b9091555050600254604051631c3c149f60e11b81523360048201526001600160a01b0390911690633878293e9060240160206040518083038186803b158015611dda57600080fd5b505afa158015611dee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e12919061358d565b600e85018054600090611e26908490613992565b90915550611e35905033612f4b565b600b85018054600090611e49908490613992565b90915550506005546001600160a01b0316331415611e7f57600184600f016002016000828254611e799190613992565b90915550505b61208c565b8515611f885782846006016000016000828254611ea19190613992565b9091555050600254604051631c3c149f60e11b81523360048201526001600160a01b0390911690633878293e9060240160206040518083038186803b158015611ee957600080fd5b505afa158015611efd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f21919061358d565b600c85018054600090611f35908490613992565b90915550611f44905033612f4b565b600985018054600090611f58908490613992565b90915550506005546001600160a01b0316331415611e7f57600184600f016000016000828254611e799190613992565b82846006016001016000828254611f9f9190613992565b9091555050600254604051631c3c149f60e11b81523360048201526001600160a01b0390911690633878293e9060240160206040518083038186803b158015611fe757600080fd5b505afa158015611ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201f919061358d565b600d85018054600090612033908490613992565b90915550612042905033612f4b565b600a85018054600090612056908490613992565b90915550506005546001600160a01b031633141561208c57600184600f0160010160008282546120869190613992565b90915550505b336000908152600c602052604081208054916120a783613b83565b90915550506040805188815287151560208201523381830152861515606082015290517fbe6f1c58cc15c8e86d6f0ef23c5a30eb33319af3b57f6b7d9b56ccfa87696b849181900360800190a150505050505050565b6000805460405163703e2a4360e11b815260048101859052602481018490526001600160a01b039091169063e07c54869060440160206040518083038186803b15801561214957600080fd5b505afa15801561215d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611097919061333f565b600080600061218f8561175d565b9050806121a357600080925092505061100c565b806121ad81613b37565b91506001905060008083816121c28a83611a9c565b90508881116121dd576000809750975050505050505061100c565b6121e78a84611a9c565b9050888111156121f657600094505b84156122a85760026122088484613992565b61221291906139aa565b935061221e8a85611a9c565b90508881111561225f5760006122398b6104a2600188613af4565b905089811161224b5760009550612259565b612256600186613af4565b92505b506122a3565b60006122708b6104a2876001613992565b90508981111561229357600095508461228881613b83565b9550508091506122a1565b61229e856001613992565b93505b505b6121f6565b6122b28a82611013565b6122c8576001849750975050505050505061100c565b6122d28a82611013565b80156122dd57508584105b1561230057836122ec81613b83565b9450506122f98a85611a9c565b90506122c8565b858414801561231457506123148a82611013565b1561232b576000809750975050505050505061100c565b6001849750975050505050505061100c565b6001546040516387a475fd60e01b8152600481018390526000918291829182916001600160a01b03909116906387a475fd9060240160206040518083038186803b15801561238a57600080fd5b505afa15801561239e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c2919061358d565b905060606123d5826103e5426001613992565b94509050836123f1576000806101949450945094505050612406565b60006123fc826130a9565b955060c893505050505b9193909250565b6000818152600a60205260409020600654821180159061242d5750600082115b6124795760405162461bcd60e51b815260206004820152601860248201527f44697370757465204944206d7573742062652076616c69640000000000000000604482015260640161072b565b601281015460ff16156124ce5760405162461bcd60e51b815260206004820152601e60248201527f566f74652068617320616c7265616479206265656e2065786563757465640000604482015260640161072b565b60008160050154116125225760405162461bcd60e51b815260206004820152601460248201527f566f7465206d7573742062652074616c6c696564000000000000000000000000604482015260640161072b565b600181015481546000908152600b6020526040902054146125855760405162461bcd60e51b815260206004820152601660248201527f4d757374206265207468652066696e616c20766f746500000000000000000000604482015260640161072b565b620151808160050154426125999190613af4565b10156126035760405162461bcd60e51b815260206004820152603360248201527f31206461792068617320746f20706173732061667465722074616c6c7920746f60448201527220616c6c6f7720666f7220646973707574657360681b606482015260840161072b565b60128101805460ff19166001179055600082815260086020908152604080832080548452600990925282208054919261263b83613b37565b90915550600090508060016012850154610100900460ff16600281111561267257634e487b7160e01b600052602160045260246000fd5b141561283c5783546000908152600b602052604090205491505b81156128375783546000908152600b602052604090206126ad600184613af4565b815481106126cb57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050600a60008281526020019081526020016000209350816001141561278e57600354601285015460048581015460405163a9059cbb60e01b81526001600160a01b0362010000909404841692810192909252602482015291169063a9059cbb90604401602060405180830381600087803b15801561275457600080fd5b505af1158015612768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278c91906134d4565b505b600354601285015460048087015460405163a9059cbb60e01b81526001600160a01b0362010000909404841692810192909252602482015291169063a9059cbb90604401602060405180830381600087803b1580156127ec57600080fd5b505af1158015612800573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282491906134d4565b508161282f81613b37565b92505061268c565b612b91565b60026012850154610100900460ff16600281111561286a57634e487b7160e01b600052602160045260246000fd5b1415612a265783546000908152600b602052604090205491505b81156129905783546000908152600b602052604090206128a5600184613af4565b815481106128c357634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910154808352600a9091526040918290206003546012820154600480840154955163a9059cbb60e01b81526001600160a01b03620100009093048316918101919091526024810195909552919750919350169063a9059cbb90604401602060405180830381600087803b15801561294557600080fd5b505af1158015612959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061297d91906134d4565b508161298881613b37565b925050612884565b600380549084015460048086015460405163a9059cbb60e01b81526001600160a01b0393841692810192909252602482015291169063a9059cbb90604401602060405180830381600087803b1580156129e857600080fd5b505af11580156129fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2091906134d4565b50612b91565b60006012850154610100900460ff166002811115612a5457634e487b7160e01b600052602160045260246000fd5b1415612b915783546000908152600b602052604081205492505b8215612af35784546000908152600b60205260409020612a8f600185613af4565b81548110612aad57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549150600a60008381526020019081526020016000209450846004015481612adf9190613992565b905082612aeb81613b37565b935050612a6e565b6004840154612b029082613992565b600380549086015460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb90604401602060405180830381600087803b158015612b5657600080fd5b505af1158015612b6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8e91906134d4565b50505b6000858152600a6020526040908190206012015490517f40d231bf91823121de9e1c012d95f835ea5684dc1d93360d9510a30543345da491612bdd918891610100900460ff16906138f3565b60405180910390a15050505050565b606080600080612c00886104ff888a613af4565b9150915081612c51576040805160008082526020820190925290612c34565b6060815260200190600190039081612c1f5790505b506040805160008152602081019091529094509250612f42915050565b6000612c5d8989610f84565b909350905082612cb0576040805160008082526020820190925290612c92565b6060815260200190600190039081612c7d5790505b506040805160008152602081019091529095509350612f4292505050565b60008060008867ffffffffffffffff811115612cdc57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612d05578160200160208202803683370190505b5090505b8883108015612d2c57508482612d20866001613992565b612d2a9190613af4565b115b15612d9e576000612d418d6104a28588613af4565b9050612d4d8d82611013565b612d8b5780828581518110612d7257634e487b7160e01b600052603260045260246000fd5b602090810291909101015283612d8781613b83565b9450505b82612d9581613b83565b93505050612d09565b60008367ffffffffffffffff811115612dc757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612dfa57816020015b6060815260200190600190039081612de55790505b50905060008467ffffffffffffffff811115612e2657634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612e4f578160200160208202803683370190505b50905060005b85811015612f35578381612e6a600189613af4565b612e749190613af4565b81518110612e9257634e487b7160e01b600052603260045260246000fd5b6020026020010151828281518110612eba57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050612ef78f838381518110612eea57634e487b7160e01b600052603260045260246000fd5b6020026020010151611a14565b838281518110612f1757634e487b7160e01b600052603260045260246000fd5b60200260200101819052508080612f2d90613b83565b915050612e55565b5090985096505050505050505b94509492505050565b6000806000612f6460075461a8c0426103e59190613af4565b909250905080156130a257600082806020019051810190612f85919061335b565b905060005b815181101561309f57600080838381518110612fb657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031688604051602401612fe791906001600160a01b0391909116815260200190565b60408051601f198184030181529181526020820180516001600160e01b03166345d6082360e01b1790525161301c919061377e565b6000604051808303816000865af19150503d8060008114613059576040519150601f19603f3d011682016040523d82523d6000602084013e61305e565b606091505b5091509150811561308a578080602001905181019061307d919061358d565b6130879088613992565b96505b5050808061309790613b83565b915050612f8a565b50505b5050919050565b6000805b8251811015613108578281815181106130d657634e487b7160e01b600052603260045260246000fd5b016020015160f81c6130ea83610100613ad5565b6130f49190613992565b91508061310081613b83565b9150506130ad565b50919050565b82805461311a90613b4e565b90600052602060002090601f01602090048101928261313c5760008555613182565b82601f1061315557805160ff1916838001178555613182565b82800160010185558215613182579182015b82811115613182578251825591602001919060010190613167565b5061318e92915061322c565b5090565b82805461319e90613b4e565b90600052602060002090601f0160209004810192826131c05760008555613182565b82601f106131d15780548555613182565b8280016001018555821561318257600052602060002091601f016020900482015b828111156131825782548255916001019190600101906131f2565b6040518061022001604052806011906020820280368337509192915050565b5b8082111561318e576000815560010161322d565b600082601f830112613251578081fd5b813560206132666132618361396e565b61393d565b80838252828201915082860187848660051b8901011115613285578586fd5b855b858110156132ac57813561329a81613be2565b84529284019290840190600101613287565b5090979650505050505050565b600082601f8301126132c9578081fd5b815167ffffffffffffffff8111156132e3576132e3613bb4565b6132f6601f8201601f191660200161393d565b81815284602083860101111561330a578283fd5b61331b826020830160208701613b0b565b949350505050565b600060208284031215613334578081fd5b813561109781613bca565b600060208284031215613350578081fd5b815161109781613bca565b6000602080838503121561336d578182fd5b825167ffffffffffffffff811115613383578283fd5b8301601f81018513613393578283fd5b80516133a16132618261396e565b80828252848201915084840188868560051b87010111156133c0578687fd5b8694505b838510156133eb5780516133d781613bca565b8352600194909401939185019185016133c4565b50979650505050505050565b60008060006060848603121561340b578182fd5b833567ffffffffffffffff80821115613422578384fd5b818601915086601f830112613435578384fd5b813560206134456132618361396e565b8083825282820191508286018b848660051b8901011115613464578889fd5b8896505b84871015613486578035835260019690960195918301918301613468565b509750508701359250508082111561349c578384fd5b6134a887838801613241565b935060408601359150808211156134bd578283fd5b506134ca86828701613241565b9150509250925092565b6000602082840312156134e5578081fd5b815161109781613be2565b600080600060608486031215613504578283fd5b835161350f81613be2565b602085015190935067ffffffffffffffff81111561352b578283fd5b613537868287016132b9565b925050604084015190509250925092565b6000806040838503121561355a578182fd5b825161356581613be2565b6020939093015192949293505050565b600060208284031215613586578081fd5b5035919050565b60006020828403121561359e578081fd5b5051919050565b600080604083850312156135b7578182fd5b50508035926020909101359150565b600080600080608085870312156135db578182fd5b5050823594602084013594506040840135936060013592509050565b600060208284031215613608578081fd5b815167ffffffffffffffff81111561361e578182fd5b61331b848285016132b9565b6000806040838503121561363c578182fd5b82359150602083013561364e81613bca565b809150509250929050565b60008060006060848603121561366d578081fd5b83359250602084013561367f81613be2565b9150604084013561368f81613be2565b809150509250925092565b600080600080600080600080610100898b0312156136b6578586fd5b505086516020880151604089015160608a015160808b015160a08c015160c08d015160e0909d0151959e949d50929b919a50985090965094509092509050565b6000815180845260208085019450808401835b8381101561372557815187529582019590820190600101613709565b509495945050505050565b60008151808452613748816020860160208601613b0b565b601f01601f19169290920160200192915050565b6003811061377a57634e487b7160e01b600052602160045260246000fd5b9052565b60008251613790818460208701613b0b565b9190910192915050565b6000604082016040835280855180835260608501915060608160051b86010192506020808801855b838110156137f057605f198887030185526137de868351613730565b955093820193908201906001016137c2565b50508584038187015250505061380681856136f6565b95945050505050565b60006020825261109760208301846136f6565b8581526102a0810160208083018760005b601181101561385057815183529183019190830190600101613833565b5050505084151561024083015261386b61026083018561375c565b6001600160a01b0383166102808301529695505050505050565b6000858252846020830152608060408301526138a46080830185613730565b90506001600160a01b038316606083015295945050505050565b6000602082526110976020830184613730565b6000604082526138e46040830185613730565b90508260208301529392505050565b82815260408101611097602083018461375c565b8481526080810161391b602083018661375c565b6001600160a01b03808516604084015280841660608401525095945050505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561396657613966613bb4565b604052919050565b600067ffffffffffffffff82111561398857613988613bb4565b5060051b60200190565b600082198211156139a5576139a5613b9e565b500190565b6000826139c557634e487b7160e01b81526012600452602481fd5b500490565b80825b60018086116139dc5750612f42565b8187048211156139ee576139ee613b9e565b808616156139fb57918102915b9490941c9380026139cd565b60006110976000198484600082613a2057506001611097565b81613a2d57506000611097565b8160018114613a435760028114613a4d57613a7a565b6001915050611097565b60ff841115613a5e57613a5e613b9e565b6001841b915084821115613a7457613a74613b9e565b50611097565b5060208310610133831016604e8410600b8410161715613aad575081810a83811115613aa857613aa8613b9e565b611097565b613aba84848460016139ca565b808604821115613acc57613acc613b9e565b02949350505050565b6000816000190483118215151615613aef57613aef613b9e565b500290565b600082821015613b0657613b06613b9e565b500390565b60005b83811015613b26578181015183820152602001613b0e565b838111156106175750506000910152565b600081613b4657613b46613b9e565b506000190190565b600181811c90821680613b6257607f821691505b6020821081141561310857634e487b7160e01b600052602260045260246000fd5b6000600019821415613b9757613b97613b9e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114613bdf57600080fd5b50565b8015158114613bdf57600080fdfea26469706673582212207adcee8cad848a7f3146e2cffd63eea587fe7ce26923c3cc78b3c1f2d8c9ad2d64736f6c63430008030033000000000000000000000000d9157453e2668b2fc45b7a803d3fef3642430cc00000000000000000000000009d119edeef320f285704736f362cabc180a66f54

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

000000000000000000000000d9157453e2668b2fc45b7a803d3fef3642430cc00000000000000000000000009d119edeef320f285704736f362cabc180a66f54

-----Decoded View---------------
Arg [0] : _tellor (address): 0xd9157453e2668b2fc45b7a803d3fef3642430cc0
Arg [1] : _teamMultisig (address): 0x9d119edeef320f285704736f362cabc180a66f54

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000d9157453e2668b2fc45b7a803d3fef3642430cc0
Arg [1] : 0000000000000000000000009d119edeef320f285704736f362cabc180a66f54


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.