ETH Price: $2,672.29 (+1.33%)

Contract

0x112129620F82fa4EEc511bb2b43e487f872e176c
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040186910902023-12-01 10:52:59265 days ago1701427979IN
 Create: SmartConvertor
0 ETH0.0576133430.05600981

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SmartConvertor

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 19 : SmartConvertor.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "../Interfaces/ISmartConvertor.sol";
import "../Interfaces/Maverick/IMaverickRouter.sol";
import "../Interfaces/Maverick/IPoolInformation.sol";
import "../Interfaces/Maverick/IPool.sol";
import "../Interfaces/IPendleDepositor.sol";

contract SmartConvertor is ISmartConvertor, AccessControlUpgradeable {
    using SafeERC20 for IERC20;

    IPoolInformation public maverickPoolInformation;

    address public pendle;
    address public ePendle;
    IMaverickRouter public router;
    IPool public maverickPendleEpendlePool;
    IPendleDepositor public pendleDepositor;
    uint256 public swapThreshold;
    uint256 public maxSwapAmount;

    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");

    uint256 public buyPercent;

    function initialize() public initializer {
        __AccessControl_init();
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(ADMIN_ROLE, msg.sender);
    }

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function setParams(
        address _pendle,
        address _ePendle,
        address _router,
        address _maverickPoolInformation,
        address _maverickPendleEpendlePool,
        address _pendleDepositor
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(pendle == address(0), "already set!");
        require(_pendle != address(0), "invalid _pendle!");
        require(_ePendle != address(0), "invalid _ePendle!");
        require(_router != address(0), "invalid _router!");
        require(
            _maverickPoolInformation != address(0),
            "invalid _maverickPoolInformation!"
        );
        require(
            _maverickPendleEpendlePool != address(0),
            "invalid _maverickPendleEpendlePool!"
        );
        require(_pendleDepositor != address(0), "invalid _pendleDepositor!");

        pendle = _pendle;
        ePendle = _ePendle;
        router = IMaverickRouter(_router);
        maverickPendleEpendlePool = IPool(_maverickPendleEpendlePool);
        maverickPoolInformation = IPoolInformation(_maverickPoolInformation);
        pendleDepositor = IPendleDepositor(_pendleDepositor);
        IERC20(ePendle).safeApprove(_router, type(uint256).max);
        IERC20(pendle).safeApprove(_router, type(uint256).max);
        IERC20(pendle).safeApprove(_pendleDepositor, type(uint256).max);
        swapThreshold = 105;
        maxSwapAmount = 50000 * 1e18;
    }

    function _depositFor(
        uint256 _amount,
        address _for
    ) internal returns (uint256 obtainedAmount) {
        uint256 fromDexAmount;
        uint256 fromDepositAmount;
        uint256 obtainedFromDexAmount;

        IERC20(pendle).safeTransferFrom(msg.sender, address(this), _amount);
        fromDexAmount = _convertOutFromDexAmount(_amount);
        fromDepositAmount = _amount - fromDexAmount;

        if (fromDexAmount > 0) {
            obtainedFromDexAmount = _swapTokens(
                pendle,
                ePendle,
                fromDexAmount,
                fromDexAmount,
                _for
            );
        }

        if (fromDepositAmount > 0) {
            pendleDepositor.deposit(fromDepositAmount, false);
            IERC20(ePendle).safeTransfer(_for, fromDepositAmount);
        }

        emit EPendleObtained(
            _for,
            _amount,
            obtainedFromDexAmount,
            fromDepositAmount
        );
        return obtainedFromDexAmount + fromDepositAmount;
    }

    function estimateTotalConversion(
        uint256 _amount
    ) external override returns (uint256 amountOut) {
        uint256 amountDexIn = _convertOutFromDexAmount(_amount);
        return _estimateOutEPendleAmount(amountDexIn) + (_amount - amountDexIn);
    }

    function _convertOutFromDexAmount(
        uint256 _amount
    ) internal returns (uint256) {
        // if 1 pendle swap more than 1.05(by default) ePendle in dex
        if (
            _estimateOutEPendleAmount(_amount) > (_amount * swapThreshold) / 100
        ) {
            return Math.min((_amount * buyPercent) / 100, maxSwapAmount);
        }
        // or not swap from dex
        return 0;
    }

    function _estimateOutEPendleAmount(
        uint256 _amountSold
    ) internal returns (uint256) {
        if (_amountSold == 0) {
            return 0;
        }
        return
            maverickPoolInformation.calculateSwap(
                maverickPendleEpendlePool,
                uint128(_amountSold),
                _tokenAIsPendle(),
                false,
                0
            );
    }

    function previewAmountOut(
        address _tokenIn,
        uint256 _amount
    ) external view override returns (uint256) {
        require(_tokenIn == pendle || _tokenIn == ePendle, "invalid _tokenIn!");
        if (_amount == 0) {
            return 0;
        }
        uint256 pendleToEPendlePrice = _getPendleToEPendlePrice();
        if (_tokenIn == pendle) {
            uint256 amountDexIn = 0;
            if ((pendleToEPendlePrice * 100) / 1e18 > swapThreshold) {
                amountDexIn = Math.min(_amount, maxSwapAmount);
            }
            return
                (amountDexIn * pendleToEPendlePrice) /
                1e18 +
                (_amount - amountDexIn);
        } else {
            return (_amount * 1e18) / pendleToEPendlePrice;
        }
    }

    function deposit(
        uint256 _amount
    ) external override returns (uint256 obtainedAmount) {
        return _depositFor(_amount, msg.sender);
    }

    function depositFor(
        uint256 _amount,
        address _for
    ) external override returns (uint256 obtainedAmount) {
        return _depositFor(_amount, _for);
    }

    function swapEPendleForPendle(
        uint256 _amount,
        uint256 _amountOutMinimum,
        address _receiver
    ) external returns (uint256) {
        IERC20(ePendle).safeTransferFrom(msg.sender, address(this), _amount);
        return
            _swapTokens(ePendle, pendle, _amount, _amountOutMinimum, _receiver);
    }

    function changeSwapThreshold(
        uint256 _swapThreshold
    ) external onlyRole(ADMIN_ROLE) {
        require(
            _swapThreshold >= 100,
            "_swapThreshold should be greater than 100"
        );
        swapThreshold = _swapThreshold;
        emit SwapThresholdChanged(_swapThreshold);
    }

    function changeMaxSwapAmount(
        uint256 _maxSwapAmount
    ) external onlyRole(ADMIN_ROLE) {
        maxSwapAmount = _maxSwapAmount;
        emit MaxSwapAmountChanged(_maxSwapAmount);
    }

    function changeBuyPercent(
        uint256 _buyPercent
    ) external onlyRole(ADMIN_ROLE) {
        require(_buyPercent <= 100, "_buyPercent should be less than 100");
        buyPercent = _buyPercent;
        emit BuyPercentChanged(_buyPercent);
    }

    function changeMaverickPendleEpendlePool(
        address _maverickPendleEpendlePool
    ) external onlyRole(ADMIN_ROLE) {
        require(
            _maverickPendleEpendlePool != address(0),
            "invalid _maverickPendleEpendlePool!"
        );
        maverickPendleEpendlePool = IPool(_maverickPendleEpendlePool);
    }

    function _swapTokens(
        address _tokenIn,
        address _tokenOut,
        uint256 _amountIn,
        uint256 _amountOutMinimum,
        address _receiver
    ) internal returns (uint256) {
        IMaverickRouter.ExactInputParams memory exactInputParams;
        exactInputParams.path = abi.encodePacked(
            _tokenIn,
            maverickPendleEpendlePool,
            _tokenOut
        );
        exactInputParams.recipient = _receiver;
        exactInputParams.deadline = block.timestamp;
        exactInputParams.amountIn = _amountIn;
        exactInputParams.amountOutMinimum = _amountOutMinimum;

        uint256 amountOut = router.exactInput(exactInputParams);

        emit TokenSwapped(
            _tokenIn,
            _tokenOut,
            _amountIn,
            _amountOutMinimum,
            _receiver,
            amountOut
        );

        return amountOut;
    }

    function _getPendleToEPendlePrice() internal view returns (uint256) {
        uint256 sqrtPrice = maverickPoolInformation.getSqrtPrice(
            maverickPendleEpendlePool
        );
        if (_tokenAIsPendle()) {
            return (1e18 * 1e18 * 1e18) / sqrtPrice / sqrtPrice;
        } else {
            return (sqrtPrice * sqrtPrice) / 1e18;
        }
    }

    function _tokenAIsPendle() internal view returns (bool) {
        return address(maverickPendleEpendlePool.tokenA()) == pendle;
    }
}

