FTM Testnet

Contract

0xaD6d1b337Ee6d9fD939237f0394918b6AF21efaA

Overview

FTM Balance

Fantom LogoFantom LogoFantom Logo0 FTM

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Create Stake211740342023-10-01 14:27:49434 days ago1696170469IN
0xaD6d1b33...6AF21efaA
0 FTM0.000749472
Create Stake147547762023-04-04 13:48:28614 days ago1680616108IN
0xaD6d1b33...6AF21efaA
0 FTM0.000997452.5
Create Stake147546722023-04-04 13:36:39614 days ago1680615399IN
0xaD6d1b33...6AF21efaA
0 FTM0.001069972.5

Latest 4 internal transactions

Parent Transaction Hash Block From To
211740342023-10-01 14:27:49434 days ago1696170469
0xaD6d1b33...6AF21efaA
 Contract Creation0 FTM
147547762023-04-04 13:48:28614 days ago1680616108
0xaD6d1b33...6AF21efaA
 Contract Creation0 FTM
147546722023-04-04 13:36:39614 days ago1680615399
0xaD6d1b33...6AF21efaA
 Contract Creation0 FTM
139586652023-02-16 20:34:29660 days ago1676579669  Contract Creation0 FTM
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
XENStake

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 20 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at testnet.ftmscan.com on 2023-02-16
*/

// File: @openzeppelin/contracts/utils/introspection/IERC165.sol

// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// File: @openzeppelin/contracts/token/ERC721/IERC721.sol

// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol

// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol

// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

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

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

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

// File: @openzeppelin/contracts/utils/Address.sol

// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// File: @openzeppelin/contracts/utils/Context.sol

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// File: @openzeppelin/contracts/utils/Strings.sol

// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

// File: @openzeppelin/contracts/utils/introspection/ERC165.sol

// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

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

// File: @openzeppelin/contracts/token/ERC721/ERC721.sol

// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;







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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

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

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

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

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

        _afterTokenTransfer(address(0), to, tokenId);
    }

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

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

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

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

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

        _afterTokenTransfer(owner, address(0), tokenId);
    }

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

    /**
     * @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, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

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

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

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

// File: @openzeppelin/contracts/interfaces/IERC2981.sol

// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

// File: @openzeppelin/contracts/utils/Base64.sol

// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

// File: abdk-libraries-solidity/ABDKMath64x64.sol

/*
 * ABDK Math 64.64 Smart Contract Library.  Copyright © 2019 by ABDK Consulting.
 * Author: Mikhail Vladimirov <[email protected]>
 */
pragma solidity ^0.8.0;

/**
 * Smart contract library of mathematical functions operating with signed
 * 64.64-bit fixed point numbers.  Signed 64.64-bit fixed point number is
 * basically a simple fraction whose numerator is signed 128-bit integer and
 * denominator is 2^64.  As long as denominator is always the same, there is no
 * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are
 * represented by int128 type holding only the numerator.
 */
library ABDKMath64x64 {
  /*
   * Minimum value signed 64.64-bit fixed point number may have.
   */
  int128 private constant MIN_64x64 = -0x80000000000000000000000000000000;

  /*
   * Maximum value signed 64.64-bit fixed point number may have.
   */
  int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;

  /**
   * Convert signed 256-bit integer number into signed 64.64-bit fixed point
   * number.  Revert on overflow.
   *
   * @param x signed 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function fromInt (int256 x) internal pure returns (int128) {
    unchecked {
      require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF);
      return int128 (x << 64);
    }
  }

  /**
   * Convert signed 64.64 fixed point number into signed 64-bit integer number
   * rounding down.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64-bit integer number
   */
  function toInt (int128 x) internal pure returns (int64) {
    unchecked {
      return int64 (x >> 64);
    }
  }

  /**
   * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point
   * number.  Revert on overflow.
   *
   * @param x unsigned 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function fromUInt (uint256 x) internal pure returns (int128) {
    unchecked {
      require (x <= 0x7FFFFFFFFFFFFFFF);
      return int128 (int256 (x << 64));
    }
  }

  /**
   * Convert signed 64.64 fixed point number into unsigned 64-bit integer
   * number rounding down.  Revert on underflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return unsigned 64-bit integer number
   */
  function toUInt (int128 x) internal pure returns (uint64) {
    unchecked {
      require (x >= 0);
      return uint64 (uint128 (x >> 64));
    }
  }

  /**
   * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point
   * number rounding down.  Revert on overflow.
   *
   * @param x signed 128.128-bin fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function from128x128 (int256 x) internal pure returns (int128) {
    unchecked {
      int256 result = x >> 64;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Convert signed 64.64 fixed point number into signed 128.128 fixed point
   * number.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 128.128 fixed point number
   */
  function to128x128 (int128 x) internal pure returns (int256) {
    unchecked {
      return int256 (x) << 64;
    }
  }

  /**
   * Calculate x + y.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function add (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) + y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x - y.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function sub (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) - y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x * y rounding down.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function mul (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 result = int256(x) * y >> 64;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point
   * number and y is signed 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64 fixed point number
   * @param y signed 256-bit integer number
   * @return signed 256-bit integer number
   */
  function muli (int128 x, int256 y) internal pure returns (int256) {
    unchecked {
      if (x == MIN_64x64) {
        require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&
          y <= 0x1000000000000000000000000000000000000000000000000);
        return -y << 63;
      } else {
        bool negativeResult = false;
        if (x < 0) {
          x = -x;
          negativeResult = true;
        }
        if (y < 0) {
          y = -y; // We rely on overflow behavior here
          negativeResult = !negativeResult;
        }
        uint256 absoluteResult = mulu (x, uint256 (y));
        if (negativeResult) {
          require (absoluteResult <=
            0x8000000000000000000000000000000000000000000000000000000000000000);
          return -int256 (absoluteResult); // We rely on overflow behavior here
        } else {
          require (absoluteResult <=
            0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
          return int256 (absoluteResult);
        }
      }
    }
  }

  /**
   * Calculate x * y rounding down, where x is signed 64.64 fixed point number
   * and y is unsigned 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64 fixed point number
   * @param y unsigned 256-bit integer number
   * @return unsigned 256-bit integer number
   */
  function mulu (int128 x, uint256 y) internal pure returns (uint256) {
    unchecked {
      if (y == 0) return 0;

      require (x >= 0);

      uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64;
      uint256 hi = uint256 (int256 (x)) * (y >> 128);

      require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
      hi <<= 64;

      require (hi <=
        0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo);
      return hi + lo;
    }
  }

  /**
   * Calculate x / y rounding towards zero.  Revert on overflow or when y is
   * zero.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function div (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);
      int256 result = (int256 (x) << 64) / y;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are signed 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x signed 256-bit integer number
   * @param y signed 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function divi (int256 x, int256 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);

      bool negativeResult = false;
      if (x < 0) {
        x = -x; // We rely on overflow behavior here
        negativeResult = true;
      }
      if (y < 0) {
        y = -y; // We rely on overflow behavior here
        negativeResult = !negativeResult;
      }
      uint128 absoluteResult = divuu (uint256 (x), uint256 (y));
      if (negativeResult) {
        require (absoluteResult <= 0x80000000000000000000000000000000);
        return -int128 (absoluteResult); // We rely on overflow behavior here
      } else {
        require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
        return int128 (absoluteResult); // We rely on overflow behavior here
      }
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x unsigned 256-bit integer number
   * @param y unsigned 256-bit integer number
   * @return signed 64.64-bit fixed point number
   */
  function divu (uint256 x, uint256 y) internal pure returns (int128) {
    unchecked {
      require (y != 0);
      uint128 result = divuu (x, y);
      require (result <= uint128 (MAX_64x64));
      return int128 (result);
    }
  }

  /**
   * Calculate -x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function neg (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != MIN_64x64);
      return -x;
    }
  }

  /**
   * Calculate |x|.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function abs (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != MIN_64x64);
      return x < 0 ? -x : x;
    }
  }

  /**
   * Calculate 1 / x rounding towards zero.  Revert on overflow or when x is
   * zero.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function inv (int128 x) internal pure returns (int128) {
    unchecked {
      require (x != 0);
      int256 result = int256 (0x100000000000000000000000000000000) / x;
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function avg (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      return int128 ((int256 (x) + int256 (y)) >> 1);
    }
  }

  /**
   * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down.
   * Revert on overflow or in case x * y is negative.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function gavg (int128 x, int128 y) internal pure returns (int128) {
    unchecked {
      int256 m = int256 (x) * int256 (y);
      require (m >= 0);
      require (m <
          0x4000000000000000000000000000000000000000000000000000000000000000);
      return int128 (sqrtu (uint256 (m)));
    }
  }

  /**
   * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number
   * and y is unsigned 256-bit integer number.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @param y uint256 value
   * @return signed 64.64-bit fixed point number
   */
  function pow (int128 x, uint256 y) internal pure returns (int128) {
    unchecked {
      bool negative = x < 0 && y & 1 == 1;

      uint256 absX = uint128 (x < 0 ? -x : x);
      uint256 absResult;
      absResult = 0x100000000000000000000000000000000;

      if (absX <= 0x10000000000000000) {
        absX <<= 63;
        while (y != 0) {
          if (y & 0x1 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x2 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x4 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          if (y & 0x8 != 0) {
            absResult = absResult * absX >> 127;
          }
          absX = absX * absX >> 127;

          y >>= 4;
        }

        absResult >>= 64;
      } else {
        uint256 absXShift = 63;
        if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; }
        if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; }
        if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; }
        if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; }
        if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; }
        if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; }

        uint256 resultShift = 0;
        while (y != 0) {
          require (absXShift < 64);

          if (y & 0x1 != 0) {
            absResult = absResult * absX >> 127;
            resultShift += absXShift;
            if (absResult > 0x100000000000000000000000000000000) {
              absResult >>= 1;
              resultShift += 1;
            }
          }
          absX = absX * absX >> 127;
          absXShift <<= 1;
          if (absX >= 0x100000000000000000000000000000000) {
              absX >>= 1;
              absXShift += 1;
          }

          y >>= 1;
        }

        require (resultShift < 64);
        absResult >>= 64 - resultShift;
      }
      int256 result = negative ? -int256 (absResult) : int256 (absResult);
      require (result >= MIN_64x64 && result <= MAX_64x64);
      return int128 (result);
    }
  }

  /**
   * Calculate sqrt (x) rounding down.  Revert if x < 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function sqrt (int128 x) internal pure returns (int128) {
    unchecked {
      require (x >= 0);
      return int128 (sqrtu (uint256 (int256 (x)) << 64));
    }
  }

  /**
   * Calculate binary logarithm of x.  Revert if x <= 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function log_2 (int128 x) internal pure returns (int128) {
    unchecked {
      require (x > 0);

      int256 msb = 0;
      int256 xc = x;
      if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; }
      if (xc >= 0x100000000) { xc >>= 32; msb += 32; }
      if (xc >= 0x10000) { xc >>= 16; msb += 16; }
      if (xc >= 0x100) { xc >>= 8; msb += 8; }
      if (xc >= 0x10) { xc >>= 4; msb += 4; }
      if (xc >= 0x4) { xc >>= 2; msb += 2; }
      if (xc >= 0x2) msb += 1;  // No need to shift xc anymore

      int256 result = msb - 64 << 64;
      uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb);
      for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {
        ux *= ux;
        uint256 b = ux >> 255;
        ux >>= 127 + b;
        result += bit * int256 (b);
      }

      return int128 (result);
    }
  }

  /**
   * Calculate natural logarithm of x.  Revert if x <= 0.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function ln (int128 x) internal pure returns (int128) {
    unchecked {
      require (x > 0);

      return int128 (int256 (
          uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));
    }
  }

  /**
   * Calculate binary exponent of x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function exp_2 (int128 x) internal pure returns (int128) {
    unchecked {
      require (x < 0x400000000000000000); // Overflow

      if (x < -0x400000000000000000) return 0; // Underflow

      uint256 result = 0x80000000000000000000000000000000;

      if (x & 0x8000000000000000 > 0)
        result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128;
      if (x & 0x4000000000000000 > 0)
        result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128;
      if (x & 0x2000000000000000 > 0)
        result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128;
      if (x & 0x1000000000000000 > 0)
        result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128;
      if (x & 0x800000000000000 > 0)
        result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128;
      if (x & 0x400000000000000 > 0)
        result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128;
      if (x & 0x200000000000000 > 0)
        result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128;
      if (x & 0x100000000000000 > 0)
        result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128;
      if (x & 0x80000000000000 > 0)
        result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128;
      if (x & 0x40000000000000 > 0)
        result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128;
      if (x & 0x20000000000000 > 0)
        result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128;
      if (x & 0x10000000000000 > 0)
        result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128;
      if (x & 0x8000000000000 > 0)
        result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128;
      if (x & 0x4000000000000 > 0)
        result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128;
      if (x & 0x2000000000000 > 0)
        result = result * 0x1000162E525EE054754457D5995292026 >> 128;
      if (x & 0x1000000000000 > 0)
        result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128;
      if (x & 0x800000000000 > 0)
        result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128;
      if (x & 0x400000000000 > 0)
        result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128;
      if (x & 0x200000000000 > 0)
        result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128;
      if (x & 0x100000000000 > 0)
        result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128;
      if (x & 0x80000000000 > 0)
        result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128;
      if (x & 0x40000000000 > 0)
        result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128;
      if (x & 0x20000000000 > 0)
        result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128;
      if (x & 0x10000000000 > 0)
        result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128;
      if (x & 0x8000000000 > 0)
        result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128;
      if (x & 0x4000000000 > 0)
        result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128;
      if (x & 0x2000000000 > 0)
        result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128;
      if (x & 0x1000000000 > 0)
        result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128;
      if (x & 0x800000000 > 0)
        result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128;
      if (x & 0x400000000 > 0)
        result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128;
      if (x & 0x200000000 > 0)
        result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128;
      if (x & 0x100000000 > 0)
        result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128;
      if (x & 0x80000000 > 0)
        result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128;
      if (x & 0x40000000 > 0)
        result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128;
      if (x & 0x20000000 > 0)
        result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128;
      if (x & 0x10000000 > 0)
        result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128;
      if (x & 0x8000000 > 0)
        result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128;
      if (x & 0x4000000 > 0)
        result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128;
      if (x & 0x2000000 > 0)
        result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128;
      if (x & 0x1000000 > 0)
        result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128;
      if (x & 0x800000 > 0)
        result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128;
      if (x & 0x400000 > 0)
        result = result * 0x100000000002C5C85FDF477B662B26945 >> 128;
      if (x & 0x200000 > 0)
        result = result * 0x10000000000162E42FEFA3AE53369388C >> 128;
      if (x & 0x100000 > 0)
        result = result * 0x100000000000B17217F7D1D351A389D40 >> 128;
      if (x & 0x80000 > 0)
        result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128;
      if (x & 0x40000 > 0)
        result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128;
      if (x & 0x20000 > 0)
        result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128;
      if (x & 0x10000 > 0)
        result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128;
      if (x & 0x8000 > 0)
        result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128;
      if (x & 0x4000 > 0)
        result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128;
      if (x & 0x2000 > 0)
        result = result * 0x1000000000000162E42FEFA39F02B772C >> 128;
      if (x & 0x1000 > 0)
        result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128;
      if (x & 0x800 > 0)
        result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128;
      if (x & 0x400 > 0)
        result = result * 0x100000000000002C5C85FDF473DEA871F >> 128;
      if (x & 0x200 > 0)
        result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128;
      if (x & 0x100 > 0)
        result = result * 0x100000000000000B17217F7D1CF79E949 >> 128;
      if (x & 0x80 > 0)
        result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128;
      if (x & 0x40 > 0)
        result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128;
      if (x & 0x20 > 0)
        result = result * 0x100000000000000162E42FEFA39EF366F >> 128;
      if (x & 0x10 > 0)
        result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128;
      if (x & 0x8 > 0)
        result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128;
      if (x & 0x4 > 0)
        result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128;
      if (x & 0x2 > 0)
        result = result * 0x1000000000000000162E42FEFA39EF358 >> 128;
      if (x & 0x1 > 0)
        result = result * 0x10000000000000000B17217F7D1CF79AB >> 128;

      result >>= uint256 (int256 (63 - (x >> 64)));
      require (result <= uint256 (int256 (MAX_64x64)));

      return int128 (int256 (result));
    }
  }

  /**
   * Calculate natural exponent of x.  Revert on overflow.
   *
   * @param x signed 64.64-bit fixed point number
   * @return signed 64.64-bit fixed point number
   */
  function exp (int128 x) internal pure returns (int128) {
    unchecked {
      require (x < 0x400000000000000000); // Overflow

      if (x < -0x400000000000000000) return 0; // Underflow

      return exp_2 (
          int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128));
    }
  }

  /**
   * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit
   * integer numbers.  Revert on overflow or when y is zero.
   *
   * @param x unsigned 256-bit integer number
   * @param y unsigned 256-bit integer number
   * @return unsigned 64.64-bit fixed point number
   */
  function divuu (uint256 x, uint256 y) private pure returns (uint128) {
    unchecked {
      require (y != 0);

      uint256 result;

      if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
        result = (x << 64) / y;
      else {
        uint256 msb = 192;
        uint256 xc = x >> 192;
        if (xc >= 0x100000000) { xc >>= 32; msb += 32; }
        if (xc >= 0x10000) { xc >>= 16; msb += 16; }
        if (xc >= 0x100) { xc >>= 8; msb += 8; }
        if (xc >= 0x10) { xc >>= 4; msb += 4; }
        if (xc >= 0x4) { xc >>= 2; msb += 2; }
        if (xc >= 0x2) msb += 1;  // No need to shift xc anymore

        result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1);
        require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);

        uint256 hi = result * (y >> 128);
        uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);

        uint256 xh = x >> 192;
        uint256 xl = x << 64;

        if (xl < lo) xh -= 1;
        xl -= lo; // We rely on overflow behavior here
        lo = hi << 128;
        if (xl < lo) xh -= 1;
        xl -= lo; // We rely on overflow behavior here

        assert (xh == hi >> 128);

        result += xl / y;
      }

      require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
      return uint128 (result);
    }
  }

  /**
   * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer
   * number.
   *
   * @param x unsigned 256-bit integer number
   * @return unsigned 128-bit integer number
   */
  function sqrtu (uint256 x) private pure returns (uint128) {
    unchecked {
      if (x == 0) return 0;
      else {
        uint256 xx = x;
        uint256 r = 1;
        if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }
        if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }
        if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }
        if (xx >= 0x10000) { xx >>= 16; r <<= 8; }
        if (xx >= 0x100) { xx >>= 8; r <<= 4; }
        if (xx >= 0x10) { xx >>= 4; r <<= 2; }
        if (xx >= 0x4) { r <<= 1; }
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1; // Seven iterations should be enough
        uint256 r1 = x / r;
        return uint128 (r < r1 ? r : r1);
      }
    }
  }
}

// File: @faircrypto/xen-crypto/contracts/Math.sol

pragma solidity ^0.8.10;

library Math {

    function min(uint256 a, uint256 b) external pure returns (uint256) {
        if (a > b) return b;
        return a;
    }

    function max(uint256 a, uint256 b) external pure returns (uint256) {
        if (a > b) return a;
        return b;
    }

    function logX64(uint256 x) external pure returns (int128) {
        return ABDKMath64x64.log_2(ABDKMath64x64.fromUInt(x));
    }
}

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol

// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// File: @openzeppelin/contracts/token/ERC20/ERC20.sol

// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;



/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

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

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

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

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

// File: @openzeppelin/contracts/interfaces/IERC165.sol

// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)

pragma solidity ^0.8.0;

// File: @faircrypto/xen-crypto/contracts/interfaces/IStakingToken.sol

pragma solidity ^0.8.10;

interface IStakingToken {
    event Staked(address indexed user, uint256 amount, uint256 term);

    event Withdrawn(address indexed user, uint256 amount, uint256 reward);

    function stake(uint256 amount, uint256 term) external;

    function withdraw() external;
}

// File: @faircrypto/xen-crypto/contracts/interfaces/IRankedMintingToken.sol

pragma solidity ^0.8.10;

interface IRankedMintingToken {
    event RankClaimed(address indexed user, uint256 term, uint256 rank);

    event MintClaimed(address indexed user, uint256 rewardAmount);

    function claimRank(uint256 term) external;

    function claimMintReward() external;
}

// File: @faircrypto/xen-crypto/contracts/interfaces/IBurnableToken.sol

pragma solidity ^0.8.10;

interface IBurnableToken {
    function burn(address user, uint256 amount) external;
}

// File: @faircrypto/xen-crypto/contracts/interfaces/IBurnRedeemable.sol

pragma solidity ^0.8.10;

interface IBurnRedeemable {
    event Redeemed(
        address indexed user,
        address indexed xenContract,
        address indexed tokenContract,
        uint256 xenAmount,
        uint256 tokenAmount
    );

    function onTokenBurned(address user, uint256 amount) external;
}

// File: @faircrypto/xen-crypto/contracts/XENCrypto.sol

pragma solidity ^0.8.10;








