Contract 0xe271a0ac00fdaf2f4628b05c3047f03a57aba757

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xc2b011210ec68334b94d07b16de68fa0ca4d1c02208ddee8936093deb9df2f250x60806040671100182023-03-05 22:39:46443 days 22 hrs ago0xf09c27934a92c56c7c0dd6cbac858c35fbd5170f IN  Create: AggregatorVaultU0 ETH0.004227710.1
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x167e0ba153c58cf07cbf0539ff2974e3c50b858d3103061eaf3041f671547831720864392023-03-21 10:17:56428 days 10 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x971bb1e855ae430edec0957754b737d41c345d54fe9d03d7878aaac8d4af0605720839262023-03-21 10:07:24428 days 10 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x83e997e6eae75cb54c1336e1f6ddc01373174e342e7983dc291b7082bd3551c5720824322023-03-21 10:01:15428 days 11 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x4b50a86b22f0e2a6df21d8ea56ce3531322c059c79c870052a91b2b9f387cb49720806722023-03-21 9:53:58428 days 11 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xb98b4d5b0993d58b53d61d1a4879c5f1231a8680e25e2ebc3d9a650a64078d77720799692023-03-21 9:51:10428 days 11 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xc7d657fe1f247e0cfb1697a5e1f90714265c31dc6fe53b4f5392d949bbfe7ac2720798212023-03-21 9:50:33428 days 11 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xfa24896cab4942df9a955b4d91b696d81ed45ab6bb6334a83f396617cf871a4d720774342023-03-21 9:40:40428 days 11 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xdfbe3fd85e67ba220ba0796a3b005557bc3e6f441273921f13f943b90996fa03720767912023-03-21 9:38:05428 days 11 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x9787be44c64a9a6654440849d9a6c401021e7f0416de0192e2f55f90563c78f8720747642023-03-21 9:29:41428 days 11 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xa7aa8a5e8419913fe59607e739b2c8434da55395677ba023f8542999d59bb73a720567082023-03-21 8:15:52428 days 12 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xd652313ca5a17ca4f5ede65fc1bd781d32c9c104f595b586be3e029a7357c536720556032023-03-21 8:11:15428 days 12 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x5b4b44834559012e2c453e5f41ba1e73ae76c4f72c0dd15c186935422596a744720550342023-03-21 8:08:59428 days 12 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x14ae69534a13d06641fabcf513eb6934decccd8a593e69201fbc1f1d4e196975720506012023-03-21 7:50:48428 days 13 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x604bc89fbbc2a8939c0404392c7b74acb0abb39516aedeb1b1a1240782b7c032720496942023-03-21 7:47:00428 days 13 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x1096b8b3c2dda7c49d890924f555baf6b78a7d009f4b6ecc24dcbf9b06173406720474512023-03-21 7:37:51428 days 13 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xf6488490d18fdff4ddaa122e576c6476bed965f84449a07233243d4ca28b9b03720450072023-03-21 7:27:46428 days 13 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xb632e22dba36e70ce4cb1924c8796b40ee86cb5fcd7639f4a1b8c680b5020386719838402023-03-21 3:15:15428 days 17 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x9e348cc772ba723daf921ae3661c07be36e8ff9fd2429d1ef3ff981871403e79719838062023-03-21 3:15:07428 days 17 hrs ago 0x6dc873656fcde76dfae75146d9b2b4b6697a0594 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x8ce043486fb174ed415e71b148cea0ca31641dc3e9a0719e23d550d65d918b78719824772023-03-21 3:09:32428 days 17 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xe32cd16f4d56b90fa3b3f7690b73b8fb08700a77b083c160d04d1e61f73a2735719702202023-03-21 2:18:47428 days 18 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xd365b8e770b705c1eefa353e401f61b379e49afc384aa863668d6ff0e99722e3719615602023-03-21 1:42:21428 days 19 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0x5dcc120dbdecc946dd3391ed39d562148957bfef033c65c56e1fe9376600b601719519212023-03-21 1:01:31428 days 20 hrs ago 0x6dc873656fcde76dfae75146d9b2b4b6697a0594 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xb94c3c84ae9d9d7ed5649ac457cf5339e5eac992b51453ef6f4083891298d6d4719507292023-03-21 0:56:27428 days 20 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xe6ae7f445cb9451b37255e6871904b8c1723af313749d36a6923e248b29c95f9719505332023-03-21 0:55:36428 days 20 hrs ago 0xbe2be6a2dacf9dcc76903756ee8e085b1c5a2c30 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
0xd36f0cdf44b2c6f50a18804e0d802bc1a3af1cf0531bc8e4193a535c09eed93a719501602023-03-21 0:54:07428 days 20 hrs ago 0x6dc873656fcde76dfae75146d9b2b4b6697a0594 0xe271a0ac00fdaf2f4628b05c3047f03a57aba7570 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AggregatorVaultU

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion, GNU AGPLv3 license
File 1 of 48 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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(account),
                        " 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 2 of 48 : 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 3 of 48 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    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.
     *
     * 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.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * 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.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    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.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initialized`
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initializing`
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 4 of 48 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

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

File 5 of 48 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

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

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

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

File 6 of 48 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

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

