ETH Price: $3,274.53 (-4.14%)
Gas: 9 Gwei

Token

Hegic ETH ATM Calls Pool (ETHCALLSPOOL)
 

Overview

Max Total Supply

0 ETHCALLSPOOL

Holders

67

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
scaryghost.eth
Balance
2 ETHCALLSPOOL
0x5662696f3487304A50AC51889c4e30592B6b25f6
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
HegicCALL

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 40 : Exerciser.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "./Interfaces/IOptionsManager.sol";
import "./Interfaces/Interfaces.sol";

/**
 * @author 0mllwntrmt3
 * @title Hegic Protocol V8888 Exerciser Contract
 * @notice The contract that allows to automatically exercise options half an hour before expiration
 **/
contract Exerciser {
    IOptionsManager immutable optionsManager;

    constructor(IOptionsManager manager) {
        optionsManager = manager;
    }

    function exercise(uint256 optionId) external {
        IHegicPool pool = IHegicPool(optionsManager.tokenPool(optionId));
        (, , , , uint256 expired, , ) = pool.options(optionId);
        require(
            block.timestamp > expired - 30 minutes,
            "Facade Error: Automatically exercise for this option is not available yet"
        );
        pool.exercise(optionId);
    }
}

File 2 of 40 : IOptionsManager.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/**
 * @notice The interface for the contract
 *   that tokenizes options as ERC721.
 **/

interface IOptionsManager is IERC721 {
    /**
     * @param holder The option buyer address
     **/
    function createOptionFor(address holder) external returns (uint256);

    /**
     * @param tokenId The ERC721 token ID linked to the option
     **/
    function tokenPool(uint256 tokenId) external returns (address pool);

    /**
     * @param spender The option buyer address or another address
     *   with the granted permission to buy/exercise options on the user's behalf
     * @param tokenId The ERC721 token ID linked to the option
     **/
    function isApprovedOrOwner(address spender, uint256 tokenId)
        external
        view
        returns (bool);
}

File 3 of 40 : Interfaces.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.7/interfaces/AggregatorV3Interface.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol";

// /**
//  * @author 0mllwntrmt3
//  * @title Hegic Protocol V8888 Interface
//  * @notice The interface for the price calculator,
//  *   options, pools and staking contracts.
//  **/

/**
 * @notice The interface fot the contract that calculates
 *   the options prices (the premiums) that are adjusted
 *   through balancing the `ImpliedVolRate` parameter.
 **/
interface IPriceCalculator {
    /**
     * @param period The option period
     * @param amount The option size
     * @param strike The option strike
     **/
    function calculateTotalPremium(
        uint256 period,
        uint256 amount,
        uint256 strike
    ) external view returns (uint256 settlementFee, uint256 premium);
}

/**
 * @notice The interface for the contract that manages pools and the options parameters,
 *   accumulates the funds from the liquidity providers and makes the withdrawals for them,
 *   sells the options contracts to the options buyers and collateralizes them,
 *   exercises the ITM (in-the-money) options with the unrealized P&L and settles them,
 *   unlocks the expired options and distributes the premiums among the liquidity providers.
 **/
interface IHegicPool is IERC721, IPriceCalculator {
    enum OptionState {Invalid, Active, Exercised, Expired}
    enum TrancheState {Invalid, Open, Closed}

    /**
     * @param state The state of the option: Invalid, Active, Exercised, Expired
     * @param strike The option strike
     * @param amount The option size
     * @param lockedAmount The option collateral size locked
     * @param expired The option expiration timestamp
     * @param hedgePremium The share of the premium paid for hedging from the losses
     * @param unhedgePremium The share of the premium paid to the hedged liquidity provider
     **/
    struct Option {
        OptionState state;
        uint256 strike;
        uint256 amount;
        uint256 lockedAmount;
        uint256 expired;
        uint256 hedgePremium;
        uint256 unhedgePremium;
    }

    /**
     * @param state The state of the liquidity tranche: Invalid, Open, Closed
     * @param share The liquidity provider's share in the pool
     * @param amount The size of liquidity provided
     * @param creationTimestamp The liquidity deposit timestamp
     * @param hedged The liquidity tranche type: hedged or unhedged (classic)
     **/
    struct Tranche {
        TrancheState state;
        uint256 share;
        uint256 amount;
        uint256 creationTimestamp;
        bool hedged;
    }

    /**
     * @param id The ERC721 token ID linked to the option
     * @param settlementFee The part of the premium that
     *   is distributed among the HEGIC staking participants
     * @param premium The part of the premium that
     *   is distributed among the liquidity providers
     **/
    event Acquired(uint256 indexed id, uint256 settlementFee, uint256 premium);

    /**
     * @param id The ERC721 token ID linked to the option
     * @param profit The profits of the option if exercised
     **/
    event Exercised(uint256 indexed id, uint256 profit);

    /**
     * @param id The ERC721 token ID linked to the option
     **/
    event Expired(uint256 indexed id);

    /**
     * @param account The liquidity provider's address
     * @param trancheID The liquidity tranche ID
     **/
    event Withdrawn(
        address indexed account,
        uint256 indexed trancheID,
        uint256 amount
    );

    /**
     * @param id The ERC721 token ID linked to the option
     **/
    function unlock(uint256 id) external;

    /**
     * @param id The ERC721 token ID linked to the option
     **/
    function exercise(uint256 id) external;

    function setLockupPeriod(uint256, uint256) external;

    /**
     * @param value The hedging pool address
     **/
    function setHedgePool(address value) external;

    /**
     * @param trancheID The liquidity tranche ID
     * @return amount The liquidity to be received with
     *   the positive or negative P&L earned or lost during
     *   the period of holding the liquidity tranche considered
     **/
    function withdraw(uint256 trancheID) external returns (uint256 amount);

    function pricer() external view returns (IPriceCalculator);

    /**
     * @return amount The unhedged liquidity size
     *   (unprotected from the losses on selling the options)
     **/
    function unhedgedBalance() external view returns (uint256 amount);

    /**
     * @return amount The hedged liquidity size
     * (protected from the losses on selling the options)
     **/
    function hedgedBalance() external view returns (uint256 amount);

    /**
     * @param account The liquidity provider's address
     * @param amount The size of the liquidity tranche
     * @param hedged The type of the liquidity tranche
     * @param minShare The minimum share in the pool of the user
     **/
    function provideFrom(
        address account,
        uint256 amount,
        bool hedged,
        uint256 minShare
    ) external returns (uint256 share);

    /**
     * @param holder The option buyer address
     * @param period The option period
     * @param amount The option size
     * @param strike The option strike
     **/
    function sellOption(
        address holder,
        uint256 period,
        uint256 amount,
        uint256 strike
    ) external returns (uint256 id);

    /**
     * @param trancheID The liquidity tranche ID
     * @return amount The amount to be received after the withdrawal
     **/
    function withdrawWithoutHedge(uint256 trancheID)
        external
        returns (uint256 amount);

    /**
     * @return amount The total liquidity provided into the pool
     **/
    function totalBalance() external view returns (uint256 amount);

    /**
     * @return amount The total liquidity locked in the pool
     **/
    function lockedAmount() external view returns (uint256 amount);

    function token() external view returns (IERC20);

    /**
     * @return state The state of the option: Invalid, Active, Exercised, Expired
     * @return strike The option strike
     * @return amount The option size
     * @return lockedAmount The option collateral size locked
     * @return expired The option expiration timestamp
     * @return hedgePremium The share of the premium paid for hedging from the losses
     * @return unhedgePremium The share of the premium paid to the hedged liquidity provider
     **/
    function options(uint256 id)
        external
        view
        returns (
            OptionState state,
            uint256 strike,
            uint256 amount,
            uint256 lockedAmount,
            uint256 expired,
            uint256 hedgePremium,
            uint256 unhedgePremium
        );

    /**
     * @return state The state of the liquidity tranche: Invalid, Open, Closed
     * @return share The liquidity provider's share in the pool
     * @return amount The size of liquidity provided
     * @return creationTimestamp The liquidity deposit timestamp
     * @return hedged The liquidity tranche type: hedged or unhedged (classic)
     **/
    function tranches(uint256 id)
        external
        view
        returns (
            TrancheState state,
            uint256 share,
            uint256 amount,
            uint256 creationTimestamp,
            bool hedged
        );
}

/**
 * @notice The interface for the contract that stakes HEGIC tokens
 *   through buying microlots (any amount of HEGIC tokens per microlot)
 *   and staking lots (888,000 HEGIC per lot), accumulates the staking
 *   rewards (settlement fees) and distributes the staking rewards among
 *   the microlots and staking lots holders (should be claimed manually).
 **/
interface IHegicStaking {
    event Claim(address indexed account, uint256 amount);
    event Profit(uint256 amount);
    event MicroLotsAcquired(address indexed account, uint256 amount);
    event MicroLotsSold(address indexed account, uint256 amount);

    function claimProfits(address account) external returns (uint256 profit);

    function buyStakingLot(uint256 amount) external;

    function sellStakingLot(uint256 amount) external;

    function distributeUnrealizedRewards() external;

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

interface IWETH is IERC20 {
    function deposit() external payable;

    function withdraw(uint256 value) external;
}

File 4 of 40 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 5 of 40 : IERC165.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 IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 6 of 40 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.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 ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(sender, recipient, amount);

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

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 40 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

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

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

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

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

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

File 8 of 40 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

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

File 9 of 40 : 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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 10 of 40 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

interface AggregatorV3Interface {

  function decimals() external view returns (uint8);
  function description() external view returns (string memory);
  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

}

File 11 of 40 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

File 12 of 40 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 13 of 40 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @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 14 of 40 : 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) {
        return msg.data;
    }
}

File 15 of 40 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 16 of 40 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 17 of 40 : 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;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    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

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

File 18 of 40 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 19 of 40 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 20 of 40 : HegicStaking.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../Interfaces/Interfaces.sol";

/**
 * @author 0mllwntrmt3
 * @title Hegic Protocol V8888 Staking Contract
 * @notice The contract that stakes the HEGIC tokens through
 * buying the microlots (any amount of HEGIC tokens per microlot)
 * and the staking lots (888,000 HEGIC per lot), accumulates the staking
 * rewards (settlement fees) and distributes the staking rewards among
 * the microlots and staking lots holders (should be claimed manually).
 **/

contract HegicStaking is ERC20, IHegicStaking {
    using SafeERC20 for IERC20;

    IERC20 public immutable HEGIC;
    IERC20 public immutable token;

    uint256 public constant STAKING_LOT_PRICE = 888_000e18;
    uint256 internal constant ACCURACY = 1e30;
    uint256 internal realisedBalance;

    uint256 public microLotsTotal = 0;
    mapping(address => uint256) public microBalance;

    uint256 public totalProfit = 0;
    mapping(address => uint256) internal lastProfit;

    uint256 public microLotsProfits = 0;
    mapping(address => uint256) internal lastMicroLotProfits;

    mapping(address => uint256) internal savedProfit;

    uint256 public classicLockupPeriod = 1 days;
    uint256 public microLockupPeriod = 1 days;

    mapping(address => uint256) public lastBoughtTimestamp;
    mapping(address => uint256) public lastMicroBoughtTimestamp;
    mapping(address => bool) public _revertTransfersInLockUpPeriod;

    constructor(
        ERC20 _hegic,
        ERC20 _token,
        string memory name,
        string memory short
    ) ERC20(name, short) {
        HEGIC = _hegic;
        token = _token;
    }

    function decimals() public pure override returns (uint8) {
        return 0;
    }

    /**
     * @notice Used by the HEGIC microlots holders
     * or staking lots holders for claiming
     * the accumulated staking rewards.
     **/
    function claimProfits(address account)
        external
        override
        returns (uint256 profit)
    {
        saveProfits(account);
        profit = savedProfit[account];
        require(profit > 0, "Zero profit");
        savedProfit[account] = 0;
        realisedBalance -= profit;
        token.safeTransfer(account, profit);
        emit Claim(account, profit);
    }

    /**
     * @notice Used for staking any amount of the HEGIC tokens
     * higher than zero in the form of buying the microlot
     * for receiving a pro rata share of 20% of the total staking
     * rewards (settlement fees) generated by the protocol.
     **/
    function buyMicroLot(uint256 amount) external {
        require(amount > 0, "Amount is zero");
        saveProfits(msg.sender);
        lastMicroBoughtTimestamp[msg.sender] = block.timestamp;
        microLotsTotal += amount;
        microBalance[msg.sender] += amount;
        HEGIC.safeTransferFrom(msg.sender, address(this), amount);
        emit MicroLotsAcquired(msg.sender, amount);
    }

    /**
     * @notice Used for unstaking the HEGIC tokens
     * in the form of selling the microlot.
     **/
    function sellMicroLot(uint256 amount) external {
        require(amount > 0, "Amount is zero");
        require(
            lastMicroBoughtTimestamp[msg.sender] + microLockupPeriod <
                block.timestamp,
            "The action is suspended due to the lockup"
        );
        saveProfits(msg.sender);
        microLotsTotal -= amount;
        microBalance[msg.sender] -= amount;
        HEGIC.safeTransfer(msg.sender, amount);
        emit MicroLotsSold(msg.sender, amount);
    }

    /**
     * @notice Used for staking the fixed amount of 888,000 HEGIC
     * tokens in the form of buying the staking lot (transferrable)
     * for receiving a pro rata share of 80% of the total staking
     * rewards (settlement fees) generated by the protocol.
     **/
    function buyStakingLot(uint256 amount) external override {
        lastBoughtTimestamp[msg.sender] = block.timestamp;
        require(amount > 0, "Amount is zero");
        _mint(msg.sender, amount);
        HEGIC.safeTransferFrom(
            msg.sender,
            address(this),
            amount * STAKING_LOT_PRICE
        );
    }

    /**
     * @notice Used for unstaking 888,000 HEGIC
     * tokens in the form of selling the staking lot.
     **/
    function sellStakingLot(uint256 amount) external override lockupFree {
        _burn(msg.sender, amount);
        HEGIC.safeTransfer(msg.sender, amount * STAKING_LOT_PRICE);
    }

    function revertTransfersInLockUpPeriod(bool value) external {
        _revertTransfersInLockUpPeriod[msg.sender] = value;
    }

    /**
     * @notice Returns the amount of unclaimed staking rewards.
     **/
    function profitOf(address account)
        external
        view
        override
        returns (uint256)
    {
        (uint256 profit, uint256 micro) = getUnsavedProfits(account);
        return savedProfit[account] + profit + micro;
    }

    /**
     * @notice Used for calculating the amount of accumulated
     * staking rewards before the share of the staking participant
     * changes higher (buying more microlots or staking lots)
     * or lower (selling more microlots or staking lots).
     **/
    function getUnsavedProfits(address account)
        internal
        view
        returns (uint256 total, uint256 micro)
    {
        total =
            ((totalProfit - lastProfit[account]) * balanceOf(account)) /
            ACCURACY;
        micro =
            ((microLotsProfits - lastMicroLotProfits[account]) *
                microBalance[account]) /
            ACCURACY;
    }

    /**
     * @notice Used for saving the amount of accumulated
     * staking rewards before the staking participant's share
     * changes higher (buying more microlots or staking lots)
     * or lower (selling more microlots or staking lots).
     **/
    function saveProfits(address account) internal {
        (uint256 unsaved, uint256 micro) = getUnsavedProfits(account);
        lastProfit[account] = totalProfit;
        lastMicroLotProfits[account] = microLotsProfits;
        savedProfit[account] += unsaved;
        savedProfit[account] += micro;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256
    ) internal override {
        if (from != address(0)) saveProfits(from);
        if (to != address(0)) saveProfits(to);
        if (
            lastBoughtTimestamp[from] + classicLockupPeriod > block.timestamp &&
            lastBoughtTimestamp[from] > lastBoughtTimestamp[to]
        ) {
            require(
                !_revertTransfersInLockUpPeriod[to],
                "The recipient does not agree to accept the locked funds"
            );
            lastBoughtTimestamp[to] = lastBoughtTimestamp[from];
        }
    }

    /**
     * @notice Used for distributing the staking rewards
     * among the microlots and staking lots holders.
     **/
    function distributeUnrealizedRewards() external override {
        uint256 amount = token.balanceOf(address(this)) - realisedBalance;
        realisedBalance += amount;
        uint256 _totalSupply = totalSupply();
        if (microLotsTotal + _totalSupply > 0) {
            if (microLotsTotal == 0) {
                totalProfit += (amount * ACCURACY) / _totalSupply;
            } else if (_totalSupply == 0) {
                microLotsProfits += (amount * ACCURACY) / microLotsTotal;
            } else {
                uint256 microAmount = amount / 5;
                uint256 baseAmount = amount - microAmount;
                microLotsProfits += (microAmount * ACCURACY) / microLotsTotal;
                totalProfit += (baseAmount * ACCURACY) / _totalSupply;
            }
            emit Profit(amount);
        }
    }

    modifier lockupFree {
        require(
            lastBoughtTimestamp[msg.sender] + classicLockupPeriod <=
                block.timestamp,
            "The action is suspended due to the lockup"
        );
        _;
    }
}

File 21 of 40 : OptionsManager.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "../Interfaces/IOptionsManager.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

/**
 * @author 0mllwntrmt3
 * @title Hegic Protocol V8888 Options Manager Contract
 * @notice The contract that buys the options contracts for the options holders
 * as well as checks whether the contract that is used for buying/exercising
 * options has been been granted with the permission to do it on the user's behalf.
 **/

contract OptionsManager is
    IOptionsManager,
    ERC721("Hegic V8888 Options (Tokenized)", "HOT8888"),
    AccessControl
{
    bytes32 public constant HEGIC_POOL_ROLE = keccak256("HEGIC_POOL_ROLE");
    uint256 public nextTokenId = 0;
    mapping(uint256 => address) public override tokenPool;

    constructor() {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    /**
     * @dev See EIP-165: ERC-165 Standard Interface Detection
     * https://eips.ethereum.org/EIPS/eip-165
     **/
    function createOptionFor(address holder)
        public
        override
        onlyRole(HEGIC_POOL_ROLE)
        returns (uint256 id)
    {
        id = nextTokenId++;
        tokenPool[id] = msg.sender;
        _safeMint(holder, id);
    }

    /**
     * @dev See EIP-165: ERC-165 Standard Interface Detection
     * https://eips.ethereum.org/EIPS/eip-165
     **/
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC721, AccessControl, IERC165)
        returns (bool)
    {
        return
            interfaceId == type(IOptionsManager).interfaceId ||
            AccessControl.supportsInterface(interfaceId) ||
            ERC721.supportsInterface(interfaceId);
    }

    /**
     * @notice Used for checking whether the user has approved
     * the contract to buy/exercise the options on her behalf.
     * @param spender The address of the contract
     * that is used for exercising the options
     * @param tokenId The ERC721 token ID that is linked to the option
     **/
    function isApprovedOrOwner(address spender, uint256 tokenId)
        external
        view
        virtual
        override
        returns (bool)
    {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner ||
            getApproved(tokenId) == spender ||
            isApprovedForAll(owner, spender));
    }
}

File 22 of 40 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    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 AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev 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(IAccessControl).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 ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view 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());
        }
    }
}

File 23 of 40 : HegicPool.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "../Interfaces/Interfaces.sol";
import "../Interfaces/IOptionsManager.sol";
import "../Interfaces/Interfaces.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

/**
 * @author 0mllwntrmt3
 * @title Hegic Protocol V8888 Main Pool Contract
 * @notice One of the main contracts that manages the pools and the options parameters,
 * accumulates the funds from the liquidity providers and makes the withdrawals for them,
 * sells the options contracts to the options buyers and collateralizes them,
 * exercises the ITM (in-the-money) options with the unrealized P&L and settles them,
 * unlocks the expired options and distributes the premiums among the liquidity providers.
 **/
