Comparing sensitive data, confidential files or internal emails?

Most legal and privacy policies prohibit uploading sensitive data online. Diffchecker Desktop ensures your confidential information never leaves your computer. Work offline and compare documents securely.

Untitled diff

Created Diff never expires
3 removals
641 lines
3 additions
641 lines
/**
/**
*Submitted for verification at Etherscan.io on 2019-06-13
*Submitted for verification at Etherscan.io on 2019-07-11
*/
*/


pragma solidity 0.4.20;
pragma solidity 0.4.20;


// we use solidity solidity 0.4.20 to work with oraclize (http://www.oraclize.it)
// we use solidity solidity 0.4.20 to work with oraclize (http://www.oraclize.it)
// solidity versions > 0.4.20 are not supported by oraclize
// solidity versions > 0.4.20 are not supported by oraclize


/*
/*
Lucky Strike smart contracts version: 5.3.1
Lucky Strike smart contracts version: 6.0.0
last change: 2019-06-13
last change: 2019-07-08
*/
*/


/*
/*
This smart contract is intended for entertainment purposes only. Cryptocurrency gambling is illegal in many jurisdictions and users should consult their legal counsel regarding the legal status of cryptocurrency gambling in their jurisdictions.
This smart contract is intended for entertainment purposes only. Cryptocurrency gambling is illegal in many jurisdictions and users should consult their legal counsel regarding the legal status of cryptocurrency gambling in their jurisdictions.
Since developers of this smart contract are unable to determine which jurisdiction you reside in, you must check current laws including your local and state laws to find out if cryptocurrency gambling is legal in your area.
Since developers of this smart contract are unable to determine which jurisdiction you reside in, you must check current laws including your local and state laws to find out if cryptocurrency gambling is legal in your area.
If you reside in a location where cryptocurrency gambling is illegal, please do not interact with this smart contract in any way and leave it immediately.
If you reside in a location where cryptocurrency gambling is illegal, please do not interact with this smart contract in any way and leave it immediately.
*/
*/


/**
/**
* @title SafeMath
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* @dev Math operations with safety checks that throw on error
* source: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
* source: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
*/
library SafeMath {
library SafeMath {


/**
/**
* @dev Multiplies two numbers, throws on overflow.
* @dev Multiplies two numbers, throws on overflow.
*/
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
if (a == 0) {
return 0;
return 0;
}
}
c = a * b;
c = a * b;
assert(c / a == b);
assert(c / a == b);
return c;
return c;
}
}


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


/**
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
assert(b <= a);
return a - b;
return a - b;
}
}


/**
/**
* @dev Adds two numbers, throws on overflow.
* @dev Adds two numbers, throws on overflow.
*/
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
c = a + b;
assert(c >= a);
assert(c >= a);
return c;
return c;
}
}
}
}