File 7 of 48 : IERC20Upgradeable.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 IERC20Upgradeable {
    /**
     * @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 8 of 48 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 9 of 48 : draft-ERC20PermitUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/extensions/draft-ERC20Permit.sol)

pragma solidity ^0.8.0;

import "./draft-IERC20PermitUpgradeable.sol";
import "../ERC20Upgradeable.sol";
import "../../../utils/cryptography/ECDSAUpgradeable.sol";
import "../../../utils/cryptography/EIP712Upgradeable.sol";
import "../../../utils/CountersUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation 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.
 *
 * _Available since v3.4._
 *
 * @custom:storage-size 51
 */
abstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {
    using CountersUpgradeable for CountersUpgradeable.Counter;

    mapping(address => CountersUpgradeable.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /**
     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
     * However, to ensure consistency with the upgradeable transpiler, we will continue
     * to reserve a slot.
     * @custom:oz-renamed-from _PERMIT_TYPEHASH
     */
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    function __ERC20Permit_init(string memory name) internal onlyInitializing {
        __EIP712_init_unchained(name, "1");
    }

    function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSAUpgradeable.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        CountersUpgradeable.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }

    /**
     * @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 10 of 48 : draft-IERC20PermitUpgradeable.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 IERC20PermitUpgradeable {
    /**
     * @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 48 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

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

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

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

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

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

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

    function safePermit(
        IERC20PermitUpgradeable 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(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

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

File 12 of 48 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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 13 of 48 : 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 14 of 48 : CountersUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library CountersUpgradeable {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 15 of 48 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _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) {
        unchecked {
            uint256 length = MathUpgradeable.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, MathUpgradeable.log256(value) + 1);
        }
    }

    /**
     * @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] = _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 16 of 48 : ECDSAUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../StringsUpgradeable.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSAUpgradeable {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 17 of 48 : EIP712Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 *
 * @custom:storage-size 52
 */
abstract contract EIP712Upgradeable is Initializable {
    /* solhint-disable var-name-mixedcase */
    bytes32 private _HASHED_NAME;
    bytes32 private _HASHED_VERSION;
    bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {
        __EIP712_init_unchained(name, version);
    }

    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev The hash of the name parameter for the EIP712 domain.
     *
     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
     * are a concern.
     */
    function _EIP712NameHash() internal virtual view returns (bytes32) {
        return _HASHED_NAME;
    }

    /**
     * @dev The hash of the version parameter for the EIP712 domain.
     *
     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
     * are a concern.
     */
    function _EIP712VersionHash() internal virtual view returns (bytes32) {
        return _HASHED_VERSION;
    }

    /**
     * @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 18 of 48 : 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 19 of 48 : 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 20 of 48 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    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. If 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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 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) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 21 of 48 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.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 AccessControl is Context, IAccessControl, ERC165 {
    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(IAccessControl).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 ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.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());
        }
    }
}

File 22 of 48 : IAccessControl.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 IAccessControl {
    /**
     * @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 23 of 48 : 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 24 of 48 : 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 25 of 48 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 26 of 48 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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 27 of 48 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

File 28 of 48 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _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) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _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 29 of 48 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.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 ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 30 of 48 : IERC165.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 IERC165 {
    /**
     * @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 31 of 48 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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. If 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)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 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) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 32 of 48 : Accounting.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import { FixedPointMathLib } from "../libraries/FixedPointMathLib.sol";
import { IERC4626Accounting } from "../interfaces/ERC4626/IERC4626Accounting.sol";

// import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// import "hardhat/console.sol";

abstract contract Accounting is IERC4626Accounting {
	using FixedPointMathLib for uint256;

	function totalAssets() public view virtual returns (uint256);

	function totalSupply() public view virtual returns (uint256);

	function convertToShares(uint256 assets) public view virtual returns (uint256) {
		uint256 supply = totalSupply();

		return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());
	}

	function convertToAssets(uint256 shares) public view virtual returns (uint256) {
		uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.

		return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);
	}

	uint256[50] private __gap;
}

File 33 of 48 : Auth.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;

import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";

struct AuthConfig {
	address owner;
	address guardian;
	address manager;
}

contract Auth is AccessControl {
	event OwnershipTransferInitiated(address owner, address pendingOwner);
	event OwnershipTransferred(address oldOwner, address newOwner);

	////////// CONSTANTS //////////

	/// Update vault params, perform time-sensitive operations, set manager
	bytes32 public constant GUARDIAN = keccak256("GUARDIAN");

	/// Hot-wallet bots that route funds between vaults, rebalance and harvest strategies
	bytes32 public constant MANAGER = keccak256("MANAGER");

	/// Add and remove vaults and strategies and other critical operations behind timelock
	/// Default admin role
	/// There should only be one owner, so it is not a role
	address public owner;
	address public pendingOwner;

	modifier onlyOwner() {
		require(msg.sender == owner, "ONLY_OWNER");
		_;
	}

	constructor(AuthConfig memory authConfig) {
		/// Set up the roles
		// owner can manage all roles
		owner = authConfig.owner;
		emit OwnershipTransferred(address(0), authConfig.owner);

		// TODO do we want cascading roles like this?
		_grantRole(DEFAULT_ADMIN_ROLE, authConfig.owner);
		_grantRole(GUARDIAN, authConfig.owner);
		_grantRole(GUARDIAN, authConfig.guardian);
		_grantRole(MANAGER, authConfig.owner);
		_grantRole(MANAGER, authConfig.guardian);
		_grantRole(MANAGER, authConfig.manager);

		/// Allow the guardian role to manage manager
		_setRoleAdmin(MANAGER, GUARDIAN);
	}

	// ----------- Ownership -----------

	/// @dev Init transfer of ownership of the contract to a new account (`_pendingOwner`).
	/// @param _pendingOwner pending owner of contract
	/// Can only be called by the current owner.
	function transferOwnership(address _pendingOwner) external onlyOwner {
		pendingOwner = _pendingOwner;
		emit OwnershipTransferInitiated(owner, _pendingOwner);
	}

	/// @dev Accept transfer of ownership of the contract.
	/// Can only be called by the pendingOwner.
	function acceptOwnership() external {
		address newOwner = pendingOwner;
		require(msg.sender == newOwner, "ONLY_PENDING_OWNER");
		address oldOwner = owner;
		owner = newOwner;

		// revoke the DEFAULT ADMIN ROLE from prev owner
		_revokeRole(DEFAULT_ADMIN_ROLE, oldOwner);
		_revokeRole(GUARDIAN, oldOwner);
		_revokeRole(MANAGER, oldOwner);

		_grantRole(DEFAULT_ADMIN_ROLE, newOwner);
		_grantRole(GUARDIAN, newOwner);
		_grantRole(MANAGER, newOwner);

		emit OwnershipTransferred(oldOwner, newOwner);
	}
}

File 34 of 48 : AuthU.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;

import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { AuthConfig } from "./Auth.sol";

contract AuthU is AccessControlUpgradeable {
	event OwnershipTransferInitiated(address owner, address pendingOwner);
	event OwnershipTransferred(address oldOwner, address newOwner);

	////////// CONSTANTS //////////

	/// Update vault params, perform time-sensitive operations, set manager
	bytes32 public constant GUARDIAN = keccak256("GUARDIAN");

	/// Hot-wallet bots that route funds between vaults, rebalance and harvest strategies
	bytes32 public constant MANAGER = keccak256("MANAGER");

	/// Add and remove vaults and strategies and other critical operations behind timelock
	/// Default admin role
	/// There should only be one owner, so it is not a role
	address public owner;
	address public pendingOwner;

	modifier onlyOwner() {
		require(msg.sender == owner, "ONLY_OWNER");
		_;
	}

	/// security no undefined constructor
	constructor() {}

	function __Auth_init(AuthConfig memory authConfig) public onlyInitializing {
		/// Set up the roles
		// owner can manage all roles
		owner = authConfig.owner;
		emit OwnershipTransferred(address(0), authConfig.owner);

		// TODO do we want cascading roles like this?
		_grantRole(DEFAULT_ADMIN_ROLE, authConfig.owner);
		_grantRole(GUARDIAN, authConfig.owner);
		_grantRole(GUARDIAN, authConfig.guardian);
		_grantRole(MANAGER, authConfig.owner);
		_grantRole(MANAGER, authConfig.guardian);
		_grantRole(MANAGER, authConfig.manager);

		/// Allow the guardian role to manage manager
		_setRoleAdmin(MANAGER, GUARDIAN);
	}

	// ----------- Ownership -----------

	/// @dev Init transfer of ownership of the contract to a new account (`_pendingOwner`).
	/// @param _pendingOwner pending owner of contract
	/// Can only be called by the current owner.
	function transferOwnership(address _pendingOwner) external onlyOwner {
		pendingOwner = _pendingOwner;
		emit OwnershipTransferInitiated(owner, _pendingOwner);
	}

	/// @dev Accept transfer of ownership of the contract.
	/// Can only be called by the pendingOwner.
	function acceptOwnership() external {
		address newOwner = pendingOwner;
		require(msg.sender == newOwner, "ONLY_PENDING_OWNER");
		address oldOwner = owner;
		owner = newOwner;

		// revoke the DEFAULT ADMIN ROLE from prev owner
		_revokeRole(DEFAULT_ADMIN_ROLE, oldOwner);
		_revokeRole(GUARDIAN, oldOwner);
		_revokeRole(MANAGER, oldOwner);

		_grantRole(DEFAULT_ADMIN_ROLE, newOwner);
		_grantRole(GUARDIAN, newOwner);
		_grantRole(MANAGER, newOwner);

		emit OwnershipTransferred(oldOwner, newOwner);
	}

	uint256[50] private __gap;
}

File 35 of 48 : BatchedWithdraw.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;

import { Accounting } from "./Accounting.sol";
import { SectorErrors } from "../interfaces/SectorErrors.sol";
import { EpochType } from "../interfaces/Structs.sol";
import { FixedPointMathLib } from "../libraries/FixedPointMathLib.sol";

// import "hardhat/console.sol";

struct WithdrawRecord {
	uint256 timestamp;
	uint256 shares;
	uint256 value; // this the current value (also max withdraw value)
}

abstract contract BatchedWithdraw is Accounting, SectorErrors {
	using FixedPointMathLib for uint256;

	event RequestWithdraw(address indexed caller, address indexed owner, uint256 shares);

	uint256 public lastHarvestTimestamp;
	uint256 public requestedRedeem;
	uint256 public pendingRedeem;

	EpochType public constant epochType = EpochType.None;

	mapping(address => WithdrawRecord) public withdrawLedger;

	function requestRedeem(uint256 shares) public {
		return requestRedeem(shares, msg.sender);
	}

	function requestRedeem(uint256 shares, address owner) public {
		if (msg.sender != owner) _spendAllowance(owner, msg.sender, shares);
		_requestRedeem(shares, owner, msg.sender);
	}

	/// @dev redeem request records the value of the redeemed shares at the time of request
	/// at the time of claim, user is able to withdraw the minimum of the
	/// current value and value at time of request
	/// this is to prevent users from pre-emptively submitting redeem claims
	/// and claiming any rewards after the request has been made
	function _requestRedeem(
		uint256 shares,
		address owner,
		address redeemer
	) internal {
		_transfer(owner, address(this), shares);
		WithdrawRecord storage withdrawRecord = withdrawLedger[redeemer];
		withdrawRecord.timestamp = block.timestamp;
		withdrawRecord.shares += shares;
		uint256 value = convertToAssets(shares);
		withdrawRecord.value += value;
		requestedRedeem += shares;
		emit RequestWithdraw(msg.sender, owner, shares);
	}

	function _redeem(address account) internal returns (uint256 amountOut, uint256 shares) {
		WithdrawRecord storage withdrawRecord = withdrawLedger[account];

		if (withdrawRecord.value == 0) revert ZeroAmount();
		if (withdrawRecord.timestamp >= lastHarvestTimestamp) revert NotReady();

		shares = withdrawRecord.shares;
		// value of shares at time of redemption request
		uint256 redeemValue = withdrawRecord.value;

		// actual amount out is the smaller of currentValue and redeemValue
		amountOut = _getWithdrawAmount(shares, redeemValue);

		// update total pending redeem
		pendingRedeem -= shares;

		// important pendingRedeem should update prior to beforeWithdraw call
		withdrawRecord.value = 0;
		withdrawRecord.shares = 0;
	}

	function _processRedeem() internal {
		pendingRedeem += requestedRedeem;
		requestedRedeem = 0;
	}

	function _getWithdrawAmount(uint256 shares, uint256 redeemValue)
		internal
		view
		returns (uint256 amountOut)
	{
		// value of shares at time of redemption request
		uint256 currentValue = convertToAssets(shares);
		// actual amount out is the smaller of currentValue and redeemValue
		amountOut = currentValue < redeemValue ? currentValue : redeemValue;
	}

	function cancelRedeem() public virtual {
		WithdrawRecord storage withdrawRecord = withdrawLedger[msg.sender];
		if (withdrawRecord.timestamp <= lastHarvestTimestamp) revert CannotCancelProccesedRedeem();

		uint256 shares = withdrawRecord.shares;

		// update accounting
		withdrawRecord.value = 0;
		withdrawRecord.shares = 0;
		requestedRedeem -= shares;

		return _transfer(address(this), msg.sender, shares);
	}

	/// @notice UI method to view cancellation penalty
	function getPenalty() public view returns (uint256) {
		WithdrawRecord storage withdrawRecord = withdrawLedger[msg.sender];
		uint256 shares = withdrawRecord.shares;

		uint256 redeemValue = withdrawRecord.value;
		uint256 currentValue = convertToAssets(shares);

		if (currentValue < redeemValue) return 0;
		return (currentValue - redeemValue).mulDivDown(1e18, redeemValue);
	}

	/// VIRTUAL ERC20 METHODS

	function _transfer(
		address sender,
		address recipient,
		uint256 amount
	) internal virtual;

	function _spendAllowance(
		address owner,
		address spender,
		uint256 amount
	) internal virtual;

	/// UTILS
	function redeemIsReady(address user) external view returns (bool) {
		WithdrawRecord storage withdrawRecord = withdrawLedger[user];
		return lastHarvestTimestamp > withdrawRecord.timestamp && withdrawRecord.value > 0;
	}

	function getWithdrawStatus(address user) external view returns (WithdrawRecord memory) {
		return withdrawLedger[user];
	}

	error NotReady();
	error CannotCancelProccesedRedeem();
	error NotNativeAsset();

	uint256[50] private __gap;
}

File 36 of 48 : Fees.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import { Auth } from "./Auth.sol";

// import "hardhat/console.sol";

struct FeeConfig {
	address treasury;
	uint256 performanceFee;
	uint256 managementFee;
}

abstract contract Fees is Auth {
	uint256 public constant MAX_MANAGEMENT_FEE = .05e18; // 5%
	uint256 public constant MAX_PERFORMANCE_FEE = .25e18; // 25%

	/// @notice The percentage of profit recognized each harvest to reserve as fees.
	/// @dev A fixed point number where 1e18 represents 100% and 0 represents 0%.
	uint256 public performanceFee;

	/// @notice Annual management fee.
	/// @dev A fixed point number where 1e18 represents 100% and 0 represents 0%.
	uint256 public managementFee;

	/// @notice address where all fees are sent to
	address public treasury;

	constructor(FeeConfig memory feeConfig) {
		treasury = feeConfig.treasury;
		performanceFee = feeConfig.performanceFee;
		managementFee = feeConfig.managementFee;
		emit SetTreasury(feeConfig.treasury);
		emit SetPerformanceFee(feeConfig.performanceFee);
		emit SetManagementFee(feeConfig.managementFee);
	}

	/// @notice Sets a new performanceFee.
	/// @param _performanceFee The new performance fee.
	function setPerformanceFee(uint256 _performanceFee) public onlyOwner {
		if (_performanceFee > MAX_PERFORMANCE_FEE) revert OverMaxFee();

		performanceFee = _performanceFee;
		emit SetPerformanceFee(performanceFee);
	}

	/// @notice Sets a new performanceFee.
	/// @param _managementFee The new performance fee.
	function setManagementFee(uint256 _managementFee) public onlyOwner {
		if (_managementFee > MAX_MANAGEMENT_FEE) revert OverMaxFee();

		managementFee = _managementFee;
		emit SetManagementFee(_managementFee);
	}

	/// @notice Updates treasury.
	/// @param _treasury New treasury address.
	function setTreasury(address _treasury) public onlyOwner {
		treasury = _treasury;
		emit SetTreasury(_treasury);
	}

	/// @notice Emitted when performance fee is updated.
	/// @param performanceFee The new perforamance fee.
	event SetPerformanceFee(uint256 performanceFee);

	/// @notice Emitted when management fee is updated.
	/// @param managementFee The new management fee.
	event SetManagementFee(uint256 managementFee);

	event SetTreasury(address indexed treasury);

	error OverMaxFee();
}

File 37 of 48 : FeesU.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import { SafeERC20Upgradeable as SafeERC20, IERC20Upgradeable as IERC20 } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";

import { AuthU } from "./AuthU.sol";
import { FeeConfig } from "./Fees.sol";

// import "hardhat/console.sol";

abstract contract FeesU is AuthU {
	uint256 public constant MAX_MANAGEMENT_FEE = .05e18; // 5%
	uint256 public constant MAX_PERFORMANCE_FEE = .25e18; // 25%

	/// @notice The percentage of profit recognized each harvest to reserve as fees.
	/// @dev A fixed point number where 1e18 represents 100% and 0 represents 0%.
	uint256 public performanceFee;

	/// @notice Annual management fee.
	/// @dev A fixed point number where 1e18 represents 100% and 0 represents 0%.
	uint256 public managementFee;

	/// @notice address where all fees are sent to
	address public treasury;

	function __Fees_init(FeeConfig memory feeConfig) public onlyInitializing {
		treasury = feeConfig.treasury;
		performanceFee = feeConfig.performanceFee;
		managementFee = feeConfig.managementFee;
		emit SetTreasury(feeConfig.treasury);
		emit SetPerformanceFee(feeConfig.performanceFee);
		emit SetManagementFee(feeConfig.managementFee);
	}

	/// @notice Sets a new performanceFee.
	/// @param _performanceFee The new performance fee.
	function setPerformanceFee(uint256 _performanceFee) public onlyOwner {
		if (_performanceFee > MAX_PERFORMANCE_FEE) revert OverMaxFee();

		performanceFee = _performanceFee;
		emit SetPerformanceFee(performanceFee);
	}

	/// @notice Sets a new performanceFee.
	/// @param _managementFee The new performance fee.
	function setManagementFee(uint256 _managementFee) public onlyOwner {
		if (_managementFee > MAX_MANAGEMENT_FEE) revert OverMaxFee();

		managementFee = _managementFee;
		emit SetManagementFee(_managementFee);
	}

	/// @notice Updates treasury.
	/// @param _treasury New treasury address.
	function setTreasury(address _treasury) public onlyOwner {
		treasury = _treasury;
		emit SetTreasury(_treasury);
	}

	/// @notice Emitted when performance fee is updated.
	/// @param performanceFee The new perforamance fee.
	event SetPerformanceFee(uint256 performanceFee);

	/// @notice Emitted when management fee is updated.
	/// @param managementFee The new management fee.
	event SetManagementFee(uint256 managementFee);

	event SetTreasury(address indexed treasury);

	error OverMaxFee();

	uint256[50] private __gap;
}

File 38 of 48 : IERC4626.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.16;

interface IERC4626 {
	event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);

	event Withdraw(
		address indexed sender,
		address indexed receiver,
		address indexed owner,
		uint256 assets,
		uint256 shares
	);

	/*//////////////////////////////////////////////////////////////
                        DEPOSIT/WITHDRAWAL LOGIC
    //////////////////////////////////////////////////////////////*/

	function deposit(uint256 assets, address receiver) external payable returns (uint256 shares);

	function mint(uint256 shares, address receiver) external payable returns (uint256 assets);

	function withdraw(
		uint256 assets,
		address receiver,
		address owner
	) external returns (uint256 shares);

	function redeem(
		uint256 shares,
		address receiver,
		address owner
	) external returns (uint256 assets);

	/*//////////////////////////////////////////////////////////////
                     DEPOSIT/WITHDRAWAL LIMIT LOGIC
    //////////////////////////////////////////////////////////////*/

	function maxDeposit(address receiver) external view returns (uint256 maxAssets);

	function maxMint(address receiver) external view returns (uint256 maxShares);

	function maxWithdraw(address owner) external view returns (uint256 maxAssets);

	function maxRedeem(address owner) external view returns (uint256 maxShares);
}

File 39 of 48 : IERC4626Accounting.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.16;

interface IERC4626Accounting {
	function totalAssets() external view returns (uint256);

	function convertToShares(uint256 assets) external view returns (uint256);

	function convertToAssets(uint256 shares) external view returns (uint256);
}

File 40 of 48 : IVaultStrategy.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.16;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { VaultType, EpochType } from "./Structs.sol";

interface IVaultStrategy is IERC20 {
	// scy deposit
	function deposit(
		address receiver,
		address tokenIn,
		uint256 amountTokenToPull,
		uint256 minSharesOut
	) external payable returns (uint256 amountSharesOut);

	// erc4626 deposit
	function deposit(uint256 amount, address to) external payable returns (uint256 amountSharesOut);

	function vaultType() external view returns (VaultType);

	function redeem(
		address receiver,
		uint256 amountSharesToPull,
		address tokenOut,
		uint256 minTokenOut
	) external returns (uint256 amountTokenOut);

	function epochType() external view returns (EpochType);

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

	function requestRedeem(uint256 shares) external;

	function redeem() external returns (uint256 amountTokenOut);

	function getAndUpdateTvl() external returns (uint256 tvl);

	function getTvl() external view returns (uint256 tvl);

	function getMaxTvl() external view returns (uint256);

	function MIN_LIQUIDITY() external view returns (uint256);

	function underlying() external view returns (IERC20);

	function sendERC20ToStrategy() external view returns (bool);

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

	function underlyingBalance(address) external view returns (uint256);

	function underlyingToShares(uint256 amnt) external view returns (uint256);

	function exchangeRateUnderlying() external view returns (uint256);

	function sharesToUnderlying(uint256 shares) external view returns (uint256);

	function getUpdatedUnderlyingBalance(address) external returns (uint256);

	// only for withdraw batch vaults
	function requestedRedeem() external view returns (uint256);

	/// @dev slippage param is optional
	function processRedeem(uint256 slippageParam) external;

	function balanceOf(address account) external view returns (uint256);
}

File 41 of 48 : SectorErrors.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.16;

interface SectorErrors {
	error NotImplemented();
	error MaxTvlReached();
	error StrategyHasBalance();
	error MinLiquidity();
	error OnlyVault();
	error ZeroAmount();
}

File 42 of 48 : Structs.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

enum CallType {
	ADD_LIQUIDITY_AND_MINT,
	BORROWB,
	REMOVE_LIQ_AND_REPAY
}

enum VaultType {
	Strategy,
	Aggregator
}

enum EpochType {
	None,
	Withdraw,
	Full
}

enum NativeToken {
	None,
	Underlying,
	Short
}

struct CalleeData {
	CallType callType;
	bytes data;
}
struct AddLiquidityAndMintCalldata {
	uint256 uAmnt;
	uint256 sAmnt;
}
struct BorrowBCalldata {
	uint256 borrowAmount;
	bytes data;
}
struct RemoveLiqAndRepayCalldata {
	uint256 removeLpAmnt;
	uint256 repayUnderlying;
	uint256 repayShort;
	uint256 borrowUnderlying;
	// uint256 amountAMin;
	// uint256 amountBMin;
}

struct HarvestSwapParams {
	address[] path; //path that the token takes
	uint256 min; // min price of in token * 1e18 (computed externally based on spot * slippage + fees)
	uint256 deadline;
	bytes pathData; // uniswap3 path data
}

struct IMXConfig {
	address vault;
	address underlying;
	address short;
	address uniPair;
	address poolToken;
	address farmToken;
	address farmRouter;
}

struct HLPConfig {
	string symbol;
	string name;
	address underlying;
	address short;
	address cTokenLend;
	address cTokenBorrow;
	address uniPair;
	address uniFarm;
	address farmToken;
	uint256 farmId;
	address farmRouter;
	address comptroller;
	address lendRewardRouter;
	address lendRewardToken;
	address vault;
	NativeToken nativeToken;
}

struct EAction {
	address target;
	uint256 value;
	bytes data;
}

File 43 of 48 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

interface IWETH {
	function deposit() external payable;

	function transfer(address to, uint256 value) external returns (bool);

	function withdraw(uint256) external;

	function balanceOf(address) external returns (uint256);
}

File 44 of 48 : FixedPointMathLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.16;

/// @notice Arithmetic library with operations for fixed-point numbers.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)
/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)
library FixedPointMathLib {
	/*//////////////////////////////////////////////////////////////
                    SIMPLIFIED FIXED POINT OPERATIONS
    //////////////////////////////////////////////////////////////*/

	uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.

	function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
		return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.
	}

	function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
		return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.
	}

	function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
		return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.
	}

	function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
		return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.
	}

	/*//////////////////////////////////////////////////////////////
                    LOW LEVEL FIXED POINT OPERATIONS
    //////////////////////////////////////////////////////////////*/

	function mulDivDown(
		uint256 x,
		uint256 y,
		uint256 denominator
	) internal pure returns (uint256 z) {
		assembly {
			// Store x * y in z for now.
			z := mul(x, y)

			// Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))
			if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {
				revert(0, 0)
			}

			// Divide z by the denominator.
			z := div(z, denominator)
		}
	}

	function mulDivUp(
		uint256 x,
		uint256 y,
		uint256 denominator
	) internal pure returns (uint256 z) {
		assembly {
			// Store x * y in z for now.
			z := mul(x, y)

			// Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))
			if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {
				revert(0, 0)
			}

			// First, divide z - 1 by the denominator and add 1.
			// We allow z - 1 to underflow if z is 0, because we multiply the
			// end result by 0 if z is zero, ensuring we return 0 if z is zero.
			z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))
		}
	}

	function rpow(
		uint256 x,
		uint256 n,
		uint256 scalar
	) internal pure returns (uint256 z) {
		assembly {
			switch x
			case 0 {
				switch n
				case 0 {
					// 0 ** 0 = 1
					z := scalar
				}
				default {
					// 0 ** n = 0
					z := 0
				}
			}
			default {
				switch mod(n, 2)
				case 0 {
					// If n is even, store scalar in z for now.
					z := scalar
				}
				default {
					// If n is odd, store x in z for now.
					z := x
				}

				// Shifting right by 1 is like dividing by 2.
				let half := shr(1, scalar)

				for {
					// Shift n right by 1 before looping to halve it.
					n := shr(1, n)
				} n {
					// Shift n right by 1 each iteration to halve it.
					n := shr(1, n)
				} {
					// Revert immediately if x ** 2 would overflow.
					// Equivalent to iszero(eq(div(xx, x), x)) here.
					if shr(128, x) {
						revert(0, 0)
					}

					// Store x squared.
					let xx := mul(x, x)

					// Round to the nearest number.
					let xxRound := add(xx, half)

					// Revert if xx + half overflowed.
					if lt(xxRound, xx) {
						revert(0, 0)
					}

					// Set x to scaled xxRound.
					x := div(xxRound, scalar)

					// If n is even:
					if mod(n, 2) {
						// Compute z * x.
						let zx := mul(z, x)

						// If z * x overflowed:
						if iszero(eq(div(zx, x), z)) {
							// Revert if x is non-zero.
							if iszero(iszero(x)) {
								revert(0, 0)
							}
						}

						// Round to the nearest number.
						let zxRound := add(zx, half)

						// Revert if zx + half overflowed.
						if lt(zxRound, zx) {
							revert(0, 0)
						}

						// Return properly scaled zxRound.
						z := div(zxRound, scalar)
					}
				}
			}
		}
	}

	/*//////////////////////////////////////////////////////////////
                        GENERAL NUMBER UTILITIES
    //////////////////////////////////////////////////////////////*/

	function sqrt(uint256 x) internal pure returns (uint256 z) {
		assembly {
			// Start off with z at 1.
			z := 1

			// Used below to help find a nearby power of 2.
			let y := x

			// Find the lowest power of 2 that is at least sqrt(x).
			if iszero(lt(y, 0x100000000000000000000000000000000)) {
				y := shr(128, y) // Like dividing by 2 ** 128.
				z := shl(64, z) // Like multiplying by 2 ** 64.
			}
			if iszero(lt(y, 0x10000000000000000)) {
				y := shr(64, y) // Like dividing by 2 ** 64.
				z := shl(32, z) // Like multiplying by 2 ** 32.
			}
			if iszero(lt(y, 0x100000000)) {
				y := shr(32, y) // Like dividing by 2 ** 32.
				z := shl(16, z) // Like multiplying by 2 ** 16.
			}
			if iszero(lt(y, 0x10000)) {
				y := shr(16, y) // Like dividing by 2 ** 16.
				z := shl(8, z) // Like multiplying by 2 ** 8.
			}
			if iszero(lt(y, 0x100)) {
				y := shr(8, y) // Like dividing by 2 ** 8.
				z := shl(4, z) // Like multiplying by 2 ** 4.
			}
			if iszero(lt(y, 0x10)) {
				y := shr(4, y) // Like dividing by 2 ** 4.
				z := shl(2, z) // Like multiplying by 2 ** 2.
			}
			if iszero(lt(y, 0x8)) {
				// Equivalent to 2 ** z.
				z := shl(1, z)
			}

			// Shifting right by 1 is like dividing by 2.
			z := shr(1, add(z, div(x, z)))
			z := shr(1, add(z, div(x, z)))
			z := shr(1, add(z, div(x, z)))
			z := shr(1, add(z, div(x, z)))
			z := shr(1, add(z, div(x, z)))
			z := shr(1, add(z, div(x, z)))
			z := shr(1, add(z, div(x, z)))

			// Compute a rounded down version of z.
			let zRoundDown := div(x, z)

			// If zRoundDown is smaller, use it.
			if lt(zRoundDown, z) {
				z := zRoundDown
			}
		}
	}
}

File 45 of 48 : SafeETH.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.16;

library SafeETH {
	function safeTransferETH(address to, uint256 amount) internal {
		bool callStatus;

		assembly {
			// Transfer the ETH and store if it succeeded or not.
			callStatus := call(gas(), to, amount, 0, 0, 0, 0)
		}

		require(callStatus, "ETH_TRANSFER_FAILED");
	}
}

File 46 of 48 : ERC4626U.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import { ERC20Upgradeable as ERC20 } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { FixedPointMathLib } from "../../libraries/FixedPointMathLib.sol";
import { IERC4626 } from "../../interfaces/ERC4626/IERC4626.sol";
import { Accounting } from "../../common/Accounting.sol";
import { AuthU, AuthConfig } from "../../common/AuthU.sol";
import { FeesU, FeeConfig } from "../../common/FeesU.sol";
import { IWETH } from "../../interfaces/uniswap/IWETH.sol";
import { SectorErrors } from "../../interfaces/SectorErrors.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { ERC20PermitUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

// import "hardhat/console.sol";

