Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multi Chain
Multichain Addresses
N/ALatest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 8337264 | 249 days 12 hrs ago | IN | Create: StMATIC | 0 ETH | 0.05358755 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Txn Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
9755679 | 12 hrs 21 mins ago | 0 ETH | ||||
9752539 | 1 day 1 hr ago | 0 ETH | ||||
9745415 | 2 days 7 hrs ago | 0 ETH | ||||
9745411 | 2 days 7 hrs ago | 0 ETH | ||||
9745406 | 2 days 7 hrs ago | 0 ETH | ||||
9745404 | 2 days 7 hrs ago | 0 ETH | ||||
9745402 | 2 days 7 hrs ago | 0 ETH | ||||
9745396 | 2 days 7 hrs ago | 0 ETH | ||||
9745357 | 2 days 7 hrs ago | 0 ETH | ||||
9745354 | 2 days 7 hrs ago | 0 ETH | ||||
9745352 | 2 days 7 hrs ago | 0 ETH | ||||
9745347 | 2 days 7 hrs ago | 0 ETH | ||||
9739763 | 3 days 6 hrs ago | 0 ETH | ||||
9739752 | 3 days 6 hrs ago | 0 ETH | ||||
9739597 | 3 days 7 hrs ago | 0 ETH | ||||
9738514 | 3 days 11 hrs ago | 0 ETH | ||||
9738501 | 3 days 11 hrs ago | 0 ETH | ||||
9738467 | 3 days 11 hrs ago | 0 ETH | ||||
9734395 | 4 days 4 hrs ago | 0 ETH | ||||
9734326 | 4 days 5 hrs ago | 0 ETH | ||||
9734311 | 4 days 5 hrs ago | 0 ETH | ||||
9734305 | 4 days 5 hrs ago | 0 ETH | ||||
9733842 | 4 days 7 hrs ago | 0 ETH | ||||
9733842 | 4 days 7 hrs ago | 0 ETH | ||||
9733842 | 4 days 7 hrs ago | 0 ETH |
Loading...
Loading
Contract Name:
StMATIC
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// 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"; /// @title StMATIC /// @author 2021 ShardLabs. contract StMATIC is IStMATIC, ERC20Upgradeable, AccessControlUpgradeable, PausableUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; /// @notice node operator registry interface. INodeOperatorRegistry public override nodeOperator; /// @notice The fee distribution. FeeDistribution public override entityFees; /// @notice StakeManager interface. IStakeManager public override stakeManager; /// @notice LidoNFT interface. IPoLidoNFT public override poLidoNFT; /// @notice contract version. string public override version; /// @notice dao address. address public override dao; /// @notice insurance address. address public override insurance; /// @notice Matic ERC20 token. address public override token; /// @notice Matic ERC20 token address NOT USED IN V2. uint256 public override lastWithdrawnValidatorId; /// @notice total buffered Matic in the contract. uint256 public override totalBuffered; /// @notice delegation lower bound. uint256 public override delegationLowerBound; /// @notice reward distribution lower bound. uint256 public override rewardDistributionLowerBound; /// @notice reserved funds in Matic. uint256 public override reservedFunds; uint256 public minValidatorBalance; /// @notice token to WithdrawRequest mapping one-to-one. mapping(uint256 => RequestWithdraw) public override token2WithdrawRequest; /// @notice DAO Role. bytes32 public constant override DAO = keccak256("DAO"); IFxStateRootTunnel override public fxStateRootTunnel; bool public override submitHandler; uint256 public override submitThreshold; /// @notice When an operator quit the system StMATIC contract withdraw the total delegated /// to it. The request is stored inside this array. RequestWithdraw[] public stMaticWithdrawRequest; bytes32 public constant override PAUSE_ROLE = keccak256("LIDO_PAUSE_OPERATOR"); bytes32 public constant override UNPAUSE_ROLE = keccak256("LIDO_UNPAUSE_OPERATOR"); /// @notice token to Array WithdrawRequest mapping one-to-many. mapping(uint256 => RequestWithdraw[]) public token2WithdrawRequests; /// @notice protocol fee. uint8 public override protocolFee; // @notice these state variable are used to mark entrance and exit form a contract function uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; /// @notice Prevents a contract from calling itself, directly or indirectly. modifier nonReentrant() { _nonReentrant(); _status = _ENTERED; _; _status = _NOT_ENTERED; } /// @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 ) external override initializer { __AccessControl_init_unchained(); __Pausable_init_unchained(); __ERC20_init_unchained("Staked MATIC", "stMATIC"); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(DAO, _dao); _grantRole(PAUSE_ROLE, msg.sender); _grantRole(UNPAUSE_ROLE, _dao); nodeOperator = INodeOperatorRegistry(_nodeOperatorRegistry); stakeManager = IStakeManager(_stakeManager); poLidoNFT = IPoLidoNFT(_poLidoNFT); fxStateRootTunnel = IFxStateRootTunnel(_fxStateRootTunnel); dao = _dao; token = _token; insurance = _insurance; entityFees = FeeDistribution(25, 50, 25); } /// @notice 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 /// @param _referral - referral address. /// @return Amount of StMATIC shares generated function submit(uint256 _amount, address _referral) external override whenNotPaused nonReentrant returns (uint256) { _require(_amount > 0, "Invalid amount"); IERC20Upgradeable(token).safeTransferFrom( msg.sender, address(this), _amount ); ( uint256 amountToMint, uint256 totalShares, uint256 totalPooledMatic ) = convertMaticToStMatic(_amount); _require(amountToMint > 0, "Mint ZERO"); _mint(msg.sender, amountToMint); totalBuffered += _amount; fxStateRootTunnel.sendMessageToChild( abi.encode(totalShares + amountToMint, totalPooledMatic + _amount) ); emit SubmitEvent(msg.sender, _amount, _referral); return amountToMint; } /// @notice Stores users request to withdraw into a RequestWithdraw struct /// @param _amount - Amount of StMATIC that is requested to withdraw /// @param _referral - referral address. /// @return NFT token id. function requestWithdraw(uint256 _amount, address _referral) external override whenNotPaused nonReentrant returns (uint256) { _require( _amount > 0 && balanceOf(msg.sender) >= _amount, "Invalid amount" ); uint256 tokenId; { ( INodeOperatorRegistry.ValidatorData[] memory activeNodeOperators, uint256 totalDelegated, uint256 bigNodeOperatorLength, uint256[] memory bigNodeOperatorIds, uint256 smallNodeOperatorLength, uint256[] memory smallNodeOperatorIds, uint256[] memory allowedAmountToRequestFromOperators, uint256 totalValidatorsToWithdrawFrom ) = nodeOperator.getValidatorsRequestWithdraw(_amount); uint256 totalPooledMatic = _getTotalPooledMatic(totalDelegated); uint256 totalAmount2WithdrawInMatic = _convertStMaticToMatic( _amount, totalPooledMatic ); _require(totalAmount2WithdrawInMatic > 0, "Withdraw ZERO Matic"); { uint256 localActiveBalance = totalBuffered > reservedFunds ? totalBuffered - reservedFunds : 0; uint256 liquidity = totalDelegated + localActiveBalance; _require( liquidity >= totalAmount2WithdrawInMatic, "Too much to withdraw" ); } // Added a scoop here to fix stack too deep error { uint256 currentAmount2WithdrawInMatic = totalAmount2WithdrawInMatic; tokenId = poLidoNFT.mint(msg.sender); if (totalDelegated != 0) { if (totalValidatorsToWithdrawFrom != 0) { currentAmount2WithdrawInMatic = _requestWithdrawBalanced( tokenId, activeNodeOperators, totalAmount2WithdrawInMatic, totalValidatorsToWithdrawFrom, totalDelegated, currentAmount2WithdrawInMatic ); } else { // request withdraw from big delegated validators currentAmount2WithdrawInMatic = _requestWithdrawUnbalanced( tokenId, activeNodeOperators, bigNodeOperatorLength, bigNodeOperatorIds, allowedAmountToRequestFromOperators, currentAmount2WithdrawInMatic ); // request withdraw from small delegated validators if (currentAmount2WithdrawInMatic != 0) { currentAmount2WithdrawInMatic = _requestWithdrawUnbalanced( tokenId, activeNodeOperators, smallNodeOperatorLength, smallNodeOperatorIds, allowedAmountToRequestFromOperators, currentAmount2WithdrawInMatic ); } } } if (_amount > totalDelegated) { token2WithdrawRequests[tokenId].push( RequestWithdraw( currentAmount2WithdrawInMatic, 0, stakeManager.epoch() + stakeManager.withdrawalDelay(), address(0) ) ); reservedFunds += currentAmount2WithdrawInMatic; currentAmount2WithdrawInMatic = 0; } } _burn(msg.sender, _amount); fxStateRootTunnel.sendMessageToChild( abi.encode( totalSupply(), totalPooledMatic - totalAmount2WithdrawInMatic ) ); } emit RequestWithdrawEvent(msg.sender, _amount, _referral); return tokenId; } /// @notice Request withdraw when system is balanced function _requestWithdrawBalanced( uint256 tokenId, INodeOperatorRegistry.ValidatorData[] memory activeNodeOperators, uint256 totalAmount2WithdrawInMatic, uint256 totalValidatorsToWithdrawFrom, uint256 totalDelegated, uint256 currentAmount2WithdrawInMatic ) private returns (uint256) { uint256 totalAmount = totalDelegated > totalAmount2WithdrawInMatic ? totalAmount2WithdrawInMatic : totalDelegated; uint256 amount2WithdrawFromValidator = totalAmount / totalValidatorsToWithdrawFrom; for (uint256 idx = 0; idx < totalValidatorsToWithdrawFrom; idx++) { address validatorShare = activeNodeOperators[idx].validatorShare; _require( _calculateValidatorShares( validatorShare, amount2WithdrawFromValidator ) > 0, "ZERO shares to withdraw" ); currentAmount2WithdrawInMatic = _requestWithdraw( tokenId, validatorShare, amount2WithdrawFromValidator, currentAmount2WithdrawInMatic ); } return currentAmount2WithdrawInMatic; } /// @notice Request withdraw when system is unbalanced function _requestWithdrawUnbalanced( uint256 tokenId, INodeOperatorRegistry.ValidatorData[] memory activeNodeOperators, uint256 nodeOperatorLength, uint256[] memory nodeOperatorIds, uint256[] memory allowedAmountToRequestFromOperators, uint256 currentAmount2WithdrawInMatic ) private returns (uint256) { for (uint256 idx = 0; idx < nodeOperatorLength; idx++) { uint256 id = nodeOperatorIds[idx]; uint256 amountCanBeRequested = allowedAmountToRequestFromOperators[ id ]; if (amountCanBeRequested == 0) continue; uint256 amount2WithdrawFromValidator = amountCanBeRequested > currentAmount2WithdrawInMatic ? currentAmount2WithdrawInMatic : allowedAmountToRequestFromOperators[id]; address validatorShare = activeNodeOperators[id].validatorShare; _require( _calculateValidatorShares( validatorShare, amount2WithdrawFromValidator ) > 0, "ZERO shares to withdraw" ); currentAmount2WithdrawInMatic = _requestWithdraw( tokenId, validatorShare, amount2WithdrawFromValidator, currentAmount2WithdrawInMatic ); if (currentAmount2WithdrawInMatic == 0) break; } return currentAmount2WithdrawInMatic; } function _requestWithdraw( uint256 tokenId, address validatorShare, uint256 amount2WithdrawFromValidator, uint256 currentAmount2WithdrawInMatic ) private returns (uint256) { sellVoucher_new( validatorShare, amount2WithdrawFromValidator, type(uint256).max ); token2WithdrawRequests[tokenId].push( RequestWithdraw( 0, IValidatorShare(validatorShare).unbondNonces(address(this)), stakeManager.epoch() + stakeManager.withdrawalDelay(), validatorShare ) ); currentAmount2WithdrawInMatic -= amount2WithdrawFromValidator; return currentAmount2WithdrawInMatic; } /// @notice This will be included in the cron job /// @notice Delegates tokens to validator share contract function delegate() external override whenNotPaused nonReentrant { uint256 ltotalBuffered = totalBuffered; uint256 lreservedFunds = reservedFunds; _require( ltotalBuffered > delegationLowerBound + lreservedFunds, "Amount to delegate lower than minimum" ); uint256 amountToDelegate = ltotalBuffered - lreservedFunds; ( INodeOperatorRegistry.ValidatorData[] memory delegatableNodeOperators, uint256 totalDelegatableNodeOperators, uint256[] memory operatorRatios, uint256 totalRatio ) = nodeOperator.getValidatorsDelegationAmount( amountToDelegate ); uint256 remainder; uint256 amountDelegated; IERC20Upgradeable(token).safeApprove(address(stakeManager), 0); IERC20Upgradeable(token).safeApprove( address(stakeManager), amountToDelegate ); for (uint256 i = 0; i < totalDelegatableNodeOperators; i++) { uint256 amountToDelegatePerOperator; // If the total Ratio is equal to ZERO that means the system is balanced so we // distribute the buffered tokens equally between the validators if (totalRatio == 0) { amountToDelegatePerOperator = amountToDelegate / totalDelegatableNodeOperators; } else { if (operatorRatios[i] == 0) continue; amountToDelegatePerOperator = (operatorRatios[i] * amountToDelegate) / totalRatio; } address _validatorAddress = delegatableNodeOperators[i] .validatorShare; uint256 shares = _calculateValidatorShares( _validatorAddress, amountToDelegatePerOperator ); if (shares == 0) continue; buyVoucher(_validatorAddress, amountToDelegatePerOperator, 0); amountDelegated += amountToDelegatePerOperator; } remainder = amountToDelegate - amountDelegated; totalBuffered = remainder + lreservedFunds; emit DelegateEvent(amountDelegated, remainder); } /// @notice 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" ); if (token2WithdrawRequest[_tokenId].requestTime != 0) { _claimTokensV1(_tokenId); } else if (token2WithdrawRequests[_tokenId].length != 0) { _claimTokensV2(_tokenId); } else { revert("Invalid claim token"); } } /// @notice Claims tokens v2 function _claimTokensV2(uint256 _tokenId) private { RequestWithdraw[] memory usersRequest = token2WithdrawRequests[ _tokenId ]; _require( stakeManager.epoch() >= usersRequest[0].requestTime, "Not able to claim yet" ); poLidoNFT.burn(_tokenId); uint256 length = usersRequest.length; uint256 amountToClaim; uint256 balanceBeforeClaim = IERC20Upgradeable(token).balanceOf( address(this) ); for (uint256 idx = 0; idx < length; idx++) { if (usersRequest[idx].validatorAddress != address(0)) { unstakeClaimTokens_new( usersRequest[idx].validatorAddress, usersRequest[idx].validatorNonce ); } else { uint256 _amountToClaim = usersRequest[idx] .amount2WithdrawFromStMATIC; reservedFunds -= _amountToClaim; totalBuffered -= _amountToClaim; amountToClaim += _amountToClaim; } } amountToClaim += IERC20Upgradeable(token).balanceOf(address(this)) - balanceBeforeClaim; IERC20Upgradeable(token).safeTransfer(msg.sender, amountToClaim); emit ClaimTokensEvent(msg.sender, _tokenId, amountToClaim, 0); } /// @notice Claims tokens v1 function _claimTokensV1(uint256 _tokenId) private { RequestWithdraw storage usersRequest = token2WithdrawRequest[_tokenId]; _require( stakeManager.epoch() >= usersRequest.requestTime, "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); } /// @notice Distributes rewards claimed from validator shares based on fees defined /// in entityFee. function distributeRewards() external override whenNotPaused nonReentrant { ( INodeOperatorRegistry.ValidatorData[] memory operatorInfos, uint256 totalActiveOperatorInfos ) = nodeOperator.listDelegatedNodeOperators(); for (uint256 i = 0; i < totalActiveOperatorInfos; 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; uint256 protocolRewards = totalRewards * protocolFee / 100; _require( protocolRewards > rewardDistributionLowerBound, "Amount to distribute lower than minimum" ); uint256 balanceBeforeDistribution = IERC20Upgradeable(token).balanceOf( address(this) ); uint256 daoRewards = (protocolRewards * entityFees.dao) / 100; uint256 insuranceRewards = (protocolRewards * entityFees.insurance) / 100; uint256 operatorsRewards = (protocolRewards * entityFees.operators) / 100; uint256 operatorReward = operatorsRewards / totalActiveOperatorInfos; IERC20Upgradeable(token).safeTransfer(dao, daoRewards); IERC20Upgradeable(token).safeTransfer(insurance, insuranceRewards); for (uint256 i = 0; i < totalActiveOperatorInfos; 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 /// @notice Withdraws funds from stopped validator. /// @param _validatorShare - Address of the validator share that will be withdrawn function withdrawTotalDelegated(address _validatorShare) external override nonReentrant { _require( msg.sender == address(nodeOperator), "Not a node operator" ); (uint256 stakedAmount, ) = getTotalStake( IValidatorShare(_validatorShare) ); // Check if the validator has enough shares. uint256 shares = _calculateValidatorShares( _validatorShare, stakedAmount ); if (shares == 0) { return; } _createWithdrawRequest(_validatorShare, stakedAmount); emit WithdrawTotalDelegatedEvent(_validatorShare, stakedAmount); } /// @notice Rebalane the system by request withdraw from the validators that contains /// more token delegated to them. function rebalanceDelegatedTokens() external override onlyRole(DAO) { uint256 amountToReDelegate = totalBuffered - reservedFunds + calculatePendingBufferedTokens(); ( INodeOperatorRegistry.ValidatorData[] memory nodeOperators, uint256 totalActiveNodeOperator, uint256[] memory operatorRatios, uint256 totalRatio, uint256 totalToWithdraw ) = nodeOperator.getValidatorsRebalanceAmount( amountToReDelegate ); uint256 amountToWithdraw; address _validatorAddress; for (uint256 i = 0; i < totalActiveNodeOperator; i++) { if (operatorRatios[i] == 0) continue; amountToWithdraw = (operatorRatios[i] * totalToWithdraw) / totalRatio; if (amountToWithdraw == 0) continue; _validatorAddress = nodeOperators[i].validatorShare; uint256 shares = _calculateValidatorShares( _validatorAddress, amountToWithdraw ); if (shares == 0) continue; _createWithdrawRequest( nodeOperators[i].validatorShare, amountToWithdraw ); } } function _createWithdrawRequest(address _validatorShare, uint256 amount) private { sellVoucher_new(_validatorShare, amount, type(uint256).max); stMaticWithdrawRequest.push( RequestWithdraw( 0, IValidatorShare(_validatorShare).unbondNonces(address(this)), stakeManager.epoch() + stakeManager.withdrawalDelay(), _validatorShare ) ); } /// @notice calculate the total amount stored in stMaticWithdrawRequest array. /// @return pendingBufferedTokens the total pending amount for stMatic. function calculatePendingBufferedTokens() public view override returns (uint256 pendingBufferedTokens) { uint256 pendingWithdrawalLength = stMaticWithdrawRequest.length; for (uint256 i = 0; i < pendingWithdrawalLength; i++) { pendingBufferedTokens += _getMaticFromRequestData( stMaticWithdrawRequest[i] ); } return pendingBufferedTokens; } /// @notice Claims tokens from validator share and sends them to the StMATIC contract. function claimTokensFromValidatorToContract(uint256 _index) external override whenNotPaused nonReentrant { uint256 length = stMaticWithdrawRequest.length; _require(_index < length, "invalid index"); RequestWithdraw memory lidoRequest = stMaticWithdrawRequest[_index]; _require( stakeManager.epoch() >= lidoRequest.requestTime, "Not able to claim yet" ); uint256 balanceBeforeClaim = IERC20Upgradeable(token).balanceOf( address(this) ); unstakeClaimTokens_new( lidoRequest.validatorAddress, lidoRequest.validatorNonce ); uint256 claimedAmount = IERC20Upgradeable(token).balanceOf( address(this) ) - balanceBeforeClaim; totalBuffered += claimedAmount; if (_index != length - 1 && length != 1) { stMaticWithdrawRequest[_index] = stMaticWithdrawRequest[length - 1]; } stMaticWithdrawRequest.pop(); fxStateRootTunnel.sendMessageToChild( abi.encode(totalSupply(), getTotalPooledMatic()) ); emit ClaimTotalDelegatedEvent( lidoRequest.validatorAddress, claimedAmount ); } /// @notice Pauses the contract function pause() external onlyRole(PAUSE_ROLE) { _pause(); } /// @notice Unpauses the contract function unpause() external onlyRole(UNPAUSE_ROLE) { _unpause(); } //////////////////////////////////////////////////////////// ///// /// ///// ***ValidatorShare API*** /// ///// /// //////////////////////////////////////////////////////////// /// @notice Returns the stMaticWithdrawRequest list function getTotalWithdrawRequest() public view returns (RequestWithdraw[] memory) { return stMaticWithdrawRequest; } /// @notice 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; } /// @notice 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); } /// @notice 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 ); } /// @notice 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)); } /// @notice 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*** /// ///// /// //////////////////////////////////////////////////////////// /// @notice Helper function for that returns total pooled MATIC /// @return Total pooled MATIC function getTotalStakeAcrossAllValidators() public view override returns (uint256) { uint256 totalStake; ( INodeOperatorRegistry.ValidatorData[] memory nodeOperators, uint256 operatorsLength ) = nodeOperator.listWithdrawNodeOperators(); for (uint256 i = 0; i < operatorsLength; i++) { (uint256 currValidatorShare, ) = getTotalStake( IValidatorShare(nodeOperators[i].validatorShare) ); totalStake += currValidatorShare; } return totalStake; } /// @notice Function that calculates total pooled Matic /// @return Total pooled Matic function getTotalPooledMatic() public view override returns (uint256) { uint256 totalStaked = getTotalStakeAcrossAllValidators(); return _getTotalPooledMatic(totalStaked); } function _getTotalPooledMatic(uint256 _totalStaked) private view returns (uint256) { return _totalStaked + totalBuffered + calculatePendingBufferedTokens() - reservedFunds; } /// @notice Function that converts arbitrary stMATIC to Matic /// @param _amountInStMatic - Amount of stMATIC to convert to Matic /// @return amountInMatic - Amount of Matic after conversion, /// @return totalStMaticAmount - Total StMatic in the contract, /// @return totalPooledMatic - Total Matic in the staking pool function convertStMaticToMatic(uint256 _amountInStMatic) external view override returns ( uint256 amountInMatic, uint256 totalStMaticAmount, uint256 totalPooledMatic ) { totalStMaticAmount = totalSupply(); uint256 totalPooledMATIC = getTotalPooledMatic(); return ( _convertStMaticToMatic(_amountInStMatic, totalPooledMATIC), totalStMaticAmount, totalPooledMATIC ); } /// @notice Function that converts arbitrary amount of stMatic to Matic /// @param _stMaticAmount - amount of stMatic to convert to Matic /// @return amountInMatic, totalStMaticAmount and totalPooledMatic function _convertStMaticToMatic( uint256 _stMaticAmount, uint256 _totalPooledMatic ) private view returns (uint256) { uint256 totalStMaticSupply = totalSupply(); totalStMaticSupply = totalStMaticSupply == 0 ? 1 : totalStMaticSupply; _totalPooledMatic = _totalPooledMatic == 0 ? 1 : _totalPooledMatic; uint256 amountInMatic = (_stMaticAmount * _totalPooledMatic) / totalStMaticSupply; return amountInMatic; } /// @notice Function that converts arbitrary Matic to stMATIC /// @param _amountInMatic - Amount of Matic to convert to stMatic /// @return amountInStMatic - Amount of Matic to converted to stMatic /// @return totalStMaticSupply - Total amount of StMatic in the contract /// @return totalPooledMatic - Total amount of Matic in the staking pool function convertMaticToStMatic(uint256 _amountInMatic) public view override returns ( uint256 amountInStMatic, uint256 totalStMaticSupply, uint256 totalPooledMatic ) { totalStMaticSupply = totalSupply(); totalPooledMatic = getTotalPooledMatic(); return ( _convertMaticToStMatic(_amountInMatic, totalPooledMatic), totalStMaticSupply, totalPooledMatic ); } function getToken2WithdrawRequests(uint256 _tokenId) external view returns (RequestWithdraw[] memory) { return token2WithdrawRequests[_tokenId]; } /// @notice Function that converts arbitrary amount of Matic to stMatic /// @param _maticAmount - Amount in Matic to convert to stMatic /// @return amountInStMatic , totalStMaticAmount and totalPooledMatic function _convertMaticToStMatic( uint256 _maticAmount, uint256 _totalPooledMatic ) private view returns (uint256) { uint256 totalStMaticSupply = totalSupply(); totalStMaticSupply = totalStMaticSupply == 0 ? 1 : totalStMaticSupply; _totalPooledMatic = _totalPooledMatic == 0 ? 1 : _totalPooledMatic; uint256 amountInStMatic = (_maticAmount * totalStMaticSupply) / _totalPooledMatic; return amountInStMatic; } //////////////////////////////////////////////////////////// ///// /// ///// ***Setters*** /// ///// /// //////////////////////////////////////////////////////////// /// @notice 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; emit SetFees(_daoFee, _operatorsFee, _insuranceFee); } /// @notice Function that sets protocol fee /// @param _newProtocolFee new protocol fee function setProtocolFee(uint8 _newProtocolFee) external override onlyRole(DAO) { _require( _newProtocolFee > 0 && _newProtocolFee <= 100, "Invalid protcol fee" ); uint8 oldProtocolFee = protocolFee; protocolFee = _newProtocolFee; emit SetProtocolFee(oldProtocolFee, _newProtocolFee); } /// @notice Function that sets new dao address /// @notice Callable only by dao /// @param _newDAO - New dao address function setDaoAddress(address _newDAO) external override onlyRole(DAO) { address oldDAO = dao; dao = _newDAO; emit SetDaoAddress(oldDAO, _newDAO); } /// @notice 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; emit SetInsuranceAddress(_address); } /// @notice 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) { nodeOperator = INodeOperatorRegistry(_address); emit SetNodeOperatorRegistryAddress(_address); } /// @notice 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; emit SetDelegationLowerBound(_delegationLowerBound); } /// @notice Function that sets new lower bound for rewards distribution /// @notice Only callable by dao /// @param _newRewardDistributionLowerBound - New lower bound for rewards distribution function setRewardDistributionLowerBound( uint256 _newRewardDistributionLowerBound ) external override onlyRole(DAO) { uint256 oldRewardDistributionLowerBound = rewardDistributionLowerBound; rewardDistributionLowerBound = _newRewardDistributionLowerBound; emit SetRewardDistributionLowerBound( oldRewardDistributionLowerBound, _newRewardDistributionLowerBound ); } /// @notice Function that sets the poLidoNFT address /// @param _newLidoNFT new poLidoNFT address function setPoLidoNFT(address _newLidoNFT) external override onlyRole(DAO) { address oldPoLidoNFT = address(poLidoNFT); poLidoNFT = IPoLidoNFT(_newLidoNFT); emit SetLidoNFT(oldPoLidoNFT, _newLidoNFT); } /// @notice Function that sets the fxStateRootTunnel address /// @param _newFxStateRootTunnel address of fxStateRootTunnel function setFxStateRootTunnel(address _newFxStateRootTunnel) external override onlyRole(DAO) { address oldFxStateRootTunnel = address(fxStateRootTunnel); fxStateRootTunnel = IFxStateRootTunnel(_newFxStateRootTunnel); emit SetFxStateRootTunnel(oldFxStateRootTunnel, _newFxStateRootTunnel); } /// @notice Function that sets the new version /// @param _newVersion - New version that will be set function setVersion(string calldata _newVersion) external override onlyRole(DAO) { emit Version(version, _newVersion); version = _newVersion; } /// @notice 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) { if (token2WithdrawRequest[_tokenId].requestTime != 0) { return _getMaticFromRequestData(token2WithdrawRequest[_tokenId]); } else if (token2WithdrawRequests[_tokenId].length != 0) { RequestWithdraw[] memory requestsData = token2WithdrawRequests[ _tokenId ]; uint256 totalMatic; for (uint256 idx = 0; idx < requestsData.length; idx++) { totalMatic += _getMaticFromRequestData(requestsData[idx]); } return totalMatic; } return 0; } function _getMaticFromRequestData(RequestWithdraw memory requestData) private view returns (uint256) { if (requestData.validatorAddress == address(0)) { return requestData.amount2WithdrawFromStMATIC; } IValidatorShare validatorShare = IValidatorShare( requestData.validatorAddress ); uint256 exchangeRatePrecision = _getExchangeRatePrecision( validatorShare.validatorId() ); uint256 withdrawExchangeRate = validatorShare.withdrawExchangeRate(); IValidatorShare.DelegatorUnbond memory unbond = validatorShare .unbonds_new(address(this), requestData.validatorNonce); return (withdrawExchangeRate * unbond.shares) / exchangeRatePrecision; } function _nonReentrant() private view { _require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); } function _require(bool _condition, string memory _message) private pure { require(_condition, _message); } /// @dev get the exchange rate precision per validator. /// More details: https://github.com/maticnetwork/contracts/blob/v0.3.0-backport/contracts/staking/validatorShare/ValidatorShare.sol#L21 /// https://github.com/maticnetwork/contracts/blob/v0.3.0-backport/contracts/staking/validatorShare/ValidatorShare.sol#L87 function _getExchangeRatePrecision(uint256 _validatorId) private pure returns (uint256) { return _validatorId < 8 ? 100 : 10**29; } /// @dev calculate the number of shares to get when delegate an amount of Matic function _calculateValidatorShares( address _validatorAddress, uint256 _amountInMatic ) private view returns (uint256) { IValidatorShare validatorShare = IValidatorShare(_validatorAddress); uint256 exchangeRatePrecision = _getExchangeRatePrecision( validatorShare.validatorId() ); uint256 rate = validatorShare.exchangeRate(); return (_amountInMatic * exchangeRatePrecision) / rate; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (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 { __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: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, 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}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, 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}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, 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) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][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) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, 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: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, 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 Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - 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 {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../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 { } 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 virtual 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 virtual { 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 virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ 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()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, 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); }
// 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"); } } }
// 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 { __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()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-FileCopyrightText: 2021 ShardLabs // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; /// @title Polygon validator share interface. /// @dev https://github.com/maticnetwork/contracts/blob/v0.3.0-backport/contracts/staking/validatorShare/ValidatorShare.sol /// @author 2021 ShardLabs 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; function exchangeRate() external view returns (uint256); }
// SPDX-FileCopyrightText: 2021 ShardLabs // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; /// @title INodeOperatorRegistry /// @author 2021 ShardLabs /// @notice Node operator registry interface interface INodeOperatorRegistry { /// @notice Node Operator Registry Statuses /// StakeManager statuses: https://github.com/maticnetwork/contracts/blob/v0.3.0-backport/contracts/staking/stakeManager/StakeManagerStorage.sol#L13 /// ACTIVE: (validator.status == status.Active && validator.deactivationEpoch == 0) /// JAILED: (validator.status == status.Locked && validator.deactivationEpoch == 0) /// EJECTED: ((validator.status == status.Active || validator.status == status.Locked) && validator.deactivationEpoch != 0) /// UNSTAKED: (validator.status == status.Unstaked) enum NodeOperatorRegistryStatus { INACTIVE, ACTIVE, JAILED, EJECTED, UNSTAKED } /// @notice The full node operator struct. /// @param validatorId the validator id on stakeManager. /// @param commissionRate rate of each operator /// @param validatorShare the validator share address of the validator. /// @param rewardAddress the reward address. /// @param delegation delegation. /// @param status the status of the node operator in the stake manager. struct FullNodeOperatorRegistry { uint256 validatorId; uint256 commissionRate; address validatorShare; address rewardAddress; bool delegation; NodeOperatorRegistryStatus status; } /// @notice The node operator struct /// @param validatorShare the validator share address of the validator. /// @param rewardAddress the reward address. struct ValidatorData { address validatorShare; address rewardAddress; } /// @notice Add a new node operator to the system. /// ONLY DAO can execute this function. /// @param validatorId the validator id on stakeManager. /// @param rewardAddress the reward address. function addNodeOperator(uint256 validatorId, address rewardAddress) external; /// @notice Exit the node operator registry /// ONLY the owner of the node operator can call this function function exitNodeOperatorRegistry() external; /// @notice Remove a node operator from the system and withdraw total delegated tokens to it. /// ONLY DAO can execute this function. /// withdraw delegated tokens from it. /// @param validatorId the validator id on stakeManager. function removeNodeOperator(uint256 validatorId) external; /// @notice Remove a node operator from the system if it fails to meet certain conditions. /// 1. If the commission of the Node Operator is less than the standard commission. /// 2. If the Node Operator is either Unstaked or Ejected. /// @param validatorId the validator id on stakeManager. function removeInvalidNodeOperator(uint256 validatorId) external; /// @notice Set StMatic address. /// ONLY DAO can call this function /// @param newStMatic new stMatic address. function setStMaticAddress(address newStMatic) external; /// @notice Update reward address of a Node Operator. /// ONLY Operator owner can call this function /// @param newRewardAddress the new reward address. function setRewardAddress(address newRewardAddress) external; /// @notice set DISTANCETHRESHOLD /// ONLY DAO can call this function /// @param distanceThreshold the min rebalance threshold to include /// a validator in the delegation process. function setDistanceThreshold(uint256 distanceThreshold) external; /// @notice set MINREQUESTWITHDRAWRANGE /// ONLY DAO can call this function /// @param minRequestWithdrawRange the min request withdraw range. function setMinRequestWithdrawRange(uint8 minRequestWithdrawRange) external; /// @notice set MAXWITHDRAWPERCENTAGEPERREBALANCE /// ONLY DAO can call this function /// @param maxWithdrawPercentagePerRebalance the max withdraw percentage to /// withdraw from a validator per rebalance. function setMaxWithdrawPercentagePerRebalance( uint256 maxWithdrawPercentagePerRebalance ) external; /// @notice Allows to set new version. /// @param _newVersion new contract version. function setVersion(string memory _newVersion) external; /// @notice List all the ACTIVE operators on the stakeManager. /// @return activeNodeOperators a list of ACTIVE node operator. /// @return totalActiveNodeOperators total active node operators. function listDelegatedNodeOperators() external view returns (ValidatorData[] memory, uint256); /// @notice List all the operators on the stakeManager that can be withdrawn from this includes ACTIVE, JAILED, and /// @notice UNSTAKED operators. /// @return nodeOperators a list of ACTIVE, JAILED or UNSTAKED node operator. /// @return totalNodeOperators total number of node operators. function listWithdrawNodeOperators() external view returns (ValidatorData[] memory, uint256); /// @notice Calculate how total buffered should be delegated between the active validators, /// depending on if the system is balanced or not. If validators are in EJECTED or UNSTAKED /// status the function will revert. /// @param amountToDelegate The total that can be delegated. /// @return validators all active node operators. /// @return totalActiveNodeOperator total active node operators. /// @return operatorRatios a list of operator's ratio. It will be calculated if the system is not balanced. /// @return totalRatio the total ratio. If ZERO that means the system is balanced. /// It will be calculated if the system is not balanced. function getValidatorsDelegationAmount(uint256 amountToDelegate) external view returns ( ValidatorData[] memory validators, uint256 totalActiveNodeOperator, uint256[] memory operatorRatios, uint256 totalRatio ); /// @notice Calculate how the system could be rebalanced depending on the current /// buffered tokens. If validators are in EJECTED or UNSTAKED status the function will revert. /// If the system is balanced the function will revert. /// @notice Calculate the operator ratios to rebalance the system. /// @param totalBuffered The total amount buffered in stMatic. /// @return validators all active node operators. /// @return totalActiveNodeOperator total active node operators. /// @return operatorRatios is a list of operator's ratio. /// @return totalRatio the total ratio. If ZERO that means the system is balanced. /// @return totalToWithdraw the total amount to withdraw. function getValidatorsRebalanceAmount(uint256 totalBuffered) external view returns ( ValidatorData[] memory validators, uint256 totalActiveNodeOperator, uint256[] memory operatorRatios, uint256 totalRatio, uint256 totalToWithdraw ); /// @notice Calculate the validators to request withdrawal from depending if the system is balalnced or not. /// @param _withdrawAmount The amount to withdraw. /// @return validators all node operators. /// @return totalDelegated total amount delegated. /// @return bigNodeOperatorLength number of ids bigNodeOperatorIds. /// @return bigNodeOperatorIds stores the ids of node operators that amount delegated to it is greater than the average delegation. /// @return smallNodeOperatorLength number of ids smallNodeOperatorIds. /// @return smallNodeOperatorIds stores the ids of node operators that amount delegated to it is less than the average delegation. /// @return operatorAmountCanBeRequested amount that can be requested from a spécific validator when the system is not balanced. /// @return totalValidatorToWithdrawFrom the number of validator to withdraw from when the system is balanced. function getValidatorsRequestWithdraw(uint256 _withdrawAmount) external view returns ( ValidatorData[] memory validators, uint256 totalDelegated, uint256 bigNodeOperatorLength, uint256[] memory bigNodeOperatorIds, uint256 smallNodeOperatorLength, uint256[] memory smallNodeOperatorIds, uint256[] memory operatorAmountCanBeRequested, uint256 totalValidatorToWithdrawFrom ); /// @notice Returns a node operator. /// @param validatorId the validator id on stakeManager. /// @return operatorStatus a node operator. function getNodeOperator(uint256 validatorId) external view returns (FullNodeOperatorRegistry memory operatorStatus); /// @notice Returns a node operator. /// @param rewardAddress the reward address. /// @return operatorStatus a node operator. function getNodeOperator(address rewardAddress) external view returns (FullNodeOperatorRegistry memory operatorStatus); /// @notice Returns a node operator status. /// @param validatorId is the id of the node operator. /// @return operatorStatus Returns a node operator status. function getNodeOperatorStatus(uint256 validatorId) external view returns (NodeOperatorRegistryStatus operatorStatus); /// @notice Return a list of all validator ids in the system. function getValidatorIds() external view returns (uint256[] memory); /// @notice Explain to an end user what this does /// @return isBalanced if the system is balanced or not. /// @return distanceThreshold the distance threshold /// @return minAmount min amount delegated to a validator. /// @return maxAmount max amount delegated to a validator. function getProtocolStats() external view returns ( bool isBalanced, uint256 distanceThreshold, uint256 minAmount, uint256 maxAmount ); /// @notice List all the node operator statuses in the system. /// @return inactiveNodeOperator the number of inactive operators. /// @return activeNodeOperator the number of active operators. /// @return jailedNodeOperator the number of jailed operators. /// @return ejectedNodeOperator the number of ejected operators. /// @return unstakedNodeOperator the number of unstaked operators. function getStats() external view returns ( uint256 inactiveNodeOperator, uint256 activeNodeOperator, uint256 jailedNodeOperator, uint256 ejectedNodeOperator, uint256 unstakedNodeOperator ); //////////////////////////////////////////////////////////// ///// /// ///// ***EVENTS*** /// ///// /// //////////////////////////////////////////////////////////// /// @notice Add Node Operator event /// @param validatorId validator id. /// @param rewardAddress reward address. event AddNodeOperator(uint256 validatorId, address rewardAddress); /// @notice Remove Node Operator event. /// @param validatorId validator id. /// @param rewardAddress reward address. event RemoveNodeOperator(uint256 validatorId, address rewardAddress); /// @notice Remove Invalid Node Operator event. /// @param validatorId validator id. /// @param rewardAddress reward address. event RemoveInvalidNodeOperator(uint256 validatorId, address rewardAddress); /// @notice Set StMatic address event. /// @param oldStMatic old stMatic address. /// @param newStMatic new stMatic address. event SetStMaticAddress(address oldStMatic, address newStMatic); /// @notice Set reward address event. /// @param validatorId the validator id. /// @param oldRewardAddress old reward address. /// @param newRewardAddress new reward address. event SetRewardAddress( uint256 validatorId, address oldRewardAddress, address newRewardAddress ); /// @notice Emit when the distance threshold is changed. /// @param oldDistanceThreshold the old distance threshold. /// @param newDistanceThreshold the new distance threshold. event SetDistanceThreshold( uint256 oldDistanceThreshold, uint256 newDistanceThreshold ); /// @notice Emit when the min request withdraw range is changed. /// @param oldMinRequestWithdrawRange the old min request withdraw range. /// @param newMinRequestWithdrawRange the new min request withdraw range. event SetMinRequestWithdrawRange( uint8 oldMinRequestWithdrawRange, uint8 newMinRequestWithdrawRange ); /// @notice Emit when the max withdraw percentage per rebalance is changed. /// @param oldMaxWithdrawPercentagePerRebalance the old max withdraw percentage per rebalance. /// @param newMaxWithdrawPercentagePerRebalance the new max withdraw percentage per rebalance. event SetMaxWithdrawPercentagePerRebalance( uint256 oldMaxWithdrawPercentagePerRebalance, uint256 newMaxWithdrawPercentagePerRebalance ); /// @notice Emit when set new version. /// @param oldVersion the old version. /// @param newVersion the new version. event SetVersion(string oldVersion, string newVersion); /// @notice Emit when the node operator exits the registry /// @param validatorId node operator id /// @param rewardAddress node operator reward address event ExitNodeOperator(uint256 validatorId, address rewardAddress); }
// SPDX-FileCopyrightText: 2021 ShardLabs // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; /// @title polygon stake manager interface. /// @author 2021 ShardLabs interface IStakeManager { /// @dev Plygon stakeManager status and Validator struct /// https://github.com/maticnetwork/contracts/blob/v0.3.0-backport/contracts/staking/stakeManager/StakeManagerStorage.sol 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; } /// @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 Transfers amount from delegator function delegationDeposit( uint256 validatorId, uint256 amount, address delegator ) external returns (bool); function epoch() external view returns (uint256); function validators(uint256 _index) external view returns (Validator memory); /// @notice Returns a withdrawal delay. function withdrawalDelay() external view returns (uint256); }
// 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 { /// @notice Mint a new Lido NFT for a _to address. /// @param _to owner of the NFT. /// @return tokenId returns the token id. function mint(address _to) external returns (uint256); /// @notice Burn a Lido NFT for a _to address. /// @param _tokenId the token id. function burn(uint256 _tokenId) external; /// @notice Check if the spender is the owner of the NFT or it was approved to it. /// @param _spender the spender address. /// @param _tokenId the token id. /// @return result return if the token is owned or approved to/by the spender. function isApprovedOrOwner(address _spender, uint256 _tokenId) external view returns (bool); /// @notice Set stMatic address. /// @param _stMATIC new stMatic address. function setStMATIC(address _stMATIC) external; /// @notice List all the tokens owned by an address. /// @param _owner the owner address. /// @return result return a list of token ids. function getOwnedTokens(address _owner) external view returns (uint256[] memory); /// @notice toggle pause/unpause the contract function togglePause() external; /// @notice Allows to set new version. /// @param _newVersion new contract version. function setVersion(string calldata _newVersion) external; }
// SPDX-FileCopyrightText: 2021 ShardLabs // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; interface IFxStateRootTunnel { /// @notice send message to child /// @param _message message function sendMessageToChild(bytes memory _message) external; /// @notice Set stMatic address. /// @param _newStMATIC the new stMatic address. function setStMATIC(address _newStMATIC) external; }
// 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 "./IStakeManager.sol"; import "./IPoLidoNFT.sol"; import "./IFxStateRootTunnel.sol"; /// @title StMATIC interface. /// @author 2021 ShardLabs interface IStMATIC is IERC20Upgradeable { /// @notice The request withdraw struct. /// @param amount2WithdrawFromStMATIC amount in Matic. /// @param validatorNonce validator nonce. /// @param requestTime request epoch. /// @param validatorAddress validator share address. struct RequestWithdraw { uint256 amount2WithdrawFromStMATIC; uint256 validatorNonce; uint256 requestTime; address validatorAddress; } /// @notice The fee distribution struct. /// @param dao dao fee. /// @param operators operators fee. /// @param insurance insurance fee. struct FeeDistribution { uint8 dao; uint8 operators; uint8 insurance; } /// @notice node operator registry interface. function nodeOperator() external view returns (INodeOperatorRegistry); /// @notice The fee distribution. /// @return dao dao fee. /// @return operators operators fee. /// @return insurance insurance fee. function entityFees() external view returns ( uint8, uint8, uint8 ); /// @notice StakeManager interface. function stakeManager() external view returns (IStakeManager); /// @notice LidoNFT interface. function poLidoNFT() external view returns (IPoLidoNFT); /// @notice fxStateRootTunnel interface. function fxStateRootTunnel() external view returns (IFxStateRootTunnel); /// @notice contract version. function version() external view returns (string memory); /// @notice dao address. function dao() external view returns (address); /// @notice insurance address. function insurance() external view returns (address); /// @notice Matic ERC20 token. function token() external view returns (address); /// @notice Matic ERC20 token address NOT USED IN V2. function lastWithdrawnValidatorId() external view returns (uint256); /// @notice total buffered Matic in the contract. function totalBuffered() external view returns (uint256); /// @notice delegation lower bound. function delegationLowerBound() external view returns (uint256); /// @notice reward distribution lower bound. function rewardDistributionLowerBound() external view returns (uint256); /// @notice reserved funds in Matic. function reservedFunds() external view returns (uint256); /// @notice submit threshold NOT USED in V2. function submitThreshold() external view returns (uint256); /// @notice submit handler NOT USED in V2. function submitHandler() external view returns (bool); /// @notice token to WithdrawRequest mapping. function token2WithdrawRequest(uint256 _requestId) external view returns ( uint256, uint256, uint256, address ); /// @notice DAO Role. function DAO() external view returns (bytes32); /// @notice PAUSE_ROLE Role. function PAUSE_ROLE() external view returns (bytes32); /// @notice UNPAUSE_ROLE Role. function UNPAUSE_ROLE() external view returns (bytes32); /// @notice Protocol Fee. function protocolFee() external view returns (uint8); /// @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 ) external; /// @notice 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 /// @param _referral - referral address. /// @return Amount of StMATIC shares generated function submit(uint256 _amount, address _referral) external returns (uint256); /// @notice Stores users request to withdraw into a RequestWithdraw struct /// @param _amount - Amount of StMATIC that is requested to withdraw /// @param _referral - referral address. /// @return NFT token id. function requestWithdraw(uint256 _amount, address _referral) external returns (uint256); /// @notice This will be included in the cron job /// @notice Delegates tokens to validator share contract function delegate() external; /// @notice 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 claimTokens(uint256 _tokenId) external; /// @notice Distributes rewards claimed from validator shares based on fees defined /// in entityFee. function distributeRewards() external; /// @notice withdraw total delegated /// @param _validatorShare validator share address. function withdrawTotalDelegated(address _validatorShare) external; /// @notice 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 claimTokensFromValidatorToContract(uint256 _tokenId) external; /// @notice Rebalane the system by request withdraw from the validators that contains /// more token delegated to them. function rebalanceDelegatedTokens() external; /// @notice Helper function for that returns total pooled MATIC /// @return Total pooled MATIC function getTotalStake(IValidatorShare _validatorShare) external view returns (uint256, uint256); /// @notice 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 returns (uint256); /// @notice Helper function for that returns total pooled MATIC /// @return Total pooled MATIC function getTotalStakeAcrossAllValidators() external view returns (uint256); /// @notice Function that calculates total pooled Matic /// @return Total pooled Matic function getTotalPooledMatic() external view returns (uint256); /// @notice get Matic from token id. /// @param _tokenId NFT token id. /// @return total the amount in Matic. function getMaticFromTokenId(uint256 _tokenId) external view returns (uint256); /// @notice calculate the total amount stored in all the NFTs owned by /// stMatic contract. /// @return pendingBufferedTokens the total pending amount for stMatic. function calculatePendingBufferedTokens() external view returns(uint256); /// @notice Function that converts arbitrary stMATIC to Matic /// @param _amountInStMatic - Amount of stMATIC to convert to Matic /// @return amountInMatic - Amount of Matic after conversion, /// @return totalStMaticAmount - Total StMatic in the contract, /// @return totalPooledMatic - Total Matic in the staking pool function convertStMaticToMatic(uint256 _amountInStMatic) external view returns ( uint256 amountInMatic, uint256 totalStMaticAmount, uint256 totalPooledMatic ); /// @notice Function that converts arbitrary Matic to stMATIC /// @param _amountInMatic - Amount of Matic to convert to stMatic /// @return amountInStMatic - Amount of Matic to converted to stMatic /// @return totalStMaticSupply - Total amount of StMatic in the contract /// @return totalPooledMatic - Total amount of Matic in the staking pool function convertMaticToStMatic(uint256 _amountInMatic) external view returns ( uint256 amountInStMatic, uint256 totalStMaticSupply, uint256 totalPooledMatic ); /// @notice Allows to set fees. /// @param _daoFee the new daoFee /// @param _operatorsFee the new operatorsFee /// @param _insuranceFee the new insuranceFee function setFees( uint8 _daoFee, uint8 _operatorsFee, uint8 _insuranceFee ) external; /// @notice Function that sets protocol fee /// @param _newProtocolFee - Insurance fee in % function setProtocolFee(uint8 _newProtocolFee) external; /// @notice Allows to set DaoAddress. /// @param _newDaoAddress new DaoAddress. function setDaoAddress(address _newDaoAddress) external; /// @notice Allows to set InsuranceAddress. /// @param _newInsuranceAddress new InsuranceAddress. function setInsuranceAddress(address _newInsuranceAddress) external; /// @notice Allows to set NodeOperatorRegistryAddress. /// @param _newNodeOperatorRegistry new NodeOperatorRegistryAddress. function setNodeOperatorRegistryAddress(address _newNodeOperatorRegistry) external; /// @notice Allows to set delegationLowerBound. /// @param _delegationLowerBound new delegationLowerBound. function setDelegationLowerBound(uint256 _delegationLowerBound) external; /// @notice Allows to set setRewardDistributionLowerBound. /// @param _rewardDistributionLowerBound new setRewardDistributionLowerBound. function setRewardDistributionLowerBound( uint256 _rewardDistributionLowerBound ) external; /// @notice Allows to set LidoNFT. /// @param _poLidoNFT new LidoNFT. function setPoLidoNFT(address _poLidoNFT) external; /// @notice Allows to set fxStateRootTunnel. /// @param _fxStateRootTunnel new fxStateRootTunnel. function setFxStateRootTunnel(address _fxStateRootTunnel) external; /// @notice Allows to set new version. /// @param _newVersion new contract version. function setVersion(string calldata _newVersion) external; //////////////////////////////////////////////////////////// ///// /// ///// ***EVENTS*** /// ///// /// //////////////////////////////////////////////////////////// /// @notice Emit when submit. /// @param _from msg.sender. /// @param _amount amount. /// @param _referral - referral address. event SubmitEvent(address indexed _from, uint256 _amount, address indexed _referral); /// @notice Emit when request withdraw. /// @param _from msg.sender. /// @param _amount amount. /// @param _referral - referral address. event RequestWithdrawEvent(address indexed _from, uint256 _amount, address indexed _referral); /// @notice Emit when distribute rewards. /// @param _amount amount. event DistributeRewardsEvent(uint256 indexed _amount); /// @notice Emit when withdraw total delegated. /// @param _from msg.sender. /// @param _amount amount. event WithdrawTotalDelegatedEvent( address indexed _from, uint256 indexed _amount ); /// @notice Emit when delegate. /// @param _amountDelegated amount to delegate. /// @param _remainder remainder. event DelegateEvent( uint256 indexed _amountDelegated, uint256 indexed _remainder ); /// @notice Emit when ClaimTokens. /// @param _from msg.sender. /// @param _id token id. /// @param _amountClaimed amount Claimed. /// @param _amountBurned amount Burned. event ClaimTokensEvent( address indexed _from, uint256 indexed _id, uint256 indexed _amountClaimed, uint256 _amountBurned ); /// @notice Emit when set new InsuranceAddress. /// @param _newInsuranceAddress the new InsuranceAddress. event SetInsuranceAddress(address indexed _newInsuranceAddress); /// @notice Emit when set new NodeOperatorRegistryAddress. /// @param _newNodeOperatorRegistryAddress the new NodeOperatorRegistryAddress. event SetNodeOperatorRegistryAddress( address indexed _newNodeOperatorRegistryAddress ); /// @notice Emit when set new SetDelegationLowerBound. /// @param _delegationLowerBound the old DelegationLowerBound. event SetDelegationLowerBound(uint256 indexed _delegationLowerBound); /// @notice Emit when set new RewardDistributionLowerBound. /// @param oldRewardDistributionLowerBound the old RewardDistributionLowerBound. /// @param newRewardDistributionLowerBound the new RewardDistributionLowerBound. event SetRewardDistributionLowerBound( uint256 oldRewardDistributionLowerBound, uint256 newRewardDistributionLowerBound ); /// @notice Emit when set new LidoNFT. /// @param oldLidoNFT the old oldLidoNFT. /// @param newLidoNFT the new newLidoNFT. event SetLidoNFT(address oldLidoNFT, address newLidoNFT); /// @notice Emit when set new FxStateRootTunnel. /// @param oldFxStateRootTunnel the old FxStateRootTunnel. /// @param newFxStateRootTunnel the new FxStateRootTunnel. event SetFxStateRootTunnel( address oldFxStateRootTunnel, address newFxStateRootTunnel ); /// @notice Emit when set new DAO. /// @param oldDaoAddress the old DAO. /// @param newDaoAddress the new DAO. event SetDaoAddress(address oldDaoAddress, address newDaoAddress); /// @notice Emit when set fees. /// @param daoFee the new daoFee /// @param operatorsFee the new operatorsFee /// @param insuranceFee the new insuranceFee event SetFees(uint256 daoFee, uint256 operatorsFee, uint256 insuranceFee); /// @notice Emit when set ProtocolFee. /// @param oldProtocolFee the new ProtocolFee /// @param newProtocolFee the new ProtocolFee event SetProtocolFee(uint8 oldProtocolFee, uint8 newProtocolFee); /// @notice Emit when set ProtocolFee. /// @param validatorShare vaidatorshare address. /// @param amountClaimed amount claimed. event ClaimTotalDelegatedEvent( address indexed validatorShare, uint256 indexed amountClaimed ); /// @notice Emit when set version. /// @param oldVersion old. /// @param newVersion new. event Version( string oldVersion, string indexed newVersion ); }
// 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (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 proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * 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)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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); } }
// 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 { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"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":"address","name":"validatorShare","type":"address"},{"indexed":true,"internalType":"uint256","name":"amountClaimed","type":"uint256"}],"name":"ClaimTotalDelegatedEvent","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":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"_referral","type":"address"}],"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":false,"internalType":"address","name":"oldDaoAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newDaoAddress","type":"address"}],"name":"SetDaoAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_delegationLowerBound","type":"uint256"}],"name":"SetDelegationLowerBound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"daoFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"operatorsFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"insuranceFee","type":"uint256"}],"name":"SetFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldFxStateRootTunnel","type":"address"},{"indexed":false,"internalType":"address","name":"newFxStateRootTunnel","type":"address"}],"name":"SetFxStateRootTunnel","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_newInsuranceAddress","type":"address"}],"name":"SetInsuranceAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldLidoNFT","type":"address"},{"indexed":false,"internalType":"address","name":"newLidoNFT","type":"address"}],"name":"SetLidoNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_newNodeOperatorRegistryAddress","type":"address"}],"name":"SetNodeOperatorRegistryAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"oldProtocolFee","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"newProtocolFee","type":"uint8"}],"name":"SetProtocolFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRewardDistributionLowerBound","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRewardDistributionLowerBound","type":"uint256"}],"name":"SetRewardDistributionLowerBound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"_referral","type":"address"}],"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":false,"internalType":"string","name":"oldVersion","type":"string"},{"indexed":true,"internalType":"string","name":"newVersion","type":"string"}],"name":"Version","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":[],"name":"PAUSE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNPAUSE_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":[],"name":"calculatePendingBufferedTokens","outputs":[{"internalType":"uint256","name":"pendingBufferedTokens","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"claimTokensFromValidatorToContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountInMatic","type":"uint256"}],"name":"convertMaticToStMatic","outputs":[{"internalType":"uint256","name":"amountInStMatic","type":"uint256"},{"internalType":"uint256","name":"totalStMaticSupply","type":"uint256"},{"internalType":"uint256","name":"totalPooledMatic","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountInStMatic","type":"uint256"}],"name":"convertStMaticToMatic","outputs":[{"internalType":"uint256","name":"amountInMatic","type":"uint256"},{"internalType":"uint256","name":"totalStMaticAmount","type":"uint256"},{"internalType":"uint256","name":"totalPooledMatic","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":"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":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getToken2WithdrawRequests","outputs":[{"components":[{"internalType":"uint256","name":"amount2WithdrawFromStMATIC","type":"uint256"},{"internalType":"uint256","name":"validatorNonce","type":"uint256"},{"internalType":"uint256","name":"requestTime","type":"uint256"},{"internalType":"address","name":"validatorAddress","type":"address"}],"internalType":"struct IStMATIC.RequestWithdraw[]","name":"","type":"tuple[]"}],"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":[],"name":"getTotalWithdrawRequest","outputs":[{"components":[{"internalType":"uint256","name":"amount2WithdrawFromStMATIC","type":"uint256"},{"internalType":"uint256","name":"validatorNonce","type":"uint256"},{"internalType":"uint256","name":"requestTime","type":"uint256"},{"internalType":"address","name":"validatorAddress","type":"address"}],"internalType":"struct IStMATIC.RequestWithdraw[]","name":"","type":"tuple[]"}],"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"}],"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":"minValidatorBalance","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":"nodeOperator","outputs":[{"internalType":"contract INodeOperatorRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","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":[],"name":"protocolFee","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebalanceDelegatedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referral","type":"address"}],"name":"requestWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_newDAO","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":"_newFxStateRootTunnel","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":"_newLidoNFT","type":"address"}],"name":"setPoLidoNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_newProtocolFee","type":"uint8"}],"name":"setProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newRewardDistributionLowerBound","type":"uint256"}],"name":"setRewardDistributionLowerBound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newVersion","type":"string"}],"name":"setVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stMaticWithdrawRequest","outputs":[{"internalType":"uint256","name":"amount2WithdrawFromStMATIC","type":"uint256"},{"internalType":"uint256","name":"validatorNonce","type":"uint256"},{"internalType":"uint256","name":"requestTime","type":"uint256"},{"internalType":"address","name":"validatorAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeManager","outputs":[{"internalType":"contract IStakeManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referral","type":"address"}],"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":"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":"requestTime","type":"uint256"},{"internalType":"address","name":"validatorAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"token2WithdrawRequests","outputs":[{"internalType":"uint256","name":"amount2WithdrawFromStMATIC","type":"uint256"},{"internalType":"uint256","name":"validatorNonce","type":"uint256"},{"internalType":"uint256","name":"requestTime","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":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"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"}]
Contract Creation Code
608060405234801561001057600080fd5b50615ff880620000216000396000f3fe608060405234801561001057600080fd5b506004361061043e5760003560e01c80637682c90211610236578063b0e21e8a1161013b578063d968447c116100c3578063f08711fe11610087578063f08711fe146109da578063f1a13fce14610a19578063f532e86a14610a2c578063f6794fdb14610a3f578063fc0c546a14610a5257600080fd5b8063d968447c1461095d578063dd62ed3e14610970578063e00222a0146109a9578063e062b10b146109b1578063e259faf7146109c557600080fd5b8063c89e43611161010a578063c89e43611461091d578063ccc143b814610925578063ce99b58614610938578063d280f14f14610942578063d547741f1461094a57600080fd5b8063b0e21e8a146108ad578063bb208f55146108bb578063c697d2c7146108ce578063c75e78321461090a57600080fd5b806395d89b41116101be578063a217fddf1161018d578063a217fddf1461086d578063a245294714610875578063a457c2d71461087f578063a9059cbb14610892578063afd290a7146108a557600080fd5b806395d89b41146107f9578063964a75961461080157806398fabd3a146108455780639a3cac6a1461085a57600080fd5b8063893818a311610205578063893818a31461079257806389cf32041461079c578063916b9eba146107b0578063917a52f5146107b857806391d14854146107e657600080fd5b80637682c9021461075c578063788bc78c1461076f5780637e978af8146107825780638456cb591461078a57600080fd5b8063395093511161034757806354fd4d50116102cf57806370a082311161029357806370a08231146106f057806370bf9fe91461071957806371975a3e1461072c578063720bcf1d146107365780637542ff951461074957600080fd5b806354fd4d50146106af5780635c975abb146106b7578063676e5550146106c25780636f4a2cd0146106d55780637029c90e146106dd57600080fd5b806346e04a2f1161031657806346e04a2f146106625780634cfeb862146106755780634e91f81114610688578063509c5df61461069b57806352349b17146106a557600080fd5b806339509351146106205780633b573c4a146106335780633f4ba83a146106465780634162169f1461064e57600080fd5b806323b872dd116103ca578063309756fb11610399578063309756fb14610597578063313ce567146105be57806335876476146105d357806336568abe146105e6578063389ed267146105f957600080fd5b806323b872dd1461052e578063248a9ca314610541578063253d1735146105645780632f2ff15d1461058457600080fd5b80630d7abc33116104115780630d7abc33146104be5780630f2b2639146104d657806315539d3f146104eb57806318160ddd146104fe5780631e7ff8f61461050657600080fd5b806301ffc9a714610443578063023c5b081461046b57806306fdde0314610496578063095ea7b3146104ab575b600080fd5b61045661045136600461592b565b610a66565b60405190151581526020015b60405180910390f35b60fb5461047e906001600160a01b031681565b6040516001600160a01b039091168152602001610462565b61049e610a9d565b6040516104629190615c0d565b6104566104b936600461568f565b610b2f565b6104c86101055481565b604051908152602001610462565b6104e96104e4366004615562565b610b47565b005b6104e96104f9366004615562565b610bab565b6035546104c8565b610519610514366004615562565b610c27565b60408051928352602083019190915201610462565b61045661053c36600461564e565b610cab565b6104c861054f3660046158ed565b60009081526097602052604090206001015490565b6105776105723660046158ed565b610cd1565b6040516104629190615ba0565b6104e9610592366004615906565b610d6f565b6104c87f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2281565b60125b60405160ff9091168152602001610462565b6104e96105e13660046155b8565b610d9a565b6104e96105f4366004615906565b610fcf565b6104c87ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1481565b61045661062e36600461568f565b61104d565b6104e96106413660046158ed565b61108c565b6104e96110e4565b6101005461047e906001600160a01b031681565b6104e96106703660046158ed565b61111a565b6104e96106833660046158ed565b611265565b6104e9610696366004615a75565b6116e2565b6104c86101075481565b6104c86101045481565b61049e611795565b60c95460ff16610456565b6104c86106d0366004615562565b611823565b6104e961189d565b60fe5461047e906001600160a01b031681565b6104c86106fe366004615562565b6001600160a01b031660009081526033602052604090205490565b6104e9610727366004615562565b611e29565b6104c86101035481565b6104c86107443660046158ed565b611e9d565b60fd5461047e906001600160a01b031681565b6104e961076a3660046158ed565b61200f565b6104e961077d366004615955565b61205d565b6104c86120d8565b6104e96121cb565b6104c861010b5481565b6101015461047e906001600160a01b031681565b6105776121fe565b6107cb6107c63660046158ed565b612289565b60408051938452602084019290925290820152606001610462565b6104566107f4366004615906565b6122b5565b61049e6122e0565b60fc546108219060ff808216916101008104821691620100009091041683565b6040805160ff94851681529284166020840152921691810191909152606001610462565b6104c8600080516020615f5783398151915281565b6104e9610868366004615562565b6122ef565b6104c8600081565b6104c86101065481565b61045661088d36600461568f565b612363565b6104566108a036600461568f565b612400565b6104c861240e565b61010e546105c19060ff1681565b6104e96108c9366004615562565b6124a8565b6108e16108dc366004615a2f565b61250d565b604080519485526020850193909352918301526001600160a01b03166060820152608001610462565b6104e9610918366004615562565b61255d565b6104e9612621565b6104c8610933366004615906565b6128b2565b6104c86101085481565b6104e9612e33565b6104e9610958366004615906565b612ffb565b6107cb61096b3660046158ed565b613021565b6104c861097e36600461557f565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6104c8613050565b61010a5461047e906001600160a01b031681565b61010a5461045690600160a01b900460ff1681565b6108e16109e83660046158ed565b610109602052600090815260409020805460018201546002830154600390930154919290916001600160a01b031684565b6108e1610a273660046158ed565b61306c565b6104c8610a3a366004615906565b6130b0565b6104e9610a4d366004615a90565b61327c565b6101025461047e906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b1480610a9757506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060368054610aac90615e93565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad890615e93565b8015610b255780601f10610afa57610100808354040283529160200191610b25565b820191906000526020600020905b815481529060010190602001808311610b0857829003601f168201915b5050505050905090565b600033610b3d818585613356565b5060019392505050565b600080516020615f57833981519152610b60813361347a565b60fb80546001600160a01b0319166001600160a01b0384169081179091556040517fb8e1a40638c48c0ebe9679e0b5b032f2066cf44139d775cc09c945b5df070c4e90600090a25050565b600080516020615f57833981519152610bc4813361347a565b60fe80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f3879f4996438c287cec42ea09f698215be51d075ec446a9f5bc83c98ccc1910191015b60405180910390a1505050565b604051630f3ffc7b60e11b815230600482015260009081906001600160a01b03841690631e7ff8f690602401604080518083038186803b158015610c6a57600080fd5b505afa158015610c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca29190615a51565b91509150915091565b600033610cb98582856134de565b610cc485858561356a565b60019150505b9392505050565b606061010d6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015610d6457600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101610d07565b505050509050919050565b600082815260976020526040902060010154610d8b813361347a565b610d958383613738565b505050565b600054610100900460ff16610db55760005460ff1615610db9565b303b155b610e215760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b600054610100900460ff16158015610e43576000805461ffff19166101011790555b610e4b6137be565b610e536137e7565b610ea06040518060400160405280600c81526020016b5374616b6564204d4154494360a01b8152506040518060400160405280600781526020016673744d4154494360c81b81525061381a565b610eab600033613738565b610ec3600080516020615f5783398151915287613738565b610eed7ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1433613738565b610f177f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2287613738565b60fb80546001600160a01b03199081166001600160a01b038b81169190911790925560fd8054821687841617905560fe8054821686841617905561010a8054821685841617905561010080548216898416179055610102805482168a841617905561010180549091169187169190911790556040805160608101825260198082526032602083015291015260fc805462ffffff1916621932191790558015610fc5576000805461ff00191690555b5050505050505050565b6001600160a01b038116331461103f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610e18565b6110498282613868565b5050565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190610b3d9082908690611087908790615dbb565b613356565b600080516020615f578339815191526110a5813361347a565b61010680549083905560408051828152602081018590527fbf99ce7c5a72f4c7135bb72a36193d147a37a54bfcf63ec29505b5e6d5e2921d9101610c1a565b7f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2261110f813361347a565b6111176138cf565b50565b60c95460ff161561113d5760405162461bcd60e51b8152600401610e1890615cc8565b60fe5460405163430c208160e01b8152336004820152602481018390526111e8916001600160a01b03169063430c20819060440160206040518083038186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c191906158cb565b604051806040016040528060098152602001682737ba1037bbb732b960b91b815250613962565b60008181526101096020526040902060020154156112095761111781613981565b600081815261010d6020526040902054156112275761111781613c1c565b60405162461bcd60e51b815260206004820152601360248201527224b73b30b634b21031b630b4b6903a37b5b2b760691b6044820152606401610e18565b60c95460ff16156112885760405162461bcd60e51b8152600401610e1890615cc8565b611290613ffa565b600261010f5561010c5460408051808201909152600d81526c0d2dcecc2d8d2c840d2dcc8caf609b1b60208201526112cb9082841090613962565b600061010c83815481106112e1576112e1615f15565b60009182526020918290206040805160808101825260049384029092018054835260018101548386015260028101548383018190526003909101546001600160a01b03908116606085015260fd54835163900cf0cf60e01b815293519497506113d696929591169363900cf0cf93808301939290829003018186803b15801561136957600080fd5b505afa15801561137d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a19190615a16565b101560405180604001604052806015815260200174139bdd0818589b19481d1bc818db185a5b481e595d605a1b815250613962565b610102546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561141b57600080fd5b505afa15801561142f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114539190615a16565b905061146782606001518360200151614040565b610102546040516370a0823160e01b815230600482015260009183916001600160a01b03909116906370a082319060240160206040518083038186803b1580156114b057600080fd5b505afa1580156114c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e89190615a16565b6114f29190615e39565b90508061010460008282546115079190615dbb565b909155506115189050600185615e39565b8514158015611528575083600114155b156115bc5761010c61153b600186615e39565b8154811061154b5761154b615f15565b906000526020600020906004020161010c868154811061156d5761156d615f15565b6000918252602090912082546004909202019081556001808301549082015560028083015490820155600391820154910180546001600160a01b0319166001600160a01b039092169190911790555b61010c8054806115ce576115ce615eff565b60008281526020812060046000199093019283020181815560018101829055600281019190915560030180546001600160a01b0319169055905561010a546001600160a01b0316634c09e6e861162360355490565b61162b613050565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b81526004016116689190615c0d565b600060405180830381600087803b15801561168257600080fd5b505af1158015611696573d6000803e3d6000fd5b505050508083606001516001600160a01b03167f4c42a3bec298a4d82d41b7a540d8ebc22d91ee8a61459bce23849ff470d31dea60405160405180910390a35050600161010f55505050565b600080516020615f578339815191526116fb813361347a565b61174660008360ff16118015611715575060648360ff1611155b60405180604001604052806013815260200172496e76616c69642070726f74636f6c2066656560681b815250613962565b61010e805460ff84811660ff1983168117909355604080519190921680825260208201939093527f6b1719571aee7af62357ac4d4c98cc35155a52a5fcf0c09198874443c0fe430d9101610c1a565b60ff80546117a290615e93565b80601f01602080910402602001604051908101604052809291908181526020018280546117ce90615e93565b801561181b5780601f106117f05761010080835404028352916020019161181b565b820191906000526020600020905b8154815290600101906020018083116117fe57829003601f168201915b505050505081565b604051630676e55560e41b81523060048201526000906001600160a01b0383169063676e55509060240160206040518083038186803b15801561186557600080fd5b505afa158015611879573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a979190615a16565b60c95460ff16156118c05760405162461bcd60e51b8152600401610e1890615cc8565b6118c8613ffa565b600261010f5560fb546040805163a335385960e01b8152905160009283926001600160a01b039091169163a3353859916004808201928692909190829003018186803b15801561191757600080fd5b505afa15801561192b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261195391908101906156bb565b9150915060005b81811015611ae857600083828151811061197657611976615f15565b602090810291909101015151604051630676e55560e41b81523060048201529091506000906001600160a01b0383169063676e55509060240160206040518083038186803b1580156119c757600080fd5b505afa1580156119db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ff9190615a16565b90506000826001600160a01b0316639b2cb5d86040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3c57600080fd5b505afa158015611a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a749190615a16565b905080821115611ad257826001600160a01b031663c7b8981c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611ab957600080fd5b505af1158015611acd573d6000803e3d6000fd5b505050505b5050508080611ae090615ece565b91505061195a565b5061010454610102546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a082319060240160206040518083038186803b158015611b3357600080fd5b505afa158015611b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6b9190615a16565b611b759190615e39565b61010e54909150600090606490611b8f9060ff1684615e1a565b611b999190615df8565b9050611bc2610106548211604051806060016040528060278152602001615f7760279139613962565b610102546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611c0757600080fd5b505afa158015611c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3f9190615a16565b60fc54909150600090606490611c589060ff1685615e1a565b611c629190615df8565b60fc54909150600090606490611c819062010000900460ff1686615e1a565b611c8b9190615df8565b60fc54909150600090606490611ca990610100900460ff1687615e1a565b611cb39190615df8565b90506000611cc18883615df8565b6101005461010254919250611ce3916001600160a01b0390811691168661409e565b6101015461010254611d02916001600160a01b0391821691168561409e565b60005b88811015611d5657611d448a8281518110611d2257611d22615f15565b6020908102919091018101510151610102546001600160a01b0316908461409e565b80611d4e81615ece565b915050611d05565b50610102546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611d9c57600080fd5b505afa158015611db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd49190615a16565b90506000611de28288615e39565b61010483905560405190915081907f4e3c6a1e602996ae70905ac6165ed2434753246e3bfa52b6ca6852b40e2d440890600090a25050600161010f55505050505050505050565b600080516020615f57833981519152611e42813361347a565b61010a80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f8f8196a0718fc814ab20b90fdc8c2024046578345148e1b903b20667f693a6ba9101610c1a565b6000818152610109602052604081206002015415611f0957600082815261010960209081526040918290208251608081018452815481526001820154928101929092526002810154928201929092526003909101546001600160a01b03166060820152610a9790614101565b600082815261010d60205260409020541561200757600082815261010d6020908152604080832080548251818502810185019093528083529192909190849084015b82821015611fa857600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101611f4b565b505050509050600080600090505b8251811015611fff57611fe1838281518110611fd457611fd4615f15565b6020026020010151614101565b611feb9083615dbb565b915080611ff781615ece565b915050611fb6565b509392505050565b506000919050565b600080516020615f57833981519152612028813361347a565b61010582905560405182907f1cabc2f7b706218bb8613769cd658789cd6f1860310413b841020a2c7b7a0e3290600090a25050565b600080516020615f57833981519152612076813361347a565b8282604051612086929190615b1b565b60405180910390207fa22d531a51c0ad90c971d36d779910f19a3b85d5e5005072f84700bd68b6f0c560ff6040516120be9190615c20565b60405180910390a26120d260ff8484615329565b50505050565b60008060008060fb60009054906101000a90046001600160a01b03166001600160a01b0316630926efe46040518163ffffffff1660e01b815260040160006040518083038186803b15801561212c57600080fd5b505afa158015612140573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261216891908101906156bb565b9150915060005b818110156121c257600061219f84838151811061218e5761218e615f15565b602002602001015160000151610c27565b5090506121ac8186615dbb565b94505080806121ba90615ece565b91505061216f565b50919392505050565b7ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d146121f6813361347a565b6111176142c2565b606061010c805480602002602001604051908101604052809291908181526020016000905b8282101561228057600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101612223565b50505050905090565b600080600061229760355490565b91506122a1613050565b90506122ad848261431a565b949193509150565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060378054610aac90615e93565b600080516020615f57833981519152612308813361347a565b61010080546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f3b8dbc80bf27331221431f1c8b2c6fe358eadfdb3c3d7085e6a2521eeb775b079101610c1a565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156123e85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610e18565b6123f58286868403613356565b506001949350505050565b600033610b3d81858561356a565b61010c54600090815b818110156124a35761248561010c828154811061243657612436615f15565b6000918252602091829020604080516080810182526004909302909101805483526001810154938301939093526002830154908201526003909101546001600160a01b03166060820152614101565b61248f9084615dbb565b92508061249b81615ece565b915050612417565b505090565b600080516020615f578339815191526124c1813361347a565b61010180546001600160a01b0319166001600160a01b0384169081179091556040517f4029fa39dede0b39dd254005137e18c9116d6b2620b2037632c09bf89404c6d790600090a25050565b61010d602052816000526040600020818154811061252a57600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491945092506001600160a01b031684565b612565613ffa565b600261010f5560fb546040805180820190915260138152722737ba1030903737b2329037b832b930ba37b960691b60208201526125ad916001600160a01b0316331490613962565b60006125b882610c27565b50905060006125c7838361436a565b9050806125d5575050612618565b6125df8383614430565b60405182906001600160a01b038516907f65fcdf1cdc99352d178d6d953d52e01307cde7a592027b09c9e1d9ac8eb09ab790600090a350505b50600161010f55565b60c95460ff16156126445760405162461bcd60e51b8152600401610e1890615cc8565b61264c613ffa565b600261010f5561010454610107546101055461268d9061266d908390615dbb565b8311604051806060016040528060258152602001615f9e60259139613962565b60006126998284615e39565b60fb54604051637202ba3760e11b8152600481018390529192506000918291829182916001600160a01b03169063e405746e9060240160006040518083038186803b1580156126e757600080fd5b505afa1580156126fb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127239190810190615702565b60fd546101025494985092965090945092506000918291612751916001600160a01b03908116911683614640565b60fd546101025461276f916001600160a01b03918216911689614640565b60005b85811015612859576000846127925761278b878a615df8565b90506127ed565b8582815181106127a4576127a4615f15565b6020026020010151600014156127ba5750612847565b84898784815181106127ce576127ce615f15565b60200260200101516127e09190615e1a565b6127ea9190615df8565b90505b600088838151811061280157612801615f15565b6020026020010151600001519050600061281b828461436a565b90508061282a57505050612847565b61283682846000614764565b506128418386615dbb565b94505050505b8061285181615ece565b915050612772565b506128648188615e39565b91506128708883615dbb565b61010455604051829082907f421adba60af7a6b11679e2ac133b1bc91d3de91d56866ec19703d9d60cf950c890600090a35050600161010f5550505050505050565b60006128c060c95460ff1690565b156128dd5760405162461bcd60e51b8152600401610e1890615cc8565b6128e5613ffa565b600261010f55612938831580159061290c5750336000908152603360205260409020548411155b6040518060400160405280600e81526020016d125b9d985b1a5908185b5bdd5b9d60921b815250613962565b60fb546040516308b16df560e21b815260048101859052600091829182918291829182918291829182916001600160a01b0316906322c5b7d49060240160006040518083038186803b15801561298d57600080fd5b505afa1580156129a1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129c991908101906157f7565b9750975097509750975097509750975060006129e4886147ea565b905060006129f28e8361481a565b9050612a2c60008211604051806040016040528060138152602001725769746864726177205a45524f204d6174696360681b815250613962565b6000610107546101045411612a42576000612a54565b6101075461010454612a549190615e39565b90506000612a62828c615dbb565b9050612a9d8382101560405180604001604052806014815260200173546f6f206d75636820746f20776974686472617760601b815250613962565b505060fe546040516335313c2160e11b815233600482015282916001600160a01b031690636a62784290602401602060405180830381600087803b158015612ae457600080fd5b505af1158015612af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1c9190615a16565b9b508915612b66578315612b3f57612b388c8c84878e86614857565b9050612b66565b612b4d8c8c8b8b8986614921565b90508015612b6657612b638c8c89898986614921565b90505b898f1115612d305761010d60008d815260200190815260200160002060405180608001604052808381526020016000815260200160fd60009054906101000a90046001600160a01b03166001600160a01b031663a7ab69616040518163ffffffff1660e01b815260040160206040518083038186803b158015612be857600080fd5b505afa158015612bfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c209190615a16565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c6e57600080fd5b505afa158015612c82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca69190615a16565b612cb09190615dbb565b8152600060209182018190528354600180820186559482528282208451600490920201908155918301519382019390935560408201516002820155606090910151600390910180546001600160a01b0319166001600160a01b039092169190911790556101078054839290612d26908490615dbb565b9091555060009150505b50612d3b338f614a15565b61010a546001600160a01b0316634c09e6e8612d5660355490565b612d608486615e39565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b8152600401612d9d9190615c0d565b600060405180830381600087803b158015612db757600080fd5b505af1158015612dcb573d6000803e3d6000fd5b5050505050505050505050505050826001600160a01b0316336001600160a01b03167f4318b22a7b774533f1c9cd7102530d96faffc18ef44a1ecb56abc9a55d49fd8b86604051612e1e91815260200190565b60405180910390a3600161010f559392505050565b600080516020615f57833981519152612e4c813361347a565b6000612e5661240e565b6101075461010454612e689190615e39565b612e729190615dbb565b60fb54604051639552d81d60e01b81526004810183905291925060009182918291829182916001600160a01b0390911690639552d81d9060240160006040518083038186803b158015612ec457600080fd5b505afa158015612ed8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612f009190810190615777565b9450945094509450945060008060005b86811015612fef57858181518110612f2a57612f2a615f15565b602002602001015160001415612f3f57612fdd565b8484878381518110612f5357612f53615f15565b6020026020010151612f659190615e1a565b612f6f9190615df8565b925082612f7b57612fdd565b878181518110612f8d57612f8d615f15565b60200260200101516000015191506000612fa7838561436a565b905080612fb45750612fdd565b612fdb898381518110612fc957612fc9615f15565b60200260200101516000015185614430565b505b80612fe781615ece565b915050612f10565b50505050505050505050565b600082815260976020526040902060010154613017813361347a565b610d958383613868565b600080600061302f60355490565b9150600061303b613050565b9050613047858261481a565b95929450925050565b60008061305b6120d8565b9050613066816147ea565b91505090565b61010c818154811061307d57600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491935091906001600160a01b031684565b60006130be60c95460ff1690565b156130db5760405162461bcd60e51b8152600401610e1890615cc8565b6130e3613ffa565b600261010f5560408051808201909152600e81526d125b9d985b1a5908185b5bdd5b9d60921b602082015261311b9084151590613962565b61010254613134906001600160a01b0316333086614b63565b600080600061314286612289565b92509250925061317660008411604051806040016040528060098152602001684d696e74205a45524f60b81b815250613962565b6131803384614b9b565b8561010460008282546131939190615dbb565b909155505061010a546001600160a01b0316634c09e6e86131b48585615dbb565b6131be8985615dbb565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b81526004016131fb9190615c0d565b600060405180830381600087803b15801561321557600080fd5b505af1158015613229573d6000803e3d6000fd5b50506040518881526001600160a01b03881692503391507f98d2bc018caf34c71a8f920d9d93d4ed62e9789506b74087b48570c17b28ed999060200160405180910390a35050600161010f559392505050565b600080516020615f57833981519152613295813361347a565b6132de826132a38587615dd3565b6132ad9190615dd3565b60ff166064146040518060400160405280600d81526020016c073756d2866656529213d31303609c1b815250613962565b60fc805460ff86811661ffff1990921682176101008783169081029190911762ff0000191662010000928716928302179093556040805192835260208301939093528183015290517f37322890d66d781059d797be5e2f27dc160a34d8bc0a8e09116cb9a773ce88ef9181900360600190a150505050565b6001600160a01b0383166133b85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610e18565b6001600160a01b0382166134195760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610e18565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b61348482826122b5565b6110495761349c816001600160a01b03166014614c7a565b6134a7836020614c7a565b6040516020016134b8929190615b2b565b60408051601f198184030181529082905262461bcd60e51b8252610e1891600401615c0d565b6001600160a01b0383811660009081526034602090815260408083209386168352929052205460001981146120d2578181101561355d5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610e18565b6120d28484848403613356565b6001600160a01b0383166135ce5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610e18565b6001600160a01b0382166136305760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610e18565b6001600160a01b038316600090815260336020526040902054818110156136a85760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610e18565b6001600160a01b038085166000908152603360205260408082208585039055918516815290812080548492906136df908490615dbb565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161372b91815260200190565b60405180910390a36120d2565b61374282826122b5565b6110495760008281526097602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561377a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600054610100900460ff166137e55760405162461bcd60e51b8152600401610e1890615cf2565b565b600054610100900460ff1661380e5760405162461bcd60e51b8152600401610e1890615cf2565b60c9805460ff19169055565b600054610100900460ff166138415760405162461bcd60e51b8152600401610e1890615cf2565b81516138549060369060208501906153ad565b508051610d959060379060208401906153ad565b61387282826122b5565b156110495760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60c95460ff166139185760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610e18565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b8082610d955760405162461bcd60e51b8152600401610e189190615c0d565b60008181526101096020908152604091829020600281015460fd54845163900cf0cf60e01b8152945192946139de9492936001600160a01b039092169263900cf0cf92600480840193829003018186803b15801561136957600080fd5b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015613a2457600080fd5b505af1158015613a38573d6000803e3d6000fd5b5050506003820154600091506001600160a01b031615613b7f57610102546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015613a9757600080fd5b505afa158015613aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613acf9190615a16565b60038401546001850154919250613af1916001600160a01b0390911690614040565b610102546040516370a0823160e01b815230600482015282916001600160a01b0316906370a082319060240160206040518083038186803b158015613b3557600080fd5b505afa158015613b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b6d9190615a16565b613b779190615e39565b915050613bb9565b81600001549050806101076000828254613b999190615e39565b92505081905550806101046000828254613bb39190615e39565b90915550505b61010254613bd1906001600160a01b0316338361409e565b8083336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd6000604051613c0f91815260200190565b60405180910390a4505050565b600081815261010d6020908152604080832080548251818502810185019093528083529192909190849084015b82821015613ca657600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101613c49565b505050509050613d1c81600081518110613cc257613cc2615f15565b60200260200101516040015160fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561136957600080fd5b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015613d6257600080fd5b505af1158015613d76573d6000803e3d6000fd5b50508251610102546040516370a0823160e01b81523060048201529193506000925082916001600160a01b03909116906370a082319060240160206040518083038186803b158015613dc757600080fd5b505afa158015613ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dff9190615a16565b905060005b83811015613f015760006001600160a01b0316858281518110613e2957613e29615f15565b6020026020010151606001516001600160a01b031614613e8c57613e87858281518110613e5857613e58615f15565b602002602001015160600151868381518110613e7657613e76615f15565b602002602001015160200151614040565b613eef565b6000858281518110613ea057613ea0615f15565b6020026020010151600001519050806101076000828254613ec19190615e39565b92505081905550806101046000828254613edb9190615e39565b90915550613eeb90508185615dbb565b9350505b80613ef981615ece565b915050613e04565b50610102546040516370a0823160e01b815230600482015282916001600160a01b0316906370a082319060240160206040518083038186803b158015613f4657600080fd5b505afa158015613f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f7e9190615a16565b613f889190615e39565b613f929083615dbb565b61010254909250613fad906001600160a01b0316338461409e565b8185336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd6000604051613feb91815260200190565b60405180910390a45050505050565b6137e5600261010f5414156040518060400160405280601f81526020017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815250613962565b6040516374bfeee160e11b8152600481018290526001600160a01b0383169063e97fddc290602401600060405180830381600087803b15801561408257600080fd5b505af1158015614096573d6000803e3d6000fd5b505050505050565b6040516001600160a01b038316602482015260448101829052610d9590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614e16565b60608101516000906001600160a01b031661411b57505190565b600082606001519050600061419f826001600160a01b0316635c5f7dae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561416257600080fd5b505afa158015614176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061419a9190615a16565b614ee8565b90506000826001600160a01b031663bfb18f296040518163ffffffff1660e01b815260040160206040518083038186803b1580156141dc57600080fd5b505afa1580156141f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142149190615a16565b602086015160405163795be58760e01b815230600482015260248101919091529091506000906001600160a01b0385169063795be58790604401604080518083038186803b15801561426557600080fd5b505afa158015614279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061429d91906159c7565b805190915083906142ae9084615e1a565b6142b89190615df8565b9695505050505050565b60c95460ff16156142e55760405162461bcd60e51b8152600401610e1890615cc8565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586139453390565b60008061432660355490565b905080156143345780614337565b60015b905082156143455782614348565b60015b92506000836143578387615e1a565b6143619190615df8565b95945050505050565b60008083905060006143ae826001600160a01b0316635c5f7dae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561416257600080fd5b90506000826001600160a01b0316633ba0b9a96040518163ffffffff1660e01b815260040160206040518083038186803b1580156143eb57600080fd5b505afa1580156143ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144239190615a16565b9050806142ae8387615e1a565b61443d8282600019614f1d565b60408051608081018252600081529051630c11b08160e21b815230600482015261010c919060208201906001600160a01b03861690633046c2049060240160206040518083038186803b15801561449357600080fd5b505afa1580156144a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144cb9190615a16565b815260fd546040805163a7ab696160e01b815290516020938401936001600160a01b039093169263a7ab69619260048082019391829003018186803b15801561451357600080fd5b505afa158015614527573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061454b9190615a16565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561459957600080fd5b505afa1580156145ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145d19190615a16565b6145db9190615dbb565b81526001600160a01b03948516602091820152825460018082018555600094855293829020835160049092020190815590820151928101929092556040810151600283015560600151600390910180546001600160a01b031916919093161790915550565b8015806146c95750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561468f57600080fd5b505afa1580156146a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146c79190615a16565b155b6147345760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610e18565b6040516001600160a01b038316602482015260448101829052610d9590849063095ea7b360e01b906064016140ca565b604051636ab1507160e01b8152600481018390526024810182905260009081906001600160a01b03861690636ab1507190604401602060405180830381600087803b1580156147b257600080fd5b505af11580156147c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143619190615a16565b6000610107546147f861240e565b610104546148069085615dbb565b6148109190615dbb565b610a979190615e39565b60008061482660355490565b905080156148345780614837565b60015b905082156148455782614848565b60015b92506000816143578587615e1a565b6000808584116148675783614869565b855b905060006148778683615df8565b905060005b8681101561491357600089828151811061489857614898615f15565b60200260200101516000015190506148f160006148b5838661436a565b116040518060400160405280601781526020017f5a45524f2073686172657320746f207769746864726177000000000000000000815250613962565b6148fd8b828589614f83565b955050808061490b90615ece565b91505061487c565b509298975050505050505050565b6000805b85811015614a0957600085828151811061494157614941615f15565b60200260200101519050600085828151811061495f5761495f615f15565b6020026020010151905080600014156149795750506149f7565b60008582116149a15786838151811061499457614994615f15565b60200260200101516149a3565b855b905060008a84815181106149b9576149b9615f15565b60200260200101516000015190506149d660006148b5838561436a565b6149e28c82848a614f83565b9650866149f25750505050614a09565b505050505b80614a0181615ece565b915050614925565b50909695505050505050565b6001600160a01b038216614a755760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610e18565b6001600160a01b03821660009081526033602052604090205481811015614ae95760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610e18565b6001600160a01b0383166000908152603360205260408120838303905560358054849290614b18908490615e39565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6040516001600160a01b03808516602483015283166044820152606481018290526120d29085906323b872dd60e01b906084016140ca565b6001600160a01b038216614bf15760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610e18565b8060356000828254614c039190615dbb565b90915550506001600160a01b03821660009081526033602052604081208054839290614c30908490615dbb565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606000614c89836002615e1a565b614c94906002615dbb565b67ffffffffffffffff811115614cac57614cac615f2b565b6040519080825280601f01601f191660200182016040528015614cd6576020820181803683370190505b509050600360fc1b81600081518110614cf157614cf1615f15565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614d2057614d20615f15565b60200101906001600160f81b031916908160001a9053506000614d44846002615e1a565b614d4f906001615dbb565b90505b6001811115614dc7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614d8357614d83615f15565b1a60f81b828281518110614d9957614d99615f15565b60200101906001600160f81b031916908160001a90535060049490941c93614dc081615e7c565b9050614d52565b508315610cca5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610e18565b6000614e6b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166151a89092919063ffffffff16565b805190915015610d955780806020019051810190614e8991906158cb565b610d955760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610e18565b600060088210614f05576c01431e0fae6d7217caa0000000614f08565b60645b6cffffffffffffffffffffffffff1692915050565b60405163c83ec04d60e01b815260048101839052602481018290526001600160a01b0384169063c83ec04d90604401600060405180830381600087803b158015614f6657600080fd5b505af1158015614f7a573d6000803e3d6000fd5b50505050505050565b6000614f928484600019614f1d565b600085815261010d6020908152604080832081516080810183529384529051630c11b08160e21b81523060048201529092918201906001600160a01b03881690633046c2049060240160206040518083038186803b158015614ff357600080fd5b505afa158015615007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061502b9190615a16565b815260fd546040805163a7ab696160e01b815290516020938401936001600160a01b039093169263a7ab69619260048082019391829003018186803b15801561507357600080fd5b505afa158015615087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150ab9190615a16565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156150f957600080fd5b505afa15801561510d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906151319190615a16565b61513b9190615dbb565b81526001600160a01b038781166020928301528354600180820186556000958652948390208451600490920201908155918301519382019390935560408201516002820155606090910151600390910180546001600160a01b031916919092161790556143618383615e39565b60606151b784846000856151bf565b949350505050565b6060824710156152205760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610e18565b6001600160a01b0385163b6152775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610e18565b600080866001600160a01b031685876040516152939190615aff565b60006040518083038185875af1925050503d80600081146152d0576040519150601f19603f3d011682016040523d82523d6000602084013e6152d5565b606091505b50915091506152e58282866152f0565b979650505050505050565b606083156152ff575081610cca565b82511561530f5782518084602001fd5b8160405162461bcd60e51b8152600401610e189190615c0d565b82805461533590615e93565b90600052602060002090601f016020900481019282615357576000855561539d565b82601f106153705782800160ff1982351617855561539d565b8280016001018555821561539d579182015b8281111561539d578235825591602001919060010190615382565b506153a9929150615421565b5090565b8280546153b990615e93565b90600052602060002090601f0160209004810192826153db576000855561539d565b82601f106153f457805160ff191683800117855561539d565b8280016001018555821561539d579182015b8281111561539d578251825591602001919060010190615406565b5b808211156153a95760008155600101615422565b600082601f83011261544757600080fd5b8151602061545c61545783615d97565b615d66565b80838252828201915082860187848660061b890101111561547c57600080fd5b6000805b868110156154d157604080848c031215615498578283fd5b6154a0615d3d565b84516154ab81615f41565b8152848801516154ba81615f41565b818901528652948601949290920191600101615480565b509198975050505050505050565b600082601f8301126154f057600080fd5b8151602061550061545783615d97565b80838252828201915082860187848660051b890101111561552057600080fd5b60005b8581101561553f57815184529284019290840190600101615523565b5090979650505050505050565b803560ff8116811461555d57600080fd5b919050565b60006020828403121561557457600080fd5b8135610cca81615f41565b6000806040838503121561559257600080fd5b823561559d81615f41565b915060208301356155ad81615f41565b809150509250929050565b600080600080600080600060e0888a0312156155d357600080fd5b87356155de81615f41565b965060208801356155ee81615f41565b955060408801356155fe81615f41565b9450606088013561560e81615f41565b9350608088013561561e81615f41565b925060a088013561562e81615f41565b915060c088013561563e81615f41565b8091505092959891949750929550565b60008060006060848603121561566357600080fd5b833561566e81615f41565b9250602084013561567e81615f41565b929592945050506040919091013590565b600080604083850312156156a257600080fd5b82356156ad81615f41565b946020939093013593505050565b600080604083850312156156ce57600080fd5b825167ffffffffffffffff8111156156e557600080fd5b6156f185828601615436565b925050602083015190509250929050565b6000806000806080858703121561571857600080fd5b845167ffffffffffffffff8082111561573057600080fd5b61573c88838901615436565b955060208701519450604087015191508082111561575957600080fd5b50615766878288016154df565b606096909601519497939650505050565b600080600080600060a0868803121561578f57600080fd5b855167ffffffffffffffff808211156157a757600080fd5b6157b389838a01615436565b96506020880151955060408801519150808211156157d057600080fd5b506157dd888289016154df565b606088015160809098015196999598509695949350505050565b600080600080600080600080610100898b03121561581457600080fd5b885167ffffffffffffffff8082111561582c57600080fd5b6158388c838d01615436565b995060208b0151985060408b0151975060608b015191508082111561585c57600080fd5b6158688c838d016154df565b965060808b0151955060a08b015191508082111561588557600080fd5b6158918c838d016154df565b945060c08b01519150808211156158a757600080fd5b506158b48b828c016154df565b92505060e089015190509295985092959890939650565b6000602082840312156158dd57600080fd5b81518015158114610cca57600080fd5b6000602082840312156158ff57600080fd5b5035919050565b6000806040838503121561591957600080fd5b8235915060208301356155ad81615f41565b60006020828403121561593d57600080fd5b81356001600160e01b031981168114610cca57600080fd5b6000806020838503121561596857600080fd5b823567ffffffffffffffff8082111561598057600080fd5b818501915085601f83011261599457600080fd5b8135818111156159a357600080fd5b8660208285010111156159b557600080fd5b60209290920196919550909350505050565b6000604082840312156159d957600080fd5b6040516040810181811067ffffffffffffffff821117156159fc576159fc615f2b565b604052825181526020928301519281019290925250919050565b600060208284031215615a2857600080fd5b5051919050565b60008060408385031215615a4257600080fd5b50508035926020909101359150565b60008060408385031215615a6457600080fd5b505080516020909101519092909150565b600060208284031215615a8757600080fd5b610cca8261554c565b600080600060608486031215615aa557600080fd5b615aae8461554c565b9250615abc6020850161554c565b9150615aca6040850161554c565b90509250925092565b60008151808452615aeb816020860160208601615e50565b601f01601f19169290920160200192915050565b60008251615b11818460208701615e50565b9190910192915050565b8183823760009101908152919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615b63816017850160208801615e50565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615b94816028840160208801615e50565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b82811015615c0057815180518552868101518786015285810151868601526060908101516001600160a01b03169085015260809093019290850190600101615bbd565b5091979650505050505050565b602081526000610cca6020830184615ad3565b600060208083526000845481600182811c915080831680615c4257607f831692505b858310811415615c6057634e487b7160e01b85526022600452602485fd5b878601838152602001818015615c7d5760018114615c8e57615cb9565b60ff19861682528782019650615cb9565b60008b81526020902060005b86811015615cb357815484820152908501908901615c9a565b83019750505b50949998505050505050505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6040805190810167ffffffffffffffff81118282101715615d6057615d60615f2b565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715615d8f57615d8f615f2b565b604052919050565b600067ffffffffffffffff821115615db157615db1615f2b565b5060051b60200190565b60008219821115615dce57615dce615ee9565b500190565b600060ff821660ff84168060ff03821115615df057615df0615ee9565b019392505050565b600082615e1557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615615e3457615e34615ee9565b500290565b600082821015615e4b57615e4b615ee9565b500390565b60005b83811015615e6b578181015183820152602001615e53565b838111156120d25750506000910152565b600081615e8b57615e8b615ee9565b506000190190565b600181811c90821680615ea757607f821691505b60208210811415615ec857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415615ee257615ee2615ee9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461111757600080fdfed0a4ad96d49edb1c33461cebc6fb2609190f32c904e3c3f5877edb4488dee91e416d6f756e7420746f2064697374726962757465206c6f776572207468616e206d696e696d756d416d6f756e7420746f2064656c6567617465206c6f776572207468616e206d696e696d756da2646970667358221220ef4992c6d6bbc520a2738d94de9da5ac35248bdd9ffda1fd56055b17d660e8e964736f6c63430008070033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061043e5760003560e01c80637682c90211610236578063b0e21e8a1161013b578063d968447c116100c3578063f08711fe11610087578063f08711fe146109da578063f1a13fce14610a19578063f532e86a14610a2c578063f6794fdb14610a3f578063fc0c546a14610a5257600080fd5b8063d968447c1461095d578063dd62ed3e14610970578063e00222a0146109a9578063e062b10b146109b1578063e259faf7146109c557600080fd5b8063c89e43611161010a578063c89e43611461091d578063ccc143b814610925578063ce99b58614610938578063d280f14f14610942578063d547741f1461094a57600080fd5b8063b0e21e8a146108ad578063bb208f55146108bb578063c697d2c7146108ce578063c75e78321461090a57600080fd5b806395d89b41116101be578063a217fddf1161018d578063a217fddf1461086d578063a245294714610875578063a457c2d71461087f578063a9059cbb14610892578063afd290a7146108a557600080fd5b806395d89b41146107f9578063964a75961461080157806398fabd3a146108455780639a3cac6a1461085a57600080fd5b8063893818a311610205578063893818a31461079257806389cf32041461079c578063916b9eba146107b0578063917a52f5146107b857806391d14854146107e657600080fd5b80637682c9021461075c578063788bc78c1461076f5780637e978af8146107825780638456cb591461078a57600080fd5b8063395093511161034757806354fd4d50116102cf57806370a082311161029357806370a08231146106f057806370bf9fe91461071957806371975a3e1461072c578063720bcf1d146107365780637542ff951461074957600080fd5b806354fd4d50146106af5780635c975abb146106b7578063676e5550146106c25780636f4a2cd0146106d55780637029c90e146106dd57600080fd5b806346e04a2f1161031657806346e04a2f146106625780634cfeb862146106755780634e91f81114610688578063509c5df61461069b57806352349b17146106a557600080fd5b806339509351146106205780633b573c4a146106335780633f4ba83a146106465780634162169f1461064e57600080fd5b806323b872dd116103ca578063309756fb11610399578063309756fb14610597578063313ce567146105be57806335876476146105d357806336568abe146105e6578063389ed267146105f957600080fd5b806323b872dd1461052e578063248a9ca314610541578063253d1735146105645780632f2ff15d1461058457600080fd5b80630d7abc33116104115780630d7abc33146104be5780630f2b2639146104d657806315539d3f146104eb57806318160ddd146104fe5780631e7ff8f61461050657600080fd5b806301ffc9a714610443578063023c5b081461046b57806306fdde0314610496578063095ea7b3146104ab575b600080fd5b61045661045136600461592b565b610a66565b60405190151581526020015b60405180910390f35b60fb5461047e906001600160a01b031681565b6040516001600160a01b039091168152602001610462565b61049e610a9d565b6040516104629190615c0d565b6104566104b936600461568f565b610b2f565b6104c86101055481565b604051908152602001610462565b6104e96104e4366004615562565b610b47565b005b6104e96104f9366004615562565b610bab565b6035546104c8565b610519610514366004615562565b610c27565b60408051928352602083019190915201610462565b61045661053c36600461564e565b610cab565b6104c861054f3660046158ed565b60009081526097602052604090206001015490565b6105776105723660046158ed565b610cd1565b6040516104629190615ba0565b6104e9610592366004615906565b610d6f565b6104c87f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2281565b60125b60405160ff9091168152602001610462565b6104e96105e13660046155b8565b610d9a565b6104e96105f4366004615906565b610fcf565b6104c87ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1481565b61045661062e36600461568f565b61104d565b6104e96106413660046158ed565b61108c565b6104e96110e4565b6101005461047e906001600160a01b031681565b6104e96106703660046158ed565b61111a565b6104e96106833660046158ed565b611265565b6104e9610696366004615a75565b6116e2565b6104c86101075481565b6104c86101045481565b61049e611795565b60c95460ff16610456565b6104c86106d0366004615562565b611823565b6104e961189d565b60fe5461047e906001600160a01b031681565b6104c86106fe366004615562565b6001600160a01b031660009081526033602052604090205490565b6104e9610727366004615562565b611e29565b6104c86101035481565b6104c86107443660046158ed565b611e9d565b60fd5461047e906001600160a01b031681565b6104e961076a3660046158ed565b61200f565b6104e961077d366004615955565b61205d565b6104c86120d8565b6104e96121cb565b6104c861010b5481565b6101015461047e906001600160a01b031681565b6105776121fe565b6107cb6107c63660046158ed565b612289565b60408051938452602084019290925290820152606001610462565b6104566107f4366004615906565b6122b5565b61049e6122e0565b60fc546108219060ff808216916101008104821691620100009091041683565b6040805160ff94851681529284166020840152921691810191909152606001610462565b6104c8600080516020615f5783398151915281565b6104e9610868366004615562565b6122ef565b6104c8600081565b6104c86101065481565b61045661088d36600461568f565b612363565b6104566108a036600461568f565b612400565b6104c861240e565b61010e546105c19060ff1681565b6104e96108c9366004615562565b6124a8565b6108e16108dc366004615a2f565b61250d565b604080519485526020850193909352918301526001600160a01b03166060820152608001610462565b6104e9610918366004615562565b61255d565b6104e9612621565b6104c8610933366004615906565b6128b2565b6104c86101085481565b6104e9612e33565b6104e9610958366004615906565b612ffb565b6107cb61096b3660046158ed565b613021565b6104c861097e36600461557f565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6104c8613050565b61010a5461047e906001600160a01b031681565b61010a5461045690600160a01b900460ff1681565b6108e16109e83660046158ed565b610109602052600090815260409020805460018201546002830154600390930154919290916001600160a01b031684565b6108e1610a273660046158ed565b61306c565b6104c8610a3a366004615906565b6130b0565b6104e9610a4d366004615a90565b61327c565b6101025461047e906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b1480610a9757506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060368054610aac90615e93565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad890615e93565b8015610b255780601f10610afa57610100808354040283529160200191610b25565b820191906000526020600020905b815481529060010190602001808311610b0857829003601f168201915b5050505050905090565b600033610b3d818585613356565b5060019392505050565b600080516020615f57833981519152610b60813361347a565b60fb80546001600160a01b0319166001600160a01b0384169081179091556040517fb8e1a40638c48c0ebe9679e0b5b032f2066cf44139d775cc09c945b5df070c4e90600090a25050565b600080516020615f57833981519152610bc4813361347a565b60fe80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f3879f4996438c287cec42ea09f698215be51d075ec446a9f5bc83c98ccc1910191015b60405180910390a1505050565b604051630f3ffc7b60e11b815230600482015260009081906001600160a01b03841690631e7ff8f690602401604080518083038186803b158015610c6a57600080fd5b505afa158015610c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca29190615a51565b91509150915091565b600033610cb98582856134de565b610cc485858561356a565b60019150505b9392505050565b606061010d6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015610d6457600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101610d07565b505050509050919050565b600082815260976020526040902060010154610d8b813361347a565b610d958383613738565b505050565b600054610100900460ff16610db55760005460ff1615610db9565b303b155b610e215760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b600054610100900460ff16158015610e43576000805461ffff19166101011790555b610e4b6137be565b610e536137e7565b610ea06040518060400160405280600c81526020016b5374616b6564204d4154494360a01b8152506040518060400160405280600781526020016673744d4154494360c81b81525061381a565b610eab600033613738565b610ec3600080516020615f5783398151915287613738565b610eed7ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1433613738565b610f177f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2287613738565b60fb80546001600160a01b03199081166001600160a01b038b81169190911790925560fd8054821687841617905560fe8054821686841617905561010a8054821685841617905561010080548216898416179055610102805482168a841617905561010180549091169187169190911790556040805160608101825260198082526032602083015291015260fc805462ffffff1916621932191790558015610fc5576000805461ff00191690555b5050505050505050565b6001600160a01b038116331461103f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610e18565b6110498282613868565b5050565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190610b3d9082908690611087908790615dbb565b613356565b600080516020615f578339815191526110a5813361347a565b61010680549083905560408051828152602081018590527fbf99ce7c5a72f4c7135bb72a36193d147a37a54bfcf63ec29505b5e6d5e2921d9101610c1a565b7f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2261110f813361347a565b6111176138cf565b50565b60c95460ff161561113d5760405162461bcd60e51b8152600401610e1890615cc8565b60fe5460405163430c208160e01b8152336004820152602481018390526111e8916001600160a01b03169063430c20819060440160206040518083038186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c191906158cb565b604051806040016040528060098152602001682737ba1037bbb732b960b91b815250613962565b60008181526101096020526040902060020154156112095761111781613981565b600081815261010d6020526040902054156112275761111781613c1c565b60405162461bcd60e51b815260206004820152601360248201527224b73b30b634b21031b630b4b6903a37b5b2b760691b6044820152606401610e18565b60c95460ff16156112885760405162461bcd60e51b8152600401610e1890615cc8565b611290613ffa565b600261010f5561010c5460408051808201909152600d81526c0d2dcecc2d8d2c840d2dcc8caf609b1b60208201526112cb9082841090613962565b600061010c83815481106112e1576112e1615f15565b60009182526020918290206040805160808101825260049384029092018054835260018101548386015260028101548383018190526003909101546001600160a01b03908116606085015260fd54835163900cf0cf60e01b815293519497506113d696929591169363900cf0cf93808301939290829003018186803b15801561136957600080fd5b505afa15801561137d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a19190615a16565b101560405180604001604052806015815260200174139bdd0818589b19481d1bc818db185a5b481e595d605a1b815250613962565b610102546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561141b57600080fd5b505afa15801561142f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114539190615a16565b905061146782606001518360200151614040565b610102546040516370a0823160e01b815230600482015260009183916001600160a01b03909116906370a082319060240160206040518083038186803b1580156114b057600080fd5b505afa1580156114c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e89190615a16565b6114f29190615e39565b90508061010460008282546115079190615dbb565b909155506115189050600185615e39565b8514158015611528575083600114155b156115bc5761010c61153b600186615e39565b8154811061154b5761154b615f15565b906000526020600020906004020161010c868154811061156d5761156d615f15565b6000918252602090912082546004909202019081556001808301549082015560028083015490820155600391820154910180546001600160a01b0319166001600160a01b039092169190911790555b61010c8054806115ce576115ce615eff565b60008281526020812060046000199093019283020181815560018101829055600281019190915560030180546001600160a01b0319169055905561010a546001600160a01b0316634c09e6e861162360355490565b61162b613050565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b81526004016116689190615c0d565b600060405180830381600087803b15801561168257600080fd5b505af1158015611696573d6000803e3d6000fd5b505050508083606001516001600160a01b03167f4c42a3bec298a4d82d41b7a540d8ebc22d91ee8a61459bce23849ff470d31dea60405160405180910390a35050600161010f55505050565b600080516020615f578339815191526116fb813361347a565b61174660008360ff16118015611715575060648360ff1611155b60405180604001604052806013815260200172496e76616c69642070726f74636f6c2066656560681b815250613962565b61010e805460ff84811660ff1983168117909355604080519190921680825260208201939093527f6b1719571aee7af62357ac4d4c98cc35155a52a5fcf0c09198874443c0fe430d9101610c1a565b60ff80546117a290615e93565b80601f01602080910402602001604051908101604052809291908181526020018280546117ce90615e93565b801561181b5780601f106117f05761010080835404028352916020019161181b565b820191906000526020600020905b8154815290600101906020018083116117fe57829003601f168201915b505050505081565b604051630676e55560e41b81523060048201526000906001600160a01b0383169063676e55509060240160206040518083038186803b15801561186557600080fd5b505afa158015611879573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a979190615a16565b60c95460ff16156118c05760405162461bcd60e51b8152600401610e1890615cc8565b6118c8613ffa565b600261010f5560fb546040805163a335385960e01b8152905160009283926001600160a01b039091169163a3353859916004808201928692909190829003018186803b15801561191757600080fd5b505afa15801561192b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261195391908101906156bb565b9150915060005b81811015611ae857600083828151811061197657611976615f15565b602090810291909101015151604051630676e55560e41b81523060048201529091506000906001600160a01b0383169063676e55509060240160206040518083038186803b1580156119c757600080fd5b505afa1580156119db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ff9190615a16565b90506000826001600160a01b0316639b2cb5d86040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3c57600080fd5b505afa158015611a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a749190615a16565b905080821115611ad257826001600160a01b031663c7b8981c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611ab957600080fd5b505af1158015611acd573d6000803e3d6000fd5b505050505b5050508080611ae090615ece565b91505061195a565b5061010454610102546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a082319060240160206040518083038186803b158015611b3357600080fd5b505afa158015611b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6b9190615a16565b611b759190615e39565b61010e54909150600090606490611b8f9060ff1684615e1a565b611b999190615df8565b9050611bc2610106548211604051806060016040528060278152602001615f7760279139613962565b610102546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611c0757600080fd5b505afa158015611c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3f9190615a16565b60fc54909150600090606490611c589060ff1685615e1a565b611c629190615df8565b60fc54909150600090606490611c819062010000900460ff1686615e1a565b611c8b9190615df8565b60fc54909150600090606490611ca990610100900460ff1687615e1a565b611cb39190615df8565b90506000611cc18883615df8565b6101005461010254919250611ce3916001600160a01b0390811691168661409e565b6101015461010254611d02916001600160a01b0391821691168561409e565b60005b88811015611d5657611d448a8281518110611d2257611d22615f15565b6020908102919091018101510151610102546001600160a01b0316908461409e565b80611d4e81615ece565b915050611d05565b50610102546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611d9c57600080fd5b505afa158015611db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd49190615a16565b90506000611de28288615e39565b61010483905560405190915081907f4e3c6a1e602996ae70905ac6165ed2434753246e3bfa52b6ca6852b40e2d440890600090a25050600161010f55505050505050505050565b600080516020615f57833981519152611e42813361347a565b61010a80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f8f8196a0718fc814ab20b90fdc8c2024046578345148e1b903b20667f693a6ba9101610c1a565b6000818152610109602052604081206002015415611f0957600082815261010960209081526040918290208251608081018452815481526001820154928101929092526002810154928201929092526003909101546001600160a01b03166060820152610a9790614101565b600082815261010d60205260409020541561200757600082815261010d6020908152604080832080548251818502810185019093528083529192909190849084015b82821015611fa857600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101611f4b565b505050509050600080600090505b8251811015611fff57611fe1838281518110611fd457611fd4615f15565b6020026020010151614101565b611feb9083615dbb565b915080611ff781615ece565b915050611fb6565b509392505050565b506000919050565b600080516020615f57833981519152612028813361347a565b61010582905560405182907f1cabc2f7b706218bb8613769cd658789cd6f1860310413b841020a2c7b7a0e3290600090a25050565b600080516020615f57833981519152612076813361347a565b8282604051612086929190615b1b565b60405180910390207fa22d531a51c0ad90c971d36d779910f19a3b85d5e5005072f84700bd68b6f0c560ff6040516120be9190615c20565b60405180910390a26120d260ff8484615329565b50505050565b60008060008060fb60009054906101000a90046001600160a01b03166001600160a01b0316630926efe46040518163ffffffff1660e01b815260040160006040518083038186803b15801561212c57600080fd5b505afa158015612140573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261216891908101906156bb565b9150915060005b818110156121c257600061219f84838151811061218e5761218e615f15565b602002602001015160000151610c27565b5090506121ac8186615dbb565b94505080806121ba90615ece565b91505061216f565b50919392505050565b7ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d146121f6813361347a565b6111176142c2565b606061010c805480602002602001604051908101604052809291908181526020016000905b8282101561228057600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101612223565b50505050905090565b600080600061229760355490565b91506122a1613050565b90506122ad848261431a565b949193509150565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060378054610aac90615e93565b600080516020615f57833981519152612308813361347a565b61010080546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f3b8dbc80bf27331221431f1c8b2c6fe358eadfdb3c3d7085e6a2521eeb775b079101610c1a565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156123e85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610e18565b6123f58286868403613356565b506001949350505050565b600033610b3d81858561356a565b61010c54600090815b818110156124a35761248561010c828154811061243657612436615f15565b6000918252602091829020604080516080810182526004909302909101805483526001810154938301939093526002830154908201526003909101546001600160a01b03166060820152614101565b61248f9084615dbb565b92508061249b81615ece565b915050612417565b505090565b600080516020615f578339815191526124c1813361347a565b61010180546001600160a01b0319166001600160a01b0384169081179091556040517f4029fa39dede0b39dd254005137e18c9116d6b2620b2037632c09bf89404c6d790600090a25050565b61010d602052816000526040600020818154811061252a57600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491945092506001600160a01b031684565b612565613ffa565b600261010f5560fb546040805180820190915260138152722737ba1030903737b2329037b832b930ba37b960691b60208201526125ad916001600160a01b0316331490613962565b60006125b882610c27565b50905060006125c7838361436a565b9050806125d5575050612618565b6125df8383614430565b60405182906001600160a01b038516907f65fcdf1cdc99352d178d6d953d52e01307cde7a592027b09c9e1d9ac8eb09ab790600090a350505b50600161010f55565b60c95460ff16156126445760405162461bcd60e51b8152600401610e1890615cc8565b61264c613ffa565b600261010f5561010454610107546101055461268d9061266d908390615dbb565b8311604051806060016040528060258152602001615f9e60259139613962565b60006126998284615e39565b60fb54604051637202ba3760e11b8152600481018390529192506000918291829182916001600160a01b03169063e405746e9060240160006040518083038186803b1580156126e757600080fd5b505afa1580156126fb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127239190810190615702565b60fd546101025494985092965090945092506000918291612751916001600160a01b03908116911683614640565b60fd546101025461276f916001600160a01b03918216911689614640565b60005b85811015612859576000846127925761278b878a615df8565b90506127ed565b8582815181106127a4576127a4615f15565b6020026020010151600014156127ba5750612847565b84898784815181106127ce576127ce615f15565b60200260200101516127e09190615e1a565b6127ea9190615df8565b90505b600088838151811061280157612801615f15565b6020026020010151600001519050600061281b828461436a565b90508061282a57505050612847565b61283682846000614764565b506128418386615dbb565b94505050505b8061285181615ece565b915050612772565b506128648188615e39565b91506128708883615dbb565b61010455604051829082907f421adba60af7a6b11679e2ac133b1bc91d3de91d56866ec19703d9d60cf950c890600090a35050600161010f5550505050505050565b60006128c060c95460ff1690565b156128dd5760405162461bcd60e51b8152600401610e1890615cc8565b6128e5613ffa565b600261010f55612938831580159061290c5750336000908152603360205260409020548411155b6040518060400160405280600e81526020016d125b9d985b1a5908185b5bdd5b9d60921b815250613962565b60fb546040516308b16df560e21b815260048101859052600091829182918291829182918291829182916001600160a01b0316906322c5b7d49060240160006040518083038186803b15801561298d57600080fd5b505afa1580156129a1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129c991908101906157f7565b9750975097509750975097509750975060006129e4886147ea565b905060006129f28e8361481a565b9050612a2c60008211604051806040016040528060138152602001725769746864726177205a45524f204d6174696360681b815250613962565b6000610107546101045411612a42576000612a54565b6101075461010454612a549190615e39565b90506000612a62828c615dbb565b9050612a9d8382101560405180604001604052806014815260200173546f6f206d75636820746f20776974686472617760601b815250613962565b505060fe546040516335313c2160e11b815233600482015282916001600160a01b031690636a62784290602401602060405180830381600087803b158015612ae457600080fd5b505af1158015612af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1c9190615a16565b9b508915612b66578315612b3f57612b388c8c84878e86614857565b9050612b66565b612b4d8c8c8b8b8986614921565b90508015612b6657612b638c8c89898986614921565b90505b898f1115612d305761010d60008d815260200190815260200160002060405180608001604052808381526020016000815260200160fd60009054906101000a90046001600160a01b03166001600160a01b031663a7ab69616040518163ffffffff1660e01b815260040160206040518083038186803b158015612be857600080fd5b505afa158015612bfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c209190615a16565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c6e57600080fd5b505afa158015612c82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca69190615a16565b612cb09190615dbb565b8152600060209182018190528354600180820186559482528282208451600490920201908155918301519382019390935560408201516002820155606090910151600390910180546001600160a01b0319166001600160a01b039092169190911790556101078054839290612d26908490615dbb565b9091555060009150505b50612d3b338f614a15565b61010a546001600160a01b0316634c09e6e8612d5660355490565b612d608486615e39565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b8152600401612d9d9190615c0d565b600060405180830381600087803b158015612db757600080fd5b505af1158015612dcb573d6000803e3d6000fd5b5050505050505050505050505050826001600160a01b0316336001600160a01b03167f4318b22a7b774533f1c9cd7102530d96faffc18ef44a1ecb56abc9a55d49fd8b86604051612e1e91815260200190565b60405180910390a3600161010f559392505050565b600080516020615f57833981519152612e4c813361347a565b6000612e5661240e565b6101075461010454612e689190615e39565b612e729190615dbb565b60fb54604051639552d81d60e01b81526004810183905291925060009182918291829182916001600160a01b0390911690639552d81d9060240160006040518083038186803b158015612ec457600080fd5b505afa158015612ed8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612f009190810190615777565b9450945094509450945060008060005b86811015612fef57858181518110612f2a57612f2a615f15565b602002602001015160001415612f3f57612fdd565b8484878381518110612f5357612f53615f15565b6020026020010151612f659190615e1a565b612f6f9190615df8565b925082612f7b57612fdd565b878181518110612f8d57612f8d615f15565b60200260200101516000015191506000612fa7838561436a565b905080612fb45750612fdd565b612fdb898381518110612fc957612fc9615f15565b60200260200101516000015185614430565b505b80612fe781615ece565b915050612f10565b50505050505050505050565b600082815260976020526040902060010154613017813361347a565b610d958383613868565b600080600061302f60355490565b9150600061303b613050565b9050613047858261481a565b95929450925050565b60008061305b6120d8565b9050613066816147ea565b91505090565b61010c818154811061307d57600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491935091906001600160a01b031684565b60006130be60c95460ff1690565b156130db5760405162461bcd60e51b8152600401610e1890615cc8565b6130e3613ffa565b600261010f5560408051808201909152600e81526d125b9d985b1a5908185b5bdd5b9d60921b602082015261311b9084151590613962565b61010254613134906001600160a01b0316333086614b63565b600080600061314286612289565b92509250925061317660008411604051806040016040528060098152602001684d696e74205a45524f60b81b815250613962565b6131803384614b9b565b8561010460008282546131939190615dbb565b909155505061010a546001600160a01b0316634c09e6e86131b48585615dbb565b6131be8985615dbb565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b81526004016131fb9190615c0d565b600060405180830381600087803b15801561321557600080fd5b505af1158015613229573d6000803e3d6000fd5b50506040518881526001600160a01b03881692503391507f98d2bc018caf34c71a8f920d9d93d4ed62e9789506b74087b48570c17b28ed999060200160405180910390a35050600161010f559392505050565b600080516020615f57833981519152613295813361347a565b6132de826132a38587615dd3565b6132ad9190615dd3565b60ff166064146040518060400160405280600d81526020016c073756d2866656529213d31303609c1b815250613962565b60fc805460ff86811661ffff1990921682176101008783169081029190911762ff0000191662010000928716928302179093556040805192835260208301939093528183015290517f37322890d66d781059d797be5e2f27dc160a34d8bc0a8e09116cb9a773ce88ef9181900360600190a150505050565b6001600160a01b0383166133b85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610e18565b6001600160a01b0382166134195760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610e18565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b61348482826122b5565b6110495761349c816001600160a01b03166014614c7a565b6134a7836020614c7a565b6040516020016134b8929190615b2b565b60408051601f198184030181529082905262461bcd60e51b8252610e1891600401615c0d565b6001600160a01b0383811660009081526034602090815260408083209386168352929052205460001981146120d2578181101561355d5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610e18565b6120d28484848403613356565b6001600160a01b0383166135ce5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610e18565b6001600160a01b0382166136305760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610e18565b6001600160a01b038316600090815260336020526040902054818110156136a85760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610e18565b6001600160a01b038085166000908152603360205260408082208585039055918516815290812080548492906136df908490615dbb565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161372b91815260200190565b60405180910390a36120d2565b61374282826122b5565b6110495760008281526097602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561377a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600054610100900460ff166137e55760405162461bcd60e51b8152600401610e1890615cf2565b565b600054610100900460ff1661380e5760405162461bcd60e51b8152600401610e1890615cf2565b60c9805460ff19169055565b600054610100900460ff166138415760405162461bcd60e51b8152600401610e1890615cf2565b81516138549060369060208501906153ad565b508051610d959060379060208401906153ad565b61387282826122b5565b156110495760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60c95460ff166139185760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610e18565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b8082610d955760405162461bcd60e51b8152600401610e189190615c0d565b60008181526101096020908152604091829020600281015460fd54845163900cf0cf60e01b8152945192946139de9492936001600160a01b039092169263900cf0cf92600480840193829003018186803b15801561136957600080fd5b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015613a2457600080fd5b505af1158015613a38573d6000803e3d6000fd5b5050506003820154600091506001600160a01b031615613b7f57610102546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015613a9757600080fd5b505afa158015613aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613acf9190615a16565b60038401546001850154919250613af1916001600160a01b0390911690614040565b610102546040516370a0823160e01b815230600482015282916001600160a01b0316906370a082319060240160206040518083038186803b158015613b3557600080fd5b505afa158015613b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b6d9190615a16565b613b779190615e39565b915050613bb9565b81600001549050806101076000828254613b999190615e39565b92505081905550806101046000828254613bb39190615e39565b90915550505b61010254613bd1906001600160a01b0316338361409e565b8083336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd6000604051613c0f91815260200190565b60405180910390a4505050565b600081815261010d6020908152604080832080548251818502810185019093528083529192909190849084015b82821015613ca657600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101613c49565b505050509050613d1c81600081518110613cc257613cc2615f15565b60200260200101516040015160fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561136957600080fd5b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015613d6257600080fd5b505af1158015613d76573d6000803e3d6000fd5b50508251610102546040516370a0823160e01b81523060048201529193506000925082916001600160a01b03909116906370a082319060240160206040518083038186803b158015613dc757600080fd5b505afa158015613ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dff9190615a16565b905060005b83811015613f015760006001600160a01b0316858281518110613e2957613e29615f15565b6020026020010151606001516001600160a01b031614613e8c57613e87858281518110613e5857613e58615f15565b602002602001015160600151868381518110613e7657613e76615f15565b602002602001015160200151614040565b613eef565b6000858281518110613ea057613ea0615f15565b6020026020010151600001519050806101076000828254613ec19190615e39565b92505081905550806101046000828254613edb9190615e39565b90915550613eeb90508185615dbb565b9350505b80613ef981615ece565b915050613e04565b50610102546040516370a0823160e01b815230600482015282916001600160a01b0316906370a082319060240160206040518083038186803b158015613f4657600080fd5b505afa158015613f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f7e9190615a16565b613f889190615e39565b613f929083615dbb565b61010254909250613fad906001600160a01b0316338461409e565b8185336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd6000604051613feb91815260200190565b60405180910390a45050505050565b6137e5600261010f5414156040518060400160405280601f81526020017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815250613962565b6040516374bfeee160e11b8152600481018290526001600160a01b0383169063e97fddc290602401600060405180830381600087803b15801561408257600080fd5b505af1158015614096573d6000803e3d6000fd5b505050505050565b6040516001600160a01b038316602482015260448101829052610d9590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614e16565b60608101516000906001600160a01b031661411b57505190565b600082606001519050600061419f826001600160a01b0316635c5f7dae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561416257600080fd5b505afa158015614176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061419a9190615a16565b614ee8565b90506000826001600160a01b031663bfb18f296040518163ffffffff1660e01b815260040160206040518083038186803b1580156141dc57600080fd5b505afa1580156141f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142149190615a16565b602086015160405163795be58760e01b815230600482015260248101919091529091506000906001600160a01b0385169063795be58790604401604080518083038186803b15801561426557600080fd5b505afa158015614279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061429d91906159c7565b805190915083906142ae9084615e1a565b6142b89190615df8565b9695505050505050565b60c95460ff16156142e55760405162461bcd60e51b8152600401610e1890615cc8565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586139453390565b60008061432660355490565b905080156143345780614337565b60015b905082156143455782614348565b60015b92506000836143578387615e1a565b6143619190615df8565b95945050505050565b60008083905060006143ae826001600160a01b0316635c5f7dae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561416257600080fd5b90506000826001600160a01b0316633ba0b9a96040518163ffffffff1660e01b815260040160206040518083038186803b1580156143eb57600080fd5b505afa1580156143ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144239190615a16565b9050806142ae8387615e1a565b61443d8282600019614f1d565b60408051608081018252600081529051630c11b08160e21b815230600482015261010c919060208201906001600160a01b03861690633046c2049060240160206040518083038186803b15801561449357600080fd5b505afa1580156144a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144cb9190615a16565b815260fd546040805163a7ab696160e01b815290516020938401936001600160a01b039093169263a7ab69619260048082019391829003018186803b15801561451357600080fd5b505afa158015614527573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061454b9190615a16565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561459957600080fd5b505afa1580156145ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145d19190615a16565b6145db9190615dbb565b81526001600160a01b03948516602091820152825460018082018555600094855293829020835160049092020190815590820151928101929092556040810151600283015560600151600390910180546001600160a01b031916919093161790915550565b8015806146c95750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561468f57600080fd5b505afa1580156146a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146c79190615a16565b155b6147345760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610e18565b6040516001600160a01b038316602482015260448101829052610d9590849063095ea7b360e01b906064016140ca565b604051636ab1507160e01b8152600481018390526024810182905260009081906001600160a01b03861690636ab1507190604401602060405180830381600087803b1580156147b257600080fd5b505af11580156147c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143619190615a16565b6000610107546147f861240e565b610104546148069085615dbb565b6148109190615dbb565b610a979190615e39565b60008061482660355490565b905080156148345780614837565b60015b905082156148455782614848565b60015b92506000816143578587615e1a565b6000808584116148675783614869565b855b905060006148778683615df8565b905060005b8681101561491357600089828151811061489857614898615f15565b60200260200101516000015190506148f160006148b5838661436a565b116040518060400160405280601781526020017f5a45524f2073686172657320746f207769746864726177000000000000000000815250613962565b6148fd8b828589614f83565b955050808061490b90615ece565b91505061487c565b509298975050505050505050565b6000805b85811015614a0957600085828151811061494157614941615f15565b60200260200101519050600085828151811061495f5761495f615f15565b6020026020010151905080600014156149795750506149f7565b60008582116149a15786838151811061499457614994615f15565b60200260200101516149a3565b855b905060008a84815181106149b9576149b9615f15565b60200260200101516000015190506149d660006148b5838561436a565b6149e28c82848a614f83565b9650866149f25750505050614a09565b505050505b80614a0181615ece565b915050614925565b50909695505050505050565b6001600160a01b038216614a755760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610e18565b6001600160a01b03821660009081526033602052604090205481811015614ae95760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610e18565b6001600160a01b0383166000908152603360205260408120838303905560358054849290614b18908490615e39565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6040516001600160a01b03808516602483015283166044820152606481018290526120d29085906323b872dd60e01b906084016140ca565b6001600160a01b038216614bf15760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610e18565b8060356000828254614c039190615dbb565b90915550506001600160a01b03821660009081526033602052604081208054839290614c30908490615dbb565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606000614c89836002615e1a565b614c94906002615dbb565b67ffffffffffffffff811115614cac57614cac615f2b565b6040519080825280601f01601f191660200182016040528015614cd6576020820181803683370190505b509050600360fc1b81600081518110614cf157614cf1615f15565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614d2057614d20615f15565b60200101906001600160f81b031916908160001a9053506000614d44846002615e1a565b614d4f906001615dbb565b90505b6001811115614dc7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614d8357614d83615f15565b1a60f81b828281518110614d9957614d99615f15565b60200101906001600160f81b031916908160001a90535060049490941c93614dc081615e7c565b9050614d52565b508315610cca5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610e18565b6000614e6b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166151a89092919063ffffffff16565b805190915015610d955780806020019051810190614e8991906158cb565b610d955760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610e18565b600060088210614f05576c01431e0fae6d7217caa0000000614f08565b60645b6cffffffffffffffffffffffffff1692915050565b60405163c83ec04d60e01b815260048101839052602481018290526001600160a01b0384169063c83ec04d90604401600060405180830381600087803b158015614f6657600080fd5b505af1158015614f7a573d6000803e3d6000fd5b50505050505050565b6000614f928484600019614f1d565b600085815261010d6020908152604080832081516080810183529384529051630c11b08160e21b81523060048201529092918201906001600160a01b03881690633046c2049060240160206040518083038186803b158015614ff357600080fd5b505afa158015615007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061502b9190615a16565b815260fd546040805163a7ab696160e01b815290516020938401936001600160a01b039093169263a7ab69619260048082019391829003018186803b15801561507357600080fd5b505afa158015615087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150ab9190615a16565b60fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156150f957600080fd5b505afa15801561510d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906151319190615a16565b61513b9190615dbb565b81526001600160a01b038781166020928301528354600180820186556000958652948390208451600490920201908155918301519382019390935560408201516002820155606090910151600390910180546001600160a01b031916919092161790556143618383615e39565b60606151b784846000856151bf565b949350505050565b6060824710156152205760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610e18565b6001600160a01b0385163b6152775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610e18565b600080866001600160a01b031685876040516152939190615aff565b60006040518083038185875af1925050503d80600081146152d0576040519150601f19603f3d011682016040523d82523d6000602084013e6152d5565b606091505b50915091506152e58282866152f0565b979650505050505050565b606083156152ff575081610cca565b82511561530f5782518084602001fd5b8160405162461bcd60e51b8152600401610e189190615c0d565b82805461533590615e93565b90600052602060002090601f016020900481019282615357576000855561539d565b82601f106153705782800160ff1982351617855561539d565b8280016001018555821561539d579182015b8281111561539d578235825591602001919060010190615382565b506153a9929150615421565b5090565b8280546153b990615e93565b90600052602060002090601f0160209004810192826153db576000855561539d565b82601f106153f457805160ff191683800117855561539d565b8280016001018555821561539d579182015b8281111561539d578251825591602001919060010190615406565b5b808211156153a95760008155600101615422565b600082601f83011261544757600080fd5b8151602061545c61545783615d97565b615d66565b80838252828201915082860187848660061b890101111561547c57600080fd5b6000805b868110156154d157604080848c031215615498578283fd5b6154a0615d3d565b84516154ab81615f41565b8152848801516154ba81615f41565b818901528652948601949290920191600101615480565b509198975050505050505050565b600082601f8301126154f057600080fd5b8151602061550061545783615d97565b80838252828201915082860187848660051b890101111561552057600080fd5b60005b8581101561553f57815184529284019290840190600101615523565b5090979650505050505050565b803560ff8116811461555d57600080fd5b919050565b60006020828403121561557457600080fd5b8135610cca81615f41565b6000806040838503121561559257600080fd5b823561559d81615f41565b915060208301356155ad81615f41565b809150509250929050565b600080600080600080600060e0888a0312156155d357600080fd5b87356155de81615f41565b965060208801356155ee81615f41565b955060408801356155fe81615f41565b9450606088013561560e81615f41565b9350608088013561561e81615f41565b925060a088013561562e81615f41565b915060c088013561563e81615f41565b8091505092959891949750929550565b60008060006060848603121561566357600080fd5b833561566e81615f41565b9250602084013561567e81615f41565b929592945050506040919091013590565b600080604083850312156156a257600080fd5b82356156ad81615f41565b946020939093013593505050565b600080604083850312156156ce57600080fd5b825167ffffffffffffffff8111156156e557600080fd5b6156f185828601615436565b925050602083015190509250929050565b6000806000806080858703121561571857600080fd5b845167ffffffffffffffff8082111561573057600080fd5b61573c88838901615436565b955060208701519450604087015191508082111561575957600080fd5b50615766878288016154df565b606096909601519497939650505050565b600080600080600060a0868803121561578f57600080fd5b855167ffffffffffffffff808211156157a757600080fd5b6157b389838a01615436565b96506020880151955060408801519150808211156157d057600080fd5b506157dd888289016154df565b606088015160809098015196999598509695949350505050565b600080600080600080600080610100898b03121561581457600080fd5b885167ffffffffffffffff8082111561582c57600080fd5b6158388c838d01615436565b995060208b0151985060408b0151975060608b015191508082111561585c57600080fd5b6158688c838d016154df565b965060808b0151955060a08b015191508082111561588557600080fd5b6158918c838d016154df565b945060c08b01519150808211156158a757600080fd5b506158b48b828c016154df565b92505060e089015190509295985092959890939650565b6000602082840312156158dd57600080fd5b81518015158114610cca57600080fd5b6000602082840312156158ff57600080fd5b5035919050565b6000806040838503121561591957600080fd5b8235915060208301356155ad81615f41565b60006020828403121561593d57600080fd5b81356001600160e01b031981168114610cca57600080fd5b6000806020838503121561596857600080fd5b823567ffffffffffffffff8082111561598057600080fd5b818501915085601f83011261599457600080fd5b8135818111156159a357600080fd5b8660208285010111156159b557600080fd5b60209290920196919550909350505050565b6000604082840312156159d957600080fd5b6040516040810181811067ffffffffffffffff821117156159fc576159fc615f2b565b604052825181526020928301519281019290925250919050565b600060208284031215615a2857600080fd5b5051919050565b60008060408385031215615a4257600080fd5b50508035926020909101359150565b60008060408385031215615a6457600080fd5b505080516020909101519092909150565b600060208284031215615a8757600080fd5b610cca8261554c565b600080600060608486031215615aa557600080fd5b615aae8461554c565b9250615abc6020850161554c565b9150615aca6040850161554c565b90509250925092565b60008151808452615aeb816020860160208601615e50565b601f01601f19169290920160200192915050565b60008251615b11818460208701615e50565b9190910192915050565b8183823760009101908152919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615b63816017850160208801615e50565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615b94816028840160208801615e50565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b82811015615c0057815180518552868101518786015285810151868601526060908101516001600160a01b03169085015260809093019290850190600101615bbd565b5091979650505050505050565b602081526000610cca6020830184615ad3565b600060208083526000845481600182811c915080831680615c4257607f831692505b858310811415615c6057634e487b7160e01b85526022600452602485fd5b878601838152602001818015615c7d5760018114615c8e57615cb9565b60ff19861682528782019650615cb9565b60008b81526020902060005b86811015615cb357815484820152908501908901615c9a565b83019750505b50949998505050505050505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6040805190810167ffffffffffffffff81118282101715615d6057615d60615f2b565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715615d8f57615d8f615f2b565b604052919050565b600067ffffffffffffffff821115615db157615db1615f2b565b5060051b60200190565b60008219821115615dce57615dce615ee9565b500190565b600060ff821660ff84168060ff03821115615df057615df0615ee9565b019392505050565b600082615e1557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615615e3457615e34615ee9565b500290565b600082821015615e4b57615e4b615ee9565b500390565b60005b83811015615e6b578181015183820152602001615e53565b838111156120d25750506000910152565b600081615e8b57615e8b615ee9565b506000190190565b600181811c90821680615ea757607f821691505b60208210811415615ec857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415615ee257615ee2615ee9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461111757600080fdfed0a4ad96d49edb1c33461cebc6fb2609190f32c904e3c3f5877edb4488dee91e416d6f756e7420746f2064697374726962757465206c6f776572207468616e206d696e696d756d416d6f756e7420746f2064656c6567617465206c6f776572207468616e206d696e696d756da2646970667358221220ef4992c6d6bbc520a2738d94de9da5ac35248bdd9ffda1fd56055b17d660e8e964736f6c63430008070033
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.