Sepolia Testnet

Contract

0xfb313bAbC81f0cd8CFB4d29498Db3fCdFa120042

Overview

ETH Balance

0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LagrangeCommittee

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 10 : LagrangeCommittee.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";

import "../interfaces/ILagrangeCommittee.sol";
import "../interfaces/ILagrangeService.sol";
import "../interfaces/IVoteWeigher.sol";

contract LagrangeCommittee is Initializable, OwnableUpgradeable, ILagrangeCommittee {
    ILagrangeService public immutable service;
    IVoteWeigher public immutable voteWeigher;

    // Leaf Node Prefix
    bytes1 public constant LEAF_NODE_PREFIX = 0x01;
    // Inner Node Prefix
    bytes1 public constant INNER_NODE_PREFIX = 0x02;

    // Registered ChainIDs
    uint32[] public chainIDs;
    // ChainID => Committee
    mapping(uint32 => CommitteeDef) public committeeParams;

    // committees is also used for external storage for epoch period modification
    //   committees[chainID][uint256.max].leafCount = current index of epoch period
    //   committees[chainID][uint256.max - 1] : 1-index
    //          updatedBlock:  (flagBlock << 112) | flagEpoch
    //          leafCount:  epochPeriod
    //   committees[chainID][uint256.max - 2] : 2-index
    //   committees[chainID][uint256.max - 3] : 3-index
    //      ...   ...   ...
    // ChainID => Epoch => CommitteeData
    mapping(uint32 => mapping(uint256 => CommitteeData)) public committees;

    // ChainID => Operator address[]
    mapping(uint32 => address[]) public committeeAddrs;
    // Tree Depth => Node Value
    mapping(uint8 => bytes32) private zeroHashes;

    mapping(address => OperatorStatus) public operatorsStatus;

    // ChainID => Epoch check if committee tree has been updated
    mapping(uint32 => uint256) public updatedEpoch;

    mapping(uint32 => mapping(address => bool)) public subscribedChains;

    modifier onlyService() {
        require(msg.sender == address(service), "Only Lagrange service can call this function.");
        _;
    }

    constructor(ILagrangeService _service, IVoteWeigher _voteWeigher) {
        service = _service;
        voteWeigher = _voteWeigher;
        _disableInitializers();
    }

    // Initializer: sets owner
    function initialize(address initialOwner) external initializer {
        // Initialize zero hashes
        for (uint8 i = 1; i <= 20; i++) {
            zeroHashes[i] = _innerHash(zeroHashes[i - 1], zeroHashes[i - 1]);
        }

        _transferOwnership(initialOwner);
    }

    // Initializes epoch period
    // @dev This function can be called for the chainID registered in the previous version
    function setFirstEpochPeriod(uint32 chainID) public onlyOwner {
        uint32 _count = getEpochPeriodCount(chainID);
        if (_count != 0) return; // already initialized
        CommitteeDef memory _committeeParam = committeeParams[chainID];

        _writeEpochPeriod(chainID, _committeeParam.startBlock, 0, _committeeParam.duration);
    }

    // Adds a new operator to the committee
    function addOperator(address operator, address signAddress, uint256[2][] calldata blsPubKeys)
        external
        onlyService
    {
        _validateBlsPubKeys(blsPubKeys);
        _registerOperator(operator, signAddress, blsPubKeys);
    }

    // Removes an operator from the committee
    function removeOperator(address operator) external onlyService {
        delete operatorsStatus[operator];
    }

    // Unsubscribe chain by admin
    function unsubscribeByAdmin(address[] calldata operators, uint32 chainID) external onlyService {
        uint256 _length = operators.length;
        for (uint256 i; i < _length; i++) {
            address _operator = operators[i];
            require(subscribedChains[chainID][_operator], "The dedicated chain is not subscribed");
            delete subscribedChains[chainID][_operator];
            _removeOperatorFromCommitteeAddrs(chainID, _operator);
            operatorsStatus[_operator].subscribedChainCount--;
        }
    }

    // Adds additional BLS public keys to an operator
    function addBlsPubKeys(address operator, uint256[2][] calldata additionalBlsPubKeys) external onlyService {
        _validateBlsPubKeys(additionalBlsPubKeys);
        _addBlsPubKeys(operator, additionalBlsPubKeys);
    }

    // Updates an operator's BLS public key for the given index
    function updateBlsPubKey(address operator, uint32 index, uint256[2] calldata blsPubKey) external onlyService {
        require(blsPubKey[0] != 0 && blsPubKey[1] != 0, "Invalid BLS Public Key.");
        uint256[2][] storage _blsPubKeys = operatorsStatus[operator].blsPubKeys;
        require(_blsPubKeys.length > index, "Invalid index");
        _checkBlsPubKeyDuplicate(_blsPubKeys, blsPubKey);
        _blsPubKeys[index] = blsPubKey;
    }

    // Removes BLS public keys from an operator for the given indices
    function removeBlsPubKeys(address operator, uint32[] calldata indices) external onlyService {
        uint256[2][] memory _blsPubKeys = operatorsStatus[operator].blsPubKeys;
        uint256 _length = _blsPubKeys.length;
        // it ensures that keep at least one BLS public key
        require(_length > indices.length, "Invalid indices length, BLS keys cannot be empty.");
        for (uint256 i; i < indices.length; i++) {
            require(_length > indices[i], "Invalid index");
            _blsPubKeys[indices[i]][0] = 0;
            _blsPubKeys[indices[i]][1] = 0;
        }
        uint32 count;
        for (uint256 i; i < _length; i++) {
            if (_blsPubKeys[i][0] != 0 || _blsPubKeys[i][1] != 0) {
                _blsPubKeys[count] = _blsPubKeys[i];
                count++;
            }
        }
        uint256[2][] memory _newBlsPubKeys = new uint256[2][](count);
        for (uint256 i; i < count; i++) {
            _newBlsPubKeys[i] = _blsPubKeys[i];
        }
        operatorsStatus[operator].blsPubKeys = _newBlsPubKeys;
    }

    // Updates an operator's sign address
    function updateSignAddress(address operator, address newSignAddress) external onlyService {
        require(operatorsStatus[operator].blsPubKeys.length != 0, "Operator is not registered.");
        operatorsStatus[operator].signAddress = newSignAddress;
        emit SignAddressUpdated(operator, newSignAddress);
    }

    function subscribeChain(address operator, uint32 chainID) external onlyService {
        // Check if the chainID is already registered
        require(committeeParams[chainID].startBlock > 0, "The dedicated chain is not registered.");

        (bool locked,) = isLocked(chainID);
        require(!locked, "The dedicated chain is locked.");

        UnsubscribedParam[] memory unsubscribedParams = operatorsStatus[operator].unsubscribedParams;

        uint256 _length = unsubscribedParams.length;
        for (uint256 i; i < _length; i++) {
            UnsubscribedParam memory param = unsubscribedParams[i];
            if (param.chainID == chainID) {
                if (param.blockNumber >= block.number) {
                    revert("The dedciated chain is while unsubscribing.");
                }
            }
        }
        require(!subscribedChains[chainID][operator], "The dedicated chain is already subscribed.");

        CommitteeDef memory _committeeParam = committeeParams[chainID];
        uint96 _voteWeight = voteWeigher.weightOfOperator(_committeeParam.quorumNumber, operator); // voteWeight
        require(_voteWeight >= _committeeParam.minWeight, "Insufficient Vote Weight");

        _subscribeChain(operator, chainID);
    }

    function unsubscribeChain(address operator, uint32 chainID) external onlyService {
        require(subscribedChains[chainID][operator], "The dedicated chain is not subscribed");

        (bool locked, uint256 blockNumber) = isLocked(chainID);
        require(!locked, "The dedicated chain is locked.");

        _unsubscribeChain(operator, chainID, blockNumber);
    }

    // Initializes a new committee, and optionally associates addresses with it.
    function registerChain(
        uint32 chainID,
        uint256 genesisBlock,
        uint256 epochPeriod,
        uint256 freezeDuration,
        uint8 quorumNumber,
        uint96 minWeight,
        uint96 maxWeight
    ) public onlyOwner {
        require(committeeParams[chainID].startBlock == 0, "Committee has already been initialized.");
        _validateVotingPowerRange(minWeight, maxWeight);
        _validateFreezeDuration(epochPeriod, freezeDuration);

        _initCommittee(chainID, genesisBlock, epochPeriod, freezeDuration, quorumNumber, minWeight, maxWeight);
    }

    function updateChain(
        uint32 chainID,
        int256 l1Bias,
        uint256 genesisBlock,
        uint256 epochPeriod,
        uint256 freezeDuration,
        uint8 quorumNumber,
        uint96 minWeight,
        uint96 maxWeight
    ) public onlyOwner {
        uint256 _startBlock = committeeParams[chainID].startBlock;
        require(_startBlock != 0, "Chain not initialized");

        _validateVotingPowerRange(minWeight, maxWeight);
        _validateFreezeDuration(epochPeriod, freezeDuration);

        _updateCommitteeParams(
            chainID, l1Bias, _startBlock, genesisBlock, epochPeriod, freezeDuration, quorumNumber, minWeight, maxWeight
        );
    }

    function isUnregisterable(address operator) public view returns (bool, uint256) {
        OperatorStatus memory _opStatus = operatorsStatus[operator];

        if (_opStatus.subscribedChainCount > 0) {
            return (false, 0);
        }

        uint256 _unsubscribeBlockNumber;
        uint256 _length = _opStatus.unsubscribedParams.length;
        for (uint256 i; i < _length; i++) {
            UnsubscribedParam memory param = _opStatus.unsubscribedParams[i];
            if (param.blockNumber > _unsubscribeBlockNumber) {
                _unsubscribeBlockNumber = param.blockNumber;
            }
        }

        return (true, _unsubscribeBlockNumber);
    }

    function getBlsPubKeys(address operator) public view returns (uint256[2][] memory) {
        return operatorsStatus[operator].blsPubKeys;
    }

    // Returns chain's committee current and next roots at a given block.
    function getCommittee(uint32 chainID, uint256 blockNumber)
        public
        view
        returns (CommitteeData memory currentCommittee)
    {
        uint256 epochNumber = getEpochNumber(chainID, blockNumber);
        currentCommittee = committees[chainID][epochNumber];
        return currentCommittee;
    }

    // Checks if a chain's committee is updatable at a given block
    function isUpdatable(uint32 chainID, uint256 epochNumber) public view returns (bool) {
        (, uint256 _freezeBlock,) = getEpochInterval(chainID, epochNumber - 1);
        return block.number > _freezeBlock;
    }

    // Checks if a chain's committee is locked at a given block
    function isLocked(uint32 chainID) public view returns (bool, uint256) {
        uint256 _epochNumber = _getEpochNumber(chainID, block.number);
        (, uint256 _freezeBlock, uint256 _endBlock) = getEpochInterval(chainID, _epochNumber);
        return (block.number > _freezeBlock, _endBlock);
    }

    // If applicable, updates committee based on staking, unstaking, and slashing.
    function update(uint32 chainID, uint256 epochNumber) public {
        require(isUpdatable(chainID, epochNumber), "Block number is prior to committee freeze window.");

        require(updatedEpoch[chainID] + 1 == epochNumber, "The epochNumber is not sequential.");

        CommitteeDef memory _committeeParam = committeeParams[chainID];
        uint8 _quorumNumber = _committeeParam.quorumNumber;
        uint96 _minWeight = _committeeParam.minWeight;
        uint96 _maxWeight = _committeeParam.maxWeight;

        address[] memory _operators = committeeAddrs[chainID];
        uint256 _operatorCount = _operators.length;

        uint256 _leafCounter;

        // pre-calculate array size (can be bigger than actual size)
        for (uint256 i; i < _operatorCount;) {
            unchecked {
                _leafCounter += operatorsStatus[_operators[i]].blsPubKeys.length;
                i++;
            }
        }

        bytes32[] memory _committeeLeaves = new bytes32[](_leafCounter);
        {
            _leafCounter = 0;
            for (uint256 i; i < _operatorCount;) {
                address _operator = _operators[i];

                OperatorStatus storage _opStatus = operatorsStatus[_operator];
                uint96 _votingPower = _checkVotingPower(
                    uint32(_opStatus.blsPubKeys.length), // blsPubKeyCount
                    voteWeigher.weightOfOperator(_quorumNumber, _operator), // voteWeight
                    _minWeight,
                    _maxWeight
                );

                uint96 _remained = _votingPower;
                unchecked {
                    for (uint256 j; _remained > 0;) {
                        uint96 _individualVotingPower;
                        if (_remained >= _maxWeight + _minWeight) {
                            _individualVotingPower = _maxWeight;
                        } else if (_remained > _maxWeight) {
                            _individualVotingPower = _minWeight;
                        } else {
                            _individualVotingPower = _remained;
                        }
                        _remained -= _individualVotingPower;
                        _committeeLeaves[_leafCounter] =
                            _leafHash(_operator, _opStatus.blsPubKeys[j], _individualVotingPower);
                        j++;
                        _leafCounter++;
                    }
                }
                unchecked {
                    i++;
                }
            }
        }

        bytes32 _root;
        unchecked {
            // Nothing to overflow/underflow
            uint256 _childCount = _leafCounter;
            for (uint8 _h; _childCount > 1; _h++) {
                uint256 _parentCount = (_childCount + 1) >> 1;
                for (uint256 _i = 1; _i < _childCount; _i += 2) {
                    _committeeLeaves[_i >> 1] = _innerHash(_committeeLeaves[_i - 1], _committeeLeaves[_i]);
                }
                if (_childCount & 1 == 1) {
                    _committeeLeaves[_parentCount - 1] = _innerHash(_committeeLeaves[_childCount - 1], zeroHashes[_h]);
                }
                _childCount = _parentCount;
            }
            if (_leafCounter > 0) _root = _committeeLeaves[0];
        }

        _updateCommittee(chainID, epochNumber, _root, uint32(_leafCounter));
    }

    function revertEpoch(uint32 chainID, uint256 epochNumber) public onlyOwner {
        require(updatedEpoch[chainID] == epochNumber, "The epochNumber is not the latest.");
        delete committees[chainID][epochNumber];
        updatedEpoch[chainID] = epochNumber - 1;
    }

    // Computes epoch number for a chain's committee at a given block
    function getEpochNumber(uint32 chainID, uint256 blockNumber) public view returns (uint256 epochNumber) {
        // we don't need to care about safeCast here, only getting API
        blockNumber = uint256(int256(blockNumber) + committeeParams[chainID].l1Bias);

        epochNumber = _getEpochNumber(chainID, blockNumber);
        // All the prior blocks belong to epoch 1
        if (epochNumber == 0) epochNumber = 1;
    }

    // Get the operator's voting power for the given chainID
    function getOperatorVotingPower(address opAddr, uint32 chainID) public view returns (uint96) {
        CommitteeDef memory _committeeParam = committeeParams[chainID];
        uint96 _weight = voteWeigher.weightOfOperator(_committeeParam.quorumNumber, opAddr);
        return _checkVotingPower(
            uint32(operatorsStatus[opAddr].blsPubKeys.length),
            _weight,
            _committeeParam.minWeight,
            _committeeParam.maxWeight
        );
    }

    // Get array of voting powers of individual BlsPubKeys
    function getBlsPubKeyVotingPowers(address opAddr, uint32 chainID)
        public
        view
        returns (uint96[] memory individualVotingPowers)
    {
        uint96 _votingPower = getOperatorVotingPower(opAddr, chainID);
        uint96 _minWeight = committeeParams[chainID].minWeight;
        uint96 _maxWeight = committeeParams[chainID].maxWeight;
        return _divideVotingPower(_votingPower, _minWeight, _maxWeight);
    }

    function getTokenListForOperator(address operator) external view returns (address[] memory) {
        uint256 _length = chainIDs.length;
        uint8[] memory _quorumNumbers = new uint8[](operatorsStatus[operator].subscribedChainCount);
        uint256 _count;
        for (uint256 i; i < _length; i++) {
            uint32 _chainID = chainIDs[i];
            if (subscribedChains[_chainID][operator]) {
                _quorumNumbers[_count++] = committeeParams[_chainID].quorumNumber;
            }
        }

        return voteWeigher.getTokenListForQuorumNumbers(_quorumNumbers);
    }

    // Initialize new committee.
    function _initCommittee(
        uint32 _chainID,
        uint256 _genesisBlock,
        uint256 _duration,
        uint256 _freezeDuration,
        uint8 _quorumNumber,
        uint96 _minWeight,
        uint96 _maxWeight
    ) internal {
        committeeParams[_chainID] = CommitteeDef(
            block.number, 0, _genesisBlock, _duration, _freezeDuration, _quorumNumber, _minWeight, _maxWeight
        );
        committees[_chainID][0] = CommitteeData(0, 0, 0);

        chainIDs.push(_chainID);

        setFirstEpochPeriod(_chainID);

        emit InitCommittee(_chainID, _quorumNumber, _genesisBlock, _duration, _freezeDuration, _minWeight, _maxWeight);
    }

    // Update committee.
    function _updateCommitteeParams(
        uint32 _chainID,
        int256 _l1Bias,
        uint256 _startBlock,
        uint256 _genesisBlock,
        uint256 _duration,
        uint256 _freezeDuration,
        uint8 _quorumNumber,
        uint96 _minWeight,
        uint96 _maxWeight
    ) internal {
        if (committeeParams[_chainID].duration != _duration) {
            uint256 _flagEpoch = _getEpochNumber(_chainID, block.number - 1) + 1;
            (,, uint256 _endBlockPrv) = getEpochInterval(_chainID, _flagEpoch - 1);
            _writeEpochPeriod(_chainID, _endBlockPrv, _flagEpoch, _duration);
        }

        committeeParams[_chainID] = CommitteeDef(
            _startBlock, _l1Bias, _genesisBlock, _duration, _freezeDuration, _quorumNumber, _minWeight, _maxWeight
        );

        emit UpdateCommitteeParams(
            _chainID, _quorumNumber, _l1Bias, _genesisBlock, _duration, _freezeDuration, _minWeight, _maxWeight
        );
    }

    // ----------------- Functions for Epoch Number ----------------- //
    function getEpochPeriodCount(uint32 chainID) public view returns (uint32) {
        return committees[chainID][type(uint256).max].leafCount;
    }

    function getEpochPeriodByIndex(uint32 chainID, uint32 index)
        public
        view
        returns (uint256 flagBlock, uint256 flagEpoch, uint256 duration)
    {
        CommitteeData memory _epochPeriodContext = committees[chainID][type(uint256).max - index];
        return (
            _epochPeriodContext.updatedBlock >> 112,
            (_epochPeriodContext.updatedBlock << 112) >> 112,
            _epochPeriodContext.leafCount
        );
    }

    function getEpochInterval(uint32 _chainID, uint256 _epochNumber)
        public
        view
        returns (uint256 _startBlock, uint256 _freezeBlock, uint256 _endBlock)
    {
        // epoch period would be updated rarely
        uint32 _index = getEpochPeriodCount(_chainID);
        while (_index > 0) {
            (uint256 _flagBlock, uint256 _flagEpoch, uint256 _duration) = getEpochPeriodByIndex(_chainID, _index);
            if (_epochNumber >= _flagEpoch) {
                _startBlock = (_epochNumber - _flagEpoch) * _duration + _flagBlock;
                _endBlock = _startBlock + _duration;
                _freezeBlock = _endBlock - committeeParams[_chainID].freezeDuration;
                break;
            }
            unchecked {
                _index--;
            }
        }
    }

    function _writeEpochPeriod(uint32 _chainID, uint256 _flagBlock, uint256 _flagEpoch, uint256 _duration) internal {
        uint32 _index = committees[_chainID][type(uint256).max].leafCount + 1;
        committees[_chainID][type(uint256).max - _index] = CommitteeData(
            0,
            (uint224(SafeCast.toUint112(_flagBlock)) << 112) + uint224(SafeCast.toUint112(_flagEpoch)),
            SafeCast.toUint32(_duration)
        );
        committees[_chainID][type(uint256).max].leafCount = _index;
        emit EpochPeriodUpdated(_chainID, _index, _flagBlock, _flagEpoch, _duration);
    }

    function _getEpochNumber(uint32 _chainID, uint256 _blockNumber) internal view returns (uint256 _epochNumber) {
        if (_blockNumber < committeeParams[_chainID].genesisBlock) {
            return 0;
        }
        // epoch period would be updated rarely
        uint32 _index = getEpochPeriodCount(_chainID);
        while (_index > 0) {
            (uint256 _flagBlock, uint256 _flagEpoch, uint256 _duration) = getEpochPeriodByIndex(_chainID, _index);
            if (_blockNumber >= _flagBlock) {
                _epochNumber = _flagEpoch + (_blockNumber - _flagBlock) / _duration;
                break;
            }
            unchecked {
                _index--;
            }
        }
    }
    // ------------------------------------------------------------- //

    function _registerOperator(address _operator, address _signAddress, uint256[2][] memory _blsPubKeys) internal {
        delete operatorsStatus[_operator];
        OperatorStatus storage _opStatus = operatorsStatus[_operator];
        _opStatus.signAddress = _signAddress;
        uint256 _length = _blsPubKeys.length;
        for (uint256 i; i < _length; i++) {
            _checkBlsPubKeyDuplicate(_opStatus.blsPubKeys, _blsPubKeys[i]);
            _opStatus.blsPubKeys.push(_blsPubKeys[i]);
        }
    }

    function _addBlsPubKeys(address _operator, uint256[2][] memory _additionalBlsPubKeys) internal {
        OperatorStatus storage _opStatus = operatorsStatus[_operator];
        require(_opStatus.blsPubKeys.length != 0, "Operator is not registered.");
        uint256 _length = _additionalBlsPubKeys.length;
        for (uint256 i; i < _length; i++) {
            _checkBlsPubKeyDuplicate(_opStatus.blsPubKeys, _additionalBlsPubKeys[i]);
            _opStatus.blsPubKeys.push(_additionalBlsPubKeys[i]);
        }
    }

    function _checkBlsPubKeyDuplicate(uint256[2][] memory _blsPubKeys, uint256[2] memory _blsPubKey) internal pure {
        uint256 _length = _blsPubKeys.length;
        for (uint256 i; i < _length; i++) {
            require(_blsPubKeys[i][0] != _blsPubKey[0] || _blsPubKeys[i][1] != _blsPubKey[1], "Duplicated BlsPubKey");
        }
    }

    function _subscribeChain(address _operator, uint32 _chainID) internal {
        subscribedChains[_chainID][_operator] = true;
        operatorsStatus[_operator].subscribedChainCount++;

        committeeAddrs[_chainID].push(_operator);
    }

    function _unsubscribeChain(address _operator, uint32 _chainID, uint256 _blockNumber) internal {
        delete subscribedChains[_chainID][_operator];
        OperatorStatus storage _opStatus = operatorsStatus[_operator];
        _opStatus.unsubscribedParams.push(UnsubscribedParam(_chainID, _blockNumber));
        _opStatus.subscribedChainCount--;

        _removeOperatorFromCommitteeAddrs(_chainID, _operator);
    }

    function _removeOperatorFromCommitteeAddrs(uint32 _chainID, address _operator) internal {
        uint256 _length = committeeAddrs[_chainID].length;
        for (uint256 i; i < _length; i++) {
            if (committeeAddrs[_chainID][i] == _operator) {
                committeeAddrs[_chainID][i] = committeeAddrs[_chainID][_length - 1];
                committeeAddrs[_chainID].pop();
                break;
            }
        }
        require(_length == committeeAddrs[_chainID].length + 1, "Operator doesn't exist in committeeAddrs.");
    }

    function _updateCommittee(uint32 _chainID, uint256 _epochNumber, bytes32 _root, uint32 _leafCount) internal {
        // Update roots
        committees[_chainID][_epochNumber].leafCount = _leafCount;
        committees[_chainID][_epochNumber].root = _root;
        committees[_chainID][_epochNumber].updatedBlock = uint224(block.number);
        updatedEpoch[_chainID] = _epochNumber;
        emit UpdateCommittee(_chainID, _epochNumber, _root);
    }

    function _validateBlsPubKeys(uint256[2][] memory _blsPubKeys) internal pure {
        require(_blsPubKeys.length != 0, "Empty BLS Public Keys.");
        // TODO: need to add validation for blsPubKeys with signatures
        uint256 _length = _blsPubKeys.length;
        for (uint256 i; i < _length; i++) {
            require(_blsPubKeys[i][0] != 0 && _blsPubKeys[i][1] != 0, "Invalid BLS Public Key.");
        }
    }

    // Returns the leaf hash for a given operator
    function _leafHash(address opAddr, uint256[2] memory blsPubKey, uint96 _votingPower)
        internal
        pure
        returns (bytes32)
    {
        return keccak256(abi.encodePacked(LEAF_NODE_PREFIX, blsPubKey[0], blsPubKey[1], opAddr, _votingPower));
    }

    // Calculate the inner node hash from left and right children
    function _innerHash(bytes32 left, bytes32 right) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(INNER_NODE_PREFIX, left, right));
    }

    function _validateVotingPowerRange(uint96 _minWeight, uint96 _maxWeight) internal pure {
        require(_minWeight > 0 && _maxWeight >= _minWeight * 2, "Invalid min/max Weight");
    }

    function _validateFreezeDuration(uint256 _epochPeriod, uint256 _freezeDuration) internal pure {
        require(_epochPeriod > _freezeDuration, "Invalid freeze duration");
    }

    function _checkVotingPower(uint32 blsPubKeysCount, uint96 votingPower, uint96 minWeight, uint96 maxWeight)
        internal
        pure
        returns (uint96)
    {
        if (votingPower < minWeight) {
            return 0;
        }
        unchecked {
            uint256 _amountLimit = uint256(maxWeight) * uint256(blsPubKeysCount); // This value can be bigger than type(uint96).max

            if (votingPower > _amountLimit) {
                votingPower = uint96(_amountLimit);
            }
        }
        return votingPower;
    }

    function _calcActiveBlsPubKeyCount(uint96 _votingPower, uint96 minWeight, uint96 maxWeight)
        internal
        pure
        returns (uint32)
    {
        if (_votingPower < minWeight) {
            return 0;
        } else {
            unchecked {
                uint96 _count = ((_votingPower - 1) / maxWeight) + 1;
                require(_count <= type(uint32).max, "OverFlow");
                return uint32(_count);
            }
        }
    }

    function _divideVotingPower(uint96 totalWeight, uint96 minWeight, uint96 maxWeight)
        internal
        pure
        returns (uint96[] memory)
    {
        uint256 _count = _calcActiveBlsPubKeyCount(totalWeight, minWeight, maxWeight);
        uint96[] memory _individualVotingPowers = new uint96[](_count);
        if (_count == 0) return _individualVotingPowers;
        uint256 _index;
        uint96 _remained = totalWeight;
        unchecked {
            while (_remained >= maxWeight + minWeight) {
                _individualVotingPowers[_index++] = maxWeight;
                _remained -= maxWeight;
            }
            if (_remained > maxWeight) {
                _individualVotingPowers[_index++] = minWeight;
                _individualVotingPowers[_index++] = _remained - minWeight;
            } else {
                _individualVotingPowers[_index++] = _remained;
            }
        }
        return _individualVotingPowers;
    }
}

