Contract 0x3306176EBa7D552Bb4360C0fa60Af3e987AB6FDb

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x52de97b5aa3fa89b235f75e31b56a395a22dcbd33bde41e5999d209a4ff60ce70x60a06040507705032022-11-11 18:56:05138 days 1 hr agoScarab Finance: Deployer IN  Create: Controller0 FTM2.138767552366
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x52de97b5aa3fa89b235f75e31b56a395a22dcbd33bde41e5999d209a4ff60ce7507705032022-11-11 18:56:05138 days 1 hr ago Scarab Finance: Deployer  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Controller

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at FtmScan.com on 2022-11-11
*/

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

pragma solidity ^0.8.0;

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

pragma solidity ^0.8.0;

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

pragma solidity ^0.8.0;

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^0.8.0;

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

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

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

pragma solidity ^0.8.0;

/**
 * @dev Extension of ERC1155 that adds tracking of total supply per id.
 *
 * Useful for scenarios where Fungible and Non-fungible tokens have to be
 * clearly identified. Note: While a totalSupply of 1 might mean the
 * corresponding is an NFT, there is no guarantees that no other token with the
 * same id are not going to be minted.
 */
abstract contract ERC1155Supply is ERC1155 {
    mapping(uint256 => uint256) private _totalSupply;

    /**
     * @dev Total amount of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Indicates whether any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return ERC1155Supply.totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        if (from == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                _totalSupply[ids[i]] += amounts[i];
            }
        }

        if (to == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                uint256 id = ids[i];
                uint256 amount = amounts[i];
                uint256 supply = _totalSupply[id];
                require(supply >= amount, "ERC1155: burn amount exceeds totalSupply");
                unchecked {
                    _totalSupply[id] = supply - amount;
                }
            }
        }
    }
}

pragma solidity >=0.8.0;

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
    event Debug(bool one, bool two, uint256 retsize);

    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

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

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
            mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
            )
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "APPROVE_FAILED");
    }
}

pragma solidity ^0.8.0;

interface AggregatorInterface {
  function latestAnswer() external view returns (int256);

  function latestTimestamp() external view returns (uint256);

  function latestRound() external view returns (uint256);

  function getAnswer(uint256 roundId) external view returns (int256);

  function getTimestamp(uint256 roundId) external view returns (uint256);

  event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);

  event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}

pragma solidity 0.8.15;

interface IController {
    function getVaultFactory() external view returns (address);

    function triggerDepeg(uint256 marketIndex, uint256 epochEnd) external;

    function triggerEndEpoch(uint256 marketIndex, uint256 epochEnd) external;

    function triggerNullEpoch(uint256 marketIndex, uint256 epochEnd) external;
}

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

pragma solidity 0.8.15;

interface IWETH {
    function deposit() external payable;

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

    function withdraw(uint256) external;
}

pragma solidity >=0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity 0.8.15;

abstract contract SemiFungibleVault is ERC1155Supply {
    using SafeTransferLib for ERC20;
    using FixedPointMathLib for uint256;

    /*///////////////////////////////////////////////////////////////
                               IMMUTABLES AND STORAGE
    //////////////////////////////////////////////////////////////*/
    ERC20 public immutable asset;
    string public name;
    string public symbol;
    bytes internal constant EMPTY = "";

    /*///////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/
    
    /** @notice Deposit into vault when event is emitted
      * @param caller Address of deposit caller
      * @param owner receiver who will own of the tokens representing this deposit
      * @param id Vault id
      * @param assets Amount of owner assets to deposit into vault
      */
    event Deposit(
        address caller,
        address indexed owner,
        uint256 indexed id,
        uint256 assets
    );

    /** @notice Withdraw from vault when event is emitted
      * @param caller Address of withdraw caller
      * @param receiver Address of receiver of assets
      * @param owner Owner of shares
      * @param id Vault id
      * @param assets Amount of owner assets to withdraw from vault
      * @param shares Amount of owner shares to burn
      */ 
    event Withdraw(
        address caller,
        address receiver,
        address indexed owner,
        uint256 indexed id,
        uint256 assets,
        uint256 shares
    );

    /** @notice Contract constructor
      * @param _asset ERC20 token
      * @param _name Token name
      * @param _symbol Token symbol 
      */
    constructor(
        ERC20 _asset,
        string memory _name,
        string memory _symbol
    ) ERC1155("") {
        asset = _asset;
        name = _name;
        symbol = _symbol;
    }

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

    /** @notice Triggers deposit into vault and mints shares for receiver
      * @param id Vault id
      * @param assets Amount of tokens to deposit
      * @param receiver Receiver of shares
      */ 
    function deposit(
        uint256 id,
        uint256 assets,
        address receiver
    ) public virtual {

        // Need to transfer before minting or ERC777s could reenter.
        asset.safeTransferFrom(msg.sender, address(this), assets);

        _mint(receiver, id, assets, EMPTY);

        emit Deposit(msg.sender, receiver, id, assets);
    }

    /** @notice Triggers withdraw from vault and burns receivers' shares
      * @param id Vault id
      * @param assets Amount of tokens to withdraw
      * @param receiver Receiver of assets
      * @param owner Owner of shares
      * @return shares Amount of shares burned
      */ 
    function withdraw(
        uint256 id,
        uint256 assets,
        address receiver,
        address owner
    ) external virtual returns (uint256 shares) {
        require(
            msg.sender == owner || isApprovedForAll(owner, msg.sender),
            "Only owner can withdraw, or owner has approved receiver for all"
        );

        shares = previewWithdraw(id, assets);

        _burn(owner, id, shares);

        emit Withdraw(msg.sender, receiver, owner, id, assets, shares);
        asset.safeTransfer(receiver, assets);
    }

    /*///////////////////////////////////////////////////////////////
                           ACCOUNTING LOGIC
    //////////////////////////////////////////////////////////////*/

    /**@notice Returns total assets for token
     * @param  _id uint256 token id of token
     */
    function totalAssets(uint256 _id) public view virtual returns (uint256){
        return totalSupply(_id);
    }

    /**
        @notice Shows assets conversion output from withdrawing assets
        @param  id uint256 token id of token
        @param assets Total number of assets
     */
    function previewWithdraw(uint256 id, uint256 assets)
        public
        view
        virtual
        returns (uint256)
    {
    }
}

pragma solidity ^0.8.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
    );
}

pragma solidity 0.8.15;

