MATIC Price: $0.747308 (+9.52%)
Gas: 76 GWei
 

Sponsored

Transaction Hash
Method
Block
From
To
Value
Write565054562024-05-02 20:06:2818 days ago1714680388IN
0x00000000...5B3B041eD
0 MATIC0.0106972830.00000003
Cash560054542024-04-19 12:23:1432 days ago1713529394IN
0x00000000...5B3B041eD
0 MATIC0.01255416154.4462603
Cash558652632024-04-15 21:18:3935 days ago1713215919IN
0x00000000...5B3B041eD
0 MATIC0.0063906678.63213535
Write556939282024-04-11 7:39:4540 days ago1712821185IN
0x00000000...5B3B041eD
0 MATIC0.08306556237.46793062
Cash556590252024-04-10 9:22:2741 days ago1712740947IN
0x00000000...5B3B041eD
0 MATIC0.01344572116.44039205
Cash556180862024-04-09 7:13:4942 days ago1712646829IN
0x00000000...5B3B041eD
0 MATIC0.01315999133.76012971
Cash555957592024-04-08 17:06:3642 days ago1712595996IN
0x00000000...5B3B041eD
0 MATIC0.01647329201.99995361
Cash555957552024-04-08 17:06:2842 days ago1712595988IN
0x00000000...5B3B041eD
0 MATIC0.02106474204.06433076
Cash555957512024-04-08 17:06:2042 days ago1712595980IN
0x00000000...5B3B041eD
0 MATIC0.01631876200.78944258
Cash554056982024-04-03 17:31:4647 days ago1712165506IN
0x00000000...5B3B041eD
0 MATIC0.02345975237.68991322
Write554053492024-04-03 17:18:1847 days ago1712164698IN
0x00000000...5B3B041eD
0 MATIC0.08057883255.0511914
Write554049272024-04-03 17:02:1147 days ago1712163731IN
0x00000000...5B3B041eD
0 MATIC0.08050445254.82543228
Write553724502024-04-02 20:25:4348 days ago1712089543IN
0x00000000...5B3B041eD
0 MATIC0.0246251164.62962925
Cash553257322024-04-01 14:20:3549 days ago1711981235IN
0x00000000...5B3B041eD
0 MATIC0.02511078217.46020889
Write551836502024-03-28 17:15:2853 days ago1711646128IN
0x00000000...5B3B041eD
0 MATIC0.0405930794.54717294
Write551609402024-03-28 2:47:1954 days ago1711594039IN
0x00000000...5B3B041eD
0 MATIC0.03993923105.69514436
Write550689542024-03-25 16:35:2556 days ago1711384525IN
0x00000000...5B3B041eD
0 MATIC1.2627443,500
Write550276942024-03-24 13:27:5557 days ago1711286875IN
0x00000000...5B3B041eD
0 MATIC0.0098574242.48540499
Cash550264122024-03-24 12:38:3857 days ago1711283918IN
0x00000000...5B3B041eD
0 MATIC0.0037196446.56251813
Write550253602024-03-24 11:58:1958 days ago1711281499IN
0x00000000...5B3B041eD
0 MATIC0.0079176741.19777814
Cash548827532024-03-20 15:48:5861 days ago1710949738IN
0x00000000...5B3B041eD
0 MATIC0.0075909198.94567767
Cash548173822024-03-18 21:48:4963 days ago1710798529IN
0x00000000...5B3B041eD
0 MATIC0.0021646630.04440244
Cash546324542024-03-14 3:01:3268 days ago1710385292IN
0x00000000...5B3B041eD
0 MATIC0.00826816122.96496021
Cash546292062024-03-14 1:03:5168 days ago1710378231IN
0x00000000...5B3B041eD
0 MATIC0.01268314145.77651658
Cash546291712024-03-14 1:02:3768 days ago1710378157IN
0x00000000...5B3B041eD
0 MATIC0.0132217162.0644174
View all transactions

Latest 1 internal transaction

Parent Transaction Hash Block From To Value
520956852024-01-08 20:07:46133 days ago1704744466  Contract Creation0 MATIC
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NotaRegistrar

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
paris EvmVersion
File 1 of 1 : Denota.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.16;

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

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

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

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

/**
 * @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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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);
}

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

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

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

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

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

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

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

/**
 * @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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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);
        }
    }
}

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

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

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

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

// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _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) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

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

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

/**
 * @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 = _ownerOf(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 or 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 or 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 or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @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 _ownerOf(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, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        // require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        // owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

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

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

    /**
     * @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, 1); changed

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        // require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); changed

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        // _afterTokenTransfer(from, to, tokenId, 1); changed
    }

    /**
     * @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. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }
}

// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

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

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

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

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

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

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

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

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

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

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

// enum AssetType {ERC20, ERC721, ERC1155}

struct Nota {
    uint256 escrowed; // Slot 1 (256)
    address currency; // Slot2 (160)
    // 96 bits free
    INotaModule module; // Slot3 (160) // mapping(INotaModule module => uint96 index) and store uint96 here
    // 96 bits free

    // address owner; // Slot4 (160)
    // 96 bits free

    // address approved; // Slot5 (160)
    // 96 bits free

    // AssetType assetType; (8 bits)
}

// Question: Should the require statements be part of the interface? Would allow people to query canWrite(), canCash(), etc
interface INotaModule {
    function processWrite(
        address caller,
        address owner,
        uint256 notaId,
        address currency,
        uint256 escrowed,
        uint256 instant,
        bytes calldata moduleBytes
    ) external returns (uint256);

    function processTransfer(
        address caller,
        address approved,
        address owner,
        address from,
        address to,
        uint256 notaId,
        Nota calldata nota, // Does this still make sense since it's only currency, escrowed, module?
        bytes calldata moduleBytes
    ) external returns (uint256);

    function processFund(
        address caller,
        address owner,
        uint256 amount,
        uint256 instant,
        uint256 notaId,
        Nota calldata nota, // Does this still make sense since it's only currency, escrowed, module?
        bytes calldata moduleBytes
    ) external returns (uint256);

    function processCash(
        address caller,
        address owner,
        address to,
        uint256 amount,
        uint256 notaId,
        Nota calldata nota, // Does this still make sense since it's only currency, escrowed, module?
        bytes calldata moduleBytes
    ) external returns (uint256);

    function processApproval(
        address caller,
        address owner,
        address to,
        uint256 notaId,
        Nota calldata nota // Does this still make sense since it's only currency, escrowed, module?
    ) external;

    function processTokenURI(
        uint256 tokenId
    ) external view returns (string memory, string memory);
}

/**
 * @notice NotaRegistrar handles: Escrowing funds, and Storing nota data
 */
 // NOTE: If Registrar fee storing, Uniswapv4 has this inherit a IFees interface here as well. 
 /**
 * @title  The Nota Payment Registrar
 * @notice The main contract where users can WTFCA notas
 * @author Alejandro Almaraz
 * @dev    Tracks ownership of notas' data + escrow, and collects revenue.
 */

interface INotaRegistrar {

    event Written(
        address indexed caller,
        uint256 notaId,
        address indexed owner, // Question is this needed considering ERC721 _mint() emits owner `from` address(0) `to` owner?
        uint256 instant,
        address indexed currency,
        uint256 escrowed,
        uint256 timestamp, // Question Do these events need timestamps?
        uint256 moduleFee,
        INotaModule module,
        bytes moduleData
    );
    event Transferred(  // TODO does this need `from` since ERC721 already has it?
        uint256 indexed tokenId,
        address indexed from,
        address indexed to,
        uint256 moduleFee,
        bytes fundData,
        uint256 timestamp
    ); // TODO needs moduleBytes
    event Funded(
        address indexed funder,
        uint256 indexed notaId,
        uint256 amount,
        uint256 instant,
        bytes indexed fundData,
        uint256 moduleFee,
        uint256 timestamp
    );
    event Cashed(
        address indexed casher,
        uint256 indexed notaId,
        address to,
        uint256 amount,
        bytes indexed cashData,
        uint256 moduleFee,
        uint256 timestamp
    );

    error SendFailed();
    error SelfApproval();
    error NonExistent();
    error InvalidWrite(INotaModule, address);
    error InsufficientValue(uint256, uint256);
    error InsufficientEscrow(uint256, uint256);

    function write(
        address currency,
        uint256 escrowed,
        uint256 instant,
        address owner,
        INotaModule module,
        bytes calldata moduleWriteData
    ) external payable returns (uint256);

    // function safeWrite(
    //     address currency,
    //     uint256 escrowed,
    //     uint256 instant,
    //     address owner,
    //     address module,
    //     bytes calldata moduleWriteData
    // ) external payable returns (uint256);

    function transferFrom(address from, address to, uint256 tokenId) external;

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory moduleTransferData
    ) external;

    function fund(
        uint256 notaId,
        uint256 amount,
        uint256 instant,
        bytes calldata fundData
    ) external payable;

    function cash(
        uint256 notaId,
        uint256 amount,
        address to,
        bytes calldata cashData
    ) external payable;

    function approve(address to, uint256 tokenId) external;

    function notaInfo(
        uint256 notaId
    ) external view returns (Nota memory);
    
    function notaCurrency(uint256 notaId) external view returns (address);

    function notaEscrowed(uint256 notaId) external view returns (uint256);

    function notaModule(uint256 notaId) external view returns (INotaModule);

    function moduleWithdraw(
        address token,
        uint256 amount,
        address payoutAccount
    ) external;

    function moduleRevenue(INotaModule module, address currency) external view returns(uint256);
}

// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

interface IRegistrarGov {
    event ModuleWhitelisted(
        address indexed user,
        INotaModule indexed module,
        bool isAccepted,
        uint256 timestamp
    );

    event TokenWhitelisted(
        address caller,
        address indexed token,
        bool indexed accepted,
        uint256 timestamp
    );
    
    function moduleWhitelisted(INotaModule module) external view returns (bool);

    function tokenWhitelisted(address token) external view returns (bool);
}

// TODO setting contractURI makes tests hand for some reason
contract RegistrarGov is Ownable, IRegistrarGov {
    using SafeERC20 for IERC20;

    mapping(bytes32 module => bool isWhitelisted) internal _codeHashWhitelist;  // Could combine the two whitelists into one `address => bool`
    string internal _contractURI;

    event ContractURIUpdated();

    function setContractURI(string calldata uri) external onlyOwner {
        _contractURI = uri;
        emit ContractURIUpdated();
    }

    function whitelistModule(INotaModule module, bool isWhitelisted) external onlyOwner {
        bytes32 codeHash;
        assembly { codeHash := extcodehash(module) }

        require(_codeHashWhitelist[codeHash] != isWhitelisted, "REDUNDANT_WHITELIST");
        _codeHashWhitelist[codeHash] = isWhitelisted;

        emit ModuleWhitelisted(_msgSender(), module, isWhitelisted, block.timestamp);
    }

    function whitelistToken(address token, bool isWhitelisted) external onlyOwner {
        bytes32 codeHash;
        assembly { codeHash := extcodehash(token) }

        require(_codeHashWhitelist[codeHash] != isWhitelisted, "REDUNDANT_WHITELIST");

        _codeHashWhitelist[codeHash] = isWhitelisted;

        emit TokenWhitelisted(_msgSender(), token, isWhitelisted, block.timestamp);
    }

    function tokenWhitelisted(address token) public view returns (bool) {
        bytes32 codeHash;
        assembly { codeHash := extcodehash(token) }
        return _codeHashWhitelist[codeHash];
    }

    function moduleWhitelisted(INotaModule module) public view returns (bool) {
        bytes32 codeHash;
        assembly { codeHash := extcodehash(module) }
        return _codeHashWhitelist[codeHash];
    }

    function validWrite(
        INotaModule module,
        address token
    ) public view returns (bool) {
        return moduleWhitelisted(module) && tokenWhitelisted(token);
    }

}

 /// @title EIP-721 Metadata Update Extension
interface IERC4906 is IERC165, IERC721 {
    /// @dev This event emits when the metadata of a token is changed.
    /// So that the third-party platforms such as NFT market could
    /// timely update the images and related attributes of the NFT.
    event MetadataUpdate(uint256 _tokenId);

    /// @dev This event emits when the metadata of a range of tokens is changed.
    /// So that the third-party platforms such as NFT market could
    /// timely update the images and related attributes of the NFTs.    
    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}
contract ERC4906 is ERC721, IERC4906 {

    constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) {
    }

    /// @dev See {IERC165-supportsInterface}.
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
    }
}

/**
 * DISCLAIMER OF LIABILITY
 * =======================
 * Denota Protocol is provided "as is", without warranty of any kind. Use at your own risk.
 * The author(s) of this smart contract and Denota Protocol shall not be liable for any damages or losses caused by the use or inability to use this protocol.
 * This protocol has NOT undergone a formal security audit. As such, there may be risks of vulnerabilities or bugs that could lead to financial loss. 
 * Users are advised to carefully assess their risk tolerance and only interact with this protocol if they understand and accept these risks.
 * This protocol is experimental and should not be considered as a fully secure or reliable financial service. 
 * We strongly recommend reviewing the source code and conducting thorough testing before committing any value or conducting transactions through this protocol.
 * =======================
 * @title Denota Protocol
 * @author Almaraz.eth
 * @custom:description Denota Protocol (beta)- a token agreement protocol.
 * The core primitive is the Nota, an NFT that represents the ownership of underlying assets and issued by the NotaRegistrar.
 * Each Nota can escrow ERC20s and references a module which enforces the rules of both the Nota's ownership and it's escrowed funds.
 * 
 * HOW TO USE:
 * The main relevant functions for most Notas will be WTFCAT or Write (mint), Transfer, Fund, Cash, Approve, and TokenURI.
 * Writing a Nota requires approval of: your tokens so they can be escrowed, and both module and tokens you wish to use 
 * * NOTE The `moduleBytes` parameter are special arguments needed from the module being referenced. Please refer to the module for what (if any) bytes argument format it is expecting and use an abi.encode website to assist.
 * Whitelisting of modules and tokens is controlled by the deployer (me, for now) but only apply when creating new Notas. It's permissioned for safety purposes and is the only thing the NotaRegistrar's owner controls.
 * Notas are compatible with NFT marketplaces, and provide detailed and trustable metadata for display.
 * HOW TO PROFIT:
 * Each module can charge a fee every time a Nota that references it is used. Registering your account to a module allows you to collect the fees the module generates
 */

