Contract 0x9df9d91382D38c230214c7D2b959e29Ed5BC513b

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x175096465c1f1862019199a09b5b571f26a6e1dc9d9b6922c3c09c27d504e4f4Create New Marke...507906412022-11-12 17:43:44137 days 1 hr agoScarab Finance: Deployer IN  0x9df9d91382d38c230214c7d2b959e29ed5bc513b0 FTM3.61481457491
0x919ffc3458e083e25c3917d3b436834d03ebfede7821791b4a7b7a1ba5c347e0Create New Marke...507906162022-11-12 17:42:37137 days 1 hr agoScarab Finance: Deployer IN  0x9df9d91382d38c230214c7d2b959e29ed5bc513b0 FTM3.344321924587
0x34c454c1447d64fdcc9099ff4310e7d8c48039ca4c7b1c4eed62f5e2ec8655a8Create New Marke...507906122022-11-12 17:42:24137 days 1 hr agoScarab Finance: Deployer IN  0x9df9d91382d38c230214c7d2b959e29ed5bc513b0 FTM3.330335449679
0xdf61981222961ba8e9d637eb59b143ac38a642b2d16497d4906feab19694823fCreate New Marke...507905952022-11-12 17:41:48137 days 1 hr agoScarab Finance: Deployer IN  0x9df9d91382d38c230214c7d2b959e29ed5bc513b0 FTM3.362906158024
0xf18d43d6489e96a30ccf18660cd7a7b4e641cef54b0ef00340bdd37e4ce1c7d2Create New Marke...507904842022-11-12 17:36:14137 days 1 hr agoScarab Finance: Deployer IN  0x9df9d91382d38c230214c7d2b959e29ed5bc513b0 FTM3.054799599068
0x13f67d1704f753e704612395ce46ad4cc4f56cc4e345283fb377e896161d9afeSet Controller507902642022-11-12 17:27:12137 days 1 hr agoScarab Finance: Deployer IN  0x9df9d91382d38c230214c7d2b959e29ed5bc513b0 FTM0.026464354946
0xfb734290884d24c3bbbb9a02f4db7c0e5900193307ad40fa1b8b05ac522c0a2e0x60a06040507697052022-11-11 18:07:18138 days 1 hr agoScarab Finance: Deployer IN  Create: VaultFactory0 FTM4.724822006858
[ Download CSV Export 
Latest 11 internal transactions
Parent Txn Hash Block From To Value
0x175096465c1f1862019199a09b5b571f26a6e1dc9d9b6922c3c09c27d504e4f4507906412022-11-12 17:43:44137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0x175096465c1f1862019199a09b5b571f26a6e1dc9d9b6922c3c09c27d504e4f4507906412022-11-12 17:43:44137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0x919ffc3458e083e25c3917d3b436834d03ebfede7821791b4a7b7a1ba5c347e0507906162022-11-12 17:42:37137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0x919ffc3458e083e25c3917d3b436834d03ebfede7821791b4a7b7a1ba5c347e0507906162022-11-12 17:42:37137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0x34c454c1447d64fdcc9099ff4310e7d8c48039ca4c7b1c4eed62f5e2ec8655a8507906122022-11-12 17:42:24137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0x34c454c1447d64fdcc9099ff4310e7d8c48039ca4c7b1c4eed62f5e2ec8655a8507906122022-11-12 17:42:24137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0xdf61981222961ba8e9d637eb59b143ac38a642b2d16497d4906feab19694823f507905952022-11-12 17:41:48137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0xdf61981222961ba8e9d637eb59b143ac38a642b2d16497d4906feab19694823f507905952022-11-12 17:41:48137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0xf18d43d6489e96a30ccf18660cd7a7b4e641cef54b0ef00340bdd37e4ce1c7d2507904842022-11-12 17:36:14137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0xf18d43d6489e96a30ccf18660cd7a7b4e641cef54b0ef00340bdd37e4ce1c7d2507904842022-11-12 17:36:14137 days 1 hr ago 0x9df9d91382d38c230214c7d2b959e29ed5bc513b  Contract Creation0 FTM
0xfb734290884d24c3bbbb9a02f4db7c0e5900193307ad40fa1b8b05ac522c0a2e507697052022-11-11 18:07:18138 days 1 hr ago Scarab Finance: Deployer  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VaultFactory

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressFactoryNotInController","type":"error"},{"inputs":[],"name":"AddressNotController","type":"error"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"ControllerAlreadySet","type":"error"},{"inputs":[],"name":"ControllerNotSet","type":"error"},{"inputs":[{"internalType":"uint256","name":"marketIndex","type":"uint256"}],"name":"MarketDoesNotExist","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"marketEpochId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"mIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startEpoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endEpoch","type":"uint256"},{"indexed":false,"internalType":"address","name":"hedge","type":"address"},{"indexed":false,"internalType":"address","name":"risk","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"int256","name":"strikePrice","type":"int256"},{"indexed":false,"internalType":"uint256","name":"withdrawalFee","type":"uint256"}],"name":"EpochCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"mIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"hedge","type":"address"},{"indexed":false,"internalType":"address","name":"risk","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"int256","name":"strikePrice","type":"int256"}],"name":"MarketCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_marketIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"controller","type":"address"}],"name":"changedController","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"address","name":"_oracle","type":"address"}],"name":"changedOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_treasury","type":"address"},{"indexed":true,"internalType":"uint256","name":"_marketIndex","type":"uint256"}],"name":"changedTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_marketIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_feeRate","type":"uint256"}],"name":"changedVaultFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newController","type":"address"}],"name":"controllerSet","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_marketIndex","type":"uint256"},{"internalType":"address","name":"_controller","type":"address"}],"name":"changeController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_oracle","type":"address"}],"name":"changeOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_marketIndex","type":"uint256"}],"name":"changeTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawalFee","type":"uint256"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"int256","name":"_strikePrice","type":"int256"},{"internalType":"uint256","name":"epochBegin","type":"uint256"},{"internalType":"uint256","name":"epochEnd","type":"uint256"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"string","name":"_name","type":"string"}],"name":"createNewMarket","outputs":[{"internalType":"address","name":"insr","type":"address"},{"internalType":"address","name":"rsk","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"epochBegin","type":"uint256"},{"internalType":"uint256","name":"epochEnd","type":"uint256"},{"internalType":"uint256","name":"_withdrawalFee","type":"uint256"}],"name":"deployMoreAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getVaults","outputs":[{"internalType":"address[]","name":"vaults","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"indexEpochs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"indexVaults","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenToOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a06040523480156200001157600080fd5b5060405162004db738038062004db783398101604081905262000034916200012d565b6200003f33620000c0565b6001600160a01b0381166200006757604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b0382166200008f57604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b039081166080526000600355600180546001600160a01b0319169290911691909117905562000165565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200012857600080fd5b919050565b600080604083850312156200014157600080fd5b6200014c8362000110565b91506200015c6020840162000110565b90509250929050565b608051614c286200018f600039600081816102910152818161042701526104c50152614c286000f3fe60806040523480156200001157600080fd5b5060043610620001215760003560e01c806392eefe9b11620000af578063ad5c4648116200007a578063ad5c4648146200028b578063c0c99d9b14620002b3578063c5ba24b114620002ca578063f2fde38b14620002e1578063f77c479114620002f857600080fd5b806392eefe9b146200021a578063971840341462000231578063981fed0d14620002485780639820c733146200025f57600080fd5b806361d027b311620000f057806361d027b314620001c7578063715018a614620001f45780638c7adc1514620001fe5780638da5cb5b146200020857600080fd5b806315355d891462000126578063424a4ab71462000162578063468d16d014620001885780634dc809ce14620001ae575b600080fd5b6200013d62000137366004620013a6565b6200030c565b604080516001600160a01b039384168152929091166020830152015b60405180910390f35b62000179620001733660046200147e565b6200068a565b60405190815260200162000159565b6200019f62000199366004620014a1565b620006bc565b604051620001599190620014bb565b620001c5620001bf3660046200150a565b6200072a565b005b600154620001db906001600160a01b031681565b6040516001600160a01b03909116815260200162000159565b620001c56200080e565b6200017960035481565b6000546001600160a01b0316620001db565b620001c56200022b36600462001548565b62000849565b620001c5620002423660046200156f565b62000915565b620001c5620002593660046200159e565b62000b36565b620001db6200027036600462001548565b6006602052600090815260409020546001600160a01b031681565b620001db7f000000000000000000000000000000000000000000000000000000000000000081565b620001db620002c43660046200147e565b62000c6e565b620001c5620002db366004620015d1565b62000ca7565b620001c5620002f236600462001548565b62000ea5565b600254620001db906001600160a01b031681565b6000805481906001600160a01b03163314620003455760405162461bcd60e51b81526004016200033c90620015f9565b60405180910390fd5b6002546001600160a01b03166200036f57604051632110f99160e01b815260040160405180910390fd5b6002546040805163062f2ca160e21b8152905130926001600160a01b0316916318bcb2849160048083019260209291908290030181865afa158015620003b9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003df91906200162e565b6001600160a01b0316146200040757604051632e6268cb60e11b815260040160405180910390fd5b6001600360008282546200041c91906200164e565b9250508190555060007f000000000000000000000000000000000000000000000000000000000000000084604051602001620004599190620016a8565b60408051601f198184030181529082905260015460025491926001600160a01b03918216928e928e9291169062000490906200128c565b620004a19695949392919062001701565b604051809103906000f080158015620004be573d6000803e3d6000fd5b50905060007f000000000000000000000000000000000000000000000000000000000000000085604051602001620004f791906200176a565b60408051601f198184030181529082905260015460025491926001600160a01b03918216928f928f929116906200052e906200128c565b6200053f9695949392919062001794565b604051809103906000f0801580156200055c573d6000803e3d6000fd5b506040805180820182526001600160a01b03808616825283166020808301919091526003546000908152600490915291909120919250620005a0919060026200129a565b506001600160a01b038a811660009081526006602052604090205416620005f0576001600160a01b038a8116600090815260066020526040902080546001600160a01b0319169188169190911790555b6003547ff38f00404415af51ddd0dd57ce975d015de2f40ba8a087ac48cd7552b7580f3283838d898e6040516200062c959493929190620017fd565b60405180910390a26040805160c0810182526003548152602081018a90529081018890526001600160a01b0380841660608301528216608082015260a081018c9052620006798162000f44565b50909a909950975050505050505050565b60056020528160005260406000208181548110620006a757600080fd5b90600052602060002001600091509150505481565b6000818152600460209081526040918290208054835181840281018401909452808452606093928301828280156200071e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311620006ff575b50505050509050919050565b6000546001600160a01b03163314620007575760405162461bcd60e51b81526004016200033c90620015f9565b6001600160a01b0381166200077f57604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b038216620007a757604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b0382811660008181526006602090815260409182902080546001600160a01b0319169486169485179055905192835290917f28df3b064354b43def85ae35ad1af737224afbc9e54056c6148c40718fc0f23b910160405180910390a25050565b6000546001600160a01b031633146200083b5760405162461bcd60e51b81526004016200033c90620015f9565b6200084760006200123c565b565b6000546001600160a01b03163314620008765760405162461bcd60e51b81526004016200033c90620015f9565b6002546001600160a01b0316620008f9576001600160a01b038116620008af57604051639fabe1c160e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040517fef870992dc2c2a67cde45c38102147a9bb3131b38b39be3ec2ba273c058c917190600090a250565b60405163ca231c2360e01b815260040160405180910390fd5b50565b6000546001600160a01b03163314620009425760405162461bcd60e51b81526004016200033c90620015f9565b6001600160a01b0382166200096a57604051639fabe1c160e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038416179055600081815260046020908152604080832080548251818502810185019093528083529192909190830182828015620009e757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311620009c8575b5050505050905060008160008151811062000a065762000a0662001845565b6020026020010151905060008260018151811062000a285762000a2862001845565b602090810291909101015160405163b14f2a3960e01b81526001600160a01b0387811660048301529192509083169063b14f2a3990602401600060405180830381600087803b15801562000a7b57600080fd5b505af115801562000a90573d6000803e3d6000fd5b505060405163b14f2a3960e01b81526001600160a01b0388811660048301528416925063b14f2a399150602401600060405180830381600087803b15801562000ad857600080fd5b505af115801562000aed573d6000803e3d6000fd5b50506040516001600160a01b03881681528692507f19bf2eeec0ce4db400b9ec99f958a1b32935964814d88991caa4b9b936b4e639915060200160405180910390a25050505050565b6000546001600160a01b0316331462000b635760405162461bcd60e51b81526004016200033c90620015f9565b6002546001600160a01b031662000b8d57604051632110f99160e01b815260040160405180910390fd5b60035484111562000bb557604051630fff01a760e31b8152600481018590526024016200033c565b60008481526004602052604081208054829062000bd65762000bd662001845565b600091825260208083209091015487835260049091526040822080546001600160a01b03909216935090600190811062000c145762000c1462001845565b600091825260209182902001546040805160c08101825289815292830188905282018690526001600160a01b038481166060840152166080820181905260a08201859052915062000c658162000f44565b50505050505050565b6004602052816000526040600020818154811062000c8b57600080fd5b6000918252602090912001546001600160a01b03169150829050565b6000546001600160a01b0316331462000cd45760405162461bcd60e51b81526004016200033c90620015f9565b6001600160a01b03811662000cfc57604051639fabe1c160e01b815260040160405180910390fd5b60008281526004602090815260408083208054825181850281018501909352808352919290919083018282801562000d5e57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831162000d3f575b5050505050905060008160008151811062000d7d5762000d7d62001845565b6020026020010151905060008260018151811062000d9f5762000d9f62001845565b6020908102919091010151604051633cebb82360e01b81526001600160a01b03868116600483015291925090831690633cebb82390602401600060405180830381600087803b15801562000df257600080fd5b505af115801562000e07573d6000803e3d6000fd5b5050604051633cebb82360e01b81526001600160a01b03878116600483015284169250633cebb8239150602401600060405180830381600087803b15801562000e4f57600080fd5b505af115801562000e64573d6000803e3d6000fd5b50506040516001600160a01b03871692508791507fda50bc426cb0e9e095fd3ae12db16f07a366fe474ca736f84dd3037bd9050cff90600090a35050505050565b6000546001600160a01b0316331462000ed25760405162461bcd60e51b81526004016200033c90620015f9565b6001600160a01b03811662000f395760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016200033c565b62000912816200123c565b6060810151602082015160408084015160a08501519151631d1c558560e21b81526004810193909352602483015260448201526001600160a01b0390911690637471561490606401600060405180830381600087803b15801562000fa757600080fd5b505af115801562000fbc573d6000803e3d6000fd5b5050506080820151602083015160408085015160a08601519151631d1c558560e21b81526004810193909352602483015260448201526001600160a01b039091169150637471561490606401600060405180830381600087803b1580156200102357600080fd5b505af115801562001038573d6000803e3d6000fd5b505082516000908152600560209081526040808320818701805182546001810184559286529484902090910193909355855182870151935182519384018290529183019390935260608201529092506080019050604051602081830303815290604052805190602001207fb2c07c1ffc875d6b669c1cb15aa8116233e9f507b7244eaf4ef84c7660c24377836020015184604001518560600151866080015187606001516001600160a01b03166304da1a466040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200111a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200114091906200162e565b88606001516001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa15801562001183573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620011ad91908101906200185b565b89606001516001600160a01b031663c52987cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620011f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012169190620018db565b8a60a0015160405162001231989796959493929190620018f5565b60405180910390a350565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6132a1806200195283390190565b828054828255906000526020600020908101928215620012f2579160200282015b82811115620012f257825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620012bb565b506200130092915062001304565b5090565b5b8082111562001300576000815560010162001305565b6001600160a01b03811681146200091257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171562001373576200137362001331565b604052919050565b600067ffffffffffffffff82111562001398576200139862001331565b50601f01601f191660200190565b600080600080600080600060e0888a031215620013c257600080fd5b873596506020880135620013d6816200131b565b955060408801359450606088013593506080880135925060a0880135620013fd816200131b565b915060c088013567ffffffffffffffff8111156200141a57600080fd5b8801601f81018a136200142c57600080fd5b8035620014436200143d826200137b565b62001347565b8181528b60208385010111156200145957600080fd5b8160208401602083013760006020838301015280935050505092959891949750929550565b600080604083850312156200149257600080fd5b50508035926020909101359150565b600060208284031215620014b457600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015620014fe5783516001600160a01b031683529284019291840191600101620014d7565b50909695505050505050565b600080604083850312156200151e57600080fd5b82356200152b816200131b565b915060208301356200153d816200131b565b809150509250929050565b6000602082840312156200155b57600080fd5b813562001568816200131b565b9392505050565b600080604083850312156200158357600080fd5b823562001590816200131b565b946020939093013593505050565b60008060008060808587031215620015b557600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215620015e557600080fd5b8235915060208301356200153d816200131b565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156200164157600080fd5b815162001568816200131b565b600082198211156200167057634e487b7160e01b600052601160045260246000fd5b500190565b60005b838110156200169257818101518382015260200162001678565b83811115620016a2576000848401525b50505050565b60008251620016bc81846020870162001675565b64484544474560d81b920191825250600501919050565b60008151808452620016ed81602086016020860162001675565b601f01601f19169290920160200192915050565b600060018060a01b03808916835260e060208401526200172560e0840189620016d3565b83810360408086019190915260048252636859324b60e01b60208301529782166060850152958116608084015260a083019490945250911660c0909101520192915050565b600082516200177e81846020870162001675565b635249534b60e01b920191825250600401919050565b600060018060a01b03808916835260e06020840152620017b860e0840189620016d3565b83810360408086019190915260048252637259324b60e01b60208301529782166060850152958116608084015260a083019490945250911660c0909101520192915050565b6001600160a01b03868116825285811660208301528416604082015260a0606082018190526000906200183390830185620016d3565b90508260808301529695505050505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156200186e57600080fd5b815167ffffffffffffffff8111156200188657600080fd5b8201601f810184136200189857600080fd5b8051620018a96200143d826200137b565b818152856020838501011115620018bf57600080fd5b620018d282602083016020860162001675565b95945050505050565b600060208284031215620018ee57600080fd5b5051919050565b888152602081018890526001600160a01b03878116604083015286811660608301528516608082015261010060a082018190526000906200193983820187620016d3565b60c0840195909552505060e00152969550505050505056fe6101006040523480156200001257600080fd5b50604051620032a1380380620032a1833981016040819052620000359162000248565b8686866040518060200160405280600081525062000059816200014c60201b60201c565b506001600160a01b038316608052600462000075838262000396565b50600562000084828262000396565b5050600160065550506001600160a01b038416620000b557604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b038116620000dd57604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b0383166200010557604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b0392831660a052600780546001600160a01b031990811695851695909517905560c0919091523360e0526008805490931691161790555062000462915050565b60026200015a828262000396565b5050565b80516001600160a01b03811681146200017657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001a357600080fd5b81516001600160401b0380821115620001c057620001c06200017b565b604051601f8301601f19908116603f01168101908282118183101715620001eb57620001eb6200017b565b816040528381526020925086838588010111156200020857600080fd5b600091505b838210156200022c57858201830151818301840152908201906200020d565b838211156200023e5760008385830101525b9695505050505050565b600080600080600080600060e0888a0312156200026457600080fd5b6200026f886200015e565b60208901519097506001600160401b03808211156200028d57600080fd5b6200029b8b838c0162000191565b975060408a0151915080821115620002b257600080fd5b50620002c18a828b0162000191565b955050620002d2606089016200015e565b9350620002e2608089016200015e565b925060a08801519150620002f960c089016200015e565b905092959891949750929550565b600181811c908216806200031c57607f821691505b6020821081036200033d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039157600081815260208120601f850160051c810160208610156200036c5750805b601f850160051c820191505b818110156200038d5782815560010162000378565b5050505b505050565b81516001600160401b03811115620003b257620003b26200017b565b620003ca81620003c3845462000307565b8462000343565b602080601f831160018114620004025760008415620003e95750858301515b600019600386901b1c1916600185901b1785556200038d565b600085815260208120601f198616915b82811015620004335788860151825594840194600190910190840162000412565b5085821015620004525787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e051612dcd620004d4600039600081816106f301528181610c2701528181611434015261187a01526000610727015260006102b401526000818161041401528181610b0501528181610f9c0152818161129f0152818161134f015261167b0152612dcd6000f3fe60806040526004361061023a5760003560e01c806371b3177a1161012e578063bd85b039116100ab578063e985e9c51161006f578063e985e9c51461077e578063ea859a27146107c7578063f242432a146107f4578063f77c479114610814578063f9db24271461083457600080fd5b8063bd85b039146106b4578063c45a0155146106e1578063c52987cf14610715578063c6b61e4c14610749578063d662b92d1461076957600080fd5b8063a22cb465116100f2578063a22cb46514610607578063a5054b5b14610627578063ad5be0c414610647578063aff223b914610667578063b14f2a391461069457600080fd5b806371b3177a1461057257806374715614146105925780638dbdbe6d146105b257806394605857146105d257806395d89b41146105f257600080fd5b806338d52e0f116101bc5780634e1273f4116101805780634e1273f4146104c35780634f558e79146104f057806356150edf1461051f5780636164e45d1461053257806361d027b31461055257600080fd5b806338d52e0f146104025780633cebb823146104365780633e04836514610456578063488bd7b0146104765780634d288ba71461049657600080fd5b80630b8a295a116102035780630b8a295a146103405780630e89341c14610370578063243219d11461039057806329322e05146103c05780632eb2c2d6146103e257600080fd5b8062fdd58e1461023f57806301ffc9a71461027257806304da1a46146102a257806306fdde03146102ee5780630b6e8f8914610310575b600080fd5b34801561024b57600080fd5b5061025f61025a366004612485565b610861565b6040519081526020015b60405180910390f35b34801561027e57600080fd5b5061029261028d3660046124c8565b6108f7565b6040519015158152602001610269565b3480156102ae57600080fd5b506102d67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610269565b3480156102fa57600080fd5b50610303610949565b6040516102699190612532565b34801561031c57600080fd5b5061029261032b366004612545565b600d6020526000908152604090205460ff1681565b34801561034c57600080fd5b5061029261035b366004612545565b600e6020526000908152604090205460ff1681565b34801561037c57600080fd5b5061030361038b366004612545565b6109d7565b34801561039c57600080fd5b506102926103ab366004612545565b60106020526000908152604090205460ff1681565b3480156103cc57600080fd5b506103e06103db36600461255e565b610a6b565b005b3480156103ee57600080fd5b506103e06103fd3660046126d6565b610b85565b34801561040e57600080fd5b506102d67f000000000000000000000000000000000000000000000000000000000000000081565b34801561044257600080fd5b506103e0610451366004612780565b610c1c565b34801561046257600080fd5b506103e061047136600461279b565b610cb0565b34801561048257600080fd5b5061025f61049136600461279b565b610d26565b3480156104a257600080fd5b5061025f6104b1366004612545565b600b6020526000908152604090205481565b3480156104cf57600080fd5b506104e36104de3660046127bd565b610d52565b60405161026991906128c3565b3480156104fc57600080fd5b5061029261050b366004612545565b600090815260036020526040902054151590565b6103e061052d36600461255e565b610e7c565b34801561053e57600080fd5b506103e061054d366004612545565b611079565b34801561055e57600080fd5b506007546102d6906001600160a01b031681565b34801561057e57600080fd5b5061025f61058d3660046128d6565b611114565b34801561059e57600080fd5b506103e06105ad36600461291c565b611429565b3480156105be57600080fd5b506103e06105cd366004612948565b611574565b3480156105de57600080fd5b5061025f6105ed366004612545565b611769565b3480156105fe57600080fd5b506103036117b7565b34801561061357600080fd5b506103e061062236600461298b565b6117c4565b34801561063357600080fd5b5061025f61064236600461279b565b6117d3565b34801561065357600080fd5b506103e0610662366004612545565b6117f0565b34801561067357600080fd5b5061025f610682366004612545565b600f6020526000908152604090205481565b3480156106a057600080fd5b506103e06106af366004612780565b61186f565b3480156106c057600080fd5b5061025f6106cf366004612545565b60009081526003602052604090205490565b3480156106ed57600080fd5b506102d67f000000000000000000000000000000000000000000000000000000000000000081565b34801561072157600080fd5b5061025f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561075557600080fd5b5061025f610764366004612545565b611903565b34801561077557600080fd5b5060095461025f565b34801561078a57600080fd5b506102926107993660046129c2565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b3480156107d357600080fd5b5061025f6107e2366004612545565b600c6020526000908152604090205481565b34801561080057600080fd5b506103e061080f3660046129ec565b611924565b34801561082057600080fd5b506008546102d6906001600160a01b031681565b34801561084057600080fd5b5061025f61084f366004612545565b600a6020526000908152604090205481565b60006001600160a01b0383166108d15760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216636cdb3d1360e11b148061092857506001600160e01b031982166303a24d0760e21b145b8061094357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6004805461095690612a51565b80601f016020809104026020016040519081016040528092919081815260200182805461098290612a51565b80156109cf5780601f106109a4576101008083540402835291602001916109cf565b820191906000526020600020905b8154815290600101906020018083116109b257829003601f168201915b505050505081565b6060600280546109e690612a51565b80601f0160208091040260200160405190810160405280929190818152602001828054610a1290612a51565b8015610a5f5780601f10610a3457610100808354040283529160200191610a5f565b820191906000526020600020905b815481529060010190602001808311610a4257829003601f168201915b50505050509050919050565b6008546001600160a01b03163314610a9857604051632e91ff8760e21b81523360048201526024016108c8565b6000828152600e6020526040902054829060ff161515600114610ace576040516305cc46e760e31b815260040160405180910390fd5b6000838152600a60205260409081902054905163a9059cbb60e01b81526001600160a01b03848116600483015260248201929092527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015610b50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b749190612a85565b610b8057610b80612aa2565b505050565b6001600160a01b038516331480610ba15750610ba18533610799565b610c085760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b60648201526084016108c8565b610c1585858585856119ab565b5050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c675760405163017bb92160e41b81523360048201526024016108c8565b6001600160a01b038116610c8e57604051639fabe1c160e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b03163314610cdd57604051632e91ff8760e21b81523360048201526024016108c8565b6000828152600e6020526040902054829060ff161515600114610d13576040516305cc46e760e31b815260040160405180910390fd5b506000918252600b602052604090912055565b6000828152600b6020908152604080832054600a909252822054610d4b918491611b96565b9392505050565b60608151835114610db75760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b60648201526084016108c8565b6000835167ffffffffffffffff811115610dd357610dd361258a565b604051908082528060200260200182016040528015610dfc578160200160208202803683370190505b50905060005b8451811015610e7457610e47858281518110610e2057610e20612ab8565b6020026020010151858381518110610e3a57610e3a612ab8565b6020026020010151610861565b828281518110610e5957610e59612ab8565b6020908102919091010152610e6d81612ae4565b9050610e02565b509392505050565b6000828152600e6020526040902054829060ff161515600114610eb2576040516305cc46e760e31b815260040160405180910390fd5b6000838152600c60205260409020548390421115610ee3576040516326ddce9160e01b815260040160405180910390fd5b600260065403610f355760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108c8565b600260065534610f735760405162461bcd60e51b81526020600482015260096024820152685a65726f56616c756560b81b60448201526064016108c8565b6001600160a01b038316610f9a57604051639fabe1c160e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610ff557600080fd5b505af1158015611009573d6000803e3d6000fd5b505050505061102983853460405180602001604052806000815250611bc4565b6040805133815234602082015285916001600160a01b038616917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3505060016006555050565b6008546001600160a01b031633146110a657604051632e91ff8760e21b81523360048201526024016108c8565b6000818152600e6020526040902054819060ff1615156001146110dc576040516305cc46e760e31b815260040160405180910390fd5b6000828152600d60205260409020805460ff191660011790556110fe82611769565b6000928352600a60205260409092209190915550565b6000848152600d6020526040812054859060ff16151582036111495760405163ec76655760e01b815260040160405180910390fd5b6000868152600e6020526040902054869060ff16151560011461117f576040516305cc46e760e31b815260040160405180910390fd5b6001600160a01b0385166111a657604051639fabe1c160e01b815260040160405180910390fd5b336001600160a01b038516148015906111e357506001600160a01b038416600090815260016020908152604080832033845290915290205460ff16155b156112125760405163425da22160e11b81523360048201526001600160a01b03851660248201526044016108c8565b600061121f858989611ce7565b60008881526010602052604081205460ff1615159003611320576112438888610d26565b90508681111561131b5760006112598883612afd565b90506000611267828b6117d3565b90506112738184612afd565b60075460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529194507f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af11580156112e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130c9190612a85565b61131857611318612aa2565b50505b611323565b50855b80156113c85760405163a9059cbb60e01b81526001600160a01b038781166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af1158015611398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bc9190612a85565b6113c8576113c8612aa2565b604080513381526001600160a01b0388811660208301529181018990526060810183905289918716907fbbbdee62287b5bf3bee13cab60a29ad729cf38109bccbd2a986a11c99b8ca7049060800160405180910390a3979650505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114745760405163017bb92160e41b81523360048201526024016108c8565b609681111561149957604051631206ee7f60e01b8152600481018290526024016108c8565b806000036114ba57604051636883b21160e01b815260040160405180910390fd5b6000828152600e602052604090205460ff1615156001036114ee57604051631870d25960e31b815260040160405180910390fd5b81831061150e57604051631d02ec5360e11b815260040160405180910390fd5b6000828152600e60209081526040808320805460ff19166001908117909155600c8352818420969096556009805496870190557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90950193909355600f90925291902055565b6000838152600e6020526040902054839060ff1615156001146115aa576040516305cc46e760e31b815260040160405180910390fd5b6000848152600c602052604090205484904211156115db576040516326ddce9160e01b815260040160405180910390fd5b60026006540361162d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108c8565b60026006556001600160a01b03831661165957604051639fabe1c160e01b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af11580156116cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f09190612a85565b6116fc576116fc612aa2565b61171783868660405180602001604052806000815250611bc4565b604080513381526020810186905286916001600160a01b038616917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a350506001600655505050565b6000818152600e6020526040812054829060ff16151560011461179f576040516305cc46e760e31b815260040160405180910390fd5b60008381526003602052604090205491505b50919050565b6005805461095690612a51565b6117cf338383611e77565b5050565b6000818152600f6020526040812054610d4b9084906103e8611b96565b6008546001600160a01b0316331461181d57604051632e91ff8760e21b81523360048201526024016108c8565b6000818152600e6020526040902054819060ff161515600114611853576040516305cc46e760e31b815260040160405180910390fd5b506000908152601060205260409020805460ff19166001179055565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118ba5760405163017bb92160e41b81523360048201526024016108c8565b6001600160a01b0381166118e157604051639fabe1c160e01b815260040160405180910390fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6009818154811061191357600080fd5b600091825260209091200154905081565b6001600160a01b03851633148061194057506119408533610799565b61199e5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201526808185c1c1c9bdd995960ba1b60648201526084016108c8565b610c158585858585611f57565b8151835114611a0d5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016108c8565b6001600160a01b038416611a335760405162461bcd60e51b81526004016108c890612b14565b33611a4281878787878761208f565b60005b8451811015611b28576000858281518110611a6257611a62612ab8565b602002602001015190506000858381518110611a8057611a80612ab8565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015611ad05760405162461bcd60e51b81526004016108c890612b59565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290611b0d908490612ba3565b9250508190555050505080611b2190612ae4565b9050611a45565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611b78929190612bbb565b60405180910390a4611b8e818787878787612208565b505050505050565b828202811515841585830485141716611bae57600080fd5b6001826001830304018115150290509392505050565b6001600160a01b038416611c245760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b60648201526084016108c8565b336000611c3085612363565b90506000611c3d85612363565b9050611c4e8360008985858961208f565b6000868152602081815260408083206001600160a01b038b16845290915281208054879290611c7e908490612ba3565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cde836000898989896123ae565b50505050505050565b6001600160a01b038316611d495760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b60648201526084016108c8565b336000611d5584612363565b90506000611d6284612363565b9050611d828387600085856040518060200160405280600081525061208f565b6000858152602081815260408083206001600160a01b038a16845290915290205484811015611dff5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b60648201526084016108c8565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4604080516020810190915260009052611cde565b816001600160a01b0316836001600160a01b031603611eea5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b60648201526084016108c8565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416611f7d5760405162461bcd60e51b81526004016108c890612b14565b336000611f8985612363565b90506000611f9685612363565b9050611fa683898985858961208f565b6000868152602081815260408083206001600160a01b038c16845290915290205485811015611fe75760405162461bcd60e51b81526004016108c890612b59565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290612024908490612ba3565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612084848a8a8a8a8a6123ae565b505050505050505050565b6001600160a01b0385166121165760005b8351811015612114578281815181106120bb576120bb612ab8565b6020026020010151600360008684815181106120d9576120d9612ab8565b6020026020010151815260200190815260200160002060008282546120fe9190612ba3565b9091555061210d905081612ae4565b90506120a0565b505b6001600160a01b038416611b8e5760005b8351811015611cde57600084828151811061214457612144612ab8565b60200260200101519050600084838151811061216257612162612ab8565b60200260200101519050600060036000848152602001908152602001600020549050818110156121e55760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b60648201526084016108c8565b6000928352600360205260409092209103905561220181612ae4565b9050612127565b6001600160a01b0384163b15611b8e5760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061224c9089908990889088908890600401612be9565b6020604051808303816000875af1925050508015612287575060408051601f3d908101601f1916820190925261228491810190612c47565b60015b61233357612293612c64565b806308c379a0036122cc57506122a7612c80565b806122b257506122ce565b8060405162461bcd60e51b81526004016108c89190612532565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60648201526084016108c8565b6001600160e01b0319811663bc197c8160e01b14611cde5760405162461bcd60e51b81526004016108c890612d0a565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061239d5761239d612ab8565b602090810291909101015292915050565b6001600160a01b0384163b15611b8e5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906123f29089908990889088908890600401612d52565b6020604051808303816000875af192505050801561242d575060408051601f3d908101601f1916820190925261242a91810190612c47565b60015b61243957612293612c64565b6001600160e01b0319811663f23a6e6160e01b14611cde5760405162461bcd60e51b81526004016108c890612d0a565b80356001600160a01b038116811461248057600080fd5b919050565b6000806040838503121561249857600080fd5b6124a183612469565b946020939093013593505050565b6001600160e01b0319811681146124c557600080fd5b50565b6000602082840312156124da57600080fd5b8135610d4b816124af565b6000815180845260005b8181101561250b576020818501810151868301820152016124ef565b8181111561251d576000602083870101525b50601f01601f19169290920160200192915050565b602081526000610d4b60208301846124e5565b60006020828403121561255757600080fd5b5035919050565b6000806040838503121561257157600080fd5b8235915061258160208401612469565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff811182821017156125c6576125c661258a565b6040525050565b600067ffffffffffffffff8211156125e7576125e761258a565b5060051b60200190565b600082601f83011261260257600080fd5b8135602061260f826125cd565b60405161261c82826125a0565b83815260059390931b850182019282810191508684111561263c57600080fd5b8286015b848110156126575780358352918301918301612640565b509695505050505050565b600082601f83011261267357600080fd5b813567ffffffffffffffff81111561268d5761268d61258a565b6040516126a4601f8301601f1916602001826125a0565b8181528460208386010111156126b957600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156126ee57600080fd5b6126f786612469565b945061270560208701612469565b9350604086013567ffffffffffffffff8082111561272257600080fd5b61272e89838a016125f1565b9450606088013591508082111561274457600080fd5b61275089838a016125f1565b9350608088013591508082111561276657600080fd5b5061277388828901612662565b9150509295509295909350565b60006020828403121561279257600080fd5b610d4b82612469565b600080604083850312156127ae57600080fd5b50508035926020909101359150565b600080604083850312156127d057600080fd5b823567ffffffffffffffff808211156127e857600080fd5b818501915085601f8301126127fc57600080fd5b81356020612809826125cd565b60405161281682826125a0565b83815260059390931b850182019282810191508984111561283657600080fd5b948201945b8386101561285b5761284c86612469565b8252948201949082019061283b565b9650508601359250508082111561287157600080fd5b5061287e858286016125f1565b9150509250929050565b600081518084526020808501945080840160005b838110156128b85781518752958201959082019060010161289c565b509495945050505050565b602081526000610d4b6020830184612888565b600080600080608085870312156128ec57600080fd5b843593506020850135925061290360408601612469565b915061291160608601612469565b905092959194509250565b60008060006060848603121561293157600080fd5b505081359360208301359350604090920135919050565b60008060006060848603121561295d57600080fd5b833592506020840135915061297460408501612469565b90509250925092565b80151581146124c557600080fd5b6000806040838503121561299e57600080fd5b6129a783612469565b915060208301356129b78161297d565b809150509250929050565b600080604083850312156129d557600080fd5b6129de83612469565b915061258160208401612469565b600080600080600060a08688031215612a0457600080fd5b612a0d86612469565b9450612a1b60208701612469565b93506040860135925060608601359150608086013567ffffffffffffffff811115612a4557600080fd5b61277388828901612662565b600181811c90821680612a6557607f821691505b6020821081036117b157634e487b7160e01b600052602260045260246000fd5b600060208284031215612a9757600080fd5b8151610d4b8161297d565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612af657612af6612ace565b5060010190565b600082821015612b0f57612b0f612ace565b500390565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60008219821115612bb657612bb6612ace565b500190565b604081526000612bce6040830185612888565b8281036020840152612be08185612888565b95945050505050565b6001600160a01b0386811682528516602082015260a060408201819052600090612c1590830186612888565b8281036060840152612c278186612888565b90508281036080840152612c3b81856124e5565b98975050505050505050565b600060208284031215612c5957600080fd5b8151610d4b816124af565b600060033d1115612c7d5760046000803e5060005160e01c5b90565b600060443d1015612c8e5790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715612cbe57505050505090565b8285019150815181811115612cd65750505050505090565b843d8701016020828501011115612cf05750505050505090565b612cff602082860101876125a0565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090612d8c908301846124e5565b97965050505050505056fea26469706673582212202b3d93d4794a800994d457caf5a1a8dd0a396e65842bf8921e8ffb98aead435264736f6c634300080f0033a2646970667358221220170f2e2c9b2bd123375e4ba1002bb9bba1dd9e4ee1c40829f3e5c75f4d74454e64736f6c634300080f00330000000000000000000000004cb0a3068ef9f430a66ea0d53ee9af61eaf69ebe00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c83

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

0000000000000000000000004cb0a3068ef9f430a66ea0d53ee9af61eaf69ebe00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c83

-----Decoded View---------------
Arg [0] : _treasury (address): 0x4cb0a3068ef9f430a66ea0d53ee9af61eaf69ebe
Arg [1] : _weth (address): 0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000004cb0a3068ef9f430a66ea0d53ee9af61eaf69ebe
Arg [1] : 00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c83


Deployed ByteCode Sourcemap

83835:12550:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;89383:1663;;;;;;:::i;:::-;;:::i;:::-;;;;-1:-1:-1;;;;;2213:15:1;;;2195:34;;2265:15;;;;2260:2;2245:18;;2238:43;2130:18;89383:1663:0;;;;;;;;87340:48;;;;;;:::i;:::-;;:::i;:::-;;;2691:25:1;;;2679:2;2664:18;87340:48:0;2545:177:1;96226:156:0;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;95385:321::-;;;;;;:::i;:::-;;:::i;:::-;;83955:23;;;;;-1:-1:-1;;;;;83955:23:0;;;;;;-1:-1:-1;;;;;4132:32:1;;;4114:51;;4102:2;4087:18;83955:23:0;3968:203:1;67243:103:0;;;:::i;84017:26::-;;;;;;66592:87;66638:7;66665:6;-1:-1:-1;;;;;66665:6:0;66592:87;;93493:360;;;;;;:::i;:::-;;:::i;94031:500::-;;;;;;:::i;:::-;;:::i;91780:607::-;;;;;;:::i;:::-;;:::i;87422:48::-;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;87422:48:0;;;83877:29;;;;;87254:48;;;;;;:::i;:::-;;:::i;94726:487::-;;;;;;:::i;:::-;;:::i;67501:201::-;;;;;;:::i;:::-;;:::i;83985:25::-;;;;;-1:-1:-1;;;;;83985:25:0;;;89383:1663;89641:12;66665:6;;89641:12;;-1:-1:-1;;;;;66665:6:0;647:10;66812:23;66804:68;;;;-1:-1:-1;;;66804:68:0;;;;;;;:::i;:::-;;;;;;;;;89684:10:::1;::::0;-1:-1:-1;;;;;89684:10:0::1;89681:67;;89730:18;;-1:-1:-1::0;;;89730:18:0::1;;;;;;;;;;;89681:67;89790:10;::::0;89778:41:::1;::::0;;-1:-1:-1;;;89778:41:0;;;;89831:4:::1;::::0;-1:-1:-1;;;;;89790:10:0::1;::::0;89778:39:::1;::::0;:41:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;89790:10;89778:41:::1;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;89778:58:0::1;;89761:142;;89872:31;;-1:-1:-1::0;;;89872:31:0::1;;;;;;;;;;;89761:142;89931:1;89916:11;;:16;;;;;;;:::i;:::-;;;;;;;;89994:11;90032:4;90075:5;90058:31;;;;;;;;:::i;:::-;;::::0;;-1:-1:-1;;90058:31:0;;::::1;::::0;;;;;;;90126:8:::1;::::0;90197:10:::1;::::0;90058:31;;-1:-1:-1;;;;;90126:8:0;;::::1;::::0;90149:6;;90170:12;;90197:10;::::1;::::0;90008:210:::1;::::0;::::1;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;89994:224;;90231:10;90268:4;90311:5;90294:30;;;;;;;;:::i;:::-;;::::0;;-1:-1:-1;;90294:30:0;;::::1;::::0;;;;;;;90361:8:::1;::::0;90432:10:::1;::::0;90294:30;;-1:-1:-1;;;;;90361:8:0;;::::1;::::0;90384:6;;90405:12;;90432:10;::::1;::::0;90244:209:::1;::::0;::::1;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;90466:58:0::1;::::0;;;;::::1;::::0;;-1:-1:-1;;;;;90466:58:0;;::::1;::::0;;;::::1;;::::0;;::::1;::::0;;;;90478:11:::1;::::0;-1:-1:-1;90466:24:0;;;:11:::1;:24:::0;;;;;;;90231:222;;-1:-1:-1;90466:58:0::1;::::0;:24;:58:::1;;:::i;:::-;-1:-1:-1::0;;;;;;90541:21:0;;::::1;90574:1;90541:21:::0;;;:13:::1;:21;::::0;;;;;::::1;90537:99;;-1:-1:-1::0;;;;;90593:21:0;;::::1;;::::0;;;:13:::1;:21;::::0;;;;:31;;-1:-1:-1;;;;;;90593:31:0::1;::::0;;::::1;::::0;;;::::1;::::0;;90537:99:::1;90681:11;;90653:175;90715:5;90744:4;90764:6;90785:5;90805:12;90653:175;;;;;;;;;;:::i;:::-;;;;;;;;90874:75;::::0;;::::1;::::0;::::1;::::0;;90886:11:::1;::::0;90874:75;;::::1;::::0;::::1;::::0;;;;;;;;;-1:-1:-1;;;;;90874:75:0;;::::1;::::0;;;;;::::1;::::0;;;;;;;;;;90962:25:::1;90874:75:::0;90962:12:::1;:25::i;:::-;-1:-1:-1::0;91016:5:0;;;;-1:-1:-1;89383:1663:0;-1:-1:-1;;;;;;;;89383:1663:0:o;87340:48::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;96226:156::-;96356:18;;;;:11;:18;;;;;;;;;96349:25;;;;;;;;;;;;;;;;;96308:23;;96349:25;;;96356:18;96349:25;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;96349:25:0;;;;;;;;;;;;;;;;;;;;;;;96226:156;;;:::o;95385:321::-;66638:7;66665:6;-1:-1:-1;;;;;66665:6:0;647:10;66812:23;66804:68;;;;-1:-1:-1;;;66804:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;95471:21:0;::::1;95468:59;;95514:13;;-1:-1:-1::0;;;95514:13:0::1;;;;;;;;;;;95468:59;-1:-1:-1::0;;;;;95541:20:0;::::1;95538:58;;95583:13;;-1:-1:-1::0;;;95583:13:0::1;;;;;;;;;;;95538:58;-1:-1:-1::0;;;;;95621:21:0;;::::1;;::::0;;;:13:::1;:21;::::0;;;;;;;;:31;;-1:-1:-1;;;;;;95621:31:0::1;::::0;;::::1;::::0;;::::1;::::0;;95668:30;;4114:51:1;;;95621:21:0;;95668:30:::1;::::0;4087:18:1;95668:30:0::1;;;;;;;95385:321:::0;;:::o;67243:103::-;66638:7;66665:6;-1:-1:-1;;;;;66665:6:0;647:10;66812:23;66804:68;;;;-1:-1:-1;;;66804:68:0;;;;;;;:::i;:::-;67308:30:::1;67335:1;67308:18;:30::i;:::-;67243:103::o:0;93493:360::-;66638:7;66665:6;-1:-1:-1;;;;;66665:6:0;647:10;66812:23;66804:68;;;;-1:-1:-1;;;66804:68:0;;;;;;;:::i;:::-;93568:10:::1;::::0;-1:-1:-1;;;;;93568:10:0::1;93565:281;;-1:-1:-1::0;;;;;93611:25:0;::::1;93608:67;;93662:13;;-1:-1:-1::0;;;93662:13:0::1;;;;;;;;;;;93608:67;93690:10;:24:::0;;-1:-1:-1;;;;;;93690:24:0::1;-1:-1:-1::0;;;;;93690:24:0;::::1;::::0;;::::1;::::0;;;93736:26:::1;::::0;::::1;::::0;-1:-1:-1;;93736:26:0::1;93493:360:::0;:::o;93565:281::-:1;93812:22;;-1:-1:-1::0;;;93812:22:0::1;;;;;;;;;;;93565:281;93493:360:::0;:::o;94031:500::-;66638:7;66665:6;-1:-1:-1;;;;;66665:6:0;647:10;66812:23;66804:68;;;;-1:-1:-1;;;66804:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;94150:23:0;::::1;94147:61;;94195:13;;-1:-1:-1::0;;;94195:13:0::1;;;;;;;;;;;94147:61;94221:8;:20:::0;;-1:-1:-1;;;;;;94221:20:0::1;-1:-1:-1::0;;;;;94221:20:0;::::1;;::::0;;-1:-1:-1;94278:25:0;;;:11:::1;:25;::::0;;;;;;;94252:51;;;;;;::::1;::::0;;;;;;;;;;;;94278:25;;94252:51;;::::1;94278:25:::0;94252:51;;::::1;;;;;;;;;;;;;;;;::::0;;-1:-1:-1;;;;;94252:51:0::1;::::0;;;;;::::1;::::0;::::1;;::::0;;::::1;;;;;;;;;;;94314:10;94333:6;94340:1;94333:9;;;;;;;;:::i;:::-;;;;;;;94314:29;;94354:10;94373:6;94380:1;94373:9;;;;;;;;:::i;:::-;;::::0;;::::1;::::0;;;;;;94394:30:::1;::::0;-1:-1:-1;;;94394:30:0;;-1:-1:-1;;;;;4132:32:1;;;94394:30:0::1;::::0;::::1;4114:51:1::0;94373:9:0;;-1:-1:-1;94394:19:0;;::::1;::::0;::::1;::::0;4087:18:1;;94394:30:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;94435:30:0::1;::::0;-1:-1:-1;;;94435:30:0;;-1:-1:-1;;;;;4132:32:1;;;94435:30:0::1;::::0;::::1;4114:51:1::0;94435:19:0;::::1;::::0;-1:-1:-1;94435:19:0::1;::::0;-1:-1:-1;4087:18:1;;94435:30:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;94483:40:0::1;::::0;-1:-1:-1;;;;;4132:32:1;;4114:51;;94510:12:0;;-1:-1:-1;94483:40:0::1;::::0;-1:-1:-1;4102:2:1;4087:18;94483:40:0::1;;;;;;;94136:395;;;94031:500:::0;;:::o;91780:607::-;66638:7;66665:6;-1:-1:-1;;;;;66665:6:0;647:10;66812:23;66804:68;;;;-1:-1:-1;;;66804:68:0;;;;;;;:::i;:::-;91957:10:::1;::::0;-1:-1:-1;;;;;91957:10:0::1;91954:67;;92003:18;;-1:-1:-1::0;;;92003:18:0::1;;;;;;;;;;;91954:67;92046:11;;92038:5;:19;92034:84;;;92081:25;::::0;-1:-1:-1;;;92081:25:0;;::::1;::::0;::::1;2691::1::0;;;2664:18;;92081:25:0::1;2545:177:1::0;92034:84:0::1;92128:13;92144:18:::0;;;:11:::1;:18;::::0;;;;:21;;92128:13;;92144:21:::1;;;;:::i;:::-;;::::0;;;::::1;::::0;;;;;::::1;::::0;92191:18;;;:11:::1;:18:::0;;;;;;:21;;-1:-1:-1;;;;;92144:21:0;;::::1;::::0;-1:-1:-1;92191:18:0;92144:21;;92191;::::1;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;;::::1;::::0;92258:83:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;::::1;::::0;;;;;;;;-1:-1:-1;;;;;92258:83:0;;::::1;::::0;;;;92191:21:::1;92258:83:::0;;;;;;;;;;;;92191:21;-1:-1:-1;92354:25:0::1;92258:83:::0;92354:12:::1;:25::i;:::-;91943:444;;;91780:607:::0;;;;:::o;87254:48::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;87254:48:0;;-1:-1:-1;87254:48:0;;-1:-1:-1;87254:48:0:o;94726:487::-;66638:7;66665:6;-1:-1:-1;;;;;66665:6:0;647:10;66812:23;66804:68;;;;-1:-1:-1;;;66804:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;94849:25:0;::::1;94846:63;;94896:13;;-1:-1:-1::0;;;94896:13:0::1;;;;;;;;;;;94846:63;94922:23;94948:25:::0;;;:11:::1;:25;::::0;;;;;;;94922:51;;;;;;::::1;::::0;;;;;;;;;;;;94948:25;;94922:51;;::::1;94948:25:::0;94922:51;;::::1;;;;;;;;;;;;;;;;::::0;;-1:-1:-1;;;;;94922:51:0::1;::::0;;;;;::::1;::::0;::::1;;::::0;;::::1;;;;;;;;;;;94984:10;95003:6;95010:1;95003:9;;;;;;;;:::i;:::-;;;;;;;94984:29;;95024:10;95043:6;95050:1;95043:9;;;;;;;;:::i;:::-;;::::0;;::::1;::::0;;;;;;95064:34:::1;::::0;-1:-1:-1;;;95064:34:0;;-1:-1:-1;;;;;4132:32:1;;;95064:34:0::1;::::0;::::1;4114:51:1::0;95043:9:0;;-1:-1:-1;95064:21:0;;::::1;::::0;::::1;::::0;4087:18:1;;95064:34:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;95109:34:0::1;::::0;-1:-1:-1;;;95109:34:0;;-1:-1:-1;;;;;4132:32:1;;;95109:34:0::1;::::0;::::1;4114:51:1::0;95109:21:0;::::1;::::0;-1:-1:-1;95109:21:0::1;::::0;-1:-1:-1;4087:18:1;;95109:34:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;95161:44:0::1;::::0;-1:-1:-1;;;;;95161:44:0;::::1;::::0;-1:-1:-1;95179:12:0;;-1:-1:-1;95161:44:0::1;::::0;;;::::1;94835:378;;;94726:487:::0;;:::o;67501:201::-;66638:7;66665:6;-1:-1:-1;;;;;66665:6:0;647:10;66812:23;66804:68;;;;-1:-1:-1;;;66804:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;67590:22:0;::::1;67582:73;;;::::0;-1:-1:-1;;;67582:73:0;;10477:2:1;67582:73:0::1;::::0;::::1;10459:21:1::0;10516:2;10496:18;;;10489:30;10555:34;10535:18;;;10528:62;-1:-1:-1;;;10606:18:1;;;10599:36;10652:19;;67582:73:0::1;10275:402:1::0;67582:73:0::1;67666:28;67685:8;67666:18;:28::i;92395:922::-:0;92496:18;;;;92528:23;;;;92553:21;;;;;92576:26;;;;92496:107;;-1:-1:-1;;;92496:107:0;;;;;10884:25:1;;;;10925:18;;;10918:34;10968:18;;;10961:34;-1:-1:-1;;;;;92496:31:0;;;;;;10857:18:1;;92496:107:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;92614:17:0;;;;92645:23;;;;92670:21;;;;;92693:26;;;;92614:106;;-1:-1:-1;;;92614:106:0;;;;;10884:25:1;;;;10925:18;;;10918:34;10968:18;;;10961:34;-1:-1:-1;;;;;92614:30:0;;;;-1:-1:-1;92614:30:0;;10857:18:1;;92614:106:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;92745:18:0;;92733:31;;;;:11;:31;;;;;;;;92770:21;;;;;92733:59;;;;;;;;;;;;;;;;;;;;;92947:18;;92884:23;;;;92909:21;;92847:84;;;;;11191:19:1;;;11226:12;;;11219:28;;;;11263:12;;;11256:28;92947:18:0;;-1:-1:-1;11300:12:1;;;-1:-1:-1;92847:84:0;;;;;;;;;;;;92837:95;;;;;;92810:499;92980:12;:23;;;93018:12;:21;;;93062:12;:18;;;93104:12;:17;;;93137:12;:18;;;-1:-1:-1;;;;;93137:31:0;;:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;93185:12;:18;;;-1:-1:-1;;;;;93185:23:0;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;93185:25:0;;;;;;;;;;;;:::i;:::-;93225:12;:18;;;-1:-1:-1;;;;;93225:30:0;;:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;93272:12;:26;;;92810:499;;;;;;;;;;;;;:::i;:::-;;;;;;;;92395:922;:::o;67862:191::-;67936:16;67955:6;;-1:-1:-1;;;;;67972:17:0;;;-1:-1:-1;;;;;;67972:17:0;;;;;;68005:40;;67955:6;;;;;;;68005:40;;67936:16;68005:40;67925:128;67862:191;:::o;-1:-1:-1:-;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;14:131:1;-1:-1:-1;;;;;89:31:1;;79:42;;69:70;;135:1;132;125:12;150:127;211:10;206:3;202:20;199:1;192:31;242:4;239:1;232:15;266:4;263:1;256:15;282:275;353:2;347:9;418:2;399:13;;-1:-1:-1;;395:27:1;383:40;;453:18;438:34;;474:22;;;435:62;432:88;;;500:18;;:::i;:::-;536:2;529:22;282:275;;-1:-1:-1;282:275:1:o;562:187::-;611:4;644:18;636:6;633:30;630:56;;;666:18;;:::i;:::-;-1:-1:-1;732:2:1;711:15;-1:-1:-1;;707:29:1;738:4;703:40;;562:187::o;754:1224::-;876:6;884;892;900;908;916;924;977:3;965:9;956:7;952:23;948:33;945:53;;;994:1;991;984:12;945:53;1030:9;1017:23;1007:33;;1090:2;1079:9;1075:18;1062:32;1103:31;1128:5;1103:31;:::i;:::-;1153:5;-1:-1:-1;1205:2:1;1190:18;;1177:32;;-1:-1:-1;1256:2:1;1241:18;;1228:32;;-1:-1:-1;1307:3:1;1292:19;;1279:33;;-1:-1:-1;1364:3:1;1349:19;;1336:33;1378;1336;1378;:::i;:::-;1430:7;-1:-1:-1;1488:3:1;1473:19;;1460:33;1516:18;1505:30;;1502:50;;;1548:1;1545;1538:12;1502:50;1571:22;;1624:4;1616:13;;1612:27;-1:-1:-1;1602:55:1;;1653:1;1650;1643:12;1602:55;1689:2;1676:16;1714:49;1730:32;1759:2;1730:32;:::i;:::-;1714:49;:::i;:::-;1786:2;1779:5;1772:17;1826:7;1821:2;1816;1812;1808:11;1804:20;1801:33;1798:53;;;1847:1;1844;1837:12;1798:53;1902:2;1897;1893;1889:11;1884:2;1877:5;1873:14;1860:45;1946:1;1941:2;1936;1929:5;1925:14;1921:23;1914:34;1967:5;1957:15;;;;;754:1224;;;;;;;;;;:::o;2292:248::-;2360:6;2368;2421:2;2409:9;2400:7;2396:23;2392:32;2389:52;;;2437:1;2434;2427:12;2389:52;-1:-1:-1;;2460:23:1;;;2530:2;2515:18;;;2502:32;;-1:-1:-1;2292:248:1:o;2727:180::-;2786:6;2839:2;2827:9;2818:7;2814:23;2810:32;2807:52;;;2855:1;2852;2845:12;2807:52;-1:-1:-1;2878:23:1;;2727:180;-1:-1:-1;2727:180:1:o;2912:658::-;3083:2;3135:21;;;3205:13;;3108:18;;;3227:22;;;3054:4;;3083:2;3306:15;;;;3280:2;3265:18;;;3054:4;3349:195;3363:6;3360:1;3357:13;3349:195;;;3428:13;;-1:-1:-1;;;;;3424:39:1;3412:52;;3519:15;;;;3484:12;;;;3460:1;3378:9;3349:195;;;-1:-1:-1;3561:3:1;;2912:658;-1:-1:-1;;;;;;2912:658:1:o;3575:388::-;3643:6;3651;3704:2;3692:9;3683:7;3679:23;3675:32;3672:52;;;3720:1;3717;3710:12;3672:52;3759:9;3746:23;3778:31;3803:5;3778:31;:::i;:::-;3828:5;-1:-1:-1;3885:2:1;3870:18;;3857:32;3898:33;3857:32;3898:33;:::i;:::-;3950:7;3940:17;;;3575:388;;;;;:::o;4176:247::-;4235:6;4288:2;4276:9;4267:7;4263:23;4259:32;4256:52;;;4304:1;4301;4294:12;4256:52;4343:9;4330:23;4362:31;4387:5;4362:31;:::i;:::-;4412:5;4176:247;-1:-1:-1;;;4176:247:1:o;4428:315::-;4496:6;4504;4557:2;4545:9;4536:7;4532:23;4528:32;4525:52;;;4573:1;4570;4563:12;4525:52;4612:9;4599:23;4631:31;4656:5;4631:31;:::i;:::-;4681:5;4733:2;4718:18;;;;4705:32;;-1:-1:-1;;;4428:315:1:o;4748:385::-;4834:6;4842;4850;4858;4911:3;4899:9;4890:7;4886:23;4882:33;4879:53;;;4928:1;4925;4918:12;4879:53;-1:-1:-1;;4951:23:1;;;5021:2;5006:18;;4993:32;;-1:-1:-1;5072:2:1;5057:18;;5044:32;;5123:2;5108:18;5095:32;;-1:-1:-1;4748:385:1;-1:-1:-1;4748:385:1:o;5138:315::-;5206:6;5214;5267:2;5255:9;5246:7;5242:23;5238:32;5235:52;;;5283:1;5280;5273:12;5235:52;5319:9;5306:23;5296:33;;5379:2;5368:9;5364:18;5351:32;5392:31;5417:5;5392:31;:::i;5458:356::-;5660:2;5642:21;;;5679:18;;;5672:30;5738:34;5733:2;5718:18;;5711:62;5805:2;5790:18;;5458:356::o;5819:251::-;5889:6;5942:2;5930:9;5921:7;5917:23;5913:32;5910:52;;;5958:1;5955;5948:12;5910:52;5990:9;5984:16;6009:31;6034:5;6009:31;:::i;6075:225::-;6115:3;6146:1;6142:6;6139:1;6136:13;6133:136;;;6191:10;6186:3;6182:20;6179:1;6172:31;6226:4;6223:1;6216:15;6254:4;6251:1;6244:15;6133:136;-1:-1:-1;6285:9:1;;6075:225::o;6305:258::-;6377:1;6387:113;6401:6;6398:1;6395:13;6387:113;;;6477:11;;;6471:18;6458:11;;;6451:39;6423:2;6416:10;6387:113;;;6518:6;6515:1;6512:13;6509:48;;;6553:1;6544:6;6539:3;6535:16;6528:27;6509:48;;6305:258;;;:::o;6568:443::-;6800:3;6838:6;6832:13;6854:53;6900:6;6895:3;6888:4;6880:6;6876:17;6854:53;:::i;:::-;-1:-1:-1;;;6929:16:1;;6954:22;;;-1:-1:-1;7003:1:1;6992:13;;6568:443;-1:-1:-1;6568:443:1:o;7016:258::-;7058:3;7096:5;7090:12;7123:6;7118:3;7111:19;7139:63;7195:6;7188:4;7183:3;7179:14;7172:4;7165:5;7161:16;7139:63;:::i;:::-;7256:2;7235:15;-1:-1:-1;;7231:29:1;7222:39;;;;7263:4;7218:50;;7016:258;-1:-1:-1;;7016:258:1:o;7279:916::-;7630:4;7676:1;7672;7667:3;7663:11;7659:19;7717:2;7709:6;7705:15;7694:9;7687:34;7757:3;7752:2;7741:9;7737:18;7730:31;7784:46;7825:3;7814:9;7810:19;7802:6;7784:46;:::i;:::-;7866:22;;;7861:2;7846:18;;;7839:50;;;;7913:1;7898:17;;-1:-1:-1;;;7943:2:1;7931:15;;7924:31;8023:15;;;8018:2;8003:18;;7996:43;8076:15;;;8070:3;8055:19;;8048:44;8123:3;8108:19;;8101:35;;;;-1:-1:-1;8173:15:1;;8167:3;8152:19;;;8145:44;7972:15;;7279:916;-1:-1:-1;;7279:916:1:o;8200:442::-;8432:3;8470:6;8464:13;8486:53;8532:6;8527:3;8520:4;8512:6;8508:17;8486:53;:::i;:::-;-1:-1:-1;;;8561:16:1;;8586:21;;;-1:-1:-1;8634:1:1;8623:13;;8200:442;-1:-1:-1;8200:442:1:o;8647:916::-;8998:4;9044:1;9040;9035:3;9031:11;9027:19;9085:2;9077:6;9073:15;9062:9;9055:34;9125:3;9120:2;9109:9;9105:18;9098:31;9152:46;9193:3;9182:9;9178:19;9170:6;9152:46;:::i;:::-;9234:22;;;9229:2;9214:18;;;9207:50;;;;9281:1;9266:17;;-1:-1:-1;;;9311:2:1;9299:15;;9292:31;9391:15;;;9386:2;9371:18;;9364:43;9444:15;;;9438:3;9423:19;;9416:44;9491:3;9476:19;;9469:35;;;;-1:-1:-1;9541:15:1;;9535:3;9520:19;;;9513:44;9340:15;;8647:916;-1:-1:-1;;8647:916:1:o;9568:570::-;-1:-1:-1;;;;;9865:15:1;;;9847:34;;9917:15;;;9912:2;9897:18;;9890:43;9969:15;;9964:2;9949:18;;9942:43;9827:3;10016:2;10001:18;;9994:31;;;9790:4;;10042:46;;10068:19;;10060:6;10042:46;:::i;:::-;10034:54;;10125:6;10119:3;10108:9;10104:19;10097:35;9568:570;;;;;;;;:::o;10143:127::-;10204:10;10199:3;10195:20;10192:1;10185:31;10235:4;10232:1;10225:15;10259:4;10256:1;10249:15;11323:636;11403:6;11456:2;11444:9;11435:7;11431:23;11427:32;11424:52;;;11472:1;11469;11462:12;11424:52;11505:9;11499:16;11538:18;11530:6;11527:30;11524:50;;;11570:1;11567;11560:12;11524:50;11593:22;;11646:4;11638:13;;11634:27;-1:-1:-1;11624:55:1;;11675:1;11672;11665:12;11624:55;11704:2;11698:9;11729:49;11745:32;11774:2;11745:32;:::i;11729:49::-;11801:2;11794:5;11787:17;11841:7;11836:2;11831;11827;11823:11;11819:20;11816:33;11813:53;;;11862:1;11859;11852:12;11813:53;11875:54;11926:2;11921;11914:5;11910:14;11905:2;11901;11897:11;11875:54;:::i;:::-;11948:5;11323:636;-1:-1:-1;;;;;11323:636:1:o;11964:183::-;12033:6;12086:2;12074:9;12065:7;12061:23;12057:32;12054:52;;;12102:1;12099;12092:12;12054:52;-1:-1:-1;12125:16:1;;11964:183;-1:-1:-1;11964:183:1:o;12152:806::-;12499:25;;;12555:2;12540:18;;12533:34;;;-1:-1:-1;;;;;12641:15:1;;;12636:2;12621:18;;12614:43;12693:15;;;12688:2;12673:18;;12666:43;12746:15;;12740:3;12725:19;;12718:44;12487:3;12594;12778:19;;12771:31;;;12458:4;;12819:45;12845:18;;;12837:6;12819:45;:::i;:::-;12895:3;12880:19;;12873:35;;;;-1:-1:-1;;12939:3:1;12924:19;12917:35;12811:53;12152:806;-1:-1:-1;;;;;;12152:806:1:o

Swarm Source

ipfs://170f2e2c9b2bd123375e4ba1002bb9bba1dd9e4ee1c40829f3e5c75f4d74454e
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.