Contract 0xd4cafe592be189aeb7826ee5062b29405ee63488

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x515e251b0f3f9421a98bc2847ffb3b09afbb0acddc43c9830dab0af7ea3ca907Withdraw51670952022-01-28 10:56:3217 mins ago0x2833f50af7e6312c94e84627c31f51036632b097 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000584465382 ETH
0x835e8891b47c97898f6e0b6589ffc799e4afdec43de47b6c986812158881b7c4Settle51670882022-01-28 10:56:3217 mins ago0x06f2de7cc99da93e4b5a9f01f2ae196687856792 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000617310552 ETH
0x4ddb6a3723ff236f9659260e22652c8c0be887e6426fa8e905c33c95a481bdbdWithdraw51670672022-01-28 10:55:2118 mins ago0x06f2de7cc99da93e4b5a9f01f2ae196687856792 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000586254324 ETH
0x6673ca59b6912efac89b09960e9b2c3be59e2282ae0f0dc0bf250393c09fed7aWithdraw51669932022-01-28 10:52:3321 mins ago0x9e5a57470a2a136a3d4de39e1996e05944c4b1fb IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000657006058 ETH
0xa15d8dbb2eef497b3d16e8f873bd890b4adbb16403a0575463796570a3c6499aWithdraw51669582022-01-28 10:50:3123 mins ago0x6f0612984c2600938c4d72effc33462d55aea416 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000714792459 ETH
0x92423a00c13d9a9334e5649d15e0569628db8d272482d06cb962901afa393c32Settle51669342022-01-28 10:48:4325 mins ago0x9e5a57470a2a136a3d4de39e1996e05944c4b1fb IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.00068451392 ETH
0x3d9bca9041b01661ce0bfbed84311110a676cf6aa1cafddc28978e10a61b6ef1Withdraw51669092022-01-28 10:46:2427 mins ago0xe939c7f2c1e8f6425a35a6bab8808c82f9af7964 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000584483349 ETH
0x44123e446690409a4fdd4b5f9dce5a7f014fdc4528f7be5afccc3129df8ce1e3Settle51665132022-01-28 10:23:0551 mins ago0xb5faec4293c5cd262850c73d29725afbfcff189e IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000630032857 ETH
0x27df8d9d319874dc90c923ffe7ab0903409b52dd59b8360493047818613df1f3Withdraw51662992022-01-28 10:14:5359 mins ago0xf76a99b2f417c88bcb77a3bc3654d78b3eddb7c6 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000595540456 ETH
0x7e12d166607cbdc2386152f547ba0a23c58fe62fc75048f1d8fbcc18ca23d211Withdraw51662832022-01-28 10:14:081 hr ago0xf76a99b2f417c88bcb77a3bc3654d78b3eddb7c6 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000595546974 ETH
0x80a5b6c91a065e46a9c0413cccd405f882daa14d65580cfd19c2d70b0ac20eccWithdraw51662742022-01-28 10:14:081 hr ago0xf76a99b2f417c88bcb77a3bc3654d78b3eddb7c6 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000593733643 ETH
0xfed0186cc8779e5b28ea1d2739deef2e7149884b922b23907b3a04dd622c23d7Withdraw51662612022-01-28 10:13:191 hr ago0xf76a99b2f417c88bcb77a3bc3654d78b3eddb7c6 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000595540456 ETH
0x9d51a2e18ece70b4e6c9bf5acf7a5c7b494c1c644d34968aa31635081b7ed8e2Withdraw51662472022-01-28 10:11:501 hr 2 mins ago0xf76a99b2f417c88bcb77a3bc3654d78b3eddb7c6 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000726048156 ETH
0x7f9817742bb506b4530c8c738b9d0df857d430878f0284457f119e7fd5716f3fWithdraw51654852022-01-28 9:35:421 hr 38 mins ago0x2fba909aed4345ac0c67c75c51d955f822b14629 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000597927379 ETH
0x44f115f4624b442a40cbc26b2929d7b67db06ea7d06334f7f74ced7f73df4029Withdraw51654812022-01-28 9:34:311 hr 39 mins ago0x2fba909aed4345ac0c67c75c51d955f822b14629 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000728431168 ETH
0x1b8803dc6b64ddaade9cad4c032b502b2d72eb35878ca22a34a71dea877a103bWithdraw51652112022-01-28 9:22:061 hr 52 mins ago0xdad677bb15cbb69fc3c7d3b3bcad13f999f9f31f IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000593767537 ETH
0x98699d2e38310f7020af12ee10636bea1035e1802bbdc0715fda0892dd377e07Withdraw51652052022-01-28 9:22:061 hr 52 mins ago0xdad677bb15cbb69fc3c7d3b3bcad13f999f9f31f IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000660798217 ETH
0xbc6426f34ab0e2cd6f4ccf78e1520264c2f7aee10dbed171471ccfbef3f0e80bWithdraw51651732022-01-28 9:21:201 hr 52 mins ago0x6a9c8bc44bec32fa8a6e0c67466642c6def3971d IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000593741465 ETH
0x12dc7b1255d7698577892affa508441714c788d2aa8d613fc34e7cf0e8553416Withdraw51651662022-01-28 9:21:201 hr 52 mins ago0x6a9c8bc44bec32fa8a6e0c67466642c6def3971d IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.0005955561 ETH
0x118de81c169508863c7c6d6f71091cdd295bde0aac908149efc81b048ed1ceedWithdraw51651542022-01-28 9:20:421 hr 53 mins ago0x6a9c8bc44bec32fa8a6e0c67466642c6def3971d IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.00059554176 ETH
0x4f37dd834e1a3428a07d9fbe68491b474f3f19e112299b279222a460182160f1Withdraw51649442022-01-28 9:10:442 hrs 3 mins ago0xf880c665578ae6a1d111a399f8beca38dabe9002 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000595528724 ETH
0x1f0345265cebf99688ab298af9fcf530ee3f4f87fa65555c90987d32d4099679Withdraw51647152022-01-28 8:58:132 hrs 16 mins ago0xd386dcc254baf455da6fe9458eec14238285e451 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000604674861 ETH
0x526450127296f6106c65a9e95d977da312eb327adf269b13c969702fb8c88692Withdraw51646592022-01-28 8:56:362 hrs 17 mins ago0xd386dcc254baf455da6fe9458eec14238285e451 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000601028239 ETH
0xf142b042f7bb7dac3d9c544eef91b391e8a349b22aa59d2c47ffa28ddda3e13dWithdraw51646192022-01-28 8:55:172 hrs 18 mins ago0x70c784865dbd300b94e50a9dcdbaaf459084361d IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000739020139 ETH
0xaf4dc98c2b9c5257bf151251addacfad5c91a66ff8688d06c757701a66cba716Withdraw51645762022-01-28 8:54:052 hrs 20 mins ago0xd386dcc254baf455da6fe9458eec14238285e451 IN  0xd4cafe592be189aeb7826ee5062b29405ee634880 ETH0.000597369704 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RdpxSSOVV2

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license
File 1 of 35 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
        __AccessControlEnumerable_init_unchained();
    }

    function __AccessControlEnumerable_init_unchained() internal initializer {
    }
    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 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 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);
    }
    uint256[49] private __gap;
}

File 2 of 35 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
    }

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        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 override returns (bytes32) {
        return _roles[role].adminRole;
    }

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

File 3 of 35 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 4 of 35 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 5 of 35 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

/**
 * @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 a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 6 of 35 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 initializer {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

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

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

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

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

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

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

File 7 of 35 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 initializer {
        __Context_init_unchained();
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {
        _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:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, 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}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), 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}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - 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) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][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) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

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

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, 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 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 {}
    uint256[45] private __gap;
}

File 8 of 35 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 9 of 35 : ERC20BurnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 initializer {
        __Context_init_unchained();
        __ERC20Burnable_init_unchained();
    }

    function __ERC20Burnable_init_unchained() internal initializer {
    }
    /**
     * @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 {
        uint256 currentAllowance = allowance(account, _msgSender());
        require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
        unchecked {
            _approve(account, _msgSender(), currentAllowance - amount);
        }
        _burn(account, amount);
    }
    uint256[50] private __gap;
}

File 10 of 35 : ERC20PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 initializer {
        __Context_init_unchained();
        __Pausable_init_unchained();
        __ERC20Pausable_init_unchained();
    }

    function __ERC20Pausable_init_unchained() internal initializer {
    }
    /**
     * @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");
    }
    uint256[50] private __gap;
}

File 11 of 35 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 12 of 35 : ERC20PresetMinterPauserUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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.
 */
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 initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
        __AccessControlEnumerable_init_unchained();
        __ERC20_init_unchained(name, symbol);
        __ERC20Burnable_init_unchained();
        __Pausable_init_unchained();
        __ERC20Pausable_init_unchained();
        __ERC20PresetMinterPauser_init_unchained(name, symbol);
    }

    function __ERC20PresetMinterPauser_init_unchained(string memory name, string memory symbol) internal initializer {
        _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);
    }
    uint256[50] private __gap;
}

File 13 of 35 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 initializer {
        __Context_init_unchained();
    }

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

File 15 of 35 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 initializer {
        __ERC165_init_unchained();
    }

    function __ERC165_init_unchained() internal initializer {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

File 16 of 35 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 17 of 35 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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.
 */
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;

        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;

        assembly {
            result := store
        }

        return result;
    }
}