contract NotaRegistrar is ERC4906, INotaRegistrar, RegistrarGov {
    using SafeERC20 for IERC20;
    
    mapping(INotaModule module => mapping(address token => uint256 revenue)) private _moduleRevenue;
    mapping(uint256 notaId => Nota) private _notas;
    uint256 public totalSupply;

    modifier exists(uint256 notaId) {
        if (_ownerOf(notaId) == address(0)) revert NonExistent();
        _;
    }

    constructor(address newOwner) ERC4906("Denota Protocol (beta)", "NOTA") {
        transferOwnership(newOwner);  // Needed when using create2
    }

    /**
     * @notice Mints a Nota and transfers tokens
     * @dev Requires module & currency whitelisted and `owner` != address(0). Transfers instant/escrow tokens from msg.sender, sends instant tokens to `owner`
     */
    function write(address currency, uint256 escrowed, uint256 instant, address owner, INotaModule module, bytes calldata moduleBytes) public payable returns (uint256) {
        require(validWrite(module, currency), "INVALID_WRITE");
        uint256 moduleFee = module.processWrite(msg.sender, owner, totalSupply, currency, escrowed, instant, moduleBytes);

        _transferTokens(currency, owner, escrowed, instant, moduleFee);
        _mint(owner, totalSupply);
        _notas[totalSupply] = Nota(escrowed, currency, module);
        
        _moduleRevenue[module][currency] += moduleFee;

        emit Written(msg.sender, totalSupply, owner, instant, currency, escrowed, block.timestamp, moduleFee, module, moduleBytes);
        unchecked { return totalSupply++; }
    }

    /**
     * @dev Enforces the transfer requirements (isApprovedOrOwner) before transferHook is called
     */
    function transferFrom(address from, address to, uint256 notaId) public override(ERC721, IERC721, INotaRegistrar) exists(notaId) {
        _transferHookTakeFee(from, to, notaId, abi.encode(""));
        _transfer(from, to, notaId);
        emit MetadataUpdate(notaId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 notaId,
        bytes memory moduleBytes
    ) public override(ERC721, IERC721, INotaRegistrar) {
        _transferHookTakeFee(from, to, notaId, moduleBytes);
        _safeTransfer(from, to, notaId, abi.encode(""));
        emit MetadataUpdate(notaId);
    }

    /**
     * @notice Adds to the escrowed amount of a Nota
     * @dev No requirements except what the module enforces
     */
    function fund(uint256 notaId, uint256 amount, uint256 instant, bytes calldata moduleBytes) public payable exists(notaId) {
        Nota memory nota = notaInfo(notaId);
        address notaOwner = ownerOf(notaId);
        uint256 moduleFee = nota.module.processFund(msg.sender, notaOwner, amount, instant, notaId, nota, moduleBytes);

        _transferTokens(nota.currency, notaOwner, amount, instant, moduleFee);
        _notas[notaId].escrowed += amount;
        _moduleRevenue[nota.module][nota.currency] += moduleFee;

        emit Funded(msg.sender, notaId, amount, instant, moduleBytes, moduleFee, block.timestamp);
        emit MetadataUpdate(notaId);
    }

    /**
     * @notice Removes from the escrowed amount of a Nota
     * @dev No requirements except what the module enforces
     */
    function cash(uint256 notaId, uint256 amount, address to, bytes calldata moduleBytes) public payable exists(notaId) {
        Nota memory nota = notaInfo(notaId);
        uint256 moduleFee = nota.module.processCash(msg.sender, ownerOf(notaId), to, amount, notaId, nota, moduleBytes);

        _notas[notaId].escrowed -= amount;
        _unescrowTokens(nota.currency, to, amount - moduleFee);  // moduleFee stays in escrow. Should amount include the moduleFee or have it removed on after?
        _moduleRevenue[nota.module][nota.currency] += moduleFee;

        emit Cashed(msg.sender, notaId, to, amount, moduleBytes, moduleFee, block.timestamp);
        emit MetadataUpdate(notaId);
    }

    function approve(address to, uint256 notaId) public override(ERC721, IERC721, INotaRegistrar) exists(notaId) {
        Nota memory nota = notaInfo(notaId);
        nota.module.processApproval(msg.sender, ownerOf(notaId), to, notaId, nota);

        ERC721.approve(to, notaId);  // Keeps checks is owner or operator && to != owner
        emit MetadataUpdate(notaId);
    }

    function tokenURI(uint256 notaId) public view override exists(notaId) returns (string memory) {
        Nota memory nota = notaInfo(notaId);
        (string memory moduleAttributes, string memory moduleKeys) = nota.module.processTokenURI(notaId);
        
        return string(
                abi.encodePacked(
                    "data:application/json;base64,", 
                    Base64.encode(
                        bytes(
                            abi.encodePacked(
                                '{"attributes":[{"trait_type":"Currency","value":"',
                                Strings.toHexString(nota.currency),
                                '"},{"trait_type":"Escrowed","display_type":"number","value":',
                                Strings.toString(nota.escrowed),
                                '},{"trait_type":"Module","value":"',
                                Strings.toHexString(address(nota.module)),
                                '"}',
                                moduleAttributes,  // of form: ',{"trait_type":"<trait>","value":"<value>"}'
                                ']',
                                moduleKeys, // of form: ',{"<key>":"<value>"}
                                '}'
                            )
                        )
                    )
                )
            );
    }

    function contractURI() public view returns (string memory) {
        return string.concat("data:application/json;utf8,", _contractURI);
    }

    /*//////////////////////// HELPERS ///////////////////////////*/
    function _transferHookTakeFee(
        address from,
        address to,
        uint256 notaId,
        bytes memory moduleBytes
    ) private {
        require(_isApprovedOrOwner(msg.sender, notaId), "NOT_APPROVED_OR_OWNER");

        if (moduleBytes.length == 0) moduleBytes = abi.encode("");
        Nota memory nota = notaInfo(notaId);
        address owner = ownerOf(notaId);
        uint256 moduleFee = nota.module.processTransfer(msg.sender, getApproved(notaId), owner, from, to, notaId, nota, moduleBytes);

        _notas[notaId].escrowed -= moduleFee;
        _moduleRevenue[nota.module][nota.currency] += moduleFee;  // NOTE could do this unchecked
        emit Transferred(notaId, owner, to, moduleFee, moduleBytes, block.timestamp);
    }

    function _instantTokens(address currency, address to, uint256 instant) private {
        if (instant > 0) IERC20(currency).safeTransferFrom(msg.sender, to, instant);
    }
    function _escrowTokens(address currency, uint256 toEscrow) private {
        if (toEscrow > 0) IERC20(currency).safeTransferFrom(msg.sender, address(this), toEscrow);
    }
    function _unescrowTokens(address currency, address to, uint256 amount) private {
        if (amount > 0) IERC20(currency).safeTransfer(to, amount);
    }
    function _transferTokens(
        address currency,
        address recipient,
        uint256 escrowed,
        uint256 instant,
        uint256 moduleFee
    ) private {
        uint256 toEscrow = escrowed + moduleFee;
        _escrowTokens(currency, toEscrow);
        _instantTokens(currency, recipient, instant);
    }

    /**
     * @notice Updates the metadata of a Nota when module state changes without calling the registrar
     */
    function metadataUpdate(uint256 notaId) external {
        require(msg.sender == address(_notas[notaId].module), "NOT_MODULE");
        emit MetadataUpdate(notaId);
    }

    function moduleWithdraw(address token, uint256 amount, address to) external {
        _moduleRevenue[INotaModule(msg.sender)][token] -= amount;  // reverts on underflow
        _unescrowTokens(token, to, amount);
    }

    function moduleRevenue(INotaModule module, address currency) external view returns(uint256) {
        return _moduleRevenue[module][currency];
    }

    function notaInfo(
        uint256 notaId
    ) public view exists(notaId) returns (Nota memory) {
        return _notas[notaId];
    }

    function notaEscrowed(uint256 notaId) public view exists(notaId) returns (uint256) {
        return _notas[notaId].escrowed;
    }

    function notaCurrency(uint256 notaId) public view exists(notaId) returns (address) {
        return _notas[notaId].currency;
    }

    function notaModule(uint256 notaId) public view exists(notaId) returns (INotaModule) {
        return _notas[notaId].module;
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "axelarnetwork/=lib/axelar-gmp-sdk-solidity/contracts/",
    "axelar-gmp-sdk-solidity/=lib/axelar-gmp-sdk-solidity/contracts/",
    "era-contracts/=lib/foundry-zksync-era/lib/era-contracts/",
    "era-system-contracts/=lib/foundry-zksync-era/lib/era-system-contracts/",
    "foundry-zksync-era/=lib/foundry-zksync-era/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solidity-stringutils/=lib/foundry-zksync-era/lib/solidity-stringutils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"InsufficientEscrow","type":"error"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"InsufficientValue","type":"error"},{"inputs":[{"internalType":"contract INotaModule","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"InvalidWrite","type":"error"},{"inputs":[],"name":"NonExistent","type":"error"},{"inputs":[],"name":"SelfApproval","type":"error"},{"inputs":[],"name":"SendFailed","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":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"casher","type":"address"},{"indexed":true,"internalType":"uint256","name":"notaId","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"cashData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"moduleFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Cashed","type":"event"},{"anonymous":false,"inputs":[],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"funder","type":"address"},{"indexed":true,"internalType":"uint256","name":"notaId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"instant","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"fundData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"moduleFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Funded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"contract INotaModule","name":"module","type":"address"},{"indexed":false,"internalType":"bool","name":"isAccepted","type":"bool"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ModuleWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"bool","name":"accepted","type":"bool"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"TokenWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"moduleFee","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"fundData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Transferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"notaId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"instant","type":"uint256"},{"indexed":true,"internalType":"address","name":"currency","type":"address"},{"indexed":false,"internalType":"uint256","name":"escrowed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"moduleFee","type":"uint256"},{"indexed":false,"internalType":"contract INotaModule","name":"module","type":"address"},{"indexed":false,"internalType":"bytes","name":"moduleData","type":"bytes"}],"name":"Written","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"notaId","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":"uint256","name":"notaId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"moduleBytes","type":"bytes"}],"name":"cash","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"notaId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"instant","type":"uint256"},{"internalType":"bytes","name":"moduleBytes","type":"bytes"}],"name":"fund","outputs":[],"stateMutability":"payable","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":"uint256","name":"notaId","type":"uint256"}],"name":"metadataUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INotaModule","name":"module","type":"address"},{"internalType":"address","name":"currency","type":"address"}],"name":"moduleRevenue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract INotaModule","name":"module","type":"address"}],"name":"moduleWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"moduleWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"notaId","type":"uint256"}],"name":"notaCurrency","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"notaId","type":"uint256"}],"name":"notaEscrowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"notaId","type":"uint256"}],"name":"notaInfo","outputs":[{"components":[{"internalType":"uint256","name":"escrowed","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"contract INotaModule","name":"module","type":"address"}],"internalType":"struct Nota","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"notaId","type":"uint256"}],"name":"notaModule","outputs":[{"internalType":"contract INotaModule","name":"","type":"address"}],"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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"notaId","type":"uint256"},{"internalType":"bytes","name":"moduleBytes","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":"string","name":"uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"uint256","name":"notaId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"tokenWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"notaId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INotaModule","name":"module","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"validWrite","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract INotaModule","name":"module","type":"address"},{"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"whitelistModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"whitelistToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"escrowed","type":"uint256"},{"internalType":"uint256","name":"instant","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"contract INotaModule","name":"module","type":"address"},{"internalType":"bytes","name":"moduleBytes","type":"bytes"}],"name":"write","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"}]

