Contract 0x6607c5e39a43cce1760288Dc33f20eAd51b14D7B

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x17992abb8c24b6e2590ed4e32ffd318a0e38399b207874d1218d784cc9659bd0Withdraw For Str...33883892021-11-27 22:23:571 hr 50 mins ago0x2e179fb8b4d13654bb572d182bdd8aa8134bd1b1 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000700475479 ETH
0x0fec1b41795436d43d66a6f5e4c86238c4967e3762a5f6b07ca128813a3cbb21Withdraw For Str...33883812021-11-27 22:23:571 hr 50 mins ago0x2e179fb8b4d13654bb572d182bdd8aa8134bd1b1 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.001106416028 ETH
0x76719faa7bddf68512487f718f3a01c462ec5d76dd29626198defb09c3bd6260Withdraw For Str...33879192021-11-27 21:53:002 hrs 21 mins ago0x6cb1697fe884570681eda5e4bc73b6cbdea1c61c IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000699084608 ETH
0x87b3d7e87b4044a3295f9dbcac2d449ec4d55c2c48555b766fdb776453a1a895Withdraw For Str...33879182021-11-27 21:53:002 hrs 21 mins ago0x6cb1697fe884570681eda5e4bc73b6cbdea1c61c IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.001105032259 ETH
0xb79b3513e97bd57a2e900e35b9c2e14bea1b6cc5659c21efa970e1777f2e0f41Withdraw For Str...33876612021-11-27 21:35:142 hrs 39 mins ago0xdb739cfbadd0a3422e31aaa34af6fcea13b1d3a7 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000694265866 ETH
0xa33b30e3a661e5b3f02c8eca6061e7003a8e2b26375954d42c6a28ea9742816fWithdraw For Str...33876422021-11-27 21:33:492 hrs 41 mins ago0x193ac8ecb86c04292ed3f2afa04faa4f384a0dae IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000694266875 ETH
0x8591953a20eb271bc8ad8d00f0c1d0f91791d3c958b4510a9dab6f7390de43e2Withdraw For Str...33855942021-11-27 19:30:054 hrs 44 mins ago0xd3607fde3e9070db755e63f61cd2c10442bafb62 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000888204525 ETH
0xe9fe48b1c1892703e18b03ebc0053fc0ec388182d793926328e8c85cf1f012b0Withdraw For Str...33839652021-11-27 17:41:596 hrs 32 mins ago0x4b9d2c6d1d2f6ead98aa8b2249b9a454b357062d IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000701329928 ETH
0xc3790166bdf5cd37dc965b46c55515a3d049cc1139439b98329b929f678bbe9aWithdraw For Str...33820232021-11-27 15:49:398 hrs 25 mins ago0x7e4133255a9b798a414f841ade5e90d6fc644217 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.001122878606 ETH
0xba05889d2303a251f076d281f63ed8147e083a56b99480e0e312db406ad8d179Withdraw For Str...33816162021-11-27 15:29:338 hrs 45 mins ago0x77ec3b4d6e16a76ad7fd2073267d35e3e78cd1db IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.00071036852 ETH
0xb9c0c51257a322c687327bea2228fb40315287d8dfd322615813ef34c29eb660Withdraw For Str...33816062021-11-27 15:28:178 hrs 46 mins ago0x77ec3b4d6e16a76ad7fd2073267d35e3e78cd1db IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000710377798 ETH
0x6acde46f99417132677d72846308c159cced86cb9afd67aa76741c604de6f987Withdraw For Str...33812212021-11-27 15:09:569 hrs 5 mins ago0x9cc99238a7aac88865f8d8ee0af0eda84fb5f8fa IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000710362335 ETH
0xf12baa682ceb79d1b77e49019c42ca9f539419d7e00b0b50e6483d9be13dc225Withdraw For Str...33812172021-11-27 15:09:169 hrs 5 mins ago0x9cc99238a7aac88865f8d8ee0af0eda84fb5f8fa IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000916599853 ETH
0xc399ef2a796a1f1b5f8fbce0d5c470bfff5c562315c50a194dd0de7a844fbca4Withdraw For Str...33796712021-11-27 13:41:5810 hrs 32 mins ago0xd771c5856b29710d29193a27e6bdb7dcf7330538 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000731271118 ETH
0x4e0bde9f164e53b72cdc535075aad21af5d79c28da2d9a2523e539bfa2716804Withdraw For Str...33796652021-11-27 13:41:5810 hrs 32 mins ago0xd771c5856b29710d29193a27e6bdb7dcf7330538 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.00072835162 ETH
0xfb38ee05a3cbbfd13fd9a7341e3ffa563d79e36bc8d0754dc24871e7318030acWithdraw For Str...33787772021-11-27 12:54:3911 hrs 20 mins ago0xc548f804b86c2a928b10e9cc24757869cdb630f5 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000731294465 ETH
0xdd9c2f91b6864f71ebc02a104a26a73424780a3acb0c1c248a83bd2fb4a51ee8Withdraw For Str...33752652021-11-27 9:08:1715 hrs 6 mins ago0x461b2fbb62d9dbb754dfbc4784241615e56251bb IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000757335365 ETH
0x05949de0758d2d32b3edb1fd663ae8f767e7d64926168cb914f1234350394cf3Withdraw For Str...33752612021-11-27 9:08:1715 hrs 6 mins ago0x461b2fbb62d9dbb754dfbc4784241615e56251bb IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000757336456 ETH
0x7b3e8ba0395d1ec99b0e46d30eb535a4cf22ec5a2627edfc11a73e21325636f4Withdraw For Str...33752592021-11-27 9:08:1715 hrs 6 mins ago0x461b2fbb62d9dbb754dfbc4784241615e56251bb IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.001193903976 ETH
0xf0617b3780c2322082c39f78db54e3c5b2b6f0ea0d92589e26bc7465a46ed643Withdraw For Str...33735992021-11-27 7:23:2316 hrs 51 mins ago0x237fa38a894963ed11cc984e8d72256163ce90a7 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000763882529 ETH
0x9f579e557e97ea39e5d08ad4b9574528ed103d0a6c6edaa8630ad67d36fb2bcbWithdraw For Str...33728172021-11-27 6:17:1017 hrs 57 mins ago0xb614f0e24be21044fb0ee630e3dfbae20b0b0c95 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000976180373 ETH
0xaefc0baa2f5a0fadc0200f1d5c600247bc582579899f9a8f4446abf26b40a00fWithdraw For Str...33719012021-11-27 5:05:2619 hrs 9 mins ago0x114794178cd4318888f44cc0924a2da3636ac16a IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000760091904 ETH
0x511c428620ff1a8460b7f9bafc18646b725fa75b4d2200b30f00d52e195dd807Withdraw For Str...33718982021-11-27 5:05:2619 hrs 9 mins ago0x114794178cd4318888f44cc0924a2da3636ac16a IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000758570216 ETH
0x1ab96a9288cbfa9f3a8ae45f7ca83dd45d95897a2c7bb028069894abadb2ed71Withdraw For Str...33715502021-11-27 4:33:1919 hrs 41 mins ago0xf76eac42ec1746fb030ecef7194af0698093daa0 IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000969268967 ETH
0x446769c689b30d2d98923c646f8cf9d12f68289be23e85677916756ebcbd22e9Withdraw For Str...33715302021-11-27 4:32:0719 hrs 42 mins ago0x535faa541252d9650f1f8a8bbd88709fb8b55a1b IN  0x6607c5e39a43cce1760288dc33f20ead51b14d7b0 ETH0.000753861305 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SSOVRdpx

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license
File 1 of 31 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerableUpgradeable {
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

/**
 * @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) public virtual override {
        super.grantRole(role, account);
        _roleMembers[role].add(account);
    }

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

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

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

File 2 of 31 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    function hasRole(bytes32 role, address account) external view returns (bool);
    function getRoleAdmin(bytes32 role) external view returns (bytes32);
    function grantRole(bytes32 role, address account) external;
    function revokeRole(bytes32 role, address account) external;
    function renounceRole(bytes32 role, address account) external;
}

/**
 * @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 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 {_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 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]{20}) is missing role (0x[0-9a-f]{32})$/
     *
     * _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]{20}) is missing role (0x[0-9a-f]{32})$/
     */
    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 granted `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}.
     * ====
     */
    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 {
        emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}

File 3 of 31 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
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.
 */
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 4 of 31 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT

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 5 of 31 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

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 guidelines: functions revert instead
 * of 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 defaut 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");
        _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");
        _approve(_msgSender(), spender, currentAllowance - subtractedValue);

        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is 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");
        _balances[sender] = senderBalance - amount;
        _balances[recipient] += amount;

        emit Transfer(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:
     *
     * - `to` 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);
    }

    /**
     * @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");
        _balances[account] = accountBalance - amount;
        _totalSupply -= amount;

        emit Transfer(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 to 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 { }
    uint256[45] private __gap;
}

File 6 of 31 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

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 7 of 31 : ERC20BurnableUpgradeable.sol
// SPDX-License-Identifier: MIT

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");
        _approve(account, _msgSender(), currentAllowance - amount);
        _burn(account, amount);
    }
    uint256[50] private __gap;
}

File 8 of 31 : ERC20PausableUpgradeable.sol
// SPDX-License-Identifier: MIT

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 9 of 31 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT

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 10 of 31 : ERC20PresetMinterPauserUpgradeable.sol
// SPDX-License-Identifier: MIT

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 11 of 31 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

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) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
    uint256[50] private __gap;
}

File 12 of 31 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

}

File 13 of 31 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

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 14 of 31 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

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 15 of 31 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT

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;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            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) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

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

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


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

File 16 of 31 : Ownable.sol
// SPDX-License-Identifier: MIT

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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 17 of 31 : Clones.sol
// SPDX-License-Identifier: MIT

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) {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create(0, ptr, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

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

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

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

File 18 of 31 : Address.sol
// SPDX-License-Identifier: MIT

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;
        // solhint-disable-next-line no-inline-assembly
        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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 19 of 31 : Context.sol
// SPDX-License-Identifier: MIT

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) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 20 of 31 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

}

File 21 of 31 : SafeMath.sol
// SPDX-License-Identifier: MIT

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 no longer needed starting with Solidity 0.8. 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. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * 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 22 of 31 : SSOVRdpx.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 {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {ERC20PresetMinterPauserUpgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC20/presets/ERC20PresetMinterPauserUpgradeable.sol';
import {IVolatilityOracle} from '../interfaces/IVolatilityOracle.sol';

// Interfaces
import {IERC20} from '../external/interfaces/IERC20.sol';
import {IStakingRewards} from '../interfaces/IStakingRewards.sol';
import {IOptionPricing} from '../interfaces/IOptionPricing.sol';
import {IPriceOracleAggregator} from '../interfaces/IPriceOracleAggregator.sol';
import {ISSOV} from '../interfaces/ISSOV.sol';

contract SSOVRdpx is Ownable, ISSOV {
    using BokkyPooBahsDateTimeLibrary for uint256;
    using Strings for uint256;
    using SafeERC20 for IERC20;

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

    /// @dev Boolean of whether the vault is shutdown
    bool public isVaultShutdown;

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

    /// @dev Exercise Window Size
    uint256 public windowSize = 1 hours;

    /// @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
        override 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
    /// @dev mapping (epoch => (strike => deposits))
    mapping(uint256 => mapping(uint256 => uint256))
        public totalEpochStrikeBalance;

    /// @notice Total epoch deposits across all strikes
    /// @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 (and fees) collected per strike for an epoch
    /// @dev mapping (epoch => (strike => premium))
    mapping(uint256 => mapping(uint256 => uint256)) public totalEpochPremium;

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

    /// @notice Total dpx tokens that were sent back to the buyer when a options is exercised for a certain strike
    /// @dev mapping (epoch => (strike => amount))
    mapping(uint256 => mapping(uint256 => uint256))
        public totalTokenVaultExercises;

    bytes32 public constant PURCHASE_FEE = keccak256('purchaseFee');
    bytes32 public constant PURCHASE_FEE_CAP = keccak256('purchaseFeeCap');
    bytes32 public constant EXERCISE_FEE = keccak256('exerciseFee');
    bytes32 public constant EXERCISE_FEE_CAP = keccak256('exerciseFeeCap');
    mapping(bytes32 => uint256) public fees;

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

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

    event LogNewStrike(uint256 epoch, uint256 strike);

    event LogBootstrap(uint256 epoch);

    event LogNewDeposit(uint256 epoch, uint256 strike, address user);

    event LogNewPurchase(
        uint256 epoch,
        uint256 strike,
        address user,
        uint256 amount,
        uint256 premium,
        uint256 feesToUser,
        uint256 feeToFeeDistributor
    );

    event LogNewExercise(
        uint256 epoch,
        uint256 strike,
        address user,
        uint256 amount,
        uint256 pnl,
        uint256 feeTouser,
        uint256 feeToFeeDistributor
    );

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

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

    event LogFeesUpdate(bytes32 feeKey, uint256 amount);

    event LogWindowSizeUpdate(uint256 windowSizeInHours);

    event LogVaultShutdown(bool isVaultShutdown);

    event LogEmergencySettle(
        uint256 epoch,
        uint256 strike,
        address user,
        uint256 amount, // of options
        uint256 premiumReturned
    );

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

    constructor(
        address _dpx,
        address _rdpx,
        address _stakingRewards,
        address _optionPricing,
        address _priceOracleAggregator,
        address _volatilityOracle,
        address _feeDistributor
    ) {
        require(_dpx != address(0), 'E1');
        require(_rdpx != address(0), 'E2');
        require(_stakingRewards != address(0), 'E3');
        require(_optionPricing != address(0), 'E4');
        require(_priceOracleAggregator != address(0), 'E5');

        addresses['FeeDistributor'] = _feeDistributor;
        addresses['DPX'] = _dpx;
        addresses['RDPX'] = _rdpx;
        addresses['StakingRewards'] = _stakingRewards;
        addresses['OptionPricing'] = _optionPricing;
        addresses['PriceOracleAggregator'] = _priceOracleAggregator;
        addresses['VolatilityOracle'] = _volatilityOracle;

        fees[PURCHASE_FEE] = 2e8 / 100; // 0.02% of the price of the base asset
        fees[PURCHASE_FEE_CAP] = 10e8; // 10% of the option price
        fees[EXERCISE_FEE] = 1e8 / 100; // 0.01% of the price of the base asset
        fees[EXERCISE_FEE_CAP] = 10e8; // 10% of the option price

        erc20Implementation = address(new ERC20PresetMinterPauserUpgradeable());

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

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

    /// @notice Shutdown the vault
    /// @dev Can only be called by owner
    /// @return Whether it was successfully shutdown
    function shutdownVault() external onlyOwner returns (bool) {
        isVaultShutdown = true;

        _updateFinalEpochBalances(false);

        emit LogVaultShutdown(true);

        return true;
    }

    /// @notice Open the vault
    /// @dev Can only be called by owner
    /// @return Whether it was successfully opened
    function openVault() external onlyOwner returns (bool) {
        isVaultShutdown = false;

        emit LogVaultShutdown(false);

        return true;
    }

    /// @notice Update the fee percentage in the vault
    /// @dev Can only be called by owner
    /// @param feeKey The key of the fee to be updated
    /// @param feeAmount The new amount
    /// @return Whether it was successfully updated
    function updateFees(bytes32 feeKey, uint256 feeAmount)
        external
        onlyOwner
        returns (bool)
    {
        fees[feeKey] = feeAmount;

        emit LogFeesUpdate(feeKey, feeAmount);

        return true;
    }

    /// @notice Update the exercise window size of an option
    /// @dev Can only be called by owner
    /// @param _windowSize The window size
    /// @return Whether it was successfully updated
    function updateWindowSize(uint256 _windowSize)
        external
        onlyOwner
        returns (bool)
    {
        windowSize = _windowSize;
        emit LogWindowSizeUpdate(_windowSize);
        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,
            'Input lengths must match'
        );
        for (uint256 i = 0; i < names.length; i++) {
            bytes32 name = names[i];
            address destination = destinations[i];
            addresses[name] = destination;
            emit LogAddressSet(name, destination);
        }
        return true;
    }

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

    /// @notice Sets the current epoch as expired.
    /// @return Whether expire was successful
    function expireEpoch() external onlyOwner returns (bool) {
        // Vault must not be shutdown
        require(!isVaultShutdown, 'E24');

        // Epoch must not be expired
        require(!isEpochExpired[currentEpoch], 'E6');

        (, uint256 epochExpiry) = getEpochTimes(currentEpoch);
        // Current timestamp should be past expiry
        require((block.timestamp > epochExpiry), 'E7');

        isEpochExpired[currentEpoch] = true;

        _updateFinalEpochBalances(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++) {
                uint256 rdpxRewards = (totalRdpxRewardsClaimed *
                    totalEpochStrikeBalance[currentEpoch][strikes[i]]) /
                    totalEpochBalance[currentEpoch];

                // Update final dpx and rdpx balances for epoch and strike
                totalEpochStrikeRdpxBalance[currentEpoch][strikes[i]] +=
                    totalEpochStrikeDeposits[currentEpoch][strikes[i]] +
                    rdpxRewards -
                    totalTokenVaultExercises[currentEpoch][strikes[i]];

                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 returns (bool) {
        uint256 nextEpoch = currentEpoch + 1;

        // Vault must not be ready
        require(!isVaultReady[nextEpoch], 'E8');

        // Next epoch strike must be set
        require(epochStrikes[nextEpoch].length > 0, 'E9');

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

        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 LogBootstrap(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
        returns (bool)
    {
        require(!isVaultShutdown, 'E24');
        uint256 nextEpoch = currentEpoch + 1;

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

        if (currentEpoch > 0) {
            (, uint256 epochExpiry) = getEpochTimes(currentEpoch);
            // Current timestamp should be past expiry
            require((block.timestamp > epochExpiry), 'E12');
        }

        // 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 LogNewStrike(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
     * @return Whether deposit was successful
     */
    function deposit(uint256 strikeIndex, uint256 amount)
        public
        returns (bool)
    {
        require(!isVaultShutdown, 'E24');

        uint256 nextEpoch = currentEpoch + 1;

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

        // Must be a valid strikeIndex
        require(strikeIndex < epochStrikes[nextEpoch].length, 'E13');

        // Must +ve amount
        require(amount > 0, 'E14');

        // Must be a valid strike
        uint256 strike = epochStrikes[nextEpoch][strikeIndex];
        require(strike != 0, 'E15');

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

        // Transfer RDPX from user 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 LogNewDeposit(nextEpoch, strike, 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
     * @return Whether deposits went through successfully
     */
    function depositMultiple(
        uint256[] memory strikeIndices,
        uint256[] memory amounts
    ) public returns (bool) {
        require(strikeIndices.length == amounts.length, 'E16');

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

    /**
     * @notice Purchases calls for the current epoch
     * @param strikeIndex Strike index for current epoch
     * @param amount Amount of calls to purchase
     * @return Whether purchase was successful
     */
    function purchase(uint256 strikeIndex, uint256 amount)
        external
        override
        returns (uint256, uint256)
    {
        require(!isVaultShutdown, 'E24');
        require(currentEpoch > 0, 'E17');

        // Must be a valid strikeIndex
        require(strikeIndex < epochStrikes[currentEpoch].length, 'E13');

        // Must positive amount
        require(amount > 0, 'E14');

        // Must be a valid strike
        uint256 strike = epochStrikes[currentEpoch][strikeIndex];
        require(strike != 0, 'E15');
        bytes32 userStrike = keccak256(abi.encodePacked(msg.sender, strike));

        address rdpx = getAddress('RDPX');
        uint256 currentPrice = getUsdPrice(rdpx);
        // Get total premium for all calls being purchased
        uint256 premium = (IOptionPricing(getAddress('OptionPricing'))
            .getOptionPrice(
                false,
                getMonthlyExpiryFromTimestamp(block.timestamp),
                strike,
                currentPrice,
                IVolatilityOracle(getAddress('VolatilityOracle')).getVolatility()
            ) * amount) / currentPrice;

        // total fees charged
        uint256 totalFees = calculateFees(premium, currentPrice, true);

        // 30% ( number * 0.3 ) of fees for FeeDistributor
        uint256 feetoFeeDistrubutor = (totalFees * 3) / 10;

        // 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 + fees
        totalEpochPremium[currentEpoch][strike] +=
            premium +
            (totalFees - feetoFeeDistrubutor);
        // Add to user epoch premium + fees
        userEpochPremium[currentEpoch][userStrike] +=
            premium +
            (totalFees - feetoFeeDistrubutor);

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

        // Add to total epoch strike balance premium + fee to vault
        totalEpochStrikeBalance[currentEpoch][strike] +=
            premium +
            (totalFees - feetoFeeDistrubutor);

        // Add to total epoch balance premium + fee
        totalEpochBalance[currentEpoch] +=
            premium +
            (totalFees - feetoFeeDistrubutor);

        // Transfer usd equivalent to premium from user
        IERC20(rdpx).safeTransferFrom(
            msg.sender,
            address(this),
            premium + totalFees
        );

        IERC20(rdpx).safeTransfer(
            getAddress('FeeDistributor'),
            feetoFeeDistrubutor
        );

        // Transfer doTokens to user
        IERC20(epochStrikeTokens[currentEpoch][strike]).safeTransfer(
            msg.sender,
            amount
        );

        // Stake premium into farming
        IStakingRewards(getAddress('StakingRewards')).stake(
            premium + (totalFees - feetoFeeDistrubutor)
        );

        emit LogNewPurchase(
            currentEpoch,
            strike,
            msg.sender,
            amount,
            premium,
            totalFees,
            feetoFeeDistrubutor
        );

        return (premium, totalFees);
    }

    /**
     * @notice Exercise calculates the PnL for the user. Withdraw the PnL in RDPX from the SSF and transfer it to the user. Will also the burn the doTokens from the user.
     * @param strikeIndex Strike index for current epoch
     * @param amount Amount of calls to exercise
     * @param user Address of the user
     * @return Pnl and Fee
     */
    function exercise(
        uint256 strikeIndex,
        uint256 amount,
        address user
    ) external override returns (uint256, uint256) {
        require(!isVaultShutdown, 'E24');

        uint256 epoch = currentEpoch;

        (, uint256 expiry) = getEpochTimes(epoch);

        // Must be in exercise window
        require(isExerciseWindow(expiry), 'E18');

        // Must be a valid strikeIndex
        require(strikeIndex < epochStrikes[epoch].length, 'E13');

        // Must positive amount
        require(amount > 0, 'E14');

        // Must be a valid strike
        uint256 strike = epochStrikes[epoch][strikeIndex];
        require(strike != 0, 'E15');

        uint256 currentPrice = getUsdPrice(getAddress('RDPX'));

        // Revert if strike price is higher than current price
        require(strike < currentPrice, 'E19');

        // Revert if user is zero address
        require(user != address(0), 'E20');

        // Revert if user does not have enough option token balance for the amount specified
        require(
            IERC20(epochStrikeTokens[epoch][strike]).balanceOf(user) >= amount,
            'E21'
        );

        // Calculate PnL (in RDPX)
        uint256 PnL = (((currentPrice - strike) * amount) / currentPrice);

        // fee to deduct from users PnL
        uint256 feeToUser = calculateFees(PnL, currentPrice, false);

        // 30% fees to fee distributor
        uint256 feeToFeeDistributor = (feeToUser * 3) / 10;

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

        // Update state to account for exercised options (amount of RDPX used in exercising)
        totalTokenVaultExercises[epoch][strike] += PnL;

        if (!isVaultShutdown) {
            IStakingRewards(getAddress('StakingRewards')).withdraw(PnL);
        }

        // Transfer PnL to user
        IERC20(getAddress('RDPX')).safeTransfer(user, PnL - feeToUser);

        // transfer fees to FeeDistributor
        IERC20(getAddress('RDPX')).safeTransfer(
            getAddress('FeeDistributor'),
            feeToFeeDistributor
        );

        emit LogNewExercise(
            epoch,
            strike,
            user,
            amount,
            PnL,
            feeToUser,
            feeToFeeDistributor
        );

        return (PnL, feeToUser);
    }

    /**
     * @notice Allows a user to settle their options due to an emergency shutdown. Returns the premium to the user.
     * @param strikeIndex Strike index for current epoch
     * @param amount Amount of calls to exercise
     * @param user Address of the user
     */
    function emergencySettle(
        uint256 strikeIndex,
        uint256 amount,
        address user
    ) external returns (uint256) {
        // Vault must be shutdown
        require(isVaultShutdown, 'E25');

        uint256 epoch = currentEpoch;

        // Must be a valid strikeIndex
        require(strikeIndex < epochStrikes[epoch].length, 'E13');

        // Must positive amount
        require(amount > 0, 'E14');

        // Must be a valid strike
        uint256 strike = epochStrikes[epoch][strikeIndex];
        require(strike != 0, 'E15');

        // Revert if user is zero address
        require(user != address(0), 'E20');

        // Revert if user does not have enough option token balance for the amount specified
        require(
            IERC20(epochStrikeTokens[epoch][strike]).balanceOf(user) >= amount,
            'E21'
        );

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

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

        uint256 userPremium = userEpochPremium[epoch][userStrike];

        userEpochPremium[epoch][userStrike] = 0;

        // Transfer premium to user
        IERC20(getAddress('RDPX')).safeTransfer(user, userPremium);

        emit LogEmergencySettle(epoch, strike, user, amount, userPremium);

        return userPremium;
    }

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

        if (currentEpoch == 0) {
            return false;
        }

        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 *
                totalEpochStrikeDeposits[currentEpoch][strikes[i]]) /
                totalEpochDeposits[currentEpoch];

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

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

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

        emit LogCompound(
            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 Whether withdraw was successful
     */
    function withdrawForStrike(uint256 withdrawEpoch, uint256 strikeIndex)
        external
        returns (bool)
    {
        // Epoch must be expired
        require(isEpochExpired[withdrawEpoch], 'E22');

        _withdraw(withdrawEpoch, strikeIndex);

        return true;
    }

    /**
     * @notice Emergency withdraws balances for a strike
     * @dev Vault must be shutdown for this
     * @param strikeIndex Index of strike
     * @return Whether withdraw was successful
     */
    function emergencyWithdrawForStrike(uint256 strikeIndex)
        external
        returns (bool)
    {
        require(isVaultShutdown, 'E25');

        _withdraw(currentEpoch, strikeIndex);

        return true;
    }

    /// @dev Internal function to handle a withdraw
    /// @param withdrawEpoch Epoch to withdraw from
    /// @param strikeIndex Index of strike
    function _withdraw(uint256 withdrawEpoch, uint256 strikeIndex) internal {
        // Must be a valid strikeIndex
        require(strikeIndex < epochStrikes[withdrawEpoch].length, 'E13');

        // Must be a valid strike
        uint256 strike = epochStrikes[withdrawEpoch][strikeIndex];
        require(strike != 0, 'E15');

        // Must be a valid user strike deposit amount
        bytes32 userStrike = keccak256(abi.encodePacked(msg.sender, strike));
        uint256 userStrikeDeposits = userEpochDeposits[withdrawEpoch][
            userStrike
        ];

        require(userStrikeDeposits > 0, 'E23');

        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 LogNewWithdrawForStrike(
            withdrawEpoch,
            strike,
            msg.sender,
            userStrikeDeposits,
            userRdpxAmount
        );
    }

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

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

    /// @notice calculates fees for a given amount
    /// @param amountToCharge amount from which fees is charged from
    /// @param assetPrice last price of asset in USDT
    /// @param isPurchase if true, uses purchase fees values, if false, uses exercise fees values
    function calculateFees(
        uint256 amountToCharge,
        uint256 assetPrice,
        bool isPurchase
    ) public view returns (uint256) {
        uint256 fee = isPurchase ? fees[PURCHASE_FEE] : fees[EXERCISE_FEE];
        uint256 feeCap = isPurchase
            ? fees[PURCHASE_FEE_CAP]
            : fees[EXERCISE_FEE_CAP];

        uint256 baseAssetFees = (assetPrice * fee) / 1e10;
        uint256 optionPriceFees = (amountToCharge * feeCap * assetPrice) / 1e28;

        if (baseAssetFees > optionPriceFees) {
            return (optionPriceFees * 1e18) / assetPrice;
        } else {
            return (baseAssetFees * 1e18) / assetPrice;
        }
    }

    /**
     * @notice Returns start and end times for an epoch
     * @param epoch Target epoch
     */
    function getEpochTimes(uint256 epoch)
        public
        view
        returns (uint256 start, uint256 end)
    {
        require(epoch > 0, 'E17');

        return (
            epochStartTimes[epoch],
            getMonthlyExpiryFromTimestamp(epochStartTimes[epoch])
        );
    }

    /**
     * @notice Returns epoch strikes array for an epoch
     * @param epoch Target epoch
     */
    function getEpochStrikes(uint256 epoch)
        external
        view
        returns (uint256[] memory)
    {
        require(epoch > 0, 'E17');

        return epochStrikes[epoch];
    }

    /**
     * Returns epoch strike tokens array for an epoch
     * @param epoch Target epoch
     */
    function getEpochStrikeTokens(uint256 epoch)
        external
        view
        returns (address[] memory)
    {
        require(epoch > 0, 'E17');

        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
        returns (uint256[] memory)
    {
        require(epoch > 0, 'E17');

        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
        returns (uint256[] memory)
    {
        require(epoch > 0, 'E17');

        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
        returns (uint256[] memory)
    {
        require(epoch > 0, 'E17');

        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
        returns (uint256[] memory)
    {
        require(epoch > 0, 'E17');

        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
        returns (uint256[] memory)
    {
        require(epoch > 0, 'E17');

        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
        returns (uint256[] memory)
    {
        require(epoch > 0, 'E17');

        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 Update & Returns token's price in USD
     * @param _token Address of the token
     */
    function getUsdPrice(address _token) public returns (uint256) {
        return
            IPriceOracleAggregator(getAddress('PriceOracleAggregator'))
                .getPriceInUSD(_token);
    }

    /**
     * @notice Returns token's price in USD
     * @param _token Address of the token
     */
    function viewUsdPrice(address _token) external view returns (uint256) {
        return
            IPriceOracleAggregator(getAddress('PriceOracleAggregator'))
                .viewPriceInUSD(_token);
    }

    /**
     * @notice Returns true if exercise can be called
     * @param expiry The expiry of the option
     */
    function isExerciseWindow(uint256 expiry) public view returns (bool) {
        return ((block.timestamp >= expiry - windowSize) &&
            (block.timestamp < expiry));
    }

    /**
     * @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 override returns (address) {
        return addresses[name];
    }
}

File 23 of 31 : 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 24 of 31 : 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 25 of 31 : 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 26 of 31 : 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 27 of 31 : IOracle.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IOracle {
  event PriceUpdated(address asset, uint256 newPrice);

  function getPriceInUSD() external returns (uint256);

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

File 28 of 31 : IPriceOracleAggregator.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

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

interface IPriceOracleAggregator {
  event UpdateOracle(address token, IOracle oracle);

  function getPriceInUSD(address _token) external returns (uint256);

  function updateOracleForAsset(address _asset, IOracle _oracle) external;

  function viewPriceInUSD(address _token) external view returns (uint256);
}

File 29 of 31 : ISSOV.sol
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

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

    function purchase(uint256 strikeIndex, uint256 amount)
        external
        returns (uint256, uint256);

    function exercise(
        uint256 strikeIndex,
        uint256 amount,
        address user
    ) external returns (uint256, uint256);

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

File 30 of 31 : 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 31 of 31 : IVolatilityOracle.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

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

Settings
{
  "evmVersion": "istanbul",
  "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":"_priceOracleAggregator","type":"address"},{"internalType":"address","name":"_volatilityOracle","type":"address"},{"internalType":"address","name":"_feeDistributor","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":true,"internalType":"address","name":"destination","type":"address"}],"name":"LogAddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"LogBootstrap","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":"LogCompound","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":"premiumReturned","type":"uint256"}],"name":"LogEmergencySettle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"feeKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LogFeesUpdate","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"}],"name":"LogNewDeposit","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"},{"indexed":false,"internalType":"uint256","name":"feeTouser","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeToFeeDistributor","type":"uint256"}],"name":"LogNewExercise","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":"premium","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feesToUser","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeToFeeDistributor","type":"uint256"}],"name":"LogNewPurchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"}],"name":"LogNewStrike","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":"LogNewWithdrawForStrike","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isVaultShutdown","type":"bool"}],"name":"LogVaultShutdown","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"windowSizeInHours","type":"uint256"}],"name":"LogWindowSizeUpdate","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"},{"inputs":[],"name":"EXERCISE_FEE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXERCISE_FEE_CAP","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PURCHASE_FEE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PURCHASE_FEE_CAP","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","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":"amountToCharge","type":"uint256"},{"internalType":"uint256","name":"assetPrice","type":"uint256"},{"internalType":"bool","name":"isPurchase","type":"bool"}],"name":"calculateFees","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"}],"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[]"}],"name":"depositMultiple","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"emergencySettle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"}],"name":"emergencyWithdrawForStrike","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":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"exercise","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expireEpoch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"fees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"internalType":"address","name":"_token","type":"address"}],"name":"getUsdPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","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":"uint256","name":"","type":"uint256"}],"name":"isEpochExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"expiry","type":"uint256"}],"name":"isExerciseWindow","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":"isVaultShutdown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openVault","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"strikeIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"purchase","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"shutdownVault","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","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":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalTokenVaultExercises","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":[{"internalType":"bytes32","name":"feeKey","type":"bytes32"},{"internalType":"uint256","name":"feeAmount","type":"uint256"}],"name":"updateFees","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_windowSize","type":"uint256"}],"name":"updateWindowSize","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":"_token","type":"address"}],"name":"viewUsdPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"windowSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"withdrawEpoch","type":"uint256"},{"internalType":"uint256","name":"strikeIndex","type":"uint256"}],"name":"withdrawForStrike","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

60a0604052610e106002553480156200001757600080fd5b5060405162007f6138038062007f618339810160408190526200003a9162000851565b600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600160a01b038716620000bc5760405162461bcd60e51b8152602060048201526002602482015261453160f01b60448201526064015b60405180910390fd5b6001600160a01b038616620000f95760405162461bcd60e51b8152602060048201526002602482015261229960f11b6044820152606401620000b3565b6001600160a01b038516620001365760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401620000b3565b6001600160a01b038416620001735760405162461bcd60e51b8152602060048201526002602482015261114d60f21b6044820152606401620000b3565b6001600160a01b038316620001b05760405162461bcd60e51b8152602060048201526002602482015261453560f01b6044820152606401620000b3565b7fe98e84802325201f1c2aa71df400acf70d292339181f1dfa34ea8c0d5fef8ff280546001600160a01b03199081166001600160a01b03848116919091179092557f11eeda5ccce3b038d4c97ce3441d2387ea2908f4416997212badd7e59dd2ac64805482168a841617905560008051602062007f41833981519152805482168984161790557f6222f7ca720cfa6b67945f0b058a94a77ee2e8ab839317d5875400c9c5c00dc1805482168884161790557f325ab4590a041c684fa78c3bf1b67cd4ef612f7acad3e441c4ba92a82df32083805482168784161790557f6c0ce3278d434a585707bbae151044d7d587448b69d9940c1bd8c9fbb4e989b2805482168684161790557fd7c655bed4862415bb75e108b9ab0bb78cf5e3f3492884ac6f9a1d56274baef280549091169184169190911790556015602052621e84807f1b71b761c69aef11537c3bdb752cdebe9ea3ea4f7f57eb41571073ec9bed961555633b9aca007ffbead0292be198213e4924506b442a6fa206487efdbc6afd506d4b85dc1c203b819055620f42407fd66611da29a2846e90b25a72c7cf30d13ce19ee6b0112077aa5f725ab6ad07f8557f23eb6c4efac516e75977cd6ab8fb1be53469dec1800af5e533a4e7811632d21a6000527f72c1cdd7e08da5b291df70686d437faf1fa50bb7218681498f0ee25e5b8bfe0b55604051620003b49062000826565b604051809103906000f080158015620003d1573d6000803e3d6000fd5b5060601b6001600160601b031916608052600360209081527f6222f7ca720cfa6b67945f0b058a94a77ee2e8ab839317d5875400c9c5c00dc154630a488a0b60e31b60005260008051602062007f418339815191525462000450926001600160a01b03918216929190911690600019906200045d811b62003a2617901c565b50505050505050620009a6565b801580620004eb5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015620004ae57600080fd5b505afa158015620004c3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004e9919062000907565b155b6200055f5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401620000b3565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620005b7918591620005bc16565b505050565b600062000618826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200069a60201b62003b82179092919060201c565b805190915015620005b75780806020019051810190620006399190620008e5565b620005b75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401620000b3565b6060620006ab8484600085620006b5565b90505b9392505050565b606082471015620007185760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620000b3565b843b620007685760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620000b3565b600080866001600160a01b0316858760405162000786919062000920565b60006040518083038185875af1925050503d8060008114620007c5576040519150601f19603f3d011682016040523d82523d6000602084013e620007ca565b606091505b509092509050620007dd828286620007e8565b979650505050505050565b60608315620007f9575081620006ae565b8251156200080a5782518084602001fd5b8160405162461bcd60e51b8152600401620000b391906200093e565b611f8f8062005fb283390190565b80516001600160a01b03811681146200084c57600080fd5b919050565b600080600080600080600060e0888a0312156200086c578283fd5b620008778862000834565b9650620008876020890162000834565b9550620008976040890162000834565b9450620008a76060890162000834565b9350620008b76080890162000834565b9250620008c760a0890162000834565b9150620008d760c0890162000834565b905092959891949750929550565b600060208284031215620008f7578081fd5b81518015158114620006ae578182fd5b60006020828403121562000919578081fd5b5051919050565b600082516200093481846020870162000973565b9190910192915050565b60208152600082518060208401526200095f81604085016020870162000973565b601f01601f19169190910160400192915050565b60005b838110156200099057818101518382015260200162000976565b83811115620009a0576000848401525b50505050565b60805160601c6155e6620009cc6000396000818161076e015261388701526155e66000f3fe608060405234801561001057600080fd5b50600436106103af5760003560e01c80638c2b7870116101f4578063cd653df61161011a578063e5236cc9116100ad578063f306694a1161007c578063f306694a146109e1578063f69e204614610a0c578063fa8e400514610a14578063fb969b0a14610a2757600080fd5b8063e5236cc9146109a0578063ec856816146109a8578063f0977111146109bb578063f2fde38b146109ce57600080fd5b8063d6ad2072116100e9578063d6ad207214610947578063d7e151311461095a578063d990460e1461097a578063e2bbb1581461098d57600080fd5b8063cd653df6146108ee578063cdb5661f14610901578063d3e3e35214610921578063d6379b721461093457600080fd5b8063b0f48cf711610192578063bf434b7a11610161578063bf434b7a1461088a578063c300fd64146108b5578063c3259163146108c8578063cb8d1e47146108db57600080fd5b8063b0f48cf7146107fa578063b12daf6914610825578063b595005a14610850578063b87e0efb1461087757600080fd5b8063901be041116101ce578063901be0411461076957806393c82c7514610790578063a6a1dea4146107b3578063a6fe2b9e146107da57600080fd5b80638c2b7870146107325780638da5cb5b146107455780638e143ccb1461075657600080fd5b806361560c99116102d9578063715018a611610277578063823c151211610246578063823c1512146106d657806386f54712146106f65780638990d045146106fe5780638a14117a1461072957600080fd5b8063715018a614610685578063766718081461068f578063781ed978146106985780637e36701f146106c357600080fd5b80636a778454116102b35780636a7784541461062f5780636db29f6d146106425780636f56f56f1461064a57806370876c981461067257600080fd5b806361560c99146105e05780636274d49d146105f3578063699f200f1461060657600080fd5b80632807b9a8116103515780633f83b8a5116103205780633f83b8a51461054b578063470f42241461056e5780634ab01f5b146105a25780635ba0bee1146105b557600080fd5b80632807b9a8146104ae5780632dc96c8e146104d9578063304dec3a14610504578063344afb5f1461052b57600080fd5b8063175321b81161038d578063175321b8146104355780631874979b146104495780631919e1241461047057806321f8a7211461048357600080fd5b80630258fd79146103b457806310bc629c146103f257806315943b9914610415575b600080fd5b6103df6103c2366004615027565b601460209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b610405610400366004615027565b610a2f565b60405190151581526020016103e9565b61042861042336600461500f565b610a8b565b6040516103e99190615200565b60005461040590600160a01b900460ff1681565b6103df7f017840a92fa63ade139eaf1bbf69f6b3949bf8c6f5f3035c2435202bddde8d3481565b6103df61047e3660046150e2565b610b0d565b61049661049136600461500f565b610cf0565b6040516001600160a01b0390911681526020016103e9565b6103df6104bc366004615027565b601160209081526000928352604080842090915290825290205481565b6103df6104e7366004615027565b600e60209081526000928352604080842090915290825290205481565b6103df7ff7a5e3d5d9379c574f5c43e29bf5bf1c0ec522d8011ad47c196cc5800d203ba681565b6103df61053936600461500f565b600c6020526000908152604090205481565b61040561055936600461500f565b60066020526000908152604090205460ff1681565b61049661057c366004615027565b60086020908152600092835260408084209091529082529020546001600160a01b031681565b6104056105b0366004614ef9565b610d0b565b6103df6105c3366004615027565b601360209081526000928352604080842090915290825290205481565b6104286105ee366004615060565b610e69565b610428610601366004615060565b610fc5565b61049661061436600461500f565b6003602052600090815260409020546001600160a01b031681565b61042861063d36600461500f565b611118565b610405611241565b61065d61065836600461500f565b61134e565b604080519283526020830191909152016103e9565b61065d610680366004615027565b611392565b61068d61194d565b005b6103df60015481565b6103df6106a6366004615027565b600f60209081526000928352604080842090915290825290205481565b6103df6106d1366004615027565b6119c1565b6106e96106e436600461500f565b6119f2565b6040516103e991906151b3565b610405611b33565b6103df61070c366004615027565b600d60209081526000928352604080842090915290825290205481565b6103df60025481565b61040561074036600461500f565b611ba5565b6000546001600160a01b0316610496565b6103df61076436600461500f565b611bc9565b6104967f000000000000000000000000000000000000000000000000000000000000000081565b61040561079e36600461500f565b60056020526000908152604090205460ff1681565b6103df7f23eb6c4efac516e75977cd6ab8fb1be53469dec1800af5e533a4e7811632d21a81565b6103df6107e836600461500f565b60046020526000908152604090205481565b6103df610808366004615027565b601260209081526000928352604080842090915290825290205481565b6103df610833366004615027565b600960209081526000928352604080842090915290825290205481565b6103df7f27a2995a53386352e8f8aa016d283017e18d6c935e2be6c6f96dd30b6ab652ef81565b61040561088536600461500f565b611cfd565b6103df610898366004615027565b601060209081526000928352604080842090915290825290205481565b6104286108c336600461500f565b611d69565b6104056108d636600461500f565b611e8a565b6103df6108e9366004614edf565b611ede565b6104286108fc36600461500f565b611f7e565b6103df61090f36600461500f565b60156020526000908152604090205481565b61040561092f366004614f61565b61209f565b61065d6109423660046150ae565b612259565b610405610955366004614f93565b612704565b6103df61096836600461500f565b600a6020526000908152604090205481565b6103df6109883660046150ae565b6127b4565b61040561099b366004615027565b612ae2565b610405612e1e565b6104286109b6366004615060565b612e96565b6103df6109c9366004614edf565b612fe9565b61068d6109dc366004614edf565b613063565b6103df6109ef366004615027565b600b60209081526000928352604080842090915290825290205481565b61040561314d565b610405610a22366004615027565b61362a565b6104056136a9565b60008281526005602052604081205460ff16610a785760405162461bcd60e51b815260206004820152600360248201526222991960e91b60448201526064015b60405180910390fd5b610a828383613b99565b50600192915050565b606060008211610aad5760405162461bcd60e51b8152600401610a6f90615270565b60008281526007602090815260409182902080548351818402810184019094528084529091830182828015610b0157602002820191906000526020600020905b815481526020019060010190808311610aed575b50505050509050919050565b60008082610b65577ff7a5e3d5d9379c574f5c43e29bf5bf1c0ec522d8011ad47c196cc5800d203ba660005260156020527fd66611da29a2846e90b25a72c7cf30d13ce19ee6b0112077aa5f725ab6ad07f854610bb1565b7f017840a92fa63ade139eaf1bbf69f6b3949bf8c6f5f3035c2435202bddde8d3460005260156020527f1b71b761c69aef11537c3bdb752cdebe9ea3ea4f7f57eb41571073ec9bed9615545b9050600083610c0a577f23eb6c4efac516e75977cd6ab8fb1be53469dec1800af5e533a4e7811632d21a60005260156020527f72c1cdd7e08da5b291df70686d437faf1fa50bb7218681498f0ee25e5b8bfe0b54610c56565b7f27a2995a53386352e8f8aa016d283017e18d6c935e2be6c6f96dd30b6ab652ef60005260156020527ffbead0292be198213e4924506b442a6fa206487efdbc6afd506d4b85dc1c203b545b905060006402540be400610c6a848861548d565b610c7491906153f6565b905060006b204fce5e3e2502611000000087610c90858b61548d565b610c9a919061548d565b610ca491906153f6565b905080821115610cd65786610cc182670de0b6b3a764000061548d565b610ccb91906153f6565b945050505050610ce9565b86610cc183670de0b6b3a764000061548d565b9392505050565b6000908152600360205260409020546001600160a01b031690565b600080546001600160a01b03163314610d365760405162461bcd60e51b8152600401610a6f906152e4565b838214610d855760405162461bcd60e51b815260206004820152601860248201527f496e707574206c656e67746873206d757374206d6174636800000000000000006044820152606401610a6f565b60005b84811015610e5d576000868683818110610db257634e487b7160e01b600052603260045260246000fd5b9050602002013590506000858584818110610ddd57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610df29190614edf565b60008381526003602052604080822080546001600160a01b0319166001600160a01b03851690811790915590519293509184917fa06b7cc4941a4dc0c9ee5be0e2194565cbb5a22026bedc4bc363b18140cf2a3391a350508080610e559061552e565b915050610d88565b50600195945050505050565b606060008311610e8b5760405162461bcd60e51b8152600401610a6f90615270565b60008381526007602052604081205490816001600160401b03811115610ec157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610eea578160200160208202803683370190505b50905060005b82811015610fbc576000868152600760205260408120805483908110610f2657634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905060008682604051602001610f48929190615146565b60408051601f19818403018152918152815160209283012060008b815260138452828120828252909352912054855191925090859085908110610f9b57634e487b7160e01b600052603260045260246000fd5b60200260200101818152505050508080610fb49061552e565b915050610ef0565b50949350505050565b606060008311610fe75760405162461bcd60e51b8152600401610a6f90615270565b60008381526007602052604081205490816001600160401b0381111561101d57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611046578160200160208202803683370190505b50905060005b82811015610fbc57600086815260076020526040812080548390811061108257634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050600086826040516020016110a4929190615146565b60408051601f19818403018152918152815160209283012060008b8152600d84528281208282529093529120548551919250908590859081106110f757634e487b7160e01b600052603260045260246000fd5b602002602001018181525050505080806111109061552e565b91505061104c565b60606000821161113a5760405162461bcd60e51b8152600401610a6f90615270565b60008281526007602052604081205490816001600160401b0381111561117057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611199578160200160208202803683370190505b50905060005b82811015611239576000858152601060209081526040808320600790925282208054919291849081106111e257634e487b7160e01b600052603260045260246000fd5b906000526020600020015481526020019081526020016000205482828151811061121c57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806112318161552e565b91505061119f565b509392505050565b600080546001600160a01b0316331461126c5760405162461bcd60e51b8152600401610a6f906152e4565b600054600160a01b900460ff16156112965760405162461bcd60e51b8152600401610a6f9061528d565b60015460009081526005602052604090205460ff16156112dd5760405162461bcd60e51b8152602060048201526002602482015261229b60f11b6044820152606401610a6f565b60006112ea60015461134e565b9150508042116113215760405162461bcd60e51b8152602060048201526002602482015261453760f01b6044820152606401610a6f565b600180546000908152600560205260409020805460ff19168217905561134690613de9565b600191505090565b600080600083116113715760405162461bcd60e51b8152600401610a6f90615270565b60008381526004602052604090205461138981611bc9565b91509150915091565b600080548190600160a01b900460ff16156113bf5760405162461bcd60e51b8152600401610a6f9061528d565b6000600154116113e15760405162461bcd60e51b8152600401610a6f90615270565b60015460009081526007602052604090205484106114115760405162461bcd60e51b8152600401610a6f906152c7565b600083116114315760405162461bcd60e51b8152600401610a6f906152aa565b600154600090815260076020526040812080548690811061146257634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600014156114905760405162461bcd60e51b8152600401610a6f90615319565b600033826040516020016114a5929190615146565b60405160208183030381529060405280519060200120905060006114cf630a488a0b60e31b610cf0565b905060006114dc82611ede565b9050600081886114fb6c4f7074696f6e50726963696e6760981b610cf0565b6001600160a01b0316635b7b6d88600061151442611bc9565b8a886115326f566f6c6174696c6974794f7261636c6560801b610cf0565b6001600160a01b0316633af2888b6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561156c57600080fd5b505af1158015611580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a49190615048565b6040516001600160e01b031960e088901b1681529415156004860152602485019390935260448401919091526064830152608482015260a40160206040518083038186803b1580156115f557600080fd5b505afa158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d9190615048565b611637919061548d565b61164191906153f6565b9050600061165182846001610b0d565b90506000600a61166283600361548d565b61166c91906153f6565b60015460009081526010602090815260408083208b8452909152812080549293508c9290919061169d9084906153b0565b90915550506001546000908152601160209081526040808320898452909152812080548c92906116ce9084906153b0565b909155506116de905081836154eb565b6116e890846153b0565b60015460009081526012602090815260408083208b8452909152812080549091906117149084906153b0565b90915550611724905081836154eb565b61172e90846153b0565b60015460009081526013602090815260408083208a84529091528120805490919061175a9084906153b0565b90915550611768905061314d565b5061177381836154eb565b61177d90846153b0565b6001546000908152600b602090815260408083208b8452909152812080549091906117a99084906153b0565b909155506117b9905081836154eb565b6117c390846153b0565b6001546000908152600c6020526040812080549091906117e49084906153b0565b9091555061180b905033306117f985876153b0565b6001600160a01b038916929190614576565b6118396118286d2332b2a234b9ba3934b13aba37b960911b610cf0565b6001600160a01b03871690836145b4565b60015460009081526008602090815260408083208a845290915290205461186a906001600160a01b0316338c6145b4565b6118846d5374616b696e675265776172647360901b610cf0565b6001600160a01b031663a694fc3a61189c83856154eb565b6118a690866153b0565b6040518263ffffffff1660e01b81526004016118c491815260200190565b600060405180830381600087803b1580156118de57600080fd5b505af11580156118f2573d6000803e3d6000fd5b505050507f97045e6c2fbd28852a4cd5b60059bdeaaf550f4da40c2c7373372fa8ab6c194160015488338d8787876040516119339796959493929190615336565b60405180910390a1509096509450505050505b9250929050565b6000546001600160a01b031633146119775760405162461bcd60e51b8152600401610a6f906152e4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600760205281600052604060002081815481106119dd57600080fd5b90600052602060002001600091509150505481565b606060008211611a145760405162461bcd60e51b8152600401610a6f90615270565b60008281526007602052604081205490816001600160401b03811115611a4a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611a73578160200160208202803683370190505b50905060005b8281101561123957600085815260086020908152604080832060079092528220805491929184908110611abc57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b0316828281518110611b0957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015280611b2b8161552e565b915050611a79565b600080546001600160a01b03163314611b5e5760405162461bcd60e51b8152600401610a6f906152e4565b6000805460ff60a01b191681556040519081527f3ff7b26c9c1989d572dc980143df229d9bcd7b459794643ef88b6052eceb600f906020015b60405180910390a150600190565b600060025482611bb591906154eb565b4210158015611bc357508142105b92915050565b600080611bf3611bd8846145e4565b611be185614604565b611bec9060016153b0565b6000614616565b90506005611c0082614631565b1015611c3857611c35611c12826145e4565b611c1b83614604565b6007611c2685614665565b611c3091906154eb565b614616565b90505b6000611c80611c46836145e4565b611c4f84614604565b611c5885614631565b611c6186614665565b611c6c9060056153b0565b611c7691906154eb565b6008600080614677565b9050838111610ce9576000611cab611c97866145e4565b611ca087614604565b611bec9060026153b0565b90506005611cb882614631565b1015611ccd57611cca611c12826145e4565b90505b611cf4611cd9826145e4565b611ce283614604565b611ceb84614631565b611c6185614665565b95945050505050565b600080546001600160a01b03163314611d285760405162461bcd60e51b8152600401610a6f906152e4565b60028290556040518281527f0af7f46eea9725a91be28a59af4926adbda62f127c5cb55c9619db11a94dea4a9060200160405180910390a15060015b919050565b606060008211611d8b5760405162461bcd60e51b8152600401610a6f90615270565b60008281526007602052604081205490816001600160401b03811115611dc157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611dea578160200160208202803683370190505b50905060005b8281101561123957600085815260096020908152604080832060079092528220805491929184908110611e3357634e487b7160e01b600052603260045260246000fd5b9060005260206000200154815260200190815260200160002054828281518110611e6d57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280611e828161552e565b915050611df0565b60008054600160a01b900460ff16611eca5760405162461bcd60e51b815260206004820152600360248201526245323560e81b6044820152606401610a6f565b611ed660015483613b99565b506001919050565b6000611f0174283934b1b2a7b930b1b632a0b3b3b932b3b0ba37b960591b610cf0565b604051630226614760e01b81526001600160a01b0384811660048301529190911690630226614790602401602060405180830381600087803b158015611f4657600080fd5b505af1158015611f5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc39190615048565b606060008211611fa05760405162461bcd60e51b8152600401610a6f90615270565b60008281526007602052604081205490816001600160401b03811115611fd657634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611fff578160200160208202803683370190505b50905060005b828110156112395760008581526012602090815260408083206007909252822080549192918490811061204857634e487b7160e01b600052603260045260246000fd5b906000526020600020015481526020019081526020016000205482828151811061208257634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806120978161552e565b915050612005565b600080546001600160a01b031633146120ca5760405162461bcd60e51b8152600401610a6f906152e4565b600054600160a01b900460ff16156120f45760405162461bcd60e51b8152600401610a6f9061528d565b6000600154600161210591906153b0565b6000818152600a60205260409020549091501561214a5760405162461bcd60e51b815260206004820152600360248201526245313160e81b6044820152606401610a6f565b6001541561219957600061215f60015461134e565b9150508042116121975760405162461bcd60e51b815260206004820152600360248201526222989960e91b6044820152606401610a6f565b505b600081815260076020908152604090912084516121b892860190614d89565b5060008181526004602052604081204290555b835181101561224f577f2815fe71a8123f9bd0e2eaa1e61fc6c244707e2ad75340fa071283de5f08f0328285838151811061221657634e487b7160e01b600052603260045260246000fd5b6020026020010151604051612235929190918252602082015260400190565b60405180910390a1806122478161552e565b9150506121cb565b5060019392505050565b600080548190600160a01b900460ff16156122865760405162461bcd60e51b8152600401610a6f9061528d565b60015460006122948261134e565b9150506122a081611ba5565b6122d25760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610a6f565b60008281526007602052604090205487106122ff5760405162461bcd60e51b8152600401610a6f906152c7565b6000861161231f5760405162461bcd60e51b8152600401610a6f906152aa565b600082815260076020526040812080548990811061234d57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806000141561237b5760405162461bcd60e51b8152600401610a6f90615319565b60006123906108e9630a488a0b60e31b610cf0565b90508082106123c75760405162461bcd60e51b815260206004820152600360248201526245313960e81b6044820152606401610a6f565b6001600160a01b0387166124035760405162461bcd60e51b815260206004820152600360248201526204532360ec1b6044820152606401610a6f565b6000848152600860209081526040808320858452909152908190205490516370a0823160e01b81526001600160a01b0389811660048301528a9216906370a082319060240160206040518083038186803b15801561246057600080fd5b505afa158015612474573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124989190615048565b10156124cc5760405162461bcd60e51b815260206004820152600360248201526245323160e81b6044820152606401610a6f565b600081896124da85836154eb565b6124e4919061548d565b6124ee91906153f6565b905060006124fe82846000610b0d565b90506000600a61250f83600361548d565b61251991906153f6565b60008881526008602090815260408083208984529091529081902054905163079cc67960e41b81526001600160a01b038d81166004830152602482018f90529293509116906379cc679090604401600060405180830381600087803b15801561258157600080fd5b505af1158015612595573d6000803e3d6000fd5b5050506000888152601460209081526040808320898452909152812080548693509091906125c49084906153b0565b9091555050600054600160a01b900460ff16612654576125f46d5374616b696e675265776172647360901b610cf0565b6001600160a01b0316632e1a7d4d846040518263ffffffff1660e01b815260040161262191815260200190565b600060405180830381600087803b15801561263b57600080fd5b505af115801561264f573d6000803e3d6000fd5b505050505b6126828a61266284866154eb565b612672630a488a0b60e31b610cf0565b6001600160a01b031691906145b4565b6126b061269f6d2332b2a234b9ba3934b13aba37b960911b610cf0565b82612672630a488a0b60e31b610cf0565b7f6ad50071b7b194cd74cdd9868f94021cfb61298ca23a686ecf5c7e644fdcb4e487868c8e8787876040516126eb9796959493929190615336565b60405180910390a150909a909950975050505050505050565b6000815183511461273d5760405162461bcd60e51b815260206004820152600360248201526222989b60e91b6044820152606401610a6f565b60005b835181101561224f576127a184828151811061276c57634e487b7160e01b600052603260045260246000fd5b602002602001015184838151811061279457634e487b7160e01b600052603260045260246000fd5b6020026020010151612ae2565b50806127ac8161552e565b915050612740565b60008054600160a01b900460ff166127f45760405162461bcd60e51b815260206004820152600360248201526245323560e81b6044820152606401610a6f565b60015460008181526007602052604090205485106128245760405162461bcd60e51b8152600401610a6f906152c7565b600084116128445760405162461bcd60e51b8152600401610a6f906152aa565b600081815260076020526040812080548790811061287257634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600014156128a05760405162461bcd60e51b8152600401610a6f90615319565b6001600160a01b0384166128dc5760405162461bcd60e51b815260206004820152600360248201526204532360ec1b6044820152606401610a6f565b6000828152600860209081526040808320848452909152908190205490516370a0823160e01b81526001600160a01b038681166004830152879216906370a082319060240160206040518083038186803b15801561293957600080fd5b505afa15801561294d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129719190615048565b10156129a55760405162461bcd60e51b815260206004820152600360248201526245323160e81b6044820152606401610a6f565b60008281526008602090815260408083208484529091529081902054905163079cc67960e41b81526001600160a01b03868116600483015260248201889052909116906379cc679090604401600060405180830381600087803b158015612a0b57600080fd5b505af1158015612a1f573d6000803e3d6000fd5b5050505060003382604051602001612a38929190615146565b60408051808303601f19018152918152815160209283012060008681526013845282812082825290935290822080549290559150612a818682612672630a488a0b60e31b610cf0565b60408051858152602081018590526001600160a01b03881681830152606081018990526080810183905290517ffe78c1b9e6a078b9b6d0b33c4022a89825db55dea6be97c3c6207ce619eb729c9181900360a00190a1979650505050505050565b60008054600160a01b900460ff1615612b0d5760405162461bcd60e51b8152600401610a6f9061528d565b60006001546001612b1e91906153b0565b60015490915015612b8b5760015460009081526005602052604090205460ff168015612b59575060008181526006602052604090205460ff16155b612b8b5760405162461bcd60e51b815260206004820152600360248201526222991b60e91b6044820152606401610a6f565b6000818152600760205260409020548410612bb85760405162461bcd60e51b8152600401610a6f906152c7565b60008311612bd85760405162461bcd60e51b8152600401610a6f906152aa565b6000818152600760205260408120805486908110612c0657634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060001415612c345760405162461bcd60e51b8152600401610a6f90615319565b60003382604051602001612c49929190615146565b604051602081830303815290604052805190602001209050612c88333087612c77630a488a0b60e31b610cf0565b6001600160a01b0316929190614576565b6000838152600d6020908152604080832084845290915281208054879290612cb19084906153b0565b9091555050600083815260096020908152604080832085845290915281208054879290612cdf9084906153b0565b90915550506000838152600a602052604081208054879290612d029084906153b0565b90915550506000838152600b6020908152604080832085845290915281208054879290612d309084906153b0565b90915550506000838152600c602052604081208054879290612d539084906153b0565b90915550612d7390506d5374616b696e675265776172647360901b610cf0565b6001600160a01b031663a694fc3a866040518263ffffffff1660e01b8152600401612da091815260200190565b600060405180830381600087803b158015612dba57600080fd5b505af1158015612dce573d6000803e3d6000fd5b50506040805186815260208101869052338183015290517f69a3d39cbba81c2ebd7a5e35a14c851461f3446cf06d57380f89b7a244bb5bf29350908190036060019150a150600195945050505050565b600080546001600160a01b03163314612e495760405162461bcd60e51b8152600401610a6f906152e4565b6000805460ff60a01b1916600160a01b178155612e6590613de9565b604051600181527f3ff7b26c9c1989d572dc980143df229d9bcd7b459794643ef88b6052eceb600f90602001611b97565b606060008311612eb85760405162461bcd60e51b8152600401610a6f90615270565b60008381526007602052604081205490816001600160401b03811115612eee57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612f17578160200160208202803683370190505b50905060005b82811015610fbc576000868152600760205260408120805483908110612f5357634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905060008682604051602001612f75929190615146565b60408051601f19818403018152918152815160209283012060008b815260118452828120828252909352912054855191925090859085908110612fc857634e487b7160e01b600052603260045260246000fd5b60200260200101818152505050508080612fe19061552e565b915050612f1d565b600061300c74283934b1b2a7b930b1b632a0b3b3b932b3b0ba37b960591b610cf0565b60405163eb9d14a960e01b81526001600160a01b038481166004830152919091169063eb9d14a99060240160206040518083038186803b15801561304f57600080fd5b505afa158015611f5a573d6000803e3d6000fd5b6000546001600160a01b0316331461308d5760405162461bcd60e51b8152600401610a6f906152e4565b6001600160a01b0381166130f25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a6f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008054600160a01b900460ff16156131785760405162461bcd60e51b8152600401610a6f9061528d565b60015460009081526005602052604090205460ff16156131bf5760405162461bcd60e51b8152602060048201526002602482015261229b60f11b6044820152606401610a6f565b60015460009081526006602052604090205460ff166132065760405162461bcd60e51b815260206004820152600360248201526245323760e81b6044820152606401610a6f565b6001546132135750600090565b600061322f6d5374616b696e675265776172647360901b610cf0565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b15801561327457600080fd5b505afa158015613288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132ac9190615048565b6040516246613160e11b81523060048201529091506000906001600160a01b03841690628cc26290602401604080518083038186803b1580156132ee57600080fd5b505afa158015613302573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613326919061508b565b60015460009081526007602090815260408083208054825181850281018501909352808352949650929450929083018282801561338257602002820191906000526020600020905b81548152602001906001019080831161336e575b5050505050905060005b81518110156134da576001546000908152600a602090815260408083205460099092528220845183908690869081106133d557634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002054856133f7919061548d565b61340191906153f6565b905080600e60006001548152602001908152602001600020600085858151811061343b57634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020600082825461346091906153b0565b90915550506001546000908152600b60205260408120845183929086908690811061349b57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060008282546134c091906153b0565b909155508291506134d290508161552e565b91505061338c565b506001546000908152600c6020526040812080548492906134fc9084906153b0565b9091555050811561355b57836001600160a01b031663f69e20466040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561354257600080fd5b505af1158015613556573d6000803e3d6000fd5b505050505b6001546040516370a0823160e01b81523060048201527ff023808f96f6a68bd22b07b8d9091f94ea9280d1ebbb9631e0dda9d3689fd1e19190849086906001600160a01b038916906370a082319060240160206040518083038186803b1580156135c457600080fd5b505afa1580156135d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135fc9190615048565b60408051948552602085019390935291830152606082015260800160405180910390a1600194505050505090565b600080546001600160a01b031633146136555760405162461bcd60e51b8152600401610a6f906152e4565b60008381526015602090815260409182902084905581518581529081018490527fa0646fc9dac885ce3e0b1e4d169a6208ad836fba961a3974527cdc46d2e536fc910160405180910390a150600192915050565b600080546001600160a01b031633146136d45760405162461bcd60e51b8152600401610a6f906152e4565b600060015460016136e591906153b0565b60008181526006602052604090205490915060ff161561372c5760405162461bcd60e51b815260206004820152600260248201526108a760f31b6044820152606401610a6f565b60008181526007602052604090205461376c5760405162461bcd60e51b8152602060048201526002602482015261453960f01b6044820152606401610a6f565b600154156137bb5760015460009081526005602052604090205460ff166137bb5760405162461bcd60e51b815260206004820152600360248201526204531360ec1b6044820152606401610a6f565b60005b6000828152600760205260409020548110156139c457600082815260076020526040812080548390811061380257634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050600061384460405180604001604052806009815260200168149114160b50d0531360ba1b81525061383f846146d3565b6147ec565b905061386f81604051806040016040528060078152602001662d45504f43482d60c81b8152506147ec565b905061387e8161383f866146d3565b905060006138ab7f0000000000000000000000000000000000000000000000000000000000000000614818565b60405163266c45bb60e11b81529091506001600160a01b03821690634cd88b76906138dc908590819060040161524b565b600060405180830381600087803b1580156138f657600080fd5b505af115801561390a573d6000803e3d6000fd5b5050506000868152600860209081526040808320878452825280832080546001600160a01b0319166001600160a01b03871690811790915589845260098352818420888552909252918290205491516340c10f1960e01b8152306004820152602481019290925291506340c10f1990604401600060405180830381600087803b15801561399657600080fd5b505af11580156139aa573d6000803e3d6000fd5b5050505050505080806139bc9061552e565b9150506137be565b5060008181526006602052604090819020805460ff19166001908117909155829055517f648078b14acb0e3f5c3bf89d6216dfc5c1cd4d0fb646963ef9091179ba2808cb90613a169083815260200190565b60405180910390a1600191505090565b801580613aaf5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015613a7557600080fd5b505afa158015613a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aad9190615048565b155b613b1a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a6f565b6040516001600160a01b038316602482015260448101829052613b7d90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526148b0565b505050565b6060613b918484600085614982565b949350505050565b6000828152600760205260409020548110613bc65760405162461bcd60e51b8152600401610a6f906152c7565b6000828152600760205260408120805483908110613bf457634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060001415613c225760405162461bcd60e51b8152600401610a6f90615319565b60003382604051602001613c37929190615146565b60408051601f1981840301815291815281516020928301206000878152600d845282812082825290935291205490915080613c9a5760405162461bcd60e51b815260206004820152600360248201526245323360e81b6044820152606401610a6f565b6000613cac630a488a0b60e31b610cf0565b60008781526009602090815260408083208884528252808320548a8452600e83528184208985529092528220549293509091613ce990859061548d565b613cf391906153f6565b90506000613d0662088a0b60eb1b610cf0565b60008981526009602090815260408083208a84528252808320548c8452600f83528184208b85529092528220549293509091613d4390879061548d565b613d4d91906153f6565b60008a8152600d602090815260408083208a84529091528120559050613d7d6001600160a01b03851633856145b4565b613d916001600160a01b03831633836145b4565b604080518a8152602081018990523381830152606081018790526080810185905290517f69cd43a7a59f690a72044810c7a53102ba8068689b6fb42c9611b7d56201acf39181900360a00190a1505050505050505050565b6000613e056d5374616b696e675265776172647360901b610cf0565b90506000613e1862088a0b60eb1b610cf0565b90506000613e2c630a488a0b60e31b610cf0565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038516906370a082319060240160206040518083038186803b158015613e7157600080fd5b505afa158015613e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ea99190615048565b1115613f7f576040516370a0823160e01b81523060048201526001600160a01b03841690632e1a7d4d9082906370a082319060240160206040518083038186803b158015613ef657600080fd5b505afa158015613f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f2e9190615048565b6040518263ffffffff1660e01b8152600401613f4c91815260200190565b600060405180830381600087803b158015613f6657600080fd5b505af1158015613f7a573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b158015613fc157600080fd5b505afa158015613fd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ff99190615048565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a082319060240160206040518083038186803b15801561403e57600080fd5b505afa158015614052573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140769190615048565b604051631c4b774b60e01b8152600260048201529091506001600160a01b03861690631c4b774b90602401600060405180830381600087803b1580156140bb57600080fd5b505af11580156140cf573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201528492506001600160a01b03871691506370a082319060240160206040518083038186803b15801561411457600080fd5b505afa158015614128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061414c9190615048565b61415691906154eb565b6040516370a0823160e01b815230600482015290925081906001600160a01b038516906370a082319060240160206040518083038186803b15801561419a57600080fd5b505afa1580156141ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141d29190615048565b6141dc91906154eb565b6001546000908152600c60205260409020549091501561456e5760015460009081526007602090815260408083208054825181850281018501909352808352919290919083018282801561424f57602002820191906000526020600020905b81548152602001906001019080831161423b575b5050505050905060005b815181101561456b576001546000908152600c6020908152604080832054600b9092528220845183908690869081106142a257634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002054856142c4919061548d565b6142ce91906153f6565b9050601460006001548152602001908152602001600020600084848151811061430757634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000205481600960006001548152602001908152602001600020600086868151811061435657634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000205461437791906153b0565b61438191906154eb565b600e6000600154815260200190815260200160002060008585815181106143b857634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060008282546143dd91906153b0565b9091555050881561449857601260006001548152602001908152602001600020600084848151811061441f57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002054600e60006001548152602001908152602001600020600085858151811061446d57634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020600082825461449291906153b0565b90915550505b6001546000908152600c6020908152604080832054600b90925282208551919290918690869081106144da57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002054866144fc919061548d565b61450691906153f6565b600f60006001548152602001908152602001600020600085858151811061453d57634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020819055505080806145639061552e565b915050614259565b50505b505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526145ae9085906323b872dd60e01b90608401613b46565b50505050565b6040516001600160a01b038316602482015260448101829052613b7d90849063a9059cbb60e01b90606401613b46565b60006145fb6145f662015180846153f6565b614a9f565b50909392505050565b60006112396145f662015180846153f6565b600062015180614627858585614c13565b613b91919061548d565b60008061464162015180846153f6565b905060076146508260036153b0565b61465a9190615549565b610ce99060016153b0565b6000613b916145f662015180846153f6565b600081614685603c8561548d565b614691610e108761548d565b620151806146a08b8b8b614c13565b6146aa919061548d565b6146b491906153b0565b6146be91906153b0565b6146c891906153b0565b979650505050505050565b6060816146f75750506040805180820190915260018152600360fc1b602082015290565b8160005b8115614721578061470b8161552e565b915061471a9050600a836153f6565b91506146fb565b6000816001600160401b0381111561474957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015614773576020820181803683370190505b5090505b8415613b91576147886001836154eb565b9150614795600a86615549565b6147a09060306153b0565b60f81b8183815181106147c357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506147e5600a866153f6565b9450614777565b60608282604051602001614801929190615184565b604051602081830303815290604052905092915050565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116611d645760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610a6f565b6000614905826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b829092919063ffffffff16565b805190915015613b7d57808060200190518101906149239190614ff3565b613b7d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a6f565b6060824710156149e35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a6f565b843b614a315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a6f565b600080866001600160a01b03168587604051614a4d9190615168565b60006040518083038185875af1925050503d8060008114614a8a576040519150601f19603f3d011682016040523d82523d6000602084013e614a8f565b606091505b50915091506146c8828286614d50565b60008080838162253d8c614ab68362010bd961536f565b614ac0919061536f565b9050600062023ab1614ad383600461540a565b614add91906153c8565b90506004614aee8262023ab161540a565b614af990600361536f565b614b0391906153c8565b614b0d90836154ac565b9150600062164b09614b2084600161536f565b614b2c90610fa061540a565b614b3691906153c8565b90506004614b46826105b561540a565b614b5091906153c8565b614b5a90846154ac565b614b6590601f61536f565b9250600061098f614b7785605061540a565b614b8191906153c8565b905060006050614b938361098f61540a565b614b9d91906153c8565b614ba790866154ac565b9050614bb4600b836153c8565b9450614bc185600c61540a565b614bcc83600261536f565b614bd691906154ac565b91508483614be56031876154ac565b614bf090606461540a565b614bfa919061536f565b614c04919061536f565b9a919950975095505050505050565b60006107b2841015614c2457600080fd5b838383600062253d8c60046064600c614c3e600e886154ac565b614c4891906153c8565b614c548861132461536f565b614c5e919061536f565b614c6891906153c8565b614c7390600361540a565b614c7d91906153c8565b600c80614c8b600e886154ac565b614c9591906153c8565b614ca090600c61540a565b614cab6002886154ac565b614cb591906154ac565b614cc19061016f61540a565b614ccb91906153c8565b6004600c614cda600e896154ac565b614ce491906153c8565b614cf0896112c061536f565b614cfa919061536f565b614d06906105b561540a565b614d1091906153c8565b614d1c617d4b876154ac565b614d26919061536f565b614d30919061536f565b614d3a91906154ac565b614d4491906154ac565b98975050505050505050565b60608315614d5f575081610ce9565b825115614d6f5782518084602001fd5b8160405162461bcd60e51b8152600401610a6f9190615238565b828054828255906000526020600020908101928215614dc4579160200282015b82811115614dc4578251825591602001919060010190614da9565b50614dd0929150614dd4565b5090565b5b80821115614dd05760008155600101614dd5565b80356001600160a01b0381168114611d6457600080fd5b60008083601f840112614e11578081fd5b5081356001600160401b03811115614e27578182fd5b6020830191508360208260051b850101111561194657600080fd5b600082601f830112614e52578081fd5b813560206001600160401b0380831115614e6e57614e6e615589565b8260051b604051601f19603f83011681018181108482111715614e9357614e93615589565b60405284815283810192508684018288018501891015614eb1578687fd5b8692505b85831015614ed3578035845292840192600192909201918401614eb5565b50979650505050505050565b600060208284031215614ef0578081fd5b610ce982614de9565b60008060008060408587031215614f0e578283fd5b84356001600160401b0380821115614f24578485fd5b614f3088838901614e00565b90965094506020870135915080821115614f48578384fd5b50614f5587828801614e00565b95989497509550505050565b600060208284031215614f72578081fd5b81356001600160401b03811115614f87578182fd5b613b9184828501614e42565b60008060408385031215614fa5578182fd5b82356001600160401b0380821115614fbb578384fd5b614fc786838701614e42565b93506020850135915080821115614fdc578283fd5b50614fe985828601614e42565b9150509250929050565b600060208284031215615004578081fd5b8151610ce98161559f565b600060208284031215615020578081fd5b5035919050565b60008060408385031215615039578182fd5b50508035926020909101359150565b600060208284031215615059578081fd5b5051919050565b60008060408385031215615072578182fd5b8235915061508260208401614de9565b90509250929050565b6000806040838503121561509d578182fd5b505080516020909101519092909150565b6000806000606084860312156150c2578283fd5b83359250602084013591506150d960408501614de9565b90509250925092565b6000806000606084860312156150f6578081fd5b8335925060208401359150604084013561510f8161559f565b809150509250925092565b60008151808452615132816020860160208601615502565b601f01601f19169290920160200192915050565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6000825161517a818460208701615502565b9190910192915050565b60008351615196818460208801615502565b8351908301906151aa818360208801615502565b01949350505050565b6020808252825182820181905260009190848201906040850190845b818110156151f45783516001600160a01b0316835292840192918401916001016151cf565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156151f45783518352928401929184019160010161521c565b602081526000610ce9602083018461511a565b60408152600061525e604083018561511a565b8281036020840152611cf4818561511a565b60208082526003908201526245313760e81b604082015260600190565b602080825260039082015262114c8d60ea1b604082015260600190565b602080825260039082015262114c4d60ea1b604082015260600190565b60208082526003908201526245313360e81b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526003908201526245313560e81b604082015260600190565b96875260208701959095526001600160a01b039390931660408601526060850191909152608084015260a083015260c082015260e00190565b600080821280156001600160ff1b03849003851316156153915761539161555d565b600160ff1b83900384128116156153aa576153aa61555d565b50500190565b600082198211156153c3576153c361555d565b500190565b6000826153d7576153d7615573565b600160ff1b8214600019841416156153f1576153f161555d565b500590565b60008261540557615405615573565b500490565b60006001600160ff1b03818413828413808216868404861116156154305761543061555d565b600160ff1b8487128281168783058912161561544e5761544e61555d565b8587129250878205871284841616156154695761546961555d565b8785058712818416161561547f5761547f61555d565b505050929093029392505050565b60008160001904831182151516156154a7576154a761555d565b500290565b60008083128015600160ff1b8501841216156154ca576154ca61555d565b6001600160ff1b03840183138116156154e5576154e561555d565b50500390565b6000828210156154fd576154fd61555d565b500390565b60005b8381101561551d578181015183820152602001615505565b838111156145ae5750506000910152565b60006000198214156155425761554261555d565b5060010190565b60008261555857615558615573565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b80151581146155ad57600080fd5b5056fea2646970667358221220ed6e24803d176da05e67681952220061ef4cdc8e5c601b3b332a86cf1fcb984f64736f6c63430008040033608060405234801561001057600080fd5b50611f6f806100206000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80635c975abb11610104578063a217fddf116100a2578063d539139311610071578063d5391393146103ce578063d547741f146103f5578063dd62ed3e14610408578063e63ab1e91461044157600080fd5b8063a217fddf1461038d578063a457c2d714610395578063a9059cbb146103a8578063ca15c873146103bb57600080fd5b80638456cb59116100de5780638456cb591461033f5780639010d07c1461034757806391d148541461037257806395d89b411461038557600080fd5b80635c975abb146102f757806370a082311461030357806379cc67901461032c57600080fd5b8063313ce567116101715780633f4ba83a1161014b5780633f4ba83a146102b657806340c10f19146102be57806342966c68146102d15780634cd88b76146102e457600080fd5b8063313ce5671461028157806336568abe1461029057806339509351146102a357600080fd5b806318160ddd116101ad57806318160ddd1461022457806323b872dd14610236578063248a9ca3146102495780632f2ff15d1461026c57600080fd5b806301ffc9a7146101d457806306fdde03146101fc578063095ea7b314610211575b600080fd5b6101e76101e2366004611c9e565b610456565b60405190151581526020015b60405180910390f35b610204610481565b6040516101f39190611d9c565b6101e761021f366004611c1a565b610513565b60cb545b6040519081526020016101f3565b6101e7610244366004611bdf565b610529565b610228610257366004611c43565b60009081526065602052604090206001015490565b61027f61027a366004611c5b565b6105df565b005b604051601281526020016101f3565b61027f61029e366004611c5b565b610606565b6101e76102b1366004611c1a565b610628565b61027f61065f565b61027f6102cc366004611c1a565b6106f3565b61027f6102df366004611c43565b610796565b61027f6102f2366004611cc6565b6107a3565b61012d5460ff166101e7565b610228610311366004611b93565b6001600160a01b0316600090815260c9602052604090205490565b61027f61033a366004611c1a565b61081a565b61027f61089d565b61035a610355366004611c7d565b61092f565b6040516001600160a01b0390911681526020016101f3565b6101e7610380366004611c5b565b61094e565b610204610979565b610228600081565b6101e76103a3366004611c1a565b610988565b6101e76103b6366004611c1a565b610a23565b6102286103c9366004611c43565b610a30565b6102287f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b61027f610403366004611c5b565b610a47565b610228610416366004611bad565b6001600160a01b03918216600090815260ca6020908152604080832093909416825291909152205490565b610228600080516020611f1a83398151915281565b60006001600160e01b03198216635a05180f60e01b148061047b575061047b82610a51565b92915050565b606060cc805461049090611eb2565b80601f01602080910402602001604051908101604052809291908181526020018280546104bc90611eb2565b80156105095780601f106104de57610100808354040283529160200191610509565b820191906000526020600020905b8154815290600101906020018083116104ec57829003601f168201915b5050505050905090565b6000610520338484610a86565b50600192915050565b6000610536848484610bab565b6001600160a01b038416600090815260ca60209081526040808320338452909152902054828110156105c05760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6105d485336105cf8685611e54565b610a86565b506001949350505050565b6105e98282610d8e565b60008281526097602052604090206106019082610db4565b505050565b6106108282610dc9565b60008281526097602052604090206106019082610e43565b33600081815260ca602090815260408083206001600160a01b038716845290915281205490916105209185906105cf908690611e1d565b610677600080516020611f1a8339815191523361094e565b6106e95760405162461bcd60e51b815260206004820152603960248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20756e70617573650000000000000060648201526084016105b7565b6106f1610e58565b565b61071d7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a63361094e565b6107885760405162461bcd60e51b815260206004820152603660248201527f45524332305072657365744d696e7465725061757365723a206d7573742068616044820152751d99481b5a5b9d195c881c9bdb19481d1bc81b5a5b9d60521b60648201526084016105b7565b6107928282610eed565b5050565b6107a03382610fd8565b50565b600054610100900460ff16806107bc575060005460ff16155b6107d85760405162461bcd60e51b81526004016105b790611dcf565b600054610100900460ff161580156107fa576000805461ffff19166101011790555b6108048383611133565b8015610601576000805461ff0019169055505050565b60006108268333610416565b9050818110156108845760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b60648201526084016105b7565b61089383336105cf8585611e54565b6106018383610fd8565b6108b5600080516020611f1a8339815191523361094e565b6109275760405162461bcd60e51b815260206004820152603760248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20706175736500000000000000000060648201526084016105b7565b6106f16111d6565b60008281526097602052604081206109479083611253565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060cd805461049090611eb2565b33600090815260ca602090815260408083206001600160a01b038616845290915281205482811015610a0a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105b7565b610a1933856105cf8685611e54565b5060019392505050565b6000610520338484610bab565b600081815260976020526040812061047b9061125f565b6106108282611269565b60006001600160e01b03198216637965db0b60e01b148061047b57506301ffc9a760e01b6001600160e01b031983161461047b565b6001600160a01b038316610ae85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b7565b6001600160a01b038216610b495760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b7565b6001600160a01b03838116600081815260ca602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610c0f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b7565b6001600160a01b038216610c715760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b7565b610c7c83838361128f565b6001600160a01b038316600090815260c9602052604090205481811015610cf45760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105b7565b610cfe8282611e54565b6001600160a01b03808616600090815260c960205260408082209390935590851681529081208054849290610d34908490611e1d565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610d8091815260200190565b60405180910390a350505050565b600082815260656020526040902060010154610daa813361129a565b61060183836112fe565b6000610947836001600160a01b038416611384565b6001600160a01b0381163314610e395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105b7565b61079282826113d3565b6000610947836001600160a01b03841661143a565b61012d5460ff16610ea25760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105b7565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610f435760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105b7565b610f4f6000838361128f565b8060cb6000828254610f619190611e1d565b90915550506001600160a01b038216600090815260c9602052604081208054839290610f8e908490611e1d565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0382166110385760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105b7565b6110448260008361128f565b6001600160a01b038216600090815260c96020526040902054818110156110b85760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105b7565b6110c28282611e54565b6001600160a01b038416600090815260c9602052604081209190915560cb80548492906110f0908490611e54565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610b9e565b600054610100900460ff168061114c575060005460ff16155b6111685760405162461bcd60e51b81526004016105b790611dcf565b600054610100900460ff1615801561118a576000805461ffff19166101011790555b611192611551565b61119a611551565b6111a2611551565b6111aa611551565b6111b483836115bc565b6111bc611551565b6111c4611651565b6111cc611551565b61080483836116c7565b61012d5460ff161561121d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105b7565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610ed03390565b6000610947838361176b565b600061047b825490565b600082815260656020526040902060010154611285813361129a565b61060183836113d3565b6106018383836117ff565b6112a4828261094e565b610792576112bc816001600160a01b03166014611866565b6112c7836020611866565b6040516020016112d8929190611d27565b60408051601f198184030181529082905262461bcd60e51b82526105b791600401611d9c565b611308828261094e565b6107925760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556113403390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008181526001830160205260408120546113cb5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561047b565b50600061047b565b6113dd828261094e565b156107925760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000818152600183016020526040812054801561154757600061145e600183611e54565b855490915060009061147290600190611e54565b9050600086600001828154811061149957634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050808760000184815481106114ca57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092558281526001890190915260409020849055865487908061150b57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061047b565b600091505061047b565b600054610100900460ff168061156a575060005460ff16155b6115865760405162461bcd60e51b81526004016105b790611dcf565b600054610100900460ff161580156115a8576000805461ffff19166101011790555b80156107a0576000805461ff001916905550565b600054610100900460ff16806115d5575060005460ff16155b6115f15760405162461bcd60e51b81526004016105b790611dcf565b600054610100900460ff16158015611613576000805461ffff19166101011790555b82516116269060cc906020860190611a57565b50815161163a9060cd906020850190611a57565b508015610601576000805461ff0019169055505050565b600054610100900460ff168061166a575060005460ff16155b6116865760405162461bcd60e51b81526004016105b790611dcf565b600054610100900460ff161580156116a8576000805461ffff19166101011790555b61012d805460ff1916905580156107a0576000805461ff001916905550565b600054610100900460ff16806116e0575060005460ff16155b6116fc5760405162461bcd60e51b81526004016105b790611dcf565b600054610100900460ff1615801561171e576000805461ffff19166101011790555b611729600033611a48565b6117537f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633611a48565b610804600080516020611f1a83398151915233611a48565b815460009082106117c95760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b60648201526084016105b7565b8260000182815481106117ec57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b61012d5460ff16156106015760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b60648201526084016105b7565b60606000611875836002611e35565b611880906002611e1d565b67ffffffffffffffff8111156118a657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156118d0576020820181803683370190505b509050600360fc1b816000815181106118f957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061193657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600061195a846002611e35565b611965906001611e1d565b90505b60018111156119f9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106119a757634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106119cb57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936119f281611e9b565b9050611968565b5083156109475760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105b7565b6105e9828261079282826112fe565b828054611a6390611eb2565b90600052602060002090601f016020900481019282611a855760008555611acb565b82601f10611a9e57805160ff1916838001178555611acb565b82800160010185558215611acb579182015b82811115611acb578251825591602001919060010190611ab0565b50611ad7929150611adb565b5090565b5b80821115611ad75760008155600101611adc565b80356001600160a01b0381168114611b0757600080fd5b919050565b600082601f830112611b1c578081fd5b813567ffffffffffffffff80821115611b3757611b37611f03565b604051601f8301601f19908116603f01168101908282118183101715611b5f57611b5f611f03565b81604052838152866020858801011115611b77578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215611ba4578081fd5b61094782611af0565b60008060408385031215611bbf578081fd5b611bc883611af0565b9150611bd660208401611af0565b90509250929050565b600080600060608486031215611bf3578081fd5b611bfc84611af0565b9250611c0a60208501611af0565b9150604084013590509250925092565b60008060408385031215611c2c578182fd5b611c3583611af0565b946020939093013593505050565b600060208284031215611c54578081fd5b5035919050565b60008060408385031215611c6d578182fd5b82359150611bd660208401611af0565b60008060408385031215611c8f578182fd5b50508035926020909101359150565b600060208284031215611caf578081fd5b81356001600160e01b031981168114610947578182fd5b60008060408385031215611cd8578182fd5b823567ffffffffffffffff80821115611cef578384fd5b611cfb86838701611b0c565b93506020850135915080821115611d10578283fd5b50611d1d85828601611b0c565b9150509250929050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611d5f816017850160208801611e6b565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611d90816028840160208801611e6b565b01602801949350505050565b6020815260008251806020840152611dbb816040850160208701611e6b565b601f01601f19169190910160400192915050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60008219821115611e3057611e30611eed565b500190565b6000816000190483118215151615611e4f57611e4f611eed565b500290565b600082821015611e6657611e66611eed565b500390565b60005b83811015611e86578181015183820152602001611e6e565b83811115611e95576000848401525b50505050565b600081611eaa57611eaa611eed565b506000190190565b600181811c90821680611ec657607f821691505b60208210811415611ee757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862aa2646970667358221220d336cd65edd0c4aa5028b35407216fb74d1a0d4b29682c6d07f8491a84222f5964736f6c63430008040033939e137f30f9b4f1facc727260c00ee2482b3b21191b496bae73dd4746306e210000000000000000000000006c2c06790b3e3e3c38e12ee22f8183b37a13ee5500000000000000000000000032eb7902d4134bf98a28b963d26de779af92a2120000000000000000000000008d481245801907b45823fb032e6848d0d3c29ae50000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b00000000000000000000000074cadbdf7850abd4f9bd355e528a9b23a2d334b40000000000000000000000003e0215c1d639280e13b46e3af94fb5630d1b321200000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c1

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

0000000000000000000000006c2c06790b3e3e3c38e12ee22f8183b37a13ee5500000000000000000000000032eb7902d4134bf98a28b963d26de779af92a2120000000000000000000000008d481245801907b45823fb032e6848d0d3c29ae50000000000000000000000002b99e3d67dad973c1b9747da742b7e26c8bdd67b00000000000000000000000074cadbdf7850abd4f9bd355e528a9b23a2d334b40000000000000000000000003e0215c1d639280e13b46e3af94fb5630d1b321200000000000000000000000055594cce8cc0014ea08c49fd820d731308f204c1

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

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


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.