abstract contract HegicPool is
    IHegicPool,
    ERC721,
    AccessControl,
    ReentrancyGuard
{
    using SafeERC20 for IERC20;

    uint256 public constant INITIAL_RATE = 1e20;
    IOptionsManager public immutable optionsManager;
    AggregatorV3Interface public immutable priceProvider;
    IPriceCalculator public override pricer;
    uint256 public lockupPeriodForHedgedTranches = 60 days;
    uint256 public lockupPeriodForUnhedgedTranches = 30 days;
    uint256 public hedgeFeeRate = 80;
    uint256 public maxUtilizationRate = 80;
    uint256 public collateralizationRatio = 50;
    uint256 public override lockedAmount;
    uint256 public maxDepositAmount = type(uint256).max;
    uint256 public maxHedgedDepositAmount = type(uint256).max;

    uint256 public unhedgedShare = 0;
    uint256 public hedgedShare = 0;
    uint256 public override unhedgedBalance = 0;
    uint256 public override hedgedBalance = 0;
    IHegicStaking public settlementFeeRecipient;
    address public hedgePool;

    Tranche[] public override tranches;
    mapping(uint256 => Option) public override options;
    IERC20 public override token;

    constructor(
        IERC20 _token,
        string memory name,
        string memory symbol,
        IOptionsManager manager,
        IPriceCalculator _pricer,
        IHegicStaking _settlementFeeRecipient,
        AggregatorV3Interface _priceProvider
    ) ERC721(name, symbol) {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        priceProvider = _priceProvider;
        settlementFeeRecipient = _settlementFeeRecipient;
        pricer = _pricer;
        token = _token;
        hedgePool = _msgSender();
        optionsManager = manager;
    }

    /**
     * @notice Used for setting the liquidity lock-up periods during which
     * the liquidity providers who deposited the funds into the pools contracts
     * won't be able to withdraw them. Note that different lock-ups could
     * be set for the hedged and unhedged — classic — liquidity tranches.
     * @param hedgedValue Hedged liquidity tranches lock-up in seconds
     * @param unhedgedValue Unhedged (classic) liquidity tranches lock-up in seconds
     **/
    function setLockupPeriod(uint256 hedgedValue, uint256 unhedgedValue)
        external
        override
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(
            hedgedValue <= 60 days,
            "The lockup period for hedged tranches is too long"
        );
        require(
            unhedgedValue <= 30 days,
            "The lockup period for unhedged tranches is too long"
        );
        lockupPeriodForHedgedTranches = hedgedValue;
        lockupPeriodForUnhedgedTranches = unhedgedValue;
    }

    /**
     * @notice Used for setting the total maximum amount
     * that could be deposited into the pools contracts.
     * Note that different total maximum amounts could be set
     * for the hedged and unhedged — classic — liquidity tranches.
     * @param total Maximum amount of assets in the pool
     * in hedged and unhedged (classic) liquidity tranches combined
     * @param hedged Maximum amount of assets in the pool
     * in hedged liquidity tranches only
     **/
    function setMaxDepositAmount(uint256 total, uint256 hedged)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(
            total >= hedged,
            "Pool Error: The total amount shouldn't be lower than the hedged amount"
        );
        maxDepositAmount = total;
        maxHedgedDepositAmount = hedged;
    }

    /**
     * @notice Used for setting the maximum share of the pool
     * size that could be utilized as a collateral in the options.
     *
     * Example: if `MaxUtilizationRate` = 50, then only 50%
     * of liquidity on the pools contracts would be used for
     * collateralizing options while 50% will be sitting idle
     * available for withdrawals by the liquidity providers.
     * @param value The utilization ratio in a range of 50% — 100%
     **/
    function setMaxUtilizationRate(uint256 value)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(
            50 <= value && value <= 100,
            "Pool error: Wrong utilization rate limitation value"
        );
        maxUtilizationRate = value;
    }

    /**
     * @notice Used for setting the collateralization ratio for the option
     * collateral size that will be locked at the moment of buying them.
     *
     * Example: if `CollateralizationRatio` = 50, then 50% of an option's
     * notional size will be locked in the pools at the moment of buying it:
     * say, 1 ETH call option will be collateralized with 0.5 ETH (50%).
     * Note that if an option holder's net P&L USD value (as options
     * are cash-settled) will exceed the amount of the collateral locked
     * in the option, she will receive the required amount at the moment
     * of exercising the option using the pool's unutilized (unlocked) funds.
     * @param value The collateralization ratio in a range of 30% — 100%
     **/
    function setCollateralizationRatio(uint256 value)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(
            30 <= value && value <= 100,
            "Pool Error: Wrong collateralization ratio value"
        );
        collateralizationRatio = value;
    }

    /**
     * @dev See EIP-165: ERC-165 Standard Interface Detection
     * https://eips.ethereum.org/EIPS/eip-165.
     **/
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC721, AccessControl, IERC165)
        returns (bool)
    {
        return
            interfaceId == type(IHegicPool).interfaceId ||
            AccessControl.supportsInterface(interfaceId) ||
            ERC721.supportsInterface(interfaceId);
    }

    /**
     * @notice Used for changing the hedging pool address
     * that will be accumulating the hedging premiums paid
     * as a share of the total premium redirected to this address.
     * @param value The address for receiving hedging premiums
     **/
    function setHedgePool(address value)
        external
        override
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(value != address(0));
        hedgePool = value;
    }

    /**
     * @notice Used for selling the options contracts
     * with the parameters chosen by the option buyer
     * such as the period of holding, option size (amount),
     * strike price and the premium to be paid for the option.
     * @param holder The option buyer address
     * @param period The option period
     * @param amount The option size
     * @param strike The option strike
     * @return id ID of ERC721 token linked to the option
     **/
    function sellOption(
        address holder,
        uint256 period,
        uint256 amount,
        uint256 strike
    ) external override returns (uint256 id) {
        if (strike == 0) strike = _currentPrice();
        uint256 balance = totalBalance();
        uint256 amountToBeLocked = _calculateLockedAmount(amount);

        require(period >= 1 days, "Pool Error: The period is too short");
        require(period <= 90 days, "Pool Error: The period is too long");
        require(
            (lockedAmount + amountToBeLocked) * 100 <=
                balance * maxUtilizationRate,
            "Pool Error: The amount is too large"
        );

        (uint256 settlementFee, uint256 premium) =
            _calculateTotalPremium(period, amount, strike);
        uint256 hedgedPremiumTotal = (premium * hedgedBalance) / balance;
        uint256 hedgeFee = (hedgedPremiumTotal * hedgeFeeRate) / 100;
        uint256 hedgePremium = hedgedPremiumTotal - hedgeFee;
        uint256 unhedgePremium = premium - hedgedPremiumTotal;

        lockedAmount += amountToBeLocked;
        id = optionsManager.createOptionFor(holder);
        options[id] = Option(
            OptionState.Active,
            strike,
            amount,
            amountToBeLocked,
            block.timestamp + period,
            hedgePremium,
            unhedgePremium
        );

        token.safeTransferFrom(
            _msgSender(),
            address(this),
            premium + settlementFee
        );
        token.safeTransfer(address(settlementFeeRecipient), settlementFee);
        settlementFeeRecipient.distributeUnrealizedRewards();
        if (hedgeFee > 0) token.safeTransfer(hedgePool, hedgeFee);
        emit Acquired(id, settlementFee, premium);
    }

    /**
     * @notice Used for setting the price calculator
     * contract that will be used for pricing the options.
     * @param pc A new price calculator contract address
     **/
    function setPriceCalculator(IPriceCalculator pc)
        public
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        pricer = pc;
    }

    /**
     * @notice Used for exercising the ITM (in-the-money)
     * options contracts in case of having the unrealized profits
     * accrued during the period of holding the option contract.
     * @param id ID of ERC721 token linked to the option
     **/
    function exercise(uint256 id) external override {
        Option storage option = options[id];
        uint256 profit = _profitOf(option);
        require(
            optionsManager.isApprovedOrOwner(_msgSender(), id),
            "Pool Error: msg.sender can't exercise this option"
        );
        require(
            option.expired > block.timestamp,
            "Pool Error: The option has already expired"
        );
        require(
            profit > 0,
            "Pool Error: There are no unrealized profits for this option"
        );
        _unlock(option);
        option.state = OptionState.Exercised;
        _send(optionsManager.ownerOf(id), profit);
        emit Exercised(id, profit);
    }

    function _send(address to, uint256 transferAmount) private {
        require(to != address(0));
        uint256 hedgeLoss = (transferAmount * hedgedBalance) / totalBalance();
        uint256 unhedgeLoss = transferAmount - hedgeLoss;
        hedgedBalance -= hedgeLoss;
        unhedgedBalance -= unhedgeLoss;
        token.safeTransfer(to, transferAmount);
    }

    /**
     * @notice Used for unlocking the expired OTM (out-of-the-money)
     * options contracts in case if there was no unrealized P&L
     * accrued during the period of holding a particular option.
     * Note that the `unlock` function releases the liquidity that
     * was locked in the option when it was active and the premiums
     * that are distributed pro rata among the liquidity providers.
     * @param id ID of ERC721 token linked to the option
     **/
    function unlock(uint256 id) external override {
        Option storage option = options[id];
        require(
            option.expired < block.timestamp,
            "Pool Error: The option has not expired yet"
        );
        _unlock(option);
        option.state = OptionState.Expired;
        emit Expired(id);
    }

    function _unlock(Option storage option) internal {
        require(
            option.state == OptionState.Active,
            "Pool Error: The option with such an ID has already been exercised or expired"
        );
        lockedAmount -= option.lockedAmount;
        hedgedBalance += option.hedgePremium;
        unhedgedBalance += option.unhedgePremium;
    }

    function _calculateLockedAmount(uint256 amount)
        internal
        virtual
        returns (uint256)
    {
        return (amount * collateralizationRatio) / 100;
    }

    /**
     * @notice Used for depositing the funds into the pool
     * and minting the liquidity tranche ERC721 token
     * which represents the liquidity provider's share
     * in the pool and her unrealized P&L for this tranche.
     * @param account The liquidity provider's address
     * @param amount The size of the liquidity tranche
     * @param hedged The type of the liquidity tranche
     * @param minShare The minimum share in the pool for the user
     **/
    function provideFrom(
        address account,
        uint256 amount,
        bool hedged,
        uint256 minShare
    ) external override nonReentrant returns (uint256 share) {
        uint256 totalShare = hedged ? hedgedShare : unhedgedShare;
        uint256 balance = hedged ? hedgedBalance : unhedgedBalance;
        share = totalShare > 0 && balance > 0
            ? (amount * totalShare) / balance
            : amount * INITIAL_RATE;
        uint256 limit =
            hedged
                ? maxHedgedDepositAmount - hedgedBalance
                : maxDepositAmount - hedgedBalance - unhedgedBalance;
        require(share >= minShare, "Pool Error: The mint limit is too large");
        require(share > 0, "Pool Error: The amount is too small");
        require(
            amount <= limit,
            "Pool Error: Depositing into the pool is not available"
        );

        if (hedged) {
            hedgedShare += share;
            hedgedBalance += amount;
        } else {
            unhedgedShare += share;
            unhedgedBalance += amount;
        }

        uint256 trancheID = tranches.length;
        tranches.push(
            Tranche(TrancheState.Open, share, amount, block.timestamp, hedged)
        );
        _safeMint(account, trancheID);
        token.safeTransferFrom(_msgSender(), address(this), amount);
    }

    /**
     * @notice Used for withdrawing the funds from the pool
     * plus the net positive P&L earned or
     * minus the net negative P&L lost on
     * providing liquidity and selling options.
     * @param trancheID The liquidity tranche ID
     * @return amount The amount received after the withdrawal
     **/
    function withdraw(uint256 trancheID)
        external
        override
        nonReentrant
        returns (uint256 amount)
    {
        address owner = ownerOf(trancheID);
        Tranche memory t = tranches[trancheID];
        amount = _withdraw(owner, trancheID);
        if (t.hedged && amount < t.amount) {
            token.safeTransferFrom(hedgePool, owner, t.amount - amount);
            amount = t.amount;
        }
        emit Withdrawn(owner, trancheID, amount);
    }

    /**
     * @notice Used for withdrawing the funds from the pool
     * by the hedged liquidity tranches providers
     * in case of an urgent need to withdraw the liquidity
     * without receiving the loss compensation from
     * the hedging pool: the net difference between
     * the amount deposited and the withdrawal amount.
     * @param trancheID ID of liquidity tranche
     * @return amount The amount received after the withdrawal
     **/
    function withdrawWithoutHedge(uint256 trancheID)
        external
        override
        nonReentrant
        returns (uint256 amount)
    {
        address owner = ownerOf(trancheID);
        amount = _withdraw(owner, trancheID);
        emit Withdrawn(owner, trancheID, amount);
    }

    function _withdraw(address owner, uint256 trancheID)
        internal
        returns (uint256 amount)
    {
        Tranche storage t = tranches[trancheID];
        uint256 lockupPeriod =
            t.hedged
                ? lockupPeriodForHedgedTranches
                : lockupPeriodForUnhedgedTranches;
        require(t.state == TrancheState.Open);
        require(_isApprovedOrOwner(_msgSender(), trancheID));
        require(
            block.timestamp > t.creationTimestamp + lockupPeriod,
            "Pool Error: The withdrawal is locked up"
        );

        t.state = TrancheState.Closed;
        if (t.hedged) {
            amount = (t.share * hedgedBalance) / hedgedShare;
            hedgedShare -= t.share;
            hedgedBalance -= amount;
        } else {
            amount = (t.share * unhedgedBalance) / unhedgedShare;
            unhedgedShare -= t.share;
            unhedgedBalance -= amount;
        }

        token.safeTransfer(owner, amount);
    }

    /**
     * @return balance Returns the amount of liquidity available for withdrawing
     **/
    function availableBalance() public view returns (uint256 balance) {
        return totalBalance() - lockedAmount;
    }

    /**
     * @return balance Returns the total balance of liquidity provided to the pool
     **/
    function totalBalance() public view override returns (uint256 balance) {
        return hedgedBalance + unhedgedBalance;
    }

    function _beforeTokenTransfer(
        address,
        address,
        uint256 id
    ) internal view override {
        require(
            tranches[id].state == TrancheState.Open,
            "Pool Error: The closed tranches can not be transferred"
        );
    }

    /**
     * @notice Returns the amount of unrealized P&L of the option
     * that could be received by the option holder in case
     * if she exercises it as an ITM (in-the-money) option.
     * @param id ID of ERC721 token linked to the option
     **/
    function profitOf(uint256 id) external view returns (uint256) {
        return _profitOf(options[id]);
    }

    function _profitOf(Option memory option)
        internal
        view
        virtual
        returns (uint256 amount);

    /**
     * @notice Used for calculating the `TotalPremium`
     * for the particular option with regards to
     * the parameters chosen by the option buyer
     * such as the period of holding, size (amount)
     * and strike price.
     * @param period The period of holding the option
     * @param period The size of the option
     **/
    function calculateTotalPremium(
        uint256 period,
        uint256 amount,
        uint256 strike
    ) external view override returns (uint256 settlementFee, uint256 premium) {
        return _calculateTotalPremium(period, amount, strike);
    }

    function _calculateTotalPremium(
        uint256 period,
        uint256 amount,
        uint256 strike
    ) internal view virtual returns (uint256 settlementFee, uint256 premium) {
        (settlementFee, premium) = pricer.calculateTotalPremium(
            period,
            amount,
            strike
        );
        require(
            settlementFee + premium > amount / 1000,
            "HegicPool: The option's price is too low"
        );
    }

    /**
     * @notice Used for changing the `settlementFeeRecipient`
     * contract address for distributing the settlement fees
     * (staking rewards) among the staking participants.
     * @param recipient New staking contract address
     **/
    function setSettlementFeeRecipient(IHegicStaking recipient)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(address(recipient) != address(0));
        settlementFeeRecipient = recipient;
    }

    function _currentPrice() internal view returns (uint256 price) {
        (, int256 latestPrice, , , ) = priceProvider.latestRoundData();
        price = uint256(latestPrice);
    }
}

File 24 of 40 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 25 of 40 : HegicPut.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "./HegicPool.sol";

/**
 * @author 0mllwntrmt3
 * @title Hegic Protocol V8888 Put Liquidity Pool Contract
 * @notice The Put Liquidity Pool Contract
 **/

contract HegicPUT is HegicPool {
    uint256 private immutable SpotDecimals; // 1e18
    uint256 private constant TokenDecimals = 1e6; // 1e6

    /**
     * @param name The pool contract name
     * @param symbol The pool ticker for the ERC721 options
     **/

    constructor(
        IERC20 _token,
        string memory name,
        string memory symbol,
        IOptionsManager manager,
        IPriceCalculator _pricer,
        IHegicStaking _settlementFeeRecipient,
        AggregatorV3Interface _priceProvider,
        uint8 spotDecimals
    )
        HegicPool(
            _token,
            name,
            symbol,
            manager,
            _pricer,
            _settlementFeeRecipient,
            _priceProvider
        )
    {
        SpotDecimals = 10**spotDecimals;
    }

    function _profitOf(Option memory option)
        internal
        view
        override
        returns (uint256 amount)
    {
        uint256 currentPrice = _currentPrice();
        if (currentPrice > option.strike) return 0;
        return
            ((option.strike - currentPrice) * option.amount * TokenDecimals) /
            SpotDecimals /
            1e8;
    }

    function _calculateLockedAmount(uint256 amount)
        internal
        view
        override
        returns (uint256)
    {
        return
            (amount *
                collateralizationRatio *
                _currentPrice() *
                TokenDecimals) /
            SpotDecimals /
            1e8 /
            100;
    }

    function _calculateTotalPremium(
        uint256 period,
        uint256 amount,
        uint256 strike
    ) internal view override returns (uint256 settlementFee, uint256 premium) {
        uint256 currentPrice = _currentPrice();
        (settlementFee, premium) = pricer.calculateTotalPremium(
            period,
            amount,
            strike
        );
        settlementFee =
            (settlementFee * currentPrice * TokenDecimals) /
            1e8 /
            SpotDecimals;
        premium = (premium * currentPrice * TokenDecimals) / 1e8 / SpotDecimals;
    }
}

File 26 of 40 : Facade.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "../Interfaces/Interfaces.sol";
import "../Interfaces/IOptionsManager.sol";

/**
 * @author 0mllwntrmt3
 * @title Hegic Protocol V8888 Facade Contract
 * @notice The contract that calculates the options prices,
 * conducts the process of buying options, converts the premiums
 * into the token that the pool is denominated in and grants
 * permissions to the contracts such as GSN (Gas Station Network).
 **/