File 18 of 35 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 19 of 35 : Clones.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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) {
        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) {
        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) {
        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 20 of 35 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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 Pausable is Context {
    /**
     * @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 Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

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

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

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

File 21 of 35 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 22 of 35 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 23 of 35 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

File 24 of 35 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 substraction 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 25 of 35 : RdpxSSOVV2.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

/**                             .                    .                             
                           .'.                    .'.                           
                         .;:.                      .;:.                         
                       .:o:.                        .;l:.                       
                     .:dd,                            ,od:.                     
                   .:dxo'                              .lxd:.                   
                 .:dkxc.                                .:xkd:.                 
               .:dkkx:.                                  .;dkkd:.               
              .ckkkkxl:,'..                            ..':dkkkkl.              
               'codxxkkkxxdol,                     .,cldxkkkxdoc,               
                  ..',;coxkkkl.                  .;dxkxdol:;'..                 
                       .cxkxl.                   ;dkxl,..                       
                      .:xxxc.                   .cxxd'                          
                      ;dxd:.    ;c,.            .:dxo'                          
                     .lddc.    .cdoc.            'odd:.                         
                     .loo;.     .clol'           .;ool,                         
                     .:loc,.      ..'.            .:loc'                        
                      .,cllc;'.                    .;llc'                       
                        .';cccc:'.                  .;cc:.                      
                           ..,;::;'                  .;::;.                     
                              .';::,.                 .;:;.                     
                                .,;;,.                .;;;.                     
                                  .,,,'..            .,,,'.                     
                                   ..',,,'..      ..'','.                       
                                     ...'''''.....'''...                        
                                         ............                           
                            DOPEX SINGLE STAKING OPTION VAULT
            Mints covered calls while farming yield on single sided DPX staking farm                                                           
*/

// Libraries
import {Strings} from '@openzeppelin/contracts/utils/Strings.sol';
import {Clones} from '@openzeppelin/contracts/proxy/Clones.sol';
import {BokkyPooBahsDateTimeLibrary} from '../../external/libraries/BokkyPooBahsDateTimeLibrary.sol';
import {SafeERC20} from '../../external/libraries/SafeERC20.sol';

// Contracts
import {ERC20PresetMinterPauserUpgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC20/presets/ERC20PresetMinterPauserUpgradeable.sol';
import {Pausable} from '@openzeppelin/contracts/security/Pausable.sol';
import {ContractWhitelist} from '../../helper/ContractWhitelist.sol';

// Interfaces
import {IERC20} from '../../external/interfaces/IERC20.sol';
import {IVolatilityOracle} from '../../interfaces/IVolatilityOracle.sol';
import {IStakingRewards} from '../../interfaces/IStakingRewards.sol';
import {IOptionPricing} from '../../interfaces/IOptionPricing.sol';
import {IERC20SSOV} from '../../interfaces/IERC20SSOV.sol';
import {IFeeStrategy} from '../../fees/IFeeStrategy.sol';

interface IPriceOracle {
    function getPriceInUSD() external view returns (uint256);
}

contract RdpxSSOVV2 is ContractWhitelist, Pausable, IERC20SSOV {
    using BokkyPooBahsDateTimeLibrary for uint256;
    using Strings for uint256;
    using SafeERC20 for IERC20;

    /// @dev ERC20PresetMinterPauserUpgradeable implementation address
    address public immutable erc20Implementation;

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

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

    /// @dev The list of contract addresses the contract uses
    mapping(bytes32 => address) public addresses;

    /// @dev epoch => the epoch start time
    mapping(uint256 => uint256) public epochStartTimes;

    /// @notice Is epoch expired
    /// @dev epoch => whether the epoch is expired
    mapping(uint256 => bool) public isEpochExpired;

    /// @notice Is vault ready for next epoch
    /// @dev epoch => whether the vault is ready (boostrapped)
    mapping(uint256 => bool) public isVaultReady;

    /// @dev Mapping of strikes for each epoch
    mapping(uint256 => uint256[]) public epochStrikes;

    /// @dev Mapping of (epoch => (strike => tokens))
    mapping(uint256 => mapping(uint256 => address)) public epochStrikeTokens;

    /// @notice Total epoch deposits for specific strikes
    /// @dev mapping (epoch => (strike => deposits))
    mapping(uint256 => mapping(uint256 => uint256))
        public totalEpochStrikeDeposits;

    /// @notice Total epoch deposits across all strikes
    /// @dev mapping (epoch => deposits)
    mapping(uint256 => uint256) public totalEpochDeposits;

    /// @notice Total epoch deposits for specific strikes including premiums and rewards
    /// @dev mapping (epoch => (strike => deposits))
    mapping(uint256 => mapping(uint256 => uint256))
        public totalEpochStrikeBalance;

    /// @notice Total epoch deposits across all strikes including premiums and rewards
    /// @dev mapping (epoch => deposits)
    mapping(uint256 => uint256) public totalEpochBalance;

    /// @notice Epoch deposits by user for each strike
    /// @dev mapping (epoch => (abi.encodePacked(user, strike) => user deposits))
    mapping(uint256 => mapping(bytes32 => uint256)) public userEpochDeposits;

    /// @notice Epoch rDPX balance per strike after accounting for rewards
    /// @dev mapping (epoch => (strike => balance))
    mapping(uint256 => mapping(uint256 => uint256))
        public totalEpochStrikeRdpxBalance;

    /// @notice Epoch DPX balance per strike after accounting for rewards
    /// @dev mapping (epoch => (strike => balance))
    mapping(uint256 => mapping(uint256 => uint256))
        public totalEpochStrikeDpxBalance;

    // Calls purchased for each strike in an epoch
    /// @dev mapping (epoch => (strike => calls purchased))
    mapping(uint256 => mapping(uint256 => uint256))
        public totalEpochCallsPurchased;

    /// @notice Calls purchased by user for each strike
    /// @dev mapping (epoch => (abi.encodePacked(user, strike) => user calls purchased))
    mapping(uint256 => mapping(bytes32 => uint256))
        public userEpochCallsPurchased;

    /// @notice Premium collected per strike for an epoch
    /// @dev mapping (epoch => (strike => premium))
    mapping(uint256 => mapping(uint256 => uint256)) public totalEpochPremium;

    /// @notice User premium collected per strike for an epoch
    /// @dev mapping (epoch => (abi.encodePacked(user, strike) => user premium))
    mapping(uint256 => mapping(bytes32 => uint256)) public userEpochPremium;

    /// @dev epoch => settlement price
    mapping(uint256 => uint256) public settlementPrices;

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

    event ExpireDelayToleranceUpdate(uint256 expireDelayTolerance);

    event AddressSet(bytes32 indexed name, address indexed destination);

    event EmergencyWithdraw(
        address sender,
        uint256 dpxWithdrawn,
        uint256 rdpxWithdrawn
    );

    event NewStrike(uint256 epoch, uint256 strike);

    event Bootstrap(uint256 epoch);

    event NewDeposit(
        uint256 epoch,
        uint256 strike,
        uint256 amount,
        address user,
        address sender
    );

    event NewPurchase(
        uint256 epoch,
        uint256 strike,
        uint256 amount,
        uint256 premium,
        uint256 fee,
        address user,
        address sender
    );

    event NewSettle(
        uint256 epoch,
        uint256 strike,
        address user,
        uint256 amount,
        uint256 pnl
    );

    event Compound(
        uint256 epoch,
        uint256 rewards,
        uint256 oldBalance,
        uint256 newBalance
    );

    event NewWithdraw(
        uint256 epoch,
        uint256 strike,
        address user,
        uint256 amount,
        uint256 rdpxAmount
    );

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

    constructor(
        address _dpx,
        address _rdpx,
        address _stakingRewards,
        address _optionPricing,
        address _rdpxPriceOracle,
        address _volatilityOracle,
        address _feeDistributor,
        address _feeStrategy
    ) {
        require(_dpx != address(0), 'E1');
        require(_rdpx != address(0), 'E1');
        require(_stakingRewards != address(0), 'E1');
        require(_optionPricing != address(0), 'E1');
        require(_rdpxPriceOracle != address(0), 'E1');
        require(_feeStrategy != address(0), 'E1');

        addresses['FeeDistributor'] = _feeDistributor;
        addresses['DPX'] = _dpx;
        addresses['rDPX'] = _rdpx;
        addresses['StakingRewards'] = _stakingRewards;
        addresses['OptionPricing'] = _optionPricing;
        addresses['RdpxPriceOracle'] = _rdpxPriceOracle;
        addresses['VolatilityOracle'] = _volatilityOracle;
        addresses['FeeStrategy'] = _feeStrategy;
        addresses['Governance'] = msg.sender;

        erc20Implementation = address(new ERC20PresetMinterPauserUpgradeable());

        // Max approve to stakingRewards
        IERC20(getAddress('rDPX')).safeApprove(
            getAddress('StakingRewards'),
            type(uint256).max
        );
    }

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

    /// @notice Pauses the vault for emergency cases
    /// @dev Can only be called by governance
    /// @return Whether it was successfully paused
    function pause() external onlyGovernance returns (bool) {
        _pause();
        _updateFinalEpochBalances(false);
        return true;
    }

    /// @notice Unpauses the vault
    /// @dev Can only be called by governance
    /// @return Whether it was successfully unpaused
    function unpause() external onlyGovernance returns (bool) {
        _unpause();
        return true;
    }

    /// @notice Updates the delay tolerance for the expiry epoch function
    /// @dev Can only be called by governance
    /// @return Whether it was successfully updated
    function updateExpireDelayTolerance(uint256 _expireDelayTolerance)
        external
        onlyGovernance
        returns (bool)
    {
        expireDelayTolerance = _expireDelayTolerance;
        emit ExpireDelayToleranceUpdate(_expireDelayTolerance);
        return true;
    }

    /// @notice Sets (adds) a list of addresses to the address list
    /// @param names Names of the contracts
    /// @param destinations Addresses of the contract
    /// @return Whether the addresses were set
    function setAddresses(
        bytes32[] calldata names,
        address[] calldata destinations
    ) external onlyOwner returns (bool) {
        require(names.length == destinations.length, 'E2');
        for (uint256 i = 0; i < names.length; i++) {
            bytes32 name = names[i];
            address destination = destinations[i];
            addresses[name] = destination;
            emit AddressSet(name, destination);
        }
        return true;
    }

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

    /// @notice Transfers all funds to msg.sender
    /// @dev Can only be called by governance
    /// @return Whether emergency withdraw was successful
    function emergencyWithdraw()
        external
        onlyGovernance
        whenPaused
        returns (bool)
    {
        IERC20 dpx = IERC20(getAddress('DPX'));
        IERC20 rdpx = IERC20(getAddress('rDPX'));

        uint256 dpxBalance = dpx.balanceOf(address(this));
        uint256 rdpxBalance = rdpx.balanceOf(address(this));

        dpx.safeTransfer(msg.sender, dpxBalance);
        rdpx.safeTransfer(msg.sender, rdpxBalance);

        emit EmergencyWithdraw(msg.sender, dpxBalance, rdpxBalance);

        return true;
    }

    /// @notice Sets the current epoch as expired.
    /// @return Whether expire was successful
    function expireEpoch()
        external
        whenNotPaused
        isEligibleSender
        returns (bool)
    {
        require(!isEpochExpired[currentEpoch], 'E3');
        (, uint256 epochExpiry) = getEpochTimes(currentEpoch);
        require((block.timestamp >= epochExpiry), 'E4');
        require(block.timestamp <= epochExpiry + expireDelayTolerance, 'E23');

        settlementPrices[currentEpoch] = getUsdPrice();

        _updateFinalEpochBalances(true);

        isEpochExpired[currentEpoch] = true;

        return true;
    }

    /// @notice Sets the current epoch as expired.
    /// @return Whether expire was successful
    function expireEpoch(uint256 settlementPrice)
        external
        onlyGovernance
        whenNotPaused
        returns (bool)
    {
        require(!isEpochExpired[currentEpoch], 'E3');
        (, uint256 epochExpiry) = getEpochTimes(currentEpoch);
        require((block.timestamp > epochExpiry + expireDelayTolerance), 'E4');

        settlementPrices[currentEpoch] = settlementPrice;

        _updateFinalEpochBalances(true);

        isEpochExpired[currentEpoch] = true;

        return true;
    }

    /// @dev Updates the final epoch DPX/rDPX balances per strike of the vault
    /// @param accountPremiums Should the fn account for premiums
    function _updateFinalEpochBalances(bool accountPremiums) internal {
        IStakingRewards stakingRewards = IStakingRewards(
            getAddress('StakingRewards')
        );

        IERC20 dpx = IERC20(getAddress('DPX'));
        IERC20 rdpx = IERC20(getAddress('rDPX'));

        if (stakingRewards.balanceOf(address(this)) > 0) {
            // Unstake all tokens from previous epoch
            stakingRewards.withdraw(stakingRewards.balanceOf(address(this)));
        }

        uint256 totalDpxRewardsClaimed = dpx.balanceOf(address(this));
        uint256 totalRdpxRewardsClaimed = rdpx.balanceOf(address(this));

        // Claim DPX and rDPX rewards
        stakingRewards.getReward(2);

        totalDpxRewardsClaimed =
            dpx.balanceOf(address(this)) -
            totalDpxRewardsClaimed;
        totalRdpxRewardsClaimed =
            rdpx.balanceOf(address(this)) -
            totalRdpxRewardsClaimed;

        if (totalEpochBalance[currentEpoch] > 0) {
            uint256[] memory strikes = epochStrikes[currentEpoch];

            for (uint256 i = 0; i < strikes.length; i++) {
                // rDPX rewards for each strike
                uint256 rdpxRewards = (totalRdpxRewardsClaimed *
                    totalEpochStrikeBalance[currentEpoch][strikes[i]]) /
                    totalEpochBalance[currentEpoch];

                // PnL from ssov option settlements
                uint256 settlement = calculatePnl(
                    settlementPrices[currentEpoch],
                    strikes[i],
                    totalEpochCallsPurchased[currentEpoch][strikes[i]]
                );

                // Update final dpx and rdpx balances for epoch and strike
                totalEpochStrikeRdpxBalance[currentEpoch][strikes[i]] +=
                    totalEpochStrikeDeposits[currentEpoch][strikes[i]] +
                    rdpxRewards -
                    settlement;
                if (accountPremiums) {
                    totalEpochStrikeRdpxBalance[currentEpoch][
                        strikes[i]
                    ] += totalEpochPremium[currentEpoch][strikes[i]];
                }

                totalEpochStrikeDpxBalance[currentEpoch][strikes[i]] =
                    (totalDpxRewardsClaimed *
                        totalEpochStrikeBalance[currentEpoch][strikes[i]]) /
                    totalEpochBalance[currentEpoch];
            }
        }
    }

    /**
     * @notice Bootstraps a new epoch and mints option tokens equivalent to user deposits for the epoch
     * @return Whether bootstrap was successful
     */
    function bootstrap() external onlyOwner whenNotPaused returns (bool) {
        uint256 nextEpoch = currentEpoch + 1;
        require(!isVaultReady[nextEpoch], 'E5');
        require(epochStrikes[nextEpoch].length > 0, 'E6');

        if (currentEpoch > 0) {
            // Previous epoch must be expired
            require(isEpochExpired[currentEpoch], 'E7');
        }

        for (uint256 i = 0; i < epochStrikes[nextEpoch].length; i++) {
            uint256 strike = epochStrikes[nextEpoch][i];
            string memory name = concatenate('rDPX-CALL', strike.toString());
            name = concatenate(name, '-EPOCH-');
            name = concatenate(name, (nextEpoch).toString());
            // Create doTokens representing calls for selected strike in epoch
            ERC20PresetMinterPauserUpgradeable _erc20 = ERC20PresetMinterPauserUpgradeable(
                    Clones.clone(erc20Implementation)
                );
            _erc20.initialize(name, name);
            epochStrikeTokens[nextEpoch][strike] = address(_erc20);
            // Mint tokens equivalent to deposits for strike in epoch
            _erc20.mint(
                address(this),
                totalEpochStrikeDeposits[nextEpoch][strike]
            );
        }

        // Mark vault as ready for epoch
        isVaultReady[nextEpoch] = true;
        // Increase the current epoch
        currentEpoch = nextEpoch;

        emit Bootstrap(nextEpoch);

        return true;
    }

    /**
     * @notice Sets strikes for next epoch
     * @param strikes Strikes to set for next epoch
     * @return Whether strikes were set
     */
    function setStrikes(uint256[] memory strikes)
        external
        onlyOwner
        whenNotPaused
        returns (bool)
    {
        uint256 nextEpoch = currentEpoch + 1;

        require(totalEpochDeposits[nextEpoch] == 0, 'E8');

        if (currentEpoch > 0) {
            (, uint256 epochExpiry) = getEpochTimes(currentEpoch);
            require((block.timestamp > epochExpiry), 'E9');
        }

        // Set the next epoch strikes
        epochStrikes[nextEpoch] = strikes;
        // Set the next epoch start time
        epochStartTimes[nextEpoch] = block.timestamp;

        for (uint256 i = 0; i < strikes.length; i++)
            emit NewStrike(nextEpoch, strikes[i]);
        return true;
    }

    /**
     * @notice Deposits rdpx into the ssov to mint options in the next epoch for selected strikes
     * @param strikeIndex Index of strike
     * @param amount Amout of rDPX to deposit
     * @param user Address of the user to deposit for
     * @return Whether deposit was successful
     */
    function deposit(
        uint256 strikeIndex,
        uint256 amount,
        address user
    ) public whenNotPaused isEligibleSender returns (bool) {
        uint256 nextEpoch = currentEpoch + 1;

        if (currentEpoch > 0) {
            require(
                isEpochExpired[currentEpoch] && !isVaultReady[nextEpoch],
                'E19'
            );
        }

        require(strikeIndex < epochStrikes[nextEpoch].length, 'E10');
        require(amount > 0, 'E11');

        uint256 strike = epochStrikes[nextEpoch][strikeIndex];
        require(strike != 0, 'E12');

        bytes32 userStrike = keccak256(abi.encodePacked(user, strike));

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

        // Add to user epoch deposits
        userEpochDeposits[nextEpoch][userStrike] += amount;
        // Add to total epoch strike deposits
        totalEpochStrikeDeposits[nextEpoch][strike] += amount;
        // Add to total epoch deposits
        totalEpochDeposits[nextEpoch] += amount;
        // Add to total epoch strike deposits
        totalEpochStrikeBalance[nextEpoch][strike] += amount;
        // Add to total epoch deposits
        totalEpochBalance[nextEpoch] += amount;
        // Deposit into staking rewards
        IStakingRewards(getAddress('StakingRewards')).stake(amount);

        emit NewDeposit(nextEpoch, strike, amount, user, msg.sender);

        return true;
    }

    /**
     * @notice Deposit rDPX multiple times
     * @param strikeIndices Indices of strikes to deposit into
     * @param amounts Amount of rDPX to deposit into each strike index
     * @param user Address of the user to deposit for
     * @return Whether deposits went through successfully
     */
    function depositMultiple(
        uint256[] memory strikeIndices,
        uint256[] memory amounts,
        address user
    ) external whenNotPaused returns (bool) {
        require(strikeIndices.length == amounts.length, 'E2');

        for (uint256 i = 0; i < strikeIndices.length; i++)
            deposit(strikeIndices[i], amounts[i], user);
        return true;
    }

    /**
     * @notice Purchases calls for the current epoch
     * @param strikeIndex Strike index for current epoch
     * @param amount Amount of calls to purchase
     * @param user User to purchase options for
     * @return Whether purchase was successful
     */
    function purchase(
        uint256 strikeIndex,
        uint256 amount,
        address user
    ) external whenNotPaused isEligibleSender returns (uint256, uint256) {
        require(isVaultReady[currentEpoch], 'E20');
        require(strikeIndex < epochStrikes[currentEpoch].length, 'E10');
        require(amount > 0, 'E11');

        uint256 strike = epochStrikes[currentEpoch][strikeIndex];
        require(strike != 0, 'E12');
        bytes32 userStrike = keccak256(abi.encodePacked(user, strike));

        address rdpx = getAddress('rDPX');
        uint256 currentPrice = getUsdPrice();
        // Get total premium for all calls being purchased
        uint256 premium = calculatePremium(strike, amount);

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

        // Add to total epoch calls purchased
        totalEpochCallsPurchased[currentEpoch][strike] += amount;
        // Add to user epoch calls purchased
        userEpochCallsPurchased[currentEpoch][userStrike] += amount;
        // Add to total epoch premium
        totalEpochPremium[currentEpoch][strike] += premium; // Add to user epoch premium
        userEpochPremium[currentEpoch][userStrike] += premium;

        // Compound before updating new strike balance
        compound();

        // Add to total epoch strike balance premium to vault
        totalEpochStrikeBalance[currentEpoch][strike] += premium;
        // Add to total epoch balance premium
        totalEpochBalance[currentEpoch] += premium;

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

        if (totalFee > 0) {
            // Transfer fee to FeeDistributor
            IERC20(rdpx).safeTransfer(getAddress('FeeDistributor'), totalFee);
        }
        // Transfer doTokens to user
        IERC20(epochStrikeTokens[currentEpoch][strike]).safeTransfer(
            user,
            amount
        );

        // Stake premium into farming
        IStakingRewards(getAddress('StakingRewards')).stake(premium);

        emit NewPurchase(
            currentEpoch,
            strike,
            amount,
            premium,
            totalFee,
            user,
            msg.sender
        );

        return (premium, totalFee);
    }

    /**
     * @notice Settle calculates the PnL for the user and withdraws the PnL in rDPX to the user. Will also the burn the option tokens from the user.
     * @param strikeIndex Strike index
     * @param amount Amount of options
     * @param epoch Epoch
     * @return pnl
     */
    function settle(
        uint256 strikeIndex,
        uint256 amount,
        uint256 epoch
    ) external whenNotPaused isEligibleSender returns (uint256 pnl) {
        require(isEpochExpired[epoch], 'E17');
        require(strikeIndex < epochStrikes[epoch].length, 'E10');
        require(amount > 0, 'E11');

        uint256 strike = epochStrikes[epoch][strikeIndex];
        require(strike != 0, 'E12');
        require(
            IERC20(epochStrikeTokens[epoch][strike]).balanceOf(msg.sender) >=
                amount,
            'E16'
        );

        // Calculate PnL (in rDPX)
        pnl = calculatePnl(settlementPrices[epoch], strike, amount);

        // Total fee charged
        uint256 totalFee = calculateSettlementFees(
            settlementPrices[epoch],
            pnl,
            amount
        );

        IERC20 rdpx = IERC20(getAddress('rDPX'));

        require(pnl > 0, 'E15');

        // Burn user option tokens
        ERC20PresetMinterPauserUpgradeable(epochStrikeTokens[epoch][strike])
            .burnFrom(msg.sender, amount);

        if (totalFee > 0) {
            // Transfer fee to FeeDistributor
            rdpx.safeTransfer(getAddress('FeeDistributor'), totalFee);
        }

        // Transfer PnL to user
        rdpx.safeTransfer(msg.sender, pnl - totalFee);

        emit NewSettle(epoch, strike, msg.sender, amount, pnl);
    }

    /**
     * @notice Allows anyone to call compound()
     * @return Whether compound was successful
     */
    function compound() public whenNotPaused returns (bool) {
        require(!isEpochExpired[currentEpoch], 'E3');
        require(isVaultReady[currentEpoch], 'E20');

        IStakingRewards stakingRewards = IStakingRewards(
            getAddress('StakingRewards')
        );

        uint256 oldBalance = stakingRewards.balanceOf(address(this));

        (, uint256 rewardsRDPX) = stakingRewards.earned(address(this));

        // Account for rDPX rewards per strike deposit
        uint256[] memory strikes = epochStrikes[currentEpoch];
        for (uint256 i = 0; i < strikes.length; i++) {
            uint256 strikeRewards = (rewardsRDPX *
                totalEpochStrikeBalance[currentEpoch][strikes[i]]) /
                totalEpochBalance[currentEpoch];

            totalEpochStrikeRdpxBalance[currentEpoch][
                strikes[i]
            ] += strikeRewards;

            totalEpochStrikeBalance[currentEpoch][strikes[i]] += strikeRewards;
        }

        totalEpochBalance[currentEpoch] += rewardsRDPX;
        if (rewardsRDPX > 0) {
            // Compound staking rewards
            stakingRewards.compound();
        }

        emit Compound(
            currentEpoch,
            rewardsRDPX,
            oldBalance,
            stakingRewards.balanceOf(address(this))
        );

        return true;
    }

    /**
     * @notice Withdraws balances for a strike in a completed epoch
     * @param withdrawEpoch Epoch to withdraw from
     * @param strikeIndex Index of strike
     * @return DPX and rDPX withdrawn
     */
    function withdraw(uint256 withdrawEpoch, uint256 strikeIndex)
        external
        whenNotPaused
        isEligibleSender
        returns (uint256[2] memory)
    {
        require(isEpochExpired[withdrawEpoch], 'E17');
        require(strikeIndex < epochStrikes[withdrawEpoch].length, 'E10');

        uint256 strike = epochStrikes[withdrawEpoch][strikeIndex];
        require(strike != 0, 'E12');

        bytes32 userStrike = keccak256(abi.encodePacked(msg.sender, strike));
        uint256 userStrikeDeposits = userEpochDeposits[withdrawEpoch][
            userStrike
        ];
        require(userStrikeDeposits > 0, 'E18');

        address rdpx = getAddress('rDPX');
        // Transfer rDPX tokens to user
        uint256 userRdpxAmount = (totalEpochStrikeRdpxBalance[withdrawEpoch][
            strike
        ] * userStrikeDeposits) /
            totalEpochStrikeDeposits[withdrawEpoch][strike];

        // Transfer DPX tokens to user
        address dpx = getAddress('DPX');
        uint256 userDpxAmount = (totalEpochStrikeDpxBalance[withdrawEpoch][
            strike
        ] * userStrikeDeposits) /
            totalEpochStrikeDeposits[withdrawEpoch][strike];

        userEpochDeposits[withdrawEpoch][userStrike] = 0;

        IERC20(rdpx).safeTransfer(msg.sender, userRdpxAmount);

        IERC20(dpx).safeTransfer(msg.sender, userDpxAmount);

        emit NewWithdraw(
            withdrawEpoch,
            strike,
            msg.sender,
            userStrikeDeposits,
            userRdpxAmount
        );

        return [userRdpxAmount, userDpxAmount];
    }

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

    /// @notice Calculates the monthly expiry from a solidity date
    /// @param timestamp Timestamp from which the monthly expiry is to be calculated
    /// @return The monthly expiry
    function getMonthlyExpiryFromTimestamp(uint256 timestamp)
        public
        pure
        returns (uint256)
    {
        uint256 lastDay = BokkyPooBahsDateTimeLibrary.timestampFromDate(
            timestamp.getYear(),
            timestamp.getMonth() + 1,
            0
        );

        if (lastDay.getDayOfWeek() < 5) {
            lastDay = BokkyPooBahsDateTimeLibrary.timestampFromDate(
                lastDay.getYear(),
                lastDay.getMonth(),
                lastDay.getDay() - 7
            );
        }

        uint256 lastFridayOfMonth = BokkyPooBahsDateTimeLibrary
            .timestampFromDateTime(
                lastDay.getYear(),
                lastDay.getMonth(),
                lastDay.getDay() + 5 - lastDay.getDayOfWeek(),
                8,
                0,
                0
            );

        if (lastFridayOfMonth <= timestamp) {
            uint256 temp = BokkyPooBahsDateTimeLibrary.timestampFromDate(
                timestamp.getYear(),
                timestamp.getMonth() + 2,
                0
            );

            if (temp.getDayOfWeek() < 5) {
                temp = BokkyPooBahsDateTimeLibrary.timestampFromDate(
                    temp.getYear(),
                    temp.getMonth(),
                    temp.getDay() - 7
                );
            }

            lastFridayOfMonth = BokkyPooBahsDateTimeLibrary
                .timestampFromDateTime(
                    temp.getYear(),
                    temp.getMonth(),
                    temp.getDay() + 5 - temp.getDayOfWeek(),
                    8,
                    0,
                    0
                );
        }
        return lastFridayOfMonth;
    }

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

    /// @notice Calculate Pnl
    /// @param price price of rDPX
    /// @param strike strike price of the the rDPX option
    /// @param amount amount of options
    function calculatePnl(
        uint256 price,
        uint256 strike,
        uint256 amount
    ) public pure returns (uint256) {
        return price > strike ? (((price - strike) * amount) / price) : 0;
    }

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

    /// @notice Calculate premium for an option
    /// @param _strike Strike price of the option
    /// @param _amount Amount of options
    function calculatePremium(uint256 _strike, uint256 _amount)
        public
        view
        returns (uint256 premium)
    {
        uint256 currentPrice = getUsdPrice();
        premium =
            (IOptionPricing(getAddress('OptionPricing')).getOptionPrice(
                false,
                getMonthlyExpiryFromTimestamp(block.timestamp),
                _strike,
                currentPrice,
                IVolatilityOracle(getAddress('VolatilityOracle')).getVolatility()
            ) * _amount) /
            currentPrice;
    }

    /// @notice Calculate Fees for purchase
    /// @param price price of DPX
    /// @param strike strike price of the the DPX option
    /// @param amount amount of options being bought
    function calculatePurchaseFees(
        uint256 price,
        uint256 strike,
        uint256 amount
    ) public view returns (uint256) {
        return
            IFeeStrategy(getAddress('FeeStrategy')).calculatePurchaseFees(
                price,
                strike,
                amount
            );
    }

    /// @notice Calculate Fees for settlement
    /// @param settlementPrice settlement price of DPX
    /// @param pnl total pnl
    /// @param amount amount of options being settled
    function calculateSettlementFees(
        uint256 settlementPrice,
        uint256 pnl,
        uint256 amount
    ) public view returns (uint256) {
        return
            IFeeStrategy(getAddress('FeeStrategy')).calculateSettlementFees(
                settlementPrice,
                pnl,
                amount
            );
    }

    /**
     * @notice Returns start and end times for an epoch
     * @param epoch Target epoch
     */
    function getEpochTimes(uint256 epoch)
        public
        view
        epochGreaterThanZero(epoch)
        returns (uint256 start, uint256 end)
    {
        return (
            epochStartTimes[epoch],
            getMonthlyExpiryFromTimestamp(epochStartTimes[epoch])
        );
    }

    /**
     * @notice Returns epoch strikes array for an epoch
     * @param epoch Target epoch
     */
    function getEpochStrikes(uint256 epoch)
        external
        view
        epochGreaterThanZero(epoch)
        returns (uint256[] memory)
    {
        return epochStrikes[epoch];
    }

    /**
     * Returns epoch strike tokens array for an epoch
     * @param epoch Target epoch
     */
    function getEpochStrikeTokens(uint256 epoch)
        external
        view
        epochGreaterThanZero(epoch)
        returns (address[] memory)
    {
        uint256 length = epochStrikes[epoch].length;
        address[] memory _epochStrikeTokens = new address[](length);

        for (uint256 i = 0; i < length; i++) {
            _epochStrikeTokens[i] = epochStrikeTokens[epoch][
                epochStrikes[epoch][i]
            ];
        }

        return _epochStrikeTokens;
    }

    /**
     * @notice Returns total epoch strike deposits array for an epoch
     * @param epoch Target epoch
     */
    function getTotalEpochStrikeDeposits(uint256 epoch)
        external
        view
        epochGreaterThanZero(epoch)
        returns (uint256[] memory)
    {
        uint256 length = epochStrikes[epoch].length;
        uint256[] memory _totalEpochStrikeDeposits = new uint256[](length);

        for (uint256 i = 0; i < length; i++) {
            _totalEpochStrikeDeposits[i] = totalEpochStrikeDeposits[epoch][
                epochStrikes[epoch][i]
            ];
        }

        return _totalEpochStrikeDeposits;
    }

    /**
     * @notice Returns user epoch deposits array for an epoch
     * @param epoch Target epoch
     * @param user Address of the user
     */
    function getUserEpochDeposits(uint256 epoch, address user)
        external
        view
        epochGreaterThanZero(epoch)
        returns (uint256[] memory)
    {
        uint256 length = epochStrikes[epoch].length;
        uint256[] memory _userEpochDeposits = new uint256[](length);

        for (uint256 i = 0; i < length; i++) {
            uint256 strike = epochStrikes[epoch][i];
            bytes32 userStrike = keccak256(abi.encodePacked(user, strike));

            _userEpochDeposits[i] = userEpochDeposits[epoch][userStrike];
        }

        return _userEpochDeposits;
    }

    /**
     * @notice Returns total epoch calls purchased array for an epoch
     * @param epoch Target epoch
     */
    function getTotalEpochCallsPurchased(uint256 epoch)
        external
        view
        epochGreaterThanZero(epoch)
        returns (uint256[] memory)
    {
        uint256 length = epochStrikes[epoch].length;
        uint256[] memory _totalEpochCallsPurchased = new uint256[](length);

        for (uint256 i = 0; i < length; i++) {
            _totalEpochCallsPurchased[i] = totalEpochCallsPurchased[epoch][
                epochStrikes[epoch][i]
            ];
        }

        return _totalEpochCallsPurchased;
    }

    /**
     * @notice Returns user epoch calls purchased array for an epoch
     * @param epoch Target epoch
     * @param user Address of the user
     */
    function getUserEpochCallsPurchased(uint256 epoch, address user)
        external
        view
        epochGreaterThanZero(epoch)
        returns (uint256[] memory)
    {
        uint256 length = epochStrikes[epoch].length;
        uint256[] memory _userEpochCallsPurchased = new uint256[](length);

        for (uint256 i = 0; i < length; i++) {
            uint256 strike = epochStrikes[epoch][i];
            bytes32 userStrike = keccak256(abi.encodePacked(user, strike));

            _userEpochCallsPurchased[i] = userEpochCallsPurchased[epoch][
                userStrike
            ];
        }

        return _userEpochCallsPurchased;
    }

    /**
     * @notice Returns total epoch premium array for an epoch
     * @param epoch Target epoch
     */
    function getTotalEpochPremium(uint256 epoch)
        external
        view
        epochGreaterThanZero(epoch)
        returns (uint256[] memory)
    {
        uint256 length = epochStrikes[epoch].length;
        uint256[] memory _totalEpochPremium = new uint256[](length);

        for (uint256 i = 0; i < length; i++) {
            _totalEpochPremium[i] = totalEpochPremium[epoch][
                epochStrikes[epoch][i]
            ];
        }

        return _totalEpochPremium;
    }

    /**
     * @notice Returns user epoch premium array for an epoch
     * @param epoch Target epoch
     * @param user Address of the user
     */
    function getUserEpochPremium(uint256 epoch, address user)
        external
        view
        epochGreaterThanZero(epoch)
        returns (uint256[] memory)
    {
        uint256 length = epochStrikes[epoch].length;
        uint256[] memory _userEpochPremium = new uint256[](length);

        for (uint256 i = 0; i < length; i++) {
            uint256 strike = epochStrikes[epoch][i];
            bytes32 userStrike = keccak256(abi.encodePacked(user, strike));

            _userEpochPremium[i] = userEpochPremium[epoch][userStrike];
        }

        return _userEpochPremium;
    }

    /**
     * @notice Returns rDPX price in USD
     */
    function getUsdPrice() public view returns (uint256) {
        return IPriceOracle(getAddress('RdpxPriceOracle')).getPriceInUSD();
    }

    /**
     * @notice Gets the address of a set contract
     * @param name Name of the contract
     * @return The address of the contract
     */
    function getAddress(bytes32 name) public view returns (address) {
        return addresses[name];
    }

    /*==== MODIFIERS ====*/

    modifier onlyGovernance() {
        require(msg.sender == getAddress('Governance'), 'E22');
        _;
    }

    modifier epochGreaterThanZero(uint256 epoch) {
        require(epoch > 0, 'E13');
        _;
    }
}

// ERROR MAPPING:
// {
//   "E1": "SSOV: Address cannot be a zero address",
//   "E2": "SSOV: Input lengths must match",
//   "E3": "SSOV: Epoch must not be expired",
//   "E4": "SSOV: Cannot expire epoch before epoch's expiry",
//   "E5": "SSOV: Already bootstrapped",
//   "E6": "SSOV: Strikes have not been set for next epoch",
//   "E7": "SSOV: Previous epoch has not expired",
//   "E8": "SSOV: Deposit already started",
//   "E9": "SSOV: Cannot set next strikes before current epoch's expiry",
//   "E10": "SSOV: Invalid strike index",
//   "E11": "SSOV: Invalid amount",
//   "E12": "SSOV: Invalid strike",
//   "E13": "SSOV: Epoch passed must be greater than 0",
//   "E14": "SSOV: Option must be in exercise window",
//   "E15": "SSOV: Strike is higher than current price",
//   "E16": "SSOV: Option token balance is not enough",
//   "E17": "SSOV: Epoch must be expired",
//   "E18": "SSOV: User strike deposit amount must be greater than zero",
//   "E19": "SSOV: Deposit is only available between epochs",
//   "E20": "SSOV: Not bootstrapped",
//   "E21": "SSOV: Can not call function in exercise window",
//   "E22": "SSOV: Caller is not governance"
// }

File 26 of 35 : 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 27 of 35 : BokkyPooBahsDateTimeLibrary.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

// ----------------------------------------------------------------------------
// BokkyPooBah's DateTime Library v1.01
//
// A gas-efficient Solidity date and time library
//
// https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary
//
// Tested date range 1970/01/01 to 2345/12/31
//
// Conventions:
// Unit      | Range         | Notes
// :-------- |:-------------:|:-----
// timestamp | >= 0          | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC
// year      | 1970 ... 2345 |
// month     | 1 ... 12      |
// day       | 1 ... 31      |
// hour      | 0 ... 23      |
// minute    | 0 ... 59      |
// second    | 0 ... 59      |
// dayOfWeek | 1 ... 7       | 1 = Monday, ..., 7 = Sunday
//
//
// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018-2019. The MIT Licence.
// ----------------------------------------------------------------------------

library BokkyPooBahsDateTimeLibrary {
  uint256 constant SECONDS_PER_DAY = 24 * 60 * 60;
  uint256 constant SECONDS_PER_HOUR = 60 * 60;
  uint256 constant SECONDS_PER_MINUTE = 60;
  int256 constant OFFSET19700101 = 2440588;

  uint256 constant DOW_MON = 1;
  uint256 constant DOW_TUE = 2;
  uint256 constant DOW_WED = 3;
  uint256 constant DOW_THU = 4;
  uint256 constant DOW_FRI = 5;
  uint256 constant DOW_SAT = 6;
  uint256 constant DOW_SUN = 7;

  // ------------------------------------------------------------------------
  // Calculate the number of days from 1970/01/01 to year/month/day using
  // the date conversion algorithm from
  //   http://aa.usno.navy.mil/faq/docs/JD_Formula.php
  // and subtracting the offset 2440588 so that 1970/01/01 is day 0
  //
  // days = day
  //      - 32075
  //      + 1461 * (year + 4800 + (month - 14) / 12) / 4
  //      + 367 * (month - 2 - (month - 14) / 12 * 12) / 12
  //      - 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4
  //      - offset
  // ------------------------------------------------------------------------
  function _daysFromDate(
    uint256 year,
    uint256 month,
    uint256 day
  ) internal pure returns (uint256 _days) {
    require(year >= 1970);
    int256 _year = int256(year);
    int256 _month = int256(month);
    int256 _day = int256(day);

    int256 __days = _day -
      32075 +
      (1461 * (_year + 4800 + (_month - 14) / 12)) /
      4 +
      (367 * (_month - 2 - ((_month - 14) / 12) * 12)) /
      12 -
      (3 * ((_year + 4900 + (_month - 14) / 12) / 100)) /
      4 -
      OFFSET19700101;

    _days = uint256(__days);
  }

  // ------------------------------------------------------------------------
  // Calculate year/month/day from the number of days since 1970/01/01 using
  // the date conversion algorithm from
  //   http://aa.usno.navy.mil/faq/docs/JD_Formula.php
  // and adding the offset 2440588 so that 1970/01/01 is day 0
  //
  // int L = days + 68569 + offset
  // int N = 4 * L / 146097
  // L = L - (146097 * N + 3) / 4
  // year = 4000 * (L + 1) / 1461001
  // L = L - 1461 * year / 4 + 31
  // month = 80 * L / 2447
  // dd = L - 2447 * month / 80
  // L = month / 11
  // month = month + 2 - 12 * L
  // year = 100 * (N - 49) + year + L
  // ------------------------------------------------------------------------
  function _daysToDate(uint256 _days)
    internal
    pure
    returns (
      uint256 year,
      uint256 month,
      uint256 day
    )
  {
    int256 __days = int256(_days);

    int256 L = __days + 68569 + OFFSET19700101;
    int256 N = (4 * L) / 146097;
    L = L - (146097 * N + 3) / 4;
    int256 _year = (4000 * (L + 1)) / 1461001;
    L = L - (1461 * _year) / 4 + 31;
    int256 _month = (80 * L) / 2447;
    int256 _day = L - (2447 * _month) / 80;
    L = _month / 11;
    _month = _month + 2 - 12 * L;
    _year = 100 * (N - 49) + _year + L;

    year = uint256(_year);
    month = uint256(_month);
    day = uint256(_day);
  }

  function timestampFromDate(
    uint256 year,
    uint256 month,
    uint256 day
  ) internal pure returns (uint256 timestamp) {
    timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY;
  }

  function timestampFromDateTime(
    uint256 year,
    uint256 month,
    uint256 day,
    uint256 hour,
    uint256 minute,
    uint256 second
  ) internal pure returns (uint256 timestamp) {
    timestamp =
      _daysFromDate(year, month, day) *
      SECONDS_PER_DAY +
      hour *
      SECONDS_PER_HOUR +
      minute *
      SECONDS_PER_MINUTE +
      second;
  }

  function timestampToDate(uint256 timestamp)
    internal
    pure
    returns (
      uint256 year,
      uint256 month,
      uint256 day
    )
  {
    (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
  }

  function timestampToDateTime(uint256 timestamp)
    internal
    pure
    returns (
      uint256 year,
      uint256 month,
      uint256 day,
      uint256 hour,
      uint256 minute,
      uint256 second
    )
  {
    (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
    uint256 secs = timestamp % SECONDS_PER_DAY;
    hour = secs / SECONDS_PER_HOUR;
    secs = secs % SECONDS_PER_HOUR;
    minute = secs / SECONDS_PER_MINUTE;
    second = secs % SECONDS_PER_MINUTE;
  }

  function isValidDate(
    uint256 year,
    uint256 month,
    uint256 day
  ) internal pure returns (bool valid) {
    if (year >= 1970 && month > 0 && month <= 12) {
      uint256 daysInMonth = _getDaysInMonth(year, month);
      if (day > 0 && day <= daysInMonth) {
        valid = true;
      }
    }
  }

  function isValidDateTime(
    uint256 year,
    uint256 month,
    uint256 day,
    uint256 hour,
    uint256 minute,
    uint256 second
  ) internal pure returns (bool valid) {
    if (isValidDate(year, month, day)) {
      if (hour < 24 && minute < 60 && second < 60) {
        valid = true;
      }
    }
  }

  function isLeapYear(uint256 timestamp) internal pure returns (bool leapYear) {
    (uint256 year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY);
    leapYear = _isLeapYear(year);
  }

  function _isLeapYear(uint256 year) internal pure returns (bool leapYear) {
    leapYear = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
  }

  function isWeekDay(uint256 timestamp) internal pure returns (bool weekDay) {
    weekDay = getDayOfWeek(timestamp) <= DOW_FRI;
  }

  function isWeekEnd(uint256 timestamp) internal pure returns (bool weekEnd) {
    weekEnd = getDayOfWeek(timestamp) >= DOW_SAT;
  }

  function getDaysInMonth(uint256 timestamp)
    internal
    pure
    returns (uint256 daysInMonth)
  {
    (uint256 year, uint256 month, ) = _daysToDate(timestamp / SECONDS_PER_DAY);
    daysInMonth = _getDaysInMonth(year, month);
  }

  function _getDaysInMonth(uint256 year, uint256 month)
    internal
    pure
    returns (uint256 daysInMonth)
  {
    if (
      month == 1 ||
      month == 3 ||
      month == 5 ||
      month == 7 ||
      month == 8 ||
      month == 10 ||
      month == 12
    ) {
      daysInMonth = 31;
    } else if (month != 2) {
      daysInMonth = 30;
    } else {
      daysInMonth = _isLeapYear(year) ? 29 : 28;
    }
  }

  // 1 = Monday, 7 = Sunday
  function getDayOfWeek(uint256 timestamp)
    internal
    pure
    returns (uint256 dayOfWeek)
  {
    uint256 _days = timestamp / SECONDS_PER_DAY;
    dayOfWeek = ((_days + 3) % 7) + 1;
  }

  // 1 = Monday, 7 = Sunday
  function getDayOfWeek(uint256 timestamp, uint256 index)
    internal
    pure
    returns (uint256 dayOfWeek)
  {
    uint256 _days = timestamp / SECONDS_PER_DAY;
    dayOfWeek = ((_days + index) % 7) + 1;
  }

  function getYear(uint256 timestamp) internal pure returns (uint256 year) {
    (year, , ) = _daysToDate(timestamp / SECONDS_PER_DAY);
  }

  function getMonth(uint256 timestamp) internal pure returns (uint256 month) {
    (, month, ) = _daysToDate(timestamp / SECONDS_PER_DAY);
  }

  function getDay(uint256 timestamp) internal pure returns (uint256 day) {
    (, , day) = _daysToDate(timestamp / SECONDS_PER_DAY);
  }

  function getHour(uint256 timestamp) internal pure returns (uint256 hour) {
    uint256 secs = timestamp % SECONDS_PER_DAY;
    hour = secs / SECONDS_PER_HOUR;
  }

  function getMinute(uint256 timestamp) internal pure returns (uint256 minute) {
    uint256 secs = timestamp % SECONDS_PER_HOUR;
    minute = secs / SECONDS_PER_MINUTE;
  }

  function getSecond(uint256 timestamp) internal pure returns (uint256 second) {
    second = timestamp % SECONDS_PER_MINUTE;
  }

  function addYears(uint256 timestamp, uint256 _years)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    (uint256 year, uint256 month, uint256 day) = _daysToDate(
      timestamp / SECONDS_PER_DAY
    );
    year += _years;
    uint256 daysInMonth = _getDaysInMonth(year, month);
    if (day > daysInMonth) {
      day = daysInMonth;
    }
    newTimestamp =
      _daysFromDate(year, month, day) *
      SECONDS_PER_DAY +
      (timestamp % SECONDS_PER_DAY);
    require(newTimestamp >= timestamp);
  }

  function addMonths(uint256 timestamp, uint256 _months)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    (uint256 year, uint256 month, uint256 day) = _daysToDate(
      timestamp / SECONDS_PER_DAY
    );
    month += _months;
    year += (month - 1) / 12;
    month = ((month - 1) % 12) + 1;
    uint256 daysInMonth = _getDaysInMonth(year, month);
    if (day > daysInMonth) {
      day = daysInMonth;
    }
    newTimestamp =
      _daysFromDate(year, month, day) *
      SECONDS_PER_DAY +
      (timestamp % SECONDS_PER_DAY);
    require(newTimestamp >= timestamp);
  }

  function addDays(uint256 timestamp, uint256 _days)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    newTimestamp = timestamp + _days * SECONDS_PER_DAY;
    require(newTimestamp >= timestamp);
  }

  function addHours(uint256 timestamp, uint256 _hours)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    newTimestamp = timestamp + _hours * SECONDS_PER_HOUR;
    require(newTimestamp >= timestamp);
  }

  function addMinutes(uint256 timestamp, uint256 _minutes)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    newTimestamp = timestamp + _minutes * SECONDS_PER_MINUTE;
    require(newTimestamp >= timestamp);
  }

  function addSeconds(uint256 timestamp, uint256 _seconds)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    newTimestamp = timestamp + _seconds;
    require(newTimestamp >= timestamp);
  }

  function subYears(uint256 timestamp, uint256 _years)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    (uint256 year, uint256 month, uint256 day) = _daysToDate(
      timestamp / SECONDS_PER_DAY
    );
    year -= _years;
    uint256 daysInMonth = _getDaysInMonth(year, month);
    if (day > daysInMonth) {
      day = daysInMonth;
    }
    newTimestamp =
      _daysFromDate(year, month, day) *
      SECONDS_PER_DAY +
      (timestamp % SECONDS_PER_DAY);
    require(newTimestamp <= timestamp);
  }

  function subMonths(uint256 timestamp, uint256 _months)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    (uint256 year, uint256 month, uint256 day) = _daysToDate(
      timestamp / SECONDS_PER_DAY
    );
    uint256 yearMonth = year * 12 + (month - 1) - _months;
    year = yearMonth / 12;
    month = (yearMonth % 12) + 1;
    uint256 daysInMonth = _getDaysInMonth(year, month);
    if (day > daysInMonth) {
      day = daysInMonth;
    }
    newTimestamp =
      _daysFromDate(year, month, day) *
      SECONDS_PER_DAY +
      (timestamp % SECONDS_PER_DAY);
    require(newTimestamp <= timestamp);
  }

  function subDays(uint256 timestamp, uint256 _days)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    newTimestamp = timestamp - _days * SECONDS_PER_DAY;
    require(newTimestamp <= timestamp);
  }

  function subHours(uint256 timestamp, uint256 _hours)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    newTimestamp = timestamp - _hours * SECONDS_PER_HOUR;
    require(newTimestamp <= timestamp);
  }

  function subMinutes(uint256 timestamp, uint256 _minutes)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    newTimestamp = timestamp - _minutes * SECONDS_PER_MINUTE;
    require(newTimestamp <= timestamp);
  }

  function subSeconds(uint256 timestamp, uint256 _seconds)
    internal
    pure
    returns (uint256 newTimestamp)
  {
    newTimestamp = timestamp - _seconds;
    require(newTimestamp <= timestamp);
  }

  function diffYears(uint256 fromTimestamp, uint256 toTimestamp)
    internal
    pure
    returns (uint256 _years)
  {
    require(fromTimestamp <= toTimestamp);
    (uint256 fromYear, , ) = _daysToDate(fromTimestamp / SECONDS_PER_DAY);
    (uint256 toYear, , ) = _daysToDate(toTimestamp / SECONDS_PER_DAY);
    _years = toYear - fromYear;
  }

  function diffMonths(uint256 fromTimestamp, uint256 toTimestamp)
    internal
    pure
    returns (uint256 _months)
  {
    require(fromTimestamp <= toTimestamp);
    (uint256 fromYear, uint256 fromMonth, ) = _daysToDate(
      fromTimestamp / SECONDS_PER_DAY
    );
    (uint256 toYear, uint256 toMonth, ) = _daysToDate(
      toTimestamp / SECONDS_PER_DAY
    );
    _months = toYear * 12 + toMonth - fromYear * 12 - fromMonth;
  }

  function diffDays(uint256 fromTimestamp, uint256 toTimestamp)
    internal
    pure
    returns (uint256 _days)
  {
    require(fromTimestamp <= toTimestamp);
    _days = (toTimestamp - fromTimestamp) / SECONDS_PER_DAY;
  }

  function diffHours(uint256 fromTimestamp, uint256 toTimestamp)
    internal
    pure
    returns (uint256 _hours)
  {
    require(fromTimestamp <= toTimestamp);
    _hours = (toTimestamp - fromTimestamp) / SECONDS_PER_HOUR;
  }

  function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp)
    internal
    pure
    returns (uint256 _minutes)
  {
    require(fromTimestamp <= toTimestamp);
    _minutes = (toTimestamp - fromTimestamp) / SECONDS_PER_MINUTE;
  }

  function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp)
    internal
    pure
    returns (uint256 _seconds)
  {
    require(fromTimestamp <= toTimestamp);
    _seconds = toTimestamp - fromTimestamp;
  }
}