File 2 of 19 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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);
        _;
    }

    /**
     * @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 `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @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.
     *
     * May emit a {RoleGranted} event.
     */
    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.
     *
     * May emit a {RoleRevoked} event.
     */
    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`.
     *
     * May emit a {RoleRevoked} event.
     */
    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.
     *
     * May emit a {RoleGranted} event.
     *
     * [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.
     *
     * May emit a {RoleGranted} event.
     */
    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.
     *
     * May emit a {RoleRevoked} event.
     */
    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 19 : 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 4 of 19 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * 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 prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

File 5 of 19 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 6 of 19 : 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 7 of 19 : 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 8 of 19 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 9 of 19 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @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);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 10 of 19 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 11 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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);
}

File 12 of 19 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.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 SafeERC20 {
    using Address for address;

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

    function safeTransferFrom(
        IERC20 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(
        IERC20 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(
        IERC20 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(
        IERC20 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));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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(IERC20 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 13 of 19 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 14 of 19 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`.
        // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
        // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
        // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
        // good first aproximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1;
        uint256 x = a;
        if (x >> 128 > 0) {
            x >>= 128;
            result <<= 64;
        }
        if (x >> 64 > 0) {
            x >>= 64;
            result <<= 32;
        }
        if (x >> 32 > 0) {
            x >>= 32;
            result <<= 16;
        }
        if (x >> 16 > 0) {
            x >>= 16;
            result <<= 8;
        }
        if (x >> 8 > 0) {
            x >>= 8;
            result <<= 4;
        }
        if (x >> 4 > 0) {
            x >>= 4;
            result <<= 2;
        }
        if (x >> 2 > 0) {
            result <<= 1;
        }

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        uint256 result = sqrt(a);
        if (rounding == Rounding.Up && result * result < a) {
            result += 1;
        }
        return result;
    }
}

File 15 of 19 : IPendleDepositor.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

interface IPendleDepositor {
    function deposit(uint256, bool) external;

    event Deposited(address indexed _user, uint256 _amount);
}

File 16 of 19 : ISmartConvertor.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.17;

interface ISmartConvertor {
    function estimateTotalConversion(
        uint256 _amount
    ) external returns (uint256 amountOut);

    function previewAmountOut(
        address _tokenIn,
        uint256 _amount
    ) external view returns (uint256);

    function deposit(uint256 _amount) external returns (uint256 obtainedAmount);

    function depositFor(
        uint256 _amount,
        address _for
    ) external returns (uint256 obtainedAmount);

