ETH Price: $2,479.70 (+1.48%)

Contract

0x3e138322b86897eDf4Ffc6060Edc0C1220b4F8B0
Transaction Hash
Method
Block
From
To
Approve1587127222023-12-10 11:32:03307 days ago1702207923IN
0x3e138322...220b4F8B0
0 ETH0.000038070.1
Withdraw1512616512023-11-17 8:34:14330 days ago1700210054IN
0x3e138322...220b4F8B0
0 ETH0.000053590.1
Withdraw1512615882023-11-17 8:33:58330 days ago1700210038IN
0x3e138322...220b4F8B0
0 ETH0.000053870.1
Withdraw1512584892023-11-17 8:21:03330 days ago1700209263IN
0x3e138322...220b4F8B0
0 ETH0.000068020.1
Withdraw1512584372023-11-17 8:20:51330 days ago1700209251IN
0x3e138322...220b4F8B0
0 ETH0.000068390.1
Withdraw1512583882023-11-17 8:20:39330 days ago1700209239IN
0x3e138322...220b4F8B0
0 ETH0.000072550.1
Withdraw1512551852023-11-17 8:07:13330 days ago1700208433IN
0x3e138322...220b4F8B0
0 ETH0.000071530.1
Withdraw1512551382023-11-17 8:07:00330 days ago1700208420IN
0x3e138322...220b4F8B0
0 ETH0.000072560.1
Withdraw1512549652023-11-17 8:06:17330 days ago1700208377IN
0x3e138322...220b4F8B0
0 ETH0.000072840.1
Withdraw1512549132023-11-17 8:06:04330 days ago1700208364IN
0x3e138322...220b4F8B0
0 ETH0.000075980.1
Expire1512536142023-11-17 8:00:36330 days ago1700208036IN
0x3e138322...220b4F8B0
0 ETH0.000112030.1
Approve1509166272023-11-16 7:43:49331 days ago1700120629IN
0x3e138322...220b4F8B0
0 ETH0.00002930.1
Purchase1497320352023-11-12 16:03:31334 days ago1699805011IN
0x3e138322...220b4F8B0
0 ETH0.00017820.1
Purchase1497319582023-11-12 16:03:11334 days ago1699804991IN
0x3e138322...220b4F8B0
0 ETH0.000178230.1
Purchase1494280492023-11-11 17:23:29335 days ago1699723409IN
0x3e138322...220b4F8B0
0 ETH0.000173630.1
Purchase1494263162023-11-11 17:16:04335 days ago1699722964IN
0x3e138322...220b4F8B0
0 ETH0.00016370.1
Withdraw1490250282023-11-10 12:11:38337 days ago1699618298IN
0x3e138322...220b4F8B0
0 ETH0.000093040.1
Deposit1490015812023-11-10 10:32:55337 days ago1699612375IN
0x3e138322...220b4F8B0
0 ETH0.000135470.1
Deposit1490012162023-11-10 10:31:21337 days ago1699612281IN
0x3e138322...220b4F8B0
0 ETH0.000135940.1
Deposit1490010102023-11-10 10:30:27337 days ago1699612227IN
0x3e138322...220b4F8B0
0 ETH0.000135660.1
Deposit1489992742023-11-10 10:23:06337 days ago1699611786IN
0x3e138322...220b4F8B0
0 ETH0.000134550.1
Deposit1489991702023-11-10 10:22:41337 days ago1699611761IN
0x3e138322...220b4F8B0
0 ETH0.000149770.1
Deposit1489944002023-11-10 10:02:34337 days ago1699610554IN
0x3e138322...220b4F8B0
0 ETH0.000154570.1
Deposit1489938992023-11-10 10:00:27337 days ago1699610427IN
0x3e138322...220b4F8B0
0 ETH0.000154090.1
Deposit1489937362023-11-10 9:59:46337 days ago1699610386IN
0x3e138322...220b4F8B0
0 ETH0.000161410.1
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
1489911122023-11-10 9:48:48337 days ago1699609728
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1489911122023-11-10 9:48:48337 days ago1699609728
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1489911122023-11-10 9:48:48337 days ago1699609728
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1489911122023-11-10 9:48:48337 days ago1699609728
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1466497792023-11-03 8:13:10344 days ago1698999190
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1466497792023-11-03 8:13:10344 days ago1698999190
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1466497792023-11-03 8:13:10344 days ago1698999190
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1466497792023-11-03 8:13:10344 days ago1698999190
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1444488252023-10-27 8:40:54351 days ago1698396054
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1444488252023-10-27 8:40:54351 days ago1698396054
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1444488252023-10-27 8:40:54351 days ago1698396054
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1444488252023-10-27 8:40:54351 days ago1698396054
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1422452562023-10-20 8:16:46358 days ago1697789806
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1422452562023-10-20 8:16:46358 days ago1697789806
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1422452562023-10-20 8:16:46358 days ago1697789806
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1422452562023-10-20 8:16:46358 days ago1697789806
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1402059732023-10-13 8:12:09365 days ago1697184729
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1402059732023-10-13 8:12:09365 days ago1697184729
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1402059732023-10-13 8:12:09365 days ago1697184729
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1402059732023-10-13 8:12:09365 days ago1697184729
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1380233862023-10-06 8:18:07372 days ago1696580287
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1380233862023-10-06 8:18:07372 days ago1696580287
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1380233862023-10-06 8:18:07372 days ago1696580287
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1380233862023-10-06 8:18:07372 days ago1696580287
0x3e138322...220b4F8B0
 Contract Creation0 ETH
1357111192023-09-29 8:15:51379 days ago1695975351
0x3e138322...220b4F8B0
 Contract Creation0 ETH
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CvxWeeklyPutsSsovV3

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license
File 1 of 51 : CvxWeeklyPutsSsovV3.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

// Contracts
import {SsovV3} from "../core/SsovV3.sol";

/// @title CVX Weekly Puts SSOV V3 contract
contract CvxWeeklyPutsSsovV3 is SsovV3 {
    constructor()
        SsovV3(
            "CVX WEEKLY PUTS SSOV V3",
            "CVX-WEEKLY-PUTS-SSOV-V3",
            "CVX",
            0x7f90122BF0700F9E7e1F688fe926940E8839F353,
            true
        )
    {}
}

File 2 of 51 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

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

File 3 of 51 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

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

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

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

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

File 4 of 51 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 5 of 51 : 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 6 of 51 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

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

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

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

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

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

File 7 of 51 : 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 8 of 51 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

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

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

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

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

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

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

    /**
     * @dev 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 9 of 51 : 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 10 of 51 : ERC20BurnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable {
    function __ERC20Burnable_init() internal onlyInitializing {
    }

    function __ERC20Burnable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }

    /**
     * @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 11 of 51 : ERC20PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)

pragma solidity ^0.8.0;

import "../ERC20Upgradeable.sol";
import "../../../security/PausableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev ERC20 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC20PausableUpgradeable is Initializable, ERC20Upgradeable, PausableUpgradeable {
    function __ERC20Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __ERC20Pausable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {ERC20-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, amount);

        require(!paused(), "ERC20Pausable: token transfer while paused");
    }

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

File 12 of 51 : 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 13 of 51 : ERC20PresetMinterPauserUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol)

pragma solidity ^0.8.0;

import "../ERC20Upgradeable.sol";
import "../extensions/ERC20BurnableUpgradeable.sol";
import "../extensions/ERC20PausableUpgradeable.sol";
import "../../../access/AccessControlEnumerableUpgradeable.sol";
import "../../../utils/ContextUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev {ERC20} token, including:
 *
 *  - ability for holders to burn (destroy) their tokens
 *  - a minter role that allows for token minting (creation)
 *  - a pauser role that allows to stop all token transfers
 *
 * This contract uses {AccessControl} to lock permissioned functions using the
 * different roles - head to its documentation for details.
 *
 * The account that deploys the contract will be granted the minter and pauser
 * roles, as well as the default admin role, which will let it grant both minter
 * and pauser roles to other accounts.
 *
 * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
 */
contract ERC20PresetMinterPauserUpgradeable is Initializable, ContextUpgradeable, AccessControlEnumerableUpgradeable, ERC20BurnableUpgradeable, ERC20PausableUpgradeable {
    function initialize(string memory name, string memory symbol) public virtual initializer {
        __ERC20PresetMinterPauser_init(name, symbol);
    }
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

    /**
     * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the
     * account that deploys the contract.
     *
     * See {ERC20-constructor}.
     */
    function __ERC20PresetMinterPauser_init(string memory name, string memory symbol) internal onlyInitializing {
        __ERC20_init_unchained(name, symbol);
        __Pausable_init_unchained();
        __ERC20PresetMinterPauser_init_unchained(name, symbol);
    }

    function __ERC20PresetMinterPauser_init_unchained(string memory, string memory) internal onlyInitializing {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());

        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(PAUSER_ROLE, _msgSender());
    }

    /**
     * @dev Creates `amount` new tokens for `to`.
     *
     * See {ERC20-_mint}.
     *
     * Requirements:
     *
     * - the caller must have the `MINTER_ROLE`.
     */
    function mint(address to, uint256 amount) public virtual {
        require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint");
        _mint(to, amount);
    }

    /**
     * @dev Pauses all token transfers.
     *
     * See {ERC20Pausable} and {Pausable-_pause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function pause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause");
        _pause();
    }

    /**
     * @dev Unpauses all token transfers.
     *
     * See {ERC20Pausable} and {Pausable-_unpause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function unpause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause");
        _unpause();
    }

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

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

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

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 15 of 51 : 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 16 of 51 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

File 17 of 51 : 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 18 of 51 : 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 19 of 51 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 20 of 51 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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(uint160(account), 20),
                        " 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 21 of 51 : 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 22 of 51 : Clones.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol)

pragma solidity ^0.8.0;

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 *
 * _Available since v3.4._
 */
library Clones {
    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create(0, ptr, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create2(0, ptr, 0x37, salt)
        }
        require(instance != address(0), "ERC1167: create2 failed");
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
            mstore(add(ptr, 0x38), shl(0x60, deployer))
            mstore(add(ptr, 0x4c), salt)
            mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))
            predicted := keccak256(add(ptr, 0x37), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(address implementation, bytes32 salt)
        internal
        view
        returns (address predicted)
    {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}

File 23 of 51 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @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 ReentrancyGuard {
    // 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;

    constructor() {
        _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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 24 of 51 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` 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 tokenId
    ) 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.
     * - `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 tokenId
    ) internal virtual {}
}

File 25 of 51 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 26 of 51 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 27 of 51 : ERC721Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "../../../utils/Context.sol";

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _burn(tokenId);
    }
}

