false
false

Contract Address Details

0x1D9c4a8f8B7b5F9B8e2641D81927f8F8Cc7fF079

Contract Name
WitnetParserLib
Creator
0x102cb4–8586da at 0x05ca80–9c9110
Balance
0 KCS
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
31200200
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
WitnetParserLib




Optimization enabled
true
Compiler version
v0.8.11+commit.d7f03943




Optimization runs
200
EVM Version
default




Verified at
2022-01-04T15:40:30.704014Z

Contract source code

// SPDX-License-Identifier: MIT


pragma solidity >=0.7.0 <0.9.0;

pragma experimental ABIEncoderV2;

// File: 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: 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: contracts\libs\WitnetBuffer.sol
/// @title A convenient wrapper around the `bytes memory` type that exposes a buffer-like interface
/// @notice The buffer has an inner cursor that tracks the final offset of every read, i.e. any subsequent read will
/// start with the byte that goes right after the last one in the previous read.
/// @dev `uint32` is used here for `cursor` because `uint16` would only enable seeking up to 8KB, which could in some
/// theoretical use cases be exceeded. Conversely, `uint32` supports up to 512MB, which cannot credibly be exceeded.
/// @author The Witnet Foundation.
library WitnetBuffer {

  // Ensures we access an existing index in an array
  modifier notOutOfBounds(uint32 index, uint256 length) {
    require(index < length, "WitnetBuffer: Tried to read from a consumed Buffer (must rewind it first)");
    _;
  }

  /// @notice Read and consume a certain amount of bytes from the buffer.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @param _length How many bytes to read and consume from the buffer.
  /// @return A `bytes memory` containing the first `_length` bytes from the buffer, counting from the cursor position.
  function read(Witnet.Buffer memory _buffer, uint32 _length) internal pure returns (bytes memory) {
    // Make sure not to read out of the bounds of the original bytes
    require(_buffer.cursor + _length <= _buffer.data.length, "WitnetBuffer: Not enough bytes in buffer when reading");

    // Create a new `bytes memory destination` value
    bytes memory destination = new bytes(_length);

    // Early return in case that bytes length is 0
    if (_length != 0) {
      bytes memory source = _buffer.data;
      uint32 offset = _buffer.cursor;

      // Get raw pointers for source and destination
      uint sourcePointer;
      uint destinationPointer;
      assembly {
        sourcePointer := add(add(source, 32), offset)
        destinationPointer := add(destination, 32)
      }
      // Copy `_length` bytes from source to destination
      memcpy(destinationPointer, sourcePointer, uint(_length));

      // Move the cursor forward by `_length` bytes
      seek(_buffer, _length, true);
    }
    return destination;
  }

  /// @notice Read and consume the next byte from the buffer.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @return The next byte in the buffer counting from the cursor position.
  function next(Witnet.Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor, _buffer.data.length) returns (bytes1) {
    // Return the byte at the position marked by the cursor and advance the cursor all at once
    return _buffer.data[_buffer.cursor++];
  }

  /// @notice Move the inner cursor of the buffer to a relative or absolute position.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @param _offset How many bytes to move the cursor forward.
  /// @param _relative Whether to count `_offset` from the last position of the cursor (`true`) or the beginning of the
  /// buffer (`true`).
  /// @return The final position of the cursor (will equal `_offset` if `_relative` is `false`).
  // solium-disable-next-line security/no-assign-params
  function seek(Witnet.Buffer memory _buffer, uint32 _offset, bool _relative) internal pure returns (uint32) {
    // Deal with relative offsets
    if (_relative) {
      require(_offset + _buffer.cursor > _offset, "WitnetBuffer: Integer overflow when seeking");
      _offset += _buffer.cursor;
    }
    // Make sure not to read out of the bounds of the original bytes
    require(_offset <= _buffer.data.length, "WitnetBuffer: Not enough bytes in buffer when seeking");
    _buffer.cursor = _offset;
    return _buffer.cursor;
  }

  /// @notice Move the inner cursor a number of bytes forward.
  /// @dev This is a simple wrapper around the relative offset case of `seek()`.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @param _relativeOffset How many bytes to move the cursor forward.
  /// @return The final position of the cursor.
  function seek(Witnet.Buffer memory _buffer, uint32 _relativeOffset) internal pure returns (uint32) {
    return seek(_buffer, _relativeOffset, true);
  }

  /// @notice Move the inner cursor back to the first byte in the buffer.
  /// @param _buffer An instance of `Witnet.Buffer`.
  function rewind(Witnet.Buffer memory _buffer) internal pure {
    _buffer.cursor = 0;
  }

  /// @notice Read and consume the next byte from the buffer as an `uint8`.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @return The `uint8` value of the next byte in the buffer counting from the cursor position.
  function readUint8(Witnet.Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor, _buffer.data.length) returns (uint8) {
    bytes memory bytesValue = _buffer.data;
    uint32 offset = _buffer.cursor;
    uint8 value;
    assembly {
      value := mload(add(add(bytesValue, 1), offset))
    }
    _buffer.cursor++;

    return value;
  }

  /// @notice Read and consume the next 2 bytes from the buffer as an `uint16`.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @return The `uint16` value of the next 2 bytes in the buffer counting from the cursor position.
  function readUint16(Witnet.Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 1, _buffer.data.length) returns (uint16) {
    bytes memory bytesValue = _buffer.data;
    uint32 offset = _buffer.cursor;
    uint16 value;
    assembly {
      value := mload(add(add(bytesValue, 2), offset))
    }
    _buffer.cursor += 2;

    return value;
  }

  /// @notice Read and consume the next 4 bytes from the buffer as an `uint32`.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @return The `uint32` value of the next 4 bytes in the buffer counting from the cursor position.
  function readUint32(Witnet.Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 3, _buffer.data.length) returns (uint32) {
    bytes memory bytesValue = _buffer.data;
    uint32 offset = _buffer.cursor;
    uint32 value;
    assembly {
      value := mload(add(add(bytesValue, 4), offset))
    }
    _buffer.cursor += 4;

    return value;
  }

  /// @notice Read and consume the next 8 bytes from the buffer as an `uint64`.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @return The `uint64` value of the next 8 bytes in the buffer counting from the cursor position.
  function readUint64(Witnet.Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 7, _buffer.data.length) returns (uint64) {
    bytes memory bytesValue = _buffer.data;
    uint32 offset = _buffer.cursor;
    uint64 value;
    assembly {
      value := mload(add(add(bytesValue, 8), offset))
    }
    _buffer.cursor += 8;

    return value;
  }

  /// @notice Read and consume the next 16 bytes from the buffer as an `uint128`.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @return The `uint128` value of the next 16 bytes in the buffer counting from the cursor position.
  function readUint128(Witnet.Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 15, _buffer.data.length) returns (uint128) {
    bytes memory bytesValue = _buffer.data;
    uint32 offset = _buffer.cursor;
    uint128 value;
    assembly {
      value := mload(add(add(bytesValue, 16), offset))
    }
    _buffer.cursor += 16;

    return value;
  }

  /// @notice Read and consume the next 32 bytes from the buffer as an `uint256`.
  /// @return The `uint256` value of the next 32 bytes in the buffer counting from the cursor position.
  /// @param _buffer An instance of `Witnet.Buffer`.
  function readUint256(Witnet.Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 31, _buffer.data.length) returns (uint256) {
    bytes memory bytesValue = _buffer.data;
    uint32 offset = _buffer.cursor;
    uint256 value;
    assembly {
      value := mload(add(add(bytesValue, 32), offset))
    }
    _buffer.cursor += 32;

    return value;
  }

  /// @notice Read and consume the next 2 bytes from the buffer as an IEEE 754-2008 floating point number enclosed in an
  /// `int32`.
  /// @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 `float16`
  /// use cases. In other words, the integer output of this method is 10,000 times the actual value. The input bytes are
  /// expected to follow the 16-bit base-2 format (a.k.a. `binary16`) in the IEEE 754-2008 standard.
  /// @param _buffer An instance of `Witnet.Buffer`.
  /// @return The `uint32` value of the next 4 bytes in the buffer counting from the cursor position.
  function readFloat16(Witnet.Buffer memory _buffer) internal pure returns (int32) {
    uint32 bytesValue = readUint16(_buffer);
    // Get bit at position 0
    uint32 sign = bytesValue & 0x8000;
    // Get bits 1 to 5, then normalize to the [-14, 15] range so as to counterweight the IEEE 754 exponent bias
    int32 exponent = (int32(bytesValue & 0x7c00) >> 10) - 15;
    // Get bits 6 to 15
    int32 significand = int32(bytesValue & 0x03ff);

    // Add 1024 to the fraction if the exponent is 0
    if (exponent == 15) {
      significand |= 0x400;
    }

    // Compute `2 ^ exponent · (1 + fraction / 1024)`
    int32 result = 0;
    if (exponent >= 0) {
      result = int32((int256(1 << uint256(int256(exponent))) * 10000 * int256(uint256(int256(significand)) | 0x400)) >> 10);
    } else {
      result = int32(((int256(uint256(int256(significand)) | 0x400) * 10000) / int256(1 << uint256(int256(- exponent)))) >> 10);
    }

    // Make the result negative if the sign bit is not 0
    if (sign != 0) {
      result *= - 1;
    }
    return result;
  }

  /// @notice Copy bytes from one memory address into another.
  /// @dev This function was borrowed from Nick Johnson's `solidity-stringutils` lib, and reproduced here under the terms
  /// of [Apache License 2.0](https://github.com/Arachnid/solidity-stringutils/blob/master/LICENSE).
  /// @param _dest Address of the destination memory.
  /// @param _src Address to the source memory.
  /// @param _len How many bytes to copy.
  // solium-disable-next-line security/no-assign-params
  function memcpy(uint _dest, uint _src, uint _len) private pure {
    require(_len > 0, "WitnetBuffer: Cannot copy 0 bytes");

    // Copy word-length chunks while possible
    for (; _len >= 32; _len -= 32) {
      assembly {
        mstore(_dest, mload(_src))
      }
      _dest += 32;
      _src += 32;
    }
    if (_len > 0) {
      // Copy remaining bytes
      uint mask = 256 ** (32 - _len) - 1;
      assembly {
        let srcpart := and(mload(_src), not(mask))
        let destpart := and(mload(_dest), mask)
        mstore(_dest, or(destpart, srcpart))
      }
    }
  }

}
// File: contracts\libs\WitnetDecoderLib.sol
/// @title A minimalistic implementation of “RFC 7049 Concise Binary Object Representation”
/// @notice This library leverages a buffer-like structure for step-by-step decoding of bytes so as to minimize
/// the gas cost of decoding them into a useful native type.
/// @dev Most of the logic has been borrowed from Patrick Gansterer’s cbor.js library: https://github.com/paroga/cbor-js
/// @author The Witnet Foundation.
/// 
/// TODO: add support for Array (majorType = 4)
/// TODO: add support for Map (majorType = 5)
/// TODO: add support for Float32 (majorType = 7, additionalInformation = 26)
/// TODO: add support for Float64 (majorType = 7, additionalInformation = 27) 