    function swapEPendleForPendle(
        uint256 _amount,
        uint256 _amountOutMinimum,
        address _receiver
    ) external returns (uint256 pendleReceived);

    event EPendleObtained(
        address indexed _user,
        uint256 _depositedPendle,
        uint256 _obtainedFromDexAmount,
        uint256 _obtainedFromDepositAmount
    );

    event TokenSwapped(
        address indexed _tokenIn,
        address indexed _tokenOut,
        uint256 _amountIn,
        uint256 _amountOutMinimum,
        address indexed _receiver,
        uint256 _amountOut
    );

    event SwapThresholdChanged(uint256 _swapThreshold);

    event MaxSwapAmountChanged(uint256 _maxSwapAmount);

    event BuyPercentChanged(uint256 _buyPercent);

    event MaverickPendleEpendlePoolChanged(address _maverickPendleEpendlePool);
}

File 17 of 19 : IMaverickRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface IMaverickRouter {
    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    function exactInput(
        ExactInputParams calldata params
    ) external payable returns (uint256 amountOut);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    function exactOutput(
        ExactOutputParams calldata params
    ) external payable returns (uint256 amountIn);
}

File 18 of 19 : IPool.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IPool {
    struct BinDelta {
        uint128 deltaA;
        uint128 deltaB;
        uint256 deltaLpBalance;
        uint128 binId;
        uint8 kind;
        int32 lowerTick;
        bool isActive;
    }

    struct TwaState {
        int96 twa;
        int96 value;
        uint64 lastTimestamp;
    }

    struct BinState {
        uint128 reserveA;
        uint128 reserveB;
        uint128 mergeBinBalance;
        uint128 mergeId;
        uint128 totalSupply;
        uint8 kind;
        int32 lowerTick;
    }

    struct AddLiquidityParams {
        uint8 kind;
        int32 pos;
        bool isDelta;
        uint128 deltaA;
        uint128 deltaB;
    }

    struct RemoveLiquidityParams {
        uint128 binId;
        uint128 amount;
    }

    struct State {
        int32 activeTick;
        uint8 status;
        uint128 binCounter;
        uint64 protocolFeeRatio;
    }

    function fee() external view returns (uint256);

    function tickSpacing() external view returns (uint256);

    function tokenA() external view returns (IERC20);

    function tokenB() external view returns (IERC20);

    function binMap(int32 tick) external view returns (uint256);

    function binPositions(
        int32 tick,
        uint256 kind
    ) external view returns (uint128);

    function binBalanceA() external view returns (uint128);

    function binBalanceB() external view returns (uint128);

    function getTwa() external view returns (TwaState memory);

    function getCurrentTwa() external view returns (int256);

    function getState() external view returns (State memory);

    function addLiquidity(
        uint256 tokenId,
        AddLiquidityParams[] calldata params,
        bytes calldata data
    )
        external
        returns (
            uint256 tokenAAmount,
            uint256 tokenBAmount,
            BinDelta[] memory binDeltas
        );

    function transferLiquidity(
        uint256 fromTokenId,
        uint256 toTokenId,
        RemoveLiquidityParams[] calldata params
    ) external;

    function removeLiquidity(
        address recipient,
        uint256 tokenId,
        RemoveLiquidityParams[] calldata params
    )
        external
        returns (
            uint256 tokenAOut,
            uint256 tokenBOut,
            BinDelta[] memory binDeltas
        );

    function migrateBinUpStack(uint128 binId, uint32 maxRecursion) external;

    function swap(
        address recipient,
        uint256 amount,
        bool tokenAIn,
        bool exactOutput,
        uint256 sqrtPriceLimit,
        bytes calldata data
    ) external returns (uint256 amountIn, uint256 amountOut);

    function getBin(uint128 binId) external view returns (BinState memory bin);

    function balanceOf(
        uint256 tokenId,
        uint128 binId
    ) external view returns (uint256 lpToken);

    function tokenAScale() external view returns (uint256);

    function tokenBScale() external view returns (uint256);
}

File 19 of 19 : IPoolInformation.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "./IPool.sol";

interface IPoolInformation {
    struct BinInfo {
        uint128 id;
        uint8 kind;
        int32 lowerTick;
        uint128 reserveA;
        uint128 reserveB;
        uint128 mergeId;
    }

    function calculateSwap(
        IPool pool,
        uint128 amount,
        bool tokenAIn,
        bool exactOutput,
        uint256 sqrtPriceLimit
    ) external returns (uint256 returnAmount);

    function calculateMultihopSwap(
        bytes memory path,
        uint256 amount,
        bool exactOutput
    ) external returns (uint256 returnAmount);

    function getActiveBins(
        IPool pool,
        uint128 startBinIndex,
        uint128 endBinIndex
    ) external view returns (BinInfo[] memory bins);

    function getBinDepth(
        IPool pool,
        uint128 binId
    ) external view returns (uint256 depth);

    function getSqrtPrice(IPool pool) external view returns (uint256 sqrtPrice);

    function getBinsAtTick(
        IPool pool,
        int32 tick
    ) external view returns (IPool.BinState[] memory bins);

    function activeTickLiquidity(
        IPool pool
    )
        external
        view
        returns (
            uint256 sqrtPrice,
            uint256 liquidity,
            uint256 reserveA,
            uint256 reserveB
        );

