Contract 0x9BE9B0CFA89Ea800556C6efbA67b455D336db1D0 4

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xc3f7a4f0f100a4254b5a2dd1f4ef01e96da29bf42a8df86d9157a49f6aae80f20x60806040261134292023-01-23 19:29:2514 days 16 hrs ago0x51edb9cc0a86a32870753e4de2c363aefcc25d8c IN  Contract Creation0 xDAI0.006141685528
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

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

Contract Name:
Autopay

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 : Autopay.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;

import { UsingTellor } from "usingtellor/contracts/UsingTellor.sol";
import { IERC20 } from "./interfaces/IERC20.sol";
import "./interfaces/IQueryDataStorage.sol";

/**
 @author Tellor Inc.
 @title Autopay
 @dev This is a contract for automatically paying for Tellor oracle data at
 * specific time intervals, as well as one time tips.
*/
contract Autopay is UsingTellor {
    // Storage
    IERC20 public token; // TRB token address
    IQueryDataStorage public queryDataStorage; // Query data storage contract
    uint256 public fee; // 1000 is 100%, 50 is 5%, etc.

    mapping(bytes32 => bytes32[]) currentFeeds; // mapping queryId to dataFeedIds array
    mapping(bytes32 => mapping(bytes32 => Feed)) dataFeed; // mapping queryId to dataFeedId to details
    mapping(bytes32 => bytes32) public queryIdFromDataFeedId; // mapping dataFeedId to queryId
    mapping(bytes32 => uint256) public queryIdsWithFundingIndex; // mapping queryId to queryIdsWithFunding index plus one (0 if not in array)
    mapping(bytes32 => Tip[]) public tips; // mapping queryId to tips
    mapping(address => uint256) public userTipsTotal; // track user tip total per user

    bytes32[] public feedsWithFunding; // array of dataFeedIds that have funding
    bytes32[] public queryIdsWithFunding; // array of queryIds that have funding

    // Structs
    struct Feed {
        FeedDetails details;
        mapping(uint256 => bool) rewardClaimed; // tracks which tips were already paid out
    }

    struct FeedDetails {
        uint256 reward; // amount paid for each eligible data submission
        uint256 balance; // account remaining balance
        uint256 startTime; // time of first payment window
        uint256 interval; // time between pay periods
        uint256 window; // amount of time data can be submitted per interval
        uint256 priceThreshold; //change in price necessitating an update 100 = 1%
        uint256 rewardIncreasePerSecond; // amount reward increases per second within window (0 for flat rewards)
        uint256 feedsWithFundingIndex; // index plus one of dataFeedID in feedsWithFunding array (0 if not in array)
    }

    struct FeedDetailsWithQueryData {
        FeedDetails details; // feed details for feed id with funding
        bytes queryData; // query data for requested data
    }

    struct SingleTipsWithQueryData {
        bytes queryData; // query data with single tip for requested data
        uint256 tip; // reward amount for request
    }

    struct Tip {
        uint256 amount; // amount tipped
        uint256 timestamp; // time tipped
        uint256 cumulativeTips; // cumulative tips for query ID
    }

    // Events
    event DataFeedFunded(
        bytes32 indexed _queryId,
        bytes32 indexed _feedId,
        uint256 indexed _amount,
        address _feedFunder,
        FeedDetails _feedDetails
    );
    event NewDataFeed(
        bytes32 indexed _queryId,
        bytes32 indexed _feedId,
        bytes _queryData,
        address _feedCreator
    );
    event OneTimeTipClaimed(
        bytes32 indexed _queryId,
        uint256 indexed _amount,
        address indexed _reporter
    );
    event TipAdded(
        bytes32 indexed _queryId,
        uint256 indexed _amount,
        bytes _queryData,
        address _tipper
    );
    event TipClaimed(
        bytes32 indexed _feedId,
        bytes32 indexed _queryId,
        uint256 indexed _amount,
        address _reporter
    );

    // Functions
    /**
     * @dev Initializes system parameters
     * @param _tellor address of Tellor contract
     * @param _queryDataStorage address of query data storage contract
     * @param _fee percentage, 1000 is 100%, 50 is 5%, etc.
     */
    constructor(
        address payable _tellor,
        address _queryDataStorage,
        uint256 _fee
    ) UsingTellor(_tellor) {
        token = IERC20(tellor.token());
        queryDataStorage = IQueryDataStorage(_queryDataStorage);
        fee = _fee;
    }

    /**
     * @dev Function to claim singular tip
     * @param _queryId id of reported data
     * @param _timestamps[] batch of timestamps array of reported data eligible for reward
     */
    function claimOneTimeTip(bytes32 _queryId, uint256[] calldata _timestamps)
        external
    {
        require(
            tips[_queryId].length > 0,
            "no tips submitted for this queryId"
        );
        uint256 _cumulativeReward;
        for (uint256 _i = 0; _i < _timestamps.length; _i++) {
            _cumulativeReward += _getOneTimeTipAmount(
                _queryId,
                _timestamps[_i]
            );
        }
        require(
            token.transfer(
                msg.sender,
                _cumulativeReward - ((_cumulativeReward * fee) / 1000)
            )
        );
        token.approve(address(tellor), (_cumulativeReward * fee) / 1000);
        tellor.addStakingRewards((_cumulativeReward * fee) / 1000);
        if (getCurrentTip(_queryId) == 0) {
            if (queryIdsWithFundingIndex[_queryId] != 0) {
                uint256 _idx = queryIdsWithFundingIndex[_queryId] - 1;
                // Replace unfunded feed in array with last element
                queryIdsWithFunding[_idx] = queryIdsWithFunding[
                    queryIdsWithFunding.length - 1
                ];
                bytes32 _queryIdLastFunded = queryIdsWithFunding[_idx];
                queryIdsWithFundingIndex[_queryIdLastFunded] = _idx + 1;
                queryIdsWithFundingIndex[_queryId] = 0;
                queryIdsWithFunding.pop();
            }
        }
        emit OneTimeTipClaimed(_queryId, _cumulativeReward, msg.sender);
    }

    /**
     * @dev Allows Tellor reporters to claim their tips in batches
     * @param _feedId unique feed identifier
     * @param _queryId ID of reported data
     * @param _timestamps batch of timestamps array of reported data eligible for reward
     */
    function claimTip(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256[] calldata _timestamps
    ) external {
        Feed storage _feed = dataFeed[_queryId][_feedId];
        uint256 _balance = _feed.details.balance;
        require(_balance > 0, "no funds available for this feed");
        uint256 _cumulativeReward;
        for (uint256 _i = 0; _i < _timestamps.length; _i++) {
            require(
                block.timestamp - _timestamps[_i] > 12 hours,
                "buffer time has not passed"
            );
            require(
                getReporterByTimestamp(_queryId, _timestamps[_i]) == msg.sender,
                "message sender not reporter for given queryId and timestamp"
            );
            _cumulativeReward += _getRewardAmount(
                _feedId,
                _queryId,
                _timestamps[_i]
            );
            if (_cumulativeReward >= _balance) {
                // Balance runs out
                require(
                    _i == _timestamps.length - 1,
                    "insufficient balance for all submitted timestamps"
                );
                _cumulativeReward = _balance;
                // Adjust currently funded feeds
                if (feedsWithFunding.length > 1) {
                    uint256 _idx = _feed.details.feedsWithFundingIndex - 1;
                    // Replace unfunded feed in array with last element
                    feedsWithFunding[_idx] = feedsWithFunding[
                        feedsWithFunding.length - 1
                    ];
                    bytes32 _feedIdLastFunded = feedsWithFunding[_idx];
                    bytes32 _queryIdLastFunded = queryIdFromDataFeedId[
                        _feedIdLastFunded
                    ];
                    dataFeed[_queryIdLastFunded][_feedIdLastFunded]
                        .details
                        .feedsWithFundingIndex = _idx + 1;
                }
                feedsWithFunding.pop();
                _feed.details.feedsWithFundingIndex = 0;
            }
            _feed.rewardClaimed[_timestamps[_i]] = true;
        }
        _feed.details.balance -= _cumulativeReward;
        require(
            token.transfer(
                msg.sender,
                _cumulativeReward - ((_cumulativeReward * fee) / 1000)
            )
        );
        token.approve(address(tellor), (_cumulativeReward * fee) / 1000);
        tellor.addStakingRewards((_cumulativeReward * fee) / 1000);
        emit TipClaimed(_feedId, _queryId, _cumulativeReward, msg.sender);
    }

    /**
     * @dev Allows dataFeed account to be filled with tokens
     * @param _feedId unique feed identifier
     * @param _queryId identifier of reported data type associated with feed
     * @param _amount quantity of tokens to fund feed
     */
    function fundFeed(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256 _amount
    ) public {
        FeedDetails storage _feed = dataFeed[_queryId][_feedId].details;
        require(_feed.reward > 0, "feed not set up");
        require(_amount > 0, "must be sending an amount");
        _feed.balance += _amount;
        require(
            token.transferFrom(msg.sender, address(this), _amount),
            "ERC20: transfer amount exceeds balance"
        );
        // Add to array of feeds with funding
        if (_feed.feedsWithFundingIndex == 0 && _feed.balance > 0) {
            feedsWithFunding.push(_feedId);
            _feed.feedsWithFundingIndex = feedsWithFunding.length;
        }
        userTipsTotal[msg.sender] += _amount;
        emit DataFeedFunded(_feedId, _queryId, _amount, msg.sender, _feed);
    }

    /**
     * @dev Initializes dataFeed parameters.
     * @param _queryId unique identifier of desired data feed
     * @param _reward tip amount per eligible data submission
     * @param _startTime timestamp of first autopay window
     * @param _interval amount of time between autopay windows
     * @param _window amount of time after each new interval when reports are eligible for tips
     * @param _priceThreshold amount price must change to automate update regardless of time (negated if 0, 100 = 1%)
     * @param _rewardIncreasePerSecond amount reward increases per second within a window (0 for flat reward)
     * @param _queryData the data used by reporters to fulfill the query
     * @param _amount optional initial amount to fund it with
     */
    function setupDataFeed(
        bytes32 _queryId,
        uint256 _reward,
        uint256 _startTime,
        uint256 _interval,
        uint256 _window,
        uint256 _priceThreshold,
        uint256 _rewardIncreasePerSecond,
        bytes calldata _queryData,
        uint256 _amount
    ) external returns (bytes32 _feedId) {
        require(
            _queryId == keccak256(_queryData),
            "id must be hash of bytes data"
        );
        _feedId = keccak256(
            abi.encode(
                _queryId,
                _reward,
                _startTime,
                _interval,
                _window,
                _priceThreshold,
                _rewardIncreasePerSecond
            )
        );
        FeedDetails storage _feed = dataFeed[_queryId][_feedId].details;
        require(_feed.reward == 0, "feed must not be set up already");
        require(_reward > 0, "reward must be greater than zero");
        require(_interval > 0, "interval must be greater than zero");
        require(
            _window < _interval,
            "window must be less than interval length"
        );
        _feed.reward = _reward;
        _feed.startTime = _startTime;
        _feed.interval = _interval;
        _feed.window = _window;
        _feed.priceThreshold = _priceThreshold;
        _feed.rewardIncreasePerSecond = _rewardIncreasePerSecond;
        currentFeeds[_queryId].push(_feedId);
        queryIdFromDataFeedId[_feedId] = _queryId;
        queryDataStorage.storeData(_queryData);
        emit NewDataFeed(_queryId, _feedId, _queryData, msg.sender);
        if (_amount > 0) {
            fundFeed(_feedId, _queryId, _amount);
        }
        return _feedId;
    }

    /**
     * @dev Function to run a single tip
     * @param _queryId ID of tipped data
     * @param _amount amount to tip
     * @param _queryData the data used by reporters to fulfill the query
     */
    function tip(
        bytes32 _queryId,
        uint256 _amount,
        bytes calldata _queryData
    ) external {
        require(
            _queryId == keccak256(_queryData),
            "id must be hash of bytes data"
        );
        require(_amount > 0, "tip must be greater than zero");
        Tip[] storage _tips = tips[_queryId];
        if (_tips.length == 0) {
            _tips.push(Tip(_amount, block.timestamp, _amount));
            queryDataStorage.storeData(_queryData);
        } else {
            (, uint256 _timestampRetrieved) = _getCurrentValue(_queryId);
            if (_timestampRetrieved < _tips[_tips.length - 1].timestamp) {
                _tips[_tips.length - 1].timestamp = block.timestamp;
                _tips[_tips.length - 1].amount += _amount;
                _tips[_tips.length - 1].cumulativeTips += _amount;
            } else {
                _tips.push(
                    Tip(
                        _amount,
                        block.timestamp,
                        _tips[_tips.length - 1].cumulativeTips + _amount
                    )
                );
            }
        }
        if (
            queryIdsWithFundingIndex[_queryId] == 0 &&
            getCurrentTip(_queryId) > 0
        ) {
            queryIdsWithFunding.push(_queryId);
            queryIdsWithFundingIndex[_queryId] = queryIdsWithFunding.length;
        }
        require(
            token.transferFrom(msg.sender, address(this), _amount),
            "ERC20: transfer amount exceeds balance"
        );
        userTipsTotal[msg.sender] += _amount;
        emit TipAdded(_queryId, _amount, _queryData, msg.sender);
    }

    // Getters
    /**
     * @dev Getter function to read current data feeds
     * @param _queryId id of reported data
     * @return feedIds array for queryId
     */
    function getCurrentFeeds(bytes32 _queryId)
        external
        view
        returns (bytes32[] memory)
    {
        return currentFeeds[_queryId];
    }

    /**
     * @dev Getter function to current oneTime tip by queryId
     * @param _queryId id of reported data
     * @return amount of tip
     */
    function getCurrentTip(bytes32 _queryId) public view returns (uint256) {
        // if no tips, return 0
        if (tips[_queryId].length == 0) {
            return 0;
        }
        (, uint256 _timestampRetrieved) = _getCurrentValue(_queryId);
        Tip memory _lastTip = tips[_queryId][tips[_queryId].length - 1];
        if (_timestampRetrieved < _lastTip.timestamp) {
            return _lastTip.amount;
        } else {
            return 0;
        }
    }

    /**
     * @dev Getter function to read a specific dataFeed
     * @param _feedId unique feedId of parameters
     * @return FeedDetails details of specified feed
     */
    function getDataFeed(bytes32 _feedId)
        external
        view
        returns (FeedDetails memory)
    {
        return (dataFeed[queryIdFromDataFeedId[_feedId]][_feedId].details);
    }

    /**
     * @dev Getter function for currently funded feed details
     * @return FeedDetailsWithQueryData[] array of details for funded feeds
     */
    function getFundedFeedDetails()
        external
        view
        returns (FeedDetailsWithQueryData[] memory)
    {
        bytes32[] memory _feeds = this.getFundedFeeds();
        FeedDetailsWithQueryData[]
            memory _details = new FeedDetailsWithQueryData[](_feeds.length);
        for (uint256 i = 0; i < _feeds.length; i++) {
            FeedDetails memory _feedDetail = this.getDataFeed(_feeds[i]);
            bytes32 _queryId = this.getQueryIdFromFeedId(_feeds[i]);
            bytes memory _queryData = queryDataStorage.getQueryData(_queryId);
            _details[i].details = _feedDetail;
            _details[i].queryData = _queryData;
        }
        return _details;
    }

    /**
     * @dev Getter function for currently funded feeds
     */
    function getFundedFeeds() external view returns (bytes32[] memory) {
        return feedsWithFunding;
    }

    /**
     * @dev Getter function for queryIds with current one time tips
     */
    function getFundedQueryIds() external view returns (bytes32[] memory) {
        return queryIdsWithFunding;
    }

    /**
     * @dev Getter function for currently funded single tips with queryData
     * @return SingleTipsWithQueryData[] array of current tips
     */
    function getFundedSingleTipsInfo()
        external
        view
        returns (SingleTipsWithQueryData[] memory)
    {
        bytes32[] memory _fundedQueryIds = this.getFundedQueryIds();
        SingleTipsWithQueryData[] memory _query = new SingleTipsWithQueryData[](
            _fundedQueryIds.length
        );
        for (uint256 i = 0; i < _fundedQueryIds.length; i++) {
            bytes memory _data = queryDataStorage.getQueryData(
                _fundedQueryIds[i]
            );
            uint256 _reward = this.getCurrentTip(_fundedQueryIds[i]);
            _query[i].queryData = _data;
            _query[i].tip = _reward;
        }
        return _query;
    }

    /**
     * @dev Getter function to get number of past tips
     * @param _queryId id of reported data
     * @return count of tips available
     */
    function getPastTipCount(bytes32 _queryId) external view returns (uint256) {
        return tips[_queryId].length;
    }

    /**
     * @dev Getter function for past tips
     * @param _queryId id of reported data
     * @return Tip struct (amount/timestamp) of all past tips
     */
    function getPastTips(bytes32 _queryId)
        external
        view
        returns (Tip[] memory)
    {
        return tips[_queryId];
    }

    /**
     * @dev Getter function for past tips by index
     * @param _queryId id of reported data
     * @param _index uint index in the Tip array
     * @return amount/timestamp of specific tip
     */
    function getPastTipByIndex(bytes32 _queryId, uint256 _index)
        external
        view
        returns (Tip memory)
    {
        return tips[_queryId][_index];
    }

    /**
     * @dev Getter function to lookup query IDs from dataFeed IDs
     * @param _feedId dataFeed unique identifier
     * @return bytes32 corresponding query ID
     */
    function getQueryIdFromFeedId(bytes32 _feedId)
        external
        view
        returns (bytes32)
    {
        return queryIdFromDataFeedId[_feedId];
    }

    /**
     * @dev Getter function to read potential rewards for a set of oracle submissions
     * NOTE: Does not consider reporter address, 12-hour dispute buffer period, or duplicate timestamps
     * @param _feedId dataFeed unique identifier
     * @param _queryId unique identifier of reported data
     * @param _timestamps array of timestamps of oracle submissions
     * @return _cumulativeReward total potential reward for the set of oracle submissions
     */
    function getRewardAmount(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256[] calldata _timestamps
    ) external view returns (uint256 _cumulativeReward) {
        FeedDetails storage _feed = dataFeed[_queryId][_feedId].details;
        for (uint256 _i = 0; _i < _timestamps.length; _i++) {
            _cumulativeReward += _getRewardAmount(
                _feedId,
                _queryId,
                _timestamps[_i]
            );
        }
        if (_cumulativeReward > _feed.balance) {
            _cumulativeReward = _feed.balance;
        }
        _cumulativeReward -= ((_cumulativeReward * fee) / 1000);
    }

    /**
     * @dev Getter function for reading whether a reward has been claimed
     * @param _feedId feedId of dataFeed
     * @param _queryId id of reported data
     * @param _timestamp id or reported data
     * @return bool rewardClaimed
     */
    function getRewardClaimedStatus(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256 _timestamp
    ) external view returns (bool) {
        return dataFeed[_queryId][_feedId].rewardClaimed[_timestamp];
    }

    /**
     * @dev Getter function for reading whether a reward has been claimed
     * @param _feedId feedId of dataFeed
     * @param _queryId queryId of reported data
     * @param _timestamp[] list of report timestamps
     * @return bool[] list of rewardClaim status
     */
    function getRewardClaimStatusList(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256[] calldata _timestamp
    ) external view returns (bool[] memory) {
        bool[] memory _status = new bool[](_timestamp.length);
        for (uint256 i = 0; i < _timestamp.length; i++) {
            _status[i] = dataFeed[_queryId][_feedId].rewardClaimed[
                _timestamp[i]
            ];
        }
        return _status;
    }

    /**
     * @dev Getter function for retrieving the total amount of tips paid by a given address
     * @param _user address of user to query
     * @return uint256 total amount of tips paid by user
     */
    function getTipsByAddress(address _user) external view returns (uint256) {
        return userTipsTotal[_user];
    }

    // Internal functions
    /**
     * @dev Internal function to read if a reward has been claimed
     * @param _b bytes value to convert to uint256
     * @return _number uint256 converted from bytes
     */
    function _bytesToUint(bytes memory _b)
        internal
        pure
        returns (uint256 _number)
    {
        for (uint256 _i = 0; _i < _b.length; _i++) {
            _number = _number * 256 + uint8(_b[_i]);
        }
    }

    /**
     ** @dev Internal function which determines tip eligibility for a given oracle submission
     * @param _queryId id of reported data
     * @param _timestamp timestamp of one time tip
     * @return _tipAmount of tip
     */
    function _getOneTimeTipAmount(bytes32 _queryId, uint256 _timestamp)
        internal
        returns (uint256 _tipAmount)
    {
        require(
            block.timestamp - _timestamp > 12 hours,
            "buffer time has not passed"
        );
        require(!isInDispute(_queryId, _timestamp), "value disputed");
        require(
            msg.sender == getReporterByTimestamp(_queryId, _timestamp),
            "msg sender must be reporter address"
        );
        Tip[] storage _tips = tips[_queryId];
        uint256 _min = 0;
        uint256 _max = _tips.length;
        uint256 _mid;
        while (_max - _min > 1) {
            _mid = (_max + _min) / 2;
            if (_tips[_mid].timestamp > _timestamp) {
                _max = _mid;
            } else {
                _min = _mid;
            }
        }
        (, uint256 _timestampBefore) = getDataBefore(_queryId, _timestamp);
        require(
            _timestampBefore < _tips[_min].timestamp,
            "tip earned by previous submission"
        );
        require(
            _timestamp >= _tips[_min].timestamp,
            "timestamp not eligible for tip"
        );
        require(_tips[_min].amount > 0, "tip already claimed");
        _tipAmount = _tips[_min].amount;
        _tips[_min].amount = 0;
        uint256 _minBackup = _min;
        // check whether eligible for previous tips in array due to disputes
        (, uint256 _indexNow) = getIndexForDataBefore(_queryId, _timestamp + 1);
        (bool _found, uint256 _indexBefore) = getIndexForDataBefore(
            _queryId,
            _timestampBefore + 1
        );
        if (_indexNow - _indexBefore > 1 || !_found) {
            if (!_found) {
                _tipAmount = _tips[_minBackup].cumulativeTips;
            } else {
                _max = _min;
                _min = 0;
                _mid;
                while (_max - _min > 1) {
                    _mid = (_max + _min) / 2;
                    if (_tips[_mid].timestamp > _timestampBefore) {
                        _max = _mid;
                    } else {
                        _min = _mid;
                    }
                }
                _min++;
                if (_min < _minBackup) {
                    _tipAmount =
                        _tips[_minBackup].cumulativeTips -
                        _tips[_min].cumulativeTips +
                        _tips[_min].amount;
                }
            }
        }
    }

    /**
     * @dev Allows the user to get the latest value for the queryId specified
     * @param _queryId is the id to look up the value for
     * @return _value the value retrieved
     * @return _timestampRetrieved the retrieved value's timestamp
     */

    function _getCurrentValue(bytes32 _queryId)
        internal
        view
        returns (bytes memory _value, uint256 _timestampRetrieved)
    {
        uint256 _count = getNewValueCountbyQueryId(_queryId);
        if (_count == 0) {
            return (bytes(""), 0);
        }
        uint256 _time;
        //loop handles for dispute (value = "" if disputed)
        while (_count > 0) {
            _count--;
            _time = getTimestampbyQueryIdandIndex(_queryId, _count);
            _value = retrieveData(_queryId, _time);
            if (_value.length > 0) {
                return (_value, _time);
            }
        }
        return (bytes(""), _time);
    }

    /**
     * @dev Internal function which determines the reward amount for a given oracle submission
     * @param _feedId id of dataFeed
     * @param _queryId id of reported data
     * @param _timestamp timestamp of reported data eligible for reward
     * @return _rewardAmount potential reward amount for the given oracle submission
     */
    function _getRewardAmount(
        bytes32 _feedId,
        bytes32 _queryId,
        uint256 _timestamp
    ) internal view returns (uint256 _rewardAmount) {
        require(
            block.timestamp - _timestamp < 4 weeks,
            "timestamp too old to claim tip"
        );
        Feed storage _feed = dataFeed[_queryId][_feedId];
        require(!_feed.rewardClaimed[_timestamp], "reward already claimed");
        uint256 _n = (_timestamp - _feed.details.startTime) /
            _feed.details.interval; // finds closest interval _n to timestamp
        uint256 _c = _feed.details.startTime + _feed.details.interval * _n; // finds start timestamp _c of interval _n
        bytes memory _valueRetrieved = retrieveData(_queryId, _timestamp);
        require(_valueRetrieved.length != 0, "no value exists at timestamp");
        (
            bytes memory _valueRetrievedBefore,
            uint256 _timestampBefore
        ) = getDataBefore(_queryId, _timestamp);
        uint256 _priceChange = 0; // price change from last value to current value
        if (_feed.details.priceThreshold != 0) {
            uint256 _v1 = _bytesToUint(_valueRetrieved);
            uint256 _v2 = _bytesToUint(_valueRetrievedBefore);
            if (_v2 == 0) {
                _priceChange = 10000;
            } else if (_v1 >= _v2) {
                _priceChange = (10000 * (_v1 - _v2)) / _v2;
            } else {
                _priceChange = (10000 * (_v2 - _v1)) / _v2;
            }
        }
        _rewardAmount = _feed.details.reward;
        uint256 _timeDiff = _timestamp - _c; // time difference between report timestamp and start of interval
        // ensure either report is first within a valid window, or price change threshold is met
        if (_timeDiff < _feed.details.window && _timestampBefore < _c) {
            // add time based rewards if applicable
            _rewardAmount += _feed.details.rewardIncreasePerSecond * _timeDiff;
        } else {
            require(
                _priceChange > _feed.details.priceThreshold,
                "price threshold not met"
            );
        }

        if (_feed.details.balance < _rewardAmount) {
            _rewardAmount = _feed.details.balance;
        }
    }
}

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