6080346200042a57601f90601f19906001600160401b03620045053881900385810185168401838111858210176200042f578492829160405283396020938491810103126200042a5751936001600160a01b03808616929091908387036200042a576200006b62000445565b91601683527f44656e6f74612050726f746f636f6c2028626574612900000000000000000000868401526200009f62000445565b600497888252634e4f544160e01b8883015284519084821162000415576000918254966001978881811c911680156200040a575b8c821014620003f757908b8288859411620003a1575b50508b908783116001146200033e57859262000332575b5050600019600383901b1c191690871b1782555b82519485116200031f5785548681811c9116801562000314575b8a8210146200030157908185879695949311620002a8575b5089938511600114620002475750926200023b575b5050600019600383901b1c191690821b1790555b6200017a3362000465565b33906006541603620001f95715620001a757620001978362000465565b6040516140569081620004af8239f35b60405162461bcd60e51b815291820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260849150fd5b60648383806040519262461bcd60e51b845283015260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b0151905038806200015b565b86959392919316858452898420935b8a82821062000291575050841162000277575b505050811b0190556200016f565b015160001960f88460031b161c1916905538808062000269565b838501518655889790950194938401930162000256565b9091929394508683528983208580880160051c8201928c8910620002f7575b9188978a9297969594930160051c01915b828110620002e857505062000146565b848155889750899101620002d8565b92508192620002c7565b634e487b7160e01b835260228b52602483fd5b90607f16906200012e565b634e487b7160e01b825260418a52602482fd5b01519050388062000100565b908c91858b95168780528388209388905b8282106200038957505084116200036f575b505050811b01825562000114565b015160001960f88460031b161c1916905538808062000361565b8385015186558d979095019493840193018f6200034f565b90919250858052878287209181860160051c8301938610620003ed575b918b91869594930160051c01915b828110620003de57508d9150620000e9565b8781558594508b9101620003cc565b92508192620003be565b634e487b7160e01b855260228d52602485fd5b90607f1690620000d3565b60418a634e487b7160e01b6000525260246000fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b60408051919082016001600160401b038111838210176200042f57604052565b600680546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a356fe608080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a7146129ec5750806306fdde031461292a578063081812fc146128ed578063095ea7b31461255e5780630ffb1d8b1461246457806313e94a23146123ec57806318160ddd146123b057806323b872dd1461231757806342842e0e146122ef5780634e289c0614611f8557806352f37f5614611f485780636352211e14611eed5780636a1c34fb14611e0257806370a0823114611d14578063715018a614611c7557806378f513e814611b9a5780638da5cb5b14611b48578063938e3d7b1461190857806395d89b41146117fd5780639ba853ef14611785578063a22cb4651461164b578063b1d70e42146115d0578063b88d4fde14611524578063c3f8450b1461142c578063c73553da146113bb578063c87b56dd14610e18578063d0d0bb3f14610977578063d6122058146105ed578063d6a4f84c14610562578063dfd5d81114610517578063e8a3d485146103ac578063e985e9c51461032c578063f2fde38b146101f55763ff8507e81461019757600080fd5b346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760206101e86101d3612b74565b3f600052600760205260ff6040600020541690565b6040519015158152f35b80fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25761022d612b74565b610235612ea2565b73ffffffffffffffffffffffffffffffffffffffff8091169081156102a857600654827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600655167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257610364612b74565b604061036e612bba565b9273ffffffffffffffffffffffffffffffffffffffff80931681526005602052209116600052602052602060ff604060002054166040519015158152f35b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257604051906020907f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c00000000008284015282816008549261041684612df3565b936001908181169081156104d55750600114610478575b50506104609250037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101845283612ce1565b610474604051928284938452830190612b31565b0390f35b90915060088252847ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee35b8584106104bd5750505050603b61046092820101388061042d565b8054888501603b0152879450920191859082016104a2565b9050603b93506104609592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff009150168284015280151502820101388061042d565b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760206101e8610554612b74565b61055c612bba565b90612f86565b50346101f25760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576105ea61059d612b74565b602435906105a9612b97565b9033855260096020526040852073ffffffffffffffffffffffffffffffffffffffff821660005260205260406000206105e38482546134fe565b9055613ca7565b80f35b5060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760643567ffffffffffffffff811161097357610638903690600401612c4c565b6004358352600260205273ffffffffffffffffffffffffffffffffffffffff604084205416156109495761066a614001565b50600435600052600260205273ffffffffffffffffffffffffffffffffffffffff604060002054161561094957600435600052600a60205260406000209173ffffffffffffffffffffffffffffffffffffffff6002604051946106cc86612c7a565b8054865282600182015416602087015201541660408401526106ef600435612dc1565b9273ffffffffffffffffffffffffffffffffffffffff60408201511693602060405180967f67f9f4f500000000000000000000000000000000000000000000000000000000825233600483015273ffffffffffffffffffffffffffffffffffffffff841660248301526024356044830152604435606483015260043560848301526107aa60a4830186604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565b6101206101048301528189816107c561012482018b8b612fb4565b03925af194851561093e578695610903575b508461080591604435906024359073ffffffffffffffffffffffffffffffffffffffff602087015116613f20565b6004358552600a602052604085206108206024358254612ff3565b905573ffffffffffffffffffffffffffffffffffffffff6040820151168552600960205273ffffffffffffffffffffffffffffffffffffffff602060408720920151166000526020526040600020610879848254612ff3565b90558160405192839283378101600081520390209060405190602435825260443560208301526040820152426060820152600435907f7f98326a87b2d74aaf7e1400dd387fab5570936bacf98cb672c19ddfbb061a4460803392a47ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce760206040516004358152a180f35b9094506020813d602011610936575b8161091f60209383612ce1565b810103126109315751936108056107d7565b600080fd5b3d9150610912565b6040513d88823e3d90fd5b60046040517f2f9d01c5000000000000000000000000000000000000000000000000000000008152fd5b5080fd5b5060c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576109aa612b74565b9060643560443573ffffffffffffffffffffffffffffffffffffffff82168203610931576084359273ffffffffffffffffffffffffffffffffffffffff841684036109315760a43567ffffffffffffffff811161097357610a0f903690600401612c4c565b919092610a1c8787612f86565b15610dba57600b54604051907fb5d701ba00000000000000000000000000000000000000000000000000000000825233600483015273ffffffffffffffffffffffffffffffffffffffff87166024830152604482015273ffffffffffffffffffffffffffffffffffffffff8816606482015260243560848201528160a482015260e060c482015260208180610ab560e48201888a612fb4565b03818673ffffffffffffffffffffffffffffffffffffffff8c165af1908115610daf578391610d7d575b50610aef8183602435898c613f20565b600b549773ffffffffffffffffffffffffffffffffffffffff871615610d1f57610b3c89600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416151590565b610cc15773ffffffffffffffffffffffffffffffffffffffff80610caf9260407f991ba5df3fcbd98c4683aa26b630563680205eed21cda3b688c3b885dd969c81978c60209e8560028f8281168652602060039052868620600181540190558386526020829052868620937fffffffffffffffffffffffff000000000000000000000000000000000000000094848316868254161790558388519216877fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4610c0681612c7a565b60243581526020810183891681528388830196168652600b5487526020600a9052878720915182558360018301915116858254161790550192511690825416179055838d16815260098e52208282166000528c526040600020610c6a868254612ff3565b905581600b549b8c9660405198899889528f890152602435604089015242606089015260808801521660a086015260e060c086015216971695339560e0840191612fb4565b0390a460018101600b55604051908152f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152fd5b90506020813d602011610da7575b81610d9860209383612ce1565b81010312610931575138610adf565b3d9150610d8b565b6040513d85823e3d90fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f494e56414c49445f5752495445000000000000000000000000000000000000006044820152fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760043590818152600260205273ffffffffffffffffffffffffffffffffffffffff6040822054161561094957610e7c614001565b5081600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416156109495781600052600a602052604060002060405192610ec284612c7a565b815484526001938373ffffffffffffffffffffffffffffffffffffffff60028188870154169560208501968752015416928360408401526024604051809581937f4fe17e1a00000000000000000000000000000000000000000000000000000000835260048301525afa9283156113b05784928594611331575b5073ffffffffffffffffffffffffffffffffffffffff610f5d91511661359c565b8151909560218682847a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008082101561131f575b50600a906d04ee2d6d415b85acef810000000080821015611312575b50662386f26fc1000080821015611305575b506305f5e100808210156112f8575b50612710808210156112eb575b5060648110156112dd575b10156112d6575b93929190610ff683820161354d565b9850880101905b611274575b61047461120d8861120860b38c8b8b61103473ffffffffffffffffffffffffffffffffffffffff60408e01511661359c565b6040519687947f7b2261747472696275746573223a5b7b2274726169745f74797065223a22437560208701527f7272656e6379222c2276616c7565223a22000000000000000000000000000000604087015261109a81518092602060518a019101612b0e565b85017f227d2c7b2274726169745f74797065223a22457363726f776564222c2264697360518201527f706c61795f74797065223a226e756d626572222c2276616c7565223a0000000060718201526110fc825180936020608d85019101612b0e565b017f7d2c7b2274726169745f74797065223a224d6f64756c65222c2276616c756522608d8201527f3a2200000000000000000000000000000000000000000000000000000000000060ad82015261115d82518093602060af85019101612b0e565b017f227d00000000000000000000000000000000000000000000000000000000000060af82015261119882518093602060b185019101612b0e565b017f5d0000000000000000000000000000000000000000000000000000000000000060b18201526111d382518093602060b285019101612b0e565b017f7d0000000000000000000000000000000000000000000000000000000000000060b2820152036093810184520182612ce1565b61375c565b611260603d60405180937f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000060208301526112508151809260208686019101612b0e565b810103601d810184520182612ce1565b604051918291602083526020830190612b31565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600a9101917f30313233343536373839616263646566000000000000000000000000000000008282061a8353049182156112d157919082610ffd565b611002565b0182610fe7565b606460029104930192610fe0565b6004910493019238610fd5565b6008910493019238610fc8565b6010910493019238610fb9565b6020910493019238610fa7565b92505050830482600a60409290610f8b565b925092503d8085843e6113448184612ce1565b82016040838203126113ac57825167ffffffffffffffff908181116113a8578261136f91860161350b565b9360208101519182116113a857610f5d9273ffffffffffffffffffffffffffffffffffffffff926113a0920161350b565b949150610f3c565b8680fd5b8480fd5b6040513d86823e3d90fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257600435808252600260205273ffffffffffffffffffffffffffffffffffffffff60408320541615610949578160409160209352600a83522054604051908152f35b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611464612b74565b73ffffffffffffffffffffffffffffffffffffffff611481612bdd565b9161148a612ea2565b6114ed813f93848652600760205260ff604087205416946114b2821515809715151415612f21565b86526007602052604086209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b60405192835242602084015216907f782c39691e7343e20d628434c28903c45c4fc7749813fd9d6e7ec17adf32dbe960403392a380f35b50346101f25760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25761155c612b74565b611564612bba565b906064359067ffffffffffffffff82116115cc57366023830112156115cc578160040135928461159385612d22565b936115a16040519586612ce1565b858552366024878301011161097357856105ea96602460209301838801378501015260443591613219565b8380fd5b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611608612b74565b6040611612612bba565b9273ffffffffffffffffffffffffffffffffffffffff809316815260096020522091166000526020526020604060002054604051908152f35b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611683612b74565b73ffffffffffffffffffffffffffffffffffffffff6116a0612bdd565b91169081331461172757338352600560205260408320826000526020526116f68160406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b60405190151581527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760043590818152600260205273ffffffffffffffffffffffffffffffffffffffff9081604082205416156109495760408160209460029352600a855220015416604051908152f35b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576040519080600180549161183f83612df3565b808652928281169081156118c05750600114611866575b6104748561126081870382612ce1565b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b8284106118a857505050810160200161126082610474611856565b8054602085870181019190915290930192810161188d565b869550610474969350602092506112609491507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001682840152151560051b8201019293611856565b50346101f257602090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25767ffffffffffffffff600435818111611b445761195b903690600401612c4c565b91611964612ea2565b8211611b1757611975600854612df3565b601f8111611ab9575b508293601f83116001146119fd57509282938293926119f2575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c1916176008555b7fa5d4097edda6d87cb9329af83fb3712ef77eeb13738ffe43cc35a4ce305ad9628180a180f35b013590503880611998565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08316947ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee39285905b878210611aa1575050836001959610611a69575b505050811b016008556119cb565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88560031b161c19910135169055388080611a5b565b80600184968294958701358155019501920190611a47565b7ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3601f840160051c810191868510611b0d575b601f0160051c01905b818110611b02575061197e565b848155600101611af5565b9091508190611aec565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b8280fd5b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257602073ffffffffffffffffffffffffffffffffffffffff60065416604051908152f35b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257600435611bd5614001565b5080600052600260205273ffffffffffffffffffffffffffffffffffffffff80604060002054161561094957606091600052600a602052604060002090600260405192611c2184612c7a565b805484528260018201541660208501520154166040820152611c736040518092604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565bf35b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611cac612ea2565b600073ffffffffffffffffffffffffffffffffffffffff6006547fffffffffffffffffffffffff00000000000000000000000000000000000000008116600655167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25773ffffffffffffffffffffffffffffffffffffffff611d61612b74565b168015611d7e578160409160209352600383522054604051908152f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257600435808252600a60205273ffffffffffffffffffffffffffffffffffffffff6002604084200154163303611e8f5760207ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce791604051908152a180f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f4e4f545f4d4f44554c45000000000000000000000000000000000000000000006044820152fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576020611f2a600435612dc1565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760206101e86101d3612b74565b5060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611fb8612b97565b60643567ffffffffffffffff8111611b4457611fd8903690600401612c4c565b6004929192358452600260205273ffffffffffffffffffffffffffffffffffffffff604085205416156109495761200d614001565b50600435600052600260205273ffffffffffffffffffffffffffffffffffffffff604060002054161561094957600435600052600a60205260406000209073ffffffffffffffffffffffffffffffffffffffff60026040519361206f85612c7a565b80548552826001820154166020860152015416936040830192858452612096600435612dc1565b9373ffffffffffffffffffffffffffffffffffffffff604051957f747729d100000000000000000000000000000000000000000000000000000000875233600488015216602486015273ffffffffffffffffffffffffffffffffffffffff8616604486015260208560243598896064830152600435608483015261214a60a4830186604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565b610120610104830152818b8161216561012482018b8b612fb4565b03925af19485156122e457889561229c575b5073ffffffffffffffffffffffffffffffffffffffff906004358952600a602052604089206121a78982546134fe565b90556121c482602085015116886121be898c6134fe565b91613ca7565b51168752600960205273ffffffffffffffffffffffffffffffffffffffff602060408920920151166000526020526040600020612202848254612ff3565b90558160405192839283378101600081520390209273ffffffffffffffffffffffffffffffffffffffff6040519316835260208301526040820152426060820152600435907fa45d21a235efa64e1d8f22fcecdbc348471bf46c3fd95cb0b3d78bb59ccfdd8e60803392a47ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce760206040516004358152a180f35b9094506020813d6020116122dc575b816122b860209383612ce1565b8101031261093157519373ffffffffffffffffffffffffffffffffffffffff612177565b3d91506122ab565b6040513d8a823e3d90fd5b50346101f2576105ea61230136612bec565b906040519261230f84612cc5565b858452613219565b50346101f25761232636612bec565b808493929352600260205273ffffffffffffffffffffffffffffffffffffffff60408520541615610949576123a6817ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce7946020946123a16040518780820152600060408201526040815261239981612c7a565b848484613914565b61302f565b604051908152a180f35b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576020600b54604051908152f35b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760043590818152600260205273ffffffffffffffffffffffffffffffffffffffff9081604082205416156109495760408160209460019352600a855220015416604051908152f35b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25761249c612b74565b6124a4612bdd565b906124ad612ea2565b612510813f92838552600760205260ff604086205416936124d5821515809615151415612f21565b85526007602052604085209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b6040805133815242602082015273ffffffffffffffffffffffffffffffffffffffff92909216917f1bf5ef6ada443138fcac941f79625fe01e92ff514fee9f160bff18363199c7a09190a380f35b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257612596612b74565b90602435918282526020906002825273ffffffffffffffffffffffffffffffffffffffff938460408520541615610949576125cf614001565b5080845260028352846040852054161561094957808452600a83526040842091856002604051946125ff86612c7a565b80548652826001820154168787015201541680604085015261262083612dc1565b90803b156113a85760e48792838a936126af8560405198899788967f300826d600000000000000000000000000000000000000000000000000000000885233600489015216602487015216998a60448601528960648601526084850190604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565b5af180156128e257612899575b50846126c782612dc1565b16808314612815578033149081156127f4575b501561277057808495817ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce796526004855260408720847fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905561274082612dc1565b1692604051937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258880a48152a180f35b608483604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152fd5b90508452600583526040842033600052835260ff60406000205416386126da565b608484604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152fd5b67ffffffffffffffff81959295116128b55760405292386126bc565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6040513d87823e3d90fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576020611f2a600435612e46565b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576040519080805461296981612df3565b808552916001918083169081156118c05750600114612992576104748561126081870382612ce1565b80809450527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b8284106129d457505050810160200161126082610474611856565b805460208587018101919091529093019281016129b9565b9050346109735760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610973576004357fffffffff000000000000000000000000000000000000000000000000000000008116809103611b4457602092507f49064906000000000000000000000000000000000000000000000000000000008114908115612a80575b5015158152f35b7f80ac58cd00000000000000000000000000000000000000000000000000000000811491508115612ae4575b8115612aba575b5038612a79565b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501438612ab3565b7f5b5e139f0000000000000000000000000000000000000000000000000000000081149150612aac565b60005b838110612b215750506000910152565b8181015183820152602001612b11565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093612b6d81518092818752878088019101612b0e565b0116010190565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361093157565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361093157565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361093157565b60243590811515820361093157565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60609101126109315773ffffffffffffffffffffffffffffffffffffffff90600435828116810361093157916024359081168103610931579060443590565b9181601f840112156109315782359167ffffffffffffffff8311610931576020838186019501011161093157565b6060810190811067ffffffffffffffff821117612c9657604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff821117612c9657604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612c9657604052565b67ffffffffffffffff8111612c9657601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b15612d6357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152fd5b600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416612df0811515612d5c565b90565b90600182811c92168015612e3c575b6020831014612e0d57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691612e02565b612e7b612e7682600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416151590565b612d5c565b600052600460205273ffffffffffffffffffffffffffffffffffffffff6040600020541690565b73ffffffffffffffffffffffffffffffffffffffff600654163303612ec357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b15612f2857565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f524544554e44414e545f57484954454c495354000000000000000000000000006044820152fd5b3f600052600760205260ff604060002054169081612fa2575090565b90503f60005260ff6040600020541690565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b9190820180921161300057565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61303883612dc1565b73ffffffffffffffffffffffffffffffffffffffff918216929082168390036131955716908115613112577fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60008481526004602052604081207fffffffffffffffffffffffff0000000000000000000000000000000000000000908181541690558382526003602052604082207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81540190558482526040822060018154019055858252600260205284604083209182541617905580a4565b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152fd5b909161325a9261322c8295838386613914565b60405192602080850152600060408501526040845261324a84612c7a565b61325583838361302f565b613345565b1561328c5760207ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce791604051908152a1565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608490fd5b0390fd5b3d15613340573d9061332682612d22565b916133346040519384612ce1565b82523d6000602084013e565b606090565b919290803b156134f5576133bc9160209160405180809581947f150b7a0200000000000000000000000000000000000000000000000000000000998a845233600485015273ffffffffffffffffffffffffffffffffffffffff809a1660248501526044840152608060648401526084830190612b31565b03916000968791165af190829082613495575b505061346f576133dd613315565b8051908161346a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608490fd5b602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000161490565b909192506020813d82116134ed575b816134b160209383612ce1565b810103126109735751907fffffffff00000000000000000000000000000000000000000000000000000000821682036101f257509038806133cf565b3d91506134a4565b50505050600190565b9190820391821161300057565b81601f8201121561093157805161352181612d22565b9261352f6040519485612ce1565b8184526020828401011161093157612df09160208085019101612b0e565b9061355782612d22565b6135646040519182612ce1565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06135928294612d22565b0190602036910137565b73ffffffffffffffffffffffffffffffffffffffff16604051906135bf82612c7a565b602a8252602090818301604036823783511561372d5760309053825160019081101561372d57607860218501536029905b80821161365e575050613601575090565b606490604051907f08c379a000000000000000000000000000000000000000000000000000000000825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f811660108110156136ff5785518410156136ff577f3031323334353637383961626364656600000000000000000000000000000000901a84848701015360041c9180156136d1577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906135f0565b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8051156139005760405161376f81612c7a565b604081527f4142434445464748494a4b4c4d4e4f505152535455565758595a61626364656660208201527f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f604082015281516002928382018092116130005760038092047f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8116810361300057613809908594951b61354d565b936020850193829183518401925b8381106138af575050505051068060011461386057600214613837575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff603d91015390565b507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe81603d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81940153015390565b85600491979293949701918251600190603f9082828260121c16880101518453828282600c1c16880101518385015382828260061c1688010151888501531685010151878201530195929190613817565b5060405161390d81612cc5565b6000815290565b91909273ffffffffffffffffffffffffffffffffffffffff61393583612dc1565b16803314908115613c82575b508015613c5b575b15613bfd57805115613bda575b61395e614001565b5081600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416156109495781600052600a60205260406000209073ffffffffffffffffffffffffffffffffffffffff604051926139ba84612c7a565b80548452816002816001840154169260208701938452015416604085015260206139e386612dc1565b96838060408801511699816139f78a612e46565b936040519788957faca2caf3000000000000000000000000000000000000000000000000000000008752336004880152166024860152818c16604486015216606484015216988960848301528760a4830152613a8360c4830188604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565b61014061012483015281600081613a9e61014482018a612b31565b03925af1918215613bce57600092613b84575b5073ffffffffffffffffffffffffffffffffffffffff60407f5e3a637bdcd06ac50d3db8eb3575927de6c71cea82a0ee1f4d65026b7087e2e19587600052600a60205281600020613b038682546134fe565b9055015116600052600960205273ffffffffffffffffffffffffffffffffffffffff60406000209151166000526020526040600020613b43828254612ff3565b905573ffffffffffffffffffffffffffffffffffffffff613b766040519384938452606060208501526060840190612b31565b9542604084015216940390a4565b9391506020843d602011613bc6575b81613ba060209383612ce1565b81010312610931579251909273ffffffffffffffffffffffffffffffffffffffff613ab1565b3d9150613b93565b6040513d6000823e3d90fd5b506040516020808201526000604082015260408152613bf881612c7a565b613956565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e4f545f415050524f5645445f4f525f4f574e455200000000000000000000006044820152fd5b503373ffffffffffffffffffffffffffffffffffffffff613c7b84612e46565b1614613949565b9050600052600560205260406000203360005260205260ff6040600020541638613941565b919081613cb357505050565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff9182166024820152604480820193909352918252613d1a92613d14606484612ce1565b16613d1c565b565b73ffffffffffffffffffffffffffffffffffffffff1690604051604081019080821067ffffffffffffffff831117612c9657613d9c916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1613d96613315565b91613e54565b805180613daa575b50505050565b8184918101031261097357820151908115918215036101f25750613dd057808080613da4565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b91929015613ecf5750815115613e68575090565b3b15613e715790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015613ee25750805190602001fd5b613311906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190612b31565b93613f2b9192612ff3565b80613f5d575b5081613f3c57505050565b613d1a9273ffffffffffffffffffffffffffffffffffffffff339116613f85565b613f7f90303373ffffffffffffffffffffffffffffffffffffffff8716613f85565b38613f31565b9290604051927f23b872dd00000000000000000000000000000000000000000000000000000000602085015273ffffffffffffffffffffffffffffffffffffffff809216602485015216604483015260648201526064815260a081019181831067ffffffffffffffff841117612c9657613d1a92604052613d1c565b6040519061400e82612c7a565b6000604083828152826020820152015256fea264697066735822122065c470cf73b04bc20618fcd09d21a48e6b4047dd026bb09e1ba2a6f158ef2e9b64736f6c63430008140033000000000000000000000000167813e0d6958bcf30a1cebee53ae0c57677c963

