MATIC Price: $0.362742 (-19.82%)
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Token Holdings

Sponsored

Transaction Hash
Method
Block
From
To
Initialize566932722024-05-07 18:45:4689 days ago1715107546IN
0xD6f5781b...72D36b6dd
0 MATIC0.0007882830.00000005
Initialize566931412024-05-07 18:41:0789 days ago1715107267IN
0xD6f5781b...72D36b6dd
0 MATIC0.0063493230.00000007
Swap Matic X For...502644012023-11-22 19:58:04256 days ago1700683084IN
0xD6f5781b...72D36b6dd
0 MATIC0.0007406131.04000001
Swap Matic For M...414209672023-04-11 21:35:19481 days ago1681248919IN
0xD6f5781b...72D36b6dd
0.1 MATIC0.0050476100
Swap Matic For M...414208092023-04-11 21:29:43481 days ago1681248583IN
0xD6f5781b...72D36b6dd
0 MATIC0.0050476100
0x60806040294072622022-06-10 19:47:29786 days ago1654890449IN
 Create: ChildPool
0 MATIC0.39429749170

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ChildPool

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 14 : ChildPool.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

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 "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";

import "./interfaces/IChildPool.sol";
import "./interfaces/IFxStateChildTunnel.sol";

contract ChildPool is
	IChildPool,
	Initializable,
	AccessControlUpgradeable,
	PausableUpgradeable
{
	using SafeERC20Upgradeable for IERC20Upgradeable;

	bytes32 public constant INSTANT_POOL_OWNER = keccak256("IPO");

	address private fxStateChildTunnel;
	address private maticX;
	address private trustedForwarder;

	address payable public override treasury;
	address payable public override instantPoolOwner;
	uint256 public override instantPoolMatic;
	uint256 public override instantPoolMaticX;

	string public override version;
	uint256 public override instantWithdrawalFeeBps;
	uint256 public override instantWithdrawalFees;

	mapping(address => MaticXSwapRequest[]) private userMaticXSwapRequests;
	uint256 public override claimedMatic;
	uint256 public override maticXSwapLockPeriod;

	/**
	 * @param _fxStateChildTunnel - Address of the fxStateChildTunnel contract
	 * @param _maticX - Address of maticX token on Polygon
	 * @param _manager - Address of the manager
	 * @param _instantPoolOwner - Address of the instant pool owner
	 * @param _treasury - Address of the treasury
	 * @param _instantWithdrawalFeeBps - Fee basis points for using instant withdrawal feature
	 */
	function initialize(
		address _fxStateChildTunnel,
		address _maticX,
		address _manager,
		address payable _instantPoolOwner,
		address payable _treasury,
		uint256 _instantWithdrawalFeeBps
	) external initializer {
		__AccessControl_init();
		__Pausable_init();

		_setupRole(DEFAULT_ADMIN_ROLE, _manager);
		_setupRole(INSTANT_POOL_OWNER, _instantPoolOwner);
		instantPoolOwner = _instantPoolOwner;
		treasury = _treasury;

		fxStateChildTunnel = _fxStateChildTunnel;
		maticX = _maticX;
		instantWithdrawalFeeBps = _instantWithdrawalFeeBps;
	}

	////////////////////////////////////////////////////////////
	/////                                                    ///
	/////             ***Instant Pool Interactions***        ///
	/////                                                    ///
	////////////////////////////////////////////////////////////

	function provideInstantPoolMatic()
		external
		payable
		override
		whenNotPaused
		onlyRole(INSTANT_POOL_OWNER)
	{
		require(msg.value > 0, "Invalid amount");

		instantPoolMatic += msg.value;
	}

	function provideInstantPoolMaticX(uint256 _amount)
		external
		override
		whenNotPaused
		onlyRole(INSTANT_POOL_OWNER)
	{
		require(_amount > 0, "Invalid amount");

		instantPoolMaticX += _amount;
		IERC20Upgradeable(maticX).safeTransferFrom(
			_msgSender(),
			address(this),
			_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(maticX).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;
		AddressUpgradeable.sendValue(instantPoolOwner, _amount);
	}

	function withdrawInstantWithdrawalFees(uint256 _amount)
		external
		override
		whenNotPaused
	{
		require(
			instantWithdrawalFees >= _amount,
			"Withdraw amount cannot exceed collected matic in instantWithdrawalFees"
		);

		instantWithdrawalFees -= _amount;
		AddressUpgradeable.sendValue(treasury, _amount);
	}

	function swapMaticForMaticXViaInstantPool()
		external
		payable
		override
		whenNotPaused
	{
		require(msg.value > 0, "Invalid amount");
		instantPoolMatic += msg.value;

		(uint256 amountInMaticX, , ) = convertMaticToMaticX(msg.value);
		require(
			instantPoolMaticX >= amountInMaticX,
			"Not enough maticX to instant swap"
		);

		instantPoolMaticX -= amountInMaticX;
		IERC20Upgradeable(maticX).safeTransfer(_msgSender(), amountInMaticX);
	}

	function setMaticXSwapLockPeriod(uint256 _hours)
		external
		override
		onlyRole(DEFAULT_ADMIN_ROLE)
	{
		require(_hours <= 720, "_hours must not exceed 720 (1 month)");

		maticXSwapLockPeriod = _hours * 1 hours;

		emit SetMaticXSwapLockPeriodEvent(_hours);
	}

	///@dev returns maticXSwapLockPeriod or 24 hours (default value) in seconds
	function getMaticXSwapLockPeriod() public view override returns (uint256) {
		return (maticXSwapLockPeriod > 0) ? maticXSwapLockPeriod : 24 hours;
	}

	///@dev request maticX->matic swap from instant pool
	function requestMaticXSwap(uint256 _amount)
		external
		override
		whenNotPaused
		returns (uint256)
	{
		require(_amount > 0, "Invalid amount");

		IERC20Upgradeable(maticX).safeTransferFrom(
			_msgSender(),
			address(this),
			_amount
		);
		instantPoolMaticX += _amount;

		(uint256 amountInMatic, , ) = convertMaticXToMatic(_amount);

		require(
			instantPoolMatic >= amountInMatic,
			"Sorry we don't have enough matic in the instant pool to facilitate this swap"
		);

		instantPoolMatic -= amountInMatic;
		claimedMatic += amountInMatic;
		userMaticXSwapRequests[_msgSender()].push(
			MaticXSwapRequest(
				amountInMatic,
				block.timestamp,
				block.timestamp + getMaticXSwapLockPeriod()
			)
		);
		uint256 idx = userMaticXSwapRequests[_msgSender()].length - 1;
		emit RequestMaticXSwap(_msgSender(), _amount, amountInMatic, idx);
		return idx;
	}

	function getUserMaticXSwapRequests(address _address)
		external
		view
		override
		returns (MaticXSwapRequest[] memory)
	{
		return userMaticXSwapRequests[_address];
	}

	///@dev claim earlier requested maticX->matic swap from instant pool
	function claimMaticXSwap(uint256 _idx) external override whenNotPaused {
		_claimMaticXSwap(_msgSender(), _idx);
	}

	function _claimMaticXSwap(address _to, uint256 _idx) internal {
		MaticXSwapRequest[] storage userRequests = userMaticXSwapRequests[_to];
		require(_idx < userRequests.length, "Invalid Index");
		MaticXSwapRequest memory userRequest = userRequests[_idx];

		require(
			block.timestamp >= userRequest.withdrawalTime,
			"Please wait for the bonding period to get over"
		);

		claimedMatic -= userRequest.amount;
		userRequests[_idx] = userRequests[userRequests.length - 1];
		userRequests.pop();
		AddressUpgradeable.sendValue(payable(_to), userRequest.amount);

		emit ClaimMaticXSwap(_to, _idx, userRequest.amount);
	}

	function swapMaticXForMaticViaInstantPool(uint256 _amount)
		external
		override
		whenNotPaused
	{
		// TODO: it is disabled for now!
		revert("Disabled");

		// require(_amount > 0, "Invalid amount");
		// instantPoolMaticX += _amount;
		// IERC20Upgradeable(maticX).safeTransferFrom(
		// 	_msgSender(),
		// 	address(this),
		// 	_amount
		// );

		// (uint256 amountInMatic, , ) = IFxStateChildTunnel(fxStateChildTunnel)
		// 	.convertMaticXToMatic(_amount);
		// (
		// 	uint256 amountInMaticAfterFees,
		// 	uint256 fees
		// ) = getAmountAfterInstantWithdrawalFees(amountInMatic);
		// require(
		// 	instantPoolMatic >= amountInMaticAfterFees,
		// 	"Not enough matic to instant swap"
		// );

		// instantPoolMatic -= amountInMaticAfterFees;
		// instantWithdrawalFees += fees;
		// IERC20Upgradeable(polygonERC20).safeTransfer(
		// 	_msgSender(),
		// 	amountInMaticAfterFees
		// );
		// emit CollectedInstantWithdrawalFees(fees);
	}

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

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

	function setTreasury(address payable _address)
		external
		override
		onlyRole(DEFAULT_ADMIN_ROLE)
	{
		treasury = _address;

		emit SetTreasury(_address);
	}

	function setInstantPoolOwner(address payable _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 setFxStateChildTunnel(address _address)
		external
		override
		onlyRole(DEFAULT_ADMIN_ROLE)
	{
		fxStateChildTunnel = _address;

		emit SetFxStateChildTunnel(_address);
	}

	/**
	 * @dev Function that sets instant withdrawal fee basis points
	 * @notice Callable only by admin
	 * @param _feeBps - Fee basis points (100 = 0.1%)
	 */
	function setInstantWithdrawalFeeBps(uint256 _feeBps)
		external
		override
		onlyRole(DEFAULT_ADMIN_ROLE)
	{
		require(_feeBps <= 10000, "_feeBps must not exceed 10000 (100%)");

		instantWithdrawalFeeBps = _feeBps;

		emit SetInstantWithdrawalFeeBps(_feeBps);
	}

	/**
	 * @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***                      ///
	/////                                                    ///
	////////////////////////////////////////////////////////////

	function convertMaticXToMatic(uint256 _balance)
		public
		view
		override
		returns (
			uint256,
			uint256,
			uint256
		)
	{
		return
			IFxStateChildTunnel(fxStateChildTunnel).convertMaticXToMatic(
				_balance
			);
	}

	function convertMaticToMaticX(uint256 _balance)
		public
		view
		override
		returns (
			uint256,
			uint256,
			uint256
		)
	{
		return
			IFxStateChildTunnel(fxStateChildTunnel).convertMaticToMaticX(
				_balance
			);
	}

	function getAmountAfterInstantWithdrawalFees(uint256 _amount)
		public
		view
		override
		returns (uint256, uint256)
	{
		uint256 fees = (_amount * instantWithdrawalFeeBps) / 10000;

		return (_amount - fees, fees);
	}

	function getContracts()
		external
		view
		override
		returns (
			address _fxStateChildTunnel,
			address _maticX,
			address _trustedForwarder
		)
	{
		_fxStateChildTunnel = fxStateChildTunnel;
		_maticX = maticX;
		_trustedForwarder = trustedForwarder;
	}

	////////////////////////////////////////////////////////////
	/////                                                    ///
	/////                 ***MetaTx***                       ///
	/////                                                    ///
	////////////////////////////////////////////////////////////

	function setTrustedForwarder(address _address)
		external
		override
		onlyRole(DEFAULT_ADMIN_ROLE)
	{
		trustedForwarder = _address;

		emit SetTrustedForwarder(_address);
	}

	function isTrustedForwarder(address _address)
		public
		view
		virtual
		returns (bool)
	{
		return _address == trustedForwarder;
	}

	function _msgSender()
		internal
		view
		virtual
		override
		returns (address sender)
	{
		if (isTrustedForwarder(msg.sender)) {
			// The assembly code is more direct than the Solidity version using `abi.decode`.
			assembly {
				sender := shr(96, calldataload(sub(calldatasize(), 20)))
			}
		} else {
			return super._msgSender();
		}
	}

	function _msgData()
		internal
		view
		virtual
		override
		returns (bytes calldata)
	{
		if (isTrustedForwarder(msg.sender)) {
			return msg.data[:msg.data.length - 20];
		} else {
			return super._msgData();
		}
	}
}

File 2 of 14 : AccessControlUpgradeable.sol
// 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;
}

File 3 of 14 : IERC20Upgradeable.sol
// 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);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __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;
}

File 6 of 14 : Initializable.sol
// 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));
    }
}

File 7 of 14 : AddressUpgradeable.sol
// 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);
            }
        }
    }
}

File 8 of 14 : IChildPool.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

interface IChildPool {
	struct MaticXSwapRequest {
		uint256 amount;
		uint256 requestTime;
		uint256 withdrawalTime;
	}

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

	function claimedMatic() external view returns (uint256);

	function maticXSwapLockPeriod() external view returns (uint256);

	function treasury() external view returns (address payable);

	function instantPoolOwner() external view returns (address payable);

	function instantPoolMatic() external view returns (uint256);

	function instantPoolMaticX() external view returns (uint256);

	function instantWithdrawalFees() external view returns (uint256);

	function instantWithdrawalFeeBps() external view returns (uint256);

	function provideInstantPoolMatic() external payable;

	function provideInstantPoolMaticX(uint256 _amount) external;

	function withdrawInstantPoolMaticX(uint256 _amount) external;

	function withdrawInstantPoolMatic(uint256 _amount) external;

	function withdrawInstantWithdrawalFees(uint256 _amount) external;

	function swapMaticForMaticXViaInstantPool() external payable;

	function swapMaticXForMaticViaInstantPool(uint256 _amount) external;

	function getMaticXSwapLockPeriod() external view returns (uint256);

	function setMaticXSwapLockPeriod(uint256 _hours) external;

	function getUserMaticXSwapRequests(address _address)
		external
		view
		returns (MaticXSwapRequest[] memory);

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

	function claimMaticXSwap(uint256 _idx) external;

	function setTreasury(address payable _address) external;

	function setInstantPoolOwner(address payable _address) external;

	function setFxStateChildTunnel(address _address) external;

	function setInstantWithdrawalFeeBps(uint256 _feeBps) external;

	function setTrustedForwarder(address _address) external;

	function setVersion(string calldata _version) 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 getAmountAfterInstantWithdrawalFees(uint256 _amount)
		external
		view
		returns (uint256, uint256);

	function getContracts()
		external
		view
		returns (
			address _fxStateChildTunnel,
			address _maticX,
			address _trustedForwarder
		);

	event SetTreasury(address _address);
	event SetInstantPoolOwner(address _address);
	event SetFxStateChildTunnel(address _address);
	event SetTrustedForwarder(address _address);
	event SetVersion(string _version);
	event CollectedInstantWithdrawalFees(uint256 _fees);
	event SetInstantWithdrawalFeeBps(uint256 _feeBps);
	event SetMaticXSwapLockPeriodEvent(uint256 _hours);
	event ClaimMaticXSwap(
		address indexed _from,
		uint256 indexed _idx,
		uint256 _amountClaimed
	);

	event RequestMaticXSwap(
		address indexed _from,
		uint256 _amountMaticX,
		uint256 _amountMatic,
		uint256 userSwapRequestsIndex
	);
}

File 9 of 14 : IFxStateChildTunnel.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;

interface IFxStateChildTunnel {
	function latestStateId() external view returns (uint256);

	function latestRootMessageSender() external view returns (address);

	function latestData() external view returns (bytes memory);

	function sendMessageToRoot(bytes memory message) external;

	function setFxRootTunnel(address _fxRootTunnel) external;

	function getReserves() external view returns (uint256, uint256);

	function getRate() external view returns (uint256);

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

	function convertMaticToMaticX(uint256 _balance)
		external
		view
		returns (
			uint256,
			uint256,
			uint256
		);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    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;
}

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

pragma solidity ^0.8.0;

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

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"uint256","name":"_idx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountClaimed","type":"uint256"}],"name":"ClaimMaticXSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fees","type":"uint256"}],"name":"CollectedInstantWithdrawalFees","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"},{"indexed":false,"internalType":"uint256","name":"userSwapRequestsIndex","type":"uint256"}],"name":"RequestMaticXSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"SetFxStateChildTunnel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"SetInstantPoolOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_feeBps","type":"uint256"}],"name":"SetInstantWithdrawalFeeBps","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_hours","type":"uint256"}],"name":"SetMaticXSwapLockPeriodEvent","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":"SetTrustedForwarder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_version","type":"string"}],"name":"SetVersion","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","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":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"claimMaticXSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimedMatic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getAmountAfterInstantWithdrawalFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContracts","outputs":[{"internalType":"address","name":"_fxStateChildTunnel","type":"address"},{"internalType":"address","name":"_maticX","type":"address"},{"internalType":"address","name":"_trustedForwarder","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaticXSwapLockPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getUserMaticXSwapRequests","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"requestTime","type":"uint256"},{"internalType":"uint256","name":"withdrawalTime","type":"uint256"}],"internalType":"struct IChildPool.MaticXSwapRequest[]","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":"_fxStateChildTunnel","type":"address"},{"internalType":"address","name":"_maticX","type":"address"},{"internalType":"address","name":"_manager","type":"address"},{"internalType":"address payable","name":"_instantPoolOwner","type":"address"},{"internalType":"address payable","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_instantWithdrawalFeeBps","type":"uint256"}],"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 payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instantWithdrawalFeeBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"instantWithdrawalFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maticXSwapLockPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provideInstantPoolMatic","outputs":[],"stateMutability":"payable","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":"requestMaticXSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address","name":"_address","type":"address"}],"name":"setFxStateChildTunnel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_address","type":"address"}],"name":"setInstantPoolOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeBps","type":"uint256"}],"name":"setInstantWithdrawalFeeBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_hours","type":"uint256"}],"name":"setMaticXSwapLockPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_address","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_version","type":"string"}],"name":"setVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapMaticForMaticXViaInstantPool","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"swapMaticXForMaticViaInstantPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address payable","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":"_amount","type":"uint256"}],"name":"withdrawInstantWithdrawalFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506128fe806100206000396000f3fe60806040526004361061025b5760003560e01c806377baf20911610144578063c759352d116100b6578063da7422281161007a578063da74222814610729578063e82d73e614610749578063e9ce053214610751578063ec7467ed14610786578063edb64ec01461079b578063f0f44260146107c857600080fd5b8063c759352d146106a9578063c78cf1a0146106bf578063cba45a7c146106c7578063d3bf9d59146106e9578063d547741f1461070957600080fd5b80639683e28e116101085780639683e28e146105e95780639ea87b2d14610609578063a217fddf1461061f578063c1e324a514610634578063c3a2a93a14610654578063c4ae31681461069457600080fd5b806377baf20914610553578063788bc78c1461057357806389dfa0251461059357806391d14854146105a957806395b6ef0c146105c957600080fd5b806336568abe116101dd5780635c975abb116101a15780635c975abb1461048057806361d027b31461049857806368c05c97146104b8578063701845b8146104d857806372be8891146104f857806375a85ef51461051857600080fd5b806336568abe146103d957806348eaf6d6146103f95780634aa6164d1461041957806354fd4d501461042f578063572b6c051461045157600080fd5b80631c083124116102245780631c083124146103175780631dd5d34c1461034f5780631e89a13714610373578063248a9ca3146103895780632f2ff15d146103b957600080fd5b8062fd822c1461026057806301ffc9a71461028257806313acce6a146102b757806313d0255e146102d7578063174b151c146102f7575b600080fd5b34801561026c57600080fd5b5061028061027b366004612451565b6107e8565b005b34801561028e57600080fd5b506102a261029d36600461249a565b6108d3565b60405190151581526020015b60405180910390f35b3480156102c357600080fd5b506102806102d2366004612451565b61090a565b3480156102e357600080fd5b506102806102f2366004612451565b6109b3565b34801561030357600080fd5b50610280610312366004612399565b610a8d565b34801561032357600080fd5b5060cd54610337906001600160a01b031681565b6040516001600160a01b0390911681526020016102ae565b34801561035b57600080fd5b5061036560d45481565b6040519081526020016102ae565b34801561037f57600080fd5b5061036560d15481565b34801561039557600080fd5b506103656103a4366004612451565b60009081526065602052604090206001015490565b3480156103c557600080fd5b506102806103d436600461246a565b610ae9565b3480156103e557600080fd5b506102806103f436600461246a565b610b16565b34801561040557600080fd5b50610365610414366004612451565b610ba0565b34801561042557600080fd5b5061036560d25481565b34801561043b57600080fd5b50610444610e05565b6040516102ae919061267d565b34801561045d57600080fd5b506102a261046c366004612399565b60cb546001600160a01b0391821691161490565b34801561048c57600080fd5b5060975460ff166102a2565b3480156104a457600080fd5b5060cc54610337906001600160a01b031681565b3480156104c457600080fd5b506102806104d3366004612451565b610e93565b3480156104e457600080fd5b506102806104f3366004612399565b610f14565b34801561050457600080fd5b50610280610513366004612451565b611011565b34801561052457600080fd5b50610538610533366004612451565b6110bc565b604080519384526020840192909252908201526060016102ae565b34801561055f57600080fd5b5061028061056e366004612451565b61114b565b34801561057f57600080fd5b5061028061058e3660046124c4565b61117f565b34801561059f57600080fd5b5061036560ce5481565b3480156105b557600080fd5b506102a26105c436600461246a565b6111d8565b3480156105d557600080fd5b506102806105e43660046123b6565b611203565b3480156105f557600080fd5b50610538610604366004612451565b611344565b34801561061557600080fd5b5061036560d55481565b34801561062b57600080fd5b50610365600081565b34801561064057600080fd5b5061028061064f366004612451565b61137a565b34801561066057600080fd5b5060c95460ca5460cb54604080516001600160a01b03948516815292841660208401529216918101919091526060016102ae565b3480156106a057600080fd5b5061028061145b565b3480156106b557600080fd5b5061036560cf5481565b610280611483565b3480156106d357600080fd5b506103656000805160206128a983398151915281565b3480156106f557600080fd5b50610280610704366004612451565b61157f565b34801561071557600080fd5b5061028061072436600461246a565b6115d5565b34801561073557600080fd5b50610280610744366004612399565b6115fd565b610280611659565b34801561075d57600080fd5b5061077161076c366004612451565b6116d1565b604080519283526020830191909152016102ae565b34801561079257600080fd5b50610365611706565b3480156107a757600080fd5b506107bb6107b6366004612399565b611720565b6040516102ae91906125f5565b3480156107d457600080fd5b506102806107e3366004612399565b6117b3565b60975460ff16156108145760405162461bcd60e51b815260040161080b906126d8565b60405180910390fd5b6000805160206128a98339815191526108348161082f61180f565b611837565b8160ce5410156108a25760405162461bcd60e51b815260206004820152603360248201527f576974686472617720616d6f756e742063616e6e6f7420657863656564206d616044820152721d1a58c81a5b881a5b9cdd185b9d081c1bdbdb606a1b606482015260840161080b565b8160ce60008282546108b491906127a6565b909155505060cd546108cf906001600160a01b03168361189b565b5050565b60006001600160e01b03198216637965db0b60e01b148061090457506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006109188161082f61180f565b6127108211156109765760405162461bcd60e51b8152602060048201526024808201527f5f666565427073206d757374206e6f74206578636565642031303030302028316044820152633030252960e01b606482015260840161080b565b60d18290556040518281527ff4e904151506e99aac05f72edf50e48babc4cf26500fd10b096210c51755a2de906020015b60405180910390a15050565b60975460ff16156109d65760405162461bcd60e51b815260040161080b906126d8565b8060d2541015610a5d5760405162461bcd60e51b815260206004820152604660248201527f576974686472617720616d6f756e742063616e6e6f742065786365656420636f60448201527f6c6c6563746564206d6174696320696e20696e7374616e745769746864726177606482015265616c4665657360d01b608482015260a40161080b565b8060d26000828254610a6f91906127a6565b909155505060cc54610a8a906001600160a01b03168261189b565b50565b6000610a9b8161082f61180f565b60c980546001600160a01b0319166001600160a01b0384169081179091556040519081527ffc1cc3f090c8622ac209ec8a7deabca32ef223096e08844b47f699fb083d4382906020016109a7565b600082815260656020526040902060010154610b078161082f61180f565b610b1183836119b4565b505050565b610b1e61180f565b6001600160a01b0316816001600160a01b031614610b965760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161080b565b6108cf8282611a3b565b6000610bae60975460ff1690565b15610bcb5760405162461bcd60e51b815260040161080b906126d8565b60008211610beb5760405162461bcd60e51b815260040161080b906126b0565b610c0a610bf661180f565b60ca546001600160a01b0316903085611ac0565b8160cf6000828254610c1c919061274d565b9091555060009050610c2d836110bc565b505090508060ce541015610cbe5760405162461bcd60e51b815260206004820152604c60248201527f536f72727920776520646f6e2774206861766520656e6f756768206d6174696360448201527f20696e2074686520696e7374616e7420706f6f6c20746f20666163696c69746160648201526b07465207468697320737761760a41b608482015260a40161080b565b8060ce6000828254610cd091906127a6565b925050819055508060d46000828254610ce9919061274d565b9091555060d390506000610cfb61180f565b6001600160a01b03166001600160a01b031681526020019081526020016000206040518060600160405280838152602001428152602001610d3a611706565b610d44904261274d565b90528154600181810184556000938452602080852084516003909402019283558301518282015560409092015160029091015560d382610d8261180f565b6001600160a01b03168152602081019190915260400160002054610da691906127a6565b9050610db061180f565b60408051868152602081018590529081018390526001600160a01b0391909116907fe4ab2eb98dc2b8ccf81f65743176eb1a6cf829d4307d33f01ec583041e493db39060600160405180910390a29392505050565b60d08054610e1290612800565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3e90612800565b8015610e8b5780601f10610e6057610100808354040283529160200191610e8b565b820191906000526020600020905b815481529060010190602001808311610e6e57829003601f168201915b505050505081565b60975460ff1615610eb65760405162461bcd60e51b815260040161080b906126d8565b6000805160206128a9833981519152610ed18161082f61180f565b60008211610ef15760405162461bcd60e51b815260040161080b906126b0565b8160cf6000828254610f03919061274d565b909155506108cf9050610bf661180f565b6000610f228161082f61180f565b60cd546001600160a01b0383811691161415610f805760405162461bcd60e51b815260206004820152601a60248201527f4f6c642061646472657373203d3d206e65772061646472657373000000000000604482015260640161080b565b60cd54610fa5906000805160206128a9833981519152906001600160a01b0316611a3b565b60cd80546001600160a01b0319166001600160a01b038416179055610fd86000805160206128a983398151915283611b31565b6040516001600160a01b03831681527f655166b35cc2872bea49c3cc867c962f7da955e7fd4f5ad9285d913bab5ed39c906020016109a7565b600061101f8161082f61180f565b6102d082111561107d5760405162461bcd60e51b8152602060048201526024808201527f5f686f757273206d757374206e6f742065786365656420373230202831206d6f6044820152636e74682960e01b606482015260840161080b565b61108982610e10612787565b60d5556040518281527f1898424283701bff1815e2eb4aaf8b2efb42ac7f19823d00cdb57ade022239e1906020016109a7565b60c9546040516375a85ef560e01b815260048101839052600091829182916001600160a01b0316906375a85ef5906024015b60606040518083038186803b15801561110657600080fd5b505afa15801561111a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113e9190612536565b9250925092509193909250565b60975460ff161561116e5760405162461bcd60e51b815260040161080b906126d8565b610a8a61117961180f565b82611b3b565b600061118d8161082f61180f565b61119960d08484612300565b507f63d269ac72f6157df0c915e6d321d02ae22763652c465e96b1aaa05c5879510283836040516111cb92919061264e565b60405180910390a1505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600054610100900460ff1661121e5760005460ff1615611222565b303b155b6112855760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161080b565b600054610100900460ff161580156112a7576000805461ffff19166101011790555b6112af611d5d565b6112b7611d86565b6112c2600086611b31565b6112da6000805160206128a983398151915285611b31565b60cd80546001600160a01b038087166001600160a01b03199283161790925560cc805486841690831617905560c980548a841690831617905560ca80549289169290911691909117905560d1829055801561133b576000805461ff00191690555b50505050505050565b60c954604051634b41f14760e11b815260048101839052600091829182916001600160a01b031690639683e28e906024016110ee565b60975460ff161561139d5760405162461bcd60e51b815260040161080b906126d8565b6000805160206128a98339815191526113b88161082f61180f565b8160cf5410156114275760405162461bcd60e51b815260206004820152603460248201527f576974686472617720616d6f756e742063616e6e6f7420657863656564206d616044820152731d1a58d6081a5b881a5b9cdd185b9d081c1bdbdb60621b606482015260840161080b565b8160cf600082825461143991906127a6565b909155505060cd5460ca546108cf916001600160a01b03918216911684611db5565b60006114698161082f61180f565b60975460ff1661147b57610a8a611de5565b610a8a611e5b565b60975460ff16156114a65760405162461bcd60e51b815260040161080b906126d8565b600034116114c65760405162461bcd60e51b815260040161080b906126b0565b3460ce60008282546114d8919061274d565b90915550600090506114e934611344565b505090508060cf5410156115495760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f756768206d617469635820746f20696e7374616e74207377616044820152600760fc1b606482015260840161080b565b8060cf600082825461155b91906127a6565b90915550610a8a905061156c61180f565b60ca546001600160a01b03169083611db5565b60975460ff16156115a25760405162461bcd60e51b815260040161080b906126d8565b60405162461bcd60e51b8152602060048201526008602482015267111a5cd8589b195960c21b604482015260640161080b565b6000828152606560205260409020600101546115f38161082f61180f565b610b118383611a3b565b600061160b8161082f61180f565b60cb80546001600160a01b0319166001600160a01b0384169081179091556040519081527f8c2bee8063bb4464870b7dfa415ebb2fe80bfa73ba20d6fbf0d42791274667ff906020016109a7565b60975460ff161561167c5760405162461bcd60e51b815260040161080b906126d8565b6000805160206128a98339815191526116978161082f61180f565b600034116116b75760405162461bcd60e51b815260040161080b906126b0565b3460ce60008282546116c9919061274d565b909155505050565b600080600061271060d154856116e79190612787565b6116f19190612765565b90506116fd81856127a6565b94909350915050565b60008060d5541161171957506201518090565b5060d55490565b6001600160a01b038116600090815260d360209081526040808320805482518185028101850190935280835260609492939192909184015b828210156117a85783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190611758565b505050509050919050565b60006117c18161082f61180f565b60cc80546001600160a01b0319166001600160a01b0384169081179091556040519081527fcb7ef3e545f5cdb893f5c568ba710fe08f336375a2d9fd66e161033f8fc09ef3906020016109a7565b60cb546000906001600160a01b0316331415611832575060131936013560601c90565b503390565b61184182826111d8565b6108cf57611859816001600160a01b03166014611ed7565b611864836020611ed7565b604051602001611875929190612580565b60408051601f198184030181529082905262461bcd60e51b825261080b9160040161267d565b804710156118eb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161080b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611938576040519150601f19603f3d011682016040523d82523d6000602084013e61193d565b606091505b5050905080610b115760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161080b565b6119be82826111d8565b6108cf5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556119f761180f565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611a4582826111d8565b156108cf5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19169055611a7c61180f565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6040516001600160a01b0380851660248301528316604482015260648101829052611b2b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261207a565b50505050565b6108cf82826119b4565b6001600160a01b038216600090815260d36020526040902080548210611b935760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c84092dcc8caf609b1b604482015260640161080b565b6000818381548110611ba757611ba7612867565b9060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505090508060400151421015611c4b5760405162461bcd60e51b815260206004820152602e60248201527f506c65617365207761697420666f722074686520626f6e64696e67207065726960448201526d37b2103a379033b2ba1037bb32b960911b606482015260840161080b565b805160d48054600090611c5f9084906127a6565b909155505081548290611c74906001906127a6565b81548110611c8457611c84612867565b9060005260206000209060030201828481548110611ca457611ca4612867565b600091825260209091208254600390920201908155600180830154908201556002918201549101558154829080611cdd57611cdd612851565b600082815260208120600360001990930192830201818155600181018290556002015590558051611d0f90859061189b565b82846001600160a01b03167f0c41df34337bedfb475937c70f33606f6e3c44695e9e18d667a856df778afd4e8360000151604051611d4f91815260200190565b60405180910390a350505050565b600054610100900460ff16611d845760405162461bcd60e51b815260040161080b90612702565b565b600054610100900460ff16611dad5760405162461bcd60e51b815260040161080b90612702565b611d8461214c565b6040516001600160a01b038316602482015260448101829052610b1190849063a9059cbb60e01b90606401611af4565b60975460ff1615611e085760405162461bcd60e51b815260040161080b906126d8565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e3e61180f565b6040516001600160a01b03909116815260200160405180910390a1565b60975460ff16611ea45760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161080b565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611e3e61180f565b60606000611ee6836002612787565b611ef190600261274d565b67ffffffffffffffff811115611f0957611f0961287d565b6040519080825280601f01601f191660200182016040528015611f33576020820181803683370190505b509050600360fc1b81600081518110611f4e57611f4e612867565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611f7d57611f7d612867565b60200101906001600160f81b031916908160001a9053506000611fa1846002612787565b611fac90600161274d565b90505b6001811115612024576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611fe057611fe0612867565b1a60f81b828281518110611ff657611ff6612867565b60200101906001600160f81b031916908160001a90535060049490941c9361201d816127e9565b9050611faf565b5083156120735760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161080b565b9392505050565b60006120cf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661217f9092919063ffffffff16565b805190915015610b1157808060200190518101906120ed919061242f565b610b115760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161080b565b600054610100900460ff166121735760405162461bcd60e51b815260040161080b90612702565b6097805460ff19169055565b606061218e8484600085612196565b949350505050565b6060824710156121f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161080b565b6001600160a01b0385163b61224e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161080b565b600080866001600160a01b0316858760405161226a9190612564565b60006040518083038185875af1925050503d80600081146122a7576040519150601f19603f3d011682016040523d82523d6000602084013e6122ac565b606091505b50915091506122bc8282866122c7565b979650505050505050565b606083156122d6575081612073565b8251156122e65782518084602001fd5b8160405162461bcd60e51b815260040161080b919061267d565b82805461230c90612800565b90600052602060002090601f01602090048101928261232e5760008555612374565b82601f106123475782800160ff19823516178555612374565b82800160010185558215612374579182015b82811115612374578235825591602001919060010190612359565b50612380929150612384565b5090565b5b808211156123805760008155600101612385565b6000602082840312156123ab57600080fd5b813561207381612893565b60008060008060008060c087890312156123cf57600080fd5b86356123da81612893565b955060208701356123ea81612893565b945060408701356123fa81612893565b9350606087013561240a81612893565b9250608087013561241a81612893565b8092505060a087013590509295509295509295565b60006020828403121561244157600080fd5b8151801515811461207357600080fd5b60006020828403121561246357600080fd5b5035919050565b6000806040838503121561247d57600080fd5b82359150602083013561248f81612893565b809150509250929050565b6000602082840312156124ac57600080fd5b81356001600160e01b03198116811461207357600080fd5b600080602083850312156124d757600080fd5b823567ffffffffffffffff808211156124ef57600080fd5b818501915085601f83011261250357600080fd5b81358181111561251257600080fd5b86602082850101111561252457600080fd5b60209290920196919550909350505050565b60008060006060848603121561254b57600080fd5b8351925060208401519150604084015190509250925092565b600082516125768184602087016127bd565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516125b88160178501602088016127bd565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516125e98160288401602088016127bd565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b828110156126415781518051855286810151878601528501518585015260609093019290850190600101612612565b5091979650505050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b602081526000825180602084015261269c8160408501602087016127bd565b601f01601f19169190910160400192915050565b6020808252600e908201526d125b9d985b1a5908185b5bdd5b9d60921b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082198211156127605761276061283b565b500190565b60008261278257634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156127a1576127a161283b565b500290565b6000828210156127b8576127b861283b565b500390565b60005b838110156127d85781810151838201526020016127c0565b83811115611b2b5750506000910152565b6000816127f8576127f861283b565b506000190190565b600181811c9082168061281457607f821691505b6020821081141561283557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a8a57600080fdfe2572658b6bf2c752d416f25a897890508cdc1ac8fd4845e04dcb7ecd022249fba26469706673582212205e02bbbf040e9cce082e00b41a2522434b740e9a361035dd4a64583775e0ef7364736f6c63430008070033

Deployed Bytecode

0x60806040526004361061025b5760003560e01c806377baf20911610144578063c759352d116100b6578063da7422281161007a578063da74222814610729578063e82d73e614610749578063e9ce053214610751578063ec7467ed14610786578063edb64ec01461079b578063f0f44260146107c857600080fd5b8063c759352d146106a9578063c78cf1a0146106bf578063cba45a7c146106c7578063d3bf9d59146106e9578063d547741f1461070957600080fd5b80639683e28e116101085780639683e28e146105e95780639ea87b2d14610609578063a217fddf1461061f578063c1e324a514610634578063c3a2a93a14610654578063c4ae31681461069457600080fd5b806377baf20914610553578063788bc78c1461057357806389dfa0251461059357806391d14854146105a957806395b6ef0c146105c957600080fd5b806336568abe116101dd5780635c975abb116101a15780635c975abb1461048057806361d027b31461049857806368c05c97146104b8578063701845b8146104d857806372be8891146104f857806375a85ef51461051857600080fd5b806336568abe146103d957806348eaf6d6146103f95780634aa6164d1461041957806354fd4d501461042f578063572b6c051461045157600080fd5b80631c083124116102245780631c083124146103175780631dd5d34c1461034f5780631e89a13714610373578063248a9ca3146103895780632f2ff15d146103b957600080fd5b8062fd822c1461026057806301ffc9a71461028257806313acce6a146102b757806313d0255e146102d7578063174b151c146102f7575b600080fd5b34801561026c57600080fd5b5061028061027b366004612451565b6107e8565b005b34801561028e57600080fd5b506102a261029d36600461249a565b6108d3565b60405190151581526020015b60405180910390f35b3480156102c357600080fd5b506102806102d2366004612451565b61090a565b3480156102e357600080fd5b506102806102f2366004612451565b6109b3565b34801561030357600080fd5b50610280610312366004612399565b610a8d565b34801561032357600080fd5b5060cd54610337906001600160a01b031681565b6040516001600160a01b0390911681526020016102ae565b34801561035b57600080fd5b5061036560d45481565b6040519081526020016102ae565b34801561037f57600080fd5b5061036560d15481565b34801561039557600080fd5b506103656103a4366004612451565b60009081526065602052604090206001015490565b3480156103c557600080fd5b506102806103d436600461246a565b610ae9565b3480156103e557600080fd5b506102806103f436600461246a565b610b16565b34801561040557600080fd5b50610365610414366004612451565b610ba0565b34801561042557600080fd5b5061036560d25481565b34801561043b57600080fd5b50610444610e05565b6040516102ae919061267d565b34801561045d57600080fd5b506102a261046c366004612399565b60cb546001600160a01b0391821691161490565b34801561048c57600080fd5b5060975460ff166102a2565b3480156104a457600080fd5b5060cc54610337906001600160a01b031681565b3480156104c457600080fd5b506102806104d3366004612451565b610e93565b3480156104e457600080fd5b506102806104f3366004612399565b610f14565b34801561050457600080fd5b50610280610513366004612451565b611011565b34801561052457600080fd5b50610538610533366004612451565b6110bc565b604080519384526020840192909252908201526060016102ae565b34801561055f57600080fd5b5061028061056e366004612451565b61114b565b34801561057f57600080fd5b5061028061058e3660046124c4565b61117f565b34801561059f57600080fd5b5061036560ce5481565b3480156105b557600080fd5b506102a26105c436600461246a565b6111d8565b3480156105d557600080fd5b506102806105e43660046123b6565b611203565b3480156105f557600080fd5b50610538610604366004612451565b611344565b34801561061557600080fd5b5061036560d55481565b34801561062b57600080fd5b50610365600081565b34801561064057600080fd5b5061028061064f366004612451565b61137a565b34801561066057600080fd5b5060c95460ca5460cb54604080516001600160a01b03948516815292841660208401529216918101919091526060016102ae565b3480156106a057600080fd5b5061028061145b565b3480156106b557600080fd5b5061036560cf5481565b610280611483565b3480156106d357600080fd5b506103656000805160206128a983398151915281565b3480156106f557600080fd5b50610280610704366004612451565b61157f565b34801561071557600080fd5b5061028061072436600461246a565b6115d5565b34801561073557600080fd5b50610280610744366004612399565b6115fd565b610280611659565b34801561075d57600080fd5b5061077161076c366004612451565b6116d1565b604080519283526020830191909152016102ae565b34801561079257600080fd5b50610365611706565b3480156107a757600080fd5b506107bb6107b6366004612399565b611720565b6040516102ae91906125f5565b3480156107d457600080fd5b506102806107e3366004612399565b6117b3565b60975460ff16156108145760405162461bcd60e51b815260040161080b906126d8565b60405180910390fd5b6000805160206128a98339815191526108348161082f61180f565b611837565b8160ce5410156108a25760405162461bcd60e51b815260206004820152603360248201527f576974686472617720616d6f756e742063616e6e6f7420657863656564206d616044820152721d1a58c81a5b881a5b9cdd185b9d081c1bdbdb606a1b606482015260840161080b565b8160ce60008282546108b491906127a6565b909155505060cd546108cf906001600160a01b03168361189b565b5050565b60006001600160e01b03198216637965db0b60e01b148061090457506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006109188161082f61180f565b6127108211156109765760405162461bcd60e51b8152602060048201526024808201527f5f666565427073206d757374206e6f74206578636565642031303030302028316044820152633030252960e01b606482015260840161080b565b60d18290556040518281527ff4e904151506e99aac05f72edf50e48babc4cf26500fd10b096210c51755a2de906020015b60405180910390a15050565b60975460ff16156109d65760405162461bcd60e51b815260040161080b906126d8565b8060d2541015610a5d5760405162461bcd60e51b815260206004820152604660248201527f576974686472617720616d6f756e742063616e6e6f742065786365656420636f60448201527f6c6c6563746564206d6174696320696e20696e7374616e745769746864726177606482015265616c4665657360d01b608482015260a40161080b565b8060d26000828254610a6f91906127a6565b909155505060cc54610a8a906001600160a01b03168261189b565b50565b6000610a9b8161082f61180f565b60c980546001600160a01b0319166001600160a01b0384169081179091556040519081527ffc1cc3f090c8622ac209ec8a7deabca32ef223096e08844b47f699fb083d4382906020016109a7565b600082815260656020526040902060010154610b078161082f61180f565b610b1183836119b4565b505050565b610b1e61180f565b6001600160a01b0316816001600160a01b031614610b965760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161080b565b6108cf8282611a3b565b6000610bae60975460ff1690565b15610bcb5760405162461bcd60e51b815260040161080b906126d8565b60008211610beb5760405162461bcd60e51b815260040161080b906126b0565b610c0a610bf661180f565b60ca546001600160a01b0316903085611ac0565b8160cf6000828254610c1c919061274d565b9091555060009050610c2d836110bc565b505090508060ce541015610cbe5760405162461bcd60e51b815260206004820152604c60248201527f536f72727920776520646f6e2774206861766520656e6f756768206d6174696360448201527f20696e2074686520696e7374616e7420706f6f6c20746f20666163696c69746160648201526b07465207468697320737761760a41b608482015260a40161080b565b8060ce6000828254610cd091906127a6565b925050819055508060d46000828254610ce9919061274d565b9091555060d390506000610cfb61180f565b6001600160a01b03166001600160a01b031681526020019081526020016000206040518060600160405280838152602001428152602001610d3a611706565b610d44904261274d565b90528154600181810184556000938452602080852084516003909402019283558301518282015560409092015160029091015560d382610d8261180f565b6001600160a01b03168152602081019190915260400160002054610da691906127a6565b9050610db061180f565b60408051868152602081018590529081018390526001600160a01b0391909116907fe4ab2eb98dc2b8ccf81f65743176eb1a6cf829d4307d33f01ec583041e493db39060600160405180910390a29392505050565b60d08054610e1290612800565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3e90612800565b8015610e8b5780601f10610e6057610100808354040283529160200191610e8b565b820191906000526020600020905b815481529060010190602001808311610e6e57829003601f168201915b505050505081565b60975460ff1615610eb65760405162461bcd60e51b815260040161080b906126d8565b6000805160206128a9833981519152610ed18161082f61180f565b60008211610ef15760405162461bcd60e51b815260040161080b906126b0565b8160cf6000828254610f03919061274d565b909155506108cf9050610bf661180f565b6000610f228161082f61180f565b60cd546001600160a01b0383811691161415610f805760405162461bcd60e51b815260206004820152601a60248201527f4f6c642061646472657373203d3d206e65772061646472657373000000000000604482015260640161080b565b60cd54610fa5906000805160206128a9833981519152906001600160a01b0316611a3b565b60cd80546001600160a01b0319166001600160a01b038416179055610fd86000805160206128a983398151915283611b31565b6040516001600160a01b03831681527f655166b35cc2872bea49c3cc867c962f7da955e7fd4f5ad9285d913bab5ed39c906020016109a7565b600061101f8161082f61180f565b6102d082111561107d5760405162461bcd60e51b8152602060048201526024808201527f5f686f757273206d757374206e6f742065786365656420373230202831206d6f6044820152636e74682960e01b606482015260840161080b565b61108982610e10612787565b60d5556040518281527f1898424283701bff1815e2eb4aaf8b2efb42ac7f19823d00cdb57ade022239e1906020016109a7565b60c9546040516375a85ef560e01b815260048101839052600091829182916001600160a01b0316906375a85ef5906024015b60606040518083038186803b15801561110657600080fd5b505afa15801561111a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113e9190612536565b9250925092509193909250565b60975460ff161561116e5760405162461bcd60e51b815260040161080b906126d8565b610a8a61117961180f565b82611b3b565b600061118d8161082f61180f565b61119960d08484612300565b507f63d269ac72f6157df0c915e6d321d02ae22763652c465e96b1aaa05c5879510283836040516111cb92919061264e565b60405180910390a1505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600054610100900460ff1661121e5760005460ff1615611222565b303b155b6112855760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161080b565b600054610100900460ff161580156112a7576000805461ffff19166101011790555b6112af611d5d565b6112b7611d86565b6112c2600086611b31565b6112da6000805160206128a983398151915285611b31565b60cd80546001600160a01b038087166001600160a01b03199283161790925560cc805486841690831617905560c980548a841690831617905560ca80549289169290911691909117905560d1829055801561133b576000805461ff00191690555b50505050505050565b60c954604051634b41f14760e11b815260048101839052600091829182916001600160a01b031690639683e28e906024016110ee565b60975460ff161561139d5760405162461bcd60e51b815260040161080b906126d8565b6000805160206128a98339815191526113b88161082f61180f565b8160cf5410156114275760405162461bcd60e51b815260206004820152603460248201527f576974686472617720616d6f756e742063616e6e6f7420657863656564206d616044820152731d1a58d6081a5b881a5b9cdd185b9d081c1bdbdb60621b606482015260840161080b565b8160cf600082825461143991906127a6565b909155505060cd5460ca546108cf916001600160a01b03918216911684611db5565b60006114698161082f61180f565b60975460ff1661147b57610a8a611de5565b610a8a611e5b565b60975460ff16156114a65760405162461bcd60e51b815260040161080b906126d8565b600034116114c65760405162461bcd60e51b815260040161080b906126b0565b3460ce60008282546114d8919061274d565b90915550600090506114e934611344565b505090508060cf5410156115495760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f756768206d617469635820746f20696e7374616e74207377616044820152600760fc1b606482015260840161080b565b8060cf600082825461155b91906127a6565b90915550610a8a905061156c61180f565b60ca546001600160a01b03169083611db5565b60975460ff16156115a25760405162461bcd60e51b815260040161080b906126d8565b60405162461bcd60e51b8152602060048201526008602482015267111a5cd8589b195960c21b604482015260640161080b565b6000828152606560205260409020600101546115f38161082f61180f565b610b118383611a3b565b600061160b8161082f61180f565b60cb80546001600160a01b0319166001600160a01b0384169081179091556040519081527f8c2bee8063bb4464870b7dfa415ebb2fe80bfa73ba20d6fbf0d42791274667ff906020016109a7565b60975460ff161561167c5760405162461bcd60e51b815260040161080b906126d8565b6000805160206128a98339815191526116978161082f61180f565b600034116116b75760405162461bcd60e51b815260040161080b906126b0565b3460ce60008282546116c9919061274d565b909155505050565b600080600061271060d154856116e79190612787565b6116f19190612765565b90506116fd81856127a6565b94909350915050565b60008060d5541161171957506201518090565b5060d55490565b6001600160a01b038116600090815260d360209081526040808320805482518185028101850190935280835260609492939192909184015b828210156117a85783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190611758565b505050509050919050565b60006117c18161082f61180f565b60cc80546001600160a01b0319166001600160a01b0384169081179091556040519081527fcb7ef3e545f5cdb893f5c568ba710fe08f336375a2d9fd66e161033f8fc09ef3906020016109a7565b60cb546000906001600160a01b0316331415611832575060131936013560601c90565b503390565b61184182826111d8565b6108cf57611859816001600160a01b03166014611ed7565b611864836020611ed7565b604051602001611875929190612580565b60408051601f198184030181529082905262461bcd60e51b825261080b9160040161267d565b804710156118eb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161080b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611938576040519150601f19603f3d011682016040523d82523d6000602084013e61193d565b606091505b5050905080610b115760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161080b565b6119be82826111d8565b6108cf5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556119f761180f565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611a4582826111d8565b156108cf5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19169055611a7c61180f565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6040516001600160a01b0380851660248301528316604482015260648101829052611b2b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261207a565b50505050565b6108cf82826119b4565b6001600160a01b038216600090815260d36020526040902080548210611b935760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c84092dcc8caf609b1b604482015260640161080b565b6000818381548110611ba757611ba7612867565b9060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505090508060400151421015611c4b5760405162461bcd60e51b815260206004820152602e60248201527f506c65617365207761697420666f722074686520626f6e64696e67207065726960448201526d37b2103a379033b2ba1037bb32b960911b606482015260840161080b565b805160d48054600090611c5f9084906127a6565b909155505081548290611c74906001906127a6565b81548110611c8457611c84612867565b9060005260206000209060030201828481548110611ca457611ca4612867565b600091825260209091208254600390920201908155600180830154908201556002918201549101558154829080611cdd57611cdd612851565b600082815260208120600360001990930192830201818155600181018290556002015590558051611d0f90859061189b565b82846001600160a01b03167f0c41df34337bedfb475937c70f33606f6e3c44695e9e18d667a856df778afd4e8360000151604051611d4f91815260200190565b60405180910390a350505050565b600054610100900460ff16611d845760405162461bcd60e51b815260040161080b90612702565b565b600054610100900460ff16611dad5760405162461bcd60e51b815260040161080b90612702565b611d8461214c565b6040516001600160a01b038316602482015260448101829052610b1190849063a9059cbb60e01b90606401611af4565b60975460ff1615611e085760405162461bcd60e51b815260040161080b906126d8565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e3e61180f565b6040516001600160a01b03909116815260200160405180910390a1565b60975460ff16611ea45760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161080b565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611e3e61180f565b60606000611ee6836002612787565b611ef190600261274d565b67ffffffffffffffff811115611f0957611f0961287d565b6040519080825280601f01601f191660200182016040528015611f33576020820181803683370190505b509050600360fc1b81600081518110611f4e57611f4e612867565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611f7d57611f7d612867565b60200101906001600160f81b031916908160001a9053506000611fa1846002612787565b611fac90600161274d565b90505b6001811115612024576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611fe057611fe0612867565b1a60f81b828281518110611ff657611ff6612867565b60200101906001600160f81b031916908160001a90535060049490941c9361201d816127e9565b9050611faf565b5083156120735760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161080b565b9392505050565b60006120cf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661217f9092919063ffffffff16565b805190915015610b1157808060200190518101906120ed919061242f565b610b115760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161080b565b600054610100900460ff166121735760405162461bcd60e51b815260040161080b90612702565b6097805460ff19169055565b606061218e8484600085612196565b949350505050565b6060824710156121f75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161080b565b6001600160a01b0385163b61224e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161080b565b600080866001600160a01b0316858760405161226a9190612564565b60006040518083038185875af1925050503d80600081146122a7576040519150601f19603f3d011682016040523d82523d6000602084013e6122ac565b606091505b50915091506122bc8282866122c7565b979650505050505050565b606083156122d6575081612073565b8251156122e65782518084602001fd5b8160405162461bcd60e51b815260040161080b919061267d565b82805461230c90612800565b90600052602060002090601f01602090048101928261232e5760008555612374565b82601f106123475782800160ff19823516178555612374565b82800160010185558215612374579182015b82811115612374578235825591602001919060010190612359565b50612380929150612384565b5090565b5b808211156123805760008155600101612385565b6000602082840312156123ab57600080fd5b813561207381612893565b60008060008060008060c087890312156123cf57600080fd5b86356123da81612893565b955060208701356123ea81612893565b945060408701356123fa81612893565b9350606087013561240a81612893565b9250608087013561241a81612893565b8092505060a087013590509295509295509295565b60006020828403121561244157600080fd5b8151801515811461207357600080fd5b60006020828403121561246357600080fd5b5035919050565b6000806040838503121561247d57600080fd5b82359150602083013561248f81612893565b809150509250929050565b6000602082840312156124ac57600080fd5b81356001600160e01b03198116811461207357600080fd5b600080602083850312156124d757600080fd5b823567ffffffffffffffff808211156124ef57600080fd5b818501915085601f83011261250357600080fd5b81358181111561251257600080fd5b86602082850101111561252457600080fd5b60209290920196919550909350505050565b60008060006060848603121561254b57600080fd5b8351925060208401519150604084015190509250925092565b600082516125768184602087016127bd565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516125b88160178501602088016127bd565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516125e98160288401602088016127bd565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b828110156126415781518051855286810151878601528501518585015260609093019290850190600101612612565b5091979650505050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b602081526000825180602084015261269c8160408501602087016127bd565b601f01601f19169190910160400192915050565b6020808252600e908201526d125b9d985b1a5908185b5bdd5b9d60921b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082198211156127605761276061283b565b500190565b60008261278257634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156127a1576127a161283b565b500290565b6000828210156127b8576127b861283b565b500390565b60005b838110156127d85781810151838201526020016127c0565b83811115611b2b5750506000910152565b6000816127f8576127f861283b565b506000190190565b600181811c9082168061281457607f821691505b6020821081141561283557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a8a57600080fdfe2572658b6bf2c752d416f25a897890508cdc1ac8fd4845e04dcb7ecd022249fba26469706673582212205e02bbbf040e9cce082e00b41a2522434b740e9a361035dd4a64583775e0ef7364736f6c63430008070033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.