contract XENCrypto is Context, IRankedMintingToken, IStakingToken, IBurnableToken, ERC20("XEN Crypto", "XEN") {
    using Math for uint256;
    using ABDKMath64x64 for int128;
    using ABDKMath64x64 for uint256;

    // INTERNAL TYPE TO DESCRIBE A XEN MINT INFO
    struct MintInfo {
        address user;
        uint256 term;
        uint256 maturityTs;
        uint256 rank;
        uint256 amplifier;
        uint256 eaaRate;
    }

    // INTERNAL TYPE TO DESCRIBE A XEN STAKE
    struct StakeInfo {
        uint256 term;
        uint256 maturityTs;
        uint256 amount;
        uint256 apy;
    }

    // PUBLIC CONSTANTS

    uint256 public constant SECONDS_IN_DAY = 3_600 * 24;
    uint256 public constant DAYS_IN_YEAR = 365;

    uint256 public constant GENESIS_RANK = 1;

    uint256 public constant MIN_TERM = 1 * SECONDS_IN_DAY - 1;
    uint256 public constant MAX_TERM_START = 100 * SECONDS_IN_DAY;
    uint256 public constant MAX_TERM_END = 1_000 * SECONDS_IN_DAY;
    uint256 public constant TERM_AMPLIFIER = 15;
    uint256 public constant TERM_AMPLIFIER_THRESHOLD = 5_000;
    uint256 public constant REWARD_AMPLIFIER_START = 3_000;
    uint256 public constant REWARD_AMPLIFIER_END = 1;
    uint256 public constant EAA_PM_START = 100;
    uint256 public constant EAA_PM_STEP = 1;
    uint256 public constant EAA_RANK_STEP = 100_000;
    uint256 public constant WITHDRAWAL_WINDOW_DAYS = 7;
    uint256 public constant MAX_PENALTY_PCT = 99;

    uint256 public constant XEN_MIN_STAKE = 0;

    uint256 public constant XEN_MIN_BURN = 0;

    uint256 public constant XEN_APY_START = 20;
    uint256 public constant XEN_APY_DAYS_STEP = 90;
    uint256 public constant XEN_APY_END = 2;

    string public constant AUTHORS = "@MrJackLevin @lbelyaev faircrypto.org";

    // PUBLIC STATE, READABLE VIA NAMESAKE GETTERS

    uint256 public immutable genesisTs;
    uint256 public globalRank = GENESIS_RANK;
    uint256 public activeMinters;
    uint256 public activeStakes;
    uint256 public totalXenStaked;
    // user address => XEN mint info
    mapping(address => MintInfo) public userMints;
    // user address => XEN stake info
    mapping(address => StakeInfo) public userStakes;
    // user address => XEN burn amount
    mapping(address => uint256) public userBurns;

    // CONSTRUCTOR
    constructor() {
        genesisTs = block.timestamp;
    }

    // PRIVATE METHODS

    /**
     * @dev calculates current MaxTerm based on Global Rank
     *      (if Global Rank crosses over TERM_AMPLIFIER_THRESHOLD)
     */
    function _calculateMaxTerm() private view returns (uint256) {
        if (globalRank > TERM_AMPLIFIER_THRESHOLD) {
            uint256 delta = globalRank.fromUInt().log_2().mul(TERM_AMPLIFIER.fromUInt()).toUInt();
            uint256 newMax = MAX_TERM_START + delta * SECONDS_IN_DAY;
            return Math.min(newMax, MAX_TERM_END);
        }
        return MAX_TERM_START;
    }

    /**
     * @dev calculates Withdrawal Penalty depending on lateness
     */
    function _penalty(uint256 secsLate) private pure returns (uint256) {
        // =MIN(2^(daysLate+3)/window-1,99)
        uint256 daysLate = secsLate / SECONDS_IN_DAY;
        if (daysLate > WITHDRAWAL_WINDOW_DAYS - 1) return MAX_PENALTY_PCT;
        uint256 penalty = (uint256(1) << (daysLate + 3)) / WITHDRAWAL_WINDOW_DAYS - 1;
        return Math.min(penalty, MAX_PENALTY_PCT);
    }

    /**
     * @dev calculates net Mint Reward (adjusted for Penalty)
     */
    function _calculateMintReward(
        uint256 cRank,
        uint256 term,
        uint256 maturityTs,
        uint256 amplifier,
        uint256 eeaRate
    ) private view returns (uint256) {
        uint256 secsLate = block.timestamp - maturityTs;
        uint256 penalty = _penalty(secsLate);
        uint256 rankDelta = Math.max(globalRank - cRank, 2);
        uint256 EAA = (1_000 + eeaRate);
        uint256 reward = getGrossReward(rankDelta, amplifier, term, EAA);
        return (reward * (100 - penalty)) / 100;
    }

    /**
     * @dev cleans up User Mint storage (gets some Gas credit;))
     */
    function _cleanUpUserMint() private {
        delete userMints[_msgSender()];
        activeMinters--;
    }

    /**
     * @dev calculates XEN Stake Reward
     */
    function _calculateStakeReward(
        uint256 amount,
        uint256 term,
        uint256 maturityTs,
        uint256 apy
    ) private view returns (uint256) {
        if (block.timestamp > maturityTs) {
            uint256 rate = (apy * term * 1_000_000) / DAYS_IN_YEAR;
            return (amount * rate) / 100_000_000;
        }
        return 0;
    }

    /**
     * @dev calculates Reward Amplifier
     */
    function _calculateRewardAmplifier() private view returns (uint256) {
        uint256 amplifierDecrease = (block.timestamp - genesisTs) / SECONDS_IN_DAY;
        if (amplifierDecrease < REWARD_AMPLIFIER_START) {
            return Math.max(REWARD_AMPLIFIER_START - amplifierDecrease, REWARD_AMPLIFIER_END);
        } else {
            return REWARD_AMPLIFIER_END;
        }
    }

    /**
     * @dev calculates Early Adopter Amplifier Rate (in 1/000ths)
     *      actual EAA is (1_000 + EAAR) / 1_000
     */
    function _calculateEAARate() private view returns (uint256) {
        uint256 decrease = (EAA_PM_STEP * globalRank) / EAA_RANK_STEP;
        if (decrease > EAA_PM_START) return 0;
        return EAA_PM_START - decrease;
    }

    /**
     * @dev calculates APY (in %)
     */
    function _calculateAPY() private view returns (uint256) {
        uint256 decrease = (block.timestamp - genesisTs) / (SECONDS_IN_DAY * XEN_APY_DAYS_STEP);
        if (XEN_APY_START - XEN_APY_END < decrease) return XEN_APY_END;
        return XEN_APY_START - decrease;
    }

    /**
     * @dev creates User Stake
     */
    function _createStake(uint256 amount, uint256 term) private {
        userStakes[_msgSender()] = StakeInfo({
            term: term,
            maturityTs: block.timestamp + term * SECONDS_IN_DAY,
            amount: amount,
            apy: _calculateAPY()
        });
        activeStakes++;
        totalXenStaked += amount;
    }

    // PUBLIC CONVENIENCE GETTERS

    /**
     * @dev calculates gross Mint Reward
     */
    function getGrossReward(
        uint256 rankDelta,
        uint256 amplifier,
        uint256 term,
        uint256 eaa
    ) public pure returns (uint256) {
        int128 log128 = rankDelta.fromUInt().log_2();
        int128 reward128 = log128.mul(amplifier.fromUInt()).mul(term.fromUInt()).mul(eaa.fromUInt());
        return reward128.div(uint256(1_000).fromUInt()).toUInt();
    }

    /**
     * @dev returns User Mint object associated with User account address
     */
    function getUserMint() external view returns (MintInfo memory) {
        return userMints[_msgSender()];
    }

    /**
     * @dev returns XEN Stake object associated with User account address
     */
    function getUserStake() external view returns (StakeInfo memory) {
        return userStakes[_msgSender()];
    }

    /**
     * @dev returns current AMP
     */
    function getCurrentAMP() external view returns (uint256) {
        return _calculateRewardAmplifier();
    }

    /**
     * @dev returns current EAA Rate
     */
    function getCurrentEAAR() external view returns (uint256) {
        return _calculateEAARate();
    }

    /**
     * @dev returns current APY
     */
    function getCurrentAPY() external view returns (uint256) {
        return _calculateAPY();
    }

    /**
     * @dev returns current MaxTerm
     */
    function getCurrentMaxTerm() external view returns (uint256) {
        return _calculateMaxTerm();
    }

    // PUBLIC STATE-CHANGING METHODS

    /**
     * @dev accepts User cRank claim provided all checks pass (incl. no current claim exists)
     */
    function claimRank(uint256 term) external {
        uint256 termSec = term * SECONDS_IN_DAY;
        require(termSec > MIN_TERM, "CRank: Term less than min");
        require(termSec < _calculateMaxTerm() + 1, "CRank: Term more than current max term");
        require(userMints[_msgSender()].rank == 0, "CRank: Mint already in progress");

        // create and store new MintInfo
        MintInfo memory mintInfo = MintInfo({
            user: _msgSender(),
            term: term,
            maturityTs: block.timestamp + termSec,
            rank: globalRank,
            amplifier: _calculateRewardAmplifier(),
            eaaRate: _calculateEAARate()
        });
        userMints[_msgSender()] = mintInfo;
        activeMinters++;
        emit RankClaimed(_msgSender(), term, globalRank++);
    }

    /**
     * @dev ends minting upon maturity (and within permitted Withdrawal Time Window), gets minted XEN
     */
    function claimMintReward() external {
        MintInfo memory mintInfo = userMints[_msgSender()];
        require(mintInfo.rank > 0, "CRank: No mint exists");
        require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached");

        // calculate reward and mint tokens
        uint256 rewardAmount = _calculateMintReward(
            mintInfo.rank,
            mintInfo.term,
            mintInfo.maturityTs,
            mintInfo.amplifier,
            mintInfo.eaaRate
        ) * 1 ether;
        _mint(_msgSender(), rewardAmount);

        _cleanUpUserMint();
        emit MintClaimed(_msgSender(), rewardAmount);
    }

    /**
     * @dev  ends minting upon maturity (and within permitted Withdrawal time Window)
     *       mints XEN coins and splits them between User and designated other address
     */
    function claimMintRewardAndShare(address other, uint256 pct) external {
        MintInfo memory mintInfo = userMints[_msgSender()];
        require(other != address(0), "CRank: Cannot share with zero address");
        require(pct > 0, "CRank: Cannot share zero percent");
        require(pct < 101, "CRank: Cannot share 100+ percent");
        require(mintInfo.rank > 0, "CRank: No mint exists");
        require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached");

        // calculate reward
        uint256 rewardAmount = _calculateMintReward(
            mintInfo.rank,
            mintInfo.term,
            mintInfo.maturityTs,
            mintInfo.amplifier,
            mintInfo.eaaRate
        ) * 1 ether;
        uint256 sharedReward = (rewardAmount * pct) / 100;
        uint256 ownReward = rewardAmount - sharedReward;

        // mint reward tokens
        _mint(_msgSender(), ownReward);
        _mint(other, sharedReward);

        _cleanUpUserMint();
        emit MintClaimed(_msgSender(), rewardAmount);
    }

    /**
     * @dev  ends minting upon maturity (and within permitted Withdrawal time Window)
     *       mints XEN coins and stakes 'pct' of it for 'term'
     */
    function claimMintRewardAndStake(uint256 pct, uint256 term) external {
        MintInfo memory mintInfo = userMints[_msgSender()];
        // require(pct > 0, "CRank: Cannot share zero percent");
        require(pct < 101, "CRank: Cannot share >100 percent");
        require(mintInfo.rank > 0, "CRank: No mint exists");
        require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached");

        // calculate reward
        uint256 rewardAmount = _calculateMintReward(
            mintInfo.rank,
            mintInfo.term,
            mintInfo.maturityTs,
            mintInfo.amplifier,
            mintInfo.eaaRate
        ) * 1 ether;
        uint256 stakedReward = (rewardAmount * pct) / 100;
        uint256 ownReward = rewardAmount - stakedReward;

        // mint reward tokens part
        _mint(_msgSender(), ownReward);
        _cleanUpUserMint();
        emit MintClaimed(_msgSender(), rewardAmount);

        // nothing to burn since we haven't minted this part yet
        // stake extra tokens part
        require(stakedReward > XEN_MIN_STAKE, "XEN: Below min stake");
        require(term * SECONDS_IN_DAY > MIN_TERM, "XEN: Below min stake term");
        require(term * SECONDS_IN_DAY < MAX_TERM_END + 1, "XEN: Above max stake term");
        require(userStakes[_msgSender()].amount == 0, "XEN: stake exists");

        _createStake(stakedReward, term);
        emit Staked(_msgSender(), stakedReward, term);
    }

    /**
     * @dev initiates XEN Stake in amount for a term (days)
     */
    function stake(uint256 amount, uint256 term) external {
        require(balanceOf(_msgSender()) >= amount, "XEN: not enough balance");
        require(amount > XEN_MIN_STAKE, "XEN: Below min stake");
        require(term * SECONDS_IN_DAY > MIN_TERM, "XEN: Below min stake term");
        require(term * SECONDS_IN_DAY < MAX_TERM_END + 1, "XEN: Above max stake term");
        require(userStakes[_msgSender()].amount == 0, "XEN: stake exists");

        // burn staked XEN
        _burn(_msgSender(), amount);
        // create XEN Stake
        _createStake(amount, term);
        emit Staked(_msgSender(), amount, term);
    }

    /**
     * @dev ends XEN Stake and gets reward if the Stake is mature
     */
    function withdraw() external {
        StakeInfo memory userStake = userStakes[_msgSender()];
        require(userStake.amount > 0, "XEN: no stake exists");

        uint256 xenReward = _calculateStakeReward(
            userStake.amount,
            userStake.term,
            userStake.maturityTs,
            userStake.apy
        );
        activeStakes--;
        totalXenStaked -= userStake.amount;

        // mint staked XEN (+ reward)
        _mint(_msgSender(), userStake.amount + xenReward);
        emit Withdrawn(_msgSender(), userStake.amount, xenReward);
        delete userStakes[_msgSender()];
    }

    /**
     * @dev burns XEN tokens and creates Proof-Of-Burn record to be used by connected DeFi services
     */
    function burn(address user, uint256 amount) public {
        require(amount > XEN_MIN_BURN, "Burn: Below min limit");
        require(
            IERC165(_msgSender()).supportsInterface(type(IBurnRedeemable).interfaceId),
            "Burn: not a supported contract"
        );

        _spendAllowance(user, _msgSender(), amount);
        _burn(user, amount);
        userBurns[user] += amount;
        IBurnRedeemable(_msgSender()).onTokenBurned(user, amount);
    }
}

// File: @faircrypto/magic-numbers/contracts/MagicNumbers.sol

pragma solidity ^0.8.10;

/*

        \\      //   |||||||||||   |\      ||       A CRYPTOCURRENCY FOR THE MASSES
         \\    //    ||            |\\     ||
          \\  //     ||            ||\\    ||       PRINCIPLES OF XEN:
           \\//      ||            || \\   ||       - No pre-mint; starts with zero supply
            XX       ||||||||      ||  \\  ||       - No admin keys
           //\\      ||            ||   \\ ||       - Immutable contract
          //  \\     ||            ||    \\||
         //    \\    ||            ||     \\|
        //      \\   |||||||||||   ||      \|       Copyright (C) FairCrypto Foundation 2022-2023

 */

library MagicNumbers {

    uint256 constant VERSION = 1;
    string public constant AUTHORS = "@MrJackLevin @lbelyaev faircrypto.org";

    // There's 370 fibs that fit in uint256 number
    uint256 constant MAX_UINT256_FIB_IDX = 370;
    // Max fib number that fits into uint256 size
    uint256 constant MAX_UINT256_FIB = 94611056096305838013295371573764256526437182762229865607320618320601813254535;
    // Max fib index supported by this Library
    uint256 constant MAX_FIB_IDX = 90;
    // Max number that could be safely tested by this Library
    uint256 constant MAX_SUPPORTED_FIB_CANDIDATE = 2 ** 62 - 1;

    /**
        @dev First 60 Fibonacci numbers, which fit into uint64
    */
    function fibs64() internal pure returns (uint64[60] memory) {
        return [
            uint64(0),            1,                     1,
            2,                    3,                     5,
            8,                    13,                    21,
            34,                   55,                    89,
            144,                  233,                   377,
            610,                  987,                   1597,
            2584,                 4181,                  6765,
            10946,                17711,                 28657,
            46368,                75025,                 121393,
            196418,               317811,                514229,
            832040,               1346269,               2178309,
            3524578,              5702887,               9227465,
            14930352,             24157817,              39088169,
            63245986,             102334155,             165580141,
            267914296,            433494437,             701408733,
            1134903170,           1836311903,            2971215073,
            4807526976,           7778742049,            12586269025,
            20365011074,          32951280099,           53316291173,
            86267571272,          139583862445,          225851433717,
            365435296162,         591286729879,          956722026041
        ];
    }

    /**
        @dev Tests if number is a fib via a linear lookup in the table above
    */
    function isFibs64(uint256 n) internal pure returns (bool) {
        for(uint i = 0; i < 60; i++) if (fibs64()[i] == n) return true;
        return false;
    }

    /**
        @dev Next 38 Fibonacci numbers, which fit into uint128
    */
    function fibs128() internal pure returns (uint128[39] memory) {
        return [
            uint128(1548008755920),2504730781961,        4052739537881,
            6557470319842,        10610209857723,        17167680177565,
            27777890035288,       44945570212853,        72723460248141,
            117669030460994,      190392490709135,       308061521170129,
            498454011879264,      806515533049393,       1304969544928657,
            2111485077978050,     3416454622906707,      5527939700884757,
            8944394323791464,     14472334024676221,     23416728348467685,
            37889062373143906,    61305790721611591,     99194853094755497,
            160500643816367088,   259695496911122585,    420196140727489673,
            679891637638612258,   1100087778366101931,   1779979416004714189,
            2880067194370816120,  4660046610375530309,   7540113804746346429,
            12200160415121876738, 19740274219868223167,  31940434634990099905,
            51680708854858323072, 83621143489848422977,  135301852344706746049
        ];
    }

    /**
        @dev Tests if number is a fib via a linear lookup in the table above
    */
    function isFibs128(uint256 n) internal pure returns (bool) {
        for(uint i = 0; i < 39; i++) if (fibs128()[i] == n) return true;
        return false;
    }

    /**
        @dev Helper for Miller-Rabin probabilistic primality test
    */
    // Write (n - 1) as 2^s * d
    function getValues(uint256 n) internal pure returns (uint256[2] memory) {
        uint256 s = 0;
        uint256 d = n - 1;
        while (d % 2 == 0) {
            d = d / 2;
            s++;
        }
        uint256[2] memory ret;
        ret[0] = s;
        ret[1] = d;
        return ret;
    }

    /**
        @dev Wrapper around EVM precompiled function for modular exponentiation, deployed at 0x05 address
    */
    function modExp(uint256 base, uint256 e, uint256 m) internal view returns (uint o) {
        assembly {
        // define pointer
            let p := mload(0x40)
        // store data assembly-favouring ways
            mstore(p, 0x20)             // Length of Base
            mstore(add(p, 0x20), 0x20)  // Length of Exponent
            mstore(add(p, 0x40), 0x20)  // Length of Modulus
            mstore(add(p, 0x60), base)  // Base
            mstore(add(p, 0x80), e)     // Exponent
            mstore(add(p, 0xa0), m)     // Modulus
        if iszero(staticcall(sub(gas(), 2000), 0x05, p, 0xc0, p, 0x20)) {
           revert(0, 0)
        }
        // data
            o := mload(p)
        }
    }

    /**
      @dev  Miller-Rabin test probabilistic primality test
            see https://en.wikipedia.org/wiki/Miller–Rabin_primality_test
    */
    function probablyPrime(uint256 n, uint256 prime) internal view returns (bool) {
        if (n == 2 || n == 3) {
            return true;
        }

        if (n % 2 == 0 || n < 2) {
            return false;
        }

        uint256[2] memory values = getValues(n);
        uint256 s = values[0];
        uint256 d = values[1];

        uint256 x = modExp(prime, d, n);

        if (x == 1 || x == n - 1) {
            return true;
        }

        for (uint256 i = s - 1; i > 0; i--) {
            x = modExp(x, 2, n);
            if (x == 1) {
                return false;
            }
            if (x == n - 1) {
                return true;
            }
        }
        return false;
    }

    /**
      @dev  Determines if a number is prime, using Miller-Rabin test probabilistic primality test
            plus deterministic checking to sift out pseudo-primes
            see https://en.wikipedia.org/wiki/Miller–Rabin_primality_test
    */
    function isPrime(uint256 n) public view returns (bool) {
        if (n < 2_047)
            return probablyPrime(n, 2);
        else if (n < 1_373_653)
            return probablyPrime(n, 2) && probablyPrime(n, 3);
        else if (n < 9_080_191)
            return probablyPrime(n, 31) && probablyPrime(n, 73);
        else if (n < 25_326_001)
            return probablyPrime(n, 2) && probablyPrime(n, 3)
            && probablyPrime(n, 5);
        else if (n < 3_215_031_751)
            return probablyPrime(n, 2) && probablyPrime(n, 3)
            && probablyPrime(n, 5) && probablyPrime(n, 7);
        else if (n < 4_759_123_141)
            return probablyPrime(n, 2) && probablyPrime(n, 7)
            && probablyPrime(n, 61);
        else if (n < 1_122_004_669_633)
            return probablyPrime(n, 2) && probablyPrime(n, 13)
            && probablyPrime(n, 23) && probablyPrime(n, 1662803);
        else if (n < 2_152_302_898_747)
            return probablyPrime(n, 2) && probablyPrime(n, 3)
            && probablyPrime(n, 5) && probablyPrime(n, 7)
            && probablyPrime(n, 11);
        else if (n < 3_474_749_660_383)
            return probablyPrime(n, 2) && probablyPrime(n, 3)
            && probablyPrime(n, 5) && probablyPrime(n, 7)
            && probablyPrime(n, 11) && probablyPrime(n, 13);
        else if (n < 341_550_071_728_321)
            return probablyPrime(n, 2) && probablyPrime(n, 3)
            && probablyPrime(n, 5) && probablyPrime(n, 7)
            && probablyPrime(n, 11) && probablyPrime(n, 13)
            && probablyPrime(n, 17);
        return false;
        // TODO: consider reverting ???
        // revert('number too big');
    }

    /**
        @dev Count prime numbers occurring between `from` and `to` numbers
    */
    function findPrimes(uint256 from, uint256 to) external view returns (uint256 count) {
        require(to > 0, "findPrimes: to should be natural");
        require(to > from, "findPrimes: to should be larger than from");
        count = 0;
        for(uint i = from; i < to; i++) {
            if (isPrime(i)) count++;
        }
    }

    /**
        @dev Helper to get N-th Fibonacci number (0 returns 0)
    */
    function getFib(uint256 n) internal pure returns (uint256 a) {
        if (n == 0) {
            return 0;
        }
        uint256 h = n / 2;
        uint256 mask = 1;
        // find highest set bit in n
        while(mask <= h) {
            mask <<= 1;
        }
        mask >>= 1;
        a = 1;
        uint256 b = 1;
        uint256 c;
        while(mask > 0) {
            c = a * a+b * b;
            if (n & mask > 0) {
                b = b * (b + 2 * a);
                a = c;
            } else {
                a = a * (2 * b - a);
                b = c;
            }
            mask >>= 1;
        }
        return a;
    }

    /**
        @dev Helper to check if a number is a perfect square
    */
    function isPerfectSquare(uint256 n) internal pure returns (bool) {
       uint256 low = 0;
       uint256 high = n;
       while (low <= high) {
           uint mid = (low + high) / 2;
           uint square = mid * mid;
           if (square == n) {
               return true;
           } else if (square > n) {
               high = mid - 1;
           } else {
               low = mid + 1;
           }
       }
       return false;
   }

    /**
        @dev Test if the number is a fib
        note the upper limit of 2 ** 62 - 1, to avoid overflow while preforming tests
    */
   function isFib(uint256 n) public pure returns (bool) {
       if (n == 0) return false;
       require(n < MAX_SUPPORTED_FIB_CANDIDATE, 'isFib: number too big');
       uint256 base = n * n * 5;
       uint256 p1 = base + 4;
       uint256 p2 = base - 4;
       return (isPerfectSquare(p1) || isPerfectSquare(p2));
    }
}

// File: operator-filter-registry/src/IOperatorFilterRegistry.sol

pragma solidity ^0.8.13;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);
    function register(address registrant) external;
    function registerAndSubscribe(address registrant, address subscription) external;
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;
    function unregister(address addr) external;
    function updateOperator(address registrant, address operator, bool filtered) external;
    function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
    function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
    function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
    function subscribe(address registrant, address registrantToSubscribe) external;
    function unsubscribe(address registrant, bool copyExistingEntries) external;
    function subscriptionOf(address addr) external returns (address registrant);
    function subscribers(address registrant) external returns (address[] memory);
    function subscriberAt(address registrant, uint256 index) external returns (address);
    function copyEntriesOf(address registrant, address registrantToCopy) external;
    function isOperatorFiltered(address registrant, address operator) external returns (bool);
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
    function filteredOperators(address addr) external returns (address[] memory);
    function filteredCodeHashes(address addr) external returns (bytes32[] memory);
    function filteredOperatorAt(address registrant, uint256 index) external returns (address);
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
    function isRegistered(address addr) external returns (bool);
    function codeHashOf(address addr) external returns (bytes32);
}

// File: operator-filter-registry/src/OperatorFilterer.sol

pragma solidity ^0.8.13;

/**
 * @title  OperatorFilterer
 * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
 *         registrant's entries in the OperatorFilterRegistry.
 * @dev    This smart contract is meant to be inherited by token contracts so they can use the following:
 *         - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
 *         - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
 */
abstract contract OperatorFilterer {
    error OperatorNotAllowed(address operator);

    IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY =
        IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);

    constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
        // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
        // will not revert, but the contract will need to be registered with the registry once it is deployed in
        // order for the modifier to filter addresses.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (subscribe) {
                OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    OPERATOR_FILTER_REGISTRY.register(address(this));
                }
            }
        }
    }

    modifier onlyAllowedOperator(address from) virtual {
        // Allow spending tokens from addresses with balance
        // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
        // from an EOA.
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    modifier onlyAllowedOperatorApproval(address operator) virtual {
        _checkFilterOperator(operator);
        _;
    }

    function _checkFilterOperator(address operator) internal view virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }
}

// File: operator-filter-registry/src/DefaultOperatorFilterer.sol

pragma solidity ^0.8.13;

/**
 * @title  DefaultOperatorFilterer
 * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription.
 */
abstract contract DefaultOperatorFilterer is OperatorFilterer {
    address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

    constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
}

// File: contracts/libs/ERC2771Context.sol

// OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol)

pragma solidity ^0.8.10;

/**
 * @dev Context variant with ERC2771 support.
 */