File 28 of 51 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

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

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

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

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 29 of 51 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 30 of 51 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 31 of 51 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

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

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 32 of 51 : 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 33 of 51 : Counters.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 Counters {
    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 34 of 51 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

File 35 of 51 : 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 36 of 51 : 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 37 of 51 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 38 of 51 : ISsovV3.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

// Interfaces
import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import {IERC20} from "../external/interfaces/IERC20.sol";

// Structs
import {Addresses, EpochData, EpochStrikeData, VaultCheckpoint} from "./SsovV3Structs.sol";

/// @title SSOV V3 interface
interface ISsovV3 is IERC721Enumerable {
    function isPut() external view returns (bool);

    function currentEpoch() external view returns (uint256);

    function collateralPrecision() external view returns (uint256);

    function addresses() external view returns (Addresses memory);

    function collateralToken() external view returns (IERC20);

    function deposit(
        uint256 strikeIndex,
        uint256 amount,
        address to
    ) external returns (uint256 tokenId);

    function purchase(
        uint256 strikeIndex,
        uint256 amount,
        address to
    ) external returns (uint256 premium, uint256 totalFee);

    function settle(
        uint256 strikeIndex,
        uint256 amount,
        uint256 epoch,
        address to
    ) external returns (uint256 pnl);

    function withdraw(uint256 tokenId, address to)
        external
        returns (
            uint256 collateralTokenWithdrawAmount,
            uint256[] memory rewardTokenWithdrawAmounts
        );

    function getUnderlyingPrice() external view returns (uint256);

    function getCollateralPrice() external view returns (uint256);

    function getVolatility(uint256 _strike) external view returns (uint256);

    function calculatePremium(
        uint256 _strike,
        uint256 _amount,
        uint256 _expiry
    ) external view returns (uint256 premium);

    function calculatePnl(
        uint256 price,
        uint256 strike,
        uint256 amount,
        uint256 collateralExchangeRate
    ) external view returns (uint256);

    function calculatePurchaseFees(uint256 strike, uint256 amount)
        external
        view
        returns (uint256);

    function calculateSettlementFees(uint256 pnl)
        external
        view
        returns (uint256);

    function getEpochTimes(uint256 epoch)
        external
        view
        returns (uint256 start, uint256 end);

    function writePosition(uint256 tokenId)
        external
        view
        returns (
            uint256 epoch,
            uint256 strike,
            uint256 collateralAmount,
            uint256 checkpointIndex,
            uint256[] memory rewardDistributionRatios
        );

    function getEpochData(uint256 epoch)
        external
        view
        returns (EpochData memory);

    function getEpochStrikeData(uint256 epoch, uint256 strike)
        external
        view
        returns (EpochStrikeData memory);

    function getEpochStrikeCheckpointsLength(uint256 epoch, uint256 strike)
        external
        view
        returns (uint256);

    function checkpoints(
        uint256 epoch,
        uint256 strike,
        uint256 index
    ) external view returns (VaultCheckpoint memory);
}

File 39 of 51 : SsovV3.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

// Libraries
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {SafeERC20} from "../external/libraries/SafeERC20.sol";

// Contracts
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {ERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import {ERC721Burnable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {Counters} from "@openzeppelin/contracts/utils/Counters.sol";
import {SsovV3State} from "./SsovV3State.sol";
import {SsovV3OptionsToken} from "../options-token/SsovV3OptionsToken.sol";
import {ContractWhitelist} from "../helpers/ContractWhitelist.sol";
import {Pausable} from "../helpers/Pausable.sol";

// Interfaces
import {IERC20} from "../external/interfaces/IERC20.sol";
import {IOptionPricing} from "../interfaces/IOptionPricing.sol";
import {IFeeStrategy} from "../interfaces/IFeeStrategy.sol";
import {IStakingStrategy} from "../staking-strategies/IStakingStrategy.sol";
import {IPriceOracle} from "../interfaces/IPriceOracle.sol";
import {IVolatilityOracle} from "../interfaces/IVolatilityOracle.sol";

// Structs
import {VaultCheckpoint, WritePosition, EpochStrikeData, Addresses, EpochData} from "./SsovV3Structs.sol";

function getUintArray(uint256 _arrayLength)
    pure
    returns (uint256[] memory result)
{
    result = new uint256[](_arrayLength);
}

function valueGreaterThanZero(uint256 _value) pure returns (bool result) {
    assembly {
        result := iszero(_value)
    }
}

/// @title SSOV V3 contract
/// @dev A serious assumption made is that all reward tokens are in 1e18 precision. This contract will break if any other precision reward token is added.
contract SsovV3 is
    ReentrancyGuard,
    Pausable,
    ERC721,
    ERC721Enumerable,
    ERC721Burnable,
    AccessControl,
    ContractWhitelist,
    SsovV3State
{
    using SafeERC20 for IERC20;
    using Counters for Counters.Counter;

    /// @dev Token ID counter for write positions
    Counters.Counter private _tokenIdCounter;

    /*==== CONSTRUCTOR ====*/

    constructor(
        string memory _name,
        string memory _symbol,
        string memory _underlyingSymbol,
        address _collateralToken,
        bool _isPut
    ) ERC721(_name, _symbol) {
        underlyingSymbol = _underlyingSymbol;
        collateralToken = IERC20(_collateralToken);
        collateralPrecision = 10**collateralToken.decimals();
        isPut = _isPut;

        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(MANAGER_ROLE, msg.sender);
    }

    /*==== METHODS ====*/

    /// @notice Pauses the vault for emergency cases
    /// @dev Can only be called by the owner
    function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {
        _pause();
    }

    /// @notice Unpauses the vault
    /// @dev Can only be called by the owner
    function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {
        _unpause();
    }

    /// @notice Add a contract to the whitelist
    /// @dev Can only be called by the owner
    /// @param _contract Address of the contract that needs to be added to the whitelist
    function addToContractWhitelist(address _contract)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _addToContractWhitelist(_contract);
    }

    /// @notice Remove a contract to the whitelist
    /// @dev Can only be called by the owner
    /// @param _contract Address of the contract that needs to be removed from the whitelist
    function removeFromContractWhitelist(address _contract)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _removeFromContractWhitelist(_contract);
    }

    /// @notice Updates the delay tolerance for the expiry epoch function
    /// @dev Can only be called by the owner
    function updateExpireDelayTolerance(uint256 _expireDelayTolerance)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        expireDelayTolerance = _expireDelayTolerance;
        emit ExpireDelayToleranceUpdate(_expireDelayTolerance);
    }

    /// @notice Sets (adds) a list of addresses to the address list
    /// @dev Can only be called by the owner
    /// @param _addresses addresses of contracts in the Addresses struct
    function setAddresses(Addresses calldata _addresses)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        addresses = _addresses;
        emit AddressesSet(_addresses);
    }

    /// @notice Change the collateral token allowance to the StakingStrategy contract
    /// @dev Can only be called by the owner
    /// @param _increase bool
    /// @param _allowance uint256
    function changeAllowanceForStakingStrategy(
        bool _increase,
        uint256 _allowance
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (_increase) {
            collateralToken.safeIncreaseAllowance(
                addresses.stakingStrategy,
                _allowance
            );
        } else {
            collateralToken.safeDecreaseAllowance(
                addresses.stakingStrategy,
                _allowance
            );
        }
    }

    /// @notice Transfers all funds to msg.sender
    /// @dev Can only be called by the owner
    /// @param tokens The list of erc20 tokens to withdraw
    /// @param transferNative Whether should transfer the native currency
    function emergencyWithdraw(address[] calldata tokens, bool transferNative)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _whenPaused();
        if (transferNative) payable(msg.sender).transfer(address(this).balance);

        IERC20 token;

        for (uint256 i; i < tokens.length; ) {
            token = IERC20(tokens[i]);
            token.safeTransfer(msg.sender, token.balanceOf(address(this)));

            unchecked {
                ++i;
            }
        }

        emit EmergencyWithdraw(msg.sender);
    }

    /// @dev Internal function to expire an epoch
    /// @param _settlementPrice the settlement price
    /// @param _settlementCollateralExchangeRate the settlement collateral exchange rate
    function _expire(
        uint256 _settlementPrice,
        uint256 _settlementCollateralExchangeRate
    ) private nonReentrant {
        _whenNotPaused();
        _epochNotExpired(currentEpoch);
        epochData[currentEpoch].settlementPrice = _settlementPrice;
        epochData[currentEpoch]
            .settlementCollateralExchangeRate = _settlementCollateralExchangeRate;

        _updateFinalEpochBalances();

        epochData[currentEpoch].expired = true;

        emit EpochExpired(msg.sender, _settlementPrice);
    }

    /// @notice Sets the current epoch as expired
    function expire() external {
        _isEligibleSender();
        (, uint256 epochExpiry) = getEpochTimes(currentEpoch);
        _validate(block.timestamp > epochExpiry, 1);
        _validate(block.timestamp < epochExpiry + expireDelayTolerance, 2);
        _expire(
            getUnderlyingPrice(),
            isPut
                ? (DEFAULT_PRECISION * DEFAULT_PRECISION) / getCollateralPrice()
                : (getUnderlyingPrice() * DEFAULT_PRECISION) /
                    getCollateralPrice()
        );
    }

    /// @notice Sets the current epoch as expired
    /// @dev Can only be called by the owner
    /// @param _settlementPrice The settlement price
    /// @param _settlementCollateralExchangeRate the settlement collateral exchange rate
    function expire(
        uint256 _settlementPrice,
        uint256 _settlementCollateralExchangeRate
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        _epochNotExpired(currentEpoch);
        _expire(_settlementPrice, _settlementCollateralExchangeRate);
    }

    /// @dev Internal function to unstake collateral, gather yield and checkpoint each strike
    function _updateFinalEpochBalances() private {
        uint256[] memory strikes = epochData[currentEpoch].strikes;

        uint256[] memory rewardTokenAmounts = IStakingStrategy(
            addresses.stakingStrategy
        ).unstake();

        for (uint256 i; i < strikes.length; ) {
            _updateRewards(strikes[i], rewardTokenAmounts, true);
            unchecked {
                ++i;
            }
        }
    }

    /// @notice Bootstraps a new epoch with new strikes
    /// @dev Can only be called by the owner
    /// @param strikes the strikes for the epoch
    /// @param expiry the expiry for the epoch
    /// @param expirySymbol the expiry symbol for the epoch
    function bootstrap(
        uint256[] memory strikes,
        uint256 expiry,
        string memory expirySymbol
    ) external nonReentrant onlyRole(MANAGER_ROLE) {
        _whenNotPaused();

        uint256 nextEpoch = currentEpoch + 1;

        _validate(block.timestamp < expiry, 3);
        if (currentEpoch > 0) _validate(epochData[currentEpoch].expired, 4);

        // Set the next epoch strikes
        epochData[nextEpoch].strikes = strikes;

        // Set the next epoch start time
        epochData[nextEpoch].startTime = block.timestamp;

        // Set the next epochs expiry
        epochData[nextEpoch].expiry = expiry;

        // Increase the current epoch
        currentEpoch = nextEpoch;

        uint256 rewardTokensLength = IStakingStrategy(addresses.stakingStrategy)
            .getRewardTokens()
            .length;

        uint256 strike;

        SsovV3OptionsToken _optionsToken;

        for (uint256 i; i < strikes.length; ) {
            strike = strikes[i];
            // Create options tokens representing the option for selected strike in epoch
            _optionsToken = SsovV3OptionsToken(
                Clones.clone(addresses.optionsTokenImplementation)
            );
            _optionsToken.initialize(
                address(this),
                isPut,
                strike,
                expiry,
                underlyingSymbol,
                collateralToken.symbol(),
                expirySymbol
            );
            epochStrikeData[nextEpoch][strike].strikeToken = address(
                _optionsToken
            );

            epochStrikeData[nextEpoch][strike]
                .rewardStoredForPremiums = getUintArray(rewardTokensLength);
            epochStrikeData[nextEpoch][strike]
                .rewardDistributionRatiosForPremiums = getUintArray(
                rewardTokensLength
            );
            unchecked {
                ++i;
            }
        }
        epochData[nextEpoch].totalRewardsCollected = getUintArray(
            rewardTokensLength
        );
        epochData[nextEpoch].rewardDistributionRatios = getUintArray(
            rewardTokensLength
        );
        epochData[nextEpoch].rewardTokensToDistribute = IStakingStrategy(
            addresses.stakingStrategy
        ).getRewardTokens();

        if (isPut) {
            // For puts collateral is always considered against 1 USD
            epochData[nextEpoch].collateralExchangeRate =
                (DEFAULT_PRECISION * DEFAULT_PRECISION) /
                getCollateralPrice();
        } else {
            epochData[nextEpoch].collateralExchangeRate =
                (getUnderlyingPrice() * DEFAULT_PRECISION) /
                getCollateralPrice();
        }

        emit Bootstrap(nextEpoch, strikes);
    }

    /// @dev Internal function to checkpoint the vault for an epoch and strike
    /// @param strike strike
    /// @param collateralAdded collateral added
    function _vaultCheckpoint(uint256 strike, uint256 collateralAdded)
        private
        returns (uint256)
    {
        uint256 _epoch = currentEpoch;

        uint256 checkpointsLength = checkpoints[_epoch][strike].length;

        if (checkpointsLength == 0) {
            checkpoints[_epoch][strike].push(
                VaultCheckpoint({
                    accruedPremium: 0,
                    activeCollateral: 0,
                    totalCollateral: collateralAdded
                })
            );
            return checkpointsLength;
        }

        VaultCheckpoint memory _checkpoint = checkpoints[_epoch][strike][
            checkpointsLength - 1
        ];

        if (_checkpoint.activeCollateral > 0) {
            checkpoints[_epoch][strike].push(
                VaultCheckpoint({
                    accruedPremium: 0,
                    activeCollateral: 0,
                    totalCollateral: collateralAdded
                })
            );
            return checkpointsLength;
        } else {
            checkpoints[_epoch][strike][
                checkpointsLength - 1
            ] = VaultCheckpoint({
                accruedPremium: _checkpoint.accruedPremium,
                activeCollateral: _checkpoint.activeCollateral,
                totalCollateral: _checkpoint.totalCollateral + collateralAdded
            });
            return checkpointsLength - 1;
        }
    }

    /// @dev Internal function to squeeze collateral from n checkpoints to fullfil a purchase
    /// @param _strike strike
    /// @param _requiredCollateral required collateral to fullfil purchase
    /// @param _premium premium awarded
    function _squeeze(
        uint256 _strike,
        uint256 _requiredCollateral,
        uint256 _premium
    ) private {
        VaultCheckpoint memory _checkpoint;

        uint256 _epoch = currentEpoch;
        uint256 _acquiredCollateral;
        uint256 _availableCollateral;
        uint256 _remainingRequiredCollateral;
        uint256 _premiumPerCollateral = (_premium * collateralPrecision) /
            _requiredCollateral;
        uint256 _checkpointPointer = epochStrikeData[_epoch][_strike]
            .checkpointPointer;

        while (_acquiredCollateral < _requiredCollateral) {
            _checkpoint = checkpoints[_epoch][_strike][_checkpointPointer];

            _remainingRequiredCollateral =
                _requiredCollateral -
                _acquiredCollateral;

            _availableCollateral =
                _checkpoint.totalCollateral -
                _checkpoint.activeCollateral;

            if (_availableCollateral >= _remainingRequiredCollateral) {
                _acquiredCollateral += _remainingRequiredCollateral;
                checkpoints[_epoch][_strike][_checkpointPointer]
                    .activeCollateral += _remainingRequiredCollateral;
                checkpoints[_epoch][_strike][_checkpointPointer]
                    .accruedPremium +=
                    (_remainingRequiredCollateral * _premiumPerCollateral) /
                    collateralPrecision;
            } else {
                _acquiredCollateral += _availableCollateral;
                checkpoints[_epoch][_strike][_checkpointPointer]
                    .activeCollateral += _availableCollateral;
                checkpoints[_epoch][_strike][_checkpointPointer]
                    .accruedPremium +=
                    (_availableCollateral * _premiumPerCollateral) /
                    collateralPrecision;
                _checkpointPointer += 1;
            }

            epochStrikeData[_epoch][_strike]
                .checkpointPointer = _checkpointPointer;
        }
    }

    /// @dev Internal function to mint a write position token
    /// @param to the address to mint the position to
    function _mintPositionToken(address to) private returns (uint256 tokenId) {
        tokenId = _tokenIdCounter.current();
        _tokenIdCounter.increment();
        _safeMint(to, tokenId);
    }

    /// @dev Calculates & updates the total rewards collected & the rewards distribution ratios
    /// @param strike the strike
    /// @param totalRewardsArray the totalRewardsArray
    /// @param isPurchase whether this was called on purchase
    function _updateRewards(
        uint256 strike,
        uint256[] memory totalRewardsArray,
        bool isPurchase
    ) private returns (uint256[] memory rewardsDistributionRatios) {
        rewardsDistributionRatios = getUintArray(totalRewardsArray.length);
        uint256 newRewardsCollected;

        for (uint256 i; i < totalRewardsArray.length; ) {
            // Calculate the new rewards accrued
            newRewardsCollected =
                totalRewardsArray[i] -
                epochData[currentEpoch].totalRewardsCollected[i];

            // Update the new total rewards accrued
            epochData[currentEpoch].totalRewardsCollected[
                i
            ] = totalRewardsArray[i];

            // Calculate the reward distribution ratios for the new rewards accrued
            if (epochData[currentEpoch].totalCollateralBalance == 0) {
                rewardsDistributionRatios[i] = 0;
            } else {
                rewardsDistributionRatios[i] =
                    (newRewardsCollected * collateralPrecision) /
                    epochData[currentEpoch].totalCollateralBalance;
            }

            // Add it to the current reward distribution ratios
            epochData[currentEpoch].rewardDistributionRatios[
                    i
                ] += rewardsDistributionRatios[i];

            if (isPurchase) {
                // Add the new rewards accrued for the premiums staked until now
                epochStrikeData[currentEpoch][strike].rewardStoredForPremiums[
                        i
                    ] +=
                    ((epochData[currentEpoch].rewardDistributionRatios[i] -
                        epochStrikeData[currentEpoch][strike]
                            .rewardDistributionRatiosForPremiums[i]) *
                        epochStrikeData[currentEpoch][strike].totalPremiums) /
                    collateralPrecision;
                // Update the reward distribution ratios for the strike
                epochStrikeData[currentEpoch][strike]
                    .rewardDistributionRatiosForPremiums[i] = epochData[
                    currentEpoch
                ].rewardDistributionRatios[i];
            }

            rewardsDistributionRatios[i] = epochData[currentEpoch]
                .rewardDistributionRatios[i];

            unchecked {
                ++i;
            }
        }
    }

    /// @notice Deposit into the ssov to mint options in the next epoch for selected strikes
    /// @param strikeIndex Index of strike
    /// @param amount Amout of collateralToken to deposit
    /// @param to Address of to send the write position to
    /// @return tokenId token id of the deposit token
    function deposit(
        uint256 strikeIndex,
        uint256 amount,
        address to
    ) public nonReentrant returns (uint256 tokenId) {
        uint256 epoch = currentEpoch;

        _whenNotPaused();
        _isEligibleSender();
        _epochNotExpired(epoch);
        _valueNotZero(amount);

        // Must be a valid strike
        uint256 strike = epochData[epoch].strikes[strikeIndex];
        _valueNotZero(strike);

        // Transfer collateralToken from msg.sender (maybe different from user param) to ssov
        collateralToken.safeTransferFrom(msg.sender, address(this), amount);

        // Stake the collateral into the staking strategy and calculates rewards
        uint256[] memory rewardDistributionRatios = _updateRewards(
            strike,
            IStakingStrategy(addresses.stakingStrategy).stake(amount),
            false
        );

        // Checkpoint the vault
        uint256 checkpointIndex = _vaultCheckpoint(strike, amount);

        // Update the total collateral balance
        epochData[currentEpoch].totalCollateralBalance += amount;
        epochStrikeData[currentEpoch][strike].totalCollateral += amount;

        // Mint a write position token
        tokenId = _mintPositionToken(to);

        // Store the write position
        writePositions[tokenId] = WritePosition({
            epoch: epoch,
            strike: strike,
            collateralAmount: amount,
            checkpointIndex: checkpointIndex,
            rewardDistributionRatios: rewardDistributionRatios
        });

        emit Deposit(tokenId, to, msg.sender);
    }

    /// @notice Purchases options for the current epoch
    /// @param strikeIndex Strike index for current epoch
    /// @param amount Amount of options to purchase
    /// @param to address to send the purchased options to
    function purchase(
        uint256 strikeIndex,
        uint256 amount,
        address to
    ) external nonReentrant returns (uint256 premium, uint256 totalFee) {
        _whenNotPaused();
        _isEligibleSender();
        _valueNotZero(amount);

        uint256 epoch = currentEpoch;

        // Check if expiry time is beyond block.timestamp
        (, uint256 epochExpiry) = getEpochTimes(epoch);
        _validate(block.timestamp < epochExpiry, 5);

        uint256 strike = epochData[epoch].strikes[strikeIndex];
        _valueNotZero(strike);

        // Check if vault has enough collateral to write the options
        uint256 availableCollateral = epochStrikeData[epoch][strike]
            .totalCollateral - epochStrikeData[epoch][strike].activeCollateral;
        uint256 requiredCollateral = isPut
            ? (amount *
                strike *
                collateralPrecision *
                epochData[epoch].collateralExchangeRate) /
                (OPTIONS_PRECISION * DEFAULT_PRECISION * DEFAULT_PRECISION)
            : (amount *
                epochData[epoch].collateralExchangeRate *
                collateralPrecision) / (DEFAULT_PRECISION * OPTIONS_PRECISION); /* 1e8 is the precision for the collateralExchangeRate, 1e18 is the precision of the options token */

        _validate(requiredCollateral < availableCollateral, 6);

        // Get total premium for all options being purchased
        premium = calculatePremium(strike, amount, epochExpiry);

        // Total fee charged
        totalFee = calculatePurchaseFees(strike, amount);

        _squeeze(strike, requiredCollateral, premium);

        // Transfer premium from msg.sender (need not be same as user)
        collateralToken.safeTransferFrom(
            msg.sender,
            address(this),
            premium + totalFee
        );

        // Stake premium into the staking strategy and calculates rewards
        _updateRewards(
            strike,
            IStakingStrategy(addresses.stakingStrategy).stake(premium),
            true
        );

        // Update active collateral
        epochStrikeData[epoch][strike].activeCollateral += requiredCollateral;

        // Update total premiums
        epochStrikeData[epoch][strike].totalPremiums += premium;

        // Update the totalCollateralBalance
        epochData[epoch].totalCollateralBalance += premium;

        // Transfer fee to FeeDistributor
        collateralToken.safeTransfer(addresses.feeDistributor, totalFee);

        // Mint option tokens
        SsovV3OptionsToken(epochStrikeData[epoch][strike].strikeToken).mint(
            to,
            amount
        );

        emit Purchase(epoch, strike, amount, premium, totalFee, to, msg.sender);
    }

    /// @notice Settle calculates the PnL for the user and withdraws the PnL in the BaseToken to the user. Will also the burn the option tokens from the user.
    /// @param strikeIndex Strike index
    /// @param amount Amount of options
    /// @param to The address to transfer pnl too
    /// @return pnl
    function settle(
        uint256 strikeIndex,
        uint256 amount,
        uint256 epoch,
        address to
    ) external nonReentrant returns (uint256 pnl) {
        _whenNotPaused();
        _isEligibleSender();
        _valueNotZero(amount);
        _epochExpired(epoch);

        uint256 strike = epochData[epoch].strikes[strikeIndex];

        SsovV3OptionsToken strikeToken = SsovV3OptionsToken(
            epochStrikeData[epoch][strike].strikeToken
        );

        _validate(strikeToken.balanceOf(msg.sender) >= amount, 10);

        // Burn option tokens from user
        strikeToken.burnFrom(msg.sender, amount);

        // Get the settlement price for the epoch
        uint256 settlementPrice = epochData[epoch].settlementPrice;

        // Calculate pnl
        pnl = calculatePnl(
            settlementPrice,
            strike,
            amount,
            epochData[epoch].settlementCollateralExchangeRate
        );

        // Total fee charged
        uint256 totalFee = calculateSettlementFees(pnl);

        _valueNotZero(pnl);

        // Transfer fee to FeeDistributor
        collateralToken.safeTransfer(addresses.feeDistributor, totalFee);

        // Transfer PnL
        collateralToken.safeTransfer(to, pnl - totalFee);

        emit Settle(
            epoch,
            strike,
            amount,
            pnl - totalFee,
            totalFee,
            to,
            msg.sender
        );
    }

    /// @notice Withdraw from the ssov via burning a write position token
    /// @param tokenId token id of the write position
    /// @param to address to transfer collateral and rewards
    function withdraw(uint256 tokenId, address to)
        external
        nonReentrant
        returns (
            uint256 collateralTokenWithdrawAmount,
            uint256[] memory rewardTokenWithdrawAmounts
        )
    {
        _whenNotPaused();
        _isEligibleSender();

        (
            uint256 epoch,
            uint256 strike,
            uint256 collateralAmount,
            uint256 checkpointIndex,
            uint256[] memory rewardDistributionRatios
        ) = writePosition(tokenId);

        _valueNotZero(strike);
        _epochExpired(epoch);

        // Burn the write position token
        burn(tokenId);

        // Get the checkpoint
        VaultCheckpoint memory _checkpoint = checkpoints[epoch][strike][
            checkpointIndex
        ];

        // Rewards calculations
        rewardTokenWithdrawAmounts = getUintArray(
            epochData[epoch].rewardTokensToDistribute.length
        );

        uint256 accruedPremium = (_checkpoint.accruedPremium *
            collateralAmount) / _checkpoint.totalCollateral;

        uint256 optionsWritten = isPut
            ? (_checkpoint.activeCollateral *
                DEFAULT_PRECISION *
                DEFAULT_PRECISION *
                OPTIONS_PRECISION) /
                (strike *
                    collateralPrecision *
                    epochData[epoch].collateralExchangeRate)
            : (_checkpoint.activeCollateral *
                OPTIONS_PRECISION *
                DEFAULT_PRECISION) /
                (epochData[epoch].collateralExchangeRate * collateralPrecision);

        // Calculate the withdrawable collateral amount
        collateralTokenWithdrawAmount =
            ((_checkpoint.totalCollateral -
                calculatePnl(
                    epochData[epoch].settlementPrice,
                    strike,
                    optionsWritten,
                    epochData[epoch].settlementCollateralExchangeRate
                )) * collateralAmount) /
            _checkpoint.totalCollateral;

        // Add premiums
        collateralTokenWithdrawAmount += accruedPremium;

        // Calculate and transfer rewards
        for (uint256 i; i < rewardTokenWithdrawAmounts.length; ) {
            rewardTokenWithdrawAmounts[i] +=
                ((epochData[epoch].rewardDistributionRatios[i] -
                    rewardDistributionRatios[i]) * collateralAmount) /
                collateralPrecision;
            if (epochStrikeData[epoch][strike].totalPremiums > 0)
                rewardTokenWithdrawAmounts[i] +=
                    (accruedPremium *
                        epochStrikeData[epoch][strike].rewardStoredForPremiums[
                            i
                        ]) /
                    epochStrikeData[epoch][strike].totalPremiums;
            IERC20(epochData[epoch].rewardTokensToDistribute[i]).safeTransfer(
                to,
                rewardTokenWithdrawAmounts[i]
            );
            unchecked {
                ++i;
            }
        }

        // Transfer the collateralTokenWithdrawAmount
        collateralToken.safeTransfer(to, collateralTokenWithdrawAmount);

        emit Withdraw(
            tokenId,
            collateralTokenWithdrawAmount,
            rewardTokenWithdrawAmounts,
            to,
            msg.sender
        );
    }

    /*==== VIEWS ====*/

    /// @notice Returns the price of the underlying in USD in 1e8 precision
    function getUnderlyingPrice() public view returns (uint256) {
        return IPriceOracle(addresses.priceOracle).getUnderlyingPrice();
    }

    /// @notice Returns the price of the collateral token in 1e8 precision
    /// @dev This contract assumes that this price can never decrease in ratio of the underlying price
    function getCollateralPrice() public view returns (uint256) {
        return IPriceOracle(addresses.priceOracle).getCollateralPrice();
    }

    /// @notice Returns the volatility from the volatility oracle
    /// @param _strike Strike of the option
    function getVolatility(uint256 _strike) public view returns (uint256) {
        return
            IVolatilityOracle(addresses.volatilityOracle).getVolatility(
                _strike
            );
    }

    /// @notice Calculate premium for an option
    /// @param _strike Strike price of the option
    /// @param _amount Amount of options (1e18 precision)
    /// @param _expiry Expiry of the option
    /// @return premium in collateralToken in collateral precision
    function calculatePremium(
        uint256 _strike,
        uint256 _amount,
        uint256 _expiry
    ) public view returns (uint256 premium) {
        premium = (IOptionPricing(addresses.optionPricing).getOptionPrice(
            isPut,
            _expiry,
            _strike,
            getUnderlyingPrice(),
            getVolatility(_strike)
        ) * _amount);

        premium =
            (premium * collateralPrecision) /
            (getCollateralPrice() * OPTIONS_PRECISION);
    }

    /// @notice Calculate Pnl
    /// @param price price of the underlying asset
    /// @param strike strike price of the option
    /// @param amount amount of options
    /// @param collateralExchangeRate collateral exchange rate
    function calculatePnl(
        uint256 price,
        uint256 strike,
        uint256 amount,
        uint256 collateralExchangeRate
    ) public view returns (uint256) {
        if (isPut)
            return
                strike > price
                    ? ((strike - price) *
                        amount *
                        collateralPrecision *
                        collateralExchangeRate) /
                        (OPTIONS_PRECISION *
                            DEFAULT_PRECISION *
                            DEFAULT_PRECISION)
                    : 0;
        return
            price > strike
                ? (((price - strike) *
                    amount *
                    collateralPrecision *
                    collateralExchangeRate) / price) /
                    (OPTIONS_PRECISION * DEFAULT_PRECISION)
                : 0;
    }

    /// @notice Calculate fees for purchase
    /// @param strike strike price of the BaseToken option
    /// @param amount amount of options being bought
    function calculatePurchaseFees(uint256 strike, uint256 amount)
        public
        view
        returns (uint256)
    {
        return ((IFeeStrategy(addresses.feeStrategy).calculatePurchaseFees(
            getUnderlyingPrice(),
            strike,
            amount
        ) * collateralPrecision) / getCollateralPrice());
    }

    /// @notice Calculate fees for settlement of options
    /// @param pnl total pnl
    function calculateSettlementFees(uint256 pnl)
        public
        view
        returns (uint256)
    {
        return IFeeStrategy(addresses.feeStrategy).calculateSettlementFees(pnl);
    }

    /// @notice Returns start and end times for an epoch
    /// @param epoch Target epoch
    function getEpochTimes(uint256 epoch)
        public
        view
        returns (uint256 start, uint256 end)
    {
        return (epochData[epoch].startTime, epochData[epoch].expiry);
    }

    /// @notice View a write position
    /// @param tokenId tokenId a parameter just like in doxygen (must be followed by parameter name)
    function writePosition(uint256 tokenId)
        public
        view
        returns (
            uint256 epoch,
            uint256 strike,
            uint256 collateralAmount,
            uint256 checkpointIndex,
            uint256[] memory rewardDistributionRatios
        )
    {
        WritePosition memory _writePosition = writePositions[tokenId];

        return (
            _writePosition.epoch,
            _writePosition.strike,
            _writePosition.collateralAmount,
            _writePosition.checkpointIndex,
            _writePosition.rewardDistributionRatios
        );
    }

    /// @notice Returns the data for an epoch
    /// @param epoch the epoch
    function getEpochData(uint256 epoch)
        external
        view
        returns (EpochData memory)
    {
        return epochData[epoch];
    }

    /// @notice Returns the checkpoints for an epoch and strike
    /// @param epoch the epoch
    /// @param strike the strike
    function getEpochStrikeCheckpointsLength(uint256 epoch, uint256 strike)
        external
        view
        returns (uint256)
    {
        return checkpoints[epoch][strike].length;
    }

    /// @notice Returns the data for an epoch and strike
    /// @param epoch the epoch
    /// @param strike the strike
    function getEpochStrikeData(uint256 epoch, uint256 strike)
        external
        view
        returns (EpochStrikeData memory)
    {
        return epochStrikeData[epoch][strike];
    }

    /*==== PRIVATE FUCNTIONS FOR REVERTS ====*/

    /// @dev Internal function to check if the epoch passed is not expired. Revert if expired.
    /// @param _epoch the epoch
    function _epochNotExpired(uint256 _epoch) private view {
        _validate(!epochData[_epoch].expired, 7);
    }

    /// @dev Internal function to check if the value passed is not zero. Revert if 0.
    /// @param _value the value
    function _valueNotZero(uint256 _value) private pure {
        _validate(!valueGreaterThanZero(_value), 8);
    }

    /// @dev Internal function to check if the epoch passed is expired. Revert if not expired.
    /// @param _epoch the epoch
    function _epochExpired(uint256 _epoch) private view {
        _validate(epochData[_epoch].expired, 9);
    }

    /// @dev Internal function to validate a condition
    /// @param _condition boolean condition
    /// @param _errorCode error code to revert with
    function _validate(bool _condition, uint256 _errorCode) private pure {
        if (!_condition) revert SsovV3Error(_errorCode);
    }

    error SsovV3Error(uint256);

    // The following functions are overrides required by Solidity.

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721Enumerable) {
        _whenNotPaused();
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721, ERC721Enumerable, AccessControl)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