// ORACLIZE_API
// ORACLIZE_API
/*
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Copyright (c) 2016 Oraclize LTD






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






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






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


//pragma solidity >=0.4.1 <=0.4.20;// Incompatible compiler version... please select one stated within pragma solidity or use different oraclizeAPI version
//pragma solidity >=0.4.1 <=0.4.20;// Incompatible compiler version... please select one stated within pragma solidity or use different oraclizeAPI version


contract OraclizeI {
contract OraclizeI {
address public cbAddress;
address public cbAddress;


function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id);
function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id);


function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id);
function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id);


function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id);
function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id);


function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) payable returns (bytes32 _id);
function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) payable returns (bytes32 _id);


function queryN(uint _timestamp, string _datasource, bytes _argN) payable returns (bytes32 _id);
function queryN(uint _timestamp, string _datasource, bytes _argN) payable returns (bytes32 _id);


function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) payable returns (bytes32 _id);
function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) payable returns (bytes32 _id);


function getPrice(string _datasource) returns (uint _dsprice);
function getPrice(string _datasource) returns (uint _dsprice);


function getPrice(string _datasource, uint gaslimit) returns (uint _dsprice);
function getPrice(string _datasource, uint gaslimit) returns (uint _dsprice);


function useCoupon(string _coupon);
function useCoupon(string _coupon);


function setProofType(byte _proofType);
function setProofType(byte _proofType);


function setConfig(bytes32 _config);
function setConfig(bytes32 _config);


function setCustomGasPrice(uint _gasPrice);
function setCustomGasPrice(uint _gasPrice);


function randomDS_getSessionPubKeyHash() returns (bytes32);
function randomDS_getSessionPubKeyHash() returns (bytes32);
}
}


contract OraclizeAddrResolverI {
contract OraclizeAddrResolverI {
function getAddress() returns (address _addr);
function getAddress() returns (address _addr);
}
}


/*
/*
Begin solidity-cborutils
Begin solidity-cborutils


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


MIT License
MIT License


Copyright (c) 2018 SmartContract ChainLink, Ltd.
Copyright (c) 2018 SmartContract ChainLink, Ltd.


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


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


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


library Buffer {
library Buffer {
struct buffer {
struct buffer {
bytes buf;
bytes buf;
uint capacity;
uint capacity;
}
}


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


function resize(buffer memory buf, uint capacity) private constant {
function resize(buffer memory buf, uint capacity) private constant {
bytes memory oldbuf = buf.buf;
bytes memory oldbuf = buf.buf;
init(buf, capacity);
init(buf, capacity);
append(buf, oldbuf);
append(buf, oldbuf);
}
}


function max(uint a, uint b) private constant returns (uint) {
function max(uint a, uint b) private constant returns (uint) {
if (a > b) {
if (a > b) {
return a;
return a;
}
}
return b;
return b;
}
}


/**
/**
* @dev Appends a byte array to the end of the buffer. Reverts if doing so
* @dev Appends a byte array to the end of the buffer. Reverts if doing so
* would exceed the capacity of the buffer.
* would exceed the capacity of the buffer.
* @param buf The buffer to append to.
* @param buf The buffer to append to.
* @param data The data to append.
* @param data The data to append.
* @return The original buffer.
* @return The original buffer.
*/
*/
function append(buffer memory buf, bytes data) internal constant returns (buffer memory) {
function append(buffer memory buf, bytes data) internal constant returns (buffer memory) {
if (data.length + buf.buf.length > buf.capacity) {
if (data.length + buf.buf.length > buf.capacity) {
resize(buf, max(buf.capacity, data.length) * 2);
resize(buf, max(buf.capacity, data.length) * 2);
}
}


uint dest;
uint dest;
uint src;
uint src;
uint len = data.length;
uint len = data.length;
assembly {
assembly {
// Memory address of the buffer data
// Memory address of the buffer data
let bufptr := mload(buf)
let bufptr := mload(buf)
// Length of existing buffer data
// Length of existing buffer data
let buflen := mload(bufptr)
let buflen := mload(bufptr)
// Start address = buffer address + buffer length + sizeof(buffer length)
// Start address = buffer address + buffer length + sizeof(buffer length)
dest := add(add(bufptr, buflen), 32)
dest := add(add(bufptr, buflen), 32)
// Update buffer length
// Update buffer length
mstore(bufptr, add(buflen, mload(data)))
mstore(bufptr, add(buflen, mload(data)))
src := add(data, 32)
src := add(data, 32)
}
}


// Copy word-length chunks while possible
// Copy word-length chunks while possible
for (; len >= 32; len -= 32) {
for (; len >= 32; len -= 32) {
assembly {
assembly {
mstore(dest, mload(src))
mstore(dest, mload(src))
}
}
dest += 32;
dest += 32;
src += 32;
src += 32;
}
}


// Copy remaining bytes
// Copy remaining bytes
uint mask = 256 ** (32 - len) - 1;
uint mask = 256 ** (32 - len) - 1;
assembly {
assembly {
let srcpart := and(mload(src), not(mask))
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
mstore(dest, or(destpart, srcpart))
}
}


return buf;
return buf;
}
}


/**
/**
* @dev Appends a byte to the end of the buffer. Reverts if doing so would
* @dev Appends a byte to the end of the buffer. Reverts if doing so would
* exceed the capacity of the buffer.
* exceed the capacity of the buffer.
* @param buf The buffer to append to.
* @param buf The buffer to append to.
* @param data The data to append.
* @param data The data to append.
* @return The original buffer.
* @return The original buffer.
*/
*/
function append(buffer memory buf, uint8 data) internal constant {
function append(buffer memory buf, uint8 data) internal constant {
if (buf.buf.length + 1 > buf.capacity) {
if (buf.buf.length + 1 > buf.capacity) {
resize(buf, buf.capacity * 2);
resize(buf, buf.capacity * 2);
}
}


assembly {
assembly {
// Memory address of the buffer data
// Memory address of the buffer data
let bufptr := mload(buf)
let bufptr := mload(buf)
// Length of existing buffer data
// Length of existing buffer data
let buflen := mload(bufptr)
let buflen := mload(bufptr)
// Address = buffer address + buffer length + sizeof(buffer length)
// Address = buffer address + buffer length + sizeof(buffer length)
let dest := add(add(bufptr, buflen), 32)
let dest := add(add(bufptr, buflen), 32)
mstore8(dest, data)
mstore8(dest, data)
// Update buffer length
// Update buffer length
mstore(bufptr, add(buflen, 1))
mstore(bufptr, add(buflen, 1))
}
}
}
}