contract Facade is Ownable {
    using SafeERC20 for IERC20;

    IWETH public immutable WETH;
    IUniswapV2Router01 public immutable exchange;
    IOptionsManager public immutable optionsManager;
    address public _trustedForwarder;

    constructor(
        IWETH weth,
        IUniswapV2Router01 router,
        IOptionsManager manager,
        address trustedForwarder
    ) {
        WETH = weth;
        exchange = router;
        _trustedForwarder = trustedForwarder;
        optionsManager = manager;
    }

    /**
     * @notice Used for calculating the option price (the premium) and using
     * the swap router (if needed) to convert the tokens with which the user
     * pays the premium into the token in which the pool is denominated.
     * @param period The option period
     * @param amount The option size
     * @param strike The option strike
     * @param total The total premium
     * @param baseTotal The part of the premium that
     * is distributed among the liquidity providers
     * @param settlementFee The part of the premium that
     * is distributed among the HEGIC staking participants
     **/
    function getOptionPrice(
        IHegicPool pool,
        uint256 period,
        uint256 amount,
        uint256 strike,
        address[] calldata swappath
    )
        public
        view
        returns (
            uint256 total,
            uint256 baseTotal,
            uint256 settlementFee,
            uint256 premium
        )
    {
        (uint256 _baseTotal, uint256 baseSettlementFee, uint256 basePremium) =
            getBaseOptionCost(pool, period, amount, strike);
        if (swappath.length > 1)
            total = exchange.getAmountsIn(_baseTotal, swappath)[0];
        else total = _baseTotal;

        baseTotal = _baseTotal;
        settlementFee = (total * baseSettlementFee) / baseTotal;
        premium = (total * basePremium) / baseTotal;
    }

    /**
     * @notice Used for calculating the option price (the premium)
     * in the token in which the pool is denominated.
     * @param period The option period
     * @param amount The option size
     * @param strike The option strike
     **/
    function getBaseOptionCost(
        IHegicPool pool,
        uint256 period,
        uint256 amount,
        uint256 strike
    )
        public
        view
        returns (
            uint256 total,
            uint256 settlementFee,
            uint256 premium
        )
    {
        (settlementFee, premium) = pool.calculateTotalPremium(
            period,
            amount,
            strike
        );
        total = premium + settlementFee;
    }

    /**
     * @notice Used for approving the pools contracts addresses.
     **/
    function poolApprove(IHegicPool pool) external {
        pool.token().safeApprove(address(pool), 0);
        pool.token().safeApprove(address(pool), type(uint256).max);
    }

    /**
     * @notice Used for buying the option contract and converting
     * the buyer's tokens (the total premium) into the token
     * in which the pool is denominated.
     * @param period The option period
     * @param amount The option size
     * @param strike The option strike
     * @param acceptablePrice The highest acceptable price
     **/
    function createOption(
        IHegicPool pool,
        uint256 period,
        uint256 amount,
        uint256 strike,
        address[] calldata swappath,
        uint256 acceptablePrice
    ) external payable {
        address buyer = _msgSender();
        (uint256 optionPrice, uint256 rawOptionPrice, , ) =
            getOptionPrice(pool, period, amount, strike, swappath);
        require(
            optionPrice <= acceptablePrice,
            "Facade Error: The option price is too high"
        );
        IERC20 paymentToken = IERC20(swappath[0]);
        paymentToken.safeTransferFrom(buyer, address(this), optionPrice);
        if (swappath.length > 1) {
            if (
                paymentToken.allowance(address(this), address(exchange)) <
                optionPrice
            ) {
                paymentToken.safeApprove(address(exchange), 0);
                paymentToken.safeApprove(address(exchange), type(uint256).max);
            }

            exchange.swapTokensForExactTokens(
                rawOptionPrice,
                optionPrice,
                swappath,
                address(this),
                block.timestamp
            );
        }
        pool.sellOption(buyer, period, amount, strike);
    }

    /**
     * @notice Used for converting the liquidity provider's Ether (ETH)
     * into Wrapped Ether (WETH) and providing the funds into the pool.
     * @param hedged The liquidity tranche type: hedged or unhedged (classic)
     **/
    function provideEthToPool(
        IHegicPool pool,
        bool hedged,
        uint256 minShare
    ) external payable returns (uint256) {
        WETH.deposit{value: msg.value}();
        if (WETH.allowance(address(this), address(pool)) < msg.value)
            WETH.approve(address(pool), type(uint256).max);
        return pool.provideFrom(msg.sender, msg.value, hedged, minShare);
    }

    /**
     * @notice Unlocks the array of options.
     * @param optionIDs The array of options
     **/
    function unlockAll(IHegicPool pool, uint256[] calldata optionIDs) external {
        uint256 arrayLength = optionIDs.length;
        for (uint256 i = 0; i < arrayLength; i++) {
            pool.unlock(optionIDs[i]);
        }
    }

    /**
     * @notice Used for granting the GSN (Gas Station Network) contract
     * the permission to pay the gas (transaction) fees for the users.
     * @param forwarder GSN (Gas Station Network) contract address
     **/
    function isTrustedForwarder(address forwarder) public view returns (bool) {
        return forwarder == _trustedForwarder;
    }

    function claimAllStakingProfits(
        IHegicStaking[] calldata stakings,
        address account
    ) external {
        uint256 arrayLength = stakings.length;
        for (uint256 i = 0; i < arrayLength; i++) {
            IHegicStaking s = stakings[i];
            if (s.profitOf(account) > 0) s.claimProfits(account);
        }
    }

    function _msgSender() internal view override returns (address signer) {
        signer = msg.sender;
        if (msg.data.length >= 20 && isTrustedForwarder(signer)) {
            assembly {
                signer := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        }
    }

    function exercise(uint256 optionId) external {
        require(
            optionsManager.isApprovedOrOwner(_msgSender(), optionId),
            "Facade Error: _msgSender is not eligible to exercise the option"
        );
        IHegicPool(optionsManager.tokenPool(optionId)).exercise(optionId);
    }
}

File 27 of 40 : HegicCall.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "./HegicPool.sol";

/**
 * @author 0mllwntrmt3
 * @title Hegic Protocol V8888 Call Liquidity Pool Contract
 * @notice The Call Liquidity Pool Contract
 **/
contract HegicCALL is HegicPool {
    /**
     * @param name The pool contract name
     * @param symbol The pool ticker for the ERC721 options
     **/
    constructor(
        IERC20 _token,
        string memory name,
        string memory symbol,
        IOptionsManager manager,
        IPriceCalculator _pricer,
        IHegicStaking _settlementFeeRecipient,
        AggregatorV3Interface _priceProvider
    )
        HegicPool(
            _token,
            name,
            symbol,
            manager,
            _pricer,
            _settlementFeeRecipient,
            _priceProvider
        )
    {}

    function _profitOf(Option memory option)
        internal
        view
        override
        returns (uint256 amount)
    {
        uint256 currentPrice = _currentPrice();
        if (currentPrice < option.strike) return 0;
        return ((currentPrice - option.strike) * option.amount) / currentPrice;
    }
}

File 28 of 40 : ERC20Mock.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract ERC20Mock is ERC20 {
    uint8 private immutable _decimals;

    constructor(
        string memory name,
        string memory symbol,
        uint8 __decimals
    ) ERC20("token", "symbol") {
        _decimals = __decimals;
    }

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

    function mintTo(address account, uint256 amount) public {
        _mint(account, amount);
    }

    function mint(uint256 amount) public {
        _mint(msg.sender, amount);
    }
}

File 29 of 40 : WETH.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "./ERC20Mock.sol";

contract WETHMock is ERC20Mock("WETH", "Wrapped Ether", 18) {
    function deposit() external payable {
        _mint(msg.sender, msg.value);
    }

    function withdraw(uint256 amount) external {
        _burn(msg.sender, amount);
        payable(msg.sender).transfer(amount);
    }
}

File 30 of 40 : UniswapRouterMock.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "./ERC20Mock.sol";
import "@chainlink/contracts/src/v0.7/interfaces/AggregatorV3Interface.sol";

contract UniswapRouterMock {
    ERC20Mock public immutable WBTC;
    ERC20Mock public immutable USDC;
    AggregatorV3Interface public immutable WBTCPriceProvider;
    AggregatorV3Interface public immutable ETHPriceProvider;

    constructor(
        ERC20Mock _wbtc,
        ERC20Mock _usdc,
        AggregatorV3Interface wpp,
        AggregatorV3Interface epp
    ) {
        WBTC = _wbtc;
        USDC = _usdc;
        WBTCPriceProvider = wpp;
        ETHPriceProvider = epp;
    }

    function swapETHForExactTokens(
        uint256 amountOut,
        address[] calldata path,
        address to,
        uint256 /*deadline*/
    ) external payable returns (uint256[] memory amounts) {
        require(path.length == 2, "UniswapMock: wrong path");
        require(
            path[1] == address(USDC) || path[1] == address(WBTC),
            "UniswapMock: too small value"
        );
        amounts = getAmountsIn(amountOut, path);
        require(msg.value >= amounts[0], "UniswapMock: too small value");
        if (msg.value > amounts[0])
            payable(msg.sender).transfer(msg.value - amounts[0]);
        ERC20Mock(path[1]).mintTo(to, amountOut);
    }

    function getAmountsIn(uint256 amountOut, address[] calldata path)
        public
        view
        returns (uint256[] memory amounts)
    {
        require(path.length == 2, "UniswapMock: wrong path");
        uint256 amount;
        if (path[1] == address(USDC)) {
            (, int256 ethPrice, , , ) = ETHPriceProvider.latestRoundData();
            amount = (amountOut * 1e8) / uint256(ethPrice);
        } else if (path[1] == address(WBTC)) {
            (, int256 ethPrice, , , ) = ETHPriceProvider.latestRoundData();
            (, int256 wbtcPrice, , , ) = WBTCPriceProvider.latestRoundData();
            amount = (amountOut * uint256(wbtcPrice)) / uint256(ethPrice);
        } else {
            revert("UniswapMock: wrong path");
        }
        amounts = new uint256[](2);
        amounts[0] = (amount * 103) / 100;
        amounts[1] = amountOut;
    }
}

File 31 of 40 : PriceCalculator.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

import "../Interfaces/Interfaces.sol";
import "../utils/Math.sol";

/**
 * @author 0mllwntrmt3
 * @title Hegic Protocol V8888 Price Calculator Contract
 * @notice The contract that calculates the options prices (the premiums)
 * that are adjusted through the `ImpliedVolRate` parameter.
 **/

contract PriceCalculator is IPriceCalculator, Ownable {
    using HegicMath for uint256;

    uint256 public impliedVolRate;
    uint256 internal constant PRICE_DECIMALS = 1e8;
    uint256 internal constant PRICE_MODIFIER_DECIMALS = 1e8;
    uint256 public utilizationRate = 0;
    AggregatorV3Interface public priceProvider;
    IHegicPool pool;

    constructor(
        uint256 initialRate,
        AggregatorV3Interface _priceProvider,
        IHegicPool _pool
    ) {
        pool = _pool;
        priceProvider = _priceProvider;
        impliedVolRate = initialRate;
    }

    /**
     * @notice Used for adjusting the options prices (the premiums)
     * while balancing the asset's implied volatility rate.
     * @param value New IVRate value
     **/
    function setImpliedVolRate(uint256 value) external onlyOwner {
        impliedVolRate = value;
    }

    /**
     * @notice Used for updating utilizationRate value
     * @param value New utilizationRate value
     **/
    function setUtilizationRate(uint256 value) external onlyOwner {
        utilizationRate = value;
    }

    /**
     * @notice Used for calculating the options prices
     * @param period The option period in seconds (1 days <= period <= 90 days)
     * @param amount The option size
     * @param strike The option strike
     * @return settlementFee The part of the premium that
     * is distributed among the HEGIC staking participants
     * @return premium The part of the premium that
     * is distributed among the liquidity providers
     **/
    function calculateTotalPremium(
        uint256 period,
        uint256 amount,
        uint256 strike
    ) public view override returns (uint256 settlementFee, uint256 premium) {
        uint256 currentPrice = _currentPrice();
        if (strike == 0) strike = currentPrice;
        require(
            strike == currentPrice,
            "Only ATM options are currently available"
        );
        uint256 total = _calculatePeriodFee(amount, period);
        settlementFee = total / 5;
        premium = total - settlementFee;
    }

    /**
     * @notice Calculates and prices in the time value of the option
     * @param amount Option size
     * @param period The option period in seconds (1 days <= period <= 90 days)
     * @return fee The premium size to be paid
     **/
    function _calculatePeriodFee(uint256 amount, uint256 period)
        internal
        view
        returns (uint256 fee)
    {
        return
            (amount * _priceModifier(amount, period, pool)) /
            PRICE_DECIMALS /
            PRICE_MODIFIER_DECIMALS;
    }

    /**
     * @notice Calculates `periodFee` of the option
     * @param amount The option size
     * @param period The option period in seconds (1 days <= period <= 90 days)
     **/
    function _priceModifier(
        uint256 amount,
        uint256 period,
        IHegicPool pool
    ) internal view returns (uint256 iv) {
        uint256 poolBalance = pool.totalBalance();
        require(poolBalance > 0, "Pool Error: The pool is empty");
        iv = impliedVolRate * period.sqrt();

        uint256 lockedAmount = pool.lockedAmount() + amount;
        uint256 utilization = (lockedAmount * 100e8) / poolBalance;

        if (utilization > 40e8) {
            iv += (iv * (utilization - 40e8) * utilizationRate) / 40e16;
        }
    }

    /**
     * @notice Used for requesting the current price of the asset
     * using the ChainLink data feeds contracts.
     * See https://feeds.chain.link/
     * @return price Price
     **/
    function _currentPrice() internal view returns (uint256 price) {
        (, int256 latestPrice, , , ) = priceProvider.latestRoundData();
        price = uint256(latestPrice);
    }
}

File 32 of 40 : Math.sol
pragma solidity 0.8.6;

/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2021 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/

library HegicMath {
    /**
     * @dev Calculates a square root of the number.
     * Responds with an "invalid opcode" at uint(-1).
     **/
    function sqrt(uint256 x) internal pure returns (uint256 result) {
        result = x;
        uint256 k = (x >> 1) + 1;
        while (k < result) (result, k) = (k, (x / k + k) >> 1);
    }
}

File 33 of 40 : IWETH.sol
pragma solidity >=0.5.0;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

File 34 of 40 : IERC20.sol
pragma solidity >=0.5.0;

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
}

File 35 of 40 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 36 of 40 : IUniswapV2Factory.sol
pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 37 of 40 : IUniswapV2Callee.sol
pragma solidity >=0.5.0;

interface IUniswapV2Callee {
    function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}

File 38 of 40 : IERC20.sol
pragma solidity >=0.5.0;

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
}

File 39 of 40 : IUniswapV2ERC20.sol
pragma solidity >=0.5.0;

interface IUniswapV2ERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}

File 40 of 40 : TransferHelper.sol
pragma solidity >=0.6.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address token, address from, address to, uint value) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"contract IOptionsManager","name":"manager","type":"address"},{"internalType":"contract IPriceCalculator","name":"_pricer","type":"address"},{"internalType":"contract IHegicStaking","name":"_settlementFeeRecipient","type":"address"},{"internalType":"contract AggregatorV3Interface","name":"_priceProvider","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settlementFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"premium","type":"uint256"}],"name":"Acquired","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"profit","type":"uint256"}],"name":"Exercised","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Expired","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"trancheID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"}],"name":"calculateTotalPremium","outputs":[{"internalType":"uint256","name":"settlementFee","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralizationRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exercise","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hedgeFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hedgePool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hedgedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hedgedShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockupPeriodForHedgedTranches","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockupPeriodForUnhedgedTranches","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxHedgedDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxUtilizationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"options","outputs":[{"internalType":"enum IHegicPool.OptionState","name":"state","type":"uint8"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"lockedAmount","type":"uint256"},{"internalType":"uint256","name":"expired","type":"uint256"},{"internalType":"uint256","name":"hedgePremium","type":"uint256"},{"internalType":"uint256","name":"unhedgePremium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"optionsManager","outputs":[{"internalType":"contract IOptionsManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceProvider","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pricer","outputs":[{"internalType":"contract IPriceCalculator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"profitOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"hedged","type":"bool"},{"internalType":"uint256","name":"minShare","type":"uint256"}],"name":"provideFrom","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"}],"name":"sellOption","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setCollateralizationRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"value","type":"address"}],"name":"setHedgePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"hedgedValue","type":"uint256"},{"internalType":"uint256","name":"unhedgedValue","type":"uint256"}],"name":"setLockupPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"hedged","type":"uint256"}],"name":"setMaxDepositAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setMaxUtilizationRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPriceCalculator","name":"pc","type":"address"}],"name":"setPriceCalculator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IHegicStaking","name":"recipient","type":"address"}],"name":"setSettlementFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settlementFeeRecipient","outputs":[{"internalType":"contract IHegicStaking","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tranches","outputs":[{"internalType":"enum IHegicPool.TrancheState","name":"state","type":"uint8"},{"internalType":"uint256","name":"share","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"creationTimestamp","type":"uint256"},{"internalType":"bool","name":"hedged","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unhedgedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unhedgedShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"trancheID","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"trancheID","type":"uint256"}],"name":"withdrawWithoutHedge","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

60c0604052624f1a0060095562278d00600a556050600b556050600c556032600d55600019600f5560001960105560006011556000601255600060135560006014553480156200004e57600080fd5b506040516200416338038062004163833981016040819052620000719162000369565b8686868686868685858160009080519060200190620000929291906200020c565b508051620000a89060019060208401906200020c565b5050600160075550620000bd60003362000158565b6001600160601b0319606082901b1660a052601580546001600160a01b038481166001600160a01b0319928316179092556008805486841690831617905560198054928a1692909116919091179055620001143390565b601680546001600160a01b0319166001600160a01b039290921691909117905550505060601b6001600160601b03191660805250620004ac98505050505050505050565b62000164828262000168565b5050565b60008281526006602090815260408083206001600160a01b038516845290915290205460ff16620001645760008281526006602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001c83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b8280546200021a9062000440565b90600052602060002090601f0160209004810192826200023e576000855562000289565b82601f106200025957805160ff191683800117855562000289565b8280016001018555821562000289579182015b82811115620002895782518255916020019190600101906200026c565b50620002979291506200029b565b5090565b5b808211156200029757600081556001016200029c565b600082601f830112620002c457600080fd5b81516001600160401b0380821115620002e157620002e16200047d565b604051601f8301601f19908116603f011681019082821181831017156200030c576200030c6200047d565b816040528381526020925086838588010111156200032957600080fd5b600091505b838210156200034d57858201830151818301840152908201906200032e565b838211156200035f5760008385830101525b9695505050505050565b600080600080600080600060e0888a0312156200038557600080fd5b8751620003928162000493565b60208901519097506001600160401b0380821115620003b057600080fd5b620003be8b838c01620002b2565b975060408a0151915080821115620003d557600080fd5b50620003e48a828b01620002b2565b9550506060880151620003f78162000493565b60808901519094506200040a8162000493565b60a08901519093506200041d8162000493565b60c0890151909250620004308162000493565b8091505092959891949750929550565b600181811c908216806200045557607f821691505b602082108114156200047757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114620004a957600080fd5b50565b60805160601c60a05160601c613c6f620004f46000396000818161071f0152612773015260008181610513015281816110ed01528181611bc40152611de00152613c6f6000f3fe608060405234801561001057600080fd5b50600436106103835760003560e01c8063762f3a16116101de578063b07f0a411161010f578063d07a1c57116100ad578063e5829d201161007c578063e5829d20146107c6578063e985e9c5146107d9578063fc0c546a14610815578063feed23421461082857600080fd5b8063d07a1c5714610779578063d547741f146107a1578063dcaf9c44146107b4578063dfcb48bd146107bd57600080fd5b8063b88d4fde116100e9578063b88d4fde14610741578063c87b56dd14610754578063ce8ff5a414610767578063cfffdefa1461077057600080fd5b8063b07f0a41146106f4578063b1e368cd14610707578063b888879e1461071a57600080fd5b80639cf0ea1d1161017c578063a22cb46511610156578063a22cb465146106be578063a6138ed9146106d1578063ab2f0e51146106e4578063ad7a672f146106ec57600080fd5b80639cf0ea1d1461069a5780639e252f08146106a3578063a217fddf146106b657600080fd5b8063911e3025116101b8578063911e30251461065957806391d148541461066c57806395d89b411461067f57806396350a851461068757600080fd5b8063762f3a16146106345780637632bffb1461063d5780638ed832711461065057600080fd5b806336568abe116102b857806352cf2a6b1161025657806363d1fac01161023057806363d1fac0146105fc5780636922d7b6146106055780636ab28bc81461061857806370a082311461062157600080fd5b806352cf2a6b146105c35780636198e339146105d65780636352211e146105e957600080fd5b8063409e220511610292578063409e22051461053557806342842e0e1461059757806349a1bd31146105aa5780634dbac733146105b357600080fd5b806336568abe146104f257806336bcbee614610505578063399735bf1461050e57600080fd5b806323b872dd116103255780632e1a7d4d116102ff5780632e1a7d4d146104a65780632f2ff15d146104b9578063330fd6d3146104cc578063331a4060146104df57600080fd5b806323b872dd1461044c578063248a9ca31461045f57806326c259621461048257600080fd5b8063095ea7b311610361578063095ea7b3146103f05780630af3f2261461040557806311b5602014610426578063181731dc1461043957600080fd5b806301ffc9a71461038857806306fdde03146103b0578063081812fc146103c5575b600080fd5b61039b6103963660046136dc565b610831565b60405190151581526020015b60405180910390f35b6103b861086b565b6040516103a79190613993565b6103d86103d336600461369e565b6108fd565b6040516001600160a01b0390911681526020016103a7565b6104036103fe3660046135d2565b610997565b005b61041861041336600461369e565b610aad565b6040519081526020016103a7565b61040361043436600461372f565b610b3f565b6015546103d8906001600160a01b031681565b61040361045a366004613483565b610bdc565b61041861046d36600461369e565b60009081526006602052604090206001015490565b61049561049036600461369e565b610c0d565b6040516103a795949392919061395c565b6104186104b436600461369e565b610c55565b6104036104c73660046136b7565b610dcc565b6104036104da36600461372f565b610df2565b6104186104ed366004613646565b610ee6565b6104036105003660046136b7565b611320565b61041860095481565b6103d87f000000000000000000000000000000000000000000000000000000000000000081565b61058461054336600461369e565b601860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015460ff9095169593949293919290919087565b6040516103a7979695949392919061391a565b6104036105a5366004613483565b61139e565b610418600a5481565b61041868056bc75e2d6310000081565b6104036105d136600461369e565b6113b9565b6104036105e436600461369e565b611445565b6103d86105f736600461369e565b6114fc565b610418600b5481565b610403610613366004613410565b611573565b610418600e5481565b61041861062f366004613410565b6115a2565b61041860105481565b61041861064b36600461369e565b611629565b610418600f5481565b6104186106673660046135fe565b6116b5565b61039b61067a3660046136b7565b611a10565b6103b8611a3b565b610403610695366004613410565b611a4a565b61041860145481565b6016546103d8906001600160a01b031681565b610418600081565b6104036106cc3660046135a4565b611a8c565b6008546103d8906001600160a01b031681565b610418611b51565b610418611b6d565b61040361070236600461369e565b611b7f565b610403610715366004613410565b611e9f565b6103d87f000000000000000000000000000000000000000000000000000000000000000081565b61040361074f3660046134c4565b611ee1565b6103b861076236600461369e565b611f19565b61041860115481565b61041860125481565b61078c610787366004613775565b612001565b604080519283526020830191909152016103a7565b6104036107af3660046136b7565b61201c565b610418600d5481565b610418600c5481565b6104036107d436600461369e565b612042565b61039b6107e736600461344a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6019546103d8906001600160a01b031681565b61041860135481565b60006001600160e01b0319821663131c0b0960e21b14806108565750610856826120ca565b806108655750610865826120eb565b92915050565b60606000805461087a90613b25565b80601f01602080910402602001604051908101604052809291908181526020018280546108a690613b25565b80156108f35780601f106108c8576101008083540402835291602001916108f3565b820191906000526020600020905b8154815290600101906020018083116108d657829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b031661097b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006109a2826114fc565b9050806001600160a01b0316836001600160a01b03161415610a105760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610972565b336001600160a01b0382161480610a2c5750610a2c81336107e7565b610a9e5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610972565b610aa8838361213b565b505050565b600060026007541415610ad25760405162461bcd60e51b815260040161097290613a49565b60026007556000610ae2836114fc565b9050610aee81846121a9565b915082816001600160a01b03167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc684604051610b2c91815260200190565b60405180910390a3506001600755919050565b6000610b4b8133612377565b81831015610bd05760405162461bcd60e51b815260206004820152604660248201527f506f6f6c204572726f723a2054686520746f74616c20616d6f756e742073686f60448201527f756c646e2774206265206c6f776572207468616e207468652068656467656420606482015265185b5bdd5b9d60d21b608482015260a401610972565b50600f91909155601055565b610be633826123db565b610c025760405162461bcd60e51b8152600401610972906139f8565b610aa88383836124d2565b60178181548110610c1d57600080fd5b60009182526020909120600590910201805460018201546002830154600384015460049094015460ff93841695509193909290911685565b600060026007541415610c7a5760405162461bcd60e51b815260040161097290613a49565b60026007556000610c8a836114fc565b9050600060178481548110610ca157610ca1613bd1565b600091825260209091206040805160a081019091526005909202018054829060ff166002811115610cd457610cd4613bbb565b6002811115610ce557610ce5613bbb565b815260018201546020820152600282015460408201526003820154606082015260049091015460ff1615156080909101529050610d2282856121a9565b925080608001518015610d385750806040015183105b15610d7c576016546040820151610d74916001600160a01b0316908490610d60908790613acb565b6019546001600160a01b031692919061267d565b806040015192505b83826001600160a01b03167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc685604051610db891815260200190565b60405180910390a350506001600755919050565b600082815260066020526040902060010154610de88133612377565b610aa883836126e8565b6000610dfe8133612377565b624f1a00831115610e6b5760405162461bcd60e51b815260206004820152603160248201527f546865206c6f636b757020706572696f6420666f7220686564676564207472616044820152706e6368657320697320746f6f206c6f6e6760781b6064820152608401610972565b62278d00821115610eda5760405162461bcd60e51b815260206004820152603360248201527f546865206c6f636b757020706572696f6420666f7220756e686564676564207460448201527272616e6368657320697320746f6f206c6f6e6760681b6064820152608401610972565b50600991909155600a55565b600081610ef857610ef561276e565b91505b6000610f02611b6d565b90506000610f0f8561280d565b905062015180861015610f705760405162461bcd60e51b815260206004820152602360248201527f506f6f6c204572726f723a2054686520706572696f6420697320746f6f2073686044820152621bdc9d60ea1b6064820152608401610972565b6276a700861115610fce5760405162461bcd60e51b815260206004820152602260248201527f506f6f6c204572726f723a2054686520706572696f6420697320746f6f206c6f6044820152616e6760f01b6064820152608401610972565b600c54610fdb9083613aac565b81600e54610fe99190613a80565b610ff4906064613aac565b111561104e5760405162461bcd60e51b815260206004820152602360248201527f506f6f6c204572726f723a2054686520616d6f756e7420697320746f6f206c6160448201526272676560e81b6064820152608401610972565b60008061105c888888612829565b91509150600084601454836110719190613aac565b61107b9190613a98565b905060006064600b548361108f9190613aac565b6110999190613a98565b905060006110a78284613acb565b905060006110b58486613acb565b905086600e60008282546110c99190613a80565b909155505060405163012c0d8160e71b81526001600160a01b038e811660048301527f00000000000000000000000000000000000000000000000000000000000000001690639606c08090602401602060405180830381600087803b15801561113157600080fd5b505af1158015611145573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111699190613716565b6040805160e0810190915290995080600181526020018b81526020018c81526020018881526020018d4261119d9190613a80565b81526020808201859052604091820184905260008c815260189091522081518154829060ff191660018360038111156111d8576111d8613bbb565b02179055506020820151600182015560408201516002820155606082015160038201556080820151600482015560a0820151600582015560c09091015160069091015561122a3330610d608989613a80565b601554601954611247916001600160a01b03918216911688612930565b601560009054906101000a90046001600160a01b03166001600160a01b031663da34364b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561129757600080fd5b505af11580156112ab573d6000803e3d6000fd5b5050505060008311156112d5576016546019546112d5916001600160a01b03918216911685612930565b60408051878152602081018790528a917ff5857d7b7b0e768564a581006734ebdf2b129d61875a3368bd9b0c84e226da75910160405180910390a25050505050505050949350505050565b6001600160a01b03811633146113905760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610972565b61139a8282612960565b5050565b610aa883838360405180602001604052806000815250611ee1565b60006113c58133612377565b816032111580156113d7575060648211155b61143f5760405162461bcd60e51b815260206004820152603360248201527f506f6f6c206572726f723a2057726f6e67207574696c697a6174696f6e2072616044820152727465206c696d69746174696f6e2076616c756560681b6064820152608401610972565b50600c55565b6000818152601860205260409020600481015442116114b95760405162461bcd60e51b815260206004820152602a60248201527f506f6f6c204572726f723a20546865206f7074696f6e20686173206e6f7420656044820152691e1c1a5c9959081e595d60b21b6064820152608401610972565b6114c2816129c7565b805460ff1916600317815560405182907ff80dbaea4785589e52984ca36a31de106adc77759539a5c7d92883bf49692fe990600090a25050565b6000818152600260205260408120546001600160a01b0316806108655760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610972565b600061157f8133612377565b50600880546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b03821661160d5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610972565b506001600160a01b031660009081526003602052604090205490565b600081815260186020526040808220815160e081019092528054610865929190829060ff16600381111561165f5761165f613bbb565b600381111561167057611670613bbb565b81526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050612abd565b6000600260075414156116da5760405162461bcd60e51b815260040161097290613a49565b60026007556000836116ee576011546116f2565b6012545b905060008461170357601354611707565b6014545b90506000821180156117195750600081115b6117355761173068056bc75e2d6310000087613aac565b61174a565b806117408388613aac565b61174a9190613a98565b925060008561177557601354601454600f546117669190613acb565b6117709190613acb565b611785565b6014546010546117859190613acb565b9050848410156117e75760405162461bcd60e51b815260206004820152602760248201527f506f6f6c204572726f723a20546865206d696e74206c696d697420697320746f6044820152666f206c6172676560c81b6064820152608401610972565b600084116118435760405162461bcd60e51b815260206004820152602360248201527f506f6f6c204572726f723a2054686520616d6f756e7420697320746f6f20736d604482015262185b1b60ea1b6064820152608401610972565b808711156118b15760405162461bcd60e51b815260206004820152603560248201527f506f6f6c204572726f723a204465706f736974696e6720696e746f2074686520604482015274706f6f6c206973206e6f7420617661696c61626c6560581b6064820152608401610972565b85156118ed5783601260008282546118c99190613a80565b9250508190555086601460008282546118e29190613a80565b9091555061191e9050565b83601160008282546118ff9190613a80565b9250508190555086601360008282546119189190613a80565b90915550505b601780546040805160a0810182526001808252602082018990529181018b9052426060820152891515608082015281830184556000939093528251600583027fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c150180549394939092839160ff19169083600281111561199f5761199f613bbb565b02179055506020820151600182015560408201516002820155606082015160038201556080909101516004909101805460ff19169115159190911790556119e68982612b09565b6119fe336019546001600160a01b031690308b61267d565b50506001600755509095945050505050565b60009182526006602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606001805461087a90613b25565b6000611a568133612377565b6001600160a01b038216611a6957600080fd5b50601580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038216331415611ae55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610972565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000600e54611b5e611b6d565b611b689190613acb565b905090565b6000601354601454611b689190613a80565b600081815260186020526040808220815160e081019092528054909291611bb8918490829060ff16600381111561165f5761165f613bbb565b90506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663430c2081336040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024810186905260440160206040518083038186803b158015611c3057600080fd5b505afa158015611c44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c689190613681565b611cce5760405162461bcd60e51b815260206004820152603160248201527f506f6f6c204572726f723a206d73672e73656e6465722063616e2774206578656044820152703931b4b9b2903a3434b99037b83a34b7b760791b6064820152608401610972565b42826004015411611d345760405162461bcd60e51b815260206004820152602a60248201527f506f6f6c204572726f723a20546865206f7074696f6e2068617320616c726561604482015269191e48195e1c1a5c995960b21b6064820152608401610972565b60008111611daa5760405162461bcd60e51b815260206004820152603b60248201527f506f6f6c204572726f723a20546865726520617265206e6f20756e7265616c6960448201527f7a65642070726f6669747320666f722074686973206f7074696f6e00000000006064820152608401610972565b611db3826129c7565b815460ff191660021782556040516331a9108f60e11b815260048101849052611e60906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690636352211e9060240160206040518083038186803b158015611e2257600080fd5b505afa158015611e36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5a919061342d565b82612b23565b827f0328c770810250ca303b85a612c9103929d1701abdf1dd1114607d139edfbed682604051611e9291815260200190565b60405180910390a2505050565b6000611eab8133612377565b6001600160a01b038216611ebe57600080fd5b50601680546001600160a01b0319166001600160a01b0392909216919091179055565b611eeb33836123db565b611f075760405162461bcd60e51b8152600401610972906139f8565b611f1384848484612bae565b50505050565b6000818152600260205260409020546060906001600160a01b0316611f985760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610972565b6000611faf60408051602081019091526000815290565b90506000815111611fcf5760405180602001604052806000815250611ffa565b80611fd984612be1565b604051602001611fea929190613839565b6040516020818303038152906040525b9392505050565b60008061200f858585612829565b915091505b935093915050565b6000828152600660205260409020600101546120388133612377565b610aa88383612960565b600061204e8133612377565b81601e11158015612060575060648211155b6120c45760405162461bcd60e51b815260206004820152602f60248201527f506f6f6c204572726f723a2057726f6e6720636f6c6c61746572616c697a617460448201526e696f6e20726174696f2076616c756560881b6064820152608401610972565b50600d55565b60006001600160e01b03198216637965db0b60e01b14806108655750610865825b60006001600160e01b031982166380ac58cd60e01b148061211c57506001600160e01b03198216635b5e139f60e01b145b8061086557506301ffc9a760e01b6001600160e01b0319831614610865565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612170826114fc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080601783815481106121bf576121bf613bd1565b60009182526020822060046005909202019081015490925060ff166121e657600a546121ea565b6009545b90506001825460ff16600281111561220457612204613bbb565b1461220e57600080fd5b61221833856123db565b61222157600080fd5b8082600301546122319190613a80565b421161228f5760405162461bcd60e51b815260206004820152602760248201527f506f6f6c204572726f723a20546865207769746864726177616c206973206c6f6044820152660636b65642075760cc1b6064820152608401610972565b815460ff19166002178255600482015460ff16156123025760125460145483600101546122bc9190613aac565b6122c69190613a98565b92508160010154601260008282546122de9190613acb565b9250508190555082601460008282546122f79190613acb565b909155506123589050565b60115460135483600101546123179190613aac565b6123219190613a98565b92508160010154601160008282546123399190613acb565b9250508190555082601360008282546123529190613acb565b90915550505b60195461236f906001600160a01b03168685612930565b505092915050565b6123818282611a10565b61139a57612399816001600160a01b03166014612cdf565b6123a4836020612cdf565b6040516020016123b5929190613868565b60408051601f198184030181529082905262461bcd60e51b825261097291600401613993565b6000818152600260205260408120546001600160a01b03166124545760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610972565b600061245f836114fc565b9050806001600160a01b0316846001600160a01b0316148061249a5750836001600160a01b031661248f846108fd565b6001600160a01b0316145b806124ca57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166124e5826114fc565b6001600160a01b03161461254d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610972565b6001600160a01b0382166125af5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610972565b6125ba838383612e7b565b6125c560008261213b565b6001600160a01b03831660009081526003602052604081208054600192906125ee908490613acb565b90915550506001600160a01b038216600090815260036020526040812080546001929061261c908490613a80565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611f139085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612f21565b6126f28282611a10565b61139a5760008281526006602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561272a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156127ca57600080fd5b505afa1580156127de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061280291906137a1565b509195945050505050565b60006064600d548361281f9190613aac565b6108659190613a98565b60085460405163d07a1c5760e01b815260048101859052602481018490526044810183905260009182916001600160a01b039091169063d07a1c5790606401604080518083038186803b15801561287f57600080fd5b505afa158015612893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b79190613751565b90925090506128c86103e885613a98565b6128d28284613a80565b116120145760405162461bcd60e51b815260206004820152602860248201527f4865676963506f6f6c3a20546865206f7074696f6e277320707269636520697360448201526720746f6f206c6f7760c01b6064820152608401610972565b6040516001600160a01b038316602482015260448101829052610aa890849063a9059cbb60e01b906064016126b1565b61296a8282611a10565b1561139a5760008281526006602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001815460ff1660038111156129df576129df613bbb565b14612a675760405162461bcd60e51b815260206004820152604c60248201527f506f6f6c204572726f723a20546865206f7074696f6e2077697468207375636860448201527f20616e2049442068617320616c7265616479206265656e20657865726369736560648201526b19081bdc88195e1c1a5c995960a21b608482015260a401610972565b8060030154600e6000828254612a7d9190613acb565b9091555050600581015460148054600090612a99908490613a80565b9091555050600681015460138054600090612ab5908490613a80565b909155505050565b600080612ac861276e565b90508260200151811015612adf5750600092915050565b808360400151846020015183612af59190613acb565b612aff9190613aac565b611ffa9190613a98565b61139a828260405180602001604052806000815250612ff3565b6001600160a01b038216612b3657600080fd5b6000612b40611b6d565b601454612b4d9084613aac565b612b579190613a98565b90506000612b658284613acb565b90508160146000828254612b799190613acb565b925050819055508060136000828254612b929190613acb565b9091555050601954611f13906001600160a01b03168585612930565b612bb98484846124d2565b612bc584848484613026565b611f135760405162461bcd60e51b8152600401610972906139a6565b606081612c055750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612c2f5780612c1981613b60565b9150612c289050600a83613a98565b9150612c09565b60008167ffffffffffffffff811115612c4a57612c4a613be7565b6040519080825280601f01601f191660200182016040528015612c74576020820181803683370190505b5090505b84156124ca57612c89600183613acb565b9150612c96600a86613b7b565b612ca1906030613a80565b60f81b818381518110612cb657612cb6613bd1565b60200101906001600160f81b031916908160001a905350612cd8600a86613a98565b9450612c78565b60606000612cee836002613aac565b612cf9906002613a80565b67ffffffffffffffff811115612d1157612d11613be7565b6040519080825280601f01601f191660200182016040528015612d3b576020820181803683370190505b509050600360fc1b81600081518110612d5657612d56613bd1565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612d8557612d85613bd1565b60200101906001600160f81b031916908160001a9053506000612da9846002613aac565b612db4906001613a80565b90505b6001811115612e2c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612de857612de8613bd1565b1a60f81b828281518110612dfe57612dfe613bd1565b60200101906001600160f81b031916908160001a90535060049490941c93612e2581613b0e565b9050612db7565b508315611ffa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610972565b600160178281548110612e9057612e90613bd1565b600091825260209091206005909102015460ff166002811115612eb557612eb5613bbb565b14610aa85760405162461bcd60e51b815260206004820152603660248201527f506f6f6c204572726f723a2054686520636c6f736564207472616e636865732060448201527518d85b881b9bdd081899481d1c985b9cd9995c9c995960521b6064820152608401610972565b6000612f76826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131339092919063ffffffff16565b805190915015610aa85780806020019051810190612f949190613681565b610aa85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610972565b612ffd8383613142565b61300a6000848484613026565b610aa85760405162461bcd60e51b8152600401610972906139a6565b60006001600160a01b0384163b1561312857604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061306a9033908990889088906004016138dd565b602060405180830381600087803b15801561308457600080fd5b505af19250505080156130b4575060408051601f3d908101601f191682019092526130b1918101906136f9565b60015b61310e573d8080156130e2576040519150601f19603f3d011682016040523d82523d6000602084013e6130e7565b606091505b5080516131065760405162461bcd60e51b8152600401610972906139a6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506124ca565b506001949350505050565b60606124ca8484600085613290565b6001600160a01b0382166131985760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610972565b6000818152600260205260409020546001600160a01b0316156131fd5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610972565b61320960008383612e7b565b6001600160a01b0382166000908152600360205260408120805460019290613232908490613a80565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060824710156132f15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610972565b843b61333f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610972565b600080866001600160a01b0316858760405161335b919061381d565b60006040518083038185875af1925050503d8060008114613398576040519150601f19603f3d011682016040523d82523d6000602084013e61339d565b606091505b50915091506133ad8282866133b8565b979650505050505050565b606083156133c7575081611ffa565b8251156133d75782518084602001fd5b8160405162461bcd60e51b81526004016109729190613993565b805169ffffffffffffffffffff8116811461340b57600080fd5b919050565b60006020828403121561342257600080fd5b8135611ffa81613bfd565b60006020828403121561343f57600080fd5b8151611ffa81613bfd565b6000806040838503121561345d57600080fd5b823561346881613bfd565b9150602083013561347881613bfd565b809150509250929050565b60008060006060848603121561349857600080fd5b83356134a381613bfd565b925060208401356134b381613bfd565b929592945050506040919091013590565b600080600080608085870312156134da57600080fd5b84356134e581613bfd565b935060208501356134f581613bfd565b925060408501359150606085013567ffffffffffffffff8082111561351957600080fd5b818701915087601f83011261352d57600080fd5b81358181111561353f5761353f613be7565b604051601f8201601f19908116603f0116810190838211818310171561356757613567613be7565b816040528281528a602084870101111561358057600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600080604083850312156135b757600080fd5b82356135c281613bfd565b9150602083013561347881613c15565b600080604083850312156135e557600080fd5b82356135f081613bfd565b946020939093013593505050565b6000806000806080858703121561361457600080fd5b843561361f81613bfd565b935060208501359250604085013561363681613c15565b9396929550929360600135925050565b6000806000806080858703121561365c57600080fd5b843561366781613bfd565b966020860135965060408601359560600135945092505050565b60006020828403121561369357600080fd5b8151611ffa81613c15565b6000602082840312156136b057600080fd5b5035919050565b600080604083850312156136ca57600080fd5b82359150602083013561347881613bfd565b6000602082840312156136ee57600080fd5b8135611ffa81613c23565b60006020828403121561370b57600080fd5b8151611ffa81613c23565b60006020828403121561372857600080fd5b5051919050565b6000806040838503121561374257600080fd5b50508035926020909101359150565b6000806040838503121561376457600080fd5b505080516020909101519092909150565b60008060006060848603121561378a57600080fd5b505081359360208301359350604090920135919050565b600080600080600060a086880312156137b957600080fd5b6137c2866133f1565b94506020860151935060408601519250606086015191506137e5608087016133f1565b90509295509295909350565b60008151808452613809816020860160208601613ae2565b601f01601f19169290920160200192915050565b6000825161382f818460208701613ae2565b9190910192915050565b6000835161384b818460208801613ae2565b83519083019061385f818360208801613ae2565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516138a0816017850160208801613ae2565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516138d1816028840160208801613ae2565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613910908301846137f1565b9695505050505050565b60e081016004891061392e5761392e613bbb565b978152602081019690965260408601949094526060850192909252608084015260a083015260c09091015290565b60a081016003871061397057613970613bbb565b958152602081019490945260408401929092526060830152151560809091015290565b602081526000611ffa60208301846137f1565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115613a9357613a93613b8f565b500190565b600082613aa757613aa7613ba5565b500490565b6000816000190483118215151615613ac657613ac6613b8f565b500290565b600082821015613add57613add613b8f565b500390565b60005b83811015613afd578181015183820152602001613ae5565b83811115611f135750506000910152565b600081613b1d57613b1d613b8f565b506000190190565b600181811c90821680613b3957607f821691505b60208210811415613b5a57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613b7457613b74613b8f565b5060010190565b600082613b8a57613b8a613ba5565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114613c1257600080fd5b50565b8015158114613c1257600080fd5b6001600160e01b031981168114613c1257600080fdfea2646970667358221220ae6728538a1c88c3d1c8f0b8d5f2c675fab700194c5baa0c3085508d3794500864736f6c63430008060033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000001ba4b447d0df64da64024e5ec47da94458c1e97f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c9ac1f2571748c4d02774b8d0fe5981ee4b897a20000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b841900000000000000000000000000000000000000000000000000000000000000184865676963204554482041544d2043616c6c7320506f6f6c0000000000000000000000000000000000000000000000000000000000000000000000000000000c45544843414c4c53504f4f4c0000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103835760003560e01c8063762f3a16116101de578063b07f0a411161010f578063d07a1c57116100ad578063e5829d201161007c578063e5829d20146107c6578063e985e9c5146107d9578063fc0c546a14610815578063feed23421461082857600080fd5b8063d07a1c5714610779578063d547741f146107a1578063dcaf9c44146107b4578063dfcb48bd146107bd57600080fd5b8063b88d4fde116100e9578063b88d4fde14610741578063c87b56dd14610754578063ce8ff5a414610767578063cfffdefa1461077057600080fd5b8063b07f0a41146106f4578063b1e368cd14610707578063b888879e1461071a57600080fd5b80639cf0ea1d1161017c578063a22cb46511610156578063a22cb465146106be578063a6138ed9146106d1578063ab2f0e51146106e4578063ad7a672f146106ec57600080fd5b80639cf0ea1d1461069a5780639e252f08146106a3578063a217fddf146106b657600080fd5b8063911e3025116101b8578063911e30251461065957806391d148541461066c57806395d89b411461067f57806396350a851461068757600080fd5b8063762f3a16146106345780637632bffb1461063d5780638ed832711461065057600080fd5b806336568abe116102b857806352cf2a6b1161025657806363d1fac01161023057806363d1fac0146105fc5780636922d7b6146106055780636ab28bc81461061857806370a082311461062157600080fd5b806352cf2a6b146105c35780636198e339146105d65780636352211e146105e957600080fd5b8063409e220511610292578063409e22051461053557806342842e0e1461059757806349a1bd31146105aa5780634dbac733146105b357600080fd5b806336568abe146104f257806336bcbee614610505578063399735bf1461050e57600080fd5b806323b872dd116103255780632e1a7d4d116102ff5780632e1a7d4d146104a65780632f2ff15d146104b9578063330fd6d3146104cc578063331a4060146104df57600080fd5b806323b872dd1461044c578063248a9ca31461045f57806326c259621461048257600080fd5b8063095ea7b311610361578063095ea7b3146103f05780630af3f2261461040557806311b5602014610426578063181731dc1461043957600080fd5b806301ffc9a71461038857806306fdde03146103b0578063081812fc146103c5575b600080fd5b61039b6103963660046136dc565b610831565b60405190151581526020015b60405180910390f35b6103b861086b565b6040516103a79190613993565b6103d86103d336600461369e565b6108fd565b6040516001600160a01b0390911681526020016103a7565b6104036103fe3660046135d2565b610997565b005b61041861041336600461369e565b610aad565b6040519081526020016103a7565b61040361043436600461372f565b610b3f565b6015546103d8906001600160a01b031681565b61040361045a366004613483565b610bdc565b61041861046d36600461369e565b60009081526006602052604090206001015490565b61049561049036600461369e565b610c0d565b6040516103a795949392919061395c565b6104186104b436600461369e565b610c55565b6104036104c73660046136b7565b610dcc565b6104036104da36600461372f565b610df2565b6104186104ed366004613646565b610ee6565b6104036105003660046136b7565b611320565b61041860095481565b6103d87f0000000000000000000000001ba4b447d0df64da64024e5ec47da94458c1e97f81565b61058461054336600461369e565b601860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015460ff9095169593949293919290919087565b6040516103a7979695949392919061391a565b6104036105a5366004613483565b61139e565b610418600a5481565b61041868056bc75e2d6310000081565b6104036105d136600461369e565b6113b9565b6104036105e436600461369e565b611445565b6103d86105f736600461369e565b6114fc565b610418600b5481565b610403610613366004613410565b611573565b610418600e5481565b61041861062f366004613410565b6115a2565b61041860105481565b61041861064b36600461369e565b611629565b610418600f5481565b6104186106673660046135fe565b6116b5565b61039b61067a3660046136b7565b611a10565b6103b8611a3b565b610403610695366004613410565b611a4a565b61041860145481565b6016546103d8906001600160a01b031681565b610418600081565b6104036106cc3660046135a4565b611a8c565b6008546103d8906001600160a01b031681565b610418611b51565b610418611b6d565b61040361070236600461369e565b611b7f565b610403610715366004613410565b611e9f565b6103d87f0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b841981565b61040361074f3660046134c4565b611ee1565b6103b861076236600461369e565b611f19565b61041860115481565b61041860125481565b61078c610787366004613775565b612001565b604080519283526020830191909152016103a7565b6104036107af3660046136b7565b61201c565b610418600d5481565b610418600c5481565b6104036107d436600461369e565b612042565b61039b6107e736600461344a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6019546103d8906001600160a01b031681565b61041860135481565b60006001600160e01b0319821663131c0b0960e21b14806108565750610856826120ca565b806108655750610865826120eb565b92915050565b60606000805461087a90613b25565b80601f01602080910402602001604051908101604052809291908181526020018280546108a690613b25565b80156108f35780601f106108c8576101008083540402835291602001916108f3565b820191906000526020600020905b8154815290600101906020018083116108d657829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b031661097b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006109a2826114fc565b9050806001600160a01b0316836001600160a01b03161415610a105760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610972565b336001600160a01b0382161480610a2c5750610a2c81336107e7565b610a9e5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610972565b610aa8838361213b565b505050565b600060026007541415610ad25760405162461bcd60e51b815260040161097290613a49565b60026007556000610ae2836114fc565b9050610aee81846121a9565b915082816001600160a01b03167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc684604051610b2c91815260200190565b60405180910390a3506001600755919050565b6000610b4b8133612377565b81831015610bd05760405162461bcd60e51b815260206004820152604660248201527f506f6f6c204572726f723a2054686520746f74616c20616d6f756e742073686f60448201527f756c646e2774206265206c6f776572207468616e207468652068656467656420606482015265185b5bdd5b9d60d21b608482015260a401610972565b50600f91909155601055565b610be633826123db565b610c025760405162461bcd60e51b8152600401610972906139f8565b610aa88383836124d2565b60178181548110610c1d57600080fd5b60009182526020909120600590910201805460018201546002830154600384015460049094015460ff93841695509193909290911685565b600060026007541415610c7a5760405162461bcd60e51b815260040161097290613a49565b60026007556000610c8a836114fc565b9050600060178481548110610ca157610ca1613bd1565b600091825260209091206040805160a081019091526005909202018054829060ff166002811115610cd457610cd4613bbb565b6002811115610ce557610ce5613bbb565b815260018201546020820152600282015460408201526003820154606082015260049091015460ff1615156080909101529050610d2282856121a9565b925080608001518015610d385750806040015183105b15610d7c576016546040820151610d74916001600160a01b0316908490610d60908790613acb565b6019546001600160a01b031692919061267d565b806040015192505b83826001600160a01b03167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc685604051610db891815260200190565b60405180910390a350506001600755919050565b600082815260066020526040902060010154610de88133612377565b610aa883836126e8565b6000610dfe8133612377565b624f1a00831115610e6b5760405162461bcd60e51b815260206004820152603160248201527f546865206c6f636b757020706572696f6420666f7220686564676564207472616044820152706e6368657320697320746f6f206c6f6e6760781b6064820152608401610972565b62278d00821115610eda5760405162461bcd60e51b815260206004820152603360248201527f546865206c6f636b757020706572696f6420666f7220756e686564676564207460448201527272616e6368657320697320746f6f206c6f6e6760681b6064820152608401610972565b50600991909155600a55565b600081610ef857610ef561276e565b91505b6000610f02611b6d565b90506000610f0f8561280d565b905062015180861015610f705760405162461bcd60e51b815260206004820152602360248201527f506f6f6c204572726f723a2054686520706572696f6420697320746f6f2073686044820152621bdc9d60ea1b6064820152608401610972565b6276a700861115610fce5760405162461bcd60e51b815260206004820152602260248201527f506f6f6c204572726f723a2054686520706572696f6420697320746f6f206c6f6044820152616e6760f01b6064820152608401610972565b600c54610fdb9083613aac565b81600e54610fe99190613a80565b610ff4906064613aac565b111561104e5760405162461bcd60e51b815260206004820152602360248201527f506f6f6c204572726f723a2054686520616d6f756e7420697320746f6f206c6160448201526272676560e81b6064820152608401610972565b60008061105c888888612829565b91509150600084601454836110719190613aac565b61107b9190613a98565b905060006064600b548361108f9190613aac565b6110999190613a98565b905060006110a78284613acb565b905060006110b58486613acb565b905086600e60008282546110c99190613a80565b909155505060405163012c0d8160e71b81526001600160a01b038e811660048301527f0000000000000000000000001ba4b447d0df64da64024e5ec47da94458c1e97f1690639606c08090602401602060405180830381600087803b15801561113157600080fd5b505af1158015611145573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111699190613716565b6040805160e0810190915290995080600181526020018b81526020018c81526020018881526020018d4261119d9190613a80565b81526020808201859052604091820184905260008c815260189091522081518154829060ff191660018360038111156111d8576111d8613bbb565b02179055506020820151600182015560408201516002820155606082015160038201556080820151600482015560a0820151600582015560c09091015160069091015561122a3330610d608989613a80565b601554601954611247916001600160a01b03918216911688612930565b601560009054906101000a90046001600160a01b03166001600160a01b031663da34364b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561129757600080fd5b505af11580156112ab573d6000803e3d6000fd5b5050505060008311156112d5576016546019546112d5916001600160a01b03918216911685612930565b60408051878152602081018790528a917ff5857d7b7b0e768564a581006734ebdf2b129d61875a3368bd9b0c84e226da75910160405180910390a25050505050505050949350505050565b6001600160a01b03811633146113905760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610972565b61139a8282612960565b5050565b610aa883838360405180602001604052806000815250611ee1565b60006113c58133612377565b816032111580156113d7575060648211155b61143f5760405162461bcd60e51b815260206004820152603360248201527f506f6f6c206572726f723a2057726f6e67207574696c697a6174696f6e2072616044820152727465206c696d69746174696f6e2076616c756560681b6064820152608401610972565b50600c55565b6000818152601860205260409020600481015442116114b95760405162461bcd60e51b815260206004820152602a60248201527f506f6f6c204572726f723a20546865206f7074696f6e20686173206e6f7420656044820152691e1c1a5c9959081e595d60b21b6064820152608401610972565b6114c2816129c7565b805460ff1916600317815560405182907ff80dbaea4785589e52984ca36a31de106adc77759539a5c7d92883bf49692fe990600090a25050565b6000818152600260205260408120546001600160a01b0316806108655760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610972565b600061157f8133612377565b50600880546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b03821661160d5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610972565b506001600160a01b031660009081526003602052604090205490565b600081815260186020526040808220815160e081019092528054610865929190829060ff16600381111561165f5761165f613bbb565b600381111561167057611670613bbb565b81526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050612abd565b6000600260075414156116da5760405162461bcd60e51b815260040161097290613a49565b60026007556000836116ee576011546116f2565b6012545b905060008461170357601354611707565b6014545b90506000821180156117195750600081115b6117355761173068056bc75e2d6310000087613aac565b61174a565b806117408388613aac565b61174a9190613a98565b925060008561177557601354601454600f546117669190613acb565b6117709190613acb565b611785565b6014546010546117859190613acb565b9050848410156117e75760405162461bcd60e51b815260206004820152602760248201527f506f6f6c204572726f723a20546865206d696e74206c696d697420697320746f6044820152666f206c6172676560c81b6064820152608401610972565b600084116118435760405162461bcd60e51b815260206004820152602360248201527f506f6f6c204572726f723a2054686520616d6f756e7420697320746f6f20736d604482015262185b1b60ea1b6064820152608401610972565b808711156118b15760405162461bcd60e51b815260206004820152603560248201527f506f6f6c204572726f723a204465706f736974696e6720696e746f2074686520604482015274706f6f6c206973206e6f7420617661696c61626c6560581b6064820152608401610972565b85156118ed5783601260008282546118c99190613a80565b9250508190555086601460008282546118e29190613a80565b9091555061191e9050565b83601160008282546118ff9190613a80565b9250508190555086601360008282546119189190613a80565b90915550505b601780546040805160a0810182526001808252602082018990529181018b9052426060820152891515608082015281830184556000939093528251600583027fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c150180549394939092839160ff19169083600281111561199f5761199f613bbb565b02179055506020820151600182015560408201516002820155606082015160038201556080909101516004909101805460ff19169115159190911790556119e68982612b09565b6119fe336019546001600160a01b031690308b61267d565b50506001600755509095945050505050565b60009182526006602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606001805461087a90613b25565b6000611a568133612377565b6001600160a01b038216611a6957600080fd5b50601580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038216331415611ae55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610972565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000600e54611b5e611b6d565b611b689190613acb565b905090565b6000601354601454611b689190613a80565b600081815260186020526040808220815160e081019092528054909291611bb8918490829060ff16600381111561165f5761165f613bbb565b90506001600160a01b037f0000000000000000000000001ba4b447d0df64da64024e5ec47da94458c1e97f1663430c2081336040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024810186905260440160206040518083038186803b158015611c3057600080fd5b505afa158015611c44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c689190613681565b611cce5760405162461bcd60e51b815260206004820152603160248201527f506f6f6c204572726f723a206d73672e73656e6465722063616e2774206578656044820152703931b4b9b2903a3434b99037b83a34b7b760791b6064820152608401610972565b42826004015411611d345760405162461bcd60e51b815260206004820152602a60248201527f506f6f6c204572726f723a20546865206f7074696f6e2068617320616c726561604482015269191e48195e1c1a5c995960b21b6064820152608401610972565b60008111611daa5760405162461bcd60e51b815260206004820152603b60248201527f506f6f6c204572726f723a20546865726520617265206e6f20756e7265616c6960448201527f7a65642070726f6669747320666f722074686973206f7074696f6e00000000006064820152608401610972565b611db3826129c7565b815460ff191660021782556040516331a9108f60e11b815260048101849052611e60906001600160a01b037f0000000000000000000000001ba4b447d0df64da64024e5ec47da94458c1e97f1690636352211e9060240160206040518083038186803b158015611e2257600080fd5b505afa158015611e36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5a919061342d565b82612b23565b827f0328c770810250ca303b85a612c9103929d1701abdf1dd1114607d139edfbed682604051611e9291815260200190565b60405180910390a2505050565b6000611eab8133612377565b6001600160a01b038216611ebe57600080fd5b50601680546001600160a01b0319166001600160a01b0392909216919091179055565b611eeb33836123db565b611f075760405162461bcd60e51b8152600401610972906139f8565b611f1384848484612bae565b50505050565b6000818152600260205260409020546060906001600160a01b0316611f985760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610972565b6000611faf60408051602081019091526000815290565b90506000815111611fcf5760405180602001604052806000815250611ffa565b80611fd984612be1565b604051602001611fea929190613839565b6040516020818303038152906040525b9392505050565b60008061200f858585612829565b915091505b935093915050565b6000828152600660205260409020600101546120388133612377565b610aa88383612960565b600061204e8133612377565b81601e11158015612060575060648211155b6120c45760405162461bcd60e51b815260206004820152602f60248201527f506f6f6c204572726f723a2057726f6e6720636f6c6c61746572616c697a617460448201526e696f6e20726174696f2076616c756560881b6064820152608401610972565b50600d55565b60006001600160e01b03198216637965db0b60e01b14806108655750610865825b60006001600160e01b031982166380ac58cd60e01b148061211c57506001600160e01b03198216635b5e139f60e01b145b8061086557506301ffc9a760e01b6001600160e01b0319831614610865565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612170826114fc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080601783815481106121bf576121bf613bd1565b60009182526020822060046005909202019081015490925060ff166121e657600a546121ea565b6009545b90506001825460ff16600281111561220457612204613bbb565b1461220e57600080fd5b61221833856123db565b61222157600080fd5b8082600301546122319190613a80565b421161228f5760405162461bcd60e51b815260206004820152602760248201527f506f6f6c204572726f723a20546865207769746864726177616c206973206c6f6044820152660636b65642075760cc1b6064820152608401610972565b815460ff19166002178255600482015460ff16156123025760125460145483600101546122bc9190613aac565b6122c69190613a98565b92508160010154601260008282546122de9190613acb565b9250508190555082601460008282546122f79190613acb565b909155506123589050565b60115460135483600101546123179190613aac565b6123219190613a98565b92508160010154601160008282546123399190613acb565b9250508190555082601360008282546123529190613acb565b90915550505b60195461236f906001600160a01b03168685612930565b505092915050565b6123818282611a10565b61139a57612399816001600160a01b03166014612cdf565b6123a4836020612cdf565b6040516020016123b5929190613868565b60408051601f198184030181529082905262461bcd60e51b825261097291600401613993565b6000818152600260205260408120546001600160a01b03166124545760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610972565b600061245f836114fc565b9050806001600160a01b0316846001600160a01b0316148061249a5750836001600160a01b031661248f846108fd565b6001600160a01b0316145b806124ca57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166124e5826114fc565b6001600160a01b03161461254d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610972565b6001600160a01b0382166125af5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610972565b6125ba838383612e7b565b6125c560008261213b565b6001600160a01b03831660009081526003602052604081208054600192906125ee908490613acb565b90915550506001600160a01b038216600090815260036020526040812080546001929061261c908490613a80565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611f139085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612f21565b6126f28282611a10565b61139a5760008281526006602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561272a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000807f0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b84196001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156127ca57600080fd5b505afa1580156127de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061280291906137a1565b509195945050505050565b60006064600d548361281f9190613aac565b6108659190613a98565b60085460405163d07a1c5760e01b815260048101859052602481018490526044810183905260009182916001600160a01b039091169063d07a1c5790606401604080518083038186803b15801561287f57600080fd5b505afa158015612893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b79190613751565b90925090506128c86103e885613a98565b6128d28284613a80565b116120145760405162461bcd60e51b815260206004820152602860248201527f4865676963506f6f6c3a20546865206f7074696f6e277320707269636520697360448201526720746f6f206c6f7760c01b6064820152608401610972565b6040516001600160a01b038316602482015260448101829052610aa890849063a9059cbb60e01b906064016126b1565b61296a8282611a10565b1561139a5760008281526006602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001815460ff1660038111156129df576129df613bbb565b14612a675760405162461bcd60e51b815260206004820152604c60248201527f506f6f6c204572726f723a20546865206f7074696f6e2077697468207375636860448201527f20616e2049442068617320616c7265616479206265656e20657865726369736560648201526b19081bdc88195e1c1a5c995960a21b608482015260a401610972565b8060030154600e6000828254612a7d9190613acb565b9091555050600581015460148054600090612a99908490613a80565b9091555050600681015460138054600090612ab5908490613a80565b909155505050565b600080612ac861276e565b90508260200151811015612adf5750600092915050565b808360400151846020015183612af59190613acb565b612aff9190613aac565b611ffa9190613a98565b61139a828260405180602001604052806000815250612ff3565b6001600160a01b038216612b3657600080fd5b6000612b40611b6d565b601454612b4d9084613aac565b612b579190613a98565b90506000612b658284613acb565b90508160146000828254612b799190613acb565b925050819055508060136000828254612b929190613acb565b9091555050601954611f13906001600160a01b03168585612930565b612bb98484846124d2565b612bc584848484613026565b611f135760405162461bcd60e51b8152600401610972906139a6565b606081612c055750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612c2f5780612c1981613b60565b9150612c289050600a83613a98565b9150612c09565b60008167ffffffffffffffff811115612c4a57612c4a613be7565b6040519080825280601f01601f191660200182016040528015612c74576020820181803683370190505b5090505b84156124ca57612c89600183613acb565b9150612c96600a86613b7b565b612ca1906030613a80565b60f81b818381518110612cb657612cb6613bd1565b60200101906001600160f81b031916908160001a905350612cd8600a86613a98565b9450612c78565b60606000612cee836002613aac565b612cf9906002613a80565b67ffffffffffffffff811115612d1157612d11613be7565b6040519080825280601f01601f191660200182016040528015612d3b576020820181803683370190505b509050600360fc1b81600081518110612d5657612d56613bd1565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612d8557612d85613bd1565b60200101906001600160f81b031916908160001a9053506000612da9846002613aac565b612db4906001613a80565b90505b6001811115612e2c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612de857612de8613bd1565b1a60f81b828281518110612dfe57612dfe613bd1565b60200101906001600160f81b031916908160001a90535060049490941c93612e2581613b0e565b9050612db7565b508315611ffa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610972565b600160178281548110612e9057612e90613bd1565b600091825260209091206005909102015460ff166002811115612eb557612eb5613bbb565b14610aa85760405162461bcd60e51b815260206004820152603660248201527f506f6f6c204572726f723a2054686520636c6f736564207472616e636865732060448201527518d85b881b9bdd081899481d1c985b9cd9995c9c995960521b6064820152608401610972565b6000612f76826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131339092919063ffffffff16565b805190915015610aa85780806020019051810190612f949190613681565b610aa85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610972565b612ffd8383613142565b61300a6000848484613026565b610aa85760405162461bcd60e51b8152600401610972906139a6565b60006001600160a01b0384163b1561312857604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061306a9033908990889088906004016138dd565b602060405180830381600087803b15801561308457600080fd5b505af19250505080156130b4575060408051601f3d908101601f191682019092526130b1918101906136f9565b60015b61310e573d8080156130e2576040519150601f19603f3d011682016040523d82523d6000602084013e6130e7565b606091505b5080516131065760405162461bcd60e51b8152600401610972906139a6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506124ca565b506001949350505050565b60606124ca8484600085613290565b6001600160a01b0382166131985760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610972565b6000818152600260205260409020546001600160a01b0316156131fd5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610972565b61320960008383612e7b565b6001600160a01b0382166000908152600360205260408120805460019290613232908490613a80565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060824710156132f15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610972565b843b61333f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610972565b600080866001600160a01b0316858760405161335b919061381d565b60006040518083038185875af1925050503d8060008114613398576040519150601f19603f3d011682016040523d82523d6000602084013e61339d565b606091505b50915091506133ad8282866133b8565b979650505050505050565b606083156133c7575081611ffa565b8251156133d75782518084602001fd5b8160405162461bcd60e51b81526004016109729190613993565b805169ffffffffffffffffffff8116811461340b57600080fd5b919050565b60006020828403121561342257600080fd5b8135611ffa81613bfd565b60006020828403121561343f57600080fd5b8151611ffa81613bfd565b6000806040838503121561345d57600080fd5b823561346881613bfd565b9150602083013561347881613bfd565b809150509250929050565b60008060006060848603121561349857600080fd5b83356134a381613bfd565b925060208401356134b381613bfd565b929592945050506040919091013590565b600080600080608085870312156134da57600080fd5b84356134e581613bfd565b935060208501356134f581613bfd565b925060408501359150606085013567ffffffffffffffff8082111561351957600080fd5b818701915087601f83011261352d57600080fd5b81358181111561353f5761353f613be7565b604051601f8201601f19908116603f0116810190838211818310171561356757613567613be7565b816040528281528a602084870101111561358057600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600080604083850312156135b757600080fd5b82356135c281613bfd565b9150602083013561347881613c15565b600080604083850312156135e557600080fd5b82356135f081613bfd565b946020939093013593505050565b6000806000806080858703121561361457600080fd5b843561361f81613bfd565b935060208501359250604085013561363681613c15565b9396929550929360600135925050565b6000806000806080858703121561365c57600080fd5b843561366781613bfd565b966020860135965060408601359560600135945092505050565b60006020828403121561369357600080fd5b8151611ffa81613c15565b6000602082840312156136b057600080fd5b5035919050565b600080604083850312156136ca57600080fd5b82359150602083013561347881613bfd565b6000602082840312156136ee57600080fd5b8135611ffa81613c23565b60006020828403121561370b57600080fd5b8151611ffa81613c23565b60006020828403121561372857600080fd5b5051919050565b6000806040838503121561374257600080fd5b50508035926020909101359150565b6000806040838503121561376457600080fd5b505080516020909101519092909150565b60008060006060848603121561378a57600080fd5b505081359360208301359350604090920135919050565b600080600080600060a086880312156137b957600080fd5b6137c2866133f1565b94506020860151935060408601519250606086015191506137e5608087016133f1565b90509295509295909350565b60008151808452613809816020860160208601613ae2565b601f01601f19169290920160200192915050565b6000825161382f818460208701613ae2565b9190910192915050565b6000835161384b818460208801613ae2565b83519083019061385f818360208801613ae2565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516138a0816017850160208801613ae2565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516138d1816028840160208801613ae2565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613910908301846137f1565b9695505050505050565b60e081016004891061392e5761392e613bbb565b978152602081019690965260408601949094526060850192909252608084015260a083015260c09091015290565b60a081016003871061397057613970613bbb565b958152602081019490945260408401929092526060830152151560809091015290565b602081526000611ffa60208301846137f1565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115613a9357613a93613b8f565b500190565b600082613aa757613aa7613ba5565b500490565b6000816000190483118215151615613ac657613ac6613b8f565b500290565b600082821015613add57613add613b8f565b500390565b60005b83811015613afd578181015183820152602001613ae5565b83811115611f135750506000910152565b600081613b1d57613b1d613b8f565b506000190190565b600181811c90821680613b3957607f821691505b60208210811415613b5a57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613b7457613b74613b8f565b5060010190565b600082613b8a57613b8a613ba5565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114613c1257600080fd5b50565b8015158114613c1257600080fd5b6001600160e01b031981168114613c1257600080fdfea2646970667358221220ae6728538a1c88c3d1c8f0b8d5f2c675fab700194c5baa0c3085508d3794500864736f6c63430008060033

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000001ba4b447d0df64da64024e5ec47da94458c1e97f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c9ac1f2571748c4d02774b8d0fe5981ee4b897a20000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b841900000000000000000000000000000000000000000000000000000000000000184865676963204554482041544d2043616c6c7320506f6f6c0000000000000000000000000000000000000000000000000000000000000000000000000000000c45544843414c4c53504f4f4c0000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _token (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [1] : name (string): Hegic ETH ATM Calls Pool
Arg [2] : symbol (string): ETHCALLSPOOL
Arg [3] : manager (address): 0x1BA4b447d0dF64DA64024e5Ec47dA94458C1e97f
Arg [4] : _pricer (address): 0x0000000000000000000000000000000000000000
Arg [5] : _settlementFeeRecipient (address): 0xc9aC1F2571748c4d02774b8d0fE5981ee4B897A2
Arg [6] : _priceProvider (address): 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419

-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [3] : 0000000000000000000000001ba4b447d0df64da64024e5ec47da94458c1e97f
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [5] : 000000000000000000000000c9ac1f2571748c4d02774b8d0fe5981ee4b897a2
Arg [6] : 0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000018
Arg [8] : 4865676963204554482041544d2043616c6c7320506f6f6c0000000000000000
Arg [9] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [10] : 45544843414c4c53504f4f4c0000000000000000000000000000000000000000


Deployed Bytecode Sourcemap

937:935:35:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7012:359:36;;;;;;:::i;:::-;;:::i;:::-;;;11337:14:40;;11330:22;11312:41;;11300:2;11285:18;7012:359:36;;;;;;;;2414:98:8;;;:::i;:::-;;;;;;;:::i;3925:217::-;;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;9976:32:40;;;9958:51;;9946:2;9931:18;3925:217:8;9913:102:40;3463:401:8;;;;;;:::i;:::-;;:::i;:::-;;16194:288:36;;;;;;:::i;:::-;;:::i;:::-;;;11510:25:40;;;11498:2;11483:18;16194:288:36;11465:76:40;4728:342:36;;;;;;:::i;:::-;;:::i;2461:43::-;;;;;-1:-1:-1;;;;;2461:43:36;;;4789:330:8;;;;;;:::i;:::-;;:::i;5447:121:1:-;;;;;;:::i;:::-;5513:7;5539:12;;;:6;:12;;;;;:22;;;;5447:121;2541:34:36;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;;;;:::i;15249:483::-;;;;;;:::i;:::-;;:::i;5818:145:1:-;;;;;;:::i;:::-;;:::i;3713:521:36:-;;;;;;:::i;:::-;;:::i;8298:1756::-;;;;;;:::i;:::-;;:::i;6835:214:1:-;;;;;;:::i;:::-;;:::i;1876:54:36:-;;;;;;1720:47;;;;;2581:50;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;5185:179:8:-;;;;;;:::i;:::-;;:::i;1936:56:36:-;;;;;;1671:43;;1710:4;1671:43;;5542:282;;;;;;:::i;:::-;;:::i;12212:324::-;;;;;;:::i;:::-;;:::i;2117:235:8:-;;;;;;:::i;:::-;;:::i;1998:32:36:-;;;;;;10246:133;;;;;;:::i;:::-;;:::i;2128:36::-;;;;;;1855:205:8;;;;;;:::i;:::-;;:::i;2227:57:36:-;;;;;;18468:108;;;;;;:::i;:::-;;:::i;2170:51::-;;;;;;13568:1353;;;;;;:::i;:::-;;:::i;4364:137:1:-;;;;;;:::i;:::-;;:::i;2576:102:8:-;;;:::i;20025:220:36:-;;;;;;:::i;:::-;;:::i;2414:41::-;;;;;;2510:24;;;;;-1:-1:-1;;;;;2510:24:36;;;2396:49:1;;2441:4;2396:49;;4209:290:8;;;;;;:::i;:::-;;:::i;1831:39:36:-;;;;;-1:-1:-1;;;;;1831:39:36;;;17576:119;;;:::i;17801:126::-;;;:::i;10648:715::-;;;;;;:::i;:::-;;:::i;7641:184::-;;;;;;:::i;:::-;;:::i;1773:52::-;;;;;5430:320:8;;;;;;:::i;:::-;;:::i;2744:329::-;;;;;;:::i;:::-;;:::i;2291:32:36:-;;;;;;2329:30;;;;;;19053:251;;;;;;:::i;:::-;;:::i;:::-;;;;30429:25:40;;;30485:2;30470:18;;30463:34;;;;30402:18;19053:251:36;30384:119:40;6197:147:1;;;;;;:::i;:::-;;:::i;2080:42:36:-;;;;;;2036:38;;;;;;6594:286;;;;;;:::i;:::-;;:::i;4565:162:8:-;;;;;;:::i;:::-;-1:-1:-1;;;;;4685:25:8;;;4662:4;4685:25;;;:18;:25;;;;;;;;:35;;;;;;;;;;;;;;;4565:162;2637:28:36;;;;;-1:-1:-1;;;;;2637:28:36;;;2365:43;;;;;;7012:359;7169:4;-1:-1:-1;;;;;;7208:43:36;;-1:-1:-1;;;7208:43:36;;:103;;;7267:44;7299:11;7267:31;:44::i;:::-;7208:156;;;;7327:37;7352:11;7327:24;:37::i;:::-;7189:175;7012:359;-1:-1:-1;;7012:359:36:o;2414:98:8:-;2468:13;2500:5;2493:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2414:98;:::o;3925:217::-;4001:7;7310:16;;;:7;:16;;;;;;-1:-1:-1;;;;;7310:16:8;4020:73;;;;-1:-1:-1;;;4020:73:8;;23328:2:40;4020:73:8;;;23310:21:40;23367:2;23347:18;;;23340:30;23406:34;23386:18;;;23379:62;-1:-1:-1;;;23457:18:40;;;23450:42;23509:19;;4020:73:8;;;;;;;;;-1:-1:-1;4111:24:8;;;;:15;:24;;;;;;-1:-1:-1;;;;;4111:24:8;;3925:217::o;3463:401::-;3543:13;3559:23;3574:7;3559:14;:23::i;:::-;3543:39;;3606:5;-1:-1:-1;;;;;3600:11:8;:2;-1:-1:-1;;;;;3600:11:8;;;3592:57;;;;-1:-1:-1;;;3592:57:8;;26187:2:40;3592:57:8;;;26169:21:40;26226:2;26206:18;;;26199:30;26265:34;26245:18;;;26238:62;-1:-1:-1;;;26316:18:40;;;26309:31;26357:19;;3592:57:8;26159:223:40;3592:57:8;665:10:13;-1:-1:-1;;;;;3681:21:8;;;;:62;;-1:-1:-1;3706:37:8;3723:5;665:10:13;4565:162:8;:::i;3706:37::-;3660:165;;;;-1:-1:-1;;;3660:165:8;;20880:2:40;3660:165:8;;;20862:21:40;20919:2;20899:18;;;20892:30;20958:34;20938:18;;;20931:62;21029:26;21009:18;;;21002:54;21073:19;;3660:165:8;20852:246:40;3660:165:8;3836:21;3845:2;3849:7;3836:8;:21::i;:::-;3533:331;3463:401;;:::o;16194:288:36:-;16315:14;1680:1:3;2259:7;;:19;;2251:63;;;;-1:-1:-1;;;2251:63:3;;;;;;;:::i;:::-;1680:1;2389:7;:18;16345:13:36::1;16361:18;16369:9:::0;16361:7:::1;:18::i;:::-;16345:34;;16398:27;16408:5;16415:9;16398;:27::i;:::-;16389:36;;16457:9;16450:5;-1:-1:-1::0;;;;;16440:35:36::1;;16468:6;16440:35;;;;11510:25:40::0;;11498:2;11483:18;;11465:76;16440:35:36::1;;;;;;;;-1:-1:-1::0;1637:1:3;2562:7;:22;16194:288:36;;-1:-1:-1;16194:288:36:o;4728:342::-;2441:4:1;3960:30;2441:4;665:10:13;3960::1;:30::i;:::-;4886:6:36::1;4877:5;:15;;4856:132;;;::::0;-1:-1:-1;;;4856:132:36;;28609:2:40;4856:132:36::1;::::0;::::1;28591:21:40::0;28648:2;28628:18;;;28621:30;28687:34;28667:18;;;28660:62;28758:34;28738:18;;;28731:62;-1:-1:-1;;;28809:19:40;;;28802:37;28856:19;;4856:132:36::1;28581:300:40::0;4856:132:36::1;-1:-1:-1::0;4998:16:36::1;:24:::0;;;;5032:22:::1;:31:::0;4728:342::o;4789:330:8:-;4978:41;665:10:13;5011:7:8;4978:18;:41::i;:::-;4970:103;;;;-1:-1:-1;;;4970:103:8;;;;;;;:::i;:::-;5084:28;5094:4;5100:2;5104:7;5084:9;:28::i;2541:34:36:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2541:34:36;;;;;;;;:::o;15249:483::-;15358:14;1680:1:3;2259:7;;:19;;2251:63;;;;-1:-1:-1;;;2251:63:3;;;;;;;:::i;:::-;1680:1;2389:7;:18;15388:13:36::1;15404:18;15412:9:::0;15404:7:::1;:18::i;:::-;15388:34;;15432:16;15451:8;15460:9;15451:19;;;;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;15432:38:::1;::::0;;::::1;::::0;::::1;::::0;;;15451:19:::1;::::0;;::::1;;15432:38:::0;;;;::::1;;;::::0;::::1;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;::::0;;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;;;;;::::1;::::0;::::1;::::0;;;;;::::1;::::0;;::::1;::::0;::::1;;;;::::0;;;;;;-1:-1:-1;15489:27:36::1;15499:5:::0;15506:9;15489::::1;:27::i;:::-;15480:36;;15530:1;:8;;;:29;;;;;15551:1;:8;;;15542:6;:17;15530:29;15526:150;;;15598:9;::::0;15616:8:::1;::::0;::::1;::::0;15575:59:::1;::::0;-1:-1:-1;;;;;15598:9:36::1;::::0;15609:5;;15616:17:::1;::::0;15627:6;;15616:17:::1;:::i;:::-;15575:5;::::0;-1:-1:-1;;;;;15575:5:36::1;::::0;:59;;:22:::1;:59::i;:::-;15657:1;:8;;;15648:17;;15526:150;15707:9;15700:5;-1:-1:-1::0;;;;;15690:35:36::1;;15718:6;15690:35;;;;11510:25:40::0;;11498:2;11483:18;;11465:76;15690:35:36::1;;;;;;;;-1:-1:-1::0;;1637:1:3;2562:7;:22;15249:483:36;;-1:-1:-1;15249:483:36:o;5818:145:1:-;5513:7;5539:12;;;:6;:12;;;;;:22;;;3960:30;3971:4;665:10:13;3960::1;:30::i;:::-;5931:25:::1;5942:4;5948:7;5931:10;:25::i;3713:521:36:-:0;2441:4:1;3960:30;2441:4;665:10:13;3960::1;:30::i;:::-;3903:7:36::1;3888:11;:22;;3867:118;;;::::0;-1:-1:-1;;;3867:118:36;;22910:2:40;3867:118:36::1;::::0;::::1;22892:21:40::0;22949:2;22929:18;;;22922:30;22988:34;22968:18;;;22961:62;-1:-1:-1;;;23039:18:40;;;23032:47;23096:19;;3867:118:36::1;22882:239:40::0;3867:118:36::1;4033:7;4016:13;:24;;3995:122;;;::::0;-1:-1:-1;;;3995:122:36;;26997:2:40;3995:122:36::1;::::0;::::1;26979:21:40::0;27036:2;27016:18;;;27009:30;27075:34;27055:18;;;27048:62;-1:-1:-1;;;27126:18:40;;;27119:49;27185:19;;3995:122:36::1;26969:241:40::0;3995:122:36::1;-1:-1:-1::0;4127:29:36::1;:43:::0;;;;4180:31:::1;:47:::0;3713:521::o;8298:1756::-;8447:10;8473:11;8469:41;;8495:15;:13;:15::i;:::-;8486:24;;8469:41;8520:15;8538:14;:12;:14::i;:::-;8520:32;;8562:24;8589:30;8612:6;8589:22;:30::i;:::-;8562:57;;8648:6;8638;:16;;8630:64;;;;-1:-1:-1;;;8630:64:36;;24145:2:40;8630:64:36;;;24127:21:40;24184:2;24164:18;;;24157:30;24223:34;24203:18;;;24196:62;-1:-1:-1;;;24274:18:40;;;24267:33;24317:19;;8630:64:36;24117:225:40;8630:64:36;8722:7;8712:6;:17;;8704:64;;;;-1:-1:-1;;;8704:64:36;;25375:2:40;8704:64:36;;;25357:21:40;25414:2;25394:18;;;25387:30;25453:34;25433:18;;;25426:62;-1:-1:-1;;;25504:18:40;;;25497:32;25546:19;;8704:64:36;25347:224:40;8704:64:36;8868:18;;8858:28;;:7;:28;:::i;:::-;8815:16;8800:12;;:31;;;;:::i;:::-;8799:39;;8835:3;8799:39;:::i;:::-;:87;;8778:169;;;;-1:-1:-1;;;8778:169:36;;20056:2:40;8778:169:36;;;20038:21:40;20095:2;20075:18;;;20068:30;20134:34;20114:18;;;20107:62;-1:-1:-1;;;20185:18:40;;;20178:33;20228:19;;8778:169:36;20028:225:40;8778:169:36;8959:21;8982:15;9013:46;9036:6;9044;9052;9013:22;:46::i;:::-;8958:101;;;;9069:26;9126:7;9109:13;;9099:7;:23;;;;:::i;:::-;9098:35;;;;:::i;:::-;9069:64;;9143:16;9200:3;9184:12;;9163:18;:33;;;;:::i;:::-;9162:41;;;;:::i;:::-;9143:60;-1:-1:-1;9213:20:36;9236:29;9143:60;9236:18;:29;:::i;:::-;9213:52;-1:-1:-1;9275:22:36;9300:28;9310:18;9300:7;:28;:::i;:::-;9275:53;;9355:16;9339:12;;:32;;;;;;;:::i;:::-;;;;-1:-1:-1;;9386:38:36;;-1:-1:-1;;;9386:38:36;;-1:-1:-1;;;;;9976:32:40;;;9386:38:36;;;9958:51:40;9386:14:36;:30;;;;9931:18:40;;9386:38:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;9448:210;;;;;;;;;9381:43;;-1:-1:-1;9448:210:36;9468:18;9448:210;;;;9500:6;9448:210;;;;9520:6;9448:210;;;;9540:16;9448:210;;;;9588:6;9570:15;:24;;;;:::i;:::-;9448:210;;;;;;;;;;;;;;;;-1:-1:-1;9434:11:36;;;:7;:11;;;;:224;;;;:11;;-1:-1:-1;;9434:224:36;;;;;;;;;;;:::i;:::-;;;;;-1:-1:-1;9434:224:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9669:122;665:10:13;9739:4:36;9758:23;9768:13;9758:7;:23;:::i;9669:122::-;9828:22;;9801:5;;:66;;-1:-1:-1;;;;;9801:5:36;;;;9828:22;9853:13;9801:18;:66::i;:::-;9877:22;;;;;;;;;-1:-1:-1;;;;;9877:22:36;-1:-1:-1;;;;;9877:50:36;;:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9954:1;9943:8;:12;9939:57;;;9976:9;;9957:5;;:39;;-1:-1:-1;;;;;9957:5:36;;;;9976:9;9987:8;9957:18;:39::i;:::-;10011:36;;;30429:25:40;;;30485:2;30470:18;;30463:34;;;10020:2:36;;10011:36;;30402:18:40;10011:36:36;;;;;;;8459:1595;;;;;;;;8298:1756;;;;;;:::o;6835:214:1:-;-1:-1:-1;;;;;6930:23:1;;665:10:13;6930:23:1;6922:83;;;;-1:-1:-1;;;6922:83:1;;29859:2:40;6922:83:1;;;29841:21:40;29898:2;29878:18;;;29871:30;29937:34;29917:18;;;29910:62;-1:-1:-1;;;29988:18:40;;;29981:45;30043:19;;6922:83:1;29831:237:40;6922:83:1;7016:26;7028:4;7034:7;7016:11;:26::i;:::-;6835:214;;:::o;5185:179:8:-;5318:39;5335:4;5341:2;5345:7;5318:39;;;;;;;;;;;;:16;:39::i;5542:282:36:-;2441:4:1;3960:30;2441:4;665:10:13;3960::1;:30::i;:::-;5683:5:36::1;5677:2;:11;;:27;;;;;5701:3;5692:5;:12;;5677:27;5656:125;;;::::0;-1:-1:-1;;;5656:125:36;;20460:2:40;5656:125:36::1;::::0;::::1;20442:21:40::0;20499:2;20479:18;;;20472:30;20538:34;20518:18;;;20511:62;-1:-1:-1;;;20589:18:40;;;20582:49;20648:19;;5656:125:36::1;20432:241:40::0;5656:125:36::1;-1:-1:-1::0;5791:18:36::1;:26:::0;5542:282::o;12212:324::-;12268:21;12292:11;;;:7;:11;;;;;12334:14;;;;12351:15;-1:-1:-1;12313:121:36;;;;-1:-1:-1;;;12313:121:36;;15126:2:40;12313:121:36;;;15108:21:40;15165:2;15145:18;;;15138:30;15204:34;15184:18;;;15177:62;-1:-1:-1;;;15255:18:40;;;15248:40;15305:19;;12313:121:36;15098:232:40;12313:121:36;12444:15;12452:6;12444:7;:15::i;:::-;12469:34;;-1:-1:-1;;12469:34:36;12484:19;12469:34;;;12518:11;;12526:2;;12518:11;;-1:-1:-1;;12518:11:36;12258:278;12212:324;:::o;2117:235:8:-;2189:7;2224:16;;;:7;:16;;;;;;-1:-1:-1;;;;;2224:16:8;2258:19;2250:73;;;;-1:-1:-1;;;2250:73:8;;21716:2:40;2250:73:8;;;21698:21:40;21755:2;21735:18;;;21728:30;21794:34;21774:18;;;21767:62;-1:-1:-1;;;21845:18:40;;;21838:39;21894:19;;2250:73:8;21688:231:40;10246:133:36;2441:4:1;3960:30;2441:4;665:10:13;3960::1;:30::i;:::-;-1:-1:-1;10361:6:36::1;:11:::0;;-1:-1:-1;;;;;;10361:11:36::1;-1:-1:-1::0;;;;;10361:11:36;;;::::1;::::0;;;::::1;::::0;;10246:133::o;1855:205:8:-;1927:7;-1:-1:-1;;;;;1954:19:8;;1946:74;;;;-1:-1:-1;;;1946:74:8;;21305:2:40;1946:74:8;;;21287:21:40;21344:2;21324:18;;;21317:30;21383:34;21363:18;;;21356:62;-1:-1:-1;;;21434:18:40;;;21427:40;21484:19;;1946:74:8;21277:232:40;1946:74:8;-1:-1:-1;;;;;;2037:16:8;;;;;:9;:16;;;;;;;1855:205::o;18468:108:36:-;18521:7;18557:11;;;:7;:11;;;;;;18547:22;;;;;;;;;;;;;18557:11;18547:22;;;;;;;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:9;:22::i;13568:1353::-;13731:13;1680:1:3;2259:7;;:19;;2251:63;;;;-1:-1:-1;;;2251:63:3;;;;;;;:::i;:::-;1680:1;2389:7;:18;13756::36::1;13777:6:::0;:36:::1;;13800:13;;13777:36;;;13786:11;;13777:36;13756:57;;13823:15;13841:6;:40;;13866:15;;13841:40;;;13850:13;;13841:40;13823:58;;13912:1;13899:10;:14;:29;;;;;13927:1;13917:7;:11;13899:29;:111;;13989:21;1710:4;13989:6:::0;:21:::1;:::i;:::-;13899:111;;;13967:7:::0;13944:19:::1;13953:10:::0;13944:6;:19:::1;:::i;:::-;13943:31;;;;:::i;:::-;13891:119;;14020:13;14048:6;:132;;14165:15;;14149:13;;14130:16;;:32;;;;:::i;:::-;:50;;;;:::i;:::-;14048:132;;;14098:13;;14073:22;;:38;;;;:::i;:::-;14020:160;;14207:8;14198:5;:17;;14190:69;;;::::0;-1:-1:-1;;;14190:69:36;;26589:2:40;14190:69:36::1;::::0;::::1;26571:21:40::0;26628:2;26608:18;;;26601:30;26667:34;26647:18;;;26640:62;-1:-1:-1;;;26718:18:40;;;26711:37;26765:19;;14190:69:36::1;26561:229:40::0;14190:69:36::1;14285:1;14277:5;:9;14269:57;;;::::0;-1:-1:-1;;;14269:57:36;;23741:2:40;14269:57:36::1;::::0;::::1;23723:21:40::0;23780:2;23760:18;;;23753:30;23819:34;23799:18;;;23792:62;-1:-1:-1;;;23870:18:40;;;23863:33;23913:19;;14269:57:36::1;23713:225:40::0;14269:57:36::1;14367:5;14357:6;:15;;14336:115;;;::::0;-1:-1:-1;;;14336:115:36;;17159:2:40;14336:115:36::1;::::0;::::1;17141:21:40::0;17198:2;17178:18;;;17171:30;17237:34;17217:18;;;17210:62;-1:-1:-1;;;17288:18:40;;;17281:51;17349:19;;14336:115:36::1;17131:243:40::0;14336:115:36::1;14466:6;14462:186;;;14503:5;14488:11;;:20;;;;;;;:::i;:::-;;;;;;;;14539:6;14522:13;;:23;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;14462:186:36::1;::::0;-1:-1:-1;14462:186:36::1;;14593:5;14576:13;;:22;;;;;;;:::i;:::-;;;;;;;;14631:6;14612:15;;:25;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;;14462:186:36::1;14678:8;:15:::0;;14730:66:::1;::::0;;::::1;::::0;::::1;::::0;;14738:17:::1;14730:66:::0;;;::::1;::::0;::::1;::::0;;;;;;;;;14772:15:::1;14730:66:::0;;;;;::::1;;::::0;;;;14703:103;;::::1;::::0;;-1:-1:-1;14703:103:36;;;;;;::::1;::::0;::::1;::::0;::::1;::::0;;14678:15;;14730:66;14703:103;;;;-1:-1:-1;;14703:103:36::1;::::0;;::::1;::::0;::::1;;;;;;:::i;:::-;;;::::0;;-1:-1:-1;14703:103:36::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;;::::1;::::0;::::1;::::0;;::::1;::::0;;-1:-1:-1;;14703:103:36::1;::::0;::::1;;::::0;;;::::1;::::0;;14816:29:::1;14826:7:::0;14835:9;14816::::1;:29::i;:::-;14855:59;665:10:13::0;14855:5:36::1;::::0;-1:-1:-1;;;;;14855:5:36::1;::::0;14900:4:::1;14907:6:::0;14855:22:::1;:59::i;:::-;-1:-1:-1::0;;1637:1:3;2562:7;:22;-1:-1:-1;13568:1353:36;;;-1:-1:-1;;;;;13568:1353:36:o;4364:137:1:-;4442:4;4465:12;;;:6;:12;;;;;;;;-1:-1:-1;;;;;4465:29:1;;;;;;;;;;;;;;;4364:137::o;2576:102:8:-;2632:13;2664:7;2657:14;;;;;:::i;20025:220:36:-;2441:4:1;3960:30;2441:4;665:10:13;3960::1;:30::i;:::-;-1:-1:-1;;;;;20161:32:36;::::1;20153:41;;;::::0;::::1;;-1:-1:-1::0;20204:22:36::1;:34:::0;;-1:-1:-1;;;;;;20204:34:36::1;-1:-1:-1::0;;;;;20204:34:36;;;::::1;::::0;;;::::1;::::0;;20025:220::o;4209:290:8:-;-1:-1:-1;;;;;4311:24:8;;665:10:13;4311:24:8;;4303:62;;;;-1:-1:-1;;;4303:62:8;;17986:2:40;4303:62:8;;;17968:21:40;18025:2;18005:18;;;17998:30;18064:27;18044:18;;;18037:55;18109:18;;4303:62:8;17958:175:40;4303:62:8;665:10:13;4376:32:8;;;;:18;:32;;;;;;;;-1:-1:-1;;;;;4376:42:8;;;;;;;;;;;;:53;;-1:-1:-1;;4376:53:8;;;;;;;;;;4444:48;;11312:41:40;;;4376:42:8;;665:10:13;4444:48:8;;11285:18:40;4444:48:8;;;;;;;4209:290;;:::o;17576:119:36:-;17625:15;17676:12;;17659:14;:12;:14::i;:::-;:29;;;;:::i;:::-;17652:36;;17576:119;:::o;17801:126::-;17855:15;17905;;17889:13;;:31;;;;:::i;10648:715::-;10706:21;10730:11;;;:7;:11;;;;;;10768:17;;;;;;;;;;10730:11;;10706:21;10768:17;;10730:11;;10768:17;;;;;;;;;;;;:::i;:::-;10751:34;-1:-1:-1;;;;;;10816:14:36;:32;;665:10:13;10816:50:36;;-1:-1:-1;;;;;;10816:50:36;;;;;;;-1:-1:-1;;;;;11085:32:40;;;10816:50:36;;;11067:51:40;11134:18;;;11127:34;;;11040:18;;10816:50:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;10795:146;;;;-1:-1:-1;;;10795:146:36;;15537:2:40;10795:146:36;;;15519:21:40;15576:2;15556:18;;;15549:30;15615:34;15595:18;;;15588:62;-1:-1:-1;;;15666:18:40;;;15659:47;15723:19;;10795:146:36;15509:239:40;10795:146:36;10989:15;10972:6;:14;;;:32;10951:121;;;;-1:-1:-1;;;10951:121:36;;18340:2:40;10951:121:36;;;18322:21:40;18379:2;18359:18;;;18352:30;18418:34;18398:18;;;18391:62;-1:-1:-1;;;18469:18:40;;;18462:40;18519:19;;10951:121:36;18312:232:40;10951:121:36;11112:1;11103:6;:10;11082:116;;;;-1:-1:-1;;;11082:116:36;;16731:2:40;11082:116:36;;;16713:21:40;16770:2;16750:18;;;16743:30;16809:34;16789:18;;;16782:62;16880:29;16860:18;;;16853:57;16927:19;;11082:116:36;16703:249:40;11082:116:36;11208:15;11216:6;11208:7;:15::i;:::-;11233:36;;-1:-1:-1;;11233:36:36;11248:21;11233:36;;;11285:26;;-1:-1:-1;;;11285:26:36;;;;;11510:25:40;;;11279:41:36;;-1:-1:-1;;;;;11285:14:36;:22;;;;11483:18:40;;11285:26:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;11313:6;11279:5;:41::i;:::-;11345:2;11335:21;11349:6;11335:21;;;;11510:25:40;;11498:2;11483:18;;11465:76;11335:21:36;;;;;;;;10696:667;;10648:715;:::o;7641:184::-;2441:4:1;3960:30;2441:4;665:10:13;3960::1;:30::i;:::-;-1:-1:-1;;;;;7771:19:36;::::1;7763:28;;;::::0;::::1;;-1:-1:-1::0;7801:9:36::1;:17:::0;;-1:-1:-1;;;;;;7801:17:36::1;-1:-1:-1::0;;;;;7801:17:36;;;::::1;::::0;;;::::1;::::0;;7641:184::o;5430:320:8:-;5599:41;665:10:13;5632:7:8;5599:18;:41::i;:::-;5591:103;;;;-1:-1:-1;;;5591:103:8;;;;;;;:::i;:::-;5704:39;5718:4;5724:2;5728:7;5737:5;5704:13;:39::i;:::-;5430:320;;;;:::o;2744:329::-;7287:4;7310:16;;;:7;:16;;;;;;2817:13;;-1:-1:-1;;;;;7310:16:8;2842:76;;;;-1:-1:-1;;;2842:76:8;;24959:2:40;2842:76:8;;;24941:21:40;24998:2;24978:18;;;24971:30;25037:34;25017:18;;;25010:62;-1:-1:-1;;;25088:18:40;;;25081:45;25143:19;;2842:76:8;24931:237:40;2842:76:8;2929:21;2953:10;3390:9;;;;;;;;;-1:-1:-1;3390:9:8;;;3314:92;2953:10;2929:34;;3004:1;2986:7;2980:21;:25;:86;;;;;;;;;;;;;;;;;3032:7;3041:18;:7;:16;:18::i;:::-;3015:45;;;;;;;;;:::i;:::-;;;;;;;;;;;;;2980:86;2973:93;2744:329;-1:-1:-1;;;2744:329:8:o;19053:251:36:-;19194:21;19217:15;19251:46;19274:6;19282;19290;19251:22;:46::i;:::-;19244:53;;;;19053:251;;;;;;;:::o;6197:147:1:-;5513:7;5539:12;;;:6;:12;;;;;:22;;;3960:30;3971:4;665:10:13;3960::1;:30::i;:::-;6311:26:::1;6323:4;6329:7;6311:11;:26::i;6594:286:36:-:0;2441:4:1;3960:30;2441:4;665:10:13;3960::1;:30::i;:::-;6739:5:36::1;6733:2;:11;;:27;;;;;6757:3;6748:5;:12;;6733:27;6712:121;;;::::0;-1:-1:-1;;;6712:121:36;;28193:2:40;6712:121:36::1;::::0;::::1;28175:21:40::0;28232:2;28212:18;;;28205:30;28271:34;28251:18;;;28244:62;-1:-1:-1;;;28322:18:40;;;28315:45;28377:19;;6712:121:36::1;28165:237:40::0;6712:121:36::1;-1:-1:-1::0;6843:22:36::1;:30:::0;6594:286::o;4075:202:1:-;4160:4;-1:-1:-1;;;;;;4183:47:1;;-1:-1:-1;;;4183:47:1;;:87;;;4234:36;4258:11;1496:300:8;1598:4;-1:-1:-1;;;;;;1633:40:8;;-1:-1:-1;;;1633:40:8;;:104;;-1:-1:-1;;;;;;;1689:48:8;;-1:-1:-1;;;1689:48:8;1633:104;:156;;;-1:-1:-1;;;;;;;;;;871:40:15;;;1753:36:8;763:155:15;11073:171:8;11147:24;;;;:15;:24;;;;;:29;;-1:-1:-1;;;;;;11147:29:8;-1:-1:-1;;;;;11147:29:8;;;;;;;;:24;;11200:23;11147:24;11200:14;:23::i;:::-;-1:-1:-1;;;;;11191:46:8;;;;;;;;;;;11073:171;;:::o;16488:984:36:-;16575:14;16605:17;16625:8;16634:9;16625:19;;;;;;;;:::i;:::-;;;;;;;;16689:8;16625:19;;;;;16689:8;;;;16625:19;;-1:-1:-1;16689:8:36;;:106;;16764:31;;16689:106;;;16716:29;;16689:106;16654:141;-1:-1:-1;16824:17:36;16813:7;;;;:28;;;;;;;;:::i;:::-;;16805:37;;;;;;16860:43;665:10:13;16893:9:36;16860:18;:43::i;:::-;16852:52;;;;;;16975:12;16953:1;:19;;;:34;;;;:::i;:::-;16935:15;:52;16914:138;;;;-1:-1:-1;;;16914:138:36;;14718:2:40;16914:138:36;;;14700:21:40;14757:2;14737:18;;;14730:30;14796:34;14776:18;;;14769:62;-1:-1:-1;;;14847:18:40;;;14840:37;14894:19;;16914:138:36;14690:229:40;16914:138:36;17063:29;;-1:-1:-1;;17063:29:36;17073:19;17063:29;;;17106:8;;;;;;17102:320;;;17167:11;;17150:13;;17140:1;:7;;;:23;;;;:::i;:::-;17139:39;;;;:::i;:::-;17130:48;;17207:1;:7;;;17192:11;;:22;;;;;;;:::i;:::-;;;;;;;;17245:6;17228:13;;:23;;;;;;;:::i;:::-;;;;-1:-1:-1;17102:320:36;;-1:-1:-1;17102:320:36;;17321:13;;17302:15;;17292:1;:7;;;:25;;;;:::i;:::-;17291:43;;;;:::i;:::-;17282:52;;17365:1;:7;;;17348:13;;:24;;;;;;;:::i;:::-;;;;;;;;17405:6;17386:15;;:25;;;;;;;:::i;:::-;;;;-1:-1:-1;;17102:320:36;17432:5;;:33;;-1:-1:-1;;;;;17432:5:36;17451;17458:6;17432:18;:33::i;:::-;16595:877;;16488:984;;;;:::o;4782:484:1:-;4862:22;4870:4;4876:7;4862;:22::i;:::-;4857:403;;5045:41;5073:7;-1:-1:-1;;;;;5045:41:1;5083:2;5045:19;:41::i;:::-;5157:38;5185:4;5192:2;5157:19;:38::i;:::-;4952:265;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;4952:265:1;;;;;;;;;;-1:-1:-1;;;4900:349:1;;;;;;;:::i;7505:344:8:-;7598:4;7310:16;;;:7;:16;;;;;;-1:-1:-1;;;;;7310:16:8;7614:73;;;;-1:-1:-1;;;7614:73:8;;19643:2:40;7614:73:8;;;19625:21:40;19682:2;19662:18;;;19655:30;19721:34;19701:18;;;19694:62;-1:-1:-1;;;19772:18:40;;;19765:42;19824:19;;7614:73:8;19615:234:40;7614:73:8;7697:13;7713:23;7728:7;7713:14;:23::i;:::-;7697:39;;7765:5;-1:-1:-1;;;;;7754:16:8;:7;-1:-1:-1;;;;;7754:16:8;;:51;;;;7798:7;-1:-1:-1;;;;;7774:31:8;:20;7786:7;7774:11;:20::i;:::-;-1:-1:-1;;;;;7774:31:8;;7754:51;:87;;;-1:-1:-1;;;;;;4685:25:8;;;4662:4;4685:25;;;:18;:25;;;;;;;;:35;;;;;;;;;;;;7809:32;7746:96;7505:344;-1:-1:-1;;;;7505:344:8:o;10402:560::-;10556:4;-1:-1:-1;;;;;10529:31:8;:23;10544:7;10529:14;:23::i;:::-;-1:-1:-1;;;;;10529:31:8;;10521:85;;;;-1:-1:-1;;;10521:85:8;;24549:2:40;10521:85:8;;;24531:21:40;24588:2;24568:18;;;24561:30;24627:34;24607:18;;;24600:62;-1:-1:-1;;;24678:18:40;;;24671:39;24727:19;;10521:85:8;24521:231:40;10521:85:8;-1:-1:-1;;;;;10624:16:8;;10616:65;;;;-1:-1:-1;;;10616:65:8;;17581:2:40;10616:65:8;;;17563:21:40;17620:2;17600:18;;;17593:30;17659:34;17639:18;;;17632:62;-1:-1:-1;;;17710:18:40;;;17703:34;17754:19;;10616:65:8;17553:226:40;10616:65:8;10692:39;10713:4;10719:2;10723:7;10692:20;:39::i;:::-;10793:29;10810:1;10814:7;10793:8;:29::i;:::-;-1:-1:-1;;;;;10833:15:8;;;;;;:9;:15;;;;;:20;;10852:1;;10833:15;:20;;10852:1;;10833:20;:::i;:::-;;;;-1:-1:-1;;;;;;;10863:13:8;;;;;;:9;:13;;;;;:18;;10880:1;;10863:13;:18;;10880:1;;10863:18;:::i;:::-;;;;-1:-1:-1;;10891:16:8;;;;:7;:16;;;;;;:21;;-1:-1:-1;;;;;;10891:21:8;-1:-1:-1;;;;;10891:21:8;;;;;;;;;10928:27;;10891:16;;10928:27;;;;;;;10402:560;;;:::o;845:241:7:-;1010:68;;-1:-1:-1;;;;;10278:15:40;;;1010:68:7;;;10260:34:40;10330:15;;10310:18;;;10303:43;10362:18;;;10355:34;;;983:96:7;;1003:5;;-1:-1:-1;;;1033:27:7;10195:18:40;;1010:68:7;;;;-1:-1:-1;;1010:68:7;;;;;;;;;;;;;;-1:-1:-1;;;;;1010:68:7;-1:-1:-1;;;;;;1010:68:7;;;;;;;;;;983:19;:96::i;8047:224:1:-;8121:22;8129:4;8135:7;8121;:22::i;:::-;8116:149;;8159:12;;;;:6;:12;;;;;;;;-1:-1:-1;;;;;8159:29:1;;;;;;;;;:36;;-1:-1:-1;;8159:36:1;8191:4;8159:36;;;8241:12;665:10:13;;586:96;8241:12:1;-1:-1:-1;;;;;8214:40:1;8232:7;-1:-1:-1;;;;;8214:40:1;8226:4;8214:40;;;;;;;;;;8047:224;;:::o;20251:180:36:-;20299:13;20327:18;20355:13;-1:-1:-1;;;;;20355:29:36;;:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;20324:62:36;;20251:180;-1:-1:-1;;;;;20251:180:36:o;12912:174::-;13010:7;13076:3;13050:22;;13041:6;:31;;;;:::i;:::-;13040:39;;;;:::i;19310:459::-;19528:6;;:98;;-1:-1:-1;;;19528:98:36;;;;;30710:25:40;;;30751:18;;;30744:34;;;30794:18;;;30787:34;;;19451:21:36;;;;-1:-1:-1;;;;;19528:6:36;;;;:28;;30683:18:40;;19528:98:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;19501:125;;-1:-1:-1;19501:125:36;-1:-1:-1;19683:13:36;19692:4;19683:6;:13;:::i;:::-;19657:23;19673:7;19657:13;:23;:::i;:::-;:39;19636:126;;;;-1:-1:-1;;;19636:126:36;;25778:2:40;19636:126:36;;;25760:21:40;25817:2;25797:18;;;25790:30;25856:34;25836:18;;;25829:62;-1:-1:-1;;;25907:18:40;;;25900:38;25955:19;;19636:126:36;25750:230:40;634:205:7;773:58;;-1:-1:-1;;;;;11085:32:40;;773:58:7;;;11067:51:40;11134:18;;;11127:34;;;746:86:7;;766:5;;-1:-1:-1;;;796:23:7;11040:18:40;;773:58:7;11022:145:40;8277:225:1;8351:22;8359:4;8365:7;8351;:22::i;:::-;8347:149;;;8421:5;8389:12;;;:6;:12;;;;;;;;-1:-1:-1;;;;;8389:29:1;;;;;;;;;;:37;;-1:-1:-1;;8389:37:1;;;8445:40;665:10:13;;8389:12:1;;8445:40;;8421:5;8445:40;8277:225;;:::o;12542:364:36:-;12638:18;12622:12;;;;:34;;;;;;;;:::i;:::-;;12601:157;;;;-1:-1:-1;;;12601:157:36;;18751:2:40;12601:157:36;;;18733:21:40;18790:2;18770:18;;;18763:30;18829:34;18809:18;;;18802:62;18900:34;18880:18;;;18873:62;-1:-1:-1;;;18951:19:40;;;18944:43;19004:19;;12601:157:36;18723:306:40;12601:157:36;12784:6;:19;;;12768:12;;:35;;;;;;;:::i;:::-;;;;-1:-1:-1;;12830:19:36;;;;12813:13;:36;;:13;;:36;;12830:19;;12813:36;:::i;:::-;;;;-1:-1:-1;;12878:21:36;;;;12859:15;:40;;:15;;:40;;12878:21;;12859:40;:::i;:::-;;;;-1:-1:-1;;;12542:364:36:o;1558:312:35:-;1663:14;1693:20;1716:15;:13;:15::i;:::-;1693:38;;1760:6;:13;;;1745:12;:28;1741:42;;;-1:-1:-1;1782:1:35;;1558:312;-1:-1:-1;;1558:312:35:o;1741:42::-;1851:12;1834:6;:13;;;1817:6;:13;;;1802:12;:28;;;;:::i;:::-;1801:46;;;;:::i;:::-;1800:63;;;;:::i;8179:108:8:-;8254:26;8264:2;8268:7;8254:26;;;;;;;;;;;;:9;:26::i;11369:362:36:-;-1:-1:-1;;;;;11446:16:36;;11438:25;;;;;;11473:17;11528:14;:12;:14::i;:::-;11511:13;;11494:30;;:14;:30;:::i;:::-;11493:49;;;;:::i;:::-;11473:69;-1:-1:-1;11552:19:36;11574:26;11473:69;11574:14;:26;:::i;:::-;11552:48;;11627:9;11610:13;;:26;;;;;;;:::i;:::-;;;;;;;;11665:11;11646:15;;:30;;;;;;;:::i;:::-;;;;-1:-1:-1;;11686:5:36;;:38;;-1:-1:-1;;;;;11686:5:36;11705:2;11709:14;11686:18;:38::i;6612:307:8:-;6763:28;6773:4;6779:2;6783:7;6763:9;:28::i;:::-;6809:48;6832:4;6838:2;6842:7;6851:5;6809:22;:48::i;:::-;6801:111;;;;-1:-1:-1;;;6801:111:8;;;;;;;:::i;275:703:14:-;331:13;548:10;544:51;;-1:-1:-1;;574:10:14;;;;;;;;;;;;-1:-1:-1;;;574:10:14;;;;;275:703::o;544:51::-;619:5;604:12;658:75;665:9;;658:75;;690:8;;;;:::i;:::-;;-1:-1:-1;712:10:14;;-1:-1:-1;720:2:14;712:10;;:::i;:::-;;;658:75;;;742:19;774:6;764:17;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;764:17:14;;742:39;;791:150;798:10;;791:150;;824:11;834:1;824:11;;:::i;:::-;;-1:-1:-1;892:10:14;900:2;892:5;:10;:::i;:::-;879:24;;:2;:24;:::i;:::-;866:39;;849:6;856;849:14;;;;;;;;:::i;:::-;;;;:56;-1:-1:-1;;;;;849:56:14;;;;;;;;-1:-1:-1;919:11:14;928:2;919:11;;:::i;:::-;;;791:150;;1535:441;1610:13;1635:19;1667:10;1671:6;1667:1;:10;:::i;:::-;:14;;1680:1;1667:14;:::i;:::-;1657:25;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1657:25:14;;1635:47;;-1:-1:-1;;;1692:6:14;1699:1;1692:9;;;;;;;;:::i;:::-;;;;:15;-1:-1:-1;;;;;1692:15:14;;;;;;;;;-1:-1:-1;;;1717:6:14;1724:1;1717:9;;;;;;;;:::i;:::-;;;;:15;-1:-1:-1;;;;;1717:15:14;;;;;;;;-1:-1:-1;1747:9:14;1759:10;1763:6;1759:1;:10;:::i;:::-;:14;;1772:1;1759:14;:::i;:::-;1747:26;;1742:132;1779:1;1775;:5;1742:132;;;-1:-1:-1;;;1826:5:14;1834:3;1826:11;1813:25;;;;;;;:::i;:::-;;;;1801:6;1808:1;1801:9;;;;;;;;:::i;:::-;;;;:37;-1:-1:-1;;;;;1801:37:14;;;;;;;;-1:-1:-1;1862:1:14;1852:11;;;;;1782:3;;;:::i;:::-;;;1742:132;;;-1:-1:-1;1891:10:14;;1883:55;;;;-1:-1:-1;;;1883:55:14;;14357:2:40;1883:55:14;;;14339:21:40;;;14376:18;;;14369:30;14435:34;14415:18;;;14408:62;14487:18;;1883:55:14;14329:182:40;17933:270:36;18099:17;18077:8;18086:2;18077:12;;;;;;;;:::i;:::-;;;;;;;;;;;;;;:18;;;:39;;;;;;;;:::i;:::-;;18056:140;;;;-1:-1:-1;;;18056:140:36;;22126:2:40;18056:140:36;;;22108:21:40;22165:2;22145:18;;;22138:30;22204:34;22184:18;;;22177:62;-1:-1:-1;;;22255:18:40;;;22248:52;22317:19;;18056:140:36;22098:244:40;3140:706:7;3559:23;3585:69;3613:4;3585:69;;;;;;;;;;;;;;;;;3593:5;-1:-1:-1;;;;;3585:27:7;;;:69;;;;;:::i;:::-;3668:17;;3559:95;;-1:-1:-1;3668:21:7;3664:176;;3763:10;3752:30;;;;;;;;;;;;:::i;:::-;3744:85;;;;-1:-1:-1;;;3744:85:7;;29088:2:40;3744:85:7;;;29070:21:40;29127:2;29107:18;;;29100:30;29166:34;29146:18;;;29139:62;-1:-1:-1;;;29217:18:40;;;29210:40;29267:19;;3744:85:7;29060:232:40;8508:311:8;8633:18;8639:2;8643:7;8633:5;:18::i;:::-;8682:54;8713:1;8717:2;8721:7;8730:5;8682:22;:54::i;:::-;8661:151;;;;-1:-1:-1;;;8661:151:8;;;;;;;:::i;11797:782::-;11947:4;-1:-1:-1;;;;;11967:13:8;;1034:20:12;1080:8;11963:610:8;;12002:72;;-1:-1:-1;;;12002:72:8;;-1:-1:-1;;;;;12002:36:8;;;;;:72;;665:10:13;;12053:4:8;;12059:7;;12068:5;;12002:72;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;12002:72:8;;;;;;;;-1:-1:-1;;12002:72:8;;;;;;;;;;;;:::i;:::-;;;11998:523;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;12245:13:8;;12241:266;;12287:60;;-1:-1:-1;;;12287:60:8;;;;;;;:::i;12241:266::-;12459:6;12453:13;12444:6;12440:2;12436:15;12429:38;11998:523;-1:-1:-1;;;;;;12124:55:8;-1:-1:-1;;;12124:55:8;;-1:-1:-1;12117:62:8;;11963:610;-1:-1:-1;12558:4:8;11797:782;;;;;;:::o;3461:223:12:-;3594:12;3625:52;3647:6;3655:4;3661:1;3664:12;3625:21;:52::i;9141:372:8:-;-1:-1:-1;;;;;9220:16:8;;9212:61;;;;-1:-1:-1;;;9212:61:8;;22549:2:40;9212:61:8;;;22531:21:40;;;22568:18;;;22561:30;22627:34;22607:18;;;22600:62;22679:18;;9212:61:8;22521:182:40;9212:61:8;7287:4;7310:16;;;:7;:16;;;;;;-1:-1:-1;;;;;7310:16:8;:30;9283:58;;;;-1:-1:-1;;;9283:58:8;;16374:2:40;9283:58:8;;;16356:21:40;16413:2;16393:18;;;16386:30;16452;16432:18;;;16425:58;16500:18;;9283:58:8;16346:178:40;9283:58:8;9352:45;9381:1;9385:2;9389:7;9352:20;:45::i;:::-;-1:-1:-1;;;;;9408:13:8;;;;;;:9;:13;;;;;:18;;9425:1;;9408:13;:18;;9425:1;;9408:18;:::i;:::-;;;;-1:-1:-1;;9436:16:8;;;;:7;:16;;;;;;:21;;-1:-1:-1;;;;;;9436:21:8;-1:-1:-1;;;;;9436:21:8;;;;;;;;9473:33;;9436:16;;;9473:33;;9436:16;;9473:33;9141:372;;:::o;4548:500:12:-;4713:12;4770:5;4745:21;:30;;4737:81;;;;-1:-1:-1;;;4737:81:12;;19236:2:40;4737:81:12;;;19218:21:40;19275:2;19255:18;;;19248:30;19314:34;19294:18;;;19287:62;-1:-1:-1;;;19365:18:40;;;19358:36;19411:19;;4737:81:12;19208:228:40;4737:81:12;1034:20;;4828:60;;;;-1:-1:-1;;;4828:60:12;;27835:2:40;4828:60:12;;;27817:21:40;27874:2;27854:18;;;27847:30;27913:31;27893:18;;;27886:59;27962:18;;4828:60:12;27807:179:40;4828:60:12;4900:12;4914:23;4941:6;-1:-1:-1;;;;;4941:11:12;4960:5;4967:4;4941:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4899:73;;;;4989:52;5007:7;5016:10;5028:12;4989:17;:52::i;:::-;4982:59;4548:500;-1:-1:-1;;;;;;;4548:500:12:o;6950:692::-;7096:12;7124:7;7120:516;;;-1:-1:-1;7154:10:12;7147:17;;7120:516;7265:17;;:21;7261:365;;7459:10;7453:17;7519:15;7506:10;7502:2;7498:19;7491:44;7261:365;7598:12;7591:20;;-1:-1:-1;;;7591:20:12;;;;;;;;:::i;14:179:40:-;92:13;;145:22;134:34;;124:45;;114:2;;183:1;180;173:12;114:2;73:120;;;:::o;198:247::-;257:6;310:2;298:9;289:7;285:23;281:32;278:2;;;326:1;323;316:12;278:2;365:9;352:23;384:31;409:5;384:31;:::i;450:251::-;520:6;573:2;561:9;552:7;548:23;544:32;541:2;;;589:1;586;579:12;541:2;621:9;615:16;640:31;665:5;640:31;:::i;706:388::-;774:6;782;835:2;823:9;814:7;810:23;806:32;803:2;;;851:1;848;841:12;803:2;890:9;877:23;909:31;934:5;909:31;:::i;:::-;959:5;-1:-1:-1;1016:2:40;1001:18;;988:32;1029:33;988:32;1029:33;:::i;:::-;1081:7;1071:17;;;793:301;;;;;:::o;1099:456::-;1176:6;1184;1192;1245:2;1233:9;1224:7;1220:23;1216:32;1213:2;;;1261:1;1258;1251:12;1213:2;1300:9;1287:23;1319:31;1344:5;1319:31;:::i;:::-;1369:5;-1:-1:-1;1426:2:40;1411:18;;1398:32;1439:33;1398:32;1439:33;:::i;:::-;1203:352;;1491:7;;-1:-1:-1;;;1545:2:40;1530:18;;;;1517:32;;1203:352::o;1560:1266::-;1655:6;1663;1671;1679;1732:3;1720:9;1711:7;1707:23;1703:33;1700:2;;;1749:1;1746;1739:12;1700:2;1788:9;1775:23;1807:31;1832:5;1807:31;:::i;:::-;1857:5;-1:-1:-1;1914:2:40;1899:18;;1886:32;1927:33;1886:32;1927:33;:::i;:::-;1979:7;-1:-1:-1;2033:2:40;2018:18;;2005:32;;-1:-1:-1;2088:2:40;2073:18;;2060:32;2111:18;2141:14;;;2138:2;;;2168:1;2165;2158:12;2138:2;2206:6;2195:9;2191:22;2181:32;;2251:7;2244:4;2240:2;2236:13;2232:27;2222:2;;2273:1;2270;2263:12;2222:2;2309;2296:16;2331:2;2327;2324:10;2321:2;;;2337:18;;:::i;:::-;2412:2;2406:9;2380:2;2466:13;;-1:-1:-1;;2462:22:40;;;2486:2;2458:31;2454:40;2442:53;;;2510:18;;;2530:22;;;2507:46;2504:2;;;2556:18;;:::i;:::-;2596:10;2592:2;2585:22;2631:2;2623:6;2616:18;2671:7;2666:2;2661;2657;2653:11;2649:20;2646:33;2643:2;;;2692:1;2689;2682:12;2643:2;2748;2743;2739;2735:11;2730:2;2722:6;2718:15;2705:46;2793:1;2788:2;2783;2775:6;2771:15;2767:24;2760:35;2814:6;2804:16;;;;;;;1690:1136;;;;;;;:::o;2831:382::-;2896:6;2904;2957:2;2945:9;2936:7;2932:23;2928:32;2925:2;;;2973:1;2970;2963:12;2925:2;3012:9;2999:23;3031:31;3056:5;3031:31;:::i;:::-;3081:5;-1:-1:-1;3138:2:40;3123:18;;3110:32;3151:30;3110:32;3151:30;:::i;3218:315::-;3286:6;3294;3347:2;3335:9;3326:7;3322:23;3318:32;3315:2;;;3363:1;3360;3353:12;3315:2;3402:9;3389:23;3421:31;3446:5;3421:31;:::i;:::-;3471:5;3523:2;3508:18;;;;3495:32;;-1:-1:-1;;;3305:228:40:o;3538:519::-;3621:6;3629;3637;3645;3698:3;3686:9;3677:7;3673:23;3669:33;3666:2;;;3715:1;3712;3705:12;3666:2;3754:9;3741:23;3773:31;3798:5;3773:31;:::i;:::-;3823:5;-1:-1:-1;3875:2:40;3860:18;;3847:32;;-1:-1:-1;3931:2:40;3916:18;;3903:32;3944:30;3903:32;3944:30;:::i;:::-;3656:401;;;;-1:-1:-1;3993:7:40;;4047:2;4032:18;4019:32;;-1:-1:-1;;3656:401:40:o;4062:452::-;4148:6;4156;4164;4172;4225:3;4213:9;4204:7;4200:23;4196:33;4193:2;;;4242:1;4239;4232:12;4193:2;4281:9;4268:23;4300:31;4325:5;4300:31;:::i;:::-;4350:5;4402:2;4387:18;;4374:32;;-1:-1:-1;4453:2:40;4438:18;;4425:32;;4504:2;4489:18;4476:32;;-1:-1:-1;4183:331:40;-1:-1:-1;;;4183:331:40:o;4519:245::-;4586:6;4639:2;4627:9;4618:7;4614:23;4610:32;4607:2;;;4655:1;4652;4645:12;4607:2;4687:9;4681:16;4706:28;4728:5;4706:28;:::i;4769:180::-;4828:6;4881:2;4869:9;4860:7;4856:23;4852:32;4849:2;;;4897:1;4894;4887:12;4849:2;-1:-1:-1;4920:23:40;;4839:110;-1:-1:-1;4839:110:40:o;4954:315::-;5022:6;5030;5083:2;5071:9;5062:7;5058:23;5054:32;5051:2;;;5099:1;5096;5089:12;5051:2;5135:9;5122:23;5112:33;;5195:2;5184:9;5180:18;5167:32;5208:31;5233:5;5208:31;:::i;5274:245::-;5332:6;5385:2;5373:9;5364:7;5360:23;5356:32;5353:2;;;5401:1;5398;5391:12;5353:2;5440:9;5427:23;5459:30;5483:5;5459:30;:::i;5524:249::-;5593:6;5646:2;5634:9;5625:7;5621:23;5617:32;5614:2;;;5662:1;5659;5652:12;5614:2;5694:9;5688:16;5713:30;5737:5;5713:30;:::i;6514:184::-;6584:6;6637:2;6625:9;6616:7;6612:23;6608:32;6605:2;;;6653:1;6650;6643:12;6605:2;-1:-1:-1;6676:16:40;;6595:103;-1:-1:-1;6595:103:40:o;6703:248::-;6771:6;6779;6832:2;6820:9;6811:7;6807:23;6803:32;6800:2;;;6848:1;6845;6838:12;6800:2;-1:-1:-1;;6871:23:40;;;6941:2;6926:18;;;6913:32;;-1:-1:-1;6790:161:40:o;6956:245::-;7035:6;7043;7096:2;7084:9;7075:7;7071:23;7067:32;7064:2;;;7112:1;7109;7102:12;7064:2;-1:-1:-1;;7135:16:40;;7191:2;7176:18;;;7170:25;7135:16;;7170:25;;-1:-1:-1;7054:147:40:o;7206:316::-;7283:6;7291;7299;7352:2;7340:9;7331:7;7327:23;7323:32;7320:2;;;7368:1;7365;7358:12;7320:2;-1:-1:-1;;7391:23:40;;;7461:2;7446:18;;7433:32;;-1:-1:-1;7512:2:40;7497:18;;;7484:32;;7310:212;-1:-1:-1;7310:212:40:o;7527:473::-;7630:6;7638;7646;7654;7662;7715:3;7703:9;7694:7;7690:23;7686:33;7683:2;;;7732:1;7729;7722:12;7683:2;7755:39;7784:9;7755:39;:::i;:::-;7745:49;;7834:2;7823:9;7819:18;7813:25;7803:35;;7878:2;7867:9;7863:18;7857:25;7847:35;;7922:2;7911:9;7907:18;7901:25;7891:35;;7945:49;7989:3;7978:9;7974:19;7945:49;:::i;:::-;7935:59;;7673:327;;;;;;;;:::o;8005:257::-;8046:3;8084:5;8078:12;8111:6;8106:3;8099:19;8127:63;8183:6;8176:4;8171:3;8167:14;8160:4;8153:5;8149:16;8127:63;:::i;:::-;8244:2;8223:15;-1:-1:-1;;8219:29:40;8210:39;;;;8251:4;8206:50;;8054:208;-1:-1:-1;;8054:208:40:o;8267:274::-;8396:3;8434:6;8428:13;8450:53;8496:6;8491:3;8484:4;8476:6;8472:17;8450:53;:::i;:::-;8519:16;;;;;8404:137;-1:-1:-1;;8404:137:40:o;8546:470::-;8725:3;8763:6;8757:13;8779:53;8825:6;8820:3;8813:4;8805:6;8801:17;8779:53;:::i;:::-;8895:13;;8854:16;;;;8917:57;8895:13;8854:16;8951:4;8939:17;;8917:57;:::i;:::-;8990:20;;8733:283;-1:-1:-1;;;;8733:283:40:o;9021:786::-;9432:25;9427:3;9420:38;9402:3;9487:6;9481:13;9503:62;9558:6;9553:2;9548:3;9544:12;9537:4;9529:6;9525:17;9503:62;:::i;:::-;-1:-1:-1;;;9624:2:40;9584:16;;;9616:11;;;9609:40;9674:13;;9696:63;9674:13;9745:2;9737:11;;9730:4;9718:17;;9696:63;:::i;:::-;9779:17;9798:2;9775:26;;9410:397;-1:-1:-1;;;;9410:397:40:o;10400:488::-;-1:-1:-1;;;;;10669:15:40;;;10651:34;;10721:15;;10716:2;10701:18;;10694:43;10768:2;10753:18;;10746:34;;;10816:3;10811:2;10796:18;;10789:31;;;10594:4;;10837:45;;10862:19;;10854:6;10837:45;:::i;:::-;10829:53;10603:285;-1:-1:-1;;;;;;10603:285:40:o;12700:677::-;13016:3;13001:19;;13050:1;13039:13;;13029:2;;13056:18;;:::i;:::-;13085:25;;;13141:2;13126:18;;13119:34;;;;13184:2;13169:18;;13162:34;;;;13227:2;13212:18;;13205:34;;;;13270:3;13255:19;;13248:35;13314:3;13299:19;;13292:35;13358:3;13343:19;;;13336:35;12983:394;:::o;13382:544::-;13637:3;13622:19;;13671:1;13660:13;;13650:2;;13677:18;;:::i;:::-;13706:25;;;13762:2;13747:18;;13740:34;;;;13805:2;13790:18;;13783:34;;;;13848:2;13833:18;;13826:34;13904:14;13897:22;13891:3;13876:19;;;13869:51;13604:322;:::o;13931:219::-;14080:2;14069:9;14062:21;14043:4;14100:44;14140:2;14129:9;14125:18;14117:6;14100:44;:::i;15753:414::-;15955:2;15937:21;;;15994:2;15974:18;;;15967:30;16033:34;16028:2;16013:18;;16006:62;-1:-1:-1;;;16099:2:40;16084:18;;16077:48;16157:3;16142:19;;15927:240::o;27215:413::-;27417:2;27399:21;;;27456:2;27436:18;;;27429:30;27495:34;27490:2;27475:18;;27468:62;-1:-1:-1;;;27561:2:40;27546:18;;27539:47;27618:3;27603:19;;27389:239::o;29297:355::-;29499:2;29481:21;;;29538:2;29518:18;;;29511:30;29577:33;29572:2;29557:18;;29550:61;29643:2;29628:18;;29471:181::o;30832:128::-;30872:3;30903:1;30899:6;30896:1;30893:13;30890:2;;;30909:18;;:::i;:::-;-1:-1:-1;30945:9:40;;30880:80::o;30965:120::-;31005:1;31031;31021:2;;31036:18;;:::i;:::-;-1:-1:-1;31070:9:40;;31011:74::o;31090:168::-;31130:7;31196:1;31192;31188:6;31184:14;31181:1;31178:21;31173:1;31166:9;31159:17;31155:45;31152:2;;;31203:18;;:::i;:::-;-1:-1:-1;31243:9:40;;31142:116::o;31263:125::-;31303:4;31331:1;31328;31325:8;31322:2;;;31336:18;;:::i;:::-;-1:-1:-1;31373:9:40;;31312:76::o;31393:258::-;31465:1;31475:113;31489:6;31486:1;31483:13;31475:113;;;31565:11;;;31559:18;31546:11;;;31539:39;31511:2;31504:10;31475:113;;;31606:6;31603:1;31600:13;31597:2;;;-1:-1:-1;;31641:1:40;31623:16;;31616:27;31446:205::o;31656:136::-;31695:3;31723:5;31713:2;;31732:18;;:::i;:::-;-1:-1:-1;;;31768:18:40;;31703:89::o;31797:380::-;31876:1;31872:12;;;;31919;;;31940:2;;31994:4;31986:6;31982:17;31972:27;;31940:2;32047;32039:6;32036:14;32016:18;32013:38;32010:2;;;32093:10;32088:3;32084:20;32081:1;32074:31;32128:4;32125:1;32118:15;32156:4;32153:1;32146:15;32010:2;;31852:325;;;:::o;32182:135::-;32221:3;-1:-1:-1;;32242:17:40;;32239:2;;;32262:18;;:::i;:::-;-1:-1:-1;32309:1:40;32298:13;;32229:88::o;32322:112::-;32354:1;32380;32370:2;;32385:18;;:::i;:::-;-1:-1:-1;32419:9:40;;32360:74::o;32439:127::-;32500:10;32495:3;32491:20;32488:1;32481:31;32531:4;32528:1;32521:15;32555:4;32552:1;32545:15;32571:127;32632:10;32627:3;32623:20;32620:1;32613:31;32663:4;32660:1;32653:15;32687:4;32684:1;32677:15;32703:127;32764:10;32759:3;32755:20;32752:1;32745:31;32795:4;32792:1;32785:15;32819:4;32816:1;32809:15;32835:127;32896:10;32891:3;32887:20;32884:1;32877:31;32927:4;32924:1;32917:15;32951:4;32948:1;32941:15;32967:127;33028:10;33023:3;33019:20;33016:1;33009:31;33059:4;33056:1;33049:15;33083:4;33080:1;33073:15;33099:131;-1:-1:-1;;;;;33174:31:40;;33164:42;;33154:2;;33220:1;33217;33210:12;33154:2;33144:86;:::o;33235:118::-;33321:5;33314:13;33307:21;33300:5;33297:32;33287:2;;33343:1;33340;33333:12;33358:131;-1:-1:-1;;;;;;33432:32:40;;33422:43;;33412:2;;33479:1;33476;33469:12

Swarm Source

ipfs://ae6728538a1c88c3d1c8f0b8d5f2c675fab700194c5baa0c3085508d37945008
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.