Latest 25 transactions from a total of 94 transactions

TxHash Age From To Value [TxFee]
0x580f81418932e2322300c8b3f758a5f2fd58d7e0616fafda6257688e357db1ea2 days 13 hrs ago0x871c8e3c7ee9086c0306f11fc272ca18daa58dbd  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.000059273
0xa9f72ae9f62619e0ce7ea4320fb8bd612db8d28dd51cdb6becf967d35e99e9ea2 days 13 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.0019706
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd5712 days 13 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00241422
0x388ed40a8251b5a8a12e62e2c10a903c51361c9e100585a4ad09c4fb34d8da082 days 13 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00216344
0x7132673cf39713097f3da39ff0126b6216defd363d9cf088049f37e3637734e32 days 13 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00168864
0x1a274a932c917da9de9b4ea7d521be3538c7f2526f16b7669a6ed0f86a0f91a62 days 13 hrs ago0x871c8e3c7ee9086c0306f11fc272ca18daa58dbd  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0.1 Ether0.000594346
0xb7e89c170e9115c6bd4641f638f51ed98b6f019cbbfca982191c05fcfe6952ed4 days 7 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.000043507
0x8185165fb3a8c5d23959f0ad8381ad9724c81a94a2993fcb072d8c254ec6ec684 days 7 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.0020026
0xc4731feaeb61dde2fc9d969614162e4086633a1579e80349a6f4ae483ab071b94 days 7 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00241422
0x61165d6c37d443938f79886ac808cf7cce51d402c9df21efc6af7f07e25d13f64 days 7 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00216088
0xb77dd444aa2c609213d2bc412d60d28e82cd6df255e0ee31d77df685e7378c044 days 7 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00172064
0x68a2ac1bd6469b974e4a9a1bfd91a66f2618f5067b4eb5b3cb699d04c5083c444 days 7 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0.02 Ether0.00060941
0x4a6cd550e799cfd5e63e65631fc46de2586b1d137c0e97a1c0118a0b077cb4fb4 days 7 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0.02 Ether0.000399832
0xfd293cd0736132e1347e17c21bc8192b47c6a326a7f374ececb3c28ba15493474 days 7 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0.02 Ether0.000249771
0x5c3de069993579887b91ba97d66b9af508f2a4546de9a58f41ac9d619678cef04 days 7 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0.02 Ether0.000199876
0x05e1e6002d6b215698f5bd87c22f3967955355e3e4854e78e701925c8cfcb42c4 days 7 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0.02 Ether0.000199876
0x697b90548207c4d7d9cf4c982c3df3ae6390d22a652ec2e58234124c6426aed811 days 12 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00198724
0x94bc9a36f180efd19685a460d80c4a308d04c00559311457a11410a1985dc64211 days 12 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00241422
0xd660b52b1b0823d2ecfcaddb5fb44dd2d048fd5d2ebe767eef918cdc2c34558d11 days 12 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00054602
0x48930d2c3a610699b18a595e22c4ae57466eafc4f4ce398d9f393a544eebc2fe11 days 12 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00216472
0x3f85d1baf4a00cc98a47af07c43917039b91bb33a4144e193ed51bc9c51e96c711 days 12 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00170528
0x764effaf22ae790df038933f65f680bb18ca6693381fff24206d81a9b91c554a11 days 12 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.01238244
0x674719a3210b8cf64dc06424e8f52b5fe37a788d5484def54bd6c8550dbd662311 days 12 hrs ago0xa54741f7fe21689b59bd7eacbf3a2947cd3f3bd4  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00088546
0xd31f55393c5425ee8d73517941884ff2adb5a6845cf02f3d9df1ec2361c016a611 days 12 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.0032
0x50da521ad10130b19592500d96d776ccbdc65427320d489e325b5308378a30d511 days 12 hrs ago0x8ebca32bd42d86ee51f762e968667e40b612b6f1  IN   0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0 Ether0.00241422
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click here To View More View All
ParentTxHash Block Age From To Value
0xa9f72ae9f62619e0ce7ea4320fb8bd612db8d28dd51cdb6becf967d35e99e9ea104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0xa9f72ae9f62619e0ce7ea4320fb8bd612db8d28dd51cdb6becf967d35e99e9ea104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0xab65771c9d62318c3d4fdead6c789c9cafc28d8488dea7fd2fecdb1faabcd571104029002 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0x388ed40a8251b5a8a12e62e2c10a903c51361c9e100585a4ad09c4fb34d8da08104028952 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0x388ed40a8251b5a8a12e62e2c10a903c51361c9e100585a4ad09c4fb34d8da08104028952 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0x7132673cf39713097f3da39ff0126b6216defd363d9cf088049f37e3637734e3104028952 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0x7132673cf39713097f3da39ff0126b6216defd363d9cf088049f37e3637734e3104028952 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0x1a274a932c917da9de9b4ea7d521be3538c7f2526f16b7669a6ed0f86a0f91a6104028922 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0.0140277 Ether
0x1a274a932c917da9de9b4ea7d521be3538c7f2526f16b7669a6ed0f86a0f91a6104028922 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0x1a274a932c917da9de9b4ea7d521be3538c7f2526f16b7669a6ed0f86a0f91a6104028922 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
0x1a274a932c917da9de9b4ea7d521be3538c7f2526f16b7669a6ed0f86a0f91a6104028922 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0x0e9e2a40eef71c807d248543c9c24925ec93699c0 Ether
0x1a274a932c917da9de9b4ea7d521be3538c7f2526f16b7669a6ed0f86a0f91a6104028922 days 13 hrs ago0x9d60fb16b3d9d965d3afbe99b1f0ea76a2f0aa1d0xb7a07bcf2ba2f2703b24c0691b5278999c59ac7e0 Ether
[ Download CSV Export  ] 
Contract Source Code Verified (Exact Match)
Contract Name: PriceRoll
Compiler Version: v0.5.2+commit.1df8f40c
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.5.2;

// File: ethereum-api\oraclizeAPI_0.5.sol

/*

ORACLIZE_API

Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

*/
pragma solidity >= 0.5.0; // Incompatible compiler version - please select a compiler within the stated pragma range, or use a different version of the oraclizeAPI!

// Dummy contract only used to emit to end-user they are using wrong solc
contract solcChecker {
/* INCOMPATIBLE SOLC: import the following instead: "github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol" */ function f(bytes calldata x) external;
}

contract OraclizeI {

    address public cbAddress;

    function setProofType(byte _proofType) external;
    function setCustomGasPrice(uint _gasPrice) external;
    function getPrice(string memory _datasource) public returns (uint _dsprice);
    function randomDS_getSessionPubKeyHash() external view returns (bytes32 _sessionKeyHash);
    function getPrice(string memory _datasource, uint _gasLimit) public returns (uint _dsprice);
    function queryN(uint _timestamp, string memory _datasource, bytes memory _argN) public payable returns (bytes32 _id);
    function query(uint _timestamp, string calldata _datasource, string calldata _arg) external payable returns (bytes32 _id);
    function query2(uint _timestamp, string memory _datasource, string memory _arg1, string memory _arg2) public payable returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string calldata _datasource, string calldata _arg, uint _gasLimit) external payable returns (bytes32 _id);
    function queryN_withGasLimit(uint _timestamp, string calldata _datasource, bytes calldata _argN, uint _gasLimit) external payable returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string calldata _datasource, string calldata _arg1, string calldata _arg2, uint _gasLimit) external payable returns (bytes32 _id);
}

contract OraclizeAddrResolverI {
    function getAddress() public returns (address _address);
}
/*

Begin solidity-cborutils

https://github.com/smartcontractkit/solidity-cborutils

MIT License

Copyright (c) 2018 SmartContract ChainLink, Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

*/
library Buffer {

    struct buffer {
        bytes buf;
        uint capacity;
    }

    function init(buffer memory _buf, uint _capacity) internal pure {
        uint capacity = _capacity;
        if (capacity % 32 != 0) {
            capacity += 32 - (capacity % 32);
        }
        _buf.capacity = capacity; // Allocate space for the buffer data
        assembly {
            let ptr := mload(0x40)
            mstore(_buf, ptr)
            mstore(ptr, 0)
            mstore(0x40, add(ptr, capacity))
        }
    }

    function resize(buffer memory _buf, uint _capacity) private pure {
        bytes memory oldbuf = _buf.buf;
        init(_buf, _capacity);
        append(_buf, oldbuf);
    }

    function max(uint _a, uint _b) private pure returns (uint _max) {
        if (_a > _b) {
            return _a;
        }
        return _b;
    }
    /**
      * @dev Appends a byte array to the end of the buffer. Resizes if doing so
      *      would exceed the capacity of the buffer.
      * @param _buf The buffer to append to.
      * @param _data The data to append.
      * @return The original buffer.
      *
      */
    function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) {
        if (_data.length + _buf.buf.length > _buf.capacity) {
            resize(_buf, max(_buf.capacity, _data.length) * 2);
        }
        uint dest;
        uint src;
        uint len = _data.length;
        assembly {
            let bufptr := mload(_buf) // Memory address of the buffer data
            let buflen := mload(bufptr) // Length of existing buffer data
            dest := add(add(bufptr, buflen), 32) // Start address = buffer address + buffer length + sizeof(buffer length)
            mstore(bufptr, add(buflen, mload(_data))) // Update buffer length
            src := add(_data, 32)
        }
        for(; len >= 32; len -= 32) { // Copy word-length chunks while possible
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }
        uint mask = 256 ** (32 - len) - 1; // Copy remaining bytes
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }
        return _buf;
    }
    /**
      *
      * @dev Appends a byte to the end of the buffer. Resizes if doing so would
      * exceed the capacity of the buffer.
      * @param _buf The buffer to append to.
      * @param _data The data to append.
      * @return The original buffer.
      *
      */
    function append(buffer memory _buf, uint8 _data) internal pure {
        if (_buf.buf.length + 1 > _buf.capacity) {
            resize(_buf, _buf.capacity * 2);
        }
        assembly {
            let bufptr := mload(_buf) // Memory address of the buffer data
            let buflen := mload(bufptr) // Length of existing buffer data
            let dest := add(add(bufptr, buflen), 32) // Address = buffer address + buffer length + sizeof(buffer length)
            mstore8(dest, _data)
            mstore(bufptr, add(buflen, 1)) // Update buffer length
        }
    }
    /**
      *
      * @dev Appends a byte to the end of the buffer. Resizes if doing so would
      * exceed the capacity of the buffer.
      * @param _buf The buffer to append to.
      * @param _data The data to append.
      * @return The original buffer.
      *
      */
    function appendInt(buffer memory _buf, uint _data, uint _len) internal pure returns (buffer memory _buffer) {
        if (_len + _buf.buf.length > _buf.capacity) {
            resize(_buf, max(_buf.capacity, _len) * 2);
        }
        uint mask = 256 ** _len - 1;
        assembly {
            let bufptr := mload(_buf) // Memory address of the buffer data
            let buflen := mload(bufptr) // Length of existing buffer data
            let dest := add(add(bufptr, buflen), _len) // Address = buffer address + buffer length + sizeof(buffer length) + len
            mstore(dest, or(and(mload(dest), not(mask)), _data))
            mstore(bufptr, add(buflen, _len)) // Update buffer length
        }
        return _buf;
    }
}