/**
/**
* @dev Appends a byte to the end of the buffer. Reverts if doing so would
* @dev Appends a byte to the end of the buffer. Reverts if doing so would
* exceed the capacity of the buffer.
* exceed the capacity of the buffer.
* @param buf The buffer to append to.
* @param buf The buffer to append to.
* @param data The data to append.
* @param data The data to append.
* @return The original buffer.
* @return The original buffer.
*/
*/
function appendInt(buffer memory buf, uint data, uint len) internal constant returns (buffer memory) {
function appendInt(buffer memory buf, uint data, uint len) internal constant returns (buffer memory) {
if (len + buf.buf.length > buf.capacity) {
if (len + buf.buf.length > buf.capacity) {
resize(buf, max(buf.capacity, len) * 2);
resize(buf, max(buf.capacity, len) * 2);
}
}


uint mask = 256 ** len - 1;
uint mask = 256 ** len - 1;
assembly {
assembly {
// Memory address of the buffer data
// Memory address of the buffer data
let bufptr := mload(buf)
let bufptr := mload(buf)
// Length of existing buffer data
// Length of existing buffer data
let buflen := mload(bufptr)
let buflen := mload(bufptr)
// Address = buffer address + buffer length + sizeof(buffer length) + len
// Address = buffer address + buffer length + sizeof(buffer length) + len
let dest := add(add(bufptr, buflen), len)
let dest := add(add(bufptr, buflen), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
mstore(dest, or(and(mload(dest), not(mask)), data))
// Update buffer length
// Update buffer length
mstore(bufptr, add(buflen, len))
mstore(bufptr, add(buflen, len))
}
}
return buf;
return buf;
}
}
}
}


library CBOR {
library CBOR {
using Buffer for Buffer.buffer;
using Buffer for Buffer.buffer;


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


function shl8(uint8 x, uint8 y) private constant returns (uint8) {
function shl8(uint8 x, uint8 y) private constant returns (uint8) {
return x * (2 ** y);
return x * (2 ** y);
}
}


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


function encodeIndefiniteLengthType(Buffer.buffer memory buf, uint8 major) private constant {
function encodeIndefiniteLengthType(Buffer.buffer memory buf, uint8 major) private constant {
buf.append(uint8(shl8(major, 5) | 31));
buf.append(uint8(shl8(major, 5) | 31));
}
}


function encodeUInt(Buffer.buffer memory buf, uint value) internal constant {
function encodeUInt(Buffer.buffer memory buf, uint value) internal constant {
encodeType(buf, MAJOR_TYPE_INT, value);
encodeType(buf, MAJOR_TYPE_INT, value);
}
}


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


function encodeBytes(Buffer.buffer memory buf, bytes value) internal constant {
function encodeBytes(Buffer.buffer memory buf, bytes value) internal constant {
encodeType(buf, MAJOR_TYPE_BYTES, value.length);
encodeType(buf, MAJOR_TYPE_BYTES, value.length);
buf.append(value);
buf.append(value);
}
}


function encodeString(Buffer.buffer memory buf, string value) internal constant {
function encodeString(Buffer.buffer memory buf, string value) internal constant {
encodeType(buf, MAJOR_TYPE_STRING, bytes(value).length);
encodeType(buf, MAJOR_TYPE_STRING, bytes(value).length);
buf.append(bytes(value));
buf.append(bytes(value));
}
}


function startArray(Buffer.buffer memory buf) internal constant {
function startArray(Buffer.buffer memory buf) internal constant {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY);
encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY);
}
}


function startMap(Buffer.buffer memory buf) internal constant {
function startMap(Buffer.buffer memory buf) internal constant {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP);
encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP);
}
}


function endSequence(Buffer.buffer memory buf) internal constant {
function endSequence(Buffer.buffer memory buf) internal constant {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE);
encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE);
}
}
}
}


/*
/*
End solidity-cborutils
End solidity-cborutils
*/
*/