/*==== ERROR CODE MAPPING ====*/
// 1 - block.timestamp must be greater than expiry timestamp
// 2 - block.timestamp must be lesser than expiry timestamp + delay tolerance
// 3 - block.timestamp must be lesser than the passed expiry timestamp
// 4 - If current epoch is greater than 0 then the current epoch must be expired to bootstrap
// 5 - block.timestamp must be lesser than the expiry timestamp
// 6 - required collateral must be lesser than the available collateral
// 7 - epoch must not be expired
// 8 - value must not be zero
// 9 - epoch must be expired
// 10 - option token balance of msg.sender should be greater than or equal to amount being settled

File 40 of 51 : SsovV3State.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

// Interfaces
import {IERC20} from "../external/interfaces/IERC20.sol";

// Structs
import {VaultCheckpoint, WritePosition, EpochStrikeData, Addresses, EpochData} from "./SsovV3Structs.sol";

abstract contract SsovV3State {
    /// @dev Manager role which handles bootstrapping
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

    /// @dev Underlying assets symbol
    string public underlyingSymbol;

    /// @notice Whether this is a Put or Call SSOV
    bool public isPut;

    /// @dev Contract addresses
    Addresses public addresses;

    /// @dev Collateral Token
    IERC20 public collateralToken;

    /// @dev Current epoch for ssov
    uint256 public currentEpoch;

    /// @dev Expire delay tolerance
    uint256 public expireDelayTolerance = 5 minutes;

    /// @dev The precision of the collateral token
    uint256 public collateralPrecision;

    /// @dev Options token precision
    uint256 internal constant OPTIONS_PRECISION = 1e18;

    /// @dev Strikes, prices and collateral exchange rate is stored in the default precision which is 1e8
    uint256 internal constant DEFAULT_PRECISION = 1e8;

    /// @dev Reward distribution rate precision and any reward token precision
    uint256 internal constant REWARD_PRECISION = 1e18;

    /// @dev Checkpoints (epoch => strike => checkpoints[])
    mapping(uint256 => mapping(uint256 => VaultCheckpoint[]))
        public checkpoints;

    /// @dev epoch => EpochData
    mapping(uint256 => EpochData) internal epochData;

    /// @dev Mapping of (epoch => (strike => EpochStrikeData))
    mapping(uint256 => mapping(uint256 => EpochStrikeData))
        internal epochStrikeData;

    /// @dev tokenId => WritePosition
    mapping(uint256 => WritePosition) internal writePositions;

    /*==== ERRORS ====*/

    event ExpireDelayToleranceUpdate(uint256 expireDelayTolerance);

    event AddressesSet(Addresses addresses);

    event EmergencyWithdraw(address sender);

    event EpochExpired(address sender, uint256 settlementPrice);

    event Bootstrap(uint256 epoch, uint256[] strikes);

    event Deposit(uint256 tokenId, address indexed to, address indexed sender);

    event Purchase(
        uint256 epoch,
        uint256 strike,
        uint256 amount,
        uint256 premium,
        uint256 fee,
        address indexed to,
        address indexed sender
    );

    event Settle(
        uint256 epoch,
        uint256 strike,
        uint256 amount,
        uint256 pnl, // pnl transfered to the user
        uint256 fee, // fee sent to fee distributor
        address indexed to,
        address indexed sender
    );

    event Withdraw(
        uint256 tokenId,
        uint256 collateralTokenWithdrawn,
        uint256[] rewardTokenWithdrawAmounts,
        address indexed to,
        address indexed sender
    );
}

File 41 of 51 : SsovV3Structs.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

struct Addresses {
    address feeStrategy;
    address stakingStrategy;
    address optionPricing;
    address priceOracle;
    address volatilityOracle;
    address feeDistributor;
    address optionsTokenImplementation;
}

struct EpochData {
    bool expired;
    uint256 startTime;
    uint256 expiry;
    uint256 settlementPrice;
    uint256 totalCollateralBalance; // Premium + Deposits from all strikes
    uint256 collateralExchangeRate; // Exchange rate for collateral to underlying (Only applicable to CALL options)
    uint256 settlementCollateralExchangeRate; // Exchange rate for collateral to underlying on settlement (Only applicable to CALL options)
    uint256[] strikes;
    uint256[] totalRewardsCollected;
    uint256[] rewardDistributionRatios;
    address[] rewardTokensToDistribute;
}

struct EpochStrikeData {
    address strikeToken;
    uint256 totalCollateral;
    uint256 activeCollateral;
    uint256 totalPremiums;
    uint256 checkpointPointer;
    uint256[] rewardStoredForPremiums;
    uint256[] rewardDistributionRatiosForPremiums;
}

struct VaultCheckpoint {
    uint256 activeCollateral;
    uint256 totalCollateral;
    uint256 accruedPremium;
}

struct WritePosition {
    uint256 epoch;
    uint256 strike;
    uint256 collateralAmount;
    uint256 checkpointIndex;
    uint256[] rewardDistributionRatios;
}

File 42 of 51 : IERC20.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 * NOTE: Modified to include symbols and decimals.
 */
interface IERC20 {
  function totalSupply() external view returns (uint256);

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

  function decimals() external view returns (uint8);

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

  function transfer(address recipient, uint256 amount) external returns (bool);

  function allowance(address owner, address spender)
    external
    view
    returns (uint256);

  function approve(address spender, uint256 amount) external returns (bool);

  function transferFrom(
    address sender,
    address recipient,
    uint256 amount
  ) external returns (bool);

  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 43 of 51 : SafeERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IERC20} from "../interfaces/IERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {Address} from "@openzeppelin/contracts/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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(
            value
        );
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(
            value,
            "SafeERC20: decreased allowance below zero"
        );
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(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
            // solhint-disable-next-line max-line-length
            require(
                abi.decode(returndata, (bool)),
                "SafeERC20: ERC20 operation did not succeed"
            );
        }
    }
}

File 44 of 51 : ContractWhitelist.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

/// @title ContractWhitelist
/// @author witherblock
/// @notice A helper contract that lets you add a list of whitelisted contracts that should be able to interact with restricited functions
abstract contract ContractWhitelist {
    /// @dev contract => whitelisted or not
    mapping(address => bool) public whitelistedContracts;

    /*==== SETTERS ====*/

    /// @dev add to the contract whitelist
    /// @param _contract the address of the contract to add to the contract whitelist
    function _addToContractWhitelist(address _contract) internal {
        require(isContract(_contract), "Address must be a contract");
        require(
            !whitelistedContracts[_contract],
            "Contract already whitelisted"
        );

        whitelistedContracts[_contract] = true;

        emit AddToContractWhitelist(_contract);
    }

    /// @dev remove from  the contract whitelist
    /// @param _contract the address of the contract to remove from the contract whitelist
    function _removeFromContractWhitelist(address _contract) internal {
        require(whitelistedContracts[_contract], "Contract not whitelisted");

        whitelistedContracts[_contract] = false;

        emit RemoveFromContractWhitelist(_contract);
    }

    // modifier is eligible sender modifier
    function _isEligibleSender() internal view {
        // the below condition checks whether the caller is a contract or not
        if (msg.sender != tx.origin)
            require(
                whitelistedContracts[msg.sender],
                "Contract must be whitelisted"
            );
    }

    /*==== VIEWS ====*/

    /// @dev checks for contract or eoa addresses
    /// @param addr the address to check
    /// @return bool whether the passed address is a contract address
    function isContract(address addr) public view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(addr)
        }
        return size > 0;
    }

    /*==== EVENTS ====*/

    event AddToContractWhitelist(address indexed _contract);

    event RemoveFromContractWhitelist(address indexed _contract);
}

File 45 of 51 : Pausable.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.0;

/// @title Lighter version of the Openzeppelin Pausable contract
/// @author witherblock
/// @notice Helps pause a contract to block the execution of selected functions
/// @dev Difference from the Openzeppelin version is changing the modifiers to internal fns and requires to reverts
abstract contract Pausable {
    /**
     * @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.
     */
    constructor() {
        _paused = false;
    }

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

    /**
     * @dev Internal function to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _whenNotPaused() internal view {
        if (paused()) revert ContractPaused();
    }

    /**
     * @dev Internal function to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _whenPaused() internal view {
        if (!paused()) revert ContractNotPaused();
    }

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

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

    error ContractPaused();
    error ContractNotPaused();
}

File 46 of 51 : IFeeStrategy.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IFeeStrategy {
    function calculatePurchaseFees(
        uint256,
        uint256,
        uint256
    ) external view returns (uint256);

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

File 47 of 51 : IOptionPricing.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IOptionPricing {
  function getOptionPrice(
    bool isPut,
    uint256 expiry,
    uint256 strike,
    uint256 lastPrice,
    uint256 baseIv
  ) external view returns (uint256);
}

File 48 of 51 : IPriceOracle.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IPriceOracle {
    function getCollateralPrice() external view returns (uint256);

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

File 49 of 51 : IVolatilityOracle.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IVolatilityOracle {
    function getVolatility(uint256) external view returns (uint256);
}

File 50 of 51 : SsovV3OptionsToken.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

// Contracts
import {ERC20PresetMinterPauserUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/presets/ERC20PresetMinterPauserUpgradeable.sol";

// Interfaces
import {ISsovV3} from "../core/ISsovV3.sol";

// Libraries
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";

/**
 * @title Dopex SSOV V3 ERC20 Options Token
 */
contract SsovV3OptionsToken is ERC20PresetMinterPauserUpgradeable {
    using Strings for uint256;

    /// @dev Is this a PUT or CALL options contract
    bool public isPut;

    /// @dev The strike of the options contract
    uint256 public strike;

    /// @dev The time of expiry of the options contract
    uint256 public expiry;

    /// @dev The address of the ssov creating the options contract
    address public ssov;

    /// @dev The symbol reperesenting the underlying asset of the option
    string public underlyingSymbol;

    /// @dev The symbol representing the collateral token of the option
    string public collateralSymbol;

    /*==== INITIALIZE FUNCTION ====*/

    /**
     * @notice Initialize function, equivalent of a constructor for upgradeable contracts
     * @param _ssov The address of the ssov creating the options contract
     * @param _isPut Whether the options is a put option
     * @param _strike The amount of strike asset that will be paid out per doToken
     * @param _expiry The time at which the insurance expires
     * @param _underlyingSymbol The symbol of the underlying asset token
     * @param _collateralSymbol The symbol of the collateral token
     * @param _expirySymbol The symbol representing the expiry
     */
    function initialize(
        address _ssov,
        bool _isPut,
        uint256 _strike,
        uint256 _expiry,
        string memory _underlyingSymbol,
        string memory _collateralSymbol,
        string memory _expirySymbol
    ) public {
        require(block.timestamp < _expiry, "Can't deploy an expired contract");

        ssov = _ssov;
        underlyingSymbol = _underlyingSymbol;
        collateralSymbol = _collateralSymbol;
        isPut = _isPut;
        strike = _strike;
        expiry = _expiry;

        string memory symbol = concatenate(_underlyingSymbol, "-");
        symbol = concatenate(symbol, _expirySymbol);
        symbol = concatenate(symbol, "-");
        symbol = concatenate(symbol, (strike / 1e8).toString());
        symbol = concatenate(symbol, isPut ? "-P" : "-C");

        super.initialize("Dopex SSOV V3 Options Token", symbol);
    }

    /*==== VIEWS ====*/

    /**
     * @notice Returns true if the doToken contract has expired
     */
    function hasExpired() external view returns (bool) {
        return (block.timestamp >= expiry);
    }

    /**
     * @notice Returns the current value of an option
     */
    function optionValue() external view returns (uint256) {
        return ISsovV3(ssov).calculatePremium(strike, 1e18, expiry);
    }

    /*==== PURE FUNCTIONS ====*/

    /**
     * @notice Returns a concatenated string of a and b
     * @param _a string a
     * @param _b string b
     */
    function concatenate(string memory _a, string memory _b)
        internal
        pure
        returns (string memory)
    {
        return string(abi.encodePacked(_a, _b));
    }
}

File 51 of 51 : IStakingStrategy.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IStakingStrategy {
    function stake(uint256) external returns (uint256[] memory);

    function unstake() external returns (uint256[] memory);

    function getRewardTokens() external view returns (address[] memory);

    event Stake(
        address sender,
        uint256 amountStaked,
        uint256 totalStakedBalance,
        uint256[] totalRewardsArray
    );

    event Unstake(
        address sender,
        uint256 amountUnstaked,
        uint256[] rewardTokenAmounts
    );
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ContractNotPaused","type":"error"},{"inputs":[],"name":"ContractPaused","type":"error"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"SsovV3Error","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"AddToContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"feeStrategy","type":"address"},{"internalType":"address","name":"stakingStrategy","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"optionsTokenImplementation","type":"address"}],"indexed":false,"internalType":"struct Addresses","name":"addresses","type":"tuple"}],"name":"AddressesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"strikes","type":"uint256[]"}],"name":"Bootstrap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"settlementPrice","type":"uint256"}],"name":"EpochExpired","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"expireDelayTolerance","type":"uint256"}],"name":"ExpireDelayToleranceUpdate","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":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"premium","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"Purchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"RemoveFromContractWhitelist","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":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pnl","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"Settle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collateralTokenWithdrawn","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"rewardTokenWithdrawAmounts","type":"uint256[]"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"addToContractWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"addresses","outputs":[{"internalType":"address","name":"feeStrategy","type":"address"},{"internalType":"address","name":"stakingStrategy","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"optionsTokenImplementation","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"strikes","type":"uint256[]"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"string","name":"expirySymbol","type":"string"}],"name":"bootstrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"collateralExchangeRate","type":"uint256"}],"name":"calculatePnl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strike","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_expiry","type":"uint256"}],"name":"calculatePremium","outputs":[{"internalType":"uint256","name":"premium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculatePurchaseFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pnl","type":"uint256"}],"name":"calculateSettlementFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_increase","type":"bool"},{"internalType":"uint256","name":"_allowance","type":"uint256"}],"name":"changeAllowanceForStakingStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"checkpoints","outputs":[{"internalType":"uint256","name":"activeCollateral","type":"uint256"},{"internalType":"uint256","name":"totalCollateral","type":"uint256"},{"internalType":"uint256","name":"accruedPremium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralPrecision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"bool","name":"transferNative","type":"bool"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expire","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_settlementPrice","type":"uint256"},{"internalType":"uint256","name":"_settlementCollateralExchangeRate","type":"uint256"}],"name":"expire","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expireDelayTolerance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCollateralPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochData","outputs":[{"components":[{"internalType":"bool","name":"expired","type":"bool"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"settlementPrice","type":"uint256"},{"internalType":"uint256","name":"totalCollateralBalance","type":"uint256"},{"internalType":"uint256","name":"collateralExchangeRate","type":"uint256"},{"internalType":"uint256","name":"settlementCollateralExchangeRate","type":"uint256"},{"internalType":"uint256[]","name":"strikes","type":"uint256[]"},{"internalType":"uint256[]","name":"totalRewardsCollected","type":"uint256[]"},{"internalType":"uint256[]","name":"rewardDistributionRatios","type":"uint256[]"},{"internalType":"address[]","name":"rewardTokensToDistribute","type":"address[]"}],"internalType":"struct EpochData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"}],"name":"getEpochStrikeCheckpointsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"}],"name":"getEpochStrikeData","outputs":[{"components":[{"internalType":"address","name":"strikeToken","type":"address"},{"internalType":"uint256","name":"totalCollateral","type":"uint256"},{"internalType":"uint256","name":"activeCollateral","type":"uint256"},{"internalType":"uint256","name":"totalPremiums","type":"uint256"},{"internalType":"uint256","name":"checkpointPointer","type":"uint256"},{"internalType":"uint256[]","name":"rewardStoredForPremiums","type":"uint256[]"},{"internalType":"uint256[]","name":"rewardDistributionRatiosForPremiums","type":"uint256[]"}],"internalType":"struct EpochStrikeData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochTimes","outputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","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":"getUnderlyingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strike","type":"uint256"}],"name":"getVolatility","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPut","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","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":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"purchase","outputs":[{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"removeFromContractWhitelist","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":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"feeStrategy","type":"address"},{"internalType":"address","name":"stakingStrategy","type":"address"},{"internalType":"address","name":"optionPricing","type":"address"},{"internalType":"address","name":"priceOracle","type":"address"},{"internalType":"address","name":"volatilityOracle","type":"address"},{"internalType":"address","name":"feeDistributor","type":"address"},{"internalType":"address","name":"optionsTokenImplementation","type":"address"}],"internalType":"struct Addresses","name":"_addresses","type":"tuple"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"settle","outputs":[{"internalType":"uint256","name":"pnl","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingSymbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_expireDelayTolerance","type":"uint256"}],"name":"updateExpireDelayTolerance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedContracts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"collateralTokenWithdrawAmount","type":"uint256"},{"internalType":"uint256[]","name":"rewardTokenWithdrawAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"writePosition","outputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"internalType":"uint256","name":"checkpointIndex","type":"uint256"},{"internalType":"uint256[]","name":"rewardDistributionRatios","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

608060405261012c6019553480156200001757600080fd5b5060408051808201825260178082527f435658205745454b4c5920505554532053534f56205633000000000000000000602080840191909152835180850185529182527f4356582d5745454b4c592d505554532d53534f562d56330000000000000000008282015283518085019094526003845262086acb60eb1b9084015260016000819055805460ff1916815591929091737f90122bf0700f9e7e1f688fe926940e8839f3539084846002620000cf838262000340565b506003620000de828262000340565b50600e9150620000f19050848262000340565b50601780546001600160a01b0319166001600160a01b0384169081179091556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa1580156200014c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200017291906200040c565b6200017f90600a6200054b565b601a55600f805460ff19168215151790556200019d600033620001d4565b620001c97f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0833620001d4565b50505050506200055c565b620001e08282620001e4565b5050565b620001f082826200026e565b620001e0576000828152600c602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200022a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152600c602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002c657607f821691505b602082108103620002e757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200033b57600081815260208120601f850160051c81016020861015620003165750805b601f850160051c820191505b81811015620003375782815560010162000322565b5050505b505050565b81516001600160401b038111156200035c576200035c6200029b565b62000374816200036d8454620002b1565b84620002ed565b602080601f831160018114620003ac5760008415620003935750858301515b600019600386901b1c1916600185901b17855562000337565b600085815260208120601f198616915b82811015620003dd57888601518255948401946001909101908401620003bc565b5085821015620003fc5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602082840312156200041f57600080fd5b815160ff811681146200043157600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200048f57816000190482111562000473576200047362000438565b808516156200048157918102915b93841c939080029062000453565b509250929050565b600082620004a85750600162000295565b81620004b75750600062000295565b8160018114620004d05760028114620004db57620004fb565b600191505062000295565b60ff841115620004ef57620004ef62000438565b50506001821b62000295565b5060208310610133831016604e8410600b841016171562000520575081810a62000295565b6200052c83836200044e565b806000190482111562000543576200054362000438565b029392505050565b60006200043160ff84168362000497565b615f5c806200056c6000396000f3fe608060405234801561001057600080fd5b50600436106103b95760003560e01c80637cdba760116101f4578063b375d4921161011a578063d8202b8b116100ad578063ea3bd5df1161007c578063ea3bd5df14610922578063ec87621c14610935578063f3c274a61461095c578063f7683bbc1461096957600080fd5b8063d8202b8b1461084a578063d90a730e1461085d578063da0321cd14610865578063e985e9c5146108e657600080fd5b8063c3d9ed39116100e9578063c3d9ed39146107fe578063c48ce05b14610811578063c87b56dd14610824578063d547741f1461083757600080fd5b8063b375d49214610797578063b88d4fde146107aa578063c189c19b146107bd578063c3cbb71c146107d057600080fd5b8063920023de11610192578063a624ec6311610161578063a624ec631461073a578063ab2150cf1461075e578063acc3a00614610771578063b2016bd41461078457600080fd5b8063920023de1461070457806395d89b4114610717578063a217fddf1461071f578063a22cb4651461072757600080fd5b806387d8ee9b116101ce57806387d8ee9b146106b85780638dbdbe6d146106cb57806391aee9a8146106de57806391d14854146106f157600080fd5b80637cdba760146106655780638456cb5914610690578063859e7d321461069857600080fd5b80633f4ba83a116102e45780636352211e11610277578063751eb65c11610246578063751eb65c1461062e578063766718081461064157806379599f961461064a5780637c4b52cb1461065257600080fd5b80636352211e146105a857806369e3b748146105bb5780636f56f56f146105db57806370a082311461061b57600080fd5b8063468f02d2116102b3578063468f02d2146105795780634f6ccce7146105815780635c975abb14610594578063616443731461059f57600080fd5b80633f4ba83a1461054257806342842e0e1461054a57806342966c681461055d578063430aea2e1461057057600080fd5b806318160ddd1161035c5780632f2ff15d1161032b5780632f2ff15d146104e65780632f745c59146104f957806336568abe1461050c578063391feebb1461051f57600080fd5b806318160ddd1461049557806323b872dd1461049d578063248a9ca3146104b057806327aa38d5146104d357600080fd5b8063081812fc11610398578063081812fc14610420578063095ea7b31461044b578063156f1d7414610460578063162790551461048157600080fd5b8062f714ce146103be57806301ffc9a7146103e857806306fdde031461040b575b600080fd5b6103d16103cc366004614fd9565b610971565b6040516103df929190615044565b60405180910390f35b6103fb6103f6366004615073565b610ddd565b60405190151581526020016103df565b610413610dee565b6040516103df91906150e0565b61043361042e3660046150f3565b610e80565b6040516001600160a01b0390911681526020016103df565b61045e61045936600461510c565b610ea7565b005b61047361046e366004615138565b610fbc565b6040519081526020016103df565b6103fb61048f366004615164565b3b151590565b600a54610473565b61045e6104ab366004615181565b6110af565b6104736104be3660046150f3565b6000908152600c602052604090206001015490565b6104736104e13660046151c2565b6110e1565b61045e6104f4366004614fd9565b6111ce565b61047361050736600461510c565b6111f3565b61045e61051a366004614fd9565b611289565b6103fb61052d366004615164565b600d6020526000908152604090205460ff1681565b61045e611307565b61045e610558366004615181565b61131d565b61045e61056b3660046150f3565b611338565b610473601a5481565b610473611366565b61047361058f3660046150f3565b6113d9565b60015460ff166103fb565b61047360195481565b6104336105b63660046150f3565b61146c565b6105ce6105c93660046151f4565b6114cc565b6040516103df9190615216565b6106066105e93660046150f3565b6000908152601c6020526040902060018101546002909101549091565b604080519283526020830191909152016103df565b610473610629366004615164565b611622565b61045e61063c36600461537b565b6116a8565b61047360185481565b61045e611baf565b61045e61066036600461544b565b611c4c565b6104736106733660046151f4565b6000918252601b6020908152604080842092845291905290205490565b61045e611d8b565b6106ab6106a63660046150f3565b611d9e565b6040516103df919061550a565b61045e6106c63660046151f4565b611fcc565b6104736106d93660046155df565b611fec565b6104736106ec36600461560d565b612242565b6103fb6106ff366004614fd9565b6124a5565b6104736107123660046151f4565b6124d0565b61041361257f565b610473600081565b61045e61073536600461564e565b61258e565b61074d6107483660046150f3565b612599565b6040516103df95949392919061567c565b61045e61076c3660046150f3565b61266c565b61045e61077f366004615164565b6126b4565b601754610433906001600160a01b031681565b61045e6107a53660046156a7565b6126c8565b61045e6107b83660046156bf565b612712565b6104736107cb3660046150f3565b61274a565b6107e36107de366004615138565b6127b9565b604080519384526020840192909252908201526060016103df565b61045e61080c366004615164565b612809565b61047361081f3660046150f3565b61281d565b6104136108323660046150f3565b61284f565b61045e610845366004614fd9565b6128c2565b61045e61085836600461573f565b6128e7565b610413612932565b60105460115460125460135460145460155460165461089d966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e0016103df565b6103fb6108f436600461575d565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6106066109303660046155df565b6129c0565b6104737f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b600f546103fb9060ff1681565b610473612db3565b600060606002600054036109a05760405162461bcd60e51b81526004016109979061578b565b60405180910390fd5b60026000556109ad612dfd565b6109b5612e23565b60008060008060006109c689612599565b945094509450945094506109d984612e89565b6109e285612e96565b6109eb89611338565b6000858152601b602090815260408083208784529091528120805484908110610a1657610a166157c2565b60009182526020808320604080516060810182526003909402909101805484526001810154848401526002015483820152898452601c909152909120600a0154909150610a6290612eb3565b965060008160200151858360400151610a7b91906157ee565b610a859190615823565b600f5490915060009060ff16610ae857601a546000898152601c6020526040902060050154610ab491906157ee565b83516305f5e10090610acf90670de0b6b3a7640000906157ee565b610ad991906157ee565b610ae39190615823565b610b4d565b6000888152601c6020526040902060050154601a54610b0790896157ee565b610b1191906157ee565b670de0b6b3a76400006305f5e100808660000151610b2f91906157ee565b610b3991906157ee565b610b4391906157ee565b610b4d9190615823565b60208085015160008b8152601c9092526040909120600381015460069091015492935090918891610b81918b9086906110e1565b8560200151610b909190615837565b610b9a91906157ee565b610ba49190615823565b9950610bb0828b61584a565b995060005b8951811015610d5f57601a5487868381518110610bd457610bd46157c2565b6020026020010151601c60008d81526020019081526020016000206009018481548110610c0357610c036157c2565b9060005260206000200154610c189190615837565b610c2291906157ee565b610c2c9190615823565b8a8281518110610c3e57610c3e6157c2565b60200260200101818151610c52919061584a565b9052506000898152601d602090815260408083208b845290915290206003015415610cf6576000898152601d602090815260408083208b8452909152902060038101546005909101805483908110610cac57610cac6157c2565b906000526020600020015484610cc291906157ee565b610ccc9190615823565b8a8281518110610cde57610cde6157c2565b60200260200101818151610cf2919061584a565b9052505b610d578c8b8381518110610d0c57610d0c6157c2565b6020026020010151601c60008d8152602001908152602001600020600a018481548110610d3b57610d3b6157c2565b6000918252602090912001546001600160a01b03169190612efe565b600101610bb5565b50601754610d77906001600160a01b03168c8c612efe565b336001600160a01b03168b6001600160a01b03167f091323a211bfa86543b51f77a7a67270d25f9bd406aebf4d2382312c908462618e8d8d604051610dbe9392919061585d565b60405180910390a3505050505050505060016000819055509250929050565b6000610de882612f61565b92915050565b606060028054610dfd9061587c565b80601f0160208091040260200160405190810160405280929190818152602001828054610e299061587c565b8015610e765780601f10610e4b57610100808354040283529160200191610e76565b820191906000526020600020905b815481529060010190602001808311610e5957829003601f168201915b5050505050905090565b6000610e8b82612f86565b506000908152600660205260409020546001600160a01b031690565b6000610eb28261146c565b9050806001600160a01b0316836001600160a01b031603610f1f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610997565b336001600160a01b0382161480610f3b5750610f3b81336108f4565b610fad5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610997565b610fb78383612fe5565b505050565b601254600f5460009184916001600160a01b0390911690635b7b6d889060ff168588610fe6611366565b610fef8b61274a565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a401602060405180830381865afa158015611045573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106991906158b0565b61107391906157ee565b9050670de0b6b3a7640000611086612db3565b61109091906157ee565b601a5461109d90836157ee565b6110a79190615823565b949350505050565b6110ba335b82613053565b6110d65760405162461bcd60e51b8152600401610997906158c9565b610fb78383836130d1565b600f5460009060ff161561115d578484116110fd576000611156565b6305f5e10061111481670de0b6b3a76400006157ee565b61111e91906157ee565b601a5483908561112e8989615837565b61113891906157ee565b61114291906157ee565b61114c91906157ee565b6111569190615823565b90506110a7565b83851161116b5760006111c5565b6111816305f5e100670de0b6b3a76400006157ee565b8583601a5486888a6111939190615837565b61119d91906157ee565b6111a791906157ee565b6111b191906157ee565b6111bb9190615823565b6111c59190615823565b95945050505050565b6000828152600c60205260409020600101546111e981613278565b610fb78383613282565b60006111fe83611622565b82106112605760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610997565b506001600160a01b03919091166000908152600860209081526040808320938352929052205490565b6001600160a01b03811633146112f95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610997565b6113038282613308565b5050565b600061131281613278565b61131a61336f565b50565b610fb783838360405180602001604052806000815250612712565b611341336110b4565b61135d5760405162461bcd60e51b8152600401610997906158c9565b61131a816133b7565b60135460408051632347816960e11b815290516000926001600160a01b03169163468f02d29160048083019260209291908290030181865afa1580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d491906158b0565b905090565b60006113e4600a5490565b82106114475760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610997565b600a828154811061145a5761145a6157c2565b90600052602060002001549050919050565b6000818152600460205260408120546001600160a01b031680610de85760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610997565b6115156040518060e0016040528060006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6000838152601d60209081526040808320858452825291829020825160e08101845281546001600160a01b0316815260018201548184015260028201548185015260038201546060820152600482015460808201526005820180548551818602810186019096528086529194929360a086019392908301828280156115b957602002820191906000526020600020905b8154815260200190600101908083116115a5575b505050505081526020016006820180548060200260200160405190810160405280929190818152602001828054801561161157602002820191906000526020600020905b8154815260200190600101908083116115fd575b505050505081525050905092915050565b60006001600160a01b03821661168c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610997565b506001600160a01b031660009081526005602052604090205490565b6002600054036116ca5760405162461bcd60e51b81526004016109979061578b565b60026000557f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086116f981613278565b611701612dfd565b60006018546001611712919061584a565b9050611721844210600361345e565b60185415611749576018546000908152601c60205260409020546117499060ff16600461345e565b6000818152601c60209081526040909120865161176e92600790920191880190614f04565b506000818152601c60205260408082204260018201556002018690556018839055601154815163c4f59f9b60e01b815291516001600160a01b039091169163c4f59f9b91600480830192869291908290030181865afa1580156117d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117fd9190810190615917565b51905060008060005b88518110156119e657888181518110611821576118216157c2565b6020908102919091010151601654909350611844906001600160a01b031661347f565b9150816001600160a01b0316635edabd8b30600f60009054906101000a900460ff16868c600e601760009054906101000a90046001600160a01b03166001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156118bd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118e591908101906159a6565b8e6040518863ffffffff1660e01b81526004016119089796959493929190615a14565b600060405180830381600087803b15801561192257600080fd5b505af1158015611936573d6000803e3d6000fd5b5050506000868152601d60209081526040808320878452909152902080546001600160a01b0319166001600160a01b0385161790555061197584612eb3565b6000868152601d60209081526040808320878452825290912082516119a4936005909201929190910190614f04565b506119ae84612eb3565b6000868152601d60209081526040808320878452825290912082516119dd936006909201929190910190614f04565b50600101611806565b506119f083612eb3565b601c60008681526020019081526020016000206008019080519060200190611a19929190614f04565b50611a2383612eb3565b601c60008681526020019081526020016000206009019080519060200190611a4c929190614f04565b506011546040805163c4f59f9b60e01b815290516001600160a01b039092169163c4f59f9b916004808201926000929091908290030181865afa158015611a97573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611abf9190810190615917565b601c6000868152602001908152602001600020600a019080519060200190611ae8929190614f4f565b50600f5460ff1615611b2b57611afc612db3565b611b0a6305f5e100806157ee565b611b149190615823565b6000858152601c6020526040902060050155611b67565b611b33612db3565b6305f5e100611b40611366565b611b4a91906157ee565b611b549190615823565b6000858152601c60205260409020600501555b7fa65bbf2074405dcc0df5134b6ae33db0e62584996f2a786d1a30be9d8efcf90d8489604051611b98929190615044565b60405180910390a150506001600055505050505050565b611bb7612e23565b6018546000908152601c6020526040902060020154611bd9428210600161345e565b611bf360195482611bea919061584a565b4210600261345e565b61131a611bfe611366565b600f5460ff16611c3657611c10612db3565b6305f5e100611c1d611366565b611c2791906157ee565b611c319190615823565b61351c565b611c3e612db3565b611c276305f5e100806157ee565b6000611c5781613278565b611c5f6135e1565b8115611c935760405133904780156108fc02916000818181858888f19350505050158015611c91573d6000803e3d6000fd5b505b6000805b84811015611d5057858582818110611cb157611cb16157c2565b9050602002016020810190611cc69190615164565b6040516370a0823160e01b8152306004820152909250611d489033906001600160a01b038516906370a0823190602401602060405180830381865afa158015611d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3791906158b0565b6001600160a01b0385169190612efe565b600101611c97565b506040513381527f5e7b34819cd91b239220bec92fcfd3c10da2214ba13e4e2b1f6c9cfdbd68a9a29060200160405180910390a15050505050565b6000611d9681613278565b61131a613604565b611dfd604051806101600160405280600015158152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b6000828152601c6020908152604091829020825161016081018452815460ff16151581526001820154818401526002820154818501526003820154606082015260048201546080820152600582015460a0820152600682015460c08201526007820180548551818602810186019096528086529194929360e08601939290830182828015611eaa57602002820191906000526020600020905b815481526020019060010190808311611e96575b5050505050815260200160088201805480602002602001604051908101604052809291908181526020018280548015611f0257602002820191906000526020600020905b815481526020019060010190808311611eee575b5050505050815260200160098201805480602002602001604051908101604052809291908181526020018280548015611f5a57602002820191906000526020600020905b815481526020019060010190808311611f46575b50505050508152602001600a8201805480602002602001604051908101604052809291908181526020018280548015611fbc57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611f9e575b5050505050815250509050919050565b6000611fd781613278565b611fe2601854613648565b610fb7838361351c565b60006002600054036120105760405162461bcd60e51b81526004016109979061578b565b6002600055601854612020612dfd565b612028612e23565b61203181613648565b61203a84612e89565b6000818152601c6020526040812060070180548790811061205d5761205d6157c2565b9060005260206000200154905061207381612e89565b60175461208b906001600160a01b0316333088613666565b60115460405163534a7e1d60e11b81526004810187905260009161210c9184916001600160a01b03169063a694fc3a906024016000604051808303816000875af11580156120dd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121059190810190615b11565b600061369e565b9050600061211a8388613a0a565b905086601c600060185481526020019081526020016000206004016000828254612144919061584a565b90915550506018546000908152601d602090815260408083208684529091528120600101805489929061217890849061584a565b90915550612187905086613c11565b6040805160a08101825286815260208082018781528284018c815260608401878152608085018981526000888152601e8652969096208551815592516001840155905160028301555160038201559251805194995091936121ee9260048501920190614f04565b50506040518681523391506001600160a01b038816907fa3d2cbcb90e0658235d4ba62aed9a50c231df9bc5bbfb74c95badbc798f38d1a9060200160405180910390a3505060016000555090949350505050565b60006002600054036122665760405162461bcd60e51b81526004016109979061578b565b6002600055612273612dfd565b61227b612e23565b61228484612e89565b61228d83612e96565b6000838152601c602052604081206007018054879081106122b0576122b06157c2565b600091825260208083209190910154868352601d82526040808420828552909252918190205490516370a0823160e01b81523360048201529192506001600160a01b03169061235090879083906370a0823190602401602060405180830381865afa158015612323573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234791906158b0565b1015600a61345e565b60405163079cc67960e41b8152336004820152602481018790526001600160a01b038216906379cc679090604401600060405180830381600087803b15801561239857600080fd5b505af11580156123ac573d6000803e3d6000fd5b5050506000868152601c6020526040902060038101546006909101549091506123da90829085908a906110e1565b935060006123e78561281d565b90506123f285612e89565b60155460175461240f916001600160a01b03918216911683612efe565b6124308661241d8388615837565b6017546001600160a01b03169190612efe565b336001600160a01b0387167f4ab5b5ebf96669ee045b167a5af455fc9ef9757a07606c2145140e9af15c5da389878c612469878c615837565b6040805194855260208501939093529183015260608201526080810185905260a00160405180910390a350506001600055509095945050505050565b6000918252600c602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006124da612db3565b601a546010546001600160a01b031663e8468ee46124f6611366565b6040516001600160e01b031960e084901b16815260048101919091526024810188905260448101879052606401602060405180830381865afa158015612540573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256491906158b0565b61256e91906157ee565b6125789190615823565b9392505050565b606060038054610dfd9061587c565b611303338383613c36565b60008060008060606000601e60008881526020019081526020016000206040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820180548060200260200160405190810160405280929190818152602001828054801561263857602002820191906000526020600020905b815481526020019060010190808311612624575b5050509190925250508151602083015160408401516060850151608090950151929c919b5099509297509550909350505050565b600061267781613278565b60198290556040518281527f5259439c9ac2029585dd4a349897aa1e8298d26537c3b57453f275126db91918906020015b60405180910390a15050565b60006126bf81613278565b61130382613d04565b60006126d381613278565b8160106126e08282615bb7565b9050507f626084554ed3d487b613abf59611e713f22caa8095d0c7b0d16b226ea45c3bc4826040516126a89190615c74565b61271c3383613053565b6127385760405162461bcd60e51b8152600401610997906158c9565b61274484848484613e07565b50505050565b60145460405163c189c19b60e01b8152600481018390526000916001600160a01b03169063c189c19b906024015b602060405180830381865afa158015612795573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de891906158b0565b601b60205282600052604060002060205281600052604060002081815481106127e157600080fd5b6000918252602090912060039091020180546001820154600290920154909450909250905083565b600061281481613278565b61130382613e3a565b60105460405163c48ce05b60e01b8152600481018390526000916001600160a01b03169063c48ce05b90602401612778565b606061285a82612f86565b600061287160408051602081019091526000815290565b905060008151116128915760405180602001604052806000815250612578565b8061289b84613eeb565b6040516020016128ac929190615d24565b6040516020818303038152906040529392505050565b6000828152600c60205260409020600101546128dd81613278565b610fb78383613308565b60006128f281613278565b821561291557601154601754610fb7916001600160a01b03918216911684613fec565b601154601754610fb7916001600160a01b0391821691168461409f565b600e805461293f9061587c565b80601f016020809104026020016040519081016040528092919081815260200182805461296b9061587c565b80156129b85780601f1061298d576101008083540402835291602001916129b8565b820191906000526020600020905b81548152906001019060200180831161299b57829003601f168201915b505050505081565b6000806002600054036129e55760405162461bcd60e51b81526004016109979061578b565b60026000556129f2612dfd565b6129fa612e23565b612a0384612e89565b6018546000818152601c6020526040902060020154612a25428211600561345e565b6000828152601c60205260408120600701805489908110612a4857612a486157c2565b90600052602060002001549050612a5e81612e89565b6000838152601d6020908152604080832084845290915281206002810154600190910154612a8c9190615837565b600f5490915060009060ff16612aea57612ab2670de0b6b3a76400006305f5e1006157ee565b601a546000878152601c6020526040902060050154612ad1908c6157ee565b612adb91906157ee565b612ae59190615823565b612b48565b6305f5e100612b0181670de0b6b3a76400006157ee565b612b0b91906157ee565b6000868152601c6020526040902060050154601a54612b2a868d6157ee565b612b3491906157ee565b612b3e91906157ee565b612b489190615823565b9050612b57828210600661345e565b612b62838a86610fbc565b9650612b6e838a6124d0565b9550612b7b838289614135565b612b9e3330612b8a898b61584a565b6017546001600160a01b0316929190613666565b60115460405163534a7e1d60e11b815260048101899052612c1e9185916001600160a01b039091169063a694fc3a906024016000604051808303816000875af1158015612bef573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612c179190810190615b11565b600161369e565b506000858152601d6020908152604080832086845290915281206002018054839290612c4b90849061584a565b90915550506000858152601d6020908152604080832086845290915281206003018054899290612c7c90849061584a565b90915550506000858152601c602052604081206004018054899290612ca290849061584a565b9091555050601554601754612cc4916001600160a01b03918216911688612efe565b6000858152601d60209081526040808320868452909152908190205490516340c10f1960e01b81526001600160a01b038a81166004830152602482018c9052909116906340c10f1990604401600060405180830381600087803b158015612d2a57600080fd5b505af1158015612d3e573d6000803e3d6000fd5b505060408051888152602081018790529081018c9052606081018a9052608081018990523392506001600160a01b038b1691507f96d7fd34a786c8810a555ee775a241bf4b8f243f8e64aaf266ec5398d1199b0c9060a00160405180910390a350505050506001600081905550935093915050565b60135460408051633dda0eef60e21b815290516000926001600160a01b03169163f7683bbc9160048083019260209291908290030181865afa1580156113b0573d6000803e3d6000fd5b60015460ff1615612e215760405163ab35696f60e01b815260040160405180910390fd5b565b333214612e2157336000908152600d602052604090205460ff16612e215760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c6973746564000000006044820152606401610997565b61131a811515600861345e565b6000818152601c602052604090205461131a9060ff16600961345e565b60608167ffffffffffffffff811115612ece57612ece61528a565b604051908082528060200260200182016040528015612ef7578160200160208202803683370190505b5092915050565b6040516001600160a01b038316602482015260448101829052610fb790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614405565b60006001600160e01b03198216637965db0b60e01b1480610de85750610de8826144d7565b6000818152600460205260409020546001600160a01b031661131a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610997565b600081815260066020526040902080546001600160a01b0319166001600160a01b038416908117909155819061301a8261146c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061305f8361146c565b9050806001600160a01b0316846001600160a01b031614806130a657506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff165b806110a75750836001600160a01b03166130bf84610e80565b6001600160a01b031614949350505050565b826001600160a01b03166130e48261146c565b6001600160a01b0316146131485760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610997565b6001600160a01b0382166131aa5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610997565b6131b58383836144fc565b6131c0600082612fe5565b6001600160a01b03831660009081526005602052604081208054600192906131e9908490615837565b90915550506001600160a01b038216600090815260056020526040812080546001929061321790849061584a565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61131a813361450f565b61328c82826124a5565b611303576000828152600c602090815260408083206001600160a01b03851684529091529020805460ff191660011790556132c43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61331282826124a5565b15611303576000828152600c602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6133776135e1565b6001805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b60006133c28261146c565b90506133d0816000846144fc565b6133db600083612fe5565b6001600160a01b0381166000908152600560205260408120805460019290613404908490615837565b909155505060008281526004602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b8161130357604051639f2932cb60e01b815260048101829052602401610997565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b0381166135175760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610997565b919050565b60026000540361353e5760405162461bcd60e51b81526004016109979061578b565b600260005561354b612dfd565b613556601854613648565b601880546000908152601c60205260408082206003018590559154815220600601819055613582614573565b6018546000908152601c6020908152604091829020805460ff1916600117905581513381529081018490527feebcafefe23aabb68b4dab0cabce2ec0228ff1d73f042e91acdd09efd17845b2910160405180910390a150506001600055565b60015460ff16612e215760405163dcdde9dd60e01b815260040160405180910390fd5b61360c612dfd565b6001805460ff1916811790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258906020016133ad565b6000818152601c602052604090205461131a9060ff1615600761345e565b6040516001600160a01b03808516602483015283166044820152606481018290526127449085906323b872dd60e01b90608401612f2a565b60606136aa8351612eb3565b90506000805b8451811015613a01576018546000908152601c602052604090206008018054829081106136df576136df6157c2565b90600052602060002001548582815181106136fc576136fc6157c2565b602002602001015161370e9190615837565b9150848181518110613722576137226157c2565b6020026020010151601c600060185481526020019081526020016000206008018281548110613753576137536157c2565b9060005260206000200181905550601c60006018548152602001908152602001600020600401546000036137a6576000838281518110613795576137956157c2565b6020026020010181815250506137f1565b6018546000908152601c6020526040902060040154601a546137c890846157ee565b6137d29190615823565b8382815181106137e4576137e46157c2565b6020026020010181815250505b828181518110613803576138036157c2565b6020026020010151601c600060185481526020019081526020016000206009018281548110613834576138346157c2565b90600052602060002001600082825461384d919061584a565b909155505083156139ab57601a546018546000908152601d602090815260408083208a8452909152902060038101546006909101805484908110613893576138936157c2565b9060005260206000200154601c6000601854815260200190815260200160002060090184815481106138c7576138c76157c2565b90600052602060002001546138dc9190615837565b6138e691906157ee565b6138f09190615823565b6018546000908152601d602090815260408083208a84529091529020600501805483908110613921576139216157c2565b90600052602060002001600082825461393a919061584a565b90915550506018546000908152601c60205260409020600901805482908110613965576139656157c2565b60009182526020808320909101546018548352601d825260408084208a8552909252912060060180548390811061399e5761399e6157c2565b6000918252602090912001555b6018546000908152601c602052604090206009018054829081106139d1576139d16157c2565b90600052602060002001548382815181106139ee576139ee6157c2565b60209081029190910101526001016136b0565b50509392505050565b6018546000818152601b60209081526040808320868452909152812054909190808303613a94576000918252601b602090815260408084208785528252808420815160608101835285815280840188815292810186815282546001818101855593885294909620905160039094020192835590519082015591516002909201919091559050610de8565b6000828152601b602090815260408083208884529091528120613ab8600184615837565b81548110613ac857613ac86157c2565b600091825260209182902060408051606081018252600390930290910180548084526001820154948401949094526002015490820152915015613b6957506000918252601b602090815260408084208785528252808420815160608101835285815280840188815292810186815282546001818101855593885294909620905160039094020192835590519082015591516002909201919091559050610de8565b604051806060016040528082600001518152602001868360200151613b8e919061584a565b81526040808401516020928301526000868152601b83528181208a82529092529020613bbb600185615837565b81548110613bcb57613bcb6157c2565b9060005260206000209060030201600082015181600001556020820151816001015560408201518160020155905050600182613c079190615837565b9350505050610de8565b6000613c1c601f5490565b9050613c2c601f80546001019055565b6135178282614686565b816001600160a01b0316836001600160a01b031603613c975760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610997565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b803b613d525760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e74726163740000000000006044820152606401610997565b6001600160a01b0381166000908152600d602052604090205460ff1615613dbb5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c6973746564000000006044820152606401610997565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b613e128484846130d1565b613e1e848484846146a0565b6127445760405162461bcd60e51b815260040161099790615d53565b6001600160a01b0381166000908152600d602052604090205460ff16613ea25760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c697374656400000000000000006044820152606401610997565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b606081600003613f125750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613f3c5780613f2681615da5565b9150613f359050600a83615823565b9150613f16565b60008167ffffffffffffffff811115613f5757613f5761528a565b6040519080825280601f01601f191660200182016040528015613f81576020820181803683370190505b5090505b84156110a757613f96600183615837565b9150613fa3600a86615dbe565b613fae90603061584a565b60f81b818381518110613fc357613fc36157c2565b60200101906001600160f81b031916908160001a905350613fe5600a86615823565b9450613f85565b604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015260009161406c9184919087169063dd62ed3e90604401602060405180830381865afa158015614042573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061406691906158b0565b9061479e565b6040516001600160a01b03851660248201526044810182905290915061274490859063095ea7b360e01b90606401612f2a565b600061406c82604051806060016040528060298152602001615efe60299139604051636eb1769f60e11b81523060048201526001600160a01b03878116602483015288169063dd62ed3e90604401602060405180830381865afa15801561410a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061412e91906158b0565b91906147aa565b61415960405180606001604052806000815260200160008152602001600081525090565b6000601854905060008060008087601a548861417591906157ee565b61417f9190615823565b6000868152601d602090815260408083208d84529091529020600401549091505b888510156143f9576000868152601b602090815260408083208d845290915290208054829081106141d3576141d36157c2565b90600052602060002090600302016040518060600160405290816000820154815260200160018201548152602001600282015481525050965084896142189190615837565b8751602089015191945061422b91615837565b93508284106143005761423e838661584a565b6000878152601b602090815260408083208e84529091529020805491965084918390811061426e5761426e6157c2565b9060005260206000209060030201600001600082825461428e919061584a565b9091555050601a546142a083856157ee565b6142aa9190615823565b6000878152601b602090815260408083208e845290915290208054839081106142d5576142d56157c2565b906000526020600020906003020160020160008282546142f5919061584a565b909155506143d59050565b61430a848661584a565b6000878152601b602090815260408083208e84529091529020805491965085918390811061433a5761433a6157c2565b9060005260206000209060030201600001600082825461435a919061584a565b9091555050601a5461436c83866157ee565b6143769190615823565b6000878152601b602090815260408083208e845290915290208054839081106143a1576143a16157c2565b906000526020600020906003020160020160008282546143c1919061584a565b909155506143d2905060018261584a565b90505b6000868152601d602090815260408083208d845290915290206004018190556141a0565b50505050505050505050565b600061445a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147d69092919063ffffffff16565b805190915015610fb757808060200190518101906144789190615dd2565b610fb75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610997565b60006001600160e01b0319821663780e9d6360e01b1480610de85750610de8826147e5565b614504612dfd565b610fb7838383614835565b61451982826124a5565b61130357614531816001600160a01b031660146148ed565b61453c8360206148ed565b60405160200161454d929190615def565b60408051601f198184030181529082905262461bcd60e51b8252610997916004016150e0565b6018546000908152601c60209081526040808320600701805482518185028101850190935280835291929091908301828280156145cf57602002820191906000526020600020905b8154815260200190600101908083116145bb575b50506011546040805163016f7b3160e51b815290519596506000956001600160a01b039092169450632def6620935060048082019350869291829003018183875af1158015614622573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261464a9190810190615b11565b905060005b8251811015610fb75761467d83828151811061466d5761466d6157c2565b602002602001015183600161369e565b5060010161464f565b611303828260405180602001604052806000815250614a89565b60006001600160a01b0384163b1561479657604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906146e4903390899088908890600401615e64565b6020604051808303816000875af192505050801561471f575060408051601f3d908101601f1916820190925261471c91810190615e97565b60015b61477c573d80801561474d576040519150601f19603f3d011682016040523d82523d6000602084013e614752565b606091505b5080516000036147745760405162461bcd60e51b815260040161099790615d53565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506110a7565b5060016110a7565b6000612578828461584a565b600081848411156147ce5760405162461bcd60e51b815260040161099791906150e0565b505050900390565b60606110a78484600085614abc565b60006001600160e01b031982166380ac58cd60e01b148061481657506001600160e01b03198216635b5e139f60e01b145b80610de857506301ffc9a760e01b6001600160e01b0319831614610de8565b6001600160a01b0383166148905761488b81600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b6148b3565b816001600160a01b0316836001600160a01b0316146148b3576148b38382614bed565b6001600160a01b0382166148ca57610fb781614c8a565b826001600160a01b0316826001600160a01b031614610fb757610fb78282614d39565b606060006148fc8360026157ee565b61490790600261584a565b67ffffffffffffffff81111561491f5761491f61528a565b6040519080825280601f01601f191660200182016040528015614949576020820181803683370190505b509050600360fc1b81600081518110614964576149646157c2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614993576149936157c2565b60200101906001600160f81b031916908160001a90535060006149b78460026157ee565b6149c290600161584a565b90505b6001811115614a3a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106149f6576149f66157c2565b1a60f81b828281518110614a0c57614a0c6157c2565b60200101906001600160f81b031916908160001a90535060049490941c93614a3381615eb4565b90506149c5565b5083156125785760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610997565b614a938383614d7d565b614aa060008484846146a0565b610fb75760405162461bcd60e51b815260040161099790615d53565b606082471015614b1d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610997565b6001600160a01b0385163b614b745760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610997565b600080866001600160a01b03168587604051614b909190615ecb565b60006040518083038185875af1925050503d8060008114614bcd576040519150601f19603f3d011682016040523d82523d6000602084013e614bd2565b606091505b5091509150614be2828286614ecb565b979650505050505050565b60006001614bfa84611622565b614c049190615837565b600083815260096020526040902054909150808214614c57576001600160a01b03841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b5060009182526009602090815260408084208490556001600160a01b039094168352600881528383209183525290812055565b600a54600090614c9c90600190615837565b6000838152600b6020526040812054600a8054939450909284908110614cc457614cc46157c2565b9060005260206000200154905080600a8381548110614ce557614ce56157c2565b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a805480614d1d57614d1d615ee7565b6001900381819060005260206000200160009055905550505050565b6000614d4483611622565b6001600160a01b039093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b6001600160a01b038216614dd35760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610997565b6000818152600460205260409020546001600160a01b031615614e385760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610997565b614e44600083836144fc565b6001600160a01b0382166000908152600560205260408120805460019290614e6d90849061584a565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315614eda575081612578565b825115614eea5782518084602001fd5b8160405162461bcd60e51b815260040161099791906150e0565b828054828255906000526020600020908101928215614f3f579160200282015b82811115614f3f578251825591602001919060010190614f24565b50614f4b929150614fa4565b5090565b828054828255906000526020600020908101928215614f3f579160200282015b82811115614f3f57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614f6f565b5b80821115614f4b5760008155600101614fa5565b6001600160a01b038116811461131a57600080fd5b803561351781614fb9565b60008060408385031215614fec57600080fd5b823591506020830135614ffe81614fb9565b809150509250929050565b600081518084526020808501945080840160005b838110156150395781518752958201959082019060010161501d565b509495945050505050565b8281526040602082015260006110a76040830184615009565b6001600160e01b03198116811461131a57600080fd5b60006020828403121561508557600080fd5b81356125788161505d565b60005b838110156150ab578181015183820152602001615093565b50506000910152565b600081518084526150cc816020860160208601615090565b601f01601f19169290920160200192915050565b60208152600061257860208301846150b4565b60006020828403121561510557600080fd5b5035919050565b6000806040838503121561511f57600080fd5b823561512a81614fb9565b946020939093013593505050565b60008060006060848603121561514d57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561517657600080fd5b813561257881614fb9565b60008060006060848603121561519657600080fd5b83356151a181614fb9565b925060208401356151b181614fb9565b929592945050506040919091013590565b600080600080608085870312156151d857600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561520757600080fd5b50508035926020909101359150565b6020815260018060a01b038251166020820152602082015160408201526040820151606082015260608201516080820152608082015160a0820152600060a083015160e060c084015261526d610100840182615009565b905060c0840151601f198483030160e08501526111c58282615009565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156152c9576152c961528a565b604052919050565b600067ffffffffffffffff8211156152eb576152eb61528a565b5060051b60200190565b600067ffffffffffffffff82111561530f5761530f61528a565b50601f01601f191660200190565b600061533061532b846152f5565b6152a0565b905082815283838301111561534457600080fd5b828260208301376000602084830101529392505050565b600082601f83011261536c57600080fd5b6125788383356020850161531d565b60008060006060848603121561539057600080fd5b833567ffffffffffffffff808211156153a857600080fd5b818601915086601f8301126153bc57600080fd5b813560206153cc61532b836152d1565b82815260059290921b8401810191818101908a8411156153eb57600080fd5b948201945b83861015615409578535825294820194908201906153f0565b975050870135945050604086013591508082111561542657600080fd5b506154338682870161535b565b9150509250925092565b801515811461131a57600080fd5b60008060006040848603121561546057600080fd5b833567ffffffffffffffff8082111561547857600080fd5b818601915086601f83011261548c57600080fd5b81358181111561549b57600080fd5b8760208260051b85010111156154b057600080fd5b602092830195509350508401356154c68161543d565b809150509250925092565b600081518084526020808501945080840160005b838110156150395781516001600160a01b0316875295820195908201906001016154e5565b6020815261551d60208201835115159052565b602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e0820152600060e08301516101606101008181860152615579610180860184615009565b9250808601519050601f1961012081878603018188015261559a8584615009565b9450808801519250506101408187860301818801526155b98584615009565b9088015187820390920184880152935090506155d583826154d1565b9695505050505050565b6000806000606084860312156155f457600080fd5b833592506020840135915060408401356154c681614fb9565b6000806000806080858703121561562357600080fd5b843593506020850135925060408501359150606085013561564381614fb9565b939692955090935050565b6000806040838503121561566157600080fd5b823561566c81614fb9565b91506020830135614ffe8161543d565b85815284602082015283604082015282606082015260a060808201526000614be260a0830184615009565b600060e082840312156156b957600080fd5b50919050565b600080600080608085870312156156d557600080fd5b84356156e081614fb9565b935060208501356156f081614fb9565b925060408501359150606085013567ffffffffffffffff81111561571357600080fd5b8501601f8101871361572457600080fd5b6157338782356020840161531d565b91505092959194509250565b6000806040838503121561575257600080fd5b823561512a8161543d565b6000806040838503121561577057600080fd5b823561577b81614fb9565b91506020830135614ffe81614fb9565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615615808576158086157d8565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158325761583261580d565b500490565b81810381811115610de857610de86157d8565b80820180821115610de857610de86157d8565b8381528260208201526060604082015260006111c56060830184615009565b600181811c9082168061589057607f821691505b6020821081036156b957634e487b7160e01b600052602260045260246000fd5b6000602082840312156158c257600080fd5b5051919050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6000602080838503121561592a57600080fd5b825167ffffffffffffffff81111561594157600080fd5b8301601f8101851361595257600080fd5b805161596061532b826152d1565b81815260059190911b8201830190838101908783111561597f57600080fd5b928401925b82841015614be257835161599781614fb9565b82529284019290840190615984565b6000602082840312156159b857600080fd5b815167ffffffffffffffff8111156159cf57600080fd5b8201601f810184136159e057600080fd5b80516159ee61532b826152f5565b818152856020838501011115615a0357600080fd5b6111c5826020830160208601615090565b60018060a01b0388168152600060208815158184015287604084015286606084015260e060808401526000865481600182811c915080831680615a5857607f831692505b8583108103615a7557634e487b7160e01b85526022600452602485fd5b60e088018390526101008801818015615a955760018114615aab57615ad6565b60ff198616825284151560051b82019650615ad6565b60008d81526020902060005b86811015615ad057815484820152908501908901615ab7565b83019750505b50505050505083810360a0850152615aee81876150b4565b91505082810360c0840152615b0381856150b4565b9a9950505050505050505050565b60006020808385031215615b2457600080fd5b825167ffffffffffffffff811115615b3b57600080fd5b8301601f81018513615b4c57600080fd5b8051615b5a61532b826152d1565b81815260059190911b82018301908381019087831115615b7957600080fd5b928401925b82841015614be257835182529284019290840190615b7e565b80546001600160a01b0319166001600160a01b0392909216919091179055565b8135615bc281614fb9565b615bcc8183615b97565b506020820135615bdb81614fb9565b615be88160018401615b97565b506040820135615bf781614fb9565b615c048160028401615b97565b506060820135615c1381614fb9565b615c208160038401615b97565b506080820135615c2f81614fb9565b615c3c8160048401615b97565b5060a0820135615c4b81614fb9565b615c588160058401615b97565b5060c0820135615c6781614fb9565b610fb78160068401615b97565b60e081018235615c8381614fb9565b6001600160a01b039081168352602084013590615c9f82614fb9565b9081166020840152604084013590615cb682614fb9565b9081166040840152606084013590615ccd82614fb9565b9081166060840152608084013590615ce482614fb9565b166080830152615cf660a08401614fce565b6001600160a01b031660a0830152615d1060c08401614fce565b6001600160a01b03811660c0840152612ef7565b60008351615d36818460208801615090565b835190830190615d4a818360208801615090565b01949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060018201615db757615db76157d8565b5060010190565b600082615dcd57615dcd61580d565b500690565b600060208284031215615de457600080fd5b81516125788161543d565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615e27816017850160208801615090565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615e58816028840160208801615090565b01602801949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906155d5908301846150b4565b600060208284031215615ea957600080fd5b81516125788161505d565b600081615ec357615ec36157d8565b506000190190565b60008251615edd818460208701615090565b9190910192915050565b634e487b7160e01b600052603160045260246000fdfe5361666545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fc19cf3fca1ef84a91428542bb08cd4e47b45ca64f79b303f6f48ff81117549864736f6c63430008100033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103b95760003560e01c80637cdba760116101f4578063b375d4921161011a578063d8202b8b116100ad578063ea3bd5df1161007c578063ea3bd5df14610922578063ec87621c14610935578063f3c274a61461095c578063f7683bbc1461096957600080fd5b8063d8202b8b1461084a578063d90a730e1461085d578063da0321cd14610865578063e985e9c5146108e657600080fd5b8063c3d9ed39116100e9578063c3d9ed39146107fe578063c48ce05b14610811578063c87b56dd14610824578063d547741f1461083757600080fd5b8063b375d49214610797578063b88d4fde146107aa578063c189c19b146107bd578063c3cbb71c146107d057600080fd5b8063920023de11610192578063a624ec6311610161578063a624ec631461073a578063ab2150cf1461075e578063acc3a00614610771578063b2016bd41461078457600080fd5b8063920023de1461070457806395d89b4114610717578063a217fddf1461071f578063a22cb4651461072757600080fd5b806387d8ee9b116101ce57806387d8ee9b146106b85780638dbdbe6d146106cb57806391aee9a8146106de57806391d14854146106f157600080fd5b80637cdba760146106655780638456cb5914610690578063859e7d321461069857600080fd5b80633f4ba83a116102e45780636352211e11610277578063751eb65c11610246578063751eb65c1461062e578063766718081461064157806379599f961461064a5780637c4b52cb1461065257600080fd5b80636352211e146105a857806369e3b748146105bb5780636f56f56f146105db57806370a082311461061b57600080fd5b8063468f02d2116102b3578063468f02d2146105795780634f6ccce7146105815780635c975abb14610594578063616443731461059f57600080fd5b80633f4ba83a1461054257806342842e0e1461054a57806342966c681461055d578063430aea2e1461057057600080fd5b806318160ddd1161035c5780632f2ff15d1161032b5780632f2ff15d146104e65780632f745c59146104f957806336568abe1461050c578063391feebb1461051f57600080fd5b806318160ddd1461049557806323b872dd1461049d578063248a9ca3146104b057806327aa38d5146104d357600080fd5b8063081812fc11610398578063081812fc14610420578063095ea7b31461044b578063156f1d7414610460578063162790551461048157600080fd5b8062f714ce146103be57806301ffc9a7146103e857806306fdde031461040b575b600080fd5b6103d16103cc366004614fd9565b610971565b6040516103df929190615044565b60405180910390f35b6103fb6103f6366004615073565b610ddd565b60405190151581526020016103df565b610413610dee565b6040516103df91906150e0565b61043361042e3660046150f3565b610e80565b6040516001600160a01b0390911681526020016103df565b61045e61045936600461510c565b610ea7565b005b61047361046e366004615138565b610fbc565b6040519081526020016103df565b6103fb61048f366004615164565b3b151590565b600a54610473565b61045e6104ab366004615181565b6110af565b6104736104be3660046150f3565b6000908152600c602052604090206001015490565b6104736104e13660046151c2565b6110e1565b61045e6104f4366004614fd9565b6111ce565b61047361050736600461510c565b6111f3565b61045e61051a366004614fd9565b611289565b6103fb61052d366004615164565b600d6020526000908152604090205460ff1681565b61045e611307565b61045e610558366004615181565b61131d565b61045e61056b3660046150f3565b611338565b610473601a5481565b610473611366565b61047361058f3660046150f3565b6113d9565b60015460ff166103fb565b61047360195481565b6104336105b63660046150f3565b61146c565b6105ce6105c93660046151f4565b6114cc565b6040516103df9190615216565b6106066105e93660046150f3565b6000908152601c6020526040902060018101546002909101549091565b604080519283526020830191909152016103df565b610473610629366004615164565b611622565b61045e61063c36600461537b565b6116a8565b61047360185481565b61045e611baf565b61045e61066036600461544b565b611c4c565b6104736106733660046151f4565b6000918252601b6020908152604080842092845291905290205490565b61045e611d8b565b6106ab6106a63660046150f3565b611d9e565b6040516103df919061550a565b61045e6106c63660046151f4565b611fcc565b6104736106d93660046155df565b611fec565b6104736106ec36600461560d565b612242565b6103fb6106ff366004614fd9565b6124a5565b6104736107123660046151f4565b6124d0565b61041361257f565b610473600081565b61045e61073536600461564e565b61258e565b61074d6107483660046150f3565b612599565b6040516103df95949392919061567c565b61045e61076c3660046150f3565b61266c565b61045e61077f366004615164565b6126b4565b601754610433906001600160a01b031681565b61045e6107a53660046156a7565b6126c8565b61045e6107b83660046156bf565b612712565b6104736107cb3660046150f3565b61274a565b6107e36107de366004615138565b6127b9565b604080519384526020840192909252908201526060016103df565b61045e61080c366004615164565b612809565b61047361081f3660046150f3565b61281d565b6104136108323660046150f3565b61284f565b61045e610845366004614fd9565b6128c2565b61045e61085836600461573f565b6128e7565b610413612932565b60105460115460125460135460145460155460165461089d966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e0016103df565b6103fb6108f436600461575d565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6106066109303660046155df565b6129c0565b6104737f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b600f546103fb9060ff1681565b610473612db3565b600060606002600054036109a05760405162461bcd60e51b81526004016109979061578b565b60405180910390fd5b60026000556109ad612dfd565b6109b5612e23565b60008060008060006109c689612599565b945094509450945094506109d984612e89565b6109e285612e96565b6109eb89611338565b6000858152601b602090815260408083208784529091528120805484908110610a1657610a166157c2565b60009182526020808320604080516060810182526003909402909101805484526001810154848401526002015483820152898452601c909152909120600a0154909150610a6290612eb3565b965060008160200151858360400151610a7b91906157ee565b610a859190615823565b600f5490915060009060ff16610ae857601a546000898152601c6020526040902060050154610ab491906157ee565b83516305f5e10090610acf90670de0b6b3a7640000906157ee565b610ad991906157ee565b610ae39190615823565b610b4d565b6000888152601c6020526040902060050154601a54610b0790896157ee565b610b1191906157ee565b670de0b6b3a76400006305f5e100808660000151610b2f91906157ee565b610b3991906157ee565b610b4391906157ee565b610b4d9190615823565b60208085015160008b8152601c9092526040909120600381015460069091015492935090918891610b81918b9086906110e1565b8560200151610b909190615837565b610b9a91906157ee565b610ba49190615823565b9950610bb0828b61584a565b995060005b8951811015610d5f57601a5487868381518110610bd457610bd46157c2565b6020026020010151601c60008d81526020019081526020016000206009018481548110610c0357610c036157c2565b9060005260206000200154610c189190615837565b610c2291906157ee565b610c2c9190615823565b8a8281518110610c3e57610c3e6157c2565b60200260200101818151610c52919061584a565b9052506000898152601d602090815260408083208b845290915290206003015415610cf6576000898152601d602090815260408083208b8452909152902060038101546005909101805483908110610cac57610cac6157c2565b906000526020600020015484610cc291906157ee565b610ccc9190615823565b8a8281518110610cde57610cde6157c2565b60200260200101818151610cf2919061584a565b9052505b610d578c8b8381518110610d0c57610d0c6157c2565b6020026020010151601c60008d8152602001908152602001600020600a018481548110610d3b57610d3b6157c2565b6000918252602090912001546001600160a01b03169190612efe565b600101610bb5565b50601754610d77906001600160a01b03168c8c612efe565b336001600160a01b03168b6001600160a01b03167f091323a211bfa86543b51f77a7a67270d25f9bd406aebf4d2382312c908462618e8d8d604051610dbe9392919061585d565b60405180910390a3505050505050505060016000819055509250929050565b6000610de882612f61565b92915050565b606060028054610dfd9061587c565b80601f0160208091040260200160405190810160405280929190818152602001828054610e299061587c565b8015610e765780601f10610e4b57610100808354040283529160200191610e76565b820191906000526020600020905b815481529060010190602001808311610e5957829003601f168201915b5050505050905090565b6000610e8b82612f86565b506000908152600660205260409020546001600160a01b031690565b6000610eb28261146c565b9050806001600160a01b0316836001600160a01b031603610f1f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610997565b336001600160a01b0382161480610f3b5750610f3b81336108f4565b610fad5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610997565b610fb78383612fe5565b505050565b601254600f5460009184916001600160a01b0390911690635b7b6d889060ff168588610fe6611366565b610fef8b61274a565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a401602060405180830381865afa158015611045573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106991906158b0565b61107391906157ee565b9050670de0b6b3a7640000611086612db3565b61109091906157ee565b601a5461109d90836157ee565b6110a79190615823565b949350505050565b6110ba335b82613053565b6110d65760405162461bcd60e51b8152600401610997906158c9565b610fb78383836130d1565b600f5460009060ff161561115d578484116110fd576000611156565b6305f5e10061111481670de0b6b3a76400006157ee565b61111e91906157ee565b601a5483908561112e8989615837565b61113891906157ee565b61114291906157ee565b61114c91906157ee565b6111569190615823565b90506110a7565b83851161116b5760006111c5565b6111816305f5e100670de0b6b3a76400006157ee565b8583601a5486888a6111939190615837565b61119d91906157ee565b6111a791906157ee565b6111b191906157ee565b6111bb9190615823565b6111c59190615823565b95945050505050565b6000828152600c60205260409020600101546111e981613278565b610fb78383613282565b60006111fe83611622565b82106112605760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610997565b506001600160a01b03919091166000908152600860209081526040808320938352929052205490565b6001600160a01b03811633146112f95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610997565b6113038282613308565b5050565b600061131281613278565b61131a61336f565b50565b610fb783838360405180602001604052806000815250612712565b611341336110b4565b61135d5760405162461bcd60e51b8152600401610997906158c9565b61131a816133b7565b60135460408051632347816960e11b815290516000926001600160a01b03169163468f02d29160048083019260209291908290030181865afa1580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d491906158b0565b905090565b60006113e4600a5490565b82106114475760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610997565b600a828154811061145a5761145a6157c2565b90600052602060002001549050919050565b6000818152600460205260408120546001600160a01b031680610de85760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610997565b6115156040518060e0016040528060006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6000838152601d60209081526040808320858452825291829020825160e08101845281546001600160a01b0316815260018201548184015260028201548185015260038201546060820152600482015460808201526005820180548551818602810186019096528086529194929360a086019392908301828280156115b957602002820191906000526020600020905b8154815260200190600101908083116115a5575b505050505081526020016006820180548060200260200160405190810160405280929190818152602001828054801561161157602002820191906000526020600020905b8154815260200190600101908083116115fd575b505050505081525050905092915050565b60006001600160a01b03821661168c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610997565b506001600160a01b031660009081526005602052604090205490565b6002600054036116ca5760405162461bcd60e51b81526004016109979061578b565b60026000557f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086116f981613278565b611701612dfd565b60006018546001611712919061584a565b9050611721844210600361345e565b60185415611749576018546000908152601c60205260409020546117499060ff16600461345e565b6000818152601c60209081526040909120865161176e92600790920191880190614f04565b506000818152601c60205260408082204260018201556002018690556018839055601154815163c4f59f9b60e01b815291516001600160a01b039091169163c4f59f9b91600480830192869291908290030181865afa1580156117d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117fd9190810190615917565b51905060008060005b88518110156119e657888181518110611821576118216157c2565b6020908102919091010151601654909350611844906001600160a01b031661347f565b9150816001600160a01b0316635edabd8b30600f60009054906101000a900460ff16868c600e601760009054906101000a90046001600160a01b03166001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156118bd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118e591908101906159a6565b8e6040518863ffffffff1660e01b81526004016119089796959493929190615a14565b600060405180830381600087803b15801561192257600080fd5b505af1158015611936573d6000803e3d6000fd5b5050506000868152601d60209081526040808320878452909152902080546001600160a01b0319166001600160a01b0385161790555061197584612eb3565b6000868152601d60209081526040808320878452825290912082516119a4936005909201929190910190614f04565b506119ae84612eb3565b6000868152601d60209081526040808320878452825290912082516119dd936006909201929190910190614f04565b50600101611806565b506119f083612eb3565b601c60008681526020019081526020016000206008019080519060200190611a19929190614f04565b50611a2383612eb3565b601c60008681526020019081526020016000206009019080519060200190611a4c929190614f04565b506011546040805163c4f59f9b60e01b815290516001600160a01b039092169163c4f59f9b916004808201926000929091908290030181865afa158015611a97573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611abf9190810190615917565b601c6000868152602001908152602001600020600a019080519060200190611ae8929190614f4f565b50600f5460ff1615611b2b57611afc612db3565b611b0a6305f5e100806157ee565b611b149190615823565b6000858152601c6020526040902060050155611b67565b611b33612db3565b6305f5e100611b40611366565b611b4a91906157ee565b611b549190615823565b6000858152601c60205260409020600501555b7fa65bbf2074405dcc0df5134b6ae33db0e62584996f2a786d1a30be9d8efcf90d8489604051611b98929190615044565b60405180910390a150506001600055505050505050565b611bb7612e23565b6018546000908152601c6020526040902060020154611bd9428210600161345e565b611bf360195482611bea919061584a565b4210600261345e565b61131a611bfe611366565b600f5460ff16611c3657611c10612db3565b6305f5e100611c1d611366565b611c2791906157ee565b611c319190615823565b61351c565b611c3e612db3565b611c276305f5e100806157ee565b6000611c5781613278565b611c5f6135e1565b8115611c935760405133904780156108fc02916000818181858888f19350505050158015611c91573d6000803e3d6000fd5b505b6000805b84811015611d5057858582818110611cb157611cb16157c2565b9050602002016020810190611cc69190615164565b6040516370a0823160e01b8152306004820152909250611d489033906001600160a01b038516906370a0823190602401602060405180830381865afa158015611d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3791906158b0565b6001600160a01b0385169190612efe565b600101611c97565b506040513381527f5e7b34819cd91b239220bec92fcfd3c10da2214ba13e4e2b1f6c9cfdbd68a9a29060200160405180910390a15050505050565b6000611d9681613278565b61131a613604565b611dfd604051806101600160405280600015158152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b6000828152601c6020908152604091829020825161016081018452815460ff16151581526001820154818401526002820154818501526003820154606082015260048201546080820152600582015460a0820152600682015460c08201526007820180548551818602810186019096528086529194929360e08601939290830182828015611eaa57602002820191906000526020600020905b815481526020019060010190808311611e96575b5050505050815260200160088201805480602002602001604051908101604052809291908181526020018280548015611f0257602002820191906000526020600020905b815481526020019060010190808311611eee575b5050505050815260200160098201805480602002602001604051908101604052809291908181526020018280548015611f5a57602002820191906000526020600020905b815481526020019060010190808311611f46575b50505050508152602001600a8201805480602002602001604051908101604052809291908181526020018280548015611fbc57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611f9e575b5050505050815250509050919050565b6000611fd781613278565b611fe2601854613648565b610fb7838361351c565b60006002600054036120105760405162461bcd60e51b81526004016109979061578b565b6002600055601854612020612dfd565b612028612e23565b61203181613648565b61203a84612e89565b6000818152601c6020526040812060070180548790811061205d5761205d6157c2565b9060005260206000200154905061207381612e89565b60175461208b906001600160a01b0316333088613666565b60115460405163534a7e1d60e11b81526004810187905260009161210c9184916001600160a01b03169063a694fc3a906024016000604051808303816000875af11580156120dd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121059190810190615b11565b600061369e565b9050600061211a8388613a0a565b905086601c600060185481526020019081526020016000206004016000828254612144919061584a565b90915550506018546000908152601d602090815260408083208684529091528120600101805489929061217890849061584a565b90915550612187905086613c11565b6040805160a08101825286815260208082018781528284018c815260608401878152608085018981526000888152601e8652969096208551815592516001840155905160028301555160038201559251805194995091936121ee9260048501920190614f04565b50506040518681523391506001600160a01b038816907fa3d2cbcb90e0658235d4ba62aed9a50c231df9bc5bbfb74c95badbc798f38d1a9060200160405180910390a3505060016000555090949350505050565b60006002600054036122665760405162461bcd60e51b81526004016109979061578b565b6002600055612273612dfd565b61227b612e23565b61228484612e89565b61228d83612e96565b6000838152601c602052604081206007018054879081106122b0576122b06157c2565b600091825260208083209190910154868352601d82526040808420828552909252918190205490516370a0823160e01b81523360048201529192506001600160a01b03169061235090879083906370a0823190602401602060405180830381865afa158015612323573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234791906158b0565b1015600a61345e565b60405163079cc67960e41b8152336004820152602481018790526001600160a01b038216906379cc679090604401600060405180830381600087803b15801561239857600080fd5b505af11580156123ac573d6000803e3d6000fd5b5050506000868152601c6020526040902060038101546006909101549091506123da90829085908a906110e1565b935060006123e78561281d565b90506123f285612e89565b60155460175461240f916001600160a01b03918216911683612efe565b6124308661241d8388615837565b6017546001600160a01b03169190612efe565b336001600160a01b0387167f4ab5b5ebf96669ee045b167a5af455fc9ef9757a07606c2145140e9af15c5da389878c612469878c615837565b6040805194855260208501939093529183015260608201526080810185905260a00160405180910390a350506001600055509095945050505050565b6000918252600c602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006124da612db3565b601a546010546001600160a01b031663e8468ee46124f6611366565b6040516001600160e01b031960e084901b16815260048101919091526024810188905260448101879052606401602060405180830381865afa158015612540573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256491906158b0565b61256e91906157ee565b6125789190615823565b9392505050565b606060038054610dfd9061587c565b611303338383613c36565b60008060008060606000601e60008881526020019081526020016000206040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820180548060200260200160405190810160405280929190818152602001828054801561263857602002820191906000526020600020905b815481526020019060010190808311612624575b5050509190925250508151602083015160408401516060850151608090950151929c919b5099509297509550909350505050565b600061267781613278565b60198290556040518281527f5259439c9ac2029585dd4a349897aa1e8298d26537c3b57453f275126db91918906020015b60405180910390a15050565b60006126bf81613278565b61130382613d04565b60006126d381613278565b8160106126e08282615bb7565b9050507f626084554ed3d487b613abf59611e713f22caa8095d0c7b0d16b226ea45c3bc4826040516126a89190615c74565b61271c3383613053565b6127385760405162461bcd60e51b8152600401610997906158c9565b61274484848484613e07565b50505050565b60145460405163c189c19b60e01b8152600481018390526000916001600160a01b03169063c189c19b906024015b602060405180830381865afa158015612795573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de891906158b0565b601b60205282600052604060002060205281600052604060002081815481106127e157600080fd5b6000918252602090912060039091020180546001820154600290920154909450909250905083565b600061281481613278565b61130382613e3a565b60105460405163c48ce05b60e01b8152600481018390526000916001600160a01b03169063c48ce05b90602401612778565b606061285a82612f86565b600061287160408051602081019091526000815290565b905060008151116128915760405180602001604052806000815250612578565b8061289b84613eeb565b6040516020016128ac929190615d24565b6040516020818303038152906040529392505050565b6000828152600c60205260409020600101546128dd81613278565b610fb78383613308565b60006128f281613278565b821561291557601154601754610fb7916001600160a01b03918216911684613fec565b601154601754610fb7916001600160a01b0391821691168461409f565b600e805461293f9061587c565b80601f016020809104026020016040519081016040528092919081815260200182805461296b9061587c565b80156129b85780601f1061298d576101008083540402835291602001916129b8565b820191906000526020600020905b81548152906001019060200180831161299b57829003601f168201915b505050505081565b6000806002600054036129e55760405162461bcd60e51b81526004016109979061578b565b60026000556129f2612dfd565b6129fa612e23565b612a0384612e89565b6018546000818152601c6020526040902060020154612a25428211600561345e565b6000828152601c60205260408120600701805489908110612a4857612a486157c2565b90600052602060002001549050612a5e81612e89565b6000838152601d6020908152604080832084845290915281206002810154600190910154612a8c9190615837565b600f5490915060009060ff16612aea57612ab2670de0b6b3a76400006305f5e1006157ee565b601a546000878152601c6020526040902060050154612ad1908c6157ee565b612adb91906157ee565b612ae59190615823565b612b48565b6305f5e100612b0181670de0b6b3a76400006157ee565b612b0b91906157ee565b6000868152601c6020526040902060050154601a54612b2a868d6157ee565b612b3491906157ee565b612b3e91906157ee565b612b489190615823565b9050612b57828210600661345e565b612b62838a86610fbc565b9650612b6e838a6124d0565b9550612b7b838289614135565b612b9e3330612b8a898b61584a565b6017546001600160a01b0316929190613666565b60115460405163534a7e1d60e11b815260048101899052612c1e9185916001600160a01b039091169063a694fc3a906024016000604051808303816000875af1158015612bef573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612c179190810190615b11565b600161369e565b506000858152601d6020908152604080832086845290915281206002018054839290612c4b90849061584a565b90915550506000858152601d6020908152604080832086845290915281206003018054899290612c7c90849061584a565b90915550506000858152601c602052604081206004018054899290612ca290849061584a565b9091555050601554601754612cc4916001600160a01b03918216911688612efe565b6000858152601d60209081526040808320868452909152908190205490516340c10f1960e01b81526001600160a01b038a81166004830152602482018c9052909116906340c10f1990604401600060405180830381600087803b158015612d2a57600080fd5b505af1158015612d3e573d6000803e3d6000fd5b505060408051888152602081018790529081018c9052606081018a9052608081018990523392506001600160a01b038b1691507f96d7fd34a786c8810a555ee775a241bf4b8f243f8e64aaf266ec5398d1199b0c9060a00160405180910390a350505050506001600081905550935093915050565b60135460408051633dda0eef60e21b815290516000926001600160a01b03169163f7683bbc9160048083019260209291908290030181865afa1580156113b0573d6000803e3d6000fd5b60015460ff1615612e215760405163ab35696f60e01b815260040160405180910390fd5b565b333214612e2157336000908152600d602052604090205460ff16612e215760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c6973746564000000006044820152606401610997565b61131a811515600861345e565b6000818152601c602052604090205461131a9060ff16600961345e565b60608167ffffffffffffffff811115612ece57612ece61528a565b604051908082528060200260200182016040528015612ef7578160200160208202803683370190505b5092915050565b6040516001600160a01b038316602482015260448101829052610fb790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614405565b60006001600160e01b03198216637965db0b60e01b1480610de85750610de8826144d7565b6000818152600460205260409020546001600160a01b031661131a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610997565b600081815260066020526040902080546001600160a01b0319166001600160a01b038416908117909155819061301a8261146c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061305f8361146c565b9050806001600160a01b0316846001600160a01b031614806130a657506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff165b806110a75750836001600160a01b03166130bf84610e80565b6001600160a01b031614949350505050565b826001600160a01b03166130e48261146c565b6001600160a01b0316146131485760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610997565b6001600160a01b0382166131aa5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610997565b6131b58383836144fc565b6131c0600082612fe5565b6001600160a01b03831660009081526005602052604081208054600192906131e9908490615837565b90915550506001600160a01b038216600090815260056020526040812080546001929061321790849061584a565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61131a813361450f565b61328c82826124a5565b611303576000828152600c602090815260408083206001600160a01b03851684529091529020805460ff191660011790556132c43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61331282826124a5565b15611303576000828152600c602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6133776135e1565b6001805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b60006133c28261146c565b90506133d0816000846144fc565b6133db600083612fe5565b6001600160a01b0381166000908152600560205260408120805460019290613404908490615837565b909155505060008281526004602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b8161130357604051639f2932cb60e01b815260048101829052602401610997565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b0381166135175760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610997565b919050565b60026000540361353e5760405162461bcd60e51b81526004016109979061578b565b600260005561354b612dfd565b613556601854613648565b601880546000908152601c60205260408082206003018590559154815220600601819055613582614573565b6018546000908152601c6020908152604091829020805460ff1916600117905581513381529081018490527feebcafefe23aabb68b4dab0cabce2ec0228ff1d73f042e91acdd09efd17845b2910160405180910390a150506001600055565b60015460ff16612e215760405163dcdde9dd60e01b815260040160405180910390fd5b61360c612dfd565b6001805460ff1916811790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258906020016133ad565b6000818152601c602052604090205461131a9060ff1615600761345e565b6040516001600160a01b03808516602483015283166044820152606481018290526127449085906323b872dd60e01b90608401612f2a565b60606136aa8351612eb3565b90506000805b8451811015613a01576018546000908152601c602052604090206008018054829081106136df576136df6157c2565b90600052602060002001548582815181106136fc576136fc6157c2565b602002602001015161370e9190615837565b9150848181518110613722576137226157c2565b6020026020010151601c600060185481526020019081526020016000206008018281548110613753576137536157c2565b9060005260206000200181905550601c60006018548152602001908152602001600020600401546000036137a6576000838281518110613795576137956157c2565b6020026020010181815250506137f1565b6018546000908152601c6020526040902060040154601a546137c890846157ee565b6137d29190615823565b8382815181106137e4576137e46157c2565b6020026020010181815250505b828181518110613803576138036157c2565b6020026020010151601c600060185481526020019081526020016000206009018281548110613834576138346157c2565b90600052602060002001600082825461384d919061584a565b909155505083156139ab57601a546018546000908152601d602090815260408083208a8452909152902060038101546006909101805484908110613893576138936157c2565b9060005260206000200154601c6000601854815260200190815260200160002060090184815481106138c7576138c76157c2565b90600052602060002001546138dc9190615837565b6138e691906157ee565b6138f09190615823565b6018546000908152601d602090815260408083208a84529091529020600501805483908110613921576139216157c2565b90600052602060002001600082825461393a919061584a565b90915550506018546000908152601c60205260409020600901805482908110613965576139656157c2565b60009182526020808320909101546018548352601d825260408084208a8552909252912060060180548390811061399e5761399e6157c2565b6000918252602090912001555b6018546000908152601c602052604090206009018054829081106139d1576139d16157c2565b90600052602060002001548382815181106139ee576139ee6157c2565b60209081029190910101526001016136b0565b50509392505050565b6018546000818152601b60209081526040808320868452909152812054909190808303613a94576000918252601b602090815260408084208785528252808420815160608101835285815280840188815292810186815282546001818101855593885294909620905160039094020192835590519082015591516002909201919091559050610de8565b6000828152601b602090815260408083208884529091528120613ab8600184615837565b81548110613ac857613ac86157c2565b600091825260209182902060408051606081018252600390930290910180548084526001820154948401949094526002015490820152915015613b6957506000918252601b602090815260408084208785528252808420815160608101835285815280840188815292810186815282546001818101855593885294909620905160039094020192835590519082015591516002909201919091559050610de8565b604051806060016040528082600001518152602001868360200151613b8e919061584a565b81526040808401516020928301526000868152601b83528181208a82529092529020613bbb600185615837565b81548110613bcb57613bcb6157c2565b9060005260206000209060030201600082015181600001556020820151816001015560408201518160020155905050600182613c079190615837565b9350505050610de8565b6000613c1c601f5490565b9050613c2c601f80546001019055565b6135178282614686565b816001600160a01b0316836001600160a01b031603613c975760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610997565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b803b613d525760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e74726163740000000000006044820152606401610997565b6001600160a01b0381166000908152600d602052604090205460ff1615613dbb5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c6973746564000000006044820152606401610997565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b613e128484846130d1565b613e1e848484846146a0565b6127445760405162461bcd60e51b815260040161099790615d53565b6001600160a01b0381166000908152600d602052604090205460ff16613ea25760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c697374656400000000000000006044820152606401610997565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b606081600003613f125750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613f3c5780613f2681615da5565b9150613f359050600a83615823565b9150613f16565b60008167ffffffffffffffff811115613f5757613f5761528a565b6040519080825280601f01601f191660200182016040528015613f81576020820181803683370190505b5090505b84156110a757613f96600183615837565b9150613fa3600a86615dbe565b613fae90603061584a565b60f81b818381518110613fc357613fc36157c2565b60200101906001600160f81b031916908160001a905350613fe5600a86615823565b9450613f85565b604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015260009161406c9184919087169063dd62ed3e90604401602060405180830381865afa158015614042573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061406691906158b0565b9061479e565b6040516001600160a01b03851660248201526044810182905290915061274490859063095ea7b360e01b90606401612f2a565b600061406c82604051806060016040528060298152602001615efe60299139604051636eb1769f60e11b81523060048201526001600160a01b03878116602483015288169063dd62ed3e90604401602060405180830381865afa15801561410a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061412e91906158b0565b91906147aa565b61415960405180606001604052806000815260200160008152602001600081525090565b6000601854905060008060008087601a548861417591906157ee565b61417f9190615823565b6000868152601d602090815260408083208d84529091529020600401549091505b888510156143f9576000868152601b602090815260408083208d845290915290208054829081106141d3576141d36157c2565b90600052602060002090600302016040518060600160405290816000820154815260200160018201548152602001600282015481525050965084896142189190615837565b8751602089015191945061422b91615837565b93508284106143005761423e838661584a565b6000878152601b602090815260408083208e84529091529020805491965084918390811061426e5761426e6157c2565b9060005260206000209060030201600001600082825461428e919061584a565b9091555050601a546142a083856157ee565b6142aa9190615823565b6000878152601b602090815260408083208e845290915290208054839081106142d5576142d56157c2565b906000526020600020906003020160020160008282546142f5919061584a565b909155506143d59050565b61430a848661584a565b6000878152601b602090815260408083208e84529091529020805491965085918390811061433a5761433a6157c2565b9060005260206000209060030201600001600082825461435a919061584a565b9091555050601a5461436c83866157ee565b6143769190615823565b6000878152601b602090815260408083208e845290915290208054839081106143a1576143a16157c2565b906000526020600020906003020160020160008282546143c1919061584a565b909155506143d2905060018261584a565b90505b6000868152601d602090815260408083208d845290915290206004018190556141a0565b50505050505050505050565b600061445a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147d69092919063ffffffff16565b805190915015610fb757808060200190518101906144789190615dd2565b610fb75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610997565b60006001600160e01b0319821663780e9d6360e01b1480610de85750610de8826147e5565b614504612dfd565b610fb7838383614835565b61451982826124a5565b61130357614531816001600160a01b031660146148ed565b61453c8360206148ed565b60405160200161454d929190615def565b60408051601f198184030181529082905262461bcd60e51b8252610997916004016150e0565b6018546000908152601c60209081526040808320600701805482518185028101850190935280835291929091908301828280156145cf57602002820191906000526020600020905b8154815260200190600101908083116145bb575b50506011546040805163016f7b3160e51b815290519596506000956001600160a01b039092169450632def6620935060048082019350869291829003018183875af1158015614622573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261464a9190810190615b11565b905060005b8251811015610fb75761467d83828151811061466d5761466d6157c2565b602002602001015183600161369e565b5060010161464f565b611303828260405180602001604052806000815250614a89565b60006001600160a01b0384163b1561479657604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906146e4903390899088908890600401615e64565b6020604051808303816000875af192505050801561471f575060408051601f3d908101601f1916820190925261471c91810190615e97565b60015b61477c573d80801561474d576040519150601f19603f3d011682016040523d82523d6000602084013e614752565b606091505b5080516000036147745760405162461bcd60e51b815260040161099790615d53565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506110a7565b5060016110a7565b6000612578828461584a565b600081848411156147ce5760405162461bcd60e51b815260040161099791906150e0565b505050900390565b60606110a78484600085614abc565b60006001600160e01b031982166380ac58cd60e01b148061481657506001600160e01b03198216635b5e139f60e01b145b80610de857506301ffc9a760e01b6001600160e01b0319831614610de8565b6001600160a01b0383166148905761488b81600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b6148b3565b816001600160a01b0316836001600160a01b0316146148b3576148b38382614bed565b6001600160a01b0382166148ca57610fb781614c8a565b826001600160a01b0316826001600160a01b031614610fb757610fb78282614d39565b606060006148fc8360026157ee565b61490790600261584a565b67ffffffffffffffff81111561491f5761491f61528a565b6040519080825280601f01601f191660200182016040528015614949576020820181803683370190505b509050600360fc1b81600081518110614964576149646157c2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614993576149936157c2565b60200101906001600160f81b031916908160001a90535060006149b78460026157ee565b6149c290600161584a565b90505b6001811115614a3a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106149f6576149f66157c2565b1a60f81b828281518110614a0c57614a0c6157c2565b60200101906001600160f81b031916908160001a90535060049490941c93614a3381615eb4565b90506149c5565b5083156125785760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610997565b614a938383614d7d565b614aa060008484846146a0565b610fb75760405162461bcd60e51b815260040161099790615d53565b606082471015614b1d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610997565b6001600160a01b0385163b614b745760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610997565b600080866001600160a01b03168587604051614b909190615ecb565b60006040518083038185875af1925050503d8060008114614bcd576040519150601f19603f3d011682016040523d82523d6000602084013e614bd2565b606091505b5091509150614be2828286614ecb565b979650505050505050565b60006001614bfa84611622565b614c049190615837565b600083815260096020526040902054909150808214614c57576001600160a01b03841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b5060009182526009602090815260408084208490556001600160a01b039094168352600881528383209183525290812055565b600a54600090614c9c90600190615837565b6000838152600b6020526040812054600a8054939450909284908110614cc457614cc46157c2565b9060005260206000200154905080600a8381548110614ce557614ce56157c2565b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a805480614d1d57614d1d615ee7565b6001900381819060005260206000200160009055905550505050565b6000614d4483611622565b6001600160a01b039093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b6001600160a01b038216614dd35760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610997565b6000818152600460205260409020546001600160a01b031615614e385760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610997565b614e44600083836144fc565b6001600160a01b0382166000908152600560205260408120805460019290614e6d90849061584a565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608315614eda575081612578565b825115614eea5782518084602001fd5b8160405162461bcd60e51b815260040161099791906150e0565b828054828255906000526020600020908101928215614f3f579160200282015b82811115614f3f578251825591602001919060010190614f24565b50614f4b929150614fa4565b5090565b828054828255906000526020600020908101928215614f3f579160200282015b82811115614f3f57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614f6f565b5b80821115614f4b5760008155600101614fa5565b6001600160a01b038116811461131a57600080fd5b803561351781614fb9565b60008060408385031215614fec57600080fd5b823591506020830135614ffe81614fb9565b809150509250929050565b600081518084526020808501945080840160005b838110156150395781518752958201959082019060010161501d565b509495945050505050565b8281526040602082015260006110a76040830184615009565b6001600160e01b03198116811461131a57600080fd5b60006020828403121561508557600080fd5b81356125788161505d565b60005b838110156150ab578181015183820152602001615093565b50506000910152565b600081518084526150cc816020860160208601615090565b601f01601f19169290920160200192915050565b60208152600061257860208301846150b4565b60006020828403121561510557600080fd5b5035919050565b6000806040838503121561511f57600080fd5b823561512a81614fb9565b946020939093013593505050565b60008060006060848603121561514d57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561517657600080fd5b813561257881614fb9565b60008060006060848603121561519657600080fd5b83356151a181614fb9565b925060208401356151b181614fb9565b929592945050506040919091013590565b600080600080608085870312156151d857600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561520757600080fd5b50508035926020909101359150565b6020815260018060a01b038251166020820152602082015160408201526040820151606082015260608201516080820152608082015160a0820152600060a083015160e060c084015261526d610100840182615009565b905060c0840151601f198483030160e08501526111c58282615009565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156152c9576152c961528a565b604052919050565b600067ffffffffffffffff8211156152eb576152eb61528a565b5060051b60200190565b600067ffffffffffffffff82111561530f5761530f61528a565b50601f01601f191660200190565b600061533061532b846152f5565b6152a0565b905082815283838301111561534457600080fd5b828260208301376000602084830101529392505050565b600082601f83011261536c57600080fd5b6125788383356020850161531d565b60008060006060848603121561539057600080fd5b833567ffffffffffffffff808211156153a857600080fd5b818601915086601f8301126153bc57600080fd5b813560206153cc61532b836152d1565b82815260059290921b8401810191818101908a8411156153eb57600080fd5b948201945b83861015615409578535825294820194908201906153f0565b975050870135945050604086013591508082111561542657600080fd5b506154338682870161535b565b9150509250925092565b801515811461131a57600080fd5b60008060006040848603121561546057600080fd5b833567ffffffffffffffff8082111561547857600080fd5b818601915086601f83011261548c57600080fd5b81358181111561549b57600080fd5b8760208260051b85010111156154b057600080fd5b602092830195509350508401356154c68161543d565b809150509250925092565b600081518084526020808501945080840160005b838110156150395781516001600160a01b0316875295820195908201906001016154e5565b6020815261551d60208201835115159052565b602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e0820152600060e08301516101606101008181860152615579610180860184615009565b9250808601519050601f1961012081878603018188015261559a8584615009565b9450808801519250506101408187860301818801526155b98584615009565b9088015187820390920184880152935090506155d583826154d1565b9695505050505050565b6000806000606084860312156155f457600080fd5b833592506020840135915060408401356154c681614fb9565b6000806000806080858703121561562357600080fd5b843593506020850135925060408501359150606085013561564381614fb9565b939692955090935050565b6000806040838503121561566157600080fd5b823561566c81614fb9565b91506020830135614ffe8161543d565b85815284602082015283604082015282606082015260a060808201526000614be260a0830184615009565b600060e082840312156156b957600080fd5b50919050565b600080600080608085870312156156d557600080fd5b84356156e081614fb9565b935060208501356156f081614fb9565b925060408501359150606085013567ffffffffffffffff81111561571357600080fd5b8501601f8101871361572457600080fd5b6157338782356020840161531d565b91505092959194509250565b6000806040838503121561575257600080fd5b823561512a8161543d565b6000806040838503121561577057600080fd5b823561577b81614fb9565b91506020830135614ffe81614fb9565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615615808576158086157d8565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158325761583261580d565b500490565b81810381811115610de857610de86157d8565b80820180821115610de857610de86157d8565b8381528260208201526060604082015260006111c56060830184615009565b600181811c9082168061589057607f821691505b6020821081036156b957634e487b7160e01b600052602260045260246000fd5b6000602082840312156158c257600080fd5b5051919050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6000602080838503121561592a57600080fd5b825167ffffffffffffffff81111561594157600080fd5b8301601f8101851361595257600080fd5b805161596061532b826152d1565b81815260059190911b8201830190838101908783111561597f57600080fd5b928401925b82841015614be257835161599781614fb9565b82529284019290840190615984565b6000602082840312156159b857600080fd5b815167ffffffffffffffff8111156159cf57600080fd5b8201601f810184136159e057600080fd5b80516159ee61532b826152f5565b818152856020838501011115615a0357600080fd5b6111c5826020830160208601615090565b60018060a01b0388168152600060208815158184015287604084015286606084015260e060808401526000865481600182811c915080831680615a5857607f831692505b8583108103615a7557634e487b7160e01b85526022600452602485fd5b60e088018390526101008801818015615a955760018114615aab57615ad6565b60ff198616825284151560051b82019650615ad6565b60008d81526020902060005b86811015615ad057815484820152908501908901615ab7565b83019750505b50505050505083810360a0850152615aee81876150b4565b91505082810360c0840152615b0381856150b4565b9a9950505050505050505050565b60006020808385031215615b2457600080fd5b825167ffffffffffffffff811115615b3b57600080fd5b8301601f81018513615b4c57600080fd5b8051615b5a61532b826152d1565b81815260059190911b82018301908381019087831115615b7957600080fd5b928401925b82841015614be257835182529284019290840190615b7e565b80546001600160a01b0319166001600160a01b0392909216919091179055565b8135615bc281614fb9565b615bcc8183615b97565b506020820135615bdb81614fb9565b615be88160018401615b97565b506040820135615bf781614fb9565b615c048160028401615b97565b506060820135615c1381614fb9565b615c208160038401615b97565b506080820135615c2f81614fb9565b615c3c8160048401615b97565b5060a0820135615c4b81614fb9565b615c588160058401615b97565b5060c0820135615c6781614fb9565b610fb78160068401615b97565b60e081018235615c8381614fb9565b6001600160a01b039081168352602084013590615c9f82614fb9565b9081166020840152604084013590615cb682614fb9565b9081166040840152606084013590615ccd82614fb9565b9081166060840152608084013590615ce482614fb9565b166080830152615cf660a08401614fce565b6001600160a01b031660a0830152615d1060c08401614fce565b6001600160a01b03811660c0840152612ef7565b60008351615d36818460208801615090565b835190830190615d4a818360208801615090565b01949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060018201615db757615db76157d8565b5060010190565b600082615dcd57615dcd61580d565b500690565b600060208284031215615de457600080fd5b81516125788161543d565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615e27816017850160208801615090565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615e58816028840160208801615090565b01602801949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906155d5908301846150b4565b600060208284031215615ea957600080fd5b81516125788161505d565b600081615ec357615ec36157d8565b506000190190565b60008251615edd818460208701615090565b9190910192915050565b634e487b7160e01b600052603160045260246000fdfe5361666545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fc19cf3fca1ef84a91428542bb08cd4e47b45ca64f79b303f6f48ff81117549864736f6c63430008100033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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