contract VaultFactory is Ownable {

    address public immutable WETH;
    // solhint-enable var-name-mixedcase
    address public treasury;
    address public controller;
    uint256 public marketIndex;

    struct MarketVault{
        uint256 index;
        uint256 epochBegin;
        uint256 epochEnd;
        Vault hedge;
        Vault risk;
        uint256 withdrawalFee;
    }

    /*//////////////////////////////////////////////////////////////
                                 ERRORS
    //////////////////////////////////////////////////////////////*/
    error MarketDoesNotExist(uint256 marketIndex);
    error AddressZero();
    error AddressNotController();
    error AddressFactoryNotInController();
    error ControllerNotSet();
    error ControllerAlreadySet();

    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/
    
    /** @notice Market is created when event is emitted
      * @param mIndex Current market index
      * @param hedge Hedge vault address
      * @param risk Risk vault address
      * @param token Token address
      * @param name Market name
      */ 
    event MarketCreated(
        uint256 indexed mIndex,
        address hedge,
        address risk,
        address token,
        string name,
        int256 strikePrice
    );

    /** @notice Epoch is created when event is emitted
      * @param marketEpochId Current market epoch id
      * @param mIndex Current market index
      * @param startEpoch Epoch start time
      * @param endEpoch Epoch end time
      * @param hedge Hedge vault address
      * @param risk Risk vault address
      * @param token Token address
      * @param name Market name
      * @param strikePrice Vault strike price
      */
    event EpochCreated(
        bytes32 indexed marketEpochId,
        uint256 indexed mIndex,
        uint256 startEpoch,
        uint256 endEpoch,
        address hedge,
        address risk,
        address token,
        string name,
        int256 strikePrice,
        uint256 withdrawalFee
    );

    /** @notice Controller is set when event is emitted
      * @param newController Address for new controller
      */ 
    event controllerSet(address indexed newController);

    /** @notice Treasury is changed when event is emitted
      * @param _treasury Treasury address
      * @param _marketIndex Target market index
      */ 
    event changedTreasury(address _treasury, uint256 indexed _marketIndex);

    /** @notice Vault fee is changed when event is emitted
      * @param _marketIndex Target market index
      * @param _feeRate Target fee rate
      */ 
    event changedVaultFee(uint256 indexed _marketIndex, uint256 _feeRate);

    /** @notice Controller is changed when event is emitted
      * @param _marketIndex Target market index
      * @param controller Target controller address
      */ 
    event changedController(
        uint256 indexed _marketIndex,
        address indexed controller
    );
    event changedOracle(address indexed _token, address _oracle);

    /*//////////////////////////////////////////////////////////////
                                MAPPINGS
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => address[]) public indexVaults; //[0] hedge and [1] risk vault
    mapping(uint256 => uint256[]) public indexEpochs; //all epochs in the market
    mapping(address => address) public tokenToOracle; //token address to respective oracle smart contract address

    /*//////////////////////////////////////////////////////////////
                                CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    /** @notice Contract constructor
      * @param _treasury Treasury address
      * @param _weth Wrapped Ether token address
      */ 
    constructor(
        address _treasury,
        address _weth
    ) {

        if(_weth == address(0))
            revert AddressZero();

        if(_treasury == address(0))
            revert AddressZero();

        WETH = _weth;
        marketIndex = 0;
        treasury = _treasury;
    }

    /*//////////////////////////////////////////////////////////////
                                ADMIN FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    /**
    @notice Function to create two new vaults, hedge and risk, with the respective params, and storing the oracle for the token provided
    @param _withdrawalFee uint256 of the fee value, multiply your % value by 10, Example: if you want fee of 0.5% , insert 5
    @param _token Address of the oracle to lookup the price in chainlink oracles
    @param _strikePrice uint256 representing the price to trigger the depeg event, needs to be 18 decimals
    @param  epochBegin uint256 in UNIX timestamp, representing the begin date of the epoch. Example: Epoch begins in 31/May/2022 at 00h 00min 00sec: 1654038000
    @param  epochEnd uint256 in UNIX timestamp, representing the end date of the epoch. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1656630000
    @param  _oracle Address representing the smart contract to lookup the price of the given _token param
    @return insr    Address of the deployed hedge vault
    @return rsk     Address of the deployed risk vault
     */
    function createNewMarket(
        uint256 _withdrawalFee,
        address _token,
        int256 _strikePrice,
        uint256 epochBegin,
        uint256 epochEnd,
        address _oracle,
        string memory _name
    ) public onlyOwner returns (address insr, address rsk) {

        if(controller == address(0))
            revert ControllerNotSet();

        if(
            IController(controller).getVaultFactory() != address(this)
            )
            revert AddressFactoryNotInController();

        marketIndex += 1;

        //y2kUSDC_99*RISK or y2kUSDC_99*HEDGE

        Vault hedge = new Vault(
            WETH,
            string(abi.encodePacked(_name,"HEDGE")),
            "hY2K",
            treasury,
            _token,
            _strikePrice,
            controller
        );

        Vault risk = new Vault(
            WETH,
            string(abi.encodePacked(_name,"RISK")),
            "rY2K",
            treasury,
            _token,
            _strikePrice,
            controller
        );

        indexVaults[marketIndex] = [address(hedge), address(risk)];

        if (tokenToOracle[_token] == address(0)) {
            tokenToOracle[_token] = _oracle;
        }

        emit MarketCreated(
            marketIndex,
            address(hedge),
            address(risk),
            _token,
            _name,
            _strikePrice
        );

        MarketVault memory marketVault = MarketVault(marketIndex, epochBegin, epochEnd, hedge, risk, _withdrawalFee);

        _createEpoch(marketVault);

        return (address(hedge), address(risk));
    }

    /**    
    @notice Function to deploy hedge assets for given epochs, after the creation of this vault, where the Index is the date of the end of epoch
    @param  index uint256 of the market index to create more assets in
    @param  epochBegin uint256 in UNIX timestamp, representing the begin date of the epoch. Example: Epoch begins in 31/May/2022 at 00h 00min 00sec: 1654038000
    @param  epochEnd uint256 in UNIX timestamp, representing the end date of the epoch and also the ID for the minting functions. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1656630000
    @param _withdrawalFee uint256 of the fee value, multiply your % value by 10, Example: if you want fee of 0.5% , insert 5
     */
    function deployMoreAssets(
        uint256 index,
        uint256 epochBegin,
        uint256 epochEnd,
        uint256 _withdrawalFee
    ) public onlyOwner {
        if(controller == address(0))
            revert ControllerNotSet();

        if (index > marketIndex) {
            revert MarketDoesNotExist(index);
        }
        address hedge = indexVaults[index][0];
        address risk = indexVaults[index][1];

        MarketVault memory marketVault = MarketVault(index, epochBegin, epochEnd, Vault(hedge), Vault(risk), _withdrawalFee);

        _createEpoch(marketVault);
    }

    function _createEpoch(
        MarketVault memory _marketVault
    ) internal {
        
        _marketVault.hedge.createAssets(_marketVault.epochBegin, _marketVault.epochEnd, _marketVault.withdrawalFee);
        _marketVault.risk.createAssets(_marketVault.epochBegin, _marketVault.epochEnd, _marketVault.withdrawalFee);

        indexEpochs[_marketVault.index].push(_marketVault.epochEnd);

        emit EpochCreated(
            keccak256(abi.encodePacked(_marketVault.index, _marketVault.epochBegin, _marketVault.epochEnd)),
            _marketVault.index,
            _marketVault.epochBegin,
            _marketVault.epochEnd,
            address(_marketVault.hedge),
            address(_marketVault.risk),
            _marketVault.hedge.tokenInsured(),
            _marketVault.hedge.name(),
            _marketVault.hedge.strikePrice(),
            _marketVault.withdrawalFee
        );
    }

    /**
    @notice Admin function, sets the controller address one time use function only
    @param  _controller Address of the controller smart contract
     */
    function setController(address _controller) public onlyOwner {
        if(controller == address(0)){
            if(_controller == address(0))
                revert AddressZero();
            controller = _controller;

            emit controllerSet(_controller);  
        }
        else{
            revert ControllerAlreadySet();
        }
    }

    /**
    @notice Admin function, changes the assigned treasury address
    @param _treasury Treasury address
    @param  _marketIndex Target market index
     */
    function changeTreasury(address _treasury, uint256 _marketIndex)
        public
        onlyOwner
    {
        if(_treasury == address(0))
            revert AddressZero();

        treasury = _treasury;
        address[] memory vaults = indexVaults[_marketIndex];
        Vault insr = Vault(vaults[0]);
        Vault risk = Vault(vaults[1]);
        insr.changeTreasury(_treasury);
        risk.changeTreasury(_treasury);

        emit changedTreasury(_treasury, _marketIndex);
    }


    /**
    @notice Admin function, changes controller address
    @param _marketIndex Target market index
    @param  _controller Address of the controller smart contract
     */
    function changeController(uint256 _marketIndex, address _controller)
        public
        onlyOwner
    {
        if(_controller == address(0))
            revert AddressZero();

        address[] memory vaults = indexVaults[_marketIndex];
        Vault insr = Vault(vaults[0]);
        Vault risk = Vault(vaults[1]);
        insr.changeController(_controller);
        risk.changeController(_controller);

        emit changedController(_marketIndex, _controller);
    }

    /**
    @notice Admin function, changes oracle address for a given token
    @param _token Target token address
    @param  _oracle Oracle address
     */
    function changeOracle(address _token, address _oracle) public onlyOwner {
        if(_oracle == address(0))
            revert AddressZero();
        if(_token == address(0))
            revert AddressZero();
            
        tokenToOracle[_token] = _oracle;
        emit changedOracle(_token, _oracle);
    }

    /*//////////////////////////////////////////////////////////////
                                GETTERS
    //////////////////////////////////////////////////////////////*/

    /**
    @notice Function the retrieve the addresses of the hedge and risk vaults, in an array, in the respective order
    @param index uint256 of the market index which to the vaults are associated to
    @return vaults Address array of two vaults addresses, [0] being the hedge vault, [1] being the risk vault
     */
    function getVaults(uint256 index)
        public
        view
        returns (address[] memory vaults)
    {
        return indexVaults[index];
    }
}

pragma solidity 0.8.15;