    function tickLiquidity(
        IPool pool,
        int32 tick
    )
        external
        view
        returns (
            uint256 sqrtPrice,
            uint256 liquidity,
            uint256 reserveA,
            uint256 reserveB
        );
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_buyPercent","type":"uint256"}],"name":"BuyPercentChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_depositedPendle","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_obtainedFromDexAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_obtainedFromDepositAmount","type":"uint256"}],"name":"EPendleObtained","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_maverickPendleEpendlePool","type":"address"}],"name":"MaverickPendleEpendlePoolChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxSwapAmount","type":"uint256"}],"name":"MaxSwapAmountChanged","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":"uint256","name":"_swapThreshold","type":"uint256"}],"name":"SwapThresholdChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_tokenIn","type":"address"},{"indexed":true,"internalType":"address","name":"_tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountOutMinimum","type":"uint256"},{"indexed":true,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountOut","type":"uint256"}],"name":"TokenSwapped","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_buyPercent","type":"uint256"}],"name":"changeBuyPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_maverickPendleEpendlePool","type":"address"}],"name":"changeMaverickPendleEpendlePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxSwapAmount","type":"uint256"}],"name":"changeMaxSwapAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_swapThreshold","type":"uint256"}],"name":"changeSwapThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"obtainedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_for","type":"address"}],"name":"depositFor","outputs":[{"internalType":"uint256","name":"obtainedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ePendle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"estimateTotalConversion","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maverickPendleEpendlePool","outputs":[{"internalType":"contract IPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maverickPoolInformation","outputs":[{"internalType":"contract IPoolInformation","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSwapAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendleDepositor","outputs":[{"internalType":"contract IPendleDepositor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"previewAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IMaverickRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pendle","type":"address"},{"internalType":"address","name":"_ePendle","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_maverickPoolInformation","type":"address"},{"internalType":"address","name":"_maverickPendleEpendlePool","type":"address"},{"internalType":"address","name":"_pendleDepositor","type":"address"}],"name":"setParams","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":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_amountOutMinimum","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"swapEPendleForPendle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61215b80620000ee6000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806389f425e7116100f9578063bbb9541511610097578063d547741f11610071578063d547741f146103e4578063df39a163146103f7578063f887ea401461040a578063ff52e6fd1461041d57600080fd5b8063bbb95415146103b5578063c653cf0a146103c8578063cce987d4146103db57600080fd5b8063a2c530da116100d3578063a2c530da14610369578063a5233bb11461037c578063b6b55f251461038f578063b86a9011146103a257600080fd5b806389f425e71461031557806391d1485414610328578063a217fddf1461036157600080fd5b806336568abe116101665780635a0745f2116101405780635a0745f2146102c05780635ebb8dee146102d357806375b238fc146102e65780638129fc1c1461030d57600080fd5b806336568abe1461029157806336efd16f146102a45780634f1455c9146102b757600080fd5b8063248a9ca3116101a2578063248a9ca3146102335780632b2e8a83146102565780632f2ff15d1461026957806334e66b381461027e57600080fd5b806301ffc9a7146101c95780630445b667146101f15780631d2e382514610208575b600080fd5b6101dc6101d7366004611d30565b610430565b60405190151581526020015b60405180910390f35b6101fa609d5481565b6040519081526020016101e8565b609c5461021b906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b6101fa610241366004611d5a565b60009081526065602052604090206001015490565b6101fa610264366004611d88565b610499565b61027c610277366004611dc1565b6104dd565b005b6101fa61028c366004611d5a565b610507565b61027c61029f366004611dc1565b610532565b6101fa6102b2366004611dc1565b6105c3565b6101fa609f5481565b60995461021b906001600160a01b031681565b61027c6102e1366004611df1565b6105cf565b6101fa7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b61027c610936565b61027c610323366004611d5a565b610a8b565b6101dc610336366004611dc1565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101fa600081565b60985461021b906001600160a01b031681565b61027c61038a366004611d5a565b610b69565b6101fa61039d366004611d5a565b610c3f565b61027c6103b0366004611e73565b610c4b565b61027c6103c3366004611d5a565b610d07565b6101fa6103d6366004611e90565b610d66565b6101fa609e5481565b61027c6103f2366004611dc1565b610ea9565b60975461021b906001600160a01b031681565b609a5461021b906001600160a01b031681565b609b5461021b906001600160a01b031681565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061049357507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6099546000906104b4906001600160a01b0316333087610ece565b6099546098546104d3916001600160a01b039081169116868686610f6d565b90505b9392505050565b6000828152606560205260409020600101546104f881611101565b610502838361110b565b505050565b600080610513836111ad565b905061051f8184611ed2565b61052882611205565b6104d69190611ee5565b6001600160a01b03811633146105b55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105bf82826112d1565b5050565b60006104d68383611354565b60006105da81611101565b6098546001600160a01b0316156106335760405162461bcd60e51b815260206004820152600c60248201527f616c72656164792073657421000000000000000000000000000000000000000060448201526064016105ac565b6001600160a01b0387166106895760405162461bcd60e51b815260206004820152601060248201527f696e76616c6964205f70656e646c65210000000000000000000000000000000060448201526064016105ac565b6001600160a01b0386166106df5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f6550656e646c652100000000000000000000000000000060448201526064016105ac565b6001600160a01b0385166107355760405162461bcd60e51b815260206004820152601060248201527f696e76616c6964205f726f75746572210000000000000000000000000000000060448201526064016105ac565b6001600160a01b0384166107b15760405162461bcd60e51b815260206004820152602160248201527f696e76616c6964205f6d6176657269636b506f6f6c496e666f726d6174696f6e60448201527f210000000000000000000000000000000000000000000000000000000000000060648201526084016105ac565b6001600160a01b0383166108135760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205f6d6176657269636b50656e646c654570656e646c65506f6044820152626f6c2160e81b60648201526084016105ac565b6001600160a01b0382166108695760405162461bcd60e51b815260206004820152601960248201527f696e76616c6964205f70656e646c654465706f7369746f72210000000000000060448201526064016105ac565b6098805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b038a811691909117909255609980548216898416908117909155609a80548316898516179055609b80548316878516179055609780548316888516179055609c80549092169285169290921790556108e890866000196114b0565b609854610901906001600160a01b0316866000196114b0565b60985461091a906001600160a01b0316836000196114b0565b50506069609d555050690a968163f0a57b400000609e55505050565b600054610100900460ff16158080156109565750600054600160ff909116105b806109705750303b158015610970575060005460ff166001145b6109e25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105ac565b6000805460ff191660011790558015610a05576000805461ff0019166101001790555b610a0d6115fe565b610a1860003361110b565b610a427fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217753361110b565b8015610a88576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610ab581611101565b6064821015610b2c5760405162461bcd60e51b815260206004820152602960248201527f5f737761705468726573686f6c642073686f756c64206265206772656174657260448201527f207468616e20313030000000000000000000000000000000000000000000000060648201526084016105ac565b609d8290556040518281527f9ff241d1f1e0c30788ac08c45391c423cc5ef3e67f66a46b95a9a8f394759f36906020015b60405180910390a15050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610b9381611101565b6064821115610c0a5760405162461bcd60e51b815260206004820152602360248201527f5f62757950657263656e742073686f756c64206265206c657373207468616e2060448201527f313030000000000000000000000000000000000000000000000000000000000060648201526084016105ac565b609f8290556040518281527f8ef148bf6dec005942d2ce21b45a090b723118787a9057bd56c7c84304e195c490602001610b5d565b60006104938233611354565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610c7581611101565b6001600160a01b038216610cd75760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205f6d6176657269636b50656e646c654570656e646c65506f6044820152626f6c2160e81b60648201526084016105ac565b50609b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610d3181611101565b609e8290556040518281527f7a8fd4eb777a8a23e4960855599f6b597db3ea92d3cc27b7de953975aa37dbaf90602001610b5d565b6098546000906001600160a01b0384811691161480610d9257506099546001600160a01b038481169116145b610dde5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f746f6b656e496e2100000000000000000000000000000060448201526064016105ac565b81600003610dee57506000610493565b6000610df861167d565b6098549091506001600160a01b0390811690851603610e8457609d54600090670de0b6b3a7640000610e2b846064611ef8565b610e359190611f0f565b1115610e4a57610e4784609e5461175e565b90505b610e548185611ed2565b670de0b6b3a7640000610e678484611ef8565b610e719190611f0f565b610e7b9190611ee5565b92505050610493565b80610e9784670de0b6b3a7640000611ef8565b610ea19190611f0f565b915050610493565b600082815260656020526040902060010154610ec481611101565b61050283836112d1565b6040516001600160a01b0380851660248301528316604482015260648101829052610f679085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152611774565b50505050565b6000610faa6040518060a001604052806060815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b609b546040516bffffffffffffffffffffffff1960608a811b8216602084015292831b811660348301529188901b9091166048820152605c0160408051601f198184030181529181529082526001600160a01b03808516602084015242838301526060830187905260808301869052609a5491517fc04b8d590000000000000000000000000000000000000000000000000000000081526000929091169063c04b8d599061105c908590600401611f81565b6020604051808303816000875af115801561107b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109f9190611fda565b60408051888152602081018890529081018290529091506001600160a01b0380861691898216918b16907f90da32b3e9098f634db67d4adf029f1297dcb7f283d2d7abd9c175172dd2bd509060600160405180910390a4979650505050505050565b610a888133611859565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166105bf5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556111693390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006064609d54836111bf9190611ef8565b6111c99190611f0f565b6111d283611205565b11156111fd576104936064609f54846111eb9190611ef8565b6111f59190611f0f565b609e5461175e565b506000919050565b60008160000361121757506000919050565b609754609b546001600160a01b0391821691632764cd0b9116846112396118d9565b6040516001600160e01b031960e086901b1681526001600160a01b0390931660048401526fffffffffffffffffffffffffffffffff909116602483015215156044820152600060648201819052608482015260a4016020604051808303816000875af11580156112ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104939190611fda565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156105bf5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b609854600090819081908190611375906001600160a01b0316333089610ece565b61137e866111ad565b925061138a8387611ed2565b915082156113b4576098546099546113b1916001600160a01b039081169116858089610f6d565b90505b811561145057609c546040517f9a40832100000000000000000000000000000000000000000000000000000000815260048101849052600060248201526001600160a01b0390911690639a40832190604401600060405180830381600087803b15801561142057600080fd5b505af1158015611434573d6000803e3d6000fd5b505060995461145092506001600160a01b031690508684611976565b60408051878152602081018390529081018390526001600160a01b038616907f4b7c6b9a3af68c1e0f019838cc648243ecdc644f9638697e6f8c2f5c6c0268539060600160405180910390a26114a68282611ee5565b9695505050505050565b80158061154357506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561151d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115419190611fda565b155b6115b55760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016105ac565b6040516001600160a01b0383166024820152604481018290526105029084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610f1b565b600054610100900460ff1661167b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105ac565b565b609754609b546040517f91c0914e0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600092839216906391c0914e90602401602060405180830381865afa1580156116e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170a9190611fda565b90506117146118d9565b1561174b578061173b81760a70c3c40a64e6c51999090b65f67d9240000000000000611f0f565b6117459190611f0f565b91505090565b670de0b6b3a764000061173b8280611ef8565b600081831061176d57816104d6565b5090919050565b60006117c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119bf9092919063ffffffff16565b80519091501561050257808060200190518101906117e79190611ff3565b6105025760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105ac565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166105bf57611897816001600160a01b031660146119ce565b6118a28360206119ce565b6040516020016118b3929190612015565b60408051601f198184030181529082905262461bcd60e51b82526105ac91600401612096565b609854609b54604080517f0fc63d1000000000000000000000000000000000000000000000000000000000815290516000936001600160a01b03908116931691630fc63d109160048083019260209291908290030181865afa158015611943573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196791906120a9565b6001600160a01b031614905090565b6040516001600160a01b0383166024820152604481018290526105029084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610f1b565b60606104d38484600085611baf565b606060006119dd836002611ef8565b6119e8906002611ee5565b67ffffffffffffffff811115611a0057611a006120c6565b6040519080825280601f01601f191660200182016040528015611a2a576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a6157611a616120dc565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611aac57611aac6120dc565b60200101906001600160f81b031916908160001a9053506000611ad0846002611ef8565b611adb906001611ee5565b90505b6001811115611b60577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1c57611b1c6120dc565b1a60f81b828281518110611b3257611b326120dc565b60200101906001600160f81b031916908160001a90535060049490941c93611b59816120f2565b9050611ade565b5083156104d65760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105ac565b606082471015611c275760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105ac565b6001600160a01b0385163b611c7e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ac565b600080866001600160a01b03168587604051611c9a9190612109565b60006040518083038185875af1925050503d8060008114611cd7576040519150601f19603f3d011682016040523d82523d6000602084013e611cdc565b606091505b5091509150611cec828286611cf7565b979650505050505050565b60608315611d065750816104d6565b825115611d165782518084602001fd5b8160405162461bcd60e51b81526004016105ac9190612096565b600060208284031215611d4257600080fd5b81356001600160e01b0319811681146104d657600080fd5b600060208284031215611d6c57600080fd5b5035919050565b6001600160a01b0381168114610a8857600080fd5b600080600060608486031215611d9d57600080fd5b83359250602084013591506040840135611db681611d73565b809150509250925092565b60008060408385031215611dd457600080fd5b823591506020830135611de681611d73565b809150509250929050565b60008060008060008060c08789031215611e0a57600080fd5b8635611e1581611d73565b95506020870135611e2581611d73565b94506040870135611e3581611d73565b93506060870135611e4581611d73565b92506080870135611e5581611d73565b915060a0870135611e6581611d73565b809150509295509295509295565b600060208284031215611e8557600080fd5b81356104d681611d73565b60008060408385031215611ea357600080fd5b8235611eae81611d73565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561049357610493611ebc565b8082018082111561049357610493611ebc565b808202811582820484141761049357610493611ebc565b600082611f2c57634e487b7160e01b600052601260045260246000fd5b500490565b60005b83811015611f4c578181015183820152602001611f34565b50506000910152565b60008151808452611f6d816020860160208601611f31565b601f01601f19169290920160200192915050565b602081526000825160a06020840152611f9d60c0840182611f55565b90506001600160a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b600060208284031215611fec57600080fd5b5051919050565b60006020828403121561200557600080fd5b815180151581146104d657600080fd5b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161204d816017850160208801611f31565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161208a816028840160208801611f31565b01602801949350505050565b6020815260006104d66020830184611f55565b6000602082840312156120bb57600080fd5b81516104d681611d73565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60008161210157612101611ebc565b506000190190565b6000825161211b818460208701611f31565b919091019291505056fea26469706673582212206358483330a069b8b6e9dcff973c3f4c4a2d4ed8a29c1b776c126c0407edf4cf64736f6c63430008110033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806389f425e7116100f9578063bbb9541511610097578063d547741f11610071578063d547741f146103e4578063df39a163146103f7578063f887ea401461040a578063ff52e6fd1461041d57600080fd5b8063bbb95415146103b5578063c653cf0a146103c8578063cce987d4146103db57600080fd5b8063a2c530da116100d3578063a2c530da14610369578063a5233bb11461037c578063b6b55f251461038f578063b86a9011146103a257600080fd5b806389f425e71461031557806391d1485414610328578063a217fddf1461036157600080fd5b806336568abe116101665780635a0745f2116101405780635a0745f2146102c05780635ebb8dee146102d357806375b238fc146102e65780638129fc1c1461030d57600080fd5b806336568abe1461029157806336efd16f146102a45780634f1455c9146102b757600080fd5b8063248a9ca3116101a2578063248a9ca3146102335780632b2e8a83146102565780632f2ff15d1461026957806334e66b381461027e57600080fd5b806301ffc9a7146101c95780630445b667146101f15780631d2e382514610208575b600080fd5b6101dc6101d7366004611d30565b610430565b60405190151581526020015b60405180910390f35b6101fa609d5481565b6040519081526020016101e8565b609c5461021b906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b6101fa610241366004611d5a565b60009081526065602052604090206001015490565b6101fa610264366004611d88565b610499565b61027c610277366004611dc1565b6104dd565b005b6101fa61028c366004611d5a565b610507565b61027c61029f366004611dc1565b610532565b6101fa6102b2366004611dc1565b6105c3565b6101fa609f5481565b60995461021b906001600160a01b031681565b61027c6102e1366004611df1565b6105cf565b6101fa7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b61027c610936565b61027c610323366004611d5a565b610a8b565b6101dc610336366004611dc1565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101fa600081565b60985461021b906001600160a01b031681565b61027c61038a366004611d5a565b610b69565b6101fa61039d366004611d5a565b610c3f565b61027c6103b0366004611e73565b610c4b565b61027c6103c3366004611d5a565b610d07565b6101fa6103d6366004611e90565b610d66565b6101fa609e5481565b61027c6103f2366004611dc1565b610ea9565b60975461021b906001600160a01b031681565b609a5461021b906001600160a01b031681565b609b5461021b906001600160a01b031681565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061049357507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6099546000906104b4906001600160a01b0316333087610ece565b6099546098546104d3916001600160a01b039081169116868686610f6d565b90505b9392505050565b6000828152606560205260409020600101546104f881611101565b610502838361110b565b505050565b600080610513836111ad565b905061051f8184611ed2565b61052882611205565b6104d69190611ee5565b6001600160a01b03811633146105b55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105bf82826112d1565b5050565b60006104d68383611354565b60006105da81611101565b6098546001600160a01b0316156106335760405162461bcd60e51b815260206004820152600c60248201527f616c72656164792073657421000000000000000000000000000000000000000060448201526064016105ac565b6001600160a01b0387166106895760405162461bcd60e51b815260206004820152601060248201527f696e76616c6964205f70656e646c65210000000000000000000000000000000060448201526064016105ac565b6001600160a01b0386166106df5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f6550656e646c652100000000000000000000000000000060448201526064016105ac565b6001600160a01b0385166107355760405162461bcd60e51b815260206004820152601060248201527f696e76616c6964205f726f75746572210000000000000000000000000000000060448201526064016105ac565b6001600160a01b0384166107b15760405162461bcd60e51b815260206004820152602160248201527f696e76616c6964205f6d6176657269636b506f6f6c496e666f726d6174696f6e60448201527f210000000000000000000000000000000000000000000000000000000000000060648201526084016105ac565b6001600160a01b0383166108135760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205f6d6176657269636b50656e646c654570656e646c65506f6044820152626f6c2160e81b60648201526084016105ac565b6001600160a01b0382166108695760405162461bcd60e51b815260206004820152601960248201527f696e76616c6964205f70656e646c654465706f7369746f72210000000000000060448201526064016105ac565b6098805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b038a811691909117909255609980548216898416908117909155609a80548316898516179055609b80548316878516179055609780548316888516179055609c80549092169285169290921790556108e890866000196114b0565b609854610901906001600160a01b0316866000196114b0565b60985461091a906001600160a01b0316836000196114b0565b50506069609d555050690a968163f0a57b400000609e55505050565b600054610100900460ff16158080156109565750600054600160ff909116105b806109705750303b158015610970575060005460ff166001145b6109e25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016105ac565b6000805460ff191660011790558015610a05576000805461ff0019166101001790555b610a0d6115fe565b610a1860003361110b565b610a427fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217753361110b565b8015610a88576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610ab581611101565b6064821015610b2c5760405162461bcd60e51b815260206004820152602960248201527f5f737761705468726573686f6c642073686f756c64206265206772656174657260448201527f207468616e20313030000000000000000000000000000000000000000000000060648201526084016105ac565b609d8290556040518281527f9ff241d1f1e0c30788ac08c45391c423cc5ef3e67f66a46b95a9a8f394759f36906020015b60405180910390a15050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610b9381611101565b6064821115610c0a5760405162461bcd60e51b815260206004820152602360248201527f5f62757950657263656e742073686f756c64206265206c657373207468616e2060448201527f313030000000000000000000000000000000000000000000000000000000000060648201526084016105ac565b609f8290556040518281527f8ef148bf6dec005942d2ce21b45a090b723118787a9057bd56c7c84304e195c490602001610b5d565b60006104938233611354565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610c7581611101565b6001600160a01b038216610cd75760405162461bcd60e51b815260206004820152602360248201527f696e76616c6964205f6d6176657269636b50656e646c654570656e646c65506f6044820152626f6c2160e81b60648201526084016105ac565b50609b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775610d3181611101565b609e8290556040518281527f7a8fd4eb777a8a23e4960855599f6b597db3ea92d3cc27b7de953975aa37dbaf90602001610b5d565b6098546000906001600160a01b0384811691161480610d9257506099546001600160a01b038481169116145b610dde5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f746f6b656e496e2100000000000000000000000000000060448201526064016105ac565b81600003610dee57506000610493565b6000610df861167d565b6098549091506001600160a01b0390811690851603610e8457609d54600090670de0b6b3a7640000610e2b846064611ef8565b610e359190611f0f565b1115610e4a57610e4784609e5461175e565b90505b610e548185611ed2565b670de0b6b3a7640000610e678484611ef8565b610e719190611f0f565b610e7b9190611ee5565b92505050610493565b80610e9784670de0b6b3a7640000611ef8565b610ea19190611f0f565b915050610493565b600082815260656020526040902060010154610ec481611101565b61050283836112d1565b6040516001600160a01b0380851660248301528316604482015260648101829052610f679085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152611774565b50505050565b6000610faa6040518060a001604052806060815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b609b546040516bffffffffffffffffffffffff1960608a811b8216602084015292831b811660348301529188901b9091166048820152605c0160408051601f198184030181529181529082526001600160a01b03808516602084015242838301526060830187905260808301869052609a5491517fc04b8d590000000000000000000000000000000000000000000000000000000081526000929091169063c04b8d599061105c908590600401611f81565b6020604051808303816000875af115801561107b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109f9190611fda565b60408051888152602081018890529081018290529091506001600160a01b0380861691898216918b16907f90da32b3e9098f634db67d4adf029f1297dcb7f283d2d7abd9c175172dd2bd509060600160405180910390a4979650505050505050565b610a888133611859565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166105bf5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556111693390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006064609d54836111bf9190611ef8565b6111c99190611f0f565b6111d283611205565b11156111fd576104936064609f54846111eb9190611ef8565b6111f59190611f0f565b609e5461175e565b506000919050565b60008160000361121757506000919050565b609754609b546001600160a01b0391821691632764cd0b9116846112396118d9565b6040516001600160e01b031960e086901b1681526001600160a01b0390931660048401526fffffffffffffffffffffffffffffffff909116602483015215156044820152600060648201819052608482015260a4016020604051808303816000875af11580156112ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104939190611fda565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156105bf5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b609854600090819081908190611375906001600160a01b0316333089610ece565b61137e866111ad565b925061138a8387611ed2565b915082156113b4576098546099546113b1916001600160a01b039081169116858089610f6d565b90505b811561145057609c546040517f9a40832100000000000000000000000000000000000000000000000000000000815260048101849052600060248201526001600160a01b0390911690639a40832190604401600060405180830381600087803b15801561142057600080fd5b505af1158015611434573d6000803e3d6000fd5b505060995461145092506001600160a01b031690508684611976565b60408051878152602081018390529081018390526001600160a01b038616907f4b7c6b9a3af68c1e0f019838cc648243ecdc644f9638697e6f8c2f5c6c0268539060600160405180910390a26114a68282611ee5565b9695505050505050565b80158061154357506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561151d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115419190611fda565b155b6115b55760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016105ac565b6040516001600160a01b0383166024820152604481018290526105029084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610f1b565b600054610100900460ff1661167b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016105ac565b565b609754609b546040517f91c0914e0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600092839216906391c0914e90602401602060405180830381865afa1580156116e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170a9190611fda565b90506117146118d9565b1561174b578061173b81760a70c3c40a64e6c51999090b65f67d9240000000000000611f0f565b6117459190611f0f565b91505090565b670de0b6b3a764000061173b8280611ef8565b600081831061176d57816104d6565b5090919050565b60006117c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119bf9092919063ffffffff16565b80519091501561050257808060200190518101906117e79190611ff3565b6105025760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105ac565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166105bf57611897816001600160a01b031660146119ce565b6118a28360206119ce565b6040516020016118b3929190612015565b60408051601f198184030181529082905262461bcd60e51b82526105ac91600401612096565b609854609b54604080517f0fc63d1000000000000000000000000000000000000000000000000000000000815290516000936001600160a01b03908116931691630fc63d109160048083019260209291908290030181865afa158015611943573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196791906120a9565b6001600160a01b031614905090565b6040516001600160a01b0383166024820152604481018290526105029084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610f1b565b60606104d38484600085611baf565b606060006119dd836002611ef8565b6119e8906002611ee5565b67ffffffffffffffff811115611a0057611a006120c6565b6040519080825280601f01601f191660200182016040528015611a2a576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a6157611a616120dc565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611aac57611aac6120dc565b60200101906001600160f81b031916908160001a9053506000611ad0846002611ef8565b611adb906001611ee5565b90505b6001811115611b60577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1c57611b1c6120dc565b1a60f81b828281518110611b3257611b326120dc565b60200101906001600160f81b031916908160001a90535060049490941c93611b59816120f2565b9050611ade565b5083156104d65760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105ac565b606082471015611c275760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105ac565b6001600160a01b0385163b611c7e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ac565b600080866001600160a01b03168587604051611c9a9190612109565b60006040518083038185875af1925050503d8060008114611cd7576040519150601f19603f3d011682016040523d82523d6000602084013e611cdc565b606091505b5091509150611cec828286611cf7565b979650505050505050565b60608315611d065750816104d6565b825115611d165782518084602001fd5b8160405162461bcd60e51b81526004016105ac9190612096565b600060208284031215611d4257600080fd5b81356001600160e01b0319811681146104d657600080fd5b600060208284031215611d6c57600080fd5b5035919050565b6001600160a01b0381168114610a8857600080fd5b600080600060608486031215611d9d57600080fd5b83359250602084013591506040840135611db681611d73565b809150509250925092565b60008060408385031215611dd457600080fd5b823591506020830135611de681611d73565b809150509250929050565b60008060008060008060c08789031215611e0a57600080fd5b8635611e1581611d73565b95506020870135611e2581611d73565b94506040870135611e3581611d73565b93506060870135611e4581611d73565b92506080870135611e5581611d73565b915060a0870135611e6581611d73565b809150509295509295509295565b600060208284031215611e8557600080fd5b81356104d681611d73565b60008060408385031215611ea357600080fd5b8235611eae81611d73565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561049357610493611ebc565b8082018082111561049357610493611ebc565b808202811582820484141761049357610493611ebc565b600082611f2c57634e487b7160e01b600052601260045260246000fd5b500490565b60005b83811015611f4c578181015183820152602001611f34565b50506000910152565b60008151808452611f6d816020860160208601611f31565b601f01601f19169290920160200192915050565b602081526000825160a06020840152611f9d60c0840182611f55565b90506001600160a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b600060208284031215611fec57600080fd5b5051919050565b60006020828403121561200557600080fd5b815180151581146104d657600080fd5b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161204d816017850160208801611f31565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161208a816028840160208801611f31565b01602801949350505050565b6020815260006104d66020830184611f55565b6000602082840312156120bb57600080fd5b81516104d681611d73565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60008161210157612101611ebc565b506000190190565b6000825161211b818460208701611f31565b919091019291505056fea26469706673582212206358483330a069b8b6e9dcff973c3f4c4a2d4ed8a29c1b776c126c0407edf4cf64736f6c63430008110033

Block Transaction Difficulty 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
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.