Address Details
contract
0x35a4f0C8C0B48769F036b79F9d428BeA286f6ab5
- Contract Name
- SortedOracles
- Creator
- 0xf3eb91–a79239 at 0x5b95c4–c70ae9
- 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
- 27611111
This contract has been 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
- 2024-03-09T11:11:54.204884Z
project:/contracts/stability/SortedOracles.sol
// SPDX-License-Identifier: GPL-3.0-or-later 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 "./interfaces/IBreakerBox.sol"; import "../common/FixidityLib.sol"; import "../common/Initializable.sol"; import "../common/linkedlists/AddressSortedLinkedListWithMedian.sol"; import "../common/linkedlists/SortedLinkedListWithMedian.sol"; /** * @title SortedOracles * * @notice This contract stores a collection of exchange rates with CELO * expressed in units of other assets. The most recent exchange rates * are gathered off-chain by oracles, who then use the `report` function to * submit the rates to this contract. Before submitting a rate report, an * oracle's address must be added to the `isOracle` mapping for a specific * rateFeedId, with the flag set to true. While submitting a report requires * an address to be added to the mapping, no additional permissions are needed * to read the reports, the calculated median rate, or the list of oracles. * * @dev A unique rateFeedId identifies each exchange rate. In the initial implementation * of this contract, the rateFeedId was set as the address of the stable * asset contract that used the rate. However, this implementation has since * been updated, and the rateFeedId now also refers to an address derived from the * concatenation other asset symbols. This change enables the contract to store multiple exchange rates for a * single token. As a result of this change, there may be instances * where the term "token" is used in the contract code. These useages of the term * "token" are actually referring to the rateFeedId. * */ contract SortedOracles is ISortedOracles, ICeloVersionedContract, Ownable, Initializable { using SafeMath for uint256; using AddressSortedLinkedListWithMedian for SortedLinkedListWithMedian.List; using FixidityLib for FixidityLib.Fraction; struct EquivalentToken { address token; } uint256 private constant FIXED1_UINT = 1e24; // Maps a rateFeedID to a sorted list of report values. mapping(address => SortedLinkedListWithMedian.List) private rates; // Maps a rateFeedID 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; // Maps a rateFeedId to its report expiry time in seconds. mapping(address => uint256) public tokenReportExpirySeconds; IBreakerBox public breakerBox; // Maps a token address to its equivalent token address. // Original token will return the median value same as the value of equivalent token. mapping(address => EquivalentToken) public equivalentTokens; 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); event BreakerBoxUpdated(address indexed newBreakerBox); event EquivalentTokenSet(address indexed token, address indexed equivalentToken); 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 Storage version of the contract. * @return Major version of the contract. * @return Minor version of the contract. * @return Patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { return (1, 1, 3, 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 rateFeedId. * @param _token The token for which the report expiry is being set. * @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 Sets the address of the BreakerBox. * @param newBreakerBox The new BreakerBox address. */ function setBreakerBox(IBreakerBox newBreakerBox) public onlyOwner { require(address(newBreakerBox) != address(0), "BreakerBox address must be set"); breakerBox = newBreakerBox; emit BreakerBoxUpdated(address(newBreakerBox)); } /** * @notice Adds a new Oracle for a specified rate feed. * @param token The token for which the specified oracle is to be added. * @param oracleAddress The address of the oracle. */ function addOracle(address token, address oracleAddress) external onlyOwner { // solhint-disable-next-line reason-string require( token != address(0) && oracleAddress != address(0) && !isOracle[token][oracleAddress], "token addr was null or oracle addr was null or oracle addr is already an oracle for token addr" ); isOracle[token][oracleAddress] = true; oracles[token].push(oracleAddress); emit OracleAdded(token, oracleAddress); } /** * @notice Removes an Oracle from a specified rate feed. * @param token The token from which the specified oracle is to be removed. * @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 { // solhint-disable-next-line reason-string 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].pop(); if (reportExists(token, oracleAddress)) { removeReport(token, oracleAddress); } emit OracleRemoved(token, oracleAddress); } /** * @notice Removes a report that is expired. * @param token The token for which the expired report is to be removed. * @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 token for which the expired report is to be checked. * @return bool A bool indicating if the last report is expired. * @return address Oracle address of the last report. */ function isOldestReportExpired(address token) public view returns (bool, address) { // solhint-disable-next-line reason-string 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 Sets the equivalent token for a token. * @param token The address of the token. * @param equivalentToken The address of the equivalent token. */ function setEquivalentToken(address token, address equivalentToken) external onlyOwner { require(token != address(0), "token address cannot be 0"); require(equivalentToken != address(0), "equivalentToken address cannot be 0"); equivalentTokens[token] = EquivalentToken(equivalentToken); emit EquivalentTokenSet(token, equivalentToken); } /** * @notice Sets the equivalent token for a token. * @param token The address of the token. */ function deleteEquivalentToken(address token) external onlyOwner { require(token != address(0), "token address cannot be 0"); delete equivalentTokens[token]; emit EquivalentTokenSet(token, address(0)); } /** * @notice Gets the equivalent token for a token. * @param token The address of the token. * @return The address of the equivalent token. */ function getEquivalentToken(address token) external view returns (address) { return (equivalentTokens[token].token); } /** * @notice Updates an oracle value and the median. * @param token The token for which the rate is being reported. * @param value The number of stable asset that equate to one unit of collateral asset, for the * specified rateFeedId, 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); } if (address(breakerBox) != address(0)) { breakerBox.checkAndSetBreakers(token); } } /** * @notice Returns the number of rates that are currently stored for a specifed rateFeedId. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the number of rates is being retrieved. * @return uint256 The number of reported oracle rates stored for the given rateFeedId. */ function numRates(address token) public view returns (uint256) { return rates[token].getNumElements(); } /** * @notice Returns the median of the currently stored rates for a specified rateFeedId. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the median value is being retrieved. * @return uint256 The median exchange rate for rateFeedId (fixidity). * @return uint256 denominator */ function medianRateWithoutEquivalentMapping(address token) public view returns (uint256, uint256) { return (rates[token].getMedianValue(), numRates(token) == 0 ? 0 : FIXED1_UINT); } /** * @notice Returns the median of the currently stored rates for a specified rateFeedId. * @dev Please note that this function respects the equivalentToken mapping, and so may * return the median identified as an equivalent to the supplied rateFeedId. * @param token The token for which the median value is being retrieved. * @return uint256 The median exchange rate for rateFeedId (fixidity). * @return uint256 denominator */ function medianRate(address token) external view returns (uint256, uint256) { EquivalentToken storage equivalentToken = equivalentTokens[token]; if (equivalentToken.token != address(0)) { (uint256 equivalentMedianRate, uint256 denominator) = medianRateWithoutEquivalentMapping( equivalentToken.token ); return (equivalentMedianRate, denominator); } return medianRateWithoutEquivalentMapping(token); } /** * @notice Gets all elements from the doubly linked list. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the rates are being retrieved. * @return keys Keys of an unpacked list of elements from largest to smallest. * @return values Values of an unpacked list of elements from largest to smallest. * @return relations Relations of 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. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the number of timestamps is being retrieved. * @return uint256 The number of oracle report timestamps for the specified rateFeedId. */ function numTimestamps(address token) public view returns (uint256) { return timestamps[token].getNumElements(); } /** * @notice Returns the median timestamp. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the median timestamp is being retrieved. * @return uint256 The median report timestamp for the specified rateFeedId. */ function medianTimestamp(address token) external view returns (uint256) { return timestamps[token].getMedianValue(); } /** * @notice Gets all elements from the doubly linked list. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the timestamps are being retrieved. * @return keys Keys of nn unpacked list of elements from largest to smallest. * @return values Values of an unpacked list of elements from largest to smallest. * @return relations Relations of 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 Checks if a report exists for a specified rateFeedId from a given oracle. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the report should be checked. * @param oracle The oracle whose report should be checked. * @return bool True if a report exists, false otherwise. */ 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 speficied rateFeedId. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the oracles are being retrieved. * @return address[] A list of oracles for the given rateFeedId. */ function getOracles(address token) external view returns (address[] memory) { return oracles[token]; } /** * @notice Returns the expiry for specified rateFeedId if it exists, if not the default is returned. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the report expiry is being retrieved. * @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. * @dev Does not take the equivalentTokens mapping into account. * @param token The token for which the oracle report should be removed. * @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); if (address(breakerBox) != address(0)) { breakerBox.checkAndSetBreakers(token); } } } }
/openzeppelin-solidity/contracts/GSN/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; } }
/openzeppelin-solidity/contracts/math/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; } }
/openzeppelin-solidity/contracts/ownership/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; } }
/project:/contracts/common/FixidityLib.sol
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.5.13 <0.9.0; /** * @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()); } }
/project:/contracts/common/Initializable.sol
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.5.13 <0.9.0; contract Initializable { bool public initialized; constructor(bool testingDeployment) public { if (!testingDeployment) { initialized = true; } } modifier initializer() { require(!initialized, "contract already initialized"); initialized = true; _; } }
/project:/contracts/common/interfaces/ICeloVersionedContract.sol
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.5.13 <0.9.0; interface ICeloVersionedContract { /** * @notice Returns the storage, major, minor, and patch version of the contract. * @return Storage version of the contract. * @return Major version of the contract. * @return Minor version of the contract. * @return Patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256); }
/project:/contracts/common/linkedlists/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; 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 Array of all keys in the list. * @return Values corresponding to keys, which will be ordered largest to smallest. * @return Array of relations to median of corresponding list elements. */ 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); } }
/project:/contracts/common/linkedlists/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); } }
/project:/contracts/common/linkedlists/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 Array of all keys in the list. * @return Values corresponding to keys, which will be ordered 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 keys. * @return The correct 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; } }
/project:/contracts/common/linkedlists/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 Array of all keys in the list. * @return Values corresponding to keys, which will be ordered largest to smallest. * @return Array of relations to median of corresponding list elements. */ 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; } }
/project:/contracts/stability/interfaces/IBreakerBox.sol
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.5.13; /** * @title Breaker Box Interface * @notice Defines the basic interface for the Breaker Box */ interface IBreakerBox { /** * @dev Used to keep track of the status of a breaker for a specific rate feed. * * - TradingMode: Represents the trading mode the breaker is in for a rate feed. * This uses a bitmask approach, meaning each bit represents a * different trading mode. The final trading mode of the rate feed * is obtained by applying a logical OR operation to the TradingMode * of all breakers associated with that rate feed. This allows multiple * breakers to contribute to the final trading mode simultaneously. * Possible values: * 0: bidirectional trading. * 1: inflow only. * 2: outflow only. * 3: trading halted. * * - LastUpdatedTime: Records the last time the breaker status was updated. This is * used to manage cooldown periods before the breaker can be reset. * * - Enabled: Indicates whether the breaker is enabled for the associated rate feed. */ struct BreakerStatus { uint8 tradingMode; uint64 lastUpdatedTime; bool enabled; } /** * @notice Emitted when a new breaker is added to the breaker box. * @param breaker The address of the breaker. */ event BreakerAdded(address indexed breaker); /** * @notice Emitted when a breaker is removed from the breaker box. * @param breaker The address of the breaker. */ event BreakerRemoved(address indexed breaker); /** * @notice Emitted when a breaker is tripped by a rate feed. * @param breaker The address of the breaker. * @param rateFeedID The address of the rate feed. */ event BreakerTripped(address indexed breaker, address indexed rateFeedID); /** * @notice Emitted when a new rate feed is added to the breaker box. * @param rateFeedID The address of the rate feed. */ event RateFeedAdded(address indexed rateFeedID); /** * @notice Emitted when dependencies for a rate feed are set. * @param rateFeedID The address of the rate feed. * @param dependencies The addresses of the dependendent rate feeds. */ event RateFeedDependenciesSet(address indexed rateFeedID, address[] indexed dependencies); /** * @notice Emitted when a rate feed is removed from the breaker box. * @param rateFeedID The address of the rate feed. */ event RateFeedRemoved(address indexed rateFeedID); /** * @notice Emitted when the trading mode for a rate feed is updated * @param rateFeedID The address of the rate feed. * @param tradingMode The new trading mode. */ event TradingModeUpdated(address indexed rateFeedID, uint256 tradingMode); /** * @notice Emitted after a reset attempt is successful. * @param rateFeedID The address of the rate feed. * @param breaker The address of the breaker. */ event ResetSuccessful(address indexed rateFeedID, address indexed breaker); /** * @notice Emitted after a reset attempt fails when the * rate feed fails the breakers reset criteria. * @param rateFeedID The address of the rate feed. * @param breaker The address of the breaker. */ event ResetAttemptCriteriaFail(address indexed rateFeedID, address indexed breaker); /** * @notice Emitted after a reset attempt fails when cooldown time has not elapsed. * @param rateFeedID The address of the rate feed. * @param breaker The address of the breaker. */ event ResetAttemptNotCool(address indexed rateFeedID, address indexed breaker); /** * @notice Emitted when the sortedOracles address is updated. * @param newSortedOracles The address of the new sortedOracles. */ event SortedOraclesUpdated(address indexed newSortedOracles); /** * @notice Emitted when the breaker is enabled or disabled for a rate feed. * @param breaker The address of the breaker. * @param rateFeedID The address of the rate feed. * @param status Indicating the status. */ event BreakerStatusUpdated(address breaker, address rateFeedID, bool status); /** * @notice Retrives an array of all breaker addresses. */ function getBreakers() external view returns (address[] memory); /** * @notice Checks if a breaker with the specified address has been added to the breaker box. * @param breaker The address of the breaker to check; * @return A bool indicating whether or not the breaker has been added. */ function isBreaker(address breaker) external view returns (bool); /** * @notice Checks breakers for the rateFeedID and sets correct trading mode * if any breakers are tripped or need to be reset. * @param rateFeedID The address of the rate feed to run checks for. */ function checkAndSetBreakers(address rateFeedID) external; /** * @notice Gets the trading mode for the specified rateFeedID. * @param rateFeedID The address of the rate feed to retrieve the trading mode for. */ function getRateFeedTradingMode(address rateFeedID) external view returns (uint8 tradingMode); }
/project:/contracts/stability/interfaces/ISortedOracles.sol
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.5.13 <0.9.0; 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); }
Compiler Settings
{"remappings":[],"optimizer":{"runs":200,"enabled":false},"metadata":{"useLiteralContent":true},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"project:/contracts/stability/SortedOracles.sol":"SortedOracles"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"bool","name":"test","internalType":"bool"}]},{"type":"event","name":"BreakerBoxUpdated","inputs":[{"type":"address","name":"newBreakerBox","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"EquivalentTokenSet","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"equivalentToken","internalType":"address","indexed":true}],"anonymous":false},{"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":"contract IBreakerBox"}],"name":"breakerBox","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"deleteEquivalentToken","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"token","internalType":"address"}],"name":"equivalentTokens","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getEquivalentToken","inputs":[{"type":"address","name":"token","internalType":"address"}],"constant":true},{"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"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"medianRateWithoutEquivalentMapping","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":"setBreakerBox","inputs":[{"type":"address","name":"newBreakerBox","internalType":"contract IBreakerBox"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setEquivalentToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"equivalentToken","internalType":"address"}],"constant":false},{"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
0x60806040523480156200001157600080fd5b5060405162004ce438038062004ce4833981810160405260208110156200003757600080fd5b81019080805190602001909291905050508060006200005b6200012360201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350806200011b576001600060146101000a81548160ff0219169083151502179055505b50506200012b565b600033905090565b614ba9806200013b6000396000f3fe608060405234801561001057600080fd5b50600436106101fb5760003560e01c806380e507441161011a578063dd34ca3b116100ad578063f2fde38b1161007c578063f2fde38b14610d24578063f414c5e414610d68578063fc20935d14610db2578063fe4b84df14610e00578063ffe736bf14610e2e576101fb565b8063dd34ca3b14610be5578063ebc1d6bb14610c33578063ef90e1b014610c61578063f0ca4adb14610cc0576101fb565b80638f32d59b116100e95780638f32d59b146109b4578063a00a8b2c146109d6578063b929215814610a64578063bbc66a9414610b8d576101fb565b806380e50744146107bf578063858975121461084d5780638da5cb5b146108d15780638e7492811461091b576101fb565b8063493a353c116101925780636dd6ef0c116101615780636dd6ef0c146106815780636deb6799146106d9578063715018a614610731578063749aa17e1461073b576101fb565b8063493a353c1461056357806353a572971461058157806354255be0146105ef57806363d9a65614610622576101fb565b8063158ef93e116101ce578063158ef93e146104295780631cbe99701461044b5780632e86bc011461048f578063370c998e146104e7576101fb565b806302f55b6114610200578063040bbd3514610329578063071b48fc1461036d578063145d8d18146103c5575b600080fd5b6102426004803603602081101561021657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ebd565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561028d578082015181840152602081019050610272565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156102cf5780820151818401526020810190506102b4565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156103115780820151818401526020810190506102f6565b50505050905001965050505050505060405180910390f35b61036b6004803603602081101561033f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611159565b005b6103af6004803603602081101561038357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112fd565b6040518082815260200191505060405180910390f35b610427600480360360408110156103db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113d0565b005b61043161167f565b604051808215151515815260200191505060405180910390f35b61048d6004803603602081101561046157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611692565b005b6104d1600480360360208110156104a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611876565b6040518082815260200191505060405180910390f35b610549600480360360408110156104fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061188e565b604051808215151515815260200191505060405180910390f35b61056b6118bd565b6040518082815260200191505060405180910390f35b6105ed6004803603606081101561059757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118c3565b005b6105f7611ddb565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6106646004803603602081101561063857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e02565b604051808381526020018281526020019250505060405180910390f35b6106c36004803603602081101561069757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611efb565b6040518082815260200191505060405180910390f35b61071b600480360360208110156106ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fce565b6040518082815260200191505060405180910390f35b610739612069565b005b61077d6004803603602081101561075157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121a2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61084b600480360360808110156107d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121e0565b005b61088f6004803603602081101561086357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612cc7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108d9612d33565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61095d6004803603602081101561093157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612d5c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156109a0578082015181840152602081019050610985565b505050509050019250505060405180910390f35b6109bc612e29565b604051808215151515815260200191505060405180910390f35b610a22600480360360408110156109ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612e87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610aa660048036036020811015610a7a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ed2565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015610af1578082015181840152602081019050610ad6565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015610b33578082015181840152602081019050610b18565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015610b75578082015181840152602081019050610b5a565b50505050905001965050505050505060405180910390f35b610bcf60048036036020811015610ba357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061316e565b6040518082815260200191505060405180910390f35b610c3160048036036040811015610bfb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613241565b005b610c5f60048036036020811015610c4957600080fd5b81019080803590602001909291905050506133f7565b005b610ca360048036036020811015610c7757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613566565b604051808381526020018281526020019250505060405180910390f35b610d2260048036036040811015610cd657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061365a565b005b610d6660048036036020811015610d3a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506139bc565b005b610d70613a42565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610dfe60048036036040811015610dc857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613a68565b005b610e2c60048036036020811015610e1657600080fd5b8101908080359060200190929190505050613c86565b005b610e7060048036036020811015610e4457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613d39565b60405180831515151581526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6060806060600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636cfa387390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015610f5157600080fd5b505af4158015610f65573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506060811015610f8f57600080fd5b8101908080516040519392919084640100000000821115610faf57600080fd5b83820191506020820185811115610fc557600080fd5b8251866020820283011164010000000082111715610fe257600080fd5b8083526020830192505050908051906020019060200280838360005b83811015611019578082015181840152602081019050610ffe565b505050509050016040526020018051604051939291908464010000000082111561104257600080fd5b8382019150602082018581111561105857600080fd5b825186602082028301116401000000008211171561107557600080fd5b8083526020830192505050908051906020019060200280838360005b838110156110ac578082015181840152602081019050611091565b50505050905001604052602001805160405193929190846401000000008211156110d557600080fd5b838201915060208201858111156110eb57600080fd5b825186602082028301116401000000008211171561110857600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561113f578082015181840152602081019050611124565b505050509050016040525050509250925092509193909250565b611161612e29565b6111d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f427265616b6572426f782061646472657373206d75737420626520736574000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f21921b3b46ef2c939e85d6a14410c6e3b9ce132b66e944357ff4f789f68e00e260405160405180910390a250565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561138e57600080fd5b505af41580156113a2573d6000803e3d6000fd5b505050506040513d60208110156113b857600080fd5b81019080805190602001909291905050509050919050565b6113d8612e29565b61144a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f746f6b656e20616464726573732063616e6e6f7420626520300000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611573576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806149b26023913960400191505060405180910390fd5b60405180602001604052808273ffffffffffffffffffffffffffffffffffffffff16815250600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f50029dfdec1fc4684fff6b60e99fd3972a724662f5b4235e5082c447344ea01f60405160405180910390a35050565b600060149054906101000a900460ff1681565b61169a612e29565b61170c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f746f6b656e20616464726573732063616e6e6f7420626520300000000000000081525060200191505060405180910390fd5b600860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f50029dfdec1fc4684fff6b60e99fd3972a724662f5b4235e5082c447344ea01f60405160405180910390a350565b60066020528060005260406000206000915090505481565b60036020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60055481565b6118cb612e29565b61193d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119a75750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119f4575080600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050115b8015611a9f57508173ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611a5c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b611af4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526056815260200180614a2f6056913960600191505060405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020611c1e6001600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050613f8490919063ffffffff16565b81548110611c2857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611c9d57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480611d2d57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611d6c8383613fce565b15611d7c57611d7b83836141dc565b5b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f6dc84b66cc948d847632b9d829f7cb1cb904fbf2c084554a9bc22ad9d845334060405160405180910390a3505050565b60008060008060018060036000839350829250819150809050935093509350935090919293565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611e9457600080fd5b505af4158015611ea8573d6000803e3d6000fd5b505050506040513d6020811015611ebe57600080fd5b81019080805190602001909291905050506000611eda8561316e565b14611eef5769d3c21bcecceda1000000611ef2565b60005b91509150915091565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611f8c57600080fd5b505af4158015611fa0573d6000803e3d6000fd5b505050506040513d6020811015611fb657600080fd5b81019080805190602001909291905050509050919050565b600080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415612021576005549050612064565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b612071612e29565b6120e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081565b83600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166122c0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180614a856027913960400191505060405180910390fd5b6000600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561235157600080fd5b505af4158015612365573d6000803e3d6000fd5b505050506040513d602081101561237b57600080fd5b81019080805190602001909291905050509050600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796395073a799091336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561245157600080fd5b505af4158015612465573d6000803e3d6000fd5b505050506040513d602081101561247b57600080fd5b8101908080519060200190929190505050156126bc57600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963832a21479091338888886040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b1580156125c457600080fd5b505af41580156125d8573d6000803e3d6000fd5b50505050600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963c1e728e99091336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b15801561269f57600080fd5b505af41580156126b3573d6000803e3d6000fd5b50505050612808565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963d4a092729091338888886040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b1580156127ef57600080fd5b505af4158015612803573d6000803e3d6000fd5b505050505b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963d4a0927290913342600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79630944c59490916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156128f457600080fd5b505af4158015612908573d6000803e3d6000fd5b505050506040513d602081101561291e57600080fd5b810190808051906020019092919050505060006040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b158015612a0557600080fd5b505af4158015612a19573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f7cebb17173a9ed273d2b7538f64395c0ebf352ff743f1cf8ce66b437a61442134288604051808381526020018281526020019250505060405180910390a36000600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612b1b57600080fd5b505af4158015612b2f573d6000803e3d6000fd5b505050506040513d6020811015612b4557600080fd5b81019080805190602001909291905050509050818114612bae578673ffffffffffffffffffffffffffffffffffffffff167fa9981ebfc3b766a742486e898f54959b050a66006dbce1a4155c1f84a08bcf41826040518082815260200191505060405180910390a25b600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612cbe57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ab02e6c0886040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015612ca557600080fd5b505af1158015612cb9573d6000803e3d6000fd5b505050505b50505050505050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015612e1d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612dd3575b50505050509050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612e6b61471d565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60046020528160005260406000208181548110612ea057fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060806060600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636cfa387390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015612f6657600080fd5b505af4158015612f7a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506060811015612fa457600080fd5b8101908080516040519392919084640100000000821115612fc457600080fd5b83820191506020820185811115612fda57600080fd5b8251866020820283011164010000000082111715612ff757600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561302e578082015181840152602081019050613013565b505050509050016040526020018051604051939291908464010000000082111561305757600080fd5b8382019150602082018581111561306d57600080fd5b825186602082028301116401000000008211171561308a57600080fd5b8083526020830192505050908051906020019060200280838360005b838110156130c15780820151818401526020810190506130a6565b50505050905001604052602001805160405193929190846401000000008211156130ea57600080fd5b8382019150602082018581111561310057600080fd5b825186602082028301116401000000008211171561311d57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015613154578082015181840152602081019050613139565b505050509050016040525050509250925092509193909250565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156131ff57600080fd5b505af4158015613213573d6000803e3d6000fd5b505050506040513d602081101561322957600080fd5b81019080805190602001909291905050509050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156133465750600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561330857600080fd5b505af415801561331c573d6000803e3d6000fd5b505050506040513d602081101561333257600080fd5b810190808051906020019092919050505081105b61339b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806149fb6034913960400191505060405180910390fd5b60008090505b818110156133f2576000806133b585613d39565b9150915081156133ce576133c985826141dc565b6133d5565b50506133f2565b50506133eb60018261472590919063ffffffff16565b90506133a1565b505050565b6133ff612e29565b613471576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600081116134ca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614b546021913960400191505060405180910390fd5b600554811415613525576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180614b326022913960400191505060405180910390fd5b806005819055507fc68a9b88effd8a11611ff410efbc83569f0031b7bc70dd455b61344c7f0a042f816040518082815260200191505060405180910390a150565b6000806000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614613646576000806136348360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611e02565b91509150818194509450505050613655565b61364f84611e02565b92509250505b915091565b613662612e29565b6136d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561373e5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156137d15750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b613826576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252605e815260200180614aac605e913960600191505060405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f828d2be040dede7698182e08dfa8bfbd663c879aee772509c4a2bd961d0ed43f60405160405180910390a35050565b6139c4612e29565b613a36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b613a3f816147ad565b50565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b613a70612e29565b613ae2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111613b3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614b546021913960400191505060405180910390fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811415613bd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180614b0a6028913960400191505060405180910390fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507ff8324c8592dfd9991ee3e717351afe0a964605257959e3d99b0eb3d45bff94228282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600060149054906101000a900460ff1615613d09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff021916908315150217905550613d2d336147ad565b613d36816133f7565b50565b600080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415613d7657600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963d938ec7b90916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613e0757600080fd5b505af4158015613e1b573d6000803e3d6000fd5b505050506040513d6020811015613e3157600080fd5b810190808051906020019092919050505090506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79637c6bb8629091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015613f0957600080fd5b505af4158015613f1d573d6000803e3d6000fd5b505050506040513d6020811015613f3357600080fd5b81019080805190602001909291905050509050613f4f85611fce565b613f628242613f8490919063ffffffff16565b10613f7557600182935093505050613f7f565b6000829350935050505b915091565b6000613fc683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506148f1565b905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796395073a799091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561409357600080fd5b505af41580156140a7573d6000803e3d6000fd5b505050506040513d60208110156140bd57600080fd5b810190808051906020019092919050505080156141d45750600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796395073a799091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561419857600080fd5b505af41580156141ac573d6000803e3d6000fd5b505050506040513d60208110156141c257600080fd5b81019080805190602001909291905050505b905092915050565b60016141e783611efb565b1480156141fa57506141f98282613fce565b5b1561420457614719565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561429557600080fd5b505af41580156142a9573d6000803e3d6000fd5b505050506040513d60208110156142bf57600080fd5b81019080805190602001909291905050509050600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963c1e728e99091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b15801561439557600080fd5b505af41580156143a9573d6000803e3d6000fd5b50505050600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963c1e728e99091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b15801561447057600080fd5b505af4158015614484573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fe21a44017b6fa1658d84e937d56ff408501facdb4ff7427c479ac460d76f789360405160405180910390a36000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561457357600080fd5b505af4158015614587573d6000803e3d6000fd5b505050506040513d602081101561459d57600080fd5b81019080805190602001909291905050509050818114614716578373ffffffffffffffffffffffffffffffffffffffff167fa9981ebfc3b766a742486e898f54959b050a66006dbce1a4155c1f84a08bcf41826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461471557600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ab02e6c0856040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156146fc57600080fd5b505af1158015614710573d6000803e3d6000fd5b505050505b5b50505b5050565b600033905090565b6000808284019050838110156147a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415614833576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806149d56026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600083831115829061499e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614963578082015181840152602081019050614948565b50505050905090810190601f1680156149905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe6571756976616c656e74546f6b656e20616464726573732063616e6e6f7420626520304f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373746f6b656e2061646472206e756c6c206f7220747279696e6720746f2072656d6f766520746f6f206d616e79207265706f727473746f6b656e2061646472206e756c6c206f72206f7261636c652061646472206e756c6c206f7220696e646578206f6620746f6b656e206f7261636c65206e6f74206d617070656420746f206f7261636c65206164647273656e64657220776173206e6f7420616e206f7261636c6520666f7220746f6b656e2061646472746f6b656e206164647220776173206e756c6c206f72206f7261636c65206164647220776173206e756c6c206f72206f7261636c65206164647220697320616c726561647920616e206f7261636c6520666f7220746f6b656e2061646472746f6b656e207265706f72744578706972795365636f6e6473206861736e2774206368616e6765647265706f72744578706972795365636f6e6473206861736e2774206368616e6765647265706f727420657870697279207365636f6e6473206d757374206265203e2030a265627a7a72315820329b647de73aa75b24522d0e83490293a0b4d9abf3ef425417d31162d1939f3c64736f6c634300050d00320000000000000000000000000000000000000000000000000000000000000000
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c806380e507441161011a578063dd34ca3b116100ad578063f2fde38b1161007c578063f2fde38b14610d24578063f414c5e414610d68578063fc20935d14610db2578063fe4b84df14610e00578063ffe736bf14610e2e576101fb565b8063dd34ca3b14610be5578063ebc1d6bb14610c33578063ef90e1b014610c61578063f0ca4adb14610cc0576101fb565b80638f32d59b116100e95780638f32d59b146109b4578063a00a8b2c146109d6578063b929215814610a64578063bbc66a9414610b8d576101fb565b806380e50744146107bf578063858975121461084d5780638da5cb5b146108d15780638e7492811461091b576101fb565b8063493a353c116101925780636dd6ef0c116101615780636dd6ef0c146106815780636deb6799146106d9578063715018a614610731578063749aa17e1461073b576101fb565b8063493a353c1461056357806353a572971461058157806354255be0146105ef57806363d9a65614610622576101fb565b8063158ef93e116101ce578063158ef93e146104295780631cbe99701461044b5780632e86bc011461048f578063370c998e146104e7576101fb565b806302f55b6114610200578063040bbd3514610329578063071b48fc1461036d578063145d8d18146103c5575b600080fd5b6102426004803603602081101561021657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ebd565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561028d578082015181840152602081019050610272565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156102cf5780820151818401526020810190506102b4565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156103115780820151818401526020810190506102f6565b50505050905001965050505050505060405180910390f35b61036b6004803603602081101561033f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611159565b005b6103af6004803603602081101561038357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112fd565b6040518082815260200191505060405180910390f35b610427600480360360408110156103db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113d0565b005b61043161167f565b604051808215151515815260200191505060405180910390f35b61048d6004803603602081101561046157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611692565b005b6104d1600480360360208110156104a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611876565b6040518082815260200191505060405180910390f35b610549600480360360408110156104fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061188e565b604051808215151515815260200191505060405180910390f35b61056b6118bd565b6040518082815260200191505060405180910390f35b6105ed6004803603606081101561059757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118c3565b005b6105f7611ddb565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6106646004803603602081101561063857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e02565b604051808381526020018281526020019250505060405180910390f35b6106c36004803603602081101561069757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611efb565b6040518082815260200191505060405180910390f35b61071b600480360360208110156106ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fce565b6040518082815260200191505060405180910390f35b610739612069565b005b61077d6004803603602081101561075157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121a2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61084b600480360360808110156107d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121e0565b005b61088f6004803603602081101561086357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612cc7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108d9612d33565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61095d6004803603602081101561093157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612d5c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156109a0578082015181840152602081019050610985565b505050509050019250505060405180910390f35b6109bc612e29565b604051808215151515815260200191505060405180910390f35b610a22600480360360408110156109ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612e87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610aa660048036036020811015610a7a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ed2565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015610af1578082015181840152602081019050610ad6565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015610b33578082015181840152602081019050610b18565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015610b75578082015181840152602081019050610b5a565b50505050905001965050505050505060405180910390f35b610bcf60048036036020811015610ba357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061316e565b6040518082815260200191505060405180910390f35b610c3160048036036040811015610bfb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613241565b005b610c5f60048036036020811015610c4957600080fd5b81019080803590602001909291905050506133f7565b005b610ca360048036036020811015610c7757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613566565b604051808381526020018281526020019250505060405180910390f35b610d2260048036036040811015610cd657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061365a565b005b610d6660048036036020811015610d3a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506139bc565b005b610d70613a42565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610dfe60048036036040811015610dc857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613a68565b005b610e2c60048036036020811015610e1657600080fd5b8101908080359060200190929190505050613c86565b005b610e7060048036036020811015610e4457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613d39565b60405180831515151581526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6060806060600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636cfa387390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015610f5157600080fd5b505af4158015610f65573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506060811015610f8f57600080fd5b8101908080516040519392919084640100000000821115610faf57600080fd5b83820191506020820185811115610fc557600080fd5b8251866020820283011164010000000082111715610fe257600080fd5b8083526020830192505050908051906020019060200280838360005b83811015611019578082015181840152602081019050610ffe565b505050509050016040526020018051604051939291908464010000000082111561104257600080fd5b8382019150602082018581111561105857600080fd5b825186602082028301116401000000008211171561107557600080fd5b8083526020830192505050908051906020019060200280838360005b838110156110ac578082015181840152602081019050611091565b50505050905001604052602001805160405193929190846401000000008211156110d557600080fd5b838201915060208201858111156110eb57600080fd5b825186602082028301116401000000008211171561110857600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561113f578082015181840152602081019050611124565b505050509050016040525050509250925092509193909250565b611161612e29565b6111d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f427265616b6572426f782061646472657373206d75737420626520736574000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f21921b3b46ef2c939e85d6a14410c6e3b9ce132b66e944357ff4f789f68e00e260405160405180910390a250565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561138e57600080fd5b505af41580156113a2573d6000803e3d6000fd5b505050506040513d60208110156113b857600080fd5b81019080805190602001909291905050509050919050565b6113d8612e29565b61144a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f746f6b656e20616464726573732063616e6e6f7420626520300000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611573576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806149b26023913960400191505060405180910390fd5b60405180602001604052808273ffffffffffffffffffffffffffffffffffffffff16815250600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f50029dfdec1fc4684fff6b60e99fd3972a724662f5b4235e5082c447344ea01f60405160405180910390a35050565b600060149054906101000a900460ff1681565b61169a612e29565b61170c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f746f6b656e20616464726573732063616e6e6f7420626520300000000000000081525060200191505060405180910390fd5b600860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f50029dfdec1fc4684fff6b60e99fd3972a724662f5b4235e5082c447344ea01f60405160405180910390a350565b60066020528060005260406000206000915090505481565b60036020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60055481565b6118cb612e29565b61193d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119a75750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119f4575080600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050115b8015611a9f57508173ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611a5c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b611af4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526056815260200180614a2f6056913960600191505060405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020611c1e6001600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050613f8490919063ffffffff16565b81548110611c2857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611c9d57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480611d2d57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611d6c8383613fce565b15611d7c57611d7b83836141dc565b5b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f6dc84b66cc948d847632b9d829f7cb1cb904fbf2c084554a9bc22ad9d845334060405160405180910390a3505050565b60008060008060018060036000839350829250819150809050935093509350935090919293565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611e9457600080fd5b505af4158015611ea8573d6000803e3d6000fd5b505050506040513d6020811015611ebe57600080fd5b81019080805190602001909291905050506000611eda8561316e565b14611eef5769d3c21bcecceda1000000611ef2565b60005b91509150915091565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611f8c57600080fd5b505af4158015611fa0573d6000803e3d6000fd5b505050506040513d6020811015611fb657600080fd5b81019080805190602001909291905050509050919050565b600080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415612021576005549050612064565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b612071612e29565b6120e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081565b83600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166122c0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180614a856027913960400191505060405180910390fd5b6000600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561235157600080fd5b505af4158015612365573d6000803e3d6000fd5b505050506040513d602081101561237b57600080fd5b81019080805190602001909291905050509050600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796395073a799091336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561245157600080fd5b505af4158015612465573d6000803e3d6000fd5b505050506040513d602081101561247b57600080fd5b8101908080519060200190929190505050156126bc57600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963832a21479091338888886040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b1580156125c457600080fd5b505af41580156125d8573d6000803e3d6000fd5b50505050600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963c1e728e99091336040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b15801561269f57600080fd5b505af41580156126b3573d6000803e3d6000fd5b50505050612808565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963d4a092729091338888886040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b1580156127ef57600080fd5b505af4158015612803573d6000803e3d6000fd5b505050505b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963d4a0927290913342600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79630944c59490916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156128f457600080fd5b505af4158015612908573d6000803e3d6000fd5b505050506040513d602081101561291e57600080fd5b810190808051906020019092919050505060006040518663ffffffff1660e01b8152600401808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060006040518083038186803b158015612a0557600080fd5b505af4158015612a19573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f7cebb17173a9ed273d2b7538f64395c0ebf352ff743f1cf8ce66b437a61442134288604051808381526020018281526020019250505060405180910390a36000600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612b1b57600080fd5b505af4158015612b2f573d6000803e3d6000fd5b505050506040513d6020811015612b4557600080fd5b81019080805190602001909291905050509050818114612bae578673ffffffffffffffffffffffffffffffffffffffff167fa9981ebfc3b766a742486e898f54959b050a66006dbce1a4155c1f84a08bcf41826040518082815260200191505060405180910390a25b600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612cbe57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ab02e6c0886040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015612ca557600080fd5b505af1158015612cb9573d6000803e3d6000fd5b505050505b50505050505050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015612e1d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612dd3575b50505050509050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612e6b61471d565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60046020528160005260406000208181548110612ea057fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060806060600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636cfa387390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015612f6657600080fd5b505af4158015612f7a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506060811015612fa457600080fd5b8101908080516040519392919084640100000000821115612fc457600080fd5b83820191506020820185811115612fda57600080fd5b8251866020820283011164010000000082111715612ff757600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561302e578082015181840152602081019050613013565b505050509050016040526020018051604051939291908464010000000082111561305757600080fd5b8382019150602082018581111561306d57600080fd5b825186602082028301116401000000008211171561308a57600080fd5b8083526020830192505050908051906020019060200280838360005b838110156130c15780820151818401526020810190506130a6565b50505050905001604052602001805160405193929190846401000000008211156130ea57600080fd5b8382019150602082018581111561310057600080fd5b825186602082028301116401000000008211171561311d57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015613154578082015181840152602081019050613139565b505050509050016040525050509250925092509193909250565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156131ff57600080fd5b505af4158015613213573d6000803e3d6000fd5b505050506040513d602081101561322957600080fd5b81019080805190602001909291905050509050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156133465750600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561330857600080fd5b505af415801561331c573d6000803e3d6000fd5b505050506040513d602081101561333257600080fd5b810190808051906020019092919050505081105b61339b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806149fb6034913960400191505060405180910390fd5b60008090505b818110156133f2576000806133b585613d39565b9150915081156133ce576133c985826141dc565b6133d5565b50506133f2565b50506133eb60018261472590919063ffffffff16565b90506133a1565b505050565b6133ff612e29565b613471576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600081116134ca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614b546021913960400191505060405180910390fd5b600554811415613525576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180614b326022913960400191505060405180910390fd5b806005819055507fc68a9b88effd8a11611ff410efbc83569f0031b7bc70dd455b61344c7f0a042f816040518082815260200191505060405180910390a150565b6000806000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614613646576000806136348360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611e02565b91509150818194509450505050613655565b61364f84611e02565b92509250505b915091565b613662612e29565b6136d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561373e5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156137d15750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b613826576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252605e815260200180614aac605e913960600191505060405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f828d2be040dede7698182e08dfa8bfbd663c879aee772509c4a2bd961d0ed43f60405160405180910390a35050565b6139c4612e29565b613a36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b613a3f816147ad565b50565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b613a70612e29565b613ae2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111613b3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614b546021913960400191505060405180910390fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811415613bd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180614b0a6028913960400191505060405180910390fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507ff8324c8592dfd9991ee3e717351afe0a964605257959e3d99b0eb3d45bff94228282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600060149054906101000a900460ff1615613d09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f636f6e747261637420616c726561647920696e697469616c697a65640000000081525060200191505060405180910390fd5b6001600060146101000a81548160ff021916908315150217905550613d2d336147ad565b613d36816133f7565b50565b600080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415613d7657600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963d938ec7b90916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613e0757600080fd5b505af4158015613e1b573d6000803e3d6000fd5b505050506040513d6020811015613e3157600080fd5b810190808051906020019092919050505090506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd79637c6bb8629091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015613f0957600080fd5b505af4158015613f1d573d6000803e3d6000fd5b505050506040513d6020811015613f3357600080fd5b81019080805190602001909291905050509050613f4f85611fce565b613f628242613f8490919063ffffffff16565b10613f7557600182935093505050613f7f565b6000829350935050505b915091565b6000613fc683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506148f1565b905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796395073a799091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561409357600080fd5b505af41580156140a7573d6000803e3d6000fd5b505050506040513d60208110156140bd57600080fd5b810190808051906020019092919050505080156141d45750600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796395073a799091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561419857600080fd5b505af41580156141ac573d6000803e3d6000fd5b505050506040513d60208110156141c257600080fd5b81019080805190602001909291905050505b905092915050565b60016141e783611efb565b1480156141fa57506141f98282613fce565b5b1561420457614719565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561429557600080fd5b505af41580156142a9573d6000803e3d6000fd5b505050506040513d60208110156142bf57600080fd5b81019080805190602001909291905050509050600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963c1e728e99091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b15801561439557600080fd5b505af41580156143a9573d6000803e3d6000fd5b50505050600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd7963c1e728e99091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060006040518083038186803b15801561447057600080fd5b505af4158015614484573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fe21a44017b6fa1658d84e937d56ff408501facdb4ff7427c479ac460d76f789360405160405180910390a36000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002073176697bb5fa930a84d3bfccacf052dfbc2adfd796359d556a890916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561457357600080fd5b505af4158015614587573d6000803e3d6000fd5b505050506040513d602081101561459d57600080fd5b81019080805190602001909291905050509050818114614716578373ffffffffffffffffffffffffffffffffffffffff167fa9981ebfc3b766a742486e898f54959b050a66006dbce1a4155c1f84a08bcf41826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461471557600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ab02e6c0856040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156146fc57600080fd5b505af1158015614710573d6000803e3d6000fd5b505050505b5b50505b5050565b600033905090565b6000808284019050838110156147a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415614833576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806149d56026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600083831115829061499e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614963578082015181840152602081019050614948565b50505050905090810190601f1680156149905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe6571756976616c656e74546f6b656e20616464726573732063616e6e6f7420626520304f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373746f6b656e2061646472206e756c6c206f7220747279696e6720746f2072656d6f766520746f6f206d616e79207265706f727473746f6b656e2061646472206e756c6c206f72206f7261636c652061646472206e756c6c206f7220696e646578206f6620746f6b656e206f7261636c65206e6f74206d617070656420746f206f7261636c65206164647273656e64657220776173206e6f7420616e206f7261636c6520666f7220746f6b656e2061646472746f6b656e206164647220776173206e756c6c206f72206f7261636c65206164647220776173206e756c6c206f72206f7261636c65206164647220697320616c726561647920616e206f7261636c6520666f7220746f6b656e2061646472746f6b656e207265706f72744578706972795365636f6e6473206861736e2774206368616e6765647265706f72744578706972795365636f6e6473206861736e2774206368616e6765647265706f727420657870697279207365636f6e6473206d757374206265203e2030a265627a7a72315820329b647de73aa75b24522d0e83490293a0b4d9abf3ef425417d31162d1939f3c64736f6c634300050d0032