contract usingOraclize {
contract usingOraclize {
uint constant day = 60 * 60 * 24;
uint constant day = 60 * 60 * 24;
uint constant week = 60 * 60 * 24 * 7;
uint constant week = 60 * 60 * 24 * 7;
uint constant month = 60 * 60 * 24 * 30;
uint constant month = 60 * 60 * 24 * 30;
byte constant proofType_NONE = 0x00;
byte constant proofType_NONE = 0x00;
byte constant proofType_TLSNotary = 0x10;
byte constant proofType_TLSNotary = 0x10;
byte constant proofType_Android = 0x20;
byte constant proofType_Android = 0x20;
byte constant proofType_Ledger = 0x30;
byte constant proofType_Ledger = 0x30;
byte constant proofType_Native = 0xF0;
byte constant proofType_Native = 0xF0;
byte constant proofStorage_IPFS = 0x01;
byte constant proofStorage_IPFS = 0x01;
uint8 constant networkID_auto = 0;
uint8 constant networkID_auto = 0;
uint8 constant networkID_mainnet = 1;
uint8 constant networkID_mainnet = 1;
uint8 constant networkID_testnet = 2;
uint8 constant networkID_testnet = 2;
uint8 constant networkID_morden = 2;
uint8 constant networkID_morden = 2;
uint8 constant networkID_consensys = 161;
uint8 constant networkID_consensys = 161;


OraclizeAddrResolverI OAR;
OraclizeAddrResolverI OAR;


OraclizeI oraclize;
OraclizeI oraclize;
modifier oraclizeAPI {
modifier oraclizeAPI {
if ((address(OAR) == 0) || (getCodeSize(address(OAR)) == 0))
if ((address(OAR) == 0) || (getCodeSize(address(OAR)) == 0))
oraclize_setNetwork(networkID_auto);
oraclize_setNetwork(networkID_auto);


if (address(oraclize) != OAR.getAddress())
if (address(oraclize) != OAR.getAddress())
oraclize = OraclizeI(OAR.getAddress());
oraclize = OraclizeI(OAR.getAddress());


_;
_;
}
}
modifier coupon(string code){
modifier coupon(string code){
oraclize = OraclizeI(OAR.getAddress());
oraclize = OraclizeI(OAR.getAddress());
oraclize.useCoupon(code);
oraclize.useCoupon(code);
_;
_;
}
}


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


function __callback(bytes32 myid, string result) {
function __callback(bytes32 myid, string result) {
__callback(myid, result, new bytes(0));
__callback(myid, result, new bytes(0));
}
}


function __callback(bytes32 myid, string result, bytes proof) {
function __callback(bytes32 myid, string result, bytes proof) {
}
}


function oraclize_useCoupon(string code) oraclizeAPI internal {
function oraclize_useCoupon(string code) oraclizeAPI internal {
oraclize.useCoupon(code);
oraclize.useCoupon(code);
}
}


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


function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){
function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){
return oraclize.getPrice(datasource, gaslimit);
return oraclize.getPrice(datasource, gaslimit);
}
}


function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource);
uint price = oraclize.getPrice(datasource);
if (price > 1 ether + tx.gasprice * 200000) return 0;
if (price > 1 ether + tx.gasprice * 200000) return 0;
// unexpectedly high price
// unexpectedly high price
return oraclize.query.value(price)(0, datasource, arg);
return oraclize.query.value(price)(0, datasource, arg);
}
}


function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource);
uint price = oraclize.getPrice(datasource);
if (price > 1 ether + tx.gasprice * 200000) return 0;
if (price > 1 ether + tx.gasprice * 200000) return 0;
// unexpectedly high price
// unexpectedly high price
return oraclize.query.value(price)(timestamp, datasource, arg);
return oraclize.query.value(price)(timestamp, datasource, arg);
}
}


function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource, gaslimit);
uint price = oraclize.getPrice(datasource, gaslimit);
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
// unexpectedly high price
// unexpectedly high price
return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit);
return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit);
}
}


function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource, gaslimit);
uint price = oraclize.getPrice(datasource, gaslimit);
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
// unexpectedly high price
// unexpectedly high price
return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit);
return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit);
}
}


function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource);
uint price = oraclize.getPrice(datasource);
if (price > 1 ether + tx.gasprice * 200000) return 0;
if (price > 1 ether + tx.gasprice * 200000) return 0;
// unexpectedly high price
// unexpectedly high price
return oraclize.query2.value(price)(0, datasource, arg1, arg2);
return oraclize.query2.value(price)(0, datasource, arg1, arg2);
}
}


function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource);
uint price = oraclize.getPrice(datasource);
if (price > 1 ether + tx.gasprice * 200000) return 0;
if (price > 1 ether + tx.gasprice * 200000) return 0;
// unexpectedly high price
// unexpectedly high price
return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2);
return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2);
}
}