library CBOR {

    using Buffer for Buffer.buffer;

    uint8 private constant MAJOR_TYPE_INT = 0;
    uint8 private constant MAJOR_TYPE_MAP = 5;
    uint8 private constant MAJOR_TYPE_BYTES = 2;
    uint8 private constant MAJOR_TYPE_ARRAY = 4;
    uint8 private constant MAJOR_TYPE_STRING = 3;
    uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1;
    uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7;

    function encodeType(Buffer.buffer memory _buf, uint8 _major, uint _value) private pure {
        if (_value <= 23) {
            _buf.append(uint8((_major << 5) | _value));
        } else if (_value <= 0xFF) {
            _buf.append(uint8((_major << 5) | 24));
            _buf.appendInt(_value, 1);
        } else if (_value <= 0xFFFF) {
            _buf.append(uint8((_major << 5) | 25));
            _buf.appendInt(_value, 2);
        } else if (_value <= 0xFFFFFFFF) {
            _buf.append(uint8((_major << 5) | 26));
            _buf.appendInt(_value, 4);
        } else if (_value <= 0xFFFFFFFFFFFFFFFF) {
            _buf.append(uint8((_major << 5) | 27));
            _buf.appendInt(_value, 8);
        }
    }

    function encodeIndefiniteLengthType(Buffer.buffer memory _buf, uint8 _major) private pure {
        _buf.append(uint8((_major << 5) | 31));
    }

    function encodeUInt(Buffer.buffer memory _buf, uint _value) internal pure {
        encodeType(_buf, MAJOR_TYPE_INT, _value);
    }

    function encodeInt(Buffer.buffer memory _buf, int _value) internal pure {
        if (_value >= 0) {
            encodeType(_buf, MAJOR_TYPE_INT, uint(_value));
        } else {
            encodeType(_buf, MAJOR_TYPE_NEGATIVE_INT, uint(-1 - _value));
        }
    }

    function encodeBytes(Buffer.buffer memory _buf, bytes memory _value) internal pure {
        encodeType(_buf, MAJOR_TYPE_BYTES, _value.length);
        _buf.append(_value);
    }

    function encodeString(Buffer.buffer memory _buf, string memory _value) internal pure {
        encodeType(_buf, MAJOR_TYPE_STRING, bytes(_value).length);
        _buf.append(bytes(_value));
    }

    function startArray(Buffer.buffer memory _buf) internal pure {
        encodeIndefiniteLengthType(_buf, MAJOR_TYPE_ARRAY);
    }

    function startMap(Buffer.buffer memory _buf) internal pure {
        encodeIndefiniteLengthType(_buf, MAJOR_TYPE_MAP);
    }

    function endSequence(Buffer.buffer memory _buf) internal pure {
        encodeIndefiniteLengthType(_buf, MAJOR_TYPE_CONTENT_FREE);
    }
}
/*

End solidity-cborutils

*/
contract usingOraclize {

    using CBOR for Buffer.buffer;

    OraclizeI oraclize;
    OraclizeAddrResolverI OAR;

    uint constant day = 60 * 60 * 24;
    uint constant week = 60 * 60 * 24 * 7;
    uint constant month = 60 * 60 * 24 * 30;

    byte constant proofType_NONE = 0x00;
    byte constant proofType_Ledger = 0x30;
    byte constant proofType_Native = 0xF0;
    byte constant proofStorage_IPFS = 0x01;
    byte constant proofType_Android = 0x40;
    byte constant proofType_TLSNotary = 0x10;

    string oraclize_network_name;
    uint8 constant networkID_auto = 0;
    uint8 constant networkID_morden = 2;
    uint8 constant networkID_mainnet = 1;
    uint8 constant networkID_testnet = 2;
    uint8 constant networkID_consensys = 161;

    mapping(bytes32 => bytes32) oraclize_randomDS_args;
    mapping(bytes32 => bool) oraclize_randomDS_sessionKeysHashVerified;

    modifier oraclizeAPI {
        if ((address(OAR) == address(0)) || (getCodeSize(address(OAR)) == 0)) {
            oraclize_setNetwork(networkID_auto);
        }
        if (address(oraclize) != OAR.getAddress()) {
            oraclize = OraclizeI(OAR.getAddress());
        }
        _;
    }

    modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string memory _result, bytes memory _proof) {
        // RandomDS Proof Step 1: The prefix has to match 'LP\x01' (Ledger Proof version 1)
        require((_proof[0] == "L") && (_proof[1] == "P") && (uint8(_proof[2]) == uint8(1)));
        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        require(proofVerified);
        _;
    }

    function oraclize_setNetwork(uint8 _networkID) internal returns (bool _networkSet) {
      return oraclize_setNetwork();
      _networkID; // silence the warning and remain backwards compatible
    }

    function oraclize_setNetworkName(string memory _network_name) internal {
        oraclize_network_name = _network_name;
    }

    function oraclize_getNetworkName() internal view returns (string memory _networkName) {
        return oraclize_network_name;
    }

    function oraclize_setNetwork() internal returns (bool _networkSet) {
        if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed) > 0) { //mainnet
            OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed);
            oraclize_setNetworkName("eth_mainnet");
            return true;
        }
        if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1) > 0) { //ropsten testnet
            OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1);
            oraclize_setNetworkName("eth_ropsten3");
            return true;
        }
        if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e) > 0) { //kovan testnet
            OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e);
            oraclize_setNetworkName("eth_kovan");
            return true;
        }
        if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48) > 0) { //rinkeby testnet
            OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48);
            oraclize_setNetworkName("eth_rinkeby");
            return true;
        }
        if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475) > 0) { //ethereum-bridge
            OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
            return true;
        }
        if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF) > 0) { //ether.camp ide
            OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF);
            return true;
        }
        if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA) > 0) { //browser-solidity
            OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA);
            return true;
        }
        return false;
    }

    function __callback(bytes32 _myid, string memory _result) public {
        __callback(_myid, _result, new bytes(0));
    }

    function __callback(bytes32 _myid, string memory _result, bytes memory _proof) public {
      return;
      _myid; _result; _proof; // Silence compiler warnings
    }

    function oraclize_getPrice(string memory _datasource) oraclizeAPI internal returns (uint _queryPrice) {
        return oraclize.getPrice(_datasource);
    }

    function oraclize_getPrice(string memory _datasource, uint _gasLimit) oraclizeAPI internal returns (uint _queryPrice) {
        return oraclize.getPrice(_datasource, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string memory _arg) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource);
        if (price > 1 ether + tx.gasprice * 200000) {
            return 0; // Unexpectedly high price
        }
        return oraclize.query.value(price)(0, _datasource, _arg);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string memory _arg) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource);
        if (price > 1 ether + tx.gasprice * 200000) {
            return 0; // Unexpectedly high price
        }
        return oraclize.query.value(price)(_timestamp, _datasource, _arg);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string memory _arg, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource,_gasLimit);
        if (price > 1 ether + tx.gasprice * _gasLimit) {
            return 0; // Unexpectedly high price
        }
        return oraclize.query_withGasLimit.value(price)(_timestamp, _datasource, _arg, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string memory _arg, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource, _gasLimit);
        if (price > 1 ether + tx.gasprice * _gasLimit) {
           return 0; // Unexpectedly high price
        }
        return oraclize.query_withGasLimit.value(price)(0, _datasource, _arg, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string memory _arg1, string memory _arg2) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource);
        if (price > 1 ether + tx.gasprice * 200000) {
            return 0; // Unexpectedly high price
        }
        return oraclize.query2.value(price)(0, _datasource, _arg1, _arg2);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string memory _arg1, string memory _arg2) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource);
        if (price > 1 ether + tx.gasprice * 200000) {
            return 0; // Unexpectedly high price
        }
        return oraclize.query2.value(price)(_timestamp, _datasource, _arg1, _arg2);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string memory _arg1, string memory _arg2, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource, _gasLimit);
        if (price > 1 ether + tx.gasprice * _gasLimit) {
            return 0; // Unexpectedly high price
        }
        return oraclize.query2_withGasLimit.value(price)(_timestamp, _datasource, _arg1, _arg2, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string memory _arg1, string memory _arg2, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource, _gasLimit);
        if (price > 1 ether + tx.gasprice * _gasLimit) {
            return 0; // Unexpectedly high price
        }
        return oraclize.query2_withGasLimit.value(price)(0, _datasource, _arg1, _arg2, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[] memory _argN) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource);
        if (price > 1 ether + tx.gasprice * 200000) {
            return 0; // Unexpectedly high price
        }
        bytes memory args = stra2cbor(_argN);
        return oraclize.queryN.value(price)(0, _datasource, args);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[] memory _argN) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource);
        if (price > 1 ether + tx.gasprice * 200000) {
            return 0; // Unexpectedly high price
        }
        bytes memory args = stra2cbor(_argN);
        return oraclize.queryN.value(price)(_timestamp, _datasource, args);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[] memory _argN, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource, _gasLimit);
        if (price > 1 ether + tx.gasprice * _gasLimit) {
            return 0; // Unexpectedly high price
        }
        bytes memory args = stra2cbor(_argN);
        return oraclize.queryN_withGasLimit.value(price)(_timestamp, _datasource, args, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[] memory _argN, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource, _gasLimit);
        if (price > 1 ether + tx.gasprice * _gasLimit) {
            return 0; // Unexpectedly high price
        }
        bytes memory args = stra2cbor(_argN);
        return oraclize.queryN_withGasLimit.value(price)(0, _datasource, args, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[1] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = _args[0];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[1] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = _args[0];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[1] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = _args[0];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[1] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = _args[0];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[2] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[2] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[3] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[3] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[3] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[3] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[4] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[4] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[4] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[4] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[5] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        dynargs[4] = _args[4];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[5] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        dynargs[4] = _args[4];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, string[5] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        dynargs[4] = _args[4];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, string[5] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        dynargs[4] = _args[4];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[] memory _argN) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource);
        if (price > 1 ether + tx.gasprice * 200000) {
            return 0; // Unexpectedly high price
        }
        bytes memory args = ba2cbor(_argN);
        return oraclize.queryN.value(price)(0, _datasource, args);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[] memory _argN) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource);
        if (price > 1 ether + tx.gasprice * 200000) {
            return 0; // Unexpectedly high price
        }
        bytes memory args = ba2cbor(_argN);
        return oraclize.queryN.value(price)(_timestamp, _datasource, args);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[] memory _argN, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource, _gasLimit);
        if (price > 1 ether + tx.gasprice * _gasLimit) {
            return 0; // Unexpectedly high price
        }
        bytes memory args = ba2cbor(_argN);
        return oraclize.queryN_withGasLimit.value(price)(_timestamp, _datasource, args, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[] memory _argN, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        uint price = oraclize.getPrice(_datasource, _gasLimit);
        if (price > 1 ether + tx.gasprice * _gasLimit) {
            return 0; // Unexpectedly high price
        }
        bytes memory args = ba2cbor(_argN);
        return oraclize.queryN_withGasLimit.value(price)(0, _datasource, args, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[1] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = _args[0];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[1] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = _args[0];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[1] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = _args[0];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[1] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = _args[0];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[2] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[2] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[3] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[3] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[3] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[3] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[4] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[4] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[4] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[4] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[5] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        dynargs[4] = _args[4];
        return oraclize_query(_datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[5] memory _args) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        dynargs[4] = _args[4];
        return oraclize_query(_timestamp, _datasource, dynargs);
    }

    function oraclize_query(uint _timestamp, string memory _datasource, bytes[5] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        dynargs[4] = _args[4];
        return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
    }

    function oraclize_query(string memory _datasource, bytes[5] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = _args[0];
        dynargs[1] = _args[1];
        dynargs[2] = _args[2];
        dynargs[3] = _args[3];
        dynargs[4] = _args[4];
        return oraclize_query(_datasource, dynargs, _gasLimit);
    }

    function oraclize_setProof(byte _proofP) oraclizeAPI internal {
        return oraclize.setProofType(_proofP);
    }


    function oraclize_cbAddress() oraclizeAPI internal returns (address _callbackAddress) {
        return oraclize.cbAddress();
    }

    function getCodeSize(address _addr) view internal returns (uint _size) {
        assembly {
            _size := extcodesize(_addr)
        }
    }

    function oraclize_setCustomGasPrice(uint _gasPrice) oraclizeAPI internal {
        return oraclize.setCustomGasPrice(_gasPrice);
    }

    function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32 _sessionKeyHash) {
        return oraclize.randomDS_getSessionPubKeyHash();
    }

    function parseAddr(string memory _a) internal pure returns (address _parsedAddress) {
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint i = 2; i < 2 + 2 * 20; i += 2) {
            iaddr *= 256;
            b1 = uint160(uint8(tmp[i]));
            b2 = uint160(uint8(tmp[i + 1]));
            if ((b1 >= 97) && (b1 <= 102)) {
                b1 -= 87;
            } else if ((b1 >= 65) && (b1 <= 70)) {
                b1 -= 55;
            } else if ((b1 >= 48) && (b1 <= 57)) {
                b1 -= 48;
            }
            if ((b2 >= 97) && (b2 <= 102)) {
                b2 -= 87;
            } else if ((b2 >= 65) && (b2 <= 70)) {
                b2 -= 55;
            } else if ((b2 >= 48) && (b2 <= 57)) {
                b2 -= 48;
            }
            iaddr += (b1 * 16 + b2);
        }
        return address(iaddr);
    }

    function strCompare(string memory _a, string memory _b) internal pure returns (int _returnCode) {
        bytes memory a = bytes(_a);
        bytes memory b = bytes(_b);
        uint minLength = a.length;
        if (b.length < minLength) {
            minLength = b.length;
        }
        for (uint i = 0; i < minLength; i ++) {
            if (a[i] < b[i]) {
                return -1;
            } else if (a[i] > b[i]) {
                return 1;
            }
        }
        if (a.length < b.length) {
            return -1;
        } else if (a.length > b.length) {
            return 1;
        } else {
            return 0;
        }
    }

    function indexOf(string memory _haystack, string memory _needle) internal pure returns (int _returnCode) {
        bytes memory h = bytes(_haystack);
        bytes memory n = bytes(_needle);
        if (h.length < 1 || n.length < 1 || (n.length > h.length)) {
            return -1;
        } else if (h.length > (2 ** 128 - 1)) {
            return -1;
        } else {
            uint subindex = 0;
            for (uint i = 0; i < h.length; i++) {
                if (h[i] == n[0]) {
                    subindex = 1;
                    while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) {
                        subindex++;
                    }
                    if (subindex == n.length) {
                        return int(i);
                    }
                }
            }
            return -1;
        }
    }

    function strConcat(string memory _a, string memory _b) internal pure returns (string memory _concatenatedString) {
        return strConcat(_a, _b, "", "", "");
    }

    function strConcat(string memory _a, string memory _b, string memory _c) internal pure returns (string memory _concatenatedString) {
        return strConcat(_a, _b, _c, "", "");
    }

    function strConcat(string memory _a, string memory _b, string memory _c, string memory _d) internal pure returns (string memory _concatenatedString) {
        return strConcat(_a, _b, _c, _d, "");
    }

    function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory _concatenatedString) {
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory _bc = bytes(_c);
        bytes memory _bd = bytes(_d);
        bytes memory _be = bytes(_e);
        string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
        bytes memory babcde = bytes(abcde);
        uint k = 0;
        uint i = 0;
        for (i = 0; i < _ba.length; i++) {
            babcde[k++] = _ba[i];
        }
        for (i = 0; i < _bb.length; i++) {
            babcde[k++] = _bb[i];
        }
        for (i = 0; i < _bc.length; i++) {
            babcde[k++] = _bc[i];
        }
        for (i = 0; i < _bd.length; i++) {
            babcde[k++] = _bd[i];
        }
        for (i = 0; i < _be.length; i++) {
            babcde[k++] = _be[i];
        }
        return string(babcde);
    }

    function safeParseInt(string memory _a) internal pure returns (uint _parsedInt) {
        return safeParseInt(_a, 0);
    }

    function safeParseInt(string memory _a, uint _b) internal pure returns (uint _parsedInt) {
        bytes memory bresult = bytes(_a);
        uint mint = 0;
        bool decimals = false;
        for (uint i = 0; i < bresult.length; i++) {
            if ((uint(uint8(bresult[i])) >= 48) && (uint(uint8(bresult[i])) <= 57)) {
                if (decimals) {
                   if (_b == 0) break;
                    else _b--;
                }
                mint *= 10;
                mint += uint(uint8(bresult[i])) - 48;
            } else if (uint(uint8(bresult[i])) == 46) {
                require(!decimals, 'More than one decimal encountered in string!');
                decimals = true;
            } else {
                revert("Non-numeral character encountered in string!");
            }
        }
        if (_b > 0) {
            mint *= 10 ** _b;
        }
        return mint;
    }

    function parseInt(string memory _a) internal pure returns (uint _parsedInt) {
        return parseInt(_a, 0);
    }

    function parseInt(string memory _a, uint _b) internal pure returns (uint _parsedInt) {
        bytes memory bresult = bytes(_a);
        uint mint = 0;
        bool decimals = false;
        for (uint i = 0; i < bresult.length; i++) {
            if ((uint(uint8(bresult[i])) >= 48) && (uint(uint8(bresult[i])) <= 57)) {
                if (decimals) {
                   if (_b == 0) {
                       break;
                   } else {
                       _b--;
                   }
                }
                mint *= 10;
                mint += uint(uint8(bresult[i])) - 48;
            } else if (uint(uint8(bresult[i])) == 46) {
                decimals = true;
            }
        }
        if (_b > 0) {
            mint *= 10 ** _b;
        }
        return mint;
    }

    function uint2str(uint _i) internal pure returns (string memory _uintAsString) {
        if (_i == 0) {
            return "0";
        }
        uint j = _i;
        uint len;
        while (j != 0) {
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint k = len - 1;
        while (_i != 0) {
            bstr[k--] = byte(uint8(48 + _i % 10));
            _i /= 10;
        }
        return string(bstr);
    }

    function stra2cbor(string[] memory _arr) internal pure returns (bytes memory _cborEncoding) {
        safeMemoryCleaner();
        Buffer.buffer memory buf;
        Buffer.init(buf, 1024);
        buf.startArray();
        for (uint i = 0; i < _arr.length; i++) {
            buf.encodeString(_arr[i]);
        }
        buf.endSequence();
        return buf.buf;
    }

    function ba2cbor(bytes[] memory _arr) internal pure returns (bytes memory _cborEncoding) {
        safeMemoryCleaner();
        Buffer.buffer memory buf;
        Buffer.init(buf, 1024);
        buf.startArray();
        for (uint i = 0; i < _arr.length; i++) {
            buf.encodeBytes(_arr[i]);
        }
        buf.endSequence();
        return buf.buf;
    }

    function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32 _queryId) {
        require((_nbytes > 0) && (_nbytes <= 32));
        _delay *= 10; // Convert from seconds to ledger timer ticks
        bytes memory nbytes = new bytes(1);
        nbytes[0] = byte(uint8(_nbytes));
        bytes memory unonce = new bytes(32);
        bytes memory sessionKeyHash = new bytes(32);
        bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
        assembly {
            mstore(unonce, 0x20)
            /*
             The following variables can be relaxed.
             Check the relaxed random contract at https://github.com/oraclize/ethereum-examples
             for an idea on how to override and replace commit hash variables.
            */
            mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
            mstore(sessionKeyHash, 0x20)
            mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
        }
        bytes memory delay = new bytes(32);
        assembly {
            mstore(add(delay, 0x20), _delay)
        }
        bytes memory delay_bytes8 = new bytes(8);
        copyBytes(delay, 24, 8, delay_bytes8, 0);
        bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay];
        bytes32 queryId = oraclize_query("random", args, _customGasLimit);
        bytes memory delay_bytes8_left = new bytes(8);
        assembly {
            let x := mload(add(delay_bytes8, 0x20))
            mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000))
        }
        oraclize_randomDS_setCommitment(queryId, keccak256(abi.encodePacked(delay_bytes8_left, args[1], sha256(args[0]), args[2])));
        return queryId;
    }

    function oraclize_randomDS_setCommitment(bytes32 _queryId, bytes32 _commitment) internal {
        oraclize_randomDS_args[_queryId] = _commitment;
    }

    function verifySig(bytes32 _tosignh, bytes memory _dersig, bytes memory _pubkey) internal returns (bool _sigVerified) {
        bool sigok;
        address signer;
        bytes32 sigr;
        bytes32 sigs;
        bytes memory sigr_ = new bytes(32);
        uint offset = 4 + (uint(uint8(_dersig[3])) - 0x20);
        sigr_ = copyBytes(_dersig, offset, 32, sigr_, 0);
        bytes memory sigs_ = new bytes(32);
        offset += 32 + 2;
        sigs_ = copyBytes(_dersig, offset + (uint(uint8(_dersig[offset - 1])) - 0x20), 32, sigs_, 0);
        assembly {
            sigr := mload(add(sigr_, 32))
            sigs := mload(add(sigs_, 32))
        }
        (sigok, signer) = safer_ecrecover(_tosignh, 27, sigr, sigs);
        if (address(uint160(uint256(keccak256(_pubkey)))) == signer) {
            return true;
        } else {
            (sigok, signer) = safer_ecrecover(_tosignh, 28, sigr, sigs);
            return (address(uint160(uint256(keccak256(_pubkey)))) == signer);
        }
    }

    function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes memory _proof, uint _sig2offset) internal returns (bool _proofVerified) {
        bool sigok;
        // Random DS Proof Step 6: Verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH)
        bytes memory sig2 = new bytes(uint(uint8(_proof[_sig2offset + 1])) + 2);
        copyBytes(_proof, _sig2offset, sig2.length, sig2, 0);
        bytes memory appkey1_pubkey = new bytes(64);
        copyBytes(_proof, 3 + 1, 64, appkey1_pubkey, 0);
        bytes memory tosign2 = new bytes(1 + 65 + 32);
        tosign2[0] = byte(uint8(1)); //role
        copyBytes(_proof, _sig2offset - 65, 65, tosign2, 1);
        bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c";
        copyBytes(CODEHASH, 0, 32, tosign2, 1 + 65);
        sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey);
        if (!sigok) {
            return false;
        }
        // Random DS Proof Step 7: Verify the APPKEY1 provenance (must be signed by Ledger)
        bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4";
        bytes memory tosign3 = new bytes(1 + 65);
        tosign3[0] = 0xFE;
        copyBytes(_proof, 3, 65, tosign3, 1);
        bytes memory sig3 = new bytes(uint(uint8(_proof[3 + 65 + 1])) + 2);
        copyBytes(_proof, 3 + 65, sig3.length, sig3, 0);
        sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY);
        return sigok;
    }

    function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string memory _result, bytes memory _proof) internal returns (uint8 _returnCode) {
        // Random DS Proof Step 1: The prefix has to match 'LP\x01' (Ledger Proof version 1)
        if ((_proof[0] != "L") || (_proof[1] != "P") || (uint8(_proof[2]) != uint8(1))) {
            return 1;
        }
        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        if (!proofVerified) {
            return 2;
        }
        return 0;
    }

    function matchBytes32Prefix(bytes32 _content, bytes memory _prefix, uint _nRandomBytes) internal pure returns (bool _matchesPrefix) {
        bool match_ = true;
        require(_prefix.length == _nRandomBytes);
        for (uint256 i = 0; i< _nRandomBytes; i++) {
            if (_content[i] != _prefix[i]) {
                match_ = false;
            }
        }
        return match_;
    }

    function oraclize_randomDS_proofVerify__main(bytes memory _proof, bytes32 _queryId, bytes memory _result, string memory _contextName) internal returns (bool _proofVerified) {
        // Random DS Proof Step 2: The unique keyhash has to match with the sha256 of (context name + _queryId)
        uint ledgerProofLength = 3 + 65 + (uint(uint8(_proof[3 + 65 + 1])) + 2) + 32;
        bytes memory keyhash = new bytes(32);
        copyBytes(_proof, ledgerProofLength, 32, keyhash, 0);
        if (!(keccak256(keyhash) == keccak256(abi.encodePacked(sha256(abi.encodePacked(_contextName, _queryId)))))) {
            return false;
        }
        bytes memory sig1 = new bytes(uint(uint8(_proof[ledgerProofLength + (32 + 8 + 1 + 32) + 1])) + 2);
        copyBytes(_proof, ledgerProofLength + (32 + 8 + 1 + 32), sig1.length, sig1, 0);
        // Random DS Proof Step 3: We assume sig1 is valid (it will be verified during step 5) and we verify if '_result' is the _prefix of sha256(sig1)
        if (!matchBytes32Prefix(sha256(sig1), _result, uint(uint8(_proof[ledgerProofLength + 32 + 8])))) {
            return false;
        }
        // Random DS Proof Step 4: Commitment match verification, keccak256(delay, nbytes, unonce, sessionKeyHash) == commitment in storage.
        // This is to verify that the computed args match with the ones specified in the query.
        bytes memory commitmentSlice1 = new bytes(8 + 1 + 32);
        copyBytes(_proof, ledgerProofLength + 32, 8 + 1 + 32, commitmentSlice1, 0);
        bytes memory sessionPubkey = new bytes(64);
        uint sig2offset = ledgerProofLength + 32 + (8 + 1 + 32) + sig1.length + 65;
        copyBytes(_proof, sig2offset - 64, 64, sessionPubkey, 0);
        bytes32 sessionPubkeyHash = sha256(sessionPubkey);
        if (oraclize_randomDS_args[_queryId] == keccak256(abi.encodePacked(commitmentSlice1, sessionPubkeyHash))) { //unonce, nbytes and sessionKeyHash match
            delete oraclize_randomDS_args[_queryId];
        } else return false;
        // Random DS Proof Step 5: Validity verification for sig1 (keyhash and args signed with the sessionKey)
        bytes memory tosign1 = new bytes(32 + 8 + 1 + 32);
        copyBytes(_proof, ledgerProofLength, 32 + 8 + 1 + 32, tosign1, 0);
        if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) {
            return false;
        }
        // Verify if sessionPubkeyHash was verified already, if not.. let's do it!
        if (!oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash]) {
            oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(_proof, sig2offset);
        }
        return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash];
    }
    /*
     The following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    */
    function copyBytes(bytes memory _from, uint _fromOffset, uint _length, bytes memory _to, uint _toOffset) internal pure returns (bytes memory _copiedBytes) {
        uint minLength = _length + _toOffset;
        require(_to.length >= minLength); // Buffer too small. Should be a better way?
        uint i = 32 + _fromOffset; // NOTE: the offset 32 is added to skip the `size` field of both bytes variables
        uint j = 32 + _toOffset;
        while (i < (32 + _fromOffset + _length)) {
            assembly {
                let tmp := mload(add(_from, i))
                mstore(add(_to, j), tmp)
            }
            i += 32;
            j += 32;
        }
        return _to;
    }
    /*
     The following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
     Duplicate Solidity's ecrecover, but catching the CALL return value
    */
    function safer_ecrecover(bytes32 _hash, uint8 _v, bytes32 _r, bytes32 _s) internal returns (bool _success, address _recoveredAddress) {
        /*
         We do our own memory management here. Solidity uses memory offset
         0x40 to store the current end of memory. We write past it (as
         writes are memory extensions), but don't update the offset so
         Solidity will reuse it. The memory used here is only needed for
         this context.
         FIXME: inline assembly can't access return values
        */
        bool ret;
        address addr;
        assembly {
            let size := mload(0x40)
            mstore(size, _hash)
            mstore(add(size, 32), _v)
            mstore(add(size, 64), _r)
            mstore(add(size, 96), _s)
            ret := call(3000, 1, 0, size, 128, size, 32) // NOTE: we can reuse the request memory because we deal with the return code.
            addr := mload(size)
        }
        return (ret, addr);
    }
    /*
     The following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    */
    function ecrecovery(bytes32 _hash, bytes memory _sig) internal returns (bool _success, address _recoveredAddress) {
        bytes32 r;
        bytes32 s;
        uint8 v;
        if (_sig.length != 65) {
            return (false, address(0));
        }
        /*
         The signature format is a compact form of:
           {bytes32 r}{bytes32 s}{uint8 v}
         Compact means, uint8 is not padded to 32 bytes.
        */
        assembly {
            r := mload(add(_sig, 32))
            s := mload(add(_sig, 64))
            /*
             Here we are loading the last 32 bytes. We exploit the fact that
             'mload' will pad with zeroes if we overread.
             There is no 'mload8' to do this, but that would be nicer.
            */
            v := byte(0, mload(add(_sig, 96)))
            /*
              Alternative solution:
              'byte' is not working due to the Solidity parser, so lets
              use the second best option, 'and'
              v := and(mload(add(_sig, 65)), 255)
            */
        }
        /*
         albeit non-transactional signatures are not specified by the YP, one would expect it
         to match the YP range of [27, 28]
         geth uses [0, 1] and some clients have followed. This might change, see:
         https://github.com/ethereum/go-ethereum/issues/2053
        */
        if (v < 27) {
            v += 27;
        }
        if (v != 27 && v != 28) {
            return (false, address(0));
        }
        return safer_ecrecover(_hash, v, r, s);
    }

    function safeMemoryCleaner() internal pure {
        assembly {
            let fmem := mload(0x40)
            codecopy(fmem, codesize, sub(msize, fmem))
        }
    }
}
/*

END ORACLIZE_API

*/

