Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 4,133 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Add Headers | 10576547 | 1578 days ago | IN | 0 ETH | 0.00986353 | ||||
Mark New Heavies... | 10572114 | 1579 days ago | IN | 0 ETH | 0.00361046 | ||||
Add Headers | 10571625 | 1579 days ago | IN | 0 ETH | 0.01631964 | ||||
Mark New Heavies... | 10571602 | 1579 days ago | IN | 0 ETH | 0.00539083 | ||||
Add Headers | 10571594 | 1579 days ago | IN | 0 ETH | 0.01787958 | ||||
Mark New Heavies... | 10571574 | 1579 days ago | IN | 0 ETH | 0.00552636 | ||||
Add Headers | 10571571 | 1579 days ago | IN | 0 ETH | 0.01655664 | ||||
Mark New Heavies... | 10571570 | 1579 days ago | IN | 0 ETH | 0.00451962 | ||||
Add Headers | 10571559 | 1579 days ago | IN | 0 ETH | 0.00554574 | ||||
Mark New Heavies... | 10571558 | 1579 days ago | IN | 0 ETH | 0.00250764 | ||||
Add Headers | 10571545 | 1579 days ago | IN | 0 ETH | 0.01643562 | ||||
Mark New Heavies... | 10571538 | 1579 days ago | IN | 0 ETH | 0.00471892 | ||||
Add Headers | 10571533 | 1579 days ago | IN | 0 ETH | 0.01631892 | ||||
Mark New Heavies... | 10571532 | 1579 days ago | IN | 0 ETH | 0.00475806 | ||||
Add Headers | 10571523 | 1579 days ago | IN | 0 ETH | 0.0178803 | ||||
Mark New Heavies... | 10571519 | 1579 days ago | IN | 0 ETH | 0.00552554 | ||||
Add Headers | 10571514 | 1579 days ago | IN | 0 ETH | 0.01876419 | ||||
Mark New Heavies... | 10571502 | 1579 days ago | IN | 0 ETH | 0.00451962 | ||||
Add Headers | 10571497 | 1579 days ago | IN | 0 ETH | 0.0142442 | ||||
Mark New Heavies... | 10571485 | 1579 days ago | IN | 0 ETH | 0.00416664 | ||||
Add Headers | 10571480 | 1579 days ago | IN | 0 ETH | 0.01631748 | ||||
Mark New Heavies... | 10571465 | 1579 days ago | IN | 0 ETH | 0.00475734 | ||||
Add Headers | 10571459 | 1579 days ago | IN | 0 ETH | 0.01787814 | ||||
Mark New Heavies... | 10571445 | 1579 days ago | IN | 0 ETH | 0.00487476 | ||||
Add Headers | 10571444 | 1579 days ago | IN | 0 ETH | 0.005678 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
OnDemandSPV
Compiler Version
v0.5.17+commit.d19bba13
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.5.10; /** @title OnDemandSPV */ /** @author Summa (https://summa.one) */ import {Relay} from "./Relay.sol"; import {ISPVRequestManager, ISPVConsumer} from "./Interfaces.sol"; import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol"; import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol"; import {ValidateSPV} from "@summa-tx/bitcoin-spv-sol/contracts/ValidateSPV.sol"; import {SafeMath} from "@summa-tx/bitcoin-spv-sol/contracts/SafeMath.sol"; contract OnDemandSPV is ISPVRequestManager, Relay { using SafeMath for uint256; using BytesLib for bytes; using BTCUtils for bytes; struct ProofRequest { bytes32 spends; bytes32 pays; uint256 notBefore; address consumer; uint64 paysValue; uint8 numConfs; address owner; RequestStates state; } enum RequestStates { NONE, ACTIVE, CLOSED } mapping (bytes32 => bool) internal validatedTxns; // authenticated tx store mapping (uint256 => ProofRequest) internal requests; // request info uint256 public constant BASE_COST = 24 * 60 * 60; // 1 day uint256 public nextID; bytes32 public latestValidatedTx; uint256 public remoteGasAllowance = 500000; // maximum gas for callback call /// @notice Gives a starting point for the relay /// @dev We don't check this AT ALL really. Don't use relays with bad genesis /// @param _genesisHeader The starting header /// @param _height The starting height /// @param _periodStart The hash of the first header in the genesis epoch constructor( bytes memory _genesisHeader, uint256 _height, bytes32 _periodStart, uint256 _firstID ) Relay( _genesisHeader, _height, _periodStart ) public { nextID = _firstID; } function () external payable {} /// @notice Cancel a bitcoin event request. /// @dev Prevents the relay from forwarding tx infromation /// @param _requestID The ID of the request to be cancelled /// @return True if succesful, error otherwise function cancelRequest(uint256 _requestID) external returns (bool) { ProofRequest storage _req = requests[_requestID]; require(_req.state == RequestStates.ACTIVE, "Request not active"); require(msg.sender == _req.consumer || msg.sender == _req.owner, "Can only be cancelled by owner or consumer"); _req.state = RequestStates.CLOSED; emit RequestClosed(_requestID); return true; } function getLatestValidatedTx() external view returns (bytes32) { return latestValidatedTx; } /// @notice Retrieve info about a request /// @dev Requests ids are numerical /// @param _requestID The numerical ID of the request /// @return A tuple representation of the request struct function getRequest( uint256 _requestID ) external view returns ( bytes32 spends, bytes32 pays, uint64 paysValue, uint8 state, address consumer, address owner, uint8 numConfs, uint256 notBefore ) { ProofRequest storage _req = requests[_requestID]; spends = _req.spends; pays = _req.pays; paysValue = _req.paysValue; state = uint8(_req.state); consumer = _req.consumer; owner = _req.owner; numConfs = _req.numConfs; notBefore = _req.notBefore; } /// @notice Subscribe to a feed of Bitcoin txns matching a request /// @dev The request can be a spent utxo and/or a created utxo /// @param _spends An outpoint that must be spent in acceptable txns (optional) /// @param _pays An output script that must be paid in acceptable txns (optional) /// @param _paysValue A minimum value that must be paid to the output script (optional) /// @param _consumer The address of a ISPVConsumer exposing spv /// @param _numConfs The minimum number of Bitcoin confirmations to accept /// @param _notBefore A timestamp before which proofs are not accepted /// @return A unique request ID. function request( bytes calldata _spends, bytes calldata _pays, uint64 _paysValue, address _consumer, uint8 _numConfs, uint256 _notBefore ) external returns (uint256) { return _request(_spends, _pays, _paysValue, _consumer, _numConfs, _notBefore); } /// @notice Subscribe to a feed of Bitcoin txns matching a request /// @dev The request can be a spent utxo and/or a created utxo /// @param _spends An outpoint that must be spent in acceptable txns (optional) /// @param _pays An output script that must be paid in acceptable txns (optional) /// @param _paysValue A minimum value that must be paid to the output script (optional) /// @param _consumer The address of a ISPVConsumer exposing spv /// @param _numConfs The minimum number of Bitcoin confirmations to accept /// @param _notBefore A timestamp before which proofs are not accepted /// @return A unique request ID function _request( bytes memory _spends, bytes memory _pays, uint64 _paysValue, address _consumer, uint8 _numConfs, uint256 _notBefore ) internal returns (uint256) { uint256 _requestID = nextID; nextID = nextID + 1; uint256 _spendsLen = _spends.length; require(_spendsLen == 36 || _spendsLen == 0, "Not a valid UTXO"); /* NB: This will fail if the output is not p2pkh, p2sh, p2wpkh, or p2wsh*/ uint256 _paysLen = _pays.length; // if it's not length-prefixed, length-prefix it if (_paysLen > 0 && uint8(_pays[0]) != _paysLen - 1) { _pays = abi.encodePacked(uint8(_paysLen), _pays); _paysLen += 1; // update the length because we made it longer } bytes memory _p = abi.encodePacked(bytes8(0), _pays); require( _paysLen == 0 || // no request OR _p.extractHash().length > 0 || // standard output OR _p.extractOpReturnData().length > 0, // OP_RETURN output "Not a standard output type"); require(_spendsLen > 0 || _paysLen > 0, "No request specified"); ProofRequest storage _req = requests[_requestID]; _req.owner = msg.sender; if (_spendsLen > 0) { _req.spends = keccak256(_spends); } if (_paysLen > 0) { _req.pays = keccak256(_pays); } if (_paysValue > 0) { _req.paysValue = _paysValue; } if (_numConfs > 0 && _numConfs < 241) { //241 is arbitray. 40 hours _req.numConfs = _numConfs; } if (_notBefore > 0) { _req.notBefore = _notBefore; } _req.consumer = _consumer; _req.state = RequestStates.ACTIVE; emit NewProofRequest(msg.sender, _requestID, _paysValue, _spends, _pays); return _requestID; } /// @notice Provide a proof of a tx that satisfies some request /// @dev The caller must specify which inputs, which outputs, and which request /// @param _header The header containing the merkleroot committing to the tx /// @param _proof The merkle proof intermediate nodes /// @param _version The tx version, always the first 4 bytes of the tx /// @param _locktime The tx locktime, always the last 4 bytes of the tx /// @param _index The index of the tx in the merkle tree's leaves /// @param _reqIndices The input and output index to check against the request, packed /// @param _vin The tx input vector /// @param _vout The tx output vector /// @param _requestID The id of the request that has been triggered /// @return True if succesful, error otherwise function provideProof( bytes calldata _header, bytes calldata _proof, bytes4 _version, bytes4 _locktime, uint256 _index, uint16 _reqIndices, bytes calldata _vin, bytes calldata _vout, uint256 _requestID ) external returns (bool) { bytes32 _txid = abi.encodePacked(_version, _vin, _vout, _locktime).hash256(); /* NB: this shortcuts validation of any txn we've seen before repeats can omit header, proof, and index */ if (!validatedTxns[_txid]) { _checkInclusion( _header, _proof, _index, _txid, _requestID); validatedTxns[_txid] = true; latestValidatedTx = _txid; } _checkRequests(_reqIndices, _vin, _vout, _requestID); _callCallback(_txid, _reqIndices, _vin, _vout, _requestID); return true; } /// @notice Notify a consumer that one of its requests has been triggered /// @dev We include information about the tx that triggered it, so the consumer can take actions /// @param _vin The tx input vector /// @param _vout The tx output vector /// @param _txid The transaction ID /// @param _requestID The id of the request that has been triggered function _callCallback( bytes32 _txid, uint16 _reqIndices, bytes memory _vin, bytes memory _vout, uint256 _requestID ) internal returns (bool) { ProofRequest storage _req = requests[_requestID]; ISPVConsumer c = ISPVConsumer(_req.consumer); uint8 _inputIndex = uint8(_reqIndices >> 8); uint8 _outputIndex = uint8(_reqIndices & 0xff); /* NB: We want to make the remote call, but we don't care about results We use the low-level call so that we can ignore reverts and set gas */ address(c).call.gas(remoteGasAllowance)( abi.encodePacked( c.spv.selector, abi.encode(_txid, _vin, _vout, _requestID, _inputIndex, _outputIndex) ) ); emit RequestFilled(_txid, _requestID); return true; } /// @notice Verifies inclusion of a tx in a header, and that header in the Relay chain /// @dev Specifically we check that both the best tip and the heaviest common header confirm it /// @param _header The header containing the merkleroot committing to the tx /// @param _proof The merkle proof intermediate nodes /// @param _index The index of the tx in the merkle tree's leaves /// @param _txid The txid that is the proof leaf /// @param _requestID The ID of the request to check against function _checkInclusion( bytes memory _header, bytes memory _proof, uint256 _index, bytes32 _txid, uint256 _requestID ) internal view returns (bool) { require( ValidateSPV.prove( _txid, _header.extractMerkleRootLE().toBytes32(), _proof, _index), "Bad inclusion proof"); bytes32 _headerHash = _header.hash256(); bytes32 _GCD = getLastReorgCommonAncestor(); require( _isAncestor( _headerHash, _GCD, 240), "GCD does not confirm header"); uint8 _numConfs = requests[_requestID].numConfs; require( _getConfs(_headerHash) >= _numConfs, "Insufficient confirmations"); return true; } /// @notice Finds the number of headers on top of the argument /// @dev Bounded to 6400 gas (8 looksups) max /// @param _headerHash The LE double-sha2 header hash /// @return The number of headers on top function _getConfs(bytes32 _headerHash) internal view returns (uint8) { return uint8(_findHeight(bestKnownDigest) - _findHeight(_headerHash)); } /// @notice Verifies that a tx meets the requester's request /// @dev Requests can be specify an input, and output, and/or an output value /// @param _reqIndices The input and output index to check against the request, packed /// @param _vin The tx input vector /// @param _vout The tx output vector /// @param _requestID The id of the request to check function _checkRequests ( uint16 _reqIndices, bytes memory _vin, bytes memory _vout, uint256 _requestID ) internal view returns (bool) { require(_vin.validateVin(), "Vin is malformatted"); require(_vout.validateVout(), "Vout is malformatted"); uint8 _inputIndex = uint8(_reqIndices >> 8); uint8 _outputIndex = uint8(_reqIndices & 0xff); ProofRequest storage _req = requests[_requestID]; require(_req.notBefore <= block.timestamp, "Request is submitted too early"); require(_req.state == RequestStates.ACTIVE, "Request is not active"); bytes32 _pays = _req.pays; bool _hasPays = _pays != bytes32(0); if (_hasPays) { bytes memory _out = _vout.extractOutputAtIndex(uint8(_outputIndex)); uint8 _len = uint8(_out.extractOutputScriptLen()[0]); require( keccak256(_out.slice(8, _len + 1)) == _pays, "Does not match pays request"); uint64 _paysValue = _req.paysValue; require( _paysValue == 0 || _out.extractValue() >= _paysValue, "Does not match value request"); } bytes32 _spends = _req.spends; bool _hasSpends = _spends != bytes32(0); if (_hasSpends) { bytes memory _in = _vin.extractInputAtIndex(uint8(_inputIndex)); require( !_hasSpends || keccak256(_in.extractOutpoint()) == _spends, "Does not match spends request"); } return true; } }
pragma solidity ^0.5.10; /// @title ISPVConsumer /// @author Summa (https://summa.one) /// @notice This interface consumes validated transaction information. /// It is the primary way that user contracts accept /// @dev Implement this interface to process transactions provided by /// the Relay system. interface ISPVConsumer { /// @notice A consumer for Bitcoin transaction information. /// @dev Users must implement this function. It handles Bitcoin /// events that have been validated by the Relay contract. /// It is VERY IMPORTANT that this function validates the /// msg.sender. The callee must check the origin of the data /// or risk accepting spurious information. /// @param _txid The LE(!) txid of the bitcoin transaction that /// triggered the notification. /// @param _vin The length-prefixed input vector of the bitcoin tx /// that triggered the notification. /// @param _vout The length-prefixed output vector of the bitcoin tx /// that triggered the notification. /// @param _requestID The ID of the event request that this notification /// satisfies. The ID is returned by /// OnDemandSPV.request and should be locally stored by /// any contract that makes more than one request. /// @param _inputIndex The index of the input in the _vin that triggered /// the notification. /// @param _outputIndex The index of the output in the _vout that triggered /// the notification. Useful for subscribing to transactions /// that spend the newly-created UTXO. function spv( bytes32 _txid, bytes calldata _vin, bytes calldata _vout, uint256 _requestID, uint8 _inputIndex, uint8 _outputIndex) external; } /// @title ISPVRequestManager /// @author Summa (https://summa.one) /// @notice The interface for using the OnDemandSPV system. This interface /// allows you to subscribe to Bitcoin events. /// @dev Manage subscriptions to Bitcoin events. Register callbacks to /// be called whenever specific Bitcoin transactions are made. interface ISPVRequestManager { event NewProofRequest ( address indexed _requester, uint256 indexed _requestID, uint64 _paysValue, bytes _spends, bytes _pays ); event RequestClosed(uint256 indexed _requestID); event RequestFilled(bytes32 indexed _txid, uint256 indexed _requestID); /// @notice Subscribe to a feed of Bitcoin transactions matching a request /// @dev The request can be a spent utxo and/or a created utxo. /// /// The contract allows users to register a "consumer" contract /// that implements ISPVConsumer to handle Bitcoin events. /// /// Bitcoin transactions are composed of a vector of inputs, /// and a vector of outputs. The `_spends` parameter allows consumers /// to watch a specific UTXO, and receive an event when it is spent. /// /// The `_pays` and `_paysValue` param allow the user to watch specific /// Bitcoin output scripts. An output script is typically encoded /// as an address, but an address is not an in-protocol construction. /// In other words, consumers will receive an event whenever a specific /// address receives funds, or when a specific OP_RETURN is created. /// /// Either `_spends` or `_pays` MUST be set. Both MAY be set. /// If both are set, only notifications meeting both criteria /// will be triggered. /// /// @param _spends An outpoint that must be spent in acceptable transactions. /// The outpoint must be exactly 36 bytes, and composed of a /// LE txid (32 bytes), and an 4-byte LE-encoded index integer. /// In other words, the precise serialization format used in a /// serialized Bitcoin TxIn. /// /// Note that while we might expect a `_spends` event to fire at most /// one time, that expectation becomes invalid in long Bitcoin reorgs /// if there is a double-spend or a disconfirmation followed by /// reconfirmation. /// /// @param _pays An output script to watch for events. A filter with `_pays` set will /// validate any number of events that create new UTXOs with a specific /// output script. /// /// This is useful for watching an address and responding to incoming /// payments. /// /// @param _paysValue A minimum value in satoshi that must be paid to the output script. /// If this is set no any non-0 number, the Relay will only forward /// `_pays` notifications to the consumer if the value of the new UTXO is /// at least `_paysValue`. /// /// @param _consumer The address of a contract that implements the `ISPVConsumer` interface. /// Whenever events are available, the Relay will validate inclusion /// and confirmation, then call the `spv` function on the consumer. /// /// @param _numConfs The number of headers that must confirm the block /// containing the transaction. Used as a security parameter. /// More confirmations means less likely to revert due to a /// chain reorganization. Note that 1 confirmation is required, /// so the general "6 confirmation" rule would be expressed /// as `5` when calling this function /// /// @param _notBefore An Ethereum timestamp before which proofs will not be accepted. /// Used to control app flow for specific users. /// /// @return A unique request ID. function request( bytes calldata _spends, bytes calldata _pays, uint64 _paysValue, address _consumer, uint8 _numConfs, uint256 _notBefore ) external returns (uint256); /// @notice Cancel an active bitcoin event request. /// @dev Prevents the relay from forwarding tx information /// @param _requestID The ID of the request to be cancelled /// @return True if succesful, error otherwise function cancelRequest(uint256 _requestID) external returns (bool); /// @notice Retrieve info about a request /// @dev Requests ids are numerical /// @param _requestID The numerical ID of the request /// @return A tuple representation of the request struct. /// To save space`spends` and `pays` are stored as keccak256 /// hashes of the original information. The `state` is /// `0` for "does not exist", `1` for "active" and `2` for /// "cancelled." function getRequest( uint256 _requestID ) external view returns ( bytes32 spends, bytes32 pays, uint64 paysValue, uint8 state, address consumer, address owner, uint8 numConfs, uint256 notBefore ); }
pragma solidity ^0.5.10; /** @title Relay */ /** @author Summa (https://summa.one) */ import {SafeMath} from "@summa-tx/bitcoin-spv-sol/contracts/SafeMath.sol"; import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol"; import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol"; import {ValidateSPV} from "@summa-tx/bitcoin-spv-sol/contracts/ValidateSPV.sol"; interface IRelay { event Extension(bytes32 indexed _first, bytes32 indexed _last); event Reorg(bytes32 indexed _from, bytes32 indexed _to, bytes32 indexed _gcd); function isMostRecentAncestor( bytes32 _ancestor, bytes32 _left, bytes32 _right, uint256 _limit ) external view returns (bool); function getCurrentEpochDifficulty() external view returns (uint256); function getPrevEpochDifficulty() external view returns (uint256); function getRelayGenesis() external view returns (bytes32); function getBestKnownDigest() external view returns (bytes32); function getLastReorgCommonAncestor() external view returns (bytes32); function findHeight(bytes32 _digest) external view returns (uint256); function findAncestor(bytes32 _digest, uint256 _offset) external view returns (bytes32); function isAncestor(bytes32 _ancestor, bytes32 _descendant, uint256 _limit) external view returns (bool); function heaviestFromAncestor( bytes32 _ancestor, bytes calldata _left, bytes calldata _right ) external view returns (bytes32); function addHeaders(bytes calldata _anchor, bytes calldata _headers) external returns (bool); function addHeadersWithRetarget( bytes calldata _oldPeriodStartHeader, bytes calldata _oldPeriodEndHeader, bytes calldata _headers ) external returns (bool); function markNewHeaviest( bytes32 _ancestor, bytes calldata _currentBest, bytes calldata _newBest, uint256 _limit ) external returns (bool); } contract Relay is IRelay { using SafeMath for uint256; using BytesLib for bytes; using BTCUtils for bytes; using ValidateSPV for bytes; // How often do we store the height? // A higher number incurs less storage cost, but more lookup cost uint32 public constant HEIGHT_INTERVAL = 4; bytes32 internal relayGenesis; bytes32 internal bestKnownDigest; bytes32 internal lastReorgCommonAncestor; mapping (bytes32 => bytes32) internal previousBlock; mapping (bytes32 => uint256) internal blockHeight; uint256 internal currentEpochDiff; uint256 internal prevEpochDiff; /// @notice Gives a starting point for the relay /// @dev We don't check this AT ALL really. Don't use relays with bad genesis /// @param _genesisHeader The starting header /// @param _height The starting height /// @param _periodStart The hash of the first header in the genesis epoch constructor(bytes memory _genesisHeader, uint256 _height, bytes32 _periodStart) public { require(_genesisHeader.length == 80, "Stop being dumb"); bytes32 _genesisDigest = _genesisHeader.hash256(); require( _periodStart & bytes32(0x0000000000000000000000000000000000000000000000000000000000ffffff) == bytes32(0), "Period start hash does not have work. Hint: wrong byte order?"); relayGenesis = _genesisDigest; bestKnownDigest = _genesisDigest; lastReorgCommonAncestor = _genesisDigest; blockHeight[_genesisDigest] = _height; blockHeight[_periodStart] = _height.sub(_height % 2016); currentEpochDiff = _genesisHeader.extractDifficulty(); } /// @notice Adds headers to storage after validating /// @dev We check integrity and consistency of the header chain /// @param _anchor The header immediately preceeding the new chain /// @param _headers A tightly-packed list of new 80-byte Bitcoin headers to record /// @param _internal True if called internally from addHeadersWithRetarget, false otherwise /// @return True if successfully written, error otherwise function _addHeaders(bytes memory _anchor, bytes memory _headers, bool _internal) internal returns (bool) { uint256 _height; bytes memory _header; bytes32 _currentDigest; bytes32 _previousDigest = _anchor.hash256(); uint256 _target = _headers.slice(0, 80).extractTarget(); uint256 _anchorHeight = _findHeight(_previousDigest); /* NB: errors if unknown */ require( _internal || _anchor.extractTarget() == _target, "Unexpected retarget on external call"); require(_headers.length % 80 == 0, "Header array length must be divisible by 80"); /* NB: 1. check that the header has sufficient work 2. check that headers are in a coherent chain (no retargets, hash links good) 3. Store the block connection 4. Store the height */ for (uint256 i = 0; i < _headers.length / 80; i = i.add(1)) { _header = _headers.slice(i.mul(80), 80); _height = _anchorHeight.add(i + 1); _currentDigest = _header.hash256(); /* NB: if the block is already authenticated, we don't need to a work check Or write anything to state. This saves gas */ if (previousBlock[_currentDigest] == bytes32(0)) { require( abi.encodePacked(_currentDigest).reverseEndianness().bytesToUint() <= _target, "Header work is insufficient"); previousBlock[_currentDigest] = _previousDigest; if (_height % HEIGHT_INTERVAL == 0) { /* NB: We store the height only every 4th header to save gas */ blockHeight[_currentDigest] = _height; } } /* NB: we do still need to make chain level checks tho */ require(_header.extractTarget() == _target, "Target changed unexpectedly"); require(_header.validateHeaderPrevHash(_previousDigest), "Headers do not form a consistent chain"); _previousDigest = _currentDigest; } emit Extension( _anchor.hash256(), _currentDigest); return true; } /// @notice Adds headers to storage after validating /// @dev We check integrity and consistency of the header chain /// @param _anchor The header immediately preceeding the new chain /// @param _headers A tightly-packed list of 80-byte Bitcoin headers /// @return True if successfully written, error otherwise function addHeaders(bytes calldata _anchor, bytes calldata _headers) external returns (bool) { return _addHeaders(_anchor, _headers, false); } /// @notice Adds headers to storage, performs additional validation of retarget /// @dev Checks the retarget, the heights, and the linkage /// @param _oldPeriodStartHeader The first header in the difficulty period being closed /// @param _oldPeriodEndHeader The last header in the difficulty period being closed /// @param _headers A tightly-packed list of 80-byte Bitcoin headers /// @return True if successfully written, error otherwise function addHeadersWithRetarget( bytes calldata _oldPeriodStartHeader, bytes calldata _oldPeriodEndHeader, bytes calldata _headers ) external returns (bool) { return _addHeadersWithRetarget(_oldPeriodStartHeader, _oldPeriodEndHeader, _headers); } /// @notice Adds headers to storage, performs additional validation of retarget /// @dev Checks the retarget, the heights, and the linkage /// @param _oldPeriodStartHeader The first header in the difficulty period being closed /// @param _oldPeriodEndHeader The last header in the difficulty period being closed /// @param _headers A tightly-packed list of 80-byte Bitcoin headers /// @return True if successfully written, error otherwise function _addHeadersWithRetarget( bytes memory _oldPeriodStartHeader, bytes memory _oldPeriodEndHeader, bytes memory _headers ) internal returns (bool) { /* NB: requires that both blocks are known */ uint256 _startHeight = _findHeight(_oldPeriodStartHeader.hash256()); uint256 _endHeight = _findHeight(_oldPeriodEndHeader.hash256()); /* NB: retargets should happen at 2016 block intervals */ require( _endHeight % 2016 == 2015, "Must provide the last header of the closing difficulty period"); require( _endHeight == _startHeight.add(2015), "Must provide exactly 1 difficulty period"); require( _oldPeriodStartHeader.extractDifficulty() == _oldPeriodEndHeader.extractDifficulty(), "Period header difficulties do not match"); /* NB: This comparison looks weird because header nBits encoding truncates targets */ bytes memory _newPeriodStart = _headers.slice(0, 80); uint256 _actualTarget = _newPeriodStart.extractTarget(); uint256 _expectedTarget = BTCUtils.retargetAlgorithm( _oldPeriodStartHeader.extractTarget(), _oldPeriodStartHeader.extractTimestamp(), _oldPeriodEndHeader.extractTimestamp() ); require( (_actualTarget & _expectedTarget) == _actualTarget, "Invalid retarget provided"); // If the current known prevEpochDiff doesn't match, and this old period is near the chaintip/ // update the stored prevEpochDiff // Don't update if this is a deep past epoch uint256 _oldDiff = _oldPeriodStartHeader.extractDifficulty(); if (prevEpochDiff != _oldDiff && _endHeight > _findHeight(bestKnownDigest).sub(2016)) { prevEpochDiff = _oldDiff; } // Pass all but the first through to be added return _addHeaders(_oldPeriodEndHeader, _headers, true); } /// @notice Finds the height of a header by its digest /// @dev Will fail if the header is unknown /// @param _digest The header digest to search for /// @return The height of the header function _findHeight(bytes32 _digest) internal view returns (uint256) { uint256 _height = 0; bytes32 _current = _digest; for (uint256 i = 0; i < HEIGHT_INTERVAL + 1; i = i.add(1)) { _height = blockHeight[_current]; if (_height == 0) { _current = previousBlock[_current]; } else { return _height.add(i); } } revert("Unknown block"); } /// @notice Finds the height of a header by its digest /// @dev Will fail if the header is unknown /// @param _digest The header digest to search for /// @return The height of the header, or error if unknown function findHeight(bytes32 _digest) external view returns (uint256) { return _findHeight(_digest); } /// @notice Finds an ancestor for a block by its digest /// @dev Will fail if the header is unknown /// @param _digest The header digest to search for /// @return The height of the header, or error if unknown function _findAncestor(bytes32 _digest, uint256 _offset) internal view returns (bytes32) { bytes32 _current = _digest; for (uint256 i = 0; i < _offset; i = i.add(1)) { _current = previousBlock[_current]; } require(_current != bytes32(0), "Unknown ancestor"); return _current; } /// @notice Finds an ancestor for a block by its digest /// @dev Will fail if the header is unknown /// @param _digest The header digest to search for /// @return The height of the header, or error if unknown function findAncestor(bytes32 _digest, uint256 _offset) external view returns (bytes32) { return _findAncestor(_digest, _offset); } /// @notice Checks if a digest is an ancestor of the current one /// @dev Limit the amount of lookups (and thus gas usage) with _limit /// @param _ancestor The prospective ancestor /// @param _descendant The descendant to check /// @param _limit The maximum number of blocks to check /// @return true if ancestor is at most limit blocks lower than descendant, otherwise false function _isAncestor(bytes32 _ancestor, bytes32 _descendant, uint256 _limit) internal view returns (bool) { bytes32 _current = _descendant; /* NB: 200 gas/read, so gas is capped at ~200 * limit */ for (uint256 i = 0; i < _limit; i = i.add(1)) { if (_current == _ancestor) { return true; } _current = previousBlock[_current]; } return false; } /// @notice Checks if a digest is an ancestor of the current one /// @dev Limit the amount of lookups (and thus gas usage) with _limit /// @param _ancestor The prospective ancestor /// @param _descendant The descendant to check /// @param _limit The maximum number of blocks to check /// @return true if ancestor is at most limit blocks lower than descendant, otherwise false function isAncestor(bytes32 _ancestor, bytes32 _descendant, uint256 _limit) external view returns (bool) { return _isAncestor(_ancestor, _descendant, _limit); } /// @notice Gives a starting point for the relay /// @dev We don't check this AT ALL really. Don't use relays with bad genesis /// @param _ancestor The digest of the most recent common ancestor /// @param _currentBest The 80-byte header referenced by bestKnownDigest /// @param _newBest The 80-byte header to mark as the new best /// @param _limit Limit the amount of traversal of the chain /// @return True if successfully updates bestKnownDigest, error otherwise function _markNewHeaviest( bytes32 _ancestor, bytes memory _currentBest, bytes memory _newBest, uint256 _limit ) internal returns (bool) { bytes32 _newBestDigest = _newBest.hash256(); bytes32 _currentBestDigest = _currentBest.hash256(); require(_currentBestDigest == bestKnownDigest, "Passed in best is not best known"); require( previousBlock[_newBestDigest] != bytes32(0), "New best is unknown"); require( _isMostRecentAncestor(_ancestor, bestKnownDigest, _newBestDigest, _limit), "Ancestor must be heaviest common ancestor"); require( _heaviestFromAncestor(_ancestor, _currentBest, _newBest) == _newBestDigest, "New best hash does not have more work than previous"); bestKnownDigest = _newBestDigest; lastReorgCommonAncestor = _ancestor; uint256 _newDiff = _newBest.extractDifficulty(); if (_newDiff != currentEpochDiff) { currentEpochDiff = _newDiff; } emit Reorg( _currentBestDigest, _newBestDigest, _ancestor); return true; } /// @notice Gives a starting point for the relay /// @dev We don't check this AT ALL really. Don't use relays with bad genesis /// @param _ancestor The digest of the most recent common ancestor /// @param _currentBest The 80-byte header referenced by bestKnownDigest /// @param _newBest The 80-byte header to mark as the new best /// @param _limit Limit the amount of traversal of the chain /// @return True if successfully updates bestKnownDigest, error otherwise function markNewHeaviest( bytes32 _ancestor, bytes calldata _currentBest, bytes calldata _newBest, uint256 _limit ) external returns (bool) { return _markNewHeaviest(_ancestor, _currentBest, _newBest, _limit); } /// @notice Checks if a digest is an ancestor of the current one /// @dev Limit the amount of lookups (and thus gas usage) with _limit /// @param _ancestor The prospective shared ancestor /// @param _left A chain tip /// @param _right A chain tip /// @param _limit The maximum number of blocks to check /// @return true if it is the most recent common ancestor within _limit, false otherwise function _isMostRecentAncestor( bytes32 _ancestor, bytes32 _left, bytes32 _right, uint256 _limit ) internal view returns (bool) { /* NB: sure why not */ if (_ancestor == _left && _ancestor == _right) { return true; } bytes32 _leftCurrent = _left; bytes32 _rightCurrent = _right; bytes32 _leftPrev = _left; bytes32 _rightPrev = _right; for(uint256 i = 0; i < _limit; i = i.add(1)) { if (_leftPrev != _ancestor) { _leftCurrent = _leftPrev; // cheap _leftPrev = previousBlock[_leftPrev]; // expensive } if (_rightPrev != _ancestor) { _rightCurrent = _rightPrev; // cheap _rightPrev = previousBlock[_rightPrev]; // expensive } } if (_leftCurrent == _rightCurrent) {return false;} /* NB: If the same, they're a nearer ancestor */ if (_leftPrev != _rightPrev) {return false;} /* NB: Both must be ancestor */ return true; } /// @notice Checks if a digest is an ancestor of the current one /// @dev Limit the amount of lookups (and thus gas usage) with _limit /// @param _ancestor The prospective shared ancestor /// @param _left A chain tip /// @param _right A chain tip /// @param _limit The maximum number of blocks to check /// @return true if it is the most recent common ancestor within _limit, false otherwise function isMostRecentAncestor( bytes32 _ancestor, bytes32 _left, bytes32 _right, uint256 _limit ) external view returns (bool) { return _isMostRecentAncestor(_ancestor, _left, _right, _limit); } /// @notice Decides which header is heaviest from the ancestor /// @dev Does not support reorgs above 2017 blocks (: /// @param _ancestor The prospective shared ancestor /// @param _left A chain tip /// @param _right A chain tip /// @return true if it is the most recent common ancestor within _limit, false otherwise function _heaviestFromAncestor( bytes32 _ancestor, bytes memory _left, bytes memory _right ) internal view returns (bytes32) { uint256 _ancestorHeight = _findHeight(_ancestor); uint256 _leftHeight = _findHeight(_left.hash256()); uint256 _rightHeight = _findHeight(_right.hash256()); require( _leftHeight >= _ancestorHeight && _rightHeight >= _ancestorHeight, "A descendant height is below the ancestor height"); /* NB: we can shortcut if one block is in a new difficulty window and the other isn't */ uint256 _nextPeriodStartHeight = _ancestorHeight.add(2016).sub(_ancestorHeight % 2016); bool _leftInPeriod = _leftHeight < _nextPeriodStartHeight; bool _rightInPeriod = _rightHeight < _nextPeriodStartHeight; /* NB: 1. Left is in a new window, right is in the old window. Left is heavier 2. Right is in a new window, left is in the old window. Right is heavier 3. Both are in the same window, choose the higher one 4. They're in different new windows. Choose the heavier one */ if (!_leftInPeriod && _rightInPeriod) {return _left.hash256();} if (_leftInPeriod && !_rightInPeriod) {return _right.hash256();} if (_leftInPeriod && _rightInPeriod) { return _leftHeight >= _rightHeight ? _left.hash256() : _right.hash256(); } else { // if (!_leftInPeriod && !_rightInPeriod) { if (((_leftHeight % 2016).mul(_left.extractDifficulty())) < (_rightHeight % 2016).mul(_right.extractDifficulty())) { return _right.hash256(); } else { return _left.hash256(); } } } /// @notice Decides which header is heaviest from the ancestor /// @dev Does not support reorgs above 2017 blocks (: /// @param _ancestor The prospective shared ancestor /// @param _left A chain tip /// @param _right A chain tip /// @return true if it is the most recent common ancestor within _limit, false otherwise function heaviestFromAncestor( bytes32 _ancestor, bytes calldata _left, bytes calldata _right ) external view returns (bytes32) { return _heaviestFromAncestor(_ancestor, _left, _right); } /// @notice Getter for currentEpochDiff /// @dev This is updated when a new heavist header has a new diff /// @return The difficulty of the bestKnownDigest function getCurrentEpochDifficulty() external view returns (uint256) { return currentEpochDiff; } /// @notice Getter for prevEpochDiff /// @dev This is updated when a difficulty change is accepted /// @return The difficulty of the previous epoch function getPrevEpochDifficulty() external view returns (uint256) { return prevEpochDiff; } /// @notice Getter for relayGenesis /// @dev This is an initialization parameter /// @return The hash of the first block of the relay function getRelayGenesis() public view returns (bytes32) { return relayGenesis; } /// @notice Getter for bestKnownDigest /// @dev This updated only by calling markNewHeaviest /// @return The hash of the best marked chain tip function getBestKnownDigest() public view returns (bytes32) { return bestKnownDigest; } /// @notice Getter for relayGenesis /// @dev This is updated only by calling markNewHeaviest /// @return The hash of the shared ancestor of the most recent fork function getLastReorgCommonAncestor() public view returns (bytes32) { return lastReorgCommonAncestor; } }
pragma solidity ^0.5.10; /* The MIT License (MIT) Copyright (c) 2016 Smart Contract Solutions, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; require(c / _a == _b, "Overflow during multiplication."); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b <= _a, "Underflow during subtraction."); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; require(c >= _a, "Overflow during addition."); return c; } }
pragma solidity ^0.5.10; /* https://github.com/GNSPS/solidity-bytes-utils/ This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <https://unlicense.org> */ /** @title BytesLib **/ /** @author https://github.com/GNSPS **/ library BytesLib { function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes_slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes_slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes_slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes_slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes_slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes_slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice(bytes memory _bytes, uint _start, uint _length) internal pure returns (bytes memory res) { require(_bytes.length >= (_start + _length), "Slice out of bounds"); assembly { // Alloc bytes array with additional 32 bytes afterspace and assign it's size res := mload(0x40) mstore(0x40, add(add(res, 64), _length)) mstore(res, _length) // Compute distance between source and destination pointers let diff := sub(res, add(_bytes, _start)) for { let src := add(add(_bytes, 32), _start) let end := add(src, _length) } lt(src, end) { src := add(src, 32) } { mstore(add(src, diff), mload(src)) } } } function toAddress(bytes memory _bytes, uint _start) internal pure returns (address) { require(_bytes.length >= (_start + 20), "Address conversion out of bounds."); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint(bytes memory _bytes, uint _start) internal pure returns (uint256) { require(_bytes.length >= (_start + 32), "Uint conversion out of bounds."); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes_slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes_slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } function toBytes32(bytes memory _source) pure internal returns (bytes32 result) { bytes memory tempEmptyStringTest = bytes(_source); if (tempEmptyStringTest.length == 0) { return 0x0; } assembly { result := mload(add(_source, 32)) } } function keccak256Slice(bytes memory _bytes, uint _start, uint _length) pure internal returns (bytes32 result) { require(_bytes.length >= (_start + _length), "Slice out of bounds"); assembly { result := keccak256(add(add(_bytes, 32), _start), _length) } } }
pragma solidity ^0.5.10; /** @title BitcoinSPV */ /** @author Summa (https://summa.one) */ import {BytesLib} from "./BytesLib.sol"; import {SafeMath} from "./SafeMath.sol"; library BTCUtils { using BytesLib for bytes; using SafeMath for uint256; // The target at minimum Difficulty. Also the target of the genesis block uint256 public constant DIFF1_TARGET = 0xffff0000000000000000000000000000000000000000000000000000; uint256 public constant RETARGET_PERIOD = 2 * 7 * 24 * 60 * 60; // 2 weeks in seconds uint256 public constant RETARGET_PERIOD_BLOCKS = 2016; // 2 weeks in blocks /* ***** */ /* UTILS */ /* ***** */ /// @notice Determines the length of a VarInt in bytes /// @dev A VarInt of >1 byte is prefixed with a flag indicating its length /// @param _flag The first byte of a VarInt /// @return The number of non-flag bytes in the VarInt function determineVarIntDataLength(bytes memory _flag) internal pure returns (uint8) { if (uint8(_flag[0]) == 0xff) { return 8; // one-byte flag, 8 bytes data } if (uint8(_flag[0]) == 0xfe) { return 4; // one-byte flag, 4 bytes data } if (uint8(_flag[0]) == 0xfd) { return 2; // one-byte flag, 2 bytes data } return 0; // flag is data } /// @notice Changes the endianness of a byte array /// @dev Returns a new, backwards, bytes /// @param _b The bytes to reverse /// @return The reversed bytes function reverseEndianness(bytes memory _b) internal pure returns (bytes memory) { bytes memory _newValue = new bytes(_b.length); for (uint i = 0; i < _b.length; i++) { _newValue[_b.length - i - 1] = _b[i]; } return _newValue; } /// @notice Changes the endianness of a uint256 /// @dev https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel /// @param _b The unsigned integer to reverse /// @return The reversed value function reverseUint256(uint256 _b) internal pure returns (uint256 v) { v = _b; // swap bytes v = ((v >> 8) & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) | ((v & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) << 8); // swap 2-byte long pairs v = ((v >> 16) & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) | ((v & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) << 16); // swap 4-byte long pairs v = ((v >> 32) & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) | ((v & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) << 32); // swap 8-byte long pairs v = ((v >> 64) & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) | ((v & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) << 64); // swap 16-byte long pairs v = (v >> 128) | (v << 128); } /// @notice Converts big-endian bytes to a uint /// @dev Traverses the byte array and sums the bytes /// @param _b The big-endian bytes-encoded integer /// @return The integer representation function bytesToUint(bytes memory _b) internal pure returns (uint256) { uint256 _number; for (uint i = 0; i < _b.length; i++) { _number = _number + uint8(_b[i]) * (2 ** (8 * (_b.length - (i + 1)))); } return _number; } /// @notice Get the last _num bytes from a byte array /// @param _b The byte array to slice /// @param _num The number of bytes to extract from the end /// @return The last _num bytes of _b function lastBytes(bytes memory _b, uint256 _num) internal pure returns (bytes memory) { uint256 _start = _b.length.sub(_num); return _b.slice(_start, _num); } /// @notice Implements bitcoin's hash160 (rmd160(sha2())) /// @dev abi.encodePacked changes the return to bytes instead of bytes32 /// @param _b The pre-image /// @return The digest function hash160(bytes memory _b) internal pure returns (bytes memory) { return abi.encodePacked(ripemd160(abi.encodePacked(sha256(_b)))); } /// @notice Implements bitcoin's hash256 (double sha2) /// @dev abi.encodePacked changes the return to bytes instead of bytes32 /// @param _b The pre-image /// @return The digest function hash256(bytes memory _b) internal pure returns (bytes32) { return abi.encodePacked(sha256(abi.encodePacked(sha256(_b)))).toBytes32(); } /// @notice Implements bitcoin's hash256 (double sha2) /// @dev sha2 is precompiled smart contract located at address(2) /// @param _b The pre-image /// @return The digest function hash256View(bytes memory _b) internal view returns (bytes32 res) { assembly { let ptr := mload(0x40) pop(staticcall(gas, 2, add(_b, 32), mload(_b), ptr, 32)) pop(staticcall(gas, 2, ptr, 32, ptr, 32)) res := mload(ptr) } } /* ************ */ /* Legacy Input */ /* ************ */ /// @notice Extracts the nth input from the vin (0-indexed) /// @dev Iterates over the vin. If you need to extract several, write a custom function /// @param _vin The vin as a tightly-packed byte array /// @param _index The 0-indexed location of the input to extract /// @return The input as a byte array function extractInputAtIndex(bytes memory _vin, uint8 _index) internal pure returns (bytes memory) { uint256 _len; bytes memory _remaining; uint256 _offset = 1; for (uint8 _i = 0; _i < _index; _i ++) { _remaining = _vin.slice(_offset, _vin.length - _offset); _len = determineInputLength(_remaining); _offset = _offset + _len; } _remaining = _vin.slice(_offset, _vin.length - _offset); _len = determineInputLength(_remaining); return _vin.slice(_offset, _len); } /// @notice Determines whether an input is legacy /// @dev False if no scriptSig, otherwise True /// @param _input The input /// @return True for legacy, False for witness function isLegacyInput(bytes memory _input) internal pure returns (bool) { return _input.keccak256Slice(36, 1) != keccak256(hex"00"); } /// @notice Determines the length of an input from its scriptsig /// @dev 36 for outpoint, 1 for scriptsig length, 4 for sequence /// @param _input The input /// @return The length of the input in bytes function determineInputLength(bytes memory _input) internal pure returns (uint256) { uint8 _varIntDataLen; uint256 _scriptSigLen; (_varIntDataLen, _scriptSigLen) = extractScriptSigLen(_input); return 36 + 1 + _varIntDataLen + _scriptSigLen + 4; } /// @notice Extracts the LE sequence bytes from an input /// @dev Sequence is used for relative time locks /// @param _input The LEGACY input /// @return The sequence bytes (LE uint) function extractSequenceLELegacy(bytes memory _input) internal pure returns (bytes memory) { uint8 _varIntDataLen; uint256 _scriptSigLen; (_varIntDataLen, _scriptSigLen) = extractScriptSigLen(_input); return _input.slice(36 + 1 + _varIntDataLen + _scriptSigLen, 4); } /// @notice Extracts the sequence from the input /// @dev Sequence is a 4-byte little-endian number /// @param _input The LEGACY input /// @return The sequence number (big-endian uint) function extractSequenceLegacy(bytes memory _input) internal pure returns (uint32) { bytes memory _leSeqence = extractSequenceLELegacy(_input); bytes memory _beSequence = reverseEndianness(_leSeqence); return uint32(bytesToUint(_beSequence)); } /// @notice Extracts the VarInt-prepended scriptSig from the input in a tx /// @dev Will return hex"00" if passed a witness input /// @param _input The LEGACY input /// @return The length-prepended script sig function extractScriptSig(bytes memory _input) internal pure returns (bytes memory) { uint8 _varIntDataLen; uint256 _scriptSigLen; (_varIntDataLen, _scriptSigLen) = extractScriptSigLen(_input); return _input.slice(36, 1 + _varIntDataLen + _scriptSigLen); } /// @notice Determines the length of a scriptSig in an input /// @dev Will return 0 if passed a witness input /// @param _input The LEGACY input /// @return The length of the script sig function extractScriptSigLen(bytes memory _input) internal pure returns (uint8, uint256) { bytes memory _varIntTag = _input.slice(36, 1); uint8 _varIntDataLen = determineVarIntDataLength(_varIntTag); uint256 _len; if (_varIntDataLen == 0) { _len = uint8(_varIntTag[0]); } else { _len = bytesToUint(reverseEndianness(_input.slice(36 + 1, _varIntDataLen))); } return (_varIntDataLen, _len); } /* ************* */ /* Witness Input */ /* ************* */ /// @notice Extracts the LE sequence bytes from an input /// @dev Sequence is used for relative time locks /// @param _input The WITNESS input /// @return The sequence bytes (LE uint) function extractSequenceLEWitness(bytes memory _input) internal pure returns (bytes memory) { return _input.slice(37, 4); } /// @notice Extracts the sequence from the input in a tx /// @dev Sequence is a 4-byte little-endian number /// @param _input The WITNESS input /// @return The sequence number (big-endian uint) function extractSequenceWitness(bytes memory _input) internal pure returns (uint32) { bytes memory _leSeqence = extractSequenceLEWitness(_input); bytes memory _inputeSequence = reverseEndianness(_leSeqence); return uint32(bytesToUint(_inputeSequence)); } /// @notice Extracts the outpoint from the input in a tx /// @dev 32 byte tx id with 4 byte index /// @param _input The input /// @return The outpoint (LE bytes of prev tx hash + LE bytes of prev tx index) function extractOutpoint(bytes memory _input) internal pure returns (bytes memory) { return _input.slice(0, 36); } /// @notice Extracts the outpoint tx id from an input /// @dev 32 byte tx id /// @param _input The input /// @return The tx id (little-endian bytes) function extractInputTxIdLE(bytes memory _input) internal pure returns (bytes32) { return _input.slice(0, 32).toBytes32(); } /// @notice Extracts the outpoint index from an input /// @dev 32 byte tx id /// @param _input The input /// @return The tx id (big-endian bytes) function extractInputTxId(bytes memory _input) internal pure returns (bytes32) { bytes memory _leId = abi.encodePacked(extractInputTxIdLE(_input)); bytes memory _beId = reverseEndianness(_leId); return _beId.toBytes32(); } /// @notice Extracts the LE tx input index from the input in a tx /// @dev 4 byte tx index /// @param _input The input /// @return The tx index (little-endian bytes) function extractTxIndexLE(bytes memory _input) internal pure returns (bytes memory) { return _input.slice(32, 4); } /// @notice Extracts the tx input index from the input in a tx /// @dev 4 byte tx index /// @param _input The input /// @return The tx index (big-endian uint) function extractTxIndex(bytes memory _input) internal pure returns (uint32) { bytes memory _leIndex = extractTxIndexLE(_input); bytes memory _beIndex = reverseEndianness(_leIndex); return uint32(bytesToUint(_beIndex)); } /* ****** */ /* Output */ /* ****** */ /// @notice Determines the length of an output /// @dev 5 types: WPKH, WSH, PKH, SH, and OP_RETURN /// @param _output The output /// @return The length indicated by the prefix, error if invalid length function determineOutputLength(bytes memory _output) internal pure returns (uint256) { uint8 _len = uint8(_output.slice(8, 1)[0]); require(_len < 0xfd, "Multi-byte VarInts not supported"); return _len + 8 + 1; // 8 byte value, 1 byte for _len itself } /// @notice Extracts the output at a given index in the TxIns vector /// @dev Iterates over the vout. If you need to extract multiple, write a custom function /// @param _vout The _vout to extract from /// @param _index The 0-indexed location of the output to extract /// @return The specified output function extractOutputAtIndex(bytes memory _vout, uint8 _index) internal pure returns (bytes memory) { uint256 _len; bytes memory _remaining; uint256 _offset = 1; for (uint8 _i = 0; _i < _index; _i ++) { _remaining = _vout.slice(_offset, _vout.length - _offset); _len = determineOutputLength(_remaining); _offset = _offset + _len; } _remaining = _vout.slice(_offset, _vout.length - _offset); _len = determineOutputLength(_remaining); return _vout.slice(_offset, _len); } /// @notice Extracts the output script length /// @dev Indexes the length prefix on the pk_script /// @param _output The output /// @return The 1 byte length prefix function extractOutputScriptLen(bytes memory _output) internal pure returns (bytes memory) { return _output.slice(8, 1); } /// @notice Extracts the value bytes from the output in a tx /// @dev Value is an 8-byte little-endian number /// @param _output The output /// @return The output value as LE bytes function extractValueLE(bytes memory _output) internal pure returns (bytes memory) { return _output.slice(0, 8); } /// @notice Extracts the value from the output in a tx /// @dev Value is an 8-byte little-endian number /// @param _output The output /// @return The output value function extractValue(bytes memory _output) internal pure returns (uint64) { bytes memory _leValue = extractValueLE(_output); bytes memory _beValue = reverseEndianness(_leValue); return uint64(bytesToUint(_beValue)); } /// @notice Extracts the data from an op return output /// @dev Returns hex"" if no data or not an op return /// @param _output The output /// @return Any data contained in the opreturn output, null if not an op return function extractOpReturnData(bytes memory _output) internal pure returns (bytes memory) { if (_output.keccak256Slice(9, 1) != keccak256(hex"6a")) { return hex""; } bytes memory _dataLen = _output.slice(10, 1); return _output.slice(11, bytesToUint(_dataLen)); } /// @notice Extracts the hash from the output script /// @dev Determines type by the length prefix and validates format /// @param _output The output /// @return The hash committed to by the pk_script, or null for errors function extractHash(bytes memory _output) internal pure returns (bytes memory) { if (uint8(_output.slice(9, 1)[0]) == 0) { uint256 _len = uint8(extractOutputScriptLen(_output)[0]) - 2; // Check for maliciously formatted witness outputs if (uint8(_output.slice(10, 1)[0]) != uint8(_len)) { return hex""; } return _output.slice(11, _len); } else { bytes32 _tag = _output.keccak256Slice(8, 3); // p2pkh if (_tag == keccak256(hex"1976a9")) { // Check for maliciously formatted p2pkh if (uint8(_output.slice(11, 1)[0]) != 0x14 || _output.keccak256Slice(_output.length - 2, 2) != keccak256(hex"88ac")) { return hex""; } return _output.slice(12, 20); //p2sh } else if (_tag == keccak256(hex"17a914")) { // Check for maliciously formatted p2sh if (uint8(_output.slice(_output.length - 1, 1)[0]) != 0x87) { return hex""; } return _output.slice(11, 20); } } return hex""; /* NB: will trigger on OPRETURN and non-standard that don't overrun */ } /* ********** */ /* Witness TX */ /* ********** */ /// @notice Checks that the vin passed up is properly formatted /// @dev Consider a vin with a valid vout in its scriptsig /// @param _vin Raw bytes length-prefixed input vector /// @return True if it represents a validly formatted vin function validateVin(bytes memory _vin) internal pure returns (bool) { uint256 _offset = 1; uint8 _nIns = uint8(_vin.slice(0, 1)[0]); // Not valid if it says there are too many or no inputs if (_nIns >= 0xfd || _nIns == 0) { return false; } for (uint8 i = 0; i < _nIns; i++) { // Grab the next input and determine its length. // Increase the offset by that much _offset += determineInputLength(_vin.slice(_offset, _vin.length - _offset)); // Returns false we jump past the end if (_offset > _vin.length) { return false; } } // Returns false if we're not exactly at the end return _offset == _vin.length; } /// @notice Checks that the vin passed up is properly formatted /// @dev Consider a vin with a valid vout in its scriptsig /// @param _vout Raw bytes length-prefixed output vector /// @return True if it represents a validly formatted bout function validateVout(bytes memory _vout) internal pure returns (bool) { uint256 _offset = 1; uint8 _nOuts = uint8(_vout.slice(0, 1)[0]); // Not valid if it says there are too many or no inputs if (_nOuts >= 0xfd || _nOuts == 0) { return false; } for (uint8 i = 0; i < _nOuts; i++) { // Grab the next input and determine its length. // Increase the offset by that much _offset += determineOutputLength(_vout.slice(_offset, _vout.length - _offset)); // Returns false we jump past the end if (_offset > _vout.length) { return false; } } // Returns false if we're not exactly at the end return _offset == _vout.length; } /* ************ */ /* Block Header */ /* ************ */ /// @notice Extracts the transaction merkle root from a block header /// @dev Use verifyHash256Merkle to verify proofs with this root /// @param _header The header /// @return The merkle root (little-endian) function extractMerkleRootLE(bytes memory _header) internal pure returns (bytes memory) { return _header.slice(36, 32); } /// @notice Extracts the transaction merkle root from a block header /// @dev Use verifyHash256Merkle to verify proofs with this root /// @param _header The header /// @return The merkle root (big-endian) function extractMerkleRootBE(bytes memory _header) internal pure returns (bytes memory) { return reverseEndianness(extractMerkleRootLE(_header)); } /// @notice Extracts the target from a block header /// @dev Target is a 256 bit number encoded as a 3-byte mantissa and 1 byte exponent /// @param _header The header /// @return The target threshold function extractTarget(bytes memory _header) internal pure returns (uint256) { bytes memory _m = _header.slice(72, 3); uint8 _e = uint8(_header[75]); uint256 _mantissa = bytesToUint(reverseEndianness(_m)); uint _exponent = _e - 3; return _mantissa * (256 ** _exponent); } /// @notice Calculate difficulty from the difficulty 1 target and current target /// @dev Difficulty 1 is 0x1d00ffff on mainnet and testnet /// @dev Difficulty 1 is a 256 bit number encoded as a 3-byte mantissa and 1 byte exponent /// @param _target The current target /// @return The block difficulty (bdiff) function calculateDifficulty(uint256 _target) internal pure returns (uint256) { // Difficulty 1 calculated from 0x1d00ffff return DIFF1_TARGET.div(_target); } /// @notice Extracts the previous block's hash from a block header /// @dev Block headers do NOT include block number :( /// @param _header The header /// @return The previous block's hash (little-endian) function extractPrevBlockLE(bytes memory _header) internal pure returns (bytes memory) { return _header.slice(4, 32); } /// @notice Extracts the previous block's hash from a block header /// @dev Block headers do NOT include block number :( /// @param _header The header /// @return The previous block's hash (big-endian) function extractPrevBlockBE(bytes memory _header) internal pure returns (bytes memory) { return reverseEndianness(extractPrevBlockLE(_header)); } /// @notice Extracts the timestamp from a block header /// @dev Time is not 100% reliable /// @param _header The header /// @return The timestamp (little-endian bytes) function extractTimestampLE(bytes memory _header) internal pure returns (bytes memory) { return _header.slice(68, 4); } /// @notice Extracts the timestamp from a block header /// @dev Time is not 100% reliable /// @param _header The header /// @return The timestamp (uint) function extractTimestamp(bytes memory _header) internal pure returns (uint32) { return uint32(bytesToUint(reverseEndianness(extractTimestampLE(_header)))); } /// @notice Extracts the expected difficulty from a block header /// @dev Does NOT verify the work /// @param _header The header /// @return The difficulty as an integer function extractDifficulty(bytes memory _header) internal pure returns (uint256) { return calculateDifficulty(extractTarget(_header)); } /// @notice Concatenates and hashes two inputs for merkle proving /// @param _a The first hash /// @param _b The second hash /// @return The double-sha256 of the concatenated hashes function _hash256MerkleStep(bytes memory _a, bytes memory _b) internal pure returns (bytes32) { return hash256(abi.encodePacked(_a, _b)); } /// @notice Verifies a Bitcoin-style merkle tree /// @dev Leaves are 0-indexed. /// @param _proof The proof. Tightly packed LE sha256 hashes. The last hash is the root /// @param _index The index of the leaf /// @return true if the proof is valid, else false function verifyHash256Merkle(bytes memory _proof, uint _index) internal pure returns (bool) { // Not an even number of hashes if (_proof.length % 32 != 0) { return false; } // Special case for coinbase-only blocks if (_proof.length == 32) { return true; } // Should never occur if (_proof.length == 64) { return false; } uint _idx = _index; bytes32 _root = _proof.slice(_proof.length - 32, 32).toBytes32(); bytes32 _current = _proof.slice(0, 32).toBytes32(); for (uint i = 1; i < (_proof.length.div(32)) - 1; i++) { if (_idx % 2 == 1) { _current = _hash256MerkleStep(_proof.slice(i * 32, 32), abi.encodePacked(_current)); } else { _current = _hash256MerkleStep(abi.encodePacked(_current), _proof.slice(i * 32, 32)); } _idx = _idx >> 1; } return _current == _root; } /* NB: https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/pow.cpp#L49-L72 NB: We get a full-bitlength target from this. For comparison with header-encoded targets we need to mask it with the header target e.g. (full & truncated) == truncated */ /// @notice performs the bitcoin difficulty retarget /// @dev implements the Bitcoin algorithm precisely /// @param _previousTarget the target of the previous period /// @param _firstTimestamp the timestamp of the first block in the difficulty period /// @param _secondTimestamp the timestamp of the last block in the difficulty period /// @return the new period's target threshold function retargetAlgorithm( uint256 _previousTarget, uint256 _firstTimestamp, uint256 _secondTimestamp ) internal pure returns (uint256) { uint256 _elapsedTime = _secondTimestamp.sub(_firstTimestamp); // Normalize ratio to factor of 4 if very long or very short if (_elapsedTime < RETARGET_PERIOD.div(4)) { _elapsedTime = RETARGET_PERIOD.div(4); } if (_elapsedTime > RETARGET_PERIOD.mul(4)) { _elapsedTime = RETARGET_PERIOD.mul(4); } /* NB: high targets e.g. ffff0020 can cause overflows here so we divide it by 256**2, then multiply by 256**2 later we know the target is evenly divisible by 256**2, so this isn't an issue */ uint256 _adjusted = _previousTarget.div(65536).mul(_elapsedTime); return _adjusted.div(RETARGET_PERIOD).mul(65536); } }
pragma solidity ^0.5.10; /** @title ValidateSPV*/ /** @author Summa (https://summa.one) */ import {BytesLib} from "./BytesLib.sol"; import {SafeMath} from "./SafeMath.sol"; import {BTCUtils} from "./BTCUtils.sol"; library ValidateSPV { using BTCUtils for bytes; using BTCUtils for uint256; using BytesLib for bytes; using SafeMath for uint256; enum InputTypes { NONE, LEGACY, COMPATIBILITY, WITNESS } enum OutputTypes { NONE, WPKH, WSH, OP_RETURN, PKH, SH, NONSTANDARD } uint256 constant ERR_BAD_LENGTH = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; uint256 constant ERR_INVALID_CHAIN = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe; uint256 constant ERR_LOW_WORK = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd; function getErrBadLength() internal pure returns (uint256) { return ERR_BAD_LENGTH; } function getErrInvalidChain() internal pure returns (uint256) { return ERR_INVALID_CHAIN; } function getErrLowWork() internal pure returns (uint256) { return ERR_LOW_WORK; } /// @notice Validates a tx inclusion in the block /// @param _txid The txid (LE) /// @param _merkleRoot The merkle root (as in the block header) /// @param _intermediateNodes The proof's intermediate nodes (digests between leaf and root) /// @param _index The leaf's index in the tree (0-indexed) /// @return true if fully valid, false otherwise function prove( bytes32 _txid, bytes32 _merkleRoot, bytes memory _intermediateNodes, uint _index ) internal pure returns (bool) { // Shortcut the empty-block case if (_txid == _merkleRoot && _index == 0 && _intermediateNodes.length == 0) { return true; } bytes memory _proof = abi.encodePacked(_txid, _intermediateNodes, _merkleRoot); // If the Merkle proof failed, bubble up error return _proof.verifyHash256Merkle(_index); } /// @notice Hashes transaction to get txid /// @dev Supports Legacy and Witness /// @param _version 4-bytes version /// @param _vin Raw bytes length-prefixed input vector /// @param _vout Raw bytes length-prefixed output vector /// @ param _locktime 4-byte tx locktime /// @return 32-byte transaction id, little endian function calculateTxId( bytes memory _version, bytes memory _vin, bytes memory _vout, bytes memory _locktime ) internal pure returns (bytes32) { // Get transaction hash double-Sha256(version + nIns + inputs + nOuts + outputs + locktime) return abi.encodePacked(_version, _vin, _vout, _locktime).hash256(); } /// @notice Parses a tx input from raw input bytes /// @dev Supports Legacy and Witness inputs /// @param _input Raw bytes tx input /// @return Tx input sequence number, tx hash, and index function parseInput(bytes memory _input) internal pure returns (uint32 _sequence, bytes32 _hash, uint32 _index, uint8 _inputType) { // NB: If the scriptsig is exactly 00, we are witness. // Otherwise we are compatibility if (_input.keccak256Slice(36, 1) != keccak256(hex"00")) { _sequence = _input.extractSequenceLegacy(); bytes32 _witnessTag = _input.keccak256Slice(36, 3); if (_witnessTag == keccak256(hex"220020") || _witnessTag == keccak256(hex"160014")) { _inputType = uint8(InputTypes.COMPATIBILITY); } else { _inputType = uint8(InputTypes.LEGACY); } } else { _sequence = _input.extractSequenceWitness(); _inputType = uint8(InputTypes.WITNESS); } return (_sequence, _input.extractInputTxId(), _input.extractTxIndex(), _inputType); } /// @notice Parses a tx output from raw output bytes /// @dev Differentiates by output script prefix, handles legacy and witness /// @param _output Raw bytes tx output /// @return Tx output value, output type, payload function parseOutput(bytes memory _output) internal pure returns (uint64 _value, uint8 _outputType, bytes memory _payload) { _value = _output.extractValue(); if (_output.keccak256Slice(9, 1) == keccak256(hex"6a")) { // OP_RETURN _outputType = uint8(OutputTypes.OP_RETURN); _payload = _output.extractOpReturnData(); } else { bytes32 _prefixHash = _output.keccak256Slice(8, 2); if (_prefixHash == keccak256(hex"2200")) { // P2WSH _outputType = uint8(OutputTypes.WSH); _payload = _output.slice(11, 32); } else if (_prefixHash == keccak256(hex"1600")) { // P2WPKH _outputType = uint8(OutputTypes.WPKH); _payload = _output.slice(11, 20); } else if (_prefixHash == keccak256(hex"1976")) { // PKH _outputType = uint8(OutputTypes.PKH); _payload = _output.slice(12, 20); } else if (_prefixHash == keccak256(hex"17a9")) { // SH _outputType = uint8(OutputTypes.SH); _payload = _output.slice(11, 20); } else { _outputType = uint8(OutputTypes.NONSTANDARD); } } return (_value, _outputType, _payload); } /// @notice Parses a block header struct from a bytestring /// @dev Block headers are always 80 bytes, see Bitcoin docs /// @return Header digest, version, previous block header hash, merkle root, timestamp, target, nonce function parseHeader(bytes memory _header) internal pure returns ( bytes32 _digest, uint32 _version, bytes32 _prevHash, bytes32 _merkleRoot, uint32 _timestamp, uint256 _target, uint32 _nonce ) { // If header has an invalid length, bubble up error if (_header.length != 80) { return(_digest, _version, _prevHash, _merkleRoot, _timestamp, _target, _nonce); } _digest = abi.encodePacked(_header.hash256()).reverseEndianness().toBytes32(); _version = uint32(_header.slice(0, 4).reverseEndianness().bytesToUint()); _prevHash = _header.extractPrevBlockLE().toBytes32(); _merkleRoot = _header.extractMerkleRootLE().toBytes32(); _timestamp = _header.extractTimestamp(); _target = _header.extractTarget(); _nonce = uint32(_header.slice(76, 4).reverseEndianness().bytesToUint()); return(_digest, _version, _prevHash, _merkleRoot, _timestamp, _target, _nonce); } /// @notice Checks validity of header chain /// @notice Compares the hash of each header to the prevHash in the next header /// @param _headers Raw byte array of header chain /// @return The total accumulated difficulty of the header chain, or an error code function validateHeaderChain(bytes memory _headers) internal view returns (uint256 _totalDifficulty) { // Check header chain length if (_headers.length % 80 != 0) {return ERR_BAD_LENGTH;} // Initialize header start index bytes32 _digest; _totalDifficulty = 0; for (uint256 _start = 0; _start < _headers.length; _start += 80) { // ith header start index and ith header bytes memory _header = _headers.slice(_start, 80); // After the first header, check that headers are in a chain if (_start != 0) { if (!validateHeaderPrevHash(_header, _digest)) {return ERR_INVALID_CHAIN;} } // ith header target uint256 _target = _header.extractTarget(); // Require that the header has sufficient work _digest = _header.hash256View(); if(uint256(_digest).reverseUint256() > _target) { return ERR_LOW_WORK; } // Add ith header difficulty to difficulty sum _totalDifficulty = _totalDifficulty.add(_target.calculateDifficulty()); } } /// @notice Checks validity of header work /// @param _digest Header digest /// @param _target The target threshold /// @return true if header work is valid, false otherwise function validateHeaderWork(bytes32 _digest, uint256 _target) internal pure returns (bool) { if (_digest == bytes32(0)) {return false;} return (abi.encodePacked(_digest).reverseEndianness().bytesToUint() < _target); } /// @notice Checks validity of header chain /// @dev Compares current header prevHash to previous header's digest /// @param _header The raw bytes header /// @param _prevHeaderDigest The previous header's digest /// @return true if header chain is valid, false otherwise function validateHeaderPrevHash(bytes memory _header, bytes32 _prevHeaderDigest) internal pure returns (bool) { // Extract prevHash of current header bytes32 _prevHash = _header.extractPrevBlockLE().toBytes32(); // Compare prevHash of current header to previous header's digest if (_prevHash != _prevHeaderDigest) {return false;} return true; } }
{ "metadata": { "useLiteralContent": true }, "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"bytes","name":"_genesisHeader","type":"bytes"},{"internalType":"uint256","name":"_height","type":"uint256"},{"internalType":"bytes32","name":"_periodStart","type":"bytes32"},{"internalType":"uint256","name":"_firstID","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_first","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"_last","type":"bytes32"}],"name":"Extension","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_requester","type":"address"},{"indexed":true,"internalType":"uint256","name":"_requestID","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_paysValue","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_spends","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_pays","type":"bytes"}],"name":"NewProofRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_from","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"_to","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"_gcd","type":"bytes32"}],"name":"Reorg","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_requestID","type":"uint256"}],"name":"RequestClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_txid","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"_requestID","type":"uint256"}],"name":"RequestFilled","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"BASE_COST","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"HEIGHT_INTERVAL","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"_anchor","type":"bytes"},{"internalType":"bytes","name":"_headers","type":"bytes"}],"name":"addHeaders","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"_oldPeriodStartHeader","type":"bytes"},{"internalType":"bytes","name":"_oldPeriodEndHeader","type":"bytes"},{"internalType":"bytes","name":"_headers","type":"bytes"}],"name":"addHeadersWithRetarget","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_requestID","type":"uint256"}],"name":"cancelRequest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_digest","type":"bytes32"},{"internalType":"uint256","name":"_offset","type":"uint256"}],"name":"findAncestor","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_digest","type":"bytes32"}],"name":"findHeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBestKnownDigest","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentEpochDifficulty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLastReorgCommonAncestor","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLatestValidatedTx","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPrevEpochDifficulty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRelayGenesis","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestID","type":"uint256"}],"name":"getRequest","outputs":[{"internalType":"bytes32","name":"spends","type":"bytes32"},{"internalType":"bytes32","name":"pays","type":"bytes32"},{"internalType":"uint64","name":"paysValue","type":"uint64"},{"internalType":"uint8","name":"state","type":"uint8"},{"internalType":"address","name":"consumer","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint8","name":"numConfs","type":"uint8"},{"internalType":"uint256","name":"notBefore","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_ancestor","type":"bytes32"},{"internalType":"bytes","name":"_left","type":"bytes"},{"internalType":"bytes","name":"_right","type":"bytes"}],"name":"heaviestFromAncestor","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_ancestor","type":"bytes32"},{"internalType":"bytes32","name":"_descendant","type":"bytes32"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"isAncestor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_ancestor","type":"bytes32"},{"internalType":"bytes32","name":"_left","type":"bytes32"},{"internalType":"bytes32","name":"_right","type":"bytes32"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"isMostRecentAncestor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"latestValidatedTx","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"_ancestor","type":"bytes32"},{"internalType":"bytes","name":"_currentBest","type":"bytes"},{"internalType":"bytes","name":"_newBest","type":"bytes"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"markNewHeaviest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nextID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"_header","type":"bytes"},{"internalType":"bytes","name":"_proof","type":"bytes"},{"internalType":"bytes4","name":"_version","type":"bytes4"},{"internalType":"bytes4","name":"_locktime","type":"bytes4"},{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"uint16","name":"_reqIndices","type":"uint16"},{"internalType":"bytes","name":"_vin","type":"bytes"},{"internalType":"bytes","name":"_vout","type":"bytes"},{"internalType":"uint256","name":"_requestID","type":"uint256"}],"name":"provideProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"remoteGasAllowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"_spends","type":"bytes"},{"internalType":"bytes","name":"_pays","type":"bytes"},{"internalType":"uint64","name":"_paysValue","type":"uint64"},{"internalType":"address","name":"_consumer","type":"address"},{"internalType":"uint8","name":"_numConfs","type":"uint8"},{"internalType":"uint256","name":"_notBefore","type":"uint256"}],"name":"request","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526207a120600b553480156200001857600080fd5b506040516200538538038062005385833981810160405260808110156200003e57600080fd5b81019080805160405193929190846401000000008211156200005f57600080fd5b838201915060208201858111156200007657600080fd5b82518660018202830111640100000000821117156200009457600080fd5b8083526020830192505050908051906020019080838360005b83811015620000ca578082015181840152602081019050620000ad565b50505050905090810190601f168015620000f85780820380516001836020036101000a031916815260200191505b5060405260200180519060200190929190805190602001909291908051906020019092919050505083838360508351146200019b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f53746f70206265696e672064756d62000000000000000000000000000000000081525060200191505060405180910390fd5b6000620001b384620002b560201b620028e71760201c565b90506000801b62ffffff60001b8316146200021a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d81526020018062005348603d913960400191505060405180910390fd5b8060008190555080600181905550806002819055508260046000838152602001908152602001600020819055506200026d6107e084816200025757fe5b06846200045360201b62003b5e1790919060201c565b60046000848152602001908152602001600020819055506200029a84620004d760201b62003a381760201c565b600581905550505050508060098190555050505050620007e1565b60006200044c600280846040518082805190602001908083835b60208310620002f45780518252602082019150602081019050602083039250620002cf565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa15801562000337573d6000803e3d6000fd5b5050506040513d60208110156200034d57600080fd5b8101908080519060200190929190505050604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b60208310620003b257805182526020820191506020810190506020830392506200038d565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015620003f5573d6000803e3d6000fd5b5050506040513d60208110156200040b57600080fd5b8101908080519060200190929190505050604051602001808281526020019150506040516020818303038152906040526200050160201b62003f5c1760201c565b9050919050565b600082821115620004cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f556e646572666c6f7720647572696e67207375627472616374696f6e2e00000081525060200191505060405180910390fd5b818303905092915050565b6000620004fa620004ee836200052e60201b60201c565b620005b460201b60201c565b9050919050565b6000606082905060008151141562000520576000801b91505062000529565b60208301519150505b919050565b60006060620005506048600385620005f360201b62003729179092919060201c565b9050600083604b815181106200056257fe5b602001015160f81c60f81b60f81c90506000620005956200058984620006b460201b60201c565b6200077160201b60201c565b905060006003830360ff169050806101000a8202945050505050919050565b6000620005ec827bffff0000000000000000000000000000000000000000000000000000620007cc60201b620044451790919060201c565b9050919050565b6060818301845110156200066f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536c696365206f7574206f6620626f756e64730000000000000000000000000081525060200191505060405180910390fd5b604051905081604082010160405281815282840181038360208601018381015b80821015620006aa578151838301526020820191506200068f565b5050509392505050565b60608082516040519080825280601f01601f191660200182016040528015620006ec5781602001600182028038833980820191505090505b50905060008090505b835181101562000767578381815181106200070c57fe5b602001015160f81c60f81b8260018387510303815181106200072a57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050620006f5565b5080915050919050565b60008060008090505b8351811015620007c2576001810184510360080260020a8482815181106200079e57fe5b602001015160f81c60f81b60f81c60ff16028201915080806001019150506200077a565b5080915050919050565b6000818381620007d857fe5b04905092915050565b614b5780620007f16000396000f3fe6080604052600436106101405760003560e01c806374c3a3a9116100b6578063ad401de61161006f578063ad401de6146108b9578063b25b9b0014610acb578063b985621a14610bc4578063c58242cd14610c2b578063c58343ef14610c56578063e3d8d8d814610d4e57610140565b806374c3a3a9146104af5780637fa637fc146105b657806394263234146106fe578063a00d952614610838578063a24022aa14610863578063a882e8641461088e57610140565b80632e4f161a116101085780632e4f161a1461021957806330017b3b1461028a5780633015394c146102e357806360b5c3901461033657806365da41b91461038557806370d53c181461047857610140565b8063113764be146101425780631910d9731461016d5780631e96917d1461019857806329798b96146101c35780632b97be24146101ee575b005b34801561014e57600080fd5b50610157610d79565b6040518082815260200191505060405180910390f35b34801561017957600080fd5b50610182610d83565b6040518082815260200191505060405180910390f35b3480156101a457600080fd5b506101ad610d8d565b6040518082815260200191505060405180910390f35b3480156101cf57600080fd5b506101d8610d93565b6040518082815260200191505060405180910390f35b3480156101fa57600080fd5b50610203610d99565b6040518082815260200191505060405180910390f35b34801561022557600080fd5b506102706004803603608081101561023c57600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610da3565b604051808215151515815260200191505060405180910390f35b34801561029657600080fd5b506102cd600480360360408110156102ad57600080fd5b810190808035906020019092919080359060200190929190505050610dbb565b6040518082815260200191505060405180910390f35b3480156102ef57600080fd5b5061031c6004803603602081101561030657600080fd5b8101908080359060200190929190505050610dcf565b604051808215151515815260200191505060405180910390f35b34801561034257600080fd5b5061036f6004803603602081101561035957600080fd5b8101908080359060200190929190505050610fe3565b6040518082815260200191505060405180910390f35b34801561039157600080fd5b5061045e600480360360408110156103a857600080fd5b81019080803590602001906401000000008111156103c557600080fd5b8201836020820111156103d757600080fd5b803590602001918460018302840111640100000000831117156103f957600080fd5b90919293919293908035906020019064010000000081111561041a57600080fd5b82018360208201111561042c57600080fd5b8035906020019184600183028401116401000000008311171561044e57600080fd5b9091929391929390505050610ff5565b604051808215151515815260200191505060405180910390f35b34801561048457600080fd5b5061048d611095565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b3480156104bb57600080fd5b5061059c600480360360808110156104d257600080fd5b8101908080359060200190929190803590602001906401000000008111156104f957600080fd5b82018360208201111561050b57600080fd5b8035906020019184600183028401116401000000008311171561052d57600080fd5b90919293919293908035906020019064010000000081111561054e57600080fd5b82018360208201111561056057600080fd5b8035906020019184600183028401116401000000008311171561058257600080fd5b90919293919293908035906020019092919050505061109a565b604051808215151515815260200191505060405180910390f35b3480156105c257600080fd5b506106e4600480360360608110156105d957600080fd5b81019080803590602001906401000000008111156105f657600080fd5b82018360208201111561060857600080fd5b8035906020019184600183028401116401000000008311171561062a57600080fd5b90919293919293908035906020019064010000000081111561064b57600080fd5b82018360208201111561065d57600080fd5b8035906020019184600183028401116401000000008311171561067f57600080fd5b9091929391929390803590602001906401000000008111156106a057600080fd5b8201836020820111156106b257600080fd5b803590602001918460018302840111640100000000831117156106d457600080fd5b909192939192939050505061113c565b604051808215151515815260200191505060405180910390f35b34801561070a57600080fd5b50610822600480360360c081101561072157600080fd5b810190808035906020019064010000000081111561073e57600080fd5b82018360208201111561075057600080fd5b8035906020019184600183028401116401000000008311171561077257600080fd5b90919293919293908035906020019064010000000081111561079357600080fd5b8201836020820111156107a557600080fd5b803590602001918460018302840111640100000000831117156107c757600080fd5b9091929391929390803567ffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080359060200190929190505050611221565b6040518082815260200191505060405180910390f35b34801561084457600080fd5b5061084d6112c7565b6040518082815260200191505060405180910390f35b34801561086f57600080fd5b506108786112ce565b6040518082815260200191505060405180910390f35b34801561089a57600080fd5b506108a36112d4565b6040518082815260200191505060405180910390f35b3480156108c557600080fd5b50610ab160048036036101208110156108dd57600080fd5b81019080803590602001906401000000008111156108fa57600080fd5b82018360208201111561090c57600080fd5b8035906020019184600183028401116401000000008311171561092e57600080fd5b90919293919293908035906020019064010000000081111561094f57600080fd5b82018360208201111561096157600080fd5b8035906020019184600183028401116401000000008311171561098357600080fd5b909192939192939080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919080359060200190929190803561ffff16906020019092919080359060200190640100000000811115610a0e57600080fd5b820183602082011115610a2057600080fd5b80359060200191846001830284011164010000000083111715610a4257600080fd5b909192939192939080359060200190640100000000811115610a6357600080fd5b820183602082011115610a7557600080fd5b80359060200191846001830284011164010000000083111715610a9757600080fd5b9091929391929390803590602001909291905050506112de565b604051808215151515815260200191505060405180910390f35b348015610ad757600080fd5b50610bae60048036036060811015610aee57600080fd5b810190808035906020019092919080359060200190640100000000811115610b1557600080fd5b820183602082011115610b2757600080fd5b80359060200191846001830284011164010000000083111715610b4957600080fd5b909192939192939080359060200190640100000000811115610b6a57600080fd5b820183602082011115610b7c57600080fd5b80359060200191846001830284011164010000000083111715610b9e57600080fd5b90919293919293905050506115e1565b6040518082815260200191505060405180910390f35b348015610bd057600080fd5b50610c1160048036036060811015610be757600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611681565b604051808215151515815260200191505060405180910390f35b348015610c3757600080fd5b50610c40611697565b6040518082815260200191505060405180910390f35b348015610c6257600080fd5b50610c8f60048036036020811015610c7957600080fd5b81019080803590602001909291905050506116a1565b604051808981526020018881526020018767ffffffffffffffff1667ffffffffffffffff1681526020018660ff1660ff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018360ff1660ff1681526020018281526020019850505050505050505060405180910390f35b348015610d5a57600080fd5b50610d63611781565b6040518082815260200191505060405180910390f35b6000600554905090565b6000600154905090565b60095481565b600a5481565b6000600654905090565b6000610db18585858561178a565b9050949350505050565b6000610dc78383611862565b905092915050565b60008060086000848152602001908152602001600020905060016002811115610df457fe5b8160040160149054906101000a900460ff166002811115610e1157fe5b14610e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f52657175657374206e6f7420616374697665000000000000000000000000000081525060200191505060405180910390fd5b8060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610f3157508060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610f86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614a22602a913960400191505060405180910390fd5b60028160040160146101000a81548160ff02191690836002811115610fa757fe5b0217905550827f4287938c90f288c18d761d34c3a5ad998017f7e890a72628c9636bb82ea286bd60405160405180910390a26001915050919050565b6000610fee8261192b565b9050919050565b600061108b85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000611a35565b9050949350505050565b600481565b60006111308787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505085611e04565b90509695505050505050565b600061121587878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612051565b90509695505050505050565b60006112b989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050878787876122eb565b905098975050505050505050565b6201518081565b600b5481565b6000600a54905090565b6000806113af8b888888888f60405160200180877bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526004018686808284378083019250505084848082843780830192505050827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040196505050505050506040516020818303038152906040526128e7565b90506007600082815260200190815260200160002060009054906101000a900460ff166114a05761146b8f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508b8487612a70565b5060016007600083815260200190815260200160002060006101000a81548160ff02191690831515021790555080600a819055505b6115348888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505087878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505086612c53565b506115ca818989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505087613118565b5060019150509d9c50505050505050505050505050565b60006116768686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050613453565b905095945050505050565b600061168e84848461363d565b90509392505050565b6000600254905090565b6000806000806000806000806000600860008b8152602001908152602001600020905080600001549850806001015497508060030160149054906101000a900467ffffffffffffffff1696508060040160149054906101000a900460ff16600281111561170a57fe5b95508060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1694508060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16935080600301601c9054906101000a900460ff1692508060020154915050919395975091939597565b60008054905090565b6000838514801561179a57508285145b156117a8576001905061185a565b600084905060008490506000869050600086905060008090505b86811015611827578983146117eb57829450600360008481526020019081526020016000205492505b89821461180c57819350600360008381526020019081526020016000205491505b6118206001826136a390919063ffffffff16565b90506117c2565b508284141561183d57600094505050505061185a565b80821461185157600094505050505061185a565b60019450505050505b949350505050565b60008083905060008090505b838110156118a757600360008381526020019081526020016000205491506118a06001826136a390919063ffffffff16565b905061186e565b506000801b811415611921576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f556e6b6e6f776e20616e636573746f720000000000000000000000000000000081525060200191505060405180910390fd5b8091505092915050565b60008060009050600083905060008090505b600160040163ffffffff168110156119c15760046000838152602001908152602001600020549250600083141561198957600360008381526020019081526020016000205491506119a6565b61199c81846136a390919063ffffffff16565b9350505050611a30565b6119ba6001826136a390919063ffffffff16565b905061193d565b506040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f556e6b6e6f776e20626c6f636b0000000000000000000000000000000000000081525060200191505060405180910390fd5b919050565b6000806060600080611a46886128e7565b90506000611a69611a64600060508b6137299092919063ffffffff16565b6137e7565b90506000611a768361192b565b90508780611a8b575081611a898b6137e7565b145b611ae0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180614aaf6024913960400191505060405180910390fd5b600060508a5181611aed57fe5b0614611b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180614992602b913960400191505060405180910390fd5b60008090505b60508a5181611b5557fe5b04811015611dbc57611b86611b7460508361385590919063ffffffff16565b60508c6137299092919063ffffffff16565b9550611b9e60018201836136a390919063ffffffff16565b9650611ba9866128e7565b94506000801b60036000878152602001908152602001600020541415611cb95782611bfa611bf587604051602001808281526020019150506040516020818303038152906040526138f5565b6139ad565b1115611c6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f48656164657220776f726b20697320696e73756666696369656e74000000000081525060200191505060405180910390fd5b8360036000878152602001908152602001600020819055506000600463ffffffff168881611c9857fe5b061415611cb8578660046000878152602001908152602001600020819055505b5b82611cc3876137e7565b14611d36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f546172676574206368616e67656420756e65787065637465646c79000000000081525060200191505060405180910390fd5b611d498487613a0590919063ffffffff16565b611d9e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061496c6026913960400191505060405180910390fd5b849350611db56001826136a390919063ffffffff16565b9050611b4a565b5083611dc78b6128e7565b7ff90e4f1d9cd0dd55e339411cbc9b152482307c3a23ed64715e4a2858f641a3f560405160405180910390a3600196505050505050509392505050565b600080611e10846128e7565b90506000611e1d866128e7565b90506001548114611e96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f50617373656420696e2062657374206973206e6f742062657374206b6e6f776e81525060200191505060405180910390fd5b6000801b60036000848152602001908152602001600020541415611f22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4e6577206265737420697320756e6b6e6f776e0000000000000000000000000081525060200191505060405180910390fd5b611f3087600154848761178a565b611f85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180614afa6029913960400191505060405180910390fd5b81611f91888888613453565b14611fe7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180614a4c6033913960400191505060405180910390fd5b8160018190555086600281905550600061200086613a38565b9050600554811461201357806005819055505b8783837f26300f292d9603532a1503495d83156db6cb60433e0802cd3b8763b57f1d14d260405160405180910390a460019350505050949350505050565b600080612065612060866128e7565b61192b565b9050600061207a612075866128e7565b61192b565b90506107df6107e0828161208a57fe5b06146120e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d8152602001806149e5603d913960400191505060405180910390fd5b6120f66107df836136a390919063ffffffff16565b811461214d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806149bd6028913960400191505060405180910390fd5b61215685613a38565b61215f87613a38565b146121b5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180614ad36027913960400191505060405180910390fd5b60606121ce60006050876137299092919063ffffffff16565b905060006121db826137e7565b9050600061220e6121eb8a6137e7565b6121f48b613a52565b63ffffffff166122038b613a52565b63ffffffff16613a74565b90508181831614612287576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e76616c69642072657461726765742070726f76696465640000000000000081525060200191505060405180910390fd5b60006122928a613a38565b905080600654141580156122c357506122c06107e06122b260015461192b565b613b5e90919063ffffffff16565b85115b156122d057806006819055505b6122dc89896001611a35565b96505050505050509392505050565b600080600954905060016009540160098190555060008851905060248114806123145750600081145b612386576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4e6f7420612076616c6964205554584f0000000000000000000000000000000081525060200191505060405180910390fd5b6000885190506000811180156123bc575060018103896000815181106123a857fe5b602001015160f81c60f81b60f81c60ff1614155b15612446578089604051602001808360ff1660ff1660f81b815260010182805190602001908083835b6020831061240857805182526020820191506020810190506020830392506123e5565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405298506001810190505b6060600060c01b8a604051602001808377ffffffffffffffffffffffffffffffffffffffffffffffff191677ffffffffffffffffffffffffffffffffffffffffffffffff1916815260080182805190602001908083835b602083106124c0578051825260208201915060208101905060208303925061249d565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050600082148061250f5750600061250c82613be1565b51115b806125235750600061252082613eaf565b51115b612595576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4e6f742061207374616e64617264206f7574707574207479706500000000000081525060200191505060405180910390fd5b60008311806125a45750600082115b612616576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4e6f20726571756573742073706563696669656400000000000000000000000081525060200191505060405180910390fd5b6000600860008681526020019081526020016000209050338160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600084111561268a578b8051906020012081600001819055505b60008311156126a4578a8051906020012081600101819055505b60008a67ffffffffffffffff1611156126e357898160030160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b60008860ff161180156126f9575060f18860ff16105b1561271c578781600301601c6101000a81548160ff021916908360ff1602179055505b600087111561272f578681600201819055505b888160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018160040160146101000a81548160ff0219169083600281111561279357fe5b0217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6744579059b48cd66d2c2dfe223754f166f2200b6de2bc6e0d239cd52d1a8c48c8f8f604051808467ffffffffffffffff1667ffffffffffffffff1681526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015612832578082015181840152602081019050612817565b50505050905090810190601f16801561285f5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561289857808201518184015260208101905061287d565b50505050905090810190601f1680156128c55780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a384955050505050509695505050505050565b6000612a69600280846040518082805190602001908083835b602083106129235780518252602082019150602081019050602083039250612900565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015612965573d6000803e3d6000fd5b5050506040513d602081101561297a57600080fd5b8101908080519060200190929190505050604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b602083106129dd57805182526020820191506020810190506020830392506129ba565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015612a1f573d6000803e3d6000fd5b5050506040513d6020811015612a3457600080fd5b810190808051906020019092919050505060405160200180828152602001915050604051602081830303815290604052613f5c565b9050919050565b6000612a8e83612a87612a8289613f87565b613f5c565b8787613fa7565b612b00576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f42616420696e636c7573696f6e2070726f6f660000000000000000000000000081525060200191505060405180910390fd5b6000612b0b876128e7565b90506000612b17611697565b9050612b25828260f061363d565b612b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f47434420646f6573206e6f7420636f6e6669726d20686561646572000000000081525060200191505060405180910390fd5b600060086000868152602001908152602001600020600301601c9054906101000a900460ff1690508060ff16612bcc84614071565b60ff161015612c43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e73756666696369656e7420636f6e6669726d6174696f6e7300000000000081525060200191505060405180910390fd5b6001935050505095945050505050565b6000612c5e8461408f565b612cd0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f56696e206973206d616c666f726d61747465640000000000000000000000000081525060200191505060405180910390fd5b612cd98361415a565b612d4b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f566f7574206973206d616c666f726d617474656400000000000000000000000081525060200191505060405180910390fd5b600060088661ffff16901c9050600060ff8716905060006008600086815260200190815260200160002090504281600201541115612df1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f52657175657374206973207375626d697474656420746f6f206561726c79000081525060200191505060405180910390fd5b60016002811115612dfe57fe5b8160040160149054906101000a900460ff166002811115612e1b57fe5b14612e8e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f52657175657374206973206e6f7420616374697665000000000000000000000081525060200191505060405180910390fd5b60008160010154905060008060001b82141590508015613045576060612ebd858a61422590919063ffffffff16565b90506000612eca826142c2565b600081518110612ed657fe5b602001015160f81c60f81b60f81c905083612f0360086001840160ff16856137299092919063ffffffff16565b8051906020012014612f7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f446f6573206e6f74206d6174636820706179732072657175657374000000000081525060200191505060405180910390fd5b60008560030160149054906101000a900467ffffffffffffffff16905060008167ffffffffffffffff161480612fcf57508067ffffffffffffffff16612fc2846142e2565b67ffffffffffffffff1610155b613041576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f446f6573206e6f74206d617463682076616c756520726571756573740000000081525060200191505060405180910390fd5b5050505b60008360000154905060008060001b82141590508015613105576060613074888d61431090919063ffffffff16565b9050811580613091575082613088826143ad565b80519060200120145b613103576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f446f6573206e6f74206d61746368207370656e6473207265717565737400000081525060200191505060405180910390fd5b505b6001975050505050505050949350505050565b60008060086000848152602001908152602001600020905060008160030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060088861ffff16901c9050600060ff891690508273ffffffffffffffffffffffffffffffffffffffff16600b548473ffffffffffffffffffffffffffffffffffffffff16630140356d905060e01b8c8b8b8b88886040516020018087815260200180602001806020018681526020018560ff1660ff1681526020018460ff1660ff168152602001838103835288818151815260200191508051906020019080838360005b8381101561321a5780820151818401526020810190506131ff565b50505050905090810190601f1680156132475780820380516001836020036101000a031916815260200191505b50838103825287818151815260200191508051906020019080838360005b83811015613280578082015181840152602081019050613265565b50505050905090810190601f1680156132ad5780820380516001836020036101000a031916815260200191505b509850505050505050505060405160208183030381529060405260405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310613341578051825260208201915060208101905060208303925061331e565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083106133a95780518252602082019150602081019050602083039250613386565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d806000811461340c576040519150601f19603f3d011682016040523d82523d6000602084013e613411565b606091505b505050858a7f97b6ce150a3b8e94c442fb09fe13c2b262f0e9b3bfc83ef2309675e09dcb453b60405160405180910390a3600194505050505095945050505050565b60008061345f8561192b565b9050600061347461346f866128e7565b61192b565b90506000613489613484866128e7565b61192b565b905082821015801561349b5750828110155b6134f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614a7f6030913960400191505060405180910390fd5b60006135246107e0858161350057fe5b066135166107e0876136a390919063ffffffff16565b613b5e90919063ffffffff16565b905060008184109050600082841090508115801561353f5750805b1561355a5761354d896128e7565b9650505050505050613636565b818015613565575080155b1561358057613573886128e7565b9650505050505050613636565b81801561358a5750805b156135bc57838510156135a5576135a0886128e7565b6135af565b6135ae896128e7565b5b9650505050505050613636565b6135e26135c889613a38565b6107e086816135d357fe5b0661385590919063ffffffff16565b6136086135ee8b613a38565b6107e088816135f957fe5b0661385590919063ffffffff16565b101561362457613617886128e7565b9650505050505050613636565b61362d896128e7565b96505050505050505b9392505050565b60008083905060008090505b8381101561369557858214156136645760019250505061369c565b6003600083815260200190815260200160002054915061368e6001826136a390919063ffffffff16565b9050613649565b5060009150505b9392505050565b6000818301905082811015613720576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4f766572666c6f7720647572696e67206164646974696f6e2e0000000000000081525060200191505060405180910390fd5b80905092915050565b6060818301845110156137a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536c696365206f7574206f6620626f756e64730000000000000000000000000081525060200191505060405180910390fd5b604051905081604082010160405281815282840181038360208601018381015b808210156137dd578151838301526020820191506137c4565b5050509392505050565b6000606061380260486003856137299092919063ffffffff16565b9050600083604b8151811061381357fe5b602001015160f81c60f81b60f81c90506000613836613831846138f5565b6139ad565b905060006003830360ff169050806101000a8202945050505050919050565b60008083141561386857600090506138ef565b81830290508183828161387757fe5b04146138eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4f766572666c6f7720647572696e67206d756c7469706c69636174696f6e2e0081525060200191505060405180910390fd5b8090505b92915050565b60608082516040519080825280601f01601f19166020018201604052801561392c5781602001600182028038833980820191505090505b50905060008090505b83518110156139a35783818151811061394a57fe5b602001015160f81c60f81b82600183875103038151811061396757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050613935565b5080915050919050565b60008060008090505b83518110156139fb576001810184510360080260020a8482815181106139d857fe5b602001015160f81c60f81b60f81c60ff16028201915080806001019150506139b6565b5080915050919050565b600080613a19613a14856143cd565b613f5c565b9050828114613a2c576000915050613a32565b60019150505b92915050565b6000613a4b613a46836137e7565b6143ed565b9050919050565b6000613a6d613a68613a6384614425565b6138f5565b6139ad565b9050919050565b600080613a8a8484613b5e90919063ffffffff16565b9050613aa360046212750061444590919063ffffffff16565b811015613ac457613ac160046212750061444590919063ffffffff16565b90505b613adb60046212750061385590919063ffffffff16565b811115613afc57613af960046212750061385590919063ffffffff16565b90505b6000613b2682613b18620100008961444590919063ffffffff16565b61385590919063ffffffff16565b9050613b5362010000613b45621275008461444590919063ffffffff16565b61385590919063ffffffff16565b925050509392505050565b600082821115613bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f556e646572666c6f7720647572696e67207375627472616374696f6e2e00000081525060200191505060405180910390fd5b818303905092915050565b60606000613bfc60096001856137299092919063ffffffff16565b600081518110613c0857fe5b602001015160f81c60f81b60f81c60ff161415613cbf5760006002613c2c846142c2565b600081518110613c3857fe5b602001015160f81c60f81b60f81c0360ff1690508060ff16613c67600a6001866137299092919063ffffffff16565b600081518110613c7357fe5b602001015160f81c60f81b60f81c60ff1614613ca15760405180602001604052806000815250915050613eaa565b613cb7600b82856137299092919063ffffffff16565b915050613eaa565b6000613cd860086003856144599092919063ffffffff16565b905060405180807f1976a9000000000000000000000000000000000000000000000000000000000081525060030190506040518091039020811415613de4576014613d30600b6001866137299092919063ffffffff16565b600081518110613d3c57fe5b602001015160f81c60f81b60f81c60ff16141580613da8575060405180807f88ac00000000000000000000000000000000000000000000000000000000000081525060020190506040518091039020613da560028551036002866144599092919063ffffffff16565b14155b15613dc55760405180602001604052806000815250915050613eaa565b613ddc600c6014856137299092919063ffffffff16565b915050613eaa565b60405180807f17a914000000000000000000000000000000000000000000000000000000000081525060030190506040518091039020811415613e96576087613e3d60018551036001866137299092919063ffffffff16565b600081518110613e4957fe5b602001015160f81c60f81b60f81c60ff1614613e775760405180602001604052806000815250915050613eaa565b613e8e600b6014856137299092919063ffffffff16565b915050613eaa565b506040518060200160405280600081525090505b919050565b606060405180807f6a0000000000000000000000000000000000000000000000000000000000000081525060010190506040518091039020613efe60096001856144599092919063ffffffff16565b14613f1a57604051806020016040528060008152509050613f57565b6060613f33600a6001856137299092919063ffffffff16565b9050613f53600b613f43836139ad565b856137299092919063ffffffff16565b9150505b919050565b60006060829050600081511415613f79576000801b915050613f82565b60208301519150505b919050565b6060613fa060246020846137299092919063ffffffff16565b9050919050565b60008385148015613fb85750600082145b8015613fc5575060008351145b15613fd35760019050614069565b60608584866040516020018084815260200183805190602001908083835b602083106140145780518252602082019150602081019050602083039250613ff1565b6001836020036101000a0380198251168184511680821785525050505050509050018281526020019350505050604051602081830303815290604052905061406583826144e590919063ffffffff16565b9150505b949350505050565b600061407c8261192b565b61408760015461192b565b039050919050565b6000806001905060006140af60006001866137299092919063ffffffff16565b6000815181106140bb57fe5b602001015160f81c60f81b60f81c905060fd8160ff161015806140e1575060008160ff16145b156140f157600092505050614155565b60008090505b8160ff168160ff16101561414b576141256141208485885103886137299092919063ffffffff16565b61465f565b83019250845183111561413e5760009350505050614155565b80806001019150506140f7565b5083518214925050505b919050565b60008060019050600061417a60006001866137299092919063ffffffff16565b60008151811061418657fe5b602001015160f81c60f81b60f81c905060fd8160ff161015806141ac575060008160ff16145b156141bc57600092505050614220565b60008090505b8160ff168160ff161015614216576141f06141eb8485885103886137299092919063ffffffff16565b61468a565b8301925084518311156142095760009350505050614220565b80806001019150506141c2565b5083518214925050505b919050565b60606000606060006001905060008090505b8560ff168160ff16101561427c5761425d8283895103896137299092919063ffffffff16565b92506142688361468a565b935083820191508080600101915050614237565b506142958182885103886137299092919063ffffffff16565b91506142a08261468a565b92506142b78184886137299092919063ffffffff16565b935050505092915050565b60606142db60086001846137299092919063ffffffff16565b9050919050565b600060606142ef8361474b565b905060606142fc826138f5565b9050614307816139ad565b92505050919050565b60606000606060006001905060008090505b8560ff168160ff161015614367576143488283895103896137299092919063ffffffff16565b92506143538361465f565b935083820191508080600101915050614322565b506143808182885103886137299092919063ffffffff16565b915061438b8261465f565b92506143a28184886137299092919063ffffffff16565b935050505092915050565b60606143c660006024846137299092919063ffffffff16565b9050919050565b60606143e660046020846137299092919063ffffffff16565b9050919050565b600061441e827bffff000000000000000000000000000000000000000000000000000061444590919063ffffffff16565b9050919050565b606061443e60446004846137299092919063ffffffff16565b9050919050565b600081838161445057fe5b04905092915050565b6000818301845110156144d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536c696365206f7574206f6620626f756e64730000000000000000000000000081525060200191505060405180910390fd5b818360208601012090509392505050565b60008060208451816144f357fe5b06146145025760009050614659565b6020835114156145155760019050614659565b6040835114156145285760009050614659565b6000829050600061455161454c60208751036020886137299092919063ffffffff16565b613f5c565b9050600061457461456f60006020896137299092919063ffffffff16565b613f5c565b90506000600190505b60016145946020895161444590919063ffffffff16565b0381101561464f576001600285816145a857fe5b0614156145f7576145f06145cb6020830260208a6137299092919063ffffffff16565b836040516020018082815260200191505060405160208183030381529060405261476b565b915061463b565b61463882604051602001808281526020019150506040516020818303038152906040526146336020840260208b6137299092919063ffffffff16565b61476b565b91505b600184901c9350808060010191505061457d565b5081811493505050505b92915050565b600080600061466d8461483b565b80925081935050506004818360250160ff16010192505050919050565b6000806146a460086001856137299092919063ffffffff16565b6000815181106146b057fe5b602001015160f81c60f81b60f81c905060fd8160ff1610614739576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4d756c74692d6279746520566172496e7473206e6f7420737570706f7274656481525060200191505060405180910390fd5b6001600882010160ff16915050919050565b606061476460006008846137299092919063ffffffff16565b9050919050565b600061483383836040516020018083805190602001908083835b602083106147a85780518252602082019150602081019050602083039250614785565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083106147f957805182526020820191506020810190506020830392506147d6565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526128e7565b905092915050565b600080606061485760246001866137299092919063ffffffff16565b90506000614864826148d2565b90506000808260ff161415614898578260008151811061488057fe5b602001015160f81c60f81b60f81c60ff1690506148c4565b6148c16148bc6148b760258560ff168a6137299092919063ffffffff16565b6138f5565b6139ad565b90505b818194509450505050915091565b600060ff826000815181106148e357fe5b602001015160f81c60f81b60f81c60ff1614156149035760089050614966565b60fe8260008151811061491257fe5b602001015160f81c60f81b60f81c60ff1614156149325760049050614966565b60fd8260008151811061494157fe5b602001015160f81c60f81b60f81c60ff1614156149615760029050614966565b600090505b91905056fe4865616465727320646f206e6f7420666f726d206120636f6e73697374656e7420636861696e486561646572206172726179206c656e677468206d75737420626520646976697369626c652062792038304d7573742070726f766964652065786163746c79203120646966666963756c747920706572696f644d7573742070726f7669646520746865206c61737420686561646572206f662074686520636c6f73696e6720646966666963756c747920706572696f6443616e206f6e6c792062652063616e63656c6c6564206279206f776e6572206f7220636f6e73756d65724e65772062657374206861736820646f6573206e6f742068617665206d6f726520776f726b207468616e2070726576696f7573412064657363656e64616e74206865696768742069732062656c6f772074686520616e636573746f7220686569676874556e6578706563746564207265746172676574206f6e2065787465726e616c2063616c6c506572696f642068656164657220646966666963756c7469657320646f206e6f74206d61746368416e636573746f72206d75737420626520686561766965737420636f6d6d6f6e20616e636573746f72a265627a7a72315820ed4a052c2505eaf6cd829e5de44121a4426b7b0673201deb84e0e73fb86c726364736f6c63430005110032506572696f64207374617274206861736820646f6573206e6f74206861766520776f726b2e2048696e743a2077726f6e672062797465206f726465723f00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000099cef459ec50d4ea62a89da04eb1ef3e352ec740bca50e8a8080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000e0ff279ba72c6a3f1e81e62004f991dc12b5af3d9758c18406030000000000000000000f3a570c00a29620ed5017e1225effa1a4be5c47f549abd84200cb553d1175f42ba6b95e397a1117cf8dfb8300000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106101405760003560e01c806374c3a3a9116100b6578063ad401de61161006f578063ad401de6146108b9578063b25b9b0014610acb578063b985621a14610bc4578063c58242cd14610c2b578063c58343ef14610c56578063e3d8d8d814610d4e57610140565b806374c3a3a9146104af5780637fa637fc146105b657806394263234146106fe578063a00d952614610838578063a24022aa14610863578063a882e8641461088e57610140565b80632e4f161a116101085780632e4f161a1461021957806330017b3b1461028a5780633015394c146102e357806360b5c3901461033657806365da41b91461038557806370d53c181461047857610140565b8063113764be146101425780631910d9731461016d5780631e96917d1461019857806329798b96146101c35780632b97be24146101ee575b005b34801561014e57600080fd5b50610157610d79565b6040518082815260200191505060405180910390f35b34801561017957600080fd5b50610182610d83565b6040518082815260200191505060405180910390f35b3480156101a457600080fd5b506101ad610d8d565b6040518082815260200191505060405180910390f35b3480156101cf57600080fd5b506101d8610d93565b6040518082815260200191505060405180910390f35b3480156101fa57600080fd5b50610203610d99565b6040518082815260200191505060405180910390f35b34801561022557600080fd5b506102706004803603608081101561023c57600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610da3565b604051808215151515815260200191505060405180910390f35b34801561029657600080fd5b506102cd600480360360408110156102ad57600080fd5b810190808035906020019092919080359060200190929190505050610dbb565b6040518082815260200191505060405180910390f35b3480156102ef57600080fd5b5061031c6004803603602081101561030657600080fd5b8101908080359060200190929190505050610dcf565b604051808215151515815260200191505060405180910390f35b34801561034257600080fd5b5061036f6004803603602081101561035957600080fd5b8101908080359060200190929190505050610fe3565b6040518082815260200191505060405180910390f35b34801561039157600080fd5b5061045e600480360360408110156103a857600080fd5b81019080803590602001906401000000008111156103c557600080fd5b8201836020820111156103d757600080fd5b803590602001918460018302840111640100000000831117156103f957600080fd5b90919293919293908035906020019064010000000081111561041a57600080fd5b82018360208201111561042c57600080fd5b8035906020019184600183028401116401000000008311171561044e57600080fd5b9091929391929390505050610ff5565b604051808215151515815260200191505060405180910390f35b34801561048457600080fd5b5061048d611095565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b3480156104bb57600080fd5b5061059c600480360360808110156104d257600080fd5b8101908080359060200190929190803590602001906401000000008111156104f957600080fd5b82018360208201111561050b57600080fd5b8035906020019184600183028401116401000000008311171561052d57600080fd5b90919293919293908035906020019064010000000081111561054e57600080fd5b82018360208201111561056057600080fd5b8035906020019184600183028401116401000000008311171561058257600080fd5b90919293919293908035906020019092919050505061109a565b604051808215151515815260200191505060405180910390f35b3480156105c257600080fd5b506106e4600480360360608110156105d957600080fd5b81019080803590602001906401000000008111156105f657600080fd5b82018360208201111561060857600080fd5b8035906020019184600183028401116401000000008311171561062a57600080fd5b90919293919293908035906020019064010000000081111561064b57600080fd5b82018360208201111561065d57600080fd5b8035906020019184600183028401116401000000008311171561067f57600080fd5b9091929391929390803590602001906401000000008111156106a057600080fd5b8201836020820111156106b257600080fd5b803590602001918460018302840111640100000000831117156106d457600080fd5b909192939192939050505061113c565b604051808215151515815260200191505060405180910390f35b34801561070a57600080fd5b50610822600480360360c081101561072157600080fd5b810190808035906020019064010000000081111561073e57600080fd5b82018360208201111561075057600080fd5b8035906020019184600183028401116401000000008311171561077257600080fd5b90919293919293908035906020019064010000000081111561079357600080fd5b8201836020820111156107a557600080fd5b803590602001918460018302840111640100000000831117156107c757600080fd5b9091929391929390803567ffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080359060200190929190505050611221565b6040518082815260200191505060405180910390f35b34801561084457600080fd5b5061084d6112c7565b6040518082815260200191505060405180910390f35b34801561086f57600080fd5b506108786112ce565b6040518082815260200191505060405180910390f35b34801561089a57600080fd5b506108a36112d4565b6040518082815260200191505060405180910390f35b3480156108c557600080fd5b50610ab160048036036101208110156108dd57600080fd5b81019080803590602001906401000000008111156108fa57600080fd5b82018360208201111561090c57600080fd5b8035906020019184600183028401116401000000008311171561092e57600080fd5b90919293919293908035906020019064010000000081111561094f57600080fd5b82018360208201111561096157600080fd5b8035906020019184600183028401116401000000008311171561098357600080fd5b909192939192939080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919080359060200190929190803561ffff16906020019092919080359060200190640100000000811115610a0e57600080fd5b820183602082011115610a2057600080fd5b80359060200191846001830284011164010000000083111715610a4257600080fd5b909192939192939080359060200190640100000000811115610a6357600080fd5b820183602082011115610a7557600080fd5b80359060200191846001830284011164010000000083111715610a9757600080fd5b9091929391929390803590602001909291905050506112de565b604051808215151515815260200191505060405180910390f35b348015610ad757600080fd5b50610bae60048036036060811015610aee57600080fd5b810190808035906020019092919080359060200190640100000000811115610b1557600080fd5b820183602082011115610b2757600080fd5b80359060200191846001830284011164010000000083111715610b4957600080fd5b909192939192939080359060200190640100000000811115610b6a57600080fd5b820183602082011115610b7c57600080fd5b80359060200191846001830284011164010000000083111715610b9e57600080fd5b90919293919293905050506115e1565b6040518082815260200191505060405180910390f35b348015610bd057600080fd5b50610c1160048036036060811015610be757600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611681565b604051808215151515815260200191505060405180910390f35b348015610c3757600080fd5b50610c40611697565b6040518082815260200191505060405180910390f35b348015610c6257600080fd5b50610c8f60048036036020811015610c7957600080fd5b81019080803590602001909291905050506116a1565b604051808981526020018881526020018767ffffffffffffffff1667ffffffffffffffff1681526020018660ff1660ff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018360ff1660ff1681526020018281526020019850505050505050505060405180910390f35b348015610d5a57600080fd5b50610d63611781565b6040518082815260200191505060405180910390f35b6000600554905090565b6000600154905090565b60095481565b600a5481565b6000600654905090565b6000610db18585858561178a565b9050949350505050565b6000610dc78383611862565b905092915050565b60008060086000848152602001908152602001600020905060016002811115610df457fe5b8160040160149054906101000a900460ff166002811115610e1157fe5b14610e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f52657175657374206e6f7420616374697665000000000000000000000000000081525060200191505060405180910390fd5b8060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610f3157508060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610f86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614a22602a913960400191505060405180910390fd5b60028160040160146101000a81548160ff02191690836002811115610fa757fe5b0217905550827f4287938c90f288c18d761d34c3a5ad998017f7e890a72628c9636bb82ea286bd60405160405180910390a26001915050919050565b6000610fee8261192b565b9050919050565b600061108b85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000611a35565b9050949350505050565b600481565b60006111308787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505085611e04565b90509695505050505050565b600061121587878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612051565b90509695505050505050565b60006112b989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050878787876122eb565b905098975050505050505050565b6201518081565b600b5481565b6000600a54905090565b6000806113af8b888888888f60405160200180877bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526004018686808284378083019250505084848082843780830192505050827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040196505050505050506040516020818303038152906040526128e7565b90506007600082815260200190815260200160002060009054906101000a900460ff166114a05761146b8f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508b8487612a70565b5060016007600083815260200190815260200160002060006101000a81548160ff02191690831515021790555080600a819055505b6115348888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505087878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505086612c53565b506115ca818989898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505087613118565b5060019150509d9c50505050505050505050505050565b60006116768686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050613453565b905095945050505050565b600061168e84848461363d565b90509392505050565b6000600254905090565b6000806000806000806000806000600860008b8152602001908152602001600020905080600001549850806001015497508060030160149054906101000a900467ffffffffffffffff1696508060040160149054906101000a900460ff16600281111561170a57fe5b95508060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1694508060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16935080600301601c9054906101000a900460ff1692508060020154915050919395975091939597565b60008054905090565b6000838514801561179a57508285145b156117a8576001905061185a565b600084905060008490506000869050600086905060008090505b86811015611827578983146117eb57829450600360008481526020019081526020016000205492505b89821461180c57819350600360008381526020019081526020016000205491505b6118206001826136a390919063ffffffff16565b90506117c2565b508284141561183d57600094505050505061185a565b80821461185157600094505050505061185a565b60019450505050505b949350505050565b60008083905060008090505b838110156118a757600360008381526020019081526020016000205491506118a06001826136a390919063ffffffff16565b905061186e565b506000801b811415611921576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f556e6b6e6f776e20616e636573746f720000000000000000000000000000000081525060200191505060405180910390fd5b8091505092915050565b60008060009050600083905060008090505b600160040163ffffffff168110156119c15760046000838152602001908152602001600020549250600083141561198957600360008381526020019081526020016000205491506119a6565b61199c81846136a390919063ffffffff16565b9350505050611a30565b6119ba6001826136a390919063ffffffff16565b905061193d565b506040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f556e6b6e6f776e20626c6f636b0000000000000000000000000000000000000081525060200191505060405180910390fd5b919050565b6000806060600080611a46886128e7565b90506000611a69611a64600060508b6137299092919063ffffffff16565b6137e7565b90506000611a768361192b565b90508780611a8b575081611a898b6137e7565b145b611ae0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180614aaf6024913960400191505060405180910390fd5b600060508a5181611aed57fe5b0614611b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180614992602b913960400191505060405180910390fd5b60008090505b60508a5181611b5557fe5b04811015611dbc57611b86611b7460508361385590919063ffffffff16565b60508c6137299092919063ffffffff16565b9550611b9e60018201836136a390919063ffffffff16565b9650611ba9866128e7565b94506000801b60036000878152602001908152602001600020541415611cb95782611bfa611bf587604051602001808281526020019150506040516020818303038152906040526138f5565b6139ad565b1115611c6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f48656164657220776f726b20697320696e73756666696369656e74000000000081525060200191505060405180910390fd5b8360036000878152602001908152602001600020819055506000600463ffffffff168881611c9857fe5b061415611cb8578660046000878152602001908152602001600020819055505b5b82611cc3876137e7565b14611d36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f546172676574206368616e67656420756e65787065637465646c79000000000081525060200191505060405180910390fd5b611d498487613a0590919063ffffffff16565b611d9e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061496c6026913960400191505060405180910390fd5b849350611db56001826136a390919063ffffffff16565b9050611b4a565b5083611dc78b6128e7565b7ff90e4f1d9cd0dd55e339411cbc9b152482307c3a23ed64715e4a2858f641a3f560405160405180910390a3600196505050505050509392505050565b600080611e10846128e7565b90506000611e1d866128e7565b90506001548114611e96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f50617373656420696e2062657374206973206e6f742062657374206b6e6f776e81525060200191505060405180910390fd5b6000801b60036000848152602001908152602001600020541415611f22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4e6577206265737420697320756e6b6e6f776e0000000000000000000000000081525060200191505060405180910390fd5b611f3087600154848761178a565b611f85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180614afa6029913960400191505060405180910390fd5b81611f91888888613453565b14611fe7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180614a4c6033913960400191505060405180910390fd5b8160018190555086600281905550600061200086613a38565b9050600554811461201357806005819055505b8783837f26300f292d9603532a1503495d83156db6cb60433e0802cd3b8763b57f1d14d260405160405180910390a460019350505050949350505050565b600080612065612060866128e7565b61192b565b9050600061207a612075866128e7565b61192b565b90506107df6107e0828161208a57fe5b06146120e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d8152602001806149e5603d913960400191505060405180910390fd5b6120f66107df836136a390919063ffffffff16565b811461214d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806149bd6028913960400191505060405180910390fd5b61215685613a38565b61215f87613a38565b146121b5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180614ad36027913960400191505060405180910390fd5b60606121ce60006050876137299092919063ffffffff16565b905060006121db826137e7565b9050600061220e6121eb8a6137e7565b6121f48b613a52565b63ffffffff166122038b613a52565b63ffffffff16613a74565b90508181831614612287576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e76616c69642072657461726765742070726f76696465640000000000000081525060200191505060405180910390fd5b60006122928a613a38565b905080600654141580156122c357506122c06107e06122b260015461192b565b613b5e90919063ffffffff16565b85115b156122d057806006819055505b6122dc89896001611a35565b96505050505050509392505050565b600080600954905060016009540160098190555060008851905060248114806123145750600081145b612386576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4e6f7420612076616c6964205554584f0000000000000000000000000000000081525060200191505060405180910390fd5b6000885190506000811180156123bc575060018103896000815181106123a857fe5b602001015160f81c60f81b60f81c60ff1614155b15612446578089604051602001808360ff1660ff1660f81b815260010182805190602001908083835b6020831061240857805182526020820191506020810190506020830392506123e5565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405298506001810190505b6060600060c01b8a604051602001808377ffffffffffffffffffffffffffffffffffffffffffffffff191677ffffffffffffffffffffffffffffffffffffffffffffffff1916815260080182805190602001908083835b602083106124c0578051825260208201915060208101905060208303925061249d565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050600082148061250f5750600061250c82613be1565b51115b806125235750600061252082613eaf565b51115b612595576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4e6f742061207374616e64617264206f7574707574207479706500000000000081525060200191505060405180910390fd5b60008311806125a45750600082115b612616576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4e6f20726571756573742073706563696669656400000000000000000000000081525060200191505060405180910390fd5b6000600860008681526020019081526020016000209050338160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600084111561268a578b8051906020012081600001819055505b60008311156126a4578a8051906020012081600101819055505b60008a67ffffffffffffffff1611156126e357898160030160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b60008860ff161180156126f9575060f18860ff16105b1561271c578781600301601c6101000a81548160ff021916908360ff1602179055505b600087111561272f578681600201819055505b888160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018160040160146101000a81548160ff0219169083600281111561279357fe5b0217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6744579059b48cd66d2c2dfe223754f166f2200b6de2bc6e0d239cd52d1a8c48c8f8f604051808467ffffffffffffffff1667ffffffffffffffff1681526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015612832578082015181840152602081019050612817565b50505050905090810190601f16801561285f5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561289857808201518184015260208101905061287d565b50505050905090810190601f1680156128c55780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a384955050505050509695505050505050565b6000612a69600280846040518082805190602001908083835b602083106129235780518252602082019150602081019050602083039250612900565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015612965573d6000803e3d6000fd5b5050506040513d602081101561297a57600080fd5b8101908080519060200190929190505050604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b602083106129dd57805182526020820191506020810190506020830392506129ba565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015612a1f573d6000803e3d6000fd5b5050506040513d6020811015612a3457600080fd5b810190808051906020019092919050505060405160200180828152602001915050604051602081830303815290604052613f5c565b9050919050565b6000612a8e83612a87612a8289613f87565b613f5c565b8787613fa7565b612b00576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f42616420696e636c7573696f6e2070726f6f660000000000000000000000000081525060200191505060405180910390fd5b6000612b0b876128e7565b90506000612b17611697565b9050612b25828260f061363d565b612b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f47434420646f6573206e6f7420636f6e6669726d20686561646572000000000081525060200191505060405180910390fd5b600060086000868152602001908152602001600020600301601c9054906101000a900460ff1690508060ff16612bcc84614071565b60ff161015612c43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e73756666696369656e7420636f6e6669726d6174696f6e7300000000000081525060200191505060405180910390fd5b6001935050505095945050505050565b6000612c5e8461408f565b612cd0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f56696e206973206d616c666f726d61747465640000000000000000000000000081525060200191505060405180910390fd5b612cd98361415a565b612d4b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f566f7574206973206d616c666f726d617474656400000000000000000000000081525060200191505060405180910390fd5b600060088661ffff16901c9050600060ff8716905060006008600086815260200190815260200160002090504281600201541115612df1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f52657175657374206973207375626d697474656420746f6f206561726c79000081525060200191505060405180910390fd5b60016002811115612dfe57fe5b8160040160149054906101000a900460ff166002811115612e1b57fe5b14612e8e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f52657175657374206973206e6f7420616374697665000000000000000000000081525060200191505060405180910390fd5b60008160010154905060008060001b82141590508015613045576060612ebd858a61422590919063ffffffff16565b90506000612eca826142c2565b600081518110612ed657fe5b602001015160f81c60f81b60f81c905083612f0360086001840160ff16856137299092919063ffffffff16565b8051906020012014612f7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f446f6573206e6f74206d6174636820706179732072657175657374000000000081525060200191505060405180910390fd5b60008560030160149054906101000a900467ffffffffffffffff16905060008167ffffffffffffffff161480612fcf57508067ffffffffffffffff16612fc2846142e2565b67ffffffffffffffff1610155b613041576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f446f6573206e6f74206d617463682076616c756520726571756573740000000081525060200191505060405180910390fd5b5050505b60008360000154905060008060001b82141590508015613105576060613074888d61431090919063ffffffff16565b9050811580613091575082613088826143ad565b80519060200120145b613103576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f446f6573206e6f74206d61746368207370656e6473207265717565737400000081525060200191505060405180910390fd5b505b6001975050505050505050949350505050565b60008060086000848152602001908152602001600020905060008160030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060088861ffff16901c9050600060ff891690508273ffffffffffffffffffffffffffffffffffffffff16600b548473ffffffffffffffffffffffffffffffffffffffff16630140356d905060e01b8c8b8b8b88886040516020018087815260200180602001806020018681526020018560ff1660ff1681526020018460ff1660ff168152602001838103835288818151815260200191508051906020019080838360005b8381101561321a5780820151818401526020810190506131ff565b50505050905090810190601f1680156132475780820380516001836020036101000a031916815260200191505b50838103825287818151815260200191508051906020019080838360005b83811015613280578082015181840152602081019050613265565b50505050905090810190601f1680156132ad5780820380516001836020036101000a031916815260200191505b509850505050505050505060405160208183030381529060405260405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310613341578051825260208201915060208101905060208303925061331e565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083106133a95780518252602082019150602081019050602083039250613386565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d806000811461340c576040519150601f19603f3d011682016040523d82523d6000602084013e613411565b606091505b505050858a7f97b6ce150a3b8e94c442fb09fe13c2b262f0e9b3bfc83ef2309675e09dcb453b60405160405180910390a3600194505050505095945050505050565b60008061345f8561192b565b9050600061347461346f866128e7565b61192b565b90506000613489613484866128e7565b61192b565b905082821015801561349b5750828110155b6134f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614a7f6030913960400191505060405180910390fd5b60006135246107e0858161350057fe5b066135166107e0876136a390919063ffffffff16565b613b5e90919063ffffffff16565b905060008184109050600082841090508115801561353f5750805b1561355a5761354d896128e7565b9650505050505050613636565b818015613565575080155b1561358057613573886128e7565b9650505050505050613636565b81801561358a5750805b156135bc57838510156135a5576135a0886128e7565b6135af565b6135ae896128e7565b5b9650505050505050613636565b6135e26135c889613a38565b6107e086816135d357fe5b0661385590919063ffffffff16565b6136086135ee8b613a38565b6107e088816135f957fe5b0661385590919063ffffffff16565b101561362457613617886128e7565b9650505050505050613636565b61362d896128e7565b96505050505050505b9392505050565b60008083905060008090505b8381101561369557858214156136645760019250505061369c565b6003600083815260200190815260200160002054915061368e6001826136a390919063ffffffff16565b9050613649565b5060009150505b9392505050565b6000818301905082811015613720576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4f766572666c6f7720647572696e67206164646974696f6e2e0000000000000081525060200191505060405180910390fd5b80905092915050565b6060818301845110156137a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536c696365206f7574206f6620626f756e64730000000000000000000000000081525060200191505060405180910390fd5b604051905081604082010160405281815282840181038360208601018381015b808210156137dd578151838301526020820191506137c4565b5050509392505050565b6000606061380260486003856137299092919063ffffffff16565b9050600083604b8151811061381357fe5b602001015160f81c60f81b60f81c90506000613836613831846138f5565b6139ad565b905060006003830360ff169050806101000a8202945050505050919050565b60008083141561386857600090506138ef565b81830290508183828161387757fe5b04146138eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4f766572666c6f7720647572696e67206d756c7469706c69636174696f6e2e0081525060200191505060405180910390fd5b8090505b92915050565b60608082516040519080825280601f01601f19166020018201604052801561392c5781602001600182028038833980820191505090505b50905060008090505b83518110156139a35783818151811061394a57fe5b602001015160f81c60f81b82600183875103038151811061396757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050613935565b5080915050919050565b60008060008090505b83518110156139fb576001810184510360080260020a8482815181106139d857fe5b602001015160f81c60f81b60f81c60ff16028201915080806001019150506139b6565b5080915050919050565b600080613a19613a14856143cd565b613f5c565b9050828114613a2c576000915050613a32565b60019150505b92915050565b6000613a4b613a46836137e7565b6143ed565b9050919050565b6000613a6d613a68613a6384614425565b6138f5565b6139ad565b9050919050565b600080613a8a8484613b5e90919063ffffffff16565b9050613aa360046212750061444590919063ffffffff16565b811015613ac457613ac160046212750061444590919063ffffffff16565b90505b613adb60046212750061385590919063ffffffff16565b811115613afc57613af960046212750061385590919063ffffffff16565b90505b6000613b2682613b18620100008961444590919063ffffffff16565b61385590919063ffffffff16565b9050613b5362010000613b45621275008461444590919063ffffffff16565b61385590919063ffffffff16565b925050509392505050565b600082821115613bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f556e646572666c6f7720647572696e67207375627472616374696f6e2e00000081525060200191505060405180910390fd5b818303905092915050565b60606000613bfc60096001856137299092919063ffffffff16565b600081518110613c0857fe5b602001015160f81c60f81b60f81c60ff161415613cbf5760006002613c2c846142c2565b600081518110613c3857fe5b602001015160f81c60f81b60f81c0360ff1690508060ff16613c67600a6001866137299092919063ffffffff16565b600081518110613c7357fe5b602001015160f81c60f81b60f81c60ff1614613ca15760405180602001604052806000815250915050613eaa565b613cb7600b82856137299092919063ffffffff16565b915050613eaa565b6000613cd860086003856144599092919063ffffffff16565b905060405180807f1976a9000000000000000000000000000000000000000000000000000000000081525060030190506040518091039020811415613de4576014613d30600b6001866137299092919063ffffffff16565b600081518110613d3c57fe5b602001015160f81c60f81b60f81c60ff16141580613da8575060405180807f88ac00000000000000000000000000000000000000000000000000000000000081525060020190506040518091039020613da560028551036002866144599092919063ffffffff16565b14155b15613dc55760405180602001604052806000815250915050613eaa565b613ddc600c6014856137299092919063ffffffff16565b915050613eaa565b60405180807f17a914000000000000000000000000000000000000000000000000000000000081525060030190506040518091039020811415613e96576087613e3d60018551036001866137299092919063ffffffff16565b600081518110613e4957fe5b602001015160f81c60f81b60f81c60ff1614613e775760405180602001604052806000815250915050613eaa565b613e8e600b6014856137299092919063ffffffff16565b915050613eaa565b506040518060200160405280600081525090505b919050565b606060405180807f6a0000000000000000000000000000000000000000000000000000000000000081525060010190506040518091039020613efe60096001856144599092919063ffffffff16565b14613f1a57604051806020016040528060008152509050613f57565b6060613f33600a6001856137299092919063ffffffff16565b9050613f53600b613f43836139ad565b856137299092919063ffffffff16565b9150505b919050565b60006060829050600081511415613f79576000801b915050613f82565b60208301519150505b919050565b6060613fa060246020846137299092919063ffffffff16565b9050919050565b60008385148015613fb85750600082145b8015613fc5575060008351145b15613fd35760019050614069565b60608584866040516020018084815260200183805190602001908083835b602083106140145780518252602082019150602081019050602083039250613ff1565b6001836020036101000a0380198251168184511680821785525050505050509050018281526020019350505050604051602081830303815290604052905061406583826144e590919063ffffffff16565b9150505b949350505050565b600061407c8261192b565b61408760015461192b565b039050919050565b6000806001905060006140af60006001866137299092919063ffffffff16565b6000815181106140bb57fe5b602001015160f81c60f81b60f81c905060fd8160ff161015806140e1575060008160ff16145b156140f157600092505050614155565b60008090505b8160ff168160ff16101561414b576141256141208485885103886137299092919063ffffffff16565b61465f565b83019250845183111561413e5760009350505050614155565b80806001019150506140f7565b5083518214925050505b919050565b60008060019050600061417a60006001866137299092919063ffffffff16565b60008151811061418657fe5b602001015160f81c60f81b60f81c905060fd8160ff161015806141ac575060008160ff16145b156141bc57600092505050614220565b60008090505b8160ff168160ff161015614216576141f06141eb8485885103886137299092919063ffffffff16565b61468a565b8301925084518311156142095760009350505050614220565b80806001019150506141c2565b5083518214925050505b919050565b60606000606060006001905060008090505b8560ff168160ff16101561427c5761425d8283895103896137299092919063ffffffff16565b92506142688361468a565b935083820191508080600101915050614237565b506142958182885103886137299092919063ffffffff16565b91506142a08261468a565b92506142b78184886137299092919063ffffffff16565b935050505092915050565b60606142db60086001846137299092919063ffffffff16565b9050919050565b600060606142ef8361474b565b905060606142fc826138f5565b9050614307816139ad565b92505050919050565b60606000606060006001905060008090505b8560ff168160ff161015614367576143488283895103896137299092919063ffffffff16565b92506143538361465f565b935083820191508080600101915050614322565b506143808182885103886137299092919063ffffffff16565b915061438b8261465f565b92506143a28184886137299092919063ffffffff16565b935050505092915050565b60606143c660006024846137299092919063ffffffff16565b9050919050565b60606143e660046020846137299092919063ffffffff16565b9050919050565b600061441e827bffff000000000000000000000000000000000000000000000000000061444590919063ffffffff16565b9050919050565b606061443e60446004846137299092919063ffffffff16565b9050919050565b600081838161445057fe5b04905092915050565b6000818301845110156144d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536c696365206f7574206f6620626f756e64730000000000000000000000000081525060200191505060405180910390fd5b818360208601012090509392505050565b60008060208451816144f357fe5b06146145025760009050614659565b6020835114156145155760019050614659565b6040835114156145285760009050614659565b6000829050600061455161454c60208751036020886137299092919063ffffffff16565b613f5c565b9050600061457461456f60006020896137299092919063ffffffff16565b613f5c565b90506000600190505b60016145946020895161444590919063ffffffff16565b0381101561464f576001600285816145a857fe5b0614156145f7576145f06145cb6020830260208a6137299092919063ffffffff16565b836040516020018082815260200191505060405160208183030381529060405261476b565b915061463b565b61463882604051602001808281526020019150506040516020818303038152906040526146336020840260208b6137299092919063ffffffff16565b61476b565b91505b600184901c9350808060010191505061457d565b5081811493505050505b92915050565b600080600061466d8461483b565b80925081935050506004818360250160ff16010192505050919050565b6000806146a460086001856137299092919063ffffffff16565b6000815181106146b057fe5b602001015160f81c60f81b60f81c905060fd8160ff1610614739576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4d756c74692d6279746520566172496e7473206e6f7420737570706f7274656481525060200191505060405180910390fd5b6001600882010160ff16915050919050565b606061476460006008846137299092919063ffffffff16565b9050919050565b600061483383836040516020018083805190602001908083835b602083106147a85780518252602082019150602081019050602083039250614785565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083106147f957805182526020820191506020810190506020830392506147d6565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526128e7565b905092915050565b600080606061485760246001866137299092919063ffffffff16565b90506000614864826148d2565b90506000808260ff161415614898578260008151811061488057fe5b602001015160f81c60f81b60f81c60ff1690506148c4565b6148c16148bc6148b760258560ff168a6137299092919063ffffffff16565b6138f5565b6139ad565b90505b818194509450505050915091565b600060ff826000815181106148e357fe5b602001015160f81c60f81b60f81c60ff1614156149035760089050614966565b60fe8260008151811061491257fe5b602001015160f81c60f81b60f81c60ff1614156149325760049050614966565b60fd8260008151811061494157fe5b602001015160f81c60f81b60f81c60ff1614156149615760029050614966565b600090505b91905056fe4865616465727320646f206e6f7420666f726d206120636f6e73697374656e7420636861696e486561646572206172726179206c656e677468206d75737420626520646976697369626c652062792038304d7573742070726f766964652065786163746c79203120646966666963756c747920706572696f644d7573742070726f7669646520746865206c61737420686561646572206f662074686520636c6f73696e6720646966666963756c747920706572696f6443616e206f6e6c792062652063616e63656c6c6564206279206f776e6572206f7220636f6e73756d65724e65772062657374206861736820646f6573206e6f742068617665206d6f726520776f726b207468616e2070726576696f7573412064657363656e64616e74206865696768742069732062656c6f772074686520616e636573746f7220686569676874556e6578706563746564207265746172676574206f6e2065787465726e616c2063616c6c506572696f642068656164657220646966666963756c7469657320646f206e6f74206d61746368416e636573746f72206d75737420626520686561766965737420636f6d6d6f6e20616e636573746f72a265627a7a72315820ed4a052c2505eaf6cd829e5de44121a4426b7b0673201deb84e0e73fb86c726364736f6c63430005110032
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000099cef459ec50d4ea62a89da04eb1ef3e352ec740bca50e8a8080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000e0ff279ba72c6a3f1e81e62004f991dc12b5af3d9758c18406030000000000000000000f3a570c00a29620ed5017e1225effa1a4be5c47f549abd84200cb553d1175f42ba6b95e397a1117cf8dfb8300000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _genesisHeader (bytes): 0x00e0ff279ba72c6a3f1e81e62004f991dc12b5af3d9758c18406030000000000000000000f3a570c00a29620ed5017e1225effa1a4be5c47f549abd84200cb553d1175f42ba6b95e397a1117cf8dfb83
Arg [1] : _height (uint256): 629999
Arg [2] : _periodStart (bytes32): 0x459ec50d4ea62a89da04eb1ef3e352ec740bca50e8a808000000000000000000
Arg [3] : _firstID (uint256): 0
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 0000000000000000000000000000000000000000000000000000000000099cef
Arg [2] : 459ec50d4ea62a89da04eb1ef3e352ec740bca50e8a808000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000050
Arg [5] : 00e0ff279ba72c6a3f1e81e62004f991dc12b5af3d9758c18406030000000000
Arg [6] : 000000000f3a570c00a29620ed5017e1225effa1a4be5c47f549abd84200cb55
Arg [7] : 3d1175f42ba6b95e397a1117cf8dfb8300000000000000000000000000000000
Deployed Bytecode Sourcemap
504:14057:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21954:107:6;;8:9:-1;5:2;;;30:1;27;20:12;5:2;21954:107:6;;;:::i;:::-;;;;;;;;;;;;;;;;;;;22778:99;;8:9:-1;5:2;;;30:1;27;20:12;5:2;22778:99:6;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1155:21:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1155:21:5;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1182:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1182:32:5;;;:::i;:::-;;;;;;;;;;;;;;;;;;;22241:101:6;;8:9:-1;5:2;;;30:1;27;20:12;5:2;22241:101:6;;;:::i;:::-;;;;;;;;;;;;;;;;;;;18722:242;;8:9:-1;5:2;;;30:1;27;20:12;5:2;18722:242:6;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;18722:242:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;12362:143;;8:9:-1;5:2;;;30:1;27;20:12;5:2;12362:143:6;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;12362:143:6;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2246:431:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2246:431:5;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2246:431:5;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;11398:113:6;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11398:113:6;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;11398:113:6;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;6901:154;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6901:154:6;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;6901:154:6;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;6901:154:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;6901:154:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;6901:154:6;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;6901:154:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;6901:154:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;6901:154:6;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;2272:42;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2272:42:6;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;16407:259;;8:9:-1;5:2;;;30:1;27;20:12;5:2;16407:259:6;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;16407:259:6;;;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;16407:259:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;16407:259:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;16407:259:6;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;16407:259:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;16407:259:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;16407:259:6;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;7611:286;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7611:286:6;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;7611:286:6;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;7611:286:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;7611:286:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;7611:286:6;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;7611:286:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;7611:286:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;7611:286:6;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;7611:286:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;7611:286:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;7611:286:6;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;4402:313:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4402:313:5;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;4402:313:5;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;4402:313:5;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;4402:313:5;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;4402:313:5;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;4402:313:5;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;4402:313:5;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;4402:313:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1090:48;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1090:48:5;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1220:42;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1220:42:5;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2683:105;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2683:105:5;;;:::i;:::-;;;;;;;;;;;;;;;;;;;8331:973;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8331:973:5;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;8331:973:5;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;8331:973:5;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;8331:973:5;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;8331:973:5;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;8331:973:5;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;8331:973:5;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;8331:973:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;8331:973:5;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;8331:973:5;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;8331:973:5;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;8331:973:5;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;8331:973:5;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;8331:973:5;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;21538:227:6;;8:9:-1;5:2;;;30:1;27;20:12;5:2;21538:227:6;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;21538:227:6;;;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;21538:227:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;21538:227:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;21538:227:6;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;21538:227:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;21538:227:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;21538:227:6;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;13853:172;;8:9:-1;5:2;;;30:1;27;20:12;5:2;13853:172:6;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;13853:172:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;23071:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23071:115:6;;;:::i;:::-;;;;;;;;;;;;;;;;;;;3040:600:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3040:600:5;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3040:600:5;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22509:93:6;;8:9:-1;5:2;;;30:1;27;20:12;5:2;22509:93:6;;;:::i;:::-;;;;;;;;;;;;;;;;;;;21954:107;22014:7;22038:16;;22031:23;;21954:107;:::o;22778:99::-;22829:7;22855:15;;22848:22;;22778:99;:::o;1155:21:5:-;;;;:::o;1182:32::-;;;;:::o;22241:101:6:-;22298:7;22322:13;;22315:20;;22241:101;:::o;18722:242::-;18879:4;18902:55;18924:9;18935:5;18942:6;18950;18902:21;:55::i;:::-;18895:62;;18722:242;;;;;;:::o;12362:143::-;12441:7;12467:31;12481:7;12490;12467:13;:31::i;:::-;12460:38;;12362:143;;;;:::o;2246:431:5:-;2307:4;2323:25;2351:8;:20;2360:10;2351:20;;;;;;;;;;;2323:48;;2403:20;2389:34;;;;;;;;:4;:10;;;;;;;;;;;;:34;;;;;;;;;2381:65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2478:4;:13;;;;;;;;;;;;2464:27;;:10;:27;;;:55;;;;2509:4;:10;;;;;;;;;;;;2495:24;;:10;:24;;;2464:55;2456:110;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2589:20;2576:4;:10;;;:33;;;;;;;;;;;;;;;;;;;;;;;;2638:10;2624:25;;;;;;;;;;2666:4;2659:11;;;2246:431;;;:::o;11398:113:6:-;11458:7;11484:20;11496:7;11484:11;:20::i;:::-;11477:27;;11398:113;;;:::o;6901:154::-;6988:4;7011:37;7023:7;;7011:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;7011:37:6;;;;;;7032:8;;7011:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;7011:37:6;;;;;;7042:5;7011:11;:37::i;:::-;7004:44;;6901:154;;;;;;:::o;2272:42::-;2313:1;2272:42;:::o;16407:259::-;16577:4;16600:59;16617:9;16628:12;;16600:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;16600:59:6;;;;;;16642:8;;16600:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;16600:59:6;;;;;;16652:6;16600:16;:59::i;:::-;16593:66;;16407:259;;;;;;;;:::o;7611:286::-;7790:4;7813:77;7837:21;;7813:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;7813:77:6;;;;;;7860:19;;7813:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;7813:77:6;;;;;;7881:8;;7813:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;7813:77:6;;;;;;:23;:77::i;:::-;7806:84;;7611:286;;;;;;;;:::o;4402:313:5:-;4612:7;4638:70;4647:7;;4638:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;4638:70:5;;;;;;4656:5;;4638:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;4638:70:5;;;;;;4663:10;4675:9;4686;4697:10;4638:8;:70::i;:::-;4631:77;;4402:313;;;;;;;;;;:::o;1090:48::-;1126:12;1090:48;:::o;1220:42::-;;;;:::o;2683:105::-;2738:7;2764:17;;2757:24;;2683:105;:::o;8331:973::-;8630:4;8646:13;8662:60;8679:8;8689:4;;8695:5;;8702:9;8662:50;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;57:3;49:6;45:16;35:26;;8662:50:5;;;;30:3:-1;22:6;14;1:33;57:3;49:6;45:16;35:26;;8662:50:5;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;8662:50:5;;;:58;:60::i;:::-;8646:76;;8880:13;:20;8894:5;8880:20;;;;;;;;;;;;;;;;;;;;;8875:272;;8916:140;8949:7;;8916:140;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;8916:140:5;;;;;;8974:6;;8916:140;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;8916:140:5;;;;;;8998:6;9022:5;9045:10;8916:15;:140::i;:::-;;9093:4;9070:13;:20;9084:5;9070:20;;;;;;;;;;;;:27;;;;;;;;;;;;;;;;;;9131:5;9111:17;:25;;;;8875:272;9156:52;9171:11;9184:4;;9156:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;9156:52:5;;;;;;9190:5;;9156:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;9156:52:5;;;;;;9197:10;9156:14;:52::i;:::-;;9218:58;9232:5;9239:11;9252:4;;9218:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;9218:58:5;;;;;;9258:5;;9218:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;9218:58:5;;;;;;9265:10;9218:13;:58::i;:::-;;9293:4;9286:11;;;8331:973;;;;;;;;;;;;;;;:::o;21538:227:6:-;21685:7;21711:47;21733:9;21744:5;;21711:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;21711:47:6;;;;;;21751:6;;21711:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;21711:47:6;;;;;;:21;:47::i;:::-;21704:54;;21538:227;;;;;;;:::o;13853:172::-;13952:4;13975:43;13987:9;13998:11;14011:6;13975:11;:43::i;:::-;13968:50;;13853:172;;;;;:::o;23071:115::-;23130:7;23156:23;;23149:30;;23071:115;:::o;3040:600:5:-;3126:14;3150:12;3172:16;3198:11;3219:16;3245:13;3268:14;3292:17;3326:25;3354:8;:20;3363:10;3354:20;;;;;;;;;;;3326:48;;3393:4;:11;;;3384:20;;3421:4;:9;;;3414:16;;3452:4;:14;;;;;;;;;;;;3440:26;;3490:4;:10;;;;;;;;;;;;3484:17;;;;;;;;3476:25;;3522:4;:13;;;;;;;;;;;;3511:24;;3553:4;:10;;;;;;;;;;;;3545:18;;3584:4;:13;;;;;;;;;;;;3573:24;;3619:4;:14;;;3607:26;;3040:600;;;;;;;;;;:::o;22509:93:6:-;22557:7;22583:12;;22576:19;;22509:93;:::o;17153:1082::-;17311:4;17375:5;17362:9;:18;:41;;;;;17397:6;17384:9;:19;17362:41;17358:83;;;17426:4;17419:11;;;;17358:83;17451:20;17474:5;17451:28;;17489:21;17513:6;17489:30;;17529:17;17549:5;17529:25;;17564:18;17585:6;17564:27;;17606:9;17618:1;17606:13;;17602:413;17625:6;17621:1;:10;17602:413;;;17678:9;17665;:22;17661:163;;17722:9;17707:24;;17771:13;:24;17785:9;17771:24;;;;;;;;;;;;17759:36;;17661:163;17855:9;17841:10;:23;17837:168;;17900:10;17884:26;;17951:13;:25;17965:10;17951:25;;;;;;;;;;;;17938:38;;17837:168;17637:8;17643:1;17637;:5;;:8;;;;:::i;:::-;17633:12;;17602:413;;;;18044:13;18028:12;:29;18024:50;;;18067:5;18060:12;;;;;;;;18024:50;18149:10;18136:9;:23;18132:44;;18169:5;18162:12;;;;;;;;18132:44;18224:4;18217:11;;;;;;17153:1082;;;;;;;:::o;11770:333::-;11850:7;11869:16;11888:7;11869:26;;11910:9;11922:1;11910:13;;11905:106;11929:7;11925:1;:11;11905:106;;;11977:13;:23;11991:8;11977:23;;;;;;;;;;;;11966:34;;11942:8;11948:1;11942;:5;;:8;;;;:::i;:::-;11938:12;;11905:106;;;;12048:1;12040:10;;12028:8;:22;;12020:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12088:8;12081:15;;;11770:333;;;;:::o;10683:457::-;10744:7;10763:15;10781:1;10763:19;;10792:16;10811:7;10792:26;;10833:9;10845:1;10833:13;;10828:273;10870:1;2313;10852:19;10848:23;;:1;:23;10828:273;;;10911:11;:21;10923:8;10911:21;;;;;;;;;;;;10901:31;;10961:1;10950:7;:12;10946:145;;;10993:13;:23;11007:8;10993:23;;;;;;;;;;;;10982:34;;10946:145;;;11062:14;11074:1;11062:7;:11;;:14;;;;:::i;:::-;11055:21;;;;;;;10946:145;10877:8;10883:1;10877;:5;;:8;;;;:::i;:::-;10873:12;;10828:273;;;;11110:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10683:457;;;;:::o;4234:2282::-;4334:4;4350:15;4375:20;4405:22;4437:23;4463:17;:7;:15;:17::i;:::-;4437:43;;4491:15;4509:37;:21;4524:1;4527:2;4509:8;:14;;:21;;;;;:::i;:::-;:35;:37::i;:::-;4491:55;;4556:21;4580:28;4592:15;4580:11;:28::i;:::-;4556:52;;4669:9;:47;;;;4709:7;4682:23;:7;:21;:23::i;:::-;:34;4669:47;4648:121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4811:1;4805:2;4787:8;:15;:20;;;;;;:25;4779:81;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5115:9;5127:1;5115:13;;5110:1294;5152:2;5134:8;:15;:20;;;;;;5130:1;:24;5110:1294;;;5194:29;5209:9;5215:2;5209:1;:5;;:9;;;;:::i;:::-;5220:2;5194:8;:14;;:29;;;;;:::i;:::-;5184:39;;5247:24;5269:1;5265;:5;5247:13;:17;;:24;;;;:::i;:::-;5237:34;;5302:17;:7;:15;:17::i;:::-;5285:34;;5561:1;5553:10;;5520:13;:29;5534:14;5520:29;;;;;;;;;;;;:43;5516:560;;;5682:7;5612:66;:52;5629:14;5612:32;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;5612:32:6;;;:50;:52::i;:::-;:64;:66::i;:::-;:77;;5583:158;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5791:15;5759:13;:29;5773:14;5759:29;;;;;;;;;;;:47;;;;5857:1;2313;5828:25;;:7;:25;;;;;;:30;5824:238;;;6036:7;6006:11;:27;6018:14;6006:27;;;;;;;;;;;:37;;;;5824:238;5516:560;6195:7;6168:23;:7;:21;:23::i;:::-;:34;6160:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6256:47;6287:15;6256:7;:30;;:47;;;;:::i;:::-;6248:98;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6379:14;6361:32;;5160:8;5166:1;5160;:5;;:8;;;;:::i;:::-;5156:12;;5110:1294;;;;6473:14;6442:17;:7;:15;:17::i;:::-;6419:69;;;;;;;;;;6505:4;6498:11;;;;;;;;4234:2282;;;;;:::o;14618:1196::-;14785:4;14801:22;14826:18;:8;:16;:18::i;:::-;14801:43;;14854:26;14883:22;:12;:20;:22::i;:::-;14854:51;;14945:15;;14923:18;:37;14915:82;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15069:1;15061:10;;15028:13;:29;15042:14;15028:29;;;;;;;;;;;;:43;;15007:100;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15138:73;15160:9;15171:15;;15188:14;15204:6;15138:21;:73::i;:::-;15117:152;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15360:14;15300:56;15322:9;15333:12;15347:8;15300:21;:56::i;:::-;:74;15279:163;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15471:14;15453:15;:32;;;;15521:9;15495:23;:35;;;;15541:16;15560:28;:8;:26;:28::i;:::-;15541:47;;15614:16;;15602:8;:28;15598:84;;15663:8;15644:16;:27;;;;15598:84;15776:9;15748:14;15716:18;15697:89;;;;;;;;;;15803:4;15796:11;;;;;14618:1196;;;;;;:::o;8453:1993::-;8627:4;8697:20;8720:44;8732:31;:21;:29;:31::i;:::-;8720:11;:44::i;:::-;8697:67;;8774:18;8795:42;8807:29;:19;:27;:29::i;:::-;8795:11;:42::i;:::-;8774:63;;8956:4;8948;8935:10;:17;;;;;;:25;8914:124;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9083:22;9100:4;9083:12;:16;;:22;;;;:::i;:::-;9069:10;:36;9048:114;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9238:39;:19;:37;:39::i;:::-;9193:41;:21;:39;:41::i;:::-;:84;9172:161;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9438:28;9469:21;9484:1;9487:2;9469:8;:14;;:21;;;;;:::i;:::-;9438:52;;9500:21;9524:31;:15;:29;:31::i;:::-;9500:55;;9565:23;9591:193;9631:37;:21;:35;:37::i;:::-;9682:40;:21;:38;:40::i;:::-;9591:193;;9736:38;:19;:36;:38::i;:::-;9591:193;;:26;:193::i;:::-;9565:219;;9852:13;9832:15;9816:13;:31;9815:50;9794:113;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10117:16;10136:41;:21;:39;:41::i;:::-;10117:60;;10208:8;10191:13;;:25;;:80;;;;;10233:38;10266:4;10233:28;10245:15;;10233:11;:28::i;:::-;:32;;:38;;;;:::i;:::-;10220:10;:51;10191:80;10187:133;;;10301:8;10285:13;:24;;;;10187:133;10391:48;10403:19;10424:8;10434:4;10391:11;:48::i;:::-;10384:55;;;;;;;;8453:1993;;;;;:::o;5476:1914:5:-;5683:7;5702:18;5723:6;;5702:27;;5757:1;5748:6;;:10;5739:6;:19;;;;5769:18;5790:7;:14;5769:35;;5836:2;5822:10;:16;:35;;;;5856:1;5842:10;:15;5822:35;5814:64;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5972:16;5991:5;:12;5972:31;;6086:1;6075:8;:12;:47;;;;;6121:1;6110:8;:12;6097:5;6103:1;6097:8;;;;;;;;;;;;;;;;6091:15;;:31;;;;6075:47;6071:200;;;6169:8;6180:5;6146:40;;;;;;;;;;;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;6146:40:5;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;6146:40:5;;;6138:48;;6212:1;6200:13;;;;6071:200;6281:15;6323:1;6316:9;;6327:5;6299:34;;;;;;;;;;;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;6299:34:5;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;6299:34:5;;;6281:52;;6376:1;6364:8;:13;:74;;;;6437:1;6411:16;:2;:14;:16::i;:::-;:23;:27;6364:74;:147;;;;6510:1;6476:24;:2;:22;:24::i;:::-;:31;:35;6364:147;6343:231;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6606:1;6593:10;:14;:30;;;;6622:1;6611:8;:12;6593:30;6585:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6659:25;6687:8;:20;6696:10;6687:20;;;;;;;;;;;6659:48;;6730:10;6717:4;:10;;;:23;;;;;;;;;;;;;;;;;;6768:1;6755:10;:14;6751:77;;;6809:7;6799:18;;;;;;6785:4;:11;;:32;;;;6751:77;6852:1;6841:8;:12;6837:71;;;6891:5;6881:16;;;;;;6869:4;:9;;:28;;;;6837:71;6934:1;6921:10;:14;;;6917:72;;;6968:10;6951:4;:14;;;:27;;;;;;;;;;;;;;;;;;6917:72;7014:1;7002:9;:13;;;:32;;;;;7031:3;7019:9;:15;;;7002:32;6998:116;;;7094:9;7078:4;:13;;;:25;;;;;;;;;;;;;;;;;;6998:116;7140:1;7127:10;:14;7123:72;;;7174:10;7157:4;:14;;:27;;;;7123:72;7220:9;7204:4;:13;;;:25;;;;;;;;;;;;;;;;;;7252:20;7239:4;:10;;;:33;;;;;;;;;;;;;;;;;;;;;;;;7316:10;7304;7288:67;;;7328:10;7340:7;7349:5;7288:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;7288:67:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;7288:67:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7373:10;7366:17;;;;;;;5476:1914;;;;;;;;:::o;4750:156:0:-;4807:7;4833:66;4850:36;4874:10;4881:2;4874:10;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;4874:10:0;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4874:10:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4874:10:0;;;;;;;;;;;;;;;;4857:28;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;4857:28:0;;;4850:36;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;4850:36:0;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4850:36:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4850:36:0;;;;;;;;;;;;;;;;4833:54;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;4833:54:0;;;:64;:66::i;:::-;4826:73;;4750:156;;;:::o;11204:867:5:-;11392:4;11429:148;11464:5;11487:41;:29;:7;:27;:29::i;:::-;:39;:41::i;:::-;11546:6;11570;11429:17;:148::i;:::-;11408:205;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11624:19;11646:17;:7;:15;:17::i;:::-;11624:39;;11673:12;11688:28;:26;:28::i;:::-;11673:43;;11748:84;11777:11;11806:4;11828:3;11748:11;:84::i;:::-;11727:149;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11886:15;11904:8;:20;11913:10;11904:20;;;;;;;;;;;:29;;;;;;;;;;;;11886:47;;11990:9;11964:35;;:22;11974:11;11964:9;:22::i;:::-;:35;;;;11943:99;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12060:4;12053:11;;;;;11204:867;;;;;;;:::o;12943:1616::-;13108:4;13132:18;:4;:16;:18::i;:::-;13124:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13192:20;:5;:18;:20::i;:::-;13184:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13248:17;13289:1;13274:11;:16;;;;13248:43;;13301:18;13342:4;13328:11;:18;13301:46;;13358:25;13386:8;:20;13395:10;13386:20;;;;;;;;;;;13358:48;;13442:15;13424:4;:14;;;:33;;13416:76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13524:20;13510:34;;;;;;;;:4;:10;;;;;;;;;;;;:34;;;;;;;;;13502:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13581:13;13597:4;:9;;;13581:25;;13616:13;13649:1;13641:10;;13632:5;:19;;13616:35;;13665:8;13661:506;;;13689:17;13709:47;13742:12;13709:5;:26;;:47;;;;:::i;:::-;13689:67;;13770:10;13789:29;:4;:27;:29::i;:::-;13819:1;13789:32;;;;;;;;;;;;;;;;13783:39;;13770:52;;13899:5;13871:23;13882:1;13892;13885:4;:8;13871:23;;:4;:10;;:23;;;;;:::i;:::-;13861:34;;;;;;:43;13836:116;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13966:17;13986:4;:14;;;;;;;;;;;;13966:34;;14053:1;14039:10;:15;;;:68;;;;14097:10;14074:33;;:19;:4;:17;:19::i;:::-;:33;;;;14039:68;14014:142;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13661:506;;;;14177:15;14195:4;:11;;;14177:29;;14216:15;14253:1;14245:10;;14234:7;:21;;14216:39;;14269:10;14265:267;;;14295:16;14314:44;14345:11;14314:4;:24;;:44;;;;:::i;:::-;14295:63;;14398:10;14397:11;:74;;;;14464:7;14438:21;:3;:19;:21::i;:::-;14428:32;;;;;;:43;14397:74;14372:149;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14265:267;;14548:4;14541:11;;;;;;;;;12943:1616;;;;;;:::o;9735:892::-;9916:4;9932:25;9960:8;:20;9969:10;9960:20;;;;;;;;;;;9932:48;;9990:14;10020:4;:13;;;;;;;;;;;;9990:44;;10045:17;10086:1;10071:11;:16;;;;10045:43;;10098:18;10139:4;10125:11;:18;10098:46;;10346:1;10338:15;;10358:18;;10425:1;:5;;;:14;;;;10468:5;10475:4;10481:5;10488:10;10500:11;10513:12;10457:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;10457:69:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;10457:69:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;10457:69:5;;;10391:149;;;;;;;;;;;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;10391:149:5;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;10391:149:5;;;10338:212;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;10338:212:5;;;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;10338:212:5;;10587:10;10580:5;10566:32;;;;;;;;;;10616:4;10609:11;;;;;;9735:892;;;;;;;:::o;19367:1768:6:-;19511:7;19530:23;19556:22;19568:9;19556:11;:22::i;:::-;19530:48;;19588:19;19610:28;19622:15;:5;:13;:15::i;:::-;19610:11;:28::i;:::-;19588:50;;19648:20;19671:29;19683:16;:6;:14;:16::i;:::-;19671:11;:29::i;:::-;19648:52;;19747:15;19732:11;:30;;:65;;;;;19782:15;19766:12;:31;;19732:65;19711:151;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19970:30;20003:53;20051:4;20033:15;:22;;;;;;20003:25;20023:4;20003:15;:19;;:25;;;;:::i;:::-;:29;;:53;;;;:::i;:::-;19970:86;;20066:18;20101:22;20087:11;:36;20066:57;;20133:19;20170:22;20155:12;:37;20133:59;;20533:13;20532:14;:32;;;;;20550:14;20532:32;20528:63;;;20574:15;:5;:13;:15::i;:::-;20567:22;;;;;;;;;;20528:63;20604:13;:32;;;;;20622:14;20621:15;20604:32;20600:64;;;20646:16;:6;:14;:16::i;:::-;20639:23;;;;;;;;;;20600:64;20677:13;:31;;;;;20694:14;20677:31;20673:456;;;20746:12;20731:11;:27;;:64;;20779:16;:6;:14;:16::i;:::-;20731:64;;;20761:15;:5;:13;:15::i;:::-;20731:64;20724:71;;;;;;;;;;20673:456;20947:53;20973:26;:6;:24;:26::i;:::-;20963:4;20948:12;:19;;;;;;20947:25;;:53;;;;:::i;:::-;20876:51;20901:25;:5;:23;:25::i;:::-;20891:4;20877:11;:18;;;;;;20876:24;;:51;;;;:::i;:::-;20875:125;20871:248;;;21027:16;:6;:14;:16::i;:::-;21020:23;;;;;;;;;;20871:248;21089:15;:5;:13;:15::i;:::-;21082:22;;;;;;;;19367:1768;;;;;;:::o;12960:438::-;13060:4;13076:16;13095:11;13076:30;;13186:9;13198:1;13186:13;;13181:189;13205:6;13201:1;:10;13181:189;;;13257:9;13245:8;:21;13241:71;;;13293:4;13286:11;;;;;;13241:71;13336:13;:23;13350:8;13336:23;;;;;;;;;;;;13325:34;;13217:8;13223:1;13217;:5;;:8;;;;:::i;:::-;13213:12;;13181:189;;;;13386:5;13379:12;;;12960:438;;;;;;:::o;2520:172:2:-;2580:9;2610:2;2605;:7;2601:11;;2635:2;2630:1;:7;;2622:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2684:1;2677:8;;2520:172;;;;:::o;10345:819:1:-;10432:16;10495:7;10486:6;:16;10468:6;:13;:35;;10460:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10664:4;10658:11;10651:18;;10713:7;10708:2;10703:3;10699:12;10695:26;10689:4;10682:40;10747:7;10742:3;10735:20;10874:6;10866;10862:19;10857:3;10853:29;10950:6;10945:2;10937:6;10933:15;10929:28;10994:7;10989:3;10985:17;10896:252;11025:3;11020;11017:12;10896:252;;;11129:3;11123:10;11116:4;11111:3;11107:14;11100:34;11064:2;11059:3;11055:12;11048:19;;10896:252;;;10900:116;;10547:611;;;;;;:::o;20858:316:0:-;20926:7;20945:15;20963:20;20977:2;20981:1;20963:7;:13;;:20;;;;;:::i;:::-;20945:38;;20993:8;21010:7;21018:2;21010:11;;;;;;;;;;;;;;;;21004:18;;20993:29;;21032:17;21052:34;21064:21;21082:2;21064:17;:21::i;:::-;21052:11;:34::i;:::-;21032:54;;21096:14;21118:1;21113:2;:6;21096:23;;;;21157:9;21150:3;:16;21137:9;:30;21130:37;;;;;;20858:316;;;:::o;1317:456:2:-;1377:9;1625:1;1619:2;:7;1615:46;;;1649:1;1642:8;;;;1615:46;1680:2;1675;:7;1671:11;;1710:2;1704;1700:1;:6;;;;;;:12;1692:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1765:1;1758:8;;1317:456;;;;;:::o;1595:278:0:-;1662:12;1686:22;1721:2;:9;1711:20;;;;;;;;;;;;;;;;;;;;;;;;;29:1:-1;21:6;17:14;116:4;104:10;96:6;87:34;147:4;139:6;135:17;125:27;;0:156;1711:20:0;;;;1686:45;;1747:6;1756:1;1747:10;;1742:98;1763:2;:9;1759:1;:13;1742:98;;;1824:2;1827:1;1824:5;;;;;;;;;;;;;;;;1793:9;1819:1;1815;1803:2;:9;:13;:17;1793:28;;;;;;;;;;;:36;;;;;;;;;;;1774:3;;;;;;;1742:98;;;;1857:9;1850:16;;;1595:278;;;:::o;3429:268::-;3490:7;3509:15;3540:6;3549:1;3540:10;;3535:131;3556:2;:9;3552:1;:13;3535:131;;;3650:1;3646;:5;3633:2;:9;:19;3628:1;:25;3622:1;:32;3612:2;3615:1;3612:5;;;;;;;;;;;;;;;;3606:12;;:49;;;3596:7;:59;3586:69;;3567:3;;;;;;;3535:131;;;;3683:7;3676:14;;;3429:268;;;:::o;9306:391:3:-;9410:4;9473:17;9493:40;:28;:7;:26;:28::i;:::-;:38;:40::i;:::-;9473:60;;9635:17;9622:9;:30;9618:51;;9662:5;9655:12;;;;;9618:51;9686:4;9679:11;;;9306:391;;;;;:::o;23489:148:0:-;23561:7;23587:43;23607:22;23621:7;23607:13;:22::i;:::-;23587:19;:43::i;:::-;23580:50;;23489:148;;;:::o;23095:170::-;23166:6;23198:59;23210:46;23228:27;23247:7;23228:18;:27::i;:::-;23210:17;:46::i;:::-;23198:11;:59::i;:::-;23184:74;;23095:170;;;:::o;26130:920::-;26286:7;26305:20;26328:37;26349:15;26328:16;:20;;:37;;;;:::i;:::-;26305:60;;26464:22;26484:1;486:20;26464:19;;:22;;;;:::i;:::-;26449:12;:37;26445:105;;;26517:22;26537:1;486:20;26517:19;;:22;;;;:::i;:::-;26502:37;;26445:105;26578:22;26598:1;486:20;26578:19;;:22;;;;:::i;:::-;26563:12;:37;26559:105;;;26631:22;26651:1;486:20;26631:19;;:22;;;;:::i;:::-;26616:37;;26559:105;26921:17;26941:44;26972:12;26941:26;26961:5;26941:15;:19;;:26;;;;:::i;:::-;:30;;:44;;;;:::i;:::-;26921:64;;27002:41;27037:5;27002:30;486:20;27002:9;:13;;:30;;;;:::i;:::-;:34;;:41;;;;:::i;:::-;26995:48;;;;26130:920;;;;;:::o;2288:160:2:-;2348:7;2381:2;2375;:8;;2367:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2439:2;2434;:7;2427:14;;2288:160;;;;:::o;16208:1308:0:-;16274:12;16335:1;16308:19;16322:1;16325;16308:7;:13;;:19;;;;;:::i;:::-;16328:1;16308:22;;;;;;;;;;;;;;;;16302:29;;:34;;;16298:1118;;;16352:12;16411:1;16373:31;16396:7;16373:22;:31::i;:::-;16405:1;16373:34;;;;;;;;;;;;;;;;16367:41;;:45;16352:60;;;;16533:4;16493:45;;16499:20;16513:2;16517:1;16499:7;:13;;:20;;;;;:::i;:::-;16520:1;16499:23;;;;;;;;;;;;;;;;16493:30;;:45;;;16489:96;;16558:12;;;;;;;;;;;;;;;;;16489:96;16605:23;16619:2;16623:4;16605:7;:13;;:23;;;;;:::i;:::-;16598:30;;;;;16298:1118;16659:12;16674:28;16697:1;16700;16674:7;:22;;:28;;;;;:::i;:::-;16659:43;;16749:22;;;;;;;;;;;;;;;;;;;16741:4;:30;16737:669;;;16886:4;16858:20;16872:2;16876:1;16858:7;:13;;:20;;;;;:::i;:::-;16879:1;16858:23;;;;;;;;;;;;;;;;16852:30;;:38;;;;:131;;;;16963:20;;;;;;;;;;;;;;;;;;;16914:45;16954:1;16937:7;:14;:18;16957:1;16914:7;:22;;:45;;;;;:::i;:::-;:69;;16852:131;16848:190;;;17007:12;;;;;;;;;;;;;;;;;16848:190;17062:21;17076:2;17080;17062:7;:13;;:21;;;;;:::i;:::-;17055:28;;;;;16737:669;17135:22;;;;;;;;;;;;;;;;;;;17127:4;:30;17123:283;;;17287:4;17243:36;17274:1;17257:7;:14;:18;17277:1;17243:7;:13;;:36;;;;;:::i;:::-;17280:1;17243:39;;;;;;;;;;;;;;;;17237:46;;:54;;;17233:113;;17315:12;;;;;;;;;;;;;;;;;17233:113;17370:21;17384:2;17388;17370:7;:13;;:21;;;;;:::i;:::-;17363:28;;;;;17123:283;16298:1118;17425:12;;;;;;;;;;;;;;16208:1308;;;;:::o;15625:308::-;15699:12;15759:18;;;;;;;;;;;;;;;;;;;15727:28;15750:1;15753;15727:7;:22;;:28;;;;;:::i;:::-;:50;15723:93;;15793:12;;;;;;;;;;;;;;;;15723:93;15825:21;15849:20;15863:2;15867:1;15849:7;:13;;:20;;;;;:::i;:::-;15825:44;;15886:40;15900:2;15904:21;15916:8;15904:11;:21::i;:::-;15886:7;:13;;:40;;;;;:::i;:::-;15879:47;;;15625:308;;;;:::o;15955:303:1:-;16019:14;16045:32;16086:7;16045:49;;16138:1;16108:19;:26;:31;16104:72;;;16162:3;16155:10;;;;;;;16104:72;16238:2;16229:7;16225:16;16219:23;16209:33;;16195:57;;;;;:::o;20053:133:0:-;20127:12;20158:21;20172:2;20176;20158:7;:13;;:21;;;;;:::i;:::-;20151:28;;20053:133;;;:::o;1587:527:3:-;1745:4;1815:11;1806:5;:20;:35;;;;;1840:1;1830:6;:11;1806:35;:69;;;;;1874:1;1845:18;:25;:30;1806:69;1802:111;;;1898:4;1891:11;;;;1802:111;1923:19;1962:5;1969:18;1989:11;1945:56;;;;;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1945:56:3;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;1945:56:3;;;1923:78;;2073:34;2100:6;2073;:26;;:34;;;;:::i;:::-;2066:41;;;1587:527;;;;;;;:::o;12337:156:5:-;12400:5;12461:24;12473:11;12461;:24::i;:::-;12430:28;12442:15;;12430:11;:28::i;:::-;:55;12417:69;;12337:156;;;:::o;17858:785:0:-;17921:4;17937:15;17955:1;17937:19;;17966:11;17986:16;17997:1;18000;17986:4;:10;;:16;;;;;:::i;:::-;18003:1;17986:19;;;;;;;;;;;;;;;;17980:26;;17966:40;;18094:4;18085:5;:13;;;;:27;;;;18111:1;18102:5;:10;;;18085:27;18081:70;;;18135:5;18128:12;;;;;;18081:70;18166:7;18176:1;18166:11;;18161:379;18183:5;18179:9;;:1;:9;;;18161:379;;;18329:64;18350:42;18361:7;18384;18370:4;:11;:21;18350:4;:10;;:42;;;;;:::i;:::-;18329:20;:64::i;:::-;18318:75;;;;18472:4;:11;18462:7;:21;18458:72;;;18510:5;18503:12;;;;;;;18458:72;18190:3;;;;;;;18161:379;;;;18625:4;:11;18614:7;:22;18607:29;;;;17858:785;;;;:::o;18922:797::-;18987:4;19003:15;19021:1;19003:19;;19032:12;19053:17;19065:1;19068;19053:5;:11;;:17;;;;;:::i;:::-;19071:1;19053:20;;;;;;;;;;;;;;;;19047:27;;19032:42;;19163:4;19153:6;:14;;;;:29;;;;19181:1;19171:6;:11;;;19153:29;19149:72;;;19205:5;19198:12;;;;;;19149:72;19236:7;19246:1;19236:11;;19231:384;19253:6;19249:10;;:1;:10;;;19231:384;;;19400:67;19422:44;19434:7;19458;19443:5;:12;:22;19422:5;:11;;:44;;;;;:::i;:::-;19400:21;:67::i;:::-;19389:78;;;;19546:5;:12;19536:7;:22;19532:73;;;19585:5;19578:12;;;;;;;19532:73;19261:3;;;;;;;19231:384;;;;19700:5;:12;19689:7;:23;19682:30;;;;18922:797;;;;:::o;13598:577::-;13685:12;13709;13731:23;13765:15;13783:1;13765:19;;13800:8;13811:1;13800:12;;13795:213;13819:6;13814:11;;:2;:11;;;13795:213;;;13861:44;13873:7;13897;13882:5;:12;:22;13861:5;:11;;:44;;;;;:::i;:::-;13848:57;;13926:33;13948:10;13926:21;:33::i;:::-;13919:40;;13993:4;13983:7;:14;13973:24;;13827:5;;;;;;;13795:213;;;;14031:44;14043:7;14067;14052:5;:12;:22;14031:5;:11;;:44;;;;;:::i;:::-;14018:57;;14092:33;14114:10;14092:21;:33::i;:::-;14085:40;;14142:26;14154:7;14163:4;14142:5;:11;;:26;;;;;:::i;:::-;14135:33;;;;;13598:577;;;;:::o;14394:134::-;14471:12;14502:19;14516:1;14519;14502:7;:13;;:19;;;;;:::i;:::-;14495:26;;14394:134;;;:::o;15106:246::-;15173:6;15191:21;15215:23;15230:7;15215:14;:23::i;:::-;15191:47;;15248:21;15272:27;15290:8;15272:17;:27::i;:::-;15248:51;;15323:21;15335:8;15323:11;:21::i;:::-;15309:36;;;;15106:246;;;:::o;5875:568::-;5960:12;5984;6006:23;6040:15;6058:1;6040:19;;6075:8;6086:1;6075:12;;6070:210;6094:6;6089:11;;:2;:11;;;6070:210;;;6136:42;6147:7;6170;6156:4;:11;:21;6136:4;:10;;:42;;;;;:::i;:::-;6123:55;;6199:32;6220:10;6199:20;:32::i;:::-;6192:39;;6265:4;6255:7;:14;6245:24;;6102:5;;;;;;;6070:210;;;;6303:42;6314:7;6337;6323:4;:11;:21;6303:4;:10;;:42;;;;;:::i;:::-;6290:55;;6362:32;6383:10;6362:20;:32::i;:::-;6355:39;;6411:25;6422:7;6431:4;6411;:10;;:25;;;;;:::i;:::-;6404:32;;;;;5875:568;;;;:::o;10920:126::-;10989:12;11020:19;11033:1;11036:2;11020:6;:12;;:19;;;;;:::i;:::-;11013:26;;10920:126;;;:::o;21991:131::-;22064:12;22095:20;22109:1;22112:2;22095:7;:13;;:20;;;;;:::i;:::-;22088:27;;21991:131;;;:::o;21554:178::-;21623:7;21700:25;21717:7;379:58;21700:16;;:25;;;;:::i;:::-;21693:32;;21554:178;;;:::o;22757:131::-;22830:12;22861:20;22875:2;22879:1;22861:7;:13;;:20;;;;;:::i;:::-;22854:27;;22757:131;;;:::o;1865:301:2:-;1925:7;2157:2;2152;:7;;;;;;2145:14;;1865:301;;;;:::o;16264:296:1:-;16359:14;16420:7;16411:6;:16;16393:6;:13;:35;;16385:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;16536:7;16527:6;16522:2;16514:6;16510:15;16506:28;16496:48;16486:58;;16472:82;;;;;:::o;24345:1009:0:-;24431:4;24513:1;24507:2;24491:6;:13;:18;;;;;;:23;24487:66;;24537:5;24530:12;;;;24487:66;24633:2;24616:6;:13;:19;24612:61;;;24658:4;24651:11;;;;24612:61;24734:2;24717:6;:13;:19;24713:62;;;24759:5;24752:12;;;;24713:62;24785:9;24797:6;24785:18;;24813:13;24829:48;:36;24858:2;24842:6;:13;:18;24862:2;24829:6;:12;;:36;;;;;:::i;:::-;:46;:48::i;:::-;24813:64;;24887:16;24906:31;:19;24919:1;24922:2;24906:6;:12;;:19;;;;;:::i;:::-;:29;:31::i;:::-;24887:50;;24953:6;24962:1;24953:10;;24948:366;24995:1;24970:21;24988:2;24970:6;:13;:17;;:21;;;;:::i;:::-;24969:27;24965:1;:31;24948:366;;;25033:1;25028;25021:4;:8;;;;;;:13;25017:257;;;25065:72;25084:24;25101:2;25097:1;:6;25105:2;25084:6;:12;;:24;;;;;:::i;:::-;25127:8;25110:26;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;25110:26:0;;;25065:18;:72::i;:::-;25054:83;;25017:257;;;25187:72;25223:8;25206:26;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;25206:26:0;;;25234:24;25251:2;25247:1;:6;25255:2;25234:6;:12;;:24;;;;;:::i;:::-;25187:18;:72::i;:::-;25176:83;;25017:257;25302:1;25294:4;:9;;25287:16;;24998:3;;;;;;;24948:366;;;;25342:5;25330:8;:17;25323:24;;;;;24345:1009;;;;;:::o;7075:282::-;7149:7;7168:20;7198:21;7263:27;7283:6;7263:19;:27::i;:::-;7229:61;;;;;;;;7349:1;7333:13;7316:14;7307:6;:23;:39;;;:43;7300:50;;;;7075:282;;;:::o;12954:280::-;13030:7;13049:10;13068:19;13082:1;13085;13068:7;:13;;:19;;;;;:::i;:::-;13088:1;13068:22;;;;;;;;;;;;;;;;13062:29;;13049:42;;13116:4;13109;:11;;;13101:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13186:1;13182;13175:4;:8;:12;13168:19;;;;;12954:280;;;:::o;14763:126::-;14832:12;14863:19;14877:1;14880;14863:7;:13;;:19;;;;;:::i;:::-;14856:26;;14763:126;;;:::o;23873:151::-;23958:7;23984:33;24009:2;24013;23992:24;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;23992:24:0;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;23992:24:0;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;23992:24:0;;;23984:7;:33::i;:::-;23977:40;;23873:151;;;;:::o;9206:474::-;9279:5;9286:7;9305:23;9331:19;9344:2;9348:1;9331:6;:12;;:19;;;;;:::i;:::-;9305:45;;9360:20;9383:37;9409:10;9383:25;:37::i;:::-;9360:60;;9430:12;9474:1;9456:14;:19;;;9452:183;;;9504:10;9515:1;9504:13;;;;;;;;;;;;;;;;9498:20;;9491:27;;;;9452:183;;;9556:68;9568:55;9586:36;9599:6;9607:14;9586:36;;:6;:12;;:36;;;;;:::i;:::-;9568:17;:55::i;:::-;9556:11;:68::i;:::-;9549:75;;9452:183;9652:14;9668:4;9644:29;;;;;;;9206:474;;;:::o;941:437::-;1019:5;1059:4;1046:5;1052:1;1046:8;;;;;;;;;;;;;;;;1040:15;;:23;;;1036:94;;;1086:1;1079:8;;;;1036:94;1162:4;1149:5;1155:1;1149:8;;;;;;;;;;;;;;;;1143:15;;:23;;;1139:94;;;1189:1;1182:8;;;;1139:94;1265:4;1252:5;1258:1;1252:8;;;;;;;;;;;;;;;;1246:15;;:23;;;1242:94;;;1292:1;1285:8;;;;1242:94;1353:1;1346:8;;941:437;;;;:::o
Swarm Source
bzzr://ed4a052c2505eaf6cd829e5de44121a4426b7b0673201deb84e0e73fb86c7263
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
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.