Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
PushMarketplace
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 20 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSL1.1 pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "./VerificationLib.sol"; // import "hardhat/console.sol"; contract PushMarketplace is Initializable, UUPSUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable { error PushMarketplace__TooManyReaders(); error PushMarketplace__MaxSubscribersAmountReached(); error PushMarketplace__FeesReceivedTooLow(); error PushMarketplace__ReaderIsNotFunded(); error PushMarketplace__IncorrectSubscriptionParams(); error PushMarketplace__TooFrequentUpdates(); error PushMarketplace__YouAreNotSubscriber(); error PushMarketplace__NoReadersToRemove(); error PushMarketplace__NullFeesReceiver(); error PushMarketplace__ArraysLengthMismatch(); error PushMarketplace__OldUpdate(); error PushMarketplace__NoFeedSubscribers(bytes32); uint256 public constant MIN_DEVIATION = 1000000 gwei; // 0.1% uint256 public constant MAX_DEVIATION = 100000000 gwei; // 10% uint256 public constant MIN_HEARTBEAT = 1 ether; // 1 hour, all equations is dimensionless, so time notation is in ether uint256 public constant MAX_HEARTBEAT = 24 ether; // 24 hour uint256 public constant MAX_READERS = 3; bytes32 public constant ADMIN = keccak256("ADMIN"); bytes32 public constant PUSH_NODE = keccak256("PUSH_NODE"); bytes32 public constant FEE_COLLECTOR = keccak256("FEE_COLLECTOR"); uint256 public maxSubsNum; uint256 public beta; uint256 public minimumFee; uint256 public gasToBeUsed; uint256 public gasPerOneSub; uint256 public protocolFee; address public protocolFeeReceiver; struct LatestUpdate { /// @notice The price for asset from latest update uint256 latestPrice; /// @notice The timestamp of latest update uint256 latestTimestamp; } VerificationLib public verificationLib; // here stored the latest information about subscriber struct Subscriber { uint256 balance; // Balance of the subscriber uint256 deviation; // Deviation of the subscriber uint256 heartbeat; // Heartbeat of the subscriber uint256 weight; // Weight of the subscriber for cost sharing } /// @notice mapping of dataKey to the latest update mapping(bytes32 dataKey => LatestUpdate) private latestUpdate; /// @notice Mapping from subscriber address to feed to Subscriber struct mapping(address => mapping(bytes32 => Subscriber)) public subscribers; /// @notice reader -> feed -> subscribers mapping(address => mapping(bytes32 => address[])) public readerToSubscribers; /// @notice subscriber -> feed -> reader mapping(address => mapping(bytes32 => address[])) public subscriberToReaders; struct Node { address prev; address next; uint256 deviation; } mapping(bytes32 => mapping(address => Node)) public subscriberNodes; // feed -> subscriber -> Node mapping(bytes32 => address) public head; // feed -> head of the linked list mapping(bytes32 => address) public tail; // feed -> tail of the linked list mapping(bytes32 => uint256) public currentMinDeviation; // feed -> current minimum deviation mapping(bytes32 => uint256) public numOfSubscribers; // feed->number of subscribers mapping(bytes32 => uint256) public totalWeight; // feed->totalWeight for cost-sharing modifier onlyReader(bytes32 feed) { // get sum balance of all subscribers for that reader, multiple subscribers for one reader is supported uint256 balance = 0; for (uint8 i = 0; i < readerToSubscribers[msg.sender][feed].length; ) { balance += subscribers[readerToSubscribers[msg.sender][feed][i]][ feed ].balance; unchecked { ++i; } } // revert if total subscribers balance of that reader = 0 if (balance == 0) { revert PushMarketplace__ReaderIsNotFunded(); } _; } event FundedFeed( bytes32 feed, address subscriber, uint256 amount, uint256 deviation, uint256 heartbeat, address[] readers ); event SubscriberBalanceDepleted(bytes32 feed, address subscriber); event PushNodeParamsChanged( bytes32 feed, uint256 newDeviation, uint256 newHeartbeat ); event UpdatePushed( bytes32 indexed feedKey, uint256 price, uint256 timestamp ); event FeedRead(address reader, bytes32 feedKey); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( address _verificationLib, uint256 _minimumFee, uint256 _beta, uint256 _gasToBeUsed, uint256 _gasPerOneSub, uint256 _protocolFee, address _protocolFeeReceiver, address _feeCollector ) public initializer { bytes32 admin = ADMIN; bytes32 feeCollector = FEE_COLLECTOR; __UUPSUpgradeable_init(); __AccessControl_init(); __ReentrancyGuard_init(); verificationLib = VerificationLib(_verificationLib); minimumFee = _minimumFee; beta = _beta; gasToBeUsed = _gasToBeUsed; gasPerOneSub = _gasPerOneSub; protocolFee = _protocolFee; if (_protocolFeeReceiver == address(0)) { revert PushMarketplace__NullFeesReceiver(); } protocolFeeReceiver = _protocolFeeReceiver; _setRoleAdmin(admin, admin); _setRoleAdmin(PUSH_NODE, admin); _setRoleAdmin(feeCollector, admin); _grantRole(admin, msg.sender); _grantRole(feeCollector, _feeCollector); maxSubsNum = 100; } /// @notice function for Push node to call to push updates on feeds function pushUpdates( bytes calldata updateData ) external onlyRole(PUSH_NODE) { ( uint256[] memory values, uint256[] memory timestamps, bytes32[] memory feedKeys ) = verificationLib.processData(updateData); uint256 length = values.length; for (uint8 i = 0; i < length; ) { uint256 currentValue = values[i]; uint256 currentTimestamp = timestamps[i]; bytes32 currentFeedKey = feedKeys[i]; LatestUpdate storage latest = latestUpdate[currentFeedKey]; uint256 _latestTimestamp = latest.latestTimestamp; uint256 _latestPrice = latest.latestPrice; if (_latestTimestamp >= currentTimestamp) { revert PushMarketplace__OldUpdate(); } uint256 _minDeviation = getMinimumDeviation(currentFeedKey); if (_minDeviation == 0) { revert PushMarketplace__NoFeedSubscribers(currentFeedKey); } if (_latestPrice != 0) { if ( ((1 ether * abs(_latestPrice, currentValue)) / _latestPrice < _minDeviation && // if (relative change of price < current deviation) and (currentTimestamp - _latestTimestamp) < 24 hours) // if update more frequent than heartbeat - revert ) { revert PushMarketplace__TooFrequentUpdates(); } } // Load the latest update into memory // Store the median value with corresponding feedKey and timestamp latest.latestPrice = currentValue; latest.latestTimestamp = currentTimestamp; uint256 subscriberCount = numOfSubscribers[currentFeedKey]; _shareFees( currentFeedKey, (gasToBeUsed + subscriberCount * gasPerOneSub) * tx.gasprice, subscriberCount ); // cost sharing emit UpdatePushed(currentFeedKey, currentValue, currentTimestamp); unchecked { ++i; } } } function _shareFees( bytes32 feed, uint256 totalFee, uint256 subscriberCount ) private { uint256 weightTotal = totalWeight[feed]; uint256 feeEach = 0; if (weightTotal == 0) { return; // end here because no subscribers to share fees } address subscriber; address nextSubscriber = head[feed]; for (uint8 i = 0; i < subscriberCount; ) { subscriber = nextSubscriber; feeEach = (subscribers[subscriber][feed].weight * totalFee) / weightTotal; if (subscribers[subscriber][feed].balance > feeEach) { subscribers[subscriber][feed].balance -= feeEach; nextSubscriber = subscriberNodes[feed][subscriber].next; } else { // balance depleted subscribers[subscriber][feed].balance = 0; _updateWeightsWhenRemovingSubscriber( subscriber, feed, subscribers[subscriber][feed].deviation ); emit SubscriberBalanceDepleted(feed, subscriber); // remove subscriber of that feed, to not itrerate through it when cost sharing, // notice that subscriber is not removed from subscribers mapping nextSubscriber = subscriberNodes[feed][subscriber].next; _removeSubscriber(feed, subscriber); } unchecked { i++; } } } /// @notice function that users call to deposit funds for Push updates and gain /// @notice access to the read, pay attention that new readers will be added to alreaydy existed readers if calling again, /// @notice if user want to change deviation and heartbeat configuration without changing readers configuration, /// @notice just call this function with empty readers array function subscribe( bytes32 feed, uint256 deviation, uint256 heartbeat, address[] calldata readers ) external payable { if ( deviation > MAX_DEVIATION || deviation < MIN_DEVIATION || heartbeat != MAX_HEARTBEAT // for MVP we restric heartbeat only to 24 hours ) { revert PushMarketplace__IncorrectSubscriptionParams(); } if (numOfSubscribers[feed] > maxSubsNum) { revert PushMarketplace__MaxSubscribersAmountReached(); } if (minimumFee >= msg.value) { revert PushMarketplace__FeesReceivedTooLow(); } if ( subscriberToReaders[msg.sender][feed].length + readers.length > MAX_READERS ) { revert PushMarketplace__TooManyReaders(); } uint256 depositValue = (msg.value * (1 ether - protocolFee)) / 1 ether; subscribers[msg.sender][feed].balance += depositValue; subscribers[msg.sender][feed].deviation = deviation; subscribers[msg.sender][feed].heartbeat = heartbeat; // add readers if (readers.length != 0) { _addIfNotPresent(feed, readers); } // Logic to grant read access to specified addresses _updateWeightsWhenSubscribing(msg.sender, feed, deviation); _insertSubscriber(feed, msg.sender, deviation); emit FundedFeed( feed, msg.sender, depositValue, deviation, heartbeat, subscriberToReaders[msg.sender][feed] ); payable(protocolFeeReceiver).transfer(msg.value - depositValue); } /// @notice Only for suscribers, just top up the balance without changing subscribtion configuration function topUp(bytes32 feed) external payable { if (subscribers[msg.sender][feed].deviation == 0) { revert PushMarketplace__YouAreNotSubscriber(); } if (minimumFee >= msg.value) { revert PushMarketplace__FeesReceivedTooLow(); } uint256 depositValue = (msg.value * (1 ether - protocolFee)) / 1 ether; subscribers[msg.sender][feed].balance += depositValue; if (subscribers[msg.sender][feed].weight == 0) { // case when subscriber has depleted balance _updateWeightsWhenSubscribing( msg.sender, feed, subscribers[msg.sender][feed].deviation ); _insertSubscriber( feed, msg.sender, subscribers[msg.sender][feed].deviation ); } emit FundedFeed( feed, msg.sender, depositValue, subscribers[msg.sender][feed].deviation, subscribers[msg.sender][feed].heartbeat, subscriberToReaders[msg.sender][feed] ); payable(protocolFeeReceiver).transfer(msg.value - depositValue); } /// @notice Pay attention that algoriythm doesn't check whether added readers already exists. /// @notice In that case, because of the readers num limitations user will waste empty slots for other readers function _addIfNotPresent(bytes32 feed, address[] memory readers) internal { for (uint8 j = 0; j < readers.length; ++j) { subscriberToReaders[msg.sender][feed].push(readers[j]); uint256 arrayLength = readerToSubscribers[readers[j]][feed].length; bool found = false; for (uint8 i = 0; i < arrayLength; ++i) { // check whether this reader has been already linked to a subscriber if (readerToSubscribers[readers[j]][feed][i] == msg.sender) { found = true; break; } } if (!found) { readerToSubscribers[readers[j]][feed].push(msg.sender); } } } function updateWeights(bytes32 feed) private { uint256 _beta = beta; uint256 weightTotal = 0; uint256 subscriberCount = numOfSubscribers[feed]; address subscriber = head[feed]; for (uint8 i = 0; i < subscriberCount; ) { uint256 deviation = subscribers[subscriber][feed].deviation; // Avoid division by zero if (deviation != 0) { subscribers[subscriber][feed].weight = _beta / (deviation ** 3); } else { subscribers[subscriber][feed].weight = 0; // Handle cases where deviation or heartbeat is zero } subscriber = subscriberNodes[feed][subscriber].next; unchecked { i++; } } totalWeight[feed] = weightTotal; } function _updateWeightsWhenSubscribing( address subscriber, bytes32 feed, uint256 deviation ) private { // Avoid division by zero if (deviation != 0) { uint256 weight = beta / (deviation ** 3); subscribers[subscriber][feed].weight = weight; totalWeight[feed] += weight; } else { subscribers[subscriber][feed].weight = 0; // Handle cases where deviation or heartbeat is zero } } function _updateWeightsWhenRemovingSubscriber( address subscriber, bytes32 feed, uint256 deviation ) private { // Avoid division by zero if (deviation != 0) { uint256 weight = beta / (deviation ** 3); totalWeight[feed] -= weight; } subscribers[subscriber][feed].weight = 0; } /// @notice Only for suscribers, in case they dont want someone to read from previous readers, /// @notice this function will remove multiple instances of reader(if it exists) function removeReaders( bytes32 feed, address[] calldata readersToRemove ) external { uint256 readersToRemoveLength = readersToRemove.length; if (readersToRemoveLength > MAX_READERS) { revert PushMarketplace__TooManyReaders(); } bool anyRemoved = false; for (uint8 j = 0; j < readersToRemoveLength; ++j) { address reader = readersToRemove[j]; uint256 initialSubscriberReadersLength = subscriberToReaders[ msg.sender ][feed].length; uint256 currentSubscriberToReadersLength = initialSubscriberReadersLength; // Remove all instances of 'reader' from subscriberToReaders uint256 i = 0; while (i < currentSubscriberToReadersLength) { if (subscriberToReaders[msg.sender][feed][i] == reader) { // Swap with last element and pop uint256 lastIndex = currentSubscriberToReadersLength - 1; subscriberToReaders[msg.sender][feed][ i ] = subscriberToReaders[msg.sender][feed][lastIndex]; subscriberToReaders[msg.sender][feed].pop(); currentSubscriberToReadersLength--; anyRemoved = true; // Check the same index again as new element is placed here } else { ++i; } } // Calculate how many instances were removed from subscriber's list uint256 numRemovedFromSubscriber = initialSubscriberReadersLength - currentSubscriberToReadersLength; if (numRemovedFromSubscriber == 0) { continue; // Skip if no instances were removed } // Remove 'numRemovedFromSubscriber' instances from reader's list uint256 removedCount = 0; uint256 currentReaderSubscribersLength = readerToSubscribers[ reader ][feed].length; i = 0; while ( i < currentReaderSubscribersLength && removedCount < numRemovedFromSubscriber ) { if (readerToSubscribers[reader][feed][i] == msg.sender) { // Swap with last element and pop uint256 lastIndex = currentReaderSubscribersLength - 1; readerToSubscribers[reader][feed][i] = readerToSubscribers[ reader ][feed][lastIndex]; readerToSubscribers[reader][feed].pop(); currentReaderSubscribersLength--; removedCount++; // Check the same index again as new element is placed here } else { ++i; } } } if (!anyRemoved) { revert PushMarketplace__NoReadersToRemove(); } } // @notice functions that readers call to read the Push feed function getFeedPrice( bytes32 feed ) external onlyReader(feed) returns (uint256 price, uint256 timestamp) { LatestUpdate storage latest = latestUpdate[feed]; emit FeedRead(msg.sender, feed); return (latest.latestPrice, latest.latestTimestamp); } function syncPushNode( bytes32 feed ) external view onlyRole(PUSH_NODE) returns (uint256 price, uint256 timestamp) { LatestUpdate storage latest = latestUpdate[feed]; return (latest.latestPrice, latest.latestTimestamp); } function checkIfReadersCanRead( bytes32 feed, address[] calldata readers ) external view returns (bool[] memory) { uint256 readersLength = readers.length; bool[] memory statuses = new bool[](readersLength); for (uint8 j = 0; j < readersLength; ++j) { uint256 balance = 0; uint256 readerToSubscribersLength = readerToSubscribers[readers[j]][ feed ].length; for (uint8 i = 0; i < readerToSubscribersLength; ) { balance += subscribers[ readerToSubscribers[readers[j]][feed][i] ][feed].balance; unchecked { ++i; } } if (balance > 0) { statuses[j] = true; } } return statuses; } // Helper function to calculate absolute value function abs(uint256 x, uint256 y) private pure returns (uint256) { return x >= y ? x - y : y - x; } function _insertSubscriber( bytes32 feed, address subscriber, uint256 deviation ) internal { // Check if subscriber already exists in the list Node memory subscriberNode = subscriberNodes[feed][subscriber]; bool exists = (subscriber == head[feed] || subscriber == tail[feed] || subscriberNode.prev != address(0) || subscriberNode.next != address(0)); if (exists) { Node storage existingNode = subscriberNodes[feed][subscriber]; if (existingNode.deviation == deviation) { return; // No change needed } // Remove existing node from list(it's actualy easier to remove it and insert again without sorting) if (existingNode.prev != address(0)) { subscriberNodes[feed][existingNode.prev].next = existingNode .next; } else { head[feed] = existingNode.next; } if (existingNode.next != address(0)) { subscriberNodes[feed][existingNode.next].prev = existingNode .prev; } else { tail[feed] = existingNode.prev; } numOfSubscribers[feed] -= 1; } // Create new node Node memory newNode = Node({ prev: address(0), next: address(0), deviation: deviation }); // Insert into empty list if (head[feed] == address(0)) { head[feed] = subscriber; tail[feed] = subscriber; } else { // Find insertion point address current = head[feed]; address prevNode = address(0); while ( current != address(0) && subscriberNodes[feed][current].deviation < deviation ) { prevNode = current; current = subscriberNodes[feed][current].next; } // Insert at end if (current == address(0)) { newNode.prev = tail[feed]; subscriberNodes[feed][tail[feed]].next = subscriber; tail[feed] = subscriber; } // Insert at head/middle else { newNode.next = current; newNode.prev = subscriberNodes[feed][current].prev; if (subscriberNodes[feed][current].prev != address(0)) { subscriberNodes[feed][subscriberNodes[feed][current].prev] .next = subscriber; } else { head[feed] = subscriber; } subscriberNodes[feed][current].prev = subscriber; } } subscriberNodes[feed][subscriber] = newNode; numOfSubscribers[feed] += 1; // Check if the minimum deviation has changed _updateMinDeviation(feed); } function _removeSubscriber(bytes32 feed, address subscriber) internal { Node memory node = subscriberNodes[feed][subscriber]; if (node.prev != address(0)) { subscriberNodes[feed][node.prev].next = node.next; } else { head[feed] = node.next; } if (node.next != address(0)) { subscriberNodes[feed][node.next].prev = node.prev; } else { tail[feed] = node.prev; } delete subscriberNodes[feed][subscriber]; numOfSubscribers[feed] -= 1; // Check if the minimum deviation has changed _updateMinDeviation(feed); } function _updateMinDeviation(bytes32 feed) internal { address newMinSubscriber = head[feed]; uint256 newMinDeviation = newMinSubscriber == address(0) ? 0 : subscriberNodes[feed][newMinSubscriber].deviation; // Compare with the current minimum deviation if (newMinDeviation != currentMinDeviation[feed]) { currentMinDeviation[feed] = newMinDeviation; emit PushNodeParamsChanged(feed, newMinDeviation, 24 * 1 ether); } } function getMinimumDeviation(bytes32 feed) public view returns (uint256) { address minSubscriber = head[feed]; if (minSubscriber == address(0)) { return 0; // No subscribers } return subscriberNodes[feed][minSubscriber].deviation; } function getSubscriberBalance( bytes32 feed, address subscriber ) external view returns (uint) { return subscribers[subscriber][feed].balance; } function getFeedSubscribers( bytes32 feed ) external view returns (address[] memory) { address subscriberAddress = head[feed]; address[] memory subscribersList = new address[]( numOfSubscribers[feed] ); uint8 i = 0; while (subscriberAddress != address(0)) { subscribersList[i] = subscriberAddress; subscriberAddress = subscriberNodes[feed][subscriberAddress].next; unchecked { ++i; } } return subscribersList; } function collectFee() external nonReentrant onlyRole(FEE_COLLECTOR) { if (address(this).balance != 0) { payable(msg.sender).transfer(address(this).balance); } } function setProtocolFeeAndFeeReceiver( uint256 _protocolFee, address _feeReciever ) external onlyRole(ADMIN) { if (_feeReciever == address(0)) { revert PushMarketplace__NullFeesReceiver(); } protocolFee = _protocolFee; protocolFeeReceiver = _feeReciever; } function setBeta( uint256 _beta, bytes32[] calldata feeds ) external onlyRole(ADMIN) { beta = _beta; uint256 feedsLength = feeds.length; for (uint256 j = 0; j < feedsLength; ) { updateWeights(feeds[j]); unchecked { ++j; } } } function getSubscriberHeartbeat( bytes32 _feed, address _subscriber ) external view returns (uint256) { return subscribers[_subscriber][_feed].heartbeat; } function getSubscriberReaders( bytes32 _feed, address _subscriber ) external view returns (address[] memory) { return subscriberToReaders[_subscriber][_feed]; } function getSubscriberDeviation( bytes32 _feed, address _subscriber ) external view returns (uint256) { return subscribers[_subscriber][_feed].deviation; } function getReaderToSubscribersLen( address _reader, bytes32 _feed ) external view returns (uint256) { return readerToSubscribers[_reader][_feed].length; } function getSubscribersBalanceForFeeds( bytes32[][] calldata feeds, address[] calldata subs ) external view returns (uint256[][] memory balances) { uint256 feedsLen = feeds.length; if (feedsLen != subs.length) { revert PushMarketplace__ArraysLengthMismatch(); } balances = new uint256[][](feedsLen); for (uint256 i = 0; i < feedsLen; ) { address currentSubscriber = subs[i]; uint256 currentFeedBalancesLen = feeds[i].length; balances[i] = new uint256[](currentFeedBalancesLen); for (uint256 j = 0; j < currentFeedBalancesLen; ) { bytes32 currentFeed = feeds[i][j]; balances[i][j] = subscribers[currentSubscriber][currentFeed] .balance; unchecked { ++j; } } unchecked { ++i; } } return (balances); } function getSubscriberInfoForFeeds( bytes32[] calldata feeds ) external view returns ( address[][] memory subs, uint256[][] memory balances, uint256[][] memory deviations, uint256[][] memory heartbeats ) { uint256 feedsLen = feeds.length; subs = new address[][](feedsLen); balances = new uint256[][](feedsLen); deviations = new uint256[][](feedsLen); heartbeats = new uint256[][](feedsLen); for (uint256 i = 0; i < feedsLen; ) { bytes32 currentFeed = feeds[i]; address currentSubscriberAddress = head[currentFeed]; uint256 subscribersForCurrentFeedLen = numOfSubscribers[ currentFeed ]; subs[i] = new address[](subscribersForCurrentFeedLen); balances[i] = new uint256[](subscribersForCurrentFeedLen); deviations[i] = new uint256[](subscribersForCurrentFeedLen); heartbeats[i] = new uint256[](subscribersForCurrentFeedLen); for (uint256 j = 0; j < subscribersForCurrentFeedLen; ) { subs[i][j] = currentSubscriberAddress; Subscriber memory currentSubscriber = subscribers[ currentSubscriberAddress ][currentFeed]; balances[i][j] = currentSubscriber.balance; deviations[i][j] = currentSubscriber.deviation; heartbeats[i][j] = currentSubscriber.heartbeat; unchecked { ++j; } } unchecked { ++i; } } } function setGasToBeUsed(uint256 _gasToBeUsed) external onlyRole(ADMIN) { gasToBeUsed = _gasToBeUsed; } function setGasPerOneSub(uint256 _gasPerOneSub) external onlyRole(ADMIN) { gasPerOneSub = _gasPerOneSub; } function setMinimumFee(uint256 _minimumFee) external onlyRole(ADMIN) { minimumFee = _minimumFee; } function _authorizeUpgrade(address) internal override onlyRole(ADMIN) {} }
//SPDX-License-Identifier: BSL 1.1 pragma solidity ^0.8.19; interface IEndPoint { /// @notice protocol info struct struct AllowedProtocolInfo { bool isCreated; uint256 consensusTargetRate; // percentage of proofs div numberOfAllowedTransmitters which should be reached to approve operation. Scaled with 10000 decimals, e.g. 6000 is 60% } function numberOfAllowedTransmitters(bytes32 protocolId) external view returns (uint256); function allowedProtocolInfo(bytes32 protocolId) external view returns (bool isCreated, uint256 consensusTargetRate); function allowedTransmitters(bytes32 protocolId, address transmitter) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(account), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.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. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * 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. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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 virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol) pragma solidity ^0.8.0; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. * * _Available since v4.8.3._ */ interface IERC1967Upgradeable { /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/IERC1967Upgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import {Initializable} from "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ */ abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { AddressUpgradeable.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeTo(address newImplementation) public virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 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. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMathUpgradeable { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; import "./math/SignedMathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = MathUpgradeable.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, MathUpgradeable.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: BSL1.1 pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@entangle_protocol/oracle-sdk/contracts/interfaces/IEndPoint.sol"; import "../lib/UnsafeCalldataBytesLib.sol"; // import "hardhat/console.sol"; contract VerificationLib is Initializable, AccessControlUpgradeable, UUPSUpgradeable, OwnableUpgradeable { error VerificationLib__WrongUDFMagic(); error VerificationLib__ZeroVotes(); error VerificationLib__NotAllowedTransmitter(address); error VerificationLib__VotesTimestampExpired(); error VerificationLib__DuplicateTransmitter(address); error VerificationLib__VotesThresholdNotReached(uint256); error VerificationLib__NotSortedVotes(); error VerificationLib__UpdateNotFound(bytes32 feedKey); error VerificationLib__ZeroSignerAddress(); error VerificationLib__FeedNotFound(); bytes32 public constant ADMIN = keccak256("ADMIN"); bytes32 public protocolId; uint256 public timeThreshold; // threshold time in seconds uint256 public votesThreshold; IEndPoint public endPoint; /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @notice Initializer /// @param initAddr - 0: admin function initialize( address[1] calldata initAddr, bytes32 _protocolId, uint256 _timeThreshold, uint256 _votesThreshold, address _endPoint ) public initializer { __Ownable_init(); __UUPSUpgradeable_init(); __AccessControl_init(); protocolId = _protocolId; endPoint = IEndPoint(_endPoint); timeThreshold = _timeThreshold; votesThreshold = _votesThreshold; _setRoleAdmin(ADMIN, ADMIN); _grantRole(ADMIN, initAddr[0]); } function _authorizeUpgrade(address) internal override onlyOwner {} /// @notice Accept updates encoded to array of bytes, verifies the updates and returns /// @param encodedUpdates The encoded data - `<MAGIC><n_updates>(<feedKey><n_votes>(<feedKey><value><timestamp><sig_r><sig_s><sig_v>)...)...` /** *@dev Data format for EVM chain updates. * * Format: <MAGIC><n_updates>(<feedKey><n_votes>(<feedKey><value><timestamp><sig_r><sig_s><sig_v>)...)... * * Structure: * - `Magic feed data key` (4 bytes): MAGIC (must be 0x55444646 for UDF) * - `update_length` (1 byte): Number of updates. * - `updates_array`: * * - `feedKey` (8 bytes) * - `n_votes` (1 byte) * * - `votes_array`: * * - `value` (8 bytes) * - `timestamp` (8 bytes) * - `r` (8 bytes): R component of the signature. * - `s` (8 bytes): S component of the signature. * - `v` (1 byte): V component of the signature. * * - `end_of_votes_array` * * - `end_of_updates_array` */ function processData( bytes calldata encodedUpdates ) external view returns (uint256[] memory, uint256[] memory, bytes32[] memory) { // Decode the MAGIC number (first 4 bytes) bytes4 magic = UnsafeCalldataBytesLib.toBytes4(encodedUpdates, 0); if (magic != 0x55444646) { revert VerificationLib__WrongUDFMagic(); } // Number of updates (next byte) uint8 nUpdates = UnsafeCalldataBytesLib.toUint8(encodedUpdates, 4); uint256 offset = 5; // Start after MAGIC and nUpdates uint256[] memory medianUpdates = new uint256[](nUpdates); uint256[] memory timestampUpdates = new uint256[](nUpdates); bytes32[] memory feedKeyUpdates = new bytes32[](nUpdates); uint256 _timeThreshold = timeThreshold; uint256 _votesThreshold = votesThreshold; IEndPoint _endPoint = endPoint; bytes32 _protocolId = protocolId; for (uint8 i = 0; i < nUpdates; i++) { bytes32 feedKey = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; // Move past feedKey uint8 nVotes = UnsafeCalldataBytesLib.toUint8( encodedUpdates, offset ); if (nVotes == 0) { revert VerificationLib__ZeroVotes(); } offset += 1; // Move past nVotes uint256[] memory values = new uint256[](nVotes); uint256[] memory timestamps = new uint256[](nVotes); address[] memory uniqueSigners = new address[](nVotes); uint256 nUniqueSigners = 0; for (uint8 j = 0; j < nVotes; j++) { uint256 value = UnsafeCalldataBytesLib.toUint256( encodedUpdates, offset ); offset += 32; // Move past value uint256 timestamp = UnsafeCalldataBytesLib.toUint256( encodedUpdates, offset ); offset += 32; // Move past timestamp bytes32 r = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; // Move past r bytes32 s = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; // Move past s uint8 v = UnsafeCalldataBytesLib.toUint8( encodedUpdates, offset ); offset += 1; // Move past v // Verify signature bytes32 messageHash = keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", keccak256(abi.encodePacked(feedKey, value, timestamp)) ) ); address signer = ecrecover(messageHash, v, r, s); if (signer == address(0)) { revert VerificationLib__ZeroSignerAddress(); } bool isAllowed = _endPoint.allowedTransmitters( _protocolId, signer ); if (!isAllowed) { revert VerificationLib__NotAllowedTransmitter(signer); } // Check for duplicate signer bool isDuplicate = false; for (uint256 k = 0; k < nUniqueSigners; k++) { if (uniqueSigners[k] == signer) { isDuplicate = true; break; } } if (isDuplicate) { revert VerificationLib__DuplicateTransmitter(signer); } // Store this signer as unique uniqueSigners[nUniqueSigners] = signer; nUniqueSigners++; // Store values and timestamps values[j] = value; timestamps[j] = timestamp; } if (nUniqueSigners < _votesThreshold) { revert VerificationLib__VotesThresholdNotReached( nUniqueSigners ); } // Check if more than half of votes are older than the threshold if (!isRecent(_timeThreshold, timestamps)) { revert VerificationLib__VotesTimestampExpired(); } // Calculate the median value from values array medianUpdates[i] = calculateMedian(values); timestampUpdates[i] = _max(timestamps); feedKeyUpdates[i] = feedKey; } return (medianUpdates, timestampUpdates, feedKeyUpdates); } function processDataForFeeds( bytes calldata encodedUpdates, bytes32[] memory targetFeedIds ) external view returns ( uint256[] memory filteredValues, uint256[] memory filteredTimestamps, bytes32[] memory filteredFeedKeys ) { bytes4 magic = UnsafeCalldataBytesLib.toBytes4(encodedUpdates, 0); if (magic != 0x55444646) { revert VerificationLib__WrongUDFMagic(); } uint8 nUpdates = UnsafeCalldataBytesLib.toUint8(encodedUpdates, 4); filteredValues = new uint256[](targetFeedIds.length); filteredTimestamps = new uint256[](targetFeedIds.length); filteredFeedKeys = new bytes32[](targetFeedIds.length); bool[] memory foundFeeds = new bool[](targetFeedIds.length); uint256 foundCount = 0; uint256 offset = 5; uint256 _timeThreshold = timeThreshold; uint256 _votesThreshold = votesThreshold; IEndPoint _endPoint = endPoint; bytes32 _protocolId = protocolId; for (uint8 i = 0; i < nUpdates; ) { bytes32 feedKey = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; uint8 nVotes = UnsafeCalldataBytesLib.toUint8( encodedUpdates, offset ); if (nVotes == 0) { revert VerificationLib__ZeroVotes(); } offset += 1; uint256 targetIndex = type(uint256).max; bool isNeeded = false; for (uint256 j = 0; j < targetFeedIds.length; ) { if (!foundFeeds[j] && feedKey == targetFeedIds[j]) { isNeeded = true; targetIndex = j; foundFeeds[j] = true; unchecked { foundCount++; } break; } unchecked { ++j; } } if (isNeeded && targetIndex != type(uint256).max) { uint256[] memory values = new uint256[](nVotes); uint256[] memory timestamps = new uint256[](nVotes); address[] memory uniqueSigners = new address[](nVotes); uint256 nUniqueSigners = 0; for (uint8 j = 0; j < nVotes; ) { uint256 value = UnsafeCalldataBytesLib.toUint256( encodedUpdates, offset ); offset += 32; uint256 timestamp = UnsafeCalldataBytesLib.toUint256( encodedUpdates, offset ); offset += 32; bytes32 r = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; bytes32 s = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; uint8 v = UnsafeCalldataBytesLib.toUint8( encodedUpdates, offset ); offset += 1; bytes32 messageHash = keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", keccak256( abi.encodePacked(feedKey, value, timestamp) ) ) ); address signer = ecrecover(messageHash, v, r, s); if (signer == address(0)) { revert VerificationLib__ZeroSignerAddress(); } bool isAllowed = _endPoint.allowedTransmitters( _protocolId, signer ); if (!isAllowed) { revert VerificationLib__NotAllowedTransmitter(signer); } bool isDuplicate = false; for (uint256 k = 0; k < nUniqueSigners; ) { if (uniqueSigners[k] == signer) { isDuplicate = true; break; } unchecked { ++k; } } if (isDuplicate) { revert VerificationLib__DuplicateTransmitter(signer); } uniqueSigners[nUniqueSigners] = signer; unchecked { ++nUniqueSigners; } values[j] = value; timestamps[j] = timestamp; unchecked { ++j; } } if (nUniqueSigners < _votesThreshold) { revert VerificationLib__VotesThresholdNotReached( nUniqueSigners ); } if (!isRecent(_timeThreshold, timestamps)) { revert VerificationLib__VotesTimestampExpired(); } filteredValues[targetIndex] = calculateMedian(values); filteredTimestamps[targetIndex] = _max(timestamps); filteredFeedKeys[targetIndex] = feedKey; } else { offset += uint256(nVotes) * (32 + 32 + 32 + 32 + 1); } unchecked { ++i; } } for (uint256 i = 0; i < targetFeedIds.length; ) { if (!foundFeeds[i]) { revert VerificationLib__FeedNotFound(); } unchecked { ++i; } } return (filteredValues, filteredTimestamps, filteredFeedKeys); } function processDataForFeed( bytes calldata encodedUpdates, bytes32 targetFeedId ) external view returns (uint256 value, uint256 timestamp) { bytes4 magic = UnsafeCalldataBytesLib.toBytes4(encodedUpdates, 0); if (magic != 0x55444646) { revert VerificationLib__WrongUDFMagic(); } uint8 nUpdates = UnsafeCalldataBytesLib.toUint8(encodedUpdates, 4); uint256 offset = 5; uint256 _timeThreshold = timeThreshold; uint256 _votesThreshold = votesThreshold; IEndPoint _endPoint = endPoint; bytes32 _protocolId = protocolId; for (uint8 i = 0; i < nUpdates; ) { bytes32 feedKey = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; uint8 nVotes = UnsafeCalldataBytesLib.toUint8( encodedUpdates, offset ); if (nVotes == 0) { revert VerificationLib__ZeroVotes(); } offset += 1; if (feedKey == targetFeedId) { uint256[] memory values = new uint256[](nVotes); uint256[] memory timestamps = new uint256[](nVotes); address[] memory uniqueSigners = new address[](nVotes); uint256 nUniqueSigners = 0; for (uint8 j = 0; j < nVotes; ) { uint256 currentValue = UnsafeCalldataBytesLib.toUint256( encodedUpdates, offset ); offset += 32; uint256 currentTimestamp = UnsafeCalldataBytesLib.toUint256( encodedUpdates, offset ); offset += 32; bytes32 r = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; bytes32 s = UnsafeCalldataBytesLib.toBytes32( encodedUpdates, offset ); offset += 32; uint8 v = UnsafeCalldataBytesLib.toUint8( encodedUpdates, offset ); offset += 1; bytes32 messageHash = keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", keccak256( abi.encodePacked( feedKey, currentValue, currentTimestamp ) ) ) ); address signer = ecrecover(messageHash, v, r, s); if (signer == address(0)) { revert VerificationLib__ZeroSignerAddress(); } bool isAllowed = _endPoint.allowedTransmitters( _protocolId, signer ); if (!isAllowed) { revert VerificationLib__NotAllowedTransmitter(signer); } bool isDuplicate = false; for (uint256 k = 0; k < nUniqueSigners; ) { if (uniqueSigners[k] == signer) { isDuplicate = true; break; } unchecked { ++k; } } if (isDuplicate) { revert VerificationLib__DuplicateTransmitter(signer); } uniqueSigners[nUniqueSigners] = signer; unchecked { ++nUniqueSigners; } values[j] = currentValue; timestamps[j] = currentTimestamp; unchecked { ++j; } } if (nUniqueSigners < _votesThreshold) { revert VerificationLib__VotesThresholdNotReached( nUniqueSigners ); } if (!isRecent(_timeThreshold, timestamps)) { revert VerificationLib__VotesTimestampExpired(); } return (calculateMedian(values), _max(timestamps)); } else { offset += nVotes * (32 + 32 + 32 + 32 + 1); // value + timestamp + r + s + v } unchecked { ++i; } } revert VerificationLib__UpdateNotFound(targetFeedId); } // TODO turn this functions to internal after testing function calculateMedian( uint256[] memory values ) internal pure returns (uint256) { uint256 length = values.length; // Check if the array is sorted for (uint256 i = 0; i < length - 1; i++) { if (values[i] > values[i + 1]) { revert VerificationLib__NotSortedVotes(); } } // Calculate median if (length % 2 == 1) { return values[length / 2]; // Odd case } else { return (values[length / 2 - 1] + values[length / 2]) / 2; // Even case } } function isRecent( uint256 _timeThreshold, uint256[] memory timestamps ) internal view returns (bool) { uint256 countOlder = 0; uint256 currentTime = block.timestamp; for (uint256 i = 0; i < timestamps.length; i++) { if (currentTime - timestamps[i] > _timeThreshold) { countOlder++; } } return countOlder <= timestamps.length / 2; // More than half should not be older } function _max(uint256[] memory numbers) internal pure returns (uint256) { uint256 maxNumber; for (uint256 i = 0; i < numbers.length; i++) { if (numbers[i] > maxNumber) { maxNumber = numbers[i]; } } return maxNumber; } function setEndpointAddress(address _endPoint) external onlyRole(ADMIN) { endPoint = IEndPoint(_endPoint); } function setVotesThreshold(uint256 _votesNum) external onlyRole(ADMIN) { votesThreshold = _votesNum; } function setTimeThreshold(uint256 _timeThreshold) external onlyRole(ADMIN) { timeThreshold = _timeThreshold; } }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. * * @notice This is the **unsafe** version of BytesLib which removed all the checks (out of bound, ...) * to be more gas efficient. */ pragma solidity >=0.8.0 <0.9.0; library UnsafeCalldataBytesLib { function slice( bytes calldata _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes calldata) { return _bytes[_start:_start + _length]; } function sliceFrom( bytes calldata _bytes, uint256 _start ) internal pure returns (bytes calldata) { return _bytes[_start:_bytes.length]; } function toAddress( bytes calldata _bytes, uint256 _start ) internal pure returns (address) { address tempAddress; assembly { tempAddress := shr(96, calldataload(add(_bytes.offset, _start))) } return tempAddress; } function toUint8( bytes calldata _bytes, uint256 _start ) internal pure returns (uint8) { uint8 tempUint; assembly { tempUint := shr(248, calldataload(add(_bytes.offset, _start))) } return tempUint; } function toUint16( bytes calldata _bytes, uint256 _start ) internal pure returns (uint16) { uint16 tempUint; assembly { tempUint := shr(240, calldataload(add(_bytes.offset, _start))) } return tempUint; } function toUint32( bytes calldata _bytes, uint256 _start ) internal pure returns (uint32) { uint32 tempUint; assembly { tempUint := shr(224, calldataload(add(_bytes.offset, _start))) } return tempUint; } function toUint64( bytes calldata _bytes, uint256 _start ) internal pure returns (uint64) { uint64 tempUint; assembly { tempUint := shr(192, calldataload(add(_bytes.offset, _start))) } return tempUint; } function toUint96( bytes calldata _bytes, uint256 _start ) internal pure returns (uint96) { uint96 tempUint; assembly { tempUint := shr(160, calldataload(add(_bytes.offset, _start))) } return tempUint; } function toUint128( bytes calldata _bytes, uint256 _start ) internal pure returns (uint128) { uint128 tempUint; assembly { tempUint := shr(128, calldataload(add(_bytes.offset, _start))) } return tempUint; } function toUint256( bytes calldata _bytes, uint256 _start ) internal pure returns (uint256) { uint256 tempUint; assembly { tempUint := calldataload(add(_bytes.offset, _start)) } return tempUint; } function toBytes32( bytes calldata _bytes, uint256 _start ) internal pure returns (bytes32) { bytes32 tempBytes32; assembly { tempBytes32 := calldataload(add(_bytes.offset, _start)) } return tempBytes32; } function toBytes4( bytes calldata _bytes, uint256 _start ) internal pure returns (bytes4) { bytes4 tempBytes4; assembly { tempBytes4 := calldataload(add(_bytes.offset, _start)) } return tempBytes4; } }
{ "optimizer": { "enabled": true, "runs": 20, "details": { "yulDetails": { "optimizerSteps": "u" } } }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"PushMarketplace__ArraysLengthMismatch","type":"error"},{"inputs":[],"name":"PushMarketplace__FeesReceivedTooLow","type":"error"},{"inputs":[],"name":"PushMarketplace__IncorrectSubscriptionParams","type":"error"},{"inputs":[],"name":"PushMarketplace__MaxSubscribersAmountReached","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"PushMarketplace__NoFeedSubscribers","type":"error"},{"inputs":[],"name":"PushMarketplace__NoReadersToRemove","type":"error"},{"inputs":[],"name":"PushMarketplace__NullFeesReceiver","type":"error"},{"inputs":[],"name":"PushMarketplace__OldUpdate","type":"error"},{"inputs":[],"name":"PushMarketplace__ReaderIsNotFunded","type":"error"},{"inputs":[],"name":"PushMarketplace__TooFrequentUpdates","type":"error"},{"inputs":[],"name":"PushMarketplace__TooManyReaders","type":"error"},{"inputs":[],"name":"PushMarketplace__YouAreNotSubscriber","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reader","type":"address"},{"indexed":false,"internalType":"bytes32","name":"feedKey","type":"bytes32"}],"name":"FeedRead","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"feed","type":"bytes32"},{"indexed":false,"internalType":"address","name":"subscriber","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deviation","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"heartbeat","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"readers","type":"address[]"}],"name":"FundedFeed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"feed","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"newDeviation","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newHeartbeat","type":"uint256"}],"name":"PushNodeParamsChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"feed","type":"bytes32"},{"indexed":false,"internalType":"address","name":"subscriber","type":"address"}],"name":"SubscriberBalanceDepleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"feedKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"UpdatePushed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_COLLECTOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DEVIATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_HEARTBEAT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_READERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DEVIATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_HEARTBEAT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PUSH_NODE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beta","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"},{"internalType":"address[]","name":"readers","type":"address[]"}],"name":"checkIfReadersCanRead","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"currentMinDeviation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasPerOneSub","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasToBeUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"}],"name":"getFeedPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"}],"name":"getFeedSubscribers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"}],"name":"getMinimumDeviation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reader","type":"address"},{"internalType":"bytes32","name":"_feed","type":"bytes32"}],"name":"getReaderToSubscribersLen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"},{"internalType":"address","name":"subscriber","type":"address"}],"name":"getSubscriberBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feed","type":"bytes32"},{"internalType":"address","name":"_subscriber","type":"address"}],"name":"getSubscriberDeviation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feed","type":"bytes32"},{"internalType":"address","name":"_subscriber","type":"address"}],"name":"getSubscriberHeartbeat","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"feeds","type":"bytes32[]"}],"name":"getSubscriberInfoForFeeds","outputs":[{"internalType":"address[][]","name":"subs","type":"address[][]"},{"internalType":"uint256[][]","name":"balances","type":"uint256[][]"},{"internalType":"uint256[][]","name":"deviations","type":"uint256[][]"},{"internalType":"uint256[][]","name":"heartbeats","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_feed","type":"bytes32"},{"internalType":"address","name":"_subscriber","type":"address"}],"name":"getSubscriberReaders","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[][]","name":"feeds","type":"bytes32[][]"},{"internalType":"address[]","name":"subs","type":"address[]"}],"name":"getSubscribersBalanceForFeeds","outputs":[{"internalType":"uint256[][]","name":"balances","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"head","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_verificationLib","type":"address"},{"internalType":"uint256","name":"_minimumFee","type":"uint256"},{"internalType":"uint256","name":"_beta","type":"uint256"},{"internalType":"uint256","name":"_gasToBeUsed","type":"uint256"},{"internalType":"uint256","name":"_gasPerOneSub","type":"uint256"},{"internalType":"uint256","name":"_protocolFee","type":"uint256"},{"internalType":"address","name":"_protocolFeeReceiver","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxSubsNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"numOfSubscribers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"updateData","type":"bytes"}],"name":"pushUpdates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"readerToSubscribers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"},{"internalType":"address[]","name":"readersToRemove","type":"address[]"}],"name":"removeReaders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_beta","type":"uint256"},{"internalType":"bytes32[]","name":"feeds","type":"bytes32[]"}],"name":"setBeta","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gasPerOneSub","type":"uint256"}],"name":"setGasPerOneSub","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gasToBeUsed","type":"uint256"}],"name":"setGasToBeUsed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minimumFee","type":"uint256"}],"name":"setMinimumFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_protocolFee","type":"uint256"},{"internalType":"address","name":"_feeReciever","type":"address"}],"name":"setProtocolFeeAndFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"},{"internalType":"uint256","name":"deviation","type":"uint256"},{"internalType":"uint256","name":"heartbeat","type":"uint256"},{"internalType":"address[]","name":"readers","type":"address[]"}],"name":"subscribe","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"name":"subscriberNodes","outputs":[{"internalType":"address","name":"prev","type":"address"},{"internalType":"address","name":"next","type":"address"},{"internalType":"uint256","name":"deviation","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"subscriberToReaders","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"subscribers","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"deviation","type":"uint256"},{"internalType":"uint256","name":"heartbeat","type":"uint256"},{"internalType":"uint256","name":"weight","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"}],"name":"syncPushNode","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"tail","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"feed","type":"bytes32"}],"name":"topUp","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"verificationLib","outputs":[{"internalType":"contract VerificationLib","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a06040523461003257610011610037565b604051614ca56101dd823960805181818161219f01526128360152614ca590f35b600080fd5b61003f610049565b61004761016d565b565b610047610047610047610047610047610047610095565b61007490610077906001600160a01b031682565b90565b6001600160a01b031690565b61007490610060565b61007490610083565b61009e3061008c565b608052565b6100749060081c5b60ff1690565b61007490546100a3565b60208082526027908201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604082015266616c697a696e6760c81b606082015260800190565b1561010957565b60405162461bcd60e51b815280610122600482016100bb565b0390fd5b610074906100ab565b6100749054610126565b6100ab6100746100749260ff1690565b9061015961007461016992610139565b825460ff191660ff919091161790565b9055565b61018661018161017d60006100b1565b1590565b610102565b610190600061012f565b60ff9081160361019c57565b6101a860ff6000610149565b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024986101d260405190565b60ff8152602090a156fe610180604052600436101561001357600080fd5b60003560e01c806301ffc9a7146103b35780630a88a71b146103ae57806314527c58146103a95780631492ee6d146103a4578063182a75061461039f5780631a7626e71461039a5780631f76d82c146103955780632093eda014610390578063248a9ca31461038b578063271be40f146103865780632737033f14610381578063274d713c1461037c5780632a0acc6a146103775780632ac00efb146103725780632ce4e4c21461036d5780632f2d0f28146103685780632f2ff15d1461036357806336568abe1461035e5780633659cfe614610359578063396394fb1461035457806339a51be51461034f578063451684071461034a57806348d7779b146103455780634b4aa8fc146103405780634f1ef2861461033b57806352d1902d14610336578063633e356514610331578063662bfe971461032c578063678f64bb146103275780636eed94da146103225780637a4263c61461031d5780637f660b01146103185780637fe8209c146103135780638da7a6aa1461030e5780638e1fbe5b1461030957806391d148541461030457806392650943146102ff57806395b070c4146102fa5780639faa3c91146102f5578063a0bc2acd146102f0578063a12cc6f4146102eb578063a217fddf146102e6578063a22561bc146102e1578063a5562f97146102dc578063a5ecfc19146102d7578063a915e7db146102d2578063b05f233a146102cd578063b0e21e8a146102c8578063ba6c7828146102c3578063bfc93532146102be578063cfa54f39146102b9578063d3acb34d146102b4578063d4d5d32a146102af578063d535176b146102aa578063d547741f146102a5578063ea8d9377146102a0578063f339e3b21461029b5763fe6451b8036103cb576114c0565b611494565b611468565b611435565b61141e565b6113b7565b61139f565b61138c565b611364565b6112f7565b6112dc565b6112b4565b61127f565b611267565b61124b565b611220565b6111f4565b6111c9565b6111ad565b611192565b611169565b61114e565b611125565b6110f3565b61104a565b610fe3565b610fb2565b610f6b565b610f26565b610f0b565b610ece565b610e2d565b610d69565b610d55565b610c43565b610c1b565b610be9565b610ab0565b610a78565b610937565b61090a565b6108f1565b6108d6565b6108b0565b610835565b6107db565b610794565b61075a565b6106d1565b61064e565b610632565b6105de565b61058d565b610552565b610535565b610507565b6104a2565b6103fa565b6001600160e01b031981165b036103cb57565b600080fd5b905035906103dd826103b8565b565b906020828203126103cb576103f3916103d0565b90565b9052565b346103cb576104276104156104103660046103df565b6114db565b60405191829182901515815260200190565b0390f35b60009103126103cb57565b6103f3916008021c5b6001600160a01b031690565b906103f39154610436565b6103f3600061013461044b565b6103f39061043f906001600160a01b031682565b6103f390610463565b6103f390610477565b6103f690610480565b6020810192916103dd9190610489565b346103cb576104b236600461042b565b6104276104bd610456565b60405191829182610492565b806103c4565b905035906103dd826104c9565b906020828203126103cb576103f3916104cf565b9081526040810192916103dd9160200152565b0152565b346103cb5761051f61051a3660046104dc565b6116bf565b9061042761052c60405190565b928392836104f0565b346103cb5761054d6105483660046104dc565b61171b565b604051005b346103cb5761054d6105653660046104dc565b61173f565b6103f3916008021c81565b906103f3915461056a565b6103f3600061012f610575565b346103cb5761059d36600461042b565b6104276105a8610580565b6040519182918290815260200190565b6103f36103f36103f39290565b6103f3670de0b6b3a76400006105b8565b6103f36105c5565b346103cb576105ee36600461042b565b6104276105a86105d6565b6103c48161043f565b905035906103dd826105f9565b91906040838203126103cb576103f390602061062b82866104cf565b9401610602565b346103cb576104276105a861064836600461060f565b90611748565b346103cb576104276105a86106643660046104dc565b611766565b909182601f830112156103cb578135916001600160401b0383116103cb5760200192602083028401116103cb57565b9190916040818403126103cb576106af83826104cf565b9260208201356001600160401b0381116103cb576106cd9201610669565b9091565b346103cb5761054d6106e4366004610698565b91611809565b9190610100838203126103cb576107018184610602565b9261070f82602083016104cf565b9261071d83604084016104cf565b9261072b81606085016104cf565b9261073982608083016104cf565b926103f361074a8460a085016104cf565b9360e061062b8260c08701610602565b346103cb5761054d61076d3660046106ea565b96959095949194939293611b63565b6103f366038d7ea4c680006105b8565b6103f361077c565b346103cb576107a436600461042b565b6104276105a861078c565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4290565b6103f36107af565b346103cb576107eb36600461042b565b6104276105a86107d3565b905b600052602052604060002090565b60006108176103f39261013b6107f6565b61044b565b6103f69061043f565b6020810192916103dd919061081c565b346103cb5761042761085061084b3660046104dc565b610806565b60405191829182610825565b909182601f830112156103cb578135916001600160401b0383116103cb5760200192600183028401116103cb57565b906020828203126103cb5781356001600160401b0381116103cb576106cd920161085c565b346103cb5761054d6108c336600461088b565b90612010565b6103f3600061012d610575565b346103cb576108e636600461042b565b6104276105a86108c9565b346103cb5761054d61090436600461060f565b90612035565b346103cb5761054d61091d36600461060f565b906120a3565b906020828203126103cb576103f391610602565b346103cb5761054d61094a366004610923565b612257565b90916040828403126103cb5781356001600160401b0381116103cb5783610977918401610669565b92909360208201356001600160401b0381116103cb576106cd9201610669565b0190565b906109bb6109b46109aa845190565b8084529260200190565b9260200190565b9060005b8181106109cc5750505090565b9091926109e96109e26001928651815260200190565b9460200190565b9291016109bf565b906103f39161099b565b90610a11610a07835190565b8083529160200190565b9081610a236020830284019460200190565b926000915b838310610a3757505050505090565b90919293946020610a5a610a53838560019503875289516109f1565b9760200190565b9301930191939290610a28565b60208082526103f3929101906109fb565b346103cb57610427610a97610a8e36600461094f565b92919091612314565b60405191829182610a67565b6103f3600061013361044b565b346103cb57610ac036600461042b565b610427610850610aa3565b906020828203126103cb5781356001600160401b0381116103cb576106cd9201610669565b906109978160209361081c565b90610b0c6109b46109aa845190565b9060005b818110610b1d5750505090565b909192610b306109e26001928651610af0565b929101610b10565b906103f391610afd565b90610b4e610a07835190565b9081610b606020830284019460200190565b926000915b838310610b7457505050505090565b90919293946020610b90610a5383856001950387528951610b38565b9301930191939290610b65565b92610bcd6103f39593610bbf610bdb94608088019088820360008a0152610b42565b9086820360208801526109fb565b9084820360408601526109fb565b9160608184039101526109fb565b346103cb57610427610c05610bff366004610acb565b906124eb565b90610c1294929460405190565b94859485610b9d565b346103cb576104276105a8610c313660046104dc565b612736565b6103f36000610131610575565b346103cb57610c5336600461042b565b6104276105a8610c36565b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b03821117610c9557604052565b610c5e565b906103dd610ca760405190565b9283610c74565b6001600160401b038111610c9557602090601f01601f19160190565b90826000939282370152565b90929192610ceb610ce682610cae565b610c9a565b93818552818301116103cb576103dd916020850190610cca565b9080601f830112156103cb578160206103f393359101610cd6565b9190916040818403126103cb57610d378382610602565b9260208201356001600160401b0381116103cb576103f39201610d05565b61054d610d63366004610d20565b906127a7565b346103cb57610d7936600461042b565b6104276105a8612897565b90916060828403126103cb576103f3610d9d8484610602565b936040610dad82602087016104cf565b94016104cf565b906107f890610480565b634e487b7160e01b600052603260045260246000fd5b8054821015610df757610dee600191600052602060002090565b91020190600090565b610dbe565b90610e0c610e1192610137610db4565b6107f6565b80548210156103cb576103f391610e2791610dd4565b9061044b565b346103cb57610427610850610e43366004610d84565b91610dfc565b6103f39061043f565b6103f39054610e49565b6103f39081565b6103f39054610e5c565b90610e7d610e82926101396107f6565b610db4565b610e8b81610e52565b916103f36002610e9d60018501610e52565b9301610e63565b6040906105036103dd9496959396610ec46060840198600085019061081c565b602083019061081c565b346103cb57610427610eea610ee436600461060f565b90610e6d565b60405191939193849384610ea4565b6103f360036105b8565b6103f3610ef9565b346103cb57610f1b36600461042b565b6104276105a8610f03565b346103cb5761054d610f3936600461060f565b906128e6565b7f26981beea75f8fcfde68f33899c220961e8d7491d7947e2724d9d979c9d6a93b90565b6103f3610f3f565b346103cb57610f7b36600461042b565b6104276105a8610f63565b7f380b61a03d510578eb69abac2609346d7bf838d9f340f7d0c66cfc65790d7f5f90565b6103f3610f86565b346103cb57610fc236600461042b565b6104276105a8610faa565b6000610fde6103f39261013e6107f6565b610575565b346103cb576104276105a8610ff93660046104dc565b610fcd565b9061100d6109b46109aa845190565b9060005b81811061101e5750505090565b9091926110316109e26001928651610af0565b929101611011565b60208082526103f392910190610ffe565b346103cb576104276110656110603660046104dc565b6128f0565b60405191829182611039565b91906040838203126103cb576103f3906020610dad8286610602565b90610e0c61109d92610136610db4565b906110a782610e63565b916110b460018201610e63565b916103f36003610e9d60028501610e63565b6105036103dd946110ec6060949897956110e5608086019a6000870152565b6020850152565b6040830152565b346103cb5761042761110f611109366004611071565b9061108d565b9061111c94929460405190565b948594856110c6565b346103cb5761042761041561113b36600461060f565b90612993565b6103f36000610130610575565b346103cb5761115e36600461042b565b6104276105a8611141565b346103cb576104276105a861117f36600461060f565b906129b3565b6103f3600061012e610575565b346103cb576111a236600461042b565b6104276105a8611185565b346103cb576104276105a86111c336600461060f565b906129c8565b346103cb5761054d6111dc366004610698565b91612a86565b6103f360006105b8565b6103f36111e2565b346103cb5761120436600461042b565b6104276105a86111ec565b6000610fde6103f39261013d6107f6565b346103cb576104276105a86112363660046104dc565b61120f565b90610e0c610e1192610138610db4565b346103cb57610427610850611261366004610d84565b9161123b565b346103cb5761051f61127a3660046104dc565b612da2565b346103cb576104276105a8611295366004611071565b90612dae565b6103f367016345785d8a00006105b8565b6103f361129b565b346103cb576112c436600461042b565b6104276105a86112ac565b6103f36000610132610575565b346103cb576112ec36600461042b565b6104276105a86112cf565b346103cb5761042761106561130d36600461060f565b90612e53565b906113226109b46109aa845190565b9060005b8181106113335750505090565b90919261134b6109e260019286511515815260200190565b929101611326565b60208082526103f392910190611313565b346103cb5761042761138061137a366004610698565b91612e74565b60405191829182611353565b61054d61139a3660046104dc565b61302b565b346103cb5761054d6113b23660046104dc565b613220565b346103cb576113c736600461042b565b61054d613294565b906080828203126103cb576113e481836104cf565b926113f282602085016104cf565b9261140083604083016104cf565b9260608201356001600160401b0381116103cb576106cd9201610669565b61054d61142c3660046113cf565b939290926132f4565b346103cb5761054d61144836600461060f565b9061353a565b6103f368014d1120d7b16000006105b8565b6103f361144e565b346103cb5761147836600461042b565b6104276105a8611460565b60006108176103f39261013a6107f6565b346103cb576104276108506114aa3660046104dc565b611483565b6000610fde6103f39261013c6107f6565b346103cb576104276105a86114d63660046104dc565b6114af565b637965db0b60e01b6001600160e01b03198216149081156114fa575090565b6103f391506001600160e01b0319166301ffc9a760e01b1490565b6115226103f36103f39290565b60ff1690565b6103f36103f36103f39260ff1690565b634e487b7160e01b600052601160045260246000fd5b9190611559565b9290565b820180921161156457565b611538565b60016103f3910160ff1690565b929091600093611585856105b8565b9261158f86611515565b935b866101376115ad6103f36115a988610e0c3386610db4565b5490565b6115b688611528565b101561160b57916115f96115ff926115f388610e0c611605976115ed610e278e6115e886610e0c610136963390610db4565b610dd4565b90610db4565b01610e63565b9061154e565b94611569565b93611591565b5050909492935061162261161e876105b8565b9190565b14611632576106cd939450611662565b631b28bde960e21b85528480600481015b0390fd5b9160206103dd9294936105036040820196600083019061081c565b92919250507f3aa8c2e667a2fabc8ac13b12611dabfd9bdd2f66210ad437122a7ab032ddf0116116ae61169a6103f3856101356107f6565b936116a460405190565b9182913383611647565b0390a16103f36001610e9d84610e63565b6106cd90600080611576565b6103dd906116df6116da6107af565b613544565b61170f565b90600019905b9181191691161790565b906117046103f361170b926105b8565b82546116e4565b9055565b6103dd906101316116f4565b6103dd906116cb565b6103dd906117336116da6107af565b6103dd9061012f6116f4565b6103dd90611724565b6115f3600291610e0c6103f39461175d600090565b50610136610db4565b60016115f36103f392611777600090565b5060c96107f6565b906103dd92916117906116da6107af565b6117af565b9190811015610df7576020020190565b356103f3816104c9565b6117be9093929361012e6116f4565b82916117ca60006105b8565b835b811015611802576117fb816117f56117f06117eb6117cc958a89611795565b6117a5565b61362d565b60010190565b90506117ca565b5092505050565b906103dd929161177f565b6103f39060081c611522565b6103f39054611814565b6103f390611522565b6103f3905461182a565b1561184457565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b9060ff906116ea565b6115226103f36103f39260ff1690565b906118c96103f361170b926118a9565b82546118a0565b9061ff009060081b6116ea565b906118ed6103f361170b92151590565b82546118d0565b6103f690611515565b6020810192916103dd91906118f4565b969492909161195f9694926119296119256000611820565b1590565b988980611a01575b80156119bc575b6119419061183d565b8961195661194f6001611515565b60006118b9565b6119ab57611a5b565b61196557565b6119706000806118dd565b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249861199a60405190565b806119a66001826118fd565b0390a1565b6119b7600160006118dd565b611a5b565b506119d16119256119cc30610480565b61371c565b801561193857506119416119e56000611833565b6119f96119f26001611515565b9160ff1690565b149050611938565b50611a0c6000611833565b611a196119f26001611515565b10611931565b906001600160a01b03906116ea565b90611a3e6103f361170b92610480565b8254611a1f565b61043f6103f36103f39290565b6103f390611a45565b949193611ac8611ad894611ac0611ad0949b9a9997611ab8611a7b6107af565b9d611ab0611aa8611a8a610f86565b9d611a936137a0565b611a9b6137a0565b611aa36137c0565b610480565b610134611a2e565b61012f6116f4565b61012e6116f4565b6101306116f4565b6101316116f4565b6101326116f4565b6000611aeb611ae682611a52565b61043f565b611af48361043f565b14611b545750611b3f9394611b0e611b3a92610133611a2e565b611b1881806137d6565b611b2981611b24610f3f565b6137d6565b611b3381846137d6565b3390613846565b613846565b6103dd611b4c60646105b8565b61012d6116f4565b63bb1ef1d360e01b8152600490fd5b906103dd9796959493929161190d565b906103dd91611b836116da610f3f565b611d83565b6001600160401b038111610c955760208091020190565b905051906103dd826104c9565b90929192611bbc610ce682611b88565b93818552602080860192028301928184116103cb57915b838310611be05750505050565b60208091611bee8486611b9f565b815201920191611bd3565b9080601f830112156103cb5781516103f392602001611bac565b90929192611c23610ce682611b88565b93818552602080860192028301928184116103cb57915b838310611c475750505050565b60208091611c558486611b9f565b815201920191611c3a565b9080601f830112156103cb5781516103f392602001611c13565b916060838303126103cb5782516001600160401b0381116103cb5782611ca1918501611bf9565b9260208101516001600160401b0381116103cb5783611cc1918301611bf9565b9260408201516001600160401b0381116103cb576103f39201611c60565b9190611cfd81611cf6816109979560209181520190565b8095610cca565b601f01601f191690565b60208082526103f393910191611cdf565b6040513d6000823e3d90fd5b90611d2d825190565b811015610df7576020809102010190565b8181029291811591840414171561156457565b634e487b7160e01b600052601260045260246000fd5b8115611d71570490565b611d51565b9190820391821161156457565b611dc191600091611d98611aa3610134610e52565b90611da260405190565b809581948293611db6638331ed0f60e01b90565b845260048401611d07565b03915afa801561200b5760009283928392611fe5575b50825192600091611de783611515565b855b611df282611528565b1015611fdc57611e11611e0d611e0783611528565b85611d24565b5190565b611e26611e0d611e2084611528565b88611d24565b611e3b611e0d611e3585611528565b8b611d24565b611e4a6103f3826101356107f6565b600181019088611e5983610e63565b910190611e6582610e63565b85821015611fcd57611e7685612736565b90611e808c6105b8565b8214611fb757611e8f8c6105b8565b8103611f40575b50505092611f248593611edb837f04e203a5aa41f955079b98cd79ebab33011841b6db7c91e8285bb43a14dad29695611ed6611f399a611de99c9a6116f4565b6116f4565b6103f3611ef2611eed8361013d6107f6565b610e63565b611f1e611f17611f03610130610e63565b6115f9611f11610131610e63565b85611d3e565b3a90611d3e565b836138eb565b92611f3161052c60405190565b0390a2611569565b9050611de7565b61161e61155582611f6d611f578c611f72966138bb565b611f68670de0b6b3a76400006105b8565b611d3e565b611d67565b109081611f96575b50611f8757388080611e96565b63cdd570c960e01b8952600489fd5b611fa1915085611d76565b611fb061161e620151806105b8565b1038611f7a565b631db2c77b60e31b8c5260048c0186905260248cfd5b63a59eca1760e01b8b5260048bfd5b50945050505050565b91509261200492503d8091833e611ffc8183610c74565b810190611c7a565b9238611dd7565b611d18565b906103dd91611b73565b906103dd9161202b6116da82611766565b906103dd91613846565b906103dd9161201a565b1561204657565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b6103dd91906120c36120b43361043f565b6120bd8461043f565b1461203f565b613a6a565b156120cf57565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b1561213057565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b6103dd906121f261219a30610480565b6121d87f0000000000000000000000000000000000000000000000000000000000000000916121d16121cb8461043f565b9161043f565b14156120c8565b6121ec6121cb6121e6613aca565b9261043f565b14612129565b612231565b90612204610ce683610cae565b918252565b369037565b906103dd61222461221e846121f7565b93610cae565b601f190160208401612209565b60006103dd9161224081613ae6565b61225161224c836105b8565b61220e565b90613b8a565b6103dd9061218a565b90612204610ce683611b88565b60005b82811061227c57505050565b606082820152602001612270565b906103dd6122a061229a84612260565b93611b88565b601f19016020840161226d565b356103f3816105f9565b903590601e1936829003018212156103cb57018035906001600160401b0382116103cb576020019160208202360383136103cb57565b90821015610df75760206106cd92028101906122b7565b906103dd61222461229a84612260565b92919390612320606090565b50809280840361242d57906123378496959661228a565b9560009361234560006105b8565b955b805b87101561242357889061236561236089888c611795565b6122ad565b956123796123748a88886122ed565b905090565b996123838b612304565b61238d8b86611d24565b526123988a85611d24565b506123a2896105b8565b8b8110156123fe57806117f58c6123f6836123f08f8f908f8f92610e0c6123e06117eb6123f99d6123da8c6115f3976123e99a6122ed565b90611795565b91610136610db4565b938b611d24565b51611d24565b52565b6123a2565b509499509495509661234991506124159060010190565b969050969196939293612347565b5095505050505050565b63f684cced60e01b6000908152600490fd5b60005b82811061244e57505050565b606082820152602001612442565b906103dd61246c61229a84612260565b601f19016020840161243f565b906103f69061043f565b6103f36080610c9a565b906103dd6124db600361249e612483565b946124af6124ab82610e63565b8752565b6124c56124be60018301610e63565b6020880152565b6115f36124d460028301610e63565b6040880152565b6060840152565b6103f39061248d565b9181906124f78261245c565b608052608051906125078461228a565b6101005261010051906125198561228a565b61016052610160519061252b8661228a565b61014052610140519061253e60006105b8565b60e0525b865b60e051101561272c5761255d6117eb60e051888b611795565b60c05261257761257261013a60c051906107f6565b610e52565b60a05261258c611eed61013d60c051906107f6565b6101205261259c61012051612304565b6125aa60e051608051611d24565b526125b960e051608051611d24565b51506125c761012051612304565b6125d660e05161010051611d24565b526125e660e05161010051611d24565b51506125f461012051612304565b61260360e05161016051611d24565b5261261360e05161016051611d24565b515061262161012051612304565b61263060e05161014051611d24565b5261264060e05161014051611d24565b5061264b60006105b8565b61012051811015612705576127009061267e61266b60e051608051611d24565b516126798360a05192611d24565b612479565b6117f56126ed60406126a96126a461269b61013660a05190610db4565b60c051906107f6565b6124e2565b6126c76126b4825190565b6123f6876123f060e05161010051611d24565b6126e86126d5602083015190565b6123f6876123f060e05161016051611d24565b015190565b6123f6836123f060e05161014051611d24565b61264b565b509091929394956125449061271c60e05160010190565b60e0529695949392919050612542565b9295509295509250565b6127456125728261013a6107f6565b612752611ae66000611a52565b61275b8261043f565b14612775576115f3600291610e7d6103f3946101396107f6565b50506103f360006105b8565b906103dd9161279261219a30610480565b6103dd916001916127a281613ae6565b613b8a565b906103dd91612781565b156127b857565b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608490fd5b6103f39061286061282e30610480565b61285a6121cb7f000000000000000000000000000000000000000000000000000000000000000061043f565b146127b1565b61288e565b6103f37f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105b8565b506103f3612865565b6103f3600061281e565b906103dd916128b16116da6107af565b60006128bf611ae682611a52565b6128c88461043f565b14611b545750906128de6103dd926101326116f4565b610133611a2e565b906103dd916128a1565b906129006125728361013a6107f6565b91612918612913611eed8361013d6107f6565b612304565b6000926129256000611515565b945b612933611ae686611a52565b61293c8261043f565b1461298a57611ae661298161297b600161297585612969612933976126796129638f611528565b8c611d24565b610e7d8a6101396107f6565b01610e52565b97611569565b96915050612927565b50935091505090565b6103f39160006129a86129ae93611777600090565b01610db4565b611833565b6115f3600191610e0c6103f39461175d600090565b6115f3600091610e0c6103f39461175d600090565b60ff1660ff81146115645760010190565b60001981146115645760010190565b916001600160a01b0360089290920291821b911b6116ea565b9190612a276103f361170b93610480565b9083546129fd565b634e487b7160e01b600052603160045260246000fd5b6103dd91600091612a16565b80548015612a74576000190190612a71612a6b8383610dd4565b90612a45565b55565b612a2f565b8015611564576000190190565b9082612a936103f3610ef9565b8411612d5e57939260008095612aa882611515565b905b835b612ab583611528565b1015612d37579293612ad3612360612acc84611528565b8684611795565b9361013895612ae96115a989610e0c338b610db4565b928392612af5876105b8565b9a5b845b8c5b1015612bea57612b17610e278d6115e88e610e0c8f3390610db4565b612b236121cb8b61043f565b03612bd0578b9c50600194612b37866105b8565b612b419082611d76565b8c612b4c338e610db4565b90612b56916107f6565b90612b6091610dd4565b612b699161044b565b8d8d612b75338f610db4565b90612b7f916107f6565b90612b8991610dd4565b612b939291612a16565b8b612b9e338d610db4565b90612ba8916107f6565b612bb190612a51565b612bba90612a79565b9b612afb612af98e5b505050509b9a939b612af7565b84612afb612be2612af99f979e6129ee565b9e8f92612bc3565b9490969391999850612bfd929a50611d76565b97612c07826105b8565b8914612d2057612c1a829a98939a6105b8565b9261013795612c306115a98a610e0c8b8b610db4565b9b859c5b808e1080612d17575b15612cf057612c57610e278f6115e88e610e0c8f8f610db4565b612c636121cb3361043f565b03612cde57612ccf818f612cc56103f38f8f8f90610e0c91610e7d612cca97612cbf612cb0610e27612ca2612cd59f612c9c60016105b8565b90611d76565b6115e88a610e0c8a8a610db4565b916115e888610e0c8888610db4565b90612a16565b612a51565b612a79565b966129ee565b9a5b9a95612c34565b959a9c612cea906129ee565b9c612cd7565b5096509650969793909850612d0b919950612aac92506129dd565b91979296939050612aaa565b508c8710612c3d565b97509791612aac91939450612d0b909695966129dd565b509495909450159250612d48915050565b612d4f5750565b63016d2eb160e61b8152600490fd5b630eb7167f60e11b6000908152600490fd5b906106cd9291612d816116da610f3f565b50612d93916103f391506101356107f6565b906103f36001610e9d84610e63565b6106cd90600080612d70565b6103f391610e0c6115a992612dc1600090565b50610137610db4565b90612de5612dd96109aa845490565b92600052602060002090565b9060005b818110612df65750505090565b909192612e17612e10600192612e0b87610e52565b610af0565b9460010190565b929101612de9565b906103f391612dca565b906103dd612e4392612e3a60405190565b93848092612e1f565b0383610c74565b6103f390612e29565b612e6f90610e0c6103f393612e66606090565b50610138610db4565b612e4a565b90929082612e8184612304565b600095612e8d87611515565b925b865b612e9a85611528565b1015612f9157612ea9886105b8565b926101379389612ed56115a989610e0c612ecf612360612ec88d611528565b8a8c611795565b8a610db4565b99612edf82611515565b925b8b612eeb85611528565b1015612f3d57612f31612f37916115f9856115f38e610e0c8f8f8f8f6115e88f91610e0c6115ed956115ed612360610e27978c95612f2b6101369c611528565b91611795565b93611569565b92612ee1565b9150969150612f67929950612e91939550979397612f5d61161e8c6105b8565b11612f74576129dd565b9396929050949094612e8f565b612f8c6001612f8561296384611528565b9015159052565b6129dd565b505093505050915090565b90612fab612dd96109aa845490565b9060005b818110612fbc5750505090565b909192612fd1612e10600192612e0b87610e52565b929101612faf565b926103f396946130106130179261300961301e96999599612fff60c08a019b60008b0152565b602089019061081c565b6040870152565b6060850152565b6080830152565b60a0818403910152612f9c565b61013661304160016115f384610e0c3386610db4565b9160009261305161161e856105b8565b146131f65761306161012f610e63565b3411156131e757826131707f682f4980dd4daeb1b816d7158fdaf8270dce98645faaecdfa1b7627d5d89c372829483946130d1670de0b6b3a76400006130cb6130c56130bf6130b1610132610e63565b6130ba856105b8565b611d76565b34611d3e565b916105b8565b90611d67565b9384926130ff876130e685610e0c3386610db4565b016130f9866130f483610e63565b61154e565b906116f4565b61311260036115f385610e0c3386610db4565b61311e61161e896105b8565b146131a8575b61314b60026115f385610e0c61314360016115f384610e0c338b610db4565b953390610db4565b61315b84610e0c33610138610db4565b9161316560405190565b958695339087612fd9565b0390a161318e613187611aa3611aa3610133610e52565b9134611d76565b9082821561319f575bf11561200b57565b506108fc613197565b6131c56131be60016115f386610e0c3387610db4565b8433613c9a565b6131e26131db60016115f386610e0c3387610db4565b3385613ddb565b613124565b63659c8c1f60e01b8352600483fd5b6376a59b4f60e01b8352600483fd5b6103dd906132146116da6107af565b6103dd906101306116f4565b6103dd90613205565b613231614257565b613239613241565b6103dd614289565b61324c6116da610f86565b6103dd61325830610480565b600090803161326961161e846105b8565b03613272575050565b81808092613282611aa333610480565b90319082821561319f57f11561200b57565b6103dd613229565b909291926132ac610ce682611b88565b93818552602080860192028301928184116103cb57915b8383106132d05750505050565b602080916132de8486610602565b8152019201916132c3565b6103f391369161329c565b91936133016103f361129b565b8211801561350c575b80156134f8575b6134e657613324611eed8461013d6107f6565b61333561161e6103f361012d610e63565b116134d45761334561012f610e63565b3411156134c2576101386133606115a985610e0c3385610db4565b9261336c83809561154e565b61337a61161e6103f3610ef9565b11612d5e5784670de0b6b3a7640000613394610132610e63565b61339d826105b8565b906133a791611d76565b6133b19034611d3e565b906133bb906105b8565b6133c491611d67565b9384928983610136816133d73383610db4565b906133e1916107f6565b876133eb82610e63565b906133f59161154e565b6133fe916116f4565b838261340a3384610db4565b90613414916107f6565b60010190613421916116f4565b3361342b91610db4565b90613435916107f6565b60020190613442916116f4565b6000998a998a998a996134548b6105b8565b14157f682f4980dd4daeb1b816d7158fdaf8270dce98645faaecdfa1b7627d5d89c372986131709661315b94610e0c936134a8575b5050613496868433613c9a565b6134a1863385613ddb565b3390610db4565b6134bb916134b5916132e9565b846142b7565b3880613489565b63659c8c1f60e01b6000908152600490fd5b6303dce79360e31b6000908152600490fd5b63ebbd55a360e01b6000908152600490fd5b506135046103f361144e565b851415613311565b506135186103f361077c565b821061330a565b906103dd916135306116da82611766565b906103dd91613a6a565b906103dd9161351f565b6103dd9033906144e6565b939190925b60018211613560575050565b90919280820481116115645760018316613582575b8002929160011c90613554565b93840293613575565b929192811561360e5780156136065780806001146135fd576002146135e85760208210610133821016604e8310600b831016176135de57926135d191819394600161354f565b8092048111611564570290565b0a91821161156457565b5060ff81116115645760020a91821161156457565b50600193505050565b506000925050565b506001925050565b906136246119f26103f39390565b6000199161358b565b61363861012e610e63565b9061364360006105b8565b91613653611eed8361013d6107f6565b926136636125728461013a6107f6565b9461366e6000611515565b955b855b61367b88611528565b1015613706576136e361297b6001612975613672946101366136a5846115f38d610e0c8686610db4565b8b838c8c8085146136eb575091610e0c6136dd926136d76129699796956130cb6003976136d189611515565b90613616565b95610db4565b016116f4565b969050613670565b935050600391610e0c6136dd9261370196610db4565b612969565b509450916103dd9350611ed6915061013e6107f6565b3b61372a61161e60006105b8565b1190565b1561373557565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b6103dd61379b6000611820565b61372e565b6103dd61378e565b6137b561379b6000611820565b6103dd6103dd614578565b6103dd6137a8565b906117046103f361170b9290565b9061380561161e6138016137e985611766565b946103f38560016137fb8460c96107f6565b016137c8565b9390565b917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff61383060405190565b600090a4565b906118c96103f361170b92151590565b6138536119258383612993565b61385b575050565b61387660016138718460006129a88660c96107f6565b613836565b61389061388a613884339390565b93610480565b91610480565b917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d61383060405190565b8181106138cc57906103f391611d76565b6103f391611d76565b9081526040810192916103dd916020019061081c565b6138fa611eed8261013e6107f6565b906000613906816105b8565b8314613a635761391b6125728361013a6107f6565b9361392582611515565b945b865b61393287611528565b1015613a5a578061013661395787611f6d86611f6860036115f38c610e0c8a8a610db4565b9161396a866115f389610e0c8587610db4565b8310156139bc57506001612975846139a26139b4956130f98a6139978d610e0c6139299c6139ae9b610db4565b01916130ba83610e63565b610e7d896101396107f6565b96611569565b959050613927565b6139b49250613a4e600161297583613a07613a00846139299a9f988e610e0c8f9a6115f393610e7d8d6139f1613a559f6105b8565b906136dd87610e0c8787610db4565b8c83614580565b7f571f5252f0a48338759e66ddc2a39468bfa5bd64428bc84f0496b26d83a0d060818c613a3f613a3660405190565b928392836138d5565b0390a1610e7d8b6101396107f6565b9887614645565b611569565b50505050505050565b5050505050565b613a748282612993565b613a7c575050565b613a91600061387184826129a88660c96107f6565b613a9f61388a613884339390565b917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b61383060405190565b6103f360006129756103f3612865565b506103dd6116da6107af565b6103dd90613ada565b6103f37f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91436105b8565b906020828203126103cb576103f391611b9f565b15613b3357565b60405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9190613ba26000613b9c6103f3613aef565b01611833565b15613bb25750506103dd906147f6565b613bbe611aa384610480565b6020613bc960405190565b6352d1902d60e01b815291829060049082905afa60009181613c69575b50613c48575060405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b92613c646103dd94613c5e61161e6103f3612865565b14613b2c565b614755565b613c8c91925060203d602011613c93575b613c848183610c74565b810190613b18565b9038613be6565b503d613c7a565b9091613ca660006105b8565b8114613cfc57613cf283613cea610e0c9460036136dd6103dd98613cdf6130f9986130cb613cd561012e610e63565b916136d187611515565b988994610136610db4565b61013e6107f6565b916130f483610e63565b5060036136dd6103dd93610e0c613d1360006105b8565b94610136610db4565b6103f36060610c9a565b906103dd613d626002613d37613d1c565b94613d4a613d4482610e52565b87612479565b6115f3613d5960018301610e52565b60208801612479565b6040840152565b6103f390613d26565b6103f3905161043f565b634e487b7160e01b600052600060045260246000fd5b6002613dca60406103dd94613db2613dac60008301613d72565b86611a2e565b6126e8613dc160208301613d72565b60018701611a2e565b91016116f4565b906103dd91613d92565b90929161013993613df8613df382610e7d86896107f6565b613d69565b61013a90613e0c611ae661257287856107f6565b613e158461043f565b149081156141dd575b81156141ba575b8115614195575b50614073575b600092613e3e84611a52565b93613e47613d1c565b94613e5481838801612479565b613e618160208801612479565b613e6c836040880152565b613e7961257288866107f6565b613e856121cb8361043f565b03613ee75750505081610e7d856103dd9798613eb1613ec69796613eac84613ec1986107f6565b611a2e565b610e0c84613eac8461013b6107f6565b613dd1565b613ee2613ed360016105b8565b6130f9613cf28461013d6107f6565b614845565b613efa612572888694959a9897966107f6565b613f038261043f565b613f0c8261043f565b141581898c83614054575b50505015613f3957600161297582610e7d8b8e613f3496506107f6565b613efa565b6103dd9850988785613ec19695613ec6999c84610e7d9785978c613f5c8261043f565b613f658661043f565b03613fb9575050505050610e0c92613eac91613f9361013b91613f8b61257285856107f6565b908d01612479565b610e0c846001613fb3613fa6868b6107f6565b6115ed61257288886107f6565b01611a2e565b8488859489946140086121cb6121e68c610e0c9f88610e7d613fb39f9e9261297593610e0c8e879f866020613fee9201612479565b876140018161297589610e7d89896107f6565b9101612479565b1461403d5750936115ed600193612975613fb394610e7d8961402d6140339b886107f6565b966107f6565b610e7d87876107f6565b90915061404f9450613eac92506107f6565b614033565b614069935091610e7d6115f3926002946107f6565b891181898c613f17565b6140846103f383610e7d878a6107f6565b61409060028201610e63565b841461418c5761409f81610e52565b60006140aa81611a52565b916140b76121cb8461043f565b1461416e576140e5896001613fb36140da8b6140d4848a01610e52565b946107f6565b6115ed868901610e52565b60018301916140f96121cb6121e685610e52565b1461414e57613fb361410f826141239501610e52565b926115ed61411d8a8d6107f6565b91610e52565b61414961413060016105b8565b6130f961413f8761013d6107f6565b916130ba83610e63565b613e32565b61415d91506141699201610e52565b613eac8661013b6107f6565b614123565b61418761417d60018501610e52565b613eac89876107f6565b6140e5565b50505050509050565b6141a29150602001613d72565b6141b26121cb611ae66000611a52565b141538613e2c565b90506141c581613d72565b6141d56121cb611ae66000611a52565b141590613e25565b90506141f1611ae66125728761013b6107f6565b6141fa8461043f565b1490613e1e565b6103f360026105b8565b1561421257565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b6103dd61426460fb610e63565b61427861426f614201565b9182141561420b565b60fb6116f4565b6103f360016105b8565b6103dd61427861427f565b80549190600160401b831015610c955782612cbf9160016103dd95018155610dd4565b6000916142c46000611515565b925b6142d16103f3835190565b6142da85611528565b1015614403576143166142f66103f385610e0c33610138610db4565b61431061430b61430588611528565b86611d24565b613d72565b90614294565b6101379061433f6115a985610e0c61433961430b6143338b611528565b89611d24565b86610db4565b958161434a81611515565b8861435482611528565b10156143f157614385610e27826115e88a610e0c61437f61430b8f6143798f91611528565b90611d24565b8b610db4565b6143916121cb3361043f565b146143a45761439f906129dd565b61434a565b509650946143bf929091508460005b6143c6575b50506129dd565b92936142c6565b6103f36143e391610e0c6143ea946115ed61430b611e3589611528565b3390614294565b38846143b8565b509650949091846143b36143bf941590565b50505050565b6103f3906105b8565b60005b8381106144255750506000910152565b8181015183820152602001614415565b61099761444d92602092614447815190565b94859290565b93849101614412565b61448e6103f393926144886144889376020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260170190565b90614435565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110190565b6144cc611cfd602093610997936144c0815190565b80835293849260200190565b95869101614412565b60208082526103f3929101906144ab565b906144f46119258284612993565b6144fc575050565b6145466103f36116439361452e61451e6145186145529661491d565b92614409565b61452860206105b8565b906149ca565b9061453860405190565b938492602084019283614456565b90810382520382610c74565b6040515b62461bcd60e51b8152918291600483016144d5565b61323961379b6000611820565b6103dd61456b565b906136dd6003916103dd9461459560006105b8565b81036145aa575b50610e0c613d1360006105b8565b6145c96145d8916130cb6145bf61012e610e63565b916136d188611515565b6130f961413f8461013e6107f6565b3861459c565b9160001960089290920291821b911b6116ea565b91906146036103f361170b936105b8565b9083546145de565b6103dd916000916145f2565b6000808255600182018190556103dd9160020161460b565b90600003614640576103dd90614617565b613d7c565b6146fe6103dd926146f961013991610e7d85614668613df384610e7d84896107f6565b9461467286613d72565b9560009661467f88611a52565b9061468c6121cb8361043f565b14614735576146ba6146a060208401613d72565b6001613fb36146af88886107f6565b6115ed8d8801613d72565b8760208301916146cf6121cb6121e685613d72565b1461471a57613fb36146e582610e0c9501613d72565b926115ed6146f388886107f6565b91613d72565b61462f565b613ee261470b60016105b8565b6130f961413f8461013d6107f6565b6147299150610e0c9201613d72565b613eac8461013b6107f6565b61475061474460208401613d72565b613eac8661013a6107f6565b6146ba565b9161475f83614add565b815161476e61161e60006105b8565b1190811561478c575b50614780575050565b61478991614b65565b50565b905038614777565b1561479b57565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b6103dd9061480b6148068261371c565b614794565b6000613fb36103f3612865565b6103f6906105b8565b9081526060810193926103dd92909160409161483e906020830152565b0190614818565b6148546125728261013a6107f6565b614861611ae66000611a52565b61486a8261043f565b036148e7575061487a60006105b8565b61013c9161488e6103f3611eed83866107f6565b820361489957505050565b6148c882611ed6837f6dfb4bd7e2c0db8e2dd13a94ab3f642c6a81c617e38ecdc4ba0d21d66446ef0d966107f6565b6119a668014d1120d7b16000006148de60405190565b93849384614821565b60026115f36148fc92610e7d856101396107f6565b61487a565b6103f39081906001600160a01b031681565b6103f36014611515565b61493a6149356103f39261492f606090565b50610477565b614901565b614528614945614913565b611528565b90614953825190565b811015610df7570160200190565b6103f39061497561161e6103f39460ff1690565b901c90565b1561498157565b60405162461bcd60e51b815280611643600482016020808252818101527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604082015260600190565b9091906149eb61224c6149e185611f6860026105b8565b6115f960026105b8565b9060006030614a026149fc836105b8565b8561494a565b53600f60fb1b614a3b614a326001978893851a614a27614a21866105b8565b8961494a565b53611f6860026105b8565b6115f9836105b8565b905b614a5f575b506103f393945090614a5961161e6103f3936105b8565b1461497a565b91614a69866105b8565b831115614ad7576f181899199a1a9b1b9c1cb0b131b232b360811b614a8e600f6105b8565b8216906010821015610df7578792614aae614acb92614ad1941a60f81b90565b851a614aba878961494a565b53614ac56004611515565b90614961565b93612a79565b90614a3d565b91614a42565b614aea90611aa3816147f6565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b614b1460405190565b600090a2565b614b2460276121f7565b7f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c6020820152660819985a5b195960ca1b604082015290565b6103f3614b1a565b6103f391614b71614b5d565b91614b96565b3d15614b9157614b863d6121f7565b903d6000602084013e565b606090565b6000806103f39493614ba6606090565b50602081519101845af4614bb8614b77565b91614c0a565b15614bc557565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b91929015614c3c57508151614c2261161e60006105b8565b14614c2b575090565b614c376103f39161371c565b614bbe565b8290614c46825190565b614c5361161e60006105b8565b1115614c625750805190602001fd5b611643906145566040519056fea264697066735822122089b44be0f82c810bdc76a06e613fc002d3e8e80c2f18be2728cd2c9ca555c61b64736f6c634300081c0033
Deployed Bytecode
0x610180604052600436101561001357600080fd5b60003560e01c806301ffc9a7146103b35780630a88a71b146103ae57806314527c58146103a95780631492ee6d146103a4578063182a75061461039f5780631a7626e71461039a5780631f76d82c146103955780632093eda014610390578063248a9ca31461038b578063271be40f146103865780632737033f14610381578063274d713c1461037c5780632a0acc6a146103775780632ac00efb146103725780632ce4e4c21461036d5780632f2d0f28146103685780632f2ff15d1461036357806336568abe1461035e5780633659cfe614610359578063396394fb1461035457806339a51be51461034f578063451684071461034a57806348d7779b146103455780634b4aa8fc146103405780634f1ef2861461033b57806352d1902d14610336578063633e356514610331578063662bfe971461032c578063678f64bb146103275780636eed94da146103225780637a4263c61461031d5780637f660b01146103185780637fe8209c146103135780638da7a6aa1461030e5780638e1fbe5b1461030957806391d148541461030457806392650943146102ff57806395b070c4146102fa5780639faa3c91146102f5578063a0bc2acd146102f0578063a12cc6f4146102eb578063a217fddf146102e6578063a22561bc146102e1578063a5562f97146102dc578063a5ecfc19146102d7578063a915e7db146102d2578063b05f233a146102cd578063b0e21e8a146102c8578063ba6c7828146102c3578063bfc93532146102be578063cfa54f39146102b9578063d3acb34d146102b4578063d4d5d32a146102af578063d535176b146102aa578063d547741f146102a5578063ea8d9377146102a0578063f339e3b21461029b5763fe6451b8036103cb576114c0565b611494565b611468565b611435565b61141e565b6113b7565b61139f565b61138c565b611364565b6112f7565b6112dc565b6112b4565b61127f565b611267565b61124b565b611220565b6111f4565b6111c9565b6111ad565b611192565b611169565b61114e565b611125565b6110f3565b61104a565b610fe3565b610fb2565b610f6b565b610f26565b610f0b565b610ece565b610e2d565b610d69565b610d55565b610c43565b610c1b565b610be9565b610ab0565b610a78565b610937565b61090a565b6108f1565b6108d6565b6108b0565b610835565b6107db565b610794565b61075a565b6106d1565b61064e565b610632565b6105de565b61058d565b610552565b610535565b610507565b6104a2565b6103fa565b6001600160e01b031981165b036103cb57565b600080fd5b905035906103dd826103b8565b565b906020828203126103cb576103f3916103d0565b90565b9052565b346103cb576104276104156104103660046103df565b6114db565b60405191829182901515815260200190565b0390f35b60009103126103cb57565b6103f3916008021c5b6001600160a01b031690565b906103f39154610436565b6103f3600061013461044b565b6103f39061043f906001600160a01b031682565b6103f390610463565b6103f390610477565b6103f690610480565b6020810192916103dd9190610489565b346103cb576104b236600461042b565b6104276104bd610456565b60405191829182610492565b806103c4565b905035906103dd826104c9565b906020828203126103cb576103f3916104cf565b9081526040810192916103dd9160200152565b0152565b346103cb5761051f61051a3660046104dc565b6116bf565b9061042761052c60405190565b928392836104f0565b346103cb5761054d6105483660046104dc565b61171b565b604051005b346103cb5761054d6105653660046104dc565b61173f565b6103f3916008021c81565b906103f3915461056a565b6103f3600061012f610575565b346103cb5761059d36600461042b565b6104276105a8610580565b6040519182918290815260200190565b6103f36103f36103f39290565b6103f3670de0b6b3a76400006105b8565b6103f36105c5565b346103cb576105ee36600461042b565b6104276105a86105d6565b6103c48161043f565b905035906103dd826105f9565b91906040838203126103cb576103f390602061062b82866104cf565b9401610602565b346103cb576104276105a861064836600461060f565b90611748565b346103cb576104276105a86106643660046104dc565b611766565b909182601f830112156103cb578135916001600160401b0383116103cb5760200192602083028401116103cb57565b9190916040818403126103cb576106af83826104cf565b9260208201356001600160401b0381116103cb576106cd9201610669565b9091565b346103cb5761054d6106e4366004610698565b91611809565b9190610100838203126103cb576107018184610602565b9261070f82602083016104cf565b9261071d83604084016104cf565b9261072b81606085016104cf565b9261073982608083016104cf565b926103f361074a8460a085016104cf565b9360e061062b8260c08701610602565b346103cb5761054d61076d3660046106ea565b96959095949194939293611b63565b6103f366038d7ea4c680006105b8565b6103f361077c565b346103cb576107a436600461042b565b6104276105a861078c565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4290565b6103f36107af565b346103cb576107eb36600461042b565b6104276105a86107d3565b905b600052602052604060002090565b60006108176103f39261013b6107f6565b61044b565b6103f69061043f565b6020810192916103dd919061081c565b346103cb5761042761085061084b3660046104dc565b610806565b60405191829182610825565b909182601f830112156103cb578135916001600160401b0383116103cb5760200192600183028401116103cb57565b906020828203126103cb5781356001600160401b0381116103cb576106cd920161085c565b346103cb5761054d6108c336600461088b565b90612010565b6103f3600061012d610575565b346103cb576108e636600461042b565b6104276105a86108c9565b346103cb5761054d61090436600461060f565b90612035565b346103cb5761054d61091d36600461060f565b906120a3565b906020828203126103cb576103f391610602565b346103cb5761054d61094a366004610923565b612257565b90916040828403126103cb5781356001600160401b0381116103cb5783610977918401610669565b92909360208201356001600160401b0381116103cb576106cd9201610669565b0190565b906109bb6109b46109aa845190565b8084529260200190565b9260200190565b9060005b8181106109cc5750505090565b9091926109e96109e26001928651815260200190565b9460200190565b9291016109bf565b906103f39161099b565b90610a11610a07835190565b8083529160200190565b9081610a236020830284019460200190565b926000915b838310610a3757505050505090565b90919293946020610a5a610a53838560019503875289516109f1565b9760200190565b9301930191939290610a28565b60208082526103f3929101906109fb565b346103cb57610427610a97610a8e36600461094f565b92919091612314565b60405191829182610a67565b6103f3600061013361044b565b346103cb57610ac036600461042b565b610427610850610aa3565b906020828203126103cb5781356001600160401b0381116103cb576106cd9201610669565b906109978160209361081c565b90610b0c6109b46109aa845190565b9060005b818110610b1d5750505090565b909192610b306109e26001928651610af0565b929101610b10565b906103f391610afd565b90610b4e610a07835190565b9081610b606020830284019460200190565b926000915b838310610b7457505050505090565b90919293946020610b90610a5383856001950387528951610b38565b9301930191939290610b65565b92610bcd6103f39593610bbf610bdb94608088019088820360008a0152610b42565b9086820360208801526109fb565b9084820360408601526109fb565b9160608184039101526109fb565b346103cb57610427610c05610bff366004610acb565b906124eb565b90610c1294929460405190565b94859485610b9d565b346103cb576104276105a8610c313660046104dc565b612736565b6103f36000610131610575565b346103cb57610c5336600461042b565b6104276105a8610c36565b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b03821117610c9557604052565b610c5e565b906103dd610ca760405190565b9283610c74565b6001600160401b038111610c9557602090601f01601f19160190565b90826000939282370152565b90929192610ceb610ce682610cae565b610c9a565b93818552818301116103cb576103dd916020850190610cca565b9080601f830112156103cb578160206103f393359101610cd6565b9190916040818403126103cb57610d378382610602565b9260208201356001600160401b0381116103cb576103f39201610d05565b61054d610d63366004610d20565b906127a7565b346103cb57610d7936600461042b565b6104276105a8612897565b90916060828403126103cb576103f3610d9d8484610602565b936040610dad82602087016104cf565b94016104cf565b906107f890610480565b634e487b7160e01b600052603260045260246000fd5b8054821015610df757610dee600191600052602060002090565b91020190600090565b610dbe565b90610e0c610e1192610137610db4565b6107f6565b80548210156103cb576103f391610e2791610dd4565b9061044b565b346103cb57610427610850610e43366004610d84565b91610dfc565b6103f39061043f565b6103f39054610e49565b6103f39081565b6103f39054610e5c565b90610e7d610e82926101396107f6565b610db4565b610e8b81610e52565b916103f36002610e9d60018501610e52565b9301610e63565b6040906105036103dd9496959396610ec46060840198600085019061081c565b602083019061081c565b346103cb57610427610eea610ee436600461060f565b90610e6d565b60405191939193849384610ea4565b6103f360036105b8565b6103f3610ef9565b346103cb57610f1b36600461042b565b6104276105a8610f03565b346103cb5761054d610f3936600461060f565b906128e6565b7f26981beea75f8fcfde68f33899c220961e8d7491d7947e2724d9d979c9d6a93b90565b6103f3610f3f565b346103cb57610f7b36600461042b565b6104276105a8610f63565b7f380b61a03d510578eb69abac2609346d7bf838d9f340f7d0c66cfc65790d7f5f90565b6103f3610f86565b346103cb57610fc236600461042b565b6104276105a8610faa565b6000610fde6103f39261013e6107f6565b610575565b346103cb576104276105a8610ff93660046104dc565b610fcd565b9061100d6109b46109aa845190565b9060005b81811061101e5750505090565b9091926110316109e26001928651610af0565b929101611011565b60208082526103f392910190610ffe565b346103cb576104276110656110603660046104dc565b6128f0565b60405191829182611039565b91906040838203126103cb576103f3906020610dad8286610602565b90610e0c61109d92610136610db4565b906110a782610e63565b916110b460018201610e63565b916103f36003610e9d60028501610e63565b6105036103dd946110ec6060949897956110e5608086019a6000870152565b6020850152565b6040830152565b346103cb5761042761110f611109366004611071565b9061108d565b9061111c94929460405190565b948594856110c6565b346103cb5761042761041561113b36600461060f565b90612993565b6103f36000610130610575565b346103cb5761115e36600461042b565b6104276105a8611141565b346103cb576104276105a861117f36600461060f565b906129b3565b6103f3600061012e610575565b346103cb576111a236600461042b565b6104276105a8611185565b346103cb576104276105a86111c336600461060f565b906129c8565b346103cb5761054d6111dc366004610698565b91612a86565b6103f360006105b8565b6103f36111e2565b346103cb5761120436600461042b565b6104276105a86111ec565b6000610fde6103f39261013d6107f6565b346103cb576104276105a86112363660046104dc565b61120f565b90610e0c610e1192610138610db4565b346103cb57610427610850611261366004610d84565b9161123b565b346103cb5761051f61127a3660046104dc565b612da2565b346103cb576104276105a8611295366004611071565b90612dae565b6103f367016345785d8a00006105b8565b6103f361129b565b346103cb576112c436600461042b565b6104276105a86112ac565b6103f36000610132610575565b346103cb576112ec36600461042b565b6104276105a86112cf565b346103cb5761042761106561130d36600461060f565b90612e53565b906113226109b46109aa845190565b9060005b8181106113335750505090565b90919261134b6109e260019286511515815260200190565b929101611326565b60208082526103f392910190611313565b346103cb5761042761138061137a366004610698565b91612e74565b60405191829182611353565b61054d61139a3660046104dc565b61302b565b346103cb5761054d6113b23660046104dc565b613220565b346103cb576113c736600461042b565b61054d613294565b906080828203126103cb576113e481836104cf565b926113f282602085016104cf565b9261140083604083016104cf565b9260608201356001600160401b0381116103cb576106cd9201610669565b61054d61142c3660046113cf565b939290926132f4565b346103cb5761054d61144836600461060f565b9061353a565b6103f368014d1120d7b16000006105b8565b6103f361144e565b346103cb5761147836600461042b565b6104276105a8611460565b60006108176103f39261013a6107f6565b346103cb576104276108506114aa3660046104dc565b611483565b6000610fde6103f39261013c6107f6565b346103cb576104276105a86114d63660046104dc565b6114af565b637965db0b60e01b6001600160e01b03198216149081156114fa575090565b6103f391506001600160e01b0319166301ffc9a760e01b1490565b6115226103f36103f39290565b60ff1690565b6103f36103f36103f39260ff1690565b634e487b7160e01b600052601160045260246000fd5b9190611559565b9290565b820180921161156457565b611538565b60016103f3910160ff1690565b929091600093611585856105b8565b9261158f86611515565b935b866101376115ad6103f36115a988610e0c3386610db4565b5490565b6115b688611528565b101561160b57916115f96115ff926115f388610e0c611605976115ed610e278e6115e886610e0c610136963390610db4565b610dd4565b90610db4565b01610e63565b9061154e565b94611569565b93611591565b5050909492935061162261161e876105b8565b9190565b14611632576106cd939450611662565b631b28bde960e21b85528480600481015b0390fd5b9160206103dd9294936105036040820196600083019061081c565b92919250507f3aa8c2e667a2fabc8ac13b12611dabfd9bdd2f66210ad437122a7ab032ddf0116116ae61169a6103f3856101356107f6565b936116a460405190565b9182913383611647565b0390a16103f36001610e9d84610e63565b6106cd90600080611576565b6103dd906116df6116da6107af565b613544565b61170f565b90600019905b9181191691161790565b906117046103f361170b926105b8565b82546116e4565b9055565b6103dd906101316116f4565b6103dd906116cb565b6103dd906117336116da6107af565b6103dd9061012f6116f4565b6103dd90611724565b6115f3600291610e0c6103f39461175d600090565b50610136610db4565b60016115f36103f392611777600090565b5060c96107f6565b906103dd92916117906116da6107af565b6117af565b9190811015610df7576020020190565b356103f3816104c9565b6117be9093929361012e6116f4565b82916117ca60006105b8565b835b811015611802576117fb816117f56117f06117eb6117cc958a89611795565b6117a5565b61362d565b60010190565b90506117ca565b5092505050565b906103dd929161177f565b6103f39060081c611522565b6103f39054611814565b6103f390611522565b6103f3905461182a565b1561184457565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b9060ff906116ea565b6115226103f36103f39260ff1690565b906118c96103f361170b926118a9565b82546118a0565b9061ff009060081b6116ea565b906118ed6103f361170b92151590565b82546118d0565b6103f690611515565b6020810192916103dd91906118f4565b969492909161195f9694926119296119256000611820565b1590565b988980611a01575b80156119bc575b6119419061183d565b8961195661194f6001611515565b60006118b9565b6119ab57611a5b565b61196557565b6119706000806118dd565b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249861199a60405190565b806119a66001826118fd565b0390a1565b6119b7600160006118dd565b611a5b565b506119d16119256119cc30610480565b61371c565b801561193857506119416119e56000611833565b6119f96119f26001611515565b9160ff1690565b149050611938565b50611a0c6000611833565b611a196119f26001611515565b10611931565b906001600160a01b03906116ea565b90611a3e6103f361170b92610480565b8254611a1f565b61043f6103f36103f39290565b6103f390611a45565b949193611ac8611ad894611ac0611ad0949b9a9997611ab8611a7b6107af565b9d611ab0611aa8611a8a610f86565b9d611a936137a0565b611a9b6137a0565b611aa36137c0565b610480565b610134611a2e565b61012f6116f4565b61012e6116f4565b6101306116f4565b6101316116f4565b6101326116f4565b6000611aeb611ae682611a52565b61043f565b611af48361043f565b14611b545750611b3f9394611b0e611b3a92610133611a2e565b611b1881806137d6565b611b2981611b24610f3f565b6137d6565b611b3381846137d6565b3390613846565b613846565b6103dd611b4c60646105b8565b61012d6116f4565b63bb1ef1d360e01b8152600490fd5b906103dd9796959493929161190d565b906103dd91611b836116da610f3f565b611d83565b6001600160401b038111610c955760208091020190565b905051906103dd826104c9565b90929192611bbc610ce682611b88565b93818552602080860192028301928184116103cb57915b838310611be05750505050565b60208091611bee8486611b9f565b815201920191611bd3565b9080601f830112156103cb5781516103f392602001611bac565b90929192611c23610ce682611b88565b93818552602080860192028301928184116103cb57915b838310611c475750505050565b60208091611c558486611b9f565b815201920191611c3a565b9080601f830112156103cb5781516103f392602001611c13565b916060838303126103cb5782516001600160401b0381116103cb5782611ca1918501611bf9565b9260208101516001600160401b0381116103cb5783611cc1918301611bf9565b9260408201516001600160401b0381116103cb576103f39201611c60565b9190611cfd81611cf6816109979560209181520190565b8095610cca565b601f01601f191690565b60208082526103f393910191611cdf565b6040513d6000823e3d90fd5b90611d2d825190565b811015610df7576020809102010190565b8181029291811591840414171561156457565b634e487b7160e01b600052601260045260246000fd5b8115611d71570490565b611d51565b9190820391821161156457565b611dc191600091611d98611aa3610134610e52565b90611da260405190565b809581948293611db6638331ed0f60e01b90565b845260048401611d07565b03915afa801561200b5760009283928392611fe5575b50825192600091611de783611515565b855b611df282611528565b1015611fdc57611e11611e0d611e0783611528565b85611d24565b5190565b611e26611e0d611e2084611528565b88611d24565b611e3b611e0d611e3585611528565b8b611d24565b611e4a6103f3826101356107f6565b600181019088611e5983610e63565b910190611e6582610e63565b85821015611fcd57611e7685612736565b90611e808c6105b8565b8214611fb757611e8f8c6105b8565b8103611f40575b50505092611f248593611edb837f04e203a5aa41f955079b98cd79ebab33011841b6db7c91e8285bb43a14dad29695611ed6611f399a611de99c9a6116f4565b6116f4565b6103f3611ef2611eed8361013d6107f6565b610e63565b611f1e611f17611f03610130610e63565b6115f9611f11610131610e63565b85611d3e565b3a90611d3e565b836138eb565b92611f3161052c60405190565b0390a2611569565b9050611de7565b61161e61155582611f6d611f578c611f72966138bb565b611f68670de0b6b3a76400006105b8565b611d3e565b611d67565b109081611f96575b50611f8757388080611e96565b63cdd570c960e01b8952600489fd5b611fa1915085611d76565b611fb061161e620151806105b8565b1038611f7a565b631db2c77b60e31b8c5260048c0186905260248cfd5b63a59eca1760e01b8b5260048bfd5b50945050505050565b91509261200492503d8091833e611ffc8183610c74565b810190611c7a565b9238611dd7565b611d18565b906103dd91611b73565b906103dd9161202b6116da82611766565b906103dd91613846565b906103dd9161201a565b1561204657565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b6103dd91906120c36120b43361043f565b6120bd8461043f565b1461203f565b613a6a565b156120cf57565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b1561213057565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b6103dd906121f261219a30610480565b6121d87f000000000000000000000000db625e03be7630b30f13646d610fe96e483dce2c916121d16121cb8461043f565b9161043f565b14156120c8565b6121ec6121cb6121e6613aca565b9261043f565b14612129565b612231565b90612204610ce683610cae565b918252565b369037565b906103dd61222461221e846121f7565b93610cae565b601f190160208401612209565b60006103dd9161224081613ae6565b61225161224c836105b8565b61220e565b90613b8a565b6103dd9061218a565b90612204610ce683611b88565b60005b82811061227c57505050565b606082820152602001612270565b906103dd6122a061229a84612260565b93611b88565b601f19016020840161226d565b356103f3816105f9565b903590601e1936829003018212156103cb57018035906001600160401b0382116103cb576020019160208202360383136103cb57565b90821015610df75760206106cd92028101906122b7565b906103dd61222461229a84612260565b92919390612320606090565b50809280840361242d57906123378496959661228a565b9560009361234560006105b8565b955b805b87101561242357889061236561236089888c611795565b6122ad565b956123796123748a88886122ed565b905090565b996123838b612304565b61238d8b86611d24565b526123988a85611d24565b506123a2896105b8565b8b8110156123fe57806117f58c6123f6836123f08f8f908f8f92610e0c6123e06117eb6123f99d6123da8c6115f3976123e99a6122ed565b90611795565b91610136610db4565b938b611d24565b51611d24565b52565b6123a2565b509499509495509661234991506124159060010190565b969050969196939293612347565b5095505050505050565b63f684cced60e01b6000908152600490fd5b60005b82811061244e57505050565b606082820152602001612442565b906103dd61246c61229a84612260565b601f19016020840161243f565b906103f69061043f565b6103f36080610c9a565b906103dd6124db600361249e612483565b946124af6124ab82610e63565b8752565b6124c56124be60018301610e63565b6020880152565b6115f36124d460028301610e63565b6040880152565b6060840152565b6103f39061248d565b9181906124f78261245c565b608052608051906125078461228a565b6101005261010051906125198561228a565b61016052610160519061252b8661228a565b61014052610140519061253e60006105b8565b60e0525b865b60e051101561272c5761255d6117eb60e051888b611795565b60c05261257761257261013a60c051906107f6565b610e52565b60a05261258c611eed61013d60c051906107f6565b6101205261259c61012051612304565b6125aa60e051608051611d24565b526125b960e051608051611d24565b51506125c761012051612304565b6125d660e05161010051611d24565b526125e660e05161010051611d24565b51506125f461012051612304565b61260360e05161016051611d24565b5261261360e05161016051611d24565b515061262161012051612304565b61263060e05161014051611d24565b5261264060e05161014051611d24565b5061264b60006105b8565b61012051811015612705576127009061267e61266b60e051608051611d24565b516126798360a05192611d24565b612479565b6117f56126ed60406126a96126a461269b61013660a05190610db4565b60c051906107f6565b6124e2565b6126c76126b4825190565b6123f6876123f060e05161010051611d24565b6126e86126d5602083015190565b6123f6876123f060e05161016051611d24565b015190565b6123f6836123f060e05161014051611d24565b61264b565b509091929394956125449061271c60e05160010190565b60e0529695949392919050612542565b9295509295509250565b6127456125728261013a6107f6565b612752611ae66000611a52565b61275b8261043f565b14612775576115f3600291610e7d6103f3946101396107f6565b50506103f360006105b8565b906103dd9161279261219a30610480565b6103dd916001916127a281613ae6565b613b8a565b906103dd91612781565b156127b857565b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608490fd5b6103f39061286061282e30610480565b61285a6121cb7f000000000000000000000000db625e03be7630b30f13646d610fe96e483dce2c61043f565b146127b1565b61288e565b6103f37f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105b8565b506103f3612865565b6103f3600061281e565b906103dd916128b16116da6107af565b60006128bf611ae682611a52565b6128c88461043f565b14611b545750906128de6103dd926101326116f4565b610133611a2e565b906103dd916128a1565b906129006125728361013a6107f6565b91612918612913611eed8361013d6107f6565b612304565b6000926129256000611515565b945b612933611ae686611a52565b61293c8261043f565b1461298a57611ae661298161297b600161297585612969612933976126796129638f611528565b8c611d24565b610e7d8a6101396107f6565b01610e52565b97611569565b96915050612927565b50935091505090565b6103f39160006129a86129ae93611777600090565b01610db4565b611833565b6115f3600191610e0c6103f39461175d600090565b6115f3600091610e0c6103f39461175d600090565b60ff1660ff81146115645760010190565b60001981146115645760010190565b916001600160a01b0360089290920291821b911b6116ea565b9190612a276103f361170b93610480565b9083546129fd565b634e487b7160e01b600052603160045260246000fd5b6103dd91600091612a16565b80548015612a74576000190190612a71612a6b8383610dd4565b90612a45565b55565b612a2f565b8015611564576000190190565b9082612a936103f3610ef9565b8411612d5e57939260008095612aa882611515565b905b835b612ab583611528565b1015612d37579293612ad3612360612acc84611528565b8684611795565b9361013895612ae96115a989610e0c338b610db4565b928392612af5876105b8565b9a5b845b8c5b1015612bea57612b17610e278d6115e88e610e0c8f3390610db4565b612b236121cb8b61043f565b03612bd0578b9c50600194612b37866105b8565b612b419082611d76565b8c612b4c338e610db4565b90612b56916107f6565b90612b6091610dd4565b612b699161044b565b8d8d612b75338f610db4565b90612b7f916107f6565b90612b8991610dd4565b612b939291612a16565b8b612b9e338d610db4565b90612ba8916107f6565b612bb190612a51565b612bba90612a79565b9b612afb612af98e5b505050509b9a939b612af7565b84612afb612be2612af99f979e6129ee565b9e8f92612bc3565b9490969391999850612bfd929a50611d76565b97612c07826105b8565b8914612d2057612c1a829a98939a6105b8565b9261013795612c306115a98a610e0c8b8b610db4565b9b859c5b808e1080612d17575b15612cf057612c57610e278f6115e88e610e0c8f8f610db4565b612c636121cb3361043f565b03612cde57612ccf818f612cc56103f38f8f8f90610e0c91610e7d612cca97612cbf612cb0610e27612ca2612cd59f612c9c60016105b8565b90611d76565b6115e88a610e0c8a8a610db4565b916115e888610e0c8888610db4565b90612a16565b612a51565b612a79565b966129ee565b9a5b9a95612c34565b959a9c612cea906129ee565b9c612cd7565b5096509650969793909850612d0b919950612aac92506129dd565b91979296939050612aaa565b508c8710612c3d565b97509791612aac91939450612d0b909695966129dd565b509495909450159250612d48915050565b612d4f5750565b63016d2eb160e61b8152600490fd5b630eb7167f60e11b6000908152600490fd5b906106cd9291612d816116da610f3f565b50612d93916103f391506101356107f6565b906103f36001610e9d84610e63565b6106cd90600080612d70565b6103f391610e0c6115a992612dc1600090565b50610137610db4565b90612de5612dd96109aa845490565b92600052602060002090565b9060005b818110612df65750505090565b909192612e17612e10600192612e0b87610e52565b610af0565b9460010190565b929101612de9565b906103f391612dca565b906103dd612e4392612e3a60405190565b93848092612e1f565b0383610c74565b6103f390612e29565b612e6f90610e0c6103f393612e66606090565b50610138610db4565b612e4a565b90929082612e8184612304565b600095612e8d87611515565b925b865b612e9a85611528565b1015612f9157612ea9886105b8565b926101379389612ed56115a989610e0c612ecf612360612ec88d611528565b8a8c611795565b8a610db4565b99612edf82611515565b925b8b612eeb85611528565b1015612f3d57612f31612f37916115f9856115f38e610e0c8f8f8f8f6115e88f91610e0c6115ed956115ed612360610e27978c95612f2b6101369c611528565b91611795565b93611569565b92612ee1565b9150969150612f67929950612e91939550979397612f5d61161e8c6105b8565b11612f74576129dd565b9396929050949094612e8f565b612f8c6001612f8561296384611528565b9015159052565b6129dd565b505093505050915090565b90612fab612dd96109aa845490565b9060005b818110612fbc5750505090565b909192612fd1612e10600192612e0b87610e52565b929101612faf565b926103f396946130106130179261300961301e96999599612fff60c08a019b60008b0152565b602089019061081c565b6040870152565b6060850152565b6080830152565b60a0818403910152612f9c565b61013661304160016115f384610e0c3386610db4565b9160009261305161161e856105b8565b146131f65761306161012f610e63565b3411156131e757826131707f682f4980dd4daeb1b816d7158fdaf8270dce98645faaecdfa1b7627d5d89c372829483946130d1670de0b6b3a76400006130cb6130c56130bf6130b1610132610e63565b6130ba856105b8565b611d76565b34611d3e565b916105b8565b90611d67565b9384926130ff876130e685610e0c3386610db4565b016130f9866130f483610e63565b61154e565b906116f4565b61311260036115f385610e0c3386610db4565b61311e61161e896105b8565b146131a8575b61314b60026115f385610e0c61314360016115f384610e0c338b610db4565b953390610db4565b61315b84610e0c33610138610db4565b9161316560405190565b958695339087612fd9565b0390a161318e613187611aa3611aa3610133610e52565b9134611d76565b9082821561319f575bf11561200b57565b506108fc613197565b6131c56131be60016115f386610e0c3387610db4565b8433613c9a565b6131e26131db60016115f386610e0c3387610db4565b3385613ddb565b613124565b63659c8c1f60e01b8352600483fd5b6376a59b4f60e01b8352600483fd5b6103dd906132146116da6107af565b6103dd906101306116f4565b6103dd90613205565b613231614257565b613239613241565b6103dd614289565b61324c6116da610f86565b6103dd61325830610480565b600090803161326961161e846105b8565b03613272575050565b81808092613282611aa333610480565b90319082821561319f57f11561200b57565b6103dd613229565b909291926132ac610ce682611b88565b93818552602080860192028301928184116103cb57915b8383106132d05750505050565b602080916132de8486610602565b8152019201916132c3565b6103f391369161329c565b91936133016103f361129b565b8211801561350c575b80156134f8575b6134e657613324611eed8461013d6107f6565b61333561161e6103f361012d610e63565b116134d45761334561012f610e63565b3411156134c2576101386133606115a985610e0c3385610db4565b9261336c83809561154e565b61337a61161e6103f3610ef9565b11612d5e5784670de0b6b3a7640000613394610132610e63565b61339d826105b8565b906133a791611d76565b6133b19034611d3e565b906133bb906105b8565b6133c491611d67565b9384928983610136816133d73383610db4565b906133e1916107f6565b876133eb82610e63565b906133f59161154e565b6133fe916116f4565b838261340a3384610db4565b90613414916107f6565b60010190613421916116f4565b3361342b91610db4565b90613435916107f6565b60020190613442916116f4565b6000998a998a998a996134548b6105b8565b14157f682f4980dd4daeb1b816d7158fdaf8270dce98645faaecdfa1b7627d5d89c372986131709661315b94610e0c936134a8575b5050613496868433613c9a565b6134a1863385613ddb565b3390610db4565b6134bb916134b5916132e9565b846142b7565b3880613489565b63659c8c1f60e01b6000908152600490fd5b6303dce79360e31b6000908152600490fd5b63ebbd55a360e01b6000908152600490fd5b506135046103f361144e565b851415613311565b506135186103f361077c565b821061330a565b906103dd916135306116da82611766565b906103dd91613a6a565b906103dd9161351f565b6103dd9033906144e6565b939190925b60018211613560575050565b90919280820481116115645760018316613582575b8002929160011c90613554565b93840293613575565b929192811561360e5780156136065780806001146135fd576002146135e85760208210610133821016604e8310600b831016176135de57926135d191819394600161354f565b8092048111611564570290565b0a91821161156457565b5060ff81116115645760020a91821161156457565b50600193505050565b506000925050565b506001925050565b906136246119f26103f39390565b6000199161358b565b61363861012e610e63565b9061364360006105b8565b91613653611eed8361013d6107f6565b926136636125728461013a6107f6565b9461366e6000611515565b955b855b61367b88611528565b1015613706576136e361297b6001612975613672946101366136a5846115f38d610e0c8686610db4565b8b838c8c8085146136eb575091610e0c6136dd926136d76129699796956130cb6003976136d189611515565b90613616565b95610db4565b016116f4565b969050613670565b935050600391610e0c6136dd9261370196610db4565b612969565b509450916103dd9350611ed6915061013e6107f6565b3b61372a61161e60006105b8565b1190565b1561373557565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b6103dd61379b6000611820565b61372e565b6103dd61378e565b6137b561379b6000611820565b6103dd6103dd614578565b6103dd6137a8565b906117046103f361170b9290565b9061380561161e6138016137e985611766565b946103f38560016137fb8460c96107f6565b016137c8565b9390565b917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff61383060405190565b600090a4565b906118c96103f361170b92151590565b6138536119258383612993565b61385b575050565b61387660016138718460006129a88660c96107f6565b613836565b61389061388a613884339390565b93610480565b91610480565b917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d61383060405190565b8181106138cc57906103f391611d76565b6103f391611d76565b9081526040810192916103dd916020019061081c565b6138fa611eed8261013e6107f6565b906000613906816105b8565b8314613a635761391b6125728361013a6107f6565b9361392582611515565b945b865b61393287611528565b1015613a5a578061013661395787611f6d86611f6860036115f38c610e0c8a8a610db4565b9161396a866115f389610e0c8587610db4565b8310156139bc57506001612975846139a26139b4956130f98a6139978d610e0c6139299c6139ae9b610db4565b01916130ba83610e63565b610e7d896101396107f6565b96611569565b959050613927565b6139b49250613a4e600161297583613a07613a00846139299a9f988e610e0c8f9a6115f393610e7d8d6139f1613a559f6105b8565b906136dd87610e0c8787610db4565b8c83614580565b7f571f5252f0a48338759e66ddc2a39468bfa5bd64428bc84f0496b26d83a0d060818c613a3f613a3660405190565b928392836138d5565b0390a1610e7d8b6101396107f6565b9887614645565b611569565b50505050505050565b5050505050565b613a748282612993565b613a7c575050565b613a91600061387184826129a88660c96107f6565b613a9f61388a613884339390565b917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b61383060405190565b6103f360006129756103f3612865565b506103dd6116da6107af565b6103dd90613ada565b6103f37f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91436105b8565b906020828203126103cb576103f391611b9f565b15613b3357565b60405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9190613ba26000613b9c6103f3613aef565b01611833565b15613bb25750506103dd906147f6565b613bbe611aa384610480565b6020613bc960405190565b6352d1902d60e01b815291829060049082905afa60009181613c69575b50613c48575060405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b92613c646103dd94613c5e61161e6103f3612865565b14613b2c565b614755565b613c8c91925060203d602011613c93575b613c848183610c74565b810190613b18565b9038613be6565b503d613c7a565b9091613ca660006105b8565b8114613cfc57613cf283613cea610e0c9460036136dd6103dd98613cdf6130f9986130cb613cd561012e610e63565b916136d187611515565b988994610136610db4565b61013e6107f6565b916130f483610e63565b5060036136dd6103dd93610e0c613d1360006105b8565b94610136610db4565b6103f36060610c9a565b906103dd613d626002613d37613d1c565b94613d4a613d4482610e52565b87612479565b6115f3613d5960018301610e52565b60208801612479565b6040840152565b6103f390613d26565b6103f3905161043f565b634e487b7160e01b600052600060045260246000fd5b6002613dca60406103dd94613db2613dac60008301613d72565b86611a2e565b6126e8613dc160208301613d72565b60018701611a2e565b91016116f4565b906103dd91613d92565b90929161013993613df8613df382610e7d86896107f6565b613d69565b61013a90613e0c611ae661257287856107f6565b613e158461043f565b149081156141dd575b81156141ba575b8115614195575b50614073575b600092613e3e84611a52565b93613e47613d1c565b94613e5481838801612479565b613e618160208801612479565b613e6c836040880152565b613e7961257288866107f6565b613e856121cb8361043f565b03613ee75750505081610e7d856103dd9798613eb1613ec69796613eac84613ec1986107f6565b611a2e565b610e0c84613eac8461013b6107f6565b613dd1565b613ee2613ed360016105b8565b6130f9613cf28461013d6107f6565b614845565b613efa612572888694959a9897966107f6565b613f038261043f565b613f0c8261043f565b141581898c83614054575b50505015613f3957600161297582610e7d8b8e613f3496506107f6565b613efa565b6103dd9850988785613ec19695613ec6999c84610e7d9785978c613f5c8261043f565b613f658661043f565b03613fb9575050505050610e0c92613eac91613f9361013b91613f8b61257285856107f6565b908d01612479565b610e0c846001613fb3613fa6868b6107f6565b6115ed61257288886107f6565b01611a2e565b8488859489946140086121cb6121e68c610e0c9f88610e7d613fb39f9e9261297593610e0c8e879f866020613fee9201612479565b876140018161297589610e7d89896107f6565b9101612479565b1461403d5750936115ed600193612975613fb394610e7d8961402d6140339b886107f6565b966107f6565b610e7d87876107f6565b90915061404f9450613eac92506107f6565b614033565b614069935091610e7d6115f3926002946107f6565b891181898c613f17565b6140846103f383610e7d878a6107f6565b61409060028201610e63565b841461418c5761409f81610e52565b60006140aa81611a52565b916140b76121cb8461043f565b1461416e576140e5896001613fb36140da8b6140d4848a01610e52565b946107f6565b6115ed868901610e52565b60018301916140f96121cb6121e685610e52565b1461414e57613fb361410f826141239501610e52565b926115ed61411d8a8d6107f6565b91610e52565b61414961413060016105b8565b6130f961413f8761013d6107f6565b916130ba83610e63565b613e32565b61415d91506141699201610e52565b613eac8661013b6107f6565b614123565b61418761417d60018501610e52565b613eac89876107f6565b6140e5565b50505050509050565b6141a29150602001613d72565b6141b26121cb611ae66000611a52565b141538613e2c565b90506141c581613d72565b6141d56121cb611ae66000611a52565b141590613e25565b90506141f1611ae66125728761013b6107f6565b6141fa8461043f565b1490613e1e565b6103f360026105b8565b1561421257565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b6103dd61426460fb610e63565b61427861426f614201565b9182141561420b565b60fb6116f4565b6103f360016105b8565b6103dd61427861427f565b80549190600160401b831015610c955782612cbf9160016103dd95018155610dd4565b6000916142c46000611515565b925b6142d16103f3835190565b6142da85611528565b1015614403576143166142f66103f385610e0c33610138610db4565b61431061430b61430588611528565b86611d24565b613d72565b90614294565b6101379061433f6115a985610e0c61433961430b6143338b611528565b89611d24565b86610db4565b958161434a81611515565b8861435482611528565b10156143f157614385610e27826115e88a610e0c61437f61430b8f6143798f91611528565b90611d24565b8b610db4565b6143916121cb3361043f565b146143a45761439f906129dd565b61434a565b509650946143bf929091508460005b6143c6575b50506129dd565b92936142c6565b6103f36143e391610e0c6143ea946115ed61430b611e3589611528565b3390614294565b38846143b8565b509650949091846143b36143bf941590565b50505050565b6103f3906105b8565b60005b8381106144255750506000910152565b8181015183820152602001614415565b61099761444d92602092614447815190565b94859290565b93849101614412565b61448e6103f393926144886144889376020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260170190565b90614435565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110190565b6144cc611cfd602093610997936144c0815190565b80835293849260200190565b95869101614412565b60208082526103f3929101906144ab565b906144f46119258284612993565b6144fc575050565b6145466103f36116439361452e61451e6145186145529661491d565b92614409565b61452860206105b8565b906149ca565b9061453860405190565b938492602084019283614456565b90810382520382610c74565b6040515b62461bcd60e51b8152918291600483016144d5565b61323961379b6000611820565b6103dd61456b565b906136dd6003916103dd9461459560006105b8565b81036145aa575b50610e0c613d1360006105b8565b6145c96145d8916130cb6145bf61012e610e63565b916136d188611515565b6130f961413f8461013e6107f6565b3861459c565b9160001960089290920291821b911b6116ea565b91906146036103f361170b936105b8565b9083546145de565b6103dd916000916145f2565b6000808255600182018190556103dd9160020161460b565b90600003614640576103dd90614617565b613d7c565b6146fe6103dd926146f961013991610e7d85614668613df384610e7d84896107f6565b9461467286613d72565b9560009661467f88611a52565b9061468c6121cb8361043f565b14614735576146ba6146a060208401613d72565b6001613fb36146af88886107f6565b6115ed8d8801613d72565b8760208301916146cf6121cb6121e685613d72565b1461471a57613fb36146e582610e0c9501613d72565b926115ed6146f388886107f6565b91613d72565b61462f565b613ee261470b60016105b8565b6130f961413f8461013d6107f6565b6147299150610e0c9201613d72565b613eac8461013b6107f6565b61475061474460208401613d72565b613eac8661013a6107f6565b6146ba565b9161475f83614add565b815161476e61161e60006105b8565b1190811561478c575b50614780575050565b61478991614b65565b50565b905038614777565b1561479b57565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b6103dd9061480b6148068261371c565b614794565b6000613fb36103f3612865565b6103f6906105b8565b9081526060810193926103dd92909160409161483e906020830152565b0190614818565b6148546125728261013a6107f6565b614861611ae66000611a52565b61486a8261043f565b036148e7575061487a60006105b8565b61013c9161488e6103f3611eed83866107f6565b820361489957505050565b6148c882611ed6837f6dfb4bd7e2c0db8e2dd13a94ab3f642c6a81c617e38ecdc4ba0d21d66446ef0d966107f6565b6119a668014d1120d7b16000006148de60405190565b93849384614821565b60026115f36148fc92610e7d856101396107f6565b61487a565b6103f39081906001600160a01b031681565b6103f36014611515565b61493a6149356103f39261492f606090565b50610477565b614901565b614528614945614913565b611528565b90614953825190565b811015610df7570160200190565b6103f39061497561161e6103f39460ff1690565b901c90565b1561498157565b60405162461bcd60e51b815280611643600482016020808252818101527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604082015260600190565b9091906149eb61224c6149e185611f6860026105b8565b6115f960026105b8565b9060006030614a026149fc836105b8565b8561494a565b53600f60fb1b614a3b614a326001978893851a614a27614a21866105b8565b8961494a565b53611f6860026105b8565b6115f9836105b8565b905b614a5f575b506103f393945090614a5961161e6103f3936105b8565b1461497a565b91614a69866105b8565b831115614ad7576f181899199a1a9b1b9c1cb0b131b232b360811b614a8e600f6105b8565b8216906010821015610df7578792614aae614acb92614ad1941a60f81b90565b851a614aba878961494a565b53614ac56004611515565b90614961565b93612a79565b90614a3d565b91614a42565b614aea90611aa3816147f6565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b614b1460405190565b600090a2565b614b2460276121f7565b7f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c6020820152660819985a5b195960ca1b604082015290565b6103f3614b1a565b6103f391614b71614b5d565b91614b96565b3d15614b9157614b863d6121f7565b903d6000602084013e565b606090565b6000806103f39493614ba6606090565b50602081519101845af4614bb8614b77565b91614c0a565b15614bc557565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b91929015614c3c57508151614c2261161e60006105b8565b14614c2b575090565b614c376103f39161371c565b614bbe565b8290614c46825190565b614c5361161e60006105b8565b1115614c625750805190602001fd5b611643906145566040519056fea264697066735822122089b44be0f82c810bdc76a06e613fc002d3e8e80c2f18be2728cd2c9ca555c61b64736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.