Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
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 nodeOperatorRegistry; /// @notice The fee distribution. FeeDistribution public override entityFees; /// @notice StakeManager interface. IStakeManager public override stakeManager; /// @notice LidoNFT interface. IPoLidoNFT public override poLidoNFT; /// @notice fxStateRootTunnel interface. IFxStateRootTunnel public override fxStateRootTunnel; /// @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; /// @notice submit threshold NOT USED in V2. uint256 public override submitThreshold; /// @notice submit handler NOT USED in V2. bool public override submitHandler; /// @notice token to WithdrawRequest mapping one-to-one. mapping(uint256 => RequestWithdraw) public override token2WithdrawRequest; /// @notice DAO Role. bytes32 public constant override DAO = keccak256("DAO"); bytes32 public constant override PAUSE_ROLE = keccak256("LIDO_PAUSE_OPERATOR"); bytes32 public constant override UNPAUSE_ROLE = keccak256("LIDO_UNPAUSE_OPERATOR"); /// @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; /// @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 used to execute the recovery 1 time bool private recovered; /// @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); nodeOperatorRegistry = 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; _bridge(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; { uint256 totalPooledMatic = getTotalPooledMatic(); uint256 totalAmount2WithdrawInMatic = _convertStMaticToMatic( _amount, totalPooledMatic ); _require(totalAmount2WithdrawInMatic > 0, "Withdraw ZERO Matic"); ( INodeOperatorRegistry.ValidatorData[] memory activeNodeOperators, uint256 totalDelegated, uint256[] memory bigNodeOperatorIds, uint256[] memory smallNodeOperatorIds, uint256[] memory allowedAmountToRequestFromOperators, uint256 totalValidatorsToWithdrawFrom ) = nodeOperatorRegistry.getValidatorsRequestWithdraw(totalAmount2WithdrawInMatic); { uint256 totalBufferedMem = totalBuffered; uint256 reservedFundsMem = reservedFunds; uint256 localActiveBalance = totalBufferedMem > reservedFundsMem ? totalBufferedMem - reservedFundsMem : 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, bigNodeOperatorIds, allowedAmountToRequestFromOperators, currentAmount2WithdrawInMatic ); // request withdraw from small delegated validators if (currentAmount2WithdrawInMatic != 0) { currentAmount2WithdrawInMatic = _requestWithdrawUnbalanced( tokenId, activeNodeOperators, smallNodeOperatorIds, allowedAmountToRequestFromOperators, currentAmount2WithdrawInMatic ); } } } if (totalAmount2WithdrawInMatic > totalDelegated) { IStakeManager stakeManagerMem = stakeManager; token2WithdrawRequests[tokenId].push( RequestWithdraw( currentAmount2WithdrawInMatic, 0, stakeManagerMem.epoch() + stakeManagerMem.withdrawalDelay(), address(0) ) ); reservedFunds += currentAmount2WithdrawInMatic; currentAmount2WithdrawInMatic = 0; } } _burn(msg.sender, _amount); _bridge(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 = min(totalDelegated, totalAmount2WithdrawInMatic); 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[] memory nodeOperatorIds, uint256[] memory allowedAmountToRequestFromOperators, uint256 currentAmount2WithdrawInMatic ) private returns (uint256) { for (uint256 idx = 0; idx < nodeOperatorIds.length; idx++) { uint256 id = nodeOperatorIds[idx]; uint256 amountCanBeRequested = allowedAmountToRequestFromOperators[ id ]; if (amountCanBeRequested == 0) continue; uint256 amount2WithdrawFromValidator = min(amountCanBeRequested, currentAmount2WithdrawInMatic); 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 ); IStakeManager stakeManagerMem = stakeManager; token2WithdrawRequests[tokenId].push( RequestWithdraw( 0, IValidatorShare(validatorShare).unbondNonces(address(this)), stakeManagerMem.epoch() + stakeManagerMem.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[] memory operatorRatiosToDelegate, uint256 totalRatio ) = nodeOperatorRegistry.getValidatorsDelegationAmount( amountToDelegate ); uint256 totalDelegatableNodeOperators = delegatableNodeOperators.length; uint256 remainder; uint256 amountDelegated; address maticTokenAddress = token; address stakeManagerAddress = address(stakeManager); IERC20Upgradeable(maticTokenAddress).safeApprove(stakeManagerAddress, 0); IERC20Upgradeable(maticTokenAddress).safeApprove( stakeManagerAddress, amountToDelegate ); // If the total Ratio is equal to ZERO that means the system is balanced so we // distribute the buffered tokens equally between the validators uint256 amountToDelegatePerOperator = amountToDelegate / totalDelegatableNodeOperators; for (uint256 i = 0; i < totalDelegatableNodeOperators; i++) { if (totalRatio != 0) { if (operatorRatiosToDelegate[i] == 0) continue; amountToDelegatePerOperator = (operatorRatiosToDelegate[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].requestEpoch != 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].requestEpoch, "Not able to claim yet" ); poLidoNFT.burn(_tokenId); delete token2WithdrawRequests[_tokenId]; uint256 length = usersRequest.length; uint256 amountToClaim; address maticTokenAddress = token; uint256 balanceBeforeClaim = IERC20Upgradeable(maticTokenAddress).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(maticTokenAddress).balanceOf(address(this)) - balanceBeforeClaim; IERC20Upgradeable(maticTokenAddress).safeTransfer(msg.sender, amountToClaim); emit ClaimTokensEvent(msg.sender, _tokenId, amountToClaim, 0); } /// @notice Claims tokens v1 function _claimTokensV1(uint256 _tokenId) private { RequestWithdraw memory usersRequest = token2WithdrawRequest[_tokenId]; _require( stakeManager.epoch() >= usersRequest.requestEpoch, "Not able to claim yet" ); poLidoNFT.burn(_tokenId); delete token2WithdrawRequest[_tokenId]; uint256 amountToClaim; address maticTokenAddress = token; if (usersRequest.validatorAddress != address(0)) { uint256 balanceBeforeClaim = IERC20Upgradeable(maticTokenAddress).balanceOf( address(this) ); unstakeClaimTokens_new( usersRequest.validatorAddress, usersRequest.validatorNonce ); amountToClaim = IERC20Upgradeable(maticTokenAddress).balanceOf(address(this)) - balanceBeforeClaim; } else { amountToClaim = usersRequest.amount2WithdrawFromStMATIC; reservedFunds -= amountToClaim; totalBuffered -= amountToClaim; } IERC20Upgradeable(maticTokenAddress).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 = nodeOperatorRegistry.listDelegatedNodeOperators(); uint256 totalActiveOperatorInfos = operatorInfos.length; 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(); } } address maticTokenAddress = token; uint256 totalRewards = IERC20Upgradeable(maticTokenAddress).balanceOf( address(this) ) - totalBuffered; uint256 protocolRewards = totalRewards * protocolFee / 100; _require( protocolRewards > rewardDistributionLowerBound, "Amount to distribute lower than minimum" ); uint256 balanceBeforeDistribution = IERC20Upgradeable(maticTokenAddress).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(maticTokenAddress).safeTransfer(dao, daoRewards); IERC20Upgradeable(maticTokenAddress).safeTransfer(insurance, insuranceRewards); for (uint256 i = 0; i < totalActiveOperatorInfos; i++) { IERC20Upgradeable(maticTokenAddress).safeTransfer( operatorInfos[i].rewardAddress, operatorReward ); } uint256 currentBalance = IERC20Upgradeable(maticTokenAddress).balanceOf( address(this) ); uint256 totalDistributed = balanceBeforeDistribution - currentBalance; // Add the remainder to totalBuffered totalBuffered = currentBalance; _bridge(totalSupply(), getTotalPooledMatic()); 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(nodeOperatorRegistry), "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[] memory operatorRatiosToRebalance, uint256 totalRatio, uint256 totalToWithdraw ) = nodeOperatorRegistry.getValidatorsRebalanceAmount( amountToReDelegate ); uint256 amountToWithdraw; address _validatorAddress; for (uint256 i = 0; i < nodeOperators.length; i++) { if (operatorRatiosToRebalance[i] == 0) continue; amountToWithdraw = (operatorRatiosToRebalance[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); IStakeManager stakeManagerMem = stakeManager; stMaticWithdrawRequest.push( RequestWithdraw( 0, IValidatorShare(_validatorShare).unbondNonces(address(this)), stakeManagerMem.epoch() + stakeManagerMem.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.requestEpoch, "Not able to claim yet" ); address maticTokenAddress = token; uint256 balanceBeforeClaim = IERC20Upgradeable(maticTokenAddress).balanceOf( address(this) ); unstakeClaimTokens_new( lidoRequest.validatorAddress, lidoRequest.validatorNonce ); uint256 claimedAmount = IERC20Upgradeable(maticTokenAddress).balanceOf( address(this) ) - balanceBeforeClaim; totalBuffered += claimedAmount; if (_index != length - 1 && length != 1) { stMaticWithdrawRequest[_index] = stMaticWithdrawRequest[length - 1]; } stMaticWithdrawRequest.pop(); _bridge(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 = nodeOperatorRegistry.listWithdrawNodeOperators(); for (uint256 i = 0; i < nodeOperators.length; 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) { nodeOperatorRegistry = 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].requestEpoch != 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; } /// @dev call fxStateRootTunnel to update L2. function _bridge(uint256 _totalSupply, uint256 _totalPooledMatic) private { fxStateRootTunnel.sendMessageToChild(abi.encode(_totalSupply, _totalPooledMatic)); } function min(uint256 _valueA, uint256 _valueB) private pure returns(uint256) { return _valueA > _valueB ? _valueB : _valueA; } }
// 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. function listDelegatedNodeOperators() external view returns (ValidatorData[] memory); /// @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. function listWithdrawNodeOperators() external view returns (ValidatorData[] memory); /// @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 operatorRatiosToDelegate a list of operator's ratio used to calculate the amount to delegate per node. /// @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[] memory operatorRatiosToDelegate, 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 operatorRatiosToRebalance a list of operator's ratio used to calculate the amount to withdraw per node. /// @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[] memory operatorRatiosToRebalance, 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 bigNodeOperatorIds stores the ids of node operators that amount delegated to it is greater than the average delegation. /// @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[] memory bigNodeOperatorIds, 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 requestEpoch request epoch. /// @param validatorAddress validator share address. struct RequestWithdraw { uint256 amount2WithdrawFromStMATIC; uint256 validatorNonce; uint256 requestEpoch; 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 nodeOperatorRegistry() 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": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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":"requestEpoch","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":"requestEpoch","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":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nodeOperatorRegistry","outputs":[{"internalType":"contract INodeOperatorRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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":"requestEpoch","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":"requestEpoch","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":"requestEpoch","type":"uint256"},{"internalType":"address","name":"validatorAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBuffered","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"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
608060405234801561001057600080fd5b50615eaa80620000216000396000f3fe608060405234801561001057600080fd5b50600436106104335760003560e01c80637682c90211610236578063b0e21e8a1161013b578063dd62ed3e116100c3578063f08711fe11610087578063f08711fe146109bd578063f1a13fce146109fc578063f532e86a14610a0f578063f6794fdb14610a22578063fc0c546a14610a3557600080fd5b8063dd62ed3e14610948578063e00222a014610981578063e062b10b14610989578063e259faf71461099c578063e8f8708f146109aa57600080fd5b8063c89e43611161010a578063c89e4361146108ff578063ccc143b814610907578063d280f14f1461091a578063d547741f14610922578063d968447c1461093557600080fd5b8063b0e21e8a1461088f578063bb208f551461089d578063c697d2c7146108b0578063c75e7832146108ec57600080fd5b806395d89b41116101be578063a217fddf1161018d578063a217fddf1461084f578063a245294714610857578063a457c2d714610861578063a9059cbb14610874578063afd290a71461088757600080fd5b806395d89b41146107db578063964a7596146107e357806398fabd3a146108275780639a3cac6a1461083c57600080fd5b8063893818a311610205578063893818a31461077457806389cf32041461077e578063916b9eba14610792578063917a52f51461079a57806391d14854146107c857600080fd5b80637682c9021461073e578063788bc78c146107515780637e978af8146107645780638456cb591461076c57600080fd5b80633b573c4a1161033c5780635c975abb116102c457806370a082311161029357806370a08231146106d257806370bf9fe9146106fb57806371975a3e1461070e578063720bcf1d146107185780637542ff951461072b57600080fd5b80635c975abb14610699578063676e5550146106a45780636f4a2cd0146106b75780637029c90e146106bf57600080fd5b80634cfeb8621161030b5780634cfeb862146106575780634e91f8111461066a578063509c5df61461067d57806352349b171461068757806354fd4d501461069157600080fd5b80633b573c4a146105fd5780633f4ba83a146106105780634162169f1461061857806346e04a2f1461064457600080fd5b8063248a9ca3116103bf578063313ce5671161038e578063313ce56714610588578063358764761461059d57806336568abe146105b0578063389ed267146105c357806339509351146105ea57600080fd5b8063248a9ca31461050b578063253d17351461052e5780632f2ff15d1461054e578063309756fb1461056157600080fd5b80630f2b2639116104065780630f2b2639146104a057806315539d3f146104b557806318160ddd146104c85780631e7ff8f6146104d057806323b872dd146104f857600080fd5b806301ffc9a71461043857806306fdde0314610460578063095ea7b3146104755780630d7abc3314610488575b600080fd5b61044b6104463660046157e3565b610a49565b60405190151581526020015b60405180910390f35b610468610a80565b6040516104579190615ac5565b61044b610483366004615582565b610b12565b6104926101065481565b604051908152602001610457565b6104b36104ae366004615455565b610b2a565b005b6104b36104c3366004615455565b610b8e565b603554610492565b6104e36104de366004615455565b610c0a565b60408051928352602083019190915201610457565b61044b610506366004615541565b610c8e565b6104926105193660046157a5565b60009081526097602052604090206001015490565b61054161053c3660046157a5565b610cb4565b6040516104579190615a58565b6104b361055c3660046157be565b610d52565b6104927f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2281565b60125b60405160ff9091168152602001610457565b6104b36105ab3660046154ab565b610d7d565b6104b36105be3660046157be565b610fb1565b6104927ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1481565b61044b6105f8366004615582565b61102f565b6104b361060b3660046157a5565b61106e565b6104b36110c6565b6101015461062c906001600160a01b031681565b6040516001600160a01b039091168152602001610457565b6104b36106523660046157a5565b6110fc565b6104b36106653660046157a5565b611247565b6104b361067836600461592d565b61164a565b6104926101085481565b6104926101055481565b6104686116fd565b60c95460ff1661044b565b6104926106b2366004615455565b61178c565b6104b3611806565b60fe5461062c906001600160a01b031681565b6104926106e0366004615455565b6001600160a01b031660009081526033602052604090205490565b6104b3610709366004615455565b611d94565b6104926101045481565b6104926107263660046157a5565b611e07565b60fd5461062c906001600160a01b031681565b6104b361074c3660046157a5565b611f79565b6104b361075f36600461580d565b611fc7565b610492612044565b6104b3612134565b6104926101095481565b6101025461062c906001600160a01b031681565b610541612167565b6107ad6107a83660046157a5565b6121f2565b60408051938452602084019290925290820152606001610457565b61044b6107d63660046157be565b61221e565b610468612249565b60fc546108039060ff808216916101008104821691620100009091041683565b6040805160ff94851681529284166020840152921691810191909152606001610457565b610492600080516020615e0983398151915281565b6104b361084a366004615455565b612258565b610492600081565b6104926101075481565b61044b61086f366004615582565b6122cc565b61044b610882366004615582565b612369565b610492612377565b61010e5461058b9060ff1681565b6104b36108ab366004615455565b612411565b6108c36108be3660046158e7565b612476565b604080519485526020850193909352918301526001600160a01b03166060820152608001610457565b6104b36108fa366004615455565b6124c6565b6104b361258a565b6104926109153660046157be565b61280f565b6104b3612ce7565b6104b36109303660046157be565b612ea9565b6107ad6109433660046157a5565b612ecf565b610492610956366004615472565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b610492612efe565b60ff5461062c906001600160a01b031681565b61010a5461044b9060ff1681565b60fb5461062c906001600160a01b031681565b6108c36109cb3660046157a5565b61010b602052600090815260409020805460018201546002830154600390930154919290916001600160a01b031684565b6108c3610a0a3660046157a5565b612f1a565b610492610a1d3660046157be565b612f5e565b6104b3610a30366004615948565b6130ad565b6101035461062c906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b1480610a7a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060368054610a8f90615d4b565b80601f0160208091040260200160405190810160405280929190818152602001828054610abb90615d4b565b8015610b085780601f10610add57610100808354040283529160200191610b08565b820191906000526020600020905b815481529060010190602001808311610aeb57829003601f168201915b5050505050905090565b600033610b20818585613187565b5060019392505050565b600080516020615e09833981519152610b4381336132ab565b60fb80546001600160a01b0319166001600160a01b0384169081179091556040517fb8e1a40638c48c0ebe9679e0b5b032f2066cf44139d775cc09c945b5df070c4e90600090a25050565b600080516020615e09833981519152610ba781336132ab565b60fe80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f3879f4996438c287cec42ea09f698215be51d075ec446a9f5bc83c98ccc1910191015b60405180910390a1505050565b604051630f3ffc7b60e11b815230600482015260009081906001600160a01b03841690631e7ff8f690602401604080518083038186803b158015610c4d57600080fd5b505afa158015610c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c859190615909565b91509150915091565b600033610c9c85828561330f565b610ca785858561339b565b60019150505b9392505050565b606061010d6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015610d4757600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101610cea565b505050509050919050565b600082815260976020526040902060010154610d6e81336132ab565b610d788383613569565b505050565b600054610100900460ff16610d985760005460ff1615610d9c565b303b155b610e045760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b600054610100900460ff16158015610e26576000805461ffff19166101011790555b610e2e6135ef565b610e36613618565b610e836040518060400160405280600c81526020016b5374616b6564204d4154494360a01b8152506040518060400160405280600781526020016673744d4154494360c81b81525061364b565b610e8e600033613569565b610ea6600080516020615e0983398151915287613569565b610ed07ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1433613569565b610efa7f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2287613569565b60fb80546001600160a01b03199081166001600160a01b038b81169190911790925560fd8054821687841617905560fe8054821686841617905560ff8054821685841617905561010180548216898416179055610103805482168a841617905561010280549091169187169190911790556040805160608101825260198082526032602083015291015260fc805462ffffff1916621932191790558015610fa7576000805461ff00191690555b5050505050505050565b6001600160a01b03811633146110215760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610dfb565b61102b8282613699565b5050565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190610b209082908690611069908790615c73565b613187565b600080516020615e0983398151915261108781336132ab565b61010780549083905560408051828152602081018590527fbf99ce7c5a72f4c7135bb72a36193d147a37a54bfcf63ec29505b5e6d5e2921d9101610bfd565b7f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc226110f181336132ab565b6110f9613700565b50565b60c95460ff161561111f5760405162461bcd60e51b8152600401610dfb90615b80565b60fe5460405163430c208160e01b8152336004820152602481018390526111ca916001600160a01b03169063430c20819060440160206040518083038186803b15801561116b57600080fd5b505afa15801561117f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a39190615783565b604051806040016040528060098152602001682737ba1037bbb732b960b91b815250613793565b600081815261010b6020526040902060020154156111eb576110f9816137b2565b600081815261010d602052604090205415611209576110f981613a98565b60405162461bcd60e51b815260206004820152601360248201527224b73b30b634b21031b630b4b6903a37b5b2b760691b6044820152606401610dfb565b60c95460ff161561126a5760405162461bcd60e51b8152600401610dfb90615b80565b611272613e86565b600261010f5561010c5460408051808201909152600d81526c0d2dcecc2d8d2c840d2dcc8caf609b1b60208201526112ad9082841090613793565b600061010c83815481106112c3576112c3615dc7565b60009182526020918290206040805160808101825260049384029092018054835260018101548386015260028101548383018190526003909101546001600160a01b03908116606085015260fd54835163900cf0cf60e01b815293519497506113b896929591169363900cf0cf93808301939290829003018186803b15801561134b57600080fd5b505afa15801561135f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138391906158ce565b101560405180604001604052806015815260200174139bdd0818589b19481d1bc818db185a5b481e595d605a1b815250613793565b610103546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a082319060240160206040518083038186803b15801561140157600080fd5b505afa158015611415573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143991906158ce565b905061144d83606001518460200151613ecc565b6040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b15801561149157600080fd5b505afa1580156114a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c991906158ce565b6114d39190615cf1565b90508061010560008282546114e89190615c73565b909155506114f99050600186615cf1565b8614158015611509575084600114155b1561159d5761010c61151c600187615cf1565b8154811061152c5761152c615dc7565b906000526020600020906004020161010c878154811061154e5761154e615dc7565b6000918252602090912082546004909202019081556001808301549082015560028083015490820155600391820154910180546001600160a01b0319166001600160a01b039092169190911790555b61010c8054806115af576115af615db1565b60008281526020812060046000199093019283020181815560018101829055600281019190915560030180546001600160a01b031916905590556116026115f560355490565b6115fd612efe565b613f2b565b606084015160405182916001600160a01b0316907f4c42a3bec298a4d82d41b7a540d8ebc22d91ee8a61459bce23849ff470d31dea90600090a35050600161010f5550505050565b600080516020615e0983398151915261166381336132ab565b6116ae60008360ff1611801561167d575060648360ff1611155b60405180604001604052806013815260200172496e76616c69642070726f74636f6c2066656560681b815250613793565b61010e805460ff84811660ff1983168117909355604080519190921680825260208201939093527f6b1719571aee7af62357ac4d4c98cc35155a52a5fcf0c09198874443c0fe430d9101610bfd565b610100805461170b90615d4b565b80601f016020809104026020016040519081016040528092919081815260200182805461173790615d4b565b80156117845780601f1061175957610100808354040283529160200191611784565b820191906000526020600020905b81548152906001019060200180831161176757829003601f168201915b505050505081565b604051630676e55560e41b81523060048201526000906001600160a01b0383169063676e55509060240160206040518083038186803b1580156117ce57600080fd5b505afa1580156117e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7a91906158ce565b60c95460ff16156118295760405162461bcd60e51b8152600401610dfb90615b80565b611831613e86565b600261010f5560fb546040805163a335385960e01b815290516000926001600160a01b03169163a33538599160048083019286929190829003018186803b15801561187b57600080fd5b505afa15801561188f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118b791908101906155ae565b805190915060005b81811015611a4d5760008382815181106118db576118db615dc7565b602090810291909101015151604051630676e55560e41b81523060048201529091506000906001600160a01b0383169063676e55509060240160206040518083038186803b15801561192c57600080fd5b505afa158015611940573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196491906158ce565b90506000826001600160a01b0316639b2cb5d86040518163ffffffff1660e01b815260040160206040518083038186803b1580156119a157600080fd5b505afa1580156119b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d991906158ce565b905080821115611a3757826001600160a01b031663c7b8981c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611a1e57600080fd5b505af1158015611a32573d6000803e3d6000fd5b505050505b5050508080611a4590615d80565b9150506118bf565b5061010354610105546040516370a0823160e01b81523060048201526001600160a01b03909216916000919083906370a082319060240160206040518083038186803b158015611a9c57600080fd5b505afa158015611ab0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad491906158ce565b611ade9190615cf1565b61010e54909150600090606490611af89060ff1684615cd2565b611b029190615cb0565b9050611b2b610107548211604051806060016040528060278152602001615e2960279139613793565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b158015611b6d57600080fd5b505afa158015611b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba591906158ce565b60fc54909150600090606490611bbe9060ff1685615cd2565b611bc89190615cb0565b60fc54909150600090606490611be79062010000900460ff1686615cd2565b611bf19190615cb0565b60fc54909150600090606490611c0f90610100900460ff1687615cd2565b611c199190615cb0565b90506000611c278983615cb0565b61010154909150611c45906001600160a01b038a8116911686613f79565b61010254611c60906001600160a01b038a8116911685613f79565b60005b89811015611cb857611ca68b8281518110611c8057611c80615dc7565b602002602001015160200151838b6001600160a01b0316613f799092919063ffffffff16565b80611cb081615d80565b915050611c63565b506040516370a0823160e01b81523060048201526000906001600160a01b038a16906370a082319060240160206040518083038186803b158015611cfb57600080fd5b505afa158015611d0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3391906158ce565b90506000611d418288615cf1565b6101058390559050611d556115f560355490565b60405181907f4e3c6a1e602996ae70905ac6165ed2434753246e3bfa52b6ca6852b40e2d440890600090a25050600161010f5550505050505050505050565b600080516020615e09833981519152611dad81336132ab565b60ff80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f8f8196a0718fc814ab20b90fdc8c2024046578345148e1b903b20667f693a6ba9101610bfd565b600081815261010b602052604081206002015415611e7357600082815261010b60209081526040918290208251608081018452815481526001820154928101929092526002810154928201929092526003909101546001600160a01b03166060820152610a7a90613fdc565b600082815261010d602052604090205415611f7157600082815261010d6020908152604080832080548251818502810185019093528083529192909190849084015b82821015611f1257600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101611eb5565b505050509050600080600090505b8251811015611f6957611f4b838281518110611f3e57611f3e615dc7565b6020026020010151613fdc565b611f559083615c73565b915080611f6181615d80565b915050611f20565b509392505050565b506000919050565b600080516020615e09833981519152611f9281336132ab565b61010682905560405182907f1cabc2f7b706218bb8613769cd658789cd6f1860310413b841020a2c7b7a0e3290600090a25050565b600080516020615e09833981519152611fe081336132ab565b8282604051611ff09291906159d3565b60405180910390207fa22d531a51c0ad90c971d36d779910f19a3b85d5e5005072f84700bd68b6f0c56101006040516120299190615ad8565b60405180910390a261203e61010084846151c7565b50505050565b600080600060fb60009054906101000a90046001600160a01b03166001600160a01b0316630926efe46040518163ffffffff1660e01b815260040160006040518083038186803b15801561209757600080fd5b505afa1580156120ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120d391908101906155ae565b905060005b815181101561212c5760006121098383815181106120f8576120f8615dc7565b602002602001015160000151610c0a565b5090506121168185615c73565b935050808061212490615d80565b9150506120d8565b509092915050565b7ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1461215f81336132ab565b6110f961419d565b606061010c805480602002602001604051908101604052809291908181526020016000905b828210156121e957600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b03166060830152908352909201910161218c565b50505050905090565b600080600061220060355490565b915061220a612efe565b905061221684826141f5565b949193509150565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060378054610a8f90615d4b565b600080516020615e0983398151915261227181336132ab565b61010180546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f3b8dbc80bf27331221431f1c8b2c6fe358eadfdb3c3d7085e6a2521eeb775b079101610bfd565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156123515760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610dfb565b61235e8286868403613187565b506001949350505050565b600033610b2081858561339b565b61010c54600090815b8181101561240c576123ee61010c828154811061239f5761239f615dc7565b6000918252602091829020604080516080810182526004909302909101805483526001810154938301939093526002830154908201526003909101546001600160a01b03166060820152613fdc565b6123f89084615c73565b92508061240481615d80565b915050612380565b505090565b600080516020615e0983398151915261242a81336132ab565b61010280546001600160a01b0319166001600160a01b0384169081179091556040517f4029fa39dede0b39dd254005137e18c9116d6b2620b2037632c09bf89404c6d790600090a25050565b61010d602052816000526040600020818154811061249357600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491945092506001600160a01b031684565b6124ce613e86565b600261010f5560fb546040805180820190915260138152722737ba1030903737b2329037b832b930ba37b960691b6020820152612516916001600160a01b0316331490613793565b600061252182610c0a565b50905060006125308383614245565b90508061253e575050612581565b612548838361430b565b60405182906001600160a01b038516907f65fcdf1cdc99352d178d6d953d52e01307cde7a592027b09c9e1d9ac8eb09ab790600090a350505b50600161010f55565b60c95460ff16156125ad5760405162461bcd60e51b8152600401610dfb90615b80565b6125b5613e86565b600261010f556101055461010854610106546125f6906125d6908390615c73565b8311604051806060016040528060258152602001615e5060259139613793565b60006126028284615cf1565b60fb54604051637202ba3760e11b815260048101839052919250600091829182916001600160a01b039091169063e405746e9060240160006040518083038186803b15801561265057600080fd5b505afa158015612664573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261268c91908101906155e3565b82516101035460fd549497509295509093509160009182916001600160a01b0391821691166126bc828285614504565b6126d06001600160a01b038316828b614504565b60006126dc868b615cb0565b905060005b868110156127b35787156127495788818151811061270157612701615dc7565b602002602001015160001415612716576127a1565b878b8a838151811061272a5761272a615dc7565b602002602001015161273c9190615cd2565b6127469190615cb0565b91505b60008a828151811061275d5761275d615dc7565b602002602001015160000151905060006127778285614245565b9050806127855750506127a1565b61279182856000614628565b5061279c8488615c73565b965050505b806127ab81615d80565b9150506126e1565b506127be848b615cf1565b94506127ca8b86615c73565b61010555604051859085907f421adba60af7a6b11679e2ac133b1bc91d3de91d56866ec19703d9d60cf950c890600090a35050600161010f5550505050505050505050565b600061281d60c95460ff1690565b1561283a5760405162461bcd60e51b8152600401610dfb90615b80565b612842613e86565b600261010f5561289583158015906128695750336000908152603360205260409020548411155b6040518060400160405280600e81526020016d125b9d985b1a5908185b5bdd5b9d60921b815250613793565b6000806128a0612efe565b905060006128ae86836146ae565b90506128e860008211604051806040016040528060138152602001725769746864726177205a45524f204d6174696360681b815250613793565b60fb546040516308b16df560e21b815260048101839052600091829182918291829182916001600160a01b03909116906322c5b7d49060240160006040518083038186803b15801561293957600080fd5b505afa15801561294d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261297591908101906156c4565b6101055461010854969c50949a509298509096509450925090600081831161299e5760006129a8565b6129a88284615cf1565b905060006129b6828a615c73565b90506129f18b82101560405180604001604052806014815260200173546f6f206d75636820746f20776974686472617760601b815250613793565b505060fe546040516335313c2160e11b81523360048201528a93506001600160a01b039091169150636a62784290602401602060405180830381600087803b158015612a3c57600080fd5b505af1158015612a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7491906158ce565b99508515612abc578115612a9757612a908a888a858a866146eb565b9050612abc565b612aa48a888786856147b0565b90508015612abc57612ab98a888686856147b0565b90505b85881115612c645760fd5460008b815261010d60209081526040808320815160808101835286815280840194909452815163a7ab696160e01b815282516001600160a01b039096169591949392840192869263a7ab6961926004808201939291829003018186803b158015612b3057600080fd5b505afa158015612b44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6891906158ce565b846001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015612ba157600080fd5b505afa158015612bb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd991906158ce565b612be39190615c73565b8152600060209182018190528354600180820186559482528282208451600490920201908155918301519382019390935560408201516002820155606090910151600390910180546001600160a01b0319166001600160a01b039092169190911790556101088054849290612c59908490615c73565b909155506000925050505b50612c6f338d614886565b612c85612c7b60355490565b6115fd898b615cf1565b5050505050505050826001600160a01b0316336001600160a01b03167f4318b22a7b774533f1c9cd7102530d96faffc18ef44a1ecb56abc9a55d49fd8b86604051612cd291815260200190565b60405180910390a3600161010f559392505050565b600080516020615e09833981519152612d0081336132ab565b6000612d0a612377565b6101085461010554612d1c9190615cf1565b612d269190615c73565b60fb54604051639552d81d60e01b8152600481018390529192506000918291829182916001600160a01b031690639552d81d9060240160006040518083038186803b158015612d7457600080fd5b505afa158015612d88573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612db09190810190615650565b935093509350935060008060005b8651811015612e9e57858181518110612dd957612dd9615dc7565b602002602001015160001415612dee57612e8c565b8484878381518110612e0257612e02615dc7565b6020026020010151612e149190615cd2565b612e1e9190615cb0565b925082612e2a57612e8c565b868181518110612e3c57612e3c615dc7565b60200260200101516000015191506000612e568385614245565b905080612e635750612e8c565b612e8a888381518110612e7857612e78615dc7565b6020026020010151600001518561430b565b505b80612e9681615d80565b915050612dbe565b505050505050505050565b600082815260976020526040902060010154612ec581336132ab565b610d788383613699565b6000806000612edd60355490565b91506000612ee9612efe565b9050612ef585826146ae565b95929450925050565b600080612f09612044565b9050612f14816149d4565b91505090565b61010c8181548110612f2b57600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491935091906001600160a01b031684565b6000612f6c60c95460ff1690565b15612f895760405162461bcd60e51b8152600401610dfb90615b80565b612f91613e86565b600261010f5560408051808201909152600e81526d125b9d985b1a5908185b5bdd5b9d60921b6020820152612fc99084151590613793565b61010354612fe2906001600160a01b0316333086614a04565b6000806000612ff0866121f2565b92509250925061302460008411604051806040016040528060098152602001684d696e74205a45524f60b81b815250613793565b61302e3384614a3c565b8561010560008282546130419190615c73565b9091555061305e90506130548484615c73565b6115fd8884615c73565b6040518681526001600160a01b0386169033907f98d2bc018caf34c71a8f920d9d93d4ed62e9789506b74087b48570c17b28ed999060200160405180910390a35050600161010f559392505050565b600080516020615e098339815191526130c681336132ab565b61310f826130d48587615c8b565b6130de9190615c8b565b60ff166064146040518060400160405280600d81526020016c073756d2866656529213d31303609c1b815250613793565b60fc805460ff86811661ffff1990921682176101008783169081029190911762ff0000191662010000928716928302179093556040805192835260208301939093528183015290517f37322890d66d781059d797be5e2f27dc160a34d8bc0a8e09116cb9a773ce88ef9181900360600190a150505050565b6001600160a01b0383166131e95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610dfb565b6001600160a01b03821661324a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610dfb565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6132b5828261221e565b61102b576132cd816001600160a01b03166014614b1b565b6132d8836020614b1b565b6040516020016132e99291906159e3565b60408051601f198184030181529082905262461bcd60e51b8252610dfb91600401615ac5565b6001600160a01b03838116600090815260346020908152604080832093861683529290522054600019811461203e578181101561338e5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610dfb565b61203e8484848403613187565b6001600160a01b0383166133ff5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610dfb565b6001600160a01b0382166134615760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610dfb565b6001600160a01b038316600090815260336020526040902054818110156134d95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610dfb565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290613510908490615c73565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161355c91815260200190565b60405180910390a361203e565b613573828261221e565b61102b5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556135ab3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600054610100900460ff166136165760405162461bcd60e51b8152600401610dfb90615baa565b565b600054610100900460ff1661363f5760405162461bcd60e51b8152600401610dfb90615baa565b60c9805460ff19169055565b600054610100900460ff166136725760405162461bcd60e51b8152600401610dfb90615baa565b815161368590603690602085019061524b565b508051610d7890603790602084019061524b565b6136a3828261221e565b1561102b5760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60c95460ff166137495760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610dfb565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b8082610d785760405162461bcd60e51b8152600401610dfb9190615ac5565b600081815261010b602090815260409182902082516080810184528154815260018201548184015260028201548185018190526003909201546001600160a01b03908116606083015260fd54855163900cf0cf60e01b81529551929561383995919092169263900cf0cf926004808201939291829003018186803b15801561134b57600080fd5b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561387f57600080fd5b505af1158015613893573d6000803e3d6000fd5b505050600083815261010b60205260408120818155600181018290556002810182905560030180546001600160a01b03191690556101035460608401519192506001600160a01b039081169116156139fe576040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b15801561392757600080fd5b505afa15801561393b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061395f91906158ce565b905061397384606001518560200151613ecc565b6040516370a0823160e01b815230600482015281906001600160a01b038416906370a082319060240160206040518083038186803b1580156139b457600080fd5b505afa1580156139c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139ec91906158ce565b6139f69190615cf1565b925050613a38565b82600001519150816101086000828254613a189190615cf1565b92505081905550816101056000828254613a329190615cf1565b90915550505b613a4c6001600160a01b0382163384613f79565b8184336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd6000604051613a8a91815260200190565b60405180910390a450505050565b600081815261010d6020908152604080832080548251818502810185019093528083529192909190849084015b82821015613b2257600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101613ac5565b505050509050613b9881600081518110613b3e57613b3e615dc7565b60200260200101516040015160fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561134b57600080fd5b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015613bde57600080fd5b505af1158015613bf2573d6000803e3d6000fd5b505050600083815261010d60205260408120613c0f9250906152bf565b8051610103546040516370a0823160e01b81523060048201526000916001600160a01b031690829082906370a082319060240160206040518083038186803b158015613c5a57600080fd5b505afa158015613c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c9291906158ce565b905060005b84811015613d945760006001600160a01b0316868281518110613cbc57613cbc615dc7565b6020026020010151606001516001600160a01b031614613d1f57613d1a868281518110613ceb57613ceb615dc7565b602002602001015160600151878381518110613d0957613d09615dc7565b602002602001015160200151613ecc565b613d82565b6000868281518110613d3357613d33615dc7565b6020026020010151600001519050806101086000828254613d549190615cf1565b92505081905550806101056000828254613d6e9190615cf1565b90915550613d7e90508186615c73565b9450505b80613d8c81615d80565b915050613c97565b506040516370a0823160e01b815230600482015281906001600160a01b038416906370a082319060240160206040518083038186803b158015613dd657600080fd5b505afa158015613dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e0e91906158ce565b613e189190615cf1565b613e229084615c73565b9250613e386001600160a01b0383163385613f79565b8286336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd6000604051613e7691815260200190565b60405180910390a4505050505050565b613616600261010f5414156040518060400160405280601f81526020017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815250613793565b6040516374bfeee160e11b8152600481018290526001600160a01b0383169063e97fddc2906024015b600060405180830381600087803b158015613f0f57600080fd5b505af1158015613f23573d6000803e3d6000fd5b505050505050565b60ff54604080516020810185905280820184905281518082038301815260608201928390526309813cdd60e31b9092526001600160a01b0390921691634c09e6e891613ef591606401615ac5565b6040516001600160a01b038316602482015260448101829052610d7890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614cb7565b60608101516000906001600160a01b0316613ff657505190565b600082606001519050600061407a826001600160a01b0316635c5f7dae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561403d57600080fd5b505afa158015614051573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061407591906158ce565b614d89565b90506000826001600160a01b031663bfb18f296040518163ffffffff1660e01b815260040160206040518083038186803b1580156140b757600080fd5b505afa1580156140cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140ef91906158ce565b602086015160405163795be58760e01b815230600482015260248101919091529091506000906001600160a01b0385169063795be58790604401604080518083038186803b15801561414057600080fd5b505afa158015614154573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614178919061587f565b805190915083906141899084615cd2565b6141939190615cb0565b9695505050505050565b60c95460ff16156141c05760405162461bcd60e51b8152600401610dfb90615b80565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586137763390565b60008061420160355490565b9050801561420f5780614212565b60015b905082156142205782614223565b60015b92506000836142328387615cd2565b61423c9190615cb0565b95945050505050565b6000808390506000614289826001600160a01b0316635c5f7dae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561403d57600080fd5b90506000826001600160a01b0316633ba0b9a96040518163ffffffff1660e01b815260040160206040518083038186803b1580156142c657600080fd5b505afa1580156142da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142fe91906158ce565b9050806141898387615cd2565b6143188282600019614dbe565b60fd5460408051608081018252600081529051630c11b08160e21b81523060048201526001600160a01b039283169261010c92916020830191871690633046c2049060240160206040518083038186803b15801561437557600080fd5b505afa158015614389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143ad91906158ce565b8152602001836001600160a01b031663a7ab69616040518163ffffffff1660e01b815260040160206040518083038186803b1580156143eb57600080fd5b505afa1580156143ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061442391906158ce565b846001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561445c57600080fd5b505afa158015614470573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061449491906158ce565b61449e9190615c73565b81526001600160a01b03958616602091820152825460018082018555600094855293829020835160049092020190815590820151928101929092556040810151600283015560600151600390910180546001600160a01b03191691909416179092555050565b80158061458d5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561455357600080fd5b505afa158015614567573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061458b91906158ce565b155b6145f85760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610dfb565b6040516001600160a01b038316602482015260448101829052610d7890849063095ea7b360e01b90606401613fa5565b604051636ab1507160e01b8152600481018390526024810182905260009081906001600160a01b03861690636ab1507190604401602060405180830381600087803b15801561467657600080fd5b505af115801561468a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061423c91906158ce565b6000806146ba60355490565b905080156146c857806146cb565b60015b905082156146d957826146dc565b60015b92506000816142328587615cd2565b6000806146f88487614e24565b905060006147068683615cb0565b905060005b868110156147a257600089828151811061472757614727615dc7565b602002602001015160000151905061478060006147448386614245565b116040518060400160405280601781526020017f5a45524f2073686172657320746f207769746864726177000000000000000000815250613793565b61478c8b828589614e39565b955050808061479a90615d80565b91505061470b565b509298975050505050505050565b6000805b845181101561487b5760008582815181106147d1576147d1615dc7565b6020026020010151905060008582815181106147ef576147ef615dc7565b602002602001015190508060001415614809575050614869565b60006148158287614e24565b9050600089848151811061482b5761482b615dc7565b602002602001015160000151905061484860006147448385614245565b6148548b82848a614e39565b965086614864575050505061487b565b505050505b8061487381615d80565b9150506147b4565b509095945050505050565b6001600160a01b0382166148e65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610dfb565b6001600160a01b0382166000908152603360205260409020548181101561495a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610dfb565b6001600160a01b0383166000908152603360205260408120838303905560358054849290614989908490615cf1565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000610108546149e2612377565b610105546149f09085615c73565b6149fa9190615c73565b610a7a9190615cf1565b6040516001600160a01b038085166024830152831660448201526064810182905261203e9085906323b872dd60e01b90608401613fa5565b6001600160a01b038216614a925760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610dfb565b8060356000828254614aa49190615c73565b90915550506001600160a01b03821660009081526033602052604081208054839290614ad1908490615c73565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606000614b2a836002615cd2565b614b35906002615c73565b67ffffffffffffffff811115614b4d57614b4d615ddd565b6040519080825280601f01601f191660200182016040528015614b77576020820181803683370190505b509050600360fc1b81600081518110614b9257614b92615dc7565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614bc157614bc1615dc7565b60200101906001600160f81b031916908160001a9053506000614be5846002615cd2565b614bf0906001615c73565b90505b6001811115614c68576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614c2457614c24615dc7565b1a60f81b828281518110614c3a57614c3a615dc7565b60200101906001600160f81b031916908160001a90535060049490941c93614c6181615d34565b9050614bf3565b508315610cad5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610dfb565b6000614d0c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166150469092919063ffffffff16565b805190915015610d785780806020019051810190614d2a9190615783565b610d785760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610dfb565b600060088210614da6576c01431e0fae6d7217caa0000000614da9565b60645b6cffffffffffffffffffffffffff1692915050565b60405163c83ec04d60e01b815260048101839052602481018290526001600160a01b0384169063c83ec04d90604401600060405180830381600087803b158015614e0757600080fd5b505af1158015614e1b573d6000803e3d6000fd5b50505050505050565b6000818311614e335782610cad565b50919050565b6000614e488484600019614dbe565b60fd54600086815261010d6020908152604080832081516080810183529384529051630c11b08160e21b81523060048201526001600160a01b0394851694919392830191891690633046c2049060240160206040518083038186803b158015614eb057600080fd5b505afa158015614ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ee891906158ce565b8152602001836001600160a01b031663a7ab69616040518163ffffffff1660e01b815260040160206040518083038186803b158015614f2657600080fd5b505afa158015614f3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f5e91906158ce565b846001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015614f9757600080fd5b505afa158015614fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614fcf91906158ce565b614fd99190615c73565b81526001600160a01b038881166020928301528354600180820186556000958652948390208451600490920201908155918301519382019390935560408201516002820155606090910151600390910180546001600160a01b031916919092161790556141938484615cf1565b6060615055848460008561505d565b949350505050565b6060824710156150be5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610dfb565b6001600160a01b0385163b6151155760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610dfb565b600080866001600160a01b0316858760405161513191906159b7565b60006040518083038185875af1925050503d806000811461516e576040519150601f19603f3d011682016040523d82523d6000602084013e615173565b606091505b509150915061518382828661518e565b979650505050505050565b6060831561519d575081610cad565b8251156151ad5782518084602001fd5b8160405162461bcd60e51b8152600401610dfb9190615ac5565b8280546151d390615d4b565b90600052602060002090601f0160209004810192826151f5576000855561523b565b82601f1061520e5782800160ff1982351617855561523b565b8280016001018555821561523b579182015b8281111561523b578235825591602001919060010190615220565b506152479291506152e0565b5090565b82805461525790615d4b565b90600052602060002090601f016020900481019282615279576000855561523b565b82601f1061529257805160ff191683800117855561523b565b8280016001018555821561523b579182015b8281111561523b5782518255916020019190600101906152a4565b50805460008255600402906000526020600020908101906110f991906152f5565b5b8082111561524757600081556001016152e1565b5b808211156152475760008082556001820181905560028201556003810180546001600160a01b03191690556004016152f6565b600082601f83011261533a57600080fd5b8151602061534f61534a83615c4f565b615c1e565b80838252828201915082860187848660061b890101111561536f57600080fd5b6000805b868110156153c457604080848c03121561538b578283fd5b615393615bf5565b845161539e81615df3565b8152848801516153ad81615df3565b818901528652948601949290920191600101615373565b509198975050505050505050565b600082601f8301126153e357600080fd5b815160206153f361534a83615c4f565b80838252828201915082860187848660051b890101111561541357600080fd5b60005b8581101561543257815184529284019290840190600101615416565b5090979650505050505050565b803560ff8116811461545057600080fd5b919050565b60006020828403121561546757600080fd5b8135610cad81615df3565b6000806040838503121561548557600080fd5b823561549081615df3565b915060208301356154a081615df3565b809150509250929050565b600080600080600080600060e0888a0312156154c657600080fd5b87356154d181615df3565b965060208801356154e181615df3565b955060408801356154f181615df3565b9450606088013561550181615df3565b9350608088013561551181615df3565b925060a088013561552181615df3565b915060c088013561553181615df3565b8091505092959891949750929550565b60008060006060848603121561555657600080fd5b833561556181615df3565b9250602084013561557181615df3565b929592945050506040919091013590565b6000806040838503121561559557600080fd5b82356155a081615df3565b946020939093013593505050565b6000602082840312156155c057600080fd5b815167ffffffffffffffff8111156155d757600080fd5b61505584828501615329565b6000806000606084860312156155f857600080fd5b835167ffffffffffffffff8082111561561057600080fd5b61561c87838801615329565b9450602086015191508082111561563257600080fd5b5061563f868287016153d2565b925050604084015190509250925092565b6000806000806080858703121561566657600080fd5b845167ffffffffffffffff8082111561567e57600080fd5b61568a88838901615329565b955060208701519150808211156156a057600080fd5b506156ad878288016153d2565b604087015160609097015195989097509350505050565b60008060008060008060c087890312156156dd57600080fd5b865167ffffffffffffffff808211156156f557600080fd5b6157018a838b01615329565b975060208901519650604089015191508082111561571e57600080fd5b61572a8a838b016153d2565b9550606089015191508082111561574057600080fd5b61574c8a838b016153d2565b9450608089015191508082111561576257600080fd5b5061576f89828a016153d2565b92505060a087015190509295509295509295565b60006020828403121561579557600080fd5b81518015158114610cad57600080fd5b6000602082840312156157b757600080fd5b5035919050565b600080604083850312156157d157600080fd5b8235915060208301356154a081615df3565b6000602082840312156157f557600080fd5b81356001600160e01b031981168114610cad57600080fd5b6000806020838503121561582057600080fd5b823567ffffffffffffffff8082111561583857600080fd5b818501915085601f83011261584c57600080fd5b81358181111561585b57600080fd5b86602082850101111561586d57600080fd5b60209290920196919550909350505050565b60006040828403121561589157600080fd5b6040516040810181811067ffffffffffffffff821117156158b4576158b4615ddd565b604052825181526020928301519281019290925250919050565b6000602082840312156158e057600080fd5b5051919050565b600080604083850312156158fa57600080fd5b50508035926020909101359150565b6000806040838503121561591c57600080fd5b505080516020909101519092909150565b60006020828403121561593f57600080fd5b610cad8261543f565b60008060006060848603121561595d57600080fd5b6159668461543f565b92506159746020850161543f565b91506159826040850161543f565b90509250925092565b600081518084526159a3816020860160208601615d08565b601f01601f19169290920160200192915050565b600082516159c9818460208701615d08565b9190910192915050565b8183823760009101908152919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615a1b816017850160208801615d08565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615a4c816028840160208801615d08565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b82811015615ab857815180518552868101518786015285810151868601526060908101516001600160a01b03169085015260809093019290850190600101615a75565b5091979650505050505050565b602081526000610cad602083018461598b565b600060208083526000845481600182811c915080831680615afa57607f831692505b858310811415615b1857634e487b7160e01b85526022600452602485fd5b878601838152602001818015615b355760018114615b4657615b71565b60ff19861682528782019650615b71565b60008b81526020902060005b86811015615b6b57815484820152908501908901615b52565b83019750505b50949998505050505050505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6040805190810167ffffffffffffffff81118282101715615c1857615c18615ddd565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715615c4757615c47615ddd565b604052919050565b600067ffffffffffffffff821115615c6957615c69615ddd565b5060051b60200190565b60008219821115615c8657615c86615d9b565b500190565b600060ff821660ff84168060ff03821115615ca857615ca8615d9b565b019392505050565b600082615ccd57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615615cec57615cec615d9b565b500290565b600082821015615d0357615d03615d9b565b500390565b60005b83811015615d23578181015183820152602001615d0b565b8381111561203e5750506000910152565b600081615d4357615d43615d9b565b506000190190565b600181811c90821680615d5f57607f821691505b60208210811415614e3357634e487b7160e01b600052602260045260246000fd5b6000600019821415615d9457615d94615d9b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146110f957600080fdfed0a4ad96d49edb1c33461cebc6fb2609190f32c904e3c3f5877edb4488dee91e416d6f756e7420746f2064697374726962757465206c6f776572207468616e206d696e696d756d416d6f756e7420746f2064656c6567617465206c6f776572207468616e206d696e696d756da2646970667358221220293fbad69f9968662eb8c4828c3263ecc07a5903fede616e4400456c5e98d1af64736f6c63430008070033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106104335760003560e01c80637682c90211610236578063b0e21e8a1161013b578063dd62ed3e116100c3578063f08711fe11610087578063f08711fe146109bd578063f1a13fce146109fc578063f532e86a14610a0f578063f6794fdb14610a22578063fc0c546a14610a3557600080fd5b8063dd62ed3e14610948578063e00222a014610981578063e062b10b14610989578063e259faf71461099c578063e8f8708f146109aa57600080fd5b8063c89e43611161010a578063c89e4361146108ff578063ccc143b814610907578063d280f14f1461091a578063d547741f14610922578063d968447c1461093557600080fd5b8063b0e21e8a1461088f578063bb208f551461089d578063c697d2c7146108b0578063c75e7832146108ec57600080fd5b806395d89b41116101be578063a217fddf1161018d578063a217fddf1461084f578063a245294714610857578063a457c2d714610861578063a9059cbb14610874578063afd290a71461088757600080fd5b806395d89b41146107db578063964a7596146107e357806398fabd3a146108275780639a3cac6a1461083c57600080fd5b8063893818a311610205578063893818a31461077457806389cf32041461077e578063916b9eba14610792578063917a52f51461079a57806391d14854146107c857600080fd5b80637682c9021461073e578063788bc78c146107515780637e978af8146107645780638456cb591461076c57600080fd5b80633b573c4a1161033c5780635c975abb116102c457806370a082311161029357806370a08231146106d257806370bf9fe9146106fb57806371975a3e1461070e578063720bcf1d146107185780637542ff951461072b57600080fd5b80635c975abb14610699578063676e5550146106a45780636f4a2cd0146106b75780637029c90e146106bf57600080fd5b80634cfeb8621161030b5780634cfeb862146106575780634e91f8111461066a578063509c5df61461067d57806352349b171461068757806354fd4d501461069157600080fd5b80633b573c4a146105fd5780633f4ba83a146106105780634162169f1461061857806346e04a2f1461064457600080fd5b8063248a9ca3116103bf578063313ce5671161038e578063313ce56714610588578063358764761461059d57806336568abe146105b0578063389ed267146105c357806339509351146105ea57600080fd5b8063248a9ca31461050b578063253d17351461052e5780632f2ff15d1461054e578063309756fb1461056157600080fd5b80630f2b2639116104065780630f2b2639146104a057806315539d3f146104b557806318160ddd146104c85780631e7ff8f6146104d057806323b872dd146104f857600080fd5b806301ffc9a71461043857806306fdde0314610460578063095ea7b3146104755780630d7abc3314610488575b600080fd5b61044b6104463660046157e3565b610a49565b60405190151581526020015b60405180910390f35b610468610a80565b6040516104579190615ac5565b61044b610483366004615582565b610b12565b6104926101065481565b604051908152602001610457565b6104b36104ae366004615455565b610b2a565b005b6104b36104c3366004615455565b610b8e565b603554610492565b6104e36104de366004615455565b610c0a565b60408051928352602083019190915201610457565b61044b610506366004615541565b610c8e565b6104926105193660046157a5565b60009081526097602052604090206001015490565b61054161053c3660046157a5565b610cb4565b6040516104579190615a58565b6104b361055c3660046157be565b610d52565b6104927f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2281565b60125b60405160ff9091168152602001610457565b6104b36105ab3660046154ab565b610d7d565b6104b36105be3660046157be565b610fb1565b6104927ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1481565b61044b6105f8366004615582565b61102f565b6104b361060b3660046157a5565b61106e565b6104b36110c6565b6101015461062c906001600160a01b031681565b6040516001600160a01b039091168152602001610457565b6104b36106523660046157a5565b6110fc565b6104b36106653660046157a5565b611247565b6104b361067836600461592d565b61164a565b6104926101085481565b6104926101055481565b6104686116fd565b60c95460ff1661044b565b6104926106b2366004615455565b61178c565b6104b3611806565b60fe5461062c906001600160a01b031681565b6104926106e0366004615455565b6001600160a01b031660009081526033602052604090205490565b6104b3610709366004615455565b611d94565b6104926101045481565b6104926107263660046157a5565b611e07565b60fd5461062c906001600160a01b031681565b6104b361074c3660046157a5565b611f79565b6104b361075f36600461580d565b611fc7565b610492612044565b6104b3612134565b6104926101095481565b6101025461062c906001600160a01b031681565b610541612167565b6107ad6107a83660046157a5565b6121f2565b60408051938452602084019290925290820152606001610457565b61044b6107d63660046157be565b61221e565b610468612249565b60fc546108039060ff808216916101008104821691620100009091041683565b6040805160ff94851681529284166020840152921691810191909152606001610457565b610492600080516020615e0983398151915281565b6104b361084a366004615455565b612258565b610492600081565b6104926101075481565b61044b61086f366004615582565b6122cc565b61044b610882366004615582565b612369565b610492612377565b61010e5461058b9060ff1681565b6104b36108ab366004615455565b612411565b6108c36108be3660046158e7565b612476565b604080519485526020850193909352918301526001600160a01b03166060820152608001610457565b6104b36108fa366004615455565b6124c6565b6104b361258a565b6104926109153660046157be565b61280f565b6104b3612ce7565b6104b36109303660046157be565b612ea9565b6107ad6109433660046157a5565b612ecf565b610492610956366004615472565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b610492612efe565b60ff5461062c906001600160a01b031681565b61010a5461044b9060ff1681565b60fb5461062c906001600160a01b031681565b6108c36109cb3660046157a5565b61010b602052600090815260409020805460018201546002830154600390930154919290916001600160a01b031684565b6108c3610a0a3660046157a5565b612f1a565b610492610a1d3660046157be565b612f5e565b6104b3610a30366004615948565b6130ad565b6101035461062c906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b1480610a7a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060368054610a8f90615d4b565b80601f0160208091040260200160405190810160405280929190818152602001828054610abb90615d4b565b8015610b085780601f10610add57610100808354040283529160200191610b08565b820191906000526020600020905b815481529060010190602001808311610aeb57829003601f168201915b5050505050905090565b600033610b20818585613187565b5060019392505050565b600080516020615e09833981519152610b4381336132ab565b60fb80546001600160a01b0319166001600160a01b0384169081179091556040517fb8e1a40638c48c0ebe9679e0b5b032f2066cf44139d775cc09c945b5df070c4e90600090a25050565b600080516020615e09833981519152610ba781336132ab565b60fe80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f3879f4996438c287cec42ea09f698215be51d075ec446a9f5bc83c98ccc1910191015b60405180910390a1505050565b604051630f3ffc7b60e11b815230600482015260009081906001600160a01b03841690631e7ff8f690602401604080518083038186803b158015610c4d57600080fd5b505afa158015610c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c859190615909565b91509150915091565b600033610c9c85828561330f565b610ca785858561339b565b60019150505b9392505050565b606061010d6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015610d4757600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101610cea565b505050509050919050565b600082815260976020526040902060010154610d6e81336132ab565b610d788383613569565b505050565b600054610100900460ff16610d985760005460ff1615610d9c565b303b155b610e045760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b600054610100900460ff16158015610e26576000805461ffff19166101011790555b610e2e6135ef565b610e36613618565b610e836040518060400160405280600c81526020016b5374616b6564204d4154494360a01b8152506040518060400160405280600781526020016673744d4154494360c81b81525061364b565b610e8e600033613569565b610ea6600080516020615e0983398151915287613569565b610ed07ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1433613569565b610efa7f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc2287613569565b60fb80546001600160a01b03199081166001600160a01b038b81169190911790925560fd8054821687841617905560fe8054821686841617905560ff8054821685841617905561010180548216898416179055610103805482168a841617905561010280549091169187169190911790556040805160608101825260198082526032602083015291015260fc805462ffffff1916621932191790558015610fa7576000805461ff00191690555b5050505050505050565b6001600160a01b03811633146110215760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610dfb565b61102b8282613699565b5050565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190610b209082908690611069908790615c73565b613187565b600080516020615e0983398151915261108781336132ab565b61010780549083905560408051828152602081018590527fbf99ce7c5a72f4c7135bb72a36193d147a37a54bfcf63ec29505b5e6d5e2921d9101610bfd565b7f393844199e3a43d3188fd97ec9bbfa35b6225814ddc4b40ea4237512887cfc226110f181336132ab565b6110f9613700565b50565b60c95460ff161561111f5760405162461bcd60e51b8152600401610dfb90615b80565b60fe5460405163430c208160e01b8152336004820152602481018390526111ca916001600160a01b03169063430c20819060440160206040518083038186803b15801561116b57600080fd5b505afa15801561117f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a39190615783565b604051806040016040528060098152602001682737ba1037bbb732b960b91b815250613793565b600081815261010b6020526040902060020154156111eb576110f9816137b2565b600081815261010d602052604090205415611209576110f981613a98565b60405162461bcd60e51b815260206004820152601360248201527224b73b30b634b21031b630b4b6903a37b5b2b760691b6044820152606401610dfb565b60c95460ff161561126a5760405162461bcd60e51b8152600401610dfb90615b80565b611272613e86565b600261010f5561010c5460408051808201909152600d81526c0d2dcecc2d8d2c840d2dcc8caf609b1b60208201526112ad9082841090613793565b600061010c83815481106112c3576112c3615dc7565b60009182526020918290206040805160808101825260049384029092018054835260018101548386015260028101548383018190526003909101546001600160a01b03908116606085015260fd54835163900cf0cf60e01b815293519497506113b896929591169363900cf0cf93808301939290829003018186803b15801561134b57600080fd5b505afa15801561135f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138391906158ce565b101560405180604001604052806015815260200174139bdd0818589b19481d1bc818db185a5b481e595d605a1b815250613793565b610103546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a082319060240160206040518083038186803b15801561140157600080fd5b505afa158015611415573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143991906158ce565b905061144d83606001518460200151613ecc565b6040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b15801561149157600080fd5b505afa1580156114a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c991906158ce565b6114d39190615cf1565b90508061010560008282546114e89190615c73565b909155506114f99050600186615cf1565b8614158015611509575084600114155b1561159d5761010c61151c600187615cf1565b8154811061152c5761152c615dc7565b906000526020600020906004020161010c878154811061154e5761154e615dc7565b6000918252602090912082546004909202019081556001808301549082015560028083015490820155600391820154910180546001600160a01b0319166001600160a01b039092169190911790555b61010c8054806115af576115af615db1565b60008281526020812060046000199093019283020181815560018101829055600281019190915560030180546001600160a01b031916905590556116026115f560355490565b6115fd612efe565b613f2b565b606084015160405182916001600160a01b0316907f4c42a3bec298a4d82d41b7a540d8ebc22d91ee8a61459bce23849ff470d31dea90600090a35050600161010f5550505050565b600080516020615e0983398151915261166381336132ab565b6116ae60008360ff1611801561167d575060648360ff1611155b60405180604001604052806013815260200172496e76616c69642070726f74636f6c2066656560681b815250613793565b61010e805460ff84811660ff1983168117909355604080519190921680825260208201939093527f6b1719571aee7af62357ac4d4c98cc35155a52a5fcf0c09198874443c0fe430d9101610bfd565b610100805461170b90615d4b565b80601f016020809104026020016040519081016040528092919081815260200182805461173790615d4b565b80156117845780601f1061175957610100808354040283529160200191611784565b820191906000526020600020905b81548152906001019060200180831161176757829003601f168201915b505050505081565b604051630676e55560e41b81523060048201526000906001600160a01b0383169063676e55509060240160206040518083038186803b1580156117ce57600080fd5b505afa1580156117e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7a91906158ce565b60c95460ff16156118295760405162461bcd60e51b8152600401610dfb90615b80565b611831613e86565b600261010f5560fb546040805163a335385960e01b815290516000926001600160a01b03169163a33538599160048083019286929190829003018186803b15801561187b57600080fd5b505afa15801561188f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118b791908101906155ae565b805190915060005b81811015611a4d5760008382815181106118db576118db615dc7565b602090810291909101015151604051630676e55560e41b81523060048201529091506000906001600160a01b0383169063676e55509060240160206040518083038186803b15801561192c57600080fd5b505afa158015611940573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196491906158ce565b90506000826001600160a01b0316639b2cb5d86040518163ffffffff1660e01b815260040160206040518083038186803b1580156119a157600080fd5b505afa1580156119b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d991906158ce565b905080821115611a3757826001600160a01b031663c7b8981c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611a1e57600080fd5b505af1158015611a32573d6000803e3d6000fd5b505050505b5050508080611a4590615d80565b9150506118bf565b5061010354610105546040516370a0823160e01b81523060048201526001600160a01b03909216916000919083906370a082319060240160206040518083038186803b158015611a9c57600080fd5b505afa158015611ab0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad491906158ce565b611ade9190615cf1565b61010e54909150600090606490611af89060ff1684615cd2565b611b029190615cb0565b9050611b2b610107548211604051806060016040528060278152602001615e2960279139613793565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b158015611b6d57600080fd5b505afa158015611b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba591906158ce565b60fc54909150600090606490611bbe9060ff1685615cd2565b611bc89190615cb0565b60fc54909150600090606490611be79062010000900460ff1686615cd2565b611bf19190615cb0565b60fc54909150600090606490611c0f90610100900460ff1687615cd2565b611c199190615cb0565b90506000611c278983615cb0565b61010154909150611c45906001600160a01b038a8116911686613f79565b61010254611c60906001600160a01b038a8116911685613f79565b60005b89811015611cb857611ca68b8281518110611c8057611c80615dc7565b602002602001015160200151838b6001600160a01b0316613f799092919063ffffffff16565b80611cb081615d80565b915050611c63565b506040516370a0823160e01b81523060048201526000906001600160a01b038a16906370a082319060240160206040518083038186803b158015611cfb57600080fd5b505afa158015611d0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3391906158ce565b90506000611d418288615cf1565b6101058390559050611d556115f560355490565b60405181907f4e3c6a1e602996ae70905ac6165ed2434753246e3bfa52b6ca6852b40e2d440890600090a25050600161010f5550505050505050505050565b600080516020615e09833981519152611dad81336132ab565b60ff80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f8f8196a0718fc814ab20b90fdc8c2024046578345148e1b903b20667f693a6ba9101610bfd565b600081815261010b602052604081206002015415611e7357600082815261010b60209081526040918290208251608081018452815481526001820154928101929092526002810154928201929092526003909101546001600160a01b03166060820152610a7a90613fdc565b600082815261010d602052604090205415611f7157600082815261010d6020908152604080832080548251818502810185019093528083529192909190849084015b82821015611f1257600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101611eb5565b505050509050600080600090505b8251811015611f6957611f4b838281518110611f3e57611f3e615dc7565b6020026020010151613fdc565b611f559083615c73565b915080611f6181615d80565b915050611f20565b509392505050565b506000919050565b600080516020615e09833981519152611f9281336132ab565b61010682905560405182907f1cabc2f7b706218bb8613769cd658789cd6f1860310413b841020a2c7b7a0e3290600090a25050565b600080516020615e09833981519152611fe081336132ab565b8282604051611ff09291906159d3565b60405180910390207fa22d531a51c0ad90c971d36d779910f19a3b85d5e5005072f84700bd68b6f0c56101006040516120299190615ad8565b60405180910390a261203e61010084846151c7565b50505050565b600080600060fb60009054906101000a90046001600160a01b03166001600160a01b0316630926efe46040518163ffffffff1660e01b815260040160006040518083038186803b15801561209757600080fd5b505afa1580156120ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120d391908101906155ae565b905060005b815181101561212c5760006121098383815181106120f8576120f8615dc7565b602002602001015160000151610c0a565b5090506121168185615c73565b935050808061212490615d80565b9150506120d8565b509092915050565b7ff6242721b06fefc650a24712f3590e1f7a66d3e4695d678965bdb1c332b04d1461215f81336132ab565b6110f961419d565b606061010c805480602002602001604051908101604052809291908181526020016000905b828210156121e957600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b03166060830152908352909201910161218c565b50505050905090565b600080600061220060355490565b915061220a612efe565b905061221684826141f5565b949193509150565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060378054610a8f90615d4b565b600080516020615e0983398151915261227181336132ab565b61010180546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f3b8dbc80bf27331221431f1c8b2c6fe358eadfdb3c3d7085e6a2521eeb775b079101610bfd565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156123515760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610dfb565b61235e8286868403613187565b506001949350505050565b600033610b2081858561339b565b61010c54600090815b8181101561240c576123ee61010c828154811061239f5761239f615dc7565b6000918252602091829020604080516080810182526004909302909101805483526001810154938301939093526002830154908201526003909101546001600160a01b03166060820152613fdc565b6123f89084615c73565b92508061240481615d80565b915050612380565b505090565b600080516020615e0983398151915261242a81336132ab565b61010280546001600160a01b0319166001600160a01b0384169081179091556040517f4029fa39dede0b39dd254005137e18c9116d6b2620b2037632c09bf89404c6d790600090a25050565b61010d602052816000526040600020818154811061249357600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491945092506001600160a01b031684565b6124ce613e86565b600261010f5560fb546040805180820190915260138152722737ba1030903737b2329037b832b930ba37b960691b6020820152612516916001600160a01b0316331490613793565b600061252182610c0a565b50905060006125308383614245565b90508061253e575050612581565b612548838361430b565b60405182906001600160a01b038516907f65fcdf1cdc99352d178d6d953d52e01307cde7a592027b09c9e1d9ac8eb09ab790600090a350505b50600161010f55565b60c95460ff16156125ad5760405162461bcd60e51b8152600401610dfb90615b80565b6125b5613e86565b600261010f556101055461010854610106546125f6906125d6908390615c73565b8311604051806060016040528060258152602001615e5060259139613793565b60006126028284615cf1565b60fb54604051637202ba3760e11b815260048101839052919250600091829182916001600160a01b039091169063e405746e9060240160006040518083038186803b15801561265057600080fd5b505afa158015612664573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261268c91908101906155e3565b82516101035460fd549497509295509093509160009182916001600160a01b0391821691166126bc828285614504565b6126d06001600160a01b038316828b614504565b60006126dc868b615cb0565b905060005b868110156127b35787156127495788818151811061270157612701615dc7565b602002602001015160001415612716576127a1565b878b8a838151811061272a5761272a615dc7565b602002602001015161273c9190615cd2565b6127469190615cb0565b91505b60008a828151811061275d5761275d615dc7565b602002602001015160000151905060006127778285614245565b9050806127855750506127a1565b61279182856000614628565b5061279c8488615c73565b965050505b806127ab81615d80565b9150506126e1565b506127be848b615cf1565b94506127ca8b86615c73565b61010555604051859085907f421adba60af7a6b11679e2ac133b1bc91d3de91d56866ec19703d9d60cf950c890600090a35050600161010f5550505050505050505050565b600061281d60c95460ff1690565b1561283a5760405162461bcd60e51b8152600401610dfb90615b80565b612842613e86565b600261010f5561289583158015906128695750336000908152603360205260409020548411155b6040518060400160405280600e81526020016d125b9d985b1a5908185b5bdd5b9d60921b815250613793565b6000806128a0612efe565b905060006128ae86836146ae565b90506128e860008211604051806040016040528060138152602001725769746864726177205a45524f204d6174696360681b815250613793565b60fb546040516308b16df560e21b815260048101839052600091829182918291829182916001600160a01b03909116906322c5b7d49060240160006040518083038186803b15801561293957600080fd5b505afa15801561294d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261297591908101906156c4565b6101055461010854969c50949a509298509096509450925090600081831161299e5760006129a8565b6129a88284615cf1565b905060006129b6828a615c73565b90506129f18b82101560405180604001604052806014815260200173546f6f206d75636820746f20776974686472617760601b815250613793565b505060fe546040516335313c2160e11b81523360048201528a93506001600160a01b039091169150636a62784290602401602060405180830381600087803b158015612a3c57600080fd5b505af1158015612a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7491906158ce565b99508515612abc578115612a9757612a908a888a858a866146eb565b9050612abc565b612aa48a888786856147b0565b90508015612abc57612ab98a888686856147b0565b90505b85881115612c645760fd5460008b815261010d60209081526040808320815160808101835286815280840194909452815163a7ab696160e01b815282516001600160a01b039096169591949392840192869263a7ab6961926004808201939291829003018186803b158015612b3057600080fd5b505afa158015612b44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6891906158ce565b846001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015612ba157600080fd5b505afa158015612bb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd991906158ce565b612be39190615c73565b8152600060209182018190528354600180820186559482528282208451600490920201908155918301519382019390935560408201516002820155606090910151600390910180546001600160a01b0319166001600160a01b039092169190911790556101088054849290612c59908490615c73565b909155506000925050505b50612c6f338d614886565b612c85612c7b60355490565b6115fd898b615cf1565b5050505050505050826001600160a01b0316336001600160a01b03167f4318b22a7b774533f1c9cd7102530d96faffc18ef44a1ecb56abc9a55d49fd8b86604051612cd291815260200190565b60405180910390a3600161010f559392505050565b600080516020615e09833981519152612d0081336132ab565b6000612d0a612377565b6101085461010554612d1c9190615cf1565b612d269190615c73565b60fb54604051639552d81d60e01b8152600481018390529192506000918291829182916001600160a01b031690639552d81d9060240160006040518083038186803b158015612d7457600080fd5b505afa158015612d88573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612db09190810190615650565b935093509350935060008060005b8651811015612e9e57858181518110612dd957612dd9615dc7565b602002602001015160001415612dee57612e8c565b8484878381518110612e0257612e02615dc7565b6020026020010151612e149190615cd2565b612e1e9190615cb0565b925082612e2a57612e8c565b868181518110612e3c57612e3c615dc7565b60200260200101516000015191506000612e568385614245565b905080612e635750612e8c565b612e8a888381518110612e7857612e78615dc7565b6020026020010151600001518561430b565b505b80612e9681615d80565b915050612dbe565b505050505050505050565b600082815260976020526040902060010154612ec581336132ab565b610d788383613699565b6000806000612edd60355490565b91506000612ee9612efe565b9050612ef585826146ae565b95929450925050565b600080612f09612044565b9050612f14816149d4565b91505090565b61010c8181548110612f2b57600080fd5b6000918252602090912060049091020180546001820154600283015460039093015491935091906001600160a01b031684565b6000612f6c60c95460ff1690565b15612f895760405162461bcd60e51b8152600401610dfb90615b80565b612f91613e86565b600261010f5560408051808201909152600e81526d125b9d985b1a5908185b5bdd5b9d60921b6020820152612fc99084151590613793565b61010354612fe2906001600160a01b0316333086614a04565b6000806000612ff0866121f2565b92509250925061302460008411604051806040016040528060098152602001684d696e74205a45524f60b81b815250613793565b61302e3384614a3c565b8561010560008282546130419190615c73565b9091555061305e90506130548484615c73565b6115fd8884615c73565b6040518681526001600160a01b0386169033907f98d2bc018caf34c71a8f920d9d93d4ed62e9789506b74087b48570c17b28ed999060200160405180910390a35050600161010f559392505050565b600080516020615e098339815191526130c681336132ab565b61310f826130d48587615c8b565b6130de9190615c8b565b60ff166064146040518060400160405280600d81526020016c073756d2866656529213d31303609c1b815250613793565b60fc805460ff86811661ffff1990921682176101008783169081029190911762ff0000191662010000928716928302179093556040805192835260208301939093528183015290517f37322890d66d781059d797be5e2f27dc160a34d8bc0a8e09116cb9a773ce88ef9181900360600190a150505050565b6001600160a01b0383166131e95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610dfb565b6001600160a01b03821661324a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610dfb565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6132b5828261221e565b61102b576132cd816001600160a01b03166014614b1b565b6132d8836020614b1b565b6040516020016132e99291906159e3565b60408051601f198184030181529082905262461bcd60e51b8252610dfb91600401615ac5565b6001600160a01b03838116600090815260346020908152604080832093861683529290522054600019811461203e578181101561338e5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610dfb565b61203e8484848403613187565b6001600160a01b0383166133ff5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610dfb565b6001600160a01b0382166134615760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610dfb565b6001600160a01b038316600090815260336020526040902054818110156134d95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610dfb565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290613510908490615c73565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161355c91815260200190565b60405180910390a361203e565b613573828261221e565b61102b5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556135ab3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600054610100900460ff166136165760405162461bcd60e51b8152600401610dfb90615baa565b565b600054610100900460ff1661363f5760405162461bcd60e51b8152600401610dfb90615baa565b60c9805460ff19169055565b600054610100900460ff166136725760405162461bcd60e51b8152600401610dfb90615baa565b815161368590603690602085019061524b565b508051610d7890603790602084019061524b565b6136a3828261221e565b1561102b5760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60c95460ff166137495760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610dfb565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b8082610d785760405162461bcd60e51b8152600401610dfb9190615ac5565b600081815261010b602090815260409182902082516080810184528154815260018201548184015260028201548185018190526003909201546001600160a01b03908116606083015260fd54855163900cf0cf60e01b81529551929561383995919092169263900cf0cf926004808201939291829003018186803b15801561134b57600080fd5b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561387f57600080fd5b505af1158015613893573d6000803e3d6000fd5b505050600083815261010b60205260408120818155600181018290556002810182905560030180546001600160a01b03191690556101035460608401519192506001600160a01b039081169116156139fe576040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b15801561392757600080fd5b505afa15801561393b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061395f91906158ce565b905061397384606001518560200151613ecc565b6040516370a0823160e01b815230600482015281906001600160a01b038416906370a082319060240160206040518083038186803b1580156139b457600080fd5b505afa1580156139c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139ec91906158ce565b6139f69190615cf1565b925050613a38565b82600001519150816101086000828254613a189190615cf1565b92505081905550816101056000828254613a329190615cf1565b90915550505b613a4c6001600160a01b0382163384613f79565b8184336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd6000604051613a8a91815260200190565b60405180910390a450505050565b600081815261010d6020908152604080832080548251818502810185019093528083529192909190849084015b82821015613b2257600084815260209081902060408051608081018252600486029092018054835260018082015484860152600282015492840192909252600301546001600160a01b031660608301529083529092019101613ac5565b505050509050613b9881600081518110613b3e57613b3e615dc7565b60200260200101516040015160fd60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561134b57600080fd5b60fe54604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015613bde57600080fd5b505af1158015613bf2573d6000803e3d6000fd5b505050600083815261010d60205260408120613c0f9250906152bf565b8051610103546040516370a0823160e01b81523060048201526000916001600160a01b031690829082906370a082319060240160206040518083038186803b158015613c5a57600080fd5b505afa158015613c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c9291906158ce565b905060005b84811015613d945760006001600160a01b0316868281518110613cbc57613cbc615dc7565b6020026020010151606001516001600160a01b031614613d1f57613d1a868281518110613ceb57613ceb615dc7565b602002602001015160600151878381518110613d0957613d09615dc7565b602002602001015160200151613ecc565b613d82565b6000868281518110613d3357613d33615dc7565b6020026020010151600001519050806101086000828254613d549190615cf1565b92505081905550806101056000828254613d6e9190615cf1565b90915550613d7e90508186615c73565b9450505b80613d8c81615d80565b915050613c97565b506040516370a0823160e01b815230600482015281906001600160a01b038416906370a082319060240160206040518083038186803b158015613dd657600080fd5b505afa158015613dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e0e91906158ce565b613e189190615cf1565b613e229084615c73565b9250613e386001600160a01b0383163385613f79565b8286336001600160a01b03167faca94a3466fab333b79851ab29b0715612740e4ae0d891ef8e9bd2a1bf5e24dd6000604051613e7691815260200190565b60405180910390a4505050505050565b613616600261010f5414156040518060400160405280601f81526020017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815250613793565b6040516374bfeee160e11b8152600481018290526001600160a01b0383169063e97fddc2906024015b600060405180830381600087803b158015613f0f57600080fd5b505af1158015613f23573d6000803e3d6000fd5b505050505050565b60ff54604080516020810185905280820184905281518082038301815260608201928390526309813cdd60e31b9092526001600160a01b0390921691634c09e6e891613ef591606401615ac5565b6040516001600160a01b038316602482015260448101829052610d7890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614cb7565b60608101516000906001600160a01b0316613ff657505190565b600082606001519050600061407a826001600160a01b0316635c5f7dae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561403d57600080fd5b505afa158015614051573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061407591906158ce565b614d89565b90506000826001600160a01b031663bfb18f296040518163ffffffff1660e01b815260040160206040518083038186803b1580156140b757600080fd5b505afa1580156140cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140ef91906158ce565b602086015160405163795be58760e01b815230600482015260248101919091529091506000906001600160a01b0385169063795be58790604401604080518083038186803b15801561414057600080fd5b505afa158015614154573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614178919061587f565b805190915083906141899084615cd2565b6141939190615cb0565b9695505050505050565b60c95460ff16156141c05760405162461bcd60e51b8152600401610dfb90615b80565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586137763390565b60008061420160355490565b9050801561420f5780614212565b60015b905082156142205782614223565b60015b92506000836142328387615cd2565b61423c9190615cb0565b95945050505050565b6000808390506000614289826001600160a01b0316635c5f7dae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561403d57600080fd5b90506000826001600160a01b0316633ba0b9a96040518163ffffffff1660e01b815260040160206040518083038186803b1580156142c657600080fd5b505afa1580156142da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142fe91906158ce565b9050806141898387615cd2565b6143188282600019614dbe565b60fd5460408051608081018252600081529051630c11b08160e21b81523060048201526001600160a01b039283169261010c92916020830191871690633046c2049060240160206040518083038186803b15801561437557600080fd5b505afa158015614389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143ad91906158ce565b8152602001836001600160a01b031663a7ab69616040518163ffffffff1660e01b815260040160206040518083038186803b1580156143eb57600080fd5b505afa1580156143ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061442391906158ce565b846001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561445c57600080fd5b505afa158015614470573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061449491906158ce565b61449e9190615c73565b81526001600160a01b03958616602091820152825460018082018555600094855293829020835160049092020190815590820151928101929092556040810151600283015560600151600390910180546001600160a01b03191691909416179092555050565b80158061458d5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561455357600080fd5b505afa158015614567573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061458b91906158ce565b155b6145f85760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610dfb565b6040516001600160a01b038316602482015260448101829052610d7890849063095ea7b360e01b90606401613fa5565b604051636ab1507160e01b8152600481018390526024810182905260009081906001600160a01b03861690636ab1507190604401602060405180830381600087803b15801561467657600080fd5b505af115801561468a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061423c91906158ce565b6000806146ba60355490565b905080156146c857806146cb565b60015b905082156146d957826146dc565b60015b92506000816142328587615cd2565b6000806146f88487614e24565b905060006147068683615cb0565b905060005b868110156147a257600089828151811061472757614727615dc7565b602002602001015160000151905061478060006147448386614245565b116040518060400160405280601781526020017f5a45524f2073686172657320746f207769746864726177000000000000000000815250613793565b61478c8b828589614e39565b955050808061479a90615d80565b91505061470b565b509298975050505050505050565b6000805b845181101561487b5760008582815181106147d1576147d1615dc7565b6020026020010151905060008582815181106147ef576147ef615dc7565b602002602001015190508060001415614809575050614869565b60006148158287614e24565b9050600089848151811061482b5761482b615dc7565b602002602001015160000151905061484860006147448385614245565b6148548b82848a614e39565b965086614864575050505061487b565b505050505b8061487381615d80565b9150506147b4565b509095945050505050565b6001600160a01b0382166148e65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610dfb565b6001600160a01b0382166000908152603360205260409020548181101561495a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610dfb565b6001600160a01b0383166000908152603360205260408120838303905560358054849290614989908490615cf1565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000610108546149e2612377565b610105546149f09085615c73565b6149fa9190615c73565b610a7a9190615cf1565b6040516001600160a01b038085166024830152831660448201526064810182905261203e9085906323b872dd60e01b90608401613fa5565b6001600160a01b038216614a925760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610dfb565b8060356000828254614aa49190615c73565b90915550506001600160a01b03821660009081526033602052604081208054839290614ad1908490615c73565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606000614b2a836002615cd2565b614b35906002615c73565b67ffffffffffffffff811115614b4d57614b4d615ddd565b6040519080825280601f01601f191660200182016040528015614b77576020820181803683370190505b509050600360fc1b81600081518110614b9257614b92615dc7565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614bc157614bc1615dc7565b60200101906001600160f81b031916908160001a9053506000614be5846002615cd2565b614bf0906001615c73565b90505b6001811115614c68576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614c2457614c24615dc7565b1a60f81b828281518110614c3a57614c3a615dc7565b60200101906001600160f81b031916908160001a90535060049490941c93614c6181615d34565b9050614bf3565b508315610cad5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610dfb565b6000614d0c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166150469092919063ffffffff16565b805190915015610d785780806020019051810190614d2a9190615783565b610d785760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610dfb565b600060088210614da6576c01431e0fae6d7217caa0000000614da9565b60645b6cffffffffffffffffffffffffff1692915050565b60405163c83ec04d60e01b815260048101839052602481018290526001600160a01b0384169063c83ec04d90604401600060405180830381600087803b158015614e0757600080fd5b505af1158015614e1b573d6000803e3d6000fd5b50505050505050565b6000818311614e335782610cad565b50919050565b6000614e488484600019614dbe565b60fd54600086815261010d6020908152604080832081516080810183529384529051630c11b08160e21b81523060048201526001600160a01b0394851694919392830191891690633046c2049060240160206040518083038186803b158015614eb057600080fd5b505afa158015614ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ee891906158ce565b8152602001836001600160a01b031663a7ab69616040518163ffffffff1660e01b815260040160206040518083038186803b158015614f2657600080fd5b505afa158015614f3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f5e91906158ce565b846001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015614f9757600080fd5b505afa158015614fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614fcf91906158ce565b614fd99190615c73565b81526001600160a01b038881166020928301528354600180820186556000958652948390208451600490920201908155918301519382019390935560408201516002820155606090910151600390910180546001600160a01b031916919092161790556141938484615cf1565b6060615055848460008561505d565b949350505050565b6060824710156150be5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610dfb565b6001600160a01b0385163b6151155760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610dfb565b600080866001600160a01b0316858760405161513191906159b7565b60006040518083038185875af1925050503d806000811461516e576040519150601f19603f3d011682016040523d82523d6000602084013e615173565b606091505b509150915061518382828661518e565b979650505050505050565b6060831561519d575081610cad565b8251156151ad5782518084602001fd5b8160405162461bcd60e51b8152600401610dfb9190615ac5565b8280546151d390615d4b565b90600052602060002090601f0160209004810192826151f5576000855561523b565b82601f1061520e5782800160ff1982351617855561523b565b8280016001018555821561523b579182015b8281111561523b578235825591602001919060010190615220565b506152479291506152e0565b5090565b82805461525790615d4b565b90600052602060002090601f016020900481019282615279576000855561523b565b82601f1061529257805160ff191683800117855561523b565b8280016001018555821561523b579182015b8281111561523b5782518255916020019190600101906152a4565b50805460008255600402906000526020600020908101906110f991906152f5565b5b8082111561524757600081556001016152e1565b5b808211156152475760008082556001820181905560028201556003810180546001600160a01b03191690556004016152f6565b600082601f83011261533a57600080fd5b8151602061534f61534a83615c4f565b615c1e565b80838252828201915082860187848660061b890101111561536f57600080fd5b6000805b868110156153c457604080848c03121561538b578283fd5b615393615bf5565b845161539e81615df3565b8152848801516153ad81615df3565b818901528652948601949290920191600101615373565b509198975050505050505050565b600082601f8301126153e357600080fd5b815160206153f361534a83615c4f565b80838252828201915082860187848660051b890101111561541357600080fd5b60005b8581101561543257815184529284019290840190600101615416565b5090979650505050505050565b803560ff8116811461545057600080fd5b919050565b60006020828403121561546757600080fd5b8135610cad81615df3565b6000806040838503121561548557600080fd5b823561549081615df3565b915060208301356154a081615df3565b809150509250929050565b600080600080600080600060e0888a0312156154c657600080fd5b87356154d181615df3565b965060208801356154e181615df3565b955060408801356154f181615df3565b9450606088013561550181615df3565b9350608088013561551181615df3565b925060a088013561552181615df3565b915060c088013561553181615df3565b8091505092959891949750929550565b60008060006060848603121561555657600080fd5b833561556181615df3565b9250602084013561557181615df3565b929592945050506040919091013590565b6000806040838503121561559557600080fd5b82356155a081615df3565b946020939093013593505050565b6000602082840312156155c057600080fd5b815167ffffffffffffffff8111156155d757600080fd5b61505584828501615329565b6000806000606084860312156155f857600080fd5b835167ffffffffffffffff8082111561561057600080fd5b61561c87838801615329565b9450602086015191508082111561563257600080fd5b5061563f868287016153d2565b925050604084015190509250925092565b6000806000806080858703121561566657600080fd5b845167ffffffffffffffff8082111561567e57600080fd5b61568a88838901615329565b955060208701519150808211156156a057600080fd5b506156ad878288016153d2565b604087015160609097015195989097509350505050565b60008060008060008060c087890312156156dd57600080fd5b865167ffffffffffffffff808211156156f557600080fd5b6157018a838b01615329565b975060208901519650604089015191508082111561571e57600080fd5b61572a8a838b016153d2565b9550606089015191508082111561574057600080fd5b61574c8a838b016153d2565b9450608089015191508082111561576257600080fd5b5061576f89828a016153d2565b92505060a087015190509295509295509295565b60006020828403121561579557600080fd5b81518015158114610cad57600080fd5b6000602082840312156157b757600080fd5b5035919050565b600080604083850312156157d157600080fd5b8235915060208301356154a081615df3565b6000602082840312156157f557600080fd5b81356001600160e01b031981168114610cad57600080fd5b6000806020838503121561582057600080fd5b823567ffffffffffffffff8082111561583857600080fd5b818501915085601f83011261584c57600080fd5b81358181111561585b57600080fd5b86602082850101111561586d57600080fd5b60209290920196919550909350505050565b60006040828403121561589157600080fd5b6040516040810181811067ffffffffffffffff821117156158b4576158b4615ddd565b604052825181526020928301519281019290925250919050565b6000602082840312156158e057600080fd5b5051919050565b600080604083850312156158fa57600080fd5b50508035926020909101359150565b6000806040838503121561591c57600080fd5b505080516020909101519092909150565b60006020828403121561593f57600080fd5b610cad8261543f565b60008060006060848603121561595d57600080fd5b6159668461543f565b92506159746020850161543f565b91506159826040850161543f565b90509250925092565b600081518084526159a3816020860160208601615d08565b601f01601f19169290920160200192915050565b600082516159c9818460208701615d08565b9190910192915050565b8183823760009101908152919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615a1b816017850160208801615d08565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615a4c816028840160208801615d08565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b82811015615ab857815180518552868101518786015285810151868601526060908101516001600160a01b03169085015260809093019290850190600101615a75565b5091979650505050505050565b602081526000610cad602083018461598b565b600060208083526000845481600182811c915080831680615afa57607f831692505b858310811415615b1857634e487b7160e01b85526022600452602485fd5b878601838152602001818015615b355760018114615b4657615b71565b60ff19861682528782019650615b71565b60008b81526020902060005b86811015615b6b57815484820152908501908901615b52565b83019750505b50949998505050505050505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6040805190810167ffffffffffffffff81118282101715615c1857615c18615ddd565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715615c4757615c47615ddd565b604052919050565b600067ffffffffffffffff821115615c6957615c69615ddd565b5060051b60200190565b60008219821115615c8657615c86615d9b565b500190565b600060ff821660ff84168060ff03821115615ca857615ca8615d9b565b019392505050565b600082615ccd57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615615cec57615cec615d9b565b500290565b600082821015615d0357615d03615d9b565b500390565b60005b83811015615d23578181015183820152602001615d0b565b8381111561203e5750506000910152565b600081615d4357615d43615d9b565b506000190190565b600181811c90821680615d5f57607f821691505b60208210811415614e3357634e487b7160e01b600052602260045260246000fd5b6000600019821415615d9457615d94615d9b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146110f957600080fdfed0a4ad96d49edb1c33461cebc6fb2609190f32c904e3c3f5877edb4488dee91e416d6f756e7420746f2064697374726962757465206c6f776572207468616e206d696e696d756d416d6f756e7420746f2064656c6567617465206c6f776572207468616e206d696e696d756da2646970667358221220293fbad69f9968662eb8c4828c3263ecc07a5903fede616e4400456c5e98d1af64736f6c63430008070033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.