File 28 of 35 : 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 29 of 35 : 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,
        uint256,
        uint256
    ) external view returns (uint256);
}

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

import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';

/// @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 is Ownable {
    /// @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
    /// @return whether the contract was successfully added to the whitelist
    function addToContractWhitelist(address _contract)
        external
        onlyOwner
        returns (bool)
    {
        require(
            isContract(_contract),
            'ContractWhitelist: Address must be a contract address'
        );
        require(
            !whitelistedContracts[_contract],
            'ContractWhitelist: Contract already whitelisted'
        );

        whitelistedContracts[_contract] = true;

        emit AddToContractWhitelist(_contract);

        return true;
    }

    /// @dev remove from  the contract whitelist
    /// @param _contract the address of the contract to remove from the contract whitelist
    /// @return whether the contract was successfully removed from the whitelist
    function removeFromContractWhitelist(address _contract)
        external
        returns (bool)
    {
        require(
            whitelistedContracts[_contract],
            'ContractWhitelist: Contract not whitelisted'
        );

        whitelistedContracts[_contract] = false;

        emit RemoveFromContractWhitelist(_contract);

        return true;
    }

    /* ========== MODIFIERS ========== */

    // Modifier is eligible sender modifier
    modifier isEligibleSender() {
        if (isContract(msg.sender))
            require(
                whitelistedContracts[msg.sender],
                'ContractWhitelist: Contract must be whitelisted'
            );
        _;
    }

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

    /// @dev checks for contract or eoa addresses
    /// @param addr the address to check
    /// @return 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 31 of 35 : IERC20SSOV.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {ISSOV} from './ISSOV.sol';

