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:
MaticX
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-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/IValidatorRegistry.sol"; import "./interfaces/IStakeManager.sol"; import "./interfaces/IMaticX.sol"; import "./interfaces/IFxStateRootTunnel.sol"; contract MaticX is IMaticX, ERC20Upgradeable, AccessControlUpgradeable, PausableUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; address private validatorRegistry; address private stakeManager; address private polygonERC20; address public override treasury; string public override version; uint8 public override feePercent; bytes32 public constant INSTANT_POOL_OWNER = keccak256("IPO"); address public override instantPoolOwner; uint256 public override instantPoolMatic; uint256 public override instantPoolMaticX; /// @notice Mapping of all user ids with withdraw requests. mapping(address => WithdrawalRequest[]) private userWithdrawalRequests; bytes32 public constant PREDICATE_ROLE = keccak256("PREDICATE_ROLE"); address public override fxStateRootTunnel; /** * @param _validatorRegistry - Address of the validator registry * @param _stakeManager - Address of the stake manager * @param _polygonERC20 - Address of matic token on Ethereum * @param _manager - Address of the manager * @param _instantPoolOwner - Address of the instant pool owner * @param _treasury - Address of the treasury */ function initialize( address _validatorRegistry, address _stakeManager, address _polygonERC20, address _manager, address _instantPoolOwner, address _treasury ) external override initializer { __AccessControl_init(); __Pausable_init(); __ERC20_init("Liquid Staking Matic", "MaticX"); _setupRole(DEFAULT_ADMIN_ROLE, _manager); _setupRole(INSTANT_POOL_OWNER, _instantPoolOwner); instantPoolOwner = _instantPoolOwner; validatorRegistry = _validatorRegistry; stakeManager = _stakeManager; treasury = _treasury; polygonERC20 = _polygonERC20; feePercent = 5; IERC20Upgradeable(polygonERC20).safeApprove( stakeManager, type(uint256).max ); } //////////////////////////////////////////////////////////// ///// /// ///// ***Instant Pool Interactions*** /// ///// /// //////////////////////////////////////////////////////////// // Uses instantPoolOwner funds. function provideInstantPoolMatic(uint256 _amount) external override whenNotPaused onlyRole(INSTANT_POOL_OWNER) { require(_amount > 0, "Invalid amount"); IERC20Upgradeable(polygonERC20).safeTransferFrom( msg.sender, address(this), _amount ); instantPoolMatic += _amount; } function provideInstantPoolMaticX(uint256 _amount) external override whenNotPaused onlyRole(INSTANT_POOL_OWNER) { require(_amount > 0, "Invalid amount"); IERC20Upgradeable(address(this)).safeTransferFrom( msg.sender, address(this), _amount ); instantPoolMaticX += _amount; } function withdrawInstantPoolMaticX(uint256 _amount) external override whenNotPaused onlyRole(INSTANT_POOL_OWNER) { require( instantPoolMaticX >= _amount, "Withdraw amount cannot exceed maticX in instant pool" ); instantPoolMaticX -= _amount; IERC20Upgradeable(address(this)).safeTransfer( instantPoolOwner, _amount ); } function withdrawInstantPoolMatic(uint256 _amount) external override whenNotPaused onlyRole(INSTANT_POOL_OWNER) { require( instantPoolMatic >= _amount, "Withdraw amount cannot exceed matic in instant pool" ); instantPoolMatic -= _amount; IERC20Upgradeable(polygonERC20).safeTransfer(instantPoolOwner, _amount); } // Uses instantPoolMatic funds function mintMaticXToInstantPool() external override whenNotPaused onlyRole(INSTANT_POOL_OWNER) { require(instantPoolMatic > 0, "Matic amount cannot be 0"); uint256 maticxMinted = helper_delegate_to_mint( address(this), instantPoolMatic ); instantPoolMaticX += maticxMinted; instantPoolMatic = 0; } function swapMaticForMaticXViaInstantPool(uint256 _amount) external override whenNotPaused { require(_amount > 0, "Invalid amount"); IERC20Upgradeable(polygonERC20).safeTransferFrom( msg.sender, address(this), _amount ); (uint256 amountToMint, , ) = convertMaticToMaticX(_amount); require( instantPoolMaticX >= amountToMint, "Not enough maticX to instant swap" ); IERC20Upgradeable(address(this)).safeTransfer(msg.sender, amountToMint); instantPoolMatic += _amount; instantPoolMaticX -= amountToMint; } //////////////////////////////////////////////////////////// ///// /// ///// ***Staking Contract Interactions*** /// ///// /// //////////////////////////////////////////////////////////// /** * @dev Send funds to MaticX contract and mints MaticX to msg.sender * @notice Requires that msg.sender has approved _amount of MATIC to this contract * @param _amount - Amount of MATIC sent from msg.sender to this contract * @return Amount of MaticX shares generated */ function submit(uint256 _amount) external override whenNotPaused returns (uint256) { require(_amount > 0, "Invalid amount"); IERC20Upgradeable(polygonERC20).safeTransferFrom( msg.sender, address(this), _amount ); return helper_delegate_to_mint(msg.sender, _amount); } /** * @dev Stores user's request to withdraw into WithdrawalRequest struct * @param _amount - Amount of maticX that is requested to withdraw */ function requestWithdraw(uint256 _amount) external override whenNotPaused { require(_amount > 0, "Invalid amount"); ( uint256 totalAmount2WithdrawInMatic, uint256 totalShares, uint256 totalPooledMatic ) = convertMaticXToMatic(_amount); _burn(msg.sender, _amount); uint256 leftAmount2WithdrawInMatic = totalAmount2WithdrawInMatic; uint256 totalDelegated = getTotalStakeAcrossAllValidators(); require( totalDelegated >= totalAmount2WithdrawInMatic, "Too much to withdraw" ); uint256[] memory validators = IValidatorRegistry(validatorRegistry) .getValidators(); uint256 preferredValidatorId = IValidatorRegistry(validatorRegistry) .preferredWithdrawalValidatorId(); uint256 currentIdx = 0; for (; currentIdx < validators.length; ++currentIdx) { if (preferredValidatorId == validators[currentIdx]) break; } while (leftAmount2WithdrawInMatic > 0) { uint256 validatorId = validators[currentIdx]; address validatorShare = IStakeManager(stakeManager) .getValidatorContract(validatorId); (uint256 validatorBalance, ) = getTotalStake( IValidatorShare(validatorShare) ); uint256 amount2WithdrawFromValidator = (validatorBalance <= leftAmount2WithdrawInMatic) ? validatorBalance : leftAmount2WithdrawInMatic; IValidatorShare(validatorShare).sellVoucher_new( amount2WithdrawFromValidator, type(uint256).max ); userWithdrawalRequests[msg.sender].push( WithdrawalRequest( IValidatorShare(validatorShare).unbondNonces(address(this)), IStakeManager(stakeManager).epoch() + IStakeManager(stakeManager).withdrawalDelay(), validatorShare ) ); leftAmount2WithdrawInMatic -= amount2WithdrawFromValidator; currentIdx = currentIdx + 1 < validators.length ? currentIdx + 1 : 0; } IFxStateRootTunnel(fxStateRootTunnel).sendMessageToChild( abi.encode( totalShares - _amount, totalPooledMatic - totalAmount2WithdrawInMatic ) ); emit RequestWithdraw(msg.sender, _amount, totalAmount2WithdrawInMatic); } /** * @dev Claims tokens from validator share and sends them to the * address if the request is in the userWithdrawalRequests * @param _idx - User withdrawal request array index */ function claimWithdrawal(uint256 _idx) external override whenNotPaused { _claimWithdrawal(msg.sender, _idx); } function withdrawRewards(uint256 _validatorId) public override whenNotPaused returns (uint256) { address validatorShare = IStakeManager(stakeManager) .getValidatorContract(_validatorId); uint256 balanceBeforeRewards = IERC20Upgradeable(polygonERC20) .balanceOf(address(this)); IValidatorShare(validatorShare).withdrawRewards(); uint256 rewards = IERC20Upgradeable(polygonERC20).balanceOf( address(this) ) - balanceBeforeRewards; emit WithdrawRewards(_validatorId, rewards); return rewards; } function stakeRewardsAndDistributeFees(uint256 _validatorId) external override whenNotPaused onlyRole(DEFAULT_ADMIN_ROLE) { require( IValidatorRegistry(validatorRegistry).validatorIdExists( _validatorId ), "Doesn't exist in validator registry" ); address validatorShare = IStakeManager(stakeManager) .getValidatorContract(_validatorId); uint256 rewards = IERC20Upgradeable(polygonERC20).balanceOf( address(this) ) - instantPoolMatic; require(rewards > 0, "Reward is zero"); uint256 treasuryFees = (rewards * feePercent) / 100; if (treasuryFees > 0) { IERC20Upgradeable(polygonERC20).safeTransfer( treasury, treasuryFees ); emit DistributeFees(treasury, treasuryFees); } uint256 amountStaked = rewards - treasuryFees; IValidatorShare(validatorShare).buyVoucher(amountStaked, 0); uint256 totalShares = totalSupply(); uint256 totalPooledMatic = getTotalPooledMatic(); IFxStateRootTunnel(fxStateRootTunnel).sendMessageToChild( abi.encode(totalShares, totalPooledMatic) ); emit StakeRewards(_validatorId, amountStaked); } /** * @dev Migrate the staked tokens to another validaor */ function migrateDelegation( uint256 _fromValidatorId, uint256 _toValidatorId, uint256 _amount ) external override whenNotPaused onlyRole(DEFAULT_ADMIN_ROLE) { require( IValidatorRegistry(validatorRegistry).validatorIdExists( _fromValidatorId ), "From validator id does not exist in our registry" ); require( IValidatorRegistry(validatorRegistry).validatorIdExists( _toValidatorId ), "To validator id does not exist in our registry" ); IStakeManager(stakeManager).migrateDelegation( _fromValidatorId, _toValidatorId, _amount ); emit MigrateDelegation(_fromValidatorId, _toValidatorId, _amount); } /** * @dev Flips the pause state */ function togglePause() external override onlyRole(DEFAULT_ADMIN_ROLE) { paused() ? _unpause() : _pause(); } /** * @dev API for getting total stake of this contract from validatorShare * @param _validatorShare - Address of validatorShare contract * @return Total stake of this contract and MATIC -> share exchange rate */ function getTotalStake(IValidatorShare _validatorShare) public view override returns (uint256, uint256) { return _validatorShare.getTotalStake(address(this)); } //////////////////////////////////////////////////////////// ///// /// ///// ***Helpers & Utilities*** /// ///// /// //////////////////////////////////////////////////////////// function helper_delegate_to_mint(address deposit_sender, uint256 _amount) internal whenNotPaused returns (uint256) { ( uint256 amountToMint, uint256 totalShares, uint256 totalPooledMatic ) = convertMaticToMaticX(_amount); _mint(deposit_sender, amountToMint); emit Submit(deposit_sender, _amount); uint256 preferredValidatorId = IValidatorRegistry(validatorRegistry) .preferredDepositValidatorId(); address validatorShare = IStakeManager(stakeManager) .getValidatorContract(preferredValidatorId); IValidatorShare(validatorShare).buyVoucher(_amount, 0); IFxStateRootTunnel(fxStateRootTunnel).sendMessageToChild( abi.encode(totalShares + amountToMint, totalPooledMatic + _amount) ); emit Delegate(preferredValidatorId, _amount); return amountToMint; } /** * @dev Claims tokens from validator share and sends them to the * address if the request is in the userWithdrawalRequests * @param _to - Address of the withdrawal request owner * @param _idx - User withdrawal request array index */ function _claimWithdrawal(address _to, uint256 _idx) internal returns (uint256) { uint256 amountToClaim = 0; uint256 balanceBeforeClaim = IERC20Upgradeable(polygonERC20).balanceOf( address(this) ); WithdrawalRequest[] storage userRequests = userWithdrawalRequests[_to]; WithdrawalRequest memory userRequest = userRequests[_idx]; require( IStakeManager(stakeManager).epoch() >= userRequest.requestEpoch, "Not able to claim yet" ); IValidatorShare(userRequest.validatorAddress).unstakeClaimTokens_new( userRequest.validatorNonce ); // swap with the last item and pop it. userRequests[_idx] = userRequests[userRequests.length - 1]; userRequests.pop(); amountToClaim = IERC20Upgradeable(polygonERC20).balanceOf(address(this)) - balanceBeforeClaim; IERC20Upgradeable(polygonERC20).safeTransfer(_to, amountToClaim); emit ClaimWithdrawal(_to, _idx, amountToClaim); return amountToClaim; } /** * @dev Function that converts arbitrary maticX to Matic * @param _balance - Balance in maticX * @return Balance in Matic, totalShares and totalPooledMATIC */ function convertMaticXToMatic(uint256 _balance) public view override returns ( uint256, uint256, uint256 ) { uint256 totalShares = totalSupply(); totalShares = totalShares == 0 ? 1 : totalShares; uint256 totalPooledMATIC = getTotalPooledMatic(); totalPooledMATIC = totalPooledMATIC == 0 ? 1 : totalPooledMATIC; uint256 balanceInMATIC = (_balance * (totalPooledMATIC)) / totalShares; return (balanceInMATIC, totalShares, totalPooledMATIC); } /** * @dev Function that converts arbitrary Matic to maticX * @param _balance - Balance in Matic * @return Balance in maticX, totalShares and totalPooledMATIC */ function convertMaticToMaticX(uint256 _balance) public view override returns ( uint256, uint256, uint256 ) { uint256 totalShares = totalSupply(); totalShares = totalShares == 0 ? 1 : totalShares; uint256 totalPooledMatic = getTotalPooledMatic(); totalPooledMatic = totalPooledMatic == 0 ? 1 : totalPooledMatic; uint256 balanceInMaticX = (_balance * totalShares) / totalPooledMatic; return (balanceInMaticX, totalShares, totalPooledMatic); } // TODO: Add logic and enable it in V2 function mint(address _user, uint256 _amount) external override whenNotPaused onlyRole(PREDICATE_ROLE) { emit MintFromPolygon(_user, _amount); } //////////////////////////////////////////////////////////// ///// /// ///// ***Setters*** /// ///// /// //////////////////////////////////////////////////////////// /** * @dev Function that sets fee percent * @notice Callable only by manager * @param _feePercent - Fee percent (10 = 10%) */ function setFeePercent(uint8 _feePercent) external override onlyRole(DEFAULT_ADMIN_ROLE) { require(_feePercent <= 100, "_feePercent must not exceed 100"); feePercent = _feePercent; emit SetFeePercent(_feePercent); } function setInstantPoolOwner(address _address) external override onlyRole(DEFAULT_ADMIN_ROLE) { require(instantPoolOwner != _address, "Old address == new address"); _revokeRole(INSTANT_POOL_OWNER, instantPoolOwner); instantPoolOwner = _address; _setupRole(INSTANT_POOL_OWNER, _address); emit SetInstantPoolOwner(_address); } function setTreasury(address _address) external override onlyRole(DEFAULT_ADMIN_ROLE) { treasury = _address; emit SetTreasury(_address); } function setValidatorRegistry(address _address) external override onlyRole(DEFAULT_ADMIN_ROLE) { validatorRegistry = _address; emit SetValidatorRegistry(_address); } function setFxStateRootTunnel(address _address) external override onlyRole(DEFAULT_ADMIN_ROLE) { fxStateRootTunnel = _address; emit SetFxStateRootTunnel(_address); } /** * @dev Function that sets the new version * @param _version - New version that will be set */ function setVersion(string calldata _version) external override onlyRole(DEFAULT_ADMIN_ROLE) { version = _version; emit SetVersion(_version); } //////////////////////////////////////////////////////////// ///// /// ///// ***Getters*** /// ///// /// //////////////////////////////////////////////////////////// /** * @dev Helper function for that returns total pooled MATIC * @return Total pooled MATIC */ function getTotalStakeAcrossAllValidators() public view override returns (uint256) { uint256 totalStake; uint256[] memory validators = IValidatorRegistry(validatorRegistry) .getValidators(); for (uint256 i = 0; i < validators.length; ++i) { address validatorShare = IStakeManager(stakeManager) .getValidatorContract(validators[i]); (uint256 currValidatorShare, ) = getTotalStake( IValidatorShare(validatorShare) ); totalStake += currValidatorShare; } return totalStake; } /** * @dev Function that calculates total pooled Matic * @return Total pooled Matic */ function getTotalPooledMatic() public view override returns (uint256) { uint256 totalStaked = getTotalStakeAcrossAllValidators(); return totalStaked; } /** * @dev Retrieves all withdrawal requests initiated by the given address * @param _address - Address of an user * @return userWithdrawalRequests array of user withdrawal requests */ function getUserWithdrawalRequests(address _address) external view override returns (WithdrawalRequest[] memory) { return userWithdrawalRequests[_address]; } /** * @dev Retrieves shares amount of a given withdrawal request * @param _address - Address of an user * @return _idx index of the withdrawal request */ function getSharesAmountOfUserWithdrawalRequest( address _address, uint256 _idx ) external view override returns (uint256) { WithdrawalRequest memory userRequest = userWithdrawalRequests[_address][ _idx ]; IValidatorShare validatorShare = IValidatorShare( userRequest.validatorAddress ); IValidatorShare.DelegatorUnbond memory unbond = validatorShare .unbonds_new(address(this), userRequest.validatorNonce); return unbond.shares; } function getContracts() external view override returns ( address _stakeManager, address _polygonERC20, address _validatorRegistry ) { _stakeManager = stakeManager; _polygonERC20 = polygonERC20; _validatorRegistry = validatorRegistry; } }
// 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-License-Identifier: GPL-3.0 pragma solidity 0.8.7; interface IValidatorShare { struct DelegatorUnbond { uint256 shares; uint256 withdrawEpoch; } function minAmount() external view returns (uint256); function unbondNonces(address _address) external view returns (uint256); function validatorId() external view returns (uint256); function delegation() external view returns (bool); function buyVoucher(uint256 _amount, uint256 _minSharesToMint) external returns (uint256); function sellVoucher_new(uint256 claimAmount, uint256 maximumSharesToBurn) external; function unstakeClaimTokens_new(uint256 unbondNonce) external; function restake() external returns (uint256, uint256); function withdrawRewards() external; function getTotalStake(address user) external view returns (uint256, uint256); function unbonds_new(address _address, uint256 _unbondNonce) external view returns (DelegatorUnbond memory); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; /// @title IValidatorRegistry /// @notice Node validator registry interface interface IValidatorRegistry { function addValidator(uint256 _validatorId) external; function removeValidator(uint256 _validatorId) external; function setPreferredDepositValidatorId(uint256 _validatorId) external; function setPreferredWithdrawalValidatorId(uint256 _validatorId) external; function setMaticX(address _maticX) external; function setVersion(string memory _version) external; function togglePause() external; function version() external view returns (string memory); function preferredDepositValidatorId() external view returns (uint256); function preferredWithdrawalValidatorId() external view returns (uint256); function validatorIdExists(uint256 _validatorId) external view returns (bool); function getContracts() external view returns ( address _stakeManager, address _polygonERC20, address _maticX ); function getValidatorId(uint256 _index) external view returns (uint256); function getValidators() external view returns (uint256[] memory); event AddValidator(uint256 indexed _validatorId); event RemoveValidator(uint256 indexed _validatorId); event SetPreferredDepositValidatorId(uint256 indexed _validatorId); event SetPreferredWithdrawalValidatorId(uint256 indexed _validatorId); event SetMaticX(address _address); event SetVersion(string _version); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; /// @title polygon stake manager interface. /// @notice User to interact with the polygon stake manager. interface IStakeManager { /// @notice Request unstake a validator. /// @param validatorId validator id. function unstake(uint256 validatorId) external; /// @notice Get the validator id using the user address. /// @param user user that own the validator in our case the validator contract. /// @return return the validator id function getValidatorId(address user) external view returns (uint256); /// @notice get the validator contract used for delegation. /// @param validatorId validator id. /// @return return the address of the validator contract. function getValidatorContract(uint256 validatorId) external view returns (address); /// @notice Withdraw accumulated rewards /// @param validatorId validator id. function withdrawRewards(uint256 validatorId) external; /// @notice Get validator total staked. /// @param validatorId validator id. function validatorStake(uint256 validatorId) external view returns (uint256); /// @notice Allows to unstake the staked tokens on the stakeManager. /// @param validatorId validator id. function unstakeClaim(uint256 validatorId) external; /// @notice Allows to migrate the staked tokens to another validator. /// @param fromValidatorId From validator id. /// @param toValidatorId To validator id. /// @param amount amount in Matic. function migrateDelegation( uint256 fromValidatorId, uint256 toValidatorId, uint256 amount ) external; /// @notice Returns a withdrawal delay. function withdrawalDelay() external view returns (uint256); /// @notice Transfers amount from delegator function delegationDeposit( uint256 validatorId, uint256 amount, address delegator ) external returns (bool); function epoch() external view returns (uint256); enum Status { Inactive, Active, Locked, Unstaked } struct Validator { uint256 amount; uint256 reward; uint256 activationEpoch; uint256 deactivationEpoch; uint256 jailTime; address signer; address contractAddress; Status status; uint256 commissionRate; uint256 lastCommissionUpdate; uint256 delegatorsReward; uint256 delegatedAmount; uint256 initialRewardPerStake; } function validators(uint256 _index) external view returns (Validator memory); // TODO: Remove it and use stakeFor instead function createValidator(uint256 _validatorId) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "./IValidatorShare.sol"; import "./IValidatorRegistry.sol"; /// @title MaticX interface. interface IMaticX is IERC20Upgradeable { struct WithdrawalRequest { uint256 validatorNonce; uint256 requestEpoch; address validatorAddress; } function version() external view returns (string memory); function treasury() external view returns (address); function feePercent() external view returns (uint8); function instantPoolOwner() external view returns (address); function instantPoolMatic() external view returns (uint256); function instantPoolMaticX() external view returns (uint256); function fxStateRootTunnel() external view returns (address); function initialize( address _validatorRegistry, address _stakeManager, address _token, address _manager, address _instant_pool_manager, address _treasury ) external; function provideInstantPoolMatic(uint256 _amount) external; function provideInstantPoolMaticX(uint256 _amount) external; function withdrawInstantPoolMaticX(uint256 _amount) external; function withdrawInstantPoolMatic(uint256 _amount) external; function mintMaticXToInstantPool() external; function swapMaticForMaticXViaInstantPool(uint256 _amount) external; function submit(uint256 _amount) external returns (uint256); function requestWithdraw(uint256 _amount) external; function claimWithdrawal(uint256 _idx) external; function withdrawRewards(uint256 _validatorId) external returns (uint256); function stakeRewardsAndDistributeFees(uint256 _validatorId) external; function migrateDelegation( uint256 _fromValidatorId, uint256 _toValidatorId, uint256 _amount ) external; function togglePause() external; function convertMaticXToMatic(uint256 _balance) external view returns ( uint256, uint256, uint256 ); function convertMaticToMaticX(uint256 _balance) external view returns ( uint256, uint256, uint256 ); function mint(address _user, uint256 _amount) external; function setFeePercent(uint8 _feePercent) external; function setInstantPoolOwner(address _address) external; function setValidatorRegistry(address _address) external; function setTreasury(address _address) external; function setFxStateRootTunnel(address _address) external; function setVersion(string calldata _version) external; function getUserWithdrawalRequests(address _address) external view returns (WithdrawalRequest[] memory); function getSharesAmountOfUserWithdrawalRequest( address _address, uint256 _idx ) external view returns (uint256); function getTotalStake(IValidatorShare _validatorShare) external view returns (uint256, uint256); function getTotalStakeAcrossAllValidators() external view returns (uint256); function getTotalPooledMatic() external view returns (uint256); function getContracts() external view returns ( address _stakeManager, address _polygonERC20, address _validatorRegistry ); event Submit(address indexed _from, uint256 _amount); event Delegate(uint256 indexed _validatorId, uint256 _amountDelegated); event RequestWithdraw( address indexed _from, uint256 _amountMaticX, uint256 _amountMatic ); event ClaimWithdrawal( address indexed _from, uint256 indexed _idx, uint256 _amountClaimed ); event WithdrawRewards(uint256 indexed _validatorId, uint256 _rewards); event StakeRewards(uint256 indexed _validatorId, uint256 _amountStaked); event DistributeFees(address indexed _address, uint256 _amount); event MigrateDelegation( uint256 indexed _fromValidatorId, uint256 indexed _toValidatorId, uint256 _amount ); event MintFromPolygon(address indexed _user, uint256 _amount); event SetFeePercent(uint8 _feePercent); event SetInstantPoolOwner(address _address); event SetTreasury(address _address); event SetValidatorRegistry(address _address); event SetFxStateRootTunnel(address _address); event SetVersion(string _version); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; interface IFxStateRootTunnel { function latestData() external view returns (bytes memory); function setFxChildTunnel(address _fxChildTunnel) external; function sendMessageToChild(bytes memory message) external; function setMaticX(address _maticX) external; }
// 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); }
{ "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":"_idx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountClaimed","type":"uint256"}],"name":"ClaimWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_validatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountDelegated","type":"uint256"}],"name":"Delegate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_address","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"DistributeFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_fromValidatorId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_toValidatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"MigrateDelegation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"MintFromPolygon","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":"_amountMaticX","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountMatic","type":"uint256"}],"name":"RequestWithdraw","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":"uint8","name":"_feePercent","type":"uint8"}],"name":"SetFeePercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"SetFxStateRootTunnel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"SetInstantPoolOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"SetTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"SetValidatorRegistry","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_version","type":"string"}],"name":"SetVersion","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_validatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountStaked","type":"uint256"}],"name":"StakeRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Submit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_validatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_rewards","type":"uint256"}],"name":"WithdrawRewards","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INSTANT_POOL_OWNER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PREDICATE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"claimWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_balance","type":"uint256"}],"name":"convertMaticToMaticX","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_balance","type":"uint256"}],"name":"convertMaticXToMatic","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"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":"feePercent","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fxStateRootTunnel","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContracts","outputs":[{"internalType":"address","name":"_stakeManager","type":"address"},{"internalType":"address","name":"_polygonERC20","type":"address"},{"internalType":"address","name":"_validatorRegistry","type":"address"}],"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":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"getSharesAmountOfUserWithdrawalRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalPooledMatic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IValidatorShare","name":"_validatorShare","type":"address"}],"name":"getTotalStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStakeAcrossAllValidators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getUserWithdrawalRequests","outputs":[{"components":[{"internalType":"uint256","name":"validatorNonce","type":"uint256"},{"internalType":"uint256","name":"requestEpoch","type":"uint256"},{"internalType":"address","name":"validatorAddress","type":"address"}],"internalType":"struct IMaticX.WithdrawalRequest[]","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":"_validatorRegistry","type":"address"},{"internalType":"address","name":"_stakeManager","type":"address"},{"internalType":"address","name":"_polygonERC20","type":"address"},{"internalType":"address","name":"_manager","type":"address"},{"internalType":"address","name":"_instantPoolOwner","type":"address"},{"internalType":"address","name":"_treasury","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"instantPoolMatic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instantPoolMaticX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instantPoolOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromValidatorId","type":"uint256"},{"internalType":"uint256","name":"_toValidatorId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"migrateDelegation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintMaticXToInstantPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"provideInstantPoolMatic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"provideInstantPoolMaticX","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"}],"name":"requestWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_feePercent","type":"uint8"}],"name":"setFeePercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setFxStateRootTunnel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setInstantPoolOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setValidatorRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_version","type":"string"}],"name":"setVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_validatorId","type":"uint256"}],"name":"stakeRewardsAndDistributeFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"submit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"swapMaticForMaticXViaInstantPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"togglePause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"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":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawInstantPoolMatic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawInstantPoolMaticX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_validatorId","type":"uint256"}],"name":"withdrawRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506148a2806100206000396000f3fe608060405234801561001057600080fd5b50600436106103825760003560e01c8063788bc78c116101de578063c4ae31681161010f578063e00222a0116100ad578063f0f442601161007c578063f0f4426014610800578063f483817614610813578063f844443614610826578063fb1ef52c1461083957600080fd5b8063e00222a0146107aa578063e062b10b146107b2578063e72db5fd146107c6578063ea99c2a6146107ed57600080fd5b8063cc2a9a5b116100e9578063cc2a9a5b14610738578063d547741f1461074b578063dcea4be91461075e578063dd62ed3e1461077157600080fd5b8063c4ae316814610711578063c759352d14610719578063cba45a7c1461072357600080fd5b80639683e28e1161017c578063a9059cbb11610156578063a9059cbb146106a5578063baec30ca146106b8578063c1e324a5146106cb578063c3a2a93a146106de57600080fd5b80639683e28e14610677578063a217fddf1461068a578063a457c2d71461069257600080fd5b806389dfa025116101b857806389dfa0251461063f57806391d14854146106495780639342c8f41461065c57806395d89b411461066f57600080fd5b8063788bc78c146106165780637e978af8146106295780637fd6f15c1461063157600080fd5b806340c10f19116102b8578063701845b81161025657806373f0ecdf1161023057806373f0ecdf146105af578063745400c9146105c257806374b7b2d2146105d557806375a85ef5146105e857600080fd5b8063701845b81461056057806370a082311461057357806370bf9fe91461059c57600080fd5b80635c975abb116102925780635c975abb1461050f57806361d027b31461051a57806368c05c971461052d5780636c9302281461054057600080fd5b806340c10f19146104e157806349773050146104f457806354fd4d501461050757600080fd5b80631e7ff8f6116103255780632f2ff15d116102ff5780632f2ff15d14610493578063313ce567146104a657806336568abe146104bb57806339509351146104ce57600080fd5b80631e7ff8f61461043557806323b872dd1461045d578063248a9ca31461047057600080fd5b806306fdde031161036157806306fdde03146103cc578063095ea7b3146103e157806318160ddd146103f45780631c0831241461040657600080fd5b8062fd822c1461038757806301ffc9a71461039c57806302b09f2e146103c4575b600080fd5b61039a6103953660046142f2565b61084c565b005b6103af6103aa366004614330565b61093c565b60405190151581526020015b60405180910390f35b61039a610973565b6103d4610a35565b6040516103bb91906145c6565b6103af6103ef3660046141f7565b610ac7565b6035545b6040519081526020016103bb565b610100805461041d916001600160a01b0391041681565b6040516001600160a01b0390911681526020016103bb565b6104486104433660046140c1565b610adf565b604080519283526020830191909152016103bb565b6103af61046b3660046141b6565b610b63565b6103f861047e3660046142f2565b60009081526097602052604090206001015490565b61039a6104a136600461430b565b610b89565b60125b60405160ff90911681526020016103bb565b61039a6104c936600461430b565b610bb4565b6103af6104dc3660046141f7565b610c2e565b61039a6104ef3660046141f7565b610c6d565b61039a6105023660046140c1565b610d03565b6103d4610d65565b60c95460ff166103af565b60fe5461041d906001600160a01b031681565b61039a61053b3660046142f2565b610df3565b61055361054e3660046140c1565b610e77565b6040516103bb9190614564565b61039a61056e3660046140c1565b610f10565b6103f86105813660046140c1565b6001600160a01b031660009081526033602052604090205490565b61039a6105aa3660046140c1565b611016565b6103f86105bd3660046141f7565b611071565b61039a6105d03660046142f2565b611165565b61039a6105e33660046142f2565b6117a9565b6105fb6105f63660046142f2565b611830565b604080519384526020840192909252908201526060016103bb565b61039a61062436600461435a565b611894565b6103f86118eb565b610100546104a99060ff1681565b6103f86101015481565b6103af61065736600461430b565b611a5f565b6103f861066a3660046142f2565b611a8a565b6103d4611cd6565b6105fb6106853660046142f2565b611ce5565b6103f8600081565b6103af6106a03660046141f7565b611d31565b6103af6106b33660046141f7565b611dce565b61039a6106c63660046142f2565b611ddc565b61039a6106d93660046142f2565b611edb565b60fc5460fd5460fb54604080516001600160a01b03948516815292841660208401529216918101919091526060016103bb565b61039a611fba565b6103f86101025481565b6103f860008051602061484d83398151915281565b61039a610746366004614134565b611fe3565b61039a61075936600461430b565b6121a4565b61039a61076c3660046142f2565b6121ca565b6103f861077f3660046140fb565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6103f8612615565b6101045461041d906001600160a01b031681565b6103f87f12ff340d0cd9c652c747ca35727e68c547d0f0bfa7758d2e77f75acef481b4f281565b6103f86107fb3660046142f2565b612620565b61039a61080e3660046140c1565b61268d565b61039a610821366004614484565b6126e7565b61039a6108343660046142f2565b61278a565b61039a610847366004614458565b6127b7565b60c95460ff16156108785760405162461bcd60e51b815260040161086f90614630565b60405180910390fd5b60008051602061484d8339815191526108918133612a53565b816101015410156109005760405162461bcd60e51b815260206004820152603360248201527f576974686472617720616d6f756e742063616e6e6f7420657863656564206d616044820152721d1a58c81a5b881a5b9cdd185b9d081c1bdbdb606a1b606482015260840161086f565b816101016000828254610913919061472f565b9091555050610100805460fd54610938926001600160a01b0391821692041684612ab7565b5050565b60006001600160e01b03198216637965db0b60e01b148061096d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60c95460ff16156109965760405162461bcd60e51b815260040161086f90614630565b60008051602061484d8339815191526109af8133612a53565b60006101015411610a025760405162461bcd60e51b815260206004820152601860248201527f4d6174696320616d6f756e742063616e6e6f7420626520300000000000000000604482015260640161086f565b6000610a113061010154612b1a565b9050806101026000828254610a2691906146d6565b90915550506000610101555050565b606060368054610a4490614789565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7090614789565b8015610abd5780601f10610a9257610100808354040283529160200191610abd565b820191906000526020600020905b815481529060010190602001808311610aa057829003601f168201915b5050505050905090565b600033610ad5818585612e05565b5060019392505050565b604051630f3ffc7b60e11b815230600482015260009081906001600160a01b03841690631e7ff8f690602401604080518083038186803b158015610b2257600080fd5b505afa158015610b36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5a9190614434565b91509150915091565b600033610b71858285612f29565b610b7c858585612fbb565b60019150505b9392505050565b600082815260976020526040902060010154610ba58133612a53565b610baf8383613189565b505050565b6001600160a01b0381163314610c245760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161086f565b610938828261320f565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190610ad59082908690610c689087906146d6565b612e05565b60c95460ff1615610c905760405162461bcd60e51b815260040161086f90614630565b7f12ff340d0cd9c652c747ca35727e68c547d0f0bfa7758d2e77f75acef481b4f2610cbb8133612a53565b826001600160a01b03167ff027eb54ed614a8bfda36d8cafda4ab4acc6e5c37696e443dfa5e2161eda696083604051610cf691815260200190565b60405180910390a2505050565b6000610d0f8133612a53565b60fb80546001600160a01b0319166001600160a01b0384169081179091556040519081527fa517f86b521912d95237e24eb8fe8f28d5b167b2a02e4fff3ca27f1da9fd125f906020015b60405180910390a15050565b60ff8054610d7290614789565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9e90614789565b8015610deb5780601f10610dc057610100808354040283529160200191610deb565b820191906000526020600020905b815481529060010190602001808311610dce57829003601f168201915b505050505081565b60c95460ff1615610e165760405162461bcd60e51b815260040161086f90614630565b60008051602061484d833981519152610e2f8133612a53565b60008211610e4f5760405162461bcd60e51b815260040161086f90614608565b610e5b30338185613276565b816101026000828254610e6e91906146d6565b90915550505050565b6001600160a01b038116600090815261010360209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610f05576000848152602090819020604080516060810182526003860290920180548352600180820154848601526002909101546001600160a01b0316918301919091529083529092019101610eb0565b505050509050919050565b6000610f1c8133612a53565b6101008054046001600160a01b039081169083161415610f7e5760405162461bcd60e51b815260206004820152601a60248201527f4f6c642061646472657373203d3d206e65772061646472657373000000000000604482015260640161086f565b6101008054610fa69160008051602061484d83398151915291046001600160a01b031661320f565b6101008054610100600160a81b0319166001600160a01b0384168202179055610fdd60008051602061484d833981519152836132ae565b6040516001600160a01b03831681527f655166b35cc2872bea49c3cc867c962f7da955e7fd4f5ad9285d913bab5ed39c90602001610d59565b60006110228133612a53565b61010480546001600160a01b0319166001600160a01b0384169081179091556040519081527f3945349f2164c50436e3da71a2721b2aedd89159dd2946c421e923ce6228c51b90602001610d59565b6001600160a01b03821660009081526101036020526040812080548291908490811061109f5761109f61480b565b60009182526020808320604080516060810182526003949094029091018054808552600182015493850193909352600201546001600160a01b0316838201819052905163795be58760e01b81523060048201526024810192909252919350909190829063795be58790604401604080518083038186803b15801561112257600080fd5b505afa158015611136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115a91906143cc565b519695505050505050565b60c95460ff16156111885760405162461bcd60e51b815260040161086f90614630565b600081116111a85760405162461bcd60e51b815260040161086f90614608565b60008060006111b684611830565b9250925092506111c633856132b8565b8260006111d16118eb565b90508481101561121a5760405162461bcd60e51b8152602060048201526014602482015273546f6f206d75636820746f20776974686472617760601b604482015260640161086f565b60fb546040805163b7ab4db560e01b815290516000926001600160a01b03169163b7ab4db59160048083019286929190829003018186803b15801561125e57600080fd5b505afa158015611272573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261129a9190810190614223565b9050600060fb60009054906101000a90046001600160a01b03166001600160a01b031663aafb9c416040518163ffffffff1660e01b815260040160206040518083038186803b1580156112ec57600080fd5b505afa158015611300573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611324919061441b565b905060005b8251811015611368578281815181106113445761134461480b565b602002602001015182141561135857611368565b611361816147c4565b9050611329565b84156116ce5760008382815181106113825761138261480b565b602090810291909101015160fc5460405163158d0b6360e21b8152600481018390529192506000916001600160a01b03909116906356342d8c9060240160206040518083038186803b1580156113d757600080fd5b505afa1580156113eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140f91906140de565b9050600061141c82610adf565b50905060008882111561142f5788611431565b815b60405163c83ec04d60e01b81526004810182905260001960248201529091506001600160a01b0384169063c83ec04d90604401600060405180830381600087803b15801561147e57600080fd5b505af1158015611492573d6000803e3d6000fd5b505033600090815261010360205260409081902081516060810192839052630c11b08160e21b90925230606483015292509050806001600160a01b038616633046c2046084830160206040518083038186803b1580156114f157600080fd5b505afa158015611505573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611529919061441b565b815260fc546040805163a7ab696160e01b815290516020938401936001600160a01b039093169263a7ab69619260048082019391829003018186803b15801561157157600080fd5b505afa158015611585573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a9919061441b565b60fc60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f757600080fd5b505afa15801561160b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162f919061441b565b61163991906146d6565b81526001600160a01b0386811660209283015283546001808201865560009586529483902084516003909202019081559183015193820193909355604090910151600290910180546001600160a01b0319169190921617905561169c818a61472f565b87519099506116ac8660016146d6565b106116b85760006116c3565b6116c38560016146d6565b945050505050611368565b610104546001600160a01b0316634c09e6e86116ea8b8a61472f565b6116f48b8a61472f565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b815260040161173191906145c6565b600060405180830381600087803b15801561174b57600080fd5b505af115801561175f573d6000803e3d6000fd5b5050604080518c8152602081018c90523393507febeaa8785285a4f7c37a305351997dceebabc3c357dab98023dc37514a1b6ed692500160405180910390a2505050505050505050565b60c95460ff16156117cc5760405162461bcd60e51b815260040161086f90614630565b60008051602061484d8339815191526117e58133612a53565b600082116118055760405162461bcd60e51b815260040161086f90614608565b60fd5461181d906001600160a01b0316333085613276565b816101016000828254610e6e91906146d6565b60008060008061183f60355490565b9050801561184d5780611850565b60015b9050600061185c612615565b9050801561186a578061186d565b60015b905060008261187c8389614710565b61188691906146ee565b979296509094509092505050565b60006118a08133612a53565b6118ac60ff8484613fb4565b507f63d269ac72f6157df0c915e6d321d02ae22763652c465e96b1aaa05c5879510283836040516118de9291906145d9565b60405180910390a1505050565b600080600060fb60009054906101000a90046001600160a01b03166001600160a01b031663b7ab4db56040518163ffffffff1660e01b815260040160006040518083038186803b15801561193e57600080fd5b505afa158015611952573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261197a9190810190614223565b905060005b8151811015611a575760fc5482516000916001600160a01b0316906356342d8c908590859081106119b2576119b261480b565b60200260200101516040518263ffffffff1660e01b81526004016119d891815260200190565b60206040518083038186803b1580156119f057600080fd5b505afa158015611a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2891906140de565b90506000611a3582610adf565b509050611a4281866146d6565b9450505080611a50906147c4565b905061197f565b509092915050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611a9860c95460ff1690565b15611ab55760405162461bcd60e51b815260040161086f90614630565b60fc5460405163158d0b6360e21b8152600481018490526000916001600160a01b0316906356342d8c9060240160206040518083038186803b158015611afa57600080fd5b505afa158015611b0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3291906140de565b60fd546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015611b7b57600080fd5b505afa158015611b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb3919061441b565b9050816001600160a01b031663c7b8981c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611bf057600080fd5b505af1158015611c04573d6000803e3d6000fd5b505060fd546040516370a0823160e01b8152306004820152600093508492506001600160a01b03909116906370a082319060240160206040518083038186803b158015611c5057600080fd5b505afa158015611c64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c88919061441b565b611c92919061472f565b9050847f2ae9806e51f82fd2eea12f1b2f042db4c0a1f81a7174d954f859f76ad1b33d2182604051611cc691815260200190565b60405180910390a2949350505050565b606060378054610a4490614789565b600080600080611cf460355490565b90508015611d025780611d05565b60015b90506000611d11612615565b90508015611d1f5780611d22565b60015b905060008161187c8489614710565b3360008181526034602090815260408083206001600160a01b038716845290915281205490919083811015611db65760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161086f565b611dc38286868403612e05565b506001949350505050565b600033610ad5818585612fbb565b60c95460ff1615611dff5760405162461bcd60e51b815260040161086f90614630565b60008111611e1f5760405162461bcd60e51b815260040161086f90614608565b60fd54611e37906001600160a01b0316333084613276565b6000611e4282611ce5565b5050905080610102541015611ea35760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f756768206d617469635820746f20696e7374616e74207377616044820152600760fc1b606482015260840161086f565b611eae303383612ab7565b816101016000828254611ec191906146d6565b92505081905550806101026000828254610e6e919061472f565b60c95460ff1615611efe5760405162461bcd60e51b815260040161086f90614630565b60008051602061484d833981519152611f178133612a53565b81610102541015611f875760405162461bcd60e51b815260206004820152603460248201527f576974686472617720616d6f756e742063616e6e6f7420657863656564206d616044820152731d1a58d6081a5b881a5b9cdd185b9d081c1bdbdb60621b606482015260840161086f565b816101026000828254611f9a919061472f565b90915550506101008054610938913091046001600160a01b031684612ab7565b6000611fc68133612a53565b60c95460ff16611fdb57611fd8613406565b50565b611fd861347b565b600054610100900460ff16611ffe5760005460ff1615612002565b303b155b6120655760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161086f565b600054610100900460ff16158015612087576000805461ffff19166101011790555b61208f6134f5565b61209761351e565b6120eb604051806040016040528060148152602001734c6971756964205374616b696e67204d6174696360601b8152506040518060400160405280600681526020016509ac2e8d2c6b60d31b81525061354d565b6120f66000856132ae565b61210e60008051602061484d833981519152846132ae565b610100805460fb80546001600160a01b038b81166001600160a01b03199283161790925560fc80548b8416908316811790915560fe805488851690841617905560fd80548b851693168317905560ff199288168502929092166001600160a81b0319909316929092176005179092556121899160001961357e565b801561219b576000805461ff00191690555b50505050505050565b6000828152609760205260409020600101546121c08133612a53565b610baf838361320f565b60c95460ff16156121ed5760405162461bcd60e51b815260040161086f90614630565b60006121f98133612a53565b60fb54604051637b96a26160e01b8152600481018490526001600160a01b0390911690637b96a2619060240160206040518083038186803b15801561223d57600080fd5b505afa158015612251573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227591906142d0565b6122cd5760405162461bcd60e51b815260206004820152602360248201527f446f65736e277420657869737420696e2076616c696461746f7220726567697360448201526274727960e81b606482015260840161086f565b60fc5460405163158d0b6360e21b8152600481018490526000916001600160a01b0316906356342d8c9060240160206040518083038186803b15801561231257600080fd5b505afa158015612326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234a91906140de565b6101015460fd546040516370a0823160e01b81523060048201529293506000926001600160a01b03909116906370a082319060240160206040518083038186803b15801561239757600080fd5b505afa1580156123ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123cf919061441b565b6123d9919061472f565b90506000811161241c5760405162461bcd60e51b815260206004820152600e60248201526d526577617264206973207a65726f60901b604482015260640161086f565b610100546000906064906124339060ff1684614710565b61243d91906146ee565b905080156124a55760fe5460fd54612462916001600160a01b03918216911683612ab7565b60fe546040518281526001600160a01b03909116907ffa7e62a609845954a9fb1d5db8e91ccca949db2f340a43e3604ae01cd752f6b59060200160405180910390a25b60006124b1828461472f565b604051636ab1507160e01b815260048101829052600060248201529091506001600160a01b03851690636ab1507190604401602060405180830381600087803b1580156124fd57600080fd5b505af1158015612511573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612535919061441b565b50600061254160355490565b9050600061254d612615565b61010454604080516020810186905280820184905281518082038301815260608201928390526309813cdd60e31b9092529293506001600160a01b0390911691634c09e6e89161259f916064016145c6565b600060405180830381600087803b1580156125b957600080fd5b505af11580156125cd573d6000803e3d6000fd5b50505050877f1ec53fb8c2b09d963869a02e5eb8cd475f82aa1f8a31e29109aaeca4a0075db28460405161260391815260200190565b60405180910390a25050505050505050565b60008061096d6118eb565b600061262e60c95460ff1690565b1561264b5760405162461bcd60e51b815260040161086f90614630565b6000821161266b5760405162461bcd60e51b815260040161086f90614608565b60fd54612683906001600160a01b0316333085613276565b61096d3383612b1a565b60006126998133612a53565b60fe80546001600160a01b0319166001600160a01b0384169081179091556040519081527fcb7ef3e545f5cdb893f5c568ba710fe08f336375a2d9fd66e161033f8fc09ef390602001610d59565b60006126f38133612a53565b60648260ff1611156127475760405162461bcd60e51b815260206004820152601f60248201527f5f66656550657263656e74206d757374206e6f74206578636565642031303000604482015260640161086f565b610100805460ff191660ff84169081179091556040519081527fde69a475f95f27956afb2f1ab8aff3f18e18f95722a293327e78aacd3753c3b590602001610d59565b60c95460ff16156127ad5760405162461bcd60e51b815260040161086f90614630565b61093833826136a2565b60c95460ff16156127da5760405162461bcd60e51b815260040161086f90614630565b60006127e68133612a53565b60fb54604051637b96a26160e01b8152600481018690526001600160a01b0390911690637b96a2619060240160206040518083038186803b15801561282a57600080fd5b505afa15801561283e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286291906142d0565b6128c75760405162461bcd60e51b815260206004820152603060248201527f46726f6d2076616c696461746f7220696420646f6573206e6f7420657869737460448201526f20696e206f757220726567697374727960801b606482015260840161086f565b60fb54604051637b96a26160e01b8152600481018590526001600160a01b0390911690637b96a2619060240160206040518083038186803b15801561290b57600080fd5b505afa15801561291f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294391906142d0565b6129a65760405162461bcd60e51b815260206004820152602e60248201527f546f2076616c696461746f7220696420646f6573206e6f74206578697374206960448201526d6e206f757220726567697374727960901b606482015260840161086f565b60fc54604051633ec7bd4b60e21b81526004810186905260248101859052604481018490526001600160a01b039091169063fb1ef52c90606401600060405180830381600087803b1580156129fa57600080fd5b505af1158015612a0e573d6000803e3d6000fd5b5050505082847fa6aaac144bdbe0896da23698d818b0bbee86d43321e2315147642fd99b2ff0c384604051612a4591815260200190565b60405180910390a350505050565b612a5d8282611a5f565b61093857612a75816001600160a01b03166014613a65565b612a80836020613a65565b604051602001612a919291906144ef565b60408051601f198184030181529082905262461bcd60e51b825261086f916004016145c6565b6040516001600160a01b038316602482015260448101829052610baf90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613c01565b6000612b2860c95460ff1690565b15612b455760405162461bcd60e51b815260040161086f90614630565b6000806000612b5385611ce5565b925092509250612b638684613cd3565b856001600160a01b03167fc205a922ce10fe082feabd05c9b000dd57cbf54ebce16cf596ec84a2df65122f86604051612b9e91815260200190565b60405180910390a260fb5460408051639052b00f60e01b815290516000926001600160a01b031691639052b00f916004808301926020929190829003018186803b158015612beb57600080fd5b505afa158015612bff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c23919061441b565b60fc5460405163158d0b6360e21b8152600481018390529192506000916001600160a01b03909116906356342d8c9060240160206040518083038186803b158015612c6d57600080fd5b505afa158015612c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca591906140de565b604051636ab1507160e01b815260048101899052600060248201529091506001600160a01b03821690636ab1507190604401602060405180830381600087803b158015612cf157600080fd5b505af1158015612d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d29919061441b565b50610104546001600160a01b0316634c09e6e8612d4687876146d6565b612d508a876146d6565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b8152600401612d8d91906145c6565b600060405180830381600087803b158015612da757600080fd5b505af1158015612dbb573d6000803e3d6000fd5b50505050817f8f0a6a275be31c643d9ad67b6710ba8b13d370aeefbaec4c1d1f2ce1f8ed055b88604051612df191815260200190565b60405180910390a250929695505050505050565b6001600160a01b038316612e675760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161086f565b6001600160a01b038216612ec85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161086f565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152603460209081526040808320938616835292905220546000198114612fb55781811015612fa85760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161086f565b612fb58484848403612e05565b50505050565b6001600160a01b03831661301f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161086f565b6001600160a01b0382166130815760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161086f565b6001600160a01b038316600090815260336020526040902054818110156130f95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161086f565b6001600160a01b038085166000908152603360205260408082208585039055918516815290812080548492906131309084906146d6565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161317c91815260200190565b60405180910390a3612fb5565b6131938282611a5f565b6109385760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556131cb3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6132198282611a5f565b156109385760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516001600160a01b0380851660248301528316604482015260648101829052612fb59085906323b872dd60e01b90608401612ae3565b6109388282613189565b6001600160a01b0382166133185760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161086f565b6001600160a01b0382166000908152603360205260409020548181101561338c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161086f565b6001600160a01b03831660009081526033602052604081208383039055603580548492906133bb90849061472f565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b60c95460ff16156134295760405162461bcd60e51b815260040161086f90614630565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861345e3390565b6040516001600160a01b03909116815260200160405180910390a1565b60c95460ff166134c45760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161086f565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3361345e565b600054610100900460ff1661351c5760405162461bcd60e51b815260040161086f9061465a565b565b600054610100900460ff166135455760405162461bcd60e51b815260040161086f9061465a565b61351c613db2565b600054610100900460ff166135745760405162461bcd60e51b815260040161086f9061465a565b6109388282613de5565b8015806136075750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156135cd57600080fd5b505afa1580156135e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613605919061441b565b155b6136725760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161086f565b6040516001600160a01b038316602482015260448101829052610baf90849063095ea7b360e01b90606401612ae3565b60fd546040516370a0823160e01b8152306004820152600091829182916001600160a01b0316906370a082319060240160206040518083038186803b1580156136ea57600080fd5b505afa1580156136fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613722919061441b565b6001600160a01b0386166000908152610103602052604081208054929350918290879081106137535761375361480b565b60009182526020918290206040805160608101825260039093029091018054835260018101548385018190526002909101546001600160a01b039081168484015260fc54835163900cf0cf60e01b81529351949650919491169263900cf0cf926004808201939291829003018186803b1580156137cf57600080fd5b505afa1580156137e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613807919061441b565b101561384d5760405162461bcd60e51b8152602060048201526015602482015274139bdd0818589b19481d1bc818db185a5b481e595d605a1b604482015260640161086f565b604081810151825191516374bfeee160e11b815260048101929092526001600160a01b03169063e97fddc290602401600060405180830381600087803b15801561389657600080fd5b505af11580156138aa573d6000803e3d6000fd5b505083548492506138be915060019061472f565b815481106138ce576138ce61480b565b90600052602060002090600302018287815481106138ee576138ee61480b565b60009182526020909120825460039092020190815560018083015490820155600291820154910180546001600160a01b0319166001600160a01b039092169190911790558154829080613943576139436147f5565b60008281526020812060036000199390930192830201818155600181019190915560020180546001600160a01b0319169055905560fd546040516370a0823160e01b815230600482015284916001600160a01b0316906370a082319060240160206040518083038186803b1580156139ba57600080fd5b505afa1580156139ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139f2919061441b565b6139fc919061472f565b60fd54909450613a16906001600160a01b03168886612ab7565b85876001600160a01b03167f63bfb3a58e0713d68e49dda62c223fab04fb534eeef8ac6356cec78e691c092a86604051613a5291815260200190565b60405180910390a3509195945050505050565b60606000613a74836002614710565b613a7f9060026146d6565b67ffffffffffffffff811115613a9757613a97614821565b6040519080825280601f01601f191660200182016040528015613ac1576020820181803683370190505b509050600360fc1b81600081518110613adc57613adc61480b565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613b0b57613b0b61480b565b60200101906001600160f81b031916908160001a9053506000613b2f846002614710565b613b3a9060016146d6565b90505b6001811115613bb2576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613b6e57613b6e61480b565b1a60f81b828281518110613b8457613b8461480b565b60200101906001600160f81b031916908160001a90535060049490941c93613bab81614772565b9050613b3d565b508315610b825760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161086f565b6000613c56826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e339092919063ffffffff16565b805190915015610baf5780806020019051810190613c7491906142d0565b610baf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161086f565b6001600160a01b038216613d295760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161086f565b8060356000828254613d3b91906146d6565b90915550506001600160a01b03821660009081526033602052604081208054839290613d689084906146d6565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600054610100900460ff16613dd95760405162461bcd60e51b815260040161086f9061465a565b60c9805460ff19169055565b600054610100900460ff16613e0c5760405162461bcd60e51b815260040161086f9061465a565b8151613e1f906036906020850190614038565b508051610baf906037906020840190614038565b6060613e428484600085613e4a565b949350505050565b606082471015613eab5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161086f565b6001600160a01b0385163b613f025760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161086f565b600080866001600160a01b03168587604051613f1e91906144d3565b60006040518083038185875af1925050503d8060008114613f5b576040519150601f19603f3d011682016040523d82523d6000602084013e613f60565b606091505b5091509150613f70828286613f7b565b979650505050505050565b60608315613f8a575081610b82565b825115613f9a5782518084602001fd5b8160405162461bcd60e51b815260040161086f91906145c6565b828054613fc090614789565b90600052602060002090601f016020900481019282613fe25760008555614028565b82601f10613ffb5782800160ff19823516178555614028565b82800160010185558215614028579182015b8281111561402857823582559160200191906001019061400d565b506140349291506140ac565b5090565b82805461404490614789565b90600052602060002090601f0160209004810192826140665760008555614028565b82601f1061407f57805160ff1916838001178555614028565b82800160010185558215614028579182015b82811115614028578251825591602001919060010190614091565b5b8082111561403457600081556001016140ad565b6000602082840312156140d357600080fd5b8135610b8281614837565b6000602082840312156140f057600080fd5b8151610b8281614837565b6000806040838503121561410e57600080fd5b823561411981614837565b9150602083013561412981614837565b809150509250929050565b60008060008060008060c0878903121561414d57600080fd5b863561415881614837565b9550602087013561416881614837565b9450604087013561417881614837565b9350606087013561418881614837565b9250608087013561419881614837565b915060a08701356141a881614837565b809150509295509295509295565b6000806000606084860312156141cb57600080fd5b83356141d681614837565b925060208401356141e681614837565b929592945050506040919091013590565b6000806040838503121561420a57600080fd5b823561421581614837565b946020939093013593505050565b6000602080838503121561423657600080fd5b825167ffffffffffffffff8082111561424e57600080fd5b818501915085601f83011261426257600080fd5b81518181111561427457614274614821565b8060051b91506142858483016146a5565b8181528481019084860184860187018a10156142a057600080fd5b600095505b838610156142c35780518352600195909501949186019186016142a5565b5098975050505050505050565b6000602082840312156142e257600080fd5b81518015158114610b8257600080fd5b60006020828403121561430457600080fd5b5035919050565b6000806040838503121561431e57600080fd5b82359150602083013561412981614837565b60006020828403121561434257600080fd5b81356001600160e01b031981168114610b8257600080fd5b6000806020838503121561436d57600080fd5b823567ffffffffffffffff8082111561438557600080fd5b818501915085601f83011261439957600080fd5b8135818111156143a857600080fd5b8660208285010111156143ba57600080fd5b60209290920196919550909350505050565b6000604082840312156143de57600080fd5b6040516040810181811067ffffffffffffffff8211171561440157614401614821565b604052825181526020928301519281019290925250919050565b60006020828403121561442d57600080fd5b5051919050565b6000806040838503121561444757600080fd5b505080516020909101519092909150565b60008060006060848603121561446d57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561449657600080fd5b813560ff81168114610b8257600080fd5b600081518084526144bf816020860160208601614746565b601f01601f19169290920160200192915050565b600082516144e5818460208701614746565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614527816017850160208801614746565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614558816028840160208801614746565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b828110156145b95781518051855286810151878601528501516001600160a01b03168585015260609093019290850190600101614581565b5091979650505050505050565b602081526000610b8260208301846144a7565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020808252600e908201526d125b9d985b1a5908185b5bdd5b9d60921b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff811182821017156146ce576146ce614821565b604052919050565b600082198211156146e9576146e96147df565b500190565b60008261470b57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561472a5761472a6147df565b500290565b600082821015614741576147416147df565b500390565b60005b83811015614761578181015183820152602001614749565b83811115612fb55750506000910152565b600081614781576147816147df565b506000190190565b600181811c9082168061479d57607f821691505b602082108114156147be57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156147d8576147d86147df565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611fd857600080fdfe2572658b6bf2c752d416f25a897890508cdc1ac8fd4845e04dcb7ecd022249fba2646970667358221220f098c0ec537dfc52f6d93ac095d67b8024dac0ed9f268d37101d104b4976485664736f6c63430008070033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103825760003560e01c8063788bc78c116101de578063c4ae31681161010f578063e00222a0116100ad578063f0f442601161007c578063f0f4426014610800578063f483817614610813578063f844443614610826578063fb1ef52c1461083957600080fd5b8063e00222a0146107aa578063e062b10b146107b2578063e72db5fd146107c6578063ea99c2a6146107ed57600080fd5b8063cc2a9a5b116100e9578063cc2a9a5b14610738578063d547741f1461074b578063dcea4be91461075e578063dd62ed3e1461077157600080fd5b8063c4ae316814610711578063c759352d14610719578063cba45a7c1461072357600080fd5b80639683e28e1161017c578063a9059cbb11610156578063a9059cbb146106a5578063baec30ca146106b8578063c1e324a5146106cb578063c3a2a93a146106de57600080fd5b80639683e28e14610677578063a217fddf1461068a578063a457c2d71461069257600080fd5b806389dfa025116101b857806389dfa0251461063f57806391d14854146106495780639342c8f41461065c57806395d89b411461066f57600080fd5b8063788bc78c146106165780637e978af8146106295780637fd6f15c1461063157600080fd5b806340c10f19116102b8578063701845b81161025657806373f0ecdf1161023057806373f0ecdf146105af578063745400c9146105c257806374b7b2d2146105d557806375a85ef5146105e857600080fd5b8063701845b81461056057806370a082311461057357806370bf9fe91461059c57600080fd5b80635c975abb116102925780635c975abb1461050f57806361d027b31461051a57806368c05c971461052d5780636c9302281461054057600080fd5b806340c10f19146104e157806349773050146104f457806354fd4d501461050757600080fd5b80631e7ff8f6116103255780632f2ff15d116102ff5780632f2ff15d14610493578063313ce567146104a657806336568abe146104bb57806339509351146104ce57600080fd5b80631e7ff8f61461043557806323b872dd1461045d578063248a9ca31461047057600080fd5b806306fdde031161036157806306fdde03146103cc578063095ea7b3146103e157806318160ddd146103f45780631c0831241461040657600080fd5b8062fd822c1461038757806301ffc9a71461039c57806302b09f2e146103c4575b600080fd5b61039a6103953660046142f2565b61084c565b005b6103af6103aa366004614330565b61093c565b60405190151581526020015b60405180910390f35b61039a610973565b6103d4610a35565b6040516103bb91906145c6565b6103af6103ef3660046141f7565b610ac7565b6035545b6040519081526020016103bb565b610100805461041d916001600160a01b0391041681565b6040516001600160a01b0390911681526020016103bb565b6104486104433660046140c1565b610adf565b604080519283526020830191909152016103bb565b6103af61046b3660046141b6565b610b63565b6103f861047e3660046142f2565b60009081526097602052604090206001015490565b61039a6104a136600461430b565b610b89565b60125b60405160ff90911681526020016103bb565b61039a6104c936600461430b565b610bb4565b6103af6104dc3660046141f7565b610c2e565b61039a6104ef3660046141f7565b610c6d565b61039a6105023660046140c1565b610d03565b6103d4610d65565b60c95460ff166103af565b60fe5461041d906001600160a01b031681565b61039a61053b3660046142f2565b610df3565b61055361054e3660046140c1565b610e77565b6040516103bb9190614564565b61039a61056e3660046140c1565b610f10565b6103f86105813660046140c1565b6001600160a01b031660009081526033602052604090205490565b61039a6105aa3660046140c1565b611016565b6103f86105bd3660046141f7565b611071565b61039a6105d03660046142f2565b611165565b61039a6105e33660046142f2565b6117a9565b6105fb6105f63660046142f2565b611830565b604080519384526020840192909252908201526060016103bb565b61039a61062436600461435a565b611894565b6103f86118eb565b610100546104a99060ff1681565b6103f86101015481565b6103af61065736600461430b565b611a5f565b6103f861066a3660046142f2565b611a8a565b6103d4611cd6565b6105fb6106853660046142f2565b611ce5565b6103f8600081565b6103af6106a03660046141f7565b611d31565b6103af6106b33660046141f7565b611dce565b61039a6106c63660046142f2565b611ddc565b61039a6106d93660046142f2565b611edb565b60fc5460fd5460fb54604080516001600160a01b03948516815292841660208401529216918101919091526060016103bb565b61039a611fba565b6103f86101025481565b6103f860008051602061484d83398151915281565b61039a610746366004614134565b611fe3565b61039a61075936600461430b565b6121a4565b61039a61076c3660046142f2565b6121ca565b6103f861077f3660046140fb565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6103f8612615565b6101045461041d906001600160a01b031681565b6103f87f12ff340d0cd9c652c747ca35727e68c547d0f0bfa7758d2e77f75acef481b4f281565b6103f86107fb3660046142f2565b612620565b61039a61080e3660046140c1565b61268d565b61039a610821366004614484565b6126e7565b61039a6108343660046142f2565b61278a565b61039a610847366004614458565b6127b7565b60c95460ff16156108785760405162461bcd60e51b815260040161086f90614630565b60405180910390fd5b60008051602061484d8339815191526108918133612a53565b816101015410156109005760405162461bcd60e51b815260206004820152603360248201527f576974686472617720616d6f756e742063616e6e6f7420657863656564206d616044820152721d1a58c81a5b881a5b9cdd185b9d081c1bdbdb606a1b606482015260840161086f565b816101016000828254610913919061472f565b9091555050610100805460fd54610938926001600160a01b0391821692041684612ab7565b5050565b60006001600160e01b03198216637965db0b60e01b148061096d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60c95460ff16156109965760405162461bcd60e51b815260040161086f90614630565b60008051602061484d8339815191526109af8133612a53565b60006101015411610a025760405162461bcd60e51b815260206004820152601860248201527f4d6174696320616d6f756e742063616e6e6f7420626520300000000000000000604482015260640161086f565b6000610a113061010154612b1a565b9050806101026000828254610a2691906146d6565b90915550506000610101555050565b606060368054610a4490614789565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7090614789565b8015610abd5780601f10610a9257610100808354040283529160200191610abd565b820191906000526020600020905b815481529060010190602001808311610aa057829003601f168201915b5050505050905090565b600033610ad5818585612e05565b5060019392505050565b604051630f3ffc7b60e11b815230600482015260009081906001600160a01b03841690631e7ff8f690602401604080518083038186803b158015610b2257600080fd5b505afa158015610b36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5a9190614434565b91509150915091565b600033610b71858285612f29565b610b7c858585612fbb565b60019150505b9392505050565b600082815260976020526040902060010154610ba58133612a53565b610baf8383613189565b505050565b6001600160a01b0381163314610c245760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161086f565b610938828261320f565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190610ad59082908690610c689087906146d6565b612e05565b60c95460ff1615610c905760405162461bcd60e51b815260040161086f90614630565b7f12ff340d0cd9c652c747ca35727e68c547d0f0bfa7758d2e77f75acef481b4f2610cbb8133612a53565b826001600160a01b03167ff027eb54ed614a8bfda36d8cafda4ab4acc6e5c37696e443dfa5e2161eda696083604051610cf691815260200190565b60405180910390a2505050565b6000610d0f8133612a53565b60fb80546001600160a01b0319166001600160a01b0384169081179091556040519081527fa517f86b521912d95237e24eb8fe8f28d5b167b2a02e4fff3ca27f1da9fd125f906020015b60405180910390a15050565b60ff8054610d7290614789565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9e90614789565b8015610deb5780601f10610dc057610100808354040283529160200191610deb565b820191906000526020600020905b815481529060010190602001808311610dce57829003601f168201915b505050505081565b60c95460ff1615610e165760405162461bcd60e51b815260040161086f90614630565b60008051602061484d833981519152610e2f8133612a53565b60008211610e4f5760405162461bcd60e51b815260040161086f90614608565b610e5b30338185613276565b816101026000828254610e6e91906146d6565b90915550505050565b6001600160a01b038116600090815261010360209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610f05576000848152602090819020604080516060810182526003860290920180548352600180820154848601526002909101546001600160a01b0316918301919091529083529092019101610eb0565b505050509050919050565b6000610f1c8133612a53565b6101008054046001600160a01b039081169083161415610f7e5760405162461bcd60e51b815260206004820152601a60248201527f4f6c642061646472657373203d3d206e65772061646472657373000000000000604482015260640161086f565b6101008054610fa69160008051602061484d83398151915291046001600160a01b031661320f565b6101008054610100600160a81b0319166001600160a01b0384168202179055610fdd60008051602061484d833981519152836132ae565b6040516001600160a01b03831681527f655166b35cc2872bea49c3cc867c962f7da955e7fd4f5ad9285d913bab5ed39c90602001610d59565b60006110228133612a53565b61010480546001600160a01b0319166001600160a01b0384169081179091556040519081527f3945349f2164c50436e3da71a2721b2aedd89159dd2946c421e923ce6228c51b90602001610d59565b6001600160a01b03821660009081526101036020526040812080548291908490811061109f5761109f61480b565b60009182526020808320604080516060810182526003949094029091018054808552600182015493850193909352600201546001600160a01b0316838201819052905163795be58760e01b81523060048201526024810192909252919350909190829063795be58790604401604080518083038186803b15801561112257600080fd5b505afa158015611136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115a91906143cc565b519695505050505050565b60c95460ff16156111885760405162461bcd60e51b815260040161086f90614630565b600081116111a85760405162461bcd60e51b815260040161086f90614608565b60008060006111b684611830565b9250925092506111c633856132b8565b8260006111d16118eb565b90508481101561121a5760405162461bcd60e51b8152602060048201526014602482015273546f6f206d75636820746f20776974686472617760601b604482015260640161086f565b60fb546040805163b7ab4db560e01b815290516000926001600160a01b03169163b7ab4db59160048083019286929190829003018186803b15801561125e57600080fd5b505afa158015611272573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261129a9190810190614223565b9050600060fb60009054906101000a90046001600160a01b03166001600160a01b031663aafb9c416040518163ffffffff1660e01b815260040160206040518083038186803b1580156112ec57600080fd5b505afa158015611300573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611324919061441b565b905060005b8251811015611368578281815181106113445761134461480b565b602002602001015182141561135857611368565b611361816147c4565b9050611329565b84156116ce5760008382815181106113825761138261480b565b602090810291909101015160fc5460405163158d0b6360e21b8152600481018390529192506000916001600160a01b03909116906356342d8c9060240160206040518083038186803b1580156113d757600080fd5b505afa1580156113eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140f91906140de565b9050600061141c82610adf565b50905060008882111561142f5788611431565b815b60405163c83ec04d60e01b81526004810182905260001960248201529091506001600160a01b0384169063c83ec04d90604401600060405180830381600087803b15801561147e57600080fd5b505af1158015611492573d6000803e3d6000fd5b505033600090815261010360205260409081902081516060810192839052630c11b08160e21b90925230606483015292509050806001600160a01b038616633046c2046084830160206040518083038186803b1580156114f157600080fd5b505afa158015611505573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611529919061441b565b815260fc546040805163a7ab696160e01b815290516020938401936001600160a01b039093169263a7ab69619260048082019391829003018186803b15801561157157600080fd5b505afa158015611585573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a9919061441b565b60fc60009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f757600080fd5b505afa15801561160b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162f919061441b565b61163991906146d6565b81526001600160a01b0386811660209283015283546001808201865560009586529483902084516003909202019081559183015193820193909355604090910151600290910180546001600160a01b0319169190921617905561169c818a61472f565b87519099506116ac8660016146d6565b106116b85760006116c3565b6116c38560016146d6565b945050505050611368565b610104546001600160a01b0316634c09e6e86116ea8b8a61472f565b6116f48b8a61472f565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b815260040161173191906145c6565b600060405180830381600087803b15801561174b57600080fd5b505af115801561175f573d6000803e3d6000fd5b5050604080518c8152602081018c90523393507febeaa8785285a4f7c37a305351997dceebabc3c357dab98023dc37514a1b6ed692500160405180910390a2505050505050505050565b60c95460ff16156117cc5760405162461bcd60e51b815260040161086f90614630565b60008051602061484d8339815191526117e58133612a53565b600082116118055760405162461bcd60e51b815260040161086f90614608565b60fd5461181d906001600160a01b0316333085613276565b816101016000828254610e6e91906146d6565b60008060008061183f60355490565b9050801561184d5780611850565b60015b9050600061185c612615565b9050801561186a578061186d565b60015b905060008261187c8389614710565b61188691906146ee565b979296509094509092505050565b60006118a08133612a53565b6118ac60ff8484613fb4565b507f63d269ac72f6157df0c915e6d321d02ae22763652c465e96b1aaa05c5879510283836040516118de9291906145d9565b60405180910390a1505050565b600080600060fb60009054906101000a90046001600160a01b03166001600160a01b031663b7ab4db56040518163ffffffff1660e01b815260040160006040518083038186803b15801561193e57600080fd5b505afa158015611952573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261197a9190810190614223565b905060005b8151811015611a575760fc5482516000916001600160a01b0316906356342d8c908590859081106119b2576119b261480b565b60200260200101516040518263ffffffff1660e01b81526004016119d891815260200190565b60206040518083038186803b1580156119f057600080fd5b505afa158015611a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2891906140de565b90506000611a3582610adf565b509050611a4281866146d6565b9450505080611a50906147c4565b905061197f565b509092915050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611a9860c95460ff1690565b15611ab55760405162461bcd60e51b815260040161086f90614630565b60fc5460405163158d0b6360e21b8152600481018490526000916001600160a01b0316906356342d8c9060240160206040518083038186803b158015611afa57600080fd5b505afa158015611b0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3291906140de565b60fd546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015611b7b57600080fd5b505afa158015611b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb3919061441b565b9050816001600160a01b031663c7b8981c6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611bf057600080fd5b505af1158015611c04573d6000803e3d6000fd5b505060fd546040516370a0823160e01b8152306004820152600093508492506001600160a01b03909116906370a082319060240160206040518083038186803b158015611c5057600080fd5b505afa158015611c64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c88919061441b565b611c92919061472f565b9050847f2ae9806e51f82fd2eea12f1b2f042db4c0a1f81a7174d954f859f76ad1b33d2182604051611cc691815260200190565b60405180910390a2949350505050565b606060378054610a4490614789565b600080600080611cf460355490565b90508015611d025780611d05565b60015b90506000611d11612615565b90508015611d1f5780611d22565b60015b905060008161187c8489614710565b3360008181526034602090815260408083206001600160a01b038716845290915281205490919083811015611db65760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161086f565b611dc38286868403612e05565b506001949350505050565b600033610ad5818585612fbb565b60c95460ff1615611dff5760405162461bcd60e51b815260040161086f90614630565b60008111611e1f5760405162461bcd60e51b815260040161086f90614608565b60fd54611e37906001600160a01b0316333084613276565b6000611e4282611ce5565b5050905080610102541015611ea35760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f756768206d617469635820746f20696e7374616e74207377616044820152600760fc1b606482015260840161086f565b611eae303383612ab7565b816101016000828254611ec191906146d6565b92505081905550806101026000828254610e6e919061472f565b60c95460ff1615611efe5760405162461bcd60e51b815260040161086f90614630565b60008051602061484d833981519152611f178133612a53565b81610102541015611f875760405162461bcd60e51b815260206004820152603460248201527f576974686472617720616d6f756e742063616e6e6f7420657863656564206d616044820152731d1a58d6081a5b881a5b9cdd185b9d081c1bdbdb60621b606482015260840161086f565b816101026000828254611f9a919061472f565b90915550506101008054610938913091046001600160a01b031684612ab7565b6000611fc68133612a53565b60c95460ff16611fdb57611fd8613406565b50565b611fd861347b565b600054610100900460ff16611ffe5760005460ff1615612002565b303b155b6120655760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161086f565b600054610100900460ff16158015612087576000805461ffff19166101011790555b61208f6134f5565b61209761351e565b6120eb604051806040016040528060148152602001734c6971756964205374616b696e67204d6174696360601b8152506040518060400160405280600681526020016509ac2e8d2c6b60d31b81525061354d565b6120f66000856132ae565b61210e60008051602061484d833981519152846132ae565b610100805460fb80546001600160a01b038b81166001600160a01b03199283161790925560fc80548b8416908316811790915560fe805488851690841617905560fd80548b851693168317905560ff199288168502929092166001600160a81b0319909316929092176005179092556121899160001961357e565b801561219b576000805461ff00191690555b50505050505050565b6000828152609760205260409020600101546121c08133612a53565b610baf838361320f565b60c95460ff16156121ed5760405162461bcd60e51b815260040161086f90614630565b60006121f98133612a53565b60fb54604051637b96a26160e01b8152600481018490526001600160a01b0390911690637b96a2619060240160206040518083038186803b15801561223d57600080fd5b505afa158015612251573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227591906142d0565b6122cd5760405162461bcd60e51b815260206004820152602360248201527f446f65736e277420657869737420696e2076616c696461746f7220726567697360448201526274727960e81b606482015260840161086f565b60fc5460405163158d0b6360e21b8152600481018490526000916001600160a01b0316906356342d8c9060240160206040518083038186803b15801561231257600080fd5b505afa158015612326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234a91906140de565b6101015460fd546040516370a0823160e01b81523060048201529293506000926001600160a01b03909116906370a082319060240160206040518083038186803b15801561239757600080fd5b505afa1580156123ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123cf919061441b565b6123d9919061472f565b90506000811161241c5760405162461bcd60e51b815260206004820152600e60248201526d526577617264206973207a65726f60901b604482015260640161086f565b610100546000906064906124339060ff1684614710565b61243d91906146ee565b905080156124a55760fe5460fd54612462916001600160a01b03918216911683612ab7565b60fe546040518281526001600160a01b03909116907ffa7e62a609845954a9fb1d5db8e91ccca949db2f340a43e3604ae01cd752f6b59060200160405180910390a25b60006124b1828461472f565b604051636ab1507160e01b815260048101829052600060248201529091506001600160a01b03851690636ab1507190604401602060405180830381600087803b1580156124fd57600080fd5b505af1158015612511573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612535919061441b565b50600061254160355490565b9050600061254d612615565b61010454604080516020810186905280820184905281518082038301815260608201928390526309813cdd60e31b9092529293506001600160a01b0390911691634c09e6e89161259f916064016145c6565b600060405180830381600087803b1580156125b957600080fd5b505af11580156125cd573d6000803e3d6000fd5b50505050877f1ec53fb8c2b09d963869a02e5eb8cd475f82aa1f8a31e29109aaeca4a0075db28460405161260391815260200190565b60405180910390a25050505050505050565b60008061096d6118eb565b600061262e60c95460ff1690565b1561264b5760405162461bcd60e51b815260040161086f90614630565b6000821161266b5760405162461bcd60e51b815260040161086f90614608565b60fd54612683906001600160a01b0316333085613276565b61096d3383612b1a565b60006126998133612a53565b60fe80546001600160a01b0319166001600160a01b0384169081179091556040519081527fcb7ef3e545f5cdb893f5c568ba710fe08f336375a2d9fd66e161033f8fc09ef390602001610d59565b60006126f38133612a53565b60648260ff1611156127475760405162461bcd60e51b815260206004820152601f60248201527f5f66656550657263656e74206d757374206e6f74206578636565642031303000604482015260640161086f565b610100805460ff191660ff84169081179091556040519081527fde69a475f95f27956afb2f1ab8aff3f18e18f95722a293327e78aacd3753c3b590602001610d59565b60c95460ff16156127ad5760405162461bcd60e51b815260040161086f90614630565b61093833826136a2565b60c95460ff16156127da5760405162461bcd60e51b815260040161086f90614630565b60006127e68133612a53565b60fb54604051637b96a26160e01b8152600481018690526001600160a01b0390911690637b96a2619060240160206040518083038186803b15801561282a57600080fd5b505afa15801561283e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286291906142d0565b6128c75760405162461bcd60e51b815260206004820152603060248201527f46726f6d2076616c696461746f7220696420646f6573206e6f7420657869737460448201526f20696e206f757220726567697374727960801b606482015260840161086f565b60fb54604051637b96a26160e01b8152600481018590526001600160a01b0390911690637b96a2619060240160206040518083038186803b15801561290b57600080fd5b505afa15801561291f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294391906142d0565b6129a65760405162461bcd60e51b815260206004820152602e60248201527f546f2076616c696461746f7220696420646f6573206e6f74206578697374206960448201526d6e206f757220726567697374727960901b606482015260840161086f565b60fc54604051633ec7bd4b60e21b81526004810186905260248101859052604481018490526001600160a01b039091169063fb1ef52c90606401600060405180830381600087803b1580156129fa57600080fd5b505af1158015612a0e573d6000803e3d6000fd5b5050505082847fa6aaac144bdbe0896da23698d818b0bbee86d43321e2315147642fd99b2ff0c384604051612a4591815260200190565b60405180910390a350505050565b612a5d8282611a5f565b61093857612a75816001600160a01b03166014613a65565b612a80836020613a65565b604051602001612a919291906144ef565b60408051601f198184030181529082905262461bcd60e51b825261086f916004016145c6565b6040516001600160a01b038316602482015260448101829052610baf90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613c01565b6000612b2860c95460ff1690565b15612b455760405162461bcd60e51b815260040161086f90614630565b6000806000612b5385611ce5565b925092509250612b638684613cd3565b856001600160a01b03167fc205a922ce10fe082feabd05c9b000dd57cbf54ebce16cf596ec84a2df65122f86604051612b9e91815260200190565b60405180910390a260fb5460408051639052b00f60e01b815290516000926001600160a01b031691639052b00f916004808301926020929190829003018186803b158015612beb57600080fd5b505afa158015612bff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c23919061441b565b60fc5460405163158d0b6360e21b8152600481018390529192506000916001600160a01b03909116906356342d8c9060240160206040518083038186803b158015612c6d57600080fd5b505afa158015612c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca591906140de565b604051636ab1507160e01b815260048101899052600060248201529091506001600160a01b03821690636ab1507190604401602060405180830381600087803b158015612cf157600080fd5b505af1158015612d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d29919061441b565b50610104546001600160a01b0316634c09e6e8612d4687876146d6565b612d508a876146d6565b6040805160208101939093528201526060016040516020818303038152906040526040518263ffffffff1660e01b8152600401612d8d91906145c6565b600060405180830381600087803b158015612da757600080fd5b505af1158015612dbb573d6000803e3d6000fd5b50505050817f8f0a6a275be31c643d9ad67b6710ba8b13d370aeefbaec4c1d1f2ce1f8ed055b88604051612df191815260200190565b60405180910390a250929695505050505050565b6001600160a01b038316612e675760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161086f565b6001600160a01b038216612ec85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161086f565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152603460209081526040808320938616835292905220546000198114612fb55781811015612fa85760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161086f565b612fb58484848403612e05565b50505050565b6001600160a01b03831661301f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161086f565b6001600160a01b0382166130815760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161086f565b6001600160a01b038316600090815260336020526040902054818110156130f95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161086f565b6001600160a01b038085166000908152603360205260408082208585039055918516815290812080548492906131309084906146d6565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161317c91815260200190565b60405180910390a3612fb5565b6131938282611a5f565b6109385760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556131cb3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6132198282611a5f565b156109385760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516001600160a01b0380851660248301528316604482015260648101829052612fb59085906323b872dd60e01b90608401612ae3565b6109388282613189565b6001600160a01b0382166133185760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161086f565b6001600160a01b0382166000908152603360205260409020548181101561338c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161086f565b6001600160a01b03831660009081526033602052604081208383039055603580548492906133bb90849061472f565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b60c95460ff16156134295760405162461bcd60e51b815260040161086f90614630565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861345e3390565b6040516001600160a01b03909116815260200160405180910390a1565b60c95460ff166134c45760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161086f565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3361345e565b600054610100900460ff1661351c5760405162461bcd60e51b815260040161086f9061465a565b565b600054610100900460ff166135455760405162461bcd60e51b815260040161086f9061465a565b61351c613db2565b600054610100900460ff166135745760405162461bcd60e51b815260040161086f9061465a565b6109388282613de5565b8015806136075750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156135cd57600080fd5b505afa1580156135e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613605919061441b565b155b6136725760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161086f565b6040516001600160a01b038316602482015260448101829052610baf90849063095ea7b360e01b90606401612ae3565b60fd546040516370a0823160e01b8152306004820152600091829182916001600160a01b0316906370a082319060240160206040518083038186803b1580156136ea57600080fd5b505afa1580156136fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613722919061441b565b6001600160a01b0386166000908152610103602052604081208054929350918290879081106137535761375361480b565b60009182526020918290206040805160608101825260039093029091018054835260018101548385018190526002909101546001600160a01b039081168484015260fc54835163900cf0cf60e01b81529351949650919491169263900cf0cf926004808201939291829003018186803b1580156137cf57600080fd5b505afa1580156137e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613807919061441b565b101561384d5760405162461bcd60e51b8152602060048201526015602482015274139bdd0818589b19481d1bc818db185a5b481e595d605a1b604482015260640161086f565b604081810151825191516374bfeee160e11b815260048101929092526001600160a01b03169063e97fddc290602401600060405180830381600087803b15801561389657600080fd5b505af11580156138aa573d6000803e3d6000fd5b505083548492506138be915060019061472f565b815481106138ce576138ce61480b565b90600052602060002090600302018287815481106138ee576138ee61480b565b60009182526020909120825460039092020190815560018083015490820155600291820154910180546001600160a01b0319166001600160a01b039092169190911790558154829080613943576139436147f5565b60008281526020812060036000199390930192830201818155600181019190915560020180546001600160a01b0319169055905560fd546040516370a0823160e01b815230600482015284916001600160a01b0316906370a082319060240160206040518083038186803b1580156139ba57600080fd5b505afa1580156139ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139f2919061441b565b6139fc919061472f565b60fd54909450613a16906001600160a01b03168886612ab7565b85876001600160a01b03167f63bfb3a58e0713d68e49dda62c223fab04fb534eeef8ac6356cec78e691c092a86604051613a5291815260200190565b60405180910390a3509195945050505050565b60606000613a74836002614710565b613a7f9060026146d6565b67ffffffffffffffff811115613a9757613a97614821565b6040519080825280601f01601f191660200182016040528015613ac1576020820181803683370190505b509050600360fc1b81600081518110613adc57613adc61480b565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613b0b57613b0b61480b565b60200101906001600160f81b031916908160001a9053506000613b2f846002614710565b613b3a9060016146d6565b90505b6001811115613bb2576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613b6e57613b6e61480b565b1a60f81b828281518110613b8457613b8461480b565b60200101906001600160f81b031916908160001a90535060049490941c93613bab81614772565b9050613b3d565b508315610b825760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161086f565b6000613c56826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e339092919063ffffffff16565b805190915015610baf5780806020019051810190613c7491906142d0565b610baf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161086f565b6001600160a01b038216613d295760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161086f565b8060356000828254613d3b91906146d6565b90915550506001600160a01b03821660009081526033602052604081208054839290613d689084906146d6565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600054610100900460ff16613dd95760405162461bcd60e51b815260040161086f9061465a565b60c9805460ff19169055565b600054610100900460ff16613e0c5760405162461bcd60e51b815260040161086f9061465a565b8151613e1f906036906020850190614038565b508051610baf906037906020840190614038565b6060613e428484600085613e4a565b949350505050565b606082471015613eab5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161086f565b6001600160a01b0385163b613f025760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161086f565b600080866001600160a01b03168587604051613f1e91906144d3565b60006040518083038185875af1925050503d8060008114613f5b576040519150601f19603f3d011682016040523d82523d6000602084013e613f60565b606091505b5091509150613f70828286613f7b565b979650505050505050565b60608315613f8a575081610b82565b825115613f9a5782518084602001fd5b8160405162461bcd60e51b815260040161086f91906145c6565b828054613fc090614789565b90600052602060002090601f016020900481019282613fe25760008555614028565b82601f10613ffb5782800160ff19823516178555614028565b82800160010185558215614028579182015b8281111561402857823582559160200191906001019061400d565b506140349291506140ac565b5090565b82805461404490614789565b90600052602060002090601f0160209004810192826140665760008555614028565b82601f1061407f57805160ff1916838001178555614028565b82800160010185558215614028579182015b82811115614028578251825591602001919060010190614091565b5b8082111561403457600081556001016140ad565b6000602082840312156140d357600080fd5b8135610b8281614837565b6000602082840312156140f057600080fd5b8151610b8281614837565b6000806040838503121561410e57600080fd5b823561411981614837565b9150602083013561412981614837565b809150509250929050565b60008060008060008060c0878903121561414d57600080fd5b863561415881614837565b9550602087013561416881614837565b9450604087013561417881614837565b9350606087013561418881614837565b9250608087013561419881614837565b915060a08701356141a881614837565b809150509295509295509295565b6000806000606084860312156141cb57600080fd5b83356141d681614837565b925060208401356141e681614837565b929592945050506040919091013590565b6000806040838503121561420a57600080fd5b823561421581614837565b946020939093013593505050565b6000602080838503121561423657600080fd5b825167ffffffffffffffff8082111561424e57600080fd5b818501915085601f83011261426257600080fd5b81518181111561427457614274614821565b8060051b91506142858483016146a5565b8181528481019084860184860187018a10156142a057600080fd5b600095505b838610156142c35780518352600195909501949186019186016142a5565b5098975050505050505050565b6000602082840312156142e257600080fd5b81518015158114610b8257600080fd5b60006020828403121561430457600080fd5b5035919050565b6000806040838503121561431e57600080fd5b82359150602083013561412981614837565b60006020828403121561434257600080fd5b81356001600160e01b031981168114610b8257600080fd5b6000806020838503121561436d57600080fd5b823567ffffffffffffffff8082111561438557600080fd5b818501915085601f83011261439957600080fd5b8135818111156143a857600080fd5b8660208285010111156143ba57600080fd5b60209290920196919550909350505050565b6000604082840312156143de57600080fd5b6040516040810181811067ffffffffffffffff8211171561440157614401614821565b604052825181526020928301519281019290925250919050565b60006020828403121561442d57600080fd5b5051919050565b6000806040838503121561444757600080fd5b505080516020909101519092909150565b60008060006060848603121561446d57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561449657600080fd5b813560ff81168114610b8257600080fd5b600081518084526144bf816020860160208601614746565b601f01601f19169290920160200192915050565b600082516144e5818460208701614746565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614527816017850160208801614746565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614558816028840160208801614746565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b828110156145b95781518051855286810151878601528501516001600160a01b03168585015260609093019290850190600101614581565b5091979650505050505050565b602081526000610b8260208301846144a7565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020808252600e908201526d125b9d985b1a5908185b5bdd5b9d60921b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff811182821017156146ce576146ce614821565b604052919050565b600082198211156146e9576146e96147df565b500190565b60008261470b57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561472a5761472a6147df565b500290565b600082821015614741576147416147df565b500390565b60005b83811015614761578181015183820152602001614749565b83811115612fb55750506000910152565b600081614781576147816147df565b506000190190565b600181811c9082168061479d57607f821691505b602082108114156147be57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156147d8576147d86147df565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611fd857600080fdfe2572658b6bf2c752d416f25a897890508cdc1ac8fd4845e04dcb7ecd022249fba2646970667358221220f098c0ec537dfc52f6d93ac095d67b8024dac0ed9f268d37101d104b4976485664736f6c63430008070033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 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.