library WitnetDecoderLib {

  using WitnetBuffer for Witnet.Buffer;

  uint32 constant internal _UINT32_MAX = type(uint32).max;
  uint64 constant internal _UINT64_MAX = type(uint64).max;

  /// @notice Decode a `Witnet.CBOR` structure into a native `bool` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as a `bool` value.
  function decodeBool(Witnet.CBOR memory _cborValue) public pure returns(bool) {
    _cborValue.len = readLength(_cborValue.buffer, _cborValue.additionalInformation);
    require(_cborValue.majorType == 7, "WitnetDecoderLib: Tried to read a `bool` value from a `Witnet.CBOR` with majorType != 7");
    if (_cborValue.len == 20) {
      return false;
    } else if (_cborValue.len == 21) {
      return true;
    } else {
      revert("WitnetDecoderLib: Tried to read `bool` from a `Witnet.CBOR` with len different than 20 or 21");
    }
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `bytes` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as a `bytes` value.   
  function decodeBytes(Witnet.CBOR memory _cborValue) public pure returns(bytes memory) {
    _cborValue.len = readLength(_cborValue.buffer, _cborValue.additionalInformation);
    if (_cborValue.len == _UINT32_MAX) {
      bytes memory bytesData;

      // These checks look repetitive but the equivalent loop would be more expensive.
      uint32 itemLength = uint32(readIndefiniteStringLength(_cborValue.buffer, _cborValue.majorType));
      if (itemLength < _UINT32_MAX) {
        bytesData = abi.encodePacked(bytesData, _cborValue.buffer.read(itemLength));
        itemLength = uint32(readIndefiniteStringLength(_cborValue.buffer, _cborValue.majorType));
        if (itemLength < _UINT32_MAX) {
          bytesData = abi.encodePacked(bytesData, _cborValue.buffer.read(itemLength));
        }
      }
      return bytesData;
    } else {
      return _cborValue.buffer.read(uint32(_cborValue.len));
    }
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `bytes32` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return _bytes32 The value represented by the input, as a `bytes32` value.
  function decodeBytes32(Witnet.CBOR memory _cborValue) public pure returns(bytes32 _bytes32) {
    bytes memory _bb = decodeBytes(_cborValue);
    uint _len = _bb.length > 32 ? 32 : _bb.length;
    for (uint _i = 0; _i < _len; _i ++) {
        _bytes32 |= bytes32(_bb[_i] & 0xff) >> (_i * 8);
    }
  }

  /// @notice Decode a `Witnet.CBOR` structure into a `fixed16` 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 _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as an `int128` value.
  function decodeFixed16(Witnet.CBOR memory _cborValue) public pure returns(int32) {
    require(_cborValue.majorType == 7, "WitnetDecoderLib: Tried to read a `fixed` value from a `WT.CBOR` with majorType != 7");
    require(_cborValue.additionalInformation == 25, "WitnetDecoderLib: Tried to read `fixed16` from a `WT.CBOR` with additionalInformation != 25");
    return _cborValue.buffer.readFloat16();
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `int128[]` value whose inner values follow the same convention.
  /// as explained in `decodeFixed16`.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as an `int128[]` value.
  function decodeFixed16Array(Witnet.CBOR memory _cborValue) external pure returns(int32[] memory) {
    require(_cborValue.majorType == 4, "WitnetDecoderLib: Tried to read `int128[]` from a `Witnet.CBOR` with majorType != 4");

    uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation);
    require(length < _UINT64_MAX, "WitnetDecoderLib: Indefinite-length CBOR arrays are not supported");

    int32[] memory array = new int32[](length);
    for (uint64 i = 0; i < length; i++) {
      Witnet.CBOR memory item = valueFromBuffer(_cborValue.buffer);
      array[i] = decodeFixed16(item);
    }

    return array;
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `int128` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as an `int128` value.
  function decodeInt128(Witnet.CBOR memory _cborValue) public pure returns(int128) {
    if (_cborValue.majorType == 1) {
      uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation);
      return int128(-1) - int128(uint128(length));
    } else if (_cborValue.majorType == 0) {
      // Any `uint64` can be safely casted to `int128`, so this method supports majorType 1 as well so as to have offer
      // a uniform API for positive and negative numbers
      return int128(uint128(decodeUint64(_cborValue)));
    }
    revert("WitnetDecoderLib: Tried to read `int128` from a `Witnet.CBOR` with majorType not 0 or 1");
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `int128[]` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as an `int128[]` value.
  function decodeInt128Array(Witnet.CBOR memory _cborValue) external pure returns(int128[] memory) {
    require(_cborValue.majorType == 4, "WitnetDecoderLib: Tried to read `int128[]` from a `Witnet.CBOR` with majorType != 4");

    uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation);
    require(length < _UINT64_MAX, "WitnetDecoderLib: Indefinite-length CBOR arrays are not supported");

    int128[] memory array = new int128[](length);
    for (uint64 i = 0; i < length; i++) {
      Witnet.CBOR memory item = valueFromBuffer(_cborValue.buffer);
      array[i] = decodeInt128(item);
    }

    return array;
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `string` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as a `string` value.
  function decodeString(Witnet.CBOR memory _cborValue) public pure returns(string memory) {
    _cborValue.len = readLength(_cborValue.buffer, _cborValue.additionalInformation);
    if (_cborValue.len == _UINT64_MAX) {
      bytes memory textData;
      bool done;
      while (!done) {
        uint64 itemLength = readIndefiniteStringLength(_cborValue.buffer, _cborValue.majorType);
        if (itemLength < _UINT64_MAX) {
          textData = abi.encodePacked(textData, readText(_cborValue.buffer, itemLength / 4));
        } else {
          done = true;
        }
      }
      return string(textData);
    } else {
      return string(readText(_cborValue.buffer, _cborValue.len));
    }
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `string[]` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as an `string[]` value.
  function decodeStringArray(Witnet.CBOR memory _cborValue) external pure returns(string[] memory) {
    require(_cborValue.majorType == 4, "WitnetDecoderLib: Tried to read `string[]` from a `Witnet.CBOR` with majorType != 4");

    uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation);
    require(length < _UINT64_MAX, "WitnetDecoderLib: Indefinite-length CBOR arrays are not supported");

    string[] memory array = new string[](length);
    for (uint64 i = 0; i < length; i++) {
      Witnet.CBOR memory item = valueFromBuffer(_cborValue.buffer);
      array[i] = decodeString(item);
    }

    return array;
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `uint64` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as an `uint64` value.
  function decodeUint64(Witnet.CBOR memory _cborValue) public pure returns(uint64) {
    require(_cborValue.majorType == 0, "WitnetDecoderLib: Tried to read `uint64` from a `Witnet.CBOR` with majorType != 0");
    return readLength(_cborValue.buffer, _cborValue.additionalInformation);
  }

  /// @notice Decode a `Witnet.CBOR` structure into a native `uint64[]` value.
  /// @param _cborValue An instance of `Witnet.CBOR`.
  /// @return The value represented by the input, as an `uint64[]` value.
  function decodeUint64Array(Witnet.CBOR memory _cborValue) external pure returns(uint64[] memory) {
    require(_cborValue.majorType == 4, "WitnetDecoderLib: Tried to read `uint64[]` from a `Witnet.CBOR` with majorType != 4");

    uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation);
    require(length < _UINT64_MAX, "WitnetDecoderLib: Indefinite-length CBOR arrays are not supported");

    uint64[] memory array = new uint64[](length);
    for (uint64 i = 0; i < length; i++) {
      Witnet.CBOR memory item = valueFromBuffer(_cborValue.buffer);
      array[i] = decodeUint64(item);
    }

    return array;
  }

  /// @notice Decode a Witnet.CBOR structure from raw bytes.
  /// @dev This is the main factory for Witnet.CBOR instances, which can be later decoded into native EVM types.
  /// @param _cborBytes Raw bytes representing a CBOR-encoded value.
  /// @return A `Witnet.CBOR` instance containing a partially decoded value.
  function valueFromBytes(bytes memory _cborBytes) external pure returns(Witnet.CBOR memory) {
    Witnet.Buffer memory buffer = Witnet.Buffer(_cborBytes, 0);

    return valueFromBuffer(buffer);
  }

  /// @notice Decode a Witnet.CBOR structure from raw bytes.
  /// @dev This is an alternate factory for Witnet.CBOR instances, which can be later decoded into native EVM types.
  /// @param _buffer A Buffer structure representing a CBOR-encoded value.
  /// @return A `Witnet.CBOR` instance containing a partially decoded value.
  function valueFromBuffer(Witnet.Buffer memory _buffer) public pure returns(Witnet.CBOR memory) {
    require(_buffer.data.length > 0, "WitnetDecoderLib: Found empty buffer when parsing CBOR value");

    uint8 initialByte;
    uint8 majorType = 255;
    uint8 additionalInformation;
    uint64 tag = _UINT64_MAX;

    bool isTagged = true;
    while (isTagged) {
      // Extract basic CBOR properties from input bytes
      initialByte = _buffer.readUint8();
      majorType = initialByte >> 5;
      additionalInformation = initialByte & 0x1f;

      // Early CBOR tag parsing.
      if (majorType == 6) {
        tag = readLength(_buffer, additionalInformation);
      } else {
        isTagged = false;
      }
    }

    require(majorType <= 7, "WitnetDecoderLib: Invalid CBOR major type");

    return Witnet.CBOR(
      _buffer,
      initialByte,
      majorType,
      additionalInformation,
      0,
      tag);
  }

  /// Reads the length of the next CBOR item from a buffer, consuming a different number of bytes depending on the
  /// value of the `additionalInformation` argument.
  function readLength(Witnet.Buffer memory _buffer, uint8 additionalInformation) private pure returns(uint64) {
    if (additionalInformation < 24) {
      return additionalInformation;
    }
    if (additionalInformation == 24) {
      return _buffer.readUint8();
    }
    if (additionalInformation == 25) {
      return _buffer.readUint16();
    }
    if (additionalInformation == 26) {
      return _buffer.readUint32();
    }
    if (additionalInformation == 27) {
      return _buffer.readUint64();
    }
    if (additionalInformation == 31) {
      return _UINT64_MAX;
    }
    revert("WitnetDecoderLib: Invalid length encoding (non-existent additionalInformation value)");
  }

  /// Read the length of a CBOR indifinite-length item (arrays, maps, byte strings and text) from a buffer, consuming
  /// as many bytes as specified by the first byte.
  function readIndefiniteStringLength(Witnet.Buffer memory _buffer, uint8 majorType) private pure returns(uint64) {
    uint8 initialByte = _buffer.readUint8();
    if (initialByte == 0xff) {
      return _UINT64_MAX;
    }
    uint64 length = readLength(_buffer, initialByte & 0x1f);
    require(length < _UINT64_MAX && (initialByte >> 5) == majorType, "WitnetDecoderLib: Invalid indefinite length");
    return length;
  }

  /// Read a text string of a given length from a buffer. Returns a `bytes memory` value for the sake of genericness,
  /// but it can be easily casted into a string with `string(result)`.
  // solium-disable-next-line security/no-assign-params
  function readText(Witnet.Buffer memory _buffer, uint64 _length) private pure returns(bytes memory) {
    bytes memory result;
    for (uint64 index = 0; index < _length; index++) {
      uint8 value = _buffer.readUint8();
      if (value & 0x80 != 0) {
        if (value < 0xe0) {
          value = (value & 0x1f) << 6 |
            (_buffer.readUint8() & 0x3f);
          _length -= 1;
        } else if (value < 0xf0) {
          value = (value & 0x0f) << 12 |
            (_buffer.readUint8() & 0x3f) << 6 |
            (_buffer.readUint8() & 0x3f);
          _length -= 2;
        } else {
          value = (value & 0x0f) << 18 |
            (_buffer.readUint8() & 0x3f) << 12 |
            (_buffer.readUint8() & 0x3f) << 6  |
            (_buffer.readUint8() & 0x3f);
          _length -= 3;
        }
      }
      result = abi.encodePacked(result, value);
    }
    return result;
  }
}
// File: contracts\libs\WitnetParserLib.sol
/// @title A library for decoding Witnet request results
/// @notice The library exposes functions to check the Witnet request success.
/// and retrieve Witnet results from CBOR values into solidity types.
/// @author The Witnet Foundation.
library WitnetParserLib {

    using WitnetDecoderLib for bytes;
    using WitnetDecoderLib for Witnet.CBOR;

    /// @notice 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 calldata _cborBytes)
        external pure
        returns (Witnet.Result memory)
    {
        Witnet.CBOR memory cborValue = _cborBytes.valueFromBytes();
        return resultFromCborValue(cborValue);
    }

    /// @notice Decode a CBOR value into a Witnet.Result instance.
    /// @param _cborValue An instance of `Witnet.Value`.
    /// @return A `Witnet.Result` instance.
    function resultFromCborValue(Witnet.CBOR memory _cborValue)
        public pure
        returns (Witnet.Result memory)    
    {
        // Witnet uses CBOR tag 39 to represent RADON error code identifiers.
        // [CBOR tag 39] Identifiers for CBOR: https://github.com/lucas-clemente/cbor-specs/blob/master/id.md
        bool success = _cborValue.tag != 39;
        return Witnet.Result(success, _cborValue);
    }

    /// @notice 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)
    {
        return _result.success;
    }

    /// @notice 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)
    {
        return !_result.success;
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read bytes value from errored Witnet.Result");
        return _result.value.decodeBytes();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: tried to read bytes32 value from errored Witnet.Result");
        return _result.value.decodeBytes32();
    }

    /// @notice 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)
    {
        uint64[] memory error = asRawError(_result);
        if (error.length == 0) {
            return Witnet.ErrorCodes.Unknown;
        }
        return _supportedErrorOrElseUnknown(error[0]);
    }

    /// @notice 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)
      public pure
      returns (Witnet.ErrorCodes, string memory)
    {
        uint64[] memory error = asRawError(_result);
        if (error.length == 0) {
            return (Witnet.ErrorCodes.Unknown, "Unknown error (no error code)");
        }
        Witnet.ErrorCodes errorCode = _supportedErrorOrElseUnknown(error[0]);
        bytes memory errorMessage;

        if (errorCode == Witnet.ErrorCodes.SourceScriptNotCBOR && error.length >= 2) {
            errorMessage = abi.encodePacked(
                "Source script #",
                _utoa(error[1]),
                " was not a valid CBOR value"
            );
        } else if (errorCode == Witnet.ErrorCodes.SourceScriptNotArray && error.length >= 2) {
            errorMessage = abi.encodePacked(
                "The CBOR value in script #",
                _utoa(error[1]),
                " was not an Array of calls"
            );
        } else if (errorCode == Witnet.ErrorCodes.SourceScriptNotRADON && error.length >= 2) {
            errorMessage = abi.encodePacked(
                "The CBOR value in script #",
                _utoa(error[1]),
                " was not a valid Data Request"
            );
        } else if (errorCode == Witnet.ErrorCodes.RequestTooManySources && error.length >= 2) {
            errorMessage = abi.encodePacked(
                "The request contained too many sources (", 
                _utoa(error[1]), 
                ")"
            );
        } else if (errorCode == Witnet.ErrorCodes.ScriptTooManyCalls && error.length >= 4) {
            errorMessage = abi.encodePacked(
                "Script #",
                _utoa(error[2]),
                " from the ",
                stageName(error[1]),
                " stage contained too many calls (",
                _utoa(error[3]),
                ")"
            );
        } else if (errorCode == Witnet.ErrorCodes.UnsupportedOperator && error.length >= 5) {
            errorMessage = abi.encodePacked(
                "Operator code 0x",
                _utohex(error[4]),
                " found at call #",
                _utoa(error[3]),
                " in script #",
                _utoa(error[2]),
                " from ",
                stageName(error[1]),
                " stage is not supported"
            );
        } else if (errorCode == Witnet.ErrorCodes.HTTP && error.length >= 3) {
            errorMessage = abi.encodePacked(
                "Source #",
                _utoa(error[1]),
                " could not be retrieved. Failed with HTTP error code: ",
                _utoa(error[2] / 100),
                _utoa(error[2] % 100 / 10),
                _utoa(error[2] % 10)
            );
        } else if (errorCode == Witnet.ErrorCodes.RetrievalTimeout && error.length >= 2) {
            errorMessage = abi.encodePacked(
                "Source #",
                _utoa(error[1]),
                " could not be retrieved because of a timeout"
            );
        } else if (errorCode == Witnet.ErrorCodes.Underflow && error.length >= 5) {
              errorMessage = abi.encodePacked(
                "Underflow at operator code 0x",
                _utohex(error[4]),
                " found at call #",
                _utoa(error[3]),
                " in script #",
                _utoa(error[2]),
                " from ",
                stageName(error[1]),
                " stage"
            );
        } else if (errorCode == Witnet.ErrorCodes.Overflow && error.length >= 5) {
            errorMessage = abi.encodePacked(
                "Overflow at operator code 0x",
                _utohex(error[4]),
                " found at call #",
                _utoa(error[3]),
                " in script #",
                _utoa(error[2]),
                " from ",
                stageName(error[1]),
                " stage"
            );
        } else if (errorCode == Witnet.ErrorCodes.DivisionByZero && error.length >= 5) {
            errorMessage = abi.encodePacked(
                "Division by zero at operator code 0x",
                _utohex(error[4]),
                " found at call #",
                _utoa(error[3]),
                " in script #",
                _utoa(error[2]),
                " from ",
                stageName(error[1]),
                " stage"
            );
        } else if (errorCode == Witnet.ErrorCodes.BridgeMalformedRequest) {
            errorMessage = "The structure of the request is invalid and it cannot be parsed";
        } else if (errorCode == Witnet.ErrorCodes.BridgePoorIncentives) {
            errorMessage = "The request has been rejected by the bridge node due to poor incentives";
        } else if (errorCode == Witnet.ErrorCodes.BridgeOversizedResult) {
            errorMessage = "The request result length exceeds a bridge contract defined limit";
        } else {
            errorMessage = abi.encodePacked("Unknown error (0x", _utohex(error[0]), ")");
        }
        return (errorCode, string(errorMessage));
    }

    /// @notice 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)
        public pure
        returns(uint64[] memory)
    {
        require(
            !_result.success,
            "WitnetParserLib: Tried to read error code from successful Witnet.Result"
        );
        return _result.value.decodeUint64Array();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `bool` value from errored Witnet.Result");
        return _result.value.decodeBool();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `fixed16` value from errored Witnet.Result");
        return _result.value.decodeFixed16();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `fixed16[]` value from errored Witnet.Result");
        return _result.value.decodeFixed16Array();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `int128` value from errored Witnet.Result");
        return _result.value.decodeInt128();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `int128[]` value from errored Witnet.Result");
        return _result.value.decodeInt128Array();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `string` value from errored Witnet.Result");
        return _result.value.decodeString();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `string[]` value from errored Witnet.Result");
        return _result.value.decodeStringArray();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `uint64` value from errored Witnet.Result");
        return _result.value.decodeUint64();
    }

    /// @notice 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)
    {
        require(_result.success, "WitnetParserLib: Tried to read `uint64[]` value from errored Witnet.Result");
        return _result.value.decodeUint64Array();
    }

    /// @notice Convert a stage index number into the name of the matching Witnet request stage.
    /// @param _stageIndex A `uint64` identifying the index of one of the Witnet request stages.
    /// @return The name of the matching stage.
    function stageName(uint64 _stageIndex)
        public pure
        returns (string memory)
    {
        if (_stageIndex == 0) {
            return "retrieval";
        } else if (_stageIndex == 1) {
            return "aggregation";
        } else if (_stageIndex == 2) {
            return "tally";
        } else {
            return "unknown";
        }
    }

    /// @notice Get an `Witnet.ErrorCodes` item from its `uint64` discriminant.
    /// @param _discriminant The numeric identifier of an error.
    /// @return A member of `Witnet.ErrorCodes`.
    function _supportedErrorOrElseUnknown(uint64 _discriminant)
        private pure
        returns (Witnet.ErrorCodes)
    {
        return Witnet.ErrorCodes(_discriminant);
    }

    /// @notice Convert a `uint64` into a 1, 2 or 3 characters long `string` representing its.
    /// three less significant decimal values.
    /// @param _u A `uint64` value.
    /// @return The `string` representing its decimal value.
    function _utoa(uint64 _u)
        private pure
        returns (string memory)
    {
        if (_u < 10) {
            bytes memory b1 = new bytes(1);
            b1[0] = bytes1(uint8(_u) + 48);
            return string(b1);
        } else if (_u < 100) {
            bytes memory b2 = new bytes(2);
            b2[0] = bytes1(uint8(_u / 10) + 48);
            b2[1] = bytes1(uint8(_u % 10) + 48);
            return string(b2);
        } else {
            bytes memory b3 = new bytes(3);
            b3[0] = bytes1(uint8(_u / 100) + 48);
            b3[1] = bytes1(uint8(_u % 100 / 10) + 48);
            b3[2] = bytes1(uint8(_u % 10) + 48);
            return string(b3);
        }
    }

    /// @notice Convert a `uint64` into a 2 characters long `string` representing its two less significant hexadecimal values.
    /// @param _u A `uint64` value.
    /// @return The `string` representing its hexadecimal value.
    function _utohex(uint64 _u)
        private pure
        returns (string memory)
    {
        bytes memory b2 = new bytes(2);
        uint8 d0 = uint8(_u / 16) + 48;
        uint8 d1 = uint8(_u % 16) + 48;
        if (d0 > 57)
            d0 += 7;
        if (d1 > 57)
            d1 += 7;
        b2[0] = bytes1(d0);
        b2[1] = bytes1(d1);
        return string(b2);
    }
}
        

Contract ABI

[{"type":"function","stateMutability":"pure","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"asBool","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"asBytes","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"asBytes32","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"Witnet.ErrorCodes","name":"","internalType":"enum Witnet.ErrorCodes"}],"name":"asErrorCode","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"Witnet.ErrorCodes","name":"","internalType":"enum Witnet.ErrorCodes"},{"type":"string","name":"","internalType":"string"}],"name":"asErrorMessage","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"int32","name":"","internalType":"int32"}],"name":"asFixed16","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"int32[]","name":"","internalType":"int32[]"}],"name":"asFixed16Array","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"int128","name":"","internalType":"int128"}],"name":"asInt128","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"int128[]","name":"","internalType":"int128[]"}],"name":"asInt128Array","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint64[]","name":"","internalType":"uint64[]"}],"name":"asRawError","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"asString","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"string[]","name":"","internalType":"string[]"}],"name":"asStringArray","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"asUint64","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint64[]","name":"","internalType":"uint64[]"}],"name":"asUint64Array","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isError","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOk","inputs":[{"type":"tuple","name":"_result","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"tuple","name":"","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}],"name":"resultFromCborBytes","inputs":[{"type":"bytes","name":"_cborBytes","internalType":"bytes"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"tuple","name":"","internalType":"struct Witnet.Result","components":[{"type":"bool","name":"success","internalType":"bool"},{"type":"tuple","name":"value","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]}],"name":"resultFromCborValue","inputs":[{"type":"tuple","name":"_cborValue","internalType":"struct Witnet.CBOR","components":[{"type":"tuple","name":"buffer","internalType":"struct Witnet.Buffer","components":[{"type":"bytes","name":"data","internalType":"bytes"},{"type":"uint32","name":"cursor","internalType":"uint32"}]},{"type":"uint8","name":"initialByte","internalType":"uint8"},{"type":"uint8","name":"majorType","internalType":"uint8"},{"type":"uint8","name":"additionalInformation","internalType":"uint8"},{"type":"uint64","name":"len","internalType":"uint64"},{"type":"uint64","name":"tag","internalType":"uint64"}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"stageName","inputs":[{"type":"uint64","name":"_stageIndex","internalType":"uint64"}]}]
              

Contract Creation Code

0x612e9161003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061012b5760003560e01c8063a1d45d56116100b7578063d45d097d1161007b578063d45d097d146102da578063d8868db6146102fa578063e99e47f314610320578063f417daf514610333578063fc853c371461034657600080fd5b8063a1d45d561461025a578063a2e876551461026d578063abf82f4c1461028e578063c71db521146102a1578063cb5371c0146102c757600080fd5b80632d26b9e2116100fe5780632d26b9e2146101ac5780636646c119146101cc5780638233f9b3146101ee5780638cc5eb5414610219578063a1b908911461023a57600080fd5b80630879730d1461013057806308efc09714610159578063130283ee14610179578063147e5c8f14610199575b600080fd5b61014361013e366004611ccf565b610366565b6040516101509190611d4e565b60405180910390f35b61016c610167366004611ccf565b610479565b6040516101509190611d9b565b61018c610187366004611dd6565b610572565b6040516101509190611eed565b6101436101a7366004611ccf565b6105a6565b6101bf6101ba366004611ccf565b61061e565b6040516101509190611f14565b6101de6101da366004611ccf565b5190565b6040519015158152602001610150565b6102016101fc366004611ccf565b610716565b6040516001600160401b039091168152602001610150565b61022c610227366004611ccf565b610808565b604051610150929190611faf565b61024d610248366004611ccf565b610eea565b6040516101509190611fcf565b6101de610268366004611ccf565b511590565b61028061027b366004611ccf565b610fef565b604051908152602001610150565b6101de61029c366004611ccf565b6110f2565b6102b46102af366004611ccf565b6111e2565b604051600f9190910b8152602001610150565b61024d6102d5366004611fe2565b6112d4565b6102ed6102e8366004611ccf565b61139d565b6040516101509190611fff565b61030d610308366004611ccf565b6113db565b60405160039190910b8152602001610150565b61018c61032e36600461200d565b6114ce565b61024d610341366004611ccf565b61159c565b610359610354366004611ccf565b61164d565b604051610150919061207e565b8051606090156103f35760405162461bcd60e51b815260206004820152604760248201527f5769746e65745061727365724c69623a20547269656420746f2072656164206560448201527f72726f7220636f64652066726f6d207375636365737366756c205769746e65746064820152660b94995cdd5b1d60ca1b608482015260a4015b60405180910390fd5b602082015160405163f8a597d360e01b815273400dbf3645b345823124aab22d04013a46d9ced59163f8a597d39161042e91906004016120b9565b600060405180830381865af415801561044b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261047391908101906120fa565b92915050565b80516060906104f25760405162461bcd60e51b815260206004820152604b6024820152600080516020612d7583398151915260448201527f666978656431365b5d602076616c75652066726f6d206572726f72656420576960648201526a1d1b995d0b94995cdd5b1d60aa1b608482015260a4016103ea565b602082015160405163531f4ba760e01b815273400dbf3645b345823124aab22d04013a46d9ced59163531f4ba79161052d91906004016120b9565b600060405180830381865af415801561054a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261047391908101906121a5565b61057a611a48565b5060a0810151604080518082019091526001600160401b03909116602714158152602081019190915290565b80516060906103f35760405162461bcd60e51b815260206004820152604a6024820152600080516020612d7583398151915260448201527f75696e7436345b5d602076616c75652066726f6d206572726f726564205769746064820152691b995d0b94995cdd5b1d60b21b608482015260a4016103ea565b80516060906106965760405162461bcd60e51b815260206004820152604a6024820152600080516020612d7583398151915260448201527f737472696e675b5d602076616c75652066726f6d206572726f726564205769746064820152691b995d0b94995cdd5b1d60b21b608482015260a4016103ea565b60208201516040516362f447f960e11b815273400dbf3645b345823124aab22d04013a46d9ced59163c5e88ff2916106d191906004016120b9565b600060405180830381865af41580156106ee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104739190810190612276565b805160009061078c5760405162461bcd60e51b81526020600482015260486024820152600080516020612d7583398151915260448201527f75696e743634602076616c75652066726f6d206572726f726564205769746e656064820152671d0b94995cdd5b1d60c21b608482015260a4016103ea565b6020820151604051637a8acab160e01b815273400dbf3645b345823124aab22d04013a46d9ced591637a8acab1916107c791906004016120b9565b602060405180830381865af41580156107e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612326565b60006060600061081784610366565b90508051600014156108655760006040518060400160405280601d81526020017f556e6b6e6f776e206572726f7220286e6f206572726f7220636f6465290000008152509250925050915091565b600061088a8260008151811061087d5761087d612343565b6020026020010151611745565b9050606060018260ff8111156108a2576108a2611f76565b1480156108b157506002835110155b156108ff576108d9836001815181106108cc576108cc612343565b6020026020010151611762565b6040516020016108e99190612359565b6040516020818303038152906040529050610edf565b60028260ff81111561091357610913611f76565b14801561092257506002835110155b1561094d5761093d836001815181106108cc576108cc612343565b6040516020016108e991906123b7565b60038260ff81111561096157610961611f76565b14801561097057506002835110155b1561099b5761098b836001815181106108cc576108cc612343565b6040516020016108e99190612423565b60108260ff8111156109af576109af611f76565b1480156109be57506002835110155b156109e9576109d9836001815181106108cc576108cc612343565b6040516020016108e9919061248f565b60118260ff8111156109fd576109fd611f76565b148015610a0c57506004835110155b15610a7257610a27836002815181106108cc576108cc612343565b610a4a84600181518110610a3d57610a3d612343565b60200260200101516112d4565b610a60856003815181106108cc576108cc612343565b6040516020016108e9939291906124f0565b60208260ff811115610a8657610a86611f76565b148015610a9557506005835110155b15610b1257610abd83600481518110610ab057610ab0612343565b6020026020010151611956565b610ad3846003815181106108cc576108cc612343565b610ae9856002815181106108cc576108cc612343565b610aff86600181518110610a3d57610a3d612343565b6040516020016108e994939291906125a0565b60308260ff811115610b2657610b26611f76565b148015610b3557506003835110155b15610bf257610b50836001815181106108cc576108cc612343565b610b7f606485600281518110610b6857610b68612343565b6020026020010151610b7a919061269a565b611762565b610bb5600a606487600281518110610b9957610b99612343565b6020026020010151610bab91906126c0565b610b7a919061269a565b610bdf600a87600281518110610bcd57610bcd612343565b6020026020010151610b7a91906126c0565b6040516020016108e994939291906126e6565b60318260ff811115610c0657610c06611f76565b148015610c1557506002835110155b15610c4057610c30836001815181106108cc576108cc612343565b6040516020016108e9919061279f565b60408260ff811115610c5457610c54611f76565b148015610c6357506005835110155b15610cd357610c7e83600481518110610ab057610ab0612343565b610c94846003815181106108cc576108cc612343565b610caa856002815181106108cc576108cc612343565b610cc086600181518110610a3d57610a3d612343565b6040516020016108e9949392919061280b565b60418260ff811115610ce757610ce7611f76565b148015610cf657506005835110155b15610d6657610d1183600481518110610ab057610ab0612343565b610d27846003815181106108cc576108cc612343565b610d3d856002815181106108cc576108cc612343565b610d5386600181518110610a3d57610a3d612343565b6040516020016108e994939291906128e8565b60428260ff811115610d7a57610d7a611f76565b148015610d8957506005835110155b15610df957610da483600481518110610ab057610ab0612343565b610dba846003815181106108cc576108cc612343565b610dd0856002815181106108cc576108cc612343565b610de686600181518110610a3d57610a3d612343565b6040516020016108e994939291906129c5565b60e08260ff811115610e0d57610e0d611f76565b1415610e33576040518060600160405280603f8152602001612d95603f91399050610edf565b60e18260ff811115610e4757610e47611f76565b1415610e6d57604051806080016040528060478152602001612e15604791399050610edf565b60e28260ff811115610e8157610e81611f76565b1415610ea757604051806080016040528060418152602001612dd4604191399050610edf565b610ebd83600081518110610ab057610ab0612343565b604051602001610ecd9190612aaf565b60405160208183030381529060405290505b909590945092505050565b8051606090610f6f5760405162461bcd60e51b815260206004820152604560248201527f5769746e65745061727365724c69623a20547269656420746f2072656164206260448201527f797465732076616c75652066726f6d206572726f726564205769746e65742e52606482015264195cdd5b1d60da1b608482015260a4016103ea565b602082015160405163bb6ef6cf60e01b815273400dbf3645b345823124aab22d04013a46d9ced59163bb6ef6cf91610faa91906004016120b9565b600060405180830381865af4158015610fc7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104739190810190612af3565b80516000906110765760405162461bcd60e51b815260206004820152604760248201527f5769746e65745061727365724c69623a20747269656420746f2072656164206260448201527f7974657333322076616c75652066726f6d206572726f726564205769746e65746064820152660b94995cdd5b1d60ca1b608482015260a4016103ea565b60208201516040516308c05c3360e01b815273400dbf3645b345823124aab22d04013a46d9ced5916308c05c33916110b191906004016120b9565b602060405180830381865af41580156110ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612b27565b80516000906111665760405162461bcd60e51b81526020600482015260466024820152600080516020612d7583398151915260448201527f626f6f6c602076616c75652066726f6d206572726f726564205769746e65742e60648201526514995cdd5b1d60d21b608482015260a4016103ea565b6020820151604051634f77306560e11b815273400dbf3645b345823124aab22d04013a46d9ced591639eee60ca916111a191906004016120b9565b602060405180830381865af41580156111be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612b40565b80516000906112585760405162461bcd60e51b81526020600482015260486024820152600080516020612d7583398151915260448201527f696e74313238602076616c75652066726f6d206572726f726564205769746e656064820152671d0b94995cdd5b1d60c21b608482015260a4016103ea565b60208201516040516325218fa960e21b815273400dbf3645b345823124aab22d04013a46d9ced5916394863ea49161129391906004016120b9565b602060405180830381865af41580156112b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612b6f565b60606001600160401b0382166113095750506040805180820190915260098152681c995d1c9a595d985b60ba1b602082015290565b816001600160401b03166001141561134257505060408051808201909152600b81526a30b3b3b932b3b0ba34b7b760a91b602082015290565b816001600160401b03166002141561137557505060408051808201909152600581526474616c6c7960d81b602082015290565b50506040805180820190915260078152663ab735b737bbb760c91b602082015290565b919050565b6000806113a983610366565b90508051600014156113be5750600092915050565b6113d48160008151811061087d5761087d612343565b9392505050565b80516000906114525760405162461bcd60e51b81526020600482015260496024820152600080516020612d7583398151915260448201527f66697865643136602076616c75652066726f6d206572726f726564205769746e606482015268195d0b94995cdd5b1d60ba1b608482015260a4016103ea565b602082015160405163409c3ccd60e11b815273400dbf3645b345823124aab22d04013a46d9ced591638138799a9161148d91906004016120b9565b602060405180830381865af41580156114aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612b8a565b6114d6611a48565b600083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040516337f2974d60e21b815273400dbf3645b345823124aab22d04013a46d9ced59363dfca5d349350611544925090600401611fcf565b600060405180830381865af4158015611561573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526115899190810190612bb0565b905061159481610572565b949350505050565b80516060906116125760405162461bcd60e51b81526020600482015260486024820152600080516020612d7583398151915260448201527f737472696e67602076616c75652066726f6d206572726f726564205769746e656064820152671d0b94995cdd5b1d60c21b608482015260a4016103ea565b602082015160405163e67c5bd160e01b815273400dbf3645b345823124aab22d04013a46d9ced59163e67c5bd191610faa91906004016120b9565b80516060906116c55760405162461bcd60e51b815260206004820152604a6024820152600080516020612d7583398151915260448201527f696e743132385b5d602076616c75652066726f6d206572726f726564205769746064820152691b995d0b94995cdd5b1d60b21b608482015260a4016103ea565b60208201516040516319c06c0b60e11b815273400dbf3645b345823124aab22d04013a46d9ced591633380d8169161170091906004016120b9565b600060405180830381865af415801561171d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104739190810190612cb5565b6000816001600160401b031660ff81111561047357610473611f76565b6060600a826001600160401b031610156117d5576040805160018082528183019092526000916020820181803683370190505090506117a2836030612d41565b60f81b816000815181106117b8576117b8612343565b60200101906001600160f81b031916908160001a90535092915050565b6064826001600160401b0316101561187757604080516002808252818301909252600091602082018180368337019050509050611813600a8461269a565b61181e906030612d41565b60f81b8160008151811061183457611834612343565b60200101906001600160f81b031916908160001a905350611856600a846126c0565b611861906030612d41565b60f81b816001815181106117b8576117b8612343565b6040805160038082528183019092526000916020820181803683370190505090506118a360648461269a565b6118ae906030612d41565b60f81b816000815181106118c4576118c4612343565b60200101906001600160f81b031916908160001a905350600a6118e86064856126c0565b6118f2919061269a565b6118fd906030612d41565b60f81b8160018151811061191357611913612343565b60200101906001600160f81b031916908160001a905350611935600a846126c0565b611940906030612d41565b60f81b816002815181106117b8576117b8612343565b60408051600280825281830190925260609160009190602082018180368337019050509050600061198860108561269a565b611993906030612d41565b905060006119a26010866126c0565b6119ad906030612d41565b905060398260ff1611156119c9576119c6600783612d41565b91505b60398160ff1611156119e3576119e0600782612d41565b90505b8160f81b836000815181106119fa576119fa612343565b60200101906001600160f81b031916908160001a9053508060f81b83600181518110611a2857611a28612343565b60200101906001600160f81b031916908160001a90535091949350505050565b6040805180820182526000808252825161010081018452606060c0820181815260e083018490528252602082810184905294820183905281018290526080810182905260a0810191909152909182015290565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b0381118282101715611ad357611ad3611a9b565b60405290565b604080519081016001600160401b0381118282101715611ad357611ad3611a9b565b604051601f8201601f191681016001600160401b0381118282101715611b2357611b23611a9b565b604052919050565b8015158114611b3957600080fd5b50565b60006001600160401b03821115611b5557611b55611a9b565b50601f01601f191660200190565b63ffffffff81168114611b3957600080fd5b60ff81168114611b3957600080fd5b803561139881611b75565b6001600160401b0381168114611b3957600080fd5b803561139881611b8f565b600060c08284031215611bc157600080fd5b611bc9611ab1565b905081356001600160401b0380821115611be257600080fd5b9083019060408286031215611bf657600080fd5b611bfe611ad9565b823582811115611c0d57600080fd5b83019150601f82018613611c2057600080fd5b81356020611c35611c3083611b3c565b611afb565b8281528882848701011115611c4957600080fd5b8282860183830137600081840183015283529384013593611c6985611b63565b8481840152828652611c7c818801611b84565b818701525050505050611c9160408301611b84565b6040820152611ca260608301611b84565b6060820152611cb360808301611ba4565b6080820152611cc460a08301611ba4565b60a082015292915050565b600060208284031215611ce157600080fd5b81356001600160401b0380821115611cf857600080fd5b9083019060408286031215611d0c57600080fd5b611d14611ad9565b8235611d1f81611b2b565b8152602083013582811115611d3357600080fd5b611d3f87828601611baf565b60208301525095945050505050565b6020808252825182820181905260009190848201906040850190845b81811015611d8f5783516001600160401b031683529284019291840191600101611d6a565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611d8f57835160030b83529284019291840191600101611db7565b600060208284031215611de857600080fd5b81356001600160401b03811115611dfe57600080fd5b61159484828501611baf565b60005b83811015611e25578181015183820152602001611e0d565b83811115611e34576000848401525b50505050565b60008151808452611e52816020860160208601611e0a565b601f01601f19169290920160200192915050565b6000815160c084528051604060c0860152611e85610100860182611e3a565b905063ffffffff60208301511660e086015260ff602085015116602086015260ff604085015116604086015260ff60608501511660608601526001600160401b03608085015116608086015260a0840151915061159460a08601836001600160401b03169052565b60208152815115156020820152600060208301516040808401526115946060840182611e66565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611f6957603f19888603018452611f57858351611e3a565b94509285019290850190600101611f3b565b5092979650505050505050565b634e487b7160e01b600052602160045260246000fd5b6101008110611fab57634e487b7160e01b600052602160045260246000fd5b9052565b611fb98184611f8c565b6040602082015260006115946040830184611e3a565b6020815260006113d46020830184611e3a565b600060208284031215611ff457600080fd5b81356113d481611b8f565b602081016104738284611f8c565b6000806020838503121561202057600080fd5b82356001600160401b038082111561203757600080fd5b818501915085601f83011261204b57600080fd5b81358181111561205a57600080fd5b86602082850101111561206c57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611d8f578351600f0b8352928401929184019160010161209a565b6020815260006113d46020830184611e66565b60006001600160401b038211156120e5576120e5611a9b565b5060051b60200190565b805161139881611b8f565b6000602080838503121561210d57600080fd5b82516001600160401b0381111561212357600080fd5b8301601f8101851361213457600080fd5b8051612142611c30826120cc565b81815260059190911b8201830190838101908783111561216157600080fd5b928401925b8284101561218857835161217981611b8f565b82529284019290840190612166565b979650505050505050565b8051600381900b811461139857600080fd5b600060208083850312156121b857600080fd5b82516001600160401b038111156121ce57600080fd5b8301601f810185136121df57600080fd5b80516121ed611c30826120cc565b81815260059190911b8201830190838101908783111561220c57600080fd5b928401925b828410156121885761222284612193565b82529284019290840190612211565b600082601f83011261224257600080fd5b8151612250611c3082611b3c565b81815284602083860101111561226557600080fd5b611594826020830160208701611e0a565b6000602080838503121561228957600080fd5b82516001600160401b03808211156122a057600080fd5b818501915085601f8301126122b457600080fd5b81516122c2611c30826120cc565b81815260059190911b830184019084810190888311156122e157600080fd5b8585015b83811015612319578051858111156122fd5760008081fd5b61230b8b89838a0101612231565b8452509186019186016122e5565b5098975050505050505050565b60006020828403121561233857600080fd5b81516113d481611b8f565b634e487b7160e01b600052603260045260246000fd5b6e536f7572636520736372697074202360881b81526000825161238381600f850160208701611e0a565b7f20776173206e6f7420612076616c69642043424f522076616c75650000000000600f939091019283015250602a01919050565b7f5468652043424f522076616c756520696e2073637269707420230000000000008152600082516123ef81601a850160208701611e0a565b7f20776173206e6f7420616e204172726179206f662063616c6c73000000000000601a939091019283015250603401919050565b7f5468652043424f522076616c756520696e20736372697074202300000000000081526000825161245b81601a850160208701611e0a565b7f20776173206e6f7420612076616c696420446174612052657175657374000000601a939091019283015250603701919050565b7f546865207265717565737420636f6e7461696e656420746f6f206d616e7920738152670deeae4c6cae640560c31b6020820152600082516124d8816028850160208701611e0a565b602960f81b6028939091019283015250602901919050565b67536372697074202360c01b815260008451612513816008850160208901611e0a565b69010333937b6903a3432960b51b600891840191820152845161253d816012840160208901611e0a565b7f20737461676520636f6e7461696e656420746f6f206d616e792063616c6c732060129290910191820152600560fb1b60328201528351612585816033840160208801611e0a565b602960f81b6033929091019182015260340195945050505050565b6f09ee0cae4c2e8dee440c6dec8ca4060f60831b81526000855160206125cc8260108601838b01611e0a565b6f20666f756e642061742063616c6c202360801b60109285019283015286516125fa81838501848b01611e0a565b6b20696e20736372697074202360a01b920181810192909252855161262581602c8501898501611e0a565b65010333937b6960d51b602c9390910192830152845161264b8160328501848901611e0a565b7f207374616765206973206e6f7420737570706f7274656400000000000000000060329390910192830152506049019695505050505050565b634e487b7160e01b600052601260045260246000fd5b60006001600160401b03808416806126b4576126b4612684565b92169190910492915050565b60006001600160401b03808416806126da576126da612684565b92169190910692915050565b67536f75726365202360c01b815260008551612709816008850160208a01611e0a565b7f20636f756c64206e6f74206265207265747269657665642e204661696c6564206008918401918201527503bb4ba3410242a2a281032b93937b91031b7b2329d160551b6028820152855161276581603e840160208a01611e0a565b855191019061277b81603e840160208901611e0a565b845191019061279181603e840160208801611e0a565b01603e019695505050505050565b67536f75726365202360c01b8152600082516127c2816008850160208701611e0a565b7f20636f756c64206e6f742062652072657472696576656420626563617573652060089390910192830152506b1bd98818481d1a5b595bdd5d60a21b6028820152603401919050565b7f556e646572666c6f77206174206f70657261746f7220636f646520307800000081526000855161284381601d850160208a01611e0a565b6f20666f756e642061742063616c6c202360801b601d91840191820152855161287381602d840160208a01611e0a565b6b20696e20736372697074202360a01b602d929091019182015284516128a0816039840160208901611e0a565b65010333937b6960d51b6039929091019182015283516128c781603f840160208801611e0a565b6520737461676560d01b603f92909101918201526045019695505050505050565b7f4f766572666c6f77206174206f70657261746f7220636f64652030780000000081526000855161292081601c850160208a01611e0a565b6f20666f756e642061742063616c6c202360801b601c91840191820152855161295081602c840160208a01611e0a565b6b20696e20736372697074202360a01b602c9290910191820152845161297d816038840160208901611e0a565b65010333937b6960d51b6038929091019182015283516129a481603e840160208801611e0a565b6520737461676560d01b603e92909101918201526044019695505050505050565b7f4469766973696f6e206279207a65726f206174206f70657261746f7220636f648152630ca4060f60e31b602082015260008551612a0a816024850160208a01611e0a565b6f20666f756e642061742063616c6c202360801b6024918401918201528551612a3a816034840160208a01611e0a565b6b20696e20736372697074202360a01b603492909101918201528451612a67816040840160208901611e0a565b65010333937b6960d51b604092909101918201528351612a8e816046840160208801611e0a565b6520737461676560d01b60469290910191820152604c019695505050505050565b700aadcd6dcdeeedc40cae4e4dee4405060f607b1b815260008251612adb816011850160208701611e0a565b602960f81b6011939091019283015250601201919050565b600060208284031215612b0557600080fd5b81516001600160401b03811115612b1b57600080fd5b61159484828501612231565b600060208284031215612b3957600080fd5b5051919050565b600060208284031215612b5257600080fd5b81516113d481611b2b565b8051600f81900b811461139857600080fd5b600060208284031215612b8157600080fd5b6113d482612b5d565b600060208284031215612b9c57600080fd5b6113d482612193565b805161139881611b75565b600060208284031215612bc257600080fd5b81516001600160401b0380821115612bd957600080fd5b9083019060c08286031215612bed57600080fd5b612bf5611ab1565b825182811115612c0457600080fd5b830160408188031215612c1657600080fd5b612c1e611ad9565b815184811115612c2d57600080fd5b612c3989828501612231565b82525060208201519350612c4c84611b63565b8360208201528083525050612c6360208401612ba5565b6020820152612c7460408401612ba5565b6040820152612c8560608401612ba5565b6060820152612c96608084016120ef565b6080820152612ca760a084016120ef565b60a082015295945050505050565b60006020808385031215612cc857600080fd5b82516001600160401b03811115612cde57600080fd5b8301601f81018513612cef57600080fd5b8051612cfd611c30826120cc565b81815260059190911b82018301908381019087831115612d1c57600080fd5b928401925b8284101561218857612d3284612b5d565b82529284019290840190612d21565b600060ff821660ff84168060ff03821115612d6c57634e487b7160e01b600052601160045260246000fd5b01939250505056fe5769746e65745061727365724c69623a20547269656420746f2072656164206054686520737472756374757265206f6620746865207265717565737420697320696e76616c696420616e642069742063616e6e6f7420626520706172736564546865207265717565737420726573756c74206c656e677468206578636565647320612062726964676520636f6e747261637420646566696e6564206c696d6974546865207265717565737420686173206265656e2072656a65637465642062792074686520627269646765206e6f64652064756520746f20706f6f7220696e63656e7469766573a2646970667358221220215b7682efe58239f9bd570de4c8fb62483b077dee81f6f75a7e7e1ba144721164736f6c634300080b0033

Deployed ByteCode

0x731d9c4a8f8b7b5f9b8e2641d81927f8f8cc7ff079301460806040526004361061012b5760003560e01c8063a1d45d56116100b7578063d45d097d1161007b578063d45d097d146102da578063d8868db6146102fa578063e99e47f314610320578063f417daf514610333578063fc853c371461034657600080fd5b8063a1d45d561461025a578063a2e876551461026d578063abf82f4c1461028e578063c71db521146102a1578063cb5371c0146102c757600080fd5b80632d26b9e2116100fe5780632d26b9e2146101ac5780636646c119146101cc5780638233f9b3146101ee5780638cc5eb5414610219578063a1b908911461023a57600080fd5b80630879730d1461013057806308efc09714610159578063130283ee14610179578063147e5c8f14610199575b600080fd5b61014361013e366004611ccf565b610366565b6040516101509190611d4e565b60405180910390f35b61016c610167366004611ccf565b610479565b6040516101509190611d9b565b61018c610187366004611dd6565b610572565b6040516101509190611eed565b6101436101a7366004611ccf565b6105a6565b6101bf6101ba366004611ccf565b61061e565b6040516101509190611f14565b6101de6101da366004611ccf565b5190565b6040519015158152602001610150565b6102016101fc366004611ccf565b610716565b6040516001600160401b039091168152602001610150565b61022c610227366004611ccf565b610808565b604051610150929190611faf565b61024d610248366004611ccf565b610eea565b6040516101509190611fcf565b6101de610268366004611ccf565b511590565b61028061027b366004611ccf565b610fef565b604051908152602001610150565b6101de61029c366004611ccf565b6110f2565b6102b46102af366004611ccf565b6111e2565b604051600f9190910b8152602001610150565b61024d6102d5366004611fe2565b6112d4565b6102ed6102e8366004611ccf565b61139d565b6040516101509190611fff565b61030d610308366004611ccf565b6113db565b60405160039190910b8152602001610150565b61018c61032e36600461200d565b6114ce565b61024d610341366004611ccf565b61159c565b610359610354366004611ccf565b61164d565b604051610150919061207e565b8051606090156103f35760405162461bcd60e51b815260206004820152604760248201527f5769746e65745061727365724c69623a20547269656420746f2072656164206560448201527f72726f7220636f64652066726f6d207375636365737366756c205769746e65746064820152660b94995cdd5b1d60ca1b608482015260a4015b60405180910390fd5b602082015160405163f8a597d360e01b815273400dbf3645b345823124aab22d04013a46d9ced59163f8a597d39161042e91906004016120b9565b600060405180830381865af415801561044b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261047391908101906120fa565b92915050565b80516060906104f25760405162461bcd60e51b815260206004820152604b6024820152600080516020612d7583398151915260448201527f666978656431365b5d602076616c75652066726f6d206572726f72656420576960648201526a1d1b995d0b94995cdd5b1d60aa1b608482015260a4016103ea565b602082015160405163531f4ba760e01b815273400dbf3645b345823124aab22d04013a46d9ced59163531f4ba79161052d91906004016120b9565b600060405180830381865af415801561054a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261047391908101906121a5565b61057a611a48565b5060a0810151604080518082019091526001600160401b03909116602714158152602081019190915290565b80516060906103f35760405162461bcd60e51b815260206004820152604a6024820152600080516020612d7583398151915260448201527f75696e7436345b5d602076616c75652066726f6d206572726f726564205769746064820152691b995d0b94995cdd5b1d60b21b608482015260a4016103ea565b80516060906106965760405162461bcd60e51b815260206004820152604a6024820152600080516020612d7583398151915260448201527f737472696e675b5d602076616c75652066726f6d206572726f726564205769746064820152691b995d0b94995cdd5b1d60b21b608482015260a4016103ea565b60208201516040516362f447f960e11b815273400dbf3645b345823124aab22d04013a46d9ced59163c5e88ff2916106d191906004016120b9565b600060405180830381865af41580156106ee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104739190810190612276565b805160009061078c5760405162461bcd60e51b81526020600482015260486024820152600080516020612d7583398151915260448201527f75696e743634602076616c75652066726f6d206572726f726564205769746e656064820152671d0b94995cdd5b1d60c21b608482015260a4016103ea565b6020820151604051637a8acab160e01b815273400dbf3645b345823124aab22d04013a46d9ced591637a8acab1916107c791906004016120b9565b602060405180830381865af41580156107e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612326565b60006060600061081784610366565b90508051600014156108655760006040518060400160405280601d81526020017f556e6b6e6f776e206572726f7220286e6f206572726f7220636f6465290000008152509250925050915091565b600061088a8260008151811061087d5761087d612343565b6020026020010151611745565b9050606060018260ff8111156108a2576108a2611f76565b1480156108b157506002835110155b156108ff576108d9836001815181106108cc576108cc612343565b6020026020010151611762565b6040516020016108e99190612359565b6040516020818303038152906040529050610edf565b60028260ff81111561091357610913611f76565b14801561092257506002835110155b1561094d5761093d836001815181106108cc576108cc612343565b6040516020016108e991906123b7565b60038260ff81111561096157610961611f76565b14801561097057506002835110155b1561099b5761098b836001815181106108cc576108cc612343565b6040516020016108e99190612423565b60108260ff8111156109af576109af611f76565b1480156109be57506002835110155b156109e9576109d9836001815181106108cc576108cc612343565b6040516020016108e9919061248f565b60118260ff8111156109fd576109fd611f76565b148015610a0c57506004835110155b15610a7257610a27836002815181106108cc576108cc612343565b610a4a84600181518110610a3d57610a3d612343565b60200260200101516112d4565b610a60856003815181106108cc576108cc612343565b6040516020016108e9939291906124f0565b60208260ff811115610a8657610a86611f76565b148015610a9557506005835110155b15610b1257610abd83600481518110610ab057610ab0612343565b6020026020010151611956565b610ad3846003815181106108cc576108cc612343565b610ae9856002815181106108cc576108cc612343565b610aff86600181518110610a3d57610a3d612343565b6040516020016108e994939291906125a0565b60308260ff811115610b2657610b26611f76565b148015610b3557506003835110155b15610bf257610b50836001815181106108cc576108cc612343565b610b7f606485600281518110610b6857610b68612343565b6020026020010151610b7a919061269a565b611762565b610bb5600a606487600281518110610b9957610b99612343565b6020026020010151610bab91906126c0565b610b7a919061269a565b610bdf600a87600281518110610bcd57610bcd612343565b6020026020010151610b7a91906126c0565b6040516020016108e994939291906126e6565b60318260ff811115610c0657610c06611f76565b148015610c1557506002835110155b15610c4057610c30836001815181106108cc576108cc612343565b6040516020016108e9919061279f565b60408260ff811115610c5457610c54611f76565b148015610c6357506005835110155b15610cd357610c7e83600481518110610ab057610ab0612343565b610c94846003815181106108cc576108cc612343565b610caa856002815181106108cc576108cc612343565b610cc086600181518110610a3d57610a3d612343565b6040516020016108e9949392919061280b565b60418260ff811115610ce757610ce7611f76565b148015610cf657506005835110155b15610d6657610d1183600481518110610ab057610ab0612343565b610d27846003815181106108cc576108cc612343565b610d3d856002815181106108cc576108cc612343565b610d5386600181518110610a3d57610a3d612343565b6040516020016108e994939291906128e8565b60428260ff811115610d7a57610d7a611f76565b148015610d8957506005835110155b15610df957610da483600481518110610ab057610ab0612343565b610dba846003815181106108cc576108cc612343565b610dd0856002815181106108cc576108cc612343565b610de686600181518110610a3d57610a3d612343565b6040516020016108e994939291906129c5565b60e08260ff811115610e0d57610e0d611f76565b1415610e33576040518060600160405280603f8152602001612d95603f91399050610edf565b60e18260ff811115610e4757610e47611f76565b1415610e6d57604051806080016040528060478152602001612e15604791399050610edf565b60e28260ff811115610e8157610e81611f76565b1415610ea757604051806080016040528060418152602001612dd4604191399050610edf565b610ebd83600081518110610ab057610ab0612343565b604051602001610ecd9190612aaf565b60405160208183030381529060405290505b909590945092505050565b8051606090610f6f5760405162461bcd60e51b815260206004820152604560248201527f5769746e65745061727365724c69623a20547269656420746f2072656164206260448201527f797465732076616c75652066726f6d206572726f726564205769746e65742e52606482015264195cdd5b1d60da1b608482015260a4016103ea565b602082015160405163bb6ef6cf60e01b815273400dbf3645b345823124aab22d04013a46d9ced59163bb6ef6cf91610faa91906004016120b9565b600060405180830381865af4158015610fc7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104739190810190612af3565b80516000906110765760405162461bcd60e51b815260206004820152604760248201527f5769746e65745061727365724c69623a20747269656420746f2072656164206260448201527f7974657333322076616c75652066726f6d206572726f726564205769746e65746064820152660b94995cdd5b1d60ca1b608482015260a4016103ea565b60208201516040516308c05c3360e01b815273400dbf3645b345823124aab22d04013a46d9ced5916308c05c33916110b191906004016120b9565b602060405180830381865af41580156110ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612b27565b80516000906111665760405162461bcd60e51b81526020600482015260466024820152600080516020612d7583398151915260448201527f626f6f6c602076616c75652066726f6d206572726f726564205769746e65742e60648201526514995cdd5b1d60d21b608482015260a4016103ea565b6020820151604051634f77306560e11b815273400dbf3645b345823124aab22d04013a46d9ced591639eee60ca916111a191906004016120b9565b602060405180830381865af41580156111be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612b40565b80516000906112585760405162461bcd60e51b81526020600482015260486024820152600080516020612d7583398151915260448201527f696e74313238602076616c75652066726f6d206572726f726564205769746e656064820152671d0b94995cdd5b1d60c21b608482015260a4016103ea565b60208201516040516325218fa960e21b815273400dbf3645b345823124aab22d04013a46d9ced5916394863ea49161129391906004016120b9565b602060405180830381865af41580156112b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612b6f565b60606001600160401b0382166113095750506040805180820190915260098152681c995d1c9a595d985b60ba1b602082015290565b816001600160401b03166001141561134257505060408051808201909152600b81526a30b3b3b932b3b0ba34b7b760a91b602082015290565b816001600160401b03166002141561137557505060408051808201909152600581526474616c6c7960d81b602082015290565b50506040805180820190915260078152663ab735b737bbb760c91b602082015290565b919050565b6000806113a983610366565b90508051600014156113be5750600092915050565b6113d48160008151811061087d5761087d612343565b9392505050565b80516000906114525760405162461bcd60e51b81526020600482015260496024820152600080516020612d7583398151915260448201527f66697865643136602076616c75652066726f6d206572726f726564205769746e606482015268195d0b94995cdd5b1d60ba1b608482015260a4016103ea565b602082015160405163409c3ccd60e11b815273400dbf3645b345823124aab22d04013a46d9ced591638138799a9161148d91906004016120b9565b602060405180830381865af41580156114aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190612b8a565b6114d6611a48565b600083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040516337f2974d60e21b815273400dbf3645b345823124aab22d04013a46d9ced59363dfca5d349350611544925090600401611fcf565b600060405180830381865af4158015611561573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526115899190810190612bb0565b905061159481610572565b949350505050565b80516060906116125760405162461bcd60e51b81526020600482015260486024820152600080516020612d7583398151915260448201527f737472696e67602076616c75652066726f6d206572726f726564205769746e656064820152671d0b94995cdd5b1d60c21b608482015260a4016103ea565b602082015160405163e67c5bd160e01b815273400dbf3645b345823124aab22d04013a46d9ced59163e67c5bd191610faa91906004016120b9565b80516060906116c55760405162461bcd60e51b815260206004820152604a6024820152600080516020612d7583398151915260448201527f696e743132385b5d602076616c75652066726f6d206572726f726564205769746064820152691b995d0b94995cdd5b1d60b21b608482015260a4016103ea565b60208201516040516319c06c0b60e11b815273400dbf3645b345823124aab22d04013a46d9ced591633380d8169161170091906004016120b9565b600060405180830381865af415801561171d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104739190810190612cb5565b6000816001600160401b031660ff81111561047357610473611f76565b6060600a826001600160401b031610156117d5576040805160018082528183019092526000916020820181803683370190505090506117a2836030612d41565b60f81b816000815181106117b8576117b8612343565b60200101906001600160f81b031916908160001a90535092915050565b6064826001600160401b0316101561187757604080516002808252818301909252600091602082018180368337019050509050611813600a8461269a565b61181e906030612d41565b60f81b8160008151811061183457611834612343565b60200101906001600160f81b031916908160001a905350611856600a846126c0565b611861906030612d41565b60f81b816001815181106117b8576117b8612343565b6040805160038082528183019092526000916020820181803683370190505090506118a360648461269a565b6118ae906030612d41565b60f81b816000815181106118c4576118c4612343565b60200101906001600160f81b031916908160001a905350600a6118e86064856126c0565b6118f2919061269a565b6118fd906030612d41565b60f81b8160018151811061191357611913612343565b60200101906001600160f81b031916908160001a905350611935600a846126c0565b611940906030612d41565b60f81b816002815181106117b8576117b8612343565b60408051600280825281830190925260609160009190602082018180368337019050509050600061198860108561269a565b611993906030612d41565b905060006119a26010866126c0565b6119ad906030612d41565b905060398260ff1611156119c9576119c6600783612d41565b91505b60398160ff1611156119e3576119e0600782612d41565b90505b8160f81b836000815181106119fa576119fa612343565b60200101906001600160f81b031916908160001a9053508060f81b83600181518110611a2857611a28612343565b60200101906001600160f81b031916908160001a90535091949350505050565b6040805180820182526000808252825161010081018452606060c0820181815260e083018490528252602082810184905294820183905281018290526080810182905260a0810191909152909182015290565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b0381118282101715611ad357611ad3611a9b565b60405290565b604080519081016001600160401b0381118282101715611ad357611ad3611a9b565b604051601f8201601f191681016001600160401b0381118282101715611b2357611b23611a9b565b604052919050565b8015158114611b3957600080fd5b50565b60006001600160401b03821115611b5557611b55611a9b565b50601f01601f191660200190565b63ffffffff81168114611b3957600080fd5b60ff81168114611b3957600080fd5b803561139881611b75565b6001600160401b0381168114611b3957600080fd5b803561139881611b8f565b600060c08284031215611bc157600080fd5b611bc9611ab1565b905081356001600160401b0380821115611be257600080fd5b9083019060408286031215611bf657600080fd5b611bfe611ad9565b823582811115611c0d57600080fd5b83019150601f82018613611c2057600080fd5b81356020611c35611c3083611b3c565b611afb565b8281528882848701011115611c4957600080fd5b8282860183830137600081840183015283529384013593611c6985611b63565b8481840152828652611c7c818801611b84565b818701525050505050611c9160408301611b84565b6040820152611ca260608301611b84565b6060820152611cb360808301611ba4565b6080820152611cc460a08301611ba4565b60a082015292915050565b600060208284031215611ce157600080fd5b81356001600160401b0380821115611cf857600080fd5b9083019060408286031215611d0c57600080fd5b611d14611ad9565b8235611d1f81611b2b565b8152602083013582811115611d3357600080fd5b611d3f87828601611baf565b60208301525095945050505050565b6020808252825182820181905260009190848201906040850190845b81811015611d8f5783516001600160401b031683529284019291840191600101611d6a565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611d8f57835160030b83529284019291840191600101611db7565b600060208284031215611de857600080fd5b81356001600160401b03811115611dfe57600080fd5b61159484828501611baf565b60005b83811015611e25578181015183820152602001611e0d565b83811115611e34576000848401525b50505050565b60008151808452611e52816020860160208601611e0a565b601f01601f19169290920160200192915050565b6000815160c084528051604060c0860152611e85610100860182611e3a565b905063ffffffff60208301511660e086015260ff602085015116602086015260ff604085015116604086015260ff60608501511660608601526001600160401b03608085015116608086015260a0840151915061159460a08601836001600160401b03169052565b60208152815115156020820152600060208301516040808401526115946060840182611e66565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611f6957603f19888603018452611f57858351611e3a565b94509285019290850190600101611f3b565b5092979650505050505050565b634e487b7160e01b600052602160045260246000fd5b6101008110611fab57634e487b7160e01b600052602160045260246000fd5b9052565b611fb98184611f8c565b6040602082015260006115946040830184611e3a565b6020815260006113d46020830184611e3a565b600060208284031215611ff457600080fd5b81356113d481611b8f565b602081016104738284611f8c565b6000806020838503121561202057600080fd5b82356001600160401b038082111561203757600080fd5b818501915085601f83011261204b57600080fd5b81358181111561205a57600080fd5b86602082850101111561206c57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611d8f578351600f0b8352928401929184019160010161209a565b6020815260006113d46020830184611e66565b60006001600160401b038211156120e5576120e5611a9b565b5060051b60200190565b805161139881611b8f565b6000602080838503121561210d57600080fd5b82516001600160401b0381111561212357600080fd5b8301601f8101851361213457600080fd5b8051612142611c30826120cc565b81815260059190911b8201830190838101908783111561216157600080fd5b928401925b8284101561218857835161217981611b8f565b82529284019290840190612166565b979650505050505050565b8051600381900b811461139857600080fd5b600060208083850312156121b857600080fd5b82516001600160401b038111156121ce57600080fd5b8301601f810185136121df57600080fd5b80516121ed611c30826120cc565b81815260059190911b8201830190838101908783111561220c57600080fd5b928401925b828410156121885761222284612193565b82529284019290840190612211565b600082601f83011261224257600080fd5b8151612250611c3082611b3c565b81815284602083860101111561226557600080fd5b611594826020830160208701611e0a565b6000602080838503121561228957600080fd5b82516001600160401b03808211156122a057600080fd5b818501915085601f8301126122b457600080fd5b81516122c2611c30826120cc565b81815260059190911b830184019084810190888311156122e157600080fd5b8585015b83811015612319578051858111156122fd5760008081fd5b61230b8b89838a0101612231565b8452509186019186016122e5565b5098975050505050505050565b60006020828403121561233857600080fd5b81516113d481611b8f565b634e487b7160e01b600052603260045260246000fd5b6e536f7572636520736372697074202360881b81526000825161238381600f850160208701611e0a565b7f20776173206e6f7420612076616c69642043424f522076616c75650000000000600f939091019283015250602a01919050565b7f5468652043424f522076616c756520696e2073637269707420230000000000008152600082516123ef81601a850160208701611e0a565b7f20776173206e6f7420616e204172726179206f662063616c6c73000000000000601a939091019283015250603401919050565b7f5468652043424f522076616c756520696e20736372697074202300000000000081526000825161245b81601a850160208701611e0a565b7f20776173206e6f7420612076616c696420446174612052657175657374000000601a939091019283015250603701919050565b7f546865207265717565737420636f6e7461696e656420746f6f206d616e7920738152670deeae4c6cae640560c31b6020820152600082516124d8816028850160208701611e0a565b602960f81b6028939091019283015250602901919050565b67536372697074202360c01b815260008451612513816008850160208901611e0a565b69010333937b6903a3432960b51b600891840191820152845161253d816012840160208901611e0a565b7f20737461676520636f6e7461696e656420746f6f206d616e792063616c6c732060129290910191820152600560fb1b60328201528351612585816033840160208801611e0a565b602960f81b6033929091019182015260340195945050505050565b6f09ee0cae4c2e8dee440c6dec8ca4060f60831b81526000855160206125cc8260108601838b01611e0a565b6f20666f756e642061742063616c6c202360801b60109285019283015286516125fa81838501848b01611e0a565b6b20696e20736372697074202360a01b920181810192909252855161262581602c8501898501611e0a565b65010333937b6960d51b602c9390910192830152845161264b8160328501848901611e0a565b7f207374616765206973206e6f7420737570706f7274656400000000000000000060329390910192830152506049019695505050505050565b634e487b7160e01b600052601260045260246000fd5b60006001600160401b03808416806126b4576126b4612684565b92169190910492915050565b60006001600160401b03808416806126da576126da612684565b92169190910692915050565b67536f75726365202360c01b815260008551612709816008850160208a01611e0a565b7f20636f756c64206e6f74206265207265747269657665642e204661696c6564206008918401918201527503bb4ba3410242a2a281032b93937b91031b7b2329d160551b6028820152855161276581603e840160208a01611e0a565b855191019061277b81603e840160208901611e0a565b845191019061279181603e840160208801611e0a565b01603e019695505050505050565b67536f75726365202360c01b8152600082516127c2816008850160208701611e0a565b7f20636f756c64206e6f742062652072657472696576656420626563617573652060089390910192830152506b1bd98818481d1a5b595bdd5d60a21b6028820152603401919050565b7f556e646572666c6f77206174206f70657261746f7220636f646520307800000081526000855161284381601d850160208a01611e0a565b6f20666f756e642061742063616c6c202360801b601d91840191820152855161287381602d840160208a01611e0a565b6b20696e20736372697074202360a01b602d929091019182015284516128a0816039840160208901611e0a565b65010333937b6960d51b6039929091019182015283516128c781603f840160208801611e0a565b6520737461676560d01b603f92909101918201526045019695505050505050565b7f4f766572666c6f77206174206f70657261746f7220636f64652030780000000081526000855161292081601c850160208a01611e0a565b6f20666f756e642061742063616c6c202360801b601c91840191820152855161295081602c840160208a01611e0a565b6b20696e20736372697074202360a01b602c9290910191820152845161297d816038840160208901611e0a565b65010333937b6960d51b6038929091019182015283516129a481603e840160208801611e0a565b6520737461676560d01b603e92909101918201526044019695505050505050565b7f4469766973696f6e206279207a65726f206174206f70657261746f7220636f648152630ca4060f60e31b602082015260008551612a0a816024850160208a01611e0a565b6f20666f756e642061742063616c6c202360801b6024918401918201528551612a3a816034840160208a01611e0a565b6b20696e20736372697074202360a01b603492909101918201528451612a67816040840160208901611e0a565b65010333937b6960d51b604092909101918201528351612a8e816046840160208801611e0a565b6520737461676560d01b60469290910191820152604c019695505050505050565b700aadcd6dcdeeedc40cae4e4dee4405060f607b1b815260008251612adb816011850160208701611e0a565b602960f81b6011939091019283015250601201919050565b600060208284031215612b0557600080fd5b81516001600160401b03811115612b1b57600080fd5b61159484828501612231565b600060208284031215612b3957600080fd5b5051919050565b600060208284031215612b5257600080fd5b81516113d481611b2b565b8051600f81900b811461139857600080fd5b600060208284031215612b8157600080fd5b6113d482612b5d565b600060208284031215612b9c57600080fd5b6113d482612193565b805161139881611b75565b600060208284031215612bc257600080fd5b81516001600160401b0380821115612bd957600080fd5b9083019060c08286031215612bed57600080fd5b612bf5611ab1565b825182811115612c0457600080fd5b830160408188031215612c1657600080fd5b612c1e611ad9565b815184811115612c2d57600080fd5b612c3989828501612231565b82525060208201519350612c4c84611b63565b8360208201528083525050612c6360208401612ba5565b6020820152612c7460408401612ba5565b6040820152612c8560608401612ba5565b6060820152612c96608084016120ef565b6080820152612ca760a084016120ef565b60a082015295945050505050565b60006020808385031215612cc857600080fd5b82516001600160401b03811115612cde57600080fd5b8301601f81018513612cef57600080fd5b8051612cfd611c30826120cc565b81815260059190911b82018301908381019087831115612d1c57600080fd5b928401925b8284101561218857612d3284612b5d565b82529284019290840190612d21565b600060ff821660ff84168060ff03821115612d6c57634e487b7160e01b600052601160045260246000fd5b01939250505056fe5769746e65745061727365724c69623a20547269656420746f2072656164206054686520737472756374757265206f6620746865207265717565737420697320696e76616c696420616e642069742063616e6e6f7420626520706172736564546865207265717565737420726573756c74206c656e677468206578636565647320612062726964676520636f6e747261637420646566696e6564206c696d6974546865207265717565737420686173206265656e2072656a65637465642062792074686520627269646765206e6f64652064756520746f20706f6f7220696e63656e7469766573a2646970667358221220215b7682efe58239f9bd570de4c8fb62483b077dee81f6f75a7e7e1ba144721164736f6c634300080b0033

External libraries