abstract contract ERC2771Context is Context {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    // one-time settable var
    address internal _trustedForwarder;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(address trustedForwarder) {
        _trustedForwarder = trustedForwarder;
    }

    function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
        return forwarder == _trustedForwarder;
    }

    function _msgSender() internal view virtual override returns (address sender) {
        if (isTrustedForwarder(msg.sender)) {
            // The assembly code is more direct than the Solidity version using `abi.decode`.
            /// @solidity memory-safe-assembly
            assembly {
                sender := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            return super._msgSender();
        }
    }

    function _msgData() internal view virtual override returns (bytes calldata) {
        if (isTrustedForwarder(msg.sender)) {
            return msg.data[:msg.data.length - 20];
        } else {
            return super._msgData();
        }
    }
}

// File: contracts/interfaces/IERC2771.sol

pragma solidity ^0.8.10;

interface IERC2771 {
    function isTrustedForwarder(address forwarder) external;
}

// File: contracts/libs/StakeInfo.sol

pragma solidity ^0.8.10;

// mapping: NFT tokenId => StakeInfo (used in tokenURI generation + other contracts)
// StakeInfo encoded as:
//      term (uint16)
//      | maturityTs (uint64)
//      | amount (uint128) TODO: storing here vs. separately as full uint256 ???
//      | apy (uint16)
//      | rarityScore (uint16)
//      | rarityBits (uint16):
//          [15] tokenIdIsPrime
//          [14] tokenIdIsFib
//          [14] blockIdIsPrime
//          [13] blockIdIsFib
//          [0-13] ...
library StakeInfo {
    /**
        @dev helper to convert Bool to U256 type and make compiler happy
     */
    // TODO: remove if not needed ???
    function toU256(bool x) internal pure returns (uint256 r) {
        assembly {
            r := x
        }
    }

    /**
        @dev encodes StakeInfo record from its props
     */
    function encodeStakeInfo(
        uint256 term,
        uint256 maturityTs,
        uint256 amount,
        uint256 apy,
        uint256 rarityScore,
        uint256 rarityBits
    ) public pure returns (uint256 info) {
        info = info | (rarityBits & 0xFFFF);
        info = info | ((rarityScore & 0xFFFF) << 16);
        info = info | ((apy & 0xFFFF) << 32);
        info = info | ((amount & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) << 48);
        info = info | ((maturityTs & 0xFFFFFFFFFFFFFFFF) << 176);
        info = info | ((term & 0xFFFF) << 240);
    }

    /**
        @dev decodes StakeInfo record and extracts all of its props
     */
    function decodeStakeInfo(
        uint256 info
    )
        public
        pure
        returns (uint256 term, uint256 maturityTs, uint256 amount, uint256 apy, uint256 rarityScore, uint256 rarityBits)
    {
        term = uint16(info >> 240);
        maturityTs = uint64(info >> 176);
        amount = uint128(info >> 48);
        apy = uint16(info >> 32);
        rarityScore = uint16(info >> 16);
        rarityBits = uint16(info);
    }

    /**
        @dev extracts `term` prop from encoded StakeInfo
     */
    function getTerm(uint256 info) public pure returns (uint256 term) {
        (term, , , , , ) = decodeStakeInfo(info);
    }

    /**
        @dev extracts `maturityTs` prop from encoded StakeInfo
     */
    function getMaturityTs(uint256 info) public pure returns (uint256 maturityTs) {
        (, maturityTs, , , , ) = decodeStakeInfo(info);
    }

    /**
        @dev extracts `amount` prop from encoded StakeInfo
     */
    function getAmount(uint256 info) public pure returns (uint256 amount) {
        (, , amount, , , ) = decodeStakeInfo(info);
    }

    /**
        @dev extracts `APY` prop from encoded StakeInfo
     */
    function getAPY(uint256 info) public pure returns (uint256 apy) {
        (, , , apy, , ) = decodeStakeInfo(info);
    }

    /**
        @dev extracts `rarityScore` prop from encoded StakeInfo
     */
    function getRarityScore(uint256 info) public pure returns (uint256 rarityScore) {
        (, , , , rarityScore, ) = decodeStakeInfo(info);
    }

    /**
        @dev extracts `rarityBits` prop from encoded StakeInfo
     */
    function getRarityBits(uint256 info) public pure returns (uint256 rarityBits) {
        (, , , , , rarityBits) = decodeStakeInfo(info);
    }

    /**
        @dev decodes boolean flags from `rarityBits` prop
     */
    function decodeRarityBits(
        uint256 rarityBits
    ) public pure returns (bool isPrime, bool isFib, bool blockIsPrime, bool blockIsFib) {
        isPrime = rarityBits & 0x0008 > 0;
        isFib = rarityBits & 0x0004 > 0;
        blockIsPrime = rarityBits & 0x0002 > 0;
        blockIsFib = rarityBits & 0x0001 > 0;
    }

    /**
        @dev encodes boolean flags to `rarityBits` prop
     */
    function encodeRarityBits(
        bool isPrime,
        bool isFib,
        bool blockIsPrime,
        bool blockIsFib
    ) public pure returns (uint256 rarityBits) {
        rarityBits = rarityBits | ((toU256(isPrime) << 3) & 0xFFFF);
        rarityBits = rarityBits | ((toU256(isFib) << 2) & 0xFFFF);
        rarityBits = rarityBits | ((toU256(blockIsPrime) << 1) & 0xFFFF);
        rarityBits = rarityBits | ((toU256(blockIsFib)) & 0xFFFF);
    }

    /**
        @dev extracts `rarityBits` prop from encoded StakeInfo
     */
    function getRarityBitsDecoded(
        uint256 info
    ) public pure returns (bool isPrime, bool isFib, bool blockIsPrime, bool blockIsFib) {
        (, , , , , uint256 rarityBits) = decodeStakeInfo(info);
        (isPrime, isFib, blockIsPrime, blockIsFib) = decodeRarityBits(rarityBits);
    }
}

// File: contracts/libs/BokkyPooBahsDateTimeLibrary.sol

pragma solidity ^0.8.10;

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

library BokkyPooBahsDateTimeLibrary {
    uint256 constant _SECONDS_PER_DAY = 24 * 60 * 60;
    uint256 constant _SECONDS_PER_HOUR = 60 * 60;
    uint256 constant _SECONDS_PER_MINUTE = 60;
    int256 constant _OFFSET19700101 = 2440588;

    uint256 constant _DOW_FRI = 5;
    uint256 constant _DOW_SAT = 6;

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

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

        _days = uint256(__days);
    }

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

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

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

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

    function timestampFromDateTime(
        uint256 year,
        uint256 month,
        uint256 day,
        uint256 hour,
        uint256 minute,
        uint256 second
    ) internal pure returns (uint256 timestamp) {
        timestamp =
            _daysFromDate(year, month, day) *
            _SECONDS_PER_DAY +
            hour *
            _SECONDS_PER_HOUR +
            minute *
            _SECONDS_PER_MINUTE +
            second;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// File: contracts/libs/DateTime.sol

pragma solidity ^0.8.10;


/*
    @dev        Library to convert epoch timestamp to a human-readable Date-Time string
    @dependency uses BokkyPooBahsDateTimeLibrary.sol library internally
 */
library DateTime {
    using Strings for uint256;

    bytes public constant MONTHS = bytes("JanFebMarAprMayJunJulAugSepOctNovDec");

    /**
     *   @dev returns month as short (3-letter) string
     */
    function monthAsString(uint256 idx) internal pure returns (string memory) {
        require(idx > 0, "bad idx");
        bytes memory str = new bytes(3);
        uint256 offset = (idx - 1) * 3;
        str[0] = bytes1(MONTHS[offset]);
        str[1] = bytes1(MONTHS[offset + 1]);
        str[2] = bytes1(MONTHS[offset + 2]);
        return string(str);
    }

    /**
     *   @dev returns string representation of number left-padded for 2 symbols
     */
    function asPaddedString(uint256 n) internal pure returns (string memory) {
        if (n == 0) return "00";
        if (n < 10) return string.concat("0", n.toString());
        return n.toString();
    }

    /**
     *   @dev returns string of format 'Jan 01, 2022 18:00 UTC' for a given timestamp
     */
    function asString(uint256 ts) external pure returns (string memory) {
        (uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, ) = BokkyPooBahsDateTimeLibrary
            .timestampToDateTime(ts);
        return
            string(
                abi.encodePacked(
                    monthAsString(month),
                    " ",
                    day.toString(),
                    ", ",
                    year.toString(),
                    " ",
                    asPaddedString(hour),
                    ":",
                    asPaddedString(minute),
                    " UTC"
                )
            );
    }

    /**
     *   @dev returns (year, month as string) components of a date by timestamp
     */
    function yearAndMonth(uint256 ts) external pure returns (uint256, string memory) {
        (uint256 year, uint256 month, , , , ) = BokkyPooBahsDateTimeLibrary.timestampToDateTime(ts);
        return (year, monthAsString(month));
    }
}

// File: contracts/libs/FormattedStrings.sol

pragma solidity ^0.8.10;

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

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

// File: contracts/libs/StakeSVG.sol

pragma solidity ^0.8.10;



/*
    @dev        Library to create SVG image for XENFT metadata
    @dependency depends on DataTime.sol and StringData.sol libraries
 */
library StakeSVG {
    // Type to encode all data params for SVG image generation
    struct SvgParams {
        string symbol;
        address xenAddress;
        uint256 tokenId;
        uint256 term;
        uint256 maturityTs;
        uint256 amount;
        uint256 apy;
        uint256 rarityScore;
        uint256 rarityBits;
    }

    // Type to encode SVG gradient stop color on HSL color scale
    struct Color {
        uint256 h;
        uint256 s;
        uint256 l;
        uint256 a;
        uint256 off;
    }

    // Type to encode SVG gradient
    struct Gradient {
        Color[] colors;
        uint256 id;
        uint256[4] coords;
    }

    using DateTime for uint256;
    using Strings for uint256;
    using FormattedStrings for uint256;
    using Strings for address;

    string private constant _STYLE =
        "<style> "
        ".base {fill: #ededed;font-family:Montserrat,arial,sans-serif;font-size:30px;font-weight:400;} "
        ".series {text-transform: uppercase} "
        ".logo {font-size:200px;font-weight:100;} "
        ".meta {font-size:12px;} "
        ".small {font-size:8px;} "
        ".burn {font-weight:500;font-size:16px;} }"
        "</style>";

    string private constant _STAKE =
        "<g>"
        "<path "
        'stroke="#ededed" '
        'fill="none" '
        'transform="translate(250,379), scale(0.7)" '
        'd="m 0 5 a 5 5 0 0 1 5 -5 l 40 0 a 5 5 0 0 1 5 5 l 0 40 a 5 5 0 0 1 -5 5 l -40 0 a 5 5 0 0 1 -5 -5 l 0 -40z m 25 0 l 20 10 l -20 10 l -20 -10 l 20 -10 m 10 15 l 10 5 l -20 10 l -20 -10 l 10 -5 m 20 10 l 10 5 l -20 10 l -20 -10 l 10 -5"/>'
        "</g>";

    string private constant _LOGO =
        '<path fill="#ededed" '
        'd="M122.7,227.1 l-4.8,0l55.8,-74l0,3.2l-51.8,-69.2l5,0l48.8,65.4l-1.2,0l48.8,-65.4l4.8,0l-51.2,68.4l0,-1.6l55.2,73.2l-5,0l-52.8,-70.2l1.2,0l-52.8,70.2z" '
        'vector-effect="non-scaling-stroke" />';

    /**
        @dev internal helper to create HSL-encoded color prop for SVG tags
     */
    function colorHSL(Color memory c) internal pure returns (bytes memory) {
        return abi.encodePacked("hsl(", c.h.toString(), ", ", c.s.toString(), "%, ", c.l.toString(), "%)");
    }

    /**
        @dev internal helper to create `stop` SVG tag
     */
    function colorStop(Color memory c) internal pure returns (bytes memory) {
        return
            abi.encodePacked(
                '<stop stop-color="',
                colorHSL(c),
                '" stop-opacity="',
                c.a.toString(),
                '" offset="',
                c.off.toString(),
                '%"/>'
            );
    }

    /**
        @dev internal helper to encode position for `Gradient` SVG tag
     */
    function pos(uint256[4] memory coords) internal pure returns (bytes memory) {
        return
            abi.encodePacked(
                'x1="',
                coords[0].toString(),
                '%" '
                'y1="',
                coords[1].toString(),
                '%" '
                'x2="',
                coords[2].toString(),
                '%" '
                'y2="',
                coords[3].toString(),
                '%" '
            );
    }

    /**
        @dev internal helper to create `Gradient` SVG tag
     */
    function linearGradient(
        Color[] memory colors,
        uint256 id,
        uint256[4] memory coords
    ) internal pure returns (bytes memory) {
        string memory stops = "";
        for (uint256 i = 0; i < colors.length; i++) {
            if (colors[i].h != 0) {
                stops = string.concat(stops, string(colorStop(colors[i])));
            }
        }
        return
            abi.encodePacked(
                "<linearGradient  ",
                pos(coords),
                'id="g',
                id.toString(),
                '">',
                stops,
                "</linearGradient>"
            );
    }

    /**
        @dev internal helper to create `Defs` SVG tag
     */
    function defs(Gradient memory grad) internal pure returns (bytes memory) {
        return abi.encodePacked("<defs>", linearGradient(grad.colors, 0, grad.coords), "</defs>");
    }

    /**
        @dev internal helper to create `Rect` SVG tag
     */
    function rect(uint256 id) internal pure returns (bytes memory) {
        return
            abi.encodePacked(
                "<rect "
                'width="100%" '
                'height="100%" '
                'fill="url(#g',
                id.toString(),
                ')" '
                'rx="10px" '
                'ry="10px" '
                'stroke-linejoin="round" '
                "/>"
            );
    }

    /**
        @dev internal helper to create border `Rect` SVG tag
     */
    function border() internal pure returns (string memory) {
        return
            "<rect "
            'width="94%" '
            'height="96%" '
            'fill="transparent" '
            'rx="10px" '
            'ry="10px" '
            'stroke-linejoin="round" '
            'x="3%" '
            'y="2%" '
            'stroke-dasharray="1,6" '
            'stroke="white" '
            "/>";
    }

    /**
        @dev internal helper to create group `G` SVG tag
     */
    function g(uint256 gradientsCount) internal pure returns (bytes memory) {
        string memory background = "";
        for (uint256 i = 0; i < gradientsCount; i++) {
            background = string.concat(background, string(rect(i)));
        }
        return abi.encodePacked("<g>", background, border(), "</g>");
    }

    /**
        @dev internal helper to create XEN logo line pattern with 2 SVG `lines`
     */
    function logo() internal pure returns (bytes memory) {
        return abi.encodePacked();
    }

    /**
        @dev internal helper to create `Text` SVG tag with XEN Crypto contract data
     */
    function contractData(string memory symbol, address xenAddress) internal pure returns (bytes memory) {
        return
            abi.encodePacked(
                "<text "
                'x="50%" '
                'y="5%" '
                'class="base small" '
                'dominant-baseline="middle" '
                'text-anchor="middle">',
                symbol,
                unicode"・",
                xenAddress.toHexString(),
                "</text>"
            );
    }

    /**
        @dev internal helper to create 1st part of metadata section of SVG
     */
    function meta1(
        uint256 tokenId,
        uint256 amount,
        uint256 apy,
        uint256 rarityScore
    ) internal pure returns (bytes memory) {
        bytes memory part1 = abi.encodePacked(
            "<text "
            'x="50%" '
            'y="50%" '
            'class="base " '
            'dominant-baseline="middle" '
            'text-anchor="middle">'
            "XEN CRYPTO"
            "</text>"
            "<text "
            'x="50%" '
            'y="56%" '
            'class="base burn" '
            'text-anchor="middle" '
            'dominant-baseline="middle"> ',
            amount > 0 ? string.concat(amount.toFormattedString(), " X") : "",
            "</text>"
            "<text "
            'x="18%" '
            'y="62%" '
            'class="base meta" '
            'dominant-baseline="middle"> '
            "#",
            tokenId.toString(),
            "</text>"
            "<text "
            'x="82%" '
            'y="62%" '
            'class="base meta series" '
            'dominant-baseline="middle" '
            'text-anchor="end" >STAKE</text>'
        );
        bytes memory part2 = abi.encodePacked(
            "<text "
            'x="18%" '
            'y="68%" '
            'class="base meta" '
            'dominant-baseline="middle" >'
            "APY: ",
            apy.toString(),
            "%"
            "</text>"
            "<text "
            'x="18%" '
            'y="72%" '
            'class="base meta" '
            'dominant-baseline="middle" >'
            "Rarity: ",
            rarityScore.toString(),
            "</text>"
        );
        return abi.encodePacked(part1, part2);
    }

    /**
        @dev internal helper to create 2nd part of metadata section of SVG
     */
    function meta2(uint256 term, uint256 maturityTs) internal pure returns (bytes memory) {
        bytes memory part3 = abi.encodePacked(
            "<text "
            'x="18%" '
            'y="76%" '
            'class="base meta" '
            'dominant-baseline="middle" >'
            "Term: ",
            term.toString(),
            " days"
            "</text>"
            "<text "
            'x="18%" '
            'y="80%" '
            'class="base meta" '
            'dominant-baseline="middle" >'
            "Maturity: ",
            maturityTs.asString(),
            "</text>"
        );
        return abi.encodePacked(part3);
    }

    /**
        @dev main internal helper to create SVG file representing XENFT
     */
    function image(SvgParams memory params, Gradient[] memory gradients) internal pure returns (bytes memory) {
        string memory mark = _STAKE;
        bytes memory graphics = abi.encodePacked(defs(gradients[0]), _STYLE, g(gradients.length), _LOGO, mark);
        bytes memory metadata = abi.encodePacked(
            contractData(params.symbol, params.xenAddress),
            meta1(params.tokenId, params.amount, params.apy, params.rarityScore),
            meta2(params.term, params.maturityTs)
        );
        return
            abi.encodePacked(
                "<svg "
                'xmlns="http://www.w3.org/2000/svg" '
                'preserveAspectRatio="xMinYMin meet" '
                'viewBox="0 0 350 566">',
                graphics,
                metadata,
                "</svg>"
            );
    }
}

// File: contracts/libs/StakeMetadata.sol

pragma solidity ^0.8.10;






/**
    @dev Library contains methods to generate on-chain NFT metadata
*/
library StakeMetadata {
    using DateTime for uint256;
    using StakeInfo for uint256;
    using Strings for uint256;

    // PRIVATE HELPERS

    // The following pure methods returning arrays are workaround to use array constants,
    // not yet available in Solidity

    /**
        @dev private helper to generate SVG gradients
     */
    function _commonCategoryGradients() private pure returns (StakeSVG.Gradient[] memory gradients) {
        StakeSVG.Color[] memory colors = new StakeSVG.Color[](3);
        colors[0] = StakeSVG.Color({h: 50, s: 10, l: 36, a: 1, off: 0});
        colors[1] = StakeSVG.Color({h: 50, s: 10, l: 12, a: 1, off: 50});
        colors[2] = StakeSVG.Color({h: 50, s: 10, l: 5, a: 1, off: 100});
        gradients = new StakeSVG.Gradient[](1);
        gradients[0] = StakeSVG.Gradient({colors: colors, id: 0, coords: [uint256(50), 0, 50, 100]});
    }

    // PUBLIC INTERFACE

    /**
        @dev public interface to generate SVG image based on XENFT params
     */
    function svgData(uint256 tokenId, uint256 info, address token) external view returns (bytes memory) {
        string memory symbol = IERC20Metadata(token).symbol();
        StakeSVG.SvgParams memory params = StakeSVG.SvgParams({
            symbol: symbol,
            xenAddress: token,
            tokenId: tokenId,
            term: info.getTerm(),
            maturityTs: info.getMaturityTs(),
            amount: info.getAmount(),
            apy: info.getAPY(),
            rarityScore: info.getRarityScore(),
            rarityBits: info.getRarityBits()
        });
        return StakeSVG.image(params, _commonCategoryGradients());
    }

    function _attr1(uint256 amount, uint256 apy) private pure returns (bytes memory) {
        return
            abi.encodePacked(
                '{"trait_type":"Amount","value":"',
                amount.toString(),
                '"},'
                '{"trait_type":"APY","value":"',
                apy.toString(),
                '%"},'
            );
    }

    function _attr2(uint256 term, uint256 maturityTs) private pure returns (bytes memory) {
        (uint256 year, string memory month) = DateTime.yearAndMonth(maturityTs);
        return
            abi.encodePacked(
                '{"trait_type":"Maturity DateTime","value":"',
                maturityTs.asString(),
                '"},'
                '{"trait_type":"Term","value":"',
                term.toString(),
                '"},'
                '{"trait_type":"Maturity Year","value":"',
                year.toString(),
                '"},'
                '{"trait_type":"Maturity Month","value":"',
                month,
                '"},'
            );
    }

    function _attr3(uint256 rarityScore, uint256) private pure returns (bytes memory) {
        return abi.encodePacked('{"trait_type":"Rarity","value":"', rarityScore.toString(), '"}');
    }

    /**
        @dev private helper to construct attributes portion of NFT metadata
     */
    function attributes(uint256 stakeInfo) external pure returns (bytes memory) {
        (
            uint256 term,
            uint256 maturityTs,
            uint256 amount,
            uint256 apy,
            uint256 rarityScore,
            uint256 rarityBits
        ) = StakeInfo.decodeStakeInfo(stakeInfo);
        return
            abi.encodePacked("[", _attr1(amount, apy), _attr2(term, maturityTs), _attr3(rarityScore, rarityBits), "]");
    }

    function formattedString(uint256 n) public pure returns (string memory) {
        return FormattedStrings.toFormattedString(n);
    }
}

// File: contracts/libs/Array.sol

pragma solidity ^0.8.10;

library Array {
    function idx(uint256[] memory arr, uint256 item) internal pure returns (uint256 i) {
        for (i = 1; i <= arr.length; i++) {
            if (arr[i - 1] == item) {
                return i;
            }
        }
        i = 0;
    }

    function addItem(uint256[] storage arr, uint256 item) internal {
        if (idx(arr, item) == 0) {
            arr.push(item);
        }
    }

    function removeItem(uint256[] storage arr, uint256 item) internal {
        uint256 i = idx(arr, item);
        if (i > 0) {
            arr[i - 1] = arr[arr.length - 1];
            arr.pop();
        }
    }

    function contains(uint256[] memory container, uint256[] memory items) internal pure returns (bool) {
        if (items.length == 0) return true;
        for (uint256 i = 0; i < items.length; i++) {
            bool itemIsContained = false;
            for (uint256 j = 0; j < container.length; j++) {
                itemIsContained = items[i] == container[j];
            }
            if (!itemIsContained) return false;
        }
        return true;
    }

    function asSingletonArray(uint256 element) internal pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;
        return array;
    }

    function hasDuplicatesOrZeros(uint256[] memory array) internal pure returns (bool) {
        for (uint256 i = 0; i < array.length; i++) {
            if (array[i] == 0) return true;
            for (uint256 j = 0; j < array.length; j++) {
                if (array[i] == array[j] && i != j) return true;
            }
        }
        return false;
    }

    function hasRoguesOrZeros(uint256[] memory array) internal pure returns (bool) {
        uint256 _first = array[0];
        for (uint256 i = 0; i < array.length; i++) {
            if (array[i] == 0 || array[i] != _first) return true;
        }
        return false;
    }
}

// File: contracts/interfaces/IXENStake.sol

pragma solidity ^0.8.10;

interface IXENStake {
    event CreateStake(address indexed user, uint256 indexed tokenId, uint256 amount, uint256 term);
    event EndStake(address indexed user, uint256 indexed tokenId);

    function createStake(uint256 amount, uint256 term) external returns (uint256);

    function endStake(uint256 tokenId) external;
}

// File: contracts/interfaces/IXENStakeProxying.sol

pragma solidity ^0.8.10;

interface IXENStakeProxying {
    function callStake(uint256 amount, uint256 term) external;

    function callTransfer(address to) external;