/// @notice Minimal ERC4626 tokenized Vault implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)
abstract contract ERC4626U is
	Initializable,
	ERC20,
	AuthU,
	Accounting,
	FeesU,
	IERC4626,
	ReentrancyGuardUpgradeable,
	ERC20PermitUpgradeable,
	PausableUpgradeable,
	SectorErrors
{
	using SafeERC20 for IERC20;
	using FixedPointMathLib for uint256;

	// gap that allows us to add new inhereted contracts without breaking the storage layout
	uint256[100] private __gapPre;

	/*//////////////////////////////////////////////////////////////
                               CONSTANTS
    //////////////////////////////////////////////////////////////*/

	// locked liquidity to prevent rounding errors
	uint256 public constant MIN_LIQUIDITY = 1e3;
	uint256 public version;

	/*//////////////////////////////////////////////////////////////
                               IMMUTABLES
    //////////////////////////////////////////////////////////////*/

	IERC20 public asset;
	// flag that allows the vault to consume native asset
	bool public useNativeAsset;
	uint256 public maxTvl;

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

	function __ERC4626_init(
		IERC20 _asset,
		string memory _name,
		string memory _symbol,
		bool _useNativeAsset
	) public onlyInitializing {
		__ERC20_init(_name, _symbol);
		__ERC20Permit_init(_name);
		useNativeAsset = _useNativeAsset;
		asset = _asset;
	}

	receive() external payable {}

	function decimals() public view virtual override returns (uint8) {
		return ERC20(address(asset)).decimals();
	}

	function totalAssets() public view virtual override returns (uint256);

	/*//////////////////////////////////////////////////////////////
                        DEPOSIT/WITHDRAWAL LOGIC
    //////////////////////////////////////////////////////////////*/

	function deposit(uint256 assets, address receiver)
		public
		payable
		virtual
		nonReentrant
		returns (uint256 shares)
	{
		if (totalAssets() + assets > maxTvl) revert MaxTvlReached();

		// This check is no longer necessary because we use MIN_LIQUIDITY
		// Check for rounding error since we round down in previewDeposit.
		// require((shares = previewDeposit(assets)) != 0, "ZERO_SHARES");
		shares = previewDeposit(assets);

		// Need to transfer before minting or ERC777s could reenter.
		if (useNativeAsset && msg.value == assets) IWETH(address(asset)).deposit{ value: assets }();
		else asset.safeTransferFrom(msg.sender, address(this), assets);

		// lock minimum liquidity if totalSupply is 0
		if (totalSupply() == 0) {
			if (MIN_LIQUIDITY > shares) revert MinLiquidity();
			shares -= MIN_LIQUIDITY;
			_mint(address(1), MIN_LIQUIDITY);
		}

		_mint(receiver, shares);

		emit Deposit(msg.sender, receiver, assets, shares);

		afterDeposit(assets, shares);
	}

	function mint(uint256 shares, address receiver)
		public
		payable
		virtual
		nonReentrant
		returns (uint256 assets)
	{
		assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.
		if (totalAssets() + assets > maxTvl) revert MaxTvlReached();

		// Need to transfer before minting or ERC777s could reenter.
		if (useNativeAsset && msg.value == assets) IWETH(address(asset)).deposit{ value: assets }();
		else asset.safeTransferFrom(msg.sender, address(this), assets);

		// lock minimum liquidity if totalSupply is 0
		if (totalSupply() == 0) {
			if (MIN_LIQUIDITY > shares) revert MinLiquidity();
			shares -= MIN_LIQUIDITY;
			_mint(address(1), MIN_LIQUIDITY);
		}

		_mint(receiver, shares);

		emit Deposit(msg.sender, receiver, assets, shares);

		afterDeposit(assets, shares);
	}

	function withdraw(
		uint256 assets,
		address receiver,
		address owner
	) public virtual returns (uint256 shares) {
		shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.

		// if not owner, allowance must be enforced
		if (msg.sender != owner) _spendAllowance(owner, msg.sender, shares);

		beforeWithdraw(assets, shares);

		_burn(owner, shares);

		emit Withdraw(msg.sender, receiver, owner, assets, shares);

		asset.safeTransfer(receiver, assets);
	}

	function redeem(
		uint256 shares,
		address receiver,
		address owner
	) public virtual returns (uint256 assets) {
		// if not owner, allowance must be enforced
		if (msg.sender != owner) _spendAllowance(owner, msg.sender, shares);

		// This check is no longer necessary because we use MIN_LIQUIDITY
		// Check for rounding error since we round down in previewRedeem.
		// require((assets = previewRedeem(shares)) != 0, "ZEROassetS");
		assets = previewRedeem(shares);

		beforeWithdraw(assets, shares);

		_burn(owner, shares);

		emit Withdraw(msg.sender, receiver, owner, assets, shares);

		asset.safeTransfer(receiver, assets);
	}

	function previewDeposit(uint256 assets) public view virtual returns (uint256) {
		return convertToShares(assets);
	}

	function previewMint(uint256 shares) public view virtual returns (uint256) {
		uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.

		return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);
	}

	function previewWithdraw(uint256 assets) public view virtual returns (uint256) {
		uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.
		return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());
	}

	function previewRedeem(uint256 shares) public view virtual returns (uint256) {
		return convertToAssets(shares);
	}

	/*//////////////////////////////////////////////////////////////
                     DEPOSIT/WITHDRAWAL LIMIT LOGIC
    //////////////////////////////////////////////////////////////*/

	function setMaxTvl(uint256 _maxTvl) public onlyRole(MANAGER) {
		maxTvl = _maxTvl;
		emit MaxTvlUpdated(_maxTvl);
	}

	function maxDeposit(address) public view override returns (uint256) {
		uint256 _totalAssets = totalAssets();
		return _totalAssets > maxTvl ? 0 : maxTvl - _totalAssets;
	}

	function maxMint(address) public view override returns (uint256) {
		return convertToShares(maxDeposit(address(0)));
	}

	function maxWithdraw(address owner) public view virtual returns (uint256) {
		return convertToAssets(balanceOf(owner));
	}

	function maxRedeem(address owner) public view virtual returns (uint256) {
		return balanceOf(owner);
	}

	/*//////////////////////////////////////////////////////////////
                          INTERNAL HOOKS LOGIC
    //////////////////////////////////////////////////////////////*/

	function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}

	function afterDeposit(uint256 assets, uint256 shares) internal virtual {}

	event MaxTvlUpdated(uint256 maxTvl);

	/// ERC20 overrides

	function totalSupply() public view virtual override(Accounting, ERC20) returns (uint256) {
		return ERC20.totalSupply();
	}

	/// PAUSABLE

	function pause() public onlyRole(GUARDIAN) {
		_pause();
	}

	function unpause() public onlyRole(GUARDIAN) {
		_unpause();
	}

	function _beforeTokenTransfer(
		address from,
		address to,
		uint256 amount
	) internal override whenNotPaused {
		super._beforeTokenTransfer(from, to, amount);
	}

	uint256[50] private __gap;
}

File 47 of 48 : SectorBaseU.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;

import { ERC4626U, FixedPointMathLib, SafeERC20, IWETH, Accounting, ERC20, IERC20 } from "./ERC4626U.sol";
import { BatchedWithdraw } from "../../common/BatchedWithdraw.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { EAction } from "../../interfaces/Structs.sol";
import { VaultType } from "../../interfaces/Structs.sol";
import { SafeETH } from "../../libraries/SafeETH.sol";

// import "hardhat/console.sol";

abstract contract SectorBaseU is BatchedWithdraw, ERC4626U {
	using FixedPointMathLib for uint256;
	using SafeERC20 for IERC20;

	VaultType public constant vaultType = VaultType.Aggregator;

	uint256 public totalChildHoldings;
	uint256 public floatAmnt; // amount of underlying tracked in vault
	uint256 public harvestInterval; // emergency redeem is enabled after this time

	function setHarvestInterval(uint256 harvestInterval_) public onlyOwner {
		harvestInterval = harvestInterval_;
		emit SetHarvestInterval(harvestInterval);
	}

	function withdraw(
		uint256,
		address,
		address
	) public pure virtual override returns (uint256) {
		revert NotImplemented();
	}

	function redeem(
		uint256,
		address receiver,
		address
	) public virtual override returns (uint256 amountOut) {
		return redeem(receiver);
	}

	function redeemNative(address receiver) public virtual returns (uint256 amountOut) {
		if (!useNativeAsset) revert NotNativeAsset();
		uint256 shares;
		(amountOut, shares) = _redeem(msg.sender);

		beforeWithdraw(amountOut, shares);
		_burn(address(this), shares);

		emit Withdraw(msg.sender, receiver, msg.sender, amountOut, shares);

		IWETH(address(asset)).withdraw(amountOut);
		SafeETH.safeTransferETH(receiver, amountOut);
	}

	function redeem(address receiver) public virtual returns (uint256 amountOut) {
		uint256 shares;
		(amountOut, shares) = _redeem(msg.sender);

		beforeWithdraw(amountOut, shares);
		_burn(address(this), shares);

		emit Withdraw(msg.sender, receiver, msg.sender, amountOut, shares);
		asset.safeTransfer(receiver, amountOut);
	}

	/// @dev safest UI method
	function redeem() public virtual returns (uint256 amountOut) {
		return redeem(msg.sender);
	}

	/// @dev safest UI method
	function redeemNative() public virtual returns (uint256 amountOut) {
		return redeemNative(msg.sender);
	}

	function _harvest(uint256 currentChildHoldings) internal {
		// withdrawFromStrategies should be called prior to harvest to ensure this tx doesn't revert
		// pendingWithdraw may be larger than the actual withdrawable amount if vault sufferred losses
		// since the previous harvest

		uint256 tvl = currentChildHoldings + floatAmnt;
		uint256 _totalSupply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.

		/// this is actually a max amount that can be withdrawn given current tvl
		/// actual withdraw amount may be slightly less if there are stale withdraw requests
		if (_totalSupply > 0) {
			uint256 pendingWithdraw = requestedRedeem.mulDivDown(tvl, _totalSupply);
			if (floatAmnt < pendingWithdraw) revert NotEnoughtFloat();
		}

		uint256 profit = currentChildHoldings > totalChildHoldings
			? currentChildHoldings - totalChildHoldings
			: 0;

		uint256 timestamp = block.timestamp;

		// totalChildHoldings need to be updated before fees computation
		totalChildHoldings = currentChildHoldings;

		// PROCESS VAULT FEES
		uint256 _performanceFee = profit == 0 ? 0 : (profit * performanceFee) / 1e18;
		uint256 _managementFee = managementFee == 0
			? 0
			: (managementFee * tvl * (timestamp - lastHarvestTimestamp)) / 1e18 / 365 days;

		uint256 totalFees = _performanceFee + _managementFee;
		uint256 feeShares;

		if (totalFees > 0 && tvl > totalFees) {
			// this results in more accurate accounting considering dilution
			feeShares = totalFees.mulDivDown(_totalSupply, tvl - totalFees);
			_mint(treasury, feeShares);
		}

		emit Harvest(treasury, profit, _performanceFee, _managementFee, feeShares, tvl);

		// this enables withdrawals requested prior to this timestamp
		lastHarvestTimestamp = timestamp;
		_processRedeem();
	}

	/// @notice this method allows an arbitrary method to be called by the owner in case of emergency
	/// owner must be a timelock contract in order to allow users to redeem funds in case they suspect
	/// this action to be malicious
	function emergencyAction(EAction[] calldata actions) public payable onlyOwner {
		uint256 l = actions.length;
		for (uint256 i; i < l; ++i) {
			address target = actions[i].target;
			bytes memory data = actions[i].data;
			(bool success, ) = target.call{ value: actions[i].value }(data);
			require(success, "emergencyAction failed");
			emit EmergencyAction(target, data);
		}
	}

	function _checkSlippage(
		uint256 expectedValue,
		uint256 actualValue,
		uint256 maxDelta
	) internal pure {
		uint256 delta = expectedValue > actualValue
			? expectedValue - actualValue
			: actualValue - expectedValue;
		if (delta > maxDelta) revert SlippageExceeded();
	}

	function totalAssets() public view virtual override(Accounting, ERC4626U) returns (uint256) {
		return floatAmnt + totalChildHoldings;
	}

	/// INTERFACE UTILS

	/// @dev returns a cached value used for withdrawals
	function underlyingBalance(address user) public view returns (uint256) {
		uint256 shares = balanceOf(user);
		return convertToAssets(shares);
	}

	function getUpdatedUnderlyingBalance(address user) public view returns (uint256) {
		uint256 shares = balanceOf(user);
		return convertToAssets(shares);
	}

	function underlyingDecimals() public view returns (uint8) {
		return decimals();
	}

	function underlying() public view returns (address) {
		return address(asset);
	}

	/// OVERRIDES
	function _transfer(
		address sender,
		address recipient,
		uint256 amount
	) internal override(BatchedWithdraw, ERC20) {
		super._transfer(sender, recipient, amount);
	}

	function _spendAllowance(
		address owner,
		address spender,
		uint256 amount
	) internal override(BatchedWithdraw, ERC20) {
		super._spendAllowance(owner, spender, amount);
	}

	function totalSupply() public view override(Accounting, ERC4626U) returns (uint256) {
		return super.totalSupply();
	}

	function afterDeposit(uint256 assets, uint256) internal override {
		if (block.timestamp - lastHarvestTimestamp > harvestInterval)
			revert EmergencyRedeemEnabled();

		floatAmnt += assets;
	}

	function beforeWithdraw(uint256 assets, uint256) internal override {
		// this check prevents withdrawing more underlying from the vault then
		// what we need to keep to honor withdrawals
		uint256 pendingWithdraw = convertToAssets(pendingRedeem);
		if (floatAmnt < assets + pendingWithdraw) revert NotEnoughtFloat();
		floatAmnt -= assets;
	}

	event RegisterDeposit(uint256 total);
	event EmergencyWithdraw(address vault, address client, uint256 shares);
	event EmergencyAction(address target, bytes callData);
	event Harvest(
		address indexed treasury,
		uint256 underlyingProfit,
		uint256 performanceFee,
		uint256 managementFee,
		uint256 sharesFees,
		uint256 tvl
	);
	event SetHarvestInterval(uint256 harvestInterval);

	error RecentHarvest();
	error MaxRedeemNotZero();
	error NotEnoughtFloat();
	error WrongUnderlying();
	error SlippageExceeded();
	error StrategyExists();
	error StrategyNotFound();
	error MissingDepositValue();
	error EmergencyRedeemEnabled();
	error TooManyStrategies();
	error WrongEpochType();

	uint256[50] private __gap;
}

File 48 of 48 : AggregatorVaultU.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;

import { ERC4626U, FixedPointMathLib, SafeERC20, FeeConfig, AuthConfig } from "../ERC4626/ERC4626U.sol";
import { IVaultStrategy } from "../../interfaces/IVaultStrategy.sol";
import { SectorBaseU, ERC20, IERC20 } from "../ERC4626/SectorBaseU.sol";
import { VaultType } from "../../interfaces/Structs.sol";

// import "hardhat/console.sol";
// TODO native asset deposit + flow

struct RedeemParams {
	IVaultStrategy strategy;
	VaultType vaultType;
	uint256 shares;
	uint256 minTokenOut;
}

struct DepositParams {
	IVaultStrategy strategy;
	VaultType vaultType;
	uint256 amountIn;
	uint256 minSharesOut;
}

// Sector Aggregator Vault
contract AggregatorVaultU is SectorBaseU {
	using FixedPointMathLib for uint256;
	using SafeERC20 for IERC20;

	// resonable amount to not go over gas limit when doing emergencyWithdraw
	// in reality can go up to 200
	uint8 constant MAX_STRATS = 100;

	mapping(IVaultStrategy => bool) public strategyExists;
	address[] public strategyIndex;

	function initialize(
		IERC20 asset_,
		string memory _name,
		string memory _symbol,
		bool _useNativeAsset,
		uint256 _harvestInterval,
		uint256 _maxTvl,
		AuthConfig memory authConfig,
		FeeConfig memory feeConfig
	) public initializer {
		__ERC4626_init(asset_, _name, _symbol, _useNativeAsset);
		__Auth_init(authConfig);
		__Fees_init(feeConfig);

		maxTvl = _maxTvl;
		emit MaxTvlUpdated(_maxTvl);

		harvestInterval = _harvestInterval;
		emit SetHarvestInterval(_harvestInterval);

		lastHarvestTimestamp = block.timestamp;
	}

	function getMaxTvl() external view returns (uint256) {
		uint256 startMaxTvl;
		for (uint256 i; i < strategyIndex.length; ++i) {
			IVaultStrategy strategy = IVaultStrategy(strategyIndex[i]);
			startMaxTvl += strategy.getMaxTvl();
		}
		return maxTvl < startMaxTvl ? maxTvl : startMaxTvl;
	}

	function addStrategy(IVaultStrategy strategy) public onlyOwner {
		if (strategyIndex.length >= MAX_STRATS) revert TooManyStrategies();
		if (strategyExists[strategy]) revert StrategyExists();

		/// make sure underlying matches
		if (address(strategy.underlying()) != address(asset)) revert WrongUnderlying();
		if (strategy.epochType() != epochType) revert WrongEpochType();

		strategyExists[strategy] = true;
		strategyIndex.push(address(strategy));
		emit AddStrategy(address(strategy));
	}

	function removeStrategy(IVaultStrategy strategy) public onlyOwner {
		if (!strategyExists[strategy]) revert StrategyNotFound();
		strategyExists[strategy] = false;

		// make sure we don't have deposits in the strategy
		uint256 balance = strategy.balanceOf(address(this));
		if (balance > MIN_LIQUIDITY) revert StrategyHasBalance();

		uint256 length = strategyIndex.length;
		// replace current index with last strategy and pop the index array
		uint256 i;
		for (i; i < length; ++i) if (address(strategy) == strategyIndex[i]) break;
		strategyIndex[i] = strategyIndex[length - 1];
		strategyIndex.pop();
		emit RemoveStrategy(address(strategy));
	}

	function totalStrategies() external view returns (uint256) {
		return strategyIndex.length;
	}

	function getAllStrategies() external view returns (address[] memory) {
		return strategyIndex;
	}

	/// We compute expected tvl off-chain first, to ensure this transactions isn't sandwitched
	function harvest(uint256 expectedTvl, uint256 maxDelta) public onlyRole(MANAGER) {
		uint256 currentChildHoldings = _getStrategyHoldings();
		uint256 tvl = currentChildHoldings + floatAmnt;
		_checkSlippage(expectedTvl, tvl, maxDelta);
		// harvest event emitted here
		_harvest(currentChildHoldings);
	}

	/// this can be done in parts in case gas limit is reached
	function depositIntoStrategies(DepositParams[] calldata params) public onlyRole(MANAGER) {
		uint256 l = params.length;
		for (uint256 i; i < l; ++i) {
			DepositParams memory param = params[i];
			uint256 amountIn = param.amountIn;
			if (amountIn == 0) continue;
			IVaultStrategy strategy = param.strategy;

			if (!strategyExists[strategy]) revert StrategyNotFound();

			// update underlying float accouting
			beforeWithdraw(amountIn, 0);
			/// push funds to avoid approvals
			if (param.vaultType == VaultType.Strategy) {
				// send funds - more gas efficient
				if (strategy.sendERC20ToStrategy() == true)
					asset.safeTransfer(strategy.strategy(), amountIn);
				else asset.safeTransfer(address(strategy), amountIn);

				// process deposit
				strategy.deposit(address(this), address(asset), 0, param.minSharesOut);
			} else if (param.vaultType == VaultType.Aggregator) {
				asset.safeApprove(address(strategy), amountIn);
				strategy.deposit(amountIn, address(this));
			}
			totalChildHoldings += amountIn;

			emit DepositIntoStrategy(msg.sender, address(strategy), amountIn);
		}
	}

	function requestRedeemFromStrategies(RedeemParams[] calldata params) public onlyRole(MANAGER) {
		uint256 l = params.length;
		for (uint256 i; i < l; ++i) {
			if (params[i].vaultType != VaultType.Aggregator) continue;
			params[i].strategy.requestRedeem(params[i].shares);
		}
	}

	/// this can be done in parts in case gas limit is reached
	function withdrawFromStrategies(RedeemParams[] calldata params) public onlyRole(MANAGER) {
		uint256 l = params.length;
		for (uint256 i; i < l; ++i) {
			RedeemParams memory param = params[i];
			uint256 shares = param.shares;
			if (shares == 0) continue;
			IVaultStrategy strategy = param.strategy;
			if (!strategyExists[strategy]) revert StrategyNotFound();

			uint256 amountOut;
			if (param.vaultType == VaultType.Strategy)
				// no need to push share tokens - contract can burn them
				amountOut = strategy.redeem(
					address(this),
					shares,
					address(asset), // token out is allways asset
					param.minTokenOut
				);
			else if (param.vaultType == VaultType.Aggregator) amountOut = strategy.redeem();

			// if strategy was profitable, we may end up withdrawing more than totalChildHoldings
			totalChildHoldings = amountOut > totalChildHoldings
				? 0
				: totalChildHoldings - amountOut;

			// update underlying float accounting
			afterDeposit(amountOut, 0);
			emit WithdrawFromStrategy(msg.sender, address(strategy), amountOut);
		}
	}

	/// @dev this method allows direct redemption of shares in exchange for
	/// a portion of the float amount + a portion of all the strategy shares the vault holds
	/// deposits are paused when we are in the emergency redeem state
	function emergencyRedeem() public nonReentrant {
		if (block.timestamp - lastHarvestTimestamp < harvestInterval) revert RecentHarvest();
		uint256 shares = balanceOf(msg.sender);
		if (shares == 0) return;

		// pendingRedeem cannot be bigger than totalSupply
		uint256 adjustedSupply = totalSupply() - pendingRedeem;

		// redeem proportional share of vault's underlying float balance
		// (minus pendingWithdraw)
		uint256 pendingWithdraw = convertToAssets(pendingRedeem);

		if (floatAmnt > pendingWithdraw) {
			uint256 availableFloat = floatAmnt - pendingWithdraw;
			uint256 underlyingShare = availableFloat.mulDivDown(shares, adjustedSupply);
			beforeWithdraw(underlyingShare, 0);
			asset.safeTransfer(msg.sender, underlyingShare);
		}

		uint256 l = strategyIndex.length;

		// redeem proportional share of each strategy
		for (uint256 i; i < l; ++i) {
			IERC20 stratToken = IERC20(strategyIndex[i]);
			uint256 balance = stratToken.balanceOf(address(this));
			uint256 userShares = shares.mulDivDown(balance, adjustedSupply);
			if (userShares == 0) continue;
			stratToken.safeTransfer(msg.sender, userShares);
		}

		// reduce the amount of totalChildHoldings
		totalChildHoldings -= shares.mulDivDown(totalChildHoldings, adjustedSupply);

		_burn(msg.sender, shares);
	}

	/// gets accurate strategy holdings denominated in asset
	function _getStrategyHoldings() internal returns (uint256 tvl) {
		uint256 l = strategyIndex.length;
		/// TODO compute realistic limit for strategy array lengh to stay within gas limit
		for (uint256 i; i < l; ++i) {
			IVaultStrategy strategy = IVaultStrategy(payable(strategyIndex[i]));
			tvl += strategy.getUpdatedUnderlyingBalance(address(this));
		}
	}

	/// returns expected tvl (used for estimate)
	function getTvl() public view returns (uint256 tvl) {
		uint256 l = strategyIndex.length;
		// there should be no untrusted strategies in this array
		for (uint256 i; i < l; ++i) {
			IVaultStrategy strategy = IVaultStrategy(payable(strategyIndex[i]));
			tvl += strategy.underlyingBalance(address(this));
		}
		tvl += asset.balanceOf(address(this));
	}

	function totalAssets() public view virtual override returns (uint256) {
		return floatAmnt + totalChildHoldings;
	}

	function getFloat() public view returns (uint256) {
		uint256 _float = floatAmnt;
		uint256 _pendingWithdraw = convertToAssets(pendingRedeem);
		return _float > _pendingWithdraw ? _float - _pendingWithdraw : 0;
	}

	/// INTERFACE UTILS

	/// @dev returns accurate value used to estimate current value
	function estimateUnderlyingBalance(address user) external view returns (uint256) {
		uint256 shares = balanceOf(user);
		// value based on last harvest exchange rate
		uint256 cachedValue = convertToAssets(shares);
		// valued based on current tvl
		uint256 currentValue = sharesToUnderlying(shares);
		return cachedValue > currentValue ? currentValue : cachedValue;
	}

	/// @dev current exchange rate (different from previewDeposit rate)
	/// this should be used for estiamtes of withdrawals
	function sharesToUnderlying(uint256 shares) public view returns (uint256) {
		uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.
		return supply == 0 ? shares : shares.mulDivDown(getTvl(), supply);
	}

	/// @dev current exchange rate (different from previewDeposit / previewWithdrawal rate)
	/// this should be used estimate of deposit fee
	function underlyingToShares(uint256 underlyingAmnt) public view returns (uint256) {
		uint256 supply = totalSupply(); // Saves an extra SLOAD if totalSupply is non-zero.
		return supply == 0 ? underlyingAmnt : underlyingAmnt.mulDivDown(supply, getTvl());
	}

	event AddStrategy(address indexed strategy);
	event RemoveStrategy(address indexed strategy);
	event DepositIntoStrategy(address caller, address strategy, uint256 amount);
	event WithdrawFromStrategy(address caller, address strategy, uint256 amount);
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[],"name":"CannotCancelProccesedRedeem","type":"error"},{"inputs":[],"name":"EmergencyRedeemEnabled","type":"error"},{"inputs":[],"name":"MaxRedeemNotZero","type":"error"},{"inputs":[],"name":"MaxTvlReached","type":"error"},{"inputs":[],"name":"MinLiquidity","type":"error"},{"inputs":[],"name":"MissingDepositValue","type":"error"},{"inputs":[],"name":"NotEnoughtFloat","type":"error"},{"inputs":[],"name":"NotImplemented","type":"error"},{"inputs":[],"name":"NotNativeAsset","type":"error"},{"inputs":[],"name":"NotReady","type":"error"},{"inputs":[],"name":"OnlyVault","type":"error"},{"inputs":[],"name":"OverMaxFee","type":"error"},{"inputs":[],"name":"RecentHarvest","type":"error"},{"inputs":[],"name":"SlippageExceeded","type":"error"},{"inputs":[],"name":"StrategyExists","type":"error"},{"inputs":[],"name":"StrategyHasBalance","type":"error"},{"inputs":[],"name":"StrategyNotFound","type":"error"},{"inputs":[],"name":"TooManyStrategies","type":"error"},{"inputs":[],"name":"WrongEpochType","type":"error"},{"inputs":[],"name":"WrongUnderlying","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"}],"name":"AddStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositIntoStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bytes","name":"callData","type":"bytes"}],"name":"EmergencyAction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"address","name":"client","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"treasury","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlyingProfit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"performanceFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"managementFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sharesFees","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tvl","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxTvl","type":"uint256"}],"name":"MaxTvlUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"total","type":"uint256"}],"name":"RegisterDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"}],"name":"RemoveStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"RequestWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"harvestInterval","type":"uint256"}],"name":"SetHarvestInterval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"managementFee","type":"uint256"}],"name":"SetManagementFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"performanceFee","type":"uint256"}],"name":"SetPerformanceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"treasury","type":"address"}],"name":"SetTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawFromStrategy","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARDIAN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MANAGEMENT_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERFORMANCE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"guardian","type":"address"},{"internalType":"address","name":"manager","type":"address"}],"internalType":"struct AuthConfig","name":"authConfig","type":"tuple"}],"name":"__Auth_init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_asset","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"bool","name":"_useNativeAsset","type":"bool"}],"name":"__ERC4626_init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"treasury","type":"address"},{"internalType":"uint256","name":"performanceFee","type":"uint256"},{"internalType":"uint256","name":"managementFee","type":"uint256"}],"internalType":"struct FeeConfig","name":"feeConfig","type":"tuple"}],"name":"__Fees_init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVaultStrategy","name":"strategy","type":"address"}],"name":"addStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IVaultStrategy","name":"strategy","type":"address"},{"internalType":"enum VaultType","name":"vaultType","type":"uint8"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minSharesOut","type":"uint256"}],"internalType":"struct DepositParams[]","name":"params","type":"tuple[]"}],"name":"depositIntoStrategies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct EAction[]","name":"actions","type":"tuple[]"}],"name":"emergencyAction","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"emergencyRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epochType","outputs":[{"internalType":"enum EpochType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"estimateUnderlyingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"floatAmnt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllStrategies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFloat","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxTvl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPenalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTvl","outputs":[{"internalType":"uint256","name":"tvl","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUpdatedUnderlyingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getWithdrawStatus","outputs":[{"components":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct WithdrawRecord","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"expectedTvl","type":"uint256"},{"internalType":"uint256","name":"maxDelta","type":"uint256"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvestInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"asset_","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"bool","name":"_useNativeAsset","type":"bool"},{"internalType":"uint256","name":"_harvestInterval","type":"uint256"},{"internalType":"uint256","name":"_maxTvl","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"guardian","type":"address"},{"internalType":"address","name":"manager","type":"address"}],"internalType":"struct AuthConfig","name":"authConfig","type":"tuple"},{"components":[{"internalType":"address","name":"treasury","type":"address"},{"internalType":"uint256","name":"performanceFee","type":"uint256"},{"internalType":"uint256","name":"managementFee","type":"uint256"}],"internalType":"struct FeeConfig","name":"feeConfig","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastHarvestTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managementFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTvl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeem","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"redeemIsReady","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeemNative","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"redeemNative","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVaultStrategy","name":"strategy","type":"address"}],"name":"removeStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"requestRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"requestRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IVaultStrategy","name":"strategy","type":"address"},{"internalType":"enum VaultType","name":"vaultType","type":"uint8"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"minTokenOut","type":"uint256"}],"internalType":"struct RedeemParams[]","name":"params","type":"tuple[]"}],"name":"requestRedeemFromStrategies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestedRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"harvestInterval_","type":"uint256"}],"name":"setHarvestInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_managementFee","type":"uint256"}],"name":"setManagementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxTvl","type":"uint256"}],"name":"setMaxTvl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_performanceFee","type":"uint256"}],"name":"setPerformanceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"sharesToUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IVaultStrategy","name":"","type":"address"}],"name":"strategyExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"strategyIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalChildHoldings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStrategies","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pendingOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"underlyingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"underlyingAmnt","type":"uint256"}],"name":"underlyingToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"useNativeAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultType","outputs":[{"internalType":"enum VaultType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"contract IVaultStrategy","name":"strategy","type":"address"},{"internalType":"enum VaultType","name":"vaultType","type":"uint8"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"minTokenOut","type":"uint256"}],"internalType":"struct RedeemParams[]","name":"params","type":"tuple[]"}],"name":"withdrawFromStrategies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawLedger","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615e0680620000f46000396000f3fe60806040526004361061049a5760003560e01c806301e1d114146104a657806301ffc9a7146104ce57806306fdde03146104fe57806307a2d13a14610520578063095ea7b3146105405780630a28a477146105605780630a605c6d14610580578063107703ab1461059757806314dc0ce0146105b9578063175188e8146105d057806318160ddd146105f05780631b2df850146106055780631b635c2d1461062757806321b77d6314610647578063223e54791461065d5780632257a7381461067d5780632265ff7e1461069457806323b872dd146106b4578063248a9ca3146106d457806325a760c2146106f45780632f2ff15d1461071b578063313ce5671461073b5780633230b79b14610750578063358d6a04146107705780633644e5151461078557806336568abe1461079a57806338d52e0f146107ba57806338d7aae1146107e857806339509351146108085780633e642575146106945780633f4ba83a14610828578063402d267d1461083d57806345ca4b851461085d5780634ac032be1461087d5780634cdad5061461089f57806351a72964146108bf57806354fd4d50146109015780635b9d2658146109185780635c975abb14610970578063607fe86e1461098957806361d027b3146109a9578063632a44ec146109ca5780636364a785146109ec5780636905ef5b14610a0c5780636a28006a14610a2e5780636c6aebac14610a435780636e553f6514610a635780636f307dc314610a7657806370897b2314610a9557806370a0823114610ab5578063724c184c14610ad557806379ba509714610af75780637df3927e14610b0c5780637ecebe0014610b1f5780638456cb5914610b3f578063856345bf14610b545780638576829e14610b745780638778878214610b8b5780638954b3e014610ba25780638c87101914610bb75780638da5cb5b14610bd757806391d1485414610bf757806394bf804d14610c1757806395a2251f14610c2a57806395d89b4114610c4a5780639908840c14610c5f5780639a1815be14610c7a578063a217fddf14610c91578063a457c2d714610ca6578063a6f7f5d614610cc6578063a9059cbb14610cdd578063aa2f892d14610cfd578063b3d7f6b914610d1d578063b460af9414610d3d578063b5ca770414610d5d578063b700a50414610d7d578063ba08765214610d9d578063bdca916514610dbd578063be040fb014610dd9578063c3b2886414610dee578063c63d75b614610e10578063c6e6f59214610e30578063cb50087f14610e50578063ce96cb7714610e70578063d075dd4214610e90578063d4355bcc14610ea5578063d505accf14610eba578063d547741f14610eda578063d7b9991c14610efa578063d905777e14610f1a578063dd62ed3e14610f3a578063de68eca314610f5a578063e30c397814610f7a578063e3f62d5d14610f9a578063e4a4b7b114610fcb578063e56e56db14610feb578063e6a2966614611000578063ef8b30f714611015578063f0f4426014611035578063f299ab3f14611055578063f2fde38b1461106c578063f3e738751461108c578063f96d7b80146110ac578063fc6b1ebe146110c2578063fe56e232146110d957600080fd5b366104a157005b600080fd5b3480156104b257600080fd5b506104bb6110f9565b6040519081526020015b60405180910390f35b3480156104da57600080fd5b506104ee6104e936600461500a565b611112565b60405190151581526020016104c5565b34801561050a57600080fd5b50610513611149565b6040516104c59190615084565b34801561052c57600080fd5b506104bb61053b366004615097565b6111db565b34801561054c57600080fd5b506104ee61055b3660046150c5565b61120f565b34801561056c57600080fd5b506104bb61057b366004615097565b611227565b34801561058c57600080fd5b506104bb6102315481565b3480156105a357600080fd5b506105b76105b23660046150f1565b61124e565b005b3480156105c557600080fd5b506104bb6103005481565b3480156105dc57600080fd5b506105b76105eb366004615121565b611278565b3480156105fc57600080fd5b506104bb6114c7565b34801561061157600080fd5b506104bb600080516020615c7183398151915281565b34801561063357600080fd5b506105b7610642366004615189565b6114d1565b34801561065357600080fd5b506104bb6103e881565b34801561066957600080fd5b506105b7610678366004615121565b6115f1565b34801561068957600080fd5b506104bb61022f5481565b3480156106a057600080fd5b506104bb6106af366004615121565b611833565b3480156106c057600080fd5b506104ee6106cf3660046151ca565b61184a565b3480156106e057600080fd5b506104bb6106ef366004615097565b61186e565b34801561070057600080fd5b50610709611883565b60405160ff90911681526020016104c5565b34801561072757600080fd5b506105b76107363660046150f1565b61188d565b34801561074757600080fd5b506107096118ae565b34801561075c57600080fd5b506104ee61076b366004615121565b61191d565b34801561077c57600080fd5b506104bb611950565b34801561079157600080fd5b506104bb611a26565b3480156107a657600080fd5b506105b76107b53660046150f1565b611a30565b3480156107c657600080fd5b506102ca546107db906001600160a01b031681565b6040516104c5919061520b565b3480156107f457600080fd5b506105b7610803366004615097565b611aaa565b34801561081457600080fd5b506104ee6108233660046150c5565b611aff565b34801561083457600080fd5b506105b7611b21565b34801561084957600080fd5b506104bb610858366004615121565b611b44565b34801561086957600080fd5b506105b76108783660046152f7565b611b73565b34801561088957600080fd5b50610892600181565b6040516104c59190615395565b3480156108ab57600080fd5b506104bb6108ba366004615097565b611beb565b3480156108cb57600080fd5b506108df6108da366004615121565b611bf6565b60408051825181526020808401519082015291810151908201526060016104c5565b34801561090d57600080fd5b506104bb6102c95481565b34801561092457600080fd5b50610955610933366004615121565b6102326020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016104c5565b34801561097c57600080fd5b506101fd5460ff166104ee565b34801561099557600080fd5b506105b76109a43660046153f4565b611c5d565b3480156109b557600080fd5b50610131546107db906001600160a01b031681565b3480156109d657600080fd5b506109df600081565b6040516104c59190615410565b3480156109f857600080fd5b506105b7610a07366004615479565b611d1b565b348015610a1857600080fd5b506102ca546104ee90600160a01b900460ff1681565b348015610a3a57600080fd5b506104bb611e47565b348015610a4f57600080fd5b506105b7610a5e366004615189565b611e52565b6104bb610a713660046150f1565b6121be565b348015610a8257600080fd5b506102ca546001600160a01b03166107db565b348015610aa157600080fd5b506105b7610ab0366004615097565b612357565b348015610ac157600080fd5b506104bb610ad0366004615121565b6123ce565b348015610ae157600080fd5b506104bb600080516020615cd183398151915281565b348015610b0357600080fd5b506105b76123e9565b6105b7610b1a366004615495565b6124f9565b348015610b2b57600080fd5b506104bb610b3a366004615121565b6126ef565b348015610b4b57600080fd5b506105b761270e565b348015610b6057600080fd5b506105b7610b6f366004615509565b61272e565b348015610b8057600080fd5b506104bb6102ff5481565b348015610b9757600080fd5b506104bb61012f5481565b348015610bae57600080fd5b506105b76128b7565b348015610bc357600080fd5b506104bb610bd2366004615097565b612ab7565b348015610be357600080fd5b5060c9546107db906001600160a01b031681565b348015610c0357600080fd5b506104ee610c123660046150f1565b612ade565b6104bb610c253660046150f1565b612b09565b348015610c3657600080fd5b506104bb610c45366004615121565b612c96565b348015610c5657600080fd5b50610513612d1e565b348015610c6b57600080fd5b506104bb66b1a2bc2ec5000081565b348015610c8657600080fd5b506104bb6102cb5481565b348015610c9d57600080fd5b506104bb600081565b348015610cb257600080fd5b506104ee610cc13660046150c5565b612d2d565b348015610cd257600080fd5b506104bb6101305481565b348015610ce957600080fd5b506104ee610cf83660046150c5565b612da8565b348015610d0957600080fd5b506105b7610d18366004615097565b612db6565b348015610d2957600080fd5b506104bb610d38366004615097565b612dc0565b348015610d4957600080fd5b506104bb610d583660046155c9565b612de6565b348015610d6957600080fd5b506104bb610d78366004615121565b612e01565b348015610d8957600080fd5b506105b7610d98366004615189565b612e41565b348015610da957600080fd5b506104bb610db83660046155c9565b613097565b348015610dc957600080fd5b506104bb6703782dace9d9000081565b348015610de557600080fd5b506104bb6130aa565b348015610dfa57600080fd5b50610e036130b5565b6040516104c5919061560b565b348015610e1c57600080fd5b506104bb610e2b366004615121565b613117565b348015610e3c57600080fd5b506104bb610e4b366004615097565b613126565b348015610e5c57600080fd5b506105b7610e6b366004615097565b613145565b348015610e7c57600080fd5b506104bb610e8b366004615121565b613181565b348015610e9c57600080fd5b506104bb61318f565b348015610eb157600080fd5b506104bb6132ce565b348015610ec657600080fd5b506105b7610ed5366004615667565b613306565b348015610ee657600080fd5b506105b7610ef53660046150f1565b61346a565b348015610f0657600080fd5b506107db610f15366004615097565b613486565b348015610f2657600080fd5b506104bb610f35366004615121565b6134b1565b348015610f4657600080fd5b506104bb610f553660046156d8565b6134bc565b348015610f6657600080fd5b506104bb610f75366004615121565b6134e7565b348015610f8657600080fd5b5060ca546107db906001600160a01b031681565b348015610fa657600080fd5b506104ee610fb5366004615121565b6103336020526000908152604090205460ff1681565b348015610fd757600080fd5b506105b7610fe6366004615706565b6135e7565b348015610ff757600080fd5b506104bb613632565b34801561100c57600080fd5b506105b7613692565b34801561102157600080fd5b506104bb611030366004615097565b6136fe565b34801561104157600080fd5b506105b7611050366004615121565b613709565b34801561106157600080fd5b506104bb6102305481565b34801561107857600080fd5b506105b7611087366004615121565b61376c565b34801561109857600080fd5b506104bb6110a7366004615097565b6137eb565b3480156110b857600080fd5b50610334546104bb565b3480156110ce57600080fd5b506104bb6102fe5481565b3480156110e557600080fd5b506105b76110f4366004615097565b613809565b60006102fe546102ff5461110d919061573e565b905090565b60006001600160e01b03198216637965db0b60e01b148061114357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060609a805461115890615751565b80601f016020809104026020016040519081016040528092919081815260200182805461118490615751565b80156111d15780601f106111a6576101008083540402835291602001916111d1565b820191906000526020600020905b8154815290600101906020018083116111b457829003601f168201915b5050505050905090565b6000806111e66114c7565b90508015611206576112016111f96110f9565b84908361387f565b611208565b825b9392505050565b60003361121d81858561389e565b5060019392505050565b6000806112326114c7565b9050801561120657611201816112466110f9565b8591906139c2565b336001600160a01b03821614611269576112698133846139f0565b6112748282336139fb565b5050565b60c9546001600160a01b031633146112ab5760405162461bcd60e51b81526004016112a290615785565b60405180910390fd5b6001600160a01b0381166000908152610333602052604090205460ff166112e557604051632df15a4160e11b815260040160405180910390fd5b6001600160a01b03811660008181526103336020526040808220805460ff19169055516370a0823160e01b81529091906370a082319061132990309060040161520b565b602060405180830381865afa158015611346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136a91906157a9565b90506103e881111561138f57604051634ed72d7b60e11b815260040160405180910390fd5b6103345460005b818110156113e05761033481815481106113b2576113b26157c2565b6000918252602090912001546001600160a01b038581169116146113e0576113d9816157d8565b9050611396565b6103346113ee6001846157f1565b815481106113fe576113fe6157c2565b60009182526020909120015461033480546001600160a01b03909216918390811061142b5761142b6157c2565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555061033480548061146b5761146b615804565b600082815260208120820160001990810180546001600160a01b03191690559091019091556040516001600160a01b038616917fd3281a40d50ae838fe77dc627744037b8f0fc6a5711d66119a9b670c5cde41af91a250505050565b600061110d613ac4565b600080516020615c718339815191526114e981613acf565b8160005b818110156115ea576001858583818110611509576115096157c2565b9050608002016020016020810190611521919061582e565b60018111156115325761153261537f565b036115da57848482818110611549576115496157c2565b61155f9260206080909202019081019150615121565b6001600160a01b031663aa2f892d86868481811061157f5761157f6157c2565b905060800201604001356040518263ffffffff1660e01b81526004016115a791815260200190565b600060405180830381600087803b1580156115c157600080fd5b505af11580156115d5573d6000803e3d6000fd5b505050505b6115e3816157d8565b90506114ed565b5050505050565b60c9546001600160a01b0316331461161b5760405162461bcd60e51b81526004016112a290615785565b6103345460641161163f5760405163607ed4ff60e11b815260040160405180910390fd5b6001600160a01b0381166000908152610333602052604090205460ff161561167a576040516325a2934b60e21b815260040160405180910390fd5b6102ca5460408051636f307dc360e01b815290516001600160a01b0392831692841691636f307dc39160048083019260209291908290030181865afa1580156116c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116eb9190615849565b6001600160a01b03161461171257604051632737e48360e11b815260040160405180910390fd5b6000816001600160a01b031663632a44ec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611752573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117769190615866565b60028111156117875761178761537f565b146117a557604051635b5408d760e01b815260040160405180910390fd5b6001600160a01b03811660008181526103336020526040808220805460ff191660019081179091556103348054918201815583527f466f2d8e93a3b91fc5539a0edccb639186c8fb083a35e07e56fd75e49e003c7f0180546001600160a01b03191684179055517f69887873d46778fb35539b0a9992d9176ca03c1820b0afb538bc3a6f63326b109190a250565b60008061183f836123ce565b9050611208816111db565b6000336118588582856139f0565b611863858585613ad9565b506001949350505050565b60009081526065602052604090206001015490565b600061110d6118ae565b6118968261186e565b61189f81613acf565b6118a98383613ae4565b505050565b6102ca546040805163313ce56760e01b815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa1580156118f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110d9190615887565b6001600160a01b038116600090815261023260205260408120805461022f54118015611208575060020154151592915050565b60008060005b61033454811015611a0a5760006103348281548110611977576119776157c2565b6000918252602091829020015460408051630d635a8160e21b815290516001600160a01b039092169350839263358d6a04926004808401938290030181865afa1580156119c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ec91906157a9565b6119f6908461573e565b92505080611a03906157d8565b9050611956565b50806102cb5410611a1b5780611a20565b6102cb545b91505090565b600061110d613b6a565b6001600160a01b0381163314611aa05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016112a2565b6112748282613be7565b60c9546001600160a01b03163314611ad45760405162461bcd60e51b81526004016112a290615785565b610300819055604051818152600080516020615c91833981519152906020015b60405180910390a150565b60003361121d818585611b1283836134bc565b611b1c919061573e565b61389e565b600080516020615cd1833981519152611b3981613acf565b611b41613c4e565b50565b600080611b4f6110f9565b90506102cb548111611b6a57806102cb5461120191906157f1565b60009392505050565b600054610100900460ff16611b9a5760405162461bcd60e51b81526004016112a2906158a4565b611ba48383613c9b565b611bad83613ccc565b6102ca80546001600160a01b039095166001600160a01b0319921515600160a01b02929092166001600160a81b031990951694909417179092555050565b6000611143826111db565b611c1a60405180606001604052806000815260200160008152602001600081525090565b506001600160a01b031660009081526102326020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915290565b600054610100900460ff16611c845760405162461bcd60e51b81526004016112a2906158a4565b805161013180546001600160a01b0319166001600160a01b039092169182179055602082015161012f556040808301516101305551600080516020615cb183398151915290600090a2600080516020615d518339815191528160200151604051611cf091815260200190565b60405180910390a1600080516020615db18339815191528160400151604051611af491815260200190565b600054610100900460ff16611d425760405162461bcd60e51b81526004016112a2906158a4565b805160c980546001600160a01b0319166001600160a01b038316179055604051600080516020615d1183398151915291611d7f91600091906158ef565b60405180910390a18051611d9590600090613ae4565b611db1600080516020615cd18339815191528260000151613ae4565b611dcd600080516020615cd18339815191528260200151613ae4565b611de9600080516020615c718339815191528260000151613ae4565b611e05600080516020615c718339815191528260200151613ae4565b611e21600080516020615c718339815191528260400151613ae4565b611b41600080516020615c71833981519152600080516020615cd1833981519152613d16565b600061110d336134e7565b600080516020615c71833981519152611e6a81613acf565b8160005b818110156115ea576000858583818110611e8a57611e8a6157c2565b905060800201803603810190611ea0919061597c565b60408101519091506000819003611eb85750506121ae565b81516001600160a01b0381166000908152610333602052604090205460ff16611ef457604051632df15a4160e11b815260040160405180910390fd5b611eff826000613d69565b600083602001516001811115611f1757611f1761537f565b036120ae57806001600160a01b0316632745825e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f7e9190615998565b151560010361200557612000816001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fec9190615849565b6102ca546001600160a01b03169084613dc3565b61201d565b6102ca5461201d906001600160a01b03168284613dc3565b6102ca5460608401516040516320e8c56560e01b81523060048201526001600160a01b039283166024820152600060448201526064810191909152908216906320e8c565906084016020604051808303816000875af1158015612084573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a891906157a9565b50612156565b6001836020015160018111156120c6576120c661537f565b03612156576102ca546120e3906001600160a01b03168284613e19565b604051636e553f6560e01b8152600481018390523060248201526001600160a01b03821690636e553f65906044016020604051808303816000875af1158015612130573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215491906157a9565b505b816102fe6000828254612169919061573e565b90915550506040517f46a80100e8cfe18c4729e50ad8704a292622bb8b711d9b6e915a1911f3492064906121a2903390849086906159b5565b60405180910390a15050505b6121b7816157d8565b9050611e6e565b60006121c8613f1c565b6102cb54836121d56110f9565b6121df919061573e565b11156121fe57604051632ec42b2f60e21b815260040160405180910390fd5b612207836136fe565b6102ca54909150600160a01b900460ff16801561222357508234145b15612297576102ca60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561227957600080fd5b505af115801561228d573d6000803e3d6000fd5b50505050506122b0565b6102ca546122b0906001600160a01b0316333086613f77565b6122b86114c7565b6000036122fd57806103e811156122e257604051630131cd7b60e51b815260040160405180910390fd5b6122ee6103e8826157f1565b90506122fd60016103e8613f98565b6123078282613f98565b816001600160a01b0316336001600160a01b0316600080516020615d91833981519152858460405161233a9291906159d9565b60405180910390a361234c8382614053565b611143600161016455565b60c9546001600160a01b031633146123815760405162461bcd60e51b81526004016112a290615785565b6703782dace9d900008111156123aa57604051635b94d8b160e01b815260040160405180910390fd5b61012f819055604051818152600080516020615d5183398151915290602001611af4565b6001600160a01b031660009081526097602052604090205490565b60ca546001600160a01b03163381146124395760405162461bcd60e51b815260206004820152601260248201527127a7262cafa822a72224a723afa7aba722a960711b60448201526064016112a2565b60c980546001600160a01b038381166001600160a01b031983161790925516612463600082613be7565b61247b600080516020615cd183398151915282613be7565b612493600080516020615c7183398151915282613be7565b61249e600083613ae4565b6124b6600080516020615cd183398151915283613ae4565b6124ce600080516020615c7183398151915283613ae4565b600080516020615d1183398151915281836040516124ed9291906158ef565b60405180910390a15050565b60c9546001600160a01b031633146125235760405162461bcd60e51b81526004016112a290615785565b8060005b818110156126e9576000848483818110612543576125436157c2565b905060200281019061255591906159e7565b612563906020810190615121565b90506000858584818110612579576125796157c2565b905060200281019061258b91906159e7565b612599906040810190615a07565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093945050506001600160a01b03841690508787868181106125ec576125ec6157c2565b90506020028101906125fe91906159e7565b60200135836040516126109190615a4d565b60006040518083038185875af1925050503d806000811461264d576040519150601f19603f3d011682016040523d82523d6000602084013e612652565b606091505b505090508061269c5760405162461bcd60e51b8152602060048201526016602482015275195b595c99d95b98de5058dd1a5bdb8819985a5b195960521b60448201526064016112a2565b7fa9f1cb7eee5fc621e043c1ef431febb0f901998a6c0cbdf70147b0fe4d9f5a6a83836040516126cd929190615a5f565b60405180910390a1505050806126e2906157d8565b9050612527565b50505050565b6001600160a01b03811660009081526101ca6020526040812054611143565b600080516020615cd183398151915261272681613acf565b611b416140a0565b600054610100900460ff161580801561274e5750600054600160ff909116105b8061276f575061275d306140de565b15801561276f575060005460ff166001145b6127d25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016112a2565b6000805460ff1916600117905580156127f5576000805461ff0019166101001790555b61280189898989611b73565b61280a83611d1b565b61281382611c5d565b6102cb849055604051848152600080516020615d718339815191529060200160405180910390a1610300859055604051858152600080516020615c918339815191529060200160405180910390a14261022f5580156128ac576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b6128bf613f1c565b6103005461022f546128d190426157f1565b10156128f05760405163fb9b2f2d60e01b815260040160405180910390fd5b60006128fb336123ce565b90508060000361290b5750612aaa565b6000610231546129196114c7565b61292391906157f1565b90506000612933610231546111db565b9050806102ff541115612988576000816102ff5461295191906157f1565b9050600061296082868661387f565b905061296d816000613d69565b6102ca54612985906001600160a01b03163383613dc3565b50505b6103345460005b81811015612a7257600061033482815481106129ad576129ad6157c2565b60009182526020822001546040516370a0823160e01b81526001600160a01b03909116925082906370a08231906129e890309060040161520b565b602060405180830381865afa158015612a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2991906157a9565b90506000612a3888838961387f565b905080600003612a4a57505050612a62565b612a5e6001600160a01b0384163383613dc3565b5050505b612a6b816157d8565b905061298f565b506102fe54612a839085908561387f565b6102fe6000828254612a9591906157f1565b90915550612aa5905033856140ed565b505050505b612ab5600161016455565b565b600080612ac26114c7565b905080156112065761120181612ad661318f565b85919061387f565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000612b13613f1c565b612b1c83612dc0565b90506102cb5481612b2b6110f9565b612b35919061573e565b1115612b5457604051632ec42b2f60e21b815260040160405180910390fd5b6102ca54600160a01b900460ff168015612b6d57508034145b15612be1576102ca60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015612bc357600080fd5b505af1158015612bd7573d6000803e3d6000fd5b5050505050612bfa565b6102ca54612bfa906001600160a01b0316333084613f77565b612c026114c7565b600003612c4757826103e81115612c2c57604051630131cd7b60e51b815260040160405180910390fd5b612c386103e8846157f1565b9250612c4760016103e8613f98565b612c518284613f98565b816001600160a01b0316336001600160a01b0316600080516020615d918339815191528386604051612c849291906159d9565b60405180910390a361234c8184614053565b600080612ca23361421b565b9092509050612cb18282613d69565b612cbb30826140ed565b336001600160a01b0316836001600160a01b0316336001600160a01b0316600080516020615cf18339815191528585604051612cf89291906159d9565b60405180910390a46102ca54612d18906001600160a01b03168484613dc3565b50919050565b6060609b805461115890615751565b60003381612d3b82866134bc565b905083811015612d9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016112a2565b611863828686840361389e565b60003361121d818585613ad9565b611b41813361124e565b600080612dcb6114c7565b9050801561120657611201612dde6110f9565b8490836139c2565b600060405163d623472560e01b815260040160405180910390fd5b600080612e0d836123ce565b90506000612e1a826111db565b90506000612e27836137eb565b9050808211612e365781612e38565b805b95945050505050565b600080516020615c71833981519152612e5981613acf565b8160005b818110156115ea576000858583818110612e7957612e796157c2565b905060800201803603810190612e8f919061597c565b60408101519091506000819003612ea7575050613087565b81516001600160a01b0381166000908152610333602052604090205460ff16612ee357604051632df15a4160e11b815260040160405180910390fd5b60008084602001516001811115612efc57612efc61537f565b03612f93576102ca54606085015160405163f3f094a160e01b8152306004820152602481018690526001600160a01b03928316604482015260648101919091529083169063f3f094a1906084016020604051808303816000875af1158015612f68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8c91906157a9565b9050613017565b600184602001516001811115612fab57612fab61537f565b0361301757816001600160a01b031663be040fb06040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612ff0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301491906157a9565b90505b6102fe54811161303557806102fe5461303091906157f1565b613038565b60005b6102fe55613047816000614053565b7f60e3ebbed9f935b37adbc6b7a8ad559873ced28247296a76a4d3b81a9e5eb19a33838360405161307a939291906159b5565b60405180910390a1505050505b613090816157d8565b9050612e5d565b60006130a283612c96565b949350505050565b600061110d33612c96565b60606103348054806020026020016040519081016040528092919081815260200182805480156111d157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116130f0575050505050905090565b6000611143610e4b6000611b44565b6000806131316114c7565b905080156112065761120181612ad66110f9565b600080516020615c7183398151915261315d81613acf565b6102cb829055604051828152600080516020615d71833981519152906020016124ed565b600061114361053b836123ce565b61033454600090815b8181101561325157600061033482815481106131b6576131b66157c2565b600091825260209091200154604051633e64257560e01b81526001600160a01b0390911691508190633e642575906131f290309060040161520b565b602060405180830381865afa15801561320f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061323391906157a9565b61323d908561573e565b9350508061324a906157d8565b9050613198565b506102ca546040516370a0823160e01b81526001600160a01b03909116906370a082319061328390309060040161520b565b602060405180830381865afa1580156132a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132c491906157a9565b611a20908361573e565b6000806102ff54905060006132e5610231546111db565b90508082116132f55760006132ff565b6132ff81836157f1565b9250505090565b834211156133565760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016112a2565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886133858c6142ca565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006133e0826142f1565b905060006133f08287878761433f565b9050896001600160a01b0316816001600160a01b0316146134535760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016112a2565b61345e8a8a8a61389e565b50505050505050505050565b6134738261186e565b61347c81613acf565b6118a98383613be7565b610334818154811061349757600080fd5b6000918252602090912001546001600160a01b0316905081565b6000611143826123ce565b6001600160a01b03918216600090815260986020908152604080832093909416825291909152205490565b6102ca54600090600160a01b900460ff1661351557604051636b99faa760e01b815260040160405180910390fd5b60006135203361421b565b909250905061352f8282613d69565b61353930826140ed565b336001600160a01b0316836001600160a01b0316336001600160a01b0316600080516020615cf183398151915285856040516135769291906159d9565b60405180910390a46102ca54604051632e1a7d4d60e01b8152600481018490526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156135c557600080fd5b505af11580156135d9573d6000803e3d6000fd5b50505050612d188383614367565b600080516020615c718339815191526135ff81613acf565b60006136096143b8565b905060006102ff548261361c919061573e565b9050613629858286614481565b6115ea826144c6565b336000908152610232602052604081206001810154600282015483613656836111db565b90508181101561366b57600094505050505090565b613689670de0b6b3a76400008361368281856157f1565b919061387f565b94505050505090565b3360009081526102326020526040902061022f548154116136c65760405163172245f360e01b815260040160405180910390fd5b600181018054600060028401819055918290556102308054919283926136ed9084906157f1565b909155506112749050303383613ad9565b600061114382613126565b60c9546001600160a01b031633146137335760405162461bcd60e51b81526004016112a290615785565b61013180546001600160a01b0319166001600160a01b038316908117909155604051600080516020615cb183398151915290600090a250565b60c9546001600160a01b031633146137965760405162461bcd60e51b81526004016112a290615785565b60ca80546001600160a01b0319166001600160a01b038381169190911790915560c9546040517fb150023a879fd806e3599b6ca8ee3b60f0e360ab3846d128d67ebce1a391639a92611af492169084906158ef565b6000806137f66114c7565b90508015611206576112016111f961318f565b60c9546001600160a01b031633146138335760405162461bcd60e51b81526004016112a290615785565b66b1a2bc2ec5000081111561385b57604051635b94d8b160e01b815260040160405180910390fd5b610130819055604051818152600080516020615db183398151915290602001611af4565b82820281151584158583048514171661389757600080fd5b0492915050565b6001600160a01b0383166139005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016112a2565b6001600160a01b0382166139615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016112a2565b6001600160a01b0383811660008181526098602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b8282028115158415858304851417166139da57600080fd5b6001826001830304018115150290509392505050565b6118a98383836146a4565b613a06823085613ad9565b6001600160a01b03811660009081526102326020526040812042815560018101805491928692613a3790849061573e565b9091555060009050613a48856111db565b905080826002016000828254613a5e919061573e565b92505081905550846102306000828254613a78919061573e565b90915550506040518581526001600160a01b0385169033907ff601bbafcf0d793cce0a8802057c8783aa5946889f76bd9dd47492217f59af1e9060200160405180910390a35050505050565b600061110d60995490565b611b418133614718565b6118a9838383614771565b613aee8282612ade565b6112745760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613b263390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061110d7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613b9a6101965490565b610197546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b613bf18282612ade565b156112745760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b613c56614915565b6101fd805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051613c91919061520b565b60405180910390a1565b600054610100900460ff16613cc25760405162461bcd60e51b81526004016112a2906158a4565b611274828261495f565b600054610100900460ff16613cf35760405162461bcd60e51b81526004016112a2906158a4565b611b4181604051806040016040528060018152602001603160f81b81525061499f565b6000613d218361186e565b600084815260656020526040808220600101859055519192508391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000613d77610231546111db565b9050613d83818461573e565b6102ff541015613da65760405163078cc1fb60e01b815260040160405180910390fd5b826102ff6000828254613db991906157f1565b9091555050505050565b6118a98363a9059cbb60e01b8484604051602401613de2929190615a83565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526149e2565b801580613e925750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e90613e4f90309086906004016158ef565b602060405180830381865afa158015613e6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e9091906157a9565b155b613efd5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016112a2565b6118a98363095ea7b360e01b8484604051602401613de2929190615a83565b60026101645403613f6f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016112a2565b600261016455565b6126e9846323b872dd60e01b858585604051602401613de2939291906159b5565b6001600160a01b038216613fee5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016112a2565b613ffa60008383614ab4565b806099600082825461400c919061573e565b90915550506001600160a01b038216600081815260976020908152604080832080548601905551848152600080516020615d31833981519152910160405180910390a35050565b6103005461022f5461406590426157f1565b11156140845760405163188decd360e31b815260040160405180910390fd5b816102ff6000828254614097919061573e565b90915550505050565b6140a8614ab8565b6101fd805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613c843390565b6001600160a01b03163b151590565b6001600160a01b03821661414d5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016112a2565b61415982600083614ab4565b6001600160a01b038216600090815260976020526040902054818110156141cd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016112a2565b6001600160a01b0383166000818152609760209081526040808320868603905560998054879003905551858152919291600080516020615d31833981519152910160405180910390a3505050565b6001600160a01b0381166000908152610232602052604081206002810154829190820361425b57604051631f2a200560e01b815260040160405180910390fd5b61022f5481541061427f57604051634a44555360e11b815260040160405180910390fd5b600181015460028201549092506142968382614aff565b93508261023160008282546142ab91906157f1565b9091555050600060028301819055600190920191909155509092909150565b6001600160a01b03811660009081526101ca60205260409020805460018101825590612d18565b60006111436142fe613b6a565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061435087878787614b1a565b9150915061435d81614bd4565b5095945050505050565b600080600080600085875af19050806118a95760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b60448201526064016112a2565b61033454600090815b8181101561447c57600061033482815481106143df576143df6157c2565b600091825260209091200154604051631132ffbf60e11b81526001600160a01b0390911691508190632265ff7e9061441b90309060040161520b565b6020604051808303816000875af115801561443a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061445e91906157a9565b614468908561573e565b93505080614475906157d8565b90506143c1565b505090565b60008284116144995761449484846157f1565b6144a3565b6144a383856157f1565b9050818111156126e957604051638199f5f360e01b815260040160405180910390fd5b60006102ff54826144d7919061573e565b905060006144e36114c7565b9050801561452557610230546000906144fd90848461387f565b9050806102ff5410156145235760405163078cc1fb60e01b815260040160405180910390fd5b505b60006102fe548411614538576000614546565b6102fe5461454690856157f1565b6102fe8590559050426000821561457e57670de0b6b3a764000061012f548461456f9190615a9c565b6145799190615abb565b614581565b60005b90506000610130546000146145df576301e13380670de0b6b3a764000061022f54856145ad91906157f1565b88610130546145bc9190615a9c565b6145c69190615a9c565b6145d09190615abb565b6145da9190615abb565b6145e2565b60005b905060006145f0828461573e565b90506000808211801561460257508188115b156146375761461d87614615848b6157f1565b84919061387f565b61013154909150614637906001600160a01b031682613f98565b61013154604080518881526020810187905290810185905260608101839052608081018a90526001600160a01b03909116907feaedd1267621f4a8ee97011faf0e67800ad3063714bd179f078c980bb9a3fa3d9060a00160405180910390a261022f8590556128ac614d19565b60006146b084846134bc565b905060001981146126e9578181101561470b5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016112a2565b6126e9848484840361389e565b6147228282612ade565b6112745761472f81614d3c565b61473a836020614d4e565b60405160200161474b929190615add565b60408051601f198184030181529082905262461bcd60e51b82526112a291600401615084565b6001600160a01b0383166147d55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016112a2565b6001600160a01b0382166148375760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016112a2565b614842838383614ab4565b6001600160a01b038316600090815260976020526040902054818110156148ba5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016112a2565b6001600160a01b038085166000818152609760205260408082208686039055928616808252908390208054860190559151600080516020615d31833981519152906149089086815260200190565b60405180910390a36126e9565b6101fd5460ff16612ab55760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016112a2565b600054610100900460ff166149865760405162461bcd60e51b81526004016112a2906158a4565b609a6149928382615b9a565b50609b6118a98282615b9a565b600054610100900460ff166149c65760405162461bcd60e51b81526004016112a2906158a4565b8151602092830120815191909201206101969190915561019755565b6000614a37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614ee99092919063ffffffff16565b8051909150156118a95780806020019051810190614a559190615998565b6118a95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016112a2565b6118a95b6101fd5460ff1615612ab55760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016112a2565b600080614b0b846111db565b905082811061120857826130a2565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115614b475750600090506003614bcb565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614b9b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116614bc457600060019250925050614bcb565b9150600090505b94509492505050565b6000816004811115614be857614be861537f565b03614bf05750565b6001816004811115614c0457614c0461537f565b03614c4c5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016112a2565b6002816004811115614c6057614c6061537f565b03614cad5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016112a2565b6003816004811115614cc157614cc161537f565b03611b415760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016112a2565b610230546102316000828254614d2f919061573e565b9091555050600061023055565b60606111436001600160a01b03831660145b60606000614d5d836002615a9c565b614d6890600261573e565b6001600160401b03811115614d7f57614d7f61521f565b6040519080825280601f01601f191660200182016040528015614da9576020820181803683370190505b509050600360fc1b81600081518110614dc457614dc46157c2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614df357614df36157c2565b60200101906001600160f81b031916908160001a9053506000614e17846002615a9c565b614e2290600161573e565b90505b6001811115614e9a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614e5657614e566157c2565b1a60f81b828281518110614e6c57614e6c6157c2565b60200101906001600160f81b031916908160001a90535060049490941c93614e9381615c59565b9050614e25565b5083156112085760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016112a2565b60606130a2848460008585600080866001600160a01b03168587604051614f109190615a4d565b60006040518083038185875af1925050503d8060008114614f4d576040519150601f19603f3d011682016040523d82523d6000602084013e614f52565b606091505b5091509150614f6387838387614f6e565b979650505050505050565b60608315614fdb578251600003614fd457614f88856140de565b614fd45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016112a2565b50816130a2565b6130a28383815115614ff05781518083602001fd5b8060405162461bcd60e51b81526004016112a29190615084565b60006020828403121561501c57600080fd5b81356001600160e01b03198116811461120857600080fd5b60005b8381101561504f578181015183820152602001615037565b50506000910152565b60008151808452615070816020860160208601615034565b601f01601f19169290920160200192915050565b6020815260006112086020830184615058565b6000602082840312156150a957600080fd5b5035919050565b6001600160a01b0381168114611b4157600080fd5b600080604083850312156150d857600080fd5b82356150e3816150b0565b946020939093013593505050565b6000806040838503121561510457600080fd5b823591506020830135615116816150b0565b809150509250929050565b60006020828403121561513357600080fd5b8135611208816150b0565b60008083601f84011261515057600080fd5b5081356001600160401b0381111561516757600080fd5b6020830191508360208260071b850101111561518257600080fd5b9250929050565b6000806020838503121561519c57600080fd5b82356001600160401b038111156151b257600080fd5b6151be8582860161513e565b90969095509350505050565b6000806000606084860312156151df57600080fd5b83356151ea816150b0565b925060208401356151fa816150b0565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b03811182821017156152575761525761521f565b60405290565b600082601f83011261526e57600080fd5b81356001600160401b03808211156152885761528861521f565b604051601f8301601f19908116603f011681019082821181831017156152b0576152b061521f565b816040528381528660208588010111156152c957600080fd5b836020870160208301376000602085830101528094505050505092915050565b8015158114611b4157600080fd5b6000806000806080858703121561530d57600080fd5b8435615318816150b0565b935060208501356001600160401b038082111561533457600080fd5b6153408883890161525d565b9450604087013591508082111561535657600080fd5b506153638782880161525d565b9250506060850135615374816152e9565b939692955090935050565b634e487b7160e01b600052602160045260246000fd5b60208101600283106153a9576153a961537f565b91905290565b6000606082840312156153c157600080fd5b6153c9615235565b905081356153d6816150b0565b80825250602082013560208201526040820135604082015292915050565b60006060828403121561540657600080fd5b61120883836153af565b60208101600383106153a9576153a961537f565b60006060828403121561543657600080fd5b61543e615235565b9050813561544b816150b0565b8152602082013561545b816150b0565b6020820152604082013561546e816150b0565b604082015292915050565b60006060828403121561548b57600080fd5b6112088383615424565b600080602083850312156154a857600080fd5b82356001600160401b03808211156154bf57600080fd5b818501915085601f8301126154d357600080fd5b8135818111156154e257600080fd5b8660208260051b85010111156154f757600080fd5b60209290920196919550909350505050565b600080600080600080600080610180898b03121561552657600080fd5b8835615531816150b0565b975060208901356001600160401b038082111561554d57600080fd5b6155598c838d0161525d565b985060408b013591508082111561556f57600080fd5b5061557c8b828c0161525d565b965050606089013561558d816152e9565b94506080890135935060a089013592506155aa8a60c08b01615424565b91506155ba8a6101208b016153af565b90509295985092959890939650565b6000806000606084860312156155de57600080fd5b8335925060208401356155f0816150b0565b91506040840135615600816150b0565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561564c5783516001600160a01b031683529284019291840191600101615627565b50909695505050505050565b60ff81168114611b4157600080fd5b600080600080600080600060e0888a03121561568257600080fd5b873561568d816150b0565b9650602088013561569d816150b0565b9550604088013594506060880135935060808801356156bb81615658565b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156156eb57600080fd5b82356156f6816150b0565b91506020830135615116816150b0565b6000806040838503121561571957600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b8082018082111561114357611143615728565b600181811c9082168061576557607f821691505b602082108103612d1857634e487b7160e01b600052602260045260246000fd5b6020808252600a908201526927a7262cafa7aba722a960b11b604082015260600190565b6000602082840312156157bb57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016157ea576157ea615728565b5060010190565b8181038181111561114357611143615728565b634e487b7160e01b600052603160045260246000fd5b80356002811061582957600080fd5b919050565b60006020828403121561584057600080fd5b6112088261581a565b60006020828403121561585b57600080fd5b8151611208816150b0565b60006020828403121561587857600080fd5b81516003811061120857600080fd5b60006020828403121561589957600080fd5b815161120881615658565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160a01b0392831681529116602082015260400190565b60006080828403121561591b57600080fd5b604051608081016001600160401b038111828210171561593d5761593d61521f565b604052905080823561594e816150b0565b815261595c6020840161581a565b602082015260408301356040820152606083013560608201525092915050565b60006080828403121561598e57600080fd5b6112088383615909565b6000602082840312156159aa57600080fd5b8151611208816152e9565b6001600160a01b039384168152919092166020820152604081019190915260600190565b918252602082015260400190565b60008235605e198336030181126159fd57600080fd5b9190910192915050565b6000808335601e19843603018112615a1e57600080fd5b8301803591506001600160401b03821115615a3857600080fd5b60200191503681900382131561518257600080fd5b600082516159fd818460208701615034565b6001600160a01b03831681526040602082018190526000906130a290830184615058565b6001600160a01b03929092168252602082015260400190565b6000816000190483118215151615615ab657615ab6615728565b500290565b600082615ad857634e487b7160e01b600052601260045260246000fd5b500490565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615b0f816017850160208801615034565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615b40816028840160208801615034565b01602801949350505050565b601f8211156118a957600081815260208120601f850160051c81016020861015615b735750805b601f850160051c820191505b81811015615b9257828155600101615b7f565b505050505050565b81516001600160401b03811115615bb357615bb361521f565b615bc781615bc18454615751565b84615b4c565b602080601f831160018114615bfc5760008415615be45750858301515b600019600386901b1c1916600185901b178555615b92565b600085815260208120601f198616915b82811015615c2b57888601518255948401946001909101908401615c0c565b5085821015615c495787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600081615c6857615c68615728565b50600019019056feaf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02cdf2ad103954d2bfcb52f25b4af68ddd72081b5be619efefde09b087202f05901cb7ef3e545f5cdb893f5c568ba710fe08f336375a2d9fd66e161033f8fc09ef38b5b16d04624687fcf0d0228f19993c9157c1ed07b41d8d430fd9100eb099fe8fbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8b940a95968ad5b511f89b01075446a4fe9f614f2dc5fbb9e9a6b227d6d4fd707f3922ae986170d8fafba84aef002be412156213e5390345e45b51ddb8ab7e15dcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7d87632b1c6ebfa21acbca0e3279b3cf6385a377cb8fda51e5b866baa6e6012aba26469706673582212209a0d7637ba9ff5112e335f8b2f3fb1d2641727c9c227fbf7ededd473e8eb268964736f6c63430008100033

Deployed Bytecode

0x60806040526004361061049a5760003560e01c806301e1d114146104a657806301ffc9a7146104ce57806306fdde03146104fe57806307a2d13a14610520578063095ea7b3146105405780630a28a477146105605780630a605c6d14610580578063107703ab1461059757806314dc0ce0146105b9578063175188e8146105d057806318160ddd146105f05780631b2df850146106055780631b635c2d1461062757806321b77d6314610647578063223e54791461065d5780632257a7381461067d5780632265ff7e1461069457806323b872dd146106b4578063248a9ca3146106d457806325a760c2146106f45780632f2ff15d1461071b578063313ce5671461073b5780633230b79b14610750578063358d6a04146107705780633644e5151461078557806336568abe1461079a57806338d52e0f146107ba57806338d7aae1146107e857806339509351146108085780633e642575146106945780633f4ba83a14610828578063402d267d1461083d57806345ca4b851461085d5780634ac032be1461087d5780634cdad5061461089f57806351a72964146108bf57806354fd4d50146109015780635b9d2658146109185780635c975abb14610970578063607fe86e1461098957806361d027b3146109a9578063632a44ec146109ca5780636364a785146109ec5780636905ef5b14610a0c5780636a28006a14610a2e5780636c6aebac14610a435780636e553f6514610a635780636f307dc314610a7657806370897b2314610a9557806370a0823114610ab5578063724c184c14610ad557806379ba509714610af75780637df3927e14610b0c5780637ecebe0014610b1f5780638456cb5914610b3f578063856345bf14610b545780638576829e14610b745780638778878214610b8b5780638954b3e014610ba25780638c87101914610bb75780638da5cb5b14610bd757806391d1485414610bf757806394bf804d14610c1757806395a2251f14610c2a57806395d89b4114610c4a5780639908840c14610c5f5780639a1815be14610c7a578063a217fddf14610c91578063a457c2d714610ca6578063a6f7f5d614610cc6578063a9059cbb14610cdd578063aa2f892d14610cfd578063b3d7f6b914610d1d578063b460af9414610d3d578063b5ca770414610d5d578063b700a50414610d7d578063ba08765214610d9d578063bdca916514610dbd578063be040fb014610dd9578063c3b2886414610dee578063c63d75b614610e10578063c6e6f59214610e30578063cb50087f14610e50578063ce96cb7714610e70578063d075dd4214610e90578063d4355bcc14610ea5578063d505accf14610eba578063d547741f14610eda578063d7b9991c14610efa578063d905777e14610f1a578063dd62ed3e14610f3a578063de68eca314610f5a578063e30c397814610f7a578063e3f62d5d14610f9a578063e4a4b7b114610fcb578063e56e56db14610feb578063e6a2966614611000578063ef8b30f714611015578063f0f4426014611035578063f299ab3f14611055578063f2fde38b1461106c578063f3e738751461108c578063f96d7b80146110ac578063fc6b1ebe146110c2578063fe56e232146110d957600080fd5b366104a157005b600080fd5b3480156104b257600080fd5b506104bb6110f9565b6040519081526020015b60405180910390f35b3480156104da57600080fd5b506104ee6104e936600461500a565b611112565b60405190151581526020016104c5565b34801561050a57600080fd5b50610513611149565b6040516104c59190615084565b34801561052c57600080fd5b506104bb61053b366004615097565b6111db565b34801561054c57600080fd5b506104ee61055b3660046150c5565b61120f565b34801561056c57600080fd5b506104bb61057b366004615097565b611227565b34801561058c57600080fd5b506104bb6102315481565b3480156105a357600080fd5b506105b76105b23660046150f1565b61124e565b005b3480156105c557600080fd5b506104bb6103005481565b3480156105dc57600080fd5b506105b76105eb366004615121565b611278565b3480156105fc57600080fd5b506104bb6114c7565b34801561061157600080fd5b506104bb600080516020615c7183398151915281565b34801561063357600080fd5b506105b7610642366004615189565b6114d1565b34801561065357600080fd5b506104bb6103e881565b34801561066957600080fd5b506105b7610678366004615121565b6115f1565b34801561068957600080fd5b506104bb61022f5481565b3480156106a057600080fd5b506104bb6106af366004615121565b611833565b3480156106c057600080fd5b506104ee6106cf3660046151ca565b61184a565b3480156106e057600080fd5b506104bb6106ef366004615097565b61186e565b34801561070057600080fd5b50610709611883565b60405160ff90911681526020016104c5565b34801561072757600080fd5b506105b76107363660046150f1565b61188d565b34801561074757600080fd5b506107096118ae565b34801561075c57600080fd5b506104ee61076b366004615121565b61191d565b34801561077c57600080fd5b506104bb611950565b34801561079157600080fd5b506104bb611a26565b3480156107a657600080fd5b506105b76107b53660046150f1565b611a30565b3480156107c657600080fd5b506102ca546107db906001600160a01b031681565b6040516104c5919061520b565b3480156107f457600080fd5b506105b7610803366004615097565b611aaa565b34801561081457600080fd5b506104ee6108233660046150c5565b611aff565b34801561083457600080fd5b506105b7611b21565b34801561084957600080fd5b506104bb610858366004615121565b611b44565b34801561086957600080fd5b506105b76108783660046152f7565b611b73565b34801561088957600080fd5b50610892600181565b6040516104c59190615395565b3480156108ab57600080fd5b506104bb6108ba366004615097565b611beb565b3480156108cb57600080fd5b506108df6108da366004615121565b611bf6565b60408051825181526020808401519082015291810151908201526060016104c5565b34801561090d57600080fd5b506104bb6102c95481565b34801561092457600080fd5b50610955610933366004615121565b6102326020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016104c5565b34801561097c57600080fd5b506101fd5460ff166104ee565b34801561099557600080fd5b506105b76109a43660046153f4565b611c5d565b3480156109b557600080fd5b50610131546107db906001600160a01b031681565b3480156109d657600080fd5b506109df600081565b6040516104c59190615410565b3480156109f857600080fd5b506105b7610a07366004615479565b611d1b565b348015610a1857600080fd5b506102ca546104ee90600160a01b900460ff1681565b348015610a3a57600080fd5b506104bb611e47565b348015610a4f57600080fd5b506105b7610a5e366004615189565b611e52565b6104bb610a713660046150f1565b6121be565b348015610a8257600080fd5b506102ca546001600160a01b03166107db565b348015610aa157600080fd5b506105b7610ab0366004615097565b612357565b348015610ac157600080fd5b506104bb610ad0366004615121565b6123ce565b348015610ae157600080fd5b506104bb600080516020615cd183398151915281565b348015610b0357600080fd5b506105b76123e9565b6105b7610b1a366004615495565b6124f9565b348015610b2b57600080fd5b506104bb610b3a366004615121565b6126ef565b348015610b4b57600080fd5b506105b761270e565b348015610b6057600080fd5b506105b7610b6f366004615509565b61272e565b348015610b8057600080fd5b506104bb6102ff5481565b348015610b9757600080fd5b506104bb61012f5481565b348015610bae57600080fd5b506105b76128b7565b348015610bc357600080fd5b506104bb610bd2366004615097565b612ab7565b348015610be357600080fd5b5060c9546107db906001600160a01b031681565b348015610c0357600080fd5b506104ee610c123660046150f1565b612ade565b6104bb610c253660046150f1565b612b09565b348015610c3657600080fd5b506104bb610c45366004615121565b612c96565b348015610c5657600080fd5b50610513612d1e565b348015610c6b57600080fd5b506104bb66b1a2bc2ec5000081565b348015610c8657600080fd5b506104bb6102cb5481565b348015610c9d57600080fd5b506104bb600081565b348015610cb257600080fd5b506104ee610cc13660046150c5565b612d2d565b348015610cd257600080fd5b506104bb6101305481565b348015610ce957600080fd5b506104ee610cf83660046150c5565b612da8565b348015610d0957600080fd5b506105b7610d18366004615097565b612db6565b348015610d2957600080fd5b506104bb610d38366004615097565b612dc0565b348015610d4957600080fd5b506104bb610d583660046155c9565b612de6565b348015610d6957600080fd5b506104bb610d78366004615121565b612e01565b348015610d8957600080fd5b506105b7610d98366004615189565b612e41565b348015610da957600080fd5b506104bb610db83660046155c9565b613097565b348015610dc957600080fd5b506104bb6703782dace9d9000081565b348015610de557600080fd5b506104bb6130aa565b348015610dfa57600080fd5b50610e036130b5565b6040516104c5919061560b565b348015610e1c57600080fd5b506104bb610e2b366004615121565b613117565b348015610e3c57600080fd5b506104bb610e4b366004615097565b613126565b348015610e5c57600080fd5b506105b7610e6b366004615097565b613145565b348015610e7c57600080fd5b506104bb610e8b366004615121565b613181565b348015610e9c57600080fd5b506104bb61318f565b348015610eb157600080fd5b506104bb6132ce565b348015610ec657600080fd5b506105b7610ed5366004615667565b613306565b348015610ee657600080fd5b506105b7610ef53660046150f1565b61346a565b348015610f0657600080fd5b506107db610f15366004615097565b613486565b348015610f2657600080fd5b506104bb610f35366004615121565b6134b1565b348015610f4657600080fd5b506104bb610f553660046156d8565b6134bc565b348015610f6657600080fd5b506104bb610f75366004615121565b6134e7565b348015610f8657600080fd5b5060ca546107db906001600160a01b031681565b348015610fa657600080fd5b506104ee610fb5366004615121565b6103336020526000908152604090205460ff1681565b348015610fd757600080fd5b506105b7610fe6366004615706565b6135e7565b348015610ff757600080fd5b506104bb613632565b34801561100c57600080fd5b506105b7613692565b34801561102157600080fd5b506104bb611030366004615097565b6136fe565b34801561104157600080fd5b506105b7611050366004615121565b613709565b34801561106157600080fd5b506104bb6102305481565b34801561107857600080fd5b506105b7611087366004615121565b61376c565b34801561109857600080fd5b506104bb6110a7366004615097565b6137eb565b3480156110b857600080fd5b50610334546104bb565b3480156110ce57600080fd5b506104bb6102fe5481565b3480156110e557600080fd5b506105b76110f4366004615097565b613809565b60006102fe546102ff5461110d919061573e565b905090565b60006001600160e01b03198216637965db0b60e01b148061114357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060609a805461115890615751565b80601f016020809104026020016040519081016040528092919081815260200182805461118490615751565b80156111d15780601f106111a6576101008083540402835291602001916111d1565b820191906000526020600020905b8154815290600101906020018083116111b457829003601f168201915b5050505050905090565b6000806111e66114c7565b90508015611206576112016111f96110f9565b84908361387f565b611208565b825b9392505050565b60003361121d81858561389e565b5060019392505050565b6000806112326114c7565b9050801561120657611201816112466110f9565b8591906139c2565b336001600160a01b03821614611269576112698133846139f0565b6112748282336139fb565b5050565b60c9546001600160a01b031633146112ab5760405162461bcd60e51b81526004016112a290615785565b60405180910390fd5b6001600160a01b0381166000908152610333602052604090205460ff166112e557604051632df15a4160e11b815260040160405180910390fd5b6001600160a01b03811660008181526103336020526040808220805460ff19169055516370a0823160e01b81529091906370a082319061132990309060040161520b565b602060405180830381865afa158015611346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136a91906157a9565b90506103e881111561138f57604051634ed72d7b60e11b815260040160405180910390fd5b6103345460005b818110156113e05761033481815481106113b2576113b26157c2565b6000918252602090912001546001600160a01b038581169116146113e0576113d9816157d8565b9050611396565b6103346113ee6001846157f1565b815481106113fe576113fe6157c2565b60009182526020909120015461033480546001600160a01b03909216918390811061142b5761142b6157c2565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555061033480548061146b5761146b615804565b600082815260208120820160001990810180546001600160a01b03191690559091019091556040516001600160a01b038616917fd3281a40d50ae838fe77dc627744037b8f0fc6a5711d66119a9b670c5cde41af91a250505050565b600061110d613ac4565b600080516020615c718339815191526114e981613acf565b8160005b818110156115ea576001858583818110611509576115096157c2565b9050608002016020016020810190611521919061582e565b60018111156115325761153261537f565b036115da57848482818110611549576115496157c2565b61155f9260206080909202019081019150615121565b6001600160a01b031663aa2f892d86868481811061157f5761157f6157c2565b905060800201604001356040518263ffffffff1660e01b81526004016115a791815260200190565b600060405180830381600087803b1580156115c157600080fd5b505af11580156115d5573d6000803e3d6000fd5b505050505b6115e3816157d8565b90506114ed565b5050505050565b60c9546001600160a01b0316331461161b5760405162461bcd60e51b81526004016112a290615785565b6103345460641161163f5760405163607ed4ff60e11b815260040160405180910390fd5b6001600160a01b0381166000908152610333602052604090205460ff161561167a576040516325a2934b60e21b815260040160405180910390fd5b6102ca5460408051636f307dc360e01b815290516001600160a01b0392831692841691636f307dc39160048083019260209291908290030181865afa1580156116c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116eb9190615849565b6001600160a01b03161461171257604051632737e48360e11b815260040160405180910390fd5b6000816001600160a01b031663632a44ec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611752573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117769190615866565b60028111156117875761178761537f565b146117a557604051635b5408d760e01b815260040160405180910390fd5b6001600160a01b03811660008181526103336020526040808220805460ff191660019081179091556103348054918201815583527f466f2d8e93a3b91fc5539a0edccb639186c8fb083a35e07e56fd75e49e003c7f0180546001600160a01b03191684179055517f69887873d46778fb35539b0a9992d9176ca03c1820b0afb538bc3a6f63326b109190a250565b60008061183f836123ce565b9050611208816111db565b6000336118588582856139f0565b611863858585613ad9565b506001949350505050565b60009081526065602052604090206001015490565b600061110d6118ae565b6118968261186e565b61189f81613acf565b6118a98383613ae4565b505050565b6102ca546040805163313ce56760e01b815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa1580156118f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110d9190615887565b6001600160a01b038116600090815261023260205260408120805461022f54118015611208575060020154151592915050565b60008060005b61033454811015611a0a5760006103348281548110611977576119776157c2565b6000918252602091829020015460408051630d635a8160e21b815290516001600160a01b039092169350839263358d6a04926004808401938290030181865afa1580156119c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ec91906157a9565b6119f6908461573e565b92505080611a03906157d8565b9050611956565b50806102cb5410611a1b5780611a20565b6102cb545b91505090565b600061110d613b6a565b6001600160a01b0381163314611aa05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016112a2565b6112748282613be7565b60c9546001600160a01b03163314611ad45760405162461bcd60e51b81526004016112a290615785565b610300819055604051818152600080516020615c91833981519152906020015b60405180910390a150565b60003361121d818585611b1283836134bc565b611b1c919061573e565b61389e565b600080516020615cd1833981519152611b3981613acf565b611b41613c4e565b50565b600080611b4f6110f9565b90506102cb548111611b6a57806102cb5461120191906157f1565b60009392505050565b600054610100900460ff16611b9a5760405162461bcd60e51b81526004016112a2906158a4565b611ba48383613c9b565b611bad83613ccc565b6102ca80546001600160a01b039095166001600160a01b0319921515600160a01b02929092166001600160a81b031990951694909417179092555050565b6000611143826111db565b611c1a60405180606001604052806000815260200160008152602001600081525090565b506001600160a01b031660009081526102326020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915290565b600054610100900460ff16611c845760405162461bcd60e51b81526004016112a2906158a4565b805161013180546001600160a01b0319166001600160a01b039092169182179055602082015161012f556040808301516101305551600080516020615cb183398151915290600090a2600080516020615d518339815191528160200151604051611cf091815260200190565b60405180910390a1600080516020615db18339815191528160400151604051611af491815260200190565b600054610100900460ff16611d425760405162461bcd60e51b81526004016112a2906158a4565b805160c980546001600160a01b0319166001600160a01b038316179055604051600080516020615d1183398151915291611d7f91600091906158ef565b60405180910390a18051611d9590600090613ae4565b611db1600080516020615cd18339815191528260000151613ae4565b611dcd600080516020615cd18339815191528260200151613ae4565b611de9600080516020615c718339815191528260000151613ae4565b611e05600080516020615c718339815191528260200151613ae4565b611e21600080516020615c718339815191528260400151613ae4565b611b41600080516020615c71833981519152600080516020615cd1833981519152613d16565b600061110d336134e7565b600080516020615c71833981519152611e6a81613acf565b8160005b818110156115ea576000858583818110611e8a57611e8a6157c2565b905060800201803603810190611ea0919061597c565b60408101519091506000819003611eb85750506121ae565b81516001600160a01b0381166000908152610333602052604090205460ff16611ef457604051632df15a4160e11b815260040160405180910390fd5b611eff826000613d69565b600083602001516001811115611f1757611f1761537f565b036120ae57806001600160a01b0316632745825e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f7e9190615998565b151560010361200557612000816001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fec9190615849565b6102ca546001600160a01b03169084613dc3565b61201d565b6102ca5461201d906001600160a01b03168284613dc3565b6102ca5460608401516040516320e8c56560e01b81523060048201526001600160a01b039283166024820152600060448201526064810191909152908216906320e8c565906084016020604051808303816000875af1158015612084573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a891906157a9565b50612156565b6001836020015160018111156120c6576120c661537f565b03612156576102ca546120e3906001600160a01b03168284613e19565b604051636e553f6560e01b8152600481018390523060248201526001600160a01b03821690636e553f65906044016020604051808303816000875af1158015612130573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215491906157a9565b505b816102fe6000828254612169919061573e565b90915550506040517f46a80100e8cfe18c4729e50ad8704a292622bb8b711d9b6e915a1911f3492064906121a2903390849086906159b5565b60405180910390a15050505b6121b7816157d8565b9050611e6e565b60006121c8613f1c565b6102cb54836121d56110f9565b6121df919061573e565b11156121fe57604051632ec42b2f60e21b815260040160405180910390fd5b612207836136fe565b6102ca54909150600160a01b900460ff16801561222357508234145b15612297576102ca60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561227957600080fd5b505af115801561228d573d6000803e3d6000fd5b50505050506122b0565b6102ca546122b0906001600160a01b0316333086613f77565b6122b86114c7565b6000036122fd57806103e811156122e257604051630131cd7b60e51b815260040160405180910390fd5b6122ee6103e8826157f1565b90506122fd60016103e8613f98565b6123078282613f98565b816001600160a01b0316336001600160a01b0316600080516020615d91833981519152858460405161233a9291906159d9565b60405180910390a361234c8382614053565b611143600161016455565b60c9546001600160a01b031633146123815760405162461bcd60e51b81526004016112a290615785565b6703782dace9d900008111156123aa57604051635b94d8b160e01b815260040160405180910390fd5b61012f819055604051818152600080516020615d5183398151915290602001611af4565b6001600160a01b031660009081526097602052604090205490565b60ca546001600160a01b03163381146124395760405162461bcd60e51b815260206004820152601260248201527127a7262cafa822a72224a723afa7aba722a960711b60448201526064016112a2565b60c980546001600160a01b038381166001600160a01b031983161790925516612463600082613be7565b61247b600080516020615cd183398151915282613be7565b612493600080516020615c7183398151915282613be7565b61249e600083613ae4565b6124b6600080516020615cd183398151915283613ae4565b6124ce600080516020615c7183398151915283613ae4565b600080516020615d1183398151915281836040516124ed9291906158ef565b60405180910390a15050565b60c9546001600160a01b031633146125235760405162461bcd60e51b81526004016112a290615785565b8060005b818110156126e9576000848483818110612543576125436157c2565b905060200281019061255591906159e7565b612563906020810190615121565b90506000858584818110612579576125796157c2565b905060200281019061258b91906159e7565b612599906040810190615a07565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093945050506001600160a01b03841690508787868181106125ec576125ec6157c2565b90506020028101906125fe91906159e7565b60200135836040516126109190615a4d565b60006040518083038185875af1925050503d806000811461264d576040519150601f19603f3d011682016040523d82523d6000602084013e612652565b606091505b505090508061269c5760405162461bcd60e51b8152602060048201526016602482015275195b595c99d95b98de5058dd1a5bdb8819985a5b195960521b60448201526064016112a2565b7fa9f1cb7eee5fc621e043c1ef431febb0f901998a6c0cbdf70147b0fe4d9f5a6a83836040516126cd929190615a5f565b60405180910390a1505050806126e2906157d8565b9050612527565b50505050565b6001600160a01b03811660009081526101ca6020526040812054611143565b600080516020615cd183398151915261272681613acf565b611b416140a0565b600054610100900460ff161580801561274e5750600054600160ff909116105b8061276f575061275d306140de565b15801561276f575060005460ff166001145b6127d25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016112a2565b6000805460ff1916600117905580156127f5576000805461ff0019166101001790555b61280189898989611b73565b61280a83611d1b565b61281382611c5d565b6102cb849055604051848152600080516020615d718339815191529060200160405180910390a1610300859055604051858152600080516020615c918339815191529060200160405180910390a14261022f5580156128ac576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b6128bf613f1c565b6103005461022f546128d190426157f1565b10156128f05760405163fb9b2f2d60e01b815260040160405180910390fd5b60006128fb336123ce565b90508060000361290b5750612aaa565b6000610231546129196114c7565b61292391906157f1565b90506000612933610231546111db565b9050806102ff541115612988576000816102ff5461295191906157f1565b9050600061296082868661387f565b905061296d816000613d69565b6102ca54612985906001600160a01b03163383613dc3565b50505b6103345460005b81811015612a7257600061033482815481106129ad576129ad6157c2565b60009182526020822001546040516370a0823160e01b81526001600160a01b03909116925082906370a08231906129e890309060040161520b565b602060405180830381865afa158015612a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2991906157a9565b90506000612a3888838961387f565b905080600003612a4a57505050612a62565b612a5e6001600160a01b0384163383613dc3565b5050505b612a6b816157d8565b905061298f565b506102fe54612a839085908561387f565b6102fe6000828254612a9591906157f1565b90915550612aa5905033856140ed565b505050505b612ab5600161016455565b565b600080612ac26114c7565b905080156112065761120181612ad661318f565b85919061387f565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000612b13613f1c565b612b1c83612dc0565b90506102cb5481612b2b6110f9565b612b35919061573e565b1115612b5457604051632ec42b2f60e21b815260040160405180910390fd5b6102ca54600160a01b900460ff168015612b6d57508034145b15612be1576102ca60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015612bc357600080fd5b505af1158015612bd7573d6000803e3d6000fd5b5050505050612bfa565b6102ca54612bfa906001600160a01b0316333084613f77565b612c026114c7565b600003612c4757826103e81115612c2c57604051630131cd7b60e51b815260040160405180910390fd5b612c386103e8846157f1565b9250612c4760016103e8613f98565b612c518284613f98565b816001600160a01b0316336001600160a01b0316600080516020615d918339815191528386604051612c849291906159d9565b60405180910390a361234c8184614053565b600080612ca23361421b565b9092509050612cb18282613d69565b612cbb30826140ed565b336001600160a01b0316836001600160a01b0316336001600160a01b0316600080516020615cf18339815191528585604051612cf89291906159d9565b60405180910390a46102ca54612d18906001600160a01b03168484613dc3565b50919050565b6060609b805461115890615751565b60003381612d3b82866134bc565b905083811015612d9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016112a2565b611863828686840361389e565b60003361121d818585613ad9565b611b41813361124e565b600080612dcb6114c7565b9050801561120657611201612dde6110f9565b8490836139c2565b600060405163d623472560e01b815260040160405180910390fd5b600080612e0d836123ce565b90506000612e1a826111db565b90506000612e27836137eb565b9050808211612e365781612e38565b805b95945050505050565b600080516020615c71833981519152612e5981613acf565b8160005b818110156115ea576000858583818110612e7957612e796157c2565b905060800201803603810190612e8f919061597c565b60408101519091506000819003612ea7575050613087565b81516001600160a01b0381166000908152610333602052604090205460ff16612ee357604051632df15a4160e11b815260040160405180910390fd5b60008084602001516001811115612efc57612efc61537f565b03612f93576102ca54606085015160405163f3f094a160e01b8152306004820152602481018690526001600160a01b03928316604482015260648101919091529083169063f3f094a1906084016020604051808303816000875af1158015612f68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8c91906157a9565b9050613017565b600184602001516001811115612fab57612fab61537f565b0361301757816001600160a01b031663be040fb06040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612ff0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301491906157a9565b90505b6102fe54811161303557806102fe5461303091906157f1565b613038565b60005b6102fe55613047816000614053565b7f60e3ebbed9f935b37adbc6b7a8ad559873ced28247296a76a4d3b81a9e5eb19a33838360405161307a939291906159b5565b60405180910390a1505050505b613090816157d8565b9050612e5d565b60006130a283612c96565b949350505050565b600061110d33612c96565b60606103348054806020026020016040519081016040528092919081815260200182805480156111d157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116130f0575050505050905090565b6000611143610e4b6000611b44565b6000806131316114c7565b905080156112065761120181612ad66110f9565b600080516020615c7183398151915261315d81613acf565b6102cb829055604051828152600080516020615d71833981519152906020016124ed565b600061114361053b836123ce565b61033454600090815b8181101561325157600061033482815481106131b6576131b66157c2565b600091825260209091200154604051633e64257560e01b81526001600160a01b0390911691508190633e642575906131f290309060040161520b565b602060405180830381865afa15801561320f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061323391906157a9565b61323d908561573e565b9350508061324a906157d8565b9050613198565b506102ca546040516370a0823160e01b81526001600160a01b03909116906370a082319061328390309060040161520b565b602060405180830381865afa1580156132a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132c491906157a9565b611a20908361573e565b6000806102ff54905060006132e5610231546111db565b90508082116132f55760006132ff565b6132ff81836157f1565b9250505090565b834211156133565760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016112a2565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886133858c6142ca565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006133e0826142f1565b905060006133f08287878761433f565b9050896001600160a01b0316816001600160a01b0316146134535760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016112a2565b61345e8a8a8a61389e565b50505050505050505050565b6134738261186e565b61347c81613acf565b6118a98383613be7565b610334818154811061349757600080fd5b6000918252602090912001546001600160a01b0316905081565b6000611143826123ce565b6001600160a01b03918216600090815260986020908152604080832093909416825291909152205490565b6102ca54600090600160a01b900460ff1661351557604051636b99faa760e01b815260040160405180910390fd5b60006135203361421b565b909250905061352f8282613d69565b61353930826140ed565b336001600160a01b0316836001600160a01b0316336001600160a01b0316600080516020615cf183398151915285856040516135769291906159d9565b60405180910390a46102ca54604051632e1a7d4d60e01b8152600481018490526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156135c557600080fd5b505af11580156135d9573d6000803e3d6000fd5b50505050612d188383614367565b600080516020615c718339815191526135ff81613acf565b60006136096143b8565b905060006102ff548261361c919061573e565b9050613629858286614481565b6115ea826144c6565b336000908152610232602052604081206001810154600282015483613656836111db565b90508181101561366b57600094505050505090565b613689670de0b6b3a76400008361368281856157f1565b919061387f565b94505050505090565b3360009081526102326020526040902061022f548154116136c65760405163172245f360e01b815260040160405180910390fd5b600181018054600060028401819055918290556102308054919283926136ed9084906157f1565b909155506112749050303383613ad9565b600061114382613126565b60c9546001600160a01b031633146137335760405162461bcd60e51b81526004016112a290615785565b61013180546001600160a01b0319166001600160a01b038316908117909155604051600080516020615cb183398151915290600090a250565b60c9546001600160a01b031633146137965760405162461bcd60e51b81526004016112a290615785565b60ca80546001600160a01b0319166001600160a01b038381169190911790915560c9546040517fb150023a879fd806e3599b6ca8ee3b60f0e360ab3846d128d67ebce1a391639a92611af492169084906158ef565b6000806137f66114c7565b90508015611206576112016111f961318f565b60c9546001600160a01b031633146138335760405162461bcd60e51b81526004016112a290615785565b66b1a2bc2ec5000081111561385b57604051635b94d8b160e01b815260040160405180910390fd5b610130819055604051818152600080516020615db183398151915290602001611af4565b82820281151584158583048514171661389757600080fd5b0492915050565b6001600160a01b0383166139005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016112a2565b6001600160a01b0382166139615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016112a2565b6001600160a01b0383811660008181526098602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b8282028115158415858304851417166139da57600080fd5b6001826001830304018115150290509392505050565b6118a98383836146a4565b613a06823085613ad9565b6001600160a01b03811660009081526102326020526040812042815560018101805491928692613a3790849061573e565b9091555060009050613a48856111db565b905080826002016000828254613a5e919061573e565b92505081905550846102306000828254613a78919061573e565b90915550506040518581526001600160a01b0385169033907ff601bbafcf0d793cce0a8802057c8783aa5946889f76bd9dd47492217f59af1e9060200160405180910390a35050505050565b600061110d60995490565b611b418133614718565b6118a9838383614771565b613aee8282612ade565b6112745760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613b263390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061110d7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613b9a6101965490565b610197546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b613bf18282612ade565b156112745760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b613c56614915565b6101fd805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051613c91919061520b565b60405180910390a1565b600054610100900460ff16613cc25760405162461bcd60e51b81526004016112a2906158a4565b611274828261495f565b600054610100900460ff16613cf35760405162461bcd60e51b81526004016112a2906158a4565b611b4181604051806040016040528060018152602001603160f81b81525061499f565b6000613d218361186e565b600084815260656020526040808220600101859055519192508391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000613d77610231546111db565b9050613d83818461573e565b6102ff541015613da65760405163078cc1fb60e01b815260040160405180910390fd5b826102ff6000828254613db991906157f1565b9091555050505050565b6118a98363a9059cbb60e01b8484604051602401613de2929190615a83565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526149e2565b801580613e925750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e90613e4f90309086906004016158ef565b602060405180830381865afa158015613e6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e9091906157a9565b155b613efd5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016112a2565b6118a98363095ea7b360e01b8484604051602401613de2929190615a83565b60026101645403613f6f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016112a2565b600261016455565b6126e9846323b872dd60e01b858585604051602401613de2939291906159b5565b6001600160a01b038216613fee5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016112a2565b613ffa60008383614ab4565b806099600082825461400c919061573e565b90915550506001600160a01b038216600081815260976020908152604080832080548601905551848152600080516020615d31833981519152910160405180910390a35050565b6103005461022f5461406590426157f1565b11156140845760405163188decd360e31b815260040160405180910390fd5b816102ff6000828254614097919061573e565b90915550505050565b6140a8614ab8565b6101fd805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613c843390565b6001600160a01b03163b151590565b6001600160a01b03821661414d5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016112a2565b61415982600083614ab4565b6001600160a01b038216600090815260976020526040902054818110156141cd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016112a2565b6001600160a01b0383166000818152609760209081526040808320868603905560998054879003905551858152919291600080516020615d31833981519152910160405180910390a3505050565b6001600160a01b0381166000908152610232602052604081206002810154829190820361425b57604051631f2a200560e01b815260040160405180910390fd5b61022f5481541061427f57604051634a44555360e11b815260040160405180910390fd5b600181015460028201549092506142968382614aff565b93508261023160008282546142ab91906157f1565b9091555050600060028301819055600190920191909155509092909150565b6001600160a01b03811660009081526101ca60205260409020805460018101825590612d18565b60006111436142fe613b6a565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061435087878787614b1a565b9150915061435d81614bd4565b5095945050505050565b600080600080600085875af19050806118a95760405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b60448201526064016112a2565b61033454600090815b8181101561447c57600061033482815481106143df576143df6157c2565b600091825260209091200154604051631132ffbf60e11b81526001600160a01b0390911691508190632265ff7e9061441b90309060040161520b565b6020604051808303816000875af115801561443a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061445e91906157a9565b614468908561573e565b93505080614475906157d8565b90506143c1565b505090565b60008284116144995761449484846157f1565b6144a3565b6144a383856157f1565b9050818111156126e957604051638199f5f360e01b815260040160405180910390fd5b60006102ff54826144d7919061573e565b905060006144e36114c7565b9050801561452557610230546000906144fd90848461387f565b9050806102ff5410156145235760405163078cc1fb60e01b815260040160405180910390fd5b505b60006102fe548411614538576000614546565b6102fe5461454690856157f1565b6102fe8590559050426000821561457e57670de0b6b3a764000061012f548461456f9190615a9c565b6145799190615abb565b614581565b60005b90506000610130546000146145df576301e13380670de0b6b3a764000061022f54856145ad91906157f1565b88610130546145bc9190615a9c565b6145c69190615a9c565b6145d09190615abb565b6145da9190615abb565b6145e2565b60005b905060006145f0828461573e565b90506000808211801561460257508188115b156146375761461d87614615848b6157f1565b84919061387f565b61013154909150614637906001600160a01b031682613f98565b61013154604080518881526020810187905290810185905260608101839052608081018a90526001600160a01b03909116907feaedd1267621f4a8ee97011faf0e67800ad3063714bd179f078c980bb9a3fa3d9060a00160405180910390a261022f8590556128ac614d19565b60006146b084846134bc565b905060001981146126e9578181101561470b5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016112a2565b6126e9848484840361389e565b6147228282612ade565b6112745761472f81614d3c565b61473a836020614d4e565b60405160200161474b929190615add565b60408051601f198184030181529082905262461bcd60e51b82526112a291600401615084565b6001600160a01b0383166147d55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016112a2565b6001600160a01b0382166148375760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016112a2565b614842838383614ab4565b6001600160a01b038316600090815260976020526040902054818110156148ba5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016112a2565b6001600160a01b038085166000818152609760205260408082208686039055928616808252908390208054860190559151600080516020615d31833981519152906149089086815260200190565b60405180910390a36126e9565b6101fd5460ff16612ab55760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016112a2565b600054610100900460ff166149865760405162461bcd60e51b81526004016112a2906158a4565b609a6149928382615b9a565b50609b6118a98282615b9a565b600054610100900460ff166149c65760405162461bcd60e51b81526004016112a2906158a4565b8151602092830120815191909201206101969190915561019755565b6000614a37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614ee99092919063ffffffff16565b8051909150156118a95780806020019051810190614a559190615998565b6118a95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016112a2565b6118a95b6101fd5460ff1615612ab55760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016112a2565b600080614b0b846111db565b905082811061120857826130a2565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115614b475750600090506003614bcb565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614b9b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116614bc457600060019250925050614bcb565b9150600090505b94509492505050565b6000816004811115614be857614be861537f565b03614bf05750565b6001816004811115614c0457614c0461537f565b03614c4c5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016112a2565b6002816004811115614c6057614c6061537f565b03614cad5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016112a2565b6003816004811115614cc157614cc161537f565b03611b415760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016112a2565b610230546102316000828254614d2f919061573e565b9091555050600061023055565b60606111436001600160a01b03831660145b60606000614d5d836002615a9c565b614d6890600261573e565b6001600160401b03811115614d7f57614d7f61521f565b6040519080825280601f01601f191660200182016040528015614da9576020820181803683370190505b509050600360fc1b81600081518110614dc457614dc46157c2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614df357614df36157c2565b60200101906001600160f81b031916908160001a9053506000614e17846002615a9c565b614e2290600161573e565b90505b6001811115614e9a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614e5657614e566157c2565b1a60f81b828281518110614e6c57614e6c6157c2565b60200101906001600160f81b031916908160001a90535060049490941c93614e9381615c59565b9050614e25565b5083156112085760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016112a2565b60606130a2848460008585600080866001600160a01b03168587604051614f109190615a4d565b60006040518083038185875af1925050503d8060008114614f4d576040519150601f19603f3d011682016040523d82523d6000602084013e614f52565b606091505b5091509150614f6387838387614f6e565b979650505050505050565b60608315614fdb578251600003614fd457614f88856140de565b614fd45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016112a2565b50816130a2565b6130a28383815115614ff05781518083602001fd5b8060405162461bcd60e51b81526004016112a29190615084565b60006020828403121561501c57600080fd5b81356001600160e01b03198116811461120857600080fd5b60005b8381101561504f578181015183820152602001615037565b50506000910152565b60008151808452615070816020860160208601615034565b601f01601f19169290920160200192915050565b6020815260006112086020830184615058565b6000602082840312156150a957600080fd5b5035919050565b6001600160a01b0381168114611b4157600080fd5b600080604083850312156150d857600080fd5b82356150e3816150b0565b946020939093013593505050565b6000806040838503121561510457600080fd5b823591506020830135615116816150b0565b809150509250929050565b60006020828403121561513357600080fd5b8135611208816150b0565b60008083601f84011261515057600080fd5b5081356001600160401b0381111561516757600080fd5b6020830191508360208260071b850101111561518257600080fd5b9250929050565b6000806020838503121561519c57600080fd5b82356001600160401b038111156151b257600080fd5b6151be8582860161513e565b90969095509350505050565b6000806000606084860312156151df57600080fd5b83356151ea816150b0565b925060208401356151fa816150b0565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b03811182821017156152575761525761521f565b60405290565b600082601f83011261526e57600080fd5b81356001600160401b03808211156152885761528861521f565b604051601f8301601f19908116603f011681019082821181831017156152b0576152b061521f565b816040528381528660208588010111156152c957600080fd5b836020870160208301376000602085830101528094505050505092915050565b8015158114611b4157600080fd5b6000806000806080858703121561530d57600080fd5b8435615318816150b0565b935060208501356001600160401b038082111561533457600080fd5b6153408883890161525d565b9450604087013591508082111561535657600080fd5b506153638782880161525d565b9250506060850135615374816152e9565b939692955090935050565b634e487b7160e01b600052602160045260246000fd5b60208101600283106153a9576153a961537f565b91905290565b6000606082840312156153c157600080fd5b6153c9615235565b905081356153d6816150b0565b80825250602082013560208201526040820135604082015292915050565b60006060828403121561540657600080fd5b61120883836153af565b60208101600383106153a9576153a961537f565b60006060828403121561543657600080fd5b61543e615235565b9050813561544b816150b0565b8152602082013561545b816150b0565b6020820152604082013561546e816150b0565b604082015292915050565b60006060828403121561548b57600080fd5b6112088383615424565b600080602083850312156154a857600080fd5b82356001600160401b03808211156154bf57600080fd5b818501915085601f8301126154d357600080fd5b8135818111156154e257600080fd5b8660208260051b85010111156154f757600080fd5b60209290920196919550909350505050565b600080600080600080600080610180898b03121561552657600080fd5b8835615531816150b0565b975060208901356001600160401b038082111561554d57600080fd5b6155598c838d0161525d565b985060408b013591508082111561556f57600080fd5b5061557c8b828c0161525d565b965050606089013561558d816152e9565b94506080890135935060a089013592506155aa8a60c08b01615424565b91506155ba8a6101208b016153af565b90509295985092959890939650565b6000806000606084860312156155de57600080fd5b8335925060208401356155f0816150b0565b91506040840135615600816150b0565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561564c5783516001600160a01b031683529284019291840191600101615627565b50909695505050505050565b60ff81168114611b4157600080fd5b600080600080600080600060e0888a03121561568257600080fd5b873561568d816150b0565b9650602088013561569d816150b0565b9550604088013594506060880135935060808801356156bb81615658565b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156156eb57600080fd5b82356156f6816150b0565b91506020830135615116816150b0565b6000806040838503121561571957600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b8082018082111561114357611143615728565b600181811c9082168061576557607f821691505b602082108103612d1857634e487b7160e01b600052602260045260246000fd5b6020808252600a908201526927a7262cafa7aba722a960b11b604082015260600190565b6000602082840312156157bb57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016157ea576157ea615728565b5060010190565b8181038181111561114357611143615728565b634e487b7160e01b600052603160045260246000fd5b80356002811061582957600080fd5b919050565b60006020828403121561584057600080fd5b6112088261581a565b60006020828403121561585b57600080fd5b8151611208816150b0565b60006020828403121561587857600080fd5b81516003811061120857600080fd5b60006020828403121561589957600080fd5b815161120881615658565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160a01b0392831681529116602082015260400190565b60006080828403121561591b57600080fd5b604051608081016001600160401b038111828210171561593d5761593d61521f565b604052905080823561594e816150b0565b815261595c6020840161581a565b602082015260408301356040820152606083013560608201525092915050565b60006080828403121561598e57600080fd5b6112088383615909565b6000602082840312156159aa57600080fd5b8151611208816152e9565b6001600160a01b039384168152919092166020820152604081019190915260600190565b918252602082015260400190565b60008235605e198336030181126159fd57600080fd5b9190910192915050565b6000808335601e19843603018112615a1e57600080fd5b8301803591506001600160401b03821115615a3857600080fd5b60200191503681900382131561518257600080fd5b600082516159fd818460208701615034565b6001600160a01b03831681526040602082018190526000906130a290830184615058565b6001600160a01b03929092168252602082015260400190565b6000816000190483118215151615615ab657615ab6615728565b500290565b600082615ad857634e487b7160e01b600052601260045260246000fd5b500490565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615b0f816017850160208801615034565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615b40816028840160208801615034565b01602801949350505050565b601f8211156118a957600081815260208120601f850160051c81016020861015615b735750805b601f850160051c820191505b81811015615b9257828155600101615b7f565b505050505050565b81516001600160401b03811115615bb357615bb361521f565b615bc781615bc18454615751565b84615b4c565b602080601f831160018114615bfc5760008415615be45750858301515b600019600386901b1c1916600185901b178555615b92565b600085815260208120601f198616915b82811015615c2b57888601518255948401946001909101908401615c0c565b5085821015615c495787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600081615c6857615c68615728565b50600019019056feaf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02cdf2ad103954d2bfcb52f25b4af68ddd72081b5be619efefde09b087202f05901cb7ef3e545f5cdb893f5c568ba710fe08f336375a2d9fd66e161033f8fc09ef38b5b16d04624687fcf0d0228f19993c9157c1ed07b41d8d430fd9100eb099fe8fbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8b940a95968ad5b511f89b01075446a4fe9f614f2dc5fbb9e9a6b227d6d4fd707f3922ae986170d8fafba84aef002be412156213e5390345e45b51ddb8ab7e15dcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7d87632b1c6ebfa21acbca0e3279b3cf6385a377cb8fda51e5b866baa6e6012aba26469706673582212209a0d7637ba9ff5112e335f8b2f3fb1d2641727c9c227fbf7ededd473e8eb268964736f6c63430008100033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.