interface IERC20SSOV is ISSOV {
    function purchase(
        uint256 strikeIndex,
        uint256 amount,
        address user
    ) external returns (uint256, uint256);

    function deposit(
        uint256 strikeIndex,
        uint256 amount,
        address user
    ) external returns (bool);
}

File 32 of 35 : 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 33 of 35 : ISSOV.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface ISSOV {
    function epochStrikeTokens(uint256 epoch, uint256 strike)
        external
        view
        returns (address);

    function getAddress(bytes32 name) external view returns (address);

    function currentEpoch() external view returns (uint256);

    function epochStrikes(uint256 epoch, uint256 strikeIndex)
        external
        view
        returns (uint256);

    function settle(
        uint256 strikeIndex,
        uint256 amount,
        uint256 epoch
    ) external returns (uint256);
}

File 34 of 35 : IStakingRewards.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

interface IStakingRewards {
  // Views
  function lastTimeRewardApplicable() external view returns (uint256);

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

  function earned(address account) external view returns (uint256, uint256);

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

  function totalSupply() external view returns (uint256);

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

  function rewardsDPX(address account) external view returns  (uint256);
  
  function compound() external;

  // Mutative

  function stake(uint256 amount) external payable;

  function withdraw(uint256 amount) external;

  function getReward(uint256 rewardsTokenID) external;