Deployed Bytecode

0x608080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a7146129ec5750806306fdde031461292a578063081812fc146128ed578063095ea7b31461255e5780630ffb1d8b1461246457806313e94a23146123ec57806318160ddd146123b057806323b872dd1461231757806342842e0e146122ef5780634e289c0614611f8557806352f37f5614611f485780636352211e14611eed5780636a1c34fb14611e0257806370a0823114611d14578063715018a614611c7557806378f513e814611b9a5780638da5cb5b14611b48578063938e3d7b1461190857806395d89b41146117fd5780639ba853ef14611785578063a22cb4651461164b578063b1d70e42146115d0578063b88d4fde14611524578063c3f8450b1461142c578063c73553da146113bb578063c87b56dd14610e18578063d0d0bb3f14610977578063d6122058146105ed578063d6a4f84c14610562578063dfd5d81114610517578063e8a3d485146103ac578063e985e9c51461032c578063f2fde38b146101f55763ff8507e81461019757600080fd5b346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760206101e86101d3612b74565b3f600052600760205260ff6040600020541690565b6040519015158152f35b80fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25761022d612b74565b610235612ea2565b73ffffffffffffffffffffffffffffffffffffffff8091169081156102a857600654827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600655167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257610364612b74565b604061036e612bba565b9273ffffffffffffffffffffffffffffffffffffffff80931681526005602052209116600052602052602060ff604060002054166040519015158152f35b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257604051906020907f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c00000000008284015282816008549261041684612df3565b936001908181169081156104d55750600114610478575b50506104609250037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101845283612ce1565b610474604051928284938452830190612b31565b0390f35b90915060088252847ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee35b8584106104bd5750505050603b61046092820101388061042d565b8054888501603b0152879450920191859082016104a2565b9050603b93506104609592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff009150168284015280151502820101388061042d565b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760206101e8610554612b74565b61055c612bba565b90612f86565b50346101f25760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576105ea61059d612b74565b602435906105a9612b97565b9033855260096020526040852073ffffffffffffffffffffffffffffffffffffffff821660005260205260406000206105e38482546134fe565b9055613ca7565b80f35b5060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760643567ffffffffffffffff811161097357610638903690600401612c4c565b6004358352600260205273ffffffffffffffffffffffffffffffffffffffff604084205416156109495761066a614001565b50600435600052600260205273ffffffffffffffffffffffffffffffffffffffff604060002054161561094957600435600052600a60205260406000209173ffffffffffffffffffffffffffffffffffffffff6002604051946106cc86612c7a565b8054865282600182015416602087015201541660408401526106ef600435612dc1565b9273ffffffffffffffffffffffffffffffffffffffff60408201511693602060405180967f67f9f4f500000000000000000000000000000000000000000000000000000000825233600483015273ffffffffffffffffffffffffffffffffffffffff841660248301526024356044830152604435606483015260043560848301526107aa60a4830186604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565b6101206101048301528189816107c561012482018b8b612fb4565b03925af194851561093e578695610903575b508461080591604435906024359073ffffffffffffffffffffffffffffffffffffffff602087015116613f20565b6004358552600a602052604085206108206024358254612ff3565b905573ffffffffffffffffffffffffffffffffffffffff6040820151168552600960205273ffffffffffffffffffffffffffffffffffffffff602060408720920151166000526020526040600020610879848254612ff3565b90558160405192839283378101600081520390209060405190602435825260443560208301526040820152426060820152600435907f7f98326a87b2d74aaf7e1400dd387fab5570936bacf98cb672c19ddfbb061a4460803392a47ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce760206040516004358152a180f35b9094506020813d602011610936575b8161091f60209383612ce1565b810103126109315751936108056107d7565b600080fd5b3d9150610912565b6040513d88823e3d90fd5b60046040517f2f9d01c5000000000000000000000000000000000000000000000000000000008152fd5b5080fd5b5060c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576109aa612b74565b9060643560443573ffffffffffffffffffffffffffffffffffffffff82168203610931576084359273ffffffffffffffffffffffffffffffffffffffff841684036109315760a43567ffffffffffffffff811161097357610a0f903690600401612c4c565b919092610a1c8787612f86565b15610dba57600b54604051907fb5d701ba00000000000000000000000000000000000000000000000000000000825233600483015273ffffffffffffffffffffffffffffffffffffffff87166024830152604482015273ffffffffffffffffffffffffffffffffffffffff8816606482015260243560848201528160a482015260e060c482015260208180610ab560e48201888a612fb4565b03818673ffffffffffffffffffffffffffffffffffffffff8c165af1908115610daf578391610d7d575b50610aef8183602435898c613f20565b600b549773ffffffffffffffffffffffffffffffffffffffff871615610d1f57610b3c89600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416151590565b610cc15773ffffffffffffffffffffffffffffffffffffffff80610caf9260407f991ba5df3fcbd98c4683aa26b630563680205eed21cda3b688c3b885dd969c81978c60209e8560028f8281168652602060039052868620600181540190558386526020829052868620937fffffffffffffffffffffffff000000000000000000000000000000000000000094848316868254161790558388519216877fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4610c0681612c7a565b60243581526020810183891681528388830196168652600b5487526020600a9052878720915182558360018301915116858254161790550192511690825416179055838d16815260098e52208282166000528c526040600020610c6a868254612ff3565b905581600b549b8c9660405198899889528f890152602435604089015242606089015260808801521660a086015260e060c086015216971695339560e0840191612fb4565b0390a460018101600b55604051908152f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152fd5b90506020813d602011610da7575b81610d9860209383612ce1565b81010312610931575138610adf565b3d9150610d8b565b6040513d85823e3d90fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f494e56414c49445f5752495445000000000000000000000000000000000000006044820152fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760043590818152600260205273ffffffffffffffffffffffffffffffffffffffff6040822054161561094957610e7c614001565b5081600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416156109495781600052600a602052604060002060405192610ec284612c7a565b815484526001938373ffffffffffffffffffffffffffffffffffffffff60028188870154169560208501968752015416928360408401526024604051809581937f4fe17e1a00000000000000000000000000000000000000000000000000000000835260048301525afa9283156113b05784928594611331575b5073ffffffffffffffffffffffffffffffffffffffff610f5d91511661359c565b8151909560218682847a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008082101561131f575b50600a906d04ee2d6d415b85acef810000000080821015611312575b50662386f26fc1000080821015611305575b506305f5e100808210156112f8575b50612710808210156112eb575b5060648110156112dd575b10156112d6575b93929190610ff683820161354d565b9850880101905b611274575b61047461120d8861120860b38c8b8b61103473ffffffffffffffffffffffffffffffffffffffff60408e01511661359c565b6040519687947f7b2261747472696275746573223a5b7b2274726169745f74797065223a22437560208701527f7272656e6379222c2276616c7565223a22000000000000000000000000000000604087015261109a81518092602060518a019101612b0e565b85017f227d2c7b2274726169745f74797065223a22457363726f776564222c2264697360518201527f706c61795f74797065223a226e756d626572222c2276616c7565223a0000000060718201526110fc825180936020608d85019101612b0e565b017f7d2c7b2274726169745f74797065223a224d6f64756c65222c2276616c756522608d8201527f3a2200000000000000000000000000000000000000000000000000000000000060ad82015261115d82518093602060af85019101612b0e565b017f227d00000000000000000000000000000000000000000000000000000000000060af82015261119882518093602060b185019101612b0e565b017f5d0000000000000000000000000000000000000000000000000000000000000060b18201526111d382518093602060b285019101612b0e565b017f7d0000000000000000000000000000000000000000000000000000000000000060b2820152036093810184520182612ce1565b61375c565b611260603d60405180937f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000060208301526112508151809260208686019101612b0e565b810103601d810184520182612ce1565b604051918291602083526020830190612b31565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600a9101917f30313233343536373839616263646566000000000000000000000000000000008282061a8353049182156112d157919082610ffd565b611002565b0182610fe7565b606460029104930192610fe0565b6004910493019238610fd5565b6008910493019238610fc8565b6010910493019238610fb9565b6020910493019238610fa7565b92505050830482600a60409290610f8b565b925092503d8085843e6113448184612ce1565b82016040838203126113ac57825167ffffffffffffffff908181116113a8578261136f91860161350b565b9360208101519182116113a857610f5d9273ffffffffffffffffffffffffffffffffffffffff926113a0920161350b565b949150610f3c565b8680fd5b8480fd5b6040513d86823e3d90fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257600435808252600260205273ffffffffffffffffffffffffffffffffffffffff60408320541615610949578160409160209352600a83522054604051908152f35b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611464612b74565b73ffffffffffffffffffffffffffffffffffffffff611481612bdd565b9161148a612ea2565b6114ed813f93848652600760205260ff604087205416946114b2821515809715151415612f21565b86526007602052604086209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b60405192835242602084015216907f782c39691e7343e20d628434c28903c45c4fc7749813fd9d6e7ec17adf32dbe960403392a380f35b50346101f25760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25761155c612b74565b611564612bba565b906064359067ffffffffffffffff82116115cc57366023830112156115cc578160040135928461159385612d22565b936115a16040519586612ce1565b858552366024878301011161097357856105ea96602460209301838801378501015260443591613219565b8380fd5b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611608612b74565b6040611612612bba565b9273ffffffffffffffffffffffffffffffffffffffff809316815260096020522091166000526020526020604060002054604051908152f35b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611683612b74565b73ffffffffffffffffffffffffffffffffffffffff6116a0612bdd565b91169081331461172757338352600560205260408320826000526020526116f68160406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b60405190151581527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760043590818152600260205273ffffffffffffffffffffffffffffffffffffffff9081604082205416156109495760408160209460029352600a855220015416604051908152f35b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576040519080600180549161183f83612df3565b808652928281169081156118c05750600114611866575b6104748561126081870382612ce1565b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b8284106118a857505050810160200161126082610474611856565b8054602085870181019190915290930192810161188d565b869550610474969350602092506112609491507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001682840152151560051b8201019293611856565b50346101f257602090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25767ffffffffffffffff600435818111611b445761195b903690600401612c4c565b91611964612ea2565b8211611b1757611975600854612df3565b601f8111611ab9575b508293601f83116001146119fd57509282938293926119f2575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c1916176008555b7fa5d4097edda6d87cb9329af83fb3712ef77eeb13738ffe43cc35a4ce305ad9628180a180f35b013590503880611998565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08316947ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee39285905b878210611aa1575050836001959610611a69575b505050811b016008556119cb565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88560031b161c19910135169055388080611a5b565b80600184968294958701358155019501920190611a47565b7ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3601f840160051c810191868510611b0d575b601f0160051c01905b818110611b02575061197e565b848155600101611af5565b9091508190611aec565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b8280fd5b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257602073ffffffffffffffffffffffffffffffffffffffff60065416604051908152f35b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257600435611bd5614001565b5080600052600260205273ffffffffffffffffffffffffffffffffffffffff80604060002054161561094957606091600052600a602052604060002090600260405192611c2184612c7a565b805484528260018201541660208501520154166040820152611c736040518092604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565bf35b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611cac612ea2565b600073ffffffffffffffffffffffffffffffffffffffff6006547fffffffffffffffffffffffff00000000000000000000000000000000000000008116600655167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25773ffffffffffffffffffffffffffffffffffffffff611d61612b74565b168015611d7e578160409160209352600383522054604051908152f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257600435808252600a60205273ffffffffffffffffffffffffffffffffffffffff6002604084200154163303611e8f5760207ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce791604051908152a180f35b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f4e4f545f4d4f44554c45000000000000000000000000000000000000000000006044820152fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576020611f2a600435612dc1565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760206101e86101d3612b74565b5060807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257611fb8612b97565b60643567ffffffffffffffff8111611b4457611fd8903690600401612c4c565b6004929192358452600260205273ffffffffffffffffffffffffffffffffffffffff604085205416156109495761200d614001565b50600435600052600260205273ffffffffffffffffffffffffffffffffffffffff604060002054161561094957600435600052600a60205260406000209073ffffffffffffffffffffffffffffffffffffffff60026040519361206f85612c7a565b80548552826001820154166020860152015416936040830192858452612096600435612dc1565b9373ffffffffffffffffffffffffffffffffffffffff604051957f747729d100000000000000000000000000000000000000000000000000000000875233600488015216602486015273ffffffffffffffffffffffffffffffffffffffff8616604486015260208560243598896064830152600435608483015261214a60a4830186604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565b610120610104830152818b8161216561012482018b8b612fb4565b03925af19485156122e457889561229c575b5073ffffffffffffffffffffffffffffffffffffffff906004358952600a602052604089206121a78982546134fe565b90556121c482602085015116886121be898c6134fe565b91613ca7565b51168752600960205273ffffffffffffffffffffffffffffffffffffffff602060408920920151166000526020526040600020612202848254612ff3565b90558160405192839283378101600081520390209273ffffffffffffffffffffffffffffffffffffffff6040519316835260208301526040820152426060820152600435907fa45d21a235efa64e1d8f22fcecdbc348471bf46c3fd95cb0b3d78bb59ccfdd8e60803392a47ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce760206040516004358152a180f35b9094506020813d6020116122dc575b816122b860209383612ce1565b8101031261093157519373ffffffffffffffffffffffffffffffffffffffff612177565b3d91506122ab565b6040513d8a823e3d90fd5b50346101f2576105ea61230136612bec565b906040519261230f84612cc5565b858452613219565b50346101f25761232636612bec565b808493929352600260205273ffffffffffffffffffffffffffffffffffffffff60408520541615610949576123a6817ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce7946020946123a16040518780820152600060408201526040815261239981612c7a565b848484613914565b61302f565b604051908152a180f35b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576020600b54604051908152f35b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25760043590818152600260205273ffffffffffffffffffffffffffffffffffffffff9081604082205416156109495760408160209460019352600a855220015416604051908152f35b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f25761249c612b74565b6124a4612bdd565b906124ad612ea2565b612510813f92838552600760205260ff604086205416936124d5821515809615151415612f21565b85526007602052604085209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b6040805133815242602082015273ffffffffffffffffffffffffffffffffffffffff92909216917f1bf5ef6ada443138fcac941f79625fe01e92ff514fee9f160bff18363199c7a09190a380f35b50346101f25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f257612596612b74565b90602435918282526020906002825273ffffffffffffffffffffffffffffffffffffffff938460408520541615610949576125cf614001565b5080845260028352846040852054161561094957808452600a83526040842091856002604051946125ff86612c7a565b80548652826001820154168787015201541680604085015261262083612dc1565b90803b156113a85760e48792838a936126af8560405198899788967f300826d600000000000000000000000000000000000000000000000000000000885233600489015216602487015216998a60448601528960648601526084850190604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565b5af180156128e257612899575b50846126c782612dc1565b16808314612815578033149081156127f4575b501561277057808495817ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce796526004855260408720847fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905561274082612dc1565b1692604051937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258880a48152a180f35b608483604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152fd5b90508452600583526040842033600052835260ff60406000205416386126da565b608484604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152fd5b67ffffffffffffffff81959295116128b55760405292386126bc565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6040513d87823e3d90fd5b50346101f25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576020611f2a600435612e46565b50346101f257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f2576040519080805461296981612df3565b808552916001918083169081156118c05750600114612992576104748561126081870382612ce1565b80809450527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b8284106129d457505050810160200161126082610474611856565b805460208587018101919091529093019281016129b9565b9050346109735760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610973576004357fffffffff000000000000000000000000000000000000000000000000000000008116809103611b4457602092507f49064906000000000000000000000000000000000000000000000000000000008114908115612a80575b5015158152f35b7f80ac58cd00000000000000000000000000000000000000000000000000000000811491508115612ae4575b8115612aba575b5038612a79565b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501438612ab3565b7f5b5e139f0000000000000000000000000000000000000000000000000000000081149150612aac565b60005b838110612b215750506000910152565b8181015183820152602001612b11565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093612b6d81518092818752878088019101612b0e565b0116010190565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361093157565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361093157565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361093157565b60243590811515820361093157565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60609101126109315773ffffffffffffffffffffffffffffffffffffffff90600435828116810361093157916024359081168103610931579060443590565b9181601f840112156109315782359167ffffffffffffffff8311610931576020838186019501011161093157565b6060810190811067ffffffffffffffff821117612c9657604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff821117612c9657604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612c9657604052565b67ffffffffffffffff8111612c9657601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b15612d6357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152fd5b600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416612df0811515612d5c565b90565b90600182811c92168015612e3c575b6020831014612e0d57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691612e02565b612e7b612e7682600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416151590565b612d5c565b600052600460205273ffffffffffffffffffffffffffffffffffffffff6040600020541690565b73ffffffffffffffffffffffffffffffffffffffff600654163303612ec357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b15612f2857565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f524544554e44414e545f57484954454c495354000000000000000000000000006044820152fd5b3f600052600760205260ff604060002054169081612fa2575090565b90503f60005260ff6040600020541690565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b9190820180921161300057565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61303883612dc1565b73ffffffffffffffffffffffffffffffffffffffff918216929082168390036131955716908115613112577fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60008481526004602052604081207fffffffffffffffffffffffff0000000000000000000000000000000000000000908181541690558382526003602052604082207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81540190558482526040822060018154019055858252600260205284604083209182541617905580a4565b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152fd5b909161325a9261322c8295838386613914565b60405192602080850152600060408501526040845261324a84612c7a565b61325583838361302f565b613345565b1561328c5760207ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce791604051908152a1565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608490fd5b0390fd5b3d15613340573d9061332682612d22565b916133346040519384612ce1565b82523d6000602084013e565b606090565b919290803b156134f5576133bc9160209160405180809581947f150b7a0200000000000000000000000000000000000000000000000000000000998a845233600485015273ffffffffffffffffffffffffffffffffffffffff809a1660248501526044840152608060648401526084830190612b31565b03916000968791165af190829082613495575b505061346f576133dd613315565b8051908161346a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608490fd5b602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000161490565b909192506020813d82116134ed575b816134b160209383612ce1565b810103126109735751907fffffffff00000000000000000000000000000000000000000000000000000000821682036101f257509038806133cf565b3d91506134a4565b50505050600190565b9190820391821161300057565b81601f8201121561093157805161352181612d22565b9261352f6040519485612ce1565b8184526020828401011161093157612df09160208085019101612b0e565b9061355782612d22565b6135646040519182612ce1565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06135928294612d22565b0190602036910137565b73ffffffffffffffffffffffffffffffffffffffff16604051906135bf82612c7a565b602a8252602090818301604036823783511561372d5760309053825160019081101561372d57607860218501536029905b80821161365e575050613601575090565b606490604051907f08c379a000000000000000000000000000000000000000000000000000000000825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f811660108110156136ff5785518410156136ff577f3031323334353637383961626364656600000000000000000000000000000000901a84848701015360041c9180156136d1577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906135f0565b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8051156139005760405161376f81612c7a565b604081527f4142434445464748494a4b4c4d4e4f505152535455565758595a61626364656660208201527f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f604082015281516002928382018092116130005760038092047f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8116810361300057613809908594951b61354d565b936020850193829183518401925b8381106138af575050505051068060011461386057600214613837575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff603d91015390565b507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe81603d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81940153015390565b85600491979293949701918251600190603f9082828260121c16880101518453828282600c1c16880101518385015382828260061c1688010151888501531685010151878201530195929190613817565b5060405161390d81612cc5565b6000815290565b91909273ffffffffffffffffffffffffffffffffffffffff61393583612dc1565b16803314908115613c82575b508015613c5b575b15613bfd57805115613bda575b61395e614001565b5081600052600260205273ffffffffffffffffffffffffffffffffffffffff60406000205416156109495781600052600a60205260406000209073ffffffffffffffffffffffffffffffffffffffff604051926139ba84612c7a565b80548452816002816001840154169260208701938452015416604085015260206139e386612dc1565b96838060408801511699816139f78a612e46565b936040519788957faca2caf3000000000000000000000000000000000000000000000000000000008752336004880152166024860152818c16604486015216606484015216988960848301528760a4830152613a8360c4830188604090805183528173ffffffffffffffffffffffffffffffffffffffff91826020820151166020860152015116910152565b61014061012483015281600081613a9e61014482018a612b31565b03925af1918215613bce57600092613b84575b5073ffffffffffffffffffffffffffffffffffffffff60407f5e3a637bdcd06ac50d3db8eb3575927de6c71cea82a0ee1f4d65026b7087e2e19587600052600a60205281600020613b038682546134fe565b9055015116600052600960205273ffffffffffffffffffffffffffffffffffffffff60406000209151166000526020526040600020613b43828254612ff3565b905573ffffffffffffffffffffffffffffffffffffffff613b766040519384938452606060208501526060840190612b31565b9542604084015216940390a4565b9391506020843d602011613bc6575b81613ba060209383612ce1565b81010312610931579251909273ffffffffffffffffffffffffffffffffffffffff613ab1565b3d9150613b93565b6040513d6000823e3d90fd5b506040516020808201526000604082015260408152613bf881612c7a565b613956565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e4f545f415050524f5645445f4f525f4f574e455200000000000000000000006044820152fd5b503373ffffffffffffffffffffffffffffffffffffffff613c7b84612e46565b1614613949565b9050600052600560205260406000203360005260205260ff6040600020541638613941565b919081613cb357505050565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff9182166024820152604480820193909352918252613d1a92613d14606484612ce1565b16613d1c565b565b73ffffffffffffffffffffffffffffffffffffffff1690604051604081019080821067ffffffffffffffff831117612c9657613d9c916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1613d96613315565b91613e54565b805180613daa575b50505050565b8184918101031261097357820151908115918215036101f25750613dd057808080613da4565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b91929015613ecf5750815115613e68575090565b3b15613e715790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015613ee25750805190602001fd5b613311906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190612b31565b93613f2b9192612ff3565b80613f5d575b5081613f3c57505050565b613d1a9273ffffffffffffffffffffffffffffffffffffffff339116613f85565b613f7f90303373ffffffffffffffffffffffffffffffffffffffff8716613f85565b38613f31565b9290604051927f23b872dd00000000000000000000000000000000000000000000000000000000602085015273ffffffffffffffffffffffffffffffffffffffff809216602485015216604483015260648201526064815260a081019181831067ffffffffffffffff841117612c9657613d1a92604052613d1c565b6040519061400e82612c7a565b6000604083828152826020820152015256fea264697066735822122065c470cf73b04bc20618fcd09d21a48e6b4047dd026bb09e1ba2a6f158ef2e9b64736f6c63430008140033

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

000000000000000000000000167813e0d6958bcf30a1cebee53ae0c57677c963

-----Decoded View---------------
Arg [0] : newOwner (address): 0x167813E0D6958BCF30a1cEbEE53aE0C57677c963

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000167813e0d6958bcf30a1cebee53ae0c57677c963


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
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.