// File: openzeppelin-solidity\contracts\access\Roles.sol

/**
 * @title Roles
 * @dev Library for managing addresses assigned to a Role.
 */
library Roles {
    struct Role {
        mapping (address => bool) bearer;
    }

    /**
     * @dev give an account access to this role
     */
    function add(Role storage role, address account) internal {
        require(account != address(0));
        require(!has(role, account));

        role.bearer[account] = true;
    }

    /**
     * @dev remove an account's access to this role
     */
    function remove(Role storage role, address account) internal {
        require(account != address(0));
        require(has(role, account));

        role.bearer[account] = false;
    }

    /**
     * @dev check if an account has this role
     * @return bool
     */
    function has(Role storage role, address account) internal view returns (bool) {
        require(account != address(0));
        return role.bearer[account];
    }
}

// File: openzeppelin-solidity\contracts\access\roles\PauserRole.sol

contract PauserRole {
    using Roles for Roles.Role;

    event PauserAdded(address indexed account);
    event PauserRemoved(address indexed account);

    Roles.Role private _pausers;

    constructor () internal {
        _addPauser(msg.sender);
    }

    modifier onlyPauser() {
        require(isPauser(msg.sender));
        _;
    }

    function isPauser(address account) public view returns (bool) {
        return _pausers.has(account);
    }

    function addPauser(address account) public onlyPauser {
        _addPauser(account);
    }

    function renouncePauser() public {
        _removePauser(msg.sender);
    }

    function _addPauser(address account) internal {
        _pausers.add(account);
        emit PauserAdded(account);
    }

    function _removePauser(address account) internal {
        _pausers.remove(account);
        emit PauserRemoved(account);
    }
}

// File: openzeppelin-solidity\contracts\lifecycle\Pausable.sol