  function exit() external;

}

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

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

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_dpx","type":"address"},{"internalType":"address","name":"_rdpx","type":"address"},{"internalType":"address","name":"_stakingRewards","type":"address"},{"internalType":"address","name":"_optionPricing","type":"address"},{"internalType":"address","name":"_rdpxPriceOracle","type":"address"},{"internalType":"address","name":"_volatilityOracle","type":"address"},{"internalType":"address","name":"_feeDistributor","type":"address"},{"internalType":"address","name":"_feeStrategy","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"AddToContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":true,"internalType":"address","name":"destination","type":"address"}],"name":"AddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Bootstrap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"Compound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"dpxWithdrawn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rdpxWithdrawn","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"expireDelayTolerance","type":"uint256"}],"name":"ExpireDelayToleranceUpdate","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":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"NewDeposit","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":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"NewPurchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pnl","type":"uint256"}],"name":"NewSettle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"}],"name":"NewStrike","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rdpxAmount","type":"uint256"}],"name":"NewWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"RemoveFromContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"addToContractWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"addresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bootstrap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculatePnl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strike","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"calculatePremium","outputs":[{"internalType":"uint256","name":"premium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"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":"settlementPrice","type":"uint256"},{"internalType":"uint256","name":"pnl","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateSettlementFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"compound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","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":"user","type":"address"}],"name":"deposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"strikeIndices","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address","name":"user","type":"address"}],"name":"depositMultiple","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochStartTimes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochStrikeTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochStrikes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20Implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireDelayTolerance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expireEpoch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"settlementPrice","type":"uint256"}],"name":"expireEpoch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"getAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochStrikeTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochStrikes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"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":"uint256","name":"timestamp","type":"uint256"}],"name":"getMonthlyExpiryFromTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getTotalEpochCallsPurchased","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getTotalEpochPremium","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getTotalEpochStrikeDeposits","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUsdPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserEpochCallsPurchased","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserEpochDeposits","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserEpochPremium","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isEpochExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isVaultReady","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"user","type":"address"}],"name":"purchase","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"removeFromContractWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"names","type":"bytes32[]"},{"internalType":"address[]","name":"destinations","type":"address[]"}],"name":"setAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"strikes","type":"uint256[]"}],"name":"setStrikes","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"settle","outputs":[{"internalType":"uint256","name":"pnl","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"settlementPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochCallsPurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochPremium","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochStrikeBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochStrikeDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochStrikeDpxBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalEpochStrikeRdpxBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_expireDelayTolerance","type":"uint256"}],"name":"updateExpireDelayTolerance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"userEpochCallsPurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"userEpochDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"userEpochPremium","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedContracts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"withdrawEpoch","type":"uint256"},{"internalType":"uint256","name":"strikeIndex","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256[2]","name":"","type":"uint256[2]"}],"stateMutability":"nonpayable","type":"function"}]

60a060405261012c6004553480156200001757600080fd5b5060405162007db538038062007db58339810160408190526200003a9162000832565b6200004533620003ee565b6002805460ff191690556001600160a01b038816620000905760405162461bcd60e51b8152602060048201526002602482015261453160f01b60448201526064015b60405180910390fd5b6001600160a01b038716620000cd5760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b0386166200010a5760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b038516620001475760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b038416620001845760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b038116620001c15760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b60056020527fccc88b330c22465d54da85345ca7fd42d1073ea97c5696e33432b63c081923d980546001600160a01b03199081166001600160a01b03858116919091179092557f7fb289d74e89aa951d6df036f505e04569b46feac2c37a0db801b8f4a2d8c930805482168b841617905560008051602062007d75833981519152805482168a841617905560008051602062007d95833981519152805482168984161790557fa34895bf08a03c19903f153b83bd840ec96aae5ac855d19e36ace94ce537d650805482168884161790557f20c17b37c5ab78def72d8ce7ce366f23eec10bf6eeb6bc6d80495dfa53ea5057805482168784161790557f6c8d5cbdd8e467916e2737c29f79ca89a665f8bae1b1f2a63b3c4bff7df8a435805482168684161790557fc1b1ed1d0373551f5ac3de995f6231e27485d5ffed3b3270cbdd6ba32f9ee874805482169284169290921790915569476f7665726e616e636560b01b6000527fa3c20e4cfcdbe0796697a05f5cc56e3d568bc2f08a21308461ccefe56b2fecb58054339216919091179055604051620003619062000807565b604051809103906000f0801580156200037e573d6000803e3d6000fd5b506001600160a01b039081166080526005602090815260008051602062007d9583398151915254630e488a0b60e31b60005260008051602062007d7583398151915254620003e0939081169291169060001990620039c46200043e821b17901c565b50505050505050506200099e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b801580620004cc5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156200048f57600080fd5b505afa158015620004a4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004ca9190620008da565b155b620005405760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000606482015260840162000087565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620005989185916200059d16565b505050565b6000620005f9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200067b60201b62003b20179092919060201c565b8051909150156200059857808060200190518101906200061a9190620008f4565b620005985760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000087565b60606200068c848460008562000696565b90505b9392505050565b606082471015620006f95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000087565b843b620007495760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000087565b600080866001600160a01b031685876040516200076791906200094b565b60006040518083038185875af1925050503d8060008114620007a6576040519150601f19603f3d011682016040523d82523d6000602084013e620007ab565b606091505b509092509050620007be828286620007c9565b979650505050505050565b60608315620007da5750816200068f565b825115620007eb5782518084602001fd5b8160405162461bcd60e51b815260040162000087919062000969565b611ed68062005e9f83390190565b80516001600160a01b03811681146200082d57600080fd5b919050565b600080600080600080600080610100898b0312156200085057600080fd5b6200085b8962000815565b97506200086b60208a0162000815565b96506200087b60408a0162000815565b95506200088b60608a0162000815565b94506200089b60808a0162000815565b9350620008ab60a08a0162000815565b9250620008bb60c08a0162000815565b9150620008cb60e08a0162000815565b90509295985092959890939650565b600060208284031215620008ed57600080fd5b5051919050565b6000602082840312156200090757600080fd5b815180151581146200068f57600080fd5b60005b83811015620009355781810151838201526020016200091b565b8381111562000945576000848401525b50505050565b600082516200095f81846020870162000918565b9190910192915050565b60208152600082518060208401526200098a81604085016020870162000918565b601f01601f19169190910160400192915050565b6080516154de620009c16000396000818161075a015261382601526154de6000f3fe608060405234801561001057600080fd5b50600436106103a35760003560e01c80638456cb59116101e9578063c300fd641161010f578063ea3bd5df116100ad578063f69e20461161007c578063f69e204614610971578063f6ac848814610979578063f72bf8fe1461098c578063fb969b0a1461099f57600080fd5b8063ea3bd5df1461090d578063ec85681614610920578063f2fde38b14610933578063f306694a1461094657600080fd5b8063d3e3e352116100e9578063d3e3e352146108bf578063d7e15131146108d2578063db2e21bc146108f2578063e8468ee4146108fa57600080fd5b8063c300fd6414610886578063c3d9ed3914610899578063cd653df6146108ac57600080fd5b806393c82c7511610187578063acc3a00611610156578063acc3a006146107f2578063b0f48cf714610805578063b12daf6914610830578063bf434b7a1461085b57600080fd5b806393c82c751461077c5780639bbce4781461079f578063a6fe2b9e146107bf578063ab2150cf146107df57600080fd5b80638da5cb5b116101c35780638da5cb5b1461071e5780638dbdbe6d1461072f5780638e143ccb14610742578063901be0411461075557600080fd5b80638456cb59146106d857806388e18e13146106e05780638990d045146106f357600080fd5b80635ba0bee1116102ce5780636db29f6d1161026c578063781ed9781161023b578063781ed978146106675780637e36701f146106925780638144eeba146106a5578063823c1512146106b857600080fd5b80636db29f6d146106245780636f56f56f1461062c578063715018a614610654578063766718081461065e57600080fd5b806361644373116102a857806361644373146105cc5780636274d49d146105d5578063699f200f146105e85780636a7784541461061157600080fd5b80635ba0bee1146105835780635c975abb146105ae57806361560c99146105b957600080fd5b8063344afb5f11610346578063441a3e7011610315578063441a3e7014610509578063470f4224146105295780634ab01f5b1461055d578063574cdded1461057057600080fd5b8063344afb5f1461049b578063391feebb146104bb5780633f4ba83a146104de5780633f83b8a5146104e657600080fd5b80631acf5582116103825780631acf55821461041257806321f8a7211461041a5780632807b9a8146104455780632dc96c8e1461047057600080fd5b806212100c146103a857806315943b99146103ce57806316279055146103ee575b600080fd5b6103bb6103b6366004614c42565b6109a7565b6040519081526020015b60405180910390f35b6103e16103dc366004614c64565b610b1b565b6040516103c59190614c7d565b6104026103fc366004614cd8565b3b151590565b60405190151581526020016103c5565b6103bb610ba8565b61042d610428366004614c64565b610c3a565b6040516001600160a01b0390911681526020016103c5565b6103bb610453366004614c42565b601360209081526000928352604080842090915290825290205481565b6103bb61047e366004614c42565b601060209081526000928352604080842090915290825290205481565b6103bb6104a9366004614c64565b600e6020526000908152604090205481565b6104026104c9366004614cd8565b60016020526000908152604090205460ff1681565b610402610c55565b6104026104f4366004614c64565b60086020526000908152604090205460ff1681565b61051c610517366004614c42565b610cab565b6040516103c59190614cf3565b61042d610537366004614c42565b600a6020908152600092835260408084209091529082529020546001600160a01b031681565b61040261056b366004614d6f565b610fa5565b6103bb61057e366004614dda565b6110cc565b6103bb610591366004614c42565b601560209081526000928352604080842090915290825290205481565b60025460ff16610402565b6103e16105c7366004614e06565b611480565b6103bb60045481565b6103e16105e3366004614e06565b6115b4565b61042d6105f6366004614c64565b6005602052600090815260409020546001600160a01b031681565b6103e161061f366004614c64565b6116de565b6104026117df565b61063f61063a366004614c64565b611941565b604080519283526020830191909152016103c5565b61065c611987565b005b6103bb60035481565b6103bb610675366004614c42565b601160209081526000928352604080842090915290825290205481565b6103bb6106a0366004614c42565b6119bd565b6104026106b3366004614ed7565b6119ee565b6106cb6106c6366004614c64565b611ab8565b6040516103c59190614f4a565b610402611bd0565b6103bb6106ee366004614dda565b611c2a565b6103bb610701366004614c42565b600f60209081526000928352604080842090915290825290205481565b6000546001600160a01b031661042d565b61040261073d366004614f8b565b611c46565b6103bb610750366004614c64565b611fc2565b61042d7f000000000000000000000000000000000000000000000000000000000000000081565b61040261078a366004614c64565b60076020526000908152604090205460ff1681565b6103bb6107ad366004614c64565b60166020526000908152604090205481565b6103bb6107cd366004614c64565b60066020526000908152604090205481565b6104026107ed366004614c64565b6120f6565b610402610800366004614cd8565b61217f565b6103bb610813366004614c42565b601460209081526000928352604080842090915290825290205481565b6103bb61083e366004614c42565b600b60209081526000928352604080842090915290825290205481565b6103bb610869366004614c42565b601260209081526000928352604080842090915290825290205481565b6103e1610894366004614c64565b6122eb565b6104026108a7366004614cd8565b6123e3565b6103e16108ba366004614c64565b6124ad565b6104026108cd366004614fb7565b6125a5565b6103bb6108e0366004614c64565b600c6020526000908152604090205481565b610402612748565b6103bb610908366004614dda565b61296f565b61063f61091b366004614f8b565b612a11565b6103e161092e366004614e06565b612e64565b61065c610941366004614cd8565b612f8e565b6103bb610954366004614c42565b600d60209081526000928352604080842090915290825290205481565b610402613029565b610402610987366004614c64565b6134ac565b6103bb61099a366004614dda565b6135de565b610402613634565b6000806109b2610ba8565b905080836109cf6c4f7074696f6e50726963696e6760981b610c3a565b6001600160a01b0316635b7b6d8860006109e842611fc2565b8987610a066f566f6c6174696c6974794f7261636c6560801b610c3a565b6001600160a01b0316633af2888b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3e57600080fd5b505afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a769190614feb565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a40160206040518083038186803b158015610ac757600080fd5b505afa158015610adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aff9190614feb565b610b09919061501a565b610b13919061504f565b949350505050565b60608160008111610b475760405162461bcd60e51b8152600401610b3e90615063565b60405180910390fd5b60008381526009602090815260409182902080548351818402810184019094528084529091830182828015610b9b57602002820191906000526020600020905b815481526020019060010190808311610b87575b5050505050915050919050565b6000610bc56e5264707850726963654f7261636c6560881b610c3a565b6001600160a01b031663e1aa60366040518163ffffffff1660e01b815260040160206040518083038186803b158015610bfd57600080fd5b505afa158015610c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c359190614feb565b905090565b6000908152600560205260409020546001600160a01b031690565b6000610c6d69476f7665726e616e636560b01b610c3a565b6001600160a01b0316336001600160a01b031614610c9d5760405162461bcd60e51b8152600401610b3e90615080565b610ca5613b2f565b50600190565b610cb3614bc4565b60025460ff1615610cd65760405162461bcd60e51b8152600401610b3e9061509d565b333b15610d0c573360009081526001602052604090205460ff16610d0c5760405162461bcd60e51b8152600401610b3e906150c7565b60008381526007602052604090205460ff16610d505760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610b3e565b6000838152600960205260409020548210610d7d5760405162461bcd60e51b8152600401610b3e90615116565b6000838152600960205260408120805484908110610d9d57610d9d615133565b906000526020600020015490508060001415610dcb5760405162461bcd60e51b8152600401610b3e90615149565b60003382604051602001610de0929190615166565b60408051601f1981840301815291815281516020928301206000888152600f845282812082825290935291205490915080610e435760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610b3e565b6000610e55630e488a0b60e31b610c3a565b6000888152600b602090815260408083208884528252808320548b8452601083528184208985529092528220549293509091610e9290859061501a565b610e9c919061504f565b90506000610eaf62088a0b60eb1b610c3a565b60008a8152600b602090815260408083208a84528252808320548d8452601183528184208b85529092528220549293509091610eec90879061501a565b610ef6919061504f565b60008b8152600f602090815260408083208a84529091528120559050610f266001600160a01b0385163385613bc2565b610f3a6001600160a01b0383163383613bc2565b604080518b8152602081018990523381830152606081018790526080810185905290517fbe7586dfb192ca07af28bcc9fc95e78619abff84853e614ba95a4864e955c5929181900360a00190a160408051808201909152928352602083015250979650505050505050565b600080546001600160a01b03163314610fd05760405162461bcd60e51b8152600401610b3e90615188565b8382146110045760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610b3e565b60005b848110156110c057600086868381811061102357611023615133565b905060200201359050600085858481811061104057611040615133565b90506020020160208101906110559190614cd8565b60008381526005602052604080822080546001600160a01b0319166001600160a01b03851690811790915590519293509184917fb37614c7d254ea8d16eb81fa11dddaeb266aa8ba4917980859c7740aff30c69191a3505080806110b8906151bd565b915050611007565b50600195945050505050565b60006110da60025460ff1690565b156110f75760405162461bcd60e51b8152600401610b3e9061509d565b333b1561112d573360009081526001602052604090205460ff1661112d5760405162461bcd60e51b8152600401610b3e906150c7565b60008281526007602052604090205460ff166111715760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610b3e565b600082815260096020526040902054841061119e5760405162461bcd60e51b8152600401610b3e90615116565b600083116111be5760405162461bcd60e51b8152600401610b3e906151d8565b60008281526009602052604081208054869081106111de576111de615133565b90600052602060002001549050806000141561120c5760405162461bcd60e51b8152600401610b3e90615149565b6000838152600a60209081526040808320848452909152908190205490516370a0823160e01b815233600482015285916001600160a01b0316906370a082319060240160206040518083038186803b15801561126757600080fd5b505afa15801561127b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129f9190614feb565b10156112d35760405162461bcd60e51b815260206004820152600360248201526222989b60e91b6044820152606401610b3e565b6000838152601660205260409020546112ed908286611c2a565b6000848152601660205260408120549193509061130b9084876135de565b9050600061131f630e488a0b60e31b610c3a565b9050600084116113575760405162461bcd60e51b815260206004820152600360248201526245313560e81b6044820152606401610b3e565b6000858152600a602090815260408083208684529091529081902054905163079cc67960e41b8152336004820152602481018890526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156113bb57600080fd5b505af11580156113cf573d6000803e3d6000fd5b50505050600082111561140a5761140a6113f96d2332b2a234b9ba3934b13aba37b960911b610c3a565b6001600160a01b0383169084613bc2565b6114293361141884876151f5565b6001600160a01b0384169190613bc2565b60408051868152602081018590523381830152606081018890526080810186905290517f170d93e3a85ba1c08f72d2c0ebd8835178a9b9f444c318ab404506c743d925bd9181900360a00190a15050509392505050565b606082600081116114a35760405162461bcd60e51b8152600401610b3e90615063565b60008481526009602052604081205490816001600160401b038111156114cb576114cb614e32565b6040519080825280602002602001820160405280156114f4578160200160208202803683370190505b50905060005b828110156115aa57600087815260096020526040812080548390811061152257611522615133565b9060005260206000200154905060008782604051602001611544929190615166565b60408051601f19818403018152918152815160209283012060008c81526015845282812082825290935291205485519192509085908590811061158957611589615133565b602002602001018181525050505080806115a2906151bd565b9150506114fa565b5095945050505050565b606082600081116115d75760405162461bcd60e51b8152600401610b3e90615063565b60008481526009602052604081205490816001600160401b038111156115ff576115ff614e32565b604051908082528060200260200182016040528015611628578160200160208202803683370190505b50905060005b828110156115aa57600087815260096020526040812080548390811061165657611656615133565b9060005260206000200154905060008782604051602001611678929190615166565b60408051601f19818403018152918152815160209283012060008c8152600f84528281208282529093529120548551919250908590859081106116bd576116bd615133565b602002602001018181525050505080806116d6906151bd565b91505061162e565b606081600081116117015760405162461bcd60e51b8152600401610b3e90615063565b60008381526009602052604081205490816001600160401b0381111561172957611729614e32565b604051908082528060200260200182016040528015611752578160200160208202803683370190505b50905060005b828110156117d65760008681526012602090815260408083206009909252822080549192918490811061178d5761178d615133565b90600052602060002001548152602001908152602001600020548282815181106117b9576117b9615133565b6020908102919091010152806117ce816151bd565b915050611758565b50949350505050565b60006117ed60025460ff1690565b1561180a5760405162461bcd60e51b8152600401610b3e9061509d565b333b15611840573360009081526001602052604090205460ff166118405760405162461bcd60e51b8152600401610b3e906150c7565b60035460009081526007602052604090205460ff16156118725760405162461bcd60e51b8152600401610b3e9061520c565b600061187f600354611941565b915050804210156118b75760405162461bcd60e51b8152602060048201526002602482015261114d60f21b6044820152606401610b3e565b6004546118c49082615228565b4211156118f95760405162461bcd60e51b815260206004820152600360248201526245323360e81b6044820152606401610b3e565b611901610ba8565b60035460009081526016602052604090205561191d6001613bf2565b50506003546000908152600760205260409020805460ff1916600190811790915590565b60008082600081116119655760405162461bcd60e51b8152600401610b3e90615063565b60008481526006602052604090205461197d81611fc2565b9250925050915091565b6000546001600160a01b031633146119b15760405162461bcd60e51b8152600401610b3e90615188565b6119bb600061434d565b565b600960205281600052604060002081815481106119d957600080fd5b90600052602060002001600091509150505481565b60006119fc60025460ff1690565b15611a195760405162461bcd60e51b8152600401610b3e9061509d565b8251845114611a4f5760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401610b3e565b60005b8451811015611aab57611a98858281518110611a7057611a70615133565b6020026020010151858381518110611a8a57611a8a615133565b602002602001015185611c46565b5080611aa3816151bd565b915050611a52565b50600190505b9392505050565b60608160008111611adb5760405162461bcd60e51b8152600401610b3e90615063565b60008381526009602052604081205490816001600160401b03811115611b0357611b03614e32565b604051908082528060200260200182016040528015611b2c578160200160208202803683370190505b50905060005b828110156117d6576000868152600a6020908152604080832060099092528220805491929184908110611b6757611b67615133565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b0316828281518110611ba657611ba6615133565b6001600160a01b039092166020928302919091019091015280611bc8816151bd565b915050611b32565b6000611be869476f7665726e616e636560b01b610c3a565b6001600160a01b0316336001600160a01b031614611c185760405162461bcd60e51b8152600401610b3e90615080565b611c2061439d565b610ca56000613bf2565b6000828411611c3a576000610b13565b8382610aff85836151f5565b6000611c5460025460ff1690565b15611c715760405162461bcd60e51b8152600401610b3e9061509d565b333b15611ca7573360009081526001602052604090205460ff16611ca75760405162461bcd60e51b8152600401610b3e906150c7565b60006003546001611cb89190615228565b60035490915015611d255760035460009081526007602052604090205460ff168015611cf3575060008181526008602052604090205460ff16155b611d255760405162461bcd60e51b815260206004820152600360248201526245313960e81b6044820152606401610b3e565b6000818152600960205260409020548510611d525760405162461bcd60e51b8152600401610b3e90615116565b60008411611d725760405162461bcd60e51b8152600401610b3e906151d8565b6000818152600960205260408120805487908110611d9257611d92615133565b906000526020600020015490508060001415611dc05760405162461bcd60e51b8152600401610b3e90615149565b60008482604051602001611dd5929190615166565b604051602081830303815290604052805190602001209050611e14333088611e03630e488a0b60e31b610c3a565b6001600160a01b03169291906143f5565b6000838152600f6020908152604080832084845290915281208054889290611e3d908490615228565b90915550506000838152600b6020908152604080832085845290915281208054889290611e6b908490615228565b90915550506000838152600c602052604081208054889290611e8e908490615228565b90915550506000838152600d6020908152604080832085845290915281208054889290611ebc908490615228565b90915550506000838152600e602052604081208054889290611edf908490615228565b90915550611eff90506d5374616b696e675265776172647360901b610c3a565b6001600160a01b031663a694fc3a876040518263ffffffff1660e01b8152600401611f2c91815260200190565b600060405180830381600087803b158015611f4657600080fd5b505af1158015611f5a573d6000803e3d6000fd5b505060408051868152602081018690529081018990526001600160a01b03881660608201523360808201527fcaa9001342572663a8f7c22e7c6f0331a45254407418d9f993ed2d1485adc205925060a001905060405180910390a15060019695505050505050565b600080611fec611fd184614433565b611fda85614453565b611fe5906001615228565b600061446d565b90506005611ff982614488565b10156120315761202e61200b82614433565b61201483614453565b600761201f856144bc565b61202991906151f5565b61446d565b90505b600061207961203f83614433565b61204884614453565b61205185614488565b61205a866144bc565b612065906005615228565b61206f91906151f5565b60086000806144ce565b9050838111611ab15760006120a461209086614433565b61209987614453565b611fe5906002615228565b905060056120b182614488565b10156120c6576120c361200b82614433565b90505b6120ed6120d282614433565b6120db83614453565b6120e484614488565b61205a856144bc565b95945050505050565b600061210e69476f7665726e616e636560b01b610c3a565b6001600160a01b0316336001600160a01b03161461213e5760405162461bcd60e51b8152600401610b3e90615080565b60048290556040518281527f5259439c9ac2029585dd4a349897aa1e8298d26537c3b57453f275126db919189060200160405180910390a15060015b919050565b600080546001600160a01b031633146121aa5760405162461bcd60e51b8152600401610b3e90615188565b813b6122165760405162461bcd60e51b815260206004820152603560248201527f436f6e747261637457686974656c6973743a2041646472657373206d757374206044820152746265206120636f6e7472616374206164647265737360581b6064820152608401610b3e565b6001600160a01b03821660009081526001602052604090205460ff16156122975760405162461bcd60e51b815260206004820152602f60248201527f436f6e747261637457686974656c6973743a20436f6e747261637420616c726560448201526e18591e481dda1a5d195b1a5cdd1959608a1b6064820152608401610b3e565b6001600160a01b0382166000818152600160208190526040808320805460ff1916909217909155517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a2506001919050565b6060816000811161230e5760405162461bcd60e51b8152600401610b3e90615063565b60008381526009602052604081205490816001600160401b0381111561233657612336614e32565b60405190808252806020026020018201604052801561235f578160200160208202803683370190505b50905060005b828110156117d6576000868152600b602090815260408083206009909252822080549192918490811061239a5761239a615133565b90600052602060002001548152602001908152602001600020548282815181106123c6576123c6615133565b6020908102919091010152806123db816151bd565b915050612365565b6001600160a01b03811660009081526001602052604081205460ff1661245f5760405162461bcd60e51b815260206004820152602b60248201527f436f6e747261637457686974656c6973743a20436f6e7472616374206e6f742060448201526a1dda1a5d195b1a5cdd195960aa1b6064820152608401610b3e565b6001600160a01b038216600081815260016020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a2506001919050565b606081600081116124d05760405162461bcd60e51b8152600401610b3e90615063565b60008381526009602052604081205490816001600160401b038111156124f8576124f8614e32565b604051908082528060200260200182016040528015612521578160200160208202803683370190505b50905060005b828110156117d65760008681526014602090815260408083206009909252822080549192918490811061255c5761255c615133565b906000526020600020015481526020019081526020016000205482828151811061258857612588615133565b60209081029190910101528061259d816151bd565b915050612527565b600080546001600160a01b031633146125d05760405162461bcd60e51b8152600401610b3e90615188565b60025460ff16156125f35760405162461bcd60e51b8152600401610b3e9061509d565b600060035460016126049190615228565b6000818152600c6020526040902054909150156126485760405162461bcd60e51b815260206004820152600260248201526108a760f31b6044820152606401610b3e565b6003541561269657600061265d600354611941565b9150508042116126945760405162461bcd60e51b8152602060048201526002602482015261453960f01b6044820152606401610b3e565b505b600081815260096020908152604090912084516126b592860190614be2565b5060008181526006602052604081204290555b835181101561273e577f5185be10ef2a03e926961817be495a630ded54bceffb3ba11f6af477c9c766828285838151811061270557612705615133565b6020026020010151604051612724929190918252602082015260400190565b60405180910390a180612736816151bd565b9150506126c8565b5060019392505050565b600061276069476f7665726e616e636560b01b610c3a565b6001600160a01b0316336001600160a01b0316146127905760405162461bcd60e51b8152600401610b3e90615080565b60025460ff166127d95760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b3e565b60006127ea62088a0b60eb1b610c3a565b905060006127fe630e488a0b60e31b610c3a565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a082319060240160206040518083038186803b15801561284357600080fd5b505afa158015612857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061287b9190614feb565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a082319060240160206040518083038186803b1580156128c057600080fd5b505afa1580156128d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f89190614feb565b905061290e6001600160a01b0385163384613bc2565b6129226001600160a01b0384163383613bc2565b60408051338152602081018490529081018290527fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae0595906060015b60405180910390a1600194505050505090565b60006129886a466565537472617465677960a81b610c3a565b604051633a11a3b960e21b81526004810186905260248101859052604481018490526001600160a01b03919091169063e8468ee4906064015b60206040518083038186803b1580156129d957600080fd5b505afa1580156129ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b139190614feb565b600080612a2060025460ff1690565b15612a3d5760405162461bcd60e51b8152600401610b3e9061509d565b333b15612a73573360009081526001602052604090205460ff16612a735760405162461bcd60e51b8152600401610b3e906150c7565b60035460009081526008602052604090205460ff16612aba5760405162461bcd60e51b815260206004820152600360248201526204532360ec1b6044820152606401610b3e565b6003546000908152600960205260409020548510612aea5760405162461bcd60e51b8152600401610b3e90615116565b60008411612b0a5760405162461bcd60e51b8152600401610b3e906151d8565b6003546000908152600960205260408120805487908110612b2d57612b2d615133565b906000526020600020015490508060001415612b5b5760405162461bcd60e51b8152600401610b3e90615149565b60008482604051602001612b70929190615166565b6040516020818303038152906040528051906020012090506000612b9a630e488a0b60e31b610c3a565b90506000612ba6610ba8565b90506000612bb4858a6109a7565b90506000612bc383878c61296f565b60035460009081526012602090815260408083208a8452909152812080549293508c92909190612bf4908490615228565b90915550506003546000908152601360209081526040808320888452909152812080548c9290612c25908490615228565b9091555050600354600090815260146020908152604080832089845290915281208054849290612c56908490615228565b9091555050600354600090815260156020908152604080832088845290915281208054849290612c87908490615228565b90915550612c959050613029565b506003546000908152600d6020908152604080832089845290915281208054849290612cc2908490615228565b90915550506003546000908152600e602052604081208054849290612ce8908490615228565b90915550612d0f90503330612cfd8486615228565b6001600160a01b0388169291906143f5565b8015612d4357612d43612d326d2332b2a234b9ba3934b13aba37b960911b610c3a565b6001600160a01b0386169083613bc2565b6003546000908152600a60209081526040808320898452909152902054612d74906001600160a01b03168a8c613bc2565b612d8e6d5374616b696e675265776172647360901b610c3a565b6001600160a01b031663a694fc3a836040518263ffffffff1660e01b8152600401612dbb91815260200190565b600060405180830381600087803b158015612dd557600080fd5b505af1158015612de9573d6000803e3d6000fd5b505060035460408051918252602082018a905281018d905260608101859052608081018490526001600160a01b038c1660a08201523360c08201527f78de8c82973d11415ea2004f458680aa6d5826c3e8a798496a61db56fa66417b925060e001905060405180910390a1909a909950975050505050505050565b60608260008111612e875760405162461bcd60e51b8152600401610b3e90615063565b60008481526009602052604081205490816001600160401b03811115612eaf57612eaf614e32565b604051908082528060200260200182016040528015612ed8578160200160208202803683370190505b50905060005b828110156115aa576000878152600960205260408120805483908110612f0657612f06615133565b9060005260206000200154905060008782604051602001612f28929190615166565b60408051601f19818403018152918152815160209283012060008c815260138452828120828252909352912054855191925090859085908110612f6d57612f6d615133565b60200260200101818152505050508080612f86906151bd565b915050612ede565b6000546001600160a01b03163314612fb85760405162461bcd60e51b8152600401610b3e90615188565b6001600160a01b03811661301d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b3e565b6130268161434d565b50565b600061303760025460ff1690565b156130545760405162461bcd60e51b8152600401610b3e9061509d565b60035460009081526007602052604090205460ff16156130865760405162461bcd60e51b8152600401610b3e9061520c565b60035460009081526008602052604090205460ff166130cd5760405162461bcd60e51b815260206004820152600360248201526204532360ec1b6044820152606401610b3e565b60006130e96d5374616b696e675265776172647360901b610c3a565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b15801561312e57600080fd5b505afa158015613142573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131669190614feb565b6040516246613160e11b81523060048201529091506000906001600160a01b03841690628cc26290602401604080518083038186803b1580156131a857600080fd5b505afa1580156131bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131e09190615240565b60035460009081526009602090815260408083208054825181850281018501909352808352949650929450929083018282801561323c57602002820191906000526020600020905b815481526020019060010190808311613228575b5050505050905060005b815181101561336a576003546000908152600e6020908152604080832054600d90925282208451839086908690811061328157613281615133565b6020026020010151815260200190815260200160002054856132a3919061501a565b6132ad919061504f565b90508060106000600354815260200190815260200160002060008585815181106132d9576132d9615133565b6020026020010151815260200190815260200160002060008282546132fe9190615228565b90915550506003546000908152600d60205260408120845183929086908690811061332b5761332b615133565b6020026020010151815260200190815260200160002060008282546133509190615228565b909155508291506133629050816151bd565b915050613246565b506003546000908152600e60205260408120805484929061338c908490615228565b909155505081156133eb57836001600160a01b031663f69e20466040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156133d257600080fd5b505af11580156133e6573d6000803e3d6000fd5b505050505b6003546040516370a0823160e01b81523060048201527f5af10a4040aa7915142a090ccc9255ef57ae8241526de1c25a8cc33e473956b09190849086906001600160a01b038916906370a082319060240160206040518083038186803b15801561345457600080fd5b505afa158015613468573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061348c9190614feb565b60408051948552602085019390935291830152606082015260800161295c565b60006134c469476f7665726e616e636560b01b610c3a565b6001600160a01b0316336001600160a01b0316146134f45760405162461bcd60e51b8152600401610b3e90615080565b60025460ff16156135175760405162461bcd60e51b8152600401610b3e9061509d565b60035460009081526007602052604090205460ff16156135495760405162461bcd60e51b8152600401610b3e9061520c565b6000613556600354611941565b915050600454816135679190615228565b421161359a5760405162461bcd60e51b8152602060048201526002602482015261114d60f21b6044820152606401610b3e565b60035460009081526016602052604090208390556135b86001613bf2565b50506003546000908152600760205260409020805460ff19166001908117909155919050565b60006135f76a466565537472617465677960a81b610c3a565b604051637b95fc7f60e11b81526004810186905260248101859052604481018490526001600160a01b03919091169063f72bf8fe906064016129c1565b600080546001600160a01b0316331461365f5760405162461bcd60e51b8152600401610b3e90615188565b60025460ff16156136825760405162461bcd60e51b8152600401610b3e9061509d565b600060035460016136939190615228565b60008181526008602052604090205490915060ff16156136da5760405162461bcd60e51b8152602060048201526002602482015261453560f01b6044820152606401610b3e565b60008181526009602052604090205461371a5760405162461bcd60e51b8152602060048201526002602482015261229b60f11b6044820152606401610b3e565b600354156137685760035460009081526007602052604090205460ff166137685760405162461bcd60e51b8152602060048201526002602482015261453760f01b6044820152606401610b3e565b60005b6000828152600960205260409020548110156139635760008281526009602052604081208054839081106137a1576137a1615133565b9060005260206000200154905060006137e3604051806040016040528060098152602001681c9114160b50d0531360ba1b8152506137de8461452a565b614627565b905061380e81604051806040016040528060078152602001662d45504f43482d60c81b815250614627565b905061381d816137de8661452a565b9050600061384a7f0000000000000000000000000000000000000000000000000000000000000000614653565b60405163266c45bb60e11b81529091506001600160a01b03821690634cd88b769061387b90859081906004016152bc565b600060405180830381600087803b15801561389557600080fd5b505af11580156138a9573d6000803e3d6000fd5b5050506000868152600a60209081526040808320878452825280832080546001600160a01b0319166001600160a01b038716908117909155898452600b8352818420888552909252918290205491516340c10f1960e01b8152306004820152602481019290925291506340c10f1990604401600060405180830381600087803b15801561393557600080fd5b505af1158015613949573d6000803e3d6000fd5b50505050505050808061395b906151bd565b91505061376b565b5060008181526008602052604090819020805460ff191660011790556003829055517fb5ca1ca1b7b47549eb8af476f3ef702fc63bcd8b8c01dc163b009bb818f97997906139b49083815260200190565b60405180910390a1600191505090565b801580613a4d5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015613a1357600080fd5b505afa158015613a27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a4b9190614feb565b155b613ab85760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610b3e565b6040516001600160a01b038316602482015260448101829052613b1b90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526146eb565b505050565b6060610b1384846000856147bd565b60025460ff16613b785760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b3e565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040516001600160a01b038316602482015260448101829052613b1b90849063a9059cbb60e01b90606401613ae4565b6000613c0e6d5374616b696e675265776172647360901b610c3a565b90506000613c2162088a0b60eb1b610c3a565b90506000613c35630e488a0b60e31b610c3a565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038516906370a082319060240160206040518083038186803b158015613c7a57600080fd5b505afa158015613c8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cb29190614feb565b1115613d88576040516370a0823160e01b81523060048201526001600160a01b03841690632e1a7d4d9082906370a082319060240160206040518083038186803b158015613cff57600080fd5b505afa158015613d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d379190614feb565b6040518263ffffffff1660e01b8152600401613d5591815260200190565b600060405180830381600087803b158015613d6f57600080fd5b505af1158015613d83573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b158015613dca57600080fd5b505afa158015613dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e029190614feb565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a082319060240160206040518083038186803b158015613e4757600080fd5b505afa158015613e5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e7f9190614feb565b604051631c4b774b60e01b8152600260048201529091506001600160a01b03861690631c4b774b90602401600060405180830381600087803b158015613ec457600080fd5b505af1158015613ed8573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201528492506001600160a01b03871691506370a082319060240160206040518083038186803b158015613f1d57600080fd5b505afa158015613f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f559190614feb565b613f5f91906151f5565b6040516370a0823160e01b815230600482015290925081906001600160a01b038516906370a082319060240160206040518083038186803b158015613fa357600080fd5b505afa158015613fb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fdb9190614feb565b613fe591906151f5565b6003546000908152600e6020526040902054909150156143455760035460009081526009602090815260408083208054825181850281018501909352808352919290919083018282801561405857602002820191906000526020600020905b815481526020019060010190808311614044575b5050505050905060005b8151811015614342576003546000908152600e6020908152604080832054600d90925282208451839086908690811061409d5761409d615133565b6020026020010151815260200190815260200160002054856140bf919061501a565b6140c9919061504f565b90506000614145601660006003548152602001908152602001600020548585815181106140f8576140f8615133565b6020026020010151601260006003548152602001908152602001600020600088888151811061412957614129615133565b6020026020010151815260200190815260200160002054611c2a565b90508082600b60006003548152602001908152602001600020600087878151811061417257614172615133565b60200260200101518152602001908152602001600020546141939190615228565b61419d91906151f5565b60106000600354815260200190815260200160002060008686815181106141c6576141c6615133565b6020026020010151815260200190815260200160002060008282546141eb9190615228565b9091555050891561428a57601460006003548152602001908152602001600020600085858151811061421f5761421f615133565b6020026020010151815260200190815260200160002054601060006003548152602001908152602001600020600086868151811061425f5761425f615133565b6020026020010151815260200190815260200160002060008282546142849190615228565b90915550505b6003546000908152600e6020908152604080832054600d90925282208651919290918790879081106142be576142be615133565b6020026020010151815260200190815260200160002054876142e0919061501a565b6142ea919061504f565b601160006003548152602001908152602001600020600086868151811061431357614313615133565b60200260200101518152602001908152602001600020819055505050808061433a906151bd565b915050614062565b50505b505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60025460ff16156143c05760405162461bcd60e51b8152600401610b3e9061509d565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613ba53390565b6040516001600160a01b038085166024830152831660448201526064810182905261442d9085906323b872dd60e01b90608401613ae4565b50505050565b600061444a614445620151808461504f565b6148da565b50909392505050565b6000614465614445620151808461504f565b509392505050565b60006201518061447e858585614a4e565b610b13919061501a565b600080614498620151808461504f565b905060076144a7826003615228565b6144b191906152e1565b611ab1906001615228565b6000610b13614445620151808461504f565b6000816144dc603c8561501a565b6144e8610e108761501a565b620151806144f78b8b8b614a4e565b614501919061501a565b61450b9190615228565b6145159190615228565b61451f9190615228565b979650505050505050565b60608161454e5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156145785780614562816151bd565b91506145719050600a8361504f565b9150614552565b6000816001600160401b0381111561459257614592614e32565b6040519080825280601f01601f1916602001820160405280156145bc576020820181803683370190505b5090505b8415610b13576145d16001836151f5565b91506145de600a866152e1565b6145e9906030615228565b60f81b8183815181106145fe576145fe615133565b60200101906001600160f81b031916908160001a905350614620600a8661504f565b94506145c0565b6060828260405160200161463c9291906152f5565b604051602081830303815290604052905092915050565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b03811661217a5760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610b3e565b6000614740826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b209092919063ffffffff16565b805190915015613b1b578080602001905181019061475e9190615324565b613b1b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b3e565b60608247101561481e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b3e565b843b61486c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b3e565b600080866001600160a01b031685876040516148889190615346565b60006040518083038185875af1925050503d80600081146148c5576040519150601f19603f3d011682016040523d82523d6000602084013e6148ca565b606091505b509150915061451f828286614b8b565b60008080838162253d8c6148f18362010bd9615362565b6148fb9190615362565b9050600062023ab161490e8360046153a3565b6149189190615428565b905060046149298262023ab16153a3565b614934906003615362565b61493e9190615428565b6149489083615456565b9150600062164b0961495b846001615362565b61496790610fa06153a3565b6149719190615428565b90506004614981826105b56153a3565b61498b9190615428565b6149959084615456565b6149a090601f615362565b9250600061098f6149b28560506153a3565b6149bc9190615428565b9050600060506149ce8361098f6153a3565b6149d89190615428565b6149e29086615456565b90506149ef600b83615428565b94506149fc85600c6153a3565b614a07836002615362565b614a119190615456565b91508483614a20603187615456565b614a2b9060646153a3565b614a359190615362565b614a3f9190615362565b9a919950975095505050505050565b60006107b2841015614a5f57600080fd5b838383600062253d8c60046064600c614a79600e88615456565b614a839190615428565b614a8f88611324615362565b614a999190615362565b614aa39190615428565b614aae9060036153a3565b614ab89190615428565b600c80614ac6600e88615456565b614ad09190615428565b614adb90600c6153a3565b614ae6600288615456565b614af09190615456565b614afc9061016f6153a3565b614b069190615428565b6004600c614b15600e89615456565b614b1f9190615428565b614b2b896112c0615362565b614b359190615362565b614b41906105b56153a3565b614b4b9190615428565b614b57617d4b87615456565b614b619190615362565b614b6b9190615362565b614b759190615456565b614b7f9190615456565b98975050505050505050565b60608315614b9a575081611ab1565b825115614baa5782518084602001fd5b8160405162461bcd60e51b8152600401610b3e9190615495565b60405180604001604052806002906020820280368337509192915050565b828054828255906000526020600020908101928215614c1d579160200282015b82811115614c1d578251825591602001919060010190614c02565b50614c29929150614c2d565b5090565b5b80821115614c295760008155600101614c2e565b60008060408385031215614c5557600080fd5b50508035926020909101359150565b600060208284031215614c7657600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015614cb557835183529284019291840191600101614c99565b50909695505050505050565b80356001600160a01b038116811461217a57600080fd5b600060208284031215614cea57600080fd5b611ab182614cc1565b60408101818360005b6002811015614d1b578151835260209283019290910190600101614cfc565b50505092915050565b60008083601f840112614d3657600080fd5b5081356001600160401b03811115614d4d57600080fd5b6020830191508360208260051b8501011115614d6857600080fd5b9250929050565b60008060008060408587031215614d8557600080fd5b84356001600160401b0380821115614d9c57600080fd5b614da888838901614d24565b90965094506020870135915080821115614dc157600080fd5b50614dce87828801614d24565b95989497509550505050565b600080600060608486031215614def57600080fd5b505081359360208301359350604090920135919050565b60008060408385031215614e1957600080fd5b82359150614e2960208401614cc1565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112614e5957600080fd5b813560206001600160401b0380831115614e7557614e75614e32565b8260051b604051601f19603f83011681018181108482111715614e9a57614e9a614e32565b604052938452858101830193838101925087851115614eb857600080fd5b83870191505b8482101561451f57813583529183019190830190614ebe565b600080600060608486031215614eec57600080fd5b83356001600160401b0380821115614f0357600080fd5b614f0f87838801614e48565b94506020860135915080821115614f2557600080fd5b50614f3286828701614e48565b925050614f4160408501614cc1565b90509250925092565b6020808252825182820181905260009190848201906040850190845b81811015614cb55783516001600160a01b031683529284019291840191600101614f66565b600080600060608486031215614fa057600080fd5b8335925060208401359150614f4160408501614cc1565b600060208284031215614fc957600080fd5b81356001600160401b03811115614fdf57600080fd5b610b1384828501614e48565b600060208284031215614ffd57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561503457615034615004565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261505e5761505e615039565b500490565b60208082526003908201526245313360e81b604082015260600190565b60208082526003908201526222991960e91b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602f908201527f436f6e747261637457686974656c6973743a20436f6e7472616374206d75737460408201526e081899481dda1a5d195b1a5cdd1959608a1b606082015260800190565b60208082526003908201526204531360ec1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60208082526003908201526222989960e91b604082015260600190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006000198214156151d1576151d1615004565b5060010190565b60208082526003908201526245313160e81b604082015260600190565b60008282101561520757615207615004565b500390565b602080825260029082015261453360f01b604082015260600190565b6000821982111561523b5761523b615004565b500190565b6000806040838503121561525357600080fd5b505080516020909101519092909150565b60005b8381101561527f578181015183820152602001615267565b8381111561442d5750506000910152565b600081518084526152a8816020860160208601615264565b601f01601f19169290920160200192915050565b6040815260006152cf6040830185615290565b82810360208401526120ed8185615290565b6000826152f0576152f0615039565b500690565b60008351615307818460208801615264565b83519083019061531b818360208801615264565b01949350505050565b60006020828403121561533657600080fd5b81518015158114611ab157600080fd5b60008251615358818460208701615264565b9190910192915050565b600080821280156001600160ff1b038490038513161561538457615384615004565b600160ff1b839003841281161561539d5761539d615004565b50500190565b60006001600160ff1b03818413828413808216868404861116156153c9576153c9615004565b600160ff1b60008712828116878305891216156153e8576153e8615004565b6000871292508782058712848416161561540457615404615004565b8785058712818416161561541a5761541a615004565b505050929093029392505050565b60008261543757615437615039565b600160ff1b82146000198414161561545157615451615004565b500590565b60008083128015600160ff1b85018412161561547457615474615004565b6001600160ff1b038401831381161561548f5761548f615004565b50500390565b602081526000611ab1602083018461529056fea26469706673582212207745511da782dbd342b5459b05c2e5ad76000f6b7240f49a30aac355cb0602a564736f6c63430008090033608060405234801561001057600080fd5b50611eb6806100206000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80635c975abb11610104578063a217fddf116100a2578063d539139311610071578063d5391393146103ce578063d547741f146103f5578063dd62ed3e14610408578063e63ab1e91461044157600080fd5b8063a217fddf1461038d578063a457c2d714610395578063a9059cbb146103a8578063ca15c873146103bb57600080fd5b80638456cb59116100de5780638456cb591461033f5780639010d07c1461034757806391d148541461037257806395d89b411461038557600080fd5b80635c975abb146102f757806370a082311461030357806379cc67901461032c57600080fd5b8063313ce567116101715780633f4ba83a1161014b5780633f4ba83a146102b657806340c10f19146102be57806342966c68146102d15780634cd88b76146102e457600080fd5b8063313ce5671461028157806336568abe1461029057806339509351146102a357600080fd5b806318160ddd116101ad57806318160ddd1461022457806323b872dd14610236578063248a9ca3146102495780632f2ff15d1461026c57600080fd5b806301ffc9a7146101d457806306fdde03146101fc578063095ea7b314610211575b600080fd5b6101e76101e23660046119fd565b610456565b60405190151581526020015b60405180910390f35b610204610481565b6040516101f39190611a53565b6101e761021f366004611aa2565b610513565b60cb545b6040519081526020016101f3565b6101e7610244366004611acc565b610529565b610228610257366004611b08565b60009081526065602052604090206001015490565b61027f61027a366004611b21565b6105d8565b005b604051601281526020016101f3565b61027f61029e366004611b21565b610603565b6101e76102b1366004611aa2565b610681565b61027f6106bd565b61027f6102cc366004611aa2565b610751565b61027f6102df366004611b08565b6107f0565b61027f6102f2366004611bf0565b6107fd565b61012d5460ff166101e7565b610228610311366004611c54565b6001600160a01b0316600090815260c9602052604090205490565b61027f61033a366004611aa2565b610874565b61027f6108f5565b61035a610355366004611c6f565b610987565b6040516001600160a01b0390911681526020016101f3565b6101e7610380366004611b21565b6109a6565b6102046109d1565b610228600081565b6101e76103a3366004611aa2565b6109e0565b6101e76103b6366004611aa2565b610a79565b6102286103c9366004611b08565b610a86565b6102287f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b61027f610403366004611b21565b610a9d565b610228610416366004611c91565b6001600160a01b03918216600090815260ca6020908152604080832093909416825291909152205490565b610228600080516020611e6183398151915281565b60006001600160e01b03198216635a05180f60e01b148061047b575061047b82610ac3565b92915050565b606060cc805461049090611cbb565b80601f01602080910402602001604051908101604052809291908181526020018280546104bc90611cbb565b80156105095780601f106104de57610100808354040283529160200191610509565b820191906000526020600020905b8154815290600101906020018083116104ec57829003601f168201915b5050505050905090565b6000610520338484610af8565b50600192915050565b6000610536848484610c1c565b6001600160a01b038416600090815260ca60209081526040808320338452909152902054828110156105c05760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6105cd8533858403610af8565b506001949350505050565b6000828152606560205260409020600101546105f48133610df7565b6105fe8383610e5b565b505050565b6001600160a01b03811633146106735760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105b7565b61067d8282610e7d565b5050565b33600081815260ca602090815260408083206001600160a01b038716845290915281205490916105209185906106b8908690611d0c565b610af8565b6106d5600080516020611e61833981519152336109a6565b6107475760405162461bcd60e51b815260206004820152603960248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20756e70617573650000000000000060648201526084016105b7565b61074f610e9f565b565b61077b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6336109a6565b6107e65760405162461bcd60e51b815260206004820152603660248201527f45524332305072657365744d696e7465725061757365723a206d7573742068616044820152751d99481b5a5b9d195c881c9bdb19481d1bc81b5a5b9d60521b60648201526084016105b7565b61067d8282610f34565b6107fa338261101f565b50565b600054610100900460ff1680610816575060005460ff16155b6108325760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff16158015610854576000805461ffff19166101011790555b61085e8383611179565b80156105fe576000805461ff0019169055505050565b60006108808333610416565b9050818110156108de5760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b60648201526084016105b7565b6108eb8333848403610af8565b6105fe838361101f565b61090d600080516020611e61833981519152336109a6565b61097f5760405162461bcd60e51b815260206004820152603760248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20706175736500000000000000000060648201526084016105b7565b61074f61121c565b600082815260976020526040812061099f9083611299565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060cd805461049090611cbb565b33600090815260ca602090815260408083206001600160a01b038616845290915281205482811015610a625760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105b7565b610a6f3385858403610af8565b5060019392505050565b6000610520338484610c1c565b600081815260976020526040812061047b906112a5565b600082815260656020526040902060010154610ab98133610df7565b6105fe8383610e7d565b60006001600160e01b03198216637965db0b60e01b148061047b57506301ffc9a760e01b6001600160e01b031983161461047b565b6001600160a01b038316610b5a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b7565b6001600160a01b038216610bbb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b7565b6001600160a01b03838116600081815260ca602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c805760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b7565b6001600160a01b038216610ce25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b7565b610ced8383836112af565b6001600160a01b038316600090815260c9602052604090205481811015610d655760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105b7565b6001600160a01b03808516600090815260c96020526040808220858503905591851681529081208054849290610d9c908490611d0c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610de891815260200190565b60405180910390a35b50505050565b610e0182826109a6565b61067d57610e19816001600160a01b031660146112ba565b610e248360206112ba565b604051602001610e35929190611d72565b60408051601f198184030181529082905262461bcd60e51b82526105b791600401611a53565b610e658282611456565b60008281526097602052604090206105fe90826114dc565b610e8782826114f1565b60008281526097602052604090206105fe9082611558565b61012d5460ff16610ee95760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105b7565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610f8a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105b7565b610f96600083836112af565b8060cb6000828254610fa89190611d0c565b90915550506001600160a01b038216600090815260c9602052604081208054839290610fd5908490611d0c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b03821661107f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105b7565b61108b826000836112af565b6001600160a01b038216600090815260c96020526040902054818110156110ff5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105b7565b6001600160a01b038316600090815260c960205260408120838303905560cb805484929061112e908490611de7565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600054610100900460ff1680611192575060005460ff16155b6111ae5760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff161580156111d0576000805461ffff19166101011790555b6111d861156d565b6111e061156d565b6111e861156d565b6111f061156d565b6111fa83836115d8565b61120261156d565b61120a61166d565b61121261156d565b61085e83836116e3565b61012d5460ff16156112635760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105b7565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f173390565b600061099f8383611787565b600061047b825490565b6105fe8383836117b1565b606060006112c9836002611dfe565b6112d4906002611d0c565b67ffffffffffffffff8111156112ec576112ec611b4d565b6040519080825280601f01601f191660200182016040528015611316576020820181803683370190505b509050600360fc1b8160008151811061133157611331611e1d565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061136057611360611e1d565b60200101906001600160f81b031916908160001a9053506000611384846002611dfe565b61138f906001611d0c565b90505b6001811115611407576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106113c3576113c3611e1d565b1a60f81b8282815181106113d9576113d9611e1d565b60200101906001600160f81b031916908160001a90535060049490941c9361140081611e33565b9050611392565b50831561099f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105b7565b61146082826109a6565b61067d5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556114983390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061099f836001600160a01b038416611818565b6114fb82826109a6565b1561067d5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061099f836001600160a01b038416611867565b600054610100900460ff1680611586575060005460ff16155b6115a25760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff161580156115c4576000805461ffff19166101011790555b80156107fa576000805461ff001916905550565b600054610100900460ff16806115f1575060005460ff16155b61160d5760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff1615801561162f576000805461ffff19166101011790555b82516116429060cc906020860190611964565b5081516116569060cd906020850190611964565b5080156105fe576000805461ff0019169055505050565b600054610100900460ff1680611686575060005460ff16155b6116a25760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff161580156116c4576000805461ffff19166101011790555b61012d805460ff1916905580156107fa576000805461ff001916905550565b600054610100900460ff16806116fc575060005460ff16155b6117185760405162461bcd60e51b81526004016105b790611d24565b600054610100900460ff1615801561173a576000805461ffff19166101011790555b61174560003361195a565b61176f7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a63361195a565b61085e600080516020611e618339815191523361195a565b600082600001828154811061179e5761179e611e1d565b9060005260206000200154905092915050565b61012d5460ff16156105fe5760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b60648201526084016105b7565b600081815260018301602052604081205461185f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561047b565b50600061047b565b6000818152600183016020526040812054801561195057600061188b600183611de7565b855490915060009061189f90600190611de7565b90508181146119045760008660000182815481106118bf576118bf611e1d565b90600052602060002001549050808760000184815481106118e2576118e2611e1d565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061191557611915611e4a565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061047b565b600091505061047b565b61067d8282610e5b565b82805461197090611cbb565b90600052602060002090601f01602090048101928261199257600085556119d8565b82601f106119ab57805160ff19168380011785556119d8565b828001600101855582156119d8579182015b828111156119d85782518255916020019190600101906119bd565b506119e49291506119e8565b5090565b5b808211156119e457600081556001016119e9565b600060208284031215611a0f57600080fd5b81356001600160e01b03198116811461099f57600080fd5b60005b83811015611a42578181015183820152602001611a2a565b83811115610df15750506000910152565b6020815260008251806020840152611a72816040850160208701611a27565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611a9d57600080fd5b919050565b60008060408385031215611ab557600080fd5b611abe83611a86565b946020939093013593505050565b600080600060608486031215611ae157600080fd5b611aea84611a86565b9250611af860208501611a86565b9150604084013590509250925092565b600060208284031215611b1a57600080fd5b5035919050565b60008060408385031215611b3457600080fd5b82359150611b4460208401611a86565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112611b7457600080fd5b813567ffffffffffffffff80821115611b8f57611b8f611b4d565b604051601f8301601f19908116603f01168101908282118183101715611bb757611bb7611b4d565b81604052838152866020858801011115611bd057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215611c0357600080fd5b823567ffffffffffffffff80821115611c1b57600080fd5b611c2786838701611b63565b93506020850135915080821115611c3d57600080fd5b50611c4a85828601611b63565b9150509250929050565b600060208284031215611c6657600080fd5b61099f82611a86565b60008060408385031215611c8257600080fd5b50508035926020909101359150565b60008060408385031215611ca457600080fd5b611cad83611a86565b9150611b4460208401611a86565b600181811c90821680611ccf57607f821691505b60208210811415611cf057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611d1f57611d1f611cf6565b500190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611daa816017850160208801611a27565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611ddb816028840160208801611a27565b01602801949350505050565b600082821015611df957611df9611cf6565b500390565b6000816000190483118215151615611e1857611e18611cf6565b500290565b634e487b7160e01b600052603260045260246000fd5b600081611e4257611e42611cf6565b506000190190565b634e487b7160e01b600052603160045260246000fdfe65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862aa26469706673582212201e8e71d04321c61cbea798e0c220b88d5e37b921bdfb67b7e07db65b7fd1d00064736f6c6343000809003376418bd9033fcb3d7cf104f4b8a0c7f3193da6e5dec806b4a1fe6a5457c27bcdc40232d6f4f9db98646b81c9aad97cdb6e05b0eadb60d604217501b86e93e87a0000000000000000000000006c2c06790b3e3e3c38e12ee22f8183b37a13ee5500000000000000000000000032eb7902d4134bf98a28b963d26de779af92a2120000000000000000000000008d481245801907b45823fb032e6848d0d3c29ae50000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b000000000000000000000000c0cdd1176aa1624b89b7476142b41c04414afaa00000000000000000000000003e0215c1d639280e13b46e3af94fb5630d1b321200000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c10000000000000000000000003f3c58ccb0655fa9161d0b4b49b217b3f6478d5a

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000006c2c06790b3e3e3c38e12ee22f8183b37a13ee5500000000000000000000000032eb7902d4134bf98a28b963d26de779af92a2120000000000000000000000008d481245801907b45823fb032e6848d0d3c29ae50000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b000000000000000000000000c0cdd1176aa1624b89b7476142b41c04414afaa00000000000000000000000003e0215c1d639280e13b46e3af94fb5630d1b321200000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c10000000000000000000000003f3c58ccb0655fa9161d0b4b49b217b3f6478d5a

-----Decoded View---------------
Arg [0] : _dpx (address): 0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55
Arg [1] : _rdpx (address): 0x32eb7902d4134bf98a28b963d26de779af92a212
Arg [2] : _stakingRewards (address): 0x8d481245801907b45823fb032e6848d0d3c29ae5
Arg [3] : _optionPricing (address): 0x2b99e3d67dad973c1b9747da742b7e26c8bdd67b
Arg [4] : _rdpxPriceOracle (address): 0xc0cdd1176aa1624b89b7476142b41c04414afaa0
Arg [5] : _volatilityOracle (address): 0x3e0215c1d639280e13b46e3af94fb5630d1b3212
Arg [6] : _feeDistributor (address): 0x55594cce8cc0014ea08c49fd820d731308f204c1
Arg [7] : _feeStrategy (address): 0x3f3c58ccb0655fa9161d0b4b49b217b3f6478d5a

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000006c2c06790b3e3e3c38e12ee22f8183b37a13ee55
Arg [1] : 00000000000000000000000032eb7902d4134bf98a28b963d26de779af92a212
Arg [2] : 0000000000000000000000008d481245801907b45823fb032e6848d0d3c29ae5
Arg [3] : 0000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b
Arg [4] : 000000000000000000000000c0cdd1176aa1624b89b7476142b41c04414afaa0
Arg [5] : 0000000000000000000000003e0215c1d639280e13b46e3af94fb5630d1b3212
Arg [6] : 00000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c1
Arg [7] : 0000000000000000000000003f3c58ccb0655fa9161d0b4b49b217b3f6478d5a


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