MOVR Price: $13.97 (-1.27%)
Gas: 3 GWei

Contract

0x01364f11D7D617886a19AD45399cFe036dA7f504

Overview

MOVR Balance

Moonriver Chain LogoMoonriver Chain LogoMoonriver Chain Logo0 MOVR

MOVR Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Request Update64155712024-03-26 5:45:4227 days ago1711431942IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64153022024-03-26 4:48:3628 days ago1711428516IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64150362024-03-26 3:51:3028 days ago1711425090IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64147722024-03-26 2:55:1228 days ago1711421712IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64144892024-03-26 1:56:0628 days ago1711418166IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64142152024-03-26 0:59:1228 days ago1711414752IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64134652024-03-25 22:22:0628 days ago1711405326IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64132042024-03-25 21:25:5428 days ago1711401954IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64129242024-03-25 20:28:1228 days ago1711398492IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64126542024-03-25 19:30:2428 days ago1711395024IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64122192024-03-25 17:55:4828 days ago1711389348IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64119562024-03-25 16:59:0028 days ago1711385940IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update64116162024-03-25 15:48:5428 days ago1711381734IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61995672024-02-22 23:34:4860 days ago1708644888IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61993042024-02-22 22:37:4860 days ago1708641468IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61969602024-02-22 13:32:3660 days ago1708608756IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61966942024-02-22 12:30:4260 days ago1708605042IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61964212024-02-22 11:33:1860 days ago1708601598IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61947132024-02-22 5:21:4860 days ago1708579308IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61944332024-02-22 4:21:4861 days ago1708575708IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61941622024-02-22 3:24:4261 days ago1708572282IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61938872024-02-22 2:23:1261 days ago1708568592IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61936312024-02-22 1:26:0661 days ago1708565166IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61931722024-02-21 23:42:3061 days ago1708558950IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
Request Update61929182024-02-21 22:45:3061 days ago1708555530IN
0x01364f11...36dA7f504
0.00014375 MOVR0.000309331.25
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
64155712024-03-26 5:45:4227 days ago1711431942
0x01364f11...36dA7f504
0.00014375 MOVR
64153022024-03-26 4:48:3628 days ago1711428516
0x01364f11...36dA7f504
0.00014375 MOVR
64150362024-03-26 3:51:3028 days ago1711425090
0x01364f11...36dA7f504
0.00014375 MOVR
64147722024-03-26 2:55:1228 days ago1711421712
0x01364f11...36dA7f504
0.00014375 MOVR
64144892024-03-26 1:56:0628 days ago1711418166
0x01364f11...36dA7f504
0.00014375 MOVR
64142152024-03-26 0:59:1228 days ago1711414752
0x01364f11...36dA7f504
0.00014375 MOVR
64137382024-03-25 23:19:1228 days ago1711408752
0x01364f11...36dA7f504
0.00014375 MOVR
64134652024-03-25 22:22:0628 days ago1711405326
0x01364f11...36dA7f504
0.00014375 MOVR
64132042024-03-25 21:25:5428 days ago1711401954
0x01364f11...36dA7f504
0.00014375 MOVR
64129242024-03-25 20:28:1228 days ago1711398492
0x01364f11...36dA7f504
0.00014375 MOVR
64126542024-03-25 19:30:2428 days ago1711395024
0x01364f11...36dA7f504
0.00014375 MOVR
64122192024-03-25 17:55:4828 days ago1711389348
0x01364f11...36dA7f504
0.00014375 MOVR
64119562024-03-25 16:59:0028 days ago1711385940
0x01364f11...36dA7f504
0.00014375 MOVR
64116162024-03-25 15:48:5428 days ago1711381734
0x01364f11...36dA7f504
0.00014375 MOVR
61995672024-02-22 23:34:4860 days ago1708644888
0x01364f11...36dA7f504
0.00014375 MOVR
61993042024-02-22 22:37:4860 days ago1708641468
0x01364f11...36dA7f504
0.00014375 MOVR
61969602024-02-22 13:32:3660 days ago1708608756
0x01364f11...36dA7f504
0.00014375 MOVR
61964212024-02-22 11:33:1860 days ago1708601598
0x01364f11...36dA7f504
0.00014375 MOVR
61947132024-02-22 5:21:4860 days ago1708579308
0x01364f11...36dA7f504
0.00014375 MOVR
61944332024-02-22 4:21:4861 days ago1708575708
0x01364f11...36dA7f504
0.00014375 MOVR
61941622024-02-22 3:24:4261 days ago1708572282
0x01364f11...36dA7f504
0.00014375 MOVR
61938872024-02-22 2:23:1261 days ago1708568592
0x01364f11...36dA7f504
0.00014375 MOVR
61936312024-02-22 1:26:0661 days ago1708565166
0x01364f11...36dA7f504
0.00014375 MOVR
61931722024-02-21 23:42:3061 days ago1708558950
0x01364f11...36dA7f504
0.00014375 MOVR
61929182024-02-21 22:45:3061 days ago1708555530
0x01364f11...36dA7f504
0.00014375 MOVR
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xA6088f5e...30304c909
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
WitnetPriceFeed

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at moonriver.moonscan.io on 2023-02-06
*/

// SPDX-License-Identifier: MIT

pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;

// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardEvents.sol
/// @title Witnet Request Board emitting events interface.
/// @author The Witnet Foundation.
interface IWitnetRequestBoardEvents {
    /// Emitted when a Witnet Data Request is posted to the WRB.
    event PostedRequest(uint256 queryId, address from);

    /// Emitted when a Witnet-solved result is reported to the WRB.
    event PostedResult(uint256 queryId, address from);

    /// Emitted when all data related to given query is deleted from the WRB.
    event DeletedQuery(uint256 queryId, address from);
}
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardReporter.sol
/// @title The Witnet Request Board Reporter interface.
/// @author The Witnet Foundation.
interface IWitnetRequestBoardReporter {
    /// Reports the Witnet-provided result to a previously posted request. 
    /// @dev Will assume `block.timestamp` as the timestamp at which the request was solved.
    /// @dev Fails if:
    /// @dev - the `_queryId` is not in 'Posted' status.
    /// @dev - provided `_drTxHash` is zero;
    /// @dev - length of provided `_result` is zero.
    /// @param _queryId The unique identifier of the data request.
    /// @param _drTxHash The hash of the corresponding data request transaction in Witnet.
    /// @param _result The result itself as bytes.
    function reportResult(
            uint256 _queryId,
            bytes32 _drTxHash,
            bytes calldata _result
        ) external;

    /// Reports the Witnet-provided result to a previously posted request.
    /// @dev Fails if:
    /// @dev - called from unauthorized address;
    /// @dev - the `_queryId` is not in 'Posted' status.
    /// @dev - provided `_drTxHash` is zero;
    /// @dev - length of provided `_result` is zero.
    /// @param _queryId The unique query identifier
    /// @param _timestamp The timestamp of the solving tally transaction in Witnet.
    /// @param _drTxHash The hash of the corresponding data request transaction in Witnet.
    /// @param _result The result itself as bytes.
    function reportResult(
            uint256 _queryId,
            uint256 _timestamp,
            bytes32 _drTxHash,
            bytes calldata _result
        ) external;

    /// Reports Witnet-provided results to multiple requests within a single EVM tx.
    /// @dev Must emit a PostedResult event for every succesfully reported result.
    /// @param _batchResults Array of BatchResult structs, every one containing:
    ///         - unique query identifier;
    ///         - timestamp of the solving tally txs in Witnet. If zero is provided, EVM-timestamp will be used instead;
    ///         - hash of the corresponding data request tx at the Witnet side-chain level;
    ///         - data request result in raw bytes.
    /// @param _verbose If true, must emit a BatchReportError event for every failing report, if any. 
    function reportResultBatch(BatchResult[] calldata _batchResults, bool _verbose) external;
        
        struct BatchResult {
            uint256 queryId;
            uint256 timestamp;
            bytes32 drTxHash;
            bytes   cborBytes;
        }

        event BatchReportError(uint256 queryId, string reason);
}
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequest.sol
/// @title The Witnet Data Request basic interface.
/// @author The Witnet Foundation.
interface IWitnetRequest {
    /// A `IWitnetRequest` is constructed around a `bytes` value containing 
    /// a well-formed Witnet Data Request using Protocol Buffers.
    function bytecode() external view returns (bytes memory);

    /// Returns SHA256 hash of Witnet Data Request as CBOR-encoded bytes.
    function hash() external view returns (bytes32);
}
// File: node_modules\witnet-solidity-bridge\contracts\libs\Witnet.sol
library Witnet {

    /// @notice Witnet function that computes the hash of a CBOR-encoded Data Request.
    /// @param _bytecode CBOR-encoded RADON.
    function hash(bytes memory _bytecode) internal pure returns (bytes32) {
        return sha256(_bytecode);
    }

    /// Struct containing both request and response data related to every query posted to the Witnet Request Board
    struct Query {
        Request request;
        Response response;
        address from;      // Address from which the request was posted.
    }

    /// Possible status of a Witnet query.
    enum QueryStatus {
        Unknown,
        Posted,
        Reported,
        Deleted
    }

    /// Data kept in EVM-storage for every Request posted to the Witnet Request Board.
    struct Request {
        IWitnetRequest addr;    // The contract containing the Data Request which execution has been requested.
        address requester;      // Address from which the request was posted.
        bytes32 hash;           // Hash of the Data Request whose execution has been requested.
        uint256 gasprice;       // Minimum gas price the DR resolver should pay on the solving tx.
        uint256 reward;         // Escrowed reward to be paid to the DR resolver.
    }

    /// Data kept in EVM-storage containing Witnet-provided response metadata and result.
    struct Response {
        address reporter;       // Address from which the result was reported.
        uint256 timestamp;      // Timestamp of the Witnet-provided result.
        bytes32 drTxHash;       // Hash of the Witnet transaction that solved the queried Data Request.
        bytes   cborBytes;      // Witnet-provided result CBOR-bytes to the queried Data Request.
    }

    /// Data struct containing the Witnet-provided result to a Data Request.
    struct Result {
        bool success;           // Flag stating whether the request could get solved successfully, or not.
        CBOR value;             // Resulting value, in CBOR-serialized bytes.
    }

    /// Data struct following the RFC-7049 standard: Concise Binary Object Representation.
    struct CBOR {
        Buffer buffer;
        uint8 initialByte;
        uint8 majorType;
        uint8 additionalInformation;
        uint64 len;
        uint64 tag;
    }

    /// Iterable bytes buffer.
    struct Buffer {
        bytes data;
        uint32 cursor;
    }

    /// Witnet error codes table.
    enum ErrorCodes {
        // 0x00: Unknown error. Something went really bad!
        Unknown,
        // Script format errors
        /// 0x01: At least one of the source scripts is not a valid CBOR-encoded value.
        SourceScriptNotCBOR,
        /// 0x02: The CBOR value decoded from a source script is not an Array.
        SourceScriptNotArray,
        /// 0x03: The Array value decoded form a source script is not a valid Data Request.
        SourceScriptNotRADON,
        /// Unallocated
        ScriptFormat0x04,
        ScriptFormat0x05,
        ScriptFormat0x06,
        ScriptFormat0x07,
        ScriptFormat0x08,
        ScriptFormat0x09,
        ScriptFormat0x0A,
        ScriptFormat0x0B,
        ScriptFormat0x0C,
        ScriptFormat0x0D,
        ScriptFormat0x0E,
        ScriptFormat0x0F,
        // Complexity errors
        /// 0x10: The request contains too many sources.
        RequestTooManySources,
        /// 0x11: The script contains too many calls.
        ScriptTooManyCalls,
        /// Unallocated
        Complexity0x12,
        Complexity0x13,
        Complexity0x14,
        Complexity0x15,
        Complexity0x16,
        Complexity0x17,
        Complexity0x18,
        Complexity0x19,
        Complexity0x1A,
        Complexity0x1B,
        Complexity0x1C,
        Complexity0x1D,
        Complexity0x1E,
        Complexity0x1F,
        // Operator errors
        /// 0x20: The operator does not exist.
        UnsupportedOperator,
        /// Unallocated
        Operator0x21,
        Operator0x22,
        Operator0x23,
        Operator0x24,
        Operator0x25,
        Operator0x26,
        Operator0x27,
        Operator0x28,
        Operator0x29,
        Operator0x2A,
        Operator0x2B,
        Operator0x2C,
        Operator0x2D,
        Operator0x2E,
        Operator0x2F,
        // Retrieval-specific errors
        /// 0x30: At least one of the sources could not be retrieved, but returned HTTP error.
        HTTP,
        /// 0x31: Retrieval of at least one of the sources timed out.
        RetrievalTimeout,
        /// Unallocated
        Retrieval0x32,
        Retrieval0x33,
        Retrieval0x34,
        Retrieval0x35,
        Retrieval0x36,
        Retrieval0x37,
        Retrieval0x38,
        Retrieval0x39,
        Retrieval0x3A,
        Retrieval0x3B,
        Retrieval0x3C,
        Retrieval0x3D,
        Retrieval0x3E,
        Retrieval0x3F,
        // Math errors
        /// 0x40: Math operator caused an underflow.
        Underflow,
        /// 0x41: Math operator caused an overflow.
        Overflow,
        /// 0x42: Tried to divide by zero.
        DivisionByZero,
        /// Unallocated
        Math0x43,
        Math0x44,
        Math0x45,
        Math0x46,
        Math0x47,
        Math0x48,
        Math0x49,
        Math0x4A,
        Math0x4B,
        Math0x4C,
        Math0x4D,
        Math0x4E,
        Math0x4F,
        // Other errors
        /// 0x50: Received zero reveals
        NoReveals,
        /// 0x51: Insufficient consensus in tally precondition clause
        InsufficientConsensus,
        /// 0x52: Received zero commits
        InsufficientCommits,
        /// 0x53: Generic error during tally execution
        TallyExecution,
        /// Unallocated
        OtherError0x54,
        OtherError0x55,
        OtherError0x56,
        OtherError0x57,
        OtherError0x58,
        OtherError0x59,
        OtherError0x5A,
        OtherError0x5B,
        OtherError0x5C,
        OtherError0x5D,
        OtherError0x5E,
        OtherError0x5F,
        /// 0x60: Invalid reveal serialization (malformed reveals are converted to this value)
        MalformedReveal,
        /// Unallocated
        OtherError0x61,
        OtherError0x62,
        OtherError0x63,
        OtherError0x64,
        OtherError0x65,
        OtherError0x66,
        OtherError0x67,
        OtherError0x68,
        OtherError0x69,
        OtherError0x6A,
        OtherError0x6B,
        OtherError0x6C,
        OtherError0x6D,
        OtherError0x6E,
        OtherError0x6F,
        // Access errors
        /// 0x70: Tried to access a value from an index using an index that is out of bounds
        ArrayIndexOutOfBounds,
        /// 0x71: Tried to access a value from a map using a key that does not exist
        MapKeyNotFound,
        /// Unallocated
        OtherError0x72,
        OtherError0x73,
        OtherError0x74,
        OtherError0x75,
        OtherError0x76,
        OtherError0x77,
        OtherError0x78,
        OtherError0x79,
        OtherError0x7A,
        OtherError0x7B,
        OtherError0x7C,
        OtherError0x7D,
        OtherError0x7E,
        OtherError0x7F,
        OtherError0x80,
        OtherError0x81,
        OtherError0x82,
        OtherError0x83,
        OtherError0x84,
        OtherError0x85,
        OtherError0x86,
        OtherError0x87,
        OtherError0x88,
        OtherError0x89,
        OtherError0x8A,
        OtherError0x8B,
        OtherError0x8C,
        OtherError0x8D,
        OtherError0x8E,
        OtherError0x8F,
        OtherError0x90,
        OtherError0x91,
        OtherError0x92,
        OtherError0x93,
        OtherError0x94,
        OtherError0x95,
        OtherError0x96,
        OtherError0x97,
        OtherError0x98,
        OtherError0x99,
        OtherError0x9A,
        OtherError0x9B,
        OtherError0x9C,
        OtherError0x9D,
        OtherError0x9E,
        OtherError0x9F,
        OtherError0xA0,
        OtherError0xA1,
        OtherError0xA2,
        OtherError0xA3,
        OtherError0xA4,
        OtherError0xA5,
        OtherError0xA6,
        OtherError0xA7,
        OtherError0xA8,
        OtherError0xA9,
        OtherError0xAA,
        OtherError0xAB,
        OtherError0xAC,
        OtherError0xAD,
        OtherError0xAE,
        OtherError0xAF,
        OtherError0xB0,
        OtherError0xB1,
        OtherError0xB2,
        OtherError0xB3,
        OtherError0xB4,
        OtherError0xB5,
        OtherError0xB6,
        OtherError0xB7,
        OtherError0xB8,
        OtherError0xB9,
        OtherError0xBA,
        OtherError0xBB,
        OtherError0xBC,
        OtherError0xBD,
        OtherError0xBE,
        OtherError0xBF,
        OtherError0xC0,
        OtherError0xC1,
        OtherError0xC2,
        OtherError0xC3,
        OtherError0xC4,
        OtherError0xC5,
        OtherError0xC6,
        OtherError0xC7,
        OtherError0xC8,
        OtherError0xC9,
        OtherError0xCA,
        OtherError0xCB,
        OtherError0xCC,
        OtherError0xCD,
        OtherError0xCE,
        OtherError0xCF,
        OtherError0xD0,
        OtherError0xD1,
        OtherError0xD2,
        OtherError0xD3,
        OtherError0xD4,
        OtherError0xD5,
        OtherError0xD6,
        OtherError0xD7,
        OtherError0xD8,
        OtherError0xD9,
        OtherError0xDA,
        OtherError0xDB,
        OtherError0xDC,
        OtherError0xDD,
        OtherError0xDE,
        OtherError0xDF,
        // Bridge errors: errors that only belong in inter-client communication
        /// 0xE0: Requests that cannot be parsed must always get this error as their result.
        /// However, this is not a valid result in a Tally transaction, because invalid requests
        /// are never included into blocks and therefore never get a Tally in response.
        BridgeMalformedRequest,
        /// 0xE1: Witnesses exceeds 100
        BridgePoorIncentives,
        /// 0xE2: The request is rejected on the grounds that it may cause the submitter to spend or stake an
        /// amount of value that is unjustifiably high when compared with the reward they will be getting
        BridgeOversizedResult,
        /// Unallocated
        OtherError0xE3,
        OtherError0xE4,
        OtherError0xE5,
        OtherError0xE6,
        OtherError0xE7,
        OtherError0xE8,
        OtherError0xE9,
        OtherError0xEA,
        OtherError0xEB,
        OtherError0xEC,
        OtherError0xED,
        OtherError0xEE,
        OtherError0xEF,
        OtherError0xF0,
        OtherError0xF1,
        OtherError0xF2,
        OtherError0xF3,
        OtherError0xF4,
        OtherError0xF5,
        OtherError0xF6,
        OtherError0xF7,
        OtherError0xF8,
        OtherError0xF9,
        OtherError0xFA,
        OtherError0xFB,
        OtherError0xFC,
        OtherError0xFD,
        OtherError0xFE,
        // This should not exist:
        /// 0xFF: Some tally error is not intercepted but should
        UnhandledIntercept
    }
}
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardRequestor.sol
/// @title Witnet Requestor Interface
/// @notice It defines how to interact with the Witnet Request Board in order to:
///   - request the execution of Witnet Radon scripts (data request);
///   - upgrade the resolution reward of any previously posted request, in case gas price raises in mainnet;
///   - read the result of any previously posted request, eventually reported by the Witnet DON.
///   - remove from storage all data related to past and solved data requests, and results.
/// @author The Witnet Foundation.
interface IWitnetRequestBoardRequestor {
    /// Retrieves a copy of all Witnet-provided data related to a previously posted request, removing the whole query from the WRB storage.
    /// @dev Fails if the `_queryId` is not in 'Reported' status, or called from an address different to
    /// @dev the one that actually posted the given request.
    /// @param _queryId The unique query identifier.
    function deleteQuery(uint256 _queryId) external returns (Witnet.Response memory);

    /// Requests the execution of the given Witnet Data Request in expectation that it will be relayed and solved by the Witnet DON.
    /// A reward amount is escrowed by the Witnet Request Board that will be transferred to the reporter who relays back the Witnet-provided 
    /// result to this request.
    /// @dev Fails if:
    /// @dev - provided reward is too low.
    /// @dev - provided script is zero address.
    /// @dev - provided script bytecode is empty.
    /// @param _addr The address of the IWitnetRequest contract that can provide the actual Data Request bytecode.
    /// @return _queryId An unique query identifier.
    function postRequest(IWitnetRequest _addr) external payable returns (uint256 _queryId);

    /// Increments the reward of a previously posted request by adding the transaction value to it.
    /// @dev Updates request `gasPrice` in case this method is called with a higher 
    /// @dev gas price value than the one used in previous calls to `postRequest` or
    /// @dev `upgradeReward`. 
    /// @dev Fails if the `_queryId` is not in 'Posted' status.
    /// @dev Fails also in case the request `gasPrice` is increased, and the new 
    /// @dev reward value gets below new recalculated threshold. 
    /// @param _queryId The unique query identifier.
    function upgradeReward(uint256 _queryId) external payable;
}
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardView.sol
/// @title Witnet Request Board info interface.
/// @author The Witnet Foundation.
interface IWitnetRequestBoardView {
    /// Estimates the amount of reward we need to insert for a given gas price.
    /// @param _gasPrice The gas price for which we need to calculate the rewards.
    function estimateReward(uint256 _gasPrice) external view returns (uint256);

    /// Returns next query id to be generated by the Witnet Request Board.
    function getNextQueryId() external view returns (uint256);

    /// Gets the whole Query data contents, if any, no matter its current status.
    function getQueryData(uint256 _queryId) external view returns (Witnet.Query memory);

    /// Gets current status of given query.
    function getQueryStatus(uint256 _queryId) external view returns (Witnet.QueryStatus);

    /// Retrieves the whole Request record posted to the Witnet Request Board.
    /// @dev Fails if the `_queryId` is not valid or, if it has already been reported
    /// @dev or deleted.
    /// @param _queryId The unique identifier of a previously posted query.
    function readRequest(uint256 _queryId) external view returns (Witnet.Request memory);

    /// Retrieves the serialized bytecode of a previously posted Witnet Data Request.
    /// @dev Fails if the `_queryId` is not valid, or if the related script bytecode 
    /// @dev got changed after being posted. Returns empty array once it gets reported, 
    /// @dev or deleted.
    /// @param _queryId The unique query identifier.
    function readRequestBytecode(uint256 _queryId) external view returns (bytes memory);

    /// Retrieves the gas price that any assigned reporter will have to pay when reporting 
    /// result to a previously posted Witnet data request.
    /// @dev Fails if the `_queryId` is not valid or, if it has already been 
    /// @dev reported, or deleted. 
    /// @param _queryId The unique query identifie
    function readRequestGasPrice(uint256 _queryId) external view returns (uint256);

