Address Details
contract
0x6CEB70e9237dfE15eDC4A35aAd1598225609d171
- Contract Name
- SortedOracles
- Creator
- 0xf3eb91–a79239 at 0xb3e757–834fad
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 12004306
This contract has been partially verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- SortedOracles
- Optimization enabled
- false
- Compiler version
- v0.5.13+commit.5b0b510c
- EVM Version
- istanbul
- Verified at
- 2021-10-19T10:46:38.264224Z
Contract source code
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./interfaces/ISortedOracles.sol"; import "../common/interfaces/ICeloVersionedContract.sol"; import "../common/FixidityLib.sol"; import "../common/Initializable.sol"; import "../common/linkedlists/AddressSortedLinkedListWithMedian.sol"; import "../common/linkedlists/SortedLinkedListWithMedian.sol"; /** * @title Maintains a sorted list of oracle exchange rates between CELO and other currencies. */ contract SortedOracles is ISortedOracles, ICeloVersionedContract, Ownable, Initializable { using SafeMath for uint256; using AddressSortedLinkedListWithMedian for SortedLinkedListWithMedian.List; using FixidityLib for FixidityLib.Fraction; uint256 private constant FIXED1_UINT = 1000000000000000000000000; // Maps a token address to a sorted list of report values. mapping(address => SortedLinkedListWithMedian.List) private rates; // Maps a token address to a sorted list of report timestamps. mapping(address => SortedLinkedListWithMedian.List) private timestamps; mapping(address => mapping(address => bool)) public isOracle; mapping(address => address[]) public oracles; // `reportExpirySeconds` is the fallback value used to determine reporting // frequency. Initially it was the _only_ value but we later introduced // the per token mapping in `tokenReportExpirySeconds`. If a token // doesn't have a value in the mapping (i.e. it's 0), the fallback is used. // See: #getTokenReportExpirySeconds uint256 public reportExpirySeconds; mapping(address => uint256) public tokenReportExpirySeconds; event OracleAdded(address indexed token, address indexed oracleAddress); event OracleRemoved(address indexed token, address indexed oracleAddress); event OracleReported( address indexed token, address indexed oracle, uint256 timestamp, uint256 value ); event OracleReportRemoved(address indexed token, address indexed oracle); event MedianUpdated(address indexed token, uint256 value); event ReportExpirySet(uint256 reportExpiry); event TokenReportExpirySet(address token, uint256 reportExpiry); modifier onlyOracle(address token) { require(isOracle[token][msg.sender], "sender was not an oracle for token addr"); _; } /** * @notice Returns the storage, major, minor, and patch version of the contract. * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { return (1, 1, 2, 0); } /** * @notice Sets initialized == true on implementation contracts * @param test Set to true to skip implementation initialization */ constructor(bool test) public Initializable(test) {} /** * @notice Used in place of the constructor to allow the contract to be upgradable via proxy. * @param _reportExpirySeconds The number of seconds before a report is considered expired. */ function initialize(uint256 _reportExpirySeconds) external initializer { _transferOwnership(msg.sender); setReportExpiry(_reportExpirySeconds); } /** * @notice Sets the report expiry parameter. * @param _reportExpirySeconds The number of seconds before a report is considered expired. */ function setReportExpiry(uint256 _reportExpirySeconds) public onlyOwner { require(_reportExpirySeconds > 0, "report expiry seconds must be > 0"); require(_reportExpirySeconds != reportExpirySeconds, "reportExpirySeconds hasn't changed"); reportExpirySeconds = _reportExpirySeconds; emit ReportExpirySet(_reportExpirySeconds); } /** * @notice Sets the report expiry parameter for a token. * @param _token The address of the token to set expiry for. * @param _reportExpirySeconds The number of seconds before a report is considered expired. */ function setTokenReportExpiry(address _token, uint256 _reportExpirySeconds) external onlyOwner { require(_reportExpirySeconds > 0, "report expiry seconds must be > 0"); require( _reportExpirySeconds != tokenReportExpirySeconds[_token], "token reportExpirySeconds hasn't changed" ); tokenReportExpirySeconds[_token] = _reportExpirySeconds; emit TokenReportExpirySet(_token, _reportExpirySeconds); } /** * @notice Adds a new Oracle. * @param token The address of the token. * @param oracleAddress The address of the oracle. */ function addOracle(address token, address oracleAddress) external onlyOwner { require( token != address(0) && oracleAddress != address(0) && !isOracle[token][oracleAddress], "token addr was null or oracle addr was null or oracle addr is not an oracle for token addr" ); isOracle[token][oracleAddress] = true; oracles[token].push(oracleAddress); emit OracleAdded(token, oracleAddress); } /** * @notice Removes an Oracle. * @param token The address of the token. * @param oracleAddress The address of the oracle. * @param index The index of `oracleAddress` in the list of oracles. */ function removeOracle(address token, address oracleAddress, uint256 index) external onlyOwner { require( token != address(0) && oracleAddress != address(0) && oracles[token].length > index && oracles[token][index] == oracleAddress, "token addr null or oracle addr null or index of token oracle not mapped to oracle addr" ); isOracle[token][oracleAddress] = false; oracles[token][index] = oracles[token][oracles[token].length.sub(1)]; oracles[token].length = oracles[token].length.sub(1); if (reportExists(token, oracleAddress)) { removeReport(token, oracleAddress); } emit OracleRemoved(token, oracleAddress); } /** * @notice Removes a report that is expired. * @param token The address of the token for which the CELO exchange rate is being reported. * @param n The number of expired reports to remove, at most (deterministic upper gas bound). */ function removeExpiredReports(address token, uint256 n) external { require( token != address(0) && n < timestamps[token].getNumElements(), "token addr null or trying to remove too many reports" ); for (uint256 i = 0; i < n; i = i.add(1)) { (bool isExpired, address oldestAddress) = isOldestReportExpired(token); if (isExpired) { removeReport(token, oldestAddress); } else { break; } } } /** * @notice Check if last report is expired. * @param token The address of the token for which the CELO exchange rate is being reported. * @return bool isExpired and the address of the last report */ function isOldestReportExpired(address token) public view returns (bool, address) { require(token != address(0)); address oldest = timestamps[token].getTail(); uint256 timestamp = timestamps[token].getValue(oldest); // solhint-disable-next-line not-rely-on-time if (now.sub(timestamp) >= getTokenReportExpirySeconds(token)) { return (true, oldest); } return (false, oldest); } /** * @notice Updates an oracle value and the median. * @param token The address of the token for which the CELO exchange rate is being reported. * @param value The amount of `token` equal to one CELO, expressed as a fixidity value. * @param lesserKey The element which should be just left of the new oracle value. * @param greaterKey The element which should be just right of the new oracle value. * @dev Note that only one of `lesserKey` or `greaterKey` needs to be correct to reduce friction. */ function report(address token, uint256 value, address lesserKey, address greaterKey) external onlyOracle(token) { uint256 originalMedian = rates[token].getMedianValue(); if (rates[token].contains(msg.sender)) { rates[token].update(msg.sender, value, lesserKey, greaterKey); // Rather than update the timestamp, we remove it and re-add it at the // head of the list later. The reason for this is that we need to handle // a few different cases: // 1. This oracle is the only one to report so far. lesserKey = address(0) // 2. Other oracles have reported since this one's last report. lesserKey = getHead() // 3. Other oracles have reported, but the most recent is this one. // lesserKey = key immediately after getHead() // // However, if we just remove this timestamp, timestamps[token].getHead() // does the right thing in all cases. timestamps[token].remove(msg.sender); } else { rates[token].insert(msg.sender, value, lesserKey, greaterKey); } timestamps[token].insert( msg.sender, // solhint-disable-next-line not-rely-on-time now, timestamps[token].getHead(), address(0) ); emit OracleReported(token, msg.sender, now, value); uint256 newMedian = rates[token].getMedianValue(); if (newMedian != originalMedian) { emit MedianUpdated(token, newMedian); } } /** * @notice Returns the number of rates. * @param token The address of the token for which the CELO exchange rate is being reported. * @return The number of reported oracle rates for `token`. */ function numRates(address token) public view returns (uint256) { return rates[token].getNumElements(); } /** * @notice Returns the median rate. * @param token The address of the token for which the CELO exchange rate is being reported. * @return The median exchange rate for `token`. */ function medianRate(address token) external view returns (uint256, uint256) { return (rates[token].getMedianValue(), numRates(token) == 0 ? 0 : FIXED1_UINT); } /** * @notice Gets all elements from the doubly linked list. * @param token The address of the token for which the CELO exchange rate is being reported. * @return An unpacked list of elements from largest to smallest. */ function getRates(address token) external view returns (address[] memory, uint256[] memory, SortedLinkedListWithMedian.MedianRelation[] memory) { return rates[token].getElements(); } /** * @notice Returns the number of timestamps. * @param token The address of the token for which the CELO exchange rate is being reported. * @return The number of oracle report timestamps for `token`. */ function numTimestamps(address token) public view returns (uint256) { return timestamps[token].getNumElements(); } /** * @notice Returns the median timestamp. * @param token The address of the token for which the CELO exchange rate is being reported. * @return The median report timestamp for `token`. */ function medianTimestamp(address token) external view returns (uint256) { return timestamps[token].getMedianValue(); } /** * @notice Gets all elements from the doubly linked list. * @param token The address of the token for which the CELO exchange rate is being reported. * @return An unpacked list of elements from largest to smallest. */ function getTimestamps(address token) external view returns (address[] memory, uint256[] memory, SortedLinkedListWithMedian.MedianRelation[] memory) { return timestamps[token].getElements(); } /** * @notice Returns whether a report exists on token from oracle. * @param token The address of the token for which the CELO exchange rate is being reported. * @param oracle The oracle whose report should be checked. */ function reportExists(address token, address oracle) internal view returns (bool) { return rates[token].contains(oracle) && timestamps[token].contains(oracle); } /** * @notice Returns the list of oracles for a particular token. * @param token The address of the token whose oracles should be returned. * @return The list of oracles for a particular token. */ function getOracles(address token) external view returns (address[] memory) { return oracles[token]; } /** * @notice Returns the expiry for the token if exists, if not the default. * @param token The address of the token. * @return The report expiry in seconds. */ function getTokenReportExpirySeconds(address token) public view returns (uint256) { if (tokenReportExpirySeconds[token] == 0) { return reportExpirySeconds; } return tokenReportExpirySeconds[token]; } /** * @notice Removes an oracle value and updates the median. * @param token The address of the token for which the CELO exchange rate is being reported. * @param oracle The oracle whose value should be removed. * @dev This can be used to delete elements for oracles that have been removed. * However, a > 1 elements reports list should always be maintained */ function removeReport(address token, address oracle) private { if (numTimestamps(token) == 1 && reportExists(token, oracle)) return; uint256 originalMedian = rates[token].getMedianValue(); rates[token].remove(oracle); timestamps[token].remove(oracle); emit OracleReportRemoved(token, oracle); uint256 newMedian = rates[token].getMedianValue(); if (newMedian != originalMedian) { emit MedianUpdated(token, newMedian); } } }
FixidityLib.sol
pragma solidity ^0.5.13; /** * @title FixidityLib * @author Gadi Guy, Alberto Cuesta Canada * @notice This library provides fixed point arithmetic with protection against * overflow. * All operations are done with uint256 and the operands must have been created * with any of the newFrom* functions, which shift the comma digits() to the * right and check for limits, or with wrap() which expects a number already * in the internal representation of a fraction. * When using this library be sure to use maxNewFixed() as the upper limit for * creation of fixed point numbers. * @dev All contained functions are pure and thus marked internal to be inlined * on consuming contracts at compile time for gas efficiency. */ library FixidityLib { struct Fraction { uint256 value; } /** * @notice Number of positions that the comma is shifted to the right. */ function digits() internal pure returns (uint8) { return 24; } uint256 private constant FIXED1_UINT = 1000000000000000000000000; /** * @notice This is 1 in the fixed point units used in this library. * @dev Test fixed1() equals 10^digits() * Hardcoded to 24 digits. */ function fixed1() internal pure returns (Fraction memory) { return Fraction(FIXED1_UINT); } /** * @notice Wrap a uint256 that represents a 24-decimal fraction in a Fraction * struct. * @param x Number that already represents a 24-decimal fraction. * @return A Fraction struct with contents x. */ function wrap(uint256 x) internal pure returns (Fraction memory) { return Fraction(x); } /** * @notice Unwraps the uint256 inside of a Fraction struct. */ function unwrap(Fraction memory x) internal pure returns (uint256) { return x.value; } /** * @notice The amount of decimals lost on each multiplication operand. * @dev Test mulPrecision() equals sqrt(fixed1) */ function mulPrecision() internal pure returns (uint256) { return 1000000000000; } /** * @notice Maximum value that can be converted to fixed point. Optimize for deployment. * @dev * Test maxNewFixed() equals maxUint256() / fixed1() */ function maxNewFixed() internal pure returns (uint256) { return 115792089237316195423570985008687907853269984665640564; } /** * @notice Converts a uint256 to fixed point Fraction * @dev Test newFixed(0) returns 0 * Test newFixed(1) returns fixed1() * Test newFixed(maxNewFixed()) returns maxNewFixed() * fixed1() * Test newFixed(maxNewFixed()+1) fails */ function newFixed(uint256 x) internal pure returns (Fraction memory) { require(x <= maxNewFixed(), "can't create fixidity number larger than maxNewFixed()"); return Fraction(x * FIXED1_UINT); } /** * @notice Converts a uint256 in the fixed point representation of this * library to a non decimal. All decimal digits will be truncated. */ function fromFixed(Fraction memory x) internal pure returns (uint256) { return x.value / FIXED1_UINT; } /** * @notice Converts two uint256 representing a fraction to fixed point units, * equivalent to multiplying dividend and divisor by 10^digits(). * @param numerator numerator must be <= maxNewFixed() * @param denominator denominator must be <= maxNewFixed() and denominator can't be 0 * @dev * Test newFixedFraction(1,0) fails * Test newFixedFraction(0,1) returns 0 * Test newFixedFraction(1,1) returns fixed1() * Test newFixedFraction(1,fixed1()) returns 1 */ function newFixedFraction(uint256 numerator, uint256 denominator) internal pure returns (Fraction memory) { Fraction memory convertedNumerator = newFixed(numerator); Fraction memory convertedDenominator = newFixed(denominator); return divide(convertedNumerator, convertedDenominator); } /** * @notice Returns the integer part of a fixed point number. * @dev * Test integer(0) returns 0 * Test integer(fixed1()) returns fixed1() * Test integer(newFixed(maxNewFixed())) returns maxNewFixed()*fixed1() */ function integer(Fraction memory x) internal pure returns (Fraction memory) { return Fraction((x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow } /** * @notice Returns the fractional part of a fixed point number. * In the case of a negative number the fractional is also negative. * @dev * Test fractional(0) returns 0 * Test fractional(fixed1()) returns 0 * Test fractional(fixed1()-1) returns 10^24-1 */ function fractional(Fraction memory x) internal pure returns (Fraction memory) { return Fraction(x.value - (x.value / FIXED1_UINT) * FIXED1_UINT); // Can't overflow } /** * @notice x+y. * @dev The maximum value that can be safely used as an addition operator is defined as * maxFixedAdd = maxUint256()-1 / 2, or * 57896044618658097711785492504343953926634992332820282019728792003956564819967. * Test add(maxFixedAdd,maxFixedAdd) equals maxFixedAdd + maxFixedAdd * Test add(maxFixedAdd+1,maxFixedAdd+1) throws */ function add(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) { uint256 z = x.value + y.value; require(z >= x.value, "add overflow detected"); return Fraction(z); } /** * @notice x-y. * @dev * Test subtract(6, 10) fails */ function subtract(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) { require(x.value >= y.value, "substraction underflow detected"); return Fraction(x.value - y.value); } /** * @notice x*y. If any of the operators is higher than the max multiplier value it * might overflow. * @dev The maximum value that can be safely used as a multiplication operator * (maxFixedMul) is calculated as sqrt(maxUint256()*fixed1()), * or 340282366920938463463374607431768211455999999999999 * Test multiply(0,0) returns 0 * Test multiply(maxFixedMul,0) returns 0 * Test multiply(0,maxFixedMul) returns 0 * Test multiply(fixed1()/mulPrecision(),fixed1()*mulPrecision()) returns fixed1() * Test multiply(maxFixedMul,maxFixedMul) is around maxUint256() * Test multiply(maxFixedMul+1,maxFixedMul+1) fails */ function multiply(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) { if (x.value == 0 || y.value == 0) return Fraction(0); if (y.value == FIXED1_UINT) return x; if (x.value == FIXED1_UINT) return y; // Separate into integer and fractional parts // x = x1 + x2, y = y1 + y2 uint256 x1 = integer(x).value / FIXED1_UINT; uint256 x2 = fractional(x).value; uint256 y1 = integer(y).value / FIXED1_UINT; uint256 y2 = fractional(y).value; // (x1 + x2) * (y1 + y2) = (x1 * y1) + (x1 * y2) + (x2 * y1) + (x2 * y2) uint256 x1y1 = x1 * y1; if (x1 != 0) require(x1y1 / x1 == y1, "overflow x1y1 detected"); // x1y1 needs to be multiplied back by fixed1 // solium-disable-next-line mixedcase uint256 fixed_x1y1 = x1y1 * FIXED1_UINT; if (x1y1 != 0) require(fixed_x1y1 / x1y1 == FIXED1_UINT, "overflow x1y1 * fixed1 detected"); x1y1 = fixed_x1y1; uint256 x2y1 = x2 * y1; if (x2 != 0) require(x2y1 / x2 == y1, "overflow x2y1 detected"); uint256 x1y2 = x1 * y2; if (x1 != 0) require(x1y2 / x1 == y2, "overflow x1y2 detected"); x2 = x2 / mulPrecision(); y2 = y2 / mulPrecision(); uint256 x2y2 = x2 * y2; if (x2 != 0) require(x2y2 / x2 == y2, "overflow x2y2 detected"); // result = fixed1() * x1 * y1 + x1 * y2 + x2 * y1 + x2 * y2 / fixed1(); Fraction memory result = Fraction(x1y1); result = add(result, Fraction(x2y1)); // Add checks for overflow result = add(result, Fraction(x1y2)); // Add checks for overflow result = add(result, Fraction(x2y2)); // Add checks for overflow return result; } /** * @notice 1/x * @dev * Test reciprocal(0) fails * Test reciprocal(fixed1()) returns fixed1() * Test reciprocal(fixed1()*fixed1()) returns 1 // Testing how the fractional is truncated * Test reciprocal(1+fixed1()*fixed1()) returns 0 // Testing how the fractional is truncated * Test reciprocal(newFixedFraction(1, 1e24)) returns newFixed(1e24) */ function reciprocal(Fraction memory x) internal pure returns (Fraction memory) { require(x.value != 0, "can't call reciprocal(0)"); return Fraction((FIXED1_UINT * FIXED1_UINT) / x.value); // Can't overflow } /** * @notice x/y. If the dividend is higher than the max dividend value, it * might overflow. You can use multiply(x,reciprocal(y)) instead. * @dev The maximum value that can be safely used as a dividend (maxNewFixed) is defined as * divide(maxNewFixed,newFixedFraction(1,fixed1())) is around maxUint256(). * This yields the value 115792089237316195423570985008687907853269984665640564. * Test maxNewFixed equals maxUint256()/fixed1() * Test divide(maxNewFixed,1) equals maxNewFixed*(fixed1) * Test divide(maxNewFixed+1,multiply(mulPrecision(),mulPrecision())) throws * Test divide(fixed1(),0) fails * Test divide(maxNewFixed,1) = maxNewFixed*(10^digits()) * Test divide(maxNewFixed+1,1) throws */ function divide(Fraction memory x, Fraction memory y) internal pure returns (Fraction memory) { require(y.value != 0, "can't divide by 0"); uint256 X = x.value * FIXED1_UINT; require(X / FIXED1_UINT == x.value, "overflow at divide"); return Fraction(X / y.value); } /** * @notice x > y */ function gt(Fraction memory x, Fraction memory y) internal pure returns (bool) { return x.value > y.value; } /** * @notice x >= y */ function gte(Fraction memory x, Fraction memory y) internal pure returns (bool) { return x.value >= y.value; } /** * @notice x < y */ function lt(Fraction memory x, Fraction memory y) internal pure returns (bool) { return x.value < y.value; } /** * @notice x <= y */ function lte(Fraction memory x, Fraction memory y) internal pure returns (bool) { return x.value <= y.value; } /** * @notice x == y */ function equals(Fraction memory x, Fraction memory y) internal pure returns (bool) { return x.value == y.value; } /** * @notice x <= 1 */ function isProperFraction(Fraction memory x) internal pure returns (bool) { return lte(x, fixed1()); } }
Initializable.sol
pragma solidity ^0.5.13; contract Initializable { bool public initialized; constructor(bool testingDeployment) public { if (!testingDeployment) { initialized = true; } } modifier initializer() { require(!initialized, "contract already initialized"); initialized = true; _; } }
ICeloVersionedContract.sol
pragma solidity ^0.5.13; interface ICeloVersionedContract { /** * @notice Returns the storage, major, minor, and patch version of the contract. * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256); }
AddressSortedLinkedListWithMedian.sol
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./SortedLinkedListWithMedian.sol"; /** * @title Maintains a sorted list of unsigned ints keyed by address. */ library AddressSortedLinkedListWithMedian { using SafeMath for uint256; using SortedLinkedListWithMedian for SortedLinkedListWithMedian.List; /** * @notice Returns the storage, major, minor, and patch version of the contract. * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { return (1, 1, 1, 0); } function toBytes(address a) public pure returns (bytes32) { return bytes32(uint256(a) << 96); } function toAddress(bytes32 b) public pure returns (address) { return address(uint256(b) >> 96); } /** * @notice Inserts an element into a doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to insert. * @param value The element value. * @param lesserKey The key of the element less than the element to insert. * @param greaterKey The key of the element greater than the element to insert. */ function insert( SortedLinkedListWithMedian.List storage list, address key, uint256 value, address lesserKey, address greaterKey ) public { list.insert(toBytes(key), value, toBytes(lesserKey), toBytes(greaterKey)); } /** * @notice Removes an element from the doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to remove. */ function remove(SortedLinkedListWithMedian.List storage list, address key) public { list.remove(toBytes(key)); } /** * @notice Updates an element in the list. * @param list A storage pointer to the underlying list. * @param key The element key. * @param value The element value. * @param lesserKey The key of the element will be just left of `key` after the update. * @param greaterKey The key of the element will be just right of `key` after the update. * @dev Note that only one of "lesserKey" or "greaterKey" needs to be correct to reduce friction. */ function update( SortedLinkedListWithMedian.List storage list, address key, uint256 value, address lesserKey, address greaterKey ) public { list.update(toBytes(key), value, toBytes(lesserKey), toBytes(greaterKey)); } /** * @notice Returns whether or not a particular key is present in the sorted list. * @param list A storage pointer to the underlying list. * @param key The element key. * @return Whether or not the key is in the sorted list. */ function contains(SortedLinkedListWithMedian.List storage list, address key) public view returns (bool) { return list.contains(toBytes(key)); } /** * @notice Returns the value for a particular key in the sorted list. * @param list A storage pointer to the underlying list. * @param key The element key. * @return The element value. */ function getValue(SortedLinkedListWithMedian.List storage list, address key) public view returns (uint256) { return list.getValue(toBytes(key)); } /** * @notice Returns the median value of the sorted list. * @param list A storage pointer to the underlying list. * @return The median value. */ function getMedianValue(SortedLinkedListWithMedian.List storage list) public view returns (uint256) { return list.getValue(list.median); } /** * @notice Returns the key of the first element in the list. * @param list A storage pointer to the underlying list. * @return The key of the first element in the list. */ function getHead(SortedLinkedListWithMedian.List storage list) external view returns (address) { return toAddress(list.getHead()); } /** * @notice Returns the key of the median element in the list. * @param list A storage pointer to the underlying list. * @return The key of the median element in the list. */ function getMedian(SortedLinkedListWithMedian.List storage list) external view returns (address) { return toAddress(list.getMedian()); } /** * @notice Returns the key of the last element in the list. * @param list A storage pointer to the underlying list. * @return The key of the last element in the list. */ function getTail(SortedLinkedListWithMedian.List storage list) external view returns (address) { return toAddress(list.getTail()); } /** * @notice Returns the number of elements in the list. * @param list A storage pointer to the underlying list. * @return The number of elements in the list. */ function getNumElements(SortedLinkedListWithMedian.List storage list) external view returns (uint256) { return list.getNumElements(); } /** * @notice Gets all elements from the doubly linked list. * @param list A storage pointer to the underlying list. * @return An unpacked list of elements from largest to smallest. */ function getElements(SortedLinkedListWithMedian.List storage list) public view returns (address[] memory, uint256[] memory, SortedLinkedListWithMedian.MedianRelation[] memory) { bytes32[] memory byteKeys = list.getKeys(); address[] memory keys = new address[](byteKeys.length); uint256[] memory values = new uint256[](byteKeys.length); // prettier-ignore SortedLinkedListWithMedian.MedianRelation[] memory relations = new SortedLinkedListWithMedian.MedianRelation[](keys.length); for (uint256 i = 0; i < byteKeys.length; i = i.add(1)) { keys[i] = toAddress(byteKeys[i]); values[i] = list.getValue(byteKeys[i]); relations[i] = list.relation[byteKeys[i]]; } return (keys, values, relations); } }
LinkedList.sol
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title Maintains a doubly linked list keyed by bytes32. * @dev Following the `next` pointers will lead you to the head, rather than the tail. */ library LinkedList { using SafeMath for uint256; struct Element { bytes32 previousKey; bytes32 nextKey; bool exists; } struct List { bytes32 head; bytes32 tail; uint256 numElements; mapping(bytes32 => Element) elements; } /** * @notice Inserts an element into a doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to insert. * @param previousKey The key of the element that comes before the element to insert. * @param nextKey The key of the element that comes after the element to insert. */ function insert(List storage list, bytes32 key, bytes32 previousKey, bytes32 nextKey) internal { require(key != bytes32(0), "Key must be defined"); require(!contains(list, key), "Can't insert an existing element"); require( previousKey != key && nextKey != key, "Key cannot be the same as previousKey or nextKey" ); Element storage element = list.elements[key]; element.exists = true; if (list.numElements == 0) { list.tail = key; list.head = key; } else { require( previousKey != bytes32(0) || nextKey != bytes32(0), "Either previousKey or nextKey must be defined" ); element.previousKey = previousKey; element.nextKey = nextKey; if (previousKey != bytes32(0)) { require( contains(list, previousKey), "If previousKey is defined, it must exist in the list" ); Element storage previousElement = list.elements[previousKey]; require(previousElement.nextKey == nextKey, "previousKey must be adjacent to nextKey"); previousElement.nextKey = key; } else { list.tail = key; } if (nextKey != bytes32(0)) { require(contains(list, nextKey), "If nextKey is defined, it must exist in the list"); Element storage nextElement = list.elements[nextKey]; require(nextElement.previousKey == previousKey, "previousKey must be adjacent to nextKey"); nextElement.previousKey = key; } else { list.head = key; } } list.numElements = list.numElements.add(1); } /** * @notice Inserts an element at the tail of the doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to insert. */ function push(List storage list, bytes32 key) internal { insert(list, key, bytes32(0), list.tail); } /** * @notice Removes an element from the doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to remove. */ function remove(List storage list, bytes32 key) internal { Element storage element = list.elements[key]; require(key != bytes32(0) && contains(list, key), "key not in list"); if (element.previousKey != bytes32(0)) { Element storage previousElement = list.elements[element.previousKey]; previousElement.nextKey = element.nextKey; } else { list.tail = element.nextKey; } if (element.nextKey != bytes32(0)) { Element storage nextElement = list.elements[element.nextKey]; nextElement.previousKey = element.previousKey; } else { list.head = element.previousKey; } delete list.elements[key]; list.numElements = list.numElements.sub(1); } /** * @notice Updates an element in the list. * @param list A storage pointer to the underlying list. * @param key The element key. * @param previousKey The key of the element that comes before the updated element. * @param nextKey The key of the element that comes after the updated element. */ function update(List storage list, bytes32 key, bytes32 previousKey, bytes32 nextKey) internal { require( key != bytes32(0) && key != previousKey && key != nextKey && contains(list, key), "key on in list" ); remove(list, key); insert(list, key, previousKey, nextKey); } /** * @notice Returns whether or not a particular key is present in the sorted list. * @param list A storage pointer to the underlying list. * @param key The element key. * @return Whether or not the key is in the sorted list. */ function contains(List storage list, bytes32 key) internal view returns (bool) { return list.elements[key].exists; } /** * @notice Returns the keys of the N elements at the head of the list. * @param list A storage pointer to the underlying list. * @param n The number of elements to return. * @return The keys of the N elements at the head of the list. * @dev Reverts if n is greater than the number of elements in the list. */ function headN(List storage list, uint256 n) internal view returns (bytes32[] memory) { require(n <= list.numElements, "not enough elements"); bytes32[] memory keys = new bytes32[](n); bytes32 key = list.head; for (uint256 i = 0; i < n; i = i.add(1)) { keys[i] = key; key = list.elements[key].previousKey; } return keys; } /** * @notice Gets all element keys from the doubly linked list. * @param list A storage pointer to the underlying list. * @return All element keys from head to tail. */ function getKeys(List storage list) internal view returns (bytes32[] memory) { return headN(list, list.numElements); } }
SortedLinkedList.sol
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./LinkedList.sol"; /** * @title Maintains a sorted list of unsigned ints keyed by bytes32. */ library SortedLinkedList { using SafeMath for uint256; using LinkedList for LinkedList.List; struct List { LinkedList.List list; mapping(bytes32 => uint256) values; } /** * @notice Inserts an element into a doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to insert. * @param value The element value. * @param lesserKey The key of the element less than the element to insert. * @param greaterKey The key of the element greater than the element to insert. */ function insert( List storage list, bytes32 key, uint256 value, bytes32 lesserKey, bytes32 greaterKey ) internal { require( key != bytes32(0) && key != lesserKey && key != greaterKey && !contains(list, key), "invalid key" ); require( (lesserKey != bytes32(0) || greaterKey != bytes32(0)) || list.list.numElements == 0, "greater and lesser key zero" ); require(contains(list, lesserKey) || lesserKey == bytes32(0), "invalid lesser key"); require(contains(list, greaterKey) || greaterKey == bytes32(0), "invalid greater key"); (lesserKey, greaterKey) = getLesserAndGreater(list, value, lesserKey, greaterKey); list.list.insert(key, lesserKey, greaterKey); list.values[key] = value; } /** * @notice Removes an element from the doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to remove. */ function remove(List storage list, bytes32 key) internal { list.list.remove(key); list.values[key] = 0; } /** * @notice Updates an element in the list. * @param list A storage pointer to the underlying list. * @param key The element key. * @param value The element value. * @param lesserKey The key of the element will be just left of `key` after the update. * @param greaterKey The key of the element will be just right of `key` after the update. * @dev Note that only one of "lesserKey" or "greaterKey" needs to be correct to reduce friction. */ function update( List storage list, bytes32 key, uint256 value, bytes32 lesserKey, bytes32 greaterKey ) internal { remove(list, key); insert(list, key, value, lesserKey, greaterKey); } /** * @notice Inserts an element at the tail of the doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to insert. */ function push(List storage list, bytes32 key) internal { insert(list, key, 0, bytes32(0), list.list.tail); } /** * @notice Removes N elements from the head of the list and returns their keys. * @param list A storage pointer to the underlying list. * @param n The number of elements to pop. * @return The keys of the popped elements. */ function popN(List storage list, uint256 n) internal returns (bytes32[] memory) { require(n <= list.list.numElements, "not enough elements"); bytes32[] memory keys = new bytes32[](n); for (uint256 i = 0; i < n; i = i.add(1)) { bytes32 key = list.list.head; keys[i] = key; remove(list, key); } return keys; } /** * @notice Returns whether or not a particular key is present in the sorted list. * @param list A storage pointer to the underlying list. * @param key The element key. * @return Whether or not the key is in the sorted list. */ function contains(List storage list, bytes32 key) internal view returns (bool) { return list.list.contains(key); } /** * @notice Returns the value for a particular key in the sorted list. * @param list A storage pointer to the underlying list. * @param key The element key. * @return The element value. */ function getValue(List storage list, bytes32 key) internal view returns (uint256) { return list.values[key]; } /** * @notice Gets all elements from the doubly linked list. * @param list A storage pointer to the underlying list. * @return An unpacked list of elements from largest to smallest. */ function getElements(List storage list) internal view returns (bytes32[] memory, uint256[] memory) { bytes32[] memory keys = getKeys(list); uint256[] memory values = new uint256[](keys.length); for (uint256 i = 0; i < keys.length; i = i.add(1)) { values[i] = list.values[keys[i]]; } return (keys, values); } /** * @notice Gets all element keys from the doubly linked list. * @param list A storage pointer to the underlying list. * @return All element keys from head to tail. */ function getKeys(List storage list) internal view returns (bytes32[] memory) { return list.list.getKeys(); } /** * @notice Returns first N greatest elements of the list. * @param list A storage pointer to the underlying list. * @param n The number of elements to return. * @return The keys of the first n elements. * @dev Reverts if n is greater than the number of elements in the list. */ function headN(List storage list, uint256 n) internal view returns (bytes32[] memory) { return list.list.headN(n); } /** * @notice Returns the keys of the elements greaterKey than and less than the provided value. * @param list A storage pointer to the underlying list. * @param value The element value. * @param lesserKey The key of the element which could be just left of the new value. * @param greaterKey The key of the element which could be just right of the new value. * @return The correct lesserKey/greaterKey keys. */ function getLesserAndGreater( List storage list, uint256 value, bytes32 lesserKey, bytes32 greaterKey ) private view returns (bytes32, bytes32) { // Check for one of the following conditions and fail if none are met: // 1. The value is less than the current lowest value // 2. The value is greater than the current greatest value // 3. The value is just greater than the value for `lesserKey` // 4. The value is just less than the value for `greaterKey` if (lesserKey == bytes32(0) && isValueBetween(list, value, lesserKey, list.list.tail)) { return (lesserKey, list.list.tail); } else if ( greaterKey == bytes32(0) && isValueBetween(list, value, list.list.head, greaterKey) ) { return (list.list.head, greaterKey); } else if ( lesserKey != bytes32(0) && isValueBetween(list, value, lesserKey, list.list.elements[lesserKey].nextKey) ) { return (lesserKey, list.list.elements[lesserKey].nextKey); } else if ( greaterKey != bytes32(0) && isValueBetween(list, value, list.list.elements[greaterKey].previousKey, greaterKey) ) { return (list.list.elements[greaterKey].previousKey, greaterKey); } else { require(false, "get lesser and greater failure"); } } /** * @notice Returns whether or not a given element is between two other elements. * @param list A storage pointer to the underlying list. * @param value The element value. * @param lesserKey The key of the element whose value should be lesserKey. * @param greaterKey The key of the element whose value should be greaterKey. * @return True if the given element is between the two other elements. */ function isValueBetween(List storage list, uint256 value, bytes32 lesserKey, bytes32 greaterKey) private view returns (bool) { bool isLesser = lesserKey == bytes32(0) || list.values[lesserKey] <= value; bool isGreater = greaterKey == bytes32(0) || list.values[greaterKey] >= value; return isLesser && isGreater; } }
SortedLinkedListWithMedian.sol
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./LinkedList.sol"; import "./SortedLinkedList.sol"; /** * @title Maintains a sorted list of unsigned ints keyed by bytes32. */ library SortedLinkedListWithMedian { using SafeMath for uint256; using SortedLinkedList for SortedLinkedList.List; enum MedianAction { None, Lesser, Greater } enum MedianRelation { Undefined, Lesser, Greater, Equal } struct List { SortedLinkedList.List list; bytes32 median; mapping(bytes32 => MedianRelation) relation; } /** * @notice Inserts an element into a doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to insert. * @param value The element value. * @param lesserKey The key of the element less than the element to insert. * @param greaterKey The key of the element greater than the element to insert. */ function insert( List storage list, bytes32 key, uint256 value, bytes32 lesserKey, bytes32 greaterKey ) internal { list.list.insert(key, value, lesserKey, greaterKey); LinkedList.Element storage element = list.list.list.elements[key]; MedianAction action = MedianAction.None; if (list.list.list.numElements == 1) { list.median = key; list.relation[key] = MedianRelation.Equal; } else if (list.list.list.numElements % 2 == 1) { // When we have an odd number of elements, and the element that we inserted is less than // the previous median, we need to slide the median down one element, since we had previously // selected the greater of the two middle elements. if ( element.previousKey == bytes32(0) || list.relation[element.previousKey] == MedianRelation.Lesser ) { action = MedianAction.Lesser; list.relation[key] = MedianRelation.Lesser; } else { list.relation[key] = MedianRelation.Greater; } } else { // When we have an even number of elements, and the element that we inserted is greater than // the previous median, we need to slide the median up one element, since we always select // the greater of the two middle elements. if ( element.nextKey == bytes32(0) || list.relation[element.nextKey] == MedianRelation.Greater ) { action = MedianAction.Greater; list.relation[key] = MedianRelation.Greater; } else { list.relation[key] = MedianRelation.Lesser; } } updateMedian(list, action); } /** * @notice Removes an element from the doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to remove. */ function remove(List storage list, bytes32 key) internal { MedianAction action = MedianAction.None; if (list.list.list.numElements == 0) { list.median = bytes32(0); } else if (list.list.list.numElements % 2 == 0) { // When we have an even number of elements, we always choose the higher of the two medians. // Thus, if the element we're removing is greaterKey than or equal to the median we need to // slide the median left by one. if ( list.relation[key] == MedianRelation.Greater || list.relation[key] == MedianRelation.Equal ) { action = MedianAction.Lesser; } } else { // When we don't have an even number of elements, we just choose the median value. // Thus, if the element we're removing is less than or equal to the median, we need to slide // median right by one. if ( list.relation[key] == MedianRelation.Lesser || list.relation[key] == MedianRelation.Equal ) { action = MedianAction.Greater; } } updateMedian(list, action); list.list.remove(key); } /** * @notice Updates an element in the list. * @param list A storage pointer to the underlying list. * @param key The element key. * @param value The element value. * @param lesserKey The key of the element will be just left of `key` after the update. * @param greaterKey The key of the element will be just right of `key` after the update. * @dev Note that only one of "lesserKey" or "greaterKey" needs to be correct to reduce friction. */ function update( List storage list, bytes32 key, uint256 value, bytes32 lesserKey, bytes32 greaterKey ) internal { remove(list, key); insert(list, key, value, lesserKey, greaterKey); } /** * @notice Inserts an element at the tail of the doubly linked list. * @param list A storage pointer to the underlying list. * @param key The key of the element to insert. */ function push(List storage list, bytes32 key) internal { insert(list, key, 0, bytes32(0), list.list.list.tail); } /** * @notice Removes N elements from the head of the list and returns their keys. * @param list A storage pointer to the underlying list. * @param n The number of elements to pop. * @return The keys of the popped elements. */ function popN(List storage list, uint256 n) internal returns (bytes32[] memory) { require(n <= list.list.list.numElements, "not enough elements"); bytes32[] memory keys = new bytes32[](n); for (uint256 i = 0; i < n; i = i.add(1)) { bytes32 key = list.list.list.head; keys[i] = key; remove(list, key); } return keys; } /** * @notice Returns whether or not a particular key is present in the sorted list. * @param list A storage pointer to the underlying list. * @param key The element key. * @return Whether or not the key is in the sorted list. */ function contains(List storage list, bytes32 key) internal view returns (bool) { return list.list.contains(key); } /** * @notice Returns the value for a particular key in the sorted list. * @param list A storage pointer to the underlying list. * @param key The element key. * @return The element value. */ function getValue(List storage list, bytes32 key) internal view returns (uint256) { return list.list.values[key]; } /** * @notice Returns the median value of the sorted list. * @param list A storage pointer to the underlying list. * @return The median value. */ function getMedianValue(List storage list) internal view returns (uint256) { return getValue(list, list.median); } /** * @notice Returns the key of the first element in the list. * @param list A storage pointer to the underlying list. * @return The key of the first element in the list. */ function getHead(List storage list) internal view returns (bytes32) { return list.list.list.head; } /** * @notice Returns the key of the median element in the list. * @param list A storage pointer to the underlying list. * @return The key of the median element in the list. */ function getMedian(List storage list) internal view returns (bytes32) { return list.median; } /** * @notice Returns the key of the last element in the list. * @param list A storage pointer to the underlying list. * @return The key of the last element in the list. */ function getTail(List storage list) internal view returns (bytes32) { return list.list.list.tail; } /** * @notice Returns the number of elements in the list. * @param list A storage pointer to the underlying list. * @return The number of elements in the list. */ function getNumElements(List storage list) internal view returns (uint256) { return list.list.list.numElements; } /** * @notice Gets all elements from the doubly linked list. * @param list A storage pointer to the underlying list. * @return An unpacked list of elements from largest to smallest. */ function getElements(List storage list) internal view returns (bytes32[] memory, uint256[] memory, MedianRelation[] memory) { bytes32[] memory keys = getKeys(list); uint256[] memory values = new uint256[](keys.length); MedianRelation[] memory relations = new MedianRelation[](keys.length); for (uint256 i = 0; i < keys.length; i = i.add(1)) { values[i] = list.list.values[keys[i]]; relations[i] = list.relation[keys[i]]; } return (keys, values, relations); } /** * @notice Gets all element keys from the doubly linked list. * @param list A storage pointer to the underlying list. * @return All element keys from head to tail. */ function getKeys(List storage list) internal view returns (bytes32[] memory) { return list.list.getKeys(); } /** * @notice Moves the median pointer right or left of its current value. * @param list A storage pointer to the underlying list. * @param action Which direction to move the median pointer. */ function updateMedian(List storage list, MedianAction action) private { LinkedList.Element storage previousMedian = list.list.list.elements[list.median]; if (action == MedianAction.Lesser) { list.relation[list.median] = MedianRelation.Greater; list.median = previousMedian.previousKey; } else if (action == MedianAction.Greater) { list.relation[list.median] = MedianRelation.Lesser; list.median = previousMedian.nextKey; } list.relation[list.median] = MedianRelation.Equal; } }
ISortedOracles.sol
pragma solidity ^0.5.13; interface ISortedOracles { function addOracle(address, address) external; function removeOracle(address, address, uint256) external; function report(address, uint256, address, address) external; function removeExpiredReports(address, uint256) external; function isOldestReportExpired(address token) external view returns (bool, address); function numRates(address) external view returns (uint256); function medianRate(address) external view returns (uint256, uint256); function numTimestamps(address) external view returns (uint256); function medianTimestamp(address) external view returns (uint256); }
Context.sol
pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
SafeMath.sol
pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot 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-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
Ownable.sol
pragma solidity ^0.5.0; import "../GSN/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"MedianUpdated","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OracleAdded","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"oracleAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OracleRemoved","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"oracleAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OracleReportRemoved","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"oracle","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OracleReported","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"oracle","internalType":"address","indexed":true},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReportExpirySet","inputs":[{"type":"uint256","name":"reportExpiry","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TokenReportExpirySet","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"reportExpiry","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addOracle","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"oracleAddress","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getOracles","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"},{"type":"uint256[]","name":"","internalType":"uint256[]"},{"type":"uint8[]","name":"","internalType":"enum SortedLinkedListWithMedian.MedianRelation[]"}],"name":"getRates","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"","internalType":"address[]"},{"type":"uint256[]","name":"","internalType":"uint256[]"},{"type":"uint8[]","name":"","internalType":"enum SortedLinkedListWithMedian.MedianRelation[]"}],"name":"getTimestamps","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTokenReportExpirySeconds","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersionNumber","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"initialize","inputs":[{"type":"uint256","name":"_reportExpirySeconds","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"initialized","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"},{"type":"address","name":"","internalType":"address"}],"name":"isOldestReportExpired","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOracle","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"medianRate","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"medianTimestamp","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"numRates","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"numTimestamps","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"oracles","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeExpiredReports","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"n","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeOracle","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"oracleAddress","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"report","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"address","name":"lesserKey","internalType":"address"},{"type":"address","name":"greaterKey","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"reportExpirySeconds","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setReportExpiry","inputs":[{"type":"uint256","name":"_reportExpirySeconds","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setTokenReportExpiry","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_reportExpirySeconds","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenReportExpirySeconds","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}],"constant":false}]
Contract Creation Code
0x608060405260006100146100b760201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3506100bf565b600033905090565b613ed280620000cf6000396000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c80638e749281116100de578063ebc1d6bb11610097578063f2fde38b11610071578063f2fde38b14610a64578063fc20935d14610aa8578063fe4b84df14610af6578063ffe736bf14610b245761018e565b8063ebc1d6bb14610973578063ef90e1b0146109a1578063f0ca4adb14610a005761018e565b80638e7492811461065b5780638f32d59b146106f4578063a00a8b2c14610716578063b9292158146107a4578063bbc66a94146108cd578063dd34ca3b146109255761018e565b806353a572971161014b5780636deb6799116101255780636deb679914610521578063715018a61461057957806380e50744146105835780638da5cb5b146106115761018e565b806353a572971461042857806354255be0146104965780636dd6ef0c146104c95761018e565b806302f55b6114610193578063071b48fc146102bc578063158ef93e146103145780632e86bc0114610336578063370c998e1461038e578063493a353c1461040a575b600080fd5b6101d5600480360360208110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb3565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015610220578082015181840152602081019050610205565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015610262578082015181840152602081019050610247565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156102a4578082015181840152602081019050610289565b50505050905001965050505050505060405180910390f35b6102fe600480360360208110156102d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4f565b6040518082815260200191505060405180910390f35b61031c610f22565b604051808215151515815260200191505060405180910390f35b6103786004803603602081101561034c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f35565b6040518082815260200191505060405180910390f35b6103f0600480360360408110156103a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f4d565b604051808215151515815260200191505060405180910390f35b610412610f7c565b6040518082815260200191505060405180910390f35b6104946004803603606081101561043e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f82565b005b61049e6114be565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b61050b600480360360208110156104df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114e5565b6040518082815260200191505060405180910390f35b6105636004803603602081101561053757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115b8565b6040518082815260200191505060405180910390f35b610581611653565b005b61060f6004803603608081101561059957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061178c565b005b610619612163565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61069d6004803603602081101561067157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061218c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e05780820151818401526020810190506106c5565b505050509050019250505060405180910390f35b6106fc612259565b604051808215151515815260200191505060405180910390f35b6107626004803603604081101561072c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506122b7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107e6600480360360208110156107ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612302565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015610831578082015181840152602081019050610816565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015610873578082015181840152602081019050610858565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156108b557808201518184015260208101905061089a565b50505050905001965050505050505060405180910390f35b61090f600480360360208110156108e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061259e565b6040518082815260200191505060405180910390f35b6109716004803603604081101561093b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612671565b005b61099f6004803603602081101561098957600080fd5b8101908080359060200190929190505050612827565b005b6109e3600480360360208110156109b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612996565b604051808381526020018281526020019250505060405180910390f35b610a6260048036036040811015610a1657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a8f565b005b610aa660048036036020811015610a7a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612df1565b005b610af460048036036040811015610abe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612e77565b005b610b2260048036036020811015610b0c57600080fd5b8101908080359060200190929190505050613095565b005b610b6660048036036020811015610b3a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613148565b60405180831515151581526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6060806060600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636cfa387390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015610c4757600080fd5b505af4158015610c5b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506060811015610c8557600080fd5b8101908080516040519392919084640100000000821115610ca557600080fd5b83820191506020820185811115610cbb57600080fd5b8251866020820283011164010000000082111715610cd857600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610d0f578082015181840152602081019050610cf4565b5050505090500160405260200180516040519392919084640100000000821115610d3857600080fd5b83820191506020820185811115610d4e57600080fd5b8251866020820283011164010000000082111715610d6b57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610da2578082015181840152602081019050610d87565b5050505090500160405260200180516040519392919084640100000000821115610dcb57600080fd5b83820191506020820185811115610de157600080fd5b8251866020820283011164010000000082111715610dfe57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610e35578082015181840152602081019050610e1a565b505050509050016040525050509250925092509193909250565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610ee057600080fd5b505af4158015610ef4573d6000803e3d6000fd5b505050506040513d6020811015610f0a57600080fd5b81019080805190602001909291905050509050919050565b600060149054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b60036020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60055481565b610f8a612259565b610ffc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156110665750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156110b3575080600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050115b801561115e57508173ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061111b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6111b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526056815260200180613d5c6056913960600191505060405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206112dd6001600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905061339390919063ffffffff16565b815481106112e757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061135c57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506113fa6001600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905061339390919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020816114449190613cb0565b5061144f83836133dd565b1561145f5761145e83836135eb565b5b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f6dc84b66cc948d847632b9d829f7cb1cb904fbf2c084554a9bc22ad9d845334060405160405180910390a3505050565b60008060008060018060026000839350829250819150809050935093509350935090919293565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561157657600080fd5b505af415801561158a573d6000803e3d6000fd5b505050506040513d60208110156115a057600080fd5b81019080805190602001909291905050509050919050565b600080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561160b57600554905061164e565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b61165b612259565b6116cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b83600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661186c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180613e0c6027913960400191505060405180910390fd5b6000600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156118fd57600080fd5b505af4158015611911573d6000803e3d6000fd5b505050506040513d602081101561192757600080fd5b81019080805190602001909291905050509050600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416395073a799091336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156119fd57600080fd5b505af4158015611a11573d6000803e3d6000fd5b505050506040513d6020811015611a2757600080fd5b810190808051906020019092919050505015611c6857600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163832a21479091338888886040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b158015611b7057600080fd5b505af4158015611b84573d6000803e3d6000fd5b50505050600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163c1e728e99091336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b158015611c4b57600080fd5b505af4158015611c5f573d6000803e3d6000fd5b50505050611db4565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163d4a092729091338888886040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b158015611d9b57600080fd5b505af4158015611daf573d6000803e3d6000fd5b505050505b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163d4a0927290913342600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941630944c59490916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611ea057600080fd5b505af4158015611eb4573d6000803e3d6000fd5b505050506040513d6020811015611eca57600080fd5b810190808051906020019092919050505060006040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b158015611fb157600080fd5b505af4158015611fc5573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f7cebb17173a9ed273d2b7538f64395c0ebf352ff743f1cf8ce66b437a61442134288604051808381526020018281526020019250505060405180910390a36000600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156120c757600080fd5b505af41580156120db573d6000803e3d6000fd5b505050506040513d60208110156120f157600080fd5b8101908080519060200190929190505050905081811461215a578673ffffffffffffffffffffffffffffffffffffffff167fa9981ebfc3b766a742486e898f54959b050a66006dbce1a4155c1f84a08bcf41826040518082815260200191505060405180910390a25b50505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561224d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612203575b50505050509050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661229b613a1c565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b600460205281600052604060002081815481106122d057fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060806060600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636cfa387390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b15801561239657600080fd5b505af41580156123aa573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060608110156123d457600080fd5b81019080805160405193929190846401000000008211156123f457600080fd5b8382019150602082018581111561240a57600080fd5b825186602082028301116401000000008211171561242757600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561245e578082015181840152602081019050612443565b505050509050016040526020018051604051939291908464010000000082111561248757600080fd5b8382019150602082018581111561249d57600080fd5b82518660208202830111640100000000821117156124ba57600080fd5b8083526020830192505050908051906020019060200280838360005b838110156124f15780820151818401526020810190506124d6565b505050509050016040526020018051604051939291908464010000000082111561251a57600080fd5b8382019150602082018581111561253057600080fd5b825186602082028301116401000000008211171561254d57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015612584578082015181840152602081019050612569565b505050509050016040525050509250925092509193909250565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561262f57600080fd5b505af4158015612643573d6000803e3d6000fd5b505050506040513d602081101561265957600080fd5b81019080805190602001909291905050509050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156127765750600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561273857600080fd5b505af415801561274c573d6000803e3d6000fd5b505050506040513d602081101561276257600080fd5b810190808051906020019092919050505081105b6127cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180613d286034913960400191505060405180910390fd5b60008090505b81811015612822576000806127e585613148565b9150915081156127fe576127f985826135eb565b612805565b5050612822565b505061281b600182613a2490919063ffffffff16565b90506127d1565b505050565b61282f612259565b6128a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600081116128fa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613e7d6021913960400191505060405180910390fd5b600554811415612955576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613e5b6022913960400191505060405180910390fd5b806005819055507fc68a9b88effd8a11611ff410efbc83569f0031b7bc70dd455b61344c7f0a042f816040518082815260200191505060405180910390a150565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612a2857600080fd5b505af4158015612a3c573d6000803e3d6000fd5b505050506040513d6020811015612a5257600080fd5b81019080805190602001909291905050506000612a6e8561259e565b14612a835769d3c21bcecceda1000000612a86565b60005b91509150915091565b612a97612259565b612b09576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015612b735750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b8015612c065750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b612c5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252605a815260200180613db2605a913960600191505060405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f828d2be040dede7698182e08dfa8bfbd663c879aee772509c4a2bd961d0ed43f60405160405180910390a35050565b612df9612259565b612e6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b612e7481613aac565b50565b612e7f612259565b612ef1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111612f4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613e7d6021913960400191505060405180910390fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811415612fe2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180613e336028913960400191505060405180910390fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507ff8324c8592dfd9991ee3e717351afe0a964605257959e3d99b0eb3d45bff94228282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600060149054906101000a900460ff1615613118576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff02191690831515021790555061313c33613aac565b61314581612827565b50565b600080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561318557600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163d938ec7b90916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561321657600080fd5b505af415801561322a573d6000803e3d6000fd5b505050506040513d602081101561324057600080fd5b810190808051906020019092919050505090506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941637c6bb8629091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561331857600080fd5b505af415801561332c573d6000803e3d6000fd5b505050506040513d602081101561334257600080fd5b8101908080519060200190929190505050905061335e856115b8565b613371824261339390919063ffffffff16565b106133845760018293509350505061338e565b6000829350935050505b915091565b60006133d583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613bf0565b905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416395073a799091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156134a257600080fd5b505af41580156134b6573d6000803e3d6000fd5b505050506040513d60208110156134cc57600080fd5b810190808051906020019092919050505080156135e35750600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416395073a799091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156135a757600080fd5b505af41580156135bb573d6000803e3d6000fd5b505050506040513d60208110156135d157600080fd5b81019080805190602001909291905050505b905092915050565b60016135f6836114e5565b148015613609575061360882826133dd565b5b1561361357613a18565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156136a457600080fd5b505af41580156136b8573d6000803e3d6000fd5b505050506040513d60208110156136ce57600080fd5b81019080805190602001909291905050509050600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163c1e728e99091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b1580156137a457600080fd5b505af41580156137b8573d6000803e3d6000fd5b50505050600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163c1e728e99091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b15801561387f57600080fd5b505af4158015613893573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fe21a44017b6fa1658d84e937d56ff408501facdb4ff7427c479ac460d76f789360405160405180910390a36000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561398257600080fd5b505af4158015613996573d6000803e3d6000fd5b505050506040513d60208110156139ac57600080fd5b81019080805190602001909291905050509050818114613a15578373ffffffffffffffffffffffffffffffffffffffff167fa9981ebfc3b766a742486e898f54959b050a66006dbce1a4155c1f84a08bcf41826040518082815260200191505060405180910390a25b50505b5050565b600033905090565b600080828401905083811015613aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613b32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613d026026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000838311158290613c9d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613c62578082015181840152602081019050613c47565b50505050905090810190601f168015613c8f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b815481835581811115613cd757818360005260206000209182019101613cd69190613cdc565b5b505050565b613cfe91905b80821115613cfa576000816000905550600101613ce2565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373746f6b656e2061646472206e756c6c206f7220747279696e6720746f2072656d6f766520746f6f206d616e79207265706f727473746f6b656e2061646472206e756c6c206f72206f7261636c652061646472206e756c6c206f7220696e646578206f6620746f6b656e206f7261636c65206e6f74206d617070656420746f206f7261636c652061646472746f6b656e206164647220776173206e756c6c206f72206f7261636c65206164647220776173206e756c6c206f72206f7261636c652061646472206973206e6f7420616e206f7261636c6520666f7220746f6b656e206164647273656e64657220776173206e6f7420616e206f7261636c6520666f7220746f6b656e2061646472746f6b656e207265706f72744578706972795365636f6e6473206861736e2774206368616e6765647265706f72744578706972795365636f6e6473206861736e2774206368616e6765647265706f727420657870697279207365636f6e6473206d757374206265203e2030a265627a7a723158203844c4881d8e16ca82269c6e66270274305471ab65c0c9076584913e10cb373364736f6c634300050d0032
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638e749281116100de578063ebc1d6bb11610097578063f2fde38b11610071578063f2fde38b14610a64578063fc20935d14610aa8578063fe4b84df14610af6578063ffe736bf14610b245761018e565b8063ebc1d6bb14610973578063ef90e1b0146109a1578063f0ca4adb14610a005761018e565b80638e7492811461065b5780638f32d59b146106f4578063a00a8b2c14610716578063b9292158146107a4578063bbc66a94146108cd578063dd34ca3b146109255761018e565b806353a572971161014b5780636deb6799116101255780636deb679914610521578063715018a61461057957806380e50744146105835780638da5cb5b146106115761018e565b806353a572971461042857806354255be0146104965780636dd6ef0c146104c95761018e565b806302f55b6114610193578063071b48fc146102bc578063158ef93e146103145780632e86bc0114610336578063370c998e1461038e578063493a353c1461040a575b600080fd5b6101d5600480360360208110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb3565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015610220578082015181840152602081019050610205565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015610262578082015181840152602081019050610247565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156102a4578082015181840152602081019050610289565b50505050905001965050505050505060405180910390f35b6102fe600480360360208110156102d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4f565b6040518082815260200191505060405180910390f35b61031c610f22565b604051808215151515815260200191505060405180910390f35b6103786004803603602081101561034c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f35565b6040518082815260200191505060405180910390f35b6103f0600480360360408110156103a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f4d565b604051808215151515815260200191505060405180910390f35b610412610f7c565b6040518082815260200191505060405180910390f35b6104946004803603606081101561043e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f82565b005b61049e6114be565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b61050b600480360360208110156104df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114e5565b6040518082815260200191505060405180910390f35b6105636004803603602081101561053757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115b8565b6040518082815260200191505060405180910390f35b610581611653565b005b61060f6004803603608081101561059957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061178c565b005b610619612163565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61069d6004803603602081101561067157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061218c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e05780820151818401526020810190506106c5565b505050509050019250505060405180910390f35b6106fc612259565b604051808215151515815260200191505060405180910390f35b6107626004803603604081101561072c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506122b7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107e6600480360360208110156107ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612302565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015610831578082015181840152602081019050610816565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015610873578082015181840152602081019050610858565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156108b557808201518184015260208101905061089a565b50505050905001965050505050505060405180910390f35b61090f600480360360208110156108e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061259e565b6040518082815260200191505060405180910390f35b6109716004803603604081101561093b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612671565b005b61099f6004803603602081101561098957600080fd5b8101908080359060200190929190505050612827565b005b6109e3600480360360208110156109b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612996565b604051808381526020018281526020019250505060405180910390f35b610a6260048036036040811015610a1657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a8f565b005b610aa660048036036020811015610a7a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612df1565b005b610af460048036036040811015610abe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612e77565b005b610b2260048036036020811015610b0c57600080fd5b8101908080359060200190929190505050613095565b005b610b6660048036036020811015610b3a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613148565b60405180831515151581526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6060806060600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636cfa387390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015610c4757600080fd5b505af4158015610c5b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506060811015610c8557600080fd5b8101908080516040519392919084640100000000821115610ca557600080fd5b83820191506020820185811115610cbb57600080fd5b8251866020820283011164010000000082111715610cd857600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610d0f578082015181840152602081019050610cf4565b5050505090500160405260200180516040519392919084640100000000821115610d3857600080fd5b83820191506020820185811115610d4e57600080fd5b8251866020820283011164010000000082111715610d6b57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610da2578082015181840152602081019050610d87565b5050505090500160405260200180516040519392919084640100000000821115610dcb57600080fd5b83820191506020820185811115610de157600080fd5b8251866020820283011164010000000082111715610dfe57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610e35578082015181840152602081019050610e1a565b505050509050016040525050509250925092509193909250565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610ee057600080fd5b505af4158015610ef4573d6000803e3d6000fd5b505050506040513d6020811015610f0a57600080fd5b81019080805190602001909291905050509050919050565b600060149054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b60036020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60055481565b610f8a612259565b610ffc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156110665750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156110b3575080600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050115b801561115e57508173ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061111b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6111b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526056815260200180613d5c6056913960600191505060405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206112dd6001600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905061339390919063ffffffff16565b815481106112e757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061135c57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506113fa6001600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905061339390919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020816114449190613cb0565b5061144f83836133dd565b1561145f5761145e83836135eb565b5b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f6dc84b66cc948d847632b9d829f7cb1cb904fbf2c084554a9bc22ad9d845334060405160405180910390a3505050565b60008060008060018060026000839350829250819150809050935093509350935090919293565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561157657600080fd5b505af415801561158a573d6000803e3d6000fd5b505050506040513d60208110156115a057600080fd5b81019080805190602001909291905050509050919050565b600080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561160b57600554905061164e565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b61165b612259565b6116cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b83600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661186c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180613e0c6027913960400191505060405180910390fd5b6000600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156118fd57600080fd5b505af4158015611911573d6000803e3d6000fd5b505050506040513d602081101561192757600080fd5b81019080805190602001909291905050509050600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416395073a799091336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156119fd57600080fd5b505af4158015611a11573d6000803e3d6000fd5b505050506040513d6020811015611a2757600080fd5b810190808051906020019092919050505015611c6857600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163832a21479091338888886040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b158015611b7057600080fd5b505af4158015611b84573d6000803e3d6000fd5b50505050600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163c1e728e99091336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b158015611c4b57600080fd5b505af4158015611c5f573d6000803e3d6000fd5b50505050611db4565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163d4a092729091338888886040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b158015611d9b57600080fd5b505af4158015611daf573d6000803e3d6000fd5b505050505b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163d4a0927290913342600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941630944c59490916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611ea057600080fd5b505af4158015611eb4573d6000803e3d6000fd5b505050506040513d6020811015611eca57600080fd5b810190808051906020019092919050505060006040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b158015611fb157600080fd5b505af4158015611fc5573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f7cebb17173a9ed273d2b7538f64395c0ebf352ff743f1cf8ce66b437a61442134288604051808381526020018281526020019250505060405180910390a36000600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156120c757600080fd5b505af41580156120db573d6000803e3d6000fd5b505050506040513d60208110156120f157600080fd5b8101908080519060200190929190505050905081811461215a578673ffffffffffffffffffffffffffffffffffffffff167fa9981ebfc3b766a742486e898f54959b050a66006dbce1a4155c1f84a08bcf41826040518082815260200191505060405180910390a25b50505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561224d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612203575b50505050509050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661229b613a1c565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b600460205281600052604060002081815481106122d057fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060806060600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636cfa387390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b15801561239657600080fd5b505af41580156123aa573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060608110156123d457600080fd5b81019080805160405193929190846401000000008211156123f457600080fd5b8382019150602082018581111561240a57600080fd5b825186602082028301116401000000008211171561242757600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561245e578082015181840152602081019050612443565b505050509050016040526020018051604051939291908464010000000082111561248757600080fd5b8382019150602082018581111561249d57600080fd5b82518660208202830111640100000000821117156124ba57600080fd5b8083526020830192505050908051906020019060200280838360005b838110156124f15780820151818401526020810190506124d6565b505050509050016040526020018051604051939291908464010000000082111561251a57600080fd5b8382019150602082018581111561253057600080fd5b825186602082028301116401000000008211171561254d57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015612584578082015181840152602081019050612569565b505050509050016040525050509250925092509193909250565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561262f57600080fd5b505af4158015612643573d6000803e3d6000fd5b505050506040513d602081101561265957600080fd5b81019080805190602001909291905050509050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156127765750600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561273857600080fd5b505af415801561274c573d6000803e3d6000fd5b505050506040513d602081101561276257600080fd5b810190808051906020019092919050505081105b6127cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180613d286034913960400191505060405180910390fd5b60008090505b81811015612822576000806127e585613148565b9150915081156127fe576127f985826135eb565b612805565b5050612822565b505061281b600182613a2490919063ffffffff16565b90506127d1565b505050565b61282f612259565b6128a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600081116128fa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613e7d6021913960400191505060405180910390fd5b600554811415612955576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613e5b6022913960400191505060405180910390fd5b806005819055507fc68a9b88effd8a11611ff410efbc83569f0031b7bc70dd455b61344c7f0a042f816040518082815260200191505060405180910390a150565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612a2857600080fd5b505af4158015612a3c573d6000803e3d6000fd5b505050506040513d6020811015612a5257600080fd5b81019080805190602001909291905050506000612a6e8561259e565b14612a835769d3c21bcecceda1000000612a86565b60005b91509150915091565b612a97612259565b612b09576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015612b735750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b8015612c065750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b612c5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252605a815260200180613db2605a913960600191505060405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f828d2be040dede7698182e08dfa8bfbd663c879aee772509c4a2bd961d0ed43f60405160405180910390a35050565b612df9612259565b612e6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b612e7481613aac565b50565b612e7f612259565b612ef1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111612f4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613e7d6021913960400191505060405180910390fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811415612fe2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180613e336028913960400191505060405180910390fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507ff8324c8592dfd9991ee3e717351afe0a964605257959e3d99b0eb3d45bff94228282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600060149054906101000a900460ff1615613118576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff02191690831515021790555061313c33613aac565b61314581612827565b50565b600080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561318557600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163d938ec7b90916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561321657600080fd5b505af415801561322a573d6000803e3d6000fd5b505050506040513d602081101561324057600080fd5b810190808051906020019092919050505090506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c941637c6bb8629091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561331857600080fd5b505af415801561332c573d6000803e3d6000fd5b505050506040513d602081101561334257600080fd5b8101908080519060200190929190505050905061335e856115b8565b613371824261339390919063ffffffff16565b106133845760018293509350505061338e565b6000829350935050505b915091565b60006133d583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613bf0565b905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416395073a799091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156134a257600080fd5b505af41580156134b6573d6000803e3d6000fd5b505050506040513d60208110156134cc57600080fd5b810190808051906020019092919050505080156135e35750600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416395073a799091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156135a757600080fd5b505af41580156135bb573d6000803e3d6000fd5b505050506040513d60208110156135d157600080fd5b81019080805190602001909291905050505b905092915050565b60016135f6836114e5565b148015613609575061360882826133dd565b5b1561361357613a18565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156136a457600080fd5b505af41580156136b8573d6000803e3d6000fd5b505050506040513d60208110156136ce57600080fd5b81019080805190602001909291905050509050600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163c1e728e99091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b1580156137a457600080fd5b505af41580156137b8573d6000803e3d6000fd5b50505050600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c94163c1e728e99091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b15801561387f57600080fd5b505af4158015613893573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fe21a44017b6fa1658d84e937d56ff408501facdb4ff7427c479ac460d76f789360405160405180910390a36000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073147f2a2e9ab1f6d7c42b25a30e4d3fd57186c9416359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561398257600080fd5b505af4158015613996573d6000803e3d6000fd5b505050506040513d60208110156139ac57600080fd5b81019080805190602001909291905050509050818114613a15578373ffffffffffffffffffffffffffffffffffffffff167fa9981ebfc3b766a742486e898f54959b050a66006dbce1a4155c1f84a08bcf41826040518082815260200191505060405180910390a25b50505b5050565b600033905090565b600080828401905083811015613aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613b32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613d026026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000838311158290613c9d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613c62578082015181840152602081019050613c47565b50505050905090810190601f168015613c8f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b815481835581811115613cd757818360005260206000209182019101613cd69190613cdc565b5b505050565b613cfe91905b80821115613cfa576000816000905550600101613ce2565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373746f6b656e2061646472206e756c6c206f7220747279696e6720746f2072656d6f766520746f6f206d616e79207265706f727473746f6b656e2061646472206e756c6c206f72206f7261636c652061646472206e756c6c206f7220696e646578206f6620746f6b656e206f7261636c65206e6f74206d617070656420746f206f7261636c652061646472746f6b656e206164647220776173206e756c6c206f72206f7261636c65206164647220776173206e756c6c206f72206f7261636c652061646472206973206e6f7420616e206f7261636c6520666f7220746f6b656e206164647273656e64657220776173206e6f7420616e206f7261636c6520666f7220746f6b656e2061646472746f6b656e207265706f72744578706972795365636f6e6473206861736e2774206368616e6765647265706f72744578706972795365636f6e6473206861736e2774206368616e6765647265706f727420657870697279207365636f6e6473206d757374206265203e2030a265627a7a723158203844c4881d8e16ca82269c6e66270274305471ab65c0c9076584913e10cb373364736f6c634300050d0032