function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource, gaslimit);
uint price = oraclize.getPrice(datasource, gaslimit);
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
// unexpectedly high price
// unexpectedly high price
return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit);
return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit);
}
}


function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource, gaslimit);
uint price = oraclize.getPrice(datasource, gaslimit);
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
// unexpectedly high price
// unexpectedly high price
return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit);
return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit);
}
}


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


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


function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource, gaslimit);
uint price = oraclize.getPrice(datasource, gaslimit);
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
// unexpectedly high price
// unexpectedly high price
bytes memory args = stra2cbor(argN);
bytes memory args = stra2cbor(argN);
return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit);
return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit);
}
}


function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource, gaslimit);
uint price = oraclize.getPrice(datasource, gaslimit);
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
// unexpectedly high price
// unexpectedly high price
bytes memory args = stra2cbor(argN);
bytes memory args = stra2cbor(argN);
return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit);
return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit);
}
}


function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](1);
string[] memory dynargs = new string[](1);
dynargs[0] = args[0];
dynargs[0] = args[0];
return oraclize_query(datasource, dynargs);
return oraclize_query(datasource, dynargs);
}
}


function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](1);
string[] memory dynargs = new string[](1);
dynargs[0] = args[0];
dynargs[0] = args[0];
return oraclize_query(timestamp, datasource, dynargs);
return oraclize_query(timestamp, datasource, dynargs);
}
}


function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](1);
string[] memory dynargs = new string[](1);
dynargs[0] = args[0];
dynargs[0] = args[0];
return oraclize_query(timestamp, datasource, dynargs, gaslimit);
return oraclize_query(timestamp, datasource, dynargs, gaslimit);
}
}


function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](1);
string[] memory dynargs = new string[](1);
dynargs[0] = args[0];
dynargs[0] = args[0];
return oraclize_query(datasource, dynargs, gaslimit);
return oraclize_query(datasource, dynargs, gaslimit);
}
}


function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](2);
string[] memory dynargs = new string[](2);
dynargs[0] = args[0];
dynargs[0] = args[0];
dynargs[1] = args[1];
dynargs[1] = args[1];
return oraclize_query(datasource, dynargs);
return oraclize_query(datasource, dynargs);
}
}


function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](2);
string[] memory dynargs = new string[](2);
dynargs[0] = args[0];
dynargs[0] = args[0];
dynargs[1] = args[1];
dynargs[1] = args[1];
return oraclize_query(timestamp, datasource, dynargs);
return oraclize_query(timestamp, datasource, dynargs);
}
}


function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](2);
string[] memory dynargs = new string[](2);
dynargs[0] = args[0];
dynargs[0] = args[0];
dynargs[1] = args[1];
dynargs[1] = args[1];
return oraclize_query(timestamp, datasource, dynargs, gaslimit);
return oraclize_query(timestamp, datasource, dynargs, gaslimit);
}
}


function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](2);
string[] memory dynargs = new string[](2);
dynargs[0] = args[0];
dynargs[0] = args[0];
dynargs[1] = args[1];
dynargs[1] = args[1];
return oraclize_query(datasource, dynargs, gaslimit);
return oraclize_query(datasource, dynargs, gaslimit);
}
}


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


function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](3);
string[] memory dynargs = new string[](3);
dynargs[0] = args[0];
dynargs[0] = args[0];
dynargs[1] = args[1];
dynargs[1] = args[1];
dynargs[2] = args[2];
dynargs[2] = args[2];
return oraclize_query(timestamp, datasource, dynargs);
return oraclize_query(timestamp, datasource, dynargs);
}
}


function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](3);
string[] memory dynargs = new string[](3);
dynargs[0] = args[0];
dynargs[0] = args[0];
dynargs[1] = args[1];
dynargs[1] = args[1];
dynargs[2] = args[2];
dynargs[2] = args[2];
return oraclize_query(timestamp, datasource, dynargs, gaslimit);
return oraclize_query(timestamp, datasource, dynargs, gaslimit);
}
}


function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](3);
string[] memory dynargs = new string[](3);
dynargs[0] = args[0];
dynargs[0] = args[0];
dynargs[1] = args[1];
dynargs[1] = args[1];
dynargs[2] = args[2];
dynargs[2] = args[2];
return oraclize_query(datasource, dynargs, gaslimit);
return oraclize_query(datasource, dynargs, gaslimit);
}
}


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


function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) {
function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) {
string[] memory dynargs = new string[](4);
string[] memory dynargs = new string[](4);
dynargs[0] = args[0];
dynargs[0] = args[0];
dynargs[1] = args[
dynargs[1] = args[