    /// Retrieves the reward currently set for the referred query.
    /// @dev Fails if the `_queryId` is not valid or, if it has already been 
    /// @dev reported, or deleted. 
    /// @param _queryId The unique query identifier.
    function readRequestReward(uint256 _queryId) external view returns (uint256);

    /// Retrieves the whole `Witnet.Response` record referred to a previously posted Witnet Data Request.
    /// @dev Fails if the `_queryId` is not in 'Reported' status.
    /// @param _queryId The unique query identifier.
    function readResponse(uint256 _queryId) external view returns (Witnet.Response memory);

    /// Retrieves the hash of the Witnet transaction hash that actually solved the referred query.
    /// @dev Fails if the `_queryId` is not in 'Reported' status.
    /// @param _queryId The unique query identifier.
    function readResponseDrTxHash(uint256 _queryId) external view returns (bytes32);    

    /// Retrieves the address that reported the result to a previously-posted request.
    /// @dev Fails if the `_queryId` is not in 'Reported' status.
    /// @param _queryId The unique query identifier.
    function readResponseReporter(uint256 _queryId) external view returns (address);

    /// Retrieves the Witnet-provided CBOR-bytes result of a previously posted request.
    /// @dev Fails if the `_queryId` is not in 'Reported' status.
    /// @param _queryId The unique query identifier.
    function readResponseResult(uint256 _queryId) external view returns (Witnet.Result memory);

    /// Retrieves the timestamp in which the result to the referred query was solved by the Witnet DON.
    /// @dev Fails if the `_queryId` is not in 'Reported' status.
    /// @param _queryId The unique query identifier.
    function readResponseTimestamp(uint256 _queryId) external view returns (uint256);
}
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestParser.sol
/// @title The Witnet interface for decoding Witnet-provided request to Data Requests.
/// This interface exposes functions to check for the success/failure of
/// a Witnet-provided result, as well as to parse and convert result into
/// Solidity types suitable to the application level. 
/// @author The Witnet Foundation.
interface IWitnetRequestParser {

    /// Decode raw CBOR bytes into a Witnet.Result instance.
    /// @param _cborBytes Raw bytes representing a CBOR-encoded value.
    /// @return A `Witnet.Result` instance.
    function resultFromCborBytes(bytes memory _cborBytes) external pure returns (Witnet.Result memory);

    /// Decode a CBOR value into a Witnet.Result instance.
    /// @param _cborValue An instance of `Witnet.CBOR`.
    /// @return A `Witnet.Result` instance.
    function resultFromCborValue(Witnet.CBOR memory _cborValue) external pure returns (Witnet.Result memory);

    /// Tell if a Witnet.Result is successful.
    /// @param _result An instance of Witnet.Result.
    /// @return `true` if successful, `false` if errored.
    function isOk(Witnet.Result memory _result) external pure returns (bool);

    /// Tell if a Witnet.Result is errored.
    /// @param _result An instance of Witnet.Result.
    /// @return `true` if errored, `false` if successful.
    function isError(Witnet.Result memory _result) external pure returns (bool);

    /// Decode a bytes value from a Witnet.Result as a `bytes` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `bytes` decoded from the Witnet.Result.
    function asBytes(Witnet.Result memory _result) external pure returns (bytes memory);

    /// Decode a bytes value from a Witnet.Result as a `bytes32` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `bytes32` decoded from the Witnet.Result.
    function asBytes32(Witnet.Result memory _result) external pure returns (bytes32);

    /// Decode an error code from a Witnet.Result as a member of `Witnet.ErrorCodes`.
    /// @param _result An instance of `Witnet.Result`.
    /// @return The `CBORValue.Error memory` decoded from the Witnet.Result.
    function asErrorCode(Witnet.Result memory _result) external pure returns (Witnet.ErrorCodes);


    /// Generate a suitable error message for a member of `Witnet.ErrorCodes` and its corresponding arguments.
    /// @dev WARN: Note that client contracts should wrap this function into a try-catch foreseing potential errors generated in this function
    /// @param _result An instance of `Witnet.Result`.
    /// @return A tuple containing the `CBORValue.Error memory` decoded from the `Witnet.Result`, plus a loggable error message.
    function asErrorMessage(Witnet.Result memory _result) external pure returns (Witnet.ErrorCodes, string memory);

    /// Decode a raw error from a `Witnet.Result` as a `uint64[]`.
    /// @param _result An instance of `Witnet.Result`.
    /// @return The `uint64[]` raw error as decoded from the `Witnet.Result`.
    function asRawError(Witnet.Result memory _result) external pure returns(uint64[] memory);

    /// Decode a boolean value from a Witnet.Result as an `bool` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `bool` decoded from the Witnet.Result.
    function asBool(Witnet.Result memory _result) external pure returns (bool);

    /// Decode a fixed16 (half-precision) numeric value from a Witnet.Result as an `int32` value.
    /// @dev Due to the lack of support for floating or fixed point arithmetic in the EVM, this method offsets all values.
    /// by 5 decimal orders so as to get a fixed precision of 5 decimal positions, which should be OK for most `fixed16`.
    /// use cases. In other words, the output of this method is 10,000 times the actual value, encoded into an `int32`.
    /// @param _result An instance of Witnet.Result.
    /// @return The `int128` decoded from the Witnet.Result.
    function asFixed16(Witnet.Result memory _result) external pure returns (int32);

    /// Decode an array of fixed16 values from a Witnet.Result as an `int128[]` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `int128[]` decoded from the Witnet.Result.
    function asFixed16Array(Witnet.Result memory _result) external pure returns (int32[] memory);

    /// Decode a integer numeric value from a Witnet.Result as an `int128` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `int128` decoded from the Witnet.Result.
    function asInt128(Witnet.Result memory _result) external pure returns (int128);

    /// Decode an array of integer numeric values from a Witnet.Result as an `int128[]` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `int128[]` decoded from the Witnet.Result.
    function asInt128Array(Witnet.Result memory _result) external pure returns (int128[] memory);

    /// Decode a string value from a Witnet.Result as a `string` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `string` decoded from the Witnet.Result.
    function asString(Witnet.Result memory _result) external pure returns (string memory);

    /// Decode an array of string values from a Witnet.Result as a `string[]` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `string[]` decoded from the Witnet.Result.
    function asStringArray(Witnet.Result memory _result) external pure returns (string[] memory);

    /// Decode a natural numeric value from a Witnet.Result as a `uint64` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `uint64` decoded from the Witnet.Result.
    function asUint64(Witnet.Result memory _result) external pure returns(uint64);

    /// Decode an array of natural numeric values from a Witnet.Result as a `uint64[]` value.
    /// @param _result An instance of Witnet.Result.
    /// @return The `uint64[]` decoded from the Witnet.Result.
    function asUint64Array(Witnet.Result memory _result) external pure returns (uint64[] memory);

}
// File: node_modules\witnet-solidity-bridge\contracts\WitnetRequestBoard.sol
/// @title Witnet Request Board functionality base contract.
/// @author The Witnet Foundation.
abstract contract WitnetRequestBoard is
    IWitnetRequestBoardEvents,
    IWitnetRequestBoardReporter,
    IWitnetRequestBoardRequestor,
    IWitnetRequestBoardView,
    IWitnetRequestParser
{
    receive() external payable {
        revert("WitnetRequestBoard: no transfers accepted");
    }
}
// File: witnet-solidity-bridge\contracts\UsingWitnet.sol
/// @title The UsingWitnet contract
/// @dev Witnet-aware contracts can inherit from this contract in order to interact with Witnet.
/// @author The Witnet Foundation.
abstract contract UsingWitnet {

    WitnetRequestBoard public immutable witnet;

    /// Include an address to specify the WitnetRequestBoard entry point address.
    /// @param _wrb The WitnetRequestBoard entry point address.
    constructor(WitnetRequestBoard _wrb)
    {
        require(address(_wrb) != address(0), "UsingWitnet: zero address");
        witnet = _wrb;
    }

    /// Provides a convenient way for client contracts extending this to block the execution of the main logic of the
    /// contract until a particular request has been successfully solved and reported by Witnet.
    modifier witnetRequestSolved(uint256 _id) {
        require(
                _witnetCheckResultAvailability(_id),
                "UsingWitnet: request not solved"
            );
        _;
    }

    /// Check if a data request has been solved and reported by Witnet.
    /// @dev Contracts depending on Witnet should not start their main business logic (e.g. receiving value from third.
    /// parties) before this method returns `true`.
    /// @param _id The unique identifier of a previously posted data request.
    /// @return A boolean telling if the request has been already resolved or not. Returns `false` also, if the result was deleted.
    function _witnetCheckResultAvailability(uint256 _id)
        internal view
        virtual
        returns (bool)
    {
        return witnet.getQueryStatus(_id) == Witnet.QueryStatus.Reported;
    }

    /// Estimate the reward amount.
    /// @param _gasPrice The gas price for which we want to retrieve the estimation.
    /// @return The reward to be included when either posting a new request, or upgrading the reward of a previously posted one.
    function _witnetEstimateReward(uint256 _gasPrice)
        internal view
        virtual
        returns (uint256)
    {
        return witnet.estimateReward(_gasPrice);
    }

    /// Estimates the reward amount, considering current transaction gas price.
    /// @return The reward to be included when either posting a new request, or upgrading the reward of a previously posted one.
    function _witnetEstimateReward()
        internal view
        virtual
        returns (uint256)
    {
        return witnet.estimateReward(tx.gasprice);
    }

    /// Send a new request to the Witnet network with transaction value as a reward.
    /// @param _request An instance of `IWitnetRequest` contract.
    /// @return _id Sequential identifier for the request included in the WitnetRequestBoard.
    /// @return _reward Current reward amount escrowed by the WRB until a result gets reported.
    function _witnetPostRequest(IWitnetRequest _request)
        internal
        virtual
        returns (uint256 _id, uint256 _reward)
    {
        _reward = _witnetEstimateReward();
        require(
            _reward <= msg.value,
            "UsingWitnet: reward too low"
        );
        _id = witnet.postRequest{value: _reward}(_request);
    }

    /// Upgrade the reward for a previously posted request.
    /// @dev Call to `upgradeReward` function in the WitnetRequestBoard contract.
    /// @param _id The unique identifier of a request that has been previously sent to the WitnetRequestBoard.
    /// @return Amount in which the reward has been increased.
    function _witnetUpgradeReward(uint256 _id)
        internal
        virtual
        returns (uint256)
    {
        uint256 _currentReward = witnet.readRequestReward(_id);        
        uint256 _newReward = _witnetEstimateReward();
        uint256 _fundsToAdd = 0;
        if (_newReward > _currentReward) {
            _fundsToAdd = (_newReward - _currentReward);
        }
        witnet.upgradeReward{value: _fundsToAdd}(_id); // Let Request.gasPrice be updated
        return _fundsToAdd;
    }

    /// Read the Witnet-provided result to a previously posted request.
    /// @param _id The unique identifier of a request that was posted to Witnet.
    /// @return The result of the request as an instance of `Witnet.Result`.
    function _witnetReadResult(uint256 _id)
        internal view
        virtual
        returns (Witnet.Result memory)
    {
        return witnet.readResponseResult(_id);
    }

    /// Retrieves copy of all response data related to a previously posted request, removing the whole query from storage.
    /// @param _id The unique identifier of a previously posted request.
    /// @return The Witnet-provided result to the request.
    function _witnetDeleteQuery(uint256 _id)
        internal
        virtual
        returns (Witnet.Response memory)
    {
        return witnet.deleteQuery(_id);
    }

}
// File: node_modules\witnet-solidity-bridge\contracts\requests\WitnetRequestBase.sol
abstract contract WitnetRequestBase
    is
        IWitnetRequest
{
    /// Contains a well-formed Witnet Data Request, encoded using Protocol Buffers.
    bytes public override bytecode;

    /// Returns SHA256 hash of Witnet Data Request as CBOR-encoded bytes.
    bytes32 public override hash;
}
// File: witnet-solidity-bridge\contracts\requests\WitnetRequest.sol
contract WitnetRequest
    is
        WitnetRequestBase
{
    using Witnet for bytes;
    constructor(bytes memory _bytecode) {
        bytecode = _bytecode;
        hash = _bytecode.hash();
    }
}
// File: ado-contracts\contracts\interfaces\IERC2362.sol
/**
* @dev EIP2362 Interface for pull oracles
* https://github.com/adoracles/EIPs/blob/erc-2362/EIPS/eip-2362.md
*/
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: node_modules\witnet-solidity-bridge\contracts\interfaces\IERC165.sol
/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetPriceRouter.sol
/// @title The Witnet Price Router basic interface.
/// @dev Guides implementation of price feeds aggregation contracts.
/// @author The Witnet Foundation.
abstract contract IWitnetPriceRouter
    is
        IERC2362 
{
    /// Emitted everytime a currency pair is attached to a new price feed contract
    /// @dev See https://github.com/adoracles/ADOIPs/blob/main/adoip-0010.md 
    /// @dev to learn how these ids are created.
    event CurrencyPairSet(bytes32 indexed erc2362ID, IERC165 pricefeed);

    /// Helper pure function: returns hash of the provided ERC2362-compliant currency pair caption (aka ID).
    function currencyPairId(string memory) external pure virtual returns (bytes32);

    /// Returns the ERC-165-compliant price feed contract currently serving 
    /// updates on the given currency pair.
    function getPriceFeed(bytes32 _erc2362id) external view virtual returns (IERC165);

    /// Returns human-readable ERC2362-based caption of the currency pair being
    /// served by the given price feed contract address. 
    /// @dev Should fail if the given price feed contract address is not currently
    /// @dev registered in the router.
    function getPriceFeedCaption(IERC165) external view virtual returns (string memory);

    /// Returns human-readable caption of the ERC2362-based currency pair identifier, if known.
    function lookupERC2362ID(bytes32 _erc2362id) external view virtual returns (string memory);

    /// Register a price feed contract that will serve updates for the given currency pair.
    /// @dev Setting zero address to a currency pair implies that it will not be served any longer.
    /// @dev Otherwise, should fail if the price feed contract does not support the `IWitnetPriceFeed` interface,
    /// @dev or if given price feed is already serving another currency pair (within this WitnetPriceRouter instance).
    function setPriceFeed(
            IERC165 _pricefeed,
            uint256 _decimals,
            string calldata _base,
            string calldata _quote
        )
        external virtual;

    /// Returns list of known currency pairs IDs.
    function supportedCurrencyPairs() external view virtual returns (bytes32[] memory);

    /// Returns `true` if given pair is currently being served by a compliant price feed contract.
    function supportsCurrencyPair(bytes32 _erc2362id) external view virtual returns (bool);

    /// Returns `true` if given price feed contract is currently serving updates to any known currency pair. 
    function supportsPriceFeed(IERC165 _priceFeed) external view virtual returns (bool);
}
// File: node_modules\@openzeppelin\contracts\utils\Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)


/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
// File: @openzeppelin\contracts\access\Ownable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)



/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
// File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetPriceFeed.sol
/// @title The Witnet Price Feed basic interface.
/// @dev Guides implementation of active price feed polling contracts.
/// @author The Witnet Foundation.

interface IWitnetPriceFeed {

    /// Signals that a new price update request is being posted to the Witnet Request Board
    event PriceFeeding(address indexed from, uint256 queryId, uint256 extraFee);

    /// Estimates minimum fee amount in native currency to be paid when 
    /// requesting a new price update.
    /// @dev Actual fee depends on the gas price of the `requestUpdate()` transaction.
    /// @param _gasPrice Gas price expected to be paid when calling `requestUpdate()`
    function estimateUpdateFee(uint256 _gasPrice) external view returns (uint256);

    /// Returns result of the last valid price update request successfully solved by the Witnet oracle.
    function lastPrice() external view returns (int256);

    /// Returns the EVM-timestamp when last valid price was reported back from the Witnet oracle.
    function lastTimestamp() external view returns (uint256);    

    /// Returns tuple containing last valid price and timestamp, as well as status code of latest update
    /// request that got posted to the Witnet Request Board.
    /// @return _lastPrice Last valid price reported back from the Witnet oracle.
    /// @return _lastTimestamp EVM-timestamp of the last valid price.
    /// @return _lastDrTxHash Hash of the Witnet Data Request that solved the last valid price.
    /// @return _latestUpdateStatus Status code of the latest update request.
    function lastValue() external view returns (
        int _lastPrice,
        uint _lastTimestamp,
        bytes32 _lastDrTxHash,
        uint _latestUpdateStatus
    );

    /// Returns identifier of the latest update request posted to the Witnet Request Board.
    function latestQueryId() external view returns (uint256);

    /// Returns hash of the Witnet Data Request that solved the latest update request.
    /// @dev Returning 0 while the latest update request remains unsolved.
    function latestUpdateDrTxHash() external view returns (bytes32);

    /// Returns error message of latest update request posted to the Witnet Request Board.
    /// @dev Returning empty string if the latest update request remains unsolved, or
    /// @dev if it was succesfully solved with no errors.
    function latestUpdateErrorMessage() external view returns (string memory);

    /// Returns status code of latest update request posted to the Witnet Request Board:
    /// @dev Status codes:
    /// @dev   - 200: update request was succesfully solved with no errors
    /// @dev   - 400: update request was solved with errors
    /// @dev   - 404: update request was not solved yet 
    function latestUpdateStatus() external view returns (uint256);

    /// Returns `true` if latest update request posted to the Witnet Request Board 
    /// has not been solved yet by the Witnet oracle.
    function pendingUpdate() external view returns (bool);

    /// Posts a new price update request to the Witnet Request Board. Requires payment of a fee
    /// that depends on the value of `tx.gasprice`. See `estimateUpdateFee(uint256)`.
    /// @dev If previous update request was not solved yet, calling this method again allows
    /// @dev upgrading the update fee if called with a higher `tx.gasprice` value.
    function requestUpdate() external payable;

    /// Tells whether this contract implements the interface defined by `interfaceId`. 
    /// @dev See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
    /// @dev to learn more about how these ids are created.
    function supportsInterface(bytes4) external view returns (bool);
}
// File: node_modules\@openzeppelin\contracts\utils\math\Math.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)


/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}
// File: @openzeppelin\contracts\utils\Strings.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)



/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}
// File: witnet-solidity-bridge\contracts\apps\WitnetPriceRouter.sol
contract WitnetPriceRouter
    is
        IWitnetPriceRouter,
        Ownable
{
    using Strings for uint256;
    
    struct Pair {
        IERC165 pricefeed;
        uint256 decimals;
        string  base;
        string  quote;
    }    

    mapping (bytes4 => Pair) internal __pairs;
    mapping (address => bytes32) internal __pricefeedId_;

    bytes32[] internal __supportedCurrencyPairs;

    // ========================================================================
    // --- Implementation of 'IERC2362' ---------------------------------------

    /// Returns last valid price value and timestamp, as well as status of
    /// the latest update request that got posted to the Witnet Request Board. 
    /// @dev Fails if the given currency pair is not currently supported.
    /// @param _erc2362id Price pair identifier as specified in https://github.com/adoracles/ADOIPs/blob/main/adoip-0010.md
    /// @return _lastPrice Last valid price reported back from the Witnet oracle.
    /// @return _lastTimestamp EVM-timestamp of the last valid price.
    /// @return _latestUpdateStatus Status code of latest update request that got posted to the Witnet Request Board:
    ///          - 200: latest update request was succesfully solved with no errors
    ///          - 400: latest update request was solved with errors
    ///          - 404: latest update request is still pending to be solved    
	function valueFor(bytes32 _erc2362id)
        external view
        virtual override
        returns (
            int256 _lastPrice,
            uint256 _lastTimestamp,
            uint256 _latestUpdateStatus
        )
    {
        IWitnetPriceFeed _pricefeed = IWitnetPriceFeed(address(getPriceFeed(_erc2362id)));
        require(address(_pricefeed) != address(0), "WitnetPriceRouter: unsupported currency pair");
        (_lastPrice, _lastTimestamp,, _latestUpdateStatus) = _pricefeed.lastValue();
    }


    // ========================================================================
    // --- Implementation of 'IWitnetPriceRouter' ---------------------------    

    /// Helper pure function: returns hash of the provided ERC2362-compliant currency pair caption (aka ID).
    function currencyPairId(string memory _caption)
        public pure
        virtual override
        returns (bytes32)
    {
        return keccak256(bytes(_caption));
    }

    /// Returns the ERC-165-compliant price feed contract currently serving 
    /// updates on the given currency pair.
    function getPriceFeed(bytes32 _erc2362id)
        public view
        virtual override
        returns (IERC165)
    {
        return __pairs[bytes4(_erc2362id)].pricefeed;
    }

    /// Returns human-readable ERC2362-based caption of the currency pair being
    /// served by the given price feed contract address. 
    /// @dev Fails if the given price feed contract address is not currently
    /// @dev registered in the router.
    function getPriceFeedCaption(IERC165 _pricefeed) 
        public view
        virtual override
        returns (string memory)
    {
        require(supportsPriceFeed(_pricefeed), "WitnetPriceRouter: unknown");
        return lookupERC2362ID(__pricefeedId_[address(_pricefeed)]);
    }

    /// Returns human-readable caption of the ERC2362-based currency pair identifier, if known.
    function lookupERC2362ID(bytes32 _erc2362id)
        public view
        virtual override
        returns (string memory _caption)
    {
        Pair storage _pair = __pairs[bytes4(_erc2362id)];
        if (
            bytes(_pair.base).length > 0 
                && bytes(_pair.quote).length > 0
        ) {
            _caption = string(abi.encodePacked(
                "Price-",
                _pair.base,
                "/",
                _pair.quote,
                "-",
                _pair.decimals.toString()
            ));
        }
    }

    /// Register a price feed contract that will serve updates for the given currency pair.
    /// @dev Setting zero address to a currency pair implies that it will not be served any longer.
    /// @dev Otherwise, fails if the price feed contract does not support the `IWitnetPriceFeed` interface,
    /// @dev or if given price feed is already serving another currency pair (within this WitnetPriceRouter instance).
    function setPriceFeed(
            IERC165 _pricefeed,
            uint256 _decimals,
            string calldata _base,
            string calldata _quote
        )
        public 
        virtual override
        onlyOwner
    {
        if (address(_pricefeed) != address(0)) {
            require(
                _pricefeed.supportsInterface(type(IWitnetPriceFeed).interfaceId),
                "WitnetPriceRouter: feed contract is not compliant with IWitnetPriceFeed"
            );
            require(
                __pricefeedId_[address(_pricefeed)] == bytes32(0),
                "WitnetPriceRouter: already serving a currency pair"
            );
        }
        bytes memory _caption = abi.encodePacked(
            "Price-",
            bytes(_base),
            "/",
            bytes(_quote),
            "-",
            _decimals.toString()
        );
        bytes32 _erc2362id = keccak256(_caption);
        
        Pair storage _record = __pairs[bytes4(_erc2362id)];
        address _currentPriceFeed = address(_record.pricefeed);
        if (bytes(_record.base).length == 0) {
            _record.base = _base;
            _record.quote = _quote;
            _record.decimals = _decimals;
            __supportedCurrencyPairs.push(_erc2362id);
        }
        else if (_currentPriceFeed != address(0)) {
            __pricefeedId_[_currentPriceFeed] = bytes32(0);
        }
        if (address(_pricefeed) != _currentPriceFeed) {
            __pricefeedId_[address(_pricefeed)] = _erc2362id;
        }
        _record.pricefeed = _pricefeed;
        emit CurrencyPairSet(_erc2362id, _pricefeed);
    }

    /// Returns list of known currency pairs IDs.
    function supportedCurrencyPairs()
        external view
        virtual override
        returns (bytes32[] memory)
    {
        return __supportedCurrencyPairs;
    }

    /// Returns `true` if given pair is currently being served by a compliant price feed contract.
    function supportsCurrencyPair(bytes32 _erc2362id)
        public view
        virtual override
        returns (bool)
    {
        return address(__pairs[bytes4(_erc2362id)].pricefeed) != address(0);
    }

    /// Returns `true` if given price feed contract is currently serving updates to any known currency pair. 
    function supportsPriceFeed(IERC165 _pricefeed)
        public view
        virtual override
        returns (bool)
    {
        return __pairs[bytes4(__pricefeedId_[address(_pricefeed)])].pricefeed == _pricefeed;
    }
}
// File: contracts\WitnetPriceFeed.sol
// force WitnetPriceRouter artifact generation on deployment


// Your contract needs to inherit from UsingWitnet
contract WitnetPriceFeed
    is
        IWitnetPriceFeed,
        UsingWitnet,
        WitnetRequest
{
    using Witnet for bytes;

    /// Stores the ID of the last price update posted to the Witnet Request Board.
    uint256 public override latestQueryId;

    /// Stores the ID of the last price update succesfully solved by the WRB.
    uint256 internal __lastValidQueryId;

    /// Constructor.
    /// @param _witnetRequestBoard WitnetRequestBoard entrypoint address.
    /// @param _witnetRequestBytecode Raw bytecode of Witnet Data Request to be used on every update request.
    constructor (
            WitnetRequestBoard _witnetRequestBoard,
            bytes memory _witnetRequestBytecode
        )
        UsingWitnet(_witnetRequestBoard)
        WitnetRequest(_witnetRequestBytecode)
    {}

    /// Estimates minimum fee amount in native currency to be paid when
    /// requesting a new price update.
    /// @dev Actual fee depends on the gas price of the `requestUpdate()` transaction.
    /// @param _gasPrice Gas price expected to be paid when calling `requestUpdate()`
    function estimateUpdateFee(uint256 _gasPrice)
        external view
        virtual override
        returns (uint256)
    {
        return witnet.estimateReward(_gasPrice);
    }

    /// Returns result of the last valid price update request successfully solved by the Witnet oracle.
    function lastPrice()
        public view
        virtual override
        returns (int256 _lastPrice)
    {
        Witnet.Result memory _result;
        uint _latestQueryId = latestQueryId;
        if (
            _latestQueryId > 0
                && _witnetCheckResultAvailability(_latestQueryId)
        ) {
            _result = witnet.readResponseResult(_latestQueryId);
            if (_result.success) {
                return int256(int64(witnet.asUint64(_result)));
            }
        }
        if (__lastValidQueryId > 0) {
            _result = witnet.readResponseResult(__lastValidQueryId);
            return int256(int64(witnet.asUint64(_result)));
        }
    }

    /// Returns the EVM-timestamp when last valid price was reported back from the Witnet oracle.
    function lastTimestamp()
        public view
        virtual override
        returns (uint256 _lastTimestamp)
    {
        Witnet.Result memory _result;
        Witnet.Response memory _response;
        uint _latestQueryId = latestQueryId;
        if (
            _latestQueryId > 0
                && _witnetCheckResultAvailability(_latestQueryId)
        ) {
            _response = witnet.readResponse(_latestQueryId);
            _result = witnet.resultFromCborBytes(_response.cborBytes);
            if (_result.success) {
                return _response.timestamp;
            }
        }
        if (__lastValidQueryId > 0) {
            _response = witnet.readResponse(__lastValidQueryId);
            return _response.timestamp;
        }
    }

    /// Returns tuple containing last valid price and timestamp, as well as status code of latest update
    /// request that got posted to the Witnet Request Board.
    /// @return _lastPrice Last valid price reported back from the Witnet oracle.
    /// @return _lastTimestamp EVM-timestamp of the last valid price.
    /// @return _lastDrTxHash Hash of the Witnet Data Request that solved the last valid price.
    /// @return _latestUpdateStatus Status code of the latest update request.
    function lastValue()
        external view
        virtual override
        returns (
            int _lastPrice,
            uint _lastTimestamp,
            bytes32 _lastDrTxHash,
            uint _latestUpdateStatus
        )
    {
        uint _latestQueryId = latestQueryId;
        if (_latestQueryId > 0) {
            bool _completed = _witnetCheckResultAvailability(_latestQueryId);
            if (_completed) {
                Witnet.Response memory _latestResponse = witnet.readResponse(_latestQueryId);
                Witnet.Result memory _latestResult = witnet.resultFromCborBytes(_latestResponse.cborBytes);
                if (_latestResult.success) {
                    return (
                        int256(int64(witnet.asUint64(_latestResult))),
                        _latestResponse.timestamp,
                        _latestResponse.drTxHash,
                        200
                    );
                }
            }
            if (__lastValidQueryId > 0) {
                Witnet.Response memory _lastValidResponse = witnet.readResponse(__lastValidQueryId);
                Witnet.Result memory _lastValidResult = witnet.resultFromCborBytes(_lastValidResponse.cborBytes);
                return (
                    int256(int64(witnet.asUint64(_lastValidResult))),
                    _lastValidResponse.timestamp,
                    _lastValidResponse.drTxHash,
                    _completed ? 400 : 404
                );
            }
        }
        return (0, 0, 0, 404);
    }

    /// Returns identifier of the latest update request posted to the Witnet Request Board.
    /// @dev Returning 0 while the latest update request remains unsolved.
    function latestUpdateDrTxHash()
        external view
        virtual override
        returns (bytes32)
    {
        uint256 _latestQueryId = latestQueryId;
        if (_latestQueryId > 0) {
            if (_witnetCheckResultAvailability(_latestQueryId)) {
                return witnet.readResponseDrTxHash(_latestQueryId);
            }
        }
        return bytes32(0);
    }

    /// Returns error message of latest update request posted to the Witnet Request Board.
    /// @dev Returning empty string if the latest update request remains unsolved, or
    /// @dev if it was succesfully solved with no errors.
    function latestUpdateErrorMessage()
        external view
        virtual override
        returns (string memory _errorMessage)
    {
        uint256 _latestQueryId = latestQueryId;
        if (_latestQueryId > 0) {
            if (_witnetCheckResultAvailability(_latestQueryId)) {
                Witnet.Result memory _latestResult = witnet.readResponseResult(_latestQueryId);
                if (_latestResult.success == false) {
                    (, _errorMessage) = witnet.asErrorMessage(_latestResult);
                }
            }
        }
    }

    /// Returns status code of latest update request posted to the Witnet Request Board:
    /// @dev Status codes:
    /// @dev   - 200: update request was succesfully solved with no errors
    /// @dev   - 400: update request was solved with errors
    /// @dev   - 404: update request was not solved yet
    function latestUpdateStatus()
        public view
        virtual override
        returns (uint256)
    {
        uint _latestQueryId = latestQueryId;
        if (_latestQueryId > 0) {
            if (_witnetCheckResultAvailability(_latestQueryId)) {
                Witnet.Result memory _result = witnet.readResponseResult(_latestQueryId);
                return (
                    _result.success
                        ? 200 // OK
                        : 400 // Bad result
                );
            } else {
                return 404; // not yet solved;
            }
        }
        return 200;
    }

    /// Returns `true` if latest update request posted to the Witnet Request Board
    /// has not been solved yet by the Witnet oracle.
    function pendingUpdate()
        public view
        virtual override
        returns (bool)
    {
        return (
            latestQueryId != 0
                && !_witnetCheckResultAvailability(latestQueryId)
        );
    }

    /// Posts a new price update request to the Witnet Request Board. Requires payment of a fee
    /// that depends on the value of `tx.gasprice`. See `estimateUpdateFee(uint256)`.
    /// @dev If previous update request was not solved yet, calling this method again allows
    /// @dev upgrading the update fee if called with a higher `tx.gasprice` value.
    function requestUpdate()
        public payable
        virtual override
    {
        uint _usedFunds;
        uint _latestQueryId = latestQueryId;
        uint _latestUpdateStatus = latestUpdateStatus();
        if (_latestUpdateStatus == 404) {
            // latest update is still pending, so just raise upgrade reward,
            // accordingly to current tx gasprice:
            _usedFunds = _witnetUpgradeReward(_latestQueryId);
        } else {
            // Check if latest update ended successfully:
            if (_latestUpdateStatus == 200) {
                // If so, remove previous last valid query from the WRB:
                if (__lastValidQueryId > 0) {
                    _witnetDeleteQuery(__lastValidQueryId);
                }
                __lastValidQueryId = _latestQueryId;
            } else {
                // Otherwise, delete latest query, as it was faulty
                // and we are about to post a new update request:
                _witnetDeleteQuery(_latestQueryId);
            }
            // Post update request to the WRB:
            (_latestQueryId, _usedFunds) = _witnetPostRequest(this);
            // Update latest query id:
            latestQueryId = _latestQueryId;
        }
        // Transfer back unused funds:
        payable(msg.sender).transfer(msg.value - _usedFunds);
        if (_usedFunds > 0) {
            emit PriceFeeding(msg.sender, _latestQueryId, _usedFunds);
        }
    }

    /// Tells whether this contract implements the interface defined by `interfaceId`.
    /// @dev See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
    /// @dev to learn more about how these ids are created.
    function supportsInterface(bytes4 _interfaceId)
        public view
        virtual override
        returns (bool)
    {
        return (
            _interfaceId == type(IERC165).interfaceId
                || _interfaceId == type(IWitnetPriceFeed).interfaceId
        );
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract WitnetRequestBoard","name":"_witnetRequestBoard","type":"address"},{"internalType":"bytes","name":"_witnetRequestBytecode","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"queryId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"extraFee","type":"uint256"}],"name":"PriceFeeding","type":"event"},{"inputs":[],"name":"bytecode","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gasPrice","type":"uint256"}],"name":"estimateUpdateFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPrice","outputs":[{"internalType":"int256","name":"_lastPrice","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimestamp","outputs":[{"internalType":"uint256","name":"_lastTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastValue","outputs":[{"internalType":"int256","name":"_lastPrice","type":"int256"},{"internalType":"uint256","name":"_lastTimestamp","type":"uint256"},{"internalType":"bytes32","name":"_lastDrTxHash","type":"bytes32"},{"internalType":"uint256","name":"_latestUpdateStatus","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestQueryId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestUpdateDrTxHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestUpdateErrorMessage","outputs":[{"internalType":"string","name":"_errorMessage","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestUpdateStatus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingUpdate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestUpdate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"witnet","outputs":[{"internalType":"contract WitnetRequestBoard","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x6080604052600436106100dc5760003560e01c80635f7fac8c1161007f578063b15cde0711610059578063b15cde0714610246578063c47500c91461025b578063d86d8ebc14610270578063f09400021461028657600080fd5b80635f7fac8c146101fa57806371bc17651461021a5780639c312cfd1461023c57600080fd5b806309bd5a60116100bb57806309bd5a601461014e57806319d8ac6114610164578063431838341461017957806346d1d21a146101ae57600080fd5b8062a4dcac146100e157806301ffc9a71461010b578063053f14da1461012b575b600080fd5b3480156100ed57600080fd5b506100f661029b565b60405190151581526020015b60405180910390f35b34801561011757600080fd5b506100f661012636600461151a565b6102bd565b34801561013757600080fd5b506101406102f4565b604051908152602001610102565b34801561015a57600080fd5b5061014060015481565b34801561017057600080fd5b50610140610534565b34801561018557600080fd5b5061018e610760565b604080519485526020850193909352918301526060820152608001610102565b3480156101ba57600080fd5b506101e27f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a81565b6040516001600160a01b039091168152602001610102565b34801561020657600080fd5b5061014061021536600461154b565b610b81565b34801561022657600080fd5b5061022f610c0d565b60405161010291906115c0565b610244610d5f565b005b34801561025257600080fd5b50610140610e4c565b34801561026757600080fd5b50610140610efd565b34801561027c57600080fd5b5061014060025481565b34801561029257600080fd5b5061022f610fd7565b60006002546000141580156102b857506102b66002546110b7565b155b905090565b60006001600160e01b031982166301ffc9a760e01b14806102ee57506001600160e01b03198216632089297160e11b145b92915050565b60006102fe6114c7565b60025480158015906103145750610314816110b7565b15610447576040516335369a6b60e21b8152600481018290527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063d4da69ac90602401600060405180830381865afa15801561037e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103a6919081019061171a565b8051909250156104475760405163bc7e25ff60e01b81526001600160a01b037f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a169063bc7e25ff906103fc90859060040161186d565b602060405180830381865afa158015610419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043d9190611928565b60070b9250505090565b6003541561052f576003546040516335369a6b60e21b815260048101919091527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063d4da69ac90602401600060405180830381865afa1580156104b8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104e0919081019061171a565b60405163bc7e25ff60e01b81529092506001600160a01b037f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a169063bc7e25ff906103fc90859060040161186d565b505090565b600061053e6114c7565b604080516080810182526000808252602082018190529181019190915260608082015260025480158015906105775750610577816110b7565b156106b557604051633aa72df560e11b8152600481018290527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063754e5bea90602401600060405180830381865afa1580156105e1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106099190810190611943565b606081015160405163e99e47f360e01b81529193506001600160a01b037f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a169163e99e47f39161065b916004016115c0565b600060405180830381865afa158015610678573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106a0919081019061171a565b8051909350156106b557506020015192915050565b6003541561075a57600354604051633aa72df560e11b815260048101919091527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063754e5bea90602401600060405180830381865afa158015610726573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261074e9190810190611943565b60200151949350505050565b50505090565b6002546000908190819081908015610b6a57600061077d826110b7565b9050801561096857604051633aa72df560e11b8152600481018390526000907f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063754e5bea90602401600060405180830381865afa1580156107ed573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108159190810190611943565b905060007f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b031663e99e47f383606001516040518263ffffffff1660e01b815260040161086991906115c0565b600060405180830381865afa158015610886573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108ae919081019061171a565b8051909150156109655760405163bc7e25ff60e01b81526001600160a01b037f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a169063bc7e25ff9061090490849060040161186d565b602060405180830381865afa158015610921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109459190611928565b60070b8260200151836040015160c8975097509750975050505050610b7b565b50505b60035415610b6857600354604051633aa72df560e11b81526000916001600160a01b037f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a169163754e5bea916109c49160040190815260200190565b600060405180830381865afa1580156109e1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a099190810190611943565b905060007f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b031663e99e47f383606001516040518263ffffffff1660e01b8152600401610a5d91906115c0565b600060405180830381865afa158015610a7a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610aa2919081019061171a565b60405163bc7e25ff60e01b81529091506001600160a01b037f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a169063bc7e25ff90610af190849060040161186d565b602060405180830381865afa158015610b0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b329190611928565b60070b8260200151836040015185610b4c57610194610b50565b6101905b8061ffff169050975097509750975050505050610b7b565b505b506000935083925082915061019490505b90919293565b60405163d2e8756160e01b8152600481018290526000907f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063d2e8756190602401602060405180830381865afa158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ee91906119e5565b6002546060908015610d5b57610c22816110b7565b15610d5b576040516335369a6b60e21b8152600481018290526000907f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063d4da69ac90602401600060405180830381865afa158015610c8f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cb7919081019061171a565b8051909150151560000361052f57604051636ba401df60e11b81526001600160a01b037f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a169063d74803be90610d1190849060040161186d565b600060405180830381865afa158015610d2e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d5691908101906119fe565b935050505b5090565b60025460009081610d6e610efd565b90508061019403610d8957610d828261115c565b9250610dce565b8060c803610db05760035415610da657610da4600354611294565b505b6003829055610dbb565b610db982611294565b505b610dc430611346565b6002829055935091505b336108fc610ddc8534611a68565b6040518115909202916000818181858888f19350505050158015610e04573d6000803e3d6000fd5b508215610e4757604080518381526020810185905233917f177160e50d083725209651bf251badbab2b70d078dda089acd2101eefccd82c7910160405180910390a25b505050565b6002546000908015610ef557610e61816110b7565b15610ef55760405163dc3c71cd60e01b8152600481018290527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063dc3c71cd90602401602060405180830381865afa158015610ecb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eef91906119e5565b91505090565b506000919050565b6002546000908015610fcf57610f12816110b7565b15610fc6576040516335369a6b60e21b8152600481018290526000907f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063d4da69ac90602401600060405180830381865afa158015610f7f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fa7919081019061171a565b8051909150610fb857610190610fbb565b60c85b61ffff169250505090565b61019491505090565b60c891505090565b60008054610fe490611a8d565b80601f016020809104026020016040519081016040528092919081815260200182805461101090611a8d565b801561105d5780601f106110325761010080835404028352916020019161105d565b820191906000526020600020905b81548152906001019060200180831161104057829003601f168201915b505050505081565b60006002826040516110779190611ac7565b602060405180830381855afa158015611094573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102ee91906119e5565b60006002604051631bc1eaf360e21b8152600481018490527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b031690636f07abcc90602401602060405180830381865afa158015611120573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111449190611af9565b600381111561115557611155611ae3565b1492915050565b604051631dd27daf60e01b81526004810182905260009081906001600160a01b037f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a1690631dd27daf90602401602060405180830381865afa1580156111c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ea91906119e5565b905060006111f661143c565b905060008282111561120f5761120c8383611a68565b90505b6040516366bfdc7560e01b8152600481018690527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b0316906366bfdc759083906024016000604051808303818588803b15801561127257600080fd5b505af1158015611286573d6000803e3d6000fd5b509398975050505050505050565b6040805160808101825260008082526020820181905291810191909152606080820152604051637c1fbda360e01b8152600481018390527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b031690637c1fbda3906024016000604051808303816000875af115801561131e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102ee9190810190611943565b60008061135161143c565b9050348111156113a75760405162461bcd60e51b815260206004820152601b60248201527f5573696e675769746e65743a2072657761726420746f6f206c6f770000000000604482015260640160405180910390fd5b60405163b281a7bd60e01b81526001600160a01b0384811660048301527f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a169063b281a7bd90839060240160206040518083038185885af1158015611410573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061143591906119e5565b9150915091565b60405163d2e8756160e01b81523a60048201526000907f000000000000000000000000d653fbd7c736838289262f0f41a458f35393c88a6001600160a01b03169063d2e8756190602401602060405180830381865afa1580156114a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b891906119e5565b6040805180820182526000808252825161010081018452606060c0820181815260e083018490528252602082810184905294820183905281018290526080810182905260a0810191909152909182015290565b60006020828403121561152c57600080fd5b81356001600160e01b03198116811461154457600080fd5b9392505050565b60006020828403121561155d57600080fd5b5035919050565b60005b8381101561157f578181015183820152602001611567565b8381111561158e576000848401525b50505050565b600081518084526115ac816020860160208601611564565b601f01601f19169290920160200192915050565b6020815260006115446020830184611594565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561160c5761160c6115d3565b60405290565b60405160c0810167ffffffffffffffff8111828210171561160c5761160c6115d3565b6040516080810167ffffffffffffffff8111828210171561160c5761160c6115d3565b600067ffffffffffffffff80841115611673576116736115d3565b604051601f8501601f19908116603f0116810190828211818310171561169b5761169b6115d3565b816040528093508581528686860111156116b457600080fd5b6116c2866020830187611564565b5050509392505050565b600082601f8301126116dd57600080fd5b61154483835160208501611658565b805160ff811681146116fd57600080fd5b919050565b805167ffffffffffffffff811681146116fd57600080fd5b6000602080838503121561172d57600080fd5b825167ffffffffffffffff8082111561174557600080fd5b908401906040828703121561175957600080fd5b6117616115e9565b8251801515811461177157600080fd5b8152828401518281111561178457600080fd5b929092019160c0838803121561179957600080fd5b6117a1611612565b8351838111156117b057600080fd5b84016040818a0312156117c257600080fd5b6117ca6115e9565b8151858111156117d957600080fd5b6117e58b8285016116cc565b82525086820151945063ffffffff8516851461180057600080fd5b8087018590528252506118148486016116ec565b85820152611824604085016116ec565b6040820152611835606085016116ec565b606082015261184660808501611702565b608082015261185760a08501611702565b60a0820152938101939093525090949350505050565b6020815281511515602082015260006020830151604080840152805160c06060850152805160406101208601526118a8610160860182611594565b60209283015163ffffffff166101408701529183015160ff81166080870152919050604083015160ff811660a08701529150606083015160ff811660c08701529150608083015167ffffffffffffffff811660e0870152915060a0830151925061191f61010086018467ffffffffffffffff169052565b95945050505050565b60006020828403121561193a57600080fd5b61154482611702565b60006020828403121561195557600080fd5b815167ffffffffffffffff8082111561196d57600080fd5b908301906080828603121561198157600080fd5b611989611635565b82516001600160a01b03811681146119a057600080fd5b8082525060208301516020820152604083015160408201526060830151828111156119ca57600080fd5b6119d6878286016116cc565b60608301525095945050505050565b6000602082840312156119f757600080fd5b5051919050565b60008060408385031215611a1157600080fd5b82516101008110611a2157600080fd5b602084015190925067ffffffffffffffff811115611a3e57600080fd5b8301601f81018513611a4f57600080fd5b611a5e85825160208401611658565b9150509250929050565b600082821015611a8857634e487b7160e01b600052601160045260246000fd5b500390565b600181811c90821680611aa157607f821691505b602082108103611ac157634e487b7160e01b600052602260045260246000fd5b50919050565b60008251611ad9818460208701611564565b9190910192915050565b634e487b7160e01b600052602160045260246000fd5b600060208284031215611b0b57600080fd5b81516004811061154457600080fdfea264697066735822122078d8e98b97e78a280b0497f2e6fba7e9a8415feebe129c7ea84134872d7cdb0264736f6c634300080d0033

Deployed Bytecode Sourcemap

68155:10240:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;75730:238;;;;;;;;;;;;;:::i;:::-;;;179:14:1;;172:22;154:41;;142:2;127:18;75730:238:0;;;;;;;;78104:288;;;;;;;;;;-1:-1:-1;78104:288:0;;;;;:::i;:::-;;:::i;69577:703::-;;;;;;;;;;;;;:::i;:::-;;;641:25:1;;;629:2;614:18;69577:703:0;497:175:1;33985:28:0;;;;;;;;;;;;;;;;70387:779;;;;;;;;;;;;;:::i;71672:1563::-;;;;;;;;;;;;;:::i;:::-;;;;1270:25:1;;;1326:2;1311:18;;1304:34;;;;1354:18;;;1347:34;1412:2;1397:18;;1390:34;1257:3;1242:19;71672:1563:0;1041:389:1;28928:42:0;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1633:32:1;;;1615:51;;1603:2;1588:18;28928:42:0;1435:237:1;69279:185:0;;;;;;;;;;-1:-1:-1;69279:185:0;;;;;:::i;:::-;;:::i;74053:572::-;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;76338:1491::-;;;:::i;:::-;;73412:395;;;;;;;;;;;;;:::i;74945:638::-;;;;;;;;;;;;;:::i;68383:37::-;;;;;;;;;;;;;;;;33871:30;;;;;;;;;;;;;:::i;75730:238::-;75820:4;75864:13;;75881:1;75864:18;;:85;;;;;75904:45;75935:13;;75904:30;:45::i;:::-;75903:46;75864:85;75842:118;;75730:238;:::o;78104:288::-;78217:4;-1:-1:-1;;;;;;78261:41:0;;-1:-1:-1;;;78261:41:0;;:112;;-1:-1:-1;;;;;;;78323:50:0;;-1:-1:-1;;;78323:50:0;78261:112;78239:145;78104:288;-1:-1:-1;;78104:288:0:o;69577:703::-;69663:17;69698:28;;:::i;:::-;69759:13;;69801:18;;;;;:85;;;69840:46;69871:14;69840:30;:46::i;:::-;69783:309;;;69923:41;;-1:-1:-1;;;69923:41:0;;;;;641:25:1;;;69923:6:0;-1:-1:-1;;;;;69923:25:0;;;;614:18:1;;69923:41:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;69923:41:0;;;;;;;;;;;;:::i;:::-;69983:15;;69913:51;;-1:-1:-1;69979:102:0;;;70039:24;;-1:-1:-1;;;70039:24:0;;-1:-1:-1;;;;;70039:6:0;:15;;;;:24;;70055:7;;70039:24;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;70026:39;;70019:46;;;;69577:703;:::o;69979:102::-;70106:18;;:22;70102:171;;70181:18;;70155:45;;-1:-1:-1;;;70155:45:0;;;;;641:25:1;;;;70155:6:0;-1:-1:-1;;;;;70155:25:0;;;;614:18:1;;70155:45:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;70155:45:0;;;;;;;;;;;;:::i;:::-;70235:24;;-1:-1:-1;;;70235:24:0;;70145:55;;-1:-1:-1;;;;;;70235:6:0;:15;;;;:24;;70145:55;;70235:24;;;:::i;70102:171::-;69687:593;;69577:703;:::o;70387:779::-;70477:22;70517:28;;:::i;:::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;70621:13:0;;70663:18;;;;;:85;;;70702:46;70733:14;70702:30;:46::i;:::-;70645:357;;;70787:35;;-1:-1:-1;;;70787:35:0;;;;;641:25:1;;;70787:6:0;-1:-1:-1;;;;;70787:19:0;;;;614:18:1;;70787:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;70787:35:0;;;;;;;;;;;;:::i;:::-;70874:19;;;;70847:47;;-1:-1:-1;;;70847:47:0;;70775;;-1:-1:-1;;;;;;70847:6:0;:26;;;;:47;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;70847:47:0;;;;;;;;;;;;:::i;:::-;70913:15;;70837:57;;-1:-1:-1;70909:82:0;;;-1:-1:-1;70956:19:0;;;;70387:779;-1:-1:-1;;70387:779:0:o;70909:82::-;71016:18;;:22;71012:147;;71087:18;;71067:39;;-1:-1:-1;;;71067:39:0;;;;;641:25:1;;;;71067:6:0;-1:-1:-1;;;;;71067:19:0;;;;614:18:1;;71067:39:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;71067:39:0;;;;;;;;;;;;:::i;:::-;71128:19;;;;70387:779;-1:-1:-1;;;;70387:779:0:o;71012:147::-;70506:660;;;70387:779;:::o;71672:1563::-;71947:13;;71774:14;;;;;;;;71975:18;;71971:1225;;72010:15;72028:46;72059:14;72028:30;:46::i;:::-;72010:64;;72093:10;72089:559;;;72165:35;;-1:-1:-1;;;72165:35:0;;;;;641:25:1;;;72124:38:0;;72165:6;-1:-1:-1;;;;;72165:19:0;;;;614:18:1;;72165:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;72165:35:0;;;;;;;;;;;;:::i;:::-;72124:76;;72219:34;72256:6;-1:-1:-1;;;;;72256:26:0;;72283:15;:25;;;72256:53;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;72256:53:0;;;;;;;;;;;;:::i;:::-;72332:21;;72219:90;;-1:-1:-1;72328:305:0;;;72425:30;;-1:-1:-1;;;72425:30:0;;-1:-1:-1;;;;;72425:6:0;:15;;;;:30;;72441:13;;72425:30;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;72412:45;;72484:15;:25;;;72536:15;:24;;;72587:3;72378:235;;;;;;;;;;;;;;72328:305;72105:543;;72089:559;72666:18;;:22;72662:523;;72773:18;;72753:39;;-1:-1:-1;;;72753:39:0;;72709:41;;-1:-1:-1;;;;;72753:6:0;:19;;;;:39;;;;641:25:1;;;629:2;614:18;;497:175;72753:39:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;72753:39:0;;;;;;;;;;;;:::i;:::-;72709:83;;72811:37;72851:6;-1:-1:-1;;;;;72851:26:0;;72878:18;:28;;;72851:56;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;72851:56:0;;;;;;;;;;;;:::i;:::-;72969:33;;-1:-1:-1;;;72969:33:0;;72811:96;;-1:-1:-1;;;;;;72969:6:0;:15;;;;:33;;72811:96;;72969:33;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;72956:48;;73027:18;:28;;;73078:18;:27;;;73128:10;:22;;73147:3;73128:22;;;73141:3;73128:22;72926:243;;;;;;;;;;;;;;;;;;;72662:523;71995:1201;71971:1225;-1:-1:-1;73214:1:0;;-1:-1:-1;73214:1:0;;-1:-1:-1;73214:1:0;;-1:-1:-1;73223:3:0;;-1:-1:-1;71672:1563:0;;;;;:::o;69279:185::-;69424:32;;-1:-1:-1;;;69424:32:0;;;;;641:25:1;;;69392:7:0;;69424:6;-1:-1:-1;;;;;69424:21:0;;;;614:18:1;;69424:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;74053:572::-;74226:13;;74156:27;;74254:18;;74250:368;;74293:46;74324:14;74293:30;:46::i;:::-;74289:318;;;74397:41;;-1:-1:-1;;;74397:41:0;;;;;641:25:1;;;74360:34:0;;74397:6;-1:-1:-1;;;;;74397:25:0;;;;614:18:1;;74397:41:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;74397:41:0;;;;;;;;;;;;:::i;:::-;74461:21;;74360:78;;-1:-1:-1;74461:30:0;;:21;:30;74457:135;;74536:36;;-1:-1:-1;;;74536:36:0;;-1:-1:-1;;;;;74536:6:0;:21;;;;:36;;74558:13;;74536:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;74536:36:0;;;;;;;;;;;;:::i;:::-;74516:56;-1:-1:-1;;74341:266:0;74289:318;74190:435;74053:572;:::o;76338:1491::-;76477:13;;76429:15;;;76528:20;:18;:20::i;:::-;76501:47;;76563:19;76586:3;76563:26;76559:1046;;76749:36;76770:14;76749:20;:36::i;:::-;76736:49;;76559:1046;;;76881:19;76904:3;76881:26;76877:514;;77006:18;;:22;77002:109;;77053:38;77072:18;;77053;:38::i;:::-;;77002:109;77129:18;:35;;;76877:514;;;77341:34;77360:14;77341:18;:34::i;:::-;;76877:514;77484:24;77503:4;77484:18;:24::i;:::-;77563:13;:30;;;77453:55;-1:-1:-1;77453:55:0;-1:-1:-1;76559:1046:0;77663:10;77655:52;77684:22;77696:10;77684:9;:22;:::i;:::-;77655:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;77722:14:0;;77718:104;;77758:52;;;10588:25:1;;;10644:2;10629:18;;10622:34;;;77771:10:0;;77758:52;;10561:18:1;77758:52:0;;;;;;;77718:104;76418:1411;;;76338:1491::o;73412:395::-;73561:13;;73511:7;;73589:18;;73585:187;;73628:46;73659:14;73628:30;:46::i;:::-;73624:137;;;73702:43;;-1:-1:-1;;;73702:43:0;;;;;641:25:1;;;73702:6:0;-1:-1:-1;;;;;73702:27:0;;;;614:18:1;;73702:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;73695:50;;;73412:395;:::o;73624:137::-;-1:-1:-1;73797:1:0;;73412:395;-1:-1:-1;73412:395:0:o;74945:638::-;75087:13;;75040:7;;75115:18;;75111:444;;75154:46;75185:14;75154:30;:46::i;:::-;75150:394;;;75252:41;;-1:-1:-1;;;75252:41:0;;;;;641:25:1;;;75221:28:0;;75252:6;-1:-1:-1;;;;;75252:25:0;;;;614:18:1;;75252:41:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;75252:41:0;;;;;;;;;;;;:::i;:::-;75342:15;;75221:72;;-1:-1:-1;75342:83:0;;75422:3;75342:83;;;75385:3;75342:83;75312:146;;;;;;74945:638;:::o;75150:394::-;75506:3;75499:10;;;74945:638;:::o;75150:394::-;75572:3;75565:10;;;74945:638;:::o;33871:30::-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;4232:113::-;4293:7;4320:17;4327:9;4320:17;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;30170:205::-;30281:4;30340:27;30310:26;;-1:-1:-1;;;30310:26:0;;;;;641:25:1;;;30310:6:0;-1:-1:-1;;;;;30310:21:0;;;;614:18:1;;30310:26:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:57;;;;;;;;:::i;:::-;;;30170:205;-1:-1:-1;;30170:205:0:o;32243:513::-;32389:29;;-1:-1:-1;;;32389:29:0;;;;;641:25:1;;;32339:7:0;;;;-1:-1:-1;;;;;32389:6:0;:24;;;;614:18:1;;32389:29:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;32364:54;;32437:18;32458:23;:21;:23::i;:::-;32437:44;;32492:19;32543:14;32530:10;:27;32526:103;;;32589:27;32602:14;32589:10;:27;:::i;:::-;32574:43;;32526:103;32639:45;;-1:-1:-1;;;32639:45:0;;;;;641:25:1;;;32639:6:0;-1:-1:-1;;;;;32639:20:0;;;;32667:11;;614:18:1;;32639:45:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;32737:11:0;;32243:513;-1:-1:-1;;;;;;;;32243:513:0:o;33444:172::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;33585:23:0;;-1:-1:-1;;;33585:23:0;;;;;641:25:1;;;33585:6:0;-1:-1:-1;;;;;33585:18:0;;;;614::1;;33585:23:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;33585:23:0;;;;;;;;;;;;:::i;31553:362::-;31659:11;31672:15;31715:23;:21;:23::i;:::-;31705:33;;31782:9;31771:7;:20;;31749:97;;;;-1:-1:-1;;;31749:97:0;;12134:2:1;31749:97:0;;;12116:21:1;12173:2;12153:18;;;12146:30;12212:29;12192:18;;;12185:57;12259:18;;31749:97:0;;;;;;;;31863:44;;-1:-1:-1;;;31863:44:0;;-1:-1:-1;;;;;1633:32:1;;;31863:44:0;;;1615:51:1;31863:6:0;:18;;;;31889:7;;1588:18:1;;31863:44:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;31857:50;;31553:362;;;:::o;31035:165::-;31158:34;;-1:-1:-1;;;31158:34:0;;31180:11;31158:34;;;641:25:1;31126:7:0;;31158:6;-1:-1:-1;;;;;31158:21:0;;;;614:18:1;;31158:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;-1:-1:-1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;206:286:1:-;264:6;317:2;305:9;296:7;292:23;288:32;285:52;;;333:1;330;323:12;285:52;359:23;;-1:-1:-1;;;;;;411:32:1;;401:43;;391:71;;458:1;455;448:12;391:71;481:5;206:286;-1:-1:-1;;;206:286:1:o;1677:180::-;1736:6;1789:2;1777:9;1768:7;1764:23;1760:32;1757:52;;;1805:1;1802;1795:12;1757:52;-1:-1:-1;1828:23:1;;1677:180;-1:-1:-1;1677:180:1:o;1862:258::-;1934:1;1944:113;1958:6;1955:1;1952:13;1944:113;;;2034:11;;;2028:18;2015:11;;;2008:39;1980:2;1973:10;1944:113;;;2075:6;2072:1;2069:13;2066:48;;;2110:1;2101:6;2096:3;2092:16;2085:27;2066:48;;1862:258;;;:::o;2125:::-;2167:3;2205:5;2199:12;2232:6;2227:3;2220:19;2248:63;2304:6;2297:4;2292:3;2288:14;2281:4;2274:5;2270:16;2248:63;:::i;:::-;2365:2;2344:15;-1:-1:-1;;2340:29:1;2331:39;;;;2372:4;2327:50;;2125:258;-1:-1:-1;;2125:258:1:o;2388:220::-;2537:2;2526:9;2519:21;2500:4;2557:45;2598:2;2587:9;2583:18;2575:6;2557:45;:::i;2836:127::-;2897:10;2892:3;2888:20;2885:1;2878:31;2928:4;2925:1;2918:15;2952:4;2949:1;2942:15;2968:257;3040:4;3034:11;;;3072:17;;3119:18;3104:34;;3140:22;;;3101:62;3098:88;;;3166:18;;:::i;:::-;3202:4;3195:24;2968:257;:::o;3230:253::-;3302:2;3296:9;3344:4;3332:17;;3379:18;3364:34;;3400:22;;;3361:62;3358:88;;;3426:18;;:::i;3488:248::-;3555:2;3549:9;3597:4;3585:17;;3632:18;3617:34;;3653:22;;;3614:62;3611:88;;;3679:18;;:::i;3741:601::-;3816:5;3846:18;3887:2;3879:6;3876:14;3873:40;;;3893:18;;:::i;:::-;3968:2;3962:9;3936:2;4022:15;;-1:-1:-1;;4018:24:1;;;4044:2;4014:33;4010:42;3998:55;;;4068:18;;;4088:22;;;4065:46;4062:72;;;4114:18;;:::i;:::-;4154:10;4150:2;4143:22;4183:6;4174:15;;4213:6;4205;4198:22;4253:3;4244:6;4239:3;4235:16;4232:25;4229:45;;;4270:1;4267;4260:12;4229:45;4283:53;4329:6;4322:4;4314:6;4310:17;4305:3;4283:53;:::i;:::-;;;;3741:601;;;;;:::o;4347:235::-;4400:5;4453:3;4446:4;4438:6;4434:17;4430:27;4420:55;;4471:1;4468;4461:12;4420:55;4493:83;4572:3;4563:6;4557:13;4550:4;4542:6;4538:17;4493:83;:::i;4587:160::-;4664:13;;4717:4;4706:16;;4696:27;;4686:55;;4737:1;4734;4727:12;4686:55;4587:160;;;:::o;4752:175::-;4830:13;;4883:18;4872:30;;4862:41;;4852:69;;4917:1;4914;4907:12;4932:1833;5025:6;5056:2;5099;5087:9;5078:7;5074:23;5070:32;5067:52;;;5115:1;5112;5105:12;5067:52;5148:9;5142:16;5177:18;5218:2;5210:6;5207:14;5204:34;;;5234:1;5231;5224:12;5204:34;5257:22;;;;5313:4;5295:16;;;5291:27;5288:47;;;5331:1;5328;5321:12;5288:47;5357:22;;:::i;:::-;5409:2;5403:9;5457:7;5450:15;5443:23;5434:7;5431:36;5421:64;;5481:1;5478;5471:12;5421:64;5494:22;;5547:11;;;5541:18;5571:16;;;5568:36;;;5600:1;5597;5590:12;5568:36;5623:17;;;;;5674:4;5656:16;;;5652:27;5649:47;;;5692:1;5689;5682:12;5649:47;5720:22;;:::i;:::-;5773:2;5767:9;5801:2;5791:8;5788:16;5785:36;;;5817:1;5814;5807:12;5785:36;5840:17;;5891:4;5873:16;;;5869:27;5866:47;;;5909:1;5906;5899:12;5866:47;5937:22;;:::i;:::-;5990:2;5984:9;6018:2;6008:8;6005:16;6002:36;;;6034:1;6031;6024:12;6002:36;6063:55;6110:7;6099:8;6095:2;6091:17;6063:55;:::i;:::-;6054:7;6047:72;;6157:2;6153;6149:11;6143:18;6128:33;;6205:10;6196:7;6192:24;6183:7;6180:37;6170:65;;6231:1;6228;6221:12;6170:65;6251:16;;;6244:33;;;6286:24;;-1:-1:-1;6344:40:1;6372:11;;;6344:40;:::i;:::-;6339:2;6330:7;6326:16;6319:66;6421:42;6457:4;6453:2;6449:13;6421:42;:::i;:::-;6414:4;6405:7;6401:18;6394:70;6498:40;6534:2;6530;6526:11;6498:40;:::i;:::-;6493:2;6484:7;6480:16;6473:66;6574:42;6611:3;6607:2;6603:12;6574:42;:::i;:::-;6568:3;6559:7;6555:17;6548:69;6652:42;6689:3;6685:2;6681:12;6652:42;:::i;:::-;6646:3;6633:17;;6626:69;6711:14;;;6704:31;;;;-1:-1:-1;6715:5:1;;4932:1833;-1:-1:-1;;;;4932:1833:1:o;6957:1326::-;7132:2;7121:9;7114:21;7191:6;7185:13;7178:21;7171:29;7166:2;7155:9;7151:18;7144:57;7095:4;7248:2;7240:6;7236:15;7230:22;7290:4;7283;7272:9;7268:20;7261:34;7332:12;7326:19;7381:4;7376:2;7365:9;7361:18;7354:32;7423:14;7417:21;7475:4;7469:3;7458:9;7454:19;7447:33;7503:54;7552:3;7541:9;7537:19;7521:14;7503:54;:::i;:::-;7624:2;7604:23;;;7598:30;7630:10;7594:47;7588:3;7573:19;;7566:76;7679:21;;;7673:28;6837:4;6826:16;;7758:3;7743:19;;6814:29;7673:28;7489:68;-1:-1:-1;7818:4:1;7800:23;;7794:30;6837:4;6826:16;;7881:3;7866:19;;6814:29;7794:30;-1:-1:-1;7941:2:1;7923:21;;7917:28;6837:4;6826:16;;8002:4;7987:20;;6814:29;7917:28;-1:-1:-1;8063:3:1;8045:22;;8039:29;6926:18;6915:30;;8126:3;8111:19;;6903:43;8039:29;-1:-1:-1;8186:3:1;8172:12;8168:22;8162:29;8140:51;;8200:54;8249:3;8238:9;8234:19;8218:14;6926:18;6915:30;6903:43;;6850:102;8200:54;8271:6;6957:1326;-1:-1:-1;;;;;6957:1326:1:o;8288:206::-;8357:6;8410:2;8398:9;8389:7;8385:23;8381:32;8378:52;;;8426:1;8423;8416:12;8378:52;8449:39;8478:9;8449:39;:::i;8499:878::-;8594:6;8647:2;8635:9;8626:7;8622:23;8618:32;8615:52;;;8663:1;8660;8653:12;8615:52;8696:9;8690:16;8725:18;8766:2;8758:6;8755:14;8752:34;;;8782:1;8779;8772:12;8752:34;8805:22;;;;8861:4;8843:16;;;8839:27;8836:47;;;8879:1;8876;8869:12;8836:47;8905:17;;:::i;:::-;8946:9;;-1:-1:-1;;;;;8986:33:1;;8974:46;;8964:74;;9034:1;9031;9024:12;8964:74;9061:7;9054:5;9047:22;;9115:2;9111;9107:11;9101:18;9096:2;9089:5;9085:14;9078:42;9166:2;9162;9158:11;9152:18;9147:2;9140:5;9136:14;9129:42;9210:2;9206;9202:11;9196:18;9239:2;9229:8;9226:16;9223:36;;;9255:1;9252;9245:12;9223:36;9291:55;9338:7;9327:8;9323:2;9319:17;9291:55;:::i;:::-;9286:2;9275:14;;9268:79;-1:-1:-1;9279:5:1;8499:878;-1:-1:-1;;;;;8499:878:1:o;9382:184::-;9452:6;9505:2;9493:9;9484:7;9480:23;9476:32;9473:52;;;9521:1;9518;9511:12;9473:52;-1:-1:-1;9544:16:1;;9382:184;-1:-1:-1;9382:184:1:o;9571:611::-;9674:6;9682;9735:2;9723:9;9714:7;9710:23;9706:32;9703:52;;;9751:1;9748;9741:12;9703:52;9783:9;9777:16;9822:3;9815:5;9812:14;9802:42;;9840:1;9837;9830:12;9802:42;9912:2;9897:18;;9891:25;9863:5;;-1:-1:-1;9939:18:1;9928:30;;9925:50;;;9971:1;9968;9961:12;9925:50;9994:22;;10047:4;10039:13;;10035:27;-1:-1:-1;10025:55:1;;10076:1;10073;10066:12;10025:55;10099:77;10168:7;10163:2;10157:9;10152:2;10148;10144:11;10099:77;:::i;:::-;10089:87;;;9571:611;;;;;:::o;10187:222::-;10227:4;10255:1;10252;10249:8;10246:131;;;10299:10;10294:3;10290:20;10287:1;10280:31;10334:4;10331:1;10324:15;10362:4;10359:1;10352:15;10246:131;-1:-1:-1;10394:9:1;;10187:222::o;10856:380::-;10935:1;10931:12;;;;10978;;;10999:61;;11053:4;11045:6;11041:17;11031:27;;10999:61;11106:2;11098:6;11095:14;11075:18;11072:38;11069:161;;11152:10;11147:3;11143:20;11140:1;11133:31;11187:4;11184:1;11177:15;11215:4;11212:1;11205:15;11069:161;;10856:380;;;:::o;11241:274::-;11370:3;11408:6;11402:13;11424:53;11470:6;11465:3;11458:4;11450:6;11446:17;11424:53;:::i;:::-;11493:16;;;;;11241:274;-1:-1:-1;;11241:274:1:o;11520:127::-;11581:10;11576:3;11572:20;11569:1;11562:31;11612:4;11609:1;11602:15;11636:4;11633:1;11626:15;11652:275;11737:6;11790:2;11778:9;11769:7;11765:23;11761:32;11758:52;;;11806:1;11803;11796:12;11758:52;11838:9;11832:16;11877:1;11870:5;11867:12;11857:40;;11893:1;11890;11883:12

Swarm Source

ipfs://78d8e98b97e78a280b0497f2e6fba7e9a8415feebe129c7ea84134872d7cdb02

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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