/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is PauserRole {
    event Paused(address account);
    event Unpaused(address account);

    bool private _paused;

    constructor () internal {
        _paused = false;
    }

    /**
     * @return true if the contract is paused, false otherwise.
     */
    function paused() public view returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     */
    modifier whenNotPaused() {
        require(!_paused);
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     */
    modifier whenPaused() {
        require(_paused);
        _;
    }

    /**
     * @dev called by the owner to pause, triggers stopped state
     */
    function pause() public onlyPauser whenNotPaused {
        _paused = true;
        emit Paused(msg.sender);
    }

    /**
     * @dev called by the owner to unpause, returns to normal state
     */
    function unpause() public onlyPauser whenPaused {
        _paused = false;
        emit Unpaused(msg.sender);
    }
}

// File: openzeppelin-solidity\contracts\math\SafeMath.sol

/**
 * @title SafeMath
 * @dev Unsigned math operations with safety checks that revert on error
 */
library SafeMath {
    /**
     * @dev Multiplies two unsigned integers, reverts on overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b);

        return c;
    }

    /**
     * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Adds two unsigned integers, reverts on overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a);

        return c;
    }

    /**
     * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
     * reverts when dividing by zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0);
        return a % b;
    }
}

// File: openzeppelin-solidity\contracts\ownership\Ownable.sol

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
    address private _owner;

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

    /**
     * @dev The Ownable constructor sets the original `owner` of the contract to the sender
     * account.
     */
    constructor () internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

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

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

    /**
     * @return true if `msg.sender` is the owner of the contract.
     */
    function isOwner() public view returns (bool) {
        return msg.sender == _owner;
    }

    /**
     * @dev Allows the current owner to relinquish control of the contract.
     * @notice Renouncing to ownership will leave the contract without an owner.
     * It will not be possible to call the functions with the `onlyOwner`
     * modifier anymore.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0));
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// File: contracts\PriceRoll.sol

//import "../solidity-stringutils/src/strings.sol";

contract PriceRoll is usingOraclize, Pausable, Ownable {

    using SafeMath for uint256;
//    using strings for *;

    /// @dev events
    event Rolling(uint256 round);
    event NewRoll(uint256 round);
    event RollEnded(uint256 round, uint256 start_price, uint256 end_price, bytes1 seed);
    event RollRefunded(uint256 round);
    event RollClaimed(uint256 round, address player, uint256 amount);
    event BetPlaced(uint256 round, uint256 amount, address player, uint8 expected_value, uint8 is_up);
    event OraclizeError(uint256 value);
    event NoPlayersError();


    // config

    /// @dev minimum time between rolls
    uint256 public config_roll_cooldown = 1 minutes;
    /// @dev time before a started roll has to reach the DONE state before it can be refunded
    uint256 public config_refund_delay = 50 minutes;
    /// @dev gas limit for price callbacks
    uint256 public config_gas_limit = 160000;
    /// @dev gas limit for random value callback
    uint256 public config_random_gas_limit = 200000;
    /// @dev gas limit for the newRoll scheduled call
    uint256 public config_rolling_gas_limit = 700000;
    // @dev gas price for transactions
    uint256 public config_gasprice = 20000000000 wei;
    /// @dev minimum authorized bet
    uint256 public config_min_bet = 0.02 ether;
    /// @dev maximum authorized bet
    uint256 public config_max_bet = 100 ether;
    /// @dev house edge
    uint256 public config_house_edge = 20; //2.0%
    /// @dev bonus to bettors winnings if he guesses the price movement
    uint256 public config_bonus_mult = 75; //7.5%
    /// @dev percentage of current pool to be used to compute max bet
    uint256 public config_percent_pool = 50; //50%
    /// @dev time between start and end price for the price movement bet
    uint256 public config_pricecheck_delay = 1 minutes;
    /// @dev address to which send the house cut on withdrawal
    address payable config_cut_address = 0xA54741f7fE21689B59bD7eAcBf3A2947cd3f3BD4;

    /// @dev possible states of a roll
    enum State {READY, WAITING_QUERY1, WAITING_QUERY2, WAITING_QUERY3, DONE, REFUND}
    /// @dev coins in the coin rotation
    enum CoinRotation {ETHEREUM, BITCOIN, LITECOIN}
    uint8 constant coin_count = 3;

    /// @dev oraclize queries for ETH,BTC and LTC with encrypted api key for cryptocompare
    string constant public query_stringETH = "[URL] json(https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD&extraParams=PriceRoll&sign=true&api_key=${[decrypt] BJEWo5a53APBrN4fYpz5xJaDzPmCLNjKdU+yMeD3p6VsMLkFRFfqIvRa+d4/qukTBbsFZqkvstMMcqoLZaShoh4HfH9XQUxL7cAtKwuAi8GCkFps0kcFmNB3EAQQvgGMX4Feaaoh40YCp5qBdKgXqLhX+BVu4x9p0uKS9XXB+Cc2qIlvagkG7y+To1bVrp1Xgg==}).USD";
    string constant public query_stringBTC = "[URL] json(https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD&extraParams=PriceRoll&sign=true&api_key=${[decrypt] BJEWo5a53APBrN4fYpz5xJaDzPmCLNjKdU+yMeD3p6VsMLkFRFfqIvRa+d4/qukTBbsFZqkvstMMcqoLZaShoh4HfH9XQUxL7cAtKwuAi8GCkFps0kcFmNB3EAQQvgGMX4Feaaoh40YCp5qBdKgXqLhX+BVu4x9p0uKS9XXB+Cc2qIlvagkG7y+To1bVrp1Xgg==}).USD";
    string constant public query_stringLTC = "[URL] json(https://min-api.cryptocompare.com/data/price?fsym=LTC&tsyms=USD&extraParams=PriceRoll&sign=true&api_key=${[decrypt] BJEWo5a53APBrN4fYpz5xJaDzPmCLNjKdU+yMeD3p6VsMLkFRFfqIvRa+d4/qukTBbsFZqkvstMMcqoLZaShoh4HfH9XQUxL7cAtKwuAi8GCkFps0kcFmNB3EAQQvgGMX4Feaaoh40YCp5qBdKgXqLhX+BVu4x9p0uKS9XXB+Cc2qIlvagkG7y+To1bVrp1Xgg==}).USD";
  
    /// @dev current roll id
    uint256 public current_roll = 0;
    /// @dev used for cooldown between rolls
    uint256 public latest_roll = 0;
    /// @dev used to rotate between coins for each roll
    CoinRotation public current_coin = CoinRotation.ETHEREUM;
    /// @dev total amount of collected eth by the house
    uint256 public house;
    /// @dev total amount of ETH available in pool for claiming
    uint256 public pool;

    /// @dev describes a user bet
    struct Bet {
        //amount of wagered ETH in Wei
        uint256 amount;
        //selected roll value
        uint8 value;
        //selected price movement
        bool is_up;
    }

    /// @dev describes a roll
    struct Roll {
        // oraclize query ids
        bytes32 query_rng;
        bytes32 query_price1;
        bytes32 query_price2;
        // query results
        uint256 result_price1;
        uint256 result_price2;
        //uint256 result_timestamp1;
        //uint256 result_timestamp2;
        // timestamp at the moment of the roll
        uint256 timestamp;
        // total amount of ETH wagered on this roll
        uint256 pool;
        // current state
        State state;
        // coin selected for this roll from the coin rotation
        CoinRotation coin;
        // final result of the price movement
        bool is_up;
        // final result of the random query
        bytes1 result_rngseed;
        // mapping bettors to their bets on this roll
        mapping(address => Bet) bets;
    }

    /// @dev mapping to associate roll number with a roll object
    mapping(uint256 => Roll) public rolls;
    /// @dev mapping to find the roll number associated with a query
    mapping(bytes32 => uint256) internal _query_to_roll;
    /// @dev mapping to prevent processing twice the same query
    mapping(bytes32 => bool) internal _processed;
    /// @dev mapping to detect roll callbacks
    mapping(bytes32 => bool) internal _rolling_query;
    /// @dev internal wallet
    mapping(address => uint256) public balanceOf;

    /**
        @dev init the contract and the first roll
    */
    constructor() public
    Pausable()
    Ownable() {
        //init first roll
        _generateRoll();
    }

    /**
        @dev Execute a new roll. Anyone can pay the ETH for it
        So can be called if Ethouse fails to call it automatically
        Must be provided with enough eth for Oraclize calls (see _checkPrice())
        Cant be called when paused
    */
    function newRoll() public
    whenNotPaused() {
        //prevent roll spamming by respecting a minimal cooldown period
        require(latest_roll + config_roll_cooldown <= block.timestamp, "roll is cooling down");
        //compute oraclize fees
        uint256 call_price = _checkPrice();

        if(call_price > address(this).balance) {
            //the caller didnt send enough for oraclize fees, just push an event and display the desired price
            emit OraclizeError(call_price);
        } else {
            //lets roll!
            Roll storage roll = rolls[current_roll]; 
            //check that we have players
            if(roll.pool > 0) {
                //decide on the query to use based on the coin rotation
                string memory query;
                if(current_coin == CoinRotation.ETHEREUM) {
                    query = query_stringETH;
                } else if(current_coin == CoinRotation.BITCOIN) {
                    query = query_stringBTC;
                } else {
                    query = query_stringLTC;
                }
                //use special proof for price values queries
                oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
                //save the oraclize query indices for proof 
                roll.query_price1 = oraclize_query(0, "nested", query, config_gas_limit);
                roll.query_price2 = oraclize_query(config_pricecheck_delay, "nested", query, config_gas_limit);
                //only ledger proof for random source
                oraclize_setProof(proofType_Ledger);
                roll.query_rng = oraclize_newRandomDSQuery(0, 1, config_random_gas_limit);

                
                roll.timestamp = block.timestamp;
                roll.state = State.WAITING_QUERY1;
                roll.coin = current_coin;

                //save mappings to find the right roll number associated with this query
                _query_to_roll[roll.query_rng] = current_roll;
                _query_to_roll[roll.query_price1] = current_roll;
                _query_to_roll[roll.query_price2] = current_roll;

                //begin new roll
                emit Rolling(current_roll);

                _generateRoll();
            
                //remove proof for simple call schedule
                oraclize_setProof(proofType_NONE);
                bytes32 id = oraclize_query(config_roll_cooldown, "URL", "", config_rolling_gas_limit);
                _rolling_query[id] = true;
            } else {
                //no players
                emit NoPlayersError();
            }
        }
    }

    /**
        @dev Places a bet on the current roll with using internal wallet ETH
        Cant be called when paused
        @param amount Amount to bet in Wei
        @param expected_value : integer from 2 to 99
        @param is_up : true if the expected price change is positive, false overwise
    */
    function betFromInternalWallet(uint256 amount, uint8 expected_value, bool is_up) public 
    whenNotPaused() {
        require(balanceOf[msg.sender] >= amount, "Not enough to bet the specified amount");
        require(expected_value > 1 && expected_value < 100,"Expected value must be in the range of 2 to 99");
        require(amount <= config_max_bet,"Bet too high");
        require(amount >= config_min_bet,"Bet too low");

        Roll storage roll = rolls[current_roll]; 
        Bet storage bet = roll.bets[msg.sender];

        //the bet structure must be by default at this point
        require(bet.amount == 0, "Already placed a bet");

        bet.amount = amount;
        bet.value = expected_value;
        bet.is_up = is_up;

        //compute max winnings
        uint256 win = _computeRollWithEdge(bet);
        uint256 bonus = bet.amount.mul(config_bonus_mult).div(1000);
        //check that the current pool is high enough for this kind of bet
        uint256 adjustedPool = pool / 100 * config_percent_pool;
        require(adjustedPool >= win.add(bonus),"Not enough in pool for this bet");
        //remove the bet amount from the users internal wallet
        balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
        //add the bet amount to the pool
        roll.pool = roll.pool.add(bet.amount);

        emit BetPlaced(current_roll, amount, msg.sender, expected_value, is_up? 1 : 0);

        //if cooled down, roll now
        if(latest_roll + config_roll_cooldown <= block.timestamp) {
            newRoll();
        }
    }

    /**
        @dev Allows to place a bet on the current roll with paid ETH
        @param expected_value : integer from 2 to 99
        @param is_up : true if the expected price change is positive, false overwise
    */
    function placeBet(uint8 expected_value, bool is_up) external payable {
        //add to internal wallet 
        balanceOf[msg.sender] = balanceOf[msg.sender].add(msg.value);
        //place a bet using internal wallet
        betFromInternalWallet(msg.value, expected_value, is_up);
    }

    /**
        @dev Allows to withdraw an amount from callers internal wallet
        @param amount Amount to withdraw in Wei
    */
    function withdrawWallet(uint256 amount) external
    {
        require(balanceOf[msg.sender] >= amount, "Not enough funds");
        balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
        msg.sender.transfer(amount);
    }

    /**
        @dev Allows a user to add ETH directly to his internal wallet
    */
    function creditWallet() external payable
    {
        balanceOf[msg.sender] = balanceOf[msg.sender].add(msg.value);
    }

    /**
        @dev Allows to claim the winnings from a roll round
        @param round Round number of the roll to claim from
    */
    function claim(uint256 round) external {
        Roll storage roll = rolls[round]; 
        Bet storage bet = roll.bets[msg.sender];
        //bettors have a non zero value bet
        require(bet.value > 0,"not a bettor");

        //handle refunding if contract isnt in the DONE or REFUND state after the refund delay is passed
        //also prevent refunding not started rolls
        if(roll.state != State.DONE && roll.state != State.REFUND && roll.state != State.READY) {
            //allow refund after the delay has passed
            bool forced_refund = roll.timestamp + config_refund_delay < now;
            if(forced_refund) {
                roll.state = State.REFUND;
            }
        }
        
        //handle payments from refunded rolls
        if(roll.state == State.REFUND) {
            //bets are deleted on refund, so bet.amount should be non zero only BEFORE refund
            require(bet.amount > 0, "Already refunded");
            //increase the internal balance of this user by the bet amount
            balanceOf[msg.sender] = balanceOf[msg.sender].add(bet.amount);
            //delete the bet from the bets mapping of this roll
            delete(roll.bets[msg.sender]);
        } else {
            //extract the users random value by using the random source and users address
            //this should guarantee diff results for every user even though the random seed is the same
            uint randomNumber = uint(keccak256(abi.encodePacked(roll.result_rngseed, msg.sender))) % 100 + 1;
            bool guessed_random = randomNumber < bet.value;
            bool guessed_pricemov = bet.is_up == roll.is_up; 
            require(guessed_random || guessed_pricemov, "No winnings to claim");
            //compute how much to pay
            uint256 to_pay = 0;
            //compute house edge on his bet
            uint256 edge = _computeRollEdge(bet);
            if(guessed_random) {
                //the user guessed right, he wins the roll formula minus house edge
                to_pay = to_pay.add(_computeRollWin(bet).sub(edge));
            }
            if(guessed_pricemov) {
                //the user guessed the price movement, add the bonus
                to_pay = to_pay.add(bet.amount.mul(config_bonus_mult).div(1000));
            }
            // credit the users internal wallet
            balanceOf[msg.sender] = balanceOf[msg.sender].add(to_pay);
            // remove the paid amount from available pool
            pool = pool.sub(to_pay);
            // edge goes to house
            house = house.add(edge);

            emit RollClaimed(round,msg.sender,to_pay);
        }
    }

    /// @dev fallback for accepting funding and replenish the pool
    function () external payable {
        //used for provisionning pool
        pool = pool.add(msg.value);
    }

    /// @dev only test!!!!!!!! REMOVE FOR MAINNET
    function destroy() external
    onlyOwner() {
        // send the contracts balance to the caller
        selfdestruct(msg.sender);
    }

    /// @dev return Current internal wallet balance of the caller in wei
    function userBalance() view external returns (uint256) {
        return balanceOf[msg.sender];
    }

    // the callback function is called by Oraclize when the result is ready
    // the oraclize_randomDS_proofVerify modifier prevents an invalid proof to execute this function code:
    // the proof validity is fully verified on-chain
    function __callback(bytes32 _queryId, string memory _result, bytes memory _proof) public
    { 
        require (msg.sender == oraclize_cbAddress(), "auth failed");
        require(!_processed[_queryId], "Query has already been processed!");
        _processed[_queryId] = true;

        if (_rolling_query[_queryId]) {
            newRoll();
        } else {
            //fetch the roll associated with this query
            uint256 roll_id = _query_to_roll[_queryId];
            require(roll_id > 0, "Invalid _queryId");
            Roll storage roll = rolls[roll_id];
            //identify if this is a query for random value, or prices check
            if(_queryId == roll.query_rng) {
                //verify proof of random on chain
                if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) {
                    // the proof verification has failed, the roll goes to refund
                    roll.state = State.REFUND;
                    emit RollRefunded(roll_id);
                } else {
                    // proof ok, save the bytes value
                    roll.result_rngseed = bytes(_result)[0];
                    // increment state to show we're waiting for the next queries now
                    roll.state = State(uint(roll.state) + 1);
                }
            } else if(_queryId == roll.query_price1) {
                //parse the result string for the precision normalized value
                roll.result_price1 = _stringToUintNormalize(_result);
                //(roll.result_price1, roll.result_timestamp1) = _extract(_result);
                // increment state to show we're waiting for the next queries now
                roll.state = State(uint(roll.state) + 1);
            } else if(_queryId == roll.query_price2) {
                //parse the result string for the precision normalized value
                roll.result_price2 = _stringToUintNormalize(_result);
                //(roll.result_price2, roll.result_timestamp2) = _extract(_result);
                // increment state to show we're waiting for the next queries now
                roll.state = State(uint(roll.state) + 1);
            } else {

                //fatal error
                roll.state = State.REFUND;
                emit RollRefunded(roll_id);
            }
            //if the roll state has been incremented enough (3 times), we've finished
            if(roll.state == State.DONE) {
                //check price change
                roll.is_up = roll.result_price1 < roll.result_price2;
                //add the rolls pool into contracts pool
                //from now on this amount of ETH can be withdrawn from the contract!
                pool = pool.add(roll.pool);
                emit RollEnded(roll_id, roll.result_price1, roll.result_price2, roll.result_rngseed);
            }
        }
        
    }

    // the callback function is called by Oraclize when the result is ready
    function __callback(bytes32 _queryId, string memory _result) public
    { 
        require (msg.sender == oraclize_cbAddress(), "auth failed");
        require(!_processed[_queryId], "Query has already been processed!");
        _processed[_queryId] = true;
        newRoll();
    }

    /**
        @dev Sends the required amount to the cut address
        @param amount Amount to withdraw from the house in Wei
    */
    function withdrawHouse(uint256 amount) external
    onlyOwner() {
        require(house >= amount, "Cant withdraw that much");
        house = house.sub(amount);
        config_cut_address.transfer(amount);
    }

    /** 
        @dev Sets the house edge
        @param new_edge Edge expressed in /1000
    */
    function setHouseEdge(uint256 new_edge) external
    onlyOwner() {
        require(new_edge <= 50,"max 5%");
        config_house_edge = new_edge;
    }

    /** 
        @dev Sets the bonus when a user guesses the price change
        @param new_bonus Bonus expressed in /1000
    */
    function setBonus(uint256 new_bonus) external
    onlyOwner() {
        require(new_bonus <= 500,"max 50%");
        config_bonus_mult = new_bonus;
    }

    /** 
        @dev Sets the % of the pool to be used for max bet computation
        @param new_percent Percent expressed in /100
    */
    function setPercentPool(uint256 new_percent) external
    onlyOwner() {
        require(new_percent <= 100,"max 100%");
        config_percent_pool = new_percent;
    }

    /**
        @dev Address of destination for the house edge
        @param new_desination address to send eth to
    */
    function setCutDestination(address payable new_desination) external
    onlyOwner() {
        config_cut_address = new_desination;
    }

    /**
        @dev Sets the cooldown between 2 bets
        A new roll cant be executed if the required cooldown delay since the last roll hasnt passed
        @param new_cooldown Cooldown in seconds
    */
    function setCooldown(uint256 new_cooldown) external
    onlyOwner() {
        require(new_cooldown >= 1 minutes,"Minimum is 1 minute");
        config_roll_cooldown = new_cooldown;
    }

    /**
        @dev Sets the minimum allowed bet
        @param new_minbet Minimum allowed bet in Wei
    */
    function setMinBet(uint256 new_minbet) external
    onlyOwner() {
        require(new_minbet > 0, "Must be greater than zero");
        config_min_bet = new_minbet;
    }

    /**
        @dev Sets the maximum allowed bet
        @param new_maxbet Maximum allowed bet in Wei
    */
    function setMaxBet(uint256 new_maxbet) external
    onlyOwner() {
        require(new_maxbet > 0, "Must be greater than zero");
        config_max_bet = new_maxbet;
    }

    /**
        @dev Sets the gas sent to oraclize for callback on a single price check
        @param new_gaslimit Gas in wei
    */
    function setGasLimit(uint256 new_gaslimit) external
    onlyOwner() {
        config_gas_limit = new_gaslimit;
    }

    /**
        @dev Sets the gas sent to oraclize for callback on the random value
        @param new_gaslimit Gas in wei
    */
    function setRandomGasLimit(uint256 new_gaslimit) external
    onlyOwner() {
        config_random_gas_limit = new_gaslimit;
    }

    /**
        @dev Sets the gas sent to oraclize for callback for the rolling scheduling
        @param new_gaslimit Gas in wei
    */
    function setRollingGasLimit(uint256 new_gaslimit) external
    onlyOwner() {
        config_rolling_gas_limit = new_gaslimit;
    }

    /**
        @dev Sets the gas price to be used by oraclize
        @param new_gasprice Gas in wei
    */
    function setGasPrice(uint256 new_gasprice) external
    onlyOwner() {
        oraclize_setCustomGasPrice(config_gasprice);
        config_gasprice = new_gasprice;
    }

    /**
        @dev Sets the delay between oraclize price request calls
        @param new_delay Delay in seconds
    */
    function setPriceCheckDelay(uint256 new_delay) external
    onlyOwner() {
        require(new_delay < 60 days,"Oraclize delay is maximum 60 days");
        config_pricecheck_delay = new_delay;
    }

    /**
        @dev Increments the current roll and rotates the coin
        After this call, all bets go to the new roll pool
    */
    function _generateRoll() internal {
        current_roll = current_roll.add(1);
        current_coin = CoinRotation((uint(current_coin)+1)%coin_count);
        latest_roll = block.timestamp;

        emit NewRoll(current_roll);
    }

    /**
        @dev returns current oraclize fees in Wei 
    */
    function _checkPrice() internal returns (uint256) {
        //TLSNotary proof for URLs
        oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
        uint256 call_price = oraclize_getPrice("URL", config_gas_limit) * 2; //2 calls
        oraclize_setProof(proofType_Ledger);
        call_price = call_price.add(oraclize_getPrice("Random", config_random_gas_limit)); //1 call

        oraclize_setProof(proofType_NONE);
        return call_price.add(oraclize_getPrice("URL", config_rolling_gas_limit)); //1 call
    }

     /**
        @dev Computes the total winnings of a bet before applying the house edge
        @param bet a potentially winning bet
    */
    function _computeRollWin(Bet memory bet) internal pure returns (uint256) {
        uint256 odds = uint256(bet.value) - 1;
        return (((bet.amount * (100-odds)) / odds + bet.amount));
    }

     /**
        @dev Computes the house edge from a winning bet
        @param bet a potentially winning bet
    */
    function _computeRollEdge(Bet memory bet) internal view returns (uint256) {
        return _computeRollWin(bet) / 1000 * config_house_edge;
    }

    /**
        @dev Computes the total winnings of a bet MINUS house edge
        @param bet a potentially winning bet
    */
    function _computeRollWithEdge(Bet memory bet) internal view returns (uint256) {
        uint256 odds = uint256(bet.value) - 1;
        return ((bet.amount * (100-odds)) / odds + bet.amount) / 1000 * (1000 - config_house_edge);
    }

    /*function _extract(string memory entry) internal pure returns (uint256, uint256) {
        strings.slice memory sl = entry.toSlice();
        strings.slice memory delim = "\"".toSlice();
        string[] memory parts = new string[](4);
        for(uint i = 0; i < parts.length; i++) {
            parts[i] = sl.split(delim).toString();
        }

        return (_stringToUintNormalize(parts[1]), _stringToUintNormalize(parts[3]));
    }*/
    
    //ETHORSE CODE
    // utility function to convert string to integer with precision consideration
    function _stringToUintNormalize(string memory s) internal pure returns (uint result) {
        uint p = 2;
        bool precision = false;
        bytes memory b = bytes(s);
        uint i;
        result = 0;
        for (i = 0; i < b.length; i++) {
            if (precision) {p = p-1;}
            if (uint8(b[i]) == 46){precision = true;}
            uint c = uint8(b[i]);
            if (c >= 48 && c <= 57) {result = result * 10 + (c - 48);}
            if (precision && p == 0){return result;}
        }
        while (p!=0) {
            result = result*10;
            p = p-1;
        }
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"latest_roll","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"current_coin","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"query_stringETH","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"new_bonus","type":"uint256"}],"name":"setBonus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"new_gaslimit","type":"uint256"}],"name":"setRandomGasLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"pool","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdrawHouse","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_queryId","type":"bytes32"},{"name":"_result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"expected_value","type":"uint8"},{"name":"is_up","type":"bool"}],"name":"placeBet","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"round","type":"uint256"}],"name":"claim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_queryId","type":"bytes32"},{"name":"_result","type":"string"},{"name":"_proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"config_bonus_mult","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"current_roll","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"new_cooldown","type":"uint256"}],"name":"setCooldown","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"config_refund_delay","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"config_random_gas_limit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"config_pricecheck_delay","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"config_house_edge","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"rolls","outputs":[{"name":"query_rng","type":"bytes32"},{"name":"query_price1","type":"bytes32"},{"name":"query_price2","type":"bytes32"},{"name":"result_price1","type":"uint256"},{"name":"result_price2","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"pool","type":"uint256"},{"name":"state","type":"uint8"},{"name":"coin","type":"uint8"},{"name":"is_up","type":"bool"},{"name":"result_rngseed","type":"bytes1"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"new_edge","type":"uint256"}],"name":"setHouseEdge","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"newRoll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"},{"name":"expected_value","type":"uint8"},{"name":"is_up","type":"bool"}],"name":"betFromInternalWallet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"new_maxbet","type":"uint256"}],"name":"setMaxBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"new_minbet","type":"uint256"}],"name":"setMinBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"config_max_bet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"query_stringLTC","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"config_roll_cooldown","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"config_gasprice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"config_percent_pool","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"new_desination","type":"address"}],"name":"setCutDestination","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"new_gaslimit","type":"uint256"}],"name":"setRollingGasLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"creditWallet","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdrawWallet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"userBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"new_gasprice","type":"uint256"}],"name":"setGasPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"config_gas_limit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"query_stringBTC","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"new_percent","type":"uint256"}],"name":"setPercentPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"config_min_bet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"new_gaslimit","type":"uint256"}],"name":"setGasLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"config_rolling_gas_limit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"new_delay","type":"uint256"}],"name":"setPriceCheckDelay","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"house","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"round","type":"uint256"}],"name":"Rolling","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"round","type":"uint256"}],"name":"NewRoll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"round","type":"uint256"},{"indexed":false,"name":"start_price","type":"uint256"},{"indexed":false,"name":"end_price","type":"uint256"},{"indexed":false,"name":"seed","type":"bytes1"}],"name":"RollEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"round","type":"uint256"}],"name":"RollRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"round","type":"uint256"},{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RollClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"round","type":"uint256"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"expected_value","type":"uint8"},{"indexed":false,"name":"is_up","type":"uint8"}],"name":"BetPlaced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"OraclizeError","type":"event"},{"anonymous":false,"inputs":[],"name":"NoPlayersError","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6080604052603c6007819055610bb86008556202710060095562030d40600a55620aae60600b556404a817c800600c5566470de4df820000600d5568056bc75e2d63100000600e556014600f819055604b601055603260115560129190915560138054600160a060020a03191673a54741f7fe21689b59bd7eacbf3a2947cd3f3bd41790556000908190556015556016805460ff19169055348015620000a457600080fd5b50620000b93364010000000062000127810204565b60068054600160a860020a0319166101003381029190911791829055604051600160a060020a039190920416906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36200012164010000000062000179810204565b620002cd565b62000142600582640100000000620048506200022082021704565b604051600160a060020a038216907f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f890600090a250565b6014546200019790600164010000000062000d1f6200027b82021704565b60145560165460039060ff166002811115620001af57fe5b600101811515620001bc57fe5b066002811115620001c957fe5b6016805460ff19166001836002811115620001e057fe5b02179055504260155560145460408051918252517fb4267207f21a1858b0724dfba74816419152c88804d2b6276e5c32f6cd47c74a9181900360200190a1565b600160a060020a03811615156200023657600080fd5b6200024b828264010000000062000295810204565b156200025657600080fd5b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b6000828201838110156200028e57600080fd5b9392505050565b6000600160a060020a0382161515620002ad57600080fd5b50600160a060020a03166000908152602091909152604090205460ff1690565b615ed680620002dd6000396000f3fe6080604052600436106103545760003560e060020a900480637de36c97116101ca578063b43d1730116100fb578063da47fc2f11610099578063f2fde38b11610073578063f2fde38b14610c98578063fa86fe2c14610ccb578063fb8512f714610ce0578063ff9b3acf14610d0a57610354565b8063da47fc2f14610c2f578063deedc5c514610c59578063ee7d72b414610c6e57610354565b8063bf152765116100d5578063bf15276514610bc6578063bf1fe42014610bdb578063d316401314610c05578063d8a3f00f14610c1a57610354565b8063b43d173014610b6a578063b8b069fc14610b94578063be87ab3f14610b9c57610354565b80638da5cb5b11610168578063987ae15411610142578063987ae15414610af85780639ad2d37714610b0d578063a4d02bf214610b22578063aad7472214610b3757610354565b80638da5cb5b14610a9d5780638f32d59b14610ace57806390e2c9dd14610ae357610354565b80638456cb59116101a45780638456cb5914610a1f578063881eff1e14610a3457806388ea41b914610a5e5780638b1dc09e14610a8857610354565b80637de36c971461099c57806382dc1ec4146109d757806383197ef014610a0a57610354565b806346fbf68e116102a45780635d10c029116102425780636ef8d66d1161021c5780636ef8d66d1461092a5780636fabd2651461093f57806370a0823114610954578063715018a61461098757610354565b80635d10c0291461083b5780635d69f16c146108505780636cd0f1021461090057610354565b8063550098991161027e57806355009899146107e757806357b6702f146107fc5780635ad51f68146108115780635c975abb1461082657610354565b806346fbf68e146107615780634e0c12f0146107a85780634fc3f41a146107bd57610354565b80632321841111610311578063379607f5116102eb578063379607f5146105ce57806338bbfa50146105f85780633f4ba83a14610737578063402684121461074c57610354565b806323218411146104c357806327dc297e146104ed5780632ed1317c146105a657610354565b8063022b02bc1461036c57806306792c071461039357806309108570146103cc5780630b98f975146104585780631361b3b21461048457806316f0115b146104ae575b601854610367903463ffffffff610d1f16565b601855005b34801561037857600080fd5b50610381610d3a565b60405190815260200160405180910390f35b34801561039f57600080fd5b506103a8610d40565b604051808260028111156103b857fe5b60ff16815260200191505060405180910390f35b3480156103d857600080fd5b506103e1610d49565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561041d578082015183820152602001610405565b50505050905090810190601f16801561044a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561046457600080fd5b506104826004803603602081101561047b57600080fd5b5035610d66565b005b34801561049057600080fd5b50610482600480360360208110156104a757600080fd5b5035610dd7565b3480156104ba57600080fd5b50610381610def565b3480156104cf57600080fd5b50610482600480360360208110156104e657600080fd5b5035610df5565b3480156104f957600080fd5b506104826004803603604081101561051057600080fd5b8135919081019060408101602082013564010000000081111561053257600080fd5b82018360208201111561054457600080fd5b8035906020019184600183028401116401000000008311171561056657600080fd5b91908080601f0160208091040260200160405190810160405281815292919060208401838380828437600092019190915250929550610eb4945050505050565b610482600480360360408110156105bc57600080fd5b5060ff81351690602001351515610f93565b3480156105da57600080fd5b50610482600480360360208110156105f157600080fd5b5035610fd0565b34801561060457600080fd5b506104826004803603606081101561061b57600080fd5b8135919081019060408101602082013564010000000081111561063d57600080fd5b82018360208201111561064f57600080fd5b8035906020019184600183028401116401000000008311171561067157600080fd5b91908080601f016020809104026020016040519081016040528181529291906020840183838082843760009201919091525092959493602081019350359150506401000000008111156106c357600080fd5b8201836020820111156106d557600080fd5b803590602001918460018302840111640100000000831117156106f757600080fd5b91908080601f0160208091040260200160405190810160405281815292919060208401838380828437600092019190915250929550611429945050505050565b34801561074357600080fd5b506104826117ec565b34801561075857600080fd5b5061038161185a565b34801561076d57600080fd5b506107946004803603602081101561078457600080fd5b5035600160a060020a0316611860565b604051901515815260200160405180910390f35b3480156107b457600080fd5b5061038161187b565b3480156107c957600080fd5b50610482600480360360208110156107e057600080fd5b5035611881565b3480156107f357600080fd5b506103816118f1565b34801561080857600080fd5b506103816118f7565b34801561081d57600080fd5b506103816118fd565b34801561083257600080fd5b50610794611903565b34801561084757600080fd5b5061038161190d565b34801561085c57600080fd5b5061087a6004803603602081101561087357600080fd5b5035611913565b604051808c81526020018b81526020018a81526020018981526020018881526020018781526020018681526020018560058111156108b457fe5b60ff1681526020018460028111156108c857fe5b60ff168152921515602084015250600160f860020a031916604080830191909152606090910199509750505050505050505180910390f35b34801561090c57600080fd5b506104826004803603602081101561092357600080fd5b503561197a565b34801561093657600080fd5b506104826119ea565b34801561094b57600080fd5b506104826119f5565b34801561096057600080fd5b506103816004803603602081101561097757600080fd5b5035600160a060020a0316611dca565b34801561099357600080fd5b50610482611dde565b3480156109a857600080fd5b50610482600480360360608110156109bf57600080fd5b5080359060ff60208201351690604001351515611e51565b3480156109e357600080fd5b50610482600480360360208110156109fa57600080fd5b5035600160a060020a031661221b565b348015610a1657600080fd5b50610482612238565b348015610a2b57600080fd5b5061048261224e565b348015610a4057600080fd5b5061048260048036036020811015610a5757600080fd5b50356122be565b348015610a6a57600080fd5b5061048260048036036020811015610a8157600080fd5b503561232d565b348015610a9457600080fd5b5061038161239c565b348015610aa957600080fd5b50610ab26123a2565b604051600160a060020a03909116815260200160405180910390f35b348015610ada57600080fd5b506107946123b6565b348015610aef57600080fd5b506103e16123cc565b348015610b0457600080fd5b506103816123e9565b348015610b1957600080fd5b506103816123ef565b348015610b2e57600080fd5b506103816123f5565b348015610b4357600080fd5b5061048260048036036020811015610b5a57600080fd5b5035600160a060020a03166123fb565b348015610b7657600080fd5b5061048260048036036020811015610b8d57600080fd5b5035612430565b610482612448565b348015610ba857600080fd5b5061048260048036036020811015610bbf57600080fd5b503561247c565b348015610bd257600080fd5b50610381612543565b348015610be757600080fd5b5061048260048036036020811015610bfe57600080fd5b5035612558565b348015610c1157600080fd5b5061038161257b565b348015610c2657600080fd5b506103e1612581565b348015610c3b57600080fd5b5061048260048036036020811015610c5257600080fd5b503561259e565b348015610c6557600080fd5b5061038161260e565b348015610c7a57600080fd5b5061048260048036036020811015610c9157600080fd5b5035612614565b348015610ca457600080fd5b5061048260048036036020811015610cbb57600080fd5b5035600160a060020a031661262c565b348015610cd757600080fd5b50610381612648565b348015610cec57600080fd5b5061048260048036036020811015610d0357600080fd5b503561264e565b348015610d1657600080fd5b506103816126aa565b600082820183811015610d3157600080fd5b90505b92915050565b60155481565b60165460ff1681565b610180604051908101604052610149808252615b92602083013981565b610d6e6123b6565b1515610d7957600080fd5b6101f4811115610dd25760405160e560020a62461bcd02815260206004820152600760248201527f6d61782035302500000000000000000000000000000000000000000000000000604482015260640160405180910390fd5b601055565b610ddf6123b6565b1515610dea57600080fd5b600a55565b60185481565b610dfd6123b6565b1515610e0857600080fd5b601754811115610e615760405160e560020a62461bcd02815260206004820152601760248201527f43616e742077697468647261772074686174206d756368000000000000000000604482015260640160405180910390fd5b601754610e74908263ffffffff6126b016565b601755601354600160a060020a031681156108fc0282604051600060405180830381858888f19350505050158015610eb0573d6000803e3d6000fd5b5050565b610ebc6126c5565b600160a060020a03163314610f1a5760405160e560020a62461bcd02815260206004820152600b60248201527f61757468206661696c6564000000000000000000000000000000000000000000604482015260640160405180910390fd5b6000828152601b602052604090205460ff1615610f6b5760405160e560020a62461bcd028152600401808060200182810382526021815260200180615cdb6021913960400191505060405180910390fd5b6000828152601b60205260019060409020805460ff1916911515919091179055610eb06119f5565b336000908152601d602052610fb590349060409020549063ffffffff610d1f16565b336000908152601d6020526040902055610eb0348383611e51565b600081815260196020526040812033600090815260088201602052909150604081206001810154909150600060ff909116116110555760405160e560020a62461bcd02815260206004820152600c60248201527f6e6f74206120626574746f720000000000000000000000000000000000000000604482015260640160405180910390fd5b6004600783015460ff16600581111561106a57fe5b1415801561108b57506005600783015460ff16600581111561108857fe5b14155b80156110aa57506000600783015460ff1660058111156110a757fe5b14155b156110d35760085460058301544291011080156110d15760078301805460ff191660051790555b505b6005600783015460ff1660058111156110e857fe5b141561119f5780546000106111465760405160e560020a62461bcd02815260206004820152601060248201527f416c726561647920726566756e64656400000000000000000000000000000000604482015260640160405180910390fd5b8054336000908152601d602052611169919060409020549063ffffffff610d1f16565b336000908152601d6020526040902055336000908152600883016020526040902060008155600101805461ffff19169055611424565b60078201546000906064906301000000900460f860020a0233604051600160f860020a0319929092166020830152600160a060020a03166c010000000000000000000000000260218201526035016040516020818303038152906040528051906020012081151561120c57fe5b60018481015460078701549390920601925060ff808216841092620100009004811615156101009092041615151481806112435750805b15156112985760405160e560020a62461bcd02815260206004820152601460248201527f4e6f2077696e6e696e677320746f20636c61696d000000000000000000000000604482015260640160405180910390fd5b6000806112d586606060405190810160409081528254825260019092015460ff808216602084015261010090910416151591810191909152612897565b9050831561133a5761133761132a8261131e89606060405190810160409081528254825260019092015460ff8082166020840152610100909104161515918101919091526128b9565b9063ffffffff6126b016565b839063ffffffff610d1f16565b91505b82156113715761136e61132a6103e86113626010548a600001546128e690919063ffffffff16565b9063ffffffff61291116565b91505b336000908152601d60205261139390839060409020549063ffffffff610d1f16565b336000908152601d60205260409020556018546113b6908363ffffffff6126b016565b6018556017546113cc908263ffffffff610d1f16565b6017557f170c93f55dab07b2a0c856acad14fbb479fc97d6c3f489faf09b5f01c1575d3e883384604051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a150505050505b505050565b6114316126c5565b600160a060020a0316331461148f5760405160e560020a62461bcd02815260206004820152600b60248201527f61757468206661696c6564000000000000000000000000000000000000000000604482015260640160405180910390fd5b6000838152601b602052604090205460ff16156114e05760405160e560020a62461bcd028152600401808060200182810382526021815260200180615cdb6021913960400191505060405180910390fd5b6000838152601b60205260019060409020805460ff19169115159190911790556000838152601c602052604090205460ff16156115245761151f6119f5565b611424565b6000838152601a602052604081205490506000811161158c5760405160e560020a62461bcd02815260206004820152601060248201527f496e76616c6964205f7175657279496400000000000000000000000000000000604482015260640160405180910390fd5b6000818152601960205260408120805490915085141561167d576115b1858585612935565b60ff16156116005760078101805460ff191660051790557f796cfdf016e01ffdff99dbe8ce27df476b06d0fae2ac92ec3889b6008219ed528260405190815260200160405180910390a1611678565b8360008151811061160d57fe5b016020015160078201805460f860020a9283900483029290920463010000000263ff00000019909216919091179081905560ff16600581111561164c57fe5b600101600581111561165a57fe5b60078201805460ff1916600183600581111561167257fe5b02179055505b61171a565b80600101548514156116aa5761169284612a4c565b6003820155600781015460ff16600581111561164c57fe5b80600201548514156116d7576116bf84612a4c565b6004820155600781015460ff16600581111561164c57fe5b60078101805460ff191660051790557f796cfdf016e01ffdff99dbe8ce27df476b06d0fae2ac92ec3889b6008219ed528260405190815260200160405180910390a15b6004600782015460ff16600581111561172f57fe5b14156117e5576004810154600382015460078301805462ff00001916929091106201000002919091179055600681015460185461176b91610d1f565b6018556003810154600482015460078301547f648116b2ba76303d563d7ea97046c4a28ec16be5f91a1cbe2298516e9834f22f92859290916301000000900460f860020a026040519384526020840192909252604080840191909152600160f860020a031990911660608301526080909101905180910390a15b5050505050565b6117f533611860565b151561180057600080fd5b60065460ff16151561181157600080fd5b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051600160a060020a03909116815260200160405180910390a1565b60105481565b600061187360058363ffffffff612b3316565b90505b919050565b60145481565b6118896123b6565b151561189457600080fd5b603c8110156118ec5760405160e560020a62461bcd02815260206004820152601360248201527f4d696e696d756d2069732031206d696e75746500000000000000000000000000604482015260640160405180910390fd5b600755565b60085481565b600a5481565b60125481565b60065460ff165b90565b600f5481565b601960205280600052604060002080546001820154600283015460038401546004850154600586015460068701546007909701549597509395929491939092909160ff80821691610100810482169162010000820416906301000000900460f860020a028b565b6119826123b6565b151561198d57600080fd5b60328111156119e55760405160e560020a62461bcd02815260206004820152600660248201527f6d61782035250000000000000000000000000000000000000000000000000000604482015260640160405180910390fd5b600f55565b6119f333612b6d565b565b60065460ff1615611a0557600080fd5b6007546015544291011115611a635760405160e560020a62461bcd02815260206004820152601460248201527f726f6c6c20697320636f6f6c696e6720646f776e000000000000000000000000604482015260640160405180910390fd5b6000611a6d612bb7565b90503031811115611ab0577f0510c169028b6c6e93e31f93b1b642b756cea80cc1966887b5c8f0b93d3d5b688160405190815260200160405180910390a1611dc7565b60145460009081526019602052604081209050600081600601541115611d99576060600060165460ff166002811115611ae557fe5b1415611b0c57610180604051908101604052610149808252615b9260208301399050611b63565b600160165460ff166002811115611b1f57fe5b1415611b46576101806040519081016040526101498082526159fa60208301399050611b63565b610180604051908101604052610149808252615d62602083013990505b611b8c7f1100000000000000000000000000000000000000000000000000000000000000612cf4565b611bcf600060408051908101604052600681527f6e6573746564000000000000000000000000000000000000000000000000000060208201526009548490612eb3565b6001830155601254611c199060408051908101604052600681527f6e6573746564000000000000000000000000000000000000000000000000000060208201526009548490612eb3565b6002830155611c477f3000000000000000000000000000000000000000000000000000000000000000612cf4565b611c5660006001600a5461327f565b825542600583015560078201805460ff191660011780825560165460ff16919061ff001916610100836002811115611c8a57fe5b021790555060145482546000908152601a602052604090205560145460018301546000908152601a602052604090205560145460028301546000908152601a60205260409020556014547fe86c6fb9a82a2c1fd4c6c98a2fe03844f019514b0cfe8dfbdf076c61f124c0d49060405190815260200160405180910390a1611d0f61375b565b611d196000612cf4565b6000611d6e6007546040805190810160405280600381526020017f55524c0000000000000000000000000000000000000000000000000000000000815250602060405190810160405260008152600b54612eb3565b6000818152601c60205290915060019060409020805460ff191691151591909117905550610eb09050565b7f64b0891bd1fba8fc913477242b6d466587cbb9008bc19fbd0406ece6624ef87760405160405180910390a1505b50565b601d60205280600052604060002054905081565b611de66123b6565b1515611df157600080fd5b6006546000906101009004600160a060020a03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36006805474ffffffffffffffffffffffffffffffffffffffff0019169055565b60065460ff1615611e6157600080fd5b336000908152601d602052839060409020541015611eb35760405160e560020a62461bcd028152600401808060200182810382526026815260200180615cfc6026913960400191505060405180910390fd5b60018260ff16118015611ec9575060648260ff16105b1515611f095760405160e560020a62461bcd02815260040180806020018281038252602e815260200180615b43602e913960400191505060405180910390fd5b600e54831115611f625760405160e560020a62461bcd02815260206004820152600c60248201527f42657420746f6f20686967680000000000000000000000000000000000000000604482015260640160405180910390fd5b600d54831015611fbb5760405160e560020a62461bcd02815260206004820152600b60248201527f42657420746f6f206c6f77000000000000000000000000000000000000000000604482015260640160405180910390fd5b601454600090815260196020526040812033600090815260088201602052909150604081208054909150156120395760405160e560020a62461bcd02815260206004820152601460248201527f416c726561647920706c61636564206120626574000000000000000000000000604482015260640160405180910390fd5b84815560018101805460ff191660ff86161761ff00191661010085151502179055600061209682606060405190810160409081528254825260019092015460ff8082166020840152610100909104161515918101919091526137f5565b905060006120b96103e861136260105486600001546128e690919063ffffffff16565b9050600060115460646018548115156120ce57fe5b040290506120e2838363ffffffff610d1f16565b8110156121385760405160e560020a62461bcd02815260206004820152601f60248201527f4e6f7420656e6f75676820696e20706f6f6c20666f7220746869732062657400604482015260640160405180910390fd5b336000908152601d60205261215a90899060409020549063ffffffff6126b016565b336000908152601d6020526040902055835460068601546121809163ffffffff610d1f16565b60068601556014547fa03a715f8e6fbcac20e92a38c1169f81b49b105441690f1e78ed31b17aafba9f9089338a8a6121b95760006121bc565b60015b6040519485526020850193909352600160a060020a0390911660408085019190915260ff91821660608501529116608083015260a0909101905180910390a160075460155442910111612211576122116119f5565b5050505050505050565b61222433611860565b151561222f57600080fd5b611dc78161383a565b6122406123b6565b151561224b57600080fd5b33ff5b61225733611860565b151561226257600080fd5b60065460ff161561227257600080fd5b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051600160a060020a03909116815260200160405180910390a1565b6122c66123b6565b15156122d157600080fd5b600081116123285760405160e560020a62461bcd02815260206004820152601960248201527f4d7573742062652067726561746572207468616e207a65726f00000000000000604482015260640160405180910390fd5b600e55565b6123356123b6565b151561234057600080fd5b600081116123975760405160e560020a62461bcd02815260206004820152601960248201527f4d7573742062652067726561746572207468616e207a65726f00000000000000604482015260640160405180910390fd5b600d55565b600e5481565b6006546101009004600160a060020a031690565b6006546101009004600160a060020a0316331490565b610180604051908101604052610149808252615d62602083013981565b60075481565b600c5481565b60115481565b6124036123b6565b151561240e57600080fd5b60138054600160a060020a031916600160a060020a0392909216919091179055565b6124386123b6565b151561244357600080fd5b600b55565b336000908152601d60205261246a90349060409020549063ffffffff610d1f16565b336000908152601d6020526040902055565b336000908152601d6020528190604090205410156124e35760405160e560020a62461bcd02815260206004820152601060248201527f4e6f7420656e6f7567682066756e647300000000000000000000000000000000604482015260640160405180910390fd5b336000908152601d60205261250590829060409020549063ffffffff6126b016565b336000908152601d60205260409020553381156108fc0282604051600060405180830381858888f19350505050158015610eb0573d6000803e3d6000fd5b336000908152601d6020526040812054905090565b6125606123b6565b151561256b57600080fd5b612576600c54613884565b600c55565b60095481565b6101806040519081016040526101498082526159fa602083013981565b6125a66123b6565b15156125b157600080fd5b60648111156126095760405160e560020a62461bcd02815260206004820152600860248201527f6d61782031303025000000000000000000000000000000000000000000000000604482015260640160405180910390fd5b601155565b600d5481565b61261c6123b6565b151561262757600080fd5b600955565b6126346123b6565b151561263f57600080fd5b611dc781613a26565b600b5481565b6126566123b6565b151561266157600080fd5b624f1a0081106126a55760405160e560020a62461bcd028152600401808060200182810382526021815260200180615b716021913960400191505060405180910390fd5b601255565b60175481565b6000828211156126bf57600080fd5b50900390565b600154600090600160a060020a031615806126f257506001546126f090600160a060020a0316613ab1565b155b15612703576127016000613ab5565b505b600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561274357600080fd5b505af1158015612757573d6000803e3d6000fd5b505050506040513d602081101561276d57600080fd5b810190808051600054600160a060020a03908116911614925061282191505057600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156127cd57600080fd5b505af11580156127e1573d6000803e3d6000fd5b505050506040513d60208110156127f757600080fd5b81019080805160008054600160a060020a031916600160a060020a03929092169190911790555050505b600054600160a060020a031663c281d19e6040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561285f57600080fd5b505afa158015612873573d6000803e3d6000fd5b505050506040513d602081101561288957600080fd5b810190808051935050505090565b6000600f546103e86128a8846128b9565b8115156128b157fe5b040292915050565b6000806001836020015160ff1603905082518160648190038551028115156128dd57fe5b04019392505050565b60008215156128f757506000610d34565b82820282848281151561290657fe5b0414610d3157600080fd5b600080821161291f57600080fd5b6000828481151561292c57fe5b04949350505050565b60008160008151811061294457fe5b016020015160f860020a900460f860020a02600160f860020a0319167f4c000000000000000000000000000000000000000000000000000000000000001415806129d657508160018151811061299657fe5b016020015160f860020a900460f860020a02600160f860020a0319167f500000000000000000000000000000000000000000000000000000000000000014155b80612a0a57506001826002815181106129eb57fe5b016020015160f860020a900460f860020a0260f860020a900460ff1614155b15612a1757506001612a45565b6000612a2c838686612a27613abf565b613b61565b9050801515612a3f576002915050612a45565b60009150505b9392505050565b600060028183815b8151811015612b12578215612a6a576001840393505b818181518110612a7657fe5b016020015160f860020a900460f860020a0260f860020a900460ff16602e1415612a9f57600192505b6000828281518110612aad57fe5b016020015160f860020a900460f860020a0260f860020a900460ff16905060308110158015612add575060398111155b15612aee576030810386600a020195505b838015612af9575084155b15612b0957506118769350505050565b50600101612a54565b5b8315612b2a5784600a029450600184039350612b13565b50505050919050565b6000600160a060020a0382161515612b4a57600080fd5b600160a060020a03821660009081526020849052604090205460ff169392505050565b612b7e60058263ffffffff61419b16565b80600160a060020a03167fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e60405160405180910390a250565b6000612be27f1100000000000000000000000000000000000000000000000000000000000000612cf4565b6000612c2360408051908101604052600381527f55524c000000000000000000000000000000000000000000000000000000000060208201526009546141f0565b6002029050612c517f3000000000000000000000000000000000000000000000000000000000000000612cf4565b612ca0612c9360408051908101604052600681527f52616e646f6d00000000000000000000000000000000000000000000000000006020820152600a546141f0565b829063ffffffff610d1f16565b9050612cac6000612cf4565b612cee612c9360408051908101604052600381527f55524c00000000000000000000000000000000000000000000000000000000006020820152600b546141f0565b91505090565b600154600160a060020a03161580612d1e5750600154612d1c90600160a060020a0316613ab1565b155b15612d2f57612d2d6000613ab5565b505b600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612d6f57600080fd5b505af1158015612d83573d6000803e3d6000fd5b505050506040513d6020811015612d9957600080fd5b810190808051600054600160a060020a039081169116149250612e4d91505057600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612df957600080fd5b505af1158015612e0d573d6000803e3d6000fd5b505050506040513d6020811015612e2357600080fd5b81019080805160008054600160a060020a031916600160a060020a03929092169190911790555050505b600054600160a060020a031663688dcfd78260405160e060020a63ffffffff8416028152600160f860020a03199091166004820152602401600060405180830381600087803b158015612e9f57600080fd5b505af11580156117e5573d6000803e3d6000fd5b600154600090600160a060020a03161580612ee05750600154612ede90600160a060020a0316613ab1565b155b15612ef157612eef6000613ab5565b505b600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612f3157600080fd5b505af1158015612f45573d6000803e3d6000fd5b505050506040513d6020811015612f5b57600080fd5b810190808051600054600160a060020a03908116911614925061300f91505057600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612fbb57600080fd5b505af1158015612fcf573d6000803e3d6000fd5b505050506040513d6020811015612fe557600080fd5b81019080805160008054600160a060020a031916600160a060020a03929092169190911790555050505b60008054600160a060020a0316632ef3accc86856040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015613078578082015183820152602001613060565b50505050905090810190601f1680156130a55780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1580156130c557600080fd5b505af11580156130d9573d6000803e3d6000fd5b505050506040513d60208110156130ef57600080fd5b8101908080519350505050670de0b6b3a76400003a840201811115613118575060009050613277565b600054600160a060020a031663c51be90f82888888886040518663ffffffff1660e060020a028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561318d578082015183820152602001613175565b50505050905090810190601f1680156131ba5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156131f05780820151838201526020016131d8565b50505050905090810190601f16801561321d5780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b15801561323f57600080fd5b505af1158015613253573d6000803e3d6000fd5b50505050506040513d602081101561326a57600080fd5b8101908080519450505050505b949350505050565b60008083118015613291575060208311155b151561329c57600080fd5b600a8402935060606001604051818152601f19601f83011681016020016040529080156132d0576020820181803883390190505b5090508360f860020a02816000815181106132e757fe5b906020010190600160f860020a031916908160001a90535060606020604051818152601f19601f830116810160200160405290801561332d576020820181803883390190505b50905060606020604051818152601f19601f830116810160200160405290801561335e576020820181803883390190505b509050600061336b61443b565b90506020835242411860014303401860208401526020825280602083015260606020604051818152601f19601f83011681016020016040529080156133b7576020820181803883390190505b50905088602082015260606008604051818152601f19601f83011681016020016040529080156133ee576020820181803883390190505b50905061340182601860088460006145d5565b5061340a615922565b608060405190810160405280878152602001888152602001868152602001848152509050600061346e60408051908101604052600681527f72616e646f6d00000000000000000000000000000000000000000000000000006020820152838c61461f565b905060606008604051818152601f19601f830116810160200160405290801561349e576020820181803883390190505b509050602084015160f860020a810460278301537e01000000000000000000000000000000000000000000000000000000000000810460268301537d0100000000000000000000000000000000000000000000000000000000008104602583015360e060020a810460248301537b01000000000000000000000000000000000000000000000000000000810460238301537a01000000000000000000000000000000000000000000000000000081046022830153790100000000000000000000000000000000000000000000000000810460218301537801000000000000000000000000000000000000000000000000810460208301535061374b82826020860151600287516040518082805190602001908083835b602083106135d35780518252601f1990920191602091820191016135b4565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015613615573d6000803e3d6000fd5b5050506040513d602081101561362a57600080fd5b8101908080519250505060408801516040516020018085805190602001908083835b6020831061366b5780518252601f19909201916020918201910161364c565b6001836020036101000a038019825116818451161790925250505091909101905084805190602001908083835b602083106136b75780518252601f199092019160209182019101613698565b6001836020036101000a038019825116818451161790925250505091909101848152602001905082805190602001908083835b602083106137095780518252601f1990920191602091820191016136ea565b6001836020036101000a03801982511681845116179092525050509190910195506040945050505050516020818303038152906040528051906020012061483b565b509b9a5050505050505050505050565b60145461376f90600163ffffffff610d1f16565b60145560165460039060ff16600281111561378657fe5b60010181151561379257fe5b06600281111561379e57fe5b6016805460ff191660018360028111156137b457fe5b0217905550426015556014547fb4267207f21a1858b0724dfba74816419152c88804d2b6276e5c32f6cd47c74a9060405190815260200160405180910390a1565b6000806001836020015160ff16039050600f546103e8036103e8846000015183606481900387510281151561382657fe5b040181151561383157fe5b04029392505050565b61384b60058263ffffffff61485016565b80600160a060020a03167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b600154600160a060020a031615806138ae57506001546138ac90600160a060020a0316613ab1565b155b156138bf576138bd6000613ab5565b505b600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156138ff57600080fd5b505af1158015613913573d6000803e3d6000fd5b505050506040513d602081101561392957600080fd5b810190808051600054600160a060020a0390811691161492506139dd91505057600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561398957600080fd5b505af115801561399d573d6000803e3d6000fd5b505050506040513d60208110156139b357600080fd5b81019080805160008054600160a060020a031916600160a060020a03929092169190911790555050505b600054600160a060020a031663ca6ad1e48260405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b158015612e9f57600080fd5b600160a060020a0381161515613a3b57600080fd5b600654600160a060020a03808316916101009004167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360068054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b3b90565b60006118736148a7565b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015613b575780601f10613b2c57610100808354040283529160200191613b57565b820191906000526020600020905b815481529060010190602001808311613b3a57829003601f168201915b5050505050905090565b60008085604581518110613b7157fe5b016020015160f860020a900460f860020a0260f860020a900460ff16600201604401602001905060606020604051818152601f19601f8301168101602001604052908015613bc6576020820181803883390190505b509050613bd8878360208460006145d5565b50600284876040516020018083805190602001908083835b60208310613c0f5780518252601f199092019160209182019101613bf0565b6001836020036101000a038019825116818451161790925250505091909101928352505060200190506040516020818303038152906040526040518082805190602001908083835b60208310613c765780518252601f199092019160209182019101613c57565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015613cb8573d6000803e3d6000fd5b5050506040513d6020811015613ccd57600080fd5b81019080805192506040915050516020018082815260200191505060405160208183030381529060405280519060200120818051906020012014613d1657600092505050613277565b606087604a840181518110613d2757fe5b016020015160f860020a900460f860020a0260f860020a900460ff16600201604051818152601f19601f8301168101602001604052908015613d70576020820181803883390190505b509050613d85888460490183518460006145d5565b50613e4f6002826040518082805190602001908083835b60208310613dbb5780518252601f199092019160209182019101613d9c565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015613dfd573d6000803e3d6000fd5b5050506040513d6020811015613e1257600080fd5b81019080805192508991508b90506028870181518110613e2e57fe5b016020015160f860020a900460f860020a0260f860020a900460ff16614bc5565b1515613e615760009350505050613277565b60606029604051818152601f19601f8301168101602001604052908015613e8f576020820181803883390190505b509050613ea4898560200160298460006145d5565b50606060408051818152601f19601f8301168101602001604052908015613ed2576020820181803883390190505b5090506000835186602001602901016041019050613ef88b6040830360408560006145d5565b5060006002836040518082805190602001908083835b60208310613f2d5780518252601f199092019160209182019101613f0e565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015613f6f573d6000803e3d6000fd5b5050506040513d6020811015613f8457600080fd5b810190808051935086925083915060409050516020018083805190602001908083835b60208310613fc65780518252601f199092019160209182019101613fa7565b6001836020036101000a038019825116818451161790925250505091909101928352505060200190506040516020818303038152906040528051906020012060008c81526003602052604090205414156140315760008b815260036020526040902060009055614041565b6000975050505050505050613277565b60606049604051818152601f19601f830116810160200160405290801561406f576020820181803883390190505b5090506140818d8960498460006145d5565b506141216002826040518082805190602001908083835b602083106140b75780518252601f199092019160209182019101614098565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa1580156140f9573d6000803e3d6000fd5b5050506040513d602081101561410e57600080fd5b8101908080519250899150879050614c45565b151561413857600098505050505050505050613277565b60008281526004602052604090205460ff1615156141785761415a8d84614dc7565b6000838152600460205260409020805460ff19169115159190911790555b60008281526004602052604090205460ff169d9c50505050505050505050505050565b600160a060020a03811615156141b057600080fd5b6141ba8282612b33565b15156141c557600080fd5b600160a060020a0381166000908152602083905260408120805460ff19169115159190911790555050565b600154600090600160a060020a0316158061421d575060015461421b90600160a060020a0316613ab1565b155b1561422e5761422c6000613ab5565b505b600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561426e57600080fd5b505af1158015614282573d6000803e3d6000fd5b505050506040513d602081101561429857600080fd5b810190808051600054600160a060020a03908116911614925061434c91505057600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156142f857600080fd5b505af115801561430c573d6000803e3d6000fd5b505050506040513d602081101561432257600080fd5b81019080805160008054600160a060020a031916600160a060020a03929092169190911790555050505b600054600160a060020a0316632ef3accc84846040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156143b457808201518382015260200161439c565b50505050905090810190601f1680156143e15780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15801561440157600080fd5b505af1158015614415573d6000803e3d6000fd5b505050506040513d602081101561442b57600080fd5b8101908080519695505050505050565b600154600090600160a060020a03161580614468575060015461446690600160a060020a0316613ab1565b155b15614479576144776000613ab5565b505b600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156144b957600080fd5b505af11580156144cd573d6000803e3d6000fd5b505050506040513d60208110156144e357600080fd5b810190808051600054600160a060020a03908116911614925061459791505057600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561454357600080fd5b505af1158015614557573d6000803e3d6000fd5b505050506040513d602081101561456d57600080fd5b81019080805160008054600160a060020a031916600160a060020a03929092169190911790555050505b600054600160a060020a031663abaa5f3e6040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561285f57600080fd5b606083820180845110156145e857600080fd5b60208087019084015b868860200101821015614612578189015186820152602091820191016145f1565b5093979650505050505050565b600154600090600160a060020a0316158061464c575060015461464a90600160a060020a0316613ab1565b155b1561465d5761465b6000613ab5565b505b600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561469d57600080fd5b505af11580156146b1573d6000803e3d6000fd5b505050506040513d60208110156146c757600080fd5b810190808051600054600160a060020a03908116911614925061477b91505057600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561472757600080fd5b505af115801561473b573d6000803e3d6000fd5b505050506040513d602081101561475157600080fd5b81019080805160008054600160a060020a031916600160a060020a03929092169190911790555050505b606060046040519080825280602002602001820160405280156147b257816020015b606081526020019060019003908161479d5790505b5090508351816000815181106147c457fe5b602090810290910101528360016020020151816001815181106147e357fe5b602090810291909101015260408401518160028151811061480057fe5b602090810291909101015260608401518160038151811061481d57fe5b602090810290910101526148328582856151a6565b95945050505050565b60008281526003602052819060409020555050565b600160a060020a038116151561486557600080fd5b61486f8282612b33565b1561487957600080fd5b600160a060020a0381166000908152602083905260019060409020805460ff19169115159190911790555050565b6000806148c7731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed613ab1565b11156149375760018054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed17905561492f60408051908101604052600b81527f6574685f6d61696e6e65740000000000000000000000000000000000000000006020820152615583565b50600161190a565b600061495673c03a2615d5efaf5f49f60b7bb6583eaec212fdf1613ab1565b11156149be5760018054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf117905561492f60408051908101604052600c81527f6574685f726f707374656e3300000000000000000000000000000000000000006020820152615583565b60006149dd73b7a07bcf2ba2f2703b24c0691b5278999c59ac7e613ab1565b1115614a455760018054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e17905561492f60408051908101604052600981527f6574685f6b6f76616e00000000000000000000000000000000000000000000006020820152615583565b6000614a6473146500cfd35b22e4a392fe0adc06de1a1368ed48613ab1565b1115614acc5760018054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed4817905561492f60408051908101604052600b81527f6574685f72696e6b6562790000000000000000000000000000000000000000006020820152615583565b6000614aeb736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475613ab1565b1115614b1d575060018054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb47517815561190a565b6000614b3c7320e12a1f859b3feae5fb2a0a32c18f5a65555bbf613ab1565b1115614b6e575060018054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf17815561190a565b6000614b8d7351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa613ab1565b1115614bbf575060018054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa17815561190a565b50600090565b6000600182845114614bd657600080fd5b60005b83811015614c3c57848181518110614bed57fe5b016020015160f860020a900460f860020a02600160f860020a0319168682602081101515614c1757fe5b1a60f860020a02600160f860020a031916141515614c3457600091505b600101614bd9565b50949350505050565b600080600080600060606020604051818152601f19601f8301168101602001604052908015614c7b576020820181803883390190505b5090506000602089600381518110614c8f57fe5b016020015160f860020a900460f860020a0260f860020a900460ff16036004019050614cc0898260208560006145d5565b915060606020604051818152601f19601f8301168101602001604052908015614cf0576020820181803883390190505b509050602282019150614d378a60208c6001860381518110614d0e57fe5b016020015160f860020a900460f860020a0260f860020a900460ff1603840160208460006145d5565b90506020830151945060208101519350614d548b601b8787615596565b9097509550600160a060020a0386168980519060200120600160a060020a03161415614d8a576001975050505050505050612a45565b614d978b601c8787615596565b9097509550600160a060020a0386168980519060200120600160a060020a0316149750612a459650505050505050565b6000806060848460010181518110614ddb57fe5b016020015160f860020a900460f860020a0260f860020a900460ff16600201604051818152601f19601f8301168101602001604052908015614e24576020820181803883390190505b509050614e36858583518460006145d5565b50606060408051818152601f19601f8301168101602001604052908015614e64576020820181803883390190505b509050614e7786600460408460006145d5565b5060606062604051818152601f19601f8301168101602001604052908015614ea6576020820181803883390190505b50905060f860020a81600081518110614ebb57fe5b906020010190600160f860020a031916908160001a905350614ee5876041880360418460016145d5565b5060606040805190810160405280602081526020017ffd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c8152509050614f3081600060208560426145d5565b50614fd06002836040518082805190602001908083835b60208310614f665780518252601f199092019160209182019101614f47565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015614fa8573d6000803e3d6000fd5b5050506040513d6020811015614fbd57600080fd5b8101908080519250879150869050614c45565b9450841515614fe757600095505050505050610d34565b6060806040519081016040528060408152602001615d2260409139905060606042604051818152601f19601f8301168101602001604052908015615032576020820181803883390190505b5090507ffe000000000000000000000000000000000000000000000000000000000000008160008151811061506357fe5b906020010190600160f860020a031916908160001a90535061508b8a600360418460016145d5565b5060608a60458151811061509b57fe5b016020015160f860020a900460f860020a0260f860020a900460ff16600201604051818152601f19601f83011681016020016040529080156150e4576020820181803883390190505b5090506150f78b604483518460006145d5565b506151976002836040518082805190602001908083835b6020831061512d5780518252601f19909201916020918201910161510e565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa15801561516f573d6000803e3d6000fd5b5050506040513d602081101561518457600080fd5b8101908080519250849150869050614c45565b9b9a5050505050505050505050565b600154600090600160a060020a031615806151d357506001546151d190600160a060020a0316613ab1565b155b156151e4576151e26000613ab5565b505b600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561522457600080fd5b505af1158015615238573d6000803e3d6000fd5b505050506040513d602081101561524e57600080fd5b810190808051600054600160a060020a03908116911614925061530291505057600154600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156152ae57600080fd5b505af11580156152c2573d6000803e3d6000fd5b505050506040513d60208110156152d857600080fd5b81019080805160008054600160a060020a031916600160a060020a03929092169190911790555050505b60008054600160a060020a0316632ef3accc86856040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561536b578082015183820152602001615353565b50505050905090810190601f1680156153985780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1580156153b857600080fd5b505af11580156153cc573d6000803e3d6000fd5b505050506040513d60208110156153e257600080fd5b8101908080519350505050670de0b6b3a76400003a84020181111561540b575060009050612a45565b6060615416856155d6565b60008054919250600160a060020a039091169063c55c1cb69084908985896040518663ffffffff1660e060020a028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561549357808201518382015260200161547b565b50505050905090810190601f1680156154c05780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156154f65780820151838201526020016154de565b50505050905090810190601f1680156155235780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b15801561554557600080fd5b505af1158015615559573d6000803e3d6000fd5b50505050506040513d602081101561557057600080fd5b8101908080519998505050505050505050565b6002818051610eb0929160200190615949565b60008060008060405188815287602082015286604082015285606082015260208160808360006001610bb8f1925080519299929850919650505050505050565b60606155e061564a565b6155e86159c7565b6155f481610400615656565b6155fd81615684565b60005b83518110156156375761562f84828151811061561857fe5b90602001906020020151839063ffffffff61568f16565b600101615600565b50615641816156ac565b80519392505050565b60405180590338823950565b8060208106156156695760208106602003015b60208301819052604051928390526000835290910160405250565b611dc78160046156b3565b61569c82600283516156cc565b611424828263ffffffff6157cb16565b611dc78160075b610eb082601f602060ff8516021763ffffffff61586416565b601781116156e85761151f8360ff848116602002168317615864565b60ff811161572157615709836018602060ff8616021763ffffffff61586416565b61571b8382600163ffffffff61589d16565b50611424565b61ffff811161575557615743836019602060ff8616021763ffffffff61586416565b61571b8382600263ffffffff61589d16565b63ffffffff811161578b5761577983601a602060ff8616021763ffffffff61586416565b61571b8382600463ffffffff61589d16565b67ffffffffffffffff8111611424576157b383601b602060ff8616021763ffffffff61586416565b6157c58382600863ffffffff61589d16565b50505050565b6157d36159c7565b826020015183515183510111156157ff576157ff836157f7856020015185516158f1565b600202615908565b60008060008451905085518051602081830101945086510190526020850191505b6020811061584057815183526020928301929190910190601f1901615820565b60001960208290036101000a01801983511681855116179093525093949350505050565b8160200151825151600101111561588657615886828360200151600202615908565b815180516020818301018381535060010190525050565b6158a56159c7565b8360200151845151830111156158c7576158c7846157f78660200151856158f1565b60001961010083900a01845180518481830101868419825116179052909301909252509192915050565b600081831115615902575081610d34565b50919050565b6060825190506159188383615656565b6157c583826157cb565b60806040519081016040526004815b60608152602001906001900390816159315790505090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061598a57805160ff19168380011785556159b7565b828001600101855582156159b7579182015b828111156159b757825182559160200191906001019061599c565b506159c39291506159df565b5090565b60408051908101604052606081526000602082015290565b61190a91905b808211156159c357600081556001016159e556fe5b55524c5d206a736f6e2868747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d425443267473796d733d555344266578747261506172616d733d5072696365526f6c6c267369676e3d74727565266170695f6b65793d247b5b646563727970745d20424a45576f35613533415042724e346659707a35784a61447a506d434c4e6a4b64552b794d654433703656734d4c6b4652466671497652612b64342f71756b54426273465a716b7673744d4d63716f4c5a6153686f683448664839585155784c376341744b777541693847436b467073306b63466d4e4233454151517667474d5834466561616f683430594370357142644b6758714c68582b4256753478397030754b53395858422b43633271496c7661676b4737792b546f3162567270315867673d3d7d292e55534445787065637465642076616c7565206d75737420626520696e207468652072616e6765206f66203220746f2039394f7261636c697a652064656c6179206973206d6178696d756d20363020646179735b55524c5d206a736f6e2868747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d455448267473796d733d555344266578747261506172616d733d5072696365526f6c6c267369676e3d74727565266170695f6b65793d247b5b646563727970745d20424a45576f35613533415042724e346659707a35784a61447a506d434c4e6a4b64552b794d654433703656734d4c6b4652466671497652612b64342f71756b54426273465a716b7673744d4d63716f4c5a6153686f683448664839585155784c376341744b777541693847436b467073306b63466d4e4233454151517667474d5834466561616f683430594370357142644b6758714c68582b4256753478397030754b53395858422b43633271496c7661676b4737792b546f3162567270315867673d3d7d292e55534451756572792068617320616c7265616479206265656e2070726f636573736564214e6f7420656e6f75676820746f20626574207468652073706563696669656420616d6f756e747fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e45b55524c5d206a736f6e2868747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d4c5443267473796d733d555344266578747261506172616d733d5072696365526f6c6c267369676e3d74727565266170695f6b65793d247b5b646563727970745d20424a45576f35613533415042724e346659707a35784a61447a506d434c4e6a4b64552b794d654433703656734d4c6b4652466671497652612b64342f71756b54426273465a716b7673744d4d63716f4c5a6153686f683448664839585155784c376341744b777541693847436b467073306b63466d4e4233454151517667474d5834466561616f683430594370357142644b6758714c68582b4256753478397030754b53395858422b43633271496c7661676b4737792b546f3162567270315867673d3d7d292e555344a165627a7a72305820e8f8c3123890d3e1029f128e35cac9b0391b29b85cc7bb981c848ef9dc9f74e80029

   Swarm Source:
bzzr://e8f8c3123890d3e1029f128e35cac9b0391b29b85cc7bb981c848ef9dc9f74e8

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward