Contract 0xBf5bB7D5b728B89AAc720F209e46d54689B551DA

 
 
Txn Hash
Method
Block
From
To
Value
0x797b21c8d2325275b41a1087567f212802d7cc89e61b38ffcaae1800f244e3940x60806040143074452022-03-02 12:02:05209 days 8 hrs agoLido: Deployer IN  Create: StMATIC0 Ether0.222839350
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StMATIC

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 22 : StMATIC.sol
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

import "./interfaces/IValidatorShare.sol";
import "./interfaces/INodeOperatorRegistry.sol";
import "./interfaces/IStakeManager.sol";
import "./interfaces/IPoLidoNFT.sol";
import "./interfaces/IFxStateRootTunnel.sol";
import "./interfaces/IStMATIC.sol";

contract StMATIC is
    IStMATIC,
    ERC20Upgradeable,
    AccessControlUpgradeable,
    PausableUpgradeable
{
    event SubmitEvent(address indexed _from, uint256 indexed _amount);
    event RequestWithdrawEvent(address indexed _from, uint256 indexed _amount);
    event DistributeRewardsEvent(uint256 indexed _amount);
    event WithdrawTotalDelegatedEvent(
        address indexed _from,
        uint256 indexed _amount
    );
    event DelegateEvent(
        uint256 indexed _amountDelegated,
        uint256 indexed _remainder
    );
    event ClaimTokensEvent(
        address indexed _from,
        uint256 indexed _id,
        uint256 indexed _amountClaimed,
        uint256 _amountBurned
    );

    using SafeERC20Upgradeable for IERC20Upgradeable;

    INodeOperatorRegistry public override nodeOperatorRegistry;
    FeeDistribution public override entityFees;
    IStakeManager public override stakeManager;
    IPoLidoNFT public override poLidoNFT;
    IFxStateRootTunnel public override fxStateRootTunnel;

    string public override version;
    address public override dao;
    address public override insurance;
    address public override token;
    uint256 public override lastWithdrawnValidatorId;
    uint256 public override totalBuffered;
    uint256 public override delegationLowerBound;
    uint256 public override rewardDistributionLowerBound;
    uint256 public override reservedFunds;
    uint256 public override submitThreshold;

    bool public override submitHandler;

    mapping(uint256 => RequestWithdraw) public override token2WithdrawRequest;

    bytes32 public constant override DAO = keccak256("DAO");

    /**
     * @param _nodeOperatorRegistry - Address of the node operator registry
     * @param _token - Address of MATIC token on Ethereum Mainnet
     * @param _dao - Address of the DAO
     * @param _insurance - Address of the insurance
     * @param _stakeManager - Address of the stake manager
     * @param _poLidoNFT - Address of the stMATIC NFT
     * @param _fxStateRootTunnel - Address of the FxStateRootTunnel
     */
    function initialize(
        address _nodeOperatorRegistry,
        address _token,
        address _dao,
        address _insurance,
        address _stakeManager,
        address _poLidoNFT,
        address _fxStateRootTunnel,
        uint256 _submitThreshold
    ) external override initializer {
        __AccessControl_init();
        __Pausable_init();
        __ERC20_init("Staked MATIC", "stMATIC");

        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(DAO, _dao);

        nodeOperatorRegistry = INodeOperatorRegistry(_nodeOperatorRegistry);
        stakeManager = IStakeManager(_stakeManager);
        poLidoNFT = IPoLidoNFT(_poLidoNFT);
        fxStateRootTunnel = IFxStateRootTunnel(_fxStateRootTunnel);
        dao = _dao;
        token = _token;
        insurance = _insurance;

        entityFees = FeeDistribution(25, 50, 25);
        submitThreshold = _submitThreshold;
        submitHandler = true;
    }

    /**
     * @dev Send funds to StMATIC contract and mints StMATIC to msg.sender
     * @notice Requires that msg.sender has approved _amount of MATIC to this contract
     * @param _amount - Amount of MATIC sent from msg.sender to this contract
     * @return Amount of StMATIC shares generated
     */
    function submit(uint256 _amount)
        external
        override
        whenNotPaused
        returns (uint256)
    {
        require(_amount > 0, "Invalid amount");

        if (submitHandler) {
            require(
                _amount + getTotalPooledMatic() <= submitThreshold,
                "Submit threshold reached"
            );
        }

        IERC20Upgradeable(token).safeTransferFrom(
            msg.sender,
            address(this),
            _amount
        );

        (
            uint256 amountToMint,
            uint256 totalShares,
            uint256 totalPooledMatic
        ) = convertMaticToStMatic(_amount);

        _mint(msg.sender, amountToMint);

        totalBuffered += _amount;

        fxStateRootTunnel.sendMessageToChild(
            abi.encode(totalShares + amountToMint, totalPooledMatic + _amount)
        );

        emit SubmitEvent(msg.sender, _amount);

        return amountToMint;
    }

    /**
     * @dev Stores users request to withdraw into a RequestWithdraw struct
     * @param _amount - Amount of StMATIC that is requested to withdraw
     */
    function requestWithdraw(uint256 _amount) external override whenNotPaused {
        require(_amount > 0, "Invalid amount");

        Operator.OperatorInfo[] memory operatorInfos = nodeOperatorRegistry
            .getOperatorInfos(false, true);

        uint256 operatorInfosLength = operatorInfos.length;

        uint256 tokenId;
        (
            uint256 totalAmount2WithdrawInMatic,
            uint256 totalShares,
            uint256 totalPooledMATIC
        ) = convertStMaticToMatic(_amount);
        uint256 currentAmount2WithdrawInMatic = totalAmount2WithdrawInMatic;

        uint256 totalDelegated = getTotalStakeAcrossAllValidators();

        uint256 minValidatorBalance = _getMinValidatorBalance(operatorInfos);

        uint256 allowedAmount2RequestFromValidators = 0;

        if (totalDelegated != 0) {
            require(
                (totalDelegated + totalBuffered) >=
                    currentAmount2WithdrawInMatic +
                        minValidatorBalance *
                        operatorInfosLength,
                "Too much to withdraw"
            );
            allowedAmount2RequestFromValidators =
                totalDelegated -
                minValidatorBalance *
                operatorInfosLength;
        } else {
            require(
                totalBuffered >= currentAmount2WithdrawInMatic,
                "Too much to withdraw"
            );
        }

        while (currentAmount2WithdrawInMatic != 0) {
            tokenId = poLidoNFT.mint(msg.sender);

            if (allowedAmount2RequestFromValidators != 0) {
                if (lastWithdrawnValidatorId > operatorInfosLength - 1) {
                    lastWithdrawnValidatorId = 0;
                }
                address validatorShare = operatorInfos[lastWithdrawnValidatorId]
                    .validatorShare;

                (uint256 validatorBalance, ) = IValidatorShare(validatorShare)
                    .getTotalStake(address(this));

                if (validatorBalance <= minValidatorBalance) {
                    lastWithdrawnValidatorId++;
                    continue;
                }

                uint256 allowedAmount2Withdraw = validatorBalance -
                    minValidatorBalance;

                uint256 amount2WithdrawFromValidator = (allowedAmount2Withdraw <=
                        currentAmount2WithdrawInMatic)
                        ? allowedAmount2Withdraw
                        : currentAmount2WithdrawInMatic;

                sellVoucher_new(
                    validatorShare,
                    amount2WithdrawFromValidator,
                    type(uint256).max
                );

                token2WithdrawRequest[tokenId] = RequestWithdraw(
                    0,
                    IValidatorShare(validatorShare).unbondNonces(address(this)),
                    stakeManager.epoch() + stakeManager.withdrawalDelay(),
                    validatorShare
                );

                allowedAmount2RequestFromValidators -= amount2WithdrawFromValidator;
                currentAmount2WithdrawInMatic -= amount2WithdrawFromValidator;
                lastWithdrawnValidatorId++;
            } else {
                token2WithdrawRequest[tokenId] = RequestWithdraw(
                    currentAmount2WithdrawInMatic,
                    0,
                    stakeManager.epoch() + stakeManager.withdrawalDelay(),
                    address(0)
                );

                reservedFunds += currentAmount2WithdrawInMatic;
                currentAmount2WithdrawInMatic = 0;
            }
        }

        _burn(msg.sender, _amount);

        fxStateRootTunnel.sendMessageToChild(
            abi.encode(
                totalShares - _amount,
                totalPooledMATIC - totalAmount2WithdrawInMatic
            )
        );

        emit RequestWithdrawEvent(msg.sender, _amount);
    }

    /**
     * @notice This will be included in the cron job
     * @dev Delegates tokens to validator share contract
     */
    function delegate() external override whenNotPaused {
        require(
            totalBuffered > delegationLowerBound + reservedFunds,
            "Amount to delegate lower than minimum"
        );
        Operator.OperatorInfo[] memory operatorInfos = nodeOperatorRegistry
            .getOperatorInfos(true, false);
        uint256 operatorInfosLength = operatorInfos.length;

        require(operatorInfosLength > 0, "No operator shares, cannot delegate");

        uint256 availableAmountToDelegate = totalBuffered - reservedFunds;
        uint256 maxDelegateLimitsSum;
        uint256 remainder;

        for (uint256 i = 0; i < operatorInfosLength; i++) {
            maxDelegateLimitsSum += operatorInfos[i].maxDelegateLimit;
        }

        require(maxDelegateLimitsSum > 0, "maxDelegateLimitsSum=0");

        uint256 totalToDelegatedAmount = maxDelegateLimitsSum <=
            availableAmountToDelegate
            ? maxDelegateLimitsSum
            : availableAmountToDelegate;

        IERC20Upgradeable(token).safeApprove(address(stakeManager), 0);

        IERC20Upgradeable(token).safeApprove(
            address(stakeManager),
            totalToDelegatedAmount
        );

        uint256 amountDelegated;

        for (uint256 i = 0; i < operatorInfosLength; i++) {
            uint256 amountToDelegatePerOperator = (operatorInfos[i]
                .maxDelegateLimit * totalToDelegatedAmount) /
                maxDelegateLimitsSum;

            buyVoucher(
                operatorInfos[i].validatorShare,
                amountToDelegatePerOperator,
                0
            );

            amountDelegated += amountToDelegatePerOperator;
        }

        remainder = availableAmountToDelegate - amountDelegated;
        totalBuffered = remainder + reservedFunds;

        emit DelegateEvent(amountDelegated, remainder);
    }

    /**
     * @dev Claims tokens from validator share and sends them to the
     * user if his request is in the userToWithdrawRequest
     * @param _tokenId - Id of the token that wants to be claimed
     */
    function claimTokens(uint256 _tokenId) external override whenNotPaused {
        require(poLidoNFT.isApprovedOrOwner(msg.sender, _tokenId), "Not owner");
        RequestWithdraw storage usersRequest = token2WithdrawRequest[_tokenId];

        require(
            stakeManager.epoch() >= usersRequest.requestEpoch,
            "Not able to claim yet"
        );

        poLidoNFT.burn(_tokenId);

        uint256 amountToClaim;

        if (usersRequest.validatorAddress != address(0)) {
            uint256 balanceBeforeClaim = IERC20Upgradeable(token).balanceOf(
                address(this)
            );

            unstakeClaimTokens_new(
                usersRequest.validatorAddress,
                usersRequest.validatorNonce
            );

            amountToClaim =
                IERC20Upgradeable(token).balanceOf(address(this)) -
                balanceBeforeClaim;
        } else {
            amountToClaim = usersRequest.amount2WithdrawFromStMATIC;

            reservedFunds -= amountToClaim;
            totalBuffered -= amountToClaim;
        }

        IERC20Upgradeable(token).safeTransfer(msg.sender, amountToClaim);

        emit ClaimTokensEvent(msg.sender, _tokenId, amountToClaim, 0);
    }

    /**
     * @dev Distributes rewards claimed from validator shares based on fees defined in entityFee
     */
    function distributeRewards() external override whenNotPaused {
        Operator.OperatorInfo[] memory operatorInfos = nodeOperatorRegistry
            .getOperatorInfos(true, false);

        uint256 operatorInfosLength = operatorInfos.length;

        for (uint256 i = 0; i < operatorInfosLength; i++) {
            IValidatorShare validatorShare = IValidatorShare(
                operatorInfos[i].validatorShare
            );
            uint256 stMaticReward = validatorShare.getLiquidRewards(
                address(this)
            );
            uint256 rewardThreshold = validatorShare.minAmount();
            if (stMaticReward >= rewardThreshold) {
                validatorShare.withdrawRewards();
            }
        }

        uint256 totalRewards = (
            (IERC20Upgradeable(token).balanceOf(address(this)) - totalBuffered)
        ) / 10;

        require(
            totalRewards > rewardDistributionLowerBound,
            "Amount to distribute lower than minimum"
        );

        uint256 balanceBeforeDistribution = IERC20Upgradeable(token).balanceOf(
            address(this)
        );

        uint256 daoRewards = (totalRewards * entityFees.dao) / 100;
        uint256 insuranceRewards = (totalRewards * entityFees.insurance) / 100;
        uint256 operatorsRewards = (totalRewards * entityFees.operators) / 100;
        uint256 operatorReward = operatorsRewards / operatorInfosLength;

        IERC20Upgradeable(token).safeTransfer(dao, daoRewards);
        IERC20Upgradeable(token).safeTransfer(insurance, insuranceRewards);

        for (uint256 i = 0; i < operatorInfosLength; i++) {
            IERC20Upgradeable(token).safeTransfer(
                operatorInfos[i].rewardAddress,
                operatorReward
            );
        }

        uint256 currentBalance = IERC20Upgradeable(token).balanceOf(
            address(this)
        );

        uint256 totalDistributed = balanceBeforeDistribution - currentBalance;

        // Add the remainder to totalBuffered
        totalBuffered = currentBalance;

        emit DistributeRewardsEvent(totalDistributed);
    }

    /**
     * @notice Only NodeOperatorRegistry can call this function
     * @dev Withdraws funds from unstaked validator
     * @param _validatorShare - Address of the validator share that will be withdrawn
     */
    function withdrawTotalDelegated(address _validatorShare) external override {
        require(
            msg.sender == address(nodeOperatorRegistry),
            "Not a node operator"
        );

        (uint256 stakedAmount, ) = getTotalStake(
            IValidatorShare(_validatorShare)
        );

        if (stakedAmount == 0) {
            return;
        }

        uint256 tokenId = poLidoNFT.mint(address(this));
        sellVoucher_new(_validatorShare, stakedAmount, type(uint256).max);

        token2WithdrawRequest[tokenId] = RequestWithdraw(
            uint256(0),
            IValidatorShare(_validatorShare).unbondNonces(address(this)),
            stakeManager.epoch() + stakeManager.withdrawalDelay(),
            _validatorShare
        );

        fxStateRootTunnel.sendMessageToChild(
            abi.encode(totalSupply(), getTotalPooledMatic())
        );

        emit WithdrawTotalDelegatedEvent(_validatorShare, stakedAmount);
    }

    /**
     * @dev Claims tokens from validator share and sends them to the
     * StMATIC contract
     * @param _tokenId - Id of the token that is supposed to be claimed
     */
    function claimTokens2StMatic(uint256 _tokenId)
        external
        override
        whenNotPaused
    {
        RequestWithdraw storage lidoRequests = token2WithdrawRequest[_tokenId];

        require(
            poLidoNFT.ownerOf(_tokenId) == address(this),
            "Not owner of the NFT"
        );

        poLidoNFT.burn(_tokenId);

        require(
            stakeManager.epoch() >= lidoRequests.requestEpoch,
            "Not able to claim yet"
        );

        uint256 balanceBeforeClaim = IERC20Upgradeable(token).balanceOf(
            address(this)
        );

        unstakeClaimTokens_new(
            lidoRequests.validatorAddress,
            lidoRequests.validatorNonce
        );

        uint256 claimedAmount = IERC20Upgradeable(token).balanceOf(
            address(this)
        ) - balanceBeforeClaim;

        totalBuffered += claimedAmount;

        fxStateRootTunnel.sendMessageToChild(
            abi.encode(totalSupply(), getTotalPooledMatic())
        );

        emit ClaimTokensEvent(address(this), _tokenId, claimedAmount, 0);
    }

    /**
     * @dev Flips the pause state
     */
    function togglePause() external override onlyRole(DEFAULT_ADMIN_ROLE) {
        paused() ? _unpause() : _pause();
    }

    ////////////////////////////////////////////////////////////
    /////                                                    ///
    /////             ***ValidatorShare API***               ///
    /////                                                    ///
    ////////////////////////////////////////////////////////////

    /**
     * @dev API for delegated buying vouchers from validatorShare
     * @param _validatorShare - Address of validatorShare contract
     * @param _amount - Amount of MATIC to use for buying vouchers
     * @param _minSharesToMint - Minimum of shares that is bought with _amount of MATIC
     * @return Actual amount of MATIC used to buy voucher, might differ from _amount because of _minSharesToMint
     */
    function buyVoucher(
        address _validatorShare,
        uint256 _amount,
        uint256 _minSharesToMint
    ) private returns (uint256) {
        uint256 amountSpent = IValidatorShare(_validatorShare).buyVoucher(
            _amount,
            _minSharesToMint
        );

        return amountSpent;
    }

    /**
     * @dev API for delegated restaking rewards to validatorShare
     * @param _validatorShare - Address of validatorShare contract
     */
    function restake(address _validatorShare) private {
        IValidatorShare(_validatorShare).restake();
    }

    /**
     * @dev API for delegated unstaking and claiming tokens from validatorShare
     * @param _validatorShare - Address of validatorShare contract
     * @param _unbondNonce - Unbond nonce
     */
    function unstakeClaimTokens_new(
        address _validatorShare,
        uint256 _unbondNonce
    ) private {
        IValidatorShare(_validatorShare).unstakeClaimTokens_new(_unbondNonce);
    }

    /**
     * @dev API for delegated selling vouchers from validatorShare
     * @param _validatorShare - Address of validatorShare contract
     * @param _claimAmount - Amount of MATIC to claim
     * @param _maximumSharesToBurn - Maximum amount of shares to burn
     */
    function sellVoucher_new(
        address _validatorShare,
        uint256 _claimAmount,
        uint256 _maximumSharesToBurn
    ) private {
        IValidatorShare(_validatorShare).sellVoucher_new(
            _claimAmount,
            _maximumSharesToBurn
        );
    }

    /**
     * @dev API for getting total stake of this contract from validatorShare
     * @param _validatorShare - Address of validatorShare contract
     * @return Total stake of this contract and MATIC -> share exchange rate
     */
    function getTotalStake(IValidatorShare _validatorShare)
        public
        view
        override
        returns (uint256, uint256)
    {
        return _validatorShare.getTotalStake(address(this));
    }

    /**
     * @dev API for liquid rewards of this contract from validatorShare
     * @param _validatorShare - Address of validatorShare contract
     * @return Liquid rewards of this contract
     */
    function getLiquidRewards(IValidatorShare _validatorShare)
        external
        view
        override
        returns (uint256)
    {
        return _validatorShare.getLiquidRewards(address(this));
    }

    ////////////////////////////////////////////////////////////
    /////                                                    ///
    /////            ***Helpers & Utilities***               ///
    /////                                                    ///
    ////////////////////////////////////////////////////////////

    /**
     * @dev Helper function for that returns total pooled MATIC
     * @return Total pooled MATIC
     */
    function getTotalStakeAcrossAllValidators()
        public
        view
        override
        returns (uint256)
    {
        uint256 totalStake;
        Operator.OperatorInfo[] memory operatorInfos = nodeOperatorRegistry
            .getOperatorInfos(false, true);

        uint256 operatorInfosLength = operatorInfos.length;
        for (uint256 i = 0; i < operatorInfosLength; i++) {
            (uint256 currValidatorShare, ) = getTotalStake(
                IValidatorShare(operatorInfos[i].validatorShare)
            );

            totalStake += currValidatorShare;
        }

        return totalStake;
    }

    /**
     * @dev Function that calculates total pooled Matic
     * @return Total pooled Matic
     */
    function getTotalPooledMatic() public view override returns (uint256) {
        uint256 totalStaked = getTotalStakeAcrossAllValidators();
        return totalStaked + totalBuffered - reservedFunds;
    }

    /**
     * @dev Function that converts arbitrary stMATIC to Matic
     * @param _balance - Balance in stMATIC
     * @return Balance in Matic, totalShares and totalPooledMATIC
     */
    function convertStMaticToMatic(uint256 _balance)
        public
        view
        override
        returns (
            uint256,
            uint256,
            uint256
        )
    {
        uint256 totalShares = totalSupply();
        totalShares = totalShares == 0 ? 1 : totalShares;

        uint256 totalPooledMATIC = getTotalPooledMatic();
        totalPooledMATIC = totalPooledMATIC == 0 ? 1 : totalPooledMATIC;

        uint256 balanceInMATIC = (_balance * totalPooledMATIC) / totalShares;

        return (balanceInMATIC, totalShares, totalPooledMATIC);
    }

    /**
     * @dev Function that converts arbitrary Matic to stMATIC
     * @param _balance - Balance in Matic
     * @return Balance in stMATIC, totalShares and totalPooledMATIC
     */
    function convertMaticToStMatic(uint256 _balance)
        public
        view
        override
        returns (
            uint256,
            uint256,
            uint256
        )
    {
        uint256 totalShares = totalSupply();
        totalShares = totalShares == 0 ? 1 : totalShares;

        uint256 totalPooledMatic = getTotalPooledMatic();
        totalPooledMatic = totalPooledMatic == 0 ? 1 : totalPooledMatic;

        uint256 balanceInStMatic = (_balance * totalShares) / totalPooledMatic;

        return (balanceInStMatic, totalShares, totalPooledMatic);
    }

    /**
     * @dev Function that calculates minimal allowed validator balance (lower bound)
     * @return Minimal validator balance in MATIC
     */
    function getMinValidatorBalance() external view override returns (uint256) {
        Operator.OperatorInfo[] memory operatorInfos = nodeOperatorRegistry
        .getOperatorInfos(false, true);

        return _getMinValidatorBalance(operatorInfos);
    }


    function _getMinValidatorBalance(Operator.OperatorInfo[] memory operatorInfos) private view returns (uint256) {
        uint256 operatorInfosLength = operatorInfos.length;
        uint256 minValidatorBalance = type(uint256).max;

        for (uint256 i = 0; i < operatorInfosLength; i++) {
            (uint256 validatorShare, ) = getTotalStake(
                IValidatorShare(operatorInfos[i].validatorShare)
            );
            // 10% of current validatorShare
            uint256 minValidatorBalanceCurrent = validatorShare / 10;

            if (
                minValidatorBalanceCurrent != 0 &&
                minValidatorBalanceCurrent < minValidatorBalance
            ) {
                minValidatorBalance = minValidatorBalanceCurrent;
            }
        }

        return minValidatorBalance;
    }

    ////////////////////////////////////////////////////////////
    /////                                                    ///
    /////                 ***Setters***                      ///
    /////                                                    ///
    ////////////////////////////////////////////////////////////

    /**
     * @dev Function that sets entity fees
     * @notice Callable only by dao
     * @param _daoFee - DAO fee in %
     * @param _operatorsFee - Operator fees in %
     * @param _insuranceFee - Insurance fee in %
     */
    function setFees(
        uint8 _daoFee,
        uint8 _operatorsFee,
        uint8 _insuranceFee
    ) external override onlyRole(DAO) {
        require(
            _daoFee + _operatorsFee + _insuranceFee == 100,
            "sum(fee)!=100"
        );
        entityFees.dao = _daoFee;
        entityFees.operators = _operatorsFee;
        entityFees.insurance = _insuranceFee;
    }

    /**
     * @dev Function that sets new dao address
     * @notice Callable only by dao
     * @param _address - New dao address
     */
    function setDaoAddress(address _address) external override onlyRole(DAO) {
        revokeRole(DAO, dao);
        dao = _address;
        _setupRole(DAO, dao);
    }

    /**
     * @dev Function that sets new insurance address
     * @notice Callable only by dao
     * @param _address - New insurance address
     */
    function setInsuranceAddress(address _address)
        external
        override
        onlyRole(DAO)
    {
        insurance = _address;
    }

    /**
     * @dev Function that sets new node operator address
     * @notice Only callable by dao
     * @param _address - New node operator address
     */
    function setNodeOperatorRegistryAddress(address _address)
        external
        override
        onlyRole(DAO)
    {
        nodeOperatorRegistry = INodeOperatorRegistry(_address);
    }

    /**
     * @dev Function that sets new lower bound for delegation
     * @notice Only callable by dao
     * @param _delegationLowerBound - New lower bound for delegation
     */
    function setDelegationLowerBound(uint256 _delegationLowerBound)
        external
        override
        onlyRole(DAO)
    {
        delegationLowerBound = _delegationLowerBound;
    }

    /**
     * @dev Function that sets new lower bound for rewards distribution
     * @notice Only callable by dao
     * @param _rewardDistributionLowerBound - New lower bound for rewards distribution
     */
    function setRewardDistributionLowerBound(
        uint256 _rewardDistributionLowerBound
    ) external override onlyRole(DAO) {
        rewardDistributionLowerBound = _rewardDistributionLowerBound;
    }

    /**
     * @dev Function that sets the poLidoNFT address
     * @param _poLidoNFT new poLidoNFT address
     */
    function setPoLidoNFT(address _poLidoNFT) external override onlyRole(DAO) {
        poLidoNFT = IPoLidoNFT(_poLidoNFT);
    }

    /**
     * @dev Function that sets the fxStateRootTunnel address
     * @param _fxStateRootTunnel address of fxStateRootTunnel
     */
    function setFxStateRootTunnel(address _fxStateRootTunnel)
        external
        override
        onlyRole(DAO)
    {
        fxStateRootTunnel = IFxStateRootTunnel(_fxStateRootTunnel);
    }

    /**
     * @dev Function that sets the submitThreshold
     * @param _submitThreshold new value for submit threshold
     */
    function setSubmitThreshold(uint256 _submitThreshold)
        external
        override
        onlyRole(DAO)
    {
        submitThreshold = _submitThreshold;
    }

    /**
     * @dev Function that sets the submitHandler value to its NOT value
     */
    function flipSubmitHandler() external override onlyRole(DAO) {
        submitHandler = !submitHandler;
    }

    /**
     * @dev Function that sets the new version
     * @param _version - New version that will be set
     */
    function setVersion(string calldata _version)
        external
        override
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        version = _version;
    }

    /**
     * @dev Function that retrieves the amount of matic that will be claimed from the NFT token
     * @param _tokenId - Id of the PolidoNFT
     */
    function getMaticFromTokenId(uint256 _tokenId)
        external
        view
        override
        returns (uint256)
    {
        RequestWithdraw memory requestData = token2WithdrawRequest[_tokenId];
        IValidatorShare validatorShare = IValidatorShare(
            requestData.validatorAddress
        );
        uint256 validatorId = validatorShare.validatorId();
        uint256 exchangeRatePrecision = validatorId < 8 ? 100 : 10**29;
        uint256 withdrawExchangeRate = validatorShare.withdrawExchangeRate();
        IValidatorShare.DelegatorUnbond memory unbond = validatorShare
            .unbonds_new(address(this), requestData.validatorNonce);

        return (withdrawExchangeRate * unbond.shares) / exchangeRatePrecision;
    }
}

File 2 of 22 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __Context_init_unchained();
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
    uint256[45] private __gap;
}

File 3 of 22 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}

File 4 of 22 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 5 of 22 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 6 of 22 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
    uint256[49] private __gap;
}

File 7 of 22 : IValidatorShare.sol
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

interface IValidatorShare {
    struct DelegatorUnbond {
        uint256 shares;
        uint256 withdrawEpoch;
    }

    function unbondNonces(address _address) external view returns (uint256);

    function activeAmount() external view returns (uint256);

    function validatorId() external view returns (uint256);

    function withdrawExchangeRate() external view returns (uint256);

    function withdrawRewards() external;

    function unstakeClaimTokens() external;

    function minAmount() external view returns (uint256);

    function getLiquidRewards(address user) external view returns (uint256);

    function delegation() external view returns (bool);

    function updateDelegation(bool _delegation) external;

    function buyVoucher(uint256 _amount, uint256 _minSharesToMint)
        external
        returns (uint256);

    function sellVoucher_new(uint256 claimAmount, uint256 maximumSharesToBurn)
        external;

    function unstakeClaimTokens_new(uint256 unbondNonce) external;

    function unbonds_new(address _address, uint256 _unbondNonce)
        external
        view
        returns (DelegatorUnbond memory);

    function getTotalStake(address user)
        external
        view
        returns (uint256, uint256);

    function owner() external view returns (address);

    function restake() external returns (uint256, uint256);

    function unlock() external;

    function lock() external;

    function drain(
        address token,
        address payable destination,
        uint256 amount
    ) external;

    function slash(uint256 _amount) external;

    function migrateOut(address user, uint256 amount) external;

    function migrateIn(address user, uint256 amount) external;
}

File 8 of 22 : INodeOperatorRegistry.sol
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

import "../lib/Operator.sol";

/// @title INodeOperatorRegistry
/// @author 2021 ShardLabs
/// @notice Node operator registry interface
interface INodeOperatorRegistry {
    /// @notice Allows to add a new node operator to the system.
    /// @param _name the node operator name.
    /// @param _rewardAddress public address used for ACL and receive rewards.
    /// @param _signerPubkey public key used on heimdall len 64 bytes.
    function addOperator(
        string memory _name,
        address _rewardAddress,
        bytes memory _signerPubkey
    ) external;

    /// @notice Allows to stop a node operator.
    /// @param _operatorId node operator id.
    function stopOperator(uint256 _operatorId) external;

    /// @notice Allows to remove a node operator from the system.
    /// @param _operatorId node operator id.
    function removeOperator(uint256 _operatorId) external;

    /// @notice Allows a staked validator to join the system.
    function joinOperator() external;

    /// @notice Allows to stake an operator on the Polygon stakeManager.
    /// This function calls Polygon transferFrom so the totalAmount(_amount + _heimdallFee)
    /// has to be approved first.
    /// @param _amount amount to stake.
    /// @param _heimdallFee heimdallFee to stake.
    function stake(uint256 _amount, uint256 _heimdallFee) external;

    /// @notice Restake Matics for a validator on polygon stake manager.
    /// @param _amount amount to stake.
    /// @param _restakeRewards restake rewards.
    function restake(uint256 _amount, bool _restakeRewards) external;

    /// @notice Allows the operator's owner to migrate the NFT. This can be done only
    /// if the DAO stopped the operator.
    function migrate() external;

    /// @notice Allows to unstake an operator from the stakeManager. After the withdraw_delay
    /// the operator owner can call claimStake func to withdraw the staked tokens.
    function unstake() external;

    /// @notice Allows to topup heimdall fees on polygon stakeManager.
    /// @param _heimdallFee amount to topup.
    function topUpForFee(uint256 _heimdallFee) external;

    /// @notice Allows to claim staked tokens on the stake Manager after the end of the
    /// withdraw delay
    function unstakeClaim() external;

    /// @notice Allows an owner to withdraw rewards from the stakeManager.
    function withdrawRewards() external;

    /// @notice Allows to update the signer pubkey
    /// @param _signerPubkey update signer public key
    function updateSigner(bytes memory _signerPubkey) external;

    /// @notice Allows to claim the heimdall fees staked by the owner of the operator
    /// @param _accumFeeAmount accumulated fees amount
    /// @param _index index
    /// @param _proof proof
    function claimFee(
        uint256 _accumFeeAmount,
        uint256 _index,
        bytes memory _proof
    ) external;

    /// @notice Allows to unjail a validator and switch from UNSTAKE status to STAKED
    function unjail() external;

    /// @notice Allows an operator's owner to set the operator name.
    function setOperatorName(string memory _name) external;

    /// @notice Allows an operator's owner to set the operator rewardAddress.
    function setOperatorRewardAddress(address _rewardAddress) external;

    /// @notice Allows the DAO to set _defaultMaxDelegateLimit.
    function setDefaultMaxDelegateLimit(uint256 _defaultMaxDelegateLimit)
        external;

    /// @notice Allows the DAO to set _maxDelegateLimit for an operator.
    function setMaxDelegateLimit(uint256 _operatorId, uint256 _maxDelegateLimit)
        external;

    /// @notice Allows the DAO to set _commissionRate.
    function setCommissionRate(uint256 _commissionRate) external;

    /// @notice Allows the DAO to set _commissionRate for an operator.
    /// @param _operatorId id of the operator
    /// @param _newCommissionRate new commission rate
    function updateOperatorCommissionRate(
        uint256 _operatorId,
        uint256 _newCommissionRate
    ) external;

    /// @notice Allows the DAO to set _minAmountStake and _minHeimdallFees.
    function setStakeAmountAndFees(
        uint256 _minAmountStake,
        uint256 _minHeimdallFees
    ) external;

    /// @notice Allows to pause/unpause the node operator contract.
    function togglePause() external;

    /// @notice Allows the DAO to enable/disable restake.
    function setRestake(bool _restake) external;

    /// @notice Allows the DAO to set stMATIC contract.
    function setStMATIC(address _stMATIC) external;

    /// @notice Allows the DAO to set validator factory contract.
    function setValidatorFactory(address _validatorFactory) external;

    /// @notice Allows the DAO to set stake manager contract.
    function setStakeManager(address _stakeManager) external;

    /// @notice Allows to set contract version.
    function setVersion(string memory _version) external;

    /// @notice Get the stMATIC contract addresses
    function getContracts()
        external
        view
        returns (
            address _validatorFactory,
            address _stakeManager,
            address _polygonERC20,
            address _stMATIC
        );

    /// @notice Allows to get stats.
    function getState()
        external
        view
        returns (
            uint256 _totalNodeOperator,
            uint256 _totalInactiveNodeOperator,
            uint256 _totalActiveNodeOperator,
            uint256 _totalStoppedNodeOperator,
            uint256 _totalUnstakedNodeOperator,
            uint256 _totalClaimedNodeOperator,
            uint256 _totalExitNodeOperator,
            uint256 _totalSlashedNodeOperator,
            uint256 _totalEjectedNodeOperator
        );

    /// @notice Allows to get a list of operatorInfo.
    function getOperatorInfos(bool _delegation, bool _allActive)
        external
        view
        returns (Operator.OperatorInfo[] memory);


    /// @notice Allows to get all the operator ids.
    function getOperatorIds() external view returns (uint256[] memory);
}

File 9 of 22 : IStakeManager.sol
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

/// @title polygon stake manager interface.
/// @author 2021 ShardLabs
/// @notice User to interact with the polygon stake manager.
interface IStakeManager {
    /// @notice Stake a validator on polygon stake manager.
    /// @param user user that own the validator in our case the validator contract.
    /// @param amount amount to stake.
    /// @param heimdallFee heimdall fees.
    /// @param acceptDelegation accept delegation.
    /// @param signerPubkey signer publickey used in heimdall node.
    function stakeFor(
        address user,
        uint256 amount,
        uint256 heimdallFee,
        bool acceptDelegation,
        bytes memory signerPubkey
    ) external;

    /// @notice Restake Matics for a validator on polygon stake manager.
    /// @param validatorId validator id.
    /// @param amount amount to stake.
    /// @param stakeRewards restake rewards.
    function restake(
        uint256 validatorId,
        uint256 amount,
        bool stakeRewards
    ) external;

    /// @notice Request unstake a validator.
    /// @param validatorId validator id.
    function unstake(uint256 validatorId) external;

    /// @notice Increase the heimdall fees.
    /// @param user user that own the validator in our case the validator contract.
    /// @param heimdallFee heimdall fees.
    function topUpForFee(address user, uint256 heimdallFee) external;

    /// @notice Get the validator id using the user address.
    /// @param user user that own the validator in our case the validator contract.
    /// @return return the validator id
    function getValidatorId(address user) external view returns (uint256);

    /// @notice get the validator contract used for delegation.
    /// @param validatorId validator id.
    /// @return return the address of the validator contract.
    function getValidatorContract(uint256 validatorId)
        external
        view
        returns (address);

    /// @notice Withdraw accumulated rewards
    /// @param validatorId validator id.
    function withdrawRewards(uint256 validatorId) external;

    /// @notice Get validator total staked.
    /// @param validatorId validator id.
    function validatorStake(uint256 validatorId)
        external
        view
        returns (uint256);

    /// @notice Allows to unstake the staked tokens on the stakeManager.
    /// @param validatorId validator id.
    function unstakeClaim(uint256 validatorId) external;

    /// @notice Allows to update the signer pubkey
    /// @param _validatorId validator id
    /// @param _signerPubkey update signer public key
    function updateSigner(uint256 _validatorId, bytes memory _signerPubkey)
        external;

    /// @notice Allows to claim the heimdall fees.
    /// @param _accumFeeAmount accumulated fees amount
    /// @param _index index
    /// @param _proof proof
    function claimFee(
        uint256 _accumFeeAmount,
        uint256 _index,
        bytes memory _proof
    ) external;

    /// @notice Allows to update the commision rate of a validator
    /// @param _validatorId operator id
    /// @param _newCommissionRate commission rate
    function updateCommissionRate(
        uint256 _validatorId,
        uint256 _newCommissionRate
    ) external;

    /// @notice Allows to unjail a validator.
    /// @param _validatorId id of the validator that is to be unjailed
    function unjail(uint256 _validatorId) external;

    /// @notice Returns a withdrawal delay.
    function withdrawalDelay() external view returns (uint256);

    /// @notice Transfers amount from delegator
    function delegationDeposit(
        uint256 validatorId,
        uint256 amount,
        address delegator
    ) external returns (bool);

    function epoch() external view returns (uint256);

    enum Status {
        Inactive,
        Active,
        Locked,
        Unstaked
    }

    struct Validator {
        uint256 amount;
        uint256 reward;
        uint256 activationEpoch;
        uint256 deactivationEpoch;
        uint256 jailTime;
        address signer;
        address contractAddress;
        Status status;
        uint256 commissionRate;
        uint256 lastCommissionUpdate;
        uint256 delegatorsReward;
        uint256 delegatedAmount;
        uint256 initialRewardPerStake;
    }

    function validators(uint256 _index)
        external
        view
        returns (Validator memory);

    /// @notice Returns the address of the nft contract
    function NFTContract() external view returns (address);

    /// @notice Returns the validator accumulated rewards on stake manager.
    function validatorReward(uint256 validatorId)
        external
        view
        returns (uint256);
}

File 10 of 22 : IPoLidoNFT.sol
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";

/// @title PoLidoNFT interface.
/// @author 2021 ShardLabs
interface IPoLidoNFT is IERC721Upgradeable {
    function mint(address _to) external returns (uint256);

    function burn(uint256 _tokenId) external;

    function isApprovedOrOwner(address _spender, uint256 _tokenId)
        external
        view
        returns (bool);

    function setStMATIC(address _stMATIC) external;
}

File 11 of 22 : IFxStateRootTunnel.sol
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

interface IFxStateRootTunnel {
    function latestData() external view returns (bytes memory);

    function setFxChildTunnel(address _fxChildTunnel) external;

    function sendMessageToChild(bytes memory message) external;

    function setStMATIC(address _stMATIC) external;
}

File 12 of 22 : IStMATIC.sol
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

import "./IValidatorShare.sol";
import "./INodeOperatorRegistry.sol";
import "./INodeOperatorRegistry.sol";
import "./IStakeManager.sol";
import "./IPoLidoNFT.sol";
import "./IFxStateRootTunnel.sol";

/// @title StMATIC interface.
/// @author 2021 ShardLabs
interface IStMATIC is IERC20Upgradeable {
    struct RequestWithdraw {
        uint256 amount2WithdrawFromStMATIC;
        uint256 validatorNonce;
        uint256 requestEpoch;
        address validatorAddress;
    }

    struct FeeDistribution {
        uint8 dao;
        uint8 operators;
        uint8 insurance;
    }

    function withdrawTotalDelegated(address _validatorShare) external;

    function nodeOperatorRegistry() external returns (INodeOperatorRegistry);

    function entityFees()
        external
        returns (
            uint8,
            uint8,
            uint8
        );

    function getMaticFromTokenId(uint256 _tokenId)
        external
        view
        returns (uint256);

    function stakeManager() external view returns (IStakeManager);

    function poLidoNFT() external view returns (IPoLidoNFT);

    function fxStateRootTunnel() external view returns (IFxStateRootTunnel);

    function version() external view returns (string memory);

    function dao() external view returns (address);

    function insurance() external view returns (address);

    function token() external view returns (address);

    function lastWithdrawnValidatorId() external view returns (uint256);

    function totalBuffered() external view returns (uint256);

    function delegationLowerBound() external view returns (uint256);

    function rewardDistributionLowerBound() external view returns (uint256);

    function reservedFunds() external view returns (uint256);

    function submitThreshold() external view returns (uint256);

    function submitHandler() external view returns (bool);

    function getMinValidatorBalance() external view returns (uint256);

    function token2WithdrawRequest(uint256 _requestId)
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            address
        );

    function DAO() external view returns (bytes32);

    function initialize(
        address _nodeOperatorRegistry,
        address _token,
        address _dao,
        address _insurance,
        address _stakeManager,
        address _poLidoNFT,
        address _fxStateRootTunnel,
        uint256 _submitThreshold
    ) external;

    function submit(uint256 _amount) external returns (uint256);

    function requestWithdraw(uint256 _amount) external;

    function delegate() external;

    function claimTokens(uint256 _tokenId) external;

    function distributeRewards() external;

    function claimTokens2StMatic(uint256 _tokenId) external;

    function togglePause() external;

    function getTotalStake(IValidatorShare _validatorShare)
        external
        view
        returns (uint256, uint256);

    function getLiquidRewards(IValidatorShare _validatorShare)
        external
        view
        returns (uint256);

    function getTotalStakeAcrossAllValidators() external view returns (uint256);

    function getTotalPooledMatic() external view returns (uint256);

    function convertStMaticToMatic(uint256 _balance)
        external
        view
        returns (
            uint256,
            uint256,
            uint256
        );

    function convertMaticToStMatic(uint256 _balance)
        external
        view
        returns (
            uint256,
            uint256,
            uint256
        );

    function setFees(
        uint8 _daoFee,
        uint8 _operatorsFee,
        uint8 _insuranceFee
    ) external;

    function setDaoAddress(address _address) external;

    function setInsuranceAddress(address _address) external;

    function setNodeOperatorRegistryAddress(address _address) external;

    function setDelegationLowerBound(uint256 _delegationLowerBound) external;

    function setRewardDistributionLowerBound(
        uint256 _rewardDistributionLowerBound
    ) external;

    function setPoLidoNFT(address _poLidoNFT) external;

    function setFxStateRootTunnel(address _fxStateRootTunnel) external;

    function setSubmitThreshold(uint256 _submitThreshold) external;

    function flipSubmitHandler() external;

    function setVersion(string calldata _version) external;
}

File 13 of 22 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 14 of 22 : 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 {
        __Context_init_unchained();
    }

    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;
    }
    uint256[50] private __gap;
}

File 15 of 22 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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 a proxied contract can't have 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.
 *
 * 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 initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 16 of 22 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 17 of 22 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 18 of 22 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 19 of 22 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
        __ERC165_init_unchained();
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

File 20 of 22 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 21 of 22 : Operator.sol
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

library Operator {
    struct OperatorInfo {
        uint256 operatorId;
        address validatorShare;
        uint256 maxDelegateLimit;
        address rewardAddress;
    }
}

File 22 of 22 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_amountClaimed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountBurned","type":"uint256"}],"name":"ClaimTokensEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_amountDelegated","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_remainder","type":"uint256"}],"name":"DelegateEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"DistributeRewardsEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"RequestWithdrawEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"SubmitEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"WithdrawTotalDelegatedEvent","type":"event"},{"inputs":[],"name":"DAO","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimTokens2StMatic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_balance","type":"uint256"}],"name":"convertMaticToStMatic","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_balance","type":"uint256"}],"name":"convertStMaticToMatic","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dao","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"delegationLowerBound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"entityFees","outputs":[{"internalType":"uint8","name":"dao","type":"uint8"},{"internalType":"uint8","name":"operators","type":"uint8"},{"internalType":"uint8","name":"insurance","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flipSubmitHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fxStateRootTunnel","outputs":[{"internalType":"contract IFxStateRootTunnel","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IValidatorShare","name":"_validatorShare","type":"address"}],"name":"getLiquidRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getMaticFromTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinValidatorBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalPooledMatic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IValidatorShare","name":"_validatorShare","type":"address"}],"name":"getTotalStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStakeAcrossAllValidators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nodeOperatorRegistry","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_dao","type":"address"},{"internalType":"address","name":"_insurance","type":"address"},{"internalType":"address","name":"_stakeManager","type":"address"},{"internalType":"address","name":"_poLidoNFT","type":"address"},{"internalType":"address","name":"_fxStateRootTunnel","type":"address"},{"internalType":"uint256","name":"_submitThreshold","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"insurance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastWithdrawnValidatorId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nodeOperatorRegistry","outputs":[{"internalType":"contract INodeOperatorRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poLidoNFT","outputs":[{"internalType":"contract IPoLidoNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"requestWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reservedFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardDistributionLowerBound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setDaoAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_delegationLowerBound","type":"uint256"}],"name":"setDelegationLowerBound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_daoFee","type":"uint8"},{"internalType":"uint8","name":"_operatorsFee","type":"uint8"},{"internalType":"uint8","name":"_insuranceFee","type":"uint8"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fxStateRootTunnel","type":"address"}],"name":"setFxStateRootTunnel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setInsuranceAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setNodeOperatorRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poLidoNFT","type":"address"}],"name":"setPoLidoNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardDistributionLowerBound","type":"uint256"}],"name":"setRewardDistributionLowerBound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_submitThreshold","type":"uint256"}],"name":"setSubmitThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_version","type":"string"}],"name":"setVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeManager","outputs":[{"internalType":"contract IStakeManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"submit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"submitHandler","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"submitThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"togglePause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"token2WithdrawRequest","outputs":[{"internalType":"uint256","name":"amount2WithdrawFromStMATIC","type":"uint256"},{"internalType":"uint256","name":"validatorNonce","type":"uint256"},{"internalType":"uint256","name":"requestEpoch","type":"uint256"},{"internalType":"address","name":"validatorAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBuffered","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_validatorShare","type":"address"}],"name":"withdrawTotalDelegated","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50614fa8806100206000396000f3fe608060405234801561001057600080fd5b50600436106103db5760003560e01c80637682c9021161020a578063bb208f5511610125578063e00222a0116100b8578063ea99c2a611610087578063ea99c2a614610884578063ee319c2114610897578063f08711fe146108aa578063f6794fdb14610912578063fc0c546a1461092557600080fd5b8063e00222a014610848578063e062b10b14610850578063e259faf714610863578063e8f8708f1461087157600080fd5b8063c89e4361116100f4578063c89e4361146107e1578063d547741f146107e9578063d968447c146107fc578063dd62ed3e1461080f57600080fd5b8063bb208f55146107ab578063c07c030e146107be578063c4ae3168146107c6578063c75e7832146107ce57600080fd5b806395d89b411161019d578063a217fddf1161016c578063a217fddf14610773578063a24529471461077b578063a457c2d714610785578063a9059cbb1461079857600080fd5b806395d89b41146106ff578063964a75961461070757806398fabd3a1461074b5780639a3cac6a1461076057600080fd5b8063893818a3116101d9578063893818a3146106a057806389cf3204146106aa578063917a52f5146106be57806391d14854146106ec57600080fd5b80637682c9021461065f578063788bc78c146106725780637e978af814610685578063883019111461068d57600080fd5b80633b573c4a116102fa5780636f4a2cd01161028d57806371975a3e1161025c57806371975a3e1461061c578063720bcf1d14610626578063745400c9146106395780637542ff951461064c57600080fd5b80636f4a2cd0146105c55780637029c90e146105cd57806370a08231146105e057806370bf9fe91461060957600080fd5b806352349b17116102c957806352349b171461059557806354fd4d501461059f5780635c975abb146105a7578063676e5550146105b257600080fd5b80633b573c4a146105395780634162169f1461054c57806346e04a2f14610578578063509c5df61461058b57600080fd5b80631e7ff8f611610372578063313ce56711610341578063313ce567146104f157806331bb3a971461050057806336568abe14610513578063395093511461052657600080fd5b80631e7ff8f61461048057806323b872dd146104a8578063248a9ca3146104bb5780632f2ff15d146104de57600080fd5b80630d946b71116103ae5780630d946b71146104485780630f2b26391461045057806315539d3f1461046557806318160ddd1461047857600080fd5b806301ffc9a7146103e057806306fdde0314610408578063095ea7b31461041d5780630d7abc3314610430575b600080fd5b6103f36103ee366004614ac3565b610939565b60405190151581526020015b60405180910390f35b610410610970565b6040516103ff9190614ceb565b6103f361042b36600461493f565b610a02565b61043a6101065481565b6040519081526020016103ff565b61043a610a18565b61046361045e3660046147eb565b610ab5565b005b6104636104733660046147eb565b610af1565b60355461043a565b61049361048e3660046147eb565b610b2d565b604080519283526020830191909152016103ff565b6103f36104b63660046148fe565b610bb1565b61043a6104c9366004614a85565b60009081526097602052604090206001015490565b6104636104ec366004614a9e565b610c62565b604051601281526020016103ff565b61046361050e366004614a85565b610c8d565b610463610521366004614a9e565b6110dd565b6103f361053436600461493f565b61115b565b610463610547366004614a85565b611197565b61010154610560906001600160a01b031681565b6040516001600160a01b0390911681526020016103ff565b610463610586366004614a85565b6111b7565b61043a6101085481565b61043a6101055481565b6104106115ab565b60c95460ff166103f3565b61043a6105c03660046147eb565b61163a565b6104636116b4565b60fe54610560906001600160a01b031681565b61043a6105ee3660046147eb565b6001600160a01b031660009081526033602052604090205490565b6104636106173660046147eb565b611c58565b61043a6101045481565b61043a610634366004614a85565b611c94565b610463610647366004614a85565b611e9f565b60fd54610560906001600160a01b031681565b61046361066d366004614a85565b6126d5565b610463610680366004614aed565b6126f5565b61043a612714565b61046361069b36600461485e565b612804565b61043a6101095481565b61010254610560906001600160a01b031681565b6106d16106cc366004614a85565b6129f4565b604080519384526020840192909252908201526060016103ff565b6103f36106fa366004614a9e565b612a58565b610410612a83565b60fc546107279060ff808216916101008104821691620100009091041683565b6040805160ff948516815292841660208401529216918101919091526060016103ff565b61043a600080516020614f5383398151915281565b61046361076e3660046147eb565b612a92565b61043a600081565b61043a6101075481565b6103f361079336600461493f565b612b09565b6103f36107a636600461493f565b612ba2565b6104636107b93660046147eb565b612baf565b610463612bec565b610463612c1b565b6104636107dc3660046147eb565b612c44565b610463612fef565b6104636107f7366004614a9e565b61334a565b6106d161080a366004614a85565b613370565b61043a61081d366004614825565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b61043a6133bc565b60ff54610560906001600160a01b031681565b61010a546103f39060ff1681565b60fb54610560906001600160a01b031681565b61043a610892366004614a85565b6133e6565b6104636108a5366004614a85565b6135dd565b6108e96108b8366004614a85565b61010b602052600090815260409020805460018201546002830154600390930154919290916001600160a01b031684565b604080519485526020850193909352918301526001600160a01b031660608201526080016103ff565b610463610920366004614beb565b6135fd565b61010354610560906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b148061096a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606036805461097f90614ea5565b80601f01602080910402602001604051908101604052809291908181526020018280546109ab90614ea5565b80156109f85780601f106109cd576101008083540402835291602001916109f8565b820191906000526020600020905b8154815290600101906020018083116109db57829003601f168201915b5050505050905090565b6000610a0f3384846136a4565b50600192915050565b60fb54604051634a84dabb60e01b8152600060048201819052600160248301529182916001600160a01b0390911690634a84dabb9060440160006040518083038186803b158015610a6857600080fd5b505afa158015610a7c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610aa4919081019061496b565b9050610aaf816137c8565b91505090565b600080516020614f53833981519152610ace8133613837565b5060fb80546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020614f53833981519152610b0a8133613837565b5060fe80546001600160a01b0319166001600160a01b0392909216919091179055565b604051630f3ffc7b60e11b815230600482015260009081906001600160a01b03841690631e7ff8f690602401604080518083038186803b158015610b7057600080fd5b505afa158015610b84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba89190614bc7565b91509150915091565b6000610bbe84848461389b565b6001600160a01b038416600090815260346020908152604080832033845290915290205482811015610c485760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610c5585338584036136a4565b60019150505b9392505050565b600082815260976020526040902060010154610c7e8133613837565b610c888383613a69565b505050565b60c95460ff1615610cb05760405162461bcd60e51b8152600401610c3f90614cfe565b600081815261010b60205260409081902060fe5491516331a9108f60e11b815260048101849052909130916001600160a01b0390911690636352211e9060240160206040518083038186803b158015610d0857600080fd5b505afa158015610d1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d409190614808565b6001600160a01b031614610d8d5760405162461bcd60e51b8152602060048201526014602482015273139bdd081bdddb995c881bd9881d1a194813919560621b6044820152606401610c3f565b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610dd357600080fd5b505af1158015610de7573d6000803e3d6000fd5b50505050806002015460fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e3e57600080fd5b505afa158015610e52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e769190614bae565b1015610ebc5760405162461bcd60e51b8152602060048201526015602482015274139bdd0818589b19481d1bc818db185a5b481e595d605a1b6044820152606401610c3f565b610103546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610f0157600080fd5b505afa158015610f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f399190614bae565b60038301546001840154919250610f5b916001600160a01b0390911690613aef565b610103546040516370a0823160e01b815230600482015260009183916001600160a01b03909116906370a082319060240160206040518083038186803b158015610fa457600080fd5b505afa158015610fb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fdc9190614bae565b610fe69190614e4b565b9050806101056000828254610ffb9190614dcd565b909155505060ff546001600160a01b0316634c09e6e861101a60355490565b6110226133bc565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b815260040161105f9190614ceb565b600060405180830381600087803b15801561107957600080fd5b505af115801561108d573d6000803e3d6000fd5b505050508084306001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd60006040516110cf91815260200190565b60405180910390a450505050565b6001600160a01b038116331461114d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c3f565b6111578282613b4d565b5050565b3360008181526034602090815260408083206001600160a01b03871684529091528120549091610a0f918590611192908690614dcd565b6136a4565b600080516020614f538339815191526111b08133613837565b5061010755565b60c95460ff16156111da5760405162461bcd60e51b8152600401610c3f90614cfe565b60fe5460405163430c208160e01b8152336004820152602481018390526001600160a01b039091169063430c20819060440160206040518083038186803b15801561122457600080fd5b505afa158015611238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125c9190614a63565b6112945760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610c3f565b600081815261010b6020908152604091829020600281015460fd54845163900cf0cf60e01b81529451929491936001600160a01b039091169263900cf0cf926004808201939291829003018186803b1580156112ef57600080fd5b505afa158015611303573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113279190614bae565b101561136d5760405162461bcd60e51b8152602060048201526015602482015274139bdd0818589b19481d1bc818db185a5b481e595d605a1b6044820152606401610c3f565b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b1580156113b357600080fd5b505af11580156113c7573d6000803e3d6000fd5b5050506003820154600091506001600160a01b03161561150e57610103546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561142657600080fd5b505afa15801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e9190614bae565b60038401546001850154919250611480916001600160a01b0390911690613aef565b610103546040516370a0823160e01b815230600482015282916001600160a01b0316906370a082319060240160206040518083038186803b1580156114c457600080fd5b505afa1580156114d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fc9190614bae565b6115069190614e4b565b915050611548565b816000015490508061010860008282546115289190614e4b565b925050819055508061010560008282546115429190614e4b565b90915550505b61010354611560906001600160a01b03163383613bb4565b8083336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd600060405161159e91815260200190565b60405180910390a4505050565b61010080546115b990614ea5565b80601f01602080910402602001604051908101604052809291908181526020018280546115e590614ea5565b80156116325780601f1061160757610100808354040283529160200191611632565b820191906000526020600020905b81548152906001019060200180831161161557829003601f168201915b505050505081565b604051630676e55560e41b81523060048201526000906001600160a01b0383169063676e55509060240160206040518083038186803b15801561167c57600080fd5b505afa158015611690573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096a9190614bae565b60c95460ff16156116d75760405162461bcd60e51b8152600401610c3f90614cfe565b60fb54604051634a84dabb60e01b815260016004820152600060248201819052916001600160a01b031690634a84dabb9060440160006040518083038186803b15801561172357600080fd5b505afa158015611737573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261175f919081019061496b565b805190915060005b818110156118f657600083828151811061178357611783614f11565b6020908102919091018101510151604051630676e55560e41b81523060048201529091506000906001600160a01b0383169063676e55509060240160206040518083038186803b1580156117d657600080fd5b505afa1580156117ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180e9190614bae565b90506000826001600160a01b0316639b2cb5d86040518163ffffffff1660e01b815260040160206040518083038186803b15801561184b57600080fd5b505afa15801561185f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118839190614bae565b90508082106118e057826001600160a01b031663c7b8981c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156118c757600080fd5b505af11580156118db573d6000803e3d6000fd5b505050505b50505080806118ee90614ee0565b915050611767565b5061010554610103546040516370a0823160e01b8152306004820152600092600a9290916001600160a01b03909116906370a082319060240160206040518083038186803b15801561194757600080fd5b505afa15801561195b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197f9190614bae565b6119899190614e4b565b6119939190614e0a565b90506101075481116119f75760405162461bcd60e51b815260206004820152602760248201527f416d6f756e7420746f2064697374726962757465206c6f776572207468616e206044820152666d696e696d756d60c81b6064820152608401610c3f565b610103546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611a3c57600080fd5b505afa158015611a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a749190614bae565b60fc54909150600090606490611a8d9060ff1685614e2c565b611a979190614e0a565b60fc54909150600090606490611ab69062010000900460ff1686614e2c565b611ac09190614e0a565b60fc54909150600090606490611ade90610100900460ff1687614e2c565b611ae89190614e0a565b90506000611af68783614e0a565b6101015461010354919250611b18916001600160a01b03908116911686613bb4565b6101025461010354611b37916001600160a01b03918216911685613bb4565b60005b87811015611b8c57611b7a898281518110611b5757611b57614f11565b602090810291909101015160600151610103546001600160a01b03169084613bb4565b80611b8481614ee0565b915050611b3a565b50610103546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611bd257600080fd5b505afa158015611be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0a9190614bae565b90506000611c188288614e4b565b61010583905560405190915081907f4e3c6a1e602996ae70905ac6165ed2434753246e3bfa52b6ca6852b40e2d440890600090a250505050505050505050565b600080516020614f53833981519152611c718133613837565b5060ff80546001600160a01b0319166001600160a01b0392909216919091179055565b600081815261010b602090815260408083208151608081018352815481526001820154818501526002820154818401526003909101546001600160a01b0316606082018190528251632e2fbed760e11b815292519193909285928492635c5f7dae9260048082019391829003018186803b158015611d1157600080fd5b505afa158015611d25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d499190614bae565b9050600060088210611d68576c01431e0fae6d7217caa0000000611d6b565b60645b6cffffffffffffffffffffffffff1690506000836001600160a01b031663bfb18f296040518163ffffffff1660e01b815260040160206040518083038186803b158015611db757600080fd5b505afa158015611dcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611def9190614bae565b602086015160405163795be58760e01b815230600482015260248101919091529091506000906001600160a01b0386169063795be58790604401604080518083038186803b158015611e4057600080fd5b505afa158015611e54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e789190614b5f565b80519091508390611e899084614e2c565b611e939190614e0a565b98975050505050505050565b60c95460ff1615611ec25760405162461bcd60e51b8152600401610c3f90614cfe565b60008111611f035760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610c3f565b60fb54604051634a84dabb60e01b815260006004820181905260016024830152916001600160a01b031690634a84dabb9060440160006040518083038186803b158015611f4f57600080fd5b505afa158015611f63573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f8b919081019061496b565b80519091506000808080611f9e87613370565b91945092509050826000611fb0612714565b90506000611fbd896137c8565b90506000821561204957611fd18983614e2c565b611fdb9085614dcd565b61010554611fe99085614dcd565b101561202e5760405162461bcd60e51b8152602060048201526014602482015273546f6f206d75636820746f20776974686472617760601b6044820152606401610c3f565b6120388983614e2c565b6120429084614e4b565b9050612093565b836101055410156120935760405162461bcd60e51b8152602060048201526014602482015273546f6f206d75636820746f20776974686472617760601b6044820152606401610c3f565b83156125fd5760fe546040516335313c2160e11b81523360048201526001600160a01b0390911690636a62784290602401602060405180830381600087803b1580156120de57600080fd5b505af11580156120f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121169190614bae565b975080156124575761212960018a614e4b565b61010454111561213a576000610104555b60008a610104548151811061215157612151614f11565b6020908102919091018101510151604051630f3ffc7b60e11b81523060048201529091506000906001600160a01b03831690631e7ff8f690602401604080518083038186803b1580156121a357600080fd5b505afa1580156121b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121db9190614bc7565b5090508381116122025761010480549060006121f683614ee0565b91905055505050612093565b600061220e8583614e4b565b90506000878211156122205787612222565b815b90506122318482600019613c17565b60408051608081018252600081529051630c11b08160e21b815230600482015260208201906001600160a01b03871690633046c2049060240160206040518083038186803b15801561228257600080fd5b505afa158015612296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ba9190614bae565b815260fd546040805163a7ab696160e01b815290516020938401936001600160a01b039093169263a7ab69619260048082019391829003018186803b15801561230257600080fd5b505afa158015612316573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233a9190614bae565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561238857600080fd5b505afa15801561239c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c09190614bae565b6123ca9190614dcd565b81526001600160a01b0386811660209283015260008f815261010b8352604090819020845181559284015160018401558301516002830155606090920151600390910180546001600160a01b0319169190921617905561242a8186614e4b565b94506124368189614e4b565b6101048054919950600061244983614ee0565b919050555050505050612093565b60405180608001604052808581526020016000815260200160fd60009054906101000a90046001600160a01b03166001600160a01b031663a7ab69616040518163ffffffff1660e01b815260040160206040518083038186803b1580156124bd57600080fd5b505afa1580156124d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f59190614bae565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561254357600080fd5b505afa158015612557573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257b9190614bae565b6125859190614dcd565b8152600060209182018190528a815261010b82526040808220845181559284015160018401558301516002830155606090920151600390910180546001600160a01b0319166001600160a01b0390921691909117905561010880548692906125ee908490614dcd565b90915550600094506120939050565b612607338c613c7d565b60ff546001600160a01b0316634c09e6e86126228d89614e4b565b61262c8a89614e4b565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b81526004016126699190614ceb565b600060405180830381600087803b15801561268357600080fd5b505af1158015612697573d6000803e3d6000fd5b50506040518d92503391507f8a8169c8a646f81d6d6ad8ed0cf560361c75cb37a74656f2487d0fa9bfcb084490600090a35050505050505050505050565b600080516020614f538339815191526126ee8133613837565b5061010655565b60006127018133613837565b61270e61010084846146cd565b50505050565b60fb54604051634a84dabb60e01b81526000600482018190526001602483015291829182916001600160a01b031690634a84dabb9060440160006040518083038186803b15801561276457600080fd5b505afa158015612778573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127a0919081019061496b565b805190915060005b818110156127fb5760006127d88483815181106127c7576127c7614f11565b602002602001015160200151610b2d565b5090506127e58186614dcd565b94505080806127f390614ee0565b9150506127a8565b50919392505050565b600054610100900460ff1661281f5760005460ff1615612823565b303b155b6128865760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c3f565b600054610100900460ff161580156128a8576000805461ffff19166101011790555b6128b0613dcb565b6128b8613e0c565b6129056040518060400160405280600c81526020016b5374616b6564204d4154494360a01b8152506040518060400160405280600781526020016673744d4154494360c81b815250613e43565b612910600033613e7c565b612928600080516020614f5383398151915288613e7c565b60fb80546001600160a01b03199081166001600160a01b038c81169190911790925560fd8054821688841617905560fe8054821687841617905560ff80548216868416179055610101805482168a8416179055610103805482168b841617905561010280549091169188169190911790556040805160608101825260198082526032602083015291015260fc805462ffffff19166219321917905561010982905561010a805460ff1916600117905580156129e9576000805461ff00191690555b505050505050505050565b600080600080612a0360355490565b90508015612a115780612a14565b60015b90506000612a206133bc565b90508015612a2e5780612a31565b60015b9050600081612a408489614e2c565b612a4a9190614e0a565b979296509094509092505050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606037805461097f90614ea5565b600080516020614f53833981519152612aab8133613837565b61010154612ad190600080516020614f53833981519152906001600160a01b031661334a565b61010180546001600160a01b0319166001600160a01b03841690811790915561115790600080516020614f5383398151915290613e7c565b3360009081526034602090815260408083206001600160a01b038616845290915281205482811015612b8b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610c3f565b612b9833858584036136a4565b5060019392505050565b6000610a0f33848461389b565b600080516020614f53833981519152612bc88133613837565b5061010280546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020614f53833981519152612c058133613837565b5061010a805460ff19811660ff90911615179055565b6000612c278133613837565b60c95460ff16612c3c57612c39613e86565b50565b612c39613efb565b60fb546001600160a01b03163314612c945760405162461bcd60e51b81526020600482015260136024820152722737ba1030903737b2329037b832b930ba37b960691b6044820152606401610c3f565b6000612c9f82610b2d565b50905080612cab575050565b60fe546040516335313c2160e11b81523060048201526000916001600160a01b031690636a62784290602401602060405180830381600087803b158015612cf157600080fd5b505af1158015612d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d299190614bae565b9050612d388383600019613c17565b60408051608081018252600081529051630c11b08160e21b815230600482015260208201906001600160a01b03861690633046c2049060240160206040518083038186803b158015612d8957600080fd5b505afa158015612d9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dc19190614bae565b815260fd546040805163a7ab696160e01b815290516020938401936001600160a01b039093169263a7ab69619260048082019391829003018186803b158015612e0957600080fd5b505afa158015612e1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e419190614bae565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015612e8f57600080fd5b505afa158015612ea3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ec79190614bae565b612ed19190614dcd565b81526001600160a01b03808616602092830152600084815261010b8352604090819020845181559284015160018401558301516002830155606090920151600390910180549183166001600160a01b031990921691909117905560ff5416634c09e6e8612f3d60355490565b612f456133bc565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b8152600401612f829190614ceb565b600060405180830381600087803b158015612f9c57600080fd5b505af1158015612fb0573d6000803e3d6000fd5b50506040518492506001600160a01b03861691507f65fcdf1cdc99352d178d6d953d52e01307cde7a592027b09c9e1d9ac8eb09ab790600090a3505050565b60c95460ff16156130125760405162461bcd60e51b8152600401610c3f90614cfe565b61010854610106546130249190614dcd565b61010554116130835760405162461bcd60e51b815260206004820152602560248201527f416d6f756e7420746f2064656c6567617465206c6f776572207468616e206d696044820152646e696d756d60d81b6064820152608401610c3f565b60fb54604051634a84dabb60e01b815260016004820152600060248201819052916001600160a01b031690634a84dabb9060440160006040518083038186803b1580156130cf57600080fd5b505afa1580156130e3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261310b919081019061496b565b8051909150806131695760405162461bcd60e51b815260206004820152602360248201527f4e6f206f70657261746f72207368617265732c2063616e6e6f742064656c656760448201526261746560e81b6064820152608401610c3f565b6000610108546101055461317d9190614e4b565b905060008060005b848110156131ca5785818151811061319f5761319f614f11565b602002602001015160400151836131b69190614dcd565b9250806131c281614ee0565b915050613185565b50600082116132145760405162461bcd60e51b815260206004820152601660248201527506d617844656c65676174654c696d69747353756d3d360541b6044820152606401610c3f565b6000838311156132245783613226565b825b60fd5461010354919250613248916001600160a01b0390811691166000613f75565b60fd5461010354613266916001600160a01b03918216911683613f75565b6000805b868110156132f457600085848a848151811061328857613288614f11565b60200260200101516040015161329e9190614e2c565b6132a89190614e0a565b90506132d38983815181106132bf576132bf614f11565b602002602001015160200151826000614099565b506132de8184614dcd565b92505080806132ec90614ee0565b91505061326a565b506132ff8186614e4b565b925061010854836133109190614dcd565b61010555604051839082907f421adba60af7a6b11679e2ac133b1bc91d3de91d56866ec19703d9d60cf950c890600090a350505050505050565b6000828152609760205260409020600101546133668133613837565b610c888383613b4d565b60008060008061337f60355490565b9050801561338d5780613390565b60015b9050600061339c6133bc565b905080156133aa57806133ad565b60015b9050600082612a408389614e2c565b6000806133c7612714565b90506101085461010554826133dc9190614dcd565b610aaf9190614e4b565b60006133f460c95460ff1690565b156134115760405162461bcd60e51b8152600401610c3f90614cfe565b600082116134525760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610c3f565b61010a5460ff16156134c2576101095461346a6133bc565b6134749084614dcd565b11156134c25760405162461bcd60e51b815260206004820152601860248201527f5375626d6974207468726573686f6c64207265616368656400000000000000006044820152606401610c3f565b610103546134db906001600160a01b0316333085614128565b60008060006134e9856129f4565b9250925092506134f93384614160565b84610105600082825461350c9190614dcd565b909155505060ff546001600160a01b0316634c09e6e861352c8585614dcd565b6135368885614dcd565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b81526004016135739190614ceb565b600060405180830381600087803b15801561358d57600080fd5b505af11580156135a1573d6000803e3d6000fd5b50506040518792503391507f8cab5a17f7d817d11abfe3fb3f8dd67646d2643cb4222e5354bde1f65ef6c44c90600090a350909150505b919050565b600080516020614f538339815191526135f68133613837565b5061010955565b600080516020614f538339815191526136168133613837565b816136218486614de5565b61362b9190614de5565b60ff1660641461366d5760405162461bcd60e51b815260206004820152600d60248201526c073756d2866656529213d31303609c1b6044820152606401610c3f565b5060fc805460ff94851661ffff1990911617610100938516939093029290921762ff00001916620100009190931602919091179055565b6001600160a01b0383166137065760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c3f565b6001600160a01b0382166137675760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c3f565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b8051600090600019825b8281101561382f5760006137f18683815181106127c7576127c7614f11565b5090506000613801600a83614e0a565b9050801580159061381157508381105b1561381a578093505b5050808061382790614ee0565b9150506137d2565b509392505050565b6138418282612a58565b61115757613859816001600160a01b0316601461423f565b61386483602061423f565b604051602001613875929190614c76565b60408051601f198184030181529082905262461bcd60e51b8252610c3f91600401614ceb565b6001600160a01b0383166138ff5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c3f565b6001600160a01b0382166139615760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c3f565b6001600160a01b038316600090815260336020526040902054818110156139d95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610c3f565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290613a10908490614dcd565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051613a5c91815260200190565b60405180910390a361270e565b613a738282612a58565b6111575760008281526097602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613aab3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6040516374bfeee160e11b8152600481018290526001600160a01b0383169063e97fddc290602401600060405180830381600087803b158015613b3157600080fd5b505af1158015613b45573d6000803e3d6000fd5b505050505050565b613b578282612a58565b156111575760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516001600160a01b038316602482015260448101829052610c8890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526143db565b60405163c83ec04d60e01b815260048101839052602481018290526001600160a01b0384169063c83ec04d90604401600060405180830381600087803b158015613c6057600080fd5b505af1158015613c74573d6000803e3d6000fd5b50505050505050565b6001600160a01b038216613cdd5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610c3f565b6001600160a01b03821660009081526033602052604090205481811015613d515760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610c3f565b6001600160a01b0383166000908152603360205260408120838303905560358054849290613d80908490614e4b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600054610100900460ff16613df25760405162461bcd60e51b8152600401610c3f90614d28565b613dfa6144ad565b613e026144ad565b613e0a6144ad565b565b600054610100900460ff16613e335760405162461bcd60e51b8152600401610c3f90614d28565b613e3b6144ad565b613e0a6144d4565b600054610100900460ff16613e6a5760405162461bcd60e51b8152600401610c3f90614d28565b613e726144ad565b6111578282614507565b6111578282613a69565b60c95460ff1615613ea95760405162461bcd60e51b8152600401610c3f90614cfe565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613ede3390565b6040516001600160a01b03909116815260200160405180910390a1565b60c95460ff16613f445760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c3f565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33613ede565b801580613ffe5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015613fc457600080fd5b505afa158015613fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ffc9190614bae565b155b6140695760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610c3f565b6040516001600160a01b038316602482015260448101829052610c8890849063095ea7b360e01b90606401613be0565b604051636ab1507160e01b8152600481018390526024810182905260009081906001600160a01b03861690636ab1507190604401602060405180830381600087803b1580156140e757600080fd5b505af11580156140fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061411f9190614bae565b95945050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261270e9085906323b872dd60e01b90608401613be0565b6001600160a01b0382166141b65760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610c3f565b80603560008282546141c89190614dcd565b90915550506001600160a01b038216600090815260336020526040812080548392906141f5908490614dcd565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6060600061424e836002614e2c565b614259906002614dcd565b67ffffffffffffffff81111561427157614271614f27565b6040519080825280601f01601f19166020018201604052801561429b576020820181803683370190505b509050600360fc1b816000815181106142b6576142b6614f11565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106142e5576142e5614f11565b60200101906001600160f81b031916908160001a9053506000614309846002614e2c565b614314906001614dcd565b90505b600181111561438c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061434857614348614f11565b1a60f81b82828151811061435e5761435e614f11565b60200101906001600160f81b031916908160001a90535060049490941c9361438581614e8e565b9050614317565b508315610c5b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c3f565b6000614430826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166145559092919063ffffffff16565b805190915015610c88578080602001905181019061444e9190614a63565b610c885760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c3f565b600054610100900460ff16613e0a5760405162461bcd60e51b8152600401610c3f90614d28565b600054610100900460ff166144fb5760405162461bcd60e51b8152600401610c3f90614d28565b60c9805460ff19169055565b600054610100900460ff1661452e5760405162461bcd60e51b8152600401610c3f90614d28565b8151614541906036906020850190614751565b508051610c88906037906020840190614751565b6060614564848460008561456c565b949350505050565b6060824710156145cd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c3f565b843b61461b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c3f565b600080866001600160a01b031685876040516146379190614c5a565b60006040518083038185875af1925050503d8060008114614674576040519150601f19603f3d011682016040523d82523d6000602084013e614679565b606091505b5091509150614689828286614694565b979650505050505050565b606083156146a3575081610c5b565b8251156146b35782518084602001fd5b8160405162461bcd60e51b8152600401610c3f9190614ceb565b8280546146d990614ea5565b90600052602060002090601f0160209004810192826146fb5760008555614741565b82601f106147145782800160ff19823516178555614741565b82800160010185558215614741579182015b82811115614741578235825591602001919060010190614726565b5061474d9291506147c5565b5090565b82805461475d90614ea5565b90600052602060002090601f01602090048101928261477f5760008555614741565b82601f1061479857805160ff1916838001178555614741565b82800160010185558215614741579182015b828111156147415782518255916020019190600101906147aa565b5b8082111561474d57600081556001016147c6565b803560ff811681146135d857600080fd5b6000602082840312156147fd57600080fd5b8135610c5b81614f3d565b60006020828403121561481a57600080fd5b8151610c5b81614f3d565b6000806040838503121561483857600080fd5b823561484381614f3d565b9150602083013561485381614f3d565b809150509250929050565b600080600080600080600080610100898b03121561487b57600080fd5b883561488681614f3d565b9750602089013561489681614f3d565b965060408901356148a681614f3d565b955060608901356148b681614f3d565b945060808901356148c681614f3d565b935060a08901356148d681614f3d565b925060c08901356148e681614f3d565b8092505060e089013590509295985092959890939650565b60008060006060848603121561491357600080fd5b833561491e81614f3d565b9250602084013561492e81614f3d565b929592945050506040919091013590565b6000806040838503121561495257600080fd5b823561495d81614f3d565b946020939093013593505050565b6000602080838503121561497e57600080fd5b825167ffffffffffffffff8082111561499657600080fd5b818501915085601f8301126149aa57600080fd5b8151818111156149bc576149bc614f27565b6149ca848260051b01614d9c565b8181528481019250838501600783901b850186018910156149ea57600080fd5b60009450845b83811015614a5557608080838c031215614a08578687fd5b614a10614d73565b8351815288840151614a2181614f3d565b818a015260408481015190820152606080850151614a3e81614f3d565b9082015286529487019491909101906001016149f0565b509098975050505050505050565b600060208284031215614a7557600080fd5b81518015158114610c5b57600080fd5b600060208284031215614a9757600080fd5b5035919050565b60008060408385031215614ab157600080fd5b82359150602083013561485381614f3d565b600060208284031215614ad557600080fd5b81356001600160e01b031981168114610c5b57600080fd5b60008060208385031215614b0057600080fd5b823567ffffffffffffffff80821115614b1857600080fd5b818501915085601f830112614b2c57600080fd5b813581811115614b3b57600080fd5b866020828501011115614b4d57600080fd5b60209290920196919550909350505050565b600060408284031215614b7157600080fd5b6040516040810181811067ffffffffffffffff82111715614b9457614b94614f27565b604052825181526020928301519281019290925250919050565b600060208284031215614bc057600080fd5b5051919050565b60008060408385031215614bda57600080fd5b505080516020909101519092909150565b600080600060608486031215614c0057600080fd5b614c09846147da565b9250614c17602085016147da565b9150614c25604085016147da565b90509250925092565b60008151808452614c46816020860160208601614e62565b601f01601f19169290920160200192915050565b60008251614c6c818460208701614e62565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614cae816017850160208801614e62565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614cdf816028840160208801614e62565b01602801949350505050565b602081526000610c5b6020830184614c2e565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6040516080810167ffffffffffffffff81118282101715614d9657614d96614f27565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614dc557614dc5614f27565b604052919050565b60008219821115614de057614de0614efb565b500190565b600060ff821660ff84168060ff03821115614e0257614e02614efb565b019392505050565b600082614e2757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615614e4657614e46614efb565b500290565b600082821015614e5d57614e5d614efb565b500390565b60005b83811015614e7d578181015183820152602001614e65565b8381111561270e5750506000910152565b600081614e9d57614e9d614efb565b506000190190565b600181811c90821680614eb957607f821691505b60208210811415614eda57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415614ef457614ef4614efb565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612c3957600080fdfed0a4ad96d49edb1c33461cebc6fb2609190f32c904e3c3f5877edb4488dee91ea26469706673582212203a29b357f55fb24d43119081ee18454005b846621b2db4fa6ea748fd6a74cac164736f6c63430008070033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

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.