interface IERC20 {
  function transfer(address _to, uint256 _amount) external returns(bool);
  function transferFrom(address _from, address _to, uint256 _amount) external returns(bool);
  function approve(address _spender, uint256 _amount) external returns(bool);
}

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

interface IQueryDataStorage {
  function storeData(bytes memory _queryData) external; 
  function getQueryData(bytes32 _queryId) 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":"_queryDataStorage","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"_feedId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_feedFunder","type":"address"},{"components":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"interval","type":"uint256"},{"internalType":"uint256","name":"window","type":"uint256"},{"internalType":"uint256","name":"priceThreshold","type":"uint256"},{"internalType":"uint256","name":"rewardIncreasePerSecond","type":"uint256"},{"internalType":"uint256","name":"feedsWithFundingIndex","type":"uint256"}],"indexed":false,"internalType":"struct Autopay.FeedDetails","name":"_feedDetails","type":"tuple"}],"name":"DataFeedFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"_feedId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"_queryData","type":"bytes"},{"indexed":false,"internalType":"address","name":"_feedCreator","type":"address"}],"name":"NewDataFeed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"_reporter","type":"address"}],"name":"OneTimeTipClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"_queryData","type":"bytes"},{"indexed":false,"internalType":"address","name":"_tipper","type":"address"}],"name":"TipAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_feedId","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_reporter","type":"address"}],"name":"TipClaimed","type":"event"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256[]","name":"_timestamps","type":"uint256[]"}],"name":"claimOneTimeTip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feedId","type":"bytes32"},{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256[]","name":"_timestamps","type":"uint256[]"}],"name":"claimTip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"feedsWithFunding","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feedId","type":"bytes32"},{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"fundFeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getCurrentFeeds","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getCurrentTip","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"internalType":"bytes32","name":"_feedId","type":"bytes32"}],"name":"getDataFeed","outputs":[{"components":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"interval","type":"uint256"},{"internalType":"uint256","name":"window","type":"uint256"},{"internalType":"uint256","name":"priceThreshold","type":"uint256"},{"internalType":"uint256","name":"rewardIncreasePerSecond","type":"uint256"},{"internalType":"uint256","name":"feedsWithFundingIndex","type":"uint256"}],"internalType":"struct Autopay.FeedDetails","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFundedFeedDetails","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"interval","type":"uint256"},{"internalType":"uint256","name":"window","type":"uint256"},{"internalType":"uint256","name":"priceThreshold","type":"uint256"},{"internalType":"uint256","name":"rewardIncreasePerSecond","type":"uint256"},{"internalType":"uint256","name":"feedsWithFundingIndex","type":"uint256"}],"internalType":"struct Autopay.FeedDetails","name":"details","type":"tuple"},{"internalType":"bytes","name":"queryData","type":"bytes"}],"internalType":"struct Autopay.FeedDetailsWithQueryData[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFundedFeeds","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFundedQueryIds","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFundedSingleTipsInfo","outputs":[{"components":[{"internalType":"bytes","name":"queryData","type":"bytes"},{"internalType":"uint256","name":"tip","type":"uint256"}],"internalType":"struct Autopay.SingleTipsWithQueryData[]","name":"","type":"tuple[]"}],"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"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getPastTipByIndex","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"cumulativeTips","type":"uint256"}],"internalType":"struct Autopay.Tip","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getPastTipCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getPastTips","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"cumulativeTips","type":"uint256"}],"internalType":"struct Autopay.Tip[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feedId","type":"bytes32"}],"name":"getQueryIdFromFeedId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"_feedId","type":"bytes32"},{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256[]","name":"_timestamps","type":"uint256[]"}],"name":"getRewardAmount","outputs":[{"internalType":"uint256","name":"_cumulativeReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feedId","type":"bytes32"},{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256[]","name":"_timestamp","type":"uint256[]"}],"name":"getRewardClaimStatusList","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feedId","type":"bytes32"},{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getRewardClaimedStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"address","name":"_user","type":"address"}],"name":"getTipsByAddress","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":"queryDataStorage","outputs":[{"internalType":"contract IQueryDataStorage","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"queryIdFromDataFeedId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"queryIdsWithFunding","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"queryIdsWithFundingIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_reward","type":"uint256"},{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_interval","type":"uint256"},{"internalType":"uint256","name":"_window","type":"uint256"},{"internalType":"uint256","name":"_priceThreshold","type":"uint256"},{"internalType":"uint256","name":"_rewardIncreasePerSecond","type":"uint256"},{"internalType":"bytes","name":"_queryData","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setupDataFeed","outputs":[{"internalType":"bytes32","name":"_feedId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tellor","outputs":[{"internalType":"contract ITellor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_queryData","type":"bytes"}],"name":"tip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tips","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"cumulativeTips","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userTipsTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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"}]

60806040523480156200001157600080fd5b50604051620048e4380380620048e4833981016040819052620000349162000124565b600080546001600160a01b0319166001600160a01b03851690811790915560408051637e062a3560e11b8152905163fc0c546a91600480820192602092909190829003018186803b1580156200008957600080fd5b505afa1580156200009e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c49190620000fe565b600280546001600160a01b039283166001600160a01b03199182161790915560038054949092169316929092179091556004555062000184565b60006020828403121562000110578081fd5b81516200011d816200016b565b9392505050565b60008060006060848603121562000139578182fd5b835162000146816200016b565b602085015190935062000159816200016b565b80925050604084015190509250925092565b6001600160a01b03811681146200018157600080fd5b50565b61475080620001946000396000f3fe608060405234801561001057600080fd5b50600436106102995760003560e01c806377b03e0d11610171578063bd05a23a116100d3578063e07c548611610097578063fc0c546a11610071578063fc0c546a146106c7578063fcd4a546146106da578063fdb9d0e2146106fb57610299565b8063e07c54861461068e578063f66f49c3146106a1578063f78eea83146106b457610299565b8063bd05a23a1461061f578063c5958af91461063f578063c7fafff81461065f578063ce5e11bf14610672578063ddca3f431461068557610299565b8063997b799011610135578063a9352c091161010f578063a9352c09146105cc578063b0e5fd07146105ec578063b7c9d376146105ff57610299565b8063997b79901461056c578063a733d2db146105a6578063a792765f146105b957610299565b806377b03e0d146104e55780637bcdfa7a146104f85780637f23d1ce14610526578063868d8b591461053957806393d539321461055957610299565b806344e87f911161021a5780634fff7099116101de57806364ee3c6d116101b857806364ee3c6d1461049157806366c1de50146104b2578063751c895c146104d257610299565b80634fff70991461043e57806357806e701461045e578063579b6d061461047157610299565b806344e87f91146103ac57806345740ccc146103cf57806345d60823146103e25780634637de0b1461040b5780634fce1e181461042b57610299565b80632af8aae0116102615780632af8aae014610347578063353d8ac91461035a57806337db4faf1461036f5780633d3fc43d1461038f57806342505164146103a457610299565b806309d6e27e1461029e578063193b505b146102bc5780631959ad5b146102d15780631af4075f146102fc578063294490851461031d575b600080fd5b6102a661070e565b6040516102b3919061430b565b60405180910390f35b6102cf6102ca366004613d48565b610a51565b005b6000546102e4906001600160a01b031681565b6040516001600160a01b0390911681526020016102b3565b61030f61030a366004613f43565b610a96565b6040519081526020016102b3565b61033061032b366004613fbf565b610b4c565b6040805192151583526020830191909152016102b3565b6001546102e4906001600160a01b031681565b610362610bdb565b6040516102b3919061423a565b61030f61037d366004613ec9565b60086020526000908152604090205481565b610397610c33565b6040516102b391906143d5565b610362610f00565b6103bf6103ba366004613fbf565b610f56565b60405190151581526020016102b3565b61030f6103dd366004613ec9565b610fe3565b61030f6103f0366004613d48565b6001600160a01b03166000908152600a602052604090205490565b61041e610419366004613ec9565b61109d565b6040516102b3919061455c565b61030f610439366004613ec9565b611162565b61030f61044c366004613ec9565b60009081526007602052604090205490565b6102cf61046c366004613f43565b611183565b61048461047f366004613ec9565b6117d0565b6040516102b3919061444a565b6104a461049f366004613fbf565b611860565b6040516102b39291906144f4565b61030f6104c0366004613d48565b600a6020526000908152604090205481565b6102cf6104e0366004613fe0565b6118b9565b61030f6104f3366004613ec9565b611d9a565b61050b610506366004613fbf565b611e17565b604080519384526020840192909252908201526060016102b3565b6102cf610534366004613f94565b611e59565b61030f610547366004613ec9565b60076020526000908152604090205481565b610362610567366004613ec9565b6120c9565b6103bf61057a366004613f94565b600091825260066020908152604080842094845293815283832091835260089091019052205460ff1690565b61030f6105b4366004614056565b61212b565b6104a46105c7366004613fbf565b61246a565b6105df6105da366004613fbf565b612500565b6040516102b391906145b4565b6003546102e4906001600160a01b031681565b61030f61060d366004613ec9565b60009081526009602052604090205490565b61063261062d366004613f43565b612591565b6040516102b391906141f4565b61065261064d366004613fbf565b61269f565b6040516102b391906144e1565b61030f61066d366004613ec9565b612727565b61030f610680366004613fbf565b612737565b61030f60045481565b6102e461069c366004613fbf565b6127bb565b6103306106af366004613fbf565b61283f565b61050b6106c2366004613ec9565b6129fb565b6002546102e4906001600160a01b031681565b6106ed6106e8366004614025565b612acb565b6040516102b3929190614272565b6102cf610709366004613ef9565b612e2a565b60606000306001600160a01b031663353d8ac96040518163ffffffff1660e01b815260040160006040518083038186803b15801561074b57600080fd5b505afa15801561075f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107879190810190613d87565b90506000815167ffffffffffffffff8111156107b357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156107ec57816020015b6107d9613beb565b8152602001906001900390816107d15790505b50905060005b8251811015610a4a576000306001600160a01b0316634637de0b85848151811061082c57634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b815260040161085291815260200190565b6101006040518083038186803b15801561086b57600080fd5b505afa15801561087f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a3919061411c565b90506000306001600160a01b0316634fff70998685815181106108d657634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016108fc91815260200190565b60206040518083038186803b15801561091457600080fd5b505afa158015610928573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094c9190613ee1565b6003546040516341b6849f60e11b8152600481018390529192506000916001600160a01b039091169063836d093e9060240160006040518083038186803b15801561099657600080fd5b505afa1580156109aa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109d291908101906140e9565b9050828585815181106109f557634e487b7160e01b600052603260045260246000fd5b60200260200101516000018190525080858581518110610a2557634e487b7160e01b600052603260045260246000fd5b6020026020010151602001819052505050508080610a42906146bb565b9150506107f2565b5091505090565b6001546001600160a01b031615610a6757600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60008381526006602090815260408083208784529091528120815b83811015610b0857610aea8787878785818110610ade57634e487b7160e01b600052603260045260246000fd5b9050602002013561324e565b610af49084614606565b925080610b00816146bb565b915050610ab1565b508060010154821115610b1d57806001015491505b6103e860045483610b2e919061463e565b610b38919061461e565b610b42908361465d565b9695505050505050565b60008054604051632944908560e01b8152600481018590526024810184905282916001600160a01b031690632944908590604401604080518083038186803b158015610b9757600080fd5b505afa158015610bab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcf9190613e9e565b915091505b9250929050565b6060600b805480602002602001604051908101604052809291908181526020018280548015610c2957602002820191906000526020600020905b815481526020019060010190808311610c15575b5050505050905090565b60606000306001600160a01b031663425051646040518163ffffffff1660e01b815260040160006040518083038186803b158015610c7057600080fd5b505afa158015610c84573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cac9190810190613d87565b90506000815167ffffffffffffffff811115610cd857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d1e57816020015b604080518082019091526060815260006020820152815260200190600190039081610cf65790505b50905060005b8251811015610a4a5760035483516000916001600160a01b03169063836d093e90869085908110610d6557634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610d8b91815260200190565b60006040518083038186803b158015610da357600080fd5b505afa158015610db7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ddf91908101906140e9565b90506000306001600160a01b03166345740ccc868581518110610e1257634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610e3891815260200190565b60206040518083038186803b158015610e5057600080fd5b505afa158015610e64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e889190613ee1565b905081848481518110610eab57634e487b7160e01b600052603260045260246000fd5b60200260200101516000018190525080848481518110610edb57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001818152505050508080610ef8906146bb565b915050610d24565b6060600c805480602002602001604051908101604052809291908181526020018280548015610c295760200282019190600052602060002090815481526020019060010190808311610c15575050505050905090565b600080546040516344e87f9160e01b815260048101859052602481018490526001600160a01b03909116906344e87f919060440160206040518083038186803b158015610fa257600080fd5b505afa158015610fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fda9190613e2f565b90505b92915050565b600081815260096020526040812054610ffe57506000611098565b60006110098361352b565b600085815260096020526040812080549294509092509061102c9060019061465d565b8154811061104a57634e487b7160e01b600052603260045260246000fd5b600091825260209182902060408051606081018252600390930290910180548352600181015493830184905260020154908201529150821015611091575191506110989050565b6000925050505b919050565b6110e560405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b506000818152600760208181526040808420548452600680835281852095855294825292839020835161010081018552815481526001820154928101929092526002810154938201939093526003830154606082015260048301546080820152600583015460a08201529282015460c0840152015460e082015290565b600b818154811061117257600080fd5b600091825260209091200154905081565b600083815260066020908152604080832087845290915290206001810154806111f35760405162461bcd60e51b815260206004820181905260248201527f6e6f2066756e647320617661696c61626c6520666f722074686973206665656460448201526064015b60405180910390fd5b6000805b8481101561157a5761a8c086868381811061122257634e487b7160e01b600052603260045260246000fd5b9050602002013542611234919061465d565b116112815760405162461bcd60e51b815260206004820152601a60248201527f6275666665722074696d6520686173206e6f742070617373656400000000000060448201526064016111ea565b336112b2888888858181106112a657634e487b7160e01b600052603260045260246000fd5b905060200201356127bb565b6001600160a01b03161461132e5760405162461bcd60e51b815260206004820152603b60248201527f6d6573736167652073656e646572206e6f74207265706f7274657220666f722060448201527f676976656e207175657279496420616e642074696d657374616d70000000000060648201526084016111ea565b6113538888888885818110610ade57634e487b7160e01b600052603260045260246000fd5b61135d9083614606565b91508282106115135761137160018661465d565b81146113d95760405162461bcd60e51b815260206004820152603160248201527f696e73756666696369656e742062616c616e636520666f7220616c6c207375626044820152706d69747465642074696d657374616d707360781b60648201526084016111ea565b600b54839250600110156114d45760078401546000906113fb9060019061465d565b600b80549192509061140f9060019061465d565b8154811061142d57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154600b828154811061145957634e487b7160e01b600052603260045260246000fd5b90600052602060002001819055506000600b828154811061148a57634e487b7160e01b600052603260045260246000fd5b600091825260208083209091015480835260079091526040909120549091506114b4836001614606565b600091825260066020908152604080842094845293905291902060070155505b600b8054806114f357634e487b7160e01b600052603160045260246000fd5b600082815260208120820160001990810182905590910190915560078501555b600184600801600088888581811061153b57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611572906146bb565b9150506111f7565b5080836000016001016000828254611592919061465d565b90915550506002546004546001600160a01b039091169063a9059cbb9033906103e8906115bf908661463e565b6115c9919061461e565b6115d3908561465d565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561161957600080fd5b505af115801561162d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116519190613e2f565b61165a57600080fd5b6002546000546004546001600160a01b039283169263095ea7b39216906103e890611685908661463e565b61168f919061461e565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156116d557600080fd5b505af11580156116e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170d9190613e2f565b506000546004546001600160a01b039091169063d9c51cd4906103e890611734908561463e565b61173e919061461e565b6040518263ffffffff1660e01b815260040161175c91815260200190565b600060405180830381600087803b15801561177657600080fd5b505af115801561178a573d6000803e3d6000fd5b505060405133815283925088915089907fbe397b811472239aa40c62686337c1611135342d6e238e8aa16580dcd7223adf9060200160405180910390a450505050505050565b606060096000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156118555783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190611805565b505050509050919050565b60606000806000611871868661283f565b91509150816118985760006040518060200160405280600081525090935093505050610bd4565b6118a28682612737565b92506118ae868461269f565b935050509250929050565b81816040516118c99291906141e4565b6040518091039020841461191f5760405162461bcd60e51b815260206004820152601d60248201527f6964206d7573742062652068617368206f66206279746573206461746100000060448201526064016111ea565b6000831161196f5760405162461bcd60e51b815260206004820152601d60248201527f746970206d7573742062652067726561746572207468616e207a65726f00000060448201526064016111ea565b60008481526009602052604090208054611a375760408051606081018252858152426020808301918252828401888152855460018181018855600088815293909320945160039182029095019485559251918401919091555160029092019190915554905163ac5c853560e01b81526001600160a01b039091169063ac5c853590611a0090869086906004016144a0565b600060405180830381600087803b158015611a1a57600080fd5b505af1158015611a2e573d6000803e3d6000fd5b50505050611c21565b6000611a428661352b565b8354909250839150611a569060019061465d565b81548110611a7457634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160010154811015611b8357815442908390611a9f9060019061465d565b81548110611abd57634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160010181905550848260018480549050611ae5919061465d565b81548110611b0357634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016000016000828254611b239190614606565b9091555050815485908390611b3a9060019061465d565b81548110611b5857634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016002016000828254611b789190614606565b90915550611c1f9050565b816040518060600160405280878152602001428152602001878560018780549050611bae919061465d565b81548110611bcc57634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160020154611be89190614606565b9052815460018181018455600093845260209384902083516003909302019182559282015192810192909255604001516002909101555b505b600085815260086020526040902054158015611c4557506000611c4386610fe3565b115b15611c8a57600c80546001810182557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c701869055546000868152600860205260409020555b6002546040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b03909116906323b872dd90606401602060405180830381600087803b158015611cdc57600080fd5b505af1158015611cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d149190613e2f565b611d305760405162461bcd60e51b81526004016111ea90614516565b336000908152600a602052604081208054869290611d4f908490614606565b9250508190555083857ff5ab15991b2cec1142b66b2c57a205c2af5e9d8fc5056bcb33b53b193990b07e858533604051611d8b939291906144b4565b60405180910390a35050505050565b600080546040516377b03e0d60e01b8152600481018490526001600160a01b03909116906377b03e0d9060240160206040518083038186803b158015611ddf57600080fd5b505afa158015611df3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fdd9190613ee1565b60096020528160005260406000208181548110611e3357600080fd5b600091825260209091206003909102018054600182015460029092015490935090915083565b600082815260066020908152604080832086845290915290208054611eb25760405162461bcd60e51b815260206004820152600f60248201526e066656564206e6f742073657420757608c1b60448201526064016111ea565b60008211611f025760405162461bcd60e51b815260206004820152601960248201527f6d7573742062652073656e64696e6720616e20616d6f756e740000000000000060448201526064016111ea565b81816001016000828254611f169190614606565b90915550506002546040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03909116906323b872dd90606401602060405180830381600087803b158015611f6d57600080fd5b505af1158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa59190613e2f565b611fc15760405162461bcd60e51b81526004016111ea90614516565b6007810154158015611fd7575060008160010154115b1561201757600b805460018101825560008290527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9018590555460078201555b336000908152600a602052604081208054849290612036908490614606565b909155505060408051338152825460208201526001830154818301526002830154606082015260038301546080820152600483015460a0820152600583015460c0820152600683015460e0820152600783015461010082015290518391859187917fdaf477f4ffa6a044c31632ac3040e483553fb75f8437629291046a833cc352af91908190036101200190a450505050565b60008181526005602090815260409182902080548351818402810184019094528084526060939283018282801561211f57602002820191906000526020600020905b81548152602001906001019080831161210b575b50505050509050919050565b6000838360405161213d9291906141e4565b60405180910390208b146121935760405162461bcd60e51b815260206004820152601d60248201527f6964206d7573742062652068617368206f66206279746573206461746100000060448201526064016111ea565b60408051602081018d90529081018b9052606081018a90526080810189905260a0810188905260c0810187905260e081018690526101000160408051601f19818403018152918152815160209283012060008e81526006845282812082825290935291208054919250901561224a5760405162461bcd60e51b815260206004820152601f60248201527f66656564206d757374206e6f742062652073657420757020616c72656164790060448201526064016111ea565b60008b1161229a5760405162461bcd60e51b815260206004820181905260248201527f726577617264206d7573742062652067726561746572207468616e207a65726f60448201526064016111ea565b600089116122f55760405162461bcd60e51b815260206004820152602260248201527f696e74657276616c206d7573742062652067726561746572207468616e207a65604482015261726f60f01b60648201526084016111ea565b8888106123555760405162461bcd60e51b815260206004820152602860248201527f77696e646f77206d757374206265206c657373207468616e20696e74657276616044820152670d840d8cadccee8d60c31b60648201526084016111ea565b8a8155600281018a905560038082018a905560048083018a905560058084018a90556006840189905560008f81526020918252604080822080546001810182559083528383200187905586825260079092528190208f90559154915163ac5c853560e01b81526001600160a01b039092169163ac5c8535916123db9189918991016144a0565b600060405180830381600087803b1580156123f557600080fd5b505af1158015612409573d6000803e3d6000fd5b50505050818c7f25b7a245f1298a141e9a73052d47515c64a19a5550bc21f5c896f2097e155efe878733604051612442939291906144b4565b60405180910390a3821561245b5761245b828d85611e59565b509a9950505050505050505050565b6000805460405163a792765f60e01b81526004810185905260248101849052606092916001600160a01b03169063a792765f9060440160006040518083038186803b1580156124b857600080fd5b505afa1580156124cc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124f49190810190613e49565b90969095509350505050565b61252460405180606001604052806000815260200160008152602001600081525090565b600083815260096020526040902080548390811061255257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016040518060600160405290816000820154815260200160018201548152602001600282015481525050905092915050565b606060008267ffffffffffffffff8111156125bc57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156125e5578160200160208202803683370190505b50905060005b838110156126955760008681526006602090815260408083208a845290915281206008019086868481811061263057634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060009054906101000a900460ff1682828151811061267357634e487b7160e01b600052603260045260246000fd5b911515602092830291909101909101528061268d816146bb565b9150506125eb565b5095945050505050565b60005460405163c5958af960e01b815260048101849052602481018390526060916001600160a01b03169063c5958af99060440160006040518083038186803b1580156126eb57600080fd5b505afa1580156126ff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fda91908101906140e9565b600c818154811061117257600080fd5b6000805460405163ce5e11bf60e01b815260048101859052602481018490526001600160a01b039091169063ce5e11bf9060440160206040518083038186803b15801561278357600080fd5b505afa158015612797573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fda9190613ee1565b6000805460405163703e2a4360e11b815260048101859052602481018490526001600160a01b039091169063e07c54869060440160206040518083038186803b15801561280757600080fd5b505afa15801561281b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fda9190613d6b565b600080600061284d85611d9a565b905080612861576000809250925050610bd4565b8061286b816146a4565b91506001905060008083816128808a83612737565b905088811161289b5760008097509750505050505050610bd4565b6128a58a84612737565b9050888111156128b457600094505b84156129665760026128c68484614606565b6128d0919061461e565b93506128dc8a85612737565b90508881111561291d5760006128f78b61068060018861465d565b90508981116129095760009550612917565b61291460018661465d565b92505b50612961565b600061292e8b610680876001614606565b905089811115612951576000955084612946816146bb565b95505080915061295f565b61295c856001614606565b93505b505b6128b4565b6129708a82610f56565b6129865760018497509750505050505050610bd4565b6129908a82610f56565b801561299b57508584105b156129be57836129aa816146bb565b9450506129b78a85612737565b9050612986565b85841480156129d257506129d28a82610f56565b156129e95760008097509750505050505050610bd4565b60018497509750505050505050610bd4565b6001546040516387a475fd60e01b8152600481018390526000918291829182916001600160a01b03909116906387a475fd9060240160206040518083038186803b158015612a4857600080fd5b505afa158015612a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a809190613ee1565b90506060612a93826105c7426001614606565b9450905083612aaf576000806101949450945094505050612ac4565b6000612aba826135ba565b955060c893505050505b9193909250565b606080600080612adf886106af888a61465d565b9150915081612b30576040805160008082526020820190925290612b13565b6060815260200190600190039081612afe5790505b506040805160008152602081019091529094509250612e21915050565b6000612b3c8989610b4c565b909350905082612b8f576040805160008082526020820190925290612b71565b6060815260200190600190039081612b5c5790505b506040805160008152602081019091529095509350612e2192505050565b60008060008867ffffffffffffffff811115612bbb57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612be4578160200160208202803683370190505b5090505b8883108015612c0b57508482612bff866001614606565b612c09919061465d565b115b15612c7d576000612c208d610680858861465d565b9050612c2c8d82610f56565b612c6a5780828581518110612c5157634e487b7160e01b600052603260045260246000fd5b602090810291909101015283612c66816146bb565b9450505b82612c74816146bb565b93505050612be8565b60008367ffffffffffffffff811115612ca657634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612cd957816020015b6060815260200190600190039081612cc45790505b50905060008467ffffffffffffffff811115612d0557634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612d2e578160200160208202803683370190505b50905060005b85811015612e14578381612d4960018961465d565b612d53919061465d565b81518110612d7157634e487b7160e01b600052603260045260246000fd5b6020026020010151828281518110612d9957634e487b7160e01b600052603260045260246000fd5b602002602001018181525050612dd68f838381518110612dc957634e487b7160e01b600052603260045260246000fd5b602002602001015161269f565b838281518110612df657634e487b7160e01b600052603260045260246000fd5b60200260200101819052508080612e0c906146bb565b915050612d34565b5090985096505050505050505b94509492505050565b600083815260096020526040902054612e905760405162461bcd60e51b815260206004820152602260248201527f6e6f2074697073207375626d697474656420666f722074686973207175657279604482015261125960f21b60648201526084016111ea565b6000805b82811015612eea57612ecc85858584818110612ec057634e487b7160e01b600052603260045260246000fd5b9050602002013561361f565b612ed69083614606565b915080612ee2816146bb565b915050612e94565b506002546004546001600160a01b039091169063a9059cbb9033906103e890612f13908661463e565b612f1d919061461e565b612f27908561465d565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015612f6d57600080fd5b505af1158015612f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fa59190613e2f565b612fae57600080fd5b6002546000546004546001600160a01b039283169263095ea7b39216906103e890612fd9908661463e565b612fe3919061461e565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561302957600080fd5b505af115801561303d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130619190613e2f565b506000546004546001600160a01b039091169063d9c51cd4906103e890613088908561463e565b613092919061461e565b6040518263ffffffff1660e01b81526004016130b091815260200190565b600060405180830381600087803b1580156130ca57600080fd5b505af11580156130de573d6000803e3d6000fd5b505050506130eb84610fe3565b61321957600084815260086020526040902054156132195760008481526008602052604081205461311e9060019061465d565b600c8054919250906131329060019061465d565b8154811061315057634e487b7160e01b600052603260045260246000fd5b9060005260206000200154600c828154811061317c57634e487b7160e01b600052603260045260246000fd5b90600052602060002001819055506000600c82815481106131ad57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508160016131c79190614606565b6000828152600860205260408082209290925587815290812055600c80548061320057634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505b6040513390829086907fdff45d500502d35c7f1150acbb404c5b2e288e31a74354c8553a283dd1e806e790600090a450505050565b60006224ea0061325e834261465d565b106132ab5760405162461bcd60e51b815260206004820152601e60248201527f74696d657374616d7020746f6f206f6c6420746f20636c61696d20746970000060448201526064016111ea565b60008381526006602090815260408083208784528252808320858452600881019092529091205460ff16156133225760405162461bcd60e51b815260206004820152601660248201527f72657761726420616c726561647920636c61696d65640000000000000000000060448201526064016111ea565b600381015460028201546000919061333a908661465d565b613344919061461e565b9050600081836000016003015461335b919061463e565b600284015461336a9190614606565b90506000613378878761269f565b90508051600014156133cc5760405162461bcd60e51b815260206004820152601c60248201527f6e6f2076616c7565206578697374732061742074696d657374616d700000000060448201526064016111ea565b6000806133d9898961246a565b600588015491935091506000901561346a5760006133f685613b8c565b9050600061340385613b8c565b905080613414576127109250613467565b8082106134435780613426818461465d565b6134329061271061463e565b61343c919061461e565b9250613467565b8061344e838261465d565b61345a9061271061463e565b613464919061461e565b92505b50505b86549750600061347a868b61465d565b60048901549091508110801561348f57508583105b156134b55760068801546134a490829061463e565b6134ae908a614606565b9850613508565b600588015482116135085760405162461bcd60e51b815260206004820152601760248201527f7072696365207468726573686f6c64206e6f74206d657400000000000000000060448201526064016111ea565b600188015489111561351c57600188015498505b50505050505050509392505050565b606060008061353984611d9a565b90508061355c5760405180602001604052806000815250600092509250506135b5565b60005b81156135a0578161356f816146a4565b92505061357c8583612737565b9050613588858261269f565b80519094501561359b5791506135b59050565b61355f565b60408051602081019091526000815293509150505b915091565b6000805b8251811015613619578281815181106135e757634e487b7160e01b600052603260045260246000fd5b016020015160f81c6135fb8361010061463e565b6136059190614606565b915080613611816146bb565b9150506135be565b50919050565b600061a8c061362e834261465d565b1161367b5760405162461bcd60e51b815260206004820152601a60248201527f6275666665722074696d6520686173206e6f742070617373656400000000000060448201526064016111ea565b6136858383610f56565b156136c35760405162461bcd60e51b815260206004820152600e60248201526d1d985b1d5948191a5cdc1d5d195960921b60448201526064016111ea565b6136cd83836127bb565b6001600160a01b0316336001600160a01b0316146137395760405162461bcd60e51b815260206004820152602360248201527f6d73672073656e646572206d757374206265207265706f72746572206164647260448201526265737360e81b60648201526084016111ea565b60008381526009602052604081208054909190815b600161375a848461465d565b11156137c257600261376c8484614606565b613776919061461e565b90508584828154811061379957634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016001015411156137b9578091506137bd565b8092505b61374e565b60006137ce888861246a565b9150508484815481106137f157634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160010154811061385b5760405162461bcd60e51b815260206004820152602160248201527f746970206561726e65642062792070726576696f7573207375626d697373696f6044820152603760f91b60648201526084016111ea565b84848154811061387b57634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600101548710156138dc5760405162461bcd60e51b815260206004820152601e60248201527f74696d657374616d70206e6f7420656c696769626c6520666f7220746970000060448201526064016111ea565b60008585815481106138fe57634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160000154116139535760405162461bcd60e51b81526020600482015260136024820152721d1a5c08185b1c9958591e4818db185a5b5959606a1b60448201526064016111ea565b84848154811061397357634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160000154955060008585815481106139a957634e487b7160e01b600052603260045260246000fd5b6000918252602082206003909102019190915584906139cd8a61032b8b6001614606565b915060009050806139e38c61032b876001614606565b909250905060016139f4828561465d565b11806139fe575081155b15613b7d5781613a4157888481548110613a2857634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600201549950613b7d565b60009796505b6001613a53898961465d565b1115613abb576002613a658989614606565b613a6f919061461e565b955084898781548110613a9257634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600101541115613ab257859650613ab6565b8597505b613a47565b87613ac5816146bb565b98505083881015613b7d57888881548110613af057634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160000154898981548110613b2257634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600201548a8681548110613b5457634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160020154613b70919061465d565b613b7a9190614606565b99505b50505050505050505092915050565b6000805b825181101561361957828181518110613bb957634e487b7160e01b600052603260045260246000fd5b016020015160f81c613bcd8361010061463e565b613bd79190614606565b915080613be3816146bb565b915050613b90565b6040518060400160405280613c3e60405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b8152602001606081525090565b60008083601f840112613c5c578182fd5b50813567ffffffffffffffff811115613c73578182fd5b6020830191508360208260051b8501011115610bd457600080fd5b8051801515811461109857600080fd5b60008083601f840112613caf578182fd5b50813567ffffffffffffffff811115613cc6578182fd5b602083019150836020828501011115610bd457600080fd5b600082601f830112613cee578081fd5b815167ffffffffffffffff811115613d0857613d086146ec565b613d1b601f8201601f19166020016145d5565b818152846020838601011115613d2f578283fd5b613d40826020830160208701614674565b949350505050565b600060208284031215613d59578081fd5b8135613d6481614702565b9392505050565b600060208284031215613d7c578081fd5b8151613d6481614702565b60006020808385031215613d99578182fd5b825167ffffffffffffffff80821115613db0578384fd5b818501915085601f830112613dc3578384fd5b815181811115613dd557613dd56146ec565b8060051b9150613de68483016145d5565b8181528481019084860184860187018a1015613e00578788fd5b8795505b83861015613e22578051835260019590950194918601918601613e04565b5098975050505050505050565b600060208284031215613e40578081fd5b610fda82613c8e565b600080600060608486031215613e5d578182fd5b613e6684613c8e565b9250602084015167ffffffffffffffff811115613e81578283fd5b613e8d86828701613cde565b925050604084015190509250925092565b60008060408385031215613eb0578182fd5b613eb983613c8e565b9150602083015190509250929050565b600060208284031215613eda578081fd5b5035919050565b600060208284031215613ef2578081fd5b5051919050565b600080600060408486031215613f0d578283fd5b83359250602084013567ffffffffffffffff811115613f2a578283fd5b613f3686828701613c4b565b9497909650939450505050565b60008060008060608587031215613f58578081fd5b8435935060208501359250604085013567ffffffffffffffff811115613f7c578182fd5b613f8887828801613c4b565b95989497509550505050565b600080600060608486031215613fa8578081fd5b505081359360208301359350604090920135919050565b60008060408385031215613fd1578182fd5b50508035926020909101359150565b60008060008060608587031215613ff5578182fd5b8435935060208501359250604085013567ffffffffffffffff811115614019578283fd5b613f8887828801613c9e565b6000806000806080858703121561403a578182fd5b5050823594602084013594506040840135936060013592509050565b6000806000806000806000806000806101208b8d031215614075578788fd5b8a35995060208b0135985060408b0135975060608b0135965060808b0135955060a08b0135945060c08b0135935060e08b013567ffffffffffffffff8111156140bc578384fd5b6140c88d828e01613c9e565b915080945050809250506101008b013590509295989b9194979a5092959850565b6000602082840312156140fa578081fd5b815167ffffffffffffffff811115614110578182fd5b613d4084828501613cde565b600061010080838503121561412f578182fd5b614138816145d5565b9050825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201528091505092915050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b600081518084526141d0816020860160208601614674565b601f01601f19169290920160200192915050565b6000828483379101908152919050565b6020808252825182820181905260009190848201906040850190845b8181101561422e578351151583529284019291840191600101614210565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561422e57835183529284019291840191600101614256565b6000604082016040835280855180835260608501915060608160051b86010192506020808801855b838110156142c857605f198887030185526142b68683516141b8565b9550938201939082019060010161429a565b505085840381870152865180855287820194820193509150845b828110156142fe578451845293810193928101926001016142e2565b5091979650505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b828110156143c857603f19888603018452815161012061439b878351805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301525050565b878201519150806101008801526143b4818801836141b8565b965050509285019290850190600101614331565b5092979650505050505050565b60006020808301818452808551808352604092508286019150828160051b870101848801865b8381101561443c57888303603f190185528151805187855261441f888601826141b8565b9189015194890194909452948701949250908601906001016143fb565b509098975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561422e5761448d8385518051825260208082015190830152604090810151910152565b9284019260609290920191600101614466565b600060208252613d4060208301848661418e565b6000604082526144c860408301858761418e565b90506001600160a01b0383166020830152949350505050565b600060208252610fda60208301846141b8565b60006040825261450760408301856141b8565b90508260208301529392505050565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6101008101610fdd8284805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260e081015160e08301525050565b81518152602080830151908201526040808301519082015260608101610fdd565b604051601f8201601f1916810167ffffffffffffffff811182821017156145fe576145fe6146ec565b604052919050565b60008219821115614619576146196146d6565b500190565b60008261463957634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615614658576146586146d6565b500290565b60008282101561466f5761466f6146d6565b500390565b60005b8381101561468f578181015183820152602001614677565b8381111561469e576000848401525b50505050565b6000816146b3576146b36146d6565b506000190190565b60006000198214156146cf576146cf6146d6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461471757600080fd5b5056fea2646970667358221220b61624ef0f357a5e7526f080dae2d83b72d8789cfb8d340d3bd07dd05386129c64736f6c6343000803003300000000000000000000000015e6cc0d69a162151cadfba035aa10b82b12b970000000000000000000000000d71f72c18767083e4e3fe84f9c62b8038c1ef4f60000000000000000000000000000000000000000000000000000000000000014

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.