contract Vault is SemiFungibleVault, ReentrancyGuard {

    using FixedPointMathLib for uint256;
    /*//////////////////////////////////////////////////////////////
                                 ERRORS
    //////////////////////////////////////////////////////////////*/
    error AddressZero();
    error AddressNotFactory(address _contract);
    error AddressNotController(address _contract);
    error MarketEpochDoesNotExist();
    error EpochAlreadyStarted();
    error EpochNotFinished();
    error FeeMoreThan150(uint256 _fee);
    error ZeroValue();
    error OwnerDidNotAuthorize(address _sender, address _owner);
    error EpochEndMustBeAfterBegin();
    error MarketEpochExists();
    error FeeCannotBe0();

    /*///////////////////////////////////////////////////////////////
                               IMMUTABLES AND STORAGE
    //////////////////////////////////////////////////////////////*/

    address public immutable tokenInsured;
    address public treasury;
    int256 public immutable strikePrice;
    address public immutable factory;
    address public controller;

    uint256[] public epochs;

    /*//////////////////////////////////////////////////////////////
                                MAPPINGS
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => uint256) public idFinalTVL;
    mapping(uint256 => uint256) public idClaimTVL;
    // @audit uint32 for timestamp is enough for the next 80 years
    mapping(uint256 => uint256) public idEpochBegin;
    // @audit id can be uint32
    mapping(uint256 => bool) public idEpochEnded;
    // @audit id can be uint32
    mapping(uint256 => bool) public idExists;
    mapping(uint256 => uint256) public epochFee;
    mapping(uint256 => bool) public epochNull;

    /*//////////////////////////////////////////////////////////////
                                MODIFIERS
    //////////////////////////////////////////////////////////////*/

    /** @notice Only factory addresses can call functions that use this modifier
      */
    modifier onlyFactory() {
        if(msg.sender != factory)
            revert AddressNotFactory(msg.sender);
        _;
    }

    /** @notice Only controller addresses can call functions that use this modifier
      */
    modifier onlyController() {
        if(msg.sender != controller)
            revert AddressNotController(msg.sender);
        _;
    }

    /** @notice Only market addresses can call functions that use this modifier
      */
    modifier marketExists(uint256 id) {
        if(idExists[id] != true)
            revert MarketEpochDoesNotExist();
        _;
    }

    /** @notice You can only call functions that use this modifier before the current epoch has started
      */
    modifier epochHasNotStarted(uint256 id) {
        if(block.timestamp > idEpochBegin[id])
            revert EpochAlreadyStarted();
        _;
    }

    /** @notice You can only call functions that use this modifier after the current epoch has started
      */
    modifier epochHasEnded(uint256 id) {
        if(idEpochEnded[id] == false)
            revert EpochNotFinished();
        _;
    }

    /*//////////////////////////////////////////////////////////////
                                 CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    /**
        @notice constructor
        @param  _assetAddress    token address representing your asset to be deposited;
        @param  _name   token name for the ERC1155 mints. Insert the name of your token; Example: Y2K_USDC_1.2$
        @param  _symbol token symbol for the ERC1155 mints. insert here if risk or hedge + Symbol. Example: HedgeY2K or riskY2K;
        @param  _token  address of the oracle to lookup the price in chainlink oracles;
        @param  _strikePrice    uint256 representing the price to trigger the depeg event;
        @param _controller  address of the controller contract, this contract can trigger the depeg events;
     */
    constructor(
        address _assetAddress,
        string memory _name,
        string memory _symbol,
        address _treasury,
        address _token,
        int256 _strikePrice,
        address _controller
    ) SemiFungibleVault(ERC20(_assetAddress), _name, _symbol) {

        if(_treasury == address(0))
            revert AddressZero();

        if(_controller == address(0))
            revert AddressZero();

        if(_token == address(0))
            revert AddressZero();

        tokenInsured = _token;
        treasury = _treasury;
        strikePrice = _strikePrice;
        factory = msg.sender;
        controller = _controller;
    }

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

    /**
        @notice Deposit function from ERC4626, with payment of a fee to a treasury implemented;
        @param  id  uint256 in UNIX timestamp, representing the end date of the epoch. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1654038000;
        @param  assets  uint256 representing how many assets the user wants to deposit, a fee will be taken from this value;
        @param receiver  address of the receiver of the assets provided by this function, that represent the ownership of the deposited asset;
     */
    function deposit(
        uint256 id,
        uint256 assets,
        address receiver
    )
        public
        override
        marketExists(id)
        epochHasNotStarted(id)
        nonReentrant
    {
        if(receiver == address(0))
            revert AddressZero();
        assert(asset.transferFrom(msg.sender, address(this), assets));

        _mint(receiver, id, assets, EMPTY);

        emit Deposit(msg.sender, receiver, id, assets);
    }

    /**
        @notice Deposit ETH function
        @param  id  uint256 in UNIX timestamp, representing the end date of the epoch. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1654038000;
        @param receiver  address of the receiver of the shares provided by this function, that represent the ownership of the deposited asset;
     */
    function depositETH(uint256 id, address receiver)
        external
        payable
        marketExists(id)
        epochHasNotStarted(id)
        nonReentrant
    {
        require(msg.value > 0, "ZeroValue");
        if(receiver == address(0))
            revert AddressZero();

        IWETH(address(asset)).deposit{value: msg.value}();
        _mint(receiver, id, msg.value, EMPTY);

        emit Deposit(msg.sender, receiver, id, msg.value);
    }

    /**
    @notice Withdraw entitled deposited assets, checking if a depeg event
    @param  id uint256 in UNIX timestamp, representing the end date of the epoch. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1654038000;
    @param assets   uint256 of how many assets you want to withdraw, this value will be used to calculate how many assets you are entitle to according to the events;
    @param receiver  Address of the receiver of the assets provided by this function, that represent the ownership of the transfered asset;
    @param owner    Address of the owner of these said assets;
    @return shares How many shares the owner is entitled to, according to the conditions;
     */
    function withdraw(
        uint256 id,
        uint256 assets,
        address receiver,
        address owner
    )
        external
        override
        epochHasEnded(id)
        marketExists(id)
        returns (uint256 shares)
    {
        if(receiver == address(0))
            revert AddressZero();

        if(
            msg.sender != owner &&
            isApprovedForAll(owner, msg.sender) == false)
            revert OwnerDidNotAuthorize(msg.sender, owner);

        uint256 entitledShares;
        _burn(owner, id, assets);

        if(epochNull[id] == false) {
            entitledShares = previewWithdraw(id, assets);
            //Taking fee from the premium
            if(entitledShares > assets) {
                uint256 premium = entitledShares - assets;
                uint256 feeValue = calculateWithdrawalFeeValue(premium, id);
                entitledShares = entitledShares - feeValue;
                assert(asset.transfer(treasury, feeValue));
            }
        }
        else{
            entitledShares = assets;
        }        
        if (entitledShares > 0) { 
            assert(asset.transfer(receiver, entitledShares)); 
        }

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

        return entitledShares;
    }

    /*///////////////////////////////////////////////////////////////
                           ACCOUNTING LOGIC
    //////////////////////////////////////////////////////////////*/

    /**
        @notice returns total assets for the id of given epoch
        @param  _id uint256 in UNIX timestamp, representing the end date of the epoch. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1654038000;
     */
    function totalAssets(uint256 _id)
        public
        view
        override
        marketExists(_id)
        returns (uint256)
    {
        return totalSupply(_id);
    }

    /**
    @notice Calculates how much ether the %fee is taking from @param amount
    @param amount Amount to withdraw from vault
    @param _epoch Target epoch
    @return feeValue Current fee value
     */
    function calculateWithdrawalFeeValue(uint256 amount, uint256 _epoch)
        public
        view
        returns (uint256 feeValue)
    {
        // 0.5% = multiply by 1000 then divide by 5
        return amount.mulDivUp(epochFee[_epoch],1000);
    }

    /*///////////////////////////////////////////////////////////////
                           Factory FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    /**
    @notice Factory function, changes treasury address
    @param _treasury New treasury address
     */
    function changeTreasury(address _treasury) public onlyFactory {
        if(_treasury == address(0))
            revert AddressZero();
        treasury = _treasury;
    }


    /**
    @notice Factory function, changes controller address
    @param _controller New controller address
     */
    function changeController(address _controller) public onlyFactory{
        if(_controller == address(0))
            revert AddressZero();
        controller = _controller;
    }

    /**
    @notice Function to deploy hedge assets for given epochs, after the creation of this vault
    @param  epochBegin uint256 in UNIX timestamp, representing the begin date of the epoch. Example: Epoch begins in 31/May/2022 at 00h 00min 00sec: 1654038000
    @param  epochEnd uint256 in UNIX timestamp, representing the end date of the epoch and also the ID for the minting functions. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1656630000
    @param _withdrawalFee uint256 of the fee value, multiply your % value by 10, Example: if you want fee of 0.5% , insert 5
     */
    function createAssets(uint256 epochBegin, uint256 epochEnd, uint256 _withdrawalFee)
        public
        onlyFactory
    {
        if(_withdrawalFee > 150)
            revert FeeMoreThan150(_withdrawalFee);

        if(_withdrawalFee == 0)
            revert FeeCannotBe0();

        if(idExists[epochEnd] == true)
            revert MarketEpochExists();
        
        if(epochBegin >= epochEnd)
            revert EpochEndMustBeAfterBegin();

        idExists[epochEnd] = true;
        idEpochBegin[epochEnd] = epochBegin;
        epochs.push(epochEnd);

        epochFee[epochEnd] = _withdrawalFee;
    }

    /*///////////////////////////////////////////////////////////////
                         CONTROLLER LOGIC
    //////////////////////////////////////////////////////////////*/

    /**
    @notice Controller can call this function to trigger the end of the epoch, storing the TVL of that epoch and if a depeg event occurred
    @param  id uint256 in UNIX timestamp, representing the end date of the epoch. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1654038000
     */
    function endEpoch(uint256 id)
        public
        onlyController
        marketExists(id)
    {
        idEpochEnded[id] = true;
        idFinalTVL[id] = totalAssets(id);
    }

    /**
    @notice Function to be called after endEpoch, by the Controller only, this function stores the TVL of the counterparty vault in a mapping to be used for later calculations of the entitled withdraw
    @param  id uint256 in UNIX timestamp, representing the end date of the epoch. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1654038000
    @param claimTVL uint256 representing the TVL the counterparty vault has, storing this value in a mapping
     */
    function setClaimTVL(uint256 id, uint256 claimTVL) public onlyController marketExists(id) {
        idClaimTVL[id] = claimTVL;
    }

    /**
    solhint-disable-next-line max-line-length
    @notice Function to be called after endEpoch and setClaimTVL functions, respecting the calls in order, after storing the TVL of the end of epoch and the TVL amount to claim, this function will allow the transfer of tokens to the counterparty vault
    @param  id uint256 in UNIX timestamp, representing the end date of the epoch. Example: Epoch ends in 30th June 2022 at 00h 00min 00sec: 1654038000
    @param _counterparty Address of the other vault, meaning address of the risk vault, if this is an hedge vault, and vice-versa
    */
    function sendTokens(uint256 id, address _counterparty)
        public
        onlyController
        marketExists(id)
    {
        assert(asset.transfer(_counterparty, idFinalTVL[id]));
    }

    function setEpochNull(uint256 id) public onlyController marketExists(id) {
        epochNull[id] = true;
    }

    /*///////////////////////////////////////////////////////////////
                         INTERNAL HOOKS LOGIC
    //////////////////////////////////////////////////////////////*/
    /**
        @notice Shows assets conversion output from withdrawing assets
        @param  id uint256 token id of token
        @param assets Total number of assets
     */
    function previewWithdraw(uint256 id, uint256 assets)
        public
        view
        override
        returns (uint256 entitledAmount)
    {
        // in case the risk wins aka no depeg event
        // risk users can withdraw the hedge (that is paid by the hedge buyers) and risk; withdraw = (risk + hedge)
        // hedge pay for each hedge seller = ( risk / tvl before the hedge payouts ) * tvl in hedge pool
        // in case there is a depeg event, the risk users can only withdraw the hedge
        entitledAmount = assets.mulDivUp(idClaimTVL[id],idFinalTVL[id]);
        // in case the hedge wins aka depegging
        // hedge users pay the hedge to risk users anyway,
        // hedge guy can withdraw risk (that is transfered from the risk pool),
        // withdraw = % tvl that hedge buyer owns
        // otherwise hedge users cannot withdraw any Eth
    }
    
    /** @notice Lookup total epochs length
      */
    function epochsLength() public view returns (uint256) {
        return epochs.length;
    }

}

pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

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

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

pragma solidity 0.8.15;