    function callWithdraw() external;

    function powerDown() external;
}

// File: contracts/XENStake.sol

pragma solidity ^0.8.10;















/*

        \\      //   |||||||||||   |\      ||       A CRYPTOCURRENCY FOR THE MASSES
         \\    //    ||            |\\     ||
          \\  //     ||            ||\\    ||       PRINCIPLES OF XEN:
           \\//      ||            || \\   ||       - No pre-mint; starts with zero supply
            XX       ||||||||      ||  \\  ||       - No admin keys
           //\\      ||            ||   \\ ||       - Immutable contract
          //  \\     ||            ||    \\||
         //    \\    ||            ||     \\|
        //      \\   |||||||||||   ||      \|       Copyright (C) FairCrypto Foundation 2022-23


    XENFT XEN Stake props:
    - amount, term, maturityTs, APY, rarityScore
 */

contract XENStake is
    DefaultOperatorFilterer, // required to support OpenSea royalties
    IXENStake,
    IXENStakeProxying,
    IBurnableToken,
    ERC2771Context, // required to support meta transactions
    IERC2981, // required to support NFT royalties
    ERC721("XEN Stake", "fmXENS")
{
    using Strings for uint256;
    using StakeInfo for uint256;
    using MagicNumbers for uint256;
    using Array for uint256[];

    // PUBLIC CONSTANTS

    // XENFT common business logic
    uint256 public constant SECONDS_IN_DAY = 24 * 3_600;
    uint256 public constant BLACKOUT_TERM = 7 * SECONDS_IN_DAY;

    string public constant AUTHORS = "@MrJackLevin @lbelyaev faircrypto.org";

    uint256 public constant ROYALTY_BP = 500;

    // PUBLIC MUTABLE STATE

    // increasing counter for NFT tokenIds, also used as salt for proxies' spinning
    uint256 public tokenIdCounter = 1;

    // tokenId => stakeInfo
    mapping(uint256 => uint256) public stakeInfo;

    // PUBLIC IMMUTABLE STATE

    // pointer to XEN Crypto contract
    XENCrypto public immutable xenCrypto;

    // PRIVATE STATE

    // original contract marking to distinguish from proxy copies
    address private immutable _original;
    // original deployer address to be used for setting trusted forwarder
    address private immutable _deployer;
    // address to be used for royalties' tracking
    address private immutable _royaltyReceiver;

    // mapping Address => tokenId[]
    mapping(address => uint256[]) private _ownedTokens;

    constructor(address xenCrypto_, address forwarder_, address royaltyReceiver_) ERC2771Context(forwarder_) {
        require(xenCrypto_ != address(0), "bad address");
        _original = address(this);
        _deployer = msg.sender;
        _royaltyReceiver = royaltyReceiver_ == address(0) ? msg.sender : royaltyReceiver_;
        xenCrypto = XENCrypto(xenCrypto_);
    }

    // INTERFACES & STANDARDS
    // IERC165 IMPLEMENTATION

    /**
        @dev confirms support for IERC-165, IERC-721, IERC2981, IERC2771 and IBurnRedeemable interfaces
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return
            interfaceId == type(IBurnRedeemable).interfaceId ||
            interfaceId == type(IERC2981).interfaceId ||
            interfaceId == type(IERC2771).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    // ERC2771 IMPLEMENTATION

    /**
        @dev use ERC2771Context implementation of _msgSender()
     */
    function _msgSender() internal view virtual override(Context, ERC2771Context) returns (address) {
        return ERC2771Context._msgSender();
    }

    /**
        @dev use ERC2771Context implementation of _msgData()
     */
    function _msgData() internal view virtual override(Context, ERC2771Context) returns (bytes calldata) {
        return ERC2771Context._msgData();
    }

    // OWNABLE IMPLEMENTATION

    /**
        @dev public getter to check for deployer / owner (Opensea, etc.)
     */
    function owner() external view returns (address) {
        return _deployer;
    }

    // ERC-721 METADATA IMPLEMENTATION
    /**
        @dev compliance with ERC-721 standard (NFT); returns NFT metadata, including SVG-encoded image
     */
    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        uint256 info = stakeInfo[tokenId];

        bytes memory dataURI = abi.encodePacked(
            "{",
            '"name": "XEN Stake #',
            tokenId.toString(),
            '",',
            '"description": "XENFT: XEN Crypto Proof Of Stake",',
            '"image": "',
            "data:image/svg+xml;base64,",
            Base64.encode(StakeMetadata.svgData(tokenId, info, address(xenCrypto))),
            '",',
            '"attributes": ',
            StakeMetadata.attributes(info),
            "}"
        );
        return string(abi.encodePacked("data:application/json;base64,", Base64.encode(dataURI)));
    }

    // IMPLEMENTATION OF XENStakeProxying INTERFACE
    // FUNCTIONS IN PROXY COPY CONTRACTS (VMU), CALLING ORIGINAL XEN CRYPTO CONTRACT
    /**
        @dev function callable only in proxy contracts from the original one => XENCrypto.stake(amount, term)
     */
    function callStake(uint256 amount, uint256 term) external {
        require(msg.sender == _original, "XEN Proxy: unauthorized");
        bytes memory callData = abi.encodeWithSignature("stake(uint256,uint256)", amount, term);
        (bool success, ) = address(xenCrypto).call(callData);
        require(success, "stake call failed");
    }

    /**
        @dev function callable only in proxy contracts from the original one => XENCrypto.withdraw()
     */
    function callWithdraw() external {
        require(msg.sender == _original, "XEN Proxy: unauthorized");
        bytes memory callData = abi.encodeWithSignature("withdraw()");
        (bool success, ) = address(xenCrypto).call(callData);
        require(success, "withdraw call failed");
    }

    /**
        @dev function callable only in proxy contracts from the original one => XENCrypto.transfer(to, amount)
     */
    function callTransfer(address to) external {
        require(msg.sender == _original, "XEN Proxy: unauthorized");
        uint256 balance = xenCrypto.balanceOf(address(this));
        bytes memory callData = abi.encodeWithSignature("transfer(address,uint256)", to, balance);
        (bool success, ) = address(xenCrypto).call(callData);
        require(success, "transfer call failed");
    }

    /**
        @dev function callable only in proxy contracts from the original one => destroys the proxy contract
     */
    function powerDown() external {
        require(msg.sender == _original, "XEN Proxy: unauthorized");
        selfdestruct(payable(address(0)));
    }

    // OVERRIDING OF ERC-721 IMPLEMENTATION
    // ENFORCEMENT OF TRANSFER BLACKOUT PERIOD

    /**
        @dev overrides OZ ERC-721 before transfer hook to check if there's no blackout period
     */
    function _beforeTokenTransfer(address from, address, uint256 tokenId) internal virtual override {
        if (from != address(0)) {
            uint256 maturityTs = StakeInfo.getMaturityTs(stakeInfo[tokenId]);
            uint256 delta = maturityTs > block.timestamp ? maturityTs - block.timestamp : block.timestamp - maturityTs;
            require(delta > BLACKOUT_TERM, "XENFT: transfer prohibited in blackout period");
        }
    }

    /**
        @dev overrides OZ ERC-721 after transfer hook to allow token enumeration for owner
     */
    function _afterTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
        _ownedTokens[from].removeItem(tokenId);
        _ownedTokens[to].addItem(tokenId);
    }

    // IBurnableToken IMPLEMENTATION

    /**
        @dev burns XENTorrent XENFT which can be used by connected contracts services
     */
    function burn(address user, uint256 tokenId) public {
        require(
            IERC165(_msgSender()).supportsInterface(type(IBurnRedeemable).interfaceId),
            "XENFT burn: not a supported contract"
        );
        require(user != address(0), "XENFT burn: illegal owner address");
        require(tokenId > 0, "XENFT burn: illegal tokenId");
        require(_isApprovedOrOwner(_msgSender(), tokenId), "XENFT burn: not an approved operator");
        require(ownerOf(tokenId) == user, "XENFT burn: user is not tokenId owner");
        _ownedTokens[user].removeItem(tokenId);
        _burn(tokenId);
        IBurnRedeemable(_msgSender()).onTokenBurned(user, tokenId);
    }

    // OVERRIDING ERC-721 IMPLEMENTATION TO ALLOW OPENSEA ROYALTIES ENFORCEMENT PROTOCOL

    /**
        @dev implements `setApprovalForAll` with additional approved Operator checking
     */
    function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
        super.setApprovalForAll(operator, approved);
    }

    /**
        @dev implements `approve` with additional approved Operator checking
     */
    function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
        super.approve(operator, tokenId);
    }

    /**
        @dev implements `transferFrom` with additional approved Operator checking
     */
    function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
        super.transferFrom(from, to, tokenId);
    }

    /**
        @dev implements `safeTransferFrom` with additional approved Operator checking
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId);
    }

    /**
        @dev implements `safeTransferFrom` with additional approved Operator checking
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId, data);
    }

    // SUPPORT FOR ERC2771 META-TRANSACTIONS

    /**
        @dev Implements setting a `Trusted Forwarder` for meta-txs. Settable only once
     */
    function addForwarder(address trustedForwarder) external {
        require(msg.sender == _deployer, "XENFT: not an deployer");
        require(_trustedForwarder == address(0), "XENFT: Forwarder is already set");
        _trustedForwarder = trustedForwarder;
    }

    // SUPPORT FOR ERC2981 ROYALTY INFO

    /**
        @dev Implements getting Royalty Info by supported operators. ROYALTY_BP is expressed in basis points
     */
    function royaltyInfo(uint256, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount) {
        receiver = _royaltyReceiver;
        royaltyAmount = (salePrice * ROYALTY_BP) / 10_000;
    }

    // XEN TORRENT PRIVATE / INTERNAL HELPERS

    /**
        @dev internal torrent interface. calculates rarityBits and rarityScore
     */
    function _calcRarity(uint256 tokenId) private view returns (uint256 rarityScore, uint256 rarityBits) {
        bool isPrime = tokenId.isPrime();
        bool isFib = tokenId.isFib();
        bool blockIsPrime = block.number.isPrime();
        bool blockIsFib = block.number.isFib();
        rarityScore += (isPrime ? 500 : 0);
        rarityScore += (blockIsPrime ? 1_000 : 0);
        rarityScore += (isFib ? 5_000 : 0);
        rarityScore += (blockIsFib ? 10_000 : 0);
        rarityBits = StakeInfo.encodeRarityBits(isPrime, isFib, blockIsPrime, blockIsFib);
    }

    /**
        @dev internal torrent interface. composes StakeInfo
     */
    function _stakeInfo(
        address proxy,
        uint256 tokenId,
        uint256 amount,
        uint256 term
    ) private view returns (uint256 info) {
        (, uint256 maturityTs, , uint256 apy) = xenCrypto.userStakes(proxy);
        (uint256 rarityScore, uint256 rarityBits) = _calcRarity(tokenId);
        info = StakeInfo.encodeStakeInfo(term, maturityTs, amount / 10 ** 18, apy, rarityScore, rarityBits);
    }

    /**
        @dev internal helper. Creates bytecode for minimal proxy contract
     */
    function _bytecode() private view returns (bytes memory) {
        return
            bytes.concat(
                bytes20(0x3D602d80600A3D3981F3363d3d373d3D3D363d73),
                bytes20(address(this)),
                bytes15(0x5af43d82803e903d91602b57fd5bf3)
            );
    }

    /**
        @dev internal torrent interface. initiates Stake Operation
     */
    function _createStake(uint256 amount, uint256 term, uint256 tokenId) private {
        bytes memory bytecode = _bytecode();
        bytes memory callData = abi.encodeWithSignature("callStake(uint256,uint256)", amount, term);
        address proxy;
        bool succeeded;
        bytes32 salt = keccak256(abi.encodePacked(tokenId));
        assembly {
            proxy := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
        }
        require(proxy != address(0), "XENFT: Error creating VSU");
        require(xenCrypto.transferFrom(_msgSender(), proxy, amount), "XENFT: Error transferring XEN to VSU");
        assembly {
            succeeded := call(gas(), proxy, 0, add(callData, 0x20), mload(callData), 0, 0)
        }
        require(succeeded, "XENFT: Error while staking");

        stakeInfo[tokenId] = _stakeInfo(proxy, tokenId, amount, term);
    }

    /**
        @dev internal torrent interface. initiates Stake Operation
     */
    function _endStake(uint256 tokenId) private {
        bytes memory bytecode = _bytecode();
        bytes memory callData = abi.encodeWithSignature("callWithdraw()");
        bytes memory callData1 = abi.encodeWithSignature("callTransfer(address)", _msgSender());
        bytes memory callData2 = abi.encodeWithSignature("powerDown()");
        bytes32 salt = keccak256(abi.encodePacked(tokenId));
        bytes32 hash = keccak256(abi.encodePacked(hex"ff", address(this), salt, keccak256(bytecode)));
        address proxy = address(uint160(uint256(hash)));

        bool succeeded;
        assembly {
            succeeded := call(gas(), proxy, 0, add(callData, 0x20), mload(callData), 0, 0)
        }
        require(succeeded, "XENFT: Error while withdrawing");
        assembly {
            succeeded := call(gas(), proxy, 0, add(callData1, 0x20), mload(callData1), 0, 0)
        }
        require(succeeded, "XENFT: Error while transferring");
        assembly {
            succeeded := call(gas(), proxy, 0, add(callData2, 0x20), mload(callData2), 0, 0)
        }
        require(succeeded, "XENFT: Error while powering down");

        delete stakeInfo[tokenId];
    }

    // PUBLIC GETTERS

    /**
        @dev public getter for tokens owned by address
     */
    function ownedTokens() external view returns (uint256[] memory) {
        return _ownedTokens[_msgSender()];
    }

    // PUBLIC TRANSACTIONAL INTERFACE

    /**
        @dev    public XEN Stake interface
                initiates XEN Crypto Stake
     */
    function createStake(uint256 amount, uint256 term) public returns (uint256 tokenId) {
        require(amount > 0, "XENFT: Illegal amount");
        require(term > 0, "XENFT: Illegal term");

        _createStake(amount, term, tokenIdCounter);
        _ownedTokens[_msgSender()].addItem(tokenIdCounter);
        _safeMint(_msgSender(), tokenIdCounter);
        tokenId = tokenIdCounter;
        tokenIdCounter++;
        emit CreateStake(_msgSender(), tokenId, amount, term);
    }

    /**
        @dev    public XEN Stake interface
                ends XEN Crypto Stake, withdraws principal and reward amounts
     */
    function endStake(uint256 tokenId) public {
        require(tokenId > 0, "XENFT: Illegal tokenId");
        require(ownerOf(tokenId) == _msgSender(), "XENFT: Incorrect owner");
        uint256 maturityTs = StakeInfo.getMaturityTs(stakeInfo[tokenId]);
        require(block.timestamp > maturityTs, "XENFT: Maturity not reached");

        _endStake(tokenId);
        _ownedTokens[_msgSender()].removeItem(tokenId);
        _burn(tokenId);
        emit EndStake(_msgSender(), tokenId);
    }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"xenCrypto_","type":"address"},{"internalType":"address","name":"forwarder_","type":"address"},{"internalType":"address","name":"royaltyReceiver_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"term","type":"uint256"}],"name":"CreateStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"EndStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"AUTHORS","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BLACKOUT_TERM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROYALTY_BP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECONDS_IN_DAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"addForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"term","type":"uint256"}],"name":"callStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"callTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"callWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"term","type":"uint256"}],"name":"createStake","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"endStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownedTokens","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"powerDown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakeInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenIdCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xenCrypto","outputs":[{"internalType":"contract XENCrypto","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

61010060405260016007553480156200001757600080fd5b5060405162003c2d38038062003c2d8339810160408190526200003a91620002bc565b604080518082018252600981526858454e205374616b6560b81b60208083019190915282518084019093526006835265666d58454e5360d01b908301529083733cc6cdda760b79bafa08df41ecfa224f810dceb660016daaeb6d7670e522a718067333cd4e3b15620001d55780156200012357604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200010457600080fd5b505af115801562000119573d6000803e3d6000fd5b50505050620001d5565b6001600160a01b03821615620001745760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401620000e9565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001bb57600080fd5b505af1158015620001d0573d6000803e3d6000fd5b505050505b5050600080546001600160a01b0319166001600160a01b03929092169190911790556001620002058382620003ab565b506002620002148282620003ab565b5050506001600160a01b038316620002605760405162461bcd60e51b815260206004820152600b60248201526a626164206164647265737360a81b604482015260640160405180910390fd5b3060a0523360c0526001600160a01b038116156200027f578062000281565b335b6001600160a01b0390811660e0529290921660805250620004779050565b80516001600160a01b0381168114620002b757600080fd5b919050565b600080600060608486031215620002d257600080fd5b620002dd846200029f565b9250620002ed602085016200029f565b9150620002fd604085016200029f565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200033157607f821691505b6020821081036200035257634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003a657600081815260208120601f850160051c81016020861015620003815750805b601f850160051c820191505b81811015620003a2578281556001016200038d565b5050505b505050565b81516001600160401b03811115620003c757620003c762000306565b620003df81620003d884546200031c565b8462000358565b602080601f831160018114620004175760008415620003fe5750858301515b600019600386901b1c1916600185901b178555620003a2565b600085815260208120601f198616915b82811015620004485788860151825594840194600190910190840162000427565b5085821015620004675787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161372f620004fe600039600061082701526000818161035f01526109fb01526000818161087501528181610ba20152818161125001526113b701526000818161033b0152818161090401528181610f95015281816112c40152818161140e015281816114d601528181611fd4015261275b015261372f6000f3fe608060405234801561001057600080fd5b506004361061019b5760003560e01c80636352211e116100ea5780636352211e1461031057806370a082311461032357806371141a58146103365780638da5cb5b1461035d578063928dd2a71461038357806395d89b411461038b57806398bdf6f5146103935780639dc29fac1461039c578063a126ad1e146103af578063a22cb465146103b7578063b88d4fde146103ca578063ba3ec741146103dd578063c87b56dd146103e5578063d7fa023d146103f8578063dad901be1461040b578063e985e9c514610413578063eec990f21461042657600080fd5b806301ffc9a7146101a0578063044db8ba146101c857806306fdde03146101df578063081812fc146101f4578063095ea7b3146102145780630cbe28d61461022957806319cba6b41461023c57806323b872dd146102515780632a55205a146102645780632ce8faa41461028557806341f434341461029857806342842e0e146102ad5780634e533572146102c0578063572b6c05146102e05780635c41d2fe146102f357806361a52a3614610306575b600080fd5b6101b36101ae366004612e41565b610439565b60405190151581526020015b60405180910390f35b6101d16101f481565b6040519081526020016101bf565b6101e761049a565b6040516101bf9190612eb5565b610207610202366004612ec8565b61052c565b6040516101bf9190612ee1565b610227610222366004612f11565b610553565b005b610227610237366004612ec8565b61056c565b610244610779565b6040516101bf9190612f3b565b61022761025f366004612f7f565b6107fa565b610277610272366004612fbb565b610825565b6040516101bf929190612fdd565b610227610293366004612fbb565b61086a565b6102076daaeb6d7670e522a718067333cd4e81565b6102276102bb366004612f7f565b6109b7565b6101d16102ce366004612ec8565b60086020526000908152604090205481565b6101b36102ee366004612ff6565b6109dc565b610227610301366004612ff6565b6109f0565b6101d16201518081565b61020761031e366004612ec8565b610adc565b6101d1610331366004612ff6565b610b11565b6102077f000000000000000000000000000000000000000000000000000000000000000081565b7f0000000000000000000000000000000000000000000000000000000000000000610207565b610227610b97565b6101e7610be3565b6101d160075481565b6102276103aa366004612f11565b610bf2565b6101d1610ee7565b6102276103c536600461301f565b610ef8565b6102276103d83660046130c3565b610f0c565b6101e7610f39565b6101e76103f3366004612ec8565b610f55565b6101d1610406366004612fbb565b6110f3565b610227611245565b6101b361042136600461316d565b61137e565b610227610434366004612ff6565b6113ac565b60006001600160e01b0319821663543746b160e01b148061046a57506001600160e01b0319821663152a902d60e11b145b8061048557506001600160e01b0319821663572b6c0560e01b145b8061049457506104948261158c565b92915050565b6060600180546104a990613197565b80601f01602080910402602001604051908101604052809291908181526020018280546104d590613197565b80156105225780601f106104f757610100808354040283529160200191610522565b820191906000526020600020905b81548152906001019060200180831161050557829003601f168201915b5050505050905090565b6000610537826115dc565b506000908152600560205260409020546001600160a01b031690565b8161055d81611604565b61056783836116b4565b505050565b600081116105ba5760405162461bcd60e51b815260206004820152601660248201527516115391950e88125b1b1959d85b081d1bdad95b925960521b60448201526064015b60405180910390fd5b6105c26117d6565b6001600160a01b03166105d482610adc565b6001600160a01b0316146106235760405162461bcd60e51b81526020600482015260166024820152752c22a7232a1d1024b731b7b93932b1ba1037bbb732b960511b60448201526064016105b1565b60008181526008602052604080822054905163125fb94760e11b81526004810191909152734c9e86e83e81165784af15a5c72a4cf49ba35732906324bf728e90602401602060405180830381865af4158015610683573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a791906131d1565b90508042116106f65760405162461bcd60e51b815260206004820152601b60248201527a16115391950e8813585d1d5c9a5d1e481b9bdd081c995858da1959602a1b60448201526064016105b1565b6106ff826117e5565b61072e826009600061070f6117d6565b6001600160a01b03168152602081019190915260400160002090611a2f565b61073782611b14565b816107406117d6565b6001600160a01b03167f984fff6f629d4293c703ca7d5e13e29fd80eedd0c8e8a04e5772bfa8c40a64a960405160405180910390a35050565b6060600960006107876117d6565b6001600160a01b03166001600160a01b0316815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561052257602002820191906000526020600020905b8154815260200190600101908083116107dd575050505050905090565b826001600160a01b03811633146108145761081433611604565b61081f848484611bb1565b50505050565b7f000000000000000000000000000000000000000000000000000000000000000060006127106108576101f485613200565b610861919061322d565b90509250929050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108b25760405162461bcd60e51b81526004016105b190613241565b604051602481018390526044810182905260009060640160408051601f198184030181529181526020820180516001600160e01b03166307b0472f60e41b179052519091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169061093090849061328e565b6000604051808303816000865af19150503d806000811461096d576040519150601f19603f3d011682016040523d82523d6000602084013e610972565b606091505b505090508061081f5760405162461bcd60e51b81526020600482015260116024820152701cdd185ad94818d85b1b0819985a5b1959607a1b60448201526064016105b1565b826001600160a01b03811633146109d1576109d133611604565b61081f848484611be3565b6000546001600160a01b0391821691161490565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a615760405162461bcd60e51b81526020600482015260166024820152752c22a7232a1d103737ba1030b7103232b83637bcb2b960511b60448201526064016105b1565b6000546001600160a01b031615610aba5760405162461bcd60e51b815260206004820152601f60248201527f58454e46543a20466f7277617264657220697320616c7265616479207365740060448201526064016105b1565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600360205260408120546001600160a01b0316806104945760405162461bcd60e51b81526004016105b1906132aa565b60006001600160a01b038216610b7b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016105b1565b506001600160a01b031660009081526004602052604090205490565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610bdf5760405162461bcd60e51b81526004016105b190613241565b6000ff5b6060600280546104a990613197565b610bfa6117d6565b6040516301ffc9a760e01b815263543746b160e01b60048201526001600160a01b0391909116906301ffc9a790602401602060405180830381865afa158015610c47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6b91906132dc565b610cc35760405162461bcd60e51b8152602060048201526024808201527f58454e4654206275726e3a206e6f74206120737570706f7274656420636f6e746044820152631c9858dd60e21b60648201526084016105b1565b6001600160a01b038216610d235760405162461bcd60e51b815260206004820152602160248201527f58454e4654206275726e3a20696c6c6567616c206f776e6572206164647265736044820152607360f81b60648201526084016105b1565b60008111610d715760405162461bcd60e51b815260206004820152601b60248201527a161153919508189d5c9b8e881a5b1b1959d85b081d1bdad95b9259602a1b60448201526064016105b1565b610d82610d7c6117d6565b82611bfe565b610dda5760405162461bcd60e51b8152602060048201526024808201527f58454e4654206275726e3a206e6f7420616e20617070726f766564206f70657260448201526330ba37b960e11b60648201526084016105b1565b816001600160a01b0316610ded82610adc565b6001600160a01b031614610e515760405162461bcd60e51b815260206004820152602560248201527f58454e4654206275726e3a2075736572206973206e6f7420746f6b656e49642060448201526437bbb732b960d91b60648201526084016105b1565b6001600160a01b0382166000908152600960205260409020610e739082611a2f565b610e7c81611b14565b610e846117d6565b6001600160a01b031663543746b183836040518363ffffffff1660e01b8152600401610eb1929190612fdd565b600060405180830381600087803b158015610ecb57600080fd5b505af1158015610edf573d6000803e3d6000fd5b505050505050565b610ef5620151806007613200565b81565b81610f0281611604565b6105678383611c5d565b836001600160a01b0381163314610f2657610f2633611604565b610f3285858585611c6f565b5050505050565b6040518060600160405280602581526020016136d56025913981565b600081815260086020526040812054606091610f7084611ca8565b60405163a37ea54960e01b815260048101869052602481018490526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660448201526110279073ff55e442aaf94dd49712173cb097d6d86a1407399063a37ea54990606401600060405180830381865af4158015610ffa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261102291908101906132f9565b611da8565b60405163682ee63560e11b81526004810185905273ff55e442aaf94dd49712173cb097d6d86a1407399063d05dcc6a90602401600060405180830381865af4158015611077573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261109f91908101906132f9565b6040516020016110b19392919061336f565b60405160208183030381529060405290506110cb81611da8565b6040516020016110db919061348a565b60405160208183030381529060405292505050919050565b600080831161113c5760405162461bcd60e51b815260206004820152601560248201527416115391950e88125b1b1959d85b08185b5bdd5b9d605a1b60448201526064016105b1565b600082116111825760405162461bcd60e51b815260206004820152601360248201527258454e46543a20496c6c6567616c207465726d60681b60448201526064016105b1565b61118f8383600754611efa565b6111c0600754600960006111a16117d6565b6001600160a01b0316815260208101919091526040016000209061215c565b6111d36111cb6117d6565b6007546121d4565b506007805490819060006111e6836134cf565b9190505550806111f46117d6565b6001600160a01b03167f7cc860bef2fa56b3d46227731e60b3b6ce0af9627bfdfbeca273f9ea5dae8a188585604051611237929190918252602082015260400190565b60405180910390a392915050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461128d5760405162461bcd60e51b81526004016105b190613241565b60408051600481526024810182526020810180516001600160e01b0316633ccfd60b60e01b17905290516000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906112f090849061328e565b6000604051808303816000865af19150503d806000811461132d576040519150601f19603f3d011682016040523d82523d6000602084013e611332565b606091505b505090508061137a5760405162461bcd60e51b81526020600482015260146024820152731dda5d1a191c985dc818d85b1b0819985a5b195960621b60448201526064016105b1565b5050565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146113f45760405162461bcd60e51b81526004016105b190613241565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611443903090600401612ee1565b602060405180830381865afa158015611460573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148491906131d1565b90506000828260405160240161149b929190612fdd565b60408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b179052519091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169061150290849061328e565b6000604051808303816000865af19150503d806000811461153f576040519150601f19603f3d011682016040523d82523d6000602084013e611544565b606091505b505090508061081f5760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c8818d85b1b0819985a5b195960621b60448201526064016105b1565b60006001600160e01b031982166380ac58cd60e01b14806115bd57506001600160e01b03198216635b5e139f60e01b145b8061049457506301ffc9a760e01b6001600160e01b0319831614610494565b6115e5816121ee565b6116015760405162461bcd60e51b81526004016105b1906132aa565b50565b6daaeb6d7670e522a718067333cd4e3b1561160157604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611671573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061169591906132dc565b6116015780604051633b79c77360e21b81526004016105b19190612ee1565b60006116bf82610adc565b9050806001600160a01b0316836001600160a01b03160361172c5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016105b1565b806001600160a01b031661173e6117d6565b6001600160a01b0316148061175a575061175a816104216117d6565b6117cc5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016105b1565b610567838361220b565b60006117e0612279565b905090565b60006117ef61229b565b6040805160048152602481019091526020810180516001600160e01b0316636d6c80df60e11b17905290915060006118256117d6565b6040516024016118359190612ee1565b60408051601f19818403018152918152602080830180516001600160e01b03908116637764c87960e11b17909152825160048152602481018452808301805190921663928dd2a760e01b17909152825180830189905283518082038401815281850185528051908401208851898501206001600160f81b03196060808501919091526001600160601b03193090911b166061840152607583018290526095808401919091528551808403909101815260b59092019094528051908301208651949550909390918291600091829182918a0182865af19050806119595760405162461bcd60e51b815260206004820152601e60248201527f58454e46543a204572726f72207768696c65207769746864726177696e67000060448201526064016105b1565b6000808751602089016000865af19050806119b65760405162461bcd60e51b815260206004820152601f60248201527f58454e46543a204572726f72207768696c65207472616e7366657272696e670060448201526064016105b1565b6000808651602088016000865af1905080611a135760405162461bcd60e51b815260206004820181905260248201527f58454e46543a204572726f72207768696c6520706f776572696e6720646f776e60448201526064016105b1565b5050506000958652505060086020525050604082209190915550565b6000611a8a83805480602002602001604051908101604052809291908181526020018280548015611a7f57602002820191906000526020600020905b815481526020019060010190808311611a6b575b5050505050836122fc565b905080156105675782548390611aa2906001906134e8565b81548110611ab257611ab26134fb565b906000526020600020015483600183611acb91906134e8565b81548110611adb57611adb6134fb565b906000526020600020018190555082805480611af957611af9613511565b60019003818190600052602060002001600090559055505050565b6000611b1f82610adc565b9050611b2d8160008461234d565b611b3860008361220b565b6001600160a01b0381166000908152600460205260408120805460019290611b619084906134e8565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b038416906000805160206136b5833981519152908390a461137a81600084612478565b611bbc610d7c6117d6565b611bd85760405162461bcd60e51b81526004016105b190613527565b6105678383836124bc565b61056783838360405180602001604052806000815250610f0c565b600080611c0a83610adc565b9050806001600160a01b0316846001600160a01b03161480611c315750611c31818561137e565b80611c555750836001600160a01b0316611c4a8461052c565b6001600160a01b0316145b949350505050565b61137a611c686117d6565b8383612657565b611c80611c7a6117d6565b83611bfe565b611c9c5760405162461bcd60e51b81526004016105b190613527565b61081f84848484612721565b606081600003611ccf5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611cf95780611ce3816134cf565b9150611cf29050600a8361322d565b9150611cd3565b6000816001600160401b03811115611d1357611d13613056565b6040519080825280601f01601f191660200182016040528015611d3d576020820181803683370190505b5090505b8415611c5557611d526001836134e8565b9150611d5f600a86613575565b611d6a906030613589565b60f81b818381518110611d7f57611d7f6134fb565b60200101906001600160f81b031916908160001a905350611da1600a8661322d565b9450611d41565b60608151600003611dc757505060408051602081019091526000815290565b60006040518060600160405280604081526020016136756040913990506000600384516002611df69190613589565b611e00919061322d565b611e0b906004613200565b6001600160401b03811115611e2257611e22613056565b6040519080825280601f01601f191660200182016040528015611e4c576020820181803683370190505b509050600182016020820185865187015b80821015611eb8576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250611e5d565b5050600386510660018114611ed45760028114611ee757611eef565b603d6001830353603d6002830353611eef565b603d60018303535b509195945050505050565b6000611f0461229b565b604051602481018690526044810185905290915060009060640160408051601f19818403018152918152602080830180516001600160e01b0316630b3a3ea960e21b17905281519081018690529192506000918291829101604051602081830303815290604052805190602001209050808551602087016000f592506001600160a01b038316611fd25760405162461bcd60e51b815260206004820152601960248201527858454e46543a204572726f72206372656174696e672056535560381b60448201526064016105b1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166323b872dd6120096117d6565b6040516001600160e01b031960e084901b1681526001600160a01b0391821660048201529086166024820152604481018b90526064016020604051808303816000875af115801561205e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208291906132dc565b6120da5760405162461bcd60e51b8152602060048201526024808201527f58454e46543a204572726f72207472616e7366657272696e672058454e20746f6044820152632056535560e01b60648201526084016105b1565b6000808551602087016000875af19150816121345760405162461bcd60e51b815260206004820152601a60248201527958454e46543a204572726f72207768696c65207374616b696e6760301b60448201526064016105b1565b61214083878a8a612754565b6000968752600860205260409096209590955550505050505050565b6121b5828054806020026020016040519081016040528092919081815260200182805480156121aa57602002820191906000526020600020905b815481526020019060010190808311612196575b5050505050826122fc565b60000361137a5781546001810183556000928352602090922090910155565b61137a8282604051806020016040528060008152506128ba565b6000908152600360205260409020546001600160a01b0316151590565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061224082610adc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612284336109dc565b15612296575060131936013560601c90565b503390565b60408051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b60208201526001600160601b03193060601b1660348201526e5af43d82803e903d91602b57fd5bf360881b604882015281516037818303018152605790910190915290565b60015b825181116123445781836123146001846134e8565b81518110612324576123246134fb565b60200260200101510315610494578061233c816134cf565b9150506122ff565b50600092915050565b6001600160a01b038316156105675760008181526008602052604080822054905163125fb94760e11b81526004810191909152734c9e86e83e81165784af15a5c72a4cf49ba35732906324bf728e90602401602060405180830381865af41580156123bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e091906131d1565b905060004282116123fa576123f582426134e8565b612404565b61240442836134e8565b9050612414620151806007613200565b8111610f325760405162461bcd60e51b815260206004820152602d60248201527f58454e46543a207472616e736665722070726f6869626974656420696e20626c60448201526c1858dadbdd5d081c195c9a5bd9609a1b60648201526084016105b1565b6001600160a01b038316600090815260096020526040902061249a9082611a2f565b6001600160a01b0382166000908152600960205260409020610567908261215c565b826001600160a01b03166124cf82610adc565b6001600160a01b0316146125335760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016105b1565b6001600160a01b0382166125955760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016105b1565b6125a083838361234d565b6125ab60008261220b565b6001600160a01b03831660009081526004602052604081208054600192906125d49084906134e8565b90915550506001600160a01b0382166000908152600460205260408120805460019290612602908490613589565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716916000805160206136b583398151915291a4610567838383612478565b816001600160a01b0316836001600160a01b0316036126b45760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b60448201526064016105b1565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61272c8484846124bc565b612738848484846128ed565b61081f5760405162461bcd60e51b81526004016105b19061359c565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da7ad23886040518263ffffffff1660e01b81526004016127a59190612ee1565b608060405180830381865afa1580156127c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127e691906135ee565b9350509250506000806127f8886129f5565b9092509050734c9e86e83e81165784af15a5c72a4cf49ba3573263814226dd878661282b670de0b6b3a76400008c61322d565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606481018690526084810185905260a4810184905260c401602060405180830381865af4158015612889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128ad91906131d1565b9998505050505050505050565b6128c48383612cf7565b6128d160008484846128ed565b6105675760405162461bcd60e51b81526004016105b19061359c565b60006001600160a01b0384163b156129ea57836001600160a01b031663150b7a026129166117d6565b8786866040518563ffffffff1660e01b81526004016129389493929190613624565b6020604051808303816000875af1925050508015612973575060408051601f3d908101601f1916820190925261297091810190613657565b60015b6129d0573d8080156129a1576040519150601f19603f3d011682016040523d82523d6000602084013e6129a6565b606091505b5080516000036129c85760405162461bcd60e51b81526004016105b19061359c565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611c55565b506001949350505050565b60405163109c0d2560e21b8152600481018290526000908190819073f7433d491e7fea60f8db1060c83908170b177e3690634270349490602401602060405180830381865af4158015612a4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7091906132dc565b604051634a0e40a160e11b81526004810186905290915060009073f7433d491e7fea60f8db1060c83908170b177e369063941c814290602401602060405180830381865af4158015612ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aea91906132dc565b60405163109c0d2560e21b815243600482015290915060009073f7433d491e7fea60f8db1060c83908170b177e3690634270349490602401602060405180830381865af4158015612b3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6391906132dc565b604051634a0e40a160e11b815243600482015290915060009073f7433d491e7fea60f8db1060c83908170b177e369063941c814290602401602060405180830381865af4158015612bb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bdc91906132dc565b905083612bea576000612bee565b6101f45b612bfc9061ffff1687613589565b955081612c0a576000612c0e565b6103e85b612c1c9061ffff1687613589565b955082612c2a576000612c2e565b6113885b612c3c9061ffff1687613589565b955080612c4a576000612c4e565b6127105b612c5c9061ffff1687613589565b60405163395e488160e01b81528515156004820152841515602482015283151560448201528215156064820152909650734c9e86e83e81165784af15a5c72a4cf49ba357329063395e488190608401602060405180830381865af4158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cec91906131d1565b945050505050915091565b6001600160a01b038216612d4d5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016105b1565b612d56816121ee565b15612da25760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b60448201526064016105b1565b612dae6000838361234d565b6001600160a01b0382166000908152600460205260408120805460019290612dd7908490613589565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392906000805160206136b5833981519152908290a461137a60008383612478565b6001600160e01b03198116811461160157600080fd5b600060208284031215612e5357600080fd5b8135612e5e81612e2b565b9392505050565b60005b83811015612e80578181015183820152602001612e68565b50506000910152565b60008151808452612ea1816020860160208601612e65565b601f01601f19169290920160200192915050565b602081526000612e5e6020830184612e89565b600060208284031215612eda57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b0381168114612f0c57600080fd5b919050565b60008060408385031215612f2457600080fd5b612f2d83612ef5565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015612f7357835183529284019291840191600101612f57565b50909695505050505050565b600080600060608486031215612f9457600080fd5b612f9d84612ef5565b9250612fab60208501612ef5565b9150604084013590509250925092565b60008060408385031215612fce57600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60006020828403121561300857600080fd5b612e5e82612ef5565b801515811461160157600080fd5b6000806040838503121561303257600080fd5b61303b83612ef5565b9150602083013561304b81613011565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561309457613094613056565b604052919050565b60006001600160401b038211156130b5576130b5613056565b50601f01601f191660200190565b600080600080608085870312156130d957600080fd5b6130e285612ef5565b93506130f060208601612ef5565b92506040850135915060608501356001600160401b0381111561311257600080fd5b8501601f8101871361312357600080fd5b80356131366131318261309c565b61306c565b81815288602083850101111561314b57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561318057600080fd5b61318983612ef5565b915061086160208401612ef5565b600181811c908216806131ab57607f821691505b6020821081036131cb57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156131e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610494576104946131ea565b634e487b7160e01b600052601260045260246000fd5b60008261323c5761323c613217565b500490565b60208082526017908201527616115388141c9bde1e4e881d5b985d5d1a1bdc9a5e9959604a1b604082015260600190565b60008151613284818560208601612e65565b9290920192915050565b600082516132a0818460208701612e65565b9190910192915050565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b6000602082840312156132ee57600080fd5b8151612e5e81613011565b60006020828403121561330b57600080fd5b81516001600160401b0381111561332157600080fd5b8201601f8101841361333257600080fd5b80516133406131318261309c565b81815285602083850101111561335557600080fd5b613366826020830160208601612e65565b95945050505050565b607b60f81b815273226e616d65223a202258454e205374616b65202360601b600182015283516000906133a9816015850160208901612e65565b61088b60f21b60159184019182018190527f226465736372697074696f6e223a202258454e46543a2058454e2043727970746017830152711bc8141c9bdbd98813d98814dd185ad9488b60721b6037830152691134b6b0b3b2911d101160b11b60498301527919185d184e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b60321b6053830152855161344481606d850160208a01612e65565b606d9201918201526d01130ba3a3934b13aba32b9911d160951b606f820152613480613473607d830186613272565b607d60f81b815260010190565b9695505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516134c281601d850160208701612e65565b91909101601d0192915050565b6000600182016134e1576134e16131ea565b5060010190565b81810381811115610494576104946131ea565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b60008261358457613584613217565b500690565b80820180821115610494576104946131ea565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000806000806080858703121561360457600080fd5b505082516020840151604085015160609095015191969095509092509050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061348090830184612e89565b60006020828403121561366957600080fd5b8151612e5e81612e2b56fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef404d724a61636b4c6576696e20406c62656c79616576206661697263727970746f2e6f7267a264697066735822122046630899531eb29dd8a242c6f22ad6e291ba0ae57d66288693b0aec6f2f7b30364736f6c6343000811003300000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c73fc08c931efe3fce850c09278472e8a81c2e05

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061019b5760003560e01c80636352211e116100ea5780636352211e1461031057806370a082311461032357806371141a58146103365780638da5cb5b1461035d578063928dd2a71461038357806395d89b411461038b57806398bdf6f5146103935780639dc29fac1461039c578063a126ad1e146103af578063a22cb465146103b7578063b88d4fde146103ca578063ba3ec741146103dd578063c87b56dd146103e5578063d7fa023d146103f8578063dad901be1461040b578063e985e9c514610413578063eec990f21461042657600080fd5b806301ffc9a7146101a0578063044db8ba146101c857806306fdde03146101df578063081812fc146101f4578063095ea7b3146102145780630cbe28d61461022957806319cba6b41461023c57806323b872dd146102515780632a55205a146102645780632ce8faa41461028557806341f434341461029857806342842e0e146102ad5780634e533572146102c0578063572b6c05146102e05780635c41d2fe146102f357806361a52a3614610306575b600080fd5b6101b36101ae366004612e41565b610439565b60405190151581526020015b60405180910390f35b6101d16101f481565b6040519081526020016101bf565b6101e761049a565b6040516101bf9190612eb5565b610207610202366004612ec8565b61052c565b6040516101bf9190612ee1565b610227610222366004612f11565b610553565b005b610227610237366004612ec8565b61056c565b610244610779565b6040516101bf9190612f3b565b61022761025f366004612f7f565b6107fa565b610277610272366004612fbb565b610825565b6040516101bf929190612fdd565b610227610293366004612fbb565b61086a565b6102076daaeb6d7670e522a718067333cd4e81565b6102276102bb366004612f7f565b6109b7565b6101d16102ce366004612ec8565b60086020526000908152604090205481565b6101b36102ee366004612ff6565b6109dc565b610227610301366004612ff6565b6109f0565b6101d16201518081565b61020761031e366004612ec8565b610adc565b6101d1610331366004612ff6565b610b11565b6102077f00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa581565b7f000000000000000000000000c21a56d5c2f0ae4ec4197b82019b0ab7abdb4bd6610207565b610227610b97565b6101e7610be3565b6101d160075481565b6102276103aa366004612f11565b610bf2565b6101d1610ee7565b6102276103c536600461301f565b610ef8565b6102276103d83660046130c3565b610f0c565b6101e7610f39565b6101e76103f3366004612ec8565b610f55565b6101d1610406366004612fbb565b6110f3565b610227611245565b6101b361042136600461316d565b61137e565b610227610434366004612ff6565b6113ac565b60006001600160e01b0319821663543746b160e01b148061046a57506001600160e01b0319821663152a902d60e11b145b8061048557506001600160e01b0319821663572b6c0560e01b145b8061049457506104948261158c565b92915050565b6060600180546104a990613197565b80601f01602080910402602001604051908101604052809291908181526020018280546104d590613197565b80156105225780601f106104f757610100808354040283529160200191610522565b820191906000526020600020905b81548152906001019060200180831161050557829003601f168201915b5050505050905090565b6000610537826115dc565b506000908152600560205260409020546001600160a01b031690565b8161055d81611604565b61056783836116b4565b505050565b600081116105ba5760405162461bcd60e51b815260206004820152601660248201527516115391950e88125b1b1959d85b081d1bdad95b925960521b60448201526064015b60405180910390fd5b6105c26117d6565b6001600160a01b03166105d482610adc565b6001600160a01b0316146106235760405162461bcd60e51b81526020600482015260166024820152752c22a7232a1d1024b731b7b93932b1ba1037bbb732b960511b60448201526064016105b1565b60008181526008602052604080822054905163125fb94760e11b81526004810191909152734c9e86e83e81165784af15a5c72a4cf49ba35732906324bf728e90602401602060405180830381865af4158015610683573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a791906131d1565b90508042116106f65760405162461bcd60e51b815260206004820152601b60248201527a16115391950e8813585d1d5c9a5d1e481b9bdd081c995858da1959602a1b60448201526064016105b1565b6106ff826117e5565b61072e826009600061070f6117d6565b6001600160a01b03168152602081019190915260400160002090611a2f565b61073782611b14565b816107406117d6565b6001600160a01b03167f984fff6f629d4293c703ca7d5e13e29fd80eedd0c8e8a04e5772bfa8c40a64a960405160405180910390a35050565b6060600960006107876117d6565b6001600160a01b03166001600160a01b0316815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561052257602002820191906000526020600020905b8154815260200190600101908083116107dd575050505050905090565b826001600160a01b03811633146108145761081433611604565b61081f848484611bb1565b50505050565b7f000000000000000000000000c73fc08c931efe3fce850c09278472e8a81c2e0560006127106108576101f485613200565b610861919061322d565b90509250929050565b336001600160a01b037f000000000000000000000000ad6d1b337ee6d9fd939237f0394918b6af21efaa16146108b25760405162461bcd60e51b81526004016105b190613241565b604051602481018390526044810182905260009060640160408051601f198184030181529181526020820180516001600160e01b03166307b0472f60e41b179052519091506000906001600160a01b037f00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa5169061093090849061328e565b6000604051808303816000865af19150503d806000811461096d576040519150601f19603f3d011682016040523d82523d6000602084013e610972565b606091505b505090508061081f5760405162461bcd60e51b81526020600482015260116024820152701cdd185ad94818d85b1b0819985a5b1959607a1b60448201526064016105b1565b826001600160a01b03811633146109d1576109d133611604565b61081f848484611be3565b6000546001600160a01b0391821691161490565b336001600160a01b037f000000000000000000000000c21a56d5c2f0ae4ec4197b82019b0ab7abdb4bd61614610a615760405162461bcd60e51b81526020600482015260166024820152752c22a7232a1d103737ba1030b7103232b83637bcb2b960511b60448201526064016105b1565b6000546001600160a01b031615610aba5760405162461bcd60e51b815260206004820152601f60248201527f58454e46543a20466f7277617264657220697320616c7265616479207365740060448201526064016105b1565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600360205260408120546001600160a01b0316806104945760405162461bcd60e51b81526004016105b1906132aa565b60006001600160a01b038216610b7b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016105b1565b506001600160a01b031660009081526004602052604090205490565b336001600160a01b037f000000000000000000000000ad6d1b337ee6d9fd939237f0394918b6af21efaa1614610bdf5760405162461bcd60e51b81526004016105b190613241565b6000ff5b6060600280546104a990613197565b610bfa6117d6565b6040516301ffc9a760e01b815263543746b160e01b60048201526001600160a01b0391909116906301ffc9a790602401602060405180830381865afa158015610c47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6b91906132dc565b610cc35760405162461bcd60e51b8152602060048201526024808201527f58454e4654206275726e3a206e6f74206120737570706f7274656420636f6e746044820152631c9858dd60e21b60648201526084016105b1565b6001600160a01b038216610d235760405162461bcd60e51b815260206004820152602160248201527f58454e4654206275726e3a20696c6c6567616c206f776e6572206164647265736044820152607360f81b60648201526084016105b1565b60008111610d715760405162461bcd60e51b815260206004820152601b60248201527a161153919508189d5c9b8e881a5b1b1959d85b081d1bdad95b9259602a1b60448201526064016105b1565b610d82610d7c6117d6565b82611bfe565b610dda5760405162461bcd60e51b8152602060048201526024808201527f58454e4654206275726e3a206e6f7420616e20617070726f766564206f70657260448201526330ba37b960e11b60648201526084016105b1565b816001600160a01b0316610ded82610adc565b6001600160a01b031614610e515760405162461bcd60e51b815260206004820152602560248201527f58454e4654206275726e3a2075736572206973206e6f7420746f6b656e49642060448201526437bbb732b960d91b60648201526084016105b1565b6001600160a01b0382166000908152600960205260409020610e739082611a2f565b610e7c81611b14565b610e846117d6565b6001600160a01b031663543746b183836040518363ffffffff1660e01b8152600401610eb1929190612fdd565b600060405180830381600087803b158015610ecb57600080fd5b505af1158015610edf573d6000803e3d6000fd5b505050505050565b610ef5620151806007613200565b81565b81610f0281611604565b6105678383611c5d565b836001600160a01b0381163314610f2657610f2633611604565b610f3285858585611c6f565b5050505050565b6040518060600160405280602581526020016136d56025913981565b600081815260086020526040812054606091610f7084611ca8565b60405163a37ea54960e01b815260048101869052602481018490526001600160a01b037f00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa51660448201526110279073ff55e442aaf94dd49712173cb097d6d86a1407399063a37ea54990606401600060405180830381865af4158015610ffa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261102291908101906132f9565b611da8565b60405163682ee63560e11b81526004810185905273ff55e442aaf94dd49712173cb097d6d86a1407399063d05dcc6a90602401600060405180830381865af4158015611077573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261109f91908101906132f9565b6040516020016110b19392919061336f565b60405160208183030381529060405290506110cb81611da8565b6040516020016110db919061348a565b60405160208183030381529060405292505050919050565b600080831161113c5760405162461bcd60e51b815260206004820152601560248201527416115391950e88125b1b1959d85b08185b5bdd5b9d605a1b60448201526064016105b1565b600082116111825760405162461bcd60e51b815260206004820152601360248201527258454e46543a20496c6c6567616c207465726d60681b60448201526064016105b1565b61118f8383600754611efa565b6111c0600754600960006111a16117d6565b6001600160a01b0316815260208101919091526040016000209061215c565b6111d36111cb6117d6565b6007546121d4565b506007805490819060006111e6836134cf565b9190505550806111f46117d6565b6001600160a01b03167f7cc860bef2fa56b3d46227731e60b3b6ce0af9627bfdfbeca273f9ea5dae8a188585604051611237929190918252602082015260400190565b60405180910390a392915050565b336001600160a01b037f000000000000000000000000ad6d1b337ee6d9fd939237f0394918b6af21efaa161461128d5760405162461bcd60e51b81526004016105b190613241565b60408051600481526024810182526020810180516001600160e01b0316633ccfd60b60e01b17905290516000906001600160a01b037f00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa516906112f090849061328e565b6000604051808303816000865af19150503d806000811461132d576040519150601f19603f3d011682016040523d82523d6000602084013e611332565b606091505b505090508061137a5760405162461bcd60e51b81526020600482015260146024820152731dda5d1a191c985dc818d85b1b0819985a5b195960621b60448201526064016105b1565b5050565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b336001600160a01b037f000000000000000000000000ad6d1b337ee6d9fd939237f0394918b6af21efaa16146113f45760405162461bcd60e51b81526004016105b190613241565b6040516370a0823160e01b81526000906001600160a01b037f00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa516906370a0823190611443903090600401612ee1565b602060405180830381865afa158015611460573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148491906131d1565b90506000828260405160240161149b929190612fdd565b60408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b179052519091506000906001600160a01b037f00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa5169061150290849061328e565b6000604051808303816000865af19150503d806000811461153f576040519150601f19603f3d011682016040523d82523d6000602084013e611544565b606091505b505090508061081f5760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c8818d85b1b0819985a5b195960621b60448201526064016105b1565b60006001600160e01b031982166380ac58cd60e01b14806115bd57506001600160e01b03198216635b5e139f60e01b145b8061049457506301ffc9a760e01b6001600160e01b0319831614610494565b6115e5816121ee565b6116015760405162461bcd60e51b81526004016105b1906132aa565b50565b6daaeb6d7670e522a718067333cd4e3b1561160157604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611671573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061169591906132dc565b6116015780604051633b79c77360e21b81526004016105b19190612ee1565b60006116bf82610adc565b9050806001600160a01b0316836001600160a01b03160361172c5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016105b1565b806001600160a01b031661173e6117d6565b6001600160a01b0316148061175a575061175a816104216117d6565b6117cc5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016105b1565b610567838361220b565b60006117e0612279565b905090565b60006117ef61229b565b6040805160048152602481019091526020810180516001600160e01b0316636d6c80df60e11b17905290915060006118256117d6565b6040516024016118359190612ee1565b60408051601f19818403018152918152602080830180516001600160e01b03908116637764c87960e11b17909152825160048152602481018452808301805190921663928dd2a760e01b17909152825180830189905283518082038401815281850185528051908401208851898501206001600160f81b03196060808501919091526001600160601b03193090911b166061840152607583018290526095808401919091528551808403909101815260b59092019094528051908301208651949550909390918291600091829182918a0182865af19050806119595760405162461bcd60e51b815260206004820152601e60248201527f58454e46543a204572726f72207768696c65207769746864726177696e67000060448201526064016105b1565b6000808751602089016000865af19050806119b65760405162461bcd60e51b815260206004820152601f60248201527f58454e46543a204572726f72207768696c65207472616e7366657272696e670060448201526064016105b1565b6000808651602088016000865af1905080611a135760405162461bcd60e51b815260206004820181905260248201527f58454e46543a204572726f72207768696c6520706f776572696e6720646f776e60448201526064016105b1565b5050506000958652505060086020525050604082209190915550565b6000611a8a83805480602002602001604051908101604052809291908181526020018280548015611a7f57602002820191906000526020600020905b815481526020019060010190808311611a6b575b5050505050836122fc565b905080156105675782548390611aa2906001906134e8565b81548110611ab257611ab26134fb565b906000526020600020015483600183611acb91906134e8565b81548110611adb57611adb6134fb565b906000526020600020018190555082805480611af957611af9613511565b60019003818190600052602060002001600090559055505050565b6000611b1f82610adc565b9050611b2d8160008461234d565b611b3860008361220b565b6001600160a01b0381166000908152600460205260408120805460019290611b619084906134e8565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b038416906000805160206136b5833981519152908390a461137a81600084612478565b611bbc610d7c6117d6565b611bd85760405162461bcd60e51b81526004016105b190613527565b6105678383836124bc565b61056783838360405180602001604052806000815250610f0c565b600080611c0a83610adc565b9050806001600160a01b0316846001600160a01b03161480611c315750611c31818561137e565b80611c555750836001600160a01b0316611c4a8461052c565b6001600160a01b0316145b949350505050565b61137a611c686117d6565b8383612657565b611c80611c7a6117d6565b83611bfe565b611c9c5760405162461bcd60e51b81526004016105b190613527565b61081f84848484612721565b606081600003611ccf5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611cf95780611ce3816134cf565b9150611cf29050600a8361322d565b9150611cd3565b6000816001600160401b03811115611d1357611d13613056565b6040519080825280601f01601f191660200182016040528015611d3d576020820181803683370190505b5090505b8415611c5557611d526001836134e8565b9150611d5f600a86613575565b611d6a906030613589565b60f81b818381518110611d7f57611d7f6134fb565b60200101906001600160f81b031916908160001a905350611da1600a8661322d565b9450611d41565b60608151600003611dc757505060408051602081019091526000815290565b60006040518060600160405280604081526020016136756040913990506000600384516002611df69190613589565b611e00919061322d565b611e0b906004613200565b6001600160401b03811115611e2257611e22613056565b6040519080825280601f01601f191660200182016040528015611e4c576020820181803683370190505b509050600182016020820185865187015b80821015611eb8576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250611e5d565b5050600386510660018114611ed45760028114611ee757611eef565b603d6001830353603d6002830353611eef565b603d60018303535b509195945050505050565b6000611f0461229b565b604051602481018690526044810185905290915060009060640160408051601f19818403018152918152602080830180516001600160e01b0316630b3a3ea960e21b17905281519081018690529192506000918291829101604051602081830303815290604052805190602001209050808551602087016000f592506001600160a01b038316611fd25760405162461bcd60e51b815260206004820152601960248201527858454e46543a204572726f72206372656174696e672056535560381b60448201526064016105b1565b7f00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa56001600160a01b03166323b872dd6120096117d6565b6040516001600160e01b031960e084901b1681526001600160a01b0391821660048201529086166024820152604481018b90526064016020604051808303816000875af115801561205e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208291906132dc565b6120da5760405162461bcd60e51b8152602060048201526024808201527f58454e46543a204572726f72207472616e7366657272696e672058454e20746f6044820152632056535560e01b60648201526084016105b1565b6000808551602087016000875af19150816121345760405162461bcd60e51b815260206004820152601a60248201527958454e46543a204572726f72207768696c65207374616b696e6760301b60448201526064016105b1565b61214083878a8a612754565b6000968752600860205260409096209590955550505050505050565b6121b5828054806020026020016040519081016040528092919081815260200182805480156121aa57602002820191906000526020600020905b815481526020019060010190808311612196575b5050505050826122fc565b60000361137a5781546001810183556000928352602090922090910155565b61137a8282604051806020016040528060008152506128ba565b6000908152600360205260409020546001600160a01b0316151590565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061224082610adc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612284336109dc565b15612296575060131936013560601c90565b503390565b60408051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b60208201526001600160601b03193060601b1660348201526e5af43d82803e903d91602b57fd5bf360881b604882015281516037818303018152605790910190915290565b60015b825181116123445781836123146001846134e8565b81518110612324576123246134fb565b60200260200101510315610494578061233c816134cf565b9150506122ff565b50600092915050565b6001600160a01b038316156105675760008181526008602052604080822054905163125fb94760e11b81526004810191909152734c9e86e83e81165784af15a5c72a4cf49ba35732906324bf728e90602401602060405180830381865af41580156123bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e091906131d1565b905060004282116123fa576123f582426134e8565b612404565b61240442836134e8565b9050612414620151806007613200565b8111610f325760405162461bcd60e51b815260206004820152602d60248201527f58454e46543a207472616e736665722070726f6869626974656420696e20626c60448201526c1858dadbdd5d081c195c9a5bd9609a1b60648201526084016105b1565b6001600160a01b038316600090815260096020526040902061249a9082611a2f565b6001600160a01b0382166000908152600960205260409020610567908261215c565b826001600160a01b03166124cf82610adc565b6001600160a01b0316146125335760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016105b1565b6001600160a01b0382166125955760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016105b1565b6125a083838361234d565b6125ab60008261220b565b6001600160a01b03831660009081526004602052604081208054600192906125d49084906134e8565b90915550506001600160a01b0382166000908152600460205260408120805460019290612602908490613589565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716916000805160206136b583398151915291a4610567838383612478565b816001600160a01b0316836001600160a01b0316036126b45760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b60448201526064016105b1565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61272c8484846124bc565b612738848484846128ed565b61081f5760405162461bcd60e51b81526004016105b19061359c565b60008060007f00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa56001600160a01b0316638da7ad23886040518263ffffffff1660e01b81526004016127a59190612ee1565b608060405180830381865afa1580156127c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127e691906135ee565b9350509250506000806127f8886129f5565b9092509050734c9e86e83e81165784af15a5c72a4cf49ba3573263814226dd878661282b670de0b6b3a76400008c61322d565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606481018690526084810185905260a4810184905260c401602060405180830381865af4158015612889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128ad91906131d1565b9998505050505050505050565b6128c48383612cf7565b6128d160008484846128ed565b6105675760405162461bcd60e51b81526004016105b19061359c565b60006001600160a01b0384163b156129ea57836001600160a01b031663150b7a026129166117d6565b8786866040518563ffffffff1660e01b81526004016129389493929190613624565b6020604051808303816000875af1925050508015612973575060408051601f3d908101601f1916820190925261297091810190613657565b60015b6129d0573d8080156129a1576040519150601f19603f3d011682016040523d82523d6000602084013e6129a6565b606091505b5080516000036129c85760405162461bcd60e51b81526004016105b19061359c565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611c55565b506001949350505050565b60405163109c0d2560e21b8152600481018290526000908190819073f7433d491e7fea60f8db1060c83908170b177e3690634270349490602401602060405180830381865af4158015612a4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7091906132dc565b604051634a0e40a160e11b81526004810186905290915060009073f7433d491e7fea60f8db1060c83908170b177e369063941c814290602401602060405180830381865af4158015612ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aea91906132dc565b60405163109c0d2560e21b815243600482015290915060009073f7433d491e7fea60f8db1060c83908170b177e3690634270349490602401602060405180830381865af4158015612b3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6391906132dc565b604051634a0e40a160e11b815243600482015290915060009073f7433d491e7fea60f8db1060c83908170b177e369063941c814290602401602060405180830381865af4158015612bb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bdc91906132dc565b905083612bea576000612bee565b6101f45b612bfc9061ffff1687613589565b955081612c0a576000612c0e565b6103e85b612c1c9061ffff1687613589565b955082612c2a576000612c2e565b6113885b612c3c9061ffff1687613589565b955080612c4a576000612c4e565b6127105b612c5c9061ffff1687613589565b60405163395e488160e01b81528515156004820152841515602482015283151560448201528215156064820152909650734c9e86e83e81165784af15a5c72a4cf49ba357329063395e488190608401602060405180830381865af4158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cec91906131d1565b945050505050915091565b6001600160a01b038216612d4d5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016105b1565b612d56816121ee565b15612da25760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b60448201526064016105b1565b612dae6000838361234d565b6001600160a01b0382166000908152600460205260408120805460019290612dd7908490613589565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392906000805160206136b5833981519152908290a461137a60008383612478565b6001600160e01b03198116811461160157600080fd5b600060208284031215612e5357600080fd5b8135612e5e81612e2b565b9392505050565b60005b83811015612e80578181015183820152602001612e68565b50506000910152565b60008151808452612ea1816020860160208601612e65565b601f01601f19169290920160200192915050565b602081526000612e5e6020830184612e89565b600060208284031215612eda57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b0381168114612f0c57600080fd5b919050565b60008060408385031215612f2457600080fd5b612f2d83612ef5565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015612f7357835183529284019291840191600101612f57565b50909695505050505050565b600080600060608486031215612f9457600080fd5b612f9d84612ef5565b9250612fab60208501612ef5565b9150604084013590509250925092565b60008060408385031215612fce57600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60006020828403121561300857600080fd5b612e5e82612ef5565b801515811461160157600080fd5b6000806040838503121561303257600080fd5b61303b83612ef5565b9150602083013561304b81613011565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561309457613094613056565b604052919050565b60006001600160401b038211156130b5576130b5613056565b50601f01601f191660200190565b600080600080608085870312156130d957600080fd5b6130e285612ef5565b93506130f060208601612ef5565b92506040850135915060608501356001600160401b0381111561311257600080fd5b8501601f8101871361312357600080fd5b80356131366131318261309c565b61306c565b81815288602083850101111561314b57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561318057600080fd5b61318983612ef5565b915061086160208401612ef5565b600181811c908216806131ab57607f821691505b6020821081036131cb57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156131e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610494576104946131ea565b634e487b7160e01b600052601260045260246000fd5b60008261323c5761323c613217565b500490565b60208082526017908201527616115388141c9bde1e4e881d5b985d5d1a1bdc9a5e9959604a1b604082015260600190565b60008151613284818560208601612e65565b9290920192915050565b600082516132a0818460208701612e65565b9190910192915050565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b6000602082840312156132ee57600080fd5b8151612e5e81613011565b60006020828403121561330b57600080fd5b81516001600160401b0381111561332157600080fd5b8201601f8101841361333257600080fd5b80516133406131318261309c565b81815285602083850101111561335557600080fd5b613366826020830160208601612e65565b95945050505050565b607b60f81b815273226e616d65223a202258454e205374616b65202360601b600182015283516000906133a9816015850160208901612e65565b61088b60f21b60159184019182018190527f226465736372697074696f6e223a202258454e46543a2058454e2043727970746017830152711bc8141c9bdbd98813d98814dd185ad9488b60721b6037830152691134b6b0b3b2911d101160b11b60498301527919185d184e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b60321b6053830152855161344481606d850160208a01612e65565b606d9201918201526d01130ba3a3934b13aba32b9911d160951b606f820152613480613473607d830186613272565b607d60f81b815260010190565b9695505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516134c281601d850160208701612e65565b91909101601d0192915050565b6000600182016134e1576134e16131ea565b5060010190565b81810381811115610494576104946131ea565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b60008261358457613584613217565b500690565b80820180821115610494576104946131ea565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000806000806080858703121561360457600080fd5b505082516020840151604085015160609095015191969095509092509050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061348090830184612e89565b60006020828403121561366957600080fd5b8151612e5e81612e2b56fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef404d724a61636b4c6576696e20406c62656c79616576206661697263727970746f2e6f7267a264697066735822122046630899531eb29dd8a242c6f22ad6e291ba0ae57d66288693b0aec6f2f7b30364736f6c63430008110033

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

00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c73fc08c931efe3fce850c09278472e8a81c2e05

-----Decoded View---------------
Arg [0] : xenCrypto_ (address): 0x44c5776735F6DEf0AEb2cC76a526f2128ef68Aa5
Arg [1] : forwarder_ (address): 0x0000000000000000000000000000000000000000
Arg [2] : royaltyReceiver_ (address): 0xC73Fc08C931Efe3FCE850C09278472e8a81c2e05

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000044c5776735f6def0aeb2cc76a526f2128ef68aa5
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 000000000000000000000000c73fc08c931efe3fce850c09278472e8a81c2e05


Library Used


Deployed Bytecode Sourcemap

158032:15657:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;160174:364;;;;;;:::i;:::-;;:::i;:::-;;;565:14:1;;558:22;540:41;;528:2;513:18;160174:364:0;;;;;;;;158748:40;;158785:3;158748:40;;;;;738:25:1;;;726:2;711:18;158748:40:0;592:177:1;22938:100:0;;;:::i;:::-;;;;;;;:::i;24451:171::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;166356:157::-;;;;;;:::i;:::-;;:::i;:::-;;173187:499;;;;;;:::i;:::-;;:::i;172277:116::-;;;:::i;:::-;;;;;;;:::i;166622:163::-;;;;;;:::i;:::-;;:::i;168029:219::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;162450:345::-;;;;;;:::i;:::-;;:::i;113339:143::-;;113439:42;113339:143;;166898:171;;;;;;:::i;:::-;;:::i;158984:44::-;;;;;;:::i;:::-;;;;;;;;;;;;;;116389:138;;;;;;:::i;:::-;;:::i;167583:267::-;;;;;;:::i;:::-;;:::i;158542:51::-;;158583:10;158542:51;;22649:222;;;;;;:::i;:::-;;:::i;22380:207::-;;;;;;:::i;:::-;;:::i;159109:36::-;;;;;161183:84;161250:9;161183:84;;163891:152;;;:::i;23107:104::-;;;:::i;158913:33::-;;;;;;165173:697;;;;;;:::i;:::-;;:::i;158600:58::-;;;:::i;166076:176::-;;;;;;:::i;:::-;;:::i;167182:239::-;;;;;;:::i;:::-;;:::i;158667:72::-;;;:::i;161437:737::-;;;;;;:::i;:::-;;:::i;172548:490::-;;;;;;:::i;:::-;;:::i;162923:297::-;;;:::i;24920:164::-;;;;;;:::i;:::-;;:::i;163358:398::-;;;;;;:::i;:::-;;:::i;160174:364::-;160276:4;-1:-1:-1;;;;;;160313:48:0;;-1:-1:-1;;;160313:48:0;;:106;;-1:-1:-1;;;;;;;160378:41:0;;-1:-1:-1;;;160378:41:0;160313:106;:164;;;-1:-1:-1;;;;;;;160436:41:0;;-1:-1:-1;;;160436:41:0;160313:164;:217;;;;160494:36;160518:11;160494:23;:36::i;:::-;160293:237;160174:364;-1:-1:-1;;160174:364:0:o;22938:100::-;22992:13;23025:5;23018:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22938:100;:::o;24451:171::-;24527:7;24547:23;24562:7;24547:14;:23::i;:::-;-1:-1:-1;24590:24:0;;;;:15;:24;;;;;;-1:-1:-1;;;;;24590:24:0;;24451:171::o;166356:157::-;166452:8;114860:30;114881:8;114860:20;:30::i;:::-;166473:32:::1;166487:8;166497:7;166473:13;:32::i;:::-;166356:157:::0;;;:::o;173187:499::-;173258:1;173248:7;:11;173240:46;;;;-1:-1:-1;;;173240:46:0;;7310:2:1;173240:46:0;;;7292:21:1;7349:2;7329:18;;;7322:30;-1:-1:-1;;;7368:18:1;;;7361:52;7430:18;;173240:46:0;;;;;;;;;173325:12;:10;:12::i;:::-;-1:-1:-1;;;;;173305:32:0;:16;173313:7;173305;:16::i;:::-;-1:-1:-1;;;;;173305:32:0;;173297:67;;;;-1:-1:-1;;;173297:67:0;;7661:2:1;173297:67:0;;;7643:21:1;7700:2;7680:18;;;7673:30;-1:-1:-1;;;7719:18:1;;;7712:52;7781:18;;173297:67:0;7459:346:1;173297:67:0;173375:18;173420;;;:9;:18;;;;;;;173396:43;;-1:-1:-1;;;173396:43:0;;;;;738:25:1;;;;173396:9:0;;:23;;711:18:1;;173396:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;173375:64;;173476:10;173458:15;:28;173450:68;;;;-1:-1:-1;;;173450:68:0;;8391:2:1;173450:68:0;;;8373:21:1;8430:2;8410:18;;;8403:30;-1:-1:-1;;;8449:18:1;;;8442:57;8516:18;;173450:68:0;8189:351:1;173450:68:0;173531:18;173541:7;173531:9;:18::i;:::-;173560:46;173598:7;173560:12;:26;173573:12;:10;:12::i;:::-;-1:-1:-1;;;;;173560:26:0;;;;;;;;;;;;-1:-1:-1;173560:26:0;;:37;:46::i;:::-;173617:14;173623:7;173617:5;:14::i;:::-;173670:7;173656:12;:10;:12::i;:::-;-1:-1:-1;;;;;173647:31:0;;;;;;;;;;;173229:457;173187:499;:::o;172277:116::-;172323:16;172359:12;:26;172372:12;:10;:12::i;:::-;-1:-1:-1;;;;;172359:26:0;-1:-1:-1;;;;;172359:26:0;;;;;;;;;;;;172352:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;172277:116;:::o;166622:163::-;166723:4;-1:-1:-1;;;;;114680:18:0;;114688:10;114680:18;114676:83;;114715:32;114736:10;114715:20;:32::i;:::-;166740:37:::1;166759:4;166765:2;166769:7;166740:18;:37::i;:::-;166622:163:::0;;;;:::o;168029:219::-;168164:16;168101;168234:6;168208:22;158785:3;168208:9;:22;:::i;:::-;168207:33;;;;:::i;:::-;168191:49;;168029:219;;;;;:::o;162450:345::-;162527:10;-1:-1:-1;;;;;162541:9:0;162527:23;;162519:59;;;;-1:-1:-1;;;162519:59:0;;;;;;;:::i;:::-;162613:63;;;;;9633:25:1;;;9674:18;;;9667:34;;;162589:21:0;;9606:18:1;;162613:63:0;;;-1:-1:-1;;162613:63:0;;;;;;;;;;;;;;-1:-1:-1;;;;;162613:63:0;-1:-1:-1;;;162613:63:0;;;162706:33;162613:63;;-1:-1:-1;;;;;;;;162714:9:0;162706:23;;:33;;162613:63;;162706:33;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;162687:52;;;162758:7;162750:37;;;;-1:-1:-1;;;162750:37:0;;10408:2:1;162750:37:0;;;10390:21:1;10447:2;10427:18;;;10420:30;-1:-1:-1;;;10466:18:1;;;10459:47;10523:18;;162750:37:0;10206:341:1;166898:171:0;167003:4;-1:-1:-1;;;;;114680:18:0;;114688:10;114680:18;114676:83;;114715:32;114736:10;114715:20;:32::i;:::-;167020:41:::1;167043:4;167049:2;167053:7;167020:22;:41::i;116389:138::-:0;116465:4;116502:17;-1:-1:-1;;;;;116489:30:0;;;116502:17;;116489:30;;116389:138::o;167583:267::-;167659:10;-1:-1:-1;;;;;167673:9:0;167659:23;;167651:58;;;;-1:-1:-1;;;167651:58:0;;10754:2:1;167651:58:0;;;10736:21:1;10793:2;10773:18;;;10766:30;-1:-1:-1;;;10812:18:1;;;10805:52;10874:18;;167651:58:0;10552:346:1;167651:58:0;167757:1;167728:17;-1:-1:-1;;;;;167728:17:0;:31;167720:75;;;;-1:-1:-1;;;167720:75:0;;11105:2:1;167720:75:0;;;11087:21:1;11144:2;11124:18;;;11117:30;11183:33;11163:18;;;11156:61;11234:18;;167720:75:0;10903:355:1;167720:75:0;167806:17;:36;;-1:-1:-1;;;;;;167806:36:0;-1:-1:-1;;;;;167806:36:0;;;;;;;;;;167583:267::o;22649:222::-;22721:7;22757:16;;;:7;:16;;;;;;-1:-1:-1;;;;;22757:16:0;;22784:56;;;;-1:-1:-1;;;22784:56:0;;;;;;;:::i;22380:207::-;22452:7;-1:-1:-1;;;;;22480:19:0;;22472:73;;;;-1:-1:-1;;;22472:73:0;;11818:2:1;22472:73:0;;;11800:21:1;11857:2;11837:18;;;11830:30;11896:34;11876:18;;;11869:62;-1:-1:-1;;;11947:18:1;;;11940:39;11996:19;;22472:73:0;11616:405:1;22472:73:0;-1:-1:-1;;;;;;22563:16:0;;;;;:9;:16;;;;;;;22380:207::o;163891:152::-;163940:10;-1:-1:-1;;;;;163954:9:0;163940:23;;163932:59;;;;-1:-1:-1;;;163932:59:0;;;;;;;:::i;:::-;164031:1;164002:33;23107:104;23163:13;23196:7;23189:14;;;;;:::i;165173:697::-;165266:12;:10;:12::i;:::-;165258:74;;-1:-1:-1;;;165258:74:0;;-1:-1:-1;;;165258:74:0;;;12170:52:1;-1:-1:-1;;;;;165258:39:0;;;;;;;12143:18:1;;165258:74:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;165236:160;;;;-1:-1:-1;;;165236:160:0;;12685:2:1;165236:160:0;;;12667:21:1;12724:2;12704:18;;;12697:30;12763:34;12743:18;;;12736:62;-1:-1:-1;;;12814:18:1;;;12807:34;12858:19;;165236:160:0;12483:400:1;165236:160:0;-1:-1:-1;;;;;165415:18:0;;165407:64;;;;-1:-1:-1;;;165407:64:0;;13090:2:1;165407:64:0;;;13072:21:1;13129:2;13109:18;;;13102:30;13168:34;13148:18;;;13141:62;-1:-1:-1;;;13219:18:1;;;13212:31;13260:19;;165407:64:0;12888:397:1;165407:64:0;165500:1;165490:7;:11;165482:51;;;;-1:-1:-1;;;165482:51:0;;13492:2:1;165482:51:0;;;13474:21:1;13531:2;13511:18;;;13504:30;-1:-1:-1;;;13550:18:1;;;13543:57;13617:18;;165482:51:0;13290:351:1;165482:51:0;165552:41;165571:12;:10;:12::i;:::-;165585:7;165552:18;:41::i;:::-;165544:90;;;;-1:-1:-1;;;165544:90:0;;13848:2:1;165544:90:0;;;13830:21:1;13887:2;13867:18;;;13860:30;13926:34;13906:18;;;13899:62;-1:-1:-1;;;13977:18:1;;;13970:34;14021:19;;165544:90:0;13646:400:1;165544:90:0;165673:4;-1:-1:-1;;;;;165653:24:0;:16;165661:7;165653;:16::i;:::-;-1:-1:-1;;;;;165653:24:0;;165645:74;;;;-1:-1:-1;;;165645:74:0;;14253:2:1;165645:74:0;;;14235:21:1;14292:2;14272:18;;;14265:30;14331:34;14311:18;;;14304:62;-1:-1:-1;;;14382:18:1;;;14375:35;14427:19;;165645:74:0;14051:401:1;165645:74:0;-1:-1:-1;;;;;165730:18:0;;;;;;:12;:18;;;;;:38;;165760:7;165730:29;:38::i;:::-;165779:14;165785:7;165779:5;:14::i;:::-;165820:12;:10;:12::i;:::-;-1:-1:-1;;;;;165804:43:0;;165848:4;165854:7;165804:58;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;165173:697;;:::o;158600:58::-;158640:18;158583:10;158640:1;:18;:::i;:::-;158600:58;:::o;166076:176::-;166180:8;114860:30;114881:8;114860:20;:30::i;:::-;166201:43:::1;166225:8;166235;166201:23;:43::i;167182:239::-:0;167349:4;-1:-1:-1;;;;;114680:18:0;;114688:10;114680:18;114676:83;;114715:32;114736:10;114715:20;:32::i;:::-;167366:47:::1;167389:4;167395:2;167399:7;167408:4;167366:22;:47::i;:::-;167182:239:::0;;;;;:::o;158667:72::-;;;;;;;;;;;;;;;;;;;:::o;161437:737::-;161528:12;161543:18;;;:9;:18;;;;;;161502:13;;161683:18;161553:7;161683:16;:18::i;:::-;161886:56;;-1:-1:-1;;;161886:56:0;;;;;14667:25:1;;;14708:18;;;14701:34;;;-1:-1:-1;;;;;161931:9:0;14771:32:1;14751:18;;;14744:60;161872:71:0;;161886:13;;:21;;14640:18:1;;161886:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;161886:56:0;;;;;;;;;;;;:::i;:::-;161872:13;:71::i;:::-;162008:30;;-1:-1:-1;;;162008:30:0;;;;;738:25:1;;;162008:13:0;;:24;;711:18:1;;162008:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;162008:30:0;;;;;;;;;;;;:::i;:::-;161597:470;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;161574:493;;162142:22;162156:7;162142:13;:22::i;:::-;162092:73;;;;;;;;:::i;:::-;;;;;;;;;;;;;162078:88;;;;161437:737;;;:::o;172548:490::-;172615:15;172660:1;172651:6;:10;172643:44;;;;-1:-1:-1;;;172643:44:0;;18377:2:1;172643:44:0;;;18359:21:1;18416:2;18396:18;;;18389:30;-1:-1:-1;;;18435:18:1;;;18428:51;18496:18;;172643:44:0;18175:345:1;172643:44:0;172713:1;172706:4;:8;172698:40;;;;-1:-1:-1;;;172698:40:0;;18727:2:1;172698:40:0;;;18709:21:1;18766:2;18746:18;;;18739:30;-1:-1:-1;;;18785:18:1;;;18778:49;18844:18;;172698:40:0;18525:343:1;172698:40:0;172751:42;172764:6;172772:4;172778:14;;172751:12;:42::i;:::-;172804:50;172839:14;;172804:12;:26;172817:12;:10;:12::i;:::-;-1:-1:-1;;;;;172804:26:0;;;;;;;;;;;;-1:-1:-1;172804:26:0;;:34;:50::i;:::-;172865:39;172875:12;:10;:12::i;:::-;172889:14;;172865:9;:39::i;:::-;-1:-1:-1;172925:14:0;;;;;;172950;:16;172925:14;172950:16;:::i;:::-;;;;;;173008:7;172994:12;:10;:12::i;:::-;-1:-1:-1;;;;;172982:48:0;;173017:6;173025:4;172982:48;;;;;;9633:25:1;;;9689:2;9674:18;;9667:34;9621:2;9606:18;;9459:248;172982:48:0;;;;;;;;172548:490;;;;:::o;162923:297::-;162975:10;-1:-1:-1;;;;;162989:9:0;162975:23;;162967:59;;;;-1:-1:-1;;;162967:59:0;;;;;;;:::i;:::-;163061:37;;;;;;;;;;;;;;;;-1:-1:-1;;;;;163061:37:0;-1:-1:-1;;;163061:37:0;;;163128:33;;163037:21;;-1:-1:-1;;;;;163136:9:0;163128:23;;:33;;163061:37;;163128:33;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;163109:52;;;163180:7;163172:40;;;;-1:-1:-1;;;163172:40:0;;19215:2:1;163172:40:0;;;19197:21:1;19254:2;19234:18;;;19227:30;-1:-1:-1;;;19273:18:1;;;19266:50;19333:18;;163172:40:0;19013:344:1;163172:40:0;162956:264;;162923:297::o;24920:164::-;-1:-1:-1;;;;;25041:25:0;;;25017:4;25041:25;;;:18;:25;;;;;;;;:35;;;;;;;;;;;;;;;24920:164::o;163358:398::-;163420:10;-1:-1:-1;;;;;163434:9:0;163420:23;;163412:59;;;;-1:-1:-1;;;163412:59:0;;;;;;;:::i;:::-;163500:34;;-1:-1:-1;;;163500:34:0;;163482:15;;-1:-1:-1;;;;;163500:9:0;:19;;;;:34;;163528:4;;163500:34;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;163482:52;;163545:21;163622:2;163626:7;163569:65;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;163569:65:0;;;;;;;;;;;;;;-1:-1:-1;;;;;163569:65:0;-1:-1:-1;;;163569:65:0;;;163664:33;163569:65;;-1:-1:-1;;;;;;;;163672:9:0;163664:23;;:33;;163569:65;;163664:33;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;163645:52;;;163716:7;163708:40;;;;-1:-1:-1;;;163708:40:0;;19564:2:1;163708:40:0;;;19546:21:1;19603:2;19583:18;;;19576:30;-1:-1:-1;;;19622:18:1;;;19615:50;19682:18;;163708:40:0;19362:344:1;22011:305:0;22113:4;-1:-1:-1;;;;;;22150:40:0;;-1:-1:-1;;;22150:40:0;;:105;;-1:-1:-1;;;;;;;22207:48:0;;-1:-1:-1;;;22207:48:0;22150:105;:158;;;-1:-1:-1;;;;;;;;;;20553:40:0;;;22272:36;20444:157;32426:135;32508:16;32516:7;32508;:16::i;:::-;32500:53;;;;-1:-1:-1;;;32500:53:0;;;;;;;:::i;:::-;32426:135;:::o;114918:419::-;113439:42;115109:45;:49;115105:225;;115180:67;;-1:-1:-1;;;115180:67:0;;115231:4;115180:67;;;19923:34:1;-1:-1:-1;;;;;19993:15:1;;19973:18;;;19966:43;113439:42:0;;115180;;19858:18:1;;115180:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;115175:144;;115294:8;115275:28;;-1:-1:-1;;;115275:28:0;;;;;;;;:::i;23968:417::-;24049:13;24065:23;24080:7;24065:14;:23::i;:::-;24049:39;;24113:5;-1:-1:-1;;;;;24107:11:0;:2;-1:-1:-1;;;;;24107:11:0;;24099:57;;;;-1:-1:-1;;;24099:57:0;;20222:2:1;24099:57:0;;;20204:21:1;20261:2;20241:18;;;20234:30;20300:34;20280:18;;;20273:62;-1:-1:-1;;;20351:18:1;;;20344:31;20392:19;;24099:57:0;20020:397:1;24099:57:0;24207:5;-1:-1:-1;;;;;24191:21:0;:12;:10;:12::i;:::-;-1:-1:-1;;;;;24191:21:0;;:62;;;;24216:37;24233:5;24240:12;:10;:12::i;24216:37::-;24169:174;;;;-1:-1:-1;;;24169:174:0;;20624:2:1;24169:174:0;;;20606:21:1;20663:2;20643:18;;;20636:30;20702:34;20682:18;;;20675:62;20773:32;20753:18;;;20746:60;20823:19;;24169:174:0;20422:426:1;24169:174:0;24356:21;24365:2;24369:7;24356:8;:21::i;160661:149::-;160748:7;160775:27;:25;:27::i;:::-;160768:34;;160661:149;:::o;170970:1200::-;171025:21;171049:11;:9;:11::i;:::-;171095:41;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;171095:41:0;-1:-1:-1;;;171095:41:0;;;171025:35;;-1:-1:-1;171071:21:0;171221:12;:10;:12::i;:::-;171172:62;;;;;;;;:::i;:::-;;;;-1:-1:-1;;171172:62:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;171172:62:0;;;-1:-1:-1;;;171172:62:0;;;;171270:38;;;;;;;;;;;;;;;;;;-1:-1:-1;;;171270:38:0;;;;171344:25;;;;;20982:19:1;;;171344:25:0;;;;;;;;;21017:12:1;;;171344:25:0;;171334:36;;;;;;171453:19;;;;;;-1:-1:-1;;;;;;171406:67:0;;;;21326:26:1;;;;-1:-1:-1;;;;;;171440:4:0;21385:15:1;;;21381:45;21368:11;;;21361:66;21443:12;;;21436:28;;;21480:12;;;;21473:28;;;;171406:67:0;;;;;;;;;;21517:12:1;;;;171406:67:0;;;171396:78;;;;;;171650:15;;171172:62;;-1:-1:-1;171270:38:0;;171396:78;;;;-1:-1:-1;;;;;;171629:19:0;;-1:-1:-1;171396:78:0;171612:5;171607:65;171594:78;;171701:9;171693:52;;;;-1:-1:-1;;;171693:52:0;;21742:2:1;171693:52:0;;;21724:21:1;21781:2;21761:18;;;21754:30;21820:32;21800:18;;;21793:60;21870:18;;171693:52:0;21540:354:1;171693:52:0;171858:1;171855;171843:9;171837:16;171830:4;171819:9;171815:20;171812:1;171805:5;171798;171793:67;171780:80;;171889:9;171881:53;;;;-1:-1:-1;;;171881:53:0;;22101:2:1;171881:53:0;;;22083:21:1;22140:2;22120:18;;;22113:30;22179:33;22159:18;;;22152:61;22230:18;;171881:53:0;21899:355:1;171881:53:0;172047:1;172044;172032:9;172026:16;172019:4;172008:9;172004:20;172001:1;171994:5;171987;171982:67;171969:80;;172078:9;172070:54;;;;-1:-1:-1;;;172070:54:0;;22461:2:1;172070:54:0;;;22443:21:1;;;22480:18;;;22473:30;22539:34;22519:18;;;22512:62;22591:18;;172070:54:0;22259:356:1;172070:54:0;-1:-1:-1;;;172144:18:0;;;;-1:-1:-1;;172144:9:0;:18;;-1:-1:-1;;172144:18:0;;;172137:25;;;;-1:-1:-1;170970:1200:0:o;154933:215::-;155010:9;155022:14;155026:3;155022:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;155031:4;155022:3;:14::i;:::-;155010:26;-1:-1:-1;155051:5:0;;155047:94;;155090:10;;155086:3;;155090:14;;155103:1;;155090:14;:::i;:::-;155086:19;;;;;;;;:::i;:::-;;;;;;;;;155073:3;155081:1;155077;:5;;;;:::i;:::-;155073:10;;;;;;;;:::i;:::-;;;;;;;;:32;;;;155120:3;:9;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;154999:149;154933:215;;:::o;30204:420::-;30264:13;30280:23;30295:7;30280:14;:23::i;:::-;30264:39;;30316:48;30337:5;30352:1;30356:7;30316:20;:48::i;:::-;30405:29;30422:1;30426:7;30405:8;:29::i;:::-;-1:-1:-1;;;;;30447:16:0;;;;;;:9;:16;;;;;:21;;30467:1;;30447:16;:21;;30467:1;;30447:21;:::i;:::-;;;;-1:-1:-1;;30486:16:0;;;;:7;:16;;;;;;30479:23;;-1:-1:-1;;;;;;30479:23:0;;;30520:36;30494:7;;30486:16;-1:-1:-1;;;;;30520:36:0;;;-1:-1:-1;;;;;;;;;;;30520:36:0;30486:16;;30520:36;30569:47;30589:5;30604:1;30608:7;30569:19;:47::i;25151:336::-;25346:41;25365:12;:10;:12::i;25346:41::-;25338:100;;;;-1:-1:-1;;;25338:100:0;;;;;;;:::i;:::-;25451:28;25461:4;25467:2;25471:7;25451:9;:28::i;25558:185::-;25696:39;25713:4;25719:2;25723:7;25696:39;;;;;;;;;;;;:16;:39::i;27938:264::-;28031:4;28048:13;28064:23;28079:7;28064:14;:23::i;:::-;28048:39;;28117:5;-1:-1:-1;;;;;28106:16:0;:7;-1:-1:-1;;;;;28106:16:0;;:52;;;;28126:32;28143:5;28150:7;28126:16;:32::i;:::-;28106:87;;;;28186:7;-1:-1:-1;;;;;28162:31:0;:20;28174:7;28162:11;:20::i;:::-;-1:-1:-1;;;;;28162:31:0;;28106:87;28098:96;27938:264;-1:-1:-1;;;;27938:264:0:o;24694:155::-;24789:52;24808:12;:10;:12::i;:::-;24822:8;24832;24789:18;:52::i;25814:323::-;25988:41;26007:12;:10;:12::i;:::-;26021:7;25988:18;:41::i;:::-;25980:100;;;;-1:-1:-1;;;25980:100:0;;;;;;;:::i;:::-;26091:38;26105:4;26111:2;26115:7;26124:4;26091:13;:38::i;17516:723::-;17572:13;17793:5;17802:1;17793:10;17789:53;;-1:-1:-1;;17820:10:0;;;;;;;;;;;;-1:-1:-1;;;17820:10:0;;;;;17516:723::o;17789:53::-;17867:5;17852:12;17908:78;17915:9;;17908:78;;17941:8;;;;:::i;:::-;;-1:-1:-1;17964:10:0;;-1:-1:-1;17972:2:0;17964:10;;:::i;:::-;;;17908:78;;;17996:19;18028:6;-1:-1:-1;;;;;18018:17:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;18018:17:0;;17996:39;;18046:154;18053:10;;18046:154;;18080:11;18090:1;18080:11;;:::i;:::-;;-1:-1:-1;18149:10:0;18157:2;18149:5;:10;:::i;:::-;18136:24;;:2;:24;:::i;:::-;18123:39;;18106:6;18113;18106:14;;;;;;;;:::i;:::-;;;;:56;-1:-1:-1;;;;;18106:56:0;;;;;;;;-1:-1:-1;18177:11:0;18186:2;18177:11;;:::i;:::-;;;18046:154;;36631:3097;36689:13;36926:4;:11;36941:1;36926:16;36922:31;;-1:-1:-1;;36944:9:0;;;;;;;;;-1:-1:-1;36944:9:0;;;36631:3097::o;36922:31::-;37006:19;37028:6;;;;;;;;;;;;;;;;;37006:28;;37445:20;37504:1;37485:4;:11;37499:1;37485:15;;;;:::i;:::-;37484:21;;;;:::i;:::-;37479:27;;:1;:27;:::i;:::-;-1:-1:-1;;;;;37468:39:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;37468:39:0;;37445:62;;37687:1;37680:5;37676:13;37791:2;37783:6;37779:15;37902:4;37954;37948:11;37942:4;37938:22;37864:1432;37988:6;37979:7;37976:19;37864:1432;;;38094:1;38085:7;38081:15;38070:26;;38133:7;38127:14;38786:4;38778:5;38774:2;38770:14;38766:25;38756:8;38752:40;38746:47;38735:9;38727:67;38840:1;38829:9;38825:17;38812:30;;38932:4;38924:5;38920:2;38916:14;38912:25;38902:8;38898:40;38892:47;38881:9;38873:67;38986:1;38975:9;38971:17;38958:30;;39077:4;39069:5;39066:1;39062:13;39058:24;39048:8;39044:39;39038:46;39027:9;39019:66;39131:1;39120:9;39116:17;39103:30;;39214:4;39207:5;39203:16;39193:8;39189:31;39183:38;39172:9;39164:58;;39268:1;39257:9;39253:17;39240:30;;37864:1432;;;37868:107;;39458:1;39451:4;39445:11;39441:19;39479:1;39474:123;;;;39616:1;39611:73;;;;39434:250;;39474:123;39527:4;39523:1;39512:9;39508:17;39500:32;39577:4;39573:1;39562:9;39558:17;39550:32;39474:123;;39611:73;39664:4;39660:1;39649:9;39645:17;39637:32;39434:250;-1:-1:-1;39714:6:0;;36631:3097;-1:-1:-1;;;;;36631:3097:0:o;169989:887::-;170077:21;170101:11;:9;:11::i;:::-;170147:67;;;;;9633:25:1;;;9674:18;;;9667:34;;;170077:35:0;;-1:-1:-1;170123:21:0;;9606:18:1;;170147:67:0;;;-1:-1:-1;;170147:67:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;170147:67:0;-1:-1:-1;;;170147:67:0;;;170299:25;;;;;20982:19:1;;;170147:67:0;;-1:-1:-1;;;;;;;21017:12:1;170299:25:0;;;;;;;;;;;;170289:36;;;;;;170274:51;;170418:4;170407:8;170401:15;170394:4;170384:8;170380:19;170377:1;170369:54;170360:63;-1:-1:-1;;;;;;170452:19:0;;170444:57;;;;-1:-1:-1;;;170444:57:0;;23881:2:1;170444:57:0;;;23863:21:1;23920:2;23900:18;;;23893:30;-1:-1:-1;;;23939:18:1;;;23932:55;24004:18;;170444:57:0;23679:349:1;170444:57:0;170520:9;-1:-1:-1;;;;;170520:22:0;;170543:12;:10;:12::i;:::-;170520:51;;-1:-1:-1;;;;;;170520:51:0;;;;;;;-1:-1:-1;;;;;24291:15:1;;;170520:51:0;;;24273:34:1;24343:15;;;24323:18;;;24316:43;24375:18;;;24368:34;;;24208:18;;170520:51:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;170512:100;;;;-1:-1:-1;;;170512:100:0;;24615:2:1;170512:100:0;;;24597:21:1;24654:2;24634:18;;;24627:30;24693:34;24673:18;;;24666:62;-1:-1:-1;;;24744:18:1;;;24737:34;24788:19;;170512:100:0;24413:400:1;170512:100:0;170723:1;170720;170709:8;170703:15;170696:4;170686:8;170682:19;170679:1;170672:5;170665;170660:65;170647:78;;170754:9;170746:48;;;;-1:-1:-1;;;170746:48:0;;25020:2:1;170746:48:0;;;25002:21:1;25059:2;25039:18;;;25032:30;-1:-1:-1;;;25078:18:1;;;25071:56;25144:18;;170746:48:0;24818:350:1;170746:48:0;170828:40;170839:5;170846:7;170855:6;170863:4;170828:10;:40::i;:::-;170807:18;;;;:9;:18;;;;;;:61;;;;-1:-1:-1;;;;;;;169989:887:0:o;154778:147::-;154856:14;154860:3;154856:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;154865:4;154856:3;:14::i;:::-;154874:1;154856:19;154852:66;;154892:14;;;;;;;-1:-1:-1;154892:14:0;;;;;;;;;;;154778:147::o;28544:110::-;28620:26;28630:2;28634:7;28620:26;;;;;;;;;;;;:9;:26::i;27644:127::-;27709:4;27733:16;;;:7;:16;;;;;;-1:-1:-1;;;;;27733:16:0;:30;;;27644:127::o;31705:174::-;31780:24;;;;:15;:24;;;;;:29;;-1:-1:-1;;;;;;31780:29:0;-1:-1:-1;;;;;31780:29:0;;;;;;;;:24;;31834:23;31780:24;31834:14;:23::i;:::-;-1:-1:-1;;;;;31825:46:0;;;;;;;;;;;31705:174;;:::o;116535:458::-;116597:14;116628:30;116647:10;116628:18;:30::i;:::-;116624:362;;;-1:-1:-1;;;116881:14:0;116877:23;116864:37;116860:2;116856:46;116535:458;:::o;116624:362::-;-1:-1:-1;16954:10:0;;160661:149::o;169601:294::-;169689:198;;;-1:-1:-1;;;169689:198:0;;;25400:28:1;-1:-1:-1;;;;;;169806:4:0;169644:12;169790:22;25458:15:1;25444:12;;;25437:37;-1:-1:-1;;;25490:12:1;;;25483:59;169689:198:0;;;;;;;;;25558:12:1;;;;169689:198:0;;;;169601:294::o;154526:244::-;154629:1;154620:127;154637:3;:10;154632:1;:15;154620:127;;154687:4;154673:3;154677:5;154681:1;154677;:5;:::i;:::-;154673:10;;;;;;;;:::i;:::-;;;;;;;:18;154669:67;154712:8;154669:67;154649:3;;;;:::i;:::-;;;;154620:127;;;-1:-1:-1;154761:1:0;154526:244;;;;:::o;164259:444::-;-1:-1:-1;;;;;164370:18:0;;;164366:330;;164405:18;164450;;;:9;:18;;;;;;;164426:43;;-1:-1:-1;;;164426:43:0;;;;;738:25:1;;;;164426:9:0;;:23;;711:18:1;;164426:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;164405:64;;164484:13;164513:15;164500:10;:28;:90;;164562:28;164580:10;164562:15;:28;:::i;:::-;164500:90;;;164531:28;164544:15;164531:10;:28;:::i;:::-;164484:106;-1:-1:-1;158640:18:0;158583:10;158640:1;:18;:::i;:::-;164613:5;:21;164605:79;;;;-1:-1:-1;;;164605:79:0;;25783:2:1;164605:79:0;;;25765:21:1;25822:2;25802:18;;;25795:30;25861:34;25841:18;;;25834:62;-1:-1:-1;;;25912:18:1;;;25905:43;25965:19;;164605:79:0;25581:409:1;164821:199:0;-1:-1:-1;;;;;164930:18:0;;;;;;:12;:18;;;;;:38;;164960:7;164930:29;:38::i;:::-;-1:-1:-1;;;;;164979:16:0;;;;;;:12;:16;;;;;:33;;165004:7;164979:24;:33::i;30961:625::-;31120:4;-1:-1:-1;;;;;31093:31:0;:23;31108:7;31093:14;:23::i;:::-;-1:-1:-1;;;;;31093:31:0;;31085:81;;;;-1:-1:-1;;;31085:81:0;;26197:2:1;31085:81:0;;;26179:21:1;26236:2;26216:18;;;26209:30;26275:34;26255:18;;;26248:62;-1:-1:-1;;;26326:18:1;;;26319:35;26371:19;;31085:81:0;25995:401:1;31085:81:0;-1:-1:-1;;;;;31185:16:0;;31177:65;;;;-1:-1:-1;;;31177:65:0;;26603:2:1;31177:65:0;;;26585:21:1;26642:2;26622:18;;;26615:30;26681:34;26661:18;;;26654:62;-1:-1:-1;;;26732:18:1;;;26725:34;26776:19;;31177:65:0;26401:400:1;31177:65:0;31255:39;31276:4;31282:2;31286:7;31255:20;:39::i;:::-;31359:29;31376:1;31380:7;31359:8;:29::i;:::-;-1:-1:-1;;;;;31401:15:0;;;;;;:9;:15;;;;;:20;;31420:1;;31401:15;:20;;31420:1;;31401:20;:::i;:::-;;;;-1:-1:-1;;;;;;;31432:13:0;;;;;;:9;:13;;;;;:18;;31449:1;;31432:13;:18;;31449:1;;31432:18;:::i;:::-;;;;-1:-1:-1;;31461:16:0;;;;:7;:16;;;;;;:21;;-1:-1:-1;;;;;;31461:21:0;-1:-1:-1;;;;;31461:21:0;;;;;;;;;31500:27;;31461:16;;31500:27;;;;-1:-1:-1;;;;;;;;;;;31500:27:0;;31540:38;31560:4;31566:2;31570:7;31540:19;:38::i;32022:315::-;32177:8;-1:-1:-1;;;;;32168:17:0;:5;-1:-1:-1;;;;;32168:17:0;;32160:55;;;;-1:-1:-1;;;32160:55:0;;27008:2:1;32160:55:0;;;26990:21:1;27047:2;27027:18;;;27020:30;-1:-1:-1;;;27066:18:1;;;27059:55;27131:18;;32160:55:0;26806:349:1;32160:55:0;-1:-1:-1;;;;;32226:25:0;;;;;;;:18;:25;;;;;;;;:35;;;;;;;;;;;;;:46;;-1:-1:-1;;32226:46:0;;;;;;;;;;32288:41;;540::1;;;32288::0;;513:18:1;32288:41:0;;;;;;;32022:315;;;:::o;27018:313::-;27174:28;27184:4;27190:2;27194:7;27174:9;:28::i;:::-;27221:47;27244:4;27250:2;27254:7;27263:4;27221:22;:47::i;:::-;27213:110;;;;-1:-1:-1;;;27213:110:0;;;;;;;:::i;169068:432::-;169215:12;169243:18;169265:11;169280:9;-1:-1:-1;;;;;169280:20:0;;169301:5;169280:27;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;169240:67;;;;;;169319:19;169340:18;169362:20;169374:7;169362:11;:20::i;:::-;169318:64;;-1:-1:-1;169318:64:0;-1:-1:-1;169400:9:0;:25;169426:4;169432:10;169444:17;169453:8;169444:6;:17;:::i;:::-;169400:92;;-1:-1:-1;;;;;;169400:92:0;;;;;;;;;;28247:25:1;;;;28288:18;;;28281:34;;;;28331:18;;;28324:34;28374:18;;;28367:34;;;28417:19;;;28410:35;;;28461:19;;;28454:35;;;28219:19;;169400:92:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;169393:99;169068:432;-1:-1:-1;;;;;;;;;169068:432:0:o;28881:319::-;29010:18;29016:2;29020:7;29010:5;:18::i;:::-;29061:53;29092:1;29096:2;29100:7;29109:4;29061:22;:53::i;:::-;29039:153;;;;-1:-1:-1;;;29039:153:0;;;;;;;:::i;33125:853::-;33279:4;-1:-1:-1;;;;;33300:13:0;;9172:19;:23;33296:675;;33352:2;-1:-1:-1;;;;;33336:36:0;;33373:12;:10;:12::i;:::-;33387:4;33393:7;33402:4;33336:71;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;-1:-1:-1;33336:71:0;;;;;;;;-1:-1:-1;;33336:71:0;;;;;;;;;;;;:::i;:::-;;;33332:584;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;33577:6;:13;33594:1;33577:18;33573:328;;33620:60;;-1:-1:-1;;;33620:60:0;;;;;;;:::i;33573:328::-;33851:6;33845:13;33836:6;33832:2;33828:15;33821:38;33332:584;-1:-1:-1;;;;;;33458:51:0;-1:-1:-1;;;33458:51:0;;-1:-1:-1;33451:58:0;;33296:675;-1:-1:-1;33955:4:0;33125:853;;;;;;:::o;168403:578::-;168530:17;;-1:-1:-1;;;168530:17:0;;;;;738:25:1;;;168463:19:0;;;;;;168530:15;;;;711:18:1;;168530:17:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;168571:15;;-1:-1:-1;;;168571:15:0;;;;;738:25:1;;;168515:32:0;;-1:-1:-1;168558:10:0;;168571:13;;;;711:18:1;;168571:15:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;168617:22;;-1:-1:-1;;;168617:22:0;;:12;:22;;;738:25:1;168558:28:0;;-1:-1:-1;168597:17:0;;168617:20;;;;711:18:1;;168617:22:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;168668:20;;-1:-1:-1;;;168668:20:0;;:12;:20;;;738:25:1;168597:42:0;;-1:-1:-1;168650:15:0;;168668:18;;;;711::1;;168668:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;168650:38;;168715:7;:17;;168731:1;168715:17;;;168725:3;168715:17;168699:34;;;;;;:::i;:::-;;;168760:12;:24;;168783:1;168760:24;;;168775:5;168760:24;168744:41;;;;;;:::i;:::-;;;168812:5;:17;;168828:1;168812:17;;;168820:5;168812:17;168796:34;;;;;;:::i;:::-;;;168857:10;:23;;168879:1;168857:23;;;168870:6;168857:23;168841:40;;;;;;:::i;:::-;168905:68;;-1:-1:-1;;;168905:68:0;;29488:14:1;;29481:22;168905:68:0;;;29463:41:1;29547:14;;29540:22;29520:18;;;29513:50;29606:14;;29599:22;29579:18;;;29572:50;29665:14;;29658:22;29638:18;;;29631:50;168841:40:0;;-1:-1:-1;168905:9:0;;:26;;29435:19:1;;168905:68:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;168892:81;;168504:477;;;;168403:578;;;:::o;29536:439::-;-1:-1:-1;;;;;29616:16:0;;29608:61;;;;-1:-1:-1;;;29608:61:0;;29894:2:1;29608:61:0;;;29876:21:1;;;29913:18;;;29906:30;29972:34;29952:18;;;29945:62;30024:18;;29608:61:0;29692:356:1;29608:61:0;29689:16;29697:7;29689;:16::i;:::-;29688:17;29680:58;;;;-1:-1:-1;;;29680:58:0;;30255:2:1;29680:58:0;;;30237:21:1;30294:2;30274:18;;;30267:30;-1:-1:-1;;;30313:18:1;;;30306:58;30381:18;;29680:58:0;30053:352:1;29680:58:0;29751:45;29780:1;29784:2;29788:7;29751:20;:45::i;:::-;-1:-1:-1;;;;;29809:13:0;;;;;;:9;:13;;;;;:18;;29826:1;;29809:13;:18;;29826:1;;29809:18;:::i;:::-;;;;-1:-1:-1;;29838:16:0;;;;:7;:16;;;;;;:21;;-1:-1:-1;;;;;;29838:21:0;-1:-1:-1;;;;;29838:21:0;;;;;;;;29877:33;;29838:16;;;-1:-1:-1;;;;;;;;;;;29877:33:0;29838:16;;29877:33;29923:44;29951:1;29955:2;29959:7;29923:19;:44::i;14:131:1:-;-1:-1:-1;;;;;;88:32:1;;78:43;;68:71;;135:1;132;125:12;150:245;208:6;261:2;249:9;240:7;236:23;232:32;229:52;;;277:1;274;267:12;229:52;316:9;303:23;335:30;359:5;335:30;:::i;:::-;384:5;150:245;-1:-1:-1;;;150:245:1:o;774:250::-;859:1;869:113;883:6;880:1;877:13;869:113;;;959:11;;;953:18;940:11;;;933:39;905:2;898:10;869:113;;;-1:-1:-1;;1016:1:1;998:16;;991:27;774:250::o;1029:271::-;1071:3;1109:5;1103:12;1136:6;1131:3;1124:19;1152:76;1221:6;1214:4;1209:3;1205:14;1198:4;1191:5;1187:16;1152:76;:::i;:::-;1282:2;1261:15;-1:-1:-1;;1257:29:1;1248:39;;;;1289:4;1244:50;;1029:271;-1:-1:-1;;1029:271:1:o;1305:220::-;1454:2;1443:9;1436:21;1417:4;1474:45;1515:2;1504:9;1500:18;1492:6;1474:45;:::i;1530:180::-;1589:6;1642:2;1630:9;1621:7;1617:23;1613:32;1610:52;;;1658:1;1655;1648:12;1610:52;-1:-1:-1;1681:23:1;;1530:180;-1:-1:-1;1530:180:1:o;1715:203::-;-1:-1:-1;;;;;1879:32:1;;;;1861:51;;1849:2;1834:18;;1715:203::o;1923:173::-;1991:20;;-1:-1:-1;;;;;2040:31:1;;2030:42;;2020:70;;2086:1;2083;2076:12;2020:70;1923:173;;;:::o;2101:254::-;2169:6;2177;2230:2;2218:9;2209:7;2205:23;2201:32;2198:52;;;2246:1;2243;2236:12;2198:52;2269:29;2288:9;2269:29;:::i;:::-;2259:39;2345:2;2330:18;;;;2317:32;;-1:-1:-1;;;2101:254:1:o;2360:632::-;2531:2;2583:21;;;2653:13;;2556:18;;;2675:22;;;2502:4;;2531:2;2754:15;;;;2728:2;2713:18;;;2502:4;2797:169;2811:6;2808:1;2805:13;2797:169;;;2872:13;;2860:26;;2941:15;;;;2906:12;;;;2833:1;2826:9;2797:169;;;-1:-1:-1;2983:3:1;;2360:632;-1:-1:-1;;;;;;2360:632:1:o;2997:328::-;3074:6;3082;3090;3143:2;3131:9;3122:7;3118:23;3114:32;3111:52;;;3159:1;3156;3149:12;3111:52;3182:29;3201:9;3182:29;:::i;:::-;3172:39;;3230:38;3264:2;3253:9;3249:18;3230:38;:::i;:::-;3220:48;;3315:2;3304:9;3300:18;3287:32;3277:42;;2997:328;;;;;:::o;3330:248::-;3398:6;3406;3459:2;3447:9;3438:7;3434:23;3430:32;3427:52;;;3475:1;3472;3465:12;3427:52;-1:-1:-1;;3498:23:1;;;3568:2;3553:18;;;3540:32;;-1:-1:-1;3330:248:1:o;3583:274::-;-1:-1:-1;;;;;3775:32:1;;;;3757:51;;3839:2;3824:18;;3817:34;3745:2;3730:18;;3583:274::o;4102:186::-;4161:6;4214:2;4202:9;4193:7;4189:23;4185:32;4182:52;;;4230:1;4227;4220:12;4182:52;4253:29;4272:9;4253:29;:::i;4519:118::-;4605:5;4598:13;4591:21;4584:5;4581:32;4571:60;;4627:1;4624;4617:12;4642:315;4707:6;4715;4768:2;4756:9;4747:7;4743:23;4739:32;4736:52;;;4784:1;4781;4774:12;4736:52;4807:29;4826:9;4807:29;:::i;:::-;4797:39;;4886:2;4875:9;4871:18;4858:32;4899:28;4921:5;4899:28;:::i;:::-;4946:5;4936:15;;;4642:315;;;;;:::o;4962:127::-;5023:10;5018:3;5014:20;5011:1;5004:31;5054:4;5051:1;5044:15;5078:4;5075:1;5068:15;5094:275;5165:2;5159:9;5230:2;5211:13;;-1:-1:-1;;5207:27:1;5195:40;;-1:-1:-1;;;;;5250:34:1;;5286:22;;;5247:62;5244:88;;;5312:18;;:::i;:::-;5348:2;5341:22;5094:275;;-1:-1:-1;5094:275:1:o;5374:186::-;5422:4;-1:-1:-1;;;;;5447:6:1;5444:30;5441:56;;;5477:18;;:::i;:::-;-1:-1:-1;5543:2:1;5522:15;-1:-1:-1;;5518:29:1;5549:4;5514:40;;5374:186::o;5565:888::-;5660:6;5668;5676;5684;5737:3;5725:9;5716:7;5712:23;5708:33;5705:53;;;5754:1;5751;5744:12;5705:53;5777:29;5796:9;5777:29;:::i;:::-;5767:39;;5825:38;5859:2;5848:9;5844:18;5825:38;:::i;:::-;5815:48;;5910:2;5899:9;5895:18;5882:32;5872:42;;5965:2;5954:9;5950:18;5937:32;-1:-1:-1;;;;;5984:6:1;5981:30;5978:50;;;6024:1;6021;6014:12;5978:50;6047:22;;6100:4;6092:13;;6088:27;-1:-1:-1;6078:55:1;;6129:1;6126;6119:12;6078:55;6165:2;6152:16;6190:48;6206:31;6234:2;6206:31;:::i;:::-;6190:48;:::i;:::-;6261:2;6254:5;6247:17;6301:7;6296:2;6291;6287;6283:11;6279:20;6276:33;6273:53;;;6322:1;6319;6312:12;6273:53;6377:2;6372;6368;6364:11;6359:2;6352:5;6348:14;6335:45;6421:1;6416:2;6411;6404:5;6400:14;6396:23;6389:34;6442:5;6432:15;;;;;5565:888;;;;;;;:::o;6458:260::-;6526:6;6534;6587:2;6575:9;6566:7;6562:23;6558:32;6555:52;;;6603:1;6600;6593:12;6555:52;6626:29;6645:9;6626:29;:::i;:::-;6616:39;;6674:38;6708:2;6697:9;6693:18;6674:38;:::i;6723:380::-;6802:1;6798:12;;;;6845;;;6866:61;;6920:4;6912:6;6908:17;6898:27;;6866:61;6973:2;6965:6;6962:14;6942:18;6939:38;6936:161;;7019:10;7014:3;7010:20;7007:1;7000:31;7054:4;7051:1;7044:15;7082:4;7079:1;7072:15;6936:161;;6723:380;;;:::o;8000:184::-;8070:6;8123:2;8111:9;8102:7;8098:23;8094:32;8091:52;;;8139:1;8136;8129:12;8091:52;-1:-1:-1;8162:16:1;;8000:184;-1:-1:-1;8000:184:1:o;8545:127::-;8606:10;8601:3;8597:20;8594:1;8587:31;8637:4;8634:1;8627:15;8661:4;8658:1;8651:15;8677:168;8750:9;;;8781;;8798:15;;;8792:22;;8778:37;8768:71;;8819:18;;:::i;8850:127::-;8911:10;8906:3;8902:20;8899:1;8892:31;8942:4;8939:1;8932:15;8966:4;8963:1;8956:15;8982:120;9022:1;9048;9038:35;;9053:18;;:::i;:::-;-1:-1:-1;9087:9:1;;8982:120::o;9107:347::-;9309:2;9291:21;;;9348:2;9328:18;;;9321:30;-1:-1:-1;;;9382:2:1;9367:18;;9360:53;9445:2;9430:18;;9107:347::o;9712:197::-;9753:3;9791:5;9785:12;9806:65;9864:6;9859:3;9852:4;9845:5;9841:16;9806:65;:::i;:::-;9887:16;;;;;9712:197;-1:-1:-1;;9712:197:1:o;9914:287::-;10043:3;10081:6;10075:13;10097:66;10156:6;10151:3;10144:4;10136:6;10132:17;10097:66;:::i;:::-;10179:16;;;;;9914:287;-1:-1:-1;;9914:287:1:o;11263:348::-;11465:2;11447:21;;;11504:2;11484:18;;;11477:30;-1:-1:-1;;;11538:2:1;11523:18;;11516:54;11602:2;11587:18;;11263:348::o;12233:245::-;12300:6;12353:2;12341:9;12332:7;12328:23;12324:32;12321:52;;;12369:1;12366;12359:12;12321:52;12401:9;12395:16;12420:28;12442:5;12420:28;:::i;14815:647::-;14894:6;14947:2;14935:9;14926:7;14922:23;14918:32;14915:52;;;14963:1;14960;14953:12;14915:52;14996:9;14990:16;-1:-1:-1;;;;;15021:6:1;15018:30;15015:50;;;15061:1;15058;15051:12;15015:50;15084:22;;15137:4;15129:13;;15125:27;-1:-1:-1;15115:55:1;;15166:1;15163;15156:12;15115:55;15195:2;15189:9;15220:48;15236:31;15264:2;15236:31;:::i;15220:48::-;15291:2;15284:5;15277:17;15331:7;15326:2;15321;15317;15313:11;15309:20;15306:33;15303:53;;;15352:1;15349;15342:12;15303:53;15365:67;15429:2;15424;15417:5;15413:14;15408:2;15404;15400:11;15365:67;:::i;:::-;15451:5;14815:647;-1:-1:-1;;;;;14815:647:1:o;15586:2118::-;-1:-1:-1;;;16738:16:1;;-1:-1:-1;;;16779:1:1;16770:11;;16763:72;16858:13;;-1:-1:-1;;16880:75:1;16858:13;16943:2;16934:12;;16927:4;16915:17;;16880:75;:::i;:::-;-1:-1:-1;;;17047:2:1;16974:16;;;17039:11;;;17032:23;;;17084:66;17079:2;17071:11;;17064:87;-1:-1:-1;;;17175:2:1;17167:11;;17160:69;-1:-1:-1;;;17253:2:1;17245:11;;17238:53;-1:-1:-1;;;17315:2:1;17307:11;;17300:49;17374:13;;17396:77;17374:13;17458:3;17450:12;;17443:4;17431:17;;17396:77;:::i;:::-;17533:3;17492:17;;17525:12;;;17518:24;-1:-1:-1;;;17566:3:1;17558:12;;17551:62;17629:69;17659:38;17692:3;17684:12;;17676:6;17659:38;:::i;:::-;-1:-1:-1;;;15532:16:1;;15573:1;15564:11;;15467:114;17629:69;17622:76;15586:2118;-1:-1:-1;;;;;;15586:2118:1:o;17709:461::-;17971:31;17966:3;17959:44;17941:3;18032:6;18026:13;18048:75;18116:6;18111:2;18106:3;18102:12;18095:4;18087:6;18083:17;18048:75;:::i;:::-;18143:16;;;;18161:2;18139:25;;17709:461;-1:-1:-1;;17709:461:1:o;18873:135::-;18912:3;18933:17;;;18930:43;;18953:18;;:::i;:::-;-1:-1:-1;19000:1:1;18989:13;;18873:135::o;22620:128::-;22687:9;;;22708:11;;;22705:37;;;22722:18;;:::i;22753:127::-;22814:10;22809:3;22805:20;22802:1;22795:31;22845:4;22842:1;22835:15;22869:4;22866:1;22859:15;22885:127;22946:10;22941:3;22937:20;22934:1;22927:31;22977:4;22974:1;22967:15;23001:4;22998:1;22991:15;23017:410;23219:2;23201:21;;;23258:2;23238:18;;;23231:30;23297:34;23292:2;23277:18;;23270:62;-1:-1:-1;;;23363:2:1;23348:18;;23341:44;23417:3;23402:19;;23017:410::o;23432:112::-;23464:1;23490;23480:35;;23495:18;;:::i;:::-;-1:-1:-1;23529:9:1;;23432:112::o;23549:125::-;23614:9;;;23635:10;;;23632:36;;;23648:18;;:::i;27160:414::-;27362:2;27344:21;;;27401:2;27381:18;;;27374:30;27440:34;27435:2;27420:18;;27413:62;-1:-1:-1;;;27506:2:1;27491:18;;27484:48;27564:3;27549:19;;27160:414::o;27579:368::-;27676:6;27684;27692;27700;27753:3;27741:9;27732:7;27728:23;27724:33;27721:53;;;27770:1;27767;27760:12;27721:53;-1:-1:-1;;27793:16:1;;27849:2;27834:18;;27828:25;27893:2;27878:18;;27872:25;27937:2;27922:18;;;27916:25;27793:16;;27828:25;;-1:-1:-1;27916:25:1;;-1:-1:-1;27579:368:1;-1:-1:-1;27579:368:1:o;28500:489::-;-1:-1:-1;;;;;28769:15:1;;;28751:34;;28821:15;;28816:2;28801:18;;28794:43;28868:2;28853:18;;28846:34;;;28916:3;28911:2;28896:18;;28889:31;;;28694:4;;28937:46;;28963:19;;28955:6;28937:46;:::i;28994:249::-;29063:6;29116:2;29104:9;29095:7;29091:23;29087:32;29084:52;;;29132:1;29129;29122:12;29084:52;29164:9;29158:16;29183:30;29207:5;29183:30;:::i

Swarm Source

ipfs://46630899531eb29dd8a242c6f22ad6e291ba0ae57d66288693b0aec6f2f7b303

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.