File 2 of 10 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

File 3 of 10 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 4 of 10 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol)

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248) {
        require(value >= type(int248).min && value <= type(int248).max, "SafeCast: value doesn't fit in 248 bits");
        return int248(value);
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240) {
        require(value >= type(int240).min && value <= type(int240).max, "SafeCast: value doesn't fit in 240 bits");
        return int240(value);
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232) {
        require(value >= type(int232).min && value <= type(int232).max, "SafeCast: value doesn't fit in 232 bits");
        return int232(value);
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224) {
        require(value >= type(int224).min && value <= type(int224).max, "SafeCast: value doesn't fit in 224 bits");
        return int224(value);
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216) {
        require(value >= type(int216).min && value <= type(int216).max, "SafeCast: value doesn't fit in 216 bits");
        return int216(value);
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208) {
        require(value >= type(int208).min && value <= type(int208).max, "SafeCast: value doesn't fit in 208 bits");
        return int208(value);
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200) {
        require(value >= type(int200).min && value <= type(int200).max, "SafeCast: value doesn't fit in 200 bits");
        return int200(value);
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192) {
        require(value >= type(int192).min && value <= type(int192).max, "SafeCast: value doesn't fit in 192 bits");
        return int192(value);
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184) {
        require(value >= type(int184).min && value <= type(int184).max, "SafeCast: value doesn't fit in 184 bits");
        return int184(value);
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176) {
        require(value >= type(int176).min && value <= type(int176).max, "SafeCast: value doesn't fit in 176 bits");
        return int176(value);
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168) {
        require(value >= type(int168).min && value <= type(int168).max, "SafeCast: value doesn't fit in 168 bits");
        return int168(value);
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160) {
        require(value >= type(int160).min && value <= type(int160).max, "SafeCast: value doesn't fit in 160 bits");
        return int160(value);
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152) {
        require(value >= type(int152).min && value <= type(int152).max, "SafeCast: value doesn't fit in 152 bits");
        return int152(value);
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144) {
        require(value >= type(int144).min && value <= type(int144).max, "SafeCast: value doesn't fit in 144 bits");
        return int144(value);
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136) {
        require(value >= type(int136).min && value <= type(int136).max, "SafeCast: value doesn't fit in 136 bits");
        return int136(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120) {
        require(value >= type(int120).min && value <= type(int120).max, "SafeCast: value doesn't fit in 120 bits");
        return int120(value);
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112) {
        require(value >= type(int112).min && value <= type(int112).max, "SafeCast: value doesn't fit in 112 bits");
        return int112(value);
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104) {
        require(value >= type(int104).min && value <= type(int104).max, "SafeCast: value doesn't fit in 104 bits");
        return int104(value);
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96) {
        require(value >= type(int96).min && value <= type(int96).max, "SafeCast: value doesn't fit in 96 bits");
        return int96(value);
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88) {
        require(value >= type(int88).min && value <= type(int88).max, "SafeCast: value doesn't fit in 88 bits");
        return int88(value);
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80) {
        require(value >= type(int80).min && value <= type(int80).max, "SafeCast: value doesn't fit in 80 bits");
        return int80(value);
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72) {
        require(value >= type(int72).min && value <= type(int72).max, "SafeCast: value doesn't fit in 72 bits");
        return int72(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56) {
        require(value >= type(int56).min && value <= type(int56).max, "SafeCast: value doesn't fit in 56 bits");
        return int56(value);
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48) {
        require(value >= type(int48).min && value <= type(int48).max, "SafeCast: value doesn't fit in 48 bits");
        return int48(value);
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40) {
        require(value >= type(int40).min && value <= type(int40).max, "SafeCast: value doesn't fit in 40 bits");
        return int40(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24) {
        require(value >= type(int24).min && value <= type(int24).max, "SafeCast: value doesn't fit in 24 bits");
        return int24(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 5 of 10 : ILagrangeCommittee.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

interface ILagrangeCommittee {
    struct UnsubscribedParam {
        uint32 chainID;
        uint256 blockNumber;
    }

    struct OperatorStatus {
        address signAddress;
        uint256[2][] blsPubKeys;
        uint8 subscribedChainCount; // assume that size of this array is not big
        UnsubscribedParam[] unsubscribedParams;
    }

    struct CommitteeDef {
        uint256 startBlock;
        // l1Bias is the difference between the base L1 block number of the given L2 chain and
        // the maintained L1 block number, for example, if we want to register the Base Mainnet
        // chain in the Holesky, the l1Bias should be the difference between the Mainnet block
        // number and the Holesky block number.
        int256 l1Bias;
        uint256 genesisBlock;
        uint256 duration;
        uint256 freezeDuration;
        uint8 quorumNumber;
        uint96 minWeight;
        uint96 maxWeight;
    }

    struct CommitteeData {
        bytes32 root;
        uint224 updatedBlock;
        uint32 leafCount;
    }

    function getCommittee(uint32 chainID, uint256 blockNumber) external view returns (CommitteeData memory);

    // TODO: need to change order of the params for gas optimization
    function registerChain(
        uint32 chainID,
        uint256 genesisBlock,
        uint256 epochPeriod,
        uint256 freezeDuration,
        uint8 quorumNumber,
        uint96 minWeight,
        uint96 maxWeight
    ) external;

    function updateChain(
        uint32 chainID,
        int256 l1Bias,
        uint256 genesisBlock,
        uint256 epochPeriod,
        uint256 freezeDuration,
        uint8 quorumNumber,
        uint96 minWeight,
        uint96 maxWeight
    ) external;

    function addOperator(address operator, address signAddress, uint256[2][] memory blsPubKeys) external;

    function removeOperator(address operator) external;

    function unsubscribeByAdmin(address[] memory operators, uint32 chainID) external;

    function addBlsPubKeys(address operator, uint256[2][] memory additionalBlsPubKeys) external;

    function updateBlsPubKey(address operator, uint32 index, uint256[2] memory blsPubKey) external;

    function removeBlsPubKeys(address operator, uint32[] memory indices) external;

    function updateSignAddress(address operator, address newSignAddress) external;

    function isLocked(uint32 chainID) external view returns (bool, uint256);

    function subscribeChain(address operator, uint32 chainID) external;

    function unsubscribeChain(address operator, uint32 chainID) external;

    function isUnregisterable(address operator) external view returns (bool, uint256);

    function update(uint32 chainID, uint256 epochNumber) external;

    function getBlsPubKeys(address operator) external view returns (uint256[2][] memory);

    function getOperatorVotingPower(address opAddr, uint32 chainID) external view returns (uint96);

    function getBlsPubKeyVotingPowers(address opAddr, uint32 chainID) external view returns (uint96[] memory);

    function getTokenListForOperator(address operator) external view returns (address[] memory);

    // Event fired on initialization of a new committee
    event InitCommittee(
        uint256 indexed chainID,
        uint8 indexed quorumNumber,
        uint256 genesisBlock,
        uint256 duration,
        uint256 freezeDuration,
        uint96 minWeight,
        uint96 maxWeight
    );

    // Event fired on updating a committee params
    event UpdateCommitteeParams(
        uint256 indexed chainID,
        uint8 indexed quorumNumber,
        int256 l1Bias,
        uint256 genesisBlock,
        uint256 duration,
        uint256 freezeDuration,
        uint96 minWeight,
        uint96 maxWeight
    );

    // Fired on successful rotation of committee
    event UpdateCommittee(uint256 indexed chainID, uint256 indexed epochNumber, bytes32 current);

    // Event fired on updating epoch period
    event EpochPeriodUpdated(
        uint32 indexed chainID, uint32 indexed epochPeriodIndex, uint256 flagBlock, uint256 flagEpoch, uint256 duration
    );

    // Event fired on updating sign address
    event SignAddressUpdated(address indexed operator, address indexed signAddress);
}

File 6 of 10 : ILagrangeService.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import {ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol";

interface ILagrangeService {
    function addOperatorsToWhitelist(address[] calldata operators) external;

    function removeOperatorsFromWhitelist(address[] calldata operators) external;

    function register(
        address signAddress,
        uint256[2][] memory blsPubKeys,
        ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature
    ) external;

    function addBlsPubKeys(uint256[2][] memory additionalBlsPubKeys) external;

    function updateBlsPubKey(uint32 index, uint256[2] memory blsPubKey) external;

    function removeBlsPubKeys(uint32[] memory indices) external;

    function updateSignAddress(address newSignAddress) external;

    function subscribe(uint32 chainID) external;

    function unsubscribe(uint32 chainID) external;

    function unsubscribeByAdmin(address[] memory operators, uint32 chainID) external;

    function deregister() external;

    function owner() external view returns (address);
}

File 7 of 10 : IVoteWeigher.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

interface IVoteWeigher {
    struct TokenMultiplier {
        address token;
        uint96 multiplier;
    }

    function addQuorumMultiplier(uint8 quorumNumber, TokenMultiplier[] memory multipliers) external;

    function removeQuorumMultiplier(uint8 quorumNumber) external;

    function updateQuorumMultiplier(uint8 quorumNumber, uint256 index, TokenMultiplier memory multiplier) external;

    function weightOfOperator(uint8 quorumNumber, address operator) external view returns (uint96);

    function getTokenList() external view returns (address[] memory);

    function getTokenListForQuorumNumbers(uint8[] memory quorumNumbers_) external view returns (address[] memory);
}

File 8 of 10 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 9 of 10 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 10 of 10 : ISignatureUtils.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

/**
 * @title The interface for common signature utilities.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 */
interface ISignatureUtils {
    // @notice Struct that bundles together a signature and an expiration time for the signature. Used primarily for stack management.
    struct SignatureWithExpiry {
        // the signature itself, formatted as a single bytes object
        bytes signature;
        // the expiration timestamp (UTC) of the signature
        uint256 expiry;
    }

    // @notice Struct that bundles together a signature, a salt for uniqueness, and an expiration time for the signature. Used primarily for stack management.
    struct SignatureWithSaltAndExpiry {
        // the signature itself, formatted as a single bytes object
        bytes signature;
        // the salt used to generate the signature
        bytes32 salt;
        // the expiration timestamp (UTC) of the signature
        uint256 expiry;
    }
}

Settings
{
  "remappings": [
    "@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "eigenlayer-contracts/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/",
    "eigenlayer-middleware/=lib/eigenlayer-middleware/src/",
    "src/=lib/eigenlayer-middleware/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": false,
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"contract ILagrangeService","name":"_service","type":"address"},{"internalType":"contract IVoteWeigher","name":"_voteWeigher","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"chainID","type":"uint32"},{"indexed":true,"internalType":"uint32","name":"epochPeriodIndex","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"flagBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"flagEpoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"EpochPeriodUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"chainID","type":"uint256"},{"indexed":true,"internalType":"uint8","name":"quorumNumber","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"genesisBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"freezeDuration","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"minWeight","type":"uint96"},{"indexed":false,"internalType":"uint96","name":"maxWeight","type":"uint96"}],"name":"InitCommittee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"signAddress","type":"address"}],"name":"SignAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"chainID","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"epochNumber","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"current","type":"bytes32"}],"name":"UpdateCommittee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"chainID","type":"uint256"},{"indexed":true,"internalType":"uint8","name":"quorumNumber","type":"uint8"},{"indexed":false,"internalType":"int256","name":"l1Bias","type":"int256"},{"indexed":false,"internalType":"uint256","name":"genesisBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"freezeDuration","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"minWeight","type":"uint96"},{"indexed":false,"internalType":"uint96","name":"maxWeight","type":"uint96"}],"name":"UpdateCommitteeParams","type":"event"},{"inputs":[],"name":"INNER_NODE_PREFIX","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LEAF_NODE_PREFIX","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256[2][]","name":"additionalBlsPubKeys","type":"uint256[2][]"}],"name":"addBlsPubKeys","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"signAddress","type":"address"},{"internalType":"uint256[2][]","name":"blsPubKeys","type":"uint256[2][]"}],"name":"addOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainIDs","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"committeeAddrs","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"committeeParams","outputs":[{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"int256","name":"l1Bias","type":"int256"},{"internalType":"uint256","name":"genesisBlock","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"freezeDuration","type":"uint256"},{"internalType":"uint8","name":"quorumNumber","type":"uint8"},{"internalType":"uint96","name":"minWeight","type":"uint96"},{"internalType":"uint96","name":"maxWeight","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"committees","outputs":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint224","name":"updatedBlock","type":"uint224"},{"internalType":"uint32","name":"leafCount","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"opAddr","type":"address"},{"internalType":"uint32","name":"chainID","type":"uint32"}],"name":"getBlsPubKeyVotingPowers","outputs":[{"internalType":"uint96[]","name":"individualVotingPowers","type":"uint96[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"getBlsPubKeys","outputs":[{"internalType":"uint256[2][]","name":"","type":"uint256[2][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getCommittee","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint224","name":"updatedBlock","type":"uint224"},{"internalType":"uint32","name":"leafCount","type":"uint32"}],"internalType":"struct ILagrangeCommittee.CommitteeData","name":"currentCommittee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_chainID","type":"uint32"},{"internalType":"uint256","name":"_epochNumber","type":"uint256"}],"name":"getEpochInterval","outputs":[{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_freezeBlock","type":"uint256"},{"internalType":"uint256","name":"_endBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getEpochNumber","outputs":[{"internalType":"uint256","name":"epochNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"},{"internalType":"uint32","name":"index","type":"uint32"}],"name":"getEpochPeriodByIndex","outputs":[{"internalType":"uint256","name":"flagBlock","type":"uint256"},{"internalType":"uint256","name":"flagEpoch","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"}],"name":"getEpochPeriodCount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"opAddr","type":"address"},{"internalType":"uint32","name":"chainID","type":"uint32"}],"name":"getOperatorVotingPower","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"getTokenListForOperator","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"isUnregisterable","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"},{"internalType":"uint256","name":"epochNumber","type":"uint256"}],"name":"isUpdatable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"operatorsStatus","outputs":[{"internalType":"address","name":"signAddress","type":"address"},{"internalType":"uint8","name":"subscribedChainCount","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"},{"internalType":"uint256","name":"genesisBlock","type":"uint256"},{"internalType":"uint256","name":"epochPeriod","type":"uint256"},{"internalType":"uint256","name":"freezeDuration","type":"uint256"},{"internalType":"uint8","name":"quorumNumber","type":"uint8"},{"internalType":"uint96","name":"minWeight","type":"uint96"},{"internalType":"uint96","name":"maxWeight","type":"uint96"}],"name":"registerChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint32[]","name":"indices","type":"uint32[]"}],"name":"removeBlsPubKeys","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"removeOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"},{"internalType":"uint256","name":"epochNumber","type":"uint256"}],"name":"revertEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"service","outputs":[{"internalType":"contract ILagrangeService","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"}],"name":"setFirstEpochPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint32","name":"chainID","type":"uint32"}],"name":"subscribeChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"address","name":"","type":"address"}],"name":"subscribedChains","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"operators","type":"address[]"},{"internalType":"uint32","name":"chainID","type":"uint32"}],"name":"unsubscribeByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint32","name":"chainID","type":"uint32"}],"name":"unsubscribeChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"},{"internalType":"uint256","name":"epochNumber","type":"uint256"}],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint32","name":"index","type":"uint32"},{"internalType":"uint256[2]","name":"blsPubKey","type":"uint256[2]"}],"name":"updateBlsPubKey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"chainID","type":"uint32"},{"internalType":"int256","name":"l1Bias","type":"int256"},{"internalType":"uint256","name":"genesisBlock","type":"uint256"},{"internalType":"uint256","name":"epochPeriod","type":"uint256"},{"internalType":"uint256","name":"freezeDuration","type":"uint256"},{"internalType":"uint8","name":"quorumNumber","type":"uint8"},{"internalType":"uint96","name":"minWeight","type":"uint96"},{"internalType":"uint96","name":"maxWeight","type":"uint96"}],"name":"updateChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"newSignAddress","type":"address"}],"name":"updateSignAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"updatedEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voteWeigher","outputs":[{"internalType":"contract IVoteWeigher","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60c06040523480156200001157600080fd5b5060405162004e3d38038062004e3d833981016040819052620000349162000134565b6001600160a01b03808316608052811660a0526200005162000059565b505062000173565b600054610100900460ff1615620000c65760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101562000119576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6001600160a01b03811681146200013157600080fd5b50565b600080604083850312156200014857600080fd5b825162000155816200011b565b602084015190925062000168816200011b565b809150509250929050565b60805160a051614c49620001f4600039600081816107a50152818161154301528181611adb01528181611c0501526120310152600081816107140152818161081f01528181610c81015281816110c801528181611cb00152818161219501528181612457015281816124ed015281816127e10152612a180152614c496000f3fe608060405234801561001057600080fd5b50600436106102535760003560e01c80637285645511610146578063bd7cd8ab116100c3578063d598d4c911610087578063d598d4c91461070f578063def9e7d514610736578063e464b31f1461077a578063ea37ac971461078d578063ef030673146107a0578063f2fde38b146107c757600080fd5b8063bd7cd8ab146106b0578063bf988ab6146106c3578063c4d66de8146106d6578063c7e8a4f3146106e9578063c8491506146106fc57600080fd5b806395703d081161010a57806395703d08146105a0578063a43dd8dd146105f7578063a63490a214610617578063a6b150681461068a578063ac8a584a1461069d57600080fd5b8063728564551461049857806378d81d081461054257806385ab9a7a146105555780638da5cb5b14610568578063935a9b6a1461058d57600080fd5b80633bc72805116101d457806356bf7c251161019857806356bf7c25146104275780635af1a88f146104475780636b11c38e14610472578063715018a614610485578063727cb30f1461048d57600080fd5b80633bc72805146103825780633d6a26791461039557806349274bc2146103a85780634db6f74a146103bb57806353b7a0ff146103e957600080fd5b806319a74c5f1161021b57806319a74c5f146102ee57806324ca7a48146103185780632c36c7181461033857806338fa59d11461034b5780633bb8285f1461036f57600080fd5b806309d23e24146102585780630c57b9d4146102855780630e9f564b1461029a5780630f225b84146102ad57806313538c7f146102db575b600080fd5b61026b61026636600461428a565b6107da565b60405163ffffffff90911681526020015b60405180910390f35b610298610293366004614304565b610814565b005b6102986102a8366004614372565b610c76565b6102c06102bb3660046143a7565b610d76565b6040805193845260208401929092529082015260600161027c565b6102986102e93660046143f7565b610e20565b6103016102fc366004614478565b610eb3565b60408051921515835260208301919091520161027c565b61032b610326366004614372565b611064565b60405161027c9190614495565b6102986103463660046144e2565b6110bd565b610356600160f81b81565b6040516001600160f81b0319909116815260200161027c565b6102c061037d36600461451b565b6111c4565b6102986103903660046143a7565b611264565b6103016103a3366004614537565b611898565b6102986103b6366004614537565b6118c8565b6103db6103c9366004614537565b606b6020526000908152604090205481565b60405190815260200161027c565b6104176103f7366004614552565b606c60209081526000928352604080842090915290825290205460ff1681565b604051901515815260200161027c565b61043a610435366004614478565b611988565b60405161027c919061456e565b61045a610455366004614372565b611b5e565b6040516001600160601b03909116815260200161027c565b610298610480366004614372565b611ca5565b610298612119565b610356600160f91b81565b6104f86104a6366004614537565b606660205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909160ff8116906001600160601b036101008204811691600160681b90041688565b604080519889526020890197909752958701949094526060860192909252608085015260ff1660a08401526001600160601b0390811660c08401521660e08201526101000161027c565b6103db6105503660046143a7565b61212d565b6104176105633660046143a7565b61216c565b6033546001600160a01b03165b6040516001600160a01b03909116815260200161027c565b61029861059b3660046145af565b61218a565b6105d66105ae366004614478565b606a60205260009081526040902080546002909101546001600160a01b039091169060ff1682565b604080516001600160a01b03909316835260ff90911660208301520161027c565b61060a610605366004614478565b6122ec565b60405161027c9190614603565b6106616106253660046143a7565b6067602090815260009283526040808420909152908252902080546001909101546001600160e01b03811690600160e01b900463ffffffff1683565b604080519384526001600160e01b03909216602084015263ffffffff169082015260600161027c565b6102986106983660046143a7565b612382565b6102986106ab366004614478565b61244c565b6102986106be3660046146b1565b6124e2565b6105756106d13660046143a7565b612605565b6102986106e4366004614478565b61263d565b6102986106f73660046146f9565b6127d6565b61029861070a36600461475e565b6128eb565b6105757f000000000000000000000000000000000000000000000000000000000000000081565b6107496107443660046143a7565b612989565b60408051825181526020808401516001600160e01b0316908201529181015163ffffffff169082015260600161027c565b6102986107883660046147d5565b612a0d565b61026b61079b366004614537565b612be4565b6105757f000000000000000000000000000000000000000000000000000000000000000081565b6102986107d5366004614478565b612c16565b606581815481106107ea57600080fd5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108655760405162461bcd60e51b815260040161085c90614822565b60405180910390fd5b6001600160a01b0383166000908152606a6020908152604080832060010180548251818502810185019093528083529192909190849084015b828210156108ee5760008481526020902060408051808201918290529160028581029091019182845b8154815260200190600101908083116108c75750505050508152602001906001019061089e565b5050825192935050508281116109605760405162461bcd60e51b815260206004820152603160248201527f496e76616c696420696e6469636573206c656e6774682c20424c53206b6579736044820152701031b0b73737ba1031329032b6b83a3c9760791b606482015260840161085c565b60005b83811015610aa65784848281811061097d5761097d61486f565b90506020020160208101906109929190614537565b63ffffffff1682116109d65760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b604482015260640161085c565b6000838686848181106109eb576109eb61486f565b9050602002016020810190610a009190614537565b63ffffffff1681518110610a1657610a1661486f565b6020026020010151600060028110610a3057610a3061486f565b6020020152600083868684818110610a4a57610a4a61486f565b9050602002016020810190610a5f9190614537565b63ffffffff1681518110610a7557610a7561486f565b6020026020010151600160028110610a8f57610a8f61486f565b602002015280610a9e8161489b565b915050610963565b506000805b82811015610b8357838181518110610ac557610ac561486f565b6020026020010151600060028110610adf57610adf61486f565b6020020151151580610b205750838181518110610afe57610afe61486f565b6020026020010151600160028110610b1857610b1861486f565b602002015115155b15610b7157838181518110610b3757610b3761486f565b6020026020010151848363ffffffff1681518110610b5757610b5761486f565b60200260200101819052508180610b6d906148b6565b9250505b80610b7b8161489b565b915050610aab565b5060008163ffffffff1667ffffffffffffffff811115610ba557610ba56148da565b604051908082528060200260200182016040528015610bde57816020015b610bcb61411a565b815260200190600190039081610bc35790505b50905060005b8263ffffffff16811015610c3c57848181518110610c0457610c0461486f565b6020026020010151828281518110610c1e57610c1e61486f565b60200260200101819052508080610c349061489b565b915050610be4565b506001600160a01b0387166000908152606a602090815260409091208251610c6c92600190920191840190614138565b5050505050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610cbe5760405162461bcd60e51b815260040161085c90614822565b63ffffffff81166000908152606c602090815260408083206001600160a01b038616845290915290205460ff16610d075760405162461bcd60e51b815260040161085c906148f0565b600080610d1383611898565b915091508115610d655760405162461bcd60e51b815260206004820152601e60248201527f5468652064656469636174656420636861696e206973206c6f636b65642e0000604482015260640161085c565b610d70848483612c8c565b50505050565b600080600080610d8586612be4565b90505b63ffffffff811615610e18576000806000610da389856111c4565b925092509250818810610e0c578281610dbc848b614935565b610dc6919061494c565b610dd0919061496b565b9650610ddc818861496b565b63ffffffff8a16600090815260666020526040902060040154909550610e029086614935565b9550505050610e18565b50505060001901610d88565b509250925092565b610e28612d46565b63ffffffff881660009081526066602052604090205480610e835760405162461bcd60e51b815260206004820152601560248201527410da185a5b881b9bdd081a5b9a5d1a585b1a5e9959605a1b604482015260640161085c565b610e8d8383612da0565b610e978686612e1a565b610ea88989838a8a8a8a8a8a612e69565b505050505050505050565b6001600160a01b038082166000908152606a602090815260408083208151608081018352815490951685526001810180548351818602810186019094528084529495869586959194858301939092909190879084015b82821015610f595760008481526020902060408051808201918290529160028581029091019182845b815481526020019060010190808311610f3257505050505081526020019060010190610f09565b50505090825250600282015460ff16602080830191909152600383018054604080518285028101850182528281529401939260009084015b82821015610fd65760008481526020908190206040805180820190915260028502909101805463ffffffff168252600190810154828401529083529092019101610f91565b50505091525050604081015190915060ff1615610ff95750600093849350915050565b606081015151600090815b81811015611055576000846060015182815181106110245761102461486f565b60200260200101519050838160200151111561104257806020015193505b508061104d8161489b565b915050611004565b50600196919550909350505050565b606060006110728484611b5e565b63ffffffff84166000908152606660205260409020600501549091506001600160601b036101008204811691600160681b9004166110b1838383613073565b93505050505b92915050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146111055760405162461bcd60e51b815260040161085c90614822565b6001600160a01b0382166000908152606a602052604090206001015461116d5760405162461bcd60e51b815260206004820152601b60248201527f4f70657261746f72206973206e6f7420726567697374657265642e0000000000604482015260640161085c565b6001600160a01b038281166000818152606a602052604080822080546001600160a01b0319169486169485179055517ff29351472086a2d8b1af521f96d65142d14518260a62923a07aa7c9e3c752d849190a35050565b600080600080606760008763ffffffff1663ffffffff16815260200190815260200160002060008663ffffffff166000196111ff9190614935565b815260208082019290925260409081016000208151606081018352815481526001909101546001600160e01b0381169382019390935263ffffffff600160e01b84041691018190526001600160701b03607083901c8116999216975095509350505050565b61126e828261216c565b6112d45760405162461bcd60e51b815260206004820152603160248201527f426c6f636b206e756d626572206973207072696f7220746f20636f6d6d69747460448201527032b290333932b2bd32903bb4b73237bb9760791b606482015260840161085c565b63ffffffff82166000908152606b602052604090205481906112f790600161496b565b1461134f5760405162461bcd60e51b815260206004820152602260248201527f5468652065706f63684e756d626572206973206e6f742073657175656e746961604482015261361760f11b606482015260840161085c565b63ffffffff821660008181526066602090815260408083208151610100808201845282548252600183015482860152600283015482850152600383015460608301526004830154608083015260059092015460ff811660a083018190529281046001600160601b0390811660c08401819052600160681b9092041660e08301819052968652606885528386208054855181880281018801909652808652929793969195939491939192909183018282801561143357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611415575b505050505090506000815190506000805b8281101561149657606a60008583815181106114625761146261486f565b6020908102919091018101516001600160a01b03168252810191909152604001600020600190810154929092019101611444565b5060008167ffffffffffffffff8111156114b2576114b26148da565b6040519080825280602002602001820160405280156114db578160200160208202803683370190505b5090506000915060005b838110156117595760008582815181106115015761150161486f565b602002602001015190506000606a6000836001600160a01b03166001600160a01b03168152602001908152602001600020905060006115ee82600101805490507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663da4098588e876040518363ffffffff1660e01b81526004016115a692919060ff9290921682526001600160a01b0316602082015260400190565b602060405180830381865afa1580156115c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e79190614983565b8c8c613212565b90508060005b6001600160601b038216156117485760008c8c016001600160601b0316836001600160601b03161061162757508a61164b565b8b6001600160601b0316836001600160601b0316111561164857508b61164b565b50815b808303925061171e868660010184815481106116695761166961486f565b600091825260209091206040805180820191829052926002908102909201919082845b81548152602001906001019080831161168c575050505050838151602080840151604051600160f81b9281019290925260218201929092526041810191909152606084901b6bffffffffffffffffffffffff1916606182015260a082901b6001600160a01b03191660758201526000906081016040516020818303038152906040528051906020012090509392505050565b888a815181106117305761173061486f565b602090810291909101015250600197880197016115f4565b5050600190930192506114e5915050565b50600082815b6001821115611859576001828101811c905b838110156117e1576117b88660018303815181106117915761179161486f565b60200260200101518783815181106117ab576117ab61486f565b6020026020010151613264565b86600183901c815181106117ce576117ce61486f565b6020908102919091010152600201611771565b50826001166001141561184f5761182d8560018503815181106118065761180661486f565b6020026020010151606960008560ff1660ff16815260200190815260200160002054613264565b8560018303815181106118425761184261486f565b6020026020010181815250505b915060010161175f565b50831561187e57826000815181106118735761187361486f565b602002602001015191505b5061188b8b8b83866132a3565b5050505050505050505050565b60008060006118a78443613340565b90506000806118b68684610d76565b43919091119890975095505050505050565b6118d0612d46565b60006118db82612be4565b905063ffffffff8116156118ed575050565b63ffffffff821660009081526066602090815260408083208151610100808201845282548083526001840154958301959095526002830154938201939093526003820154606082018190526004830154608083015260059092015460ff811660a08301526001600160601b03938104841660c0830152600160681b900490921660e083015290926119829286929091906133da565b50505b50565b6065546001600160a01b0382166000908152606a6020526040812060020154606092919060ff1667ffffffffffffffff8111156119c7576119c76148da565b6040519080825280602002602001820160405280156119f0578160200160208202803683370190505b5090506000805b83811015611ac357600060658281548110611a1457611a1461486f565b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16808352606c825260408084206001600160a01b038c16855290925291205490915060ff1615611ab05763ffffffff811660009081526066602052604090206005015460ff168484611a898161489b565b955081518110611a9b57611a9b61486f565b602002602001019060ff16908160ff16815250505b5080611abb8161489b565b9150506119f7565b50604051635ce8f06760e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635ce8f06790611b109085906004016149a0565b600060405180830381865afa158015611b2d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b5591908101906149e6565b95945050505050565b63ffffffff81166000908152606660209081526040808320815161010080820184528254825260018301548286015260028301548285015260038301546060830152600480840154608084015260059093015460ff811660a084018190529181046001600160601b0390811660c0850152600160681b9091041660e08301528351631b48130b60e31b8152928301526001600160a01b0387811660248401529251909385937f0000000000000000000000000000000000000000000000000000000000000000169263da40985892604480830193928290030181865afa158015611c4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c709190614983565b6001600160a01b0386166000908152606a602052604090206001015460c084015160e0850151929350611b5592849190613212565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611ced5760405162461bcd60e51b815260040161085c90614822565b63ffffffff8116600090815260666020526040902054611d5e5760405162461bcd60e51b815260206004820152602660248201527f5468652064656469636174656420636861696e206973206e6f742072656769736044820152653a32b932b21760d11b606482015260840161085c565b6000611d6982611898565b5090508015611dba5760405162461bcd60e51b815260206004820152601e60248201527f5468652064656469636174656420636861696e206973206c6f636b65642e0000604482015260640161085c565b6001600160a01b0383166000908152606a6020908152604080832060030180548251818502810185019093528083529192909190849084015b82821015611e385760008481526020908190206040805180820190915260028502909101805463ffffffff168252600190810154828401529083529092019101611df3565b5050825192935060009150505b81811015611efd576000838281518110611e6157611e6161486f565b602002602001015190508563ffffffff16816000015163ffffffff161415611eea5743816020015110611eea5760405162461bcd60e51b815260206004820152602b60248201527f5468652064656463696174656420636861696e206973207768696c6520756e7360448201526a3ab139b1b934b134b7339760a91b606482015260840161085c565b5080611ef58161489b565b915050611e45565b5063ffffffff84166000908152606c602090815260408083206001600160a01b038916845290915290205460ff1615611f8b5760405162461bcd60e51b815260206004820152602a60248201527f5468652064656469636174656420636861696e20697320616c726561647920736044820152693ab139b1b934b132b21760b11b606482015260840161085c565b63ffffffff84166000908152606660209081526040808320815161010080820184528254825260018301548286015260028301548285015260038301546060830152600480840154608084015260059093015460ff811660a084018190529181046001600160601b0390811660c0850152600160681b9091041660e08301528351631b48130b60e31b8152928301526001600160a01b038a8116602484015292519094937f00000000000000000000000000000000000000000000000000000000000000009093169263da40985892604480820193918290030181865afa15801561207a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209e9190614983565b90508160c001516001600160601b0316816001600160601b031610156121065760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e7420566f7465205765696768740000000000000000604482015260640161085c565b612110878761355e565b50505050505050565b612121612d46565b61212b600061360d565b565b63ffffffff82166000908152606660205260408120600101546121509083614aab565b915061215c8383613340565b9050806110b75750600192915050565b60008061217e846102bb600186614935565b50431195945050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146121d25760405162461bcd60e51b815260040161085c90614822565b8160005b818110156122e55760008585838181106121f2576121f261486f565b90506020020160208101906122079190614478565b63ffffffff85166000908152606c602090815260408083206001600160a01b038516845290915290205490915060ff166122535760405162461bcd60e51b815260040161085c906148f0565b63ffffffff84166000908152606c602090815260408083206001600160a01b03851684529091529020805460ff1916905561228e848261365f565b6001600160a01b0381166000908152606a60205260408120600201805460ff16916122b883614aec565b91906101000a81548160ff021916908360ff160217905550505080806122dd9061489b565b9150506121d6565b5050505050565b6001600160a01b0381166000908152606a60209081526040808320600101805482518185028101850190935280835260609492939192909184015b828210156123775760008481526020902060408051808201918290529160028581029091019182845b81548152602001906001019080831161235057505050505081526020019060010190612327565b505050509050919050565b61238a612d46565b63ffffffff82166000908152606b602052604090205481146123f95760405162461bcd60e51b815260206004820152602260248201527f5468652065706f63684e756d626572206973206e6f7420746865206c617465736044820152613a1760f11b606482015260840161085c565b63ffffffff82166000908152606760209081526040808320848452909152812081815560019081019190915561242f9082614935565b63ffffffff9092166000908152606b602052604090209190915550565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146124945760405162461bcd60e51b815260040161085c90614822565b6001600160a01b0381166000908152606a6020526040812080546001600160a01b0319168155906124c8600183018261418e565b60028201805460ff191690556119826003830160006141af565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461252a5760405162461bcd60e51b815260040161085c90614822565b6125978282808060200260200160405190810160405280939291908181526020016000905b8282101561258d576040805180820182529080840287019060029083908390808284376000920191909152505050815260019091019060200161254f565b5050505050613845565b611982838383808060200260200160405190810160405280939291908181526020016000905b828210156125fb57604080518082018252908084028701906002908390839080828437600092019190915250505081526001909101906020016125bd565b505050505061395f565b6068602052816000526040600020818154811061262157600080fd5b6000918252602090912001546001600160a01b03169150829050565b600054610100900460ff161580801561265d5750600054600160ff909116105b806126775750303b158015612677575060005460ff166001145b6126da5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161085c565b6000805460ff1916600117905580156126fd576000805461ff0019166101001790555b60015b60148160ff16116127825761275d6069600061271d600185614b09565b60ff1660ff16815260200190815260200160002054606960006001856127439190614b09565b60ff1660ff16815260200190815260200160002054613264565b60ff82166000908152606960205260409020558061277a81614b2c565b915050612700565b5061278c8261360d565b80156127d2576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461281e5760405162461bcd60e51b815260040161085c90614822565b6040805160208084028201810190925282815261287c918490849081906000908501821561258d576040805180820182529080840287019060029083908390808284376000920191909152505050815260019091019060200161254f565b610d7084848484808060200260200160405190810160405280939291908181526020016000905b828210156128e157604080518082018252908084028701906002908390839080828437600092019190915250505081526001909101906020016128a3565b5050505050613ac7565b6128f3612d46565b63ffffffff8716600090815260666020526040902054156129665760405162461bcd60e51b815260206004820152602760248201527f436f6d6d69747465652068617320616c7265616479206265656e20696e69746960448201526630b634bd32b21760c91b606482015260840161085c565b6129708282612da0565b61297a8585612e1a565b61211087878787878787613c28565b60408051606081018252600080825260208201819052918101829052906129b0848461212d565b63ffffffff9485166000908152606760209081526040808320938352928152908290208251606081018452815481526001909101546001600160e01b03811692820192909252600160e01b90910490951690850152509192915050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614612a555760405162461bcd60e51b815260040161085c90614822565b803515801590612a685750602081013515155b612aae5760405162461bcd60e51b815260206004820152601760248201527624b73b30b634b21021262990283ab13634b19025b2bc9760491b604482015260640161085c565b6001600160a01b0383166000908152606a60205260409020600101805463ffffffff841610612b0f5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b604482015260640161085c565b612baf81805480602002602001604051908101604052809291908181526020016000905b82821015612b835760008481526020902060408051808201918290529160028581029091019182845b815481526020019060010190808311612b5c57505050505081526020019060010190612b33565b505060408051808201825292508691506002908390839080828437600092019190915250613ecc915050565b81818463ffffffff1681548110612bc857612bc861486f565b90600052602060002090600202019060026122e59291906141d0565b63ffffffff90811660009081526067602090815260408083206000198452909152902060010154600160e01b90041690565b612c1e612d46565b6001600160a01b038116612c835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161085c565b6119858161360d565b63ffffffff8281166000818152606c602090815260408083206001600160a01b03891684528252808320805460ff19169055606a825280832081518083019092529381528082018681526003850180546001818101835591865293852092516002948502909301805463ffffffff191693909716929092178655519401939093559181018054919260ff90921691612d2383614aec565b91906101000a81548160ff021916908360ff16021790555050610d70838561365f565b6033546001600160a01b0316331461212b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161085c565b6000826001600160601b0316118015612dd55750612dbf826002614b4c565b6001600160601b0316816001600160601b031610155b6127d25760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081b5a5b8bdb585e0815d95a59da1d60521b604482015260640161085c565b8082116127d25760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420667265657a65206475726174696f6e000000000000000000604482015260640161085c565b63ffffffff89166000908152606660205260409020600301548514612ecf576000612e9e8a612e99600143614935565b613340565b612ea990600161496b565b90506000612ebc8b6102bb600185614935565b92505050612ecc8b82848a6133da565b50505b6040518061010001604052808881526020018981526020018781526020018681526020018581526020018460ff168152602001836001600160601b03168152602001826001600160601b0316815250606660008b63ffffffff1663ffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff021916908360ff16021790555060c08201518160050160016101000a8154816001600160601b0302191690836001600160601b0316021790555060e082015181600501600d6101000a8154816001600160601b0302191690836001600160601b031602179055509050508260ff168963ffffffff167fc0f5fe53277733159fe7a739f75b98e959a28a0859db2c46e04a5f4820b964008a8989898888604051613060969594939291909586526020860194909452604085019290925260608401526001600160601b0390811660808401521660a082015260c00190565b60405180910390a3505050505050505050565b60606000613082858585613fa7565b63ffffffff16905060008167ffffffffffffffff8111156130a5576130a56148da565b6040519080825280602002602001820160405280156130ce578160200160208202803683370190505b509050816130df57915061320b9050565b6000865b8686016001600160601b0316816001600160601b03161061313757858383806001019450815181106131175761311761486f565b6001600160601b03909216602092830291909101909101528590036130e3565b856001600160601b0316816001600160601b031611156131ca578683838060010194508151811061316a5761316a61486f565b60200260200101906001600160601b031690816001600160601b0316815250508681038383806001019450815181106131a5576131a561486f565b60200260200101906001600160601b031690816001600160601b031681525050613204565b808383806001019450815181106131e3576131e361486f565b60200260200101906001600160601b031690816001600160601b0316815250505b5090925050505b9392505050565b6000826001600160601b0316846001600160601b031610156132365750600061325c565b6001600160601b0380831663ffffffff871602908516811015613257578094505b508390505b949350505050565b604051600160f91b6020820152602181018390526041810182905260009060610160405160208183030381529060405280519060200120905092915050565b63ffffffff80851660008181526067602090815260408083208884528252808320878155436001600160e01b0316958716600160e01b026001600160e01b03191695909517600190950194909455828252606b905282902085905590518491907f0762b282466177911d330a0c27e7de4e70f0c930671f2080b7cf2dcb3b100f95906133329086815260200190565b60405180910390a350505050565b63ffffffff8216600090815260666020526040812060020154821015613368575060006110b7565b600061337384612be4565b90505b63ffffffff8116156133d357600080600061339187856111c4565b9250925092508286106133c757806133a98488614935565b6133b39190614b91565b6133bd908361496b565b94505050506133d3565b50505060001901613376565b5092915050565b63ffffffff808516600090815260676020908152604080832060001984529091528120600190810154919261341792600160e01b90041690614bb3565b905060405180606001604052806000801b815260200161343685614048565b6001600160701b0316607061344a88614048565b6001600160701b03166001600160e01b0316901b6134689190614bdb565b6001600160e01b0316815260200161347f846140b5565b63ffffffff9081169091528681166000908152606760205260408120916134aa908516600019614935565b81526020808201929092526040908101600090812084518155848401519483015163ffffffff908116600160e01b9081026001600160e01b03978816176001938401558b8216808552606787528585206000198652875293859020909201805491881692830291909616179094558151888152928301879052908201859052907f8fa8b10df976e6a9ed8e4d3f478b1a80d6aad3953aee7acc2c42a7533b735d089060600160405180910390a35050505050565b63ffffffff81166000908152606c602090815260408083206001600160a01b03861684528252808320805460ff19166001179055606a9091528120600201805460ff16916135ab83614b2c565b825460ff9182166101009390930a92830291909202199091161790555063ffffffff1660009081526068602090815260408220805460018101825590835291200180546001600160a01b039092166001600160a01b0319909216919091179055565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b63ffffffff8216600090815260686020526040812054905b818110156137c35763ffffffff8416600090815260686020526040902080546001600160a01b0385169190839081106136b2576136b261486f565b6000918252602090912001546001600160a01b031614156137b15763ffffffff841660009081526068602052604090206136ed600184614935565b815481106136fd576136fd61486f565b600091825260208083209091015463ffffffff871683526068909152604090912080546001600160a01b03909216918390811061373c5761373c61486f565b600091825260208083209190910180546001600160a01b0319166001600160a01b03949094169390931790925563ffffffff8616815260689091526040902080548061378a5761378a614bfd565b600082815260209020810160001990810180546001600160a01b03191690550190556137c3565b806137bb8161489b565b915050613677565b5063ffffffff83166000908152606860205260409020546137e590600161496b565b81146119825760405162461bcd60e51b815260206004820152602960248201527f4f70657261746f7220646f65736e277420657869737420696e20636f6d6d69746044820152683a32b2a0b23239399760b91b606482015260840161085c565b805161388c5760405162461bcd60e51b815260206004820152601660248201527522b6b83a3c9021262990283ab13634b19025b2bcb99760511b604482015260640161085c565b805160005b81811015611982578281815181106138ab576138ab61486f565b60200260200101516000600281106138c5576138c561486f565b60200201511580159061390757508281815181106138e5576138e561486f565b60200260200101516001600281106138ff576138ff61486f565b602002015115155b61394d5760405162461bcd60e51b815260206004820152601760248201527624b73b30b634b21021262990283ab13634b19025b2bc9760491b604482015260640161085c565b806139578161489b565b915050613891565b6001600160a01b0382166000908152606a6020526040902060018101546139c85760405162461bcd60e51b815260206004820152601b60248201527f4f70657261746f72206973206e6f7420726567697374657265642e0000000000604482015260640161085c565b815160005b818110156122e557613a6f83600101805480602002602001604051908101604052809291908181526020016000905b82821015613a4c5760008481526020902060408051808201918290529160028581029091019182845b815481526020019060010190808311613a25575050505050815260200190600101906139fc565b50505050858381518110613a6257613a6261486f565b6020026020010151613ecc565b82600101848281518110613a8557613a8561486f565b6020908102919091018101518254600181018455600093845291909220613ab49260029283029091019161420a565b5080613abf8161489b565b9150506139cd565b6001600160a01b0383166000908152606a6020526040812080546001600160a01b031916815590613afb600183018261418e565b60028201805460ff19169055613b156003830160006141af565b50506001600160a01b038381166000908152606a6020526040812080546001600160a01b0319169285169290921782558251905b81811015613c2057613bc883600101805480602002602001604051908101604052809291908181526020016000905b82821015613a4c5760008481526020902060408051808201918290529160028581029091019182845b815481526020019060010190808311613ba157505050505081526020019060010190613b78565b82600101848281518110613bde57613bde61486f565b6020908102919091018101518254600181018455600093845291909220613c0d9260029283029091019161420a565b5080613c188161489b565b915050613b49565b505050505050565b604051806101000160405280438152602001600081526020018781526020018681526020018581526020018460ff168152602001836001600160601b03168152602001826001600160601b0316815250606660008963ffffffff1663ffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff021916908360ff16021790555060c08201518160050160016101000a8154816001600160601b0302191690836001600160601b0316021790555060e082015181600501600d6101000a8154816001600160601b0302191690836001600160601b0316021790555090505060405180606001604052806000801b815260200160006001600160e01b03168152602001600063ffffffff16815250606760008963ffffffff1663ffffffff16815260200190815260200160002060008081526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160e01b0302191690836001600160e01b03160217905550604082015181600101601c6101000a81548163ffffffff021916908363ffffffff16021790555090505060658790806001815401808255809150506001900390600052602060002090600891828204019190066004029091909190916101000a81548163ffffffff021916908363ffffffff160217905550613e5e876118c8565b60408051878152602081018790529081018590526001600160601b0380841660608301528216608082015260ff84169063ffffffff8916907f443f7a0c0eb557351b38f3fed112889e529704fb0ccaac63b1f0914816d880f39060a00160405180910390a350505050505050565b815160005b81811015610d705782518451859083908110613eef57613eef61486f565b6020026020010151600060028110613f0957613f0961486f565b6020020151141580613f5257508260016020020151848281518110613f3057613f3061486f565b6020026020010151600160028110613f4a57613f4a61486f565b602002015114155b613f955760405162461bcd60e51b81526020600482015260146024820152734475706c69636174656420426c735075624b657960601b604482015260640161085c565b80613f9f8161489b565b915050613ed1565b6000826001600160601b0316846001600160601b03161015613fcb5750600061320b565b6000826001600160601b0316600186036001600160601b031681613ff157613ff1614b7b565b04600101905063ffffffff8016816001600160601b031611156140415760405162461bcd60e51b81526020600482015260086024820152674f766572466c6f7760c01b604482015260640161085c565b905061320b565b60006001600160701b038211156140b15760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663132206269747360c81b606482015260840161085c565b5090565b600063ffffffff8211156140b15760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b606482015260840161085c565b60405180604001604052806002906020820280368337509192915050565b828054828255906000526020600020906002028101928215614182579160200282015b82811115614182578251614172908390600261420a565b509160200191906002019061415b565b506140b1929150614238565b50805460008255600202906000526020600020908101906119859190614238565b50805460008255600202906000526020600020908101906119859190614252565b82600281019282156141fe579160200282015b828111156141fe5782358255916020019190600101906141e3565b506140b1929150614275565b82600281019282156141fe579160200282015b828111156141fe57825182559160200191906001019061421d565b808211156140b15760008082556001820155600201614238565b5b808211156140b157805463ffffffff1916815560006001820155600201614253565b5b808211156140b15760008155600101614276565b60006020828403121561429c57600080fd5b5035919050565b6001600160a01b038116811461198557600080fd5b60008083601f8401126142ca57600080fd5b50813567ffffffffffffffff8111156142e257600080fd5b6020830191508360208260051b85010111156142fd57600080fd5b9250929050565b60008060006040848603121561431957600080fd5b8335614324816142a3565b9250602084013567ffffffffffffffff81111561434057600080fd5b61434c868287016142b8565b9497909650939450505050565b803563ffffffff8116811461436d57600080fd5b919050565b6000806040838503121561438557600080fd5b8235614390816142a3565b915061439e60208401614359565b90509250929050565b600080604083850312156143ba57600080fd5b6143c383614359565b946020939093013593505050565b803560ff8116811461436d57600080fd5b6001600160601b038116811461198557600080fd5b600080600080600080600080610100898b03121561441457600080fd5b61441d89614359565b97506020890135965060408901359550606089013594506080890135935061444760a08a016143d1565b925060c0890135614457816143e2565b915060e0890135614467816143e2565b809150509295985092959890939650565b60006020828403121561448a57600080fd5b813561320b816142a3565b6020808252825182820181905260009190848201906040850190845b818110156144d65783516001600160601b0316835292840192918401916001016144b1565b50909695505050505050565b600080604083850312156144f557600080fd5b8235614500816142a3565b91506020830135614510816142a3565b809150509250929050565b6000806040838503121561452e57600080fd5b61439083614359565b60006020828403121561454957600080fd5b61320b82614359565b6000806040838503121561456557600080fd5b61450083614359565b6020808252825182820181905260009190848201906040850190845b818110156144d65783516001600160a01b03168352928401929184019160010161458a565b6000806000604084860312156145c457600080fd5b833567ffffffffffffffff8111156145db57600080fd5b6145e7868287016142b8565b90945092506145fa905060208501614359565b90509250925092565b60208082528251828201819052600091906040908185019086840185805b8381101561465e57825185835b600281101561464b5782518252918901919089019060010161462e565b5050509385019391860191600101614621565b509298975050505050505050565b60008083601f84011261467e57600080fd5b50813567ffffffffffffffff81111561469657600080fd5b6020830191508360208260061b85010111156142fd57600080fd5b6000806000604084860312156146c657600080fd5b83356146d1816142a3565b9250602084013567ffffffffffffffff8111156146ed57600080fd5b61434c8682870161466c565b6000806000806060858703121561470f57600080fd5b843561471a816142a3565b9350602085013561472a816142a3565b9250604085013567ffffffffffffffff81111561474657600080fd5b6147528782880161466c565b95989497509550505050565b600080600080600080600060e0888a03121561477957600080fd5b61478288614359565b96506020880135955060408801359450606088013593506147a5608089016143d1565b925060a08801356147b5816143e2565b915060c08801356147c5816143e2565b8091505092959891949750929550565b6000806000608084860312156147ea57600080fd5b83356147f5816142a3565b925061480360208501614359565b91508460808501111561481557600080fd5b6040840190509250925092565b6020808252602d908201527f4f6e6c79204c616772616e676520736572766963652063616e2063616c6c207460408201526c3434b990333ab731ba34b7b71760991b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156148af576148af614885565b5060010190565b600063ffffffff808316818114156148d0576148d0614885565b6001019392505050565b634e487b7160e01b600052604160045260246000fd5b60208082526025908201527f5468652064656469636174656420636861696e206973206e6f742073756273636040820152641c9a58995960da1b606082015260800190565b60008282101561494757614947614885565b500390565b600081600019048311821515161561496657614966614885565b500290565b6000821982111561497e5761497e614885565b500190565b60006020828403121561499557600080fd5b815161320b816143e2565b6020808252825182820181905260009190848201906040850190845b818110156144d657835160ff16835292840192918401916001016149bc565b805161436d816142a3565b600060208083850312156149f957600080fd5b825167ffffffffffffffff80821115614a1157600080fd5b818501915085601f830112614a2557600080fd5b815181811115614a3757614a376148da565b8060051b604051601f19603f83011681018181108582111715614a5c57614a5c6148da565b604052918252848201925083810185019188831115614a7a57600080fd5b938501935b82851015614a9f57614a90856149db565b84529385019392850192614a7f565b98975050505050505050565b600080821280156001600160ff1b0384900385131615614acd57614acd614885565b600160ff1b8390038412811615614ae657614ae6614885565b50500190565b600060ff821680614aff57614aff614885565b6000190192915050565b600060ff821660ff841680821015614b2357614b23614885565b90039392505050565b600060ff821660ff811415614b4357614b43614885565b60010192915050565b60006001600160601b0380831681851681830481118215151615614b7257614b72614885565b02949350505050565b634e487b7160e01b600052601260045260246000fd5b600082614bae57634e487b7160e01b600052601260045260246000fd5b500490565b600063ffffffff808316818516808303821115614bd257614bd2614885565b01949350505050565b60006001600160e01b03828116848216808303821115614bd257614bd2614885565b634e487b7160e01b600052603160045260246000fdfea26469706673582212207e06d6f592ec60f91719aba438a13083acfbba4f683aa08b8fa961977d67435c64736f6c634300080c003300000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f000000000000000000000000747dc3f9fe7df7a18dd79f6f40b3a1ed85aa75e8

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102535760003560e01c80637285645511610146578063bd7cd8ab116100c3578063d598d4c911610087578063d598d4c91461070f578063def9e7d514610736578063e464b31f1461077a578063ea37ac971461078d578063ef030673146107a0578063f2fde38b146107c757600080fd5b8063bd7cd8ab146106b0578063bf988ab6146106c3578063c4d66de8146106d6578063c7e8a4f3146106e9578063c8491506146106fc57600080fd5b806395703d081161010a57806395703d08146105a0578063a43dd8dd146105f7578063a63490a214610617578063a6b150681461068a578063ac8a584a1461069d57600080fd5b8063728564551461049857806378d81d081461054257806385ab9a7a146105555780638da5cb5b14610568578063935a9b6a1461058d57600080fd5b80633bc72805116101d457806356bf7c251161019857806356bf7c25146104275780635af1a88f146104475780636b11c38e14610472578063715018a614610485578063727cb30f1461048d57600080fd5b80633bc72805146103825780633d6a26791461039557806349274bc2146103a85780634db6f74a146103bb57806353b7a0ff146103e957600080fd5b806319a74c5f1161021b57806319a74c5f146102ee57806324ca7a48146103185780632c36c7181461033857806338fa59d11461034b5780633bb8285f1461036f57600080fd5b806309d23e24146102585780630c57b9d4146102855780630e9f564b1461029a5780630f225b84146102ad57806313538c7f146102db575b600080fd5b61026b61026636600461428a565b6107da565b60405163ffffffff90911681526020015b60405180910390f35b610298610293366004614304565b610814565b005b6102986102a8366004614372565b610c76565b6102c06102bb3660046143a7565b610d76565b6040805193845260208401929092529082015260600161027c565b6102986102e93660046143f7565b610e20565b6103016102fc366004614478565b610eb3565b60408051921515835260208301919091520161027c565b61032b610326366004614372565b611064565b60405161027c9190614495565b6102986103463660046144e2565b6110bd565b610356600160f81b81565b6040516001600160f81b0319909116815260200161027c565b6102c061037d36600461451b565b6111c4565b6102986103903660046143a7565b611264565b6103016103a3366004614537565b611898565b6102986103b6366004614537565b6118c8565b6103db6103c9366004614537565b606b6020526000908152604090205481565b60405190815260200161027c565b6104176103f7366004614552565b606c60209081526000928352604080842090915290825290205460ff1681565b604051901515815260200161027c565b61043a610435366004614478565b611988565b60405161027c919061456e565b61045a610455366004614372565b611b5e565b6040516001600160601b03909116815260200161027c565b610298610480366004614372565b611ca5565b610298612119565b610356600160f91b81565b6104f86104a6366004614537565b606660205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909160ff8116906001600160601b036101008204811691600160681b90041688565b604080519889526020890197909752958701949094526060860192909252608085015260ff1660a08401526001600160601b0390811660c08401521660e08201526101000161027c565b6103db6105503660046143a7565b61212d565b6104176105633660046143a7565b61216c565b6033546001600160a01b03165b6040516001600160a01b03909116815260200161027c565b61029861059b3660046145af565b61218a565b6105d66105ae366004614478565b606a60205260009081526040902080546002909101546001600160a01b039091169060ff1682565b604080516001600160a01b03909316835260ff90911660208301520161027c565b61060a610605366004614478565b6122ec565b60405161027c9190614603565b6106616106253660046143a7565b6067602090815260009283526040808420909152908252902080546001909101546001600160e01b03811690600160e01b900463ffffffff1683565b604080519384526001600160e01b03909216602084015263ffffffff169082015260600161027c565b6102986106983660046143a7565b612382565b6102986106ab366004614478565b61244c565b6102986106be3660046146b1565b6124e2565b6105756106d13660046143a7565b612605565b6102986106e4366004614478565b61263d565b6102986106f73660046146f9565b6127d6565b61029861070a36600461475e565b6128eb565b6105757f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f81565b6107496107443660046143a7565b612989565b60408051825181526020808401516001600160e01b0316908201529181015163ffffffff169082015260600161027c565b6102986107883660046147d5565b612a0d565b61026b61079b366004614537565b612be4565b6105757f000000000000000000000000747dc3f9fe7df7a18dd79f6f40b3a1ed85aa75e881565b6102986107d5366004614478565b612c16565b606581815481106107ea57600080fd5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f16146108655760405162461bcd60e51b815260040161085c90614822565b60405180910390fd5b6001600160a01b0383166000908152606a6020908152604080832060010180548251818502810185019093528083529192909190849084015b828210156108ee5760008481526020902060408051808201918290529160028581029091019182845b8154815260200190600101908083116108c75750505050508152602001906001019061089e565b5050825192935050508281116109605760405162461bcd60e51b815260206004820152603160248201527f496e76616c696420696e6469636573206c656e6774682c20424c53206b6579736044820152701031b0b73737ba1031329032b6b83a3c9760791b606482015260840161085c565b60005b83811015610aa65784848281811061097d5761097d61486f565b90506020020160208101906109929190614537565b63ffffffff1682116109d65760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b604482015260640161085c565b6000838686848181106109eb576109eb61486f565b9050602002016020810190610a009190614537565b63ffffffff1681518110610a1657610a1661486f565b6020026020010151600060028110610a3057610a3061486f565b6020020152600083868684818110610a4a57610a4a61486f565b9050602002016020810190610a5f9190614537565b63ffffffff1681518110610a7557610a7561486f565b6020026020010151600160028110610a8f57610a8f61486f565b602002015280610a9e8161489b565b915050610963565b506000805b82811015610b8357838181518110610ac557610ac561486f565b6020026020010151600060028110610adf57610adf61486f565b6020020151151580610b205750838181518110610afe57610afe61486f565b6020026020010151600160028110610b1857610b1861486f565b602002015115155b15610b7157838181518110610b3757610b3761486f565b6020026020010151848363ffffffff1681518110610b5757610b5761486f565b60200260200101819052508180610b6d906148b6565b9250505b80610b7b8161489b565b915050610aab565b5060008163ffffffff1667ffffffffffffffff811115610ba557610ba56148da565b604051908082528060200260200182016040528015610bde57816020015b610bcb61411a565b815260200190600190039081610bc35790505b50905060005b8263ffffffff16811015610c3c57848181518110610c0457610c0461486f565b6020026020010151828281518110610c1e57610c1e61486f565b60200260200101819052508080610c349061489b565b915050610be4565b506001600160a01b0387166000908152606a602090815260409091208251610c6c92600190920191840190614138565b5050505050505050565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f1614610cbe5760405162461bcd60e51b815260040161085c90614822565b63ffffffff81166000908152606c602090815260408083206001600160a01b038616845290915290205460ff16610d075760405162461bcd60e51b815260040161085c906148f0565b600080610d1383611898565b915091508115610d655760405162461bcd60e51b815260206004820152601e60248201527f5468652064656469636174656420636861696e206973206c6f636b65642e0000604482015260640161085c565b610d70848483612c8c565b50505050565b600080600080610d8586612be4565b90505b63ffffffff811615610e18576000806000610da389856111c4565b925092509250818810610e0c578281610dbc848b614935565b610dc6919061494c565b610dd0919061496b565b9650610ddc818861496b565b63ffffffff8a16600090815260666020526040902060040154909550610e029086614935565b9550505050610e18565b50505060001901610d88565b509250925092565b610e28612d46565b63ffffffff881660009081526066602052604090205480610e835760405162461bcd60e51b815260206004820152601560248201527410da185a5b881b9bdd081a5b9a5d1a585b1a5e9959605a1b604482015260640161085c565b610e8d8383612da0565b610e978686612e1a565b610ea88989838a8a8a8a8a8a612e69565b505050505050505050565b6001600160a01b038082166000908152606a602090815260408083208151608081018352815490951685526001810180548351818602810186019094528084529495869586959194858301939092909190879084015b82821015610f595760008481526020902060408051808201918290529160028581029091019182845b815481526020019060010190808311610f3257505050505081526020019060010190610f09565b50505090825250600282015460ff16602080830191909152600383018054604080518285028101850182528281529401939260009084015b82821015610fd65760008481526020908190206040805180820190915260028502909101805463ffffffff168252600190810154828401529083529092019101610f91565b50505091525050604081015190915060ff1615610ff95750600093849350915050565b606081015151600090815b81811015611055576000846060015182815181106110245761102461486f565b60200260200101519050838160200151111561104257806020015193505b508061104d8161489b565b915050611004565b50600196919550909350505050565b606060006110728484611b5e565b63ffffffff84166000908152606660205260409020600501549091506001600160601b036101008204811691600160681b9004166110b1838383613073565b93505050505b92915050565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f16146111055760405162461bcd60e51b815260040161085c90614822565b6001600160a01b0382166000908152606a602052604090206001015461116d5760405162461bcd60e51b815260206004820152601b60248201527f4f70657261746f72206973206e6f7420726567697374657265642e0000000000604482015260640161085c565b6001600160a01b038281166000818152606a602052604080822080546001600160a01b0319169486169485179055517ff29351472086a2d8b1af521f96d65142d14518260a62923a07aa7c9e3c752d849190a35050565b600080600080606760008763ffffffff1663ffffffff16815260200190815260200160002060008663ffffffff166000196111ff9190614935565b815260208082019290925260409081016000208151606081018352815481526001909101546001600160e01b0381169382019390935263ffffffff600160e01b84041691018190526001600160701b03607083901c8116999216975095509350505050565b61126e828261216c565b6112d45760405162461bcd60e51b815260206004820152603160248201527f426c6f636b206e756d626572206973207072696f7220746f20636f6d6d69747460448201527032b290333932b2bd32903bb4b73237bb9760791b606482015260840161085c565b63ffffffff82166000908152606b602052604090205481906112f790600161496b565b1461134f5760405162461bcd60e51b815260206004820152602260248201527f5468652065706f63684e756d626572206973206e6f742073657175656e746961604482015261361760f11b606482015260840161085c565b63ffffffff821660008181526066602090815260408083208151610100808201845282548252600183015482860152600283015482850152600383015460608301526004830154608083015260059092015460ff811660a083018190529281046001600160601b0390811660c08401819052600160681b9092041660e08301819052968652606885528386208054855181880281018801909652808652929793969195939491939192909183018282801561143357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611415575b505050505090506000815190506000805b8281101561149657606a60008583815181106114625761146261486f565b6020908102919091018101516001600160a01b03168252810191909152604001600020600190810154929092019101611444565b5060008167ffffffffffffffff8111156114b2576114b26148da565b6040519080825280602002602001820160405280156114db578160200160208202803683370190505b5090506000915060005b838110156117595760008582815181106115015761150161486f565b602002602001015190506000606a6000836001600160a01b03166001600160a01b03168152602001908152602001600020905060006115ee82600101805490507f000000000000000000000000747dc3f9fe7df7a18dd79f6f40b3a1ed85aa75e86001600160a01b031663da4098588e876040518363ffffffff1660e01b81526004016115a692919060ff9290921682526001600160a01b0316602082015260400190565b602060405180830381865afa1580156115c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e79190614983565b8c8c613212565b90508060005b6001600160601b038216156117485760008c8c016001600160601b0316836001600160601b03161061162757508a61164b565b8b6001600160601b0316836001600160601b0316111561164857508b61164b565b50815b808303925061171e868660010184815481106116695761166961486f565b600091825260209091206040805180820191829052926002908102909201919082845b81548152602001906001019080831161168c575050505050838151602080840151604051600160f81b9281019290925260218201929092526041810191909152606084901b6bffffffffffffffffffffffff1916606182015260a082901b6001600160a01b03191660758201526000906081016040516020818303038152906040528051906020012090509392505050565b888a815181106117305761173061486f565b602090810291909101015250600197880197016115f4565b5050600190930192506114e5915050565b50600082815b6001821115611859576001828101811c905b838110156117e1576117b88660018303815181106117915761179161486f565b60200260200101518783815181106117ab576117ab61486f565b6020026020010151613264565b86600183901c815181106117ce576117ce61486f565b6020908102919091010152600201611771565b50826001166001141561184f5761182d8560018503815181106118065761180661486f565b6020026020010151606960008560ff1660ff16815260200190815260200160002054613264565b8560018303815181106118425761184261486f565b6020026020010181815250505b915060010161175f565b50831561187e57826000815181106118735761187361486f565b602002602001015191505b5061188b8b8b83866132a3565b5050505050505050505050565b60008060006118a78443613340565b90506000806118b68684610d76565b43919091119890975095505050505050565b6118d0612d46565b60006118db82612be4565b905063ffffffff8116156118ed575050565b63ffffffff821660009081526066602090815260408083208151610100808201845282548083526001840154958301959095526002830154938201939093526003820154606082018190526004830154608083015260059092015460ff811660a08301526001600160601b03938104841660c0830152600160681b900490921660e083015290926119829286929091906133da565b50505b50565b6065546001600160a01b0382166000908152606a6020526040812060020154606092919060ff1667ffffffffffffffff8111156119c7576119c76148da565b6040519080825280602002602001820160405280156119f0578160200160208202803683370190505b5090506000805b83811015611ac357600060658281548110611a1457611a1461486f565b6000918252602080832060088304015460079092166004026101000a90910463ffffffff16808352606c825260408084206001600160a01b038c16855290925291205490915060ff1615611ab05763ffffffff811660009081526066602052604090206005015460ff168484611a898161489b565b955081518110611a9b57611a9b61486f565b602002602001019060ff16908160ff16815250505b5080611abb8161489b565b9150506119f7565b50604051635ce8f06760e01b81526001600160a01b037f000000000000000000000000747dc3f9fe7df7a18dd79f6f40b3a1ed85aa75e81690635ce8f06790611b109085906004016149a0565b600060405180830381865afa158015611b2d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b5591908101906149e6565b95945050505050565b63ffffffff81166000908152606660209081526040808320815161010080820184528254825260018301548286015260028301548285015260038301546060830152600480840154608084015260059093015460ff811660a084018190529181046001600160601b0390811660c0850152600160681b9091041660e08301528351631b48130b60e31b8152928301526001600160a01b0387811660248401529251909385937f000000000000000000000000747dc3f9fe7df7a18dd79f6f40b3a1ed85aa75e8169263da40985892604480830193928290030181865afa158015611c4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c709190614983565b6001600160a01b0386166000908152606a602052604090206001015460c084015160e0850151929350611b5592849190613212565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f1614611ced5760405162461bcd60e51b815260040161085c90614822565b63ffffffff8116600090815260666020526040902054611d5e5760405162461bcd60e51b815260206004820152602660248201527f5468652064656469636174656420636861696e206973206e6f742072656769736044820152653a32b932b21760d11b606482015260840161085c565b6000611d6982611898565b5090508015611dba5760405162461bcd60e51b815260206004820152601e60248201527f5468652064656469636174656420636861696e206973206c6f636b65642e0000604482015260640161085c565b6001600160a01b0383166000908152606a6020908152604080832060030180548251818502810185019093528083529192909190849084015b82821015611e385760008481526020908190206040805180820190915260028502909101805463ffffffff168252600190810154828401529083529092019101611df3565b5050825192935060009150505b81811015611efd576000838281518110611e6157611e6161486f565b602002602001015190508563ffffffff16816000015163ffffffff161415611eea5743816020015110611eea5760405162461bcd60e51b815260206004820152602b60248201527f5468652064656463696174656420636861696e206973207768696c6520756e7360448201526a3ab139b1b934b134b7339760a91b606482015260840161085c565b5080611ef58161489b565b915050611e45565b5063ffffffff84166000908152606c602090815260408083206001600160a01b038916845290915290205460ff1615611f8b5760405162461bcd60e51b815260206004820152602a60248201527f5468652064656469636174656420636861696e20697320616c726561647920736044820152693ab139b1b934b132b21760b11b606482015260840161085c565b63ffffffff84166000908152606660209081526040808320815161010080820184528254825260018301548286015260028301548285015260038301546060830152600480840154608084015260059093015460ff811660a084018190529181046001600160601b0390811660c0850152600160681b9091041660e08301528351631b48130b60e31b8152928301526001600160a01b038a8116602484015292519094937f000000000000000000000000747dc3f9fe7df7a18dd79f6f40b3a1ed85aa75e89093169263da40985892604480820193918290030181865afa15801561207a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209e9190614983565b90508160c001516001600160601b0316816001600160601b031610156121065760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e7420566f7465205765696768740000000000000000604482015260640161085c565b612110878761355e565b50505050505050565b612121612d46565b61212b600061360d565b565b63ffffffff82166000908152606660205260408120600101546121509083614aab565b915061215c8383613340565b9050806110b75750600192915050565b60008061217e846102bb600186614935565b50431195945050505050565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f16146121d25760405162461bcd60e51b815260040161085c90614822565b8160005b818110156122e55760008585838181106121f2576121f261486f565b90506020020160208101906122079190614478565b63ffffffff85166000908152606c602090815260408083206001600160a01b038516845290915290205490915060ff166122535760405162461bcd60e51b815260040161085c906148f0565b63ffffffff84166000908152606c602090815260408083206001600160a01b03851684529091529020805460ff1916905561228e848261365f565b6001600160a01b0381166000908152606a60205260408120600201805460ff16916122b883614aec565b91906101000a81548160ff021916908360ff160217905550505080806122dd9061489b565b9150506121d6565b5050505050565b6001600160a01b0381166000908152606a60209081526040808320600101805482518185028101850190935280835260609492939192909184015b828210156123775760008481526020902060408051808201918290529160028581029091019182845b81548152602001906001019080831161235057505050505081526020019060010190612327565b505050509050919050565b61238a612d46565b63ffffffff82166000908152606b602052604090205481146123f95760405162461bcd60e51b815260206004820152602260248201527f5468652065706f63684e756d626572206973206e6f7420746865206c617465736044820152613a1760f11b606482015260840161085c565b63ffffffff82166000908152606760209081526040808320848452909152812081815560019081019190915561242f9082614935565b63ffffffff9092166000908152606b602052604090209190915550565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f16146124945760405162461bcd60e51b815260040161085c90614822565b6001600160a01b0381166000908152606a6020526040812080546001600160a01b0319168155906124c8600183018261418e565b60028201805460ff191690556119826003830160006141af565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f161461252a5760405162461bcd60e51b815260040161085c90614822565b6125978282808060200260200160405190810160405280939291908181526020016000905b8282101561258d576040805180820182529080840287019060029083908390808284376000920191909152505050815260019091019060200161254f565b5050505050613845565b611982838383808060200260200160405190810160405280939291908181526020016000905b828210156125fb57604080518082018252908084028701906002908390839080828437600092019190915250505081526001909101906020016125bd565b505050505061395f565b6068602052816000526040600020818154811061262157600080fd5b6000918252602090912001546001600160a01b03169150829050565b600054610100900460ff161580801561265d5750600054600160ff909116105b806126775750303b158015612677575060005460ff166001145b6126da5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161085c565b6000805460ff1916600117905580156126fd576000805461ff0019166101001790555b60015b60148160ff16116127825761275d6069600061271d600185614b09565b60ff1660ff16815260200190815260200160002054606960006001856127439190614b09565b60ff1660ff16815260200190815260200160002054613264565b60ff82166000908152606960205260409020558061277a81614b2c565b915050612700565b5061278c8261360d565b80156127d2576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f161461281e5760405162461bcd60e51b815260040161085c90614822565b6040805160208084028201810190925282815261287c918490849081906000908501821561258d576040805180820182529080840287019060029083908390808284376000920191909152505050815260019091019060200161254f565b610d7084848484808060200260200160405190810160405280939291908181526020016000905b828210156128e157604080518082018252908084028701906002908390839080828437600092019190915250505081526001909101906020016128a3565b5050505050613ac7565b6128f3612d46565b63ffffffff8716600090815260666020526040902054156129665760405162461bcd60e51b815260206004820152602760248201527f436f6d6d69747465652068617320616c7265616479206265656e20696e69746960448201526630b634bd32b21760c91b606482015260840161085c565b6129708282612da0565b61297a8585612e1a565b61211087878787878787613c28565b60408051606081018252600080825260208201819052918101829052906129b0848461212d565b63ffffffff9485166000908152606760209081526040808320938352928152908290208251606081018452815481526001909101546001600160e01b03811692820192909252600160e01b90910490951690850152509192915050565b336001600160a01b037f00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f1614612a555760405162461bcd60e51b815260040161085c90614822565b803515801590612a685750602081013515155b612aae5760405162461bcd60e51b815260206004820152601760248201527624b73b30b634b21021262990283ab13634b19025b2bc9760491b604482015260640161085c565b6001600160a01b0383166000908152606a60205260409020600101805463ffffffff841610612b0f5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b604482015260640161085c565b612baf81805480602002602001604051908101604052809291908181526020016000905b82821015612b835760008481526020902060408051808201918290529160028581029091019182845b815481526020019060010190808311612b5c57505050505081526020019060010190612b33565b505060408051808201825292508691506002908390839080828437600092019190915250613ecc915050565b81818463ffffffff1681548110612bc857612bc861486f565b90600052602060002090600202019060026122e59291906141d0565b63ffffffff90811660009081526067602090815260408083206000198452909152902060010154600160e01b90041690565b612c1e612d46565b6001600160a01b038116612c835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161085c565b6119858161360d565b63ffffffff8281166000818152606c602090815260408083206001600160a01b03891684528252808320805460ff19169055606a825280832081518083019092529381528082018681526003850180546001818101835591865293852092516002948502909301805463ffffffff191693909716929092178655519401939093559181018054919260ff90921691612d2383614aec565b91906101000a81548160ff021916908360ff16021790555050610d70838561365f565b6033546001600160a01b0316331461212b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161085c565b6000826001600160601b0316118015612dd55750612dbf826002614b4c565b6001600160601b0316816001600160601b031610155b6127d25760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081b5a5b8bdb585e0815d95a59da1d60521b604482015260640161085c565b8082116127d25760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420667265657a65206475726174696f6e000000000000000000604482015260640161085c565b63ffffffff89166000908152606660205260409020600301548514612ecf576000612e9e8a612e99600143614935565b613340565b612ea990600161496b565b90506000612ebc8b6102bb600185614935565b92505050612ecc8b82848a6133da565b50505b6040518061010001604052808881526020018981526020018781526020018681526020018581526020018460ff168152602001836001600160601b03168152602001826001600160601b0316815250606660008b63ffffffff1663ffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff021916908360ff16021790555060c08201518160050160016101000a8154816001600160601b0302191690836001600160601b0316021790555060e082015181600501600d6101000a8154816001600160601b0302191690836001600160601b031602179055509050508260ff168963ffffffff167fc0f5fe53277733159fe7a739f75b98e959a28a0859db2c46e04a5f4820b964008a8989898888604051613060969594939291909586526020860194909452604085019290925260608401526001600160601b0390811660808401521660a082015260c00190565b60405180910390a3505050505050505050565b60606000613082858585613fa7565b63ffffffff16905060008167ffffffffffffffff8111156130a5576130a56148da565b6040519080825280602002602001820160405280156130ce578160200160208202803683370190505b509050816130df57915061320b9050565b6000865b8686016001600160601b0316816001600160601b03161061313757858383806001019450815181106131175761311761486f565b6001600160601b03909216602092830291909101909101528590036130e3565b856001600160601b0316816001600160601b031611156131ca578683838060010194508151811061316a5761316a61486f565b60200260200101906001600160601b031690816001600160601b0316815250508681038383806001019450815181106131a5576131a561486f565b60200260200101906001600160601b031690816001600160601b031681525050613204565b808383806001019450815181106131e3576131e361486f565b60200260200101906001600160601b031690816001600160601b0316815250505b5090925050505b9392505050565b6000826001600160601b0316846001600160601b031610156132365750600061325c565b6001600160601b0380831663ffffffff871602908516811015613257578094505b508390505b949350505050565b604051600160f91b6020820152602181018390526041810182905260009060610160405160208183030381529060405280519060200120905092915050565b63ffffffff80851660008181526067602090815260408083208884528252808320878155436001600160e01b0316958716600160e01b026001600160e01b03191695909517600190950194909455828252606b905282902085905590518491907f0762b282466177911d330a0c27e7de4e70f0c930671f2080b7cf2dcb3b100f95906133329086815260200190565b60405180910390a350505050565b63ffffffff8216600090815260666020526040812060020154821015613368575060006110b7565b600061337384612be4565b90505b63ffffffff8116156133d357600080600061339187856111c4565b9250925092508286106133c757806133a98488614935565b6133b39190614b91565b6133bd908361496b565b94505050506133d3565b50505060001901613376565b5092915050565b63ffffffff808516600090815260676020908152604080832060001984529091528120600190810154919261341792600160e01b90041690614bb3565b905060405180606001604052806000801b815260200161343685614048565b6001600160701b0316607061344a88614048565b6001600160701b03166001600160e01b0316901b6134689190614bdb565b6001600160e01b0316815260200161347f846140b5565b63ffffffff9081169091528681166000908152606760205260408120916134aa908516600019614935565b81526020808201929092526040908101600090812084518155848401519483015163ffffffff908116600160e01b9081026001600160e01b03978816176001938401558b8216808552606787528585206000198652875293859020909201805491881692830291909616179094558151888152928301879052908201859052907f8fa8b10df976e6a9ed8e4d3f478b1a80d6aad3953aee7acc2c42a7533b735d089060600160405180910390a35050505050565b63ffffffff81166000908152606c602090815260408083206001600160a01b03861684528252808320805460ff19166001179055606a9091528120600201805460ff16916135ab83614b2c565b825460ff9182166101009390930a92830291909202199091161790555063ffffffff1660009081526068602090815260408220805460018101825590835291200180546001600160a01b039092166001600160a01b0319909216919091179055565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b63ffffffff8216600090815260686020526040812054905b818110156137c35763ffffffff8416600090815260686020526040902080546001600160a01b0385169190839081106136b2576136b261486f565b6000918252602090912001546001600160a01b031614156137b15763ffffffff841660009081526068602052604090206136ed600184614935565b815481106136fd576136fd61486f565b600091825260208083209091015463ffffffff871683526068909152604090912080546001600160a01b03909216918390811061373c5761373c61486f565b600091825260208083209190910180546001600160a01b0319166001600160a01b03949094169390931790925563ffffffff8616815260689091526040902080548061378a5761378a614bfd565b600082815260209020810160001990810180546001600160a01b03191690550190556137c3565b806137bb8161489b565b915050613677565b5063ffffffff83166000908152606860205260409020546137e590600161496b565b81146119825760405162461bcd60e51b815260206004820152602960248201527f4f70657261746f7220646f65736e277420657869737420696e20636f6d6d69746044820152683a32b2a0b23239399760b91b606482015260840161085c565b805161388c5760405162461bcd60e51b815260206004820152601660248201527522b6b83a3c9021262990283ab13634b19025b2bcb99760511b604482015260640161085c565b805160005b81811015611982578281815181106138ab576138ab61486f565b60200260200101516000600281106138c5576138c561486f565b60200201511580159061390757508281815181106138e5576138e561486f565b60200260200101516001600281106138ff576138ff61486f565b602002015115155b61394d5760405162461bcd60e51b815260206004820152601760248201527624b73b30b634b21021262990283ab13634b19025b2bc9760491b604482015260640161085c565b806139578161489b565b915050613891565b6001600160a01b0382166000908152606a6020526040902060018101546139c85760405162461bcd60e51b815260206004820152601b60248201527f4f70657261746f72206973206e6f7420726567697374657265642e0000000000604482015260640161085c565b815160005b818110156122e557613a6f83600101805480602002602001604051908101604052809291908181526020016000905b82821015613a4c5760008481526020902060408051808201918290529160028581029091019182845b815481526020019060010190808311613a25575050505050815260200190600101906139fc565b50505050858381518110613a6257613a6261486f565b6020026020010151613ecc565b82600101848281518110613a8557613a8561486f565b6020908102919091018101518254600181018455600093845291909220613ab49260029283029091019161420a565b5080613abf8161489b565b9150506139cd565b6001600160a01b0383166000908152606a6020526040812080546001600160a01b031916815590613afb600183018261418e565b60028201805460ff19169055613b156003830160006141af565b50506001600160a01b038381166000908152606a6020526040812080546001600160a01b0319169285169290921782558251905b81811015613c2057613bc883600101805480602002602001604051908101604052809291908181526020016000905b82821015613a4c5760008481526020902060408051808201918290529160028581029091019182845b815481526020019060010190808311613ba157505050505081526020019060010190613b78565b82600101848281518110613bde57613bde61486f565b6020908102919091018101518254600181018455600093845291909220613c0d9260029283029091019161420a565b5080613c188161489b565b915050613b49565b505050505050565b604051806101000160405280438152602001600081526020018781526020018681526020018581526020018460ff168152602001836001600160601b03168152602001826001600160601b0316815250606660008963ffffffff1663ffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff021916908360ff16021790555060c08201518160050160016101000a8154816001600160601b0302191690836001600160601b0316021790555060e082015181600501600d6101000a8154816001600160601b0302191690836001600160601b0316021790555090505060405180606001604052806000801b815260200160006001600160e01b03168152602001600063ffffffff16815250606760008963ffffffff1663ffffffff16815260200190815260200160002060008081526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160e01b0302191690836001600160e01b03160217905550604082015181600101601c6101000a81548163ffffffff021916908363ffffffff16021790555090505060658790806001815401808255809150506001900390600052602060002090600891828204019190066004029091909190916101000a81548163ffffffff021916908363ffffffff160217905550613e5e876118c8565b60408051878152602081018790529081018590526001600160601b0380841660608301528216608082015260ff84169063ffffffff8916907f443f7a0c0eb557351b38f3fed112889e529704fb0ccaac63b1f0914816d880f39060a00160405180910390a350505050505050565b815160005b81811015610d705782518451859083908110613eef57613eef61486f565b6020026020010151600060028110613f0957613f0961486f565b6020020151141580613f5257508260016020020151848281518110613f3057613f3061486f565b6020026020010151600160028110613f4a57613f4a61486f565b602002015114155b613f955760405162461bcd60e51b81526020600482015260146024820152734475706c69636174656420426c735075624b657960601b604482015260640161085c565b80613f9f8161489b565b915050613ed1565b6000826001600160601b0316846001600160601b03161015613fcb5750600061320b565b6000826001600160601b0316600186036001600160601b031681613ff157613ff1614b7b565b04600101905063ffffffff8016816001600160601b031611156140415760405162461bcd60e51b81526020600482015260086024820152674f766572466c6f7760c01b604482015260640161085c565b905061320b565b60006001600160701b038211156140b15760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663132206269747360c81b606482015260840161085c565b5090565b600063ffffffff8211156140b15760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b606482015260840161085c565b60405180604001604052806002906020820280368337509192915050565b828054828255906000526020600020906002028101928215614182579160200282015b82811115614182578251614172908390600261420a565b509160200191906002019061415b565b506140b1929150614238565b50805460008255600202906000526020600020908101906119859190614238565b50805460008255600202906000526020600020908101906119859190614252565b82600281019282156141fe579160200282015b828111156141fe5782358255916020019190600101906141e3565b506140b1929150614275565b82600281019282156141fe579160200282015b828111156141fe57825182559160200191906001019061421d565b808211156140b15760008082556001820155600201614238565b5b808211156140b157805463ffffffff1916815560006001820155600201614253565b5b808211156140b15760008155600101614276565b60006020828403121561429c57600080fd5b5035919050565b6001600160a01b038116811461198557600080fd5b60008083601f8401126142ca57600080fd5b50813567ffffffffffffffff8111156142e257600080fd5b6020830191508360208260051b85010111156142fd57600080fd5b9250929050565b60008060006040848603121561431957600080fd5b8335614324816142a3565b9250602084013567ffffffffffffffff81111561434057600080fd5b61434c868287016142b8565b9497909650939450505050565b803563ffffffff8116811461436d57600080fd5b919050565b6000806040838503121561438557600080fd5b8235614390816142a3565b915061439e60208401614359565b90509250929050565b600080604083850312156143ba57600080fd5b6143c383614359565b946020939093013593505050565b803560ff8116811461436d57600080fd5b6001600160601b038116811461198557600080fd5b600080600080600080600080610100898b03121561441457600080fd5b61441d89614359565b97506020890135965060408901359550606089013594506080890135935061444760a08a016143d1565b925060c0890135614457816143e2565b915060e0890135614467816143e2565b809150509295985092959890939650565b60006020828403121561448a57600080fd5b813561320b816142a3565b6020808252825182820181905260009190848201906040850190845b818110156144d65783516001600160601b0316835292840192918401916001016144b1565b50909695505050505050565b600080604083850312156144f557600080fd5b8235614500816142a3565b91506020830135614510816142a3565b809150509250929050565b6000806040838503121561452e57600080fd5b61439083614359565b60006020828403121561454957600080fd5b61320b82614359565b6000806040838503121561456557600080fd5b61450083614359565b6020808252825182820181905260009190848201906040850190845b818110156144d65783516001600160a01b03168352928401929184019160010161458a565b6000806000604084860312156145c457600080fd5b833567ffffffffffffffff8111156145db57600080fd5b6145e7868287016142b8565b90945092506145fa905060208501614359565b90509250925092565b60208082528251828201819052600091906040908185019086840185805b8381101561465e57825185835b600281101561464b5782518252918901919089019060010161462e565b5050509385019391860191600101614621565b509298975050505050505050565b60008083601f84011261467e57600080fd5b50813567ffffffffffffffff81111561469657600080fd5b6020830191508360208260061b85010111156142fd57600080fd5b6000806000604084860312156146c657600080fd5b83356146d1816142a3565b9250602084013567ffffffffffffffff8111156146ed57600080fd5b61434c8682870161466c565b6000806000806060858703121561470f57600080fd5b843561471a816142a3565b9350602085013561472a816142a3565b9250604085013567ffffffffffffffff81111561474657600080fd5b6147528782880161466c565b95989497509550505050565b600080600080600080600060e0888a03121561477957600080fd5b61478288614359565b96506020880135955060408801359450606088013593506147a5608089016143d1565b925060a08801356147b5816143e2565b915060c08801356147c5816143e2565b8091505092959891949750929550565b6000806000608084860312156147ea57600080fd5b83356147f5816142a3565b925061480360208501614359565b91508460808501111561481557600080fd5b6040840190509250925092565b6020808252602d908201527f4f6e6c79204c616772616e676520736572766963652063616e2063616c6c207460408201526c3434b990333ab731ba34b7b71760991b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156148af576148af614885565b5060010190565b600063ffffffff808316818114156148d0576148d0614885565b6001019392505050565b634e487b7160e01b600052604160045260246000fd5b60208082526025908201527f5468652064656469636174656420636861696e206973206e6f742073756273636040820152641c9a58995960da1b606082015260800190565b60008282101561494757614947614885565b500390565b600081600019048311821515161561496657614966614885565b500290565b6000821982111561497e5761497e614885565b500190565b60006020828403121561499557600080fd5b815161320b816143e2565b6020808252825182820181905260009190848201906040850190845b818110156144d657835160ff16835292840192918401916001016149bc565b805161436d816142a3565b600060208083850312156149f957600080fd5b825167ffffffffffffffff80821115614a1157600080fd5b818501915085601f830112614a2557600080fd5b815181811115614a3757614a376148da565b8060051b604051601f19603f83011681018181108582111715614a5c57614a5c6148da565b604052918252848201925083810185019188831115614a7a57600080fd5b938501935b82851015614a9f57614a90856149db565b84529385019392850192614a7f565b98975050505050505050565b600080821280156001600160ff1b0384900385131615614acd57614acd614885565b600160ff1b8390038412811615614ae657614ae6614885565b50500190565b600060ff821680614aff57614aff614885565b6000190192915050565b600060ff821660ff841680821015614b2357614b23614885565b90039392505050565b600060ff821660ff811415614b4357614b43614885565b60010192915050565b60006001600160601b0380831681851681830481118215151615614b7257614b72614885565b02949350505050565b634e487b7160e01b600052601260045260246000fd5b600082614bae57634e487b7160e01b600052601260045260246000fd5b500490565b600063ffffffff808316818516808303821115614bd257614bd2614885565b01949350505050565b60006001600160e01b03828116848216808303821115614bd257614bd2614885565b634e487b7160e01b600052603160045260246000fdfea26469706673582212207e06d6f592ec60f91719aba438a13083acfbba4f683aa08b8fa961977d67435c64736f6c634300080c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f000000000000000000000000747dc3f9fe7df7a18dd79f6f40b3a1ed85aa75e8

-----Decoded View---------------
Arg [0] : _service (address): 0x34d8f7384Ddd4e8Ab447a150F9955f284882A43F
Arg [1] : _voteWeigher (address): 0x747dc3F9FE7df7A18DD79F6f40B3A1ed85aa75E8

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000034d8f7384ddd4e8ab447a150f9955f284882a43f
Arg [1] : 000000000000000000000000747dc3f9fe7df7a18dd79f6f40b3a1ed85aa75e8


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.