contract Controller {
    VaultFactory public immutable vaultFactory;

    uint256 private constant GRACE_PERIOD_TIME = 3600;

    /*//////////////////////////////////////////////////////////////
                                 ERRORS
    //////////////////////////////////////////////////////////////*/

    error MarketDoesNotExist(uint256 marketId);
    error SequencerDown();
    error GracePeriodNotOver();
    error ZeroAddress();
    error EpochFinishedAlready();
    error PriceNotAtStrikePrice(int256 price);
    error EpochNotStarted();
    error EpochExpired();
    error OraclePriceZero();
    error RoundIDOutdated();
    error EpochNotExist();
    error EpochNotExpired();
    error VaultNotZeroTVL();

    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/
    
    /** @notice Depegs insurance vault when event is emitted
      * @param epochMarketID Current market epoch ID
      * @param tvl Current TVL
      * @param isDisaster Flag if event isDisaster
      * @param epoch Current epoch 
      * @param time Current time
      * @param depegPrice Price that triggered depeg
      */
    event DepegInsurance(
        bytes32 epochMarketID,
        VaultTVL tvl,
        bool isDisaster,
        uint256 epoch,
        uint256 time,
        int256 depegPrice
    );

    event NullEpoch(
        bytes32 epochMarketID,
        VaultTVL tvl,
        uint256 epoch,
        uint256 time
    );

    struct VaultTVL {
        uint256 RISK_claimTVL;
        uint256 RISK_finalTVL;
        uint256 INSR_claimTVL;
        uint256 INSR_finalTVL;
    }

    /*//////////////////////////////////////////////////////////////
                                CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        address _factory
    ) {
        if(_factory == address(0)) 
            revert ZeroAddress();
        
        vaultFactory = VaultFactory(_factory);
    }

    /*//////////////////////////////////////////////////////////////
                                FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    /** @notice Trigger depeg event
      * @param marketIndex Target market index
      * @param epochEnd End of epoch set for market
      */
    function triggerDepeg(uint256 marketIndex, uint256 epochEnd)
        public
    {
        address[] memory vaultsAddress = vaultFactory.getVaults(marketIndex);
        Vault insrVault = Vault(vaultsAddress[0]);
        Vault riskVault = Vault(vaultsAddress[1]);

        if(
            vaultsAddress[0] == address(0) || vaultsAddress[1] == address(0)
            )
            revert MarketDoesNotExist(marketIndex);

        if(insrVault.idExists(epochEnd) == false)
            revert EpochNotExist();

        if(
            insrVault.strikePrice() <= getLatestPrice(insrVault.tokenInsured())
            )
            revert PriceNotAtStrikePrice(getLatestPrice(insrVault.tokenInsured()));

        if(
            insrVault.idEpochBegin(epochEnd) > block.timestamp)
            revert EpochNotStarted();

        if(
            block.timestamp > epochEnd
            )
            revert EpochExpired();

        //require this function cannot be called twice in the same epoch for the same vault
        if(insrVault.idEpochEnded(epochEnd))
            revert EpochFinishedAlready();
        if(riskVault.idEpochEnded(epochEnd)) 
            revert EpochFinishedAlready();

        insrVault.endEpoch(epochEnd);
        riskVault.endEpoch(epochEnd);

        insrVault.setClaimTVL(epochEnd, riskVault.idFinalTVL(epochEnd));
        riskVault.setClaimTVL(epochEnd, insrVault.idFinalTVL(epochEnd));

        insrVault.sendTokens(epochEnd, address(riskVault));
        riskVault.sendTokens(epochEnd, address(insrVault));

        VaultTVL memory tvl = VaultTVL(
            riskVault.idClaimTVL(epochEnd),
            riskVault.idFinalTVL(epochEnd),
            insrVault.idClaimTVL(epochEnd),
            insrVault.idFinalTVL(epochEnd)
        );

        AggregatorV3Interface priceFeed = AggregatorV3Interface(
            vaultFactory.tokenToOracle(insrVault.tokenInsured())
        );
        (
            ,  
            int256 price,
            ,
            ,
            
        ) = priceFeed.latestRoundData();

        emit DepegInsurance(
            keccak256(
                abi.encodePacked(
                    marketIndex,
                    insrVault.idEpochBegin(epochEnd),
                    epochEnd
                )
            ),
            tvl,
            true,
            epochEnd,
            block.timestamp,
            price
        );
    }

    /** @notice Trigger epoch end without depeg event
      * @param marketIndex Target market index
      * @param epochEnd End of epoch set for market
      */
    function triggerEndEpoch(uint256 marketIndex, uint256 epochEnd) public {
        if(
            block.timestamp <= epochEnd)
            revert EpochNotExpired();

        address[] memory vaultsAddress = vaultFactory.getVaults(marketIndex);

        Vault insrVault = Vault(vaultsAddress[0]);
        Vault riskVault = Vault(vaultsAddress[1]);
        
        if(
            vaultsAddress[0] == address(0) || vaultsAddress[1] == address(0)
            )
            revert MarketDoesNotExist(marketIndex);

        if(insrVault.idExists(epochEnd) == false || riskVault.idExists(epochEnd) == false)
            revert EpochNotExist();

        //require this function cannot be called twice in the same epoch for the same vault
        if(insrVault.idEpochEnded(epochEnd))
            revert EpochFinishedAlready();
        if(riskVault.idEpochEnded(epochEnd)) 
            revert EpochFinishedAlready();

        insrVault.endEpoch(epochEnd);
        riskVault.endEpoch(epochEnd);

        insrVault.setClaimTVL(epochEnd, 0);
        riskVault.setClaimTVL(epochEnd, insrVault.idFinalTVL(epochEnd) + riskVault.idFinalTVL(epochEnd));
        insrVault.sendTokens(epochEnd, address(riskVault));

        VaultTVL memory tvl = VaultTVL(
            riskVault.idClaimTVL(epochEnd),
            riskVault.idFinalTVL(epochEnd),
            insrVault.idClaimTVL(epochEnd),
            insrVault.idFinalTVL(epochEnd)
        );

        emit DepegInsurance(
            keccak256(
                abi.encodePacked(
                    marketIndex,
                    insrVault.idEpochBegin(epochEnd),
                    epochEnd
                )
            ),
            tvl,
            false,
            epochEnd,
            block.timestamp,
            getLatestPrice(insrVault.tokenInsured())
        );
    }
    /** @notice Trigger epoch invalid when one vault has 0 TVL
      * @param marketIndex Target market index
      * @param epochEnd End of epoch set for market
      */
    function triggerNullEpoch(uint256 marketIndex, uint256 epochEnd) public {
        address[] memory vaultsAddress = vaultFactory.getVaults(marketIndex);

        Vault insrVault = Vault(vaultsAddress[0]);
        Vault riskVault = Vault(vaultsAddress[1]);

        if(
            vaultsAddress[0] == address(0) || vaultsAddress[1] == address(0)
            )
            revert MarketDoesNotExist(marketIndex);

        if(insrVault.idExists(epochEnd) == false || riskVault.idExists(epochEnd) == false)
            revert EpochNotExist();

        if(block.timestamp < insrVault.idEpochBegin(epochEnd))
            revert EpochNotStarted();

        if(insrVault.idExists(epochEnd) == false || riskVault.idExists(epochEnd) == false)
            revert EpochNotExist();

        //require this function cannot be called twice in the same epoch for the same vault
        if(insrVault.idEpochEnded(epochEnd))
            revert EpochFinishedAlready();
        if(riskVault.idEpochEnded(epochEnd)) 
            revert EpochFinishedAlready();

        //set claim TVL to 0 if total assets are 0
        if(insrVault.totalAssets(epochEnd) == 0){
            insrVault.endEpoch(epochEnd);
            riskVault.endEpoch(epochEnd);

            insrVault.setClaimTVL(epochEnd, 0);
            riskVault.setClaimTVL(epochEnd, riskVault.idFinalTVL(epochEnd));

            riskVault.setEpochNull(epochEnd);
        }
        else if(riskVault.totalAssets(epochEnd) == 0){
            insrVault.endEpoch(epochEnd);
            riskVault.endEpoch(epochEnd);

            insrVault.setClaimTVL(epochEnd, insrVault.idFinalTVL(epochEnd) );
            riskVault.setClaimTVL(epochEnd, 0);

            insrVault.setEpochNull(epochEnd);
        }
        else revert VaultNotZeroTVL();

        VaultTVL memory tvl = VaultTVL(
            riskVault.idClaimTVL(epochEnd),
            riskVault.idFinalTVL(epochEnd),
            insrVault.idClaimTVL(epochEnd),
            insrVault.idFinalTVL(epochEnd)
        );

        emit NullEpoch(
            keccak256(
                abi.encodePacked(
                    marketIndex,
                    insrVault.idEpochBegin(epochEnd),
                    epochEnd
                )
            ),
            tvl,
            epochEnd,
            block.timestamp
        );
    }

    /*//////////////////////////////////////////////////////////////
                                GETTERS
    //////////////////////////////////////////////////////////////*/
    /** @notice Lookup token price
      * @param _token Target token address
      * @return nowPrice Current token price
      */
    function getLatestPrice(address _token)
        public
        view
        returns (int256 nowPrice)
    {

        AggregatorV3Interface priceFeed = AggregatorV3Interface(
            vaultFactory.tokenToOracle(_token)
        );
        (
            uint80 roundID,
            int256 price,
            ,
            ,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        
        if(priceFeed.decimals() < 18){
            uint256 decimals = 10**(18-(priceFeed.decimals()));
            price = price * int256(decimals);
        }
        else if (priceFeed.decimals() == 18){
            price = price;
        }
        else{
            uint256 decimals = 10**((priceFeed.decimals()-18));
            price = price / int256(decimals);
        }
        

        if(price <= 0)
            revert OraclePriceZero();

        if(answeredInRound < roundID)
            revert RoundIDOutdated();

        return price;
    }

    /** @notice Lookup target VaultFactory address
      * @dev need to find way to express typecasts in NatSpec
      */
    function getVaultFactory() external view returns (address) {
        return address(vaultFactory);
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EpochExpired","type":"error"},{"inputs":[],"name":"EpochFinishedAlready","type":"error"},{"inputs":[],"name":"EpochNotExist","type":"error"},{"inputs":[],"name":"EpochNotExpired","type":"error"},{"inputs":[],"name":"EpochNotStarted","type":"error"},{"inputs":[],"name":"GracePeriodNotOver","type":"error"},{"inputs":[{"internalType":"uint256","name":"marketId","type":"uint256"}],"name":"MarketDoesNotExist","type":"error"},{"inputs":[],"name":"OraclePriceZero","type":"error"},{"inputs":[{"internalType":"int256","name":"price","type":"int256"}],"name":"PriceNotAtStrikePrice","type":"error"},{"inputs":[],"name":"RoundIDOutdated","type":"error"},{"inputs":[],"name":"SequencerDown","type":"error"},{"inputs":[],"name":"VaultNotZeroTVL","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"epochMarketID","type":"bytes32"},{"components":[{"internalType":"uint256","name":"RISK_claimTVL","type":"uint256"},{"internalType":"uint256","name":"RISK_finalTVL","type":"uint256"},{"internalType":"uint256","name":"INSR_claimTVL","type":"uint256"},{"internalType":"uint256","name":"INSR_finalTVL","type":"uint256"}],"indexed":false,"internalType":"struct Controller.VaultTVL","name":"tvl","type":"tuple"},{"indexed":false,"internalType":"bool","name":"isDisaster","type":"bool"},{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"int256","name":"depegPrice","type":"int256"}],"name":"DepegInsurance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"epochMarketID","type":"bytes32"},{"components":[{"internalType":"uint256","name":"RISK_claimTVL","type":"uint256"},{"internalType":"uint256","name":"RISK_finalTVL","type":"uint256"},{"internalType":"uint256","name":"INSR_claimTVL","type":"uint256"},{"internalType":"uint256","name":"INSR_finalTVL","type":"uint256"}],"indexed":false,"internalType":"struct Controller.VaultTVL","name":"tvl","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"NullEpoch","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getLatestPrice","outputs":[{"internalType":"int256","name":"nowPrice","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"marketIndex","type":"uint256"},{"internalType":"uint256","name":"epochEnd","type":"uint256"}],"name":"triggerDepeg","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"marketIndex","type":"uint256"},{"internalType":"uint256","name":"epochEnd","type":"uint256"}],"name":"triggerEndEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"marketIndex","type":"uint256"},{"internalType":"uint256","name":"epochEnd","type":"uint256"}],"name":"triggerNullEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultFactory","outputs":[{"internalType":"contract VaultFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a06040523480156200001157600080fd5b5060405162002c9338038062002c9383398101604081905262000034916200006e565b6001600160a01b0381166200005c5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0316608052620000a0565b6000602082840312156200008157600080fd5b81516001600160a01b03811681146200009957600080fd5b9392505050565b608051612bae620000e560003960008181608f015281816101070152818161014d015281816104980152818161117601528181611b200152611da60152612bae6000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806316345f181461006757806318bcb2841461008d5780632d388e61146100c7578063bcbbcfe4146100dc578063cdfd29b3146100ef578063d8a06f7314610102575b600080fd5b61007a6100753660046126a3565b610129565b6040519081526020015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b039091168152602001610084565b6100da6100d53660046126c7565b61047f565b005b6100da6100ea3660046126c7565b61115d565b6100da6100fd3660046126c7565b611d6d565b6100af7f000000000000000000000000000000000000000000000000000000000000000081565b604051639820c73360e01b81526001600160a01b03828116600483015260009182917f00000000000000000000000000000000000000000000000000000000000000001690639820c73390602401602060405180830381865afa158015610194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b891906126f9565b90506000806000836001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156101fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102219190612730565b94505050925092506012846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610269573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028d9190612780565b60ff161015610324576000846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102fa9190612780565b6103059060126127b9565b61031090600a6128c2565b905061031c81846128d1565b92505061041c565b836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610362573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103869190612780565b60ff166012031561041c5760006012856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f79190612780565b61040191906127b9565b61040c90600a6128c2565b90506104188184612956565b9250505b6000821361043d576040516315e5656b60e21b815260040160405180910390fd5b8269ffffffffffffffffffff168169ffffffffffffffffffff161015610476576040516346e8c97560e11b815260040160405180910390fd5b50949350505050565b604051630468d16d60e41b8152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063468d16d090602401600060405180830381865afa1580156104e7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261050f91908101906129a8565b905060008160008151811061052657610526612a6d565b6020026020010151905060008260018151811061054557610545612a6d565b6020026020010151905060006001600160a01b03168360008151811061056d5761056d612a6d565b60200260200101516001600160a01b031614806105b6575060006001600160a01b0316836001815181106105a3576105a3612a6d565b60200260200101516001600160a01b0316145b156105dc57604051630fff01a760e31b8152600481018690526024015b60405180910390fd5b6040516305c514ad60e11b8152600481018590526001600160a01b03831690630b8a295a90602401602060405180830381865afa158015610621573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106459190612a83565b15806106b757506040516305c514ad60e11b8152600481018590526001600160a01b03821690630b8a295a90602401602060405180830381865afa158015610691573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b59190612a83565b155b156106d55760405163167da24960e31b815260040160405180910390fd5b60405163ea859a2760e01b8152600481018590526001600160a01b0383169063ea859a2790602401602060405180830381865afa15801561071a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073e9190612aa5565b42101561075e576040516333e7d47160e11b815260040160405180910390fd5b6040516305c514ad60e11b8152600481018590526001600160a01b03831690630b8a295a90602401602060405180830381865afa1580156107a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c79190612a83565b158061083957506040516305c514ad60e11b8152600481018590526001600160a01b03821690630b8a295a90602401602060405180830381865afa158015610813573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108379190612a83565b155b156108575760405163167da24960e31b815260040160405180910390fd5b604051630b6e8f8960e01b8152600481018590526001600160a01b03831690630b6e8f8990602401602060405180830381865afa15801561089c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c09190612a83565b156108de576040516384938d9f60e01b815260040160405180910390fd5b604051630b6e8f8960e01b8152600481018590526001600160a01b03821690630b6e8f8990602401602060405180830381865afa158015610923573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109479190612a83565b15610965576040516384938d9f60e01b815260040160405180910390fd5b604051639460585760e01b8152600481018590526001600160a01b03831690639460585790602401602060405180830381865afa1580156109aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ce9190612aa5565b600003610c1357604051636164e45d60e01b8152600481018590526001600160a01b03831690636164e45d90602401600060405180830381600087803b158015610a1757600080fd5b505af1158015610a2b573d6000803e3d6000fd5b5050604051636164e45d60e01b8152600481018790526001600160a01b0384169250636164e45d9150602401600060405180830381600087803b158015610a7157600080fd5b505af1158015610a85573d6000803e3d6000fd5b5050604051633e04836560e01b815260048101879052600060248201526001600160a01b0385169250633e0483659150604401600060405180830381600087803b158015610ad257600080fd5b505af1158015610ae6573d6000803e3d6000fd5b505060405163f9db242760e01b8152600481018790526001600160a01b0384169250633e04836591508690839063f9db242790602401602060405180830381865afa158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d9190612aa5565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b158015610b9b57600080fd5b505af1158015610baf573d6000803e3d6000fd5b5050604051632b56f83160e21b8152600481018790526001600160a01b038416925063ad5be0c491506024015b600060405180830381600087803b158015610bf657600080fd5b505af1158015610c0a573d6000803e3d6000fd5b50505050610ea7565b604051639460585760e01b8152600481018590526001600160a01b03821690639460585790602401602060405180830381865afa158015610c58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7c9190612aa5565b600003610e8e57604051636164e45d60e01b8152600481018590526001600160a01b03831690636164e45d90602401600060405180830381600087803b158015610cc557600080fd5b505af1158015610cd9573d6000803e3d6000fd5b5050604051636164e45d60e01b8152600481018790526001600160a01b0384169250636164e45d9150602401600060405180830381600087803b158015610d1f57600080fd5b505af1158015610d33573d6000803e3d6000fd5b505060405163f9db242760e01b8152600481018790526001600160a01b0385169250633e04836591508690839063f9db242790602401602060405180830381865afa158015610d86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610daa9190612aa5565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b5050604051633e04836560e01b815260048101879052600060248201526001600160a01b0384169250633e0483659150604401600060405180830381600087803b158015610e4957600080fd5b505af1158015610e5d573d6000803e3d6000fd5b5050604051632b56f83160e21b8152600481018790526001600160a01b038516925063ad5be0c49150602401610bdc565b60405163e077d61f60e01b815260040160405180910390fd5b604080516080810191829052634d288ba760e01b90915260848101859052600090806001600160a01b038416634d288ba760a48301602060405180830381865afa158015610ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1d9190612aa5565b8152602001836001600160a01b031663f9db2427886040518263ffffffff1660e01b8152600401610f5091815260200190565b602060405180830381865afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612aa5565b8152602001846001600160a01b0316634d288ba7886040518263ffffffff1660e01b8152600401610fc491815260200190565b602060405180830381865afa158015610fe1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110059190612aa5565b8152602001846001600160a01b031663f9db2427886040518263ffffffff1660e01b815260040161103891815260200190565b602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110799190612aa5565b905260405163ea859a2760e01b8152600481018790529091507f81bee92f7b15f62842e0b331896cec495f23c68126e3c1681aff439f945072c99087906001600160a01b0386169063ea859a2790602401602060405180830381865afa1580156110e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110b9190612aa5565b604080516020810193909352820152606081018790526080016040516020818303038152906040528051906020012082874260405161114d9493929190612abe565b60405180910390a1505050505050565b604051630468d16d60e41b8152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063468d16d090602401600060405180830381865afa1580156111c5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111ed91908101906129a8565b905060008160008151811061120457611204612a6d565b6020026020010151905060008260018151811061122357611223612a6d565b6020026020010151905060006001600160a01b03168360008151811061124b5761124b612a6d565b60200260200101516001600160a01b03161480611294575060006001600160a01b03168360018151811061128157611281612a6d565b60200260200101516001600160a01b0316145b156112b557604051630fff01a760e31b8152600481018690526024016105d3565b6040516305c514ad60e11b8152600481018590526001600160a01b03831690630b8a295a90602401602060405180830381865afa1580156112fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131e9190612a83565b15156000036113405760405163167da24960e31b815260040160405180910390fd5b6113a5826001600160a01b03166304da1a466040518163ffffffff1660e01b8152600401602060405180830381865afa158015611381573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061007591906126f9565b826001600160a01b031663c52987cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114079190612aa5565b136114695761144d826001600160a01b03166304da1a466040518163ffffffff1660e01b8152600401602060405180830381865afa158015611381573d6000803e3d6000fd5b604051632067f80160e21b81526004016105d391815260200190565b60405163ea859a2760e01b81526004810185905242906001600160a01b0384169063ea859a2790602401602060405180830381865afa1580156114b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d49190612aa5565b11156114f3576040516333e7d47160e11b815260040160405180910390fd5b834211156115145760405163f3708ccf60e01b815260040160405180910390fd5b604051630b6e8f8960e01b8152600481018590526001600160a01b03831690630b6e8f8990602401602060405180830381865afa158015611559573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157d9190612a83565b1561159b576040516384938d9f60e01b815260040160405180910390fd5b604051630b6e8f8960e01b8152600481018590526001600160a01b03821690630b6e8f8990602401602060405180830381865afa1580156115e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116049190612a83565b15611622576040516384938d9f60e01b815260040160405180910390fd5b604051636164e45d60e01b8152600481018590526001600160a01b03831690636164e45d90602401600060405180830381600087803b15801561166457600080fd5b505af1158015611678573d6000803e3d6000fd5b5050604051636164e45d60e01b8152600481018790526001600160a01b0384169250636164e45d9150602401600060405180830381600087803b1580156116be57600080fd5b505af11580156116d2573d6000803e3d6000fd5b50505050816001600160a01b0316633e04836585836001600160a01b031663f9db2427886040518263ffffffff1660e01b815260040161171491815260200190565b602060405180830381865afa158015611731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117559190612aa5565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b15801561179357600080fd5b505af11580156117a7573d6000803e3d6000fd5b50505050806001600160a01b0316633e04836585846001600160a01b031663f9db2427886040518263ffffffff1660e01b81526004016117e991815260200190565b602060405180830381865afa158015611806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182a9190612aa5565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b15801561186857600080fd5b505af115801561187c573d6000803e3d6000fd5b50506040516329322e0560e01b8152600481018790526001600160a01b038481166024830152851692506329322e059150604401600060405180830381600087803b1580156118ca57600080fd5b505af11580156118de573d6000803e3d6000fd5b50506040516329322e0560e01b8152600481018790526001600160a01b038581166024830152841692506329322e059150604401600060405180830381600087803b15801561192c57600080fd5b505af1158015611940573d6000803e3d6000fd5b5050604080516080810191829052634d288ba760e01b90915260848101879052600092509050806001600160a01b038416634d288ba760a48301602060405180830381865afa158015611997573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119bb9190612aa5565b8152602001836001600160a01b031663f9db2427886040518263ffffffff1660e01b81526004016119ee91815260200190565b602060405180830381865afa158015611a0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2f9190612aa5565b8152602001846001600160a01b0316634d288ba7886040518263ffffffff1660e01b8152600401611a6291815260200190565b602060405180830381865afa158015611a7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa39190612aa5565b8152602001846001600160a01b031663f9db2427886040518263ffffffff1660e01b8152600401611ad691815260200190565b602060405180830381865afa158015611af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b179190612aa5565b815250905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639820c733856001600160a01b03166304da1a466040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611baf91906126f9565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1791906126f9565b90506000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611c59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7d9190612730565b5050509150507f4c48fdcd7e3cb84b81aa54aa5dd04105736ae1bc179d84611c6fa5a642e803f288866001600160a01b031663ea859a278a6040518263ffffffff1660e01b8152600401611cd391815260200190565b602060405180830381865afa158015611cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d149190612aa5565b60408051602081019390935282015260608101899052608001604051602081830303815290604052805190602001208460018a4286604051611d5b96959493929190612b05565b60405180910390a15050505050505050565b804211611d8d576040516373593a9960e01b815260040160405180910390fd5b604051630468d16d60e41b8152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063468d16d090602401600060405180830381865afa158015611df5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e1d91908101906129a8565b9050600081600081518110611e3457611e34612a6d565b60200260200101519050600082600181518110611e5357611e53612a6d565b6020026020010151905060006001600160a01b031683600081518110611e7b57611e7b612a6d565b60200260200101516001600160a01b03161480611ec4575060006001600160a01b031683600181518110611eb157611eb1612a6d565b60200260200101516001600160a01b0316145b15611ee557604051630fff01a760e31b8152600481018690526024016105d3565b6040516305c514ad60e11b8152600481018590526001600160a01b03831690630b8a295a90602401602060405180830381865afa158015611f2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f4e9190612a83565b1580611fc057506040516305c514ad60e11b8152600481018590526001600160a01b03821690630b8a295a90602401602060405180830381865afa158015611f9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fbe9190612a83565b155b15611fde5760405163167da24960e31b815260040160405180910390fd5b604051630b6e8f8960e01b8152600481018590526001600160a01b03831690630b6e8f8990602401602060405180830381865afa158015612023573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120479190612a83565b15612065576040516384938d9f60e01b815260040160405180910390fd5b604051630b6e8f8960e01b8152600481018590526001600160a01b03821690630b6e8f8990602401602060405180830381865afa1580156120aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ce9190612a83565b156120ec576040516384938d9f60e01b815260040160405180910390fd5b604051636164e45d60e01b8152600481018590526001600160a01b03831690636164e45d90602401600060405180830381600087803b15801561212e57600080fd5b505af1158015612142573d6000803e3d6000fd5b5050604051636164e45d60e01b8152600481018790526001600160a01b0384169250636164e45d9150602401600060405180830381600087803b15801561218857600080fd5b505af115801561219c573d6000803e3d6000fd5b5050604051633e04836560e01b815260048101879052600060248201526001600160a01b0385169250633e0483659150604401600060405180830381600087803b1580156121e957600080fd5b505af11580156121fd573d6000803e3d6000fd5b505060405163f9db242760e01b8152600481018790526001600160a01b0384169250633e04836591508690839063f9db242790602401602060405180830381865afa158015612250573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122749190612aa5565b60405163f9db242760e01b8152600481018990526001600160a01b0387169063f9db242790602401602060405180830381865afa1580156122b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122dd9190612aa5565b6122e79190612b60565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381600087803b15801561232557600080fd5b505af1158015612339573d6000803e3d6000fd5b50506040516329322e0560e01b8152600481018790526001600160a01b038481166024830152851692506329322e059150604401600060405180830381600087803b15801561238757600080fd5b505af115801561239b573d6000803e3d6000fd5b5050604080516080810191829052634d288ba760e01b90915260848101879052600092509050806001600160a01b038416634d288ba760a48301602060405180830381865afa1580156123f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124169190612aa5565b8152602001836001600160a01b031663f9db2427886040518263ffffffff1660e01b815260040161244991815260200190565b602060405180830381865afa158015612466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248a9190612aa5565b8152602001846001600160a01b0316634d288ba7886040518263ffffffff1660e01b81526004016124bd91815260200190565b602060405180830381865afa1580156124da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124fe9190612aa5565b8152602001846001600160a01b031663f9db2427886040518263ffffffff1660e01b815260040161253191815260200190565b602060405180830381865afa15801561254e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125729190612aa5565b905260405163ea859a2760e01b8152600481018790529091507f4c48fdcd7e3cb84b81aa54aa5dd04105736ae1bc179d84611c6fa5a642e803f29087906001600160a01b0386169063ea859a2790602401602060405180830381865afa1580156125e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126049190612aa5565b60408051602081019390935282015260608101879052608001604051602081830303815290604052805190602001208260008842612679896001600160a01b03166304da1a466040518163ffffffff1660e01b8152600401602060405180830381865afa158015611381573d6000803e3d6000fd5b60405161114d96959493929190612b05565b6001600160a01b03811681146126a057600080fd5b50565b6000602082840312156126b557600080fd5b81356126c08161268b565b9392505050565b600080604083850312156126da57600080fd5b50508035926020909101359150565b80516126f48161268b565b919050565b60006020828403121561270b57600080fd5b81516126c08161268b565b805169ffffffffffffffffffff811681146126f457600080fd5b600080600080600060a0868803121561274857600080fd5b61275186612716565b945060208601519350604086015192506060860151915061277460808701612716565b90509295509295909350565b60006020828403121561279257600080fd5b815160ff811681146126c057600080fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8416808210156127d3576127d36127a3565b90039392505050565b600181815b808511156128175781600019048211156127fd576127fd6127a3565b8085161561280a57918102915b93841c93908002906127e1565b509250929050565b60008261282e575060016128bc565b8161283b575060006128bc565b8160018114612851576002811461285b57612877565b60019150506128bc565b60ff84111561286c5761286c6127a3565b50506001821b6128bc565b5060208310610133831016604e8410600b841016171561289a575081810a6128bc565b6128a483836127dc565b80600019048211156128b8576128b86127a3565b0290505b92915050565b60006126c060ff84168361281f565b60006001600160ff1b03818413828413808216868404861116156128f7576128f76127a3565b600160ff1b6000871282811687830589121615612916576129166127a3565b60008712925087820587128484161615612932576129326127a3565b87850587128184161615612948576129486127a3565b505050929093029392505050565b60008261297357634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561298d5761298d6127a3565b500590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156129bb57600080fd5b825167ffffffffffffffff808211156129d357600080fd5b818501915085601f8301126129e757600080fd5b8151818111156129f9576129f9612992565b8060051b604051601f19603f83011681018181108582111715612a1e57612a1e612992565b604052918252848201925083810185019188831115612a3c57600080fd5b938501935b82851015612a6157612a52856126e9565b84529385019392850192612a41565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612a9557600080fd5b815180151581146126c057600080fd5b600060208284031215612ab757600080fd5b5051919050565b84815260e08101612af36020830186805182526020810151602083015260408101516040830152606081015160608301525050565b60a082019390935260c0015292915050565b8681526101208101612b3b6020830188805182526020810151602083015260408101516040830152606081015160608301525050565b94151560a082015260c081019390935260e08301919091526101009091015292915050565b60008219821115612b7357612b736127a3565b50019056fea26469706673582212203cfa92cd0c2ee2ed1f4f29202f304ec7ea86b4d874a4276db1df069741ed18ef64736f6c634300080f00330000000000000000000000009df9d91382d38c230214c7d2b959e29ed5bc513b

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

0000000000000000000000009df9d91382d38c230214c7d2b959e29ed5bc513b

-----Decoded View---------------
Arg [0] : _factory (address): 0x9df9d91382d38c230214c7d2b959e29ed5bc513b

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000009df9d91382d38c230214c7d2b959e29ed5bc513b


Deployed ByteCode Sourcemap

97885:11090:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;107735:998;;;;;;:::i;:::-;;:::i;:::-;;;546:25:1;;;534:2;519:18;107735:998:0;;;;;;;;108866:106;108951:12;108866:106;;;-1:-1:-1;;;;;746:32:1;;;728:51;;716:2;701:18;108866:106:0;582:203:1;105033:2377:0;;;;;;:::i;:::-;;:::i;:::-;;100349:2462;;;;;;:::i;:::-;;:::i;102985:1867::-;;;;;;:::i;:::-;;:::i;97912:42::-;;;;;107735:998;107928:34;;-1:-1:-1;;;107928:34:0;;-1:-1:-1;;;;;746:32:1;;;107928:34:0;;;728:51:1;107823:15:0;;;;107928:12;:26;;;;701:18:1;;107928:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;107858:115;;107999:14;108028:12;108085:22;108121:9;-1:-1:-1;;;;;108121:25:0;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;107984:164;;;;;;;;108195:2;108172:9;-1:-1:-1;;;;;108172:18:0;;:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:25;;;108169:377;;;108213:16;108241:9;-1:-1:-1;;;;;108241:18:0;;:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;108237:25;;:2;:25;:::i;:::-;108232:31;;:2;:31;:::i;:::-;108213:50;-1:-1:-1;108286:24:0;108213:50;108286:5;:24;:::i;:::-;108278:32;;108198:124;108169:377;;;108341:9;-1:-1:-1;;;;;108341:18:0;;:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:26;;108365:2;108341:26;108337:209;;;108437:16;108483:2;108462:9;-1:-1:-1;;;;;108462:18:0;;:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:23;;;;:::i;:::-;108456:31;;:2;:31;:::i;:::-;108437:50;-1:-1:-1;108510:24:0;108437:50;108510:5;:24;:::i;:::-;108502:32;;108422:124;108337:209;108580:1;108571:5;:10;108568:52;;108603:17;;-1:-1:-1;;;108603:17:0;;;;;;;;;;;108568:52;108654:7;108636:25;;:15;:25;;;108633:67;;;108683:17;;-1:-1:-1;;;108683:17:0;;;;;;;;;;;108633:67;-1:-1:-1;108720:5:0;107735:998;-1:-1:-1;;;;107735:998:0:o;105033:2377::-;105149:35;;-1:-1:-1;;;105149:35:0;;;;;546:25:1;;;105116:30:0;;105149:12;-1:-1:-1;;;;;105149:22:0;;;;519:18:1;;105149:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;105149:35:0;;;;;;;;;;;;:::i;:::-;105116:68;;105197:15;105221:13;105235:1;105221:16;;;;;;;;:::i;:::-;;;;;;;105197:41;;105249:15;105273:13;105287:1;105273:16;;;;;;;;:::i;:::-;;;;;;;105249:41;;105348:1;-1:-1:-1;;;;;105320:30:0;:13;105334:1;105320:16;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;105320:30:0;;:64;;;;105382:1;-1:-1:-1;;;;;105354:30:0;:13;105368:1;105354:16;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;105354:30:0;;105320:64;105303:148;;;105420:31;;-1:-1:-1;;;105420:31:0;;;;;546:25:1;;;519:18;;105420:31:0;;;;;;;;105303:148;105467:28;;-1:-1:-1;;;105467:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;105467:18:0;;;;;519::1;;105467:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:37;;:78;;-1:-1:-1;105508:28:0;;-1:-1:-1;;;105508:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;105508:18:0;;;;;519::1;;105508:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:37;105467:78;105464:118;;;105567:15;;-1:-1:-1;;;105567:15:0;;;;;;;;;;;105464:118;105616:32;;-1:-1:-1;;;105616:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;105616:22:0;;;;;519:18:1;;105616:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;105598:15;:50;105595:92;;;105670:17;;-1:-1:-1;;;105670:17:0;;;;;;;;;;;105595:92;105703:28;;-1:-1:-1;;;105703:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;105703:18:0;;;;;519::1;;105703:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:37;;:78;;-1:-1:-1;105744:28:0;;-1:-1:-1;;;105744:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;105744:18:0;;;;;519::1;;105744:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:37;105703:78;105700:118;;;105803:15;;-1:-1:-1;;;105803:15:0;;;;;;;;;;;105700:118;105927:32;;-1:-1:-1;;;105927:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;105927:22:0;;;;;519:18:1;;105927:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;105924:79;;;105981:22;;-1:-1:-1;;;105981:22:0;;;;;;;;;;;105924:79;106017:32;;-1:-1:-1;;;106017:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;106017:22:0;;;;;519:18:1;;106017:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106014:80;;;106072:22;;-1:-1:-1;;;106072:22:0;;;;;;;;;;;106014:80;106162:31;;-1:-1:-1;;;106162:31:0;;;;;546:25:1;;;-1:-1:-1;;;;;106162:21:0;;;;;519:18:1;;106162:31:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106197:1;106162:36;106159:687;;106214:28;;-1:-1:-1;;;106214:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;106214:18:0;;;;;519::1;;106214:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;106257:28:0;;-1:-1:-1;;;106257:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;106257:18:0;;;-1:-1:-1;106257:18:0;;-1:-1:-1;519:18:1;;106257:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;106302:34:0;;-1:-1:-1;;;106302:34:0;;;;;7412:25:1;;;106334:1:0;7453:18:1;;;7446:34;-1:-1:-1;;;;;106302:21:0;;;-1:-1:-1;106302:21:0;;-1:-1:-1;7385:18:1;;106302:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;106383:30:0;;-1:-1:-1;;;106383:30:0;;;;;546:25:1;;;-1:-1:-1;;;;;106351:21:0;;;-1:-1:-1;106351:21:0;;-1:-1:-1;106373:8:0;;106351:21;;106383:20;;519:18:1;;106383:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106351:63;;-1:-1:-1;;;;;;106351:63:0;;;;;;;;;;7412:25:1;;;;7453:18;;;7446:34;7385:18;;106351:63:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;106431:32:0;;-1:-1:-1;;;106431:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;106431:22:0;;;-1:-1:-1;106431:22:0;;-1:-1:-1;519:18:1;;106431:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;106159:687;;;106493:31;;-1:-1:-1;;;106493:31:0;;;;;546:25:1;;;-1:-1:-1;;;;;106493:21:0;;;;;519:18:1;;106493:31:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106528:1;106493:36;106490:356;;106545:28;;-1:-1:-1;;;106545:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;106545:18:0;;;;;519::1;;106545:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;106588:28:0;;-1:-1:-1;;;106588:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;106588:18:0;;;-1:-1:-1;106588:18:0;;-1:-1:-1;519:18:1;;106588:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;106665:30:0;;-1:-1:-1;;;106665:30:0;;;;;546:25:1;;;-1:-1:-1;;;;;106633:21:0;;;-1:-1:-1;106633:21:0;;-1:-1:-1;106655:8:0;;106633:21;;106665:20;;519:18:1;;106665:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106633:64;;-1:-1:-1;;;;;;106633:64:0;;;;;;;;;;7412:25:1;;;;7453:18;;;7446:34;7385:18;;106633:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;106712:34:0;;-1:-1:-1;;;106712:34:0;;;;;7412:25:1;;;106744:1:0;7453:18:1;;;7446:34;-1:-1:-1;;;;;106712:21:0;;;-1:-1:-1;106712:21:0;;-1:-1:-1;7385:18:1;;106712:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;106763:32:0;;-1:-1:-1;;;106763:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;106763:22:0;;;-1:-1:-1;106763:22:0;;-1:-1:-1;519:18:1;;106763:32:0;402:175:1;106490:356:0;106829:17;;-1:-1:-1;;;106829:17:0;;;;;;;;;;;106490:356;106881:199;;;;;;;;;;-1:-1:-1;;;106904:30:0;;;;;;546:25:1;;;-1:-1:-1;;106881:199:0;-1:-1:-1;;;;;106904:20:0;;;519:18:1;;;106904:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106881:199;;;;106949:9;-1:-1:-1;;;;;106949:20:0;;106970:8;106949:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;106949:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106881:199;;;;106994:9;-1:-1:-1;;;;;106994:20:0;;107015:8;106994:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;106994:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106881:199;;;;107039:9;-1:-1:-1;;;;;107039:20:0;;107060:8;107039:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;107039:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;106881:199;;107223:32;;-1:-1:-1;;;107223:32:0;;;;;546:25:1;;;106859:221:0;;-1:-1:-1;107098:304:0;;107189:11;;-1:-1:-1;;;;;107223:22:0;;;;;519:18:1;;107223:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;107150:155;;;;;;7929:19:1;;;;7964:12;;7957:28;8001:12;;;7994:28;;;8038:12;;107150:155:0;;;;;;;;;;;;107122:198;;;;;;107335:3;107353:8;107376:15;107098:304;;;;;;;;;:::i;:::-;;;;;;;;105105:2305;;;;105033:2377;;:::o;100349:2462::-;100475:35;;-1:-1:-1;;;100475:35:0;;;;;546:25:1;;;100442:30:0;;100475:12;-1:-1:-1;;;;;100475:22:0;;;;519:18:1;;100475:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;100475:35:0;;;;;;;;;;;;:::i;:::-;100442:68;;100521:15;100545:13;100559:1;100545:16;;;;;;;;:::i;:::-;;;;;;;100521:41;;100573:15;100597:13;100611:1;100597:16;;;;;;;;:::i;:::-;;;;;;;100573:41;;100672:1;-1:-1:-1;;;;;100644:30:0;:13;100658:1;100644:16;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;100644:30:0;;:64;;;;100706:1;-1:-1:-1;;;;;100678:30:0;:13;100692:1;100678:16;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;100678:30:0;;100644:64;100627:148;;;100744:31;;-1:-1:-1;;;100744:31:0;;;;;546:25:1;;;519:18;;100744:31:0;402:175:1;100627:148:0;100791:28;;-1:-1:-1;;;100791:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;100791:18:0;;;;;519::1;;100791:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:37;;100823:5;100791:37;100788:77;;100850:15;;-1:-1:-1;;;100850:15:0;;;;;;;;;;;100788:77;100922:40;100937:9;-1:-1:-1;;;;;100937:22:0;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;100922:40::-;100895:9;-1:-1:-1;;;;;100895:21:0;;:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:67;100878:183;;101020:40;101035:9;-1:-1:-1;;;;;101035:22:0;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;101020:40;100998:63;;-1:-1:-1;;;100998:63:0;;;;;;546:25:1;;534:2;519:18;;402:175;100878:183:0;101091:32;;-1:-1:-1;;;101091:32:0;;;;;546:25:1;;;101126:15:0;;-1:-1:-1;;;;;101091:22:0;;;;;519:18:1;;101091:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:50;101074:106;;;101163:17;;-1:-1:-1;;;101163:17:0;;;;;;;;;;;101074:106;101228:8;101210:15;:26;101193:93;;;101272:14;;-1:-1:-1;;;101272:14:0;;;;;;;;;;;101193:93;101395:32;;-1:-1:-1;;;101395:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;101395:22:0;;;;;519:18:1;;101395:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;101392:79;;;101449:22;;-1:-1:-1;;;101449:22:0;;;;;;;;;;;101392:79;101485:32;;-1:-1:-1;;;101485:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;101485:22:0;;;;;519:18:1;;101485:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;101482:80;;;101540:22;;-1:-1:-1;;;101540:22:0;;;;;;;;;;;101482:80;101575:28;;-1:-1:-1;;;101575:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;101575:18:0;;;;;519::1;;101575:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;101614:28:0;;-1:-1:-1;;;101614:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;101614:18:0;;;-1:-1:-1;101614:18:0;;-1:-1:-1;519:18:1;;101614:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;101655:9;-1:-1:-1;;;;;101655:21:0;;101677:8;101687:9;-1:-1:-1;;;;;101687:20:0;;101708:8;101687:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;101687:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;101655:63;;-1:-1:-1;;;;;;101655:63:0;;;;;;;;;;7412:25:1;;;;7453:18;;;7446:34;7385:18;;101655:63:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;101729:9;-1:-1:-1;;;;;101729:21:0;;101751:8;101761:9;-1:-1:-1;;;;;101761:20:0;;101782:8;101761:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;101761:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;101729:63;;-1:-1:-1;;;;;;101729:63:0;;;;;;;;;;7412:25:1;;;;7453:18;;;7446:34;7385:18;;101729:63:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;101805:50:0;;-1:-1:-1;;;101805:50:0;;;;;9159:25:1;;;-1:-1:-1;;;;;9220:32:1;;;9200:18;;;9193:60;101805:20:0;;;-1:-1:-1;101805:20:0;;-1:-1:-1;9132:18:1;;101805:50:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;101866:50:0;;-1:-1:-1;;;101866:50:0;;;;;9159:25:1;;;-1:-1:-1;;;;;9220:32:1;;;9200:18;;;9193:60;101866:20:0;;;-1:-1:-1;101866:20:0;;-1:-1:-1;9132:18:1;;101866:50:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;101951:199:0;;;;;;;;;;-1:-1:-1;;;101974:30:0;;;;;;546:25:1;;;-1:-1:-1;;;101951:199:0;-1:-1:-1;101951:199:0;-1:-1:-1;;;;;101974:20:0;;;519:18:1;;;101974:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;101951:199;;;;102019:9;-1:-1:-1;;;;;102019:20:0;;102040:8;102019:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;102019:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;101951:199;;;;102064:9;-1:-1:-1;;;;;102064:20:0;;102085:8;102064:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;102064:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;101951:199;;;;102109:9;-1:-1:-1;;;;;102109:20:0;;102130:8;102109:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;102109:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;101951:199;;;101929:221;;102163:31;102233:12;-1:-1:-1;;;;;102233:26:0;;102260:9;-1:-1:-1;;;;;102260:22:0;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;102233:52;;-1:-1:-1;;;;;;102233:52:0;;;;;;;-1:-1:-1;;;;;746:32:1;;;102233:52:0;;;728:51:1;701:18;;102233:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;102163:133;;102339:12;102410:9;-1:-1:-1;;;;;102410:25:0;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;102307:130;;;;;;102455:348;102551:11;102585:9;-1:-1:-1;;;;;102585:22:0;;102608:8;102585:32;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;102585:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;102512:155;;;;;;7929:19:1;;;;7964:12;;7957:28;8001:12;;;7994:28;;;8038:12;;102512:155:0;;;;;;;;;;;;102484:198;;;;;;102697:3;102715:4;102734:8;102757:15;102787:5;102455:348;;;;;;;;;;;:::i;:::-;;;;;;;;100431:2380;;;;;;100349:2462;;:::o;102985:1867::-;103103:8;103084:15;:27;103067:83;;103133:17;;-1:-1:-1;;;103133:17:0;;;;;;;;;;;103067:83;103196:35;;-1:-1:-1;;;103196:35:0;;;;;546:25:1;;;103163:30:0;;103196:12;-1:-1:-1;;;;;103196:22:0;;;;519:18:1;;103196:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;103196:35:0;;;;;;;;;;;;:::i;:::-;103163:68;;103244:15;103268:13;103282:1;103268:16;;;;;;;;:::i;:::-;;;;;;;103244:41;;103296:15;103320:13;103334:1;103320:16;;;;;;;;:::i;:::-;;;;;;;103296:41;;103403:1;-1:-1:-1;;;;;103375:30:0;:13;103389:1;103375:16;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;103375:30:0;;:64;;;;103437:1;-1:-1:-1;;;;;103409:30:0;:13;103423:1;103409:16;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;103409:30:0;;103375:64;103358:148;;;103475:31;;-1:-1:-1;;;103475:31:0;;;;;546:25:1;;;519:18;;103475:31:0;402:175:1;103358:148:0;103522:28;;-1:-1:-1;;;103522:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;103522:18:0;;;;;519::1;;103522:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:37;;:78;;-1:-1:-1;103563:28:0;;-1:-1:-1;;;103563:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;103563:18:0;;;;;519::1;;103563:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:37;103522:78;103519:118;;;103622:15;;-1:-1:-1;;;103622:15:0;;;;;;;;;;;103519:118;103746:32;;-1:-1:-1;;;103746:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;103746:22:0;;;;;519:18:1;;103746:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;103743:79;;;103800:22;;-1:-1:-1;;;103800:22:0;;;;;;;;;;;103743:79;103836:32;;-1:-1:-1;;;103836:32:0;;;;;546:25:1;;;-1:-1:-1;;;;;103836:22:0;;;;;519:18:1;;103836:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;103833:80;;;103891:22;;-1:-1:-1;;;103891:22:0;;;;;;;;;;;103833:80;103926:28;;-1:-1:-1;;;103926:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;103926:18:0;;;;;519::1;;103926:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;103965:28:0;;-1:-1:-1;;;103965:28:0;;;;;546:25:1;;;-1:-1:-1;;;;;103965:18:0;;;-1:-1:-1;103965:18:0;;-1:-1:-1;519:18:1;;103965:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;104006:34:0;;-1:-1:-1;;;104006:34:0;;;;;7412:25:1;;;104038:1:0;7453:18:1;;;7446:34;-1:-1:-1;;;;;104006:21:0;;;-1:-1:-1;104006:21:0;;-1:-1:-1;7385:18:1;;104006:34:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;104116:30:0;;-1:-1:-1;;;104116:30:0;;;;;546:25:1;;;-1:-1:-1;;;;;104051:21:0;;;-1:-1:-1;104051:21:0;;-1:-1:-1;104073:8:0;;104051:21;;104116:20;;519:18:1;;104116:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;104083;;-1:-1:-1;;;104083:30:0;;;;;546:25:1;;;-1:-1:-1;;;;;104083:20:0;;;;;519:18:1;;104083:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:63;;;;:::i;:::-;104051:96;;-1:-1:-1;;;;;;104051:96:0;;;;;;;;;;7412:25:1;;;;7453:18;;;7446:34;7385:18;;104051:96:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;104158:50:0;;-1:-1:-1;;;104158:50:0;;;;;9159:25:1;;;-1:-1:-1;;;;;9220:32:1;;;9200:18;;;9193:60;104158:20:0;;;-1:-1:-1;104158:20:0;;-1:-1:-1;9132:18:1;;104158:50:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;104243:199:0;;;;;;;;;;-1:-1:-1;;;104266:30:0;;;;;;546:25:1;;;-1:-1:-1;;;104243:199:0;-1:-1:-1;104243:199:0;-1:-1:-1;;;;;104266:20:0;;;519:18:1;;;104266:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;104243:199;;;;104311:9;-1:-1:-1;;;;;104311:20:0;;104332:8;104311:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;104311:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;104243:199;;;;104356:9;-1:-1:-1;;;;;104356:20:0;;104377:8;104356:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;104356:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;104243:199;;;;104401:9;-1:-1:-1;;;;;104401:20:0;;104422:8;104401:30;;;;;;;;;;;;;546:25:1;;534:2;519:18;;402:175;104401:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;104243:199;;104590:32;;-1:-1:-1;;;104590:32:0;;;;;546:25:1;;;104221:221:0;;-1:-1:-1;104460:384:0;;104556:11;;-1:-1:-1;;;;;104590:22:0;;;;;519:18:1;;104590:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;104517:155;;;;;;7929:19:1;;;;7964:12;;7957:28;8001:12;;;7994:28;;;8038:12;;104517:155:0;;;;;;;;;;;;104489:198;;;;;;104702:3;104720:5;104740:8;104763:15;104793:40;104808:9;-1:-1:-1;;;;;104808:22:0;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;104793:40;104460:384;;;;;;;;;;;:::i;14:131:1:-;-1:-1:-1;;;;;89:31:1;;79:42;;69:70;;135:1;132;125:12;69:70;14:131;:::o;150:247::-;209:6;262:2;250:9;241:7;237:23;233:32;230:52;;;278:1;275;268:12;230:52;317:9;304:23;336:31;361:5;336:31;:::i;:::-;386:5;150:247;-1:-1:-1;;;150:247:1:o;790:248::-;858:6;866;919:2;907:9;898:7;894:23;890:32;887:52;;;935:1;932;925:12;887:52;-1:-1:-1;;958:23:1;;;1028:2;1013:18;;;1000:32;;-1:-1:-1;790:248:1:o;1272:138::-;1351:13;;1373:31;1351:13;1373:31;:::i;:::-;1272:138;;;:::o;1415:251::-;1485:6;1538:2;1526:9;1517:7;1513:23;1509:32;1506:52;;;1554:1;1551;1544:12;1506:52;1586:9;1580:16;1605:31;1630:5;1605:31;:::i;1671:179::-;1749:13;;1802:22;1791:34;;1781:45;;1771:73;;1840:1;1837;1830:12;1855:473;1958:6;1966;1974;1982;1990;2043:3;2031:9;2022:7;2018:23;2014:33;2011:53;;;2060:1;2057;2050:12;2011:53;2083:39;2112:9;2083:39;:::i;:::-;2073:49;;2162:2;2151:9;2147:18;2141:25;2131:35;;2206:2;2195:9;2191:18;2185:25;2175:35;;2250:2;2239:9;2235:18;2229:25;2219:35;;2273:49;2317:3;2306:9;2302:19;2273:49;:::i;:::-;2263:59;;1855:473;;;;;;;;:::o;2333:273::-;2401:6;2454:2;2442:9;2433:7;2429:23;2425:32;2422:52;;;2470:1;2467;2460:12;2422:52;2502:9;2496:16;2552:4;2545:5;2541:16;2534:5;2531:27;2521:55;;2572:1;2569;2562:12;2611:127;2672:10;2667:3;2663:20;2660:1;2653:31;2703:4;2700:1;2693:15;2727:4;2724:1;2717:15;2743:195;2781:4;2818;2815:1;2811:12;2850:4;2847:1;2843:12;2875:3;2870;2867:12;2864:38;;;2882:18;;:::i;:::-;2919:13;;;2743:195;-1:-1:-1;;;2743:195:1:o;2943:422::-;3032:1;3075:5;3032:1;3089:270;3110:7;3100:8;3097:21;3089:270;;;3169:4;3165:1;3161:6;3157:17;3151:4;3148:27;3145:53;;;3178:18;;:::i;:::-;3228:7;3218:8;3214:22;3211:55;;;3248:16;;;;3211:55;3327:22;;;;3287:15;;;;3089:270;;;3093:3;2943:422;;;;;:::o;3370:806::-;3419:5;3449:8;3439:80;;-1:-1:-1;3490:1:1;3504:5;;3439:80;3538:4;3528:76;;-1:-1:-1;3575:1:1;3589:5;;3528:76;3620:4;3638:1;3633:59;;;;3706:1;3701:130;;;;3613:218;;3633:59;3663:1;3654:10;;3677:5;;;3701:130;3738:3;3728:8;3725:17;3722:43;;;3745:18;;:::i;:::-;-1:-1:-1;;3801:1:1;3787:16;;3816:5;;3613:218;;3915:2;3905:8;3902:16;3896:3;3890:4;3887:13;3883:36;3877:2;3867:8;3864:16;3859:2;3853:4;3850:12;3846:35;3843:77;3840:159;;;-1:-1:-1;3952:19:1;;;3984:5;;3840:159;4031:34;4056:8;4050:4;4031:34;:::i;:::-;4101:6;4097:1;4093:6;4089:19;4080:7;4077:32;4074:58;;;4112:18;;:::i;:::-;4150:20;;-1:-1:-1;3370:806:1;;;;;:::o;4181:140::-;4239:5;4268:47;4309:4;4299:8;4295:19;4289:4;4268:47;:::i;4326:553::-;4365:7;-1:-1:-1;;;;;4435:9:1;;;4463;;;4488:11;;;4507:10;;;4501:17;;4484:35;4481:61;;;4522:18;;:::i;:::-;-1:-1:-1;;;4598:1:1;4591:9;;4616:11;;;4636;;;4629:19;;4612:37;4609:63;;;4652:18;;:::i;:::-;4698:1;4695;4691:9;4681:19;;4745:1;4741:2;4736:11;4733:1;4729:19;4724:2;4720;4716:11;4712:37;4709:63;;;4752:18;;:::i;:::-;4817:1;4813:2;4808:11;4805:1;4801:19;4796:2;4792;4788:11;4784:37;4781:63;;;4824:18;;:::i;:::-;-1:-1:-1;;;4864:9:1;;;;;4326:553;-1:-1:-1;;;4326:553:1:o;4884:290::-;4923:1;4949;4939:132;;4993:10;4988:3;4984:20;4981:1;4974:31;5028:4;5025:1;5018:15;5056:4;5053:1;5046:15;4939:132;-1:-1:-1;;;5087:18:1;;-1:-1:-1;;5107:13:1;;5083:38;5080:64;;;5124:18;;:::i;:::-;-1:-1:-1;5158:10:1;;4884:290::o;5361:127::-;5422:10;5417:3;5413:20;5410:1;5403:31;5453:4;5450:1;5443:15;5477:4;5474:1;5467:15;5493:1129;5588:6;5619:2;5662;5650:9;5641:7;5637:23;5633:32;5630:52;;;5678:1;5675;5668:12;5630:52;5711:9;5705:16;5740:18;5781:2;5773:6;5770:14;5767:34;;;5797:1;5794;5787:12;5767:34;5835:6;5824:9;5820:22;5810:32;;5880:7;5873:4;5869:2;5865:13;5861:27;5851:55;;5902:1;5899;5892:12;5851:55;5931:2;5925:9;5953:2;5949;5946:10;5943:36;;;5959:18;;:::i;:::-;6005:2;6002:1;5998:10;6037:2;6031:9;6100:2;6096:7;6091:2;6087;6083:11;6079:25;6071:6;6067:38;6155:6;6143:10;6140:22;6135:2;6123:10;6120:18;6117:46;6114:72;;;6166:18;;:::i;:::-;6202:2;6195:22;6252:18;;;6286:15;;;;-1:-1:-1;6328:11:1;;;6324:20;;;6356:19;;;6353:39;;;6388:1;6385;6378:12;6353:39;6412:11;;;;6432:159;6448:6;6443:3;6440:15;6432:159;;;6514:34;6544:3;6514:34;:::i;:::-;6502:47;;6465:12;;;;6569;;;;6432:159;;;6610:6;5493:1129;-1:-1:-1;;;;;;;;5493:1129:1:o;6627:127::-;6688:10;6683:3;6679:20;6676:1;6669:31;6719:4;6716:1;6709:15;6743:4;6740:1;6733:15;6759:277;6826:6;6879:2;6867:9;6858:7;6854:23;6850:32;6847:52;;;6895:1;6892;6885:12;6847:52;6927:9;6921:16;6980:5;6973:13;6966:21;6959:5;6956:32;6946:60;;7002:1;6999;6992:12;7041:184;7111:6;7164:2;7152:9;7143:7;7139:23;7135:32;7132:52;;;7180:1;7177;7170:12;7132:52;-1:-1:-1;7203:16:1;;7041:184;-1:-1:-1;7041:184:1:o;8327:465::-;8610:25;;;8597:3;8582:19;;8644:54;8694:2;8679:18;;8671:6;8141:5;8135:12;8130:3;8123:25;8197:4;8190:5;8186:16;8180:23;8173:4;8168:3;8164:14;8157:47;8253:4;8246:5;8242:16;8236:23;8229:4;8224:3;8220:14;8213:47;8309:4;8302:5;8298:16;8292:23;8285:4;8280:3;8276:14;8269:47;;;8061:261;8644:54;8729:3;8714:19;;8707:35;;;;8773:3;8758:19;8751:35;8327:465;;-1:-1:-1;;8327:465:1:o;9264:617::-;9595:25;;;9582:3;9567:19;;9629:54;9679:2;9664:18;;9656:6;8141:5;8135:12;8130:3;8123:25;8197:4;8190:5;8186:16;8180:23;8173:4;8168:3;8164:14;8157:47;8253:4;8246:5;8242:16;8236:23;8229:4;8224:3;8220:14;8213:47;8309:4;8302:5;8298:16;8292:23;8285:4;8280:3;8276:14;8269:47;;;8061:261;9629:54;9727:14;;9720:22;9714:3;9699:19;;9692:51;9774:3;9759:19;;9752:35;;;;9818:3;9803:19;;9796:35;;;;9862:3;9847:19;;;9840:35;9264:617;;-1:-1:-1;;9264:617:1:o;9886:128::-;9926:3;9957:1;9953:6;9950:1;9947:13;9944:39;;;9963:18;;:::i;:::-;-1:-1:-1;9999:9:1;;9886:128::o

Swarm Source

ipfs://3cfa92cd0c2ee2ed1f4f29202f304ec7ea86b4d874a4276db1df069741ed18ef
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.