ETH Price: $3,098.17 (-1.08%)

Token

Upside Down Bears (UDB)
 

Overview

Max Total Supply

100 UDB

Holders

8

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Filtered by Token Holder
unforgive.eth
Balance
0.000000000000000012 UDB

Value
$0.00
0xed4821fe5608bfc5c20be9ec6ffff5a6d8da23d3
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
UPSIDEDOWNBEARS

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2024-02-12
*/

// File: solady/utils/LibString.sol



///         \\_____//               \\_____//
///          //     \,/             \,/     \\
///          \_____,,,\           /,,,_____/
///           \,,,,,,, \         /,,,,,,,,/
///            \,,,,,,,,\ _____ /,,,,,,,,/
///             \,,,,,,,,,,,,,,,,,,,,,,,/
///              \,,,,,,,,_______,,,,,,,,/
///               \,,,\____________/,,,,/
///               /,,\               \,,/
///               |,|          O       |,|
///               |'|                   |,|
///               |,|         *UPSIDE*  |,|
///               |,|        *DOWN*     |,|
///                \,\     *BEARS*     /,/
///                    \__\___________/__/
///                   /,,\     \_/     /,,\
///                  |,,|   \__/|\__/   |,,|
///                 |,,,|       |       |,,,|
///                  \,,,/(,)\\o_o//(,)\,,,/
///                 /,,,___,,,,___,,,,___,,,,\
///                 |,(  )/,,,,,,,,,,,,,\(  ),|
///                  \,,,,/_____________\,,,,/
///                   \__/               \__/



pragma solidity ^0.8.4;

/// @notice Library for converting numbers into strings and other string operations.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol)
///
/// @dev Note:
/// For performance and bytecode compactness, most of the string operations are restricted to
/// byte strings (7-bit ASCII), except where otherwise specified.
/// Usage of byte string operations on charsets with runes spanning two or more bytes
/// can lead to undefined behavior.
library LibString {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                        CUSTOM ERRORS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The length of the output is too small to contain all the hex digits.
    error HexLengthInsufficient();

    /// @dev The length of the string is more than 32 bytes.
    error TooBigForSmallString();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The constant returned when the `search` is not found in the string.
    uint256 internal constant NOT_FOUND = type(uint256).max;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     DECIMAL OPERATIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the base 10 decimal representation of `value`.
    function toString(uint256 value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits.
            str := add(mload(0x40), 0x80)
            // Update the free memory pointer to allocate.
            mstore(0x40, add(str, 0x20))
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end of the memory to calculate the length later.
            let end := str

            let w := not(0) // Tsk.
            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for { let temp := value } 1 {} {
                str := add(str, w) // `sub(str, 1)`.
                // Write the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
                if iszero(temp) { break }
            }

            let length := sub(end, str)
            // Move the pointer 32 bytes leftwards to make room for the length.
            str := sub(str, 0x20)
            // Store the length.
            mstore(str, length)
        }
    }

    /// @dev Returns the base 10 decimal representation of `value`.
    function toString(int256 value) internal pure returns (string memory str) {
        if (value >= 0) {
            return toString(uint256(value));
        }
        unchecked {
            str = toString(~uint256(value) + 1);
        }
        /// @solidity memory-safe-assembly
        assembly {
            // We still have some spare memory space on the left,
            // as we have allocated 3 words (96 bytes) for up to 78 digits.
            let length := mload(str) // Load the string length.
            mstore(str, 0x2d) // Store the '-' character.
            str := sub(str, 1) // Move back the string pointer by a byte.
            mstore(str, add(length, 1)) // Update the string length.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   HEXADECIMAL OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the hexadecimal representation of `value`,
    /// left-padded to an input length of `length` bytes.
    /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte,
    /// giving a total length of `length * 2 + 2` bytes.
    /// Reverts if `length` is too small for the output to contain all the digits.
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value, length);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`,
    /// left-padded to an input length of `length` bytes.
    /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte,
    /// giving a total length of `length * 2` bytes.
    /// Reverts if `length` is too small for the output to contain all the digits.
    function toHexStringNoPrefix(uint256 value, uint256 length)
        internal
        pure
        returns (string memory str)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes
            // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length.
            // We add 0x20 to the total and round down to a multiple of 0x20.
            // (0x20 + 0x20 + 0x02 + 0x20) = 0x62.
            str := add(mload(0x40), and(add(shl(1, length), 0x42), not(0x1f)))
            // Allocate the memory.
            mstore(0x40, add(str, 0x20))
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end to calculate the length later.
            let end := str
            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            let start := sub(str, add(length, length))
            let w := not(1) // Tsk.
            let temp := value
            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for {} 1 {} {
                str := add(str, w) // `sub(str, 2)`.
                mstore8(add(str, 1), mload(and(temp, 15)))
                mstore8(str, mload(and(shr(4, temp), 15)))
                temp := shr(8, temp)
                if iszero(xor(str, start)) { break }
            }

            if temp {
                mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`.
                revert(0x1c, 0x04)
            }

            // Compute the string's length.
            let strLength := sub(end, str)
            // Move the pointer and write the length.
            str := sub(str, 0x20)
            mstore(str, strLength)
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
    /// As address are 20 bytes long, the output will left-padded to have
    /// a length of `20 * 2 + 2` bytes.
    function toHexString(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x".
    /// The output excludes leading "0" from the `toHexString` output.
    /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`.
    function toMinimalHexString(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present.
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(add(str, o), 0x3078) // Write the "0x" prefix, accounting for leading zero.
            str := sub(add(str, o), 2) // Move the pointer, accounting for leading zero.
            mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output excludes leading "0" from the `toHexStringNoPrefix` output.
    /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`.
    function toMinimalHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present.
            let strLength := mload(str) // Get the length.
            str := add(str, o) // Move the pointer, accounting for leading zero.
            mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is encoded using 2 hexadecimal digits per byte.
    /// As address are 20 bytes long, the output will left-padded to have
    /// a length of `20 * 2` bytes.
    function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
            // 0x02 bytes for the prefix, and 0x40 bytes for the digits.
            // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0.
            str := add(mload(0x40), 0x80)
            // Allocate the memory.
            mstore(0x40, add(str, 0x20))
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end to calculate the length later.
            let end := str
            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            let w := not(1) // Tsk.
            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for { let temp := value } 1 {} {
                str := add(str, w) // `sub(str, 2)`.
                mstore8(add(str, 1), mload(and(temp, 15)))
                mstore8(str, mload(and(shr(4, temp), 15)))
                temp := shr(8, temp)
                if iszero(temp) { break }
            }

            // Compute the string's length.
            let strLength := sub(end, str)
            // Move the pointer and write the length.
            str := sub(str, 0x20)
            mstore(str, strLength)
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte,
    /// and the alphabets are capitalized conditionally according to
    /// https://eips.ethereum.org/EIPS/eip-55
    function toHexStringChecksummed(address value) internal pure returns (string memory str) {
        str = toHexString(value);
        /// @solidity memory-safe-assembly
        assembly {
            let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...`
            let o := add(str, 0x22)
            let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `
            let t := shl(240, 136) // `0b10001000 << 240`
            for { let i := 0 } 1 {} {
                mstore(add(i, i), mul(t, byte(i, hashed)))
                i := add(i, 1)
                if eq(i, 20) { break }
            }
            mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask)))))
            o := add(o, 0x20)
            mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask)))))
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
    function toHexString(address value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexStringNoPrefix(address value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            str := mload(0x40)

            // Allocate the memory.
            // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
            // 0x02 bytes for the prefix, and 0x28 bytes for the digits.
            // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80.
            mstore(0x40, add(str, 0x80))

            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            str := add(str, 2)
            mstore(str, 40)

            let o := add(str, 0x20)
            mstore(add(o, 40), 0)

            value := shl(96, value)

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for { let i := 0 } 1 {} {
                let p := add(o, add(i, i))
                let temp := byte(i, value)
                mstore8(add(p, 1), mload(and(temp, 15)))
                mstore8(p, mload(shr(4, temp)))
                i := add(i, 1)
                if eq(i, 20) { break }
            }
        }
    }

    /// @dev Returns the hex encoded string from the raw bytes.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexString(bytes memory raw) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(raw);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hex encoded string from the raw bytes.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            let length := mload(raw)
            str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix.
            mstore(str, add(length, length)) // Store the length of the output.

            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            let o := add(str, 0x20)
            let end := add(raw, length)

            for {} iszero(eq(raw, end)) {} {
                raw := add(raw, 1)
                mstore8(add(o, 1), mload(and(mload(raw), 15)))
                mstore8(o, mload(and(shr(4, mload(raw)), 15)))
                o := add(o, 2)
            }
            mstore(o, 0) // Zeroize the slot after the string.
            mstore(0x40, add(o, 0x20)) // Allocate the memory.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   RUNE STRING OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the number of UTF characters in the string.
    function runeCount(string memory s) internal pure returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            if mload(s) {
                mstore(0x00, div(not(0), 255))
                mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506)
                let o := add(s, 0x20)
                let end := add(o, mload(s))
                for { result := 1 } 1 { result := add(result, 1) } {
                    o := add(o, byte(0, mload(shr(250, mload(o)))))
                    if iszero(lt(o, end)) { break }
                }
            }
        }
    }

    /// @dev Returns if this string is a 7-bit ASCII string.
    /// (i.e. all characters codes are in [0..127])
    function is7BitASCII(string memory s) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            let mask := shl(7, div(not(0), 255))
            result := 1
            let n := mload(s)
            if n {
                let o := add(s, 0x20)
                let end := add(o, n)
                let last := mload(end)
                mstore(end, 0)
                for {} 1 {} {
                    if and(mask, mload(o)) {
                        result := 0
                        break
                    }
                    o := add(o, 0x20)
                    if iszero(lt(o, end)) { break }
                }
                mstore(end, last)
            }
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   BYTE STRING OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // For performance and bytecode compactness, byte string operations are restricted
    // to 7-bit ASCII strings. All offsets are byte offsets, not UTF character offsets.
    // Usage of byte string operations on charsets with runes spanning two or more bytes
    // can lead to undefined behavior.

    /// @dev Returns `subject` all occurrences of `search` replaced with `replacement`.
    function replace(string memory subject, string memory search, string memory replacement)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            let searchLength := mload(search)
            let replacementLength := mload(replacement)

            subject := add(subject, 0x20)
            search := add(search, 0x20)
            replacement := add(replacement, 0x20)
            result := add(mload(0x40), 0x20)

            let subjectEnd := add(subject, subjectLength)
            if iszero(gt(searchLength, subjectLength)) {
                let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1)
                let h := 0
                if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }
                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(search)
                for {} 1 {} {
                    let t := mload(subject)
                    // Whether the first `searchLength % 32` bytes of
                    // `subject` and `search` matches.
                    if iszero(shr(m, xor(t, s))) {
                        if h {
                            if iszero(eq(keccak256(subject, searchLength), h)) {
                                mstore(result, t)
                                result := add(result, 1)
                                subject := add(subject, 1)
                                if iszero(lt(subject, subjectSearchEnd)) { break }
                                continue
                            }
                        }
                        // Copy the `replacement` one word at a time.
                        for { let o := 0 } 1 {} {
                            mstore(add(result, o), mload(add(replacement, o)))
                            o := add(o, 0x20)
                            if iszero(lt(o, replacementLength)) { break }
                        }
                        result := add(result, replacementLength)
                        subject := add(subject, searchLength)
                        if searchLength {
                            if iszero(lt(subject, subjectSearchEnd)) { break }
                            continue
                        }
                    }
                    mstore(result, t)
                    result := add(result, 1)
                    subject := add(subject, 1)
                    if iszero(lt(subject, subjectSearchEnd)) { break }
                }
            }

            let resultRemainder := result
            result := add(mload(0x40), 0x20)
            let k := add(sub(resultRemainder, result), sub(subjectEnd, subject))
            // Copy the rest of the string one word at a time.
            for {} lt(subject, subjectEnd) {} {
                mstore(resultRemainder, mload(subject))
                resultRemainder := add(resultRemainder, 0x20)
                subject := add(subject, 0x20)
            }
            result := sub(result, 0x20)
            let last := add(add(result, 0x20), k) // Zeroize the slot after the string.
            mstore(last, 0)
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
            mstore(result, k) // Store the length.
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from left to right, starting from `from`.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function indexOf(string memory subject, string memory search, uint256 from)
        internal
        pure
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            for { let subjectLength := mload(subject) } 1 {} {
                if iszero(mload(search)) {
                    if iszero(gt(from, subjectLength)) {
                        result := from
                        break
                    }
                    result := subjectLength
                    break
                }
                let searchLength := mload(search)
                let subjectStart := add(subject, 0x20)

                result := not(0) // Initialize to `NOT_FOUND`.

                subject := add(subjectStart, from)
                let end := add(sub(add(subjectStart, subjectLength), searchLength), 1)

                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(add(search, 0x20))

                if iszero(and(lt(subject, end), lt(from, subjectLength))) { break }

                if iszero(lt(searchLength, 0x20)) {
                    for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {
                        if iszero(shr(m, xor(mload(subject), s))) {
                            if eq(keccak256(subject, searchLength), h) {
                                result := sub(subject, subjectStart)
                                break
                            }
                        }
                        subject := add(subject, 1)
                        if iszero(lt(subject, end)) { break }
                    }
                    break
                }
                for {} 1 {} {
                    if iszero(shr(m, xor(mload(subject), s))) {
                        result := sub(subject, subjectStart)
                        break
                    }
                    subject := add(subject, 1)
                    if iszero(lt(subject, end)) { break }
                }
                break
            }
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from left to right.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function indexOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256 result)
    {
        result = indexOf(subject, search, 0);
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from right to left, starting from `from`.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function lastIndexOf(string memory subject, string memory search, uint256 from)
        internal
        pure
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            for {} 1 {} {
                result := not(0) // Initialize to `NOT_FOUND`.
                let searchLength := mload(search)
                if gt(searchLength, mload(subject)) { break }
                let w := result

                let fromMax := sub(mload(subject), searchLength)
                if iszero(gt(fromMax, from)) { from := fromMax }

                let end := add(add(subject, 0x20), w)
                subject := add(add(subject, 0x20), from)
                if iszero(gt(subject, end)) { break }
                // As this function is not too often used,
                // we shall simply use keccak256 for smaller bytecode size.
                for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {
                    if eq(keccak256(subject, searchLength), h) {
                        result := sub(subject, add(end, 1))
                        break
                    }
                    subject := add(subject, w) // `sub(subject, 1)`.
                    if iszero(gt(subject, end)) { break }
                }
                break
            }
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from right to left.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function lastIndexOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256 result)
    {
        result = lastIndexOf(subject, search, uint256(int256(-1)));
    }

    /// @dev Returns true if `search` is found in `subject`, false otherwise.
    function contains(string memory subject, string memory search) internal pure returns (bool) {
        return indexOf(subject, search) != NOT_FOUND;
    }

    /// @dev Returns whether `subject` starts with `search`.
    function startsWith(string memory subject, string memory search)
        internal
        pure
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let searchLength := mload(search)
            // Just using keccak256 directly is actually cheaper.
            // forgefmt: disable-next-item
            result := and(
                iszero(gt(searchLength, mload(subject))),
                eq(
                    keccak256(add(subject, 0x20), searchLength),
                    keccak256(add(search, 0x20), searchLength)
                )
            )
        }
    }

    /// @dev Returns whether `subject` ends with `search`.
    function endsWith(string memory subject, string memory search)
        internal
        pure
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let searchLength := mload(search)
            let subjectLength := mload(subject)
            // Whether `search` is not longer than `subject`.
            let withinRange := iszero(gt(searchLength, subjectLength))
            // Just using keccak256 directly is actually cheaper.
            // forgefmt: disable-next-item
            result := and(
                withinRange,
                eq(
                    keccak256(
                        // `subject + 0x20 + max(subjectLength - searchLength, 0)`.
                        add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))),
                        searchLength
                    ),
                    keccak256(add(search, 0x20), searchLength)
                )
            )
        }
    }

    /// @dev Returns `subject` repeated `times`.
    function repeat(string memory subject, uint256 times)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            if iszero(or(iszero(times), iszero(subjectLength))) {
                subject := add(subject, 0x20)
                result := mload(0x40)
                let output := add(result, 0x20)
                for {} 1 {} {
                    // Copy the `subject` one word at a time.
                    for { let o := 0 } 1 {} {
                        mstore(add(output, o), mload(add(subject, o)))
                        o := add(o, 0x20)
                        if iszero(lt(o, subjectLength)) { break }
                    }
                    output := add(output, subjectLength)
                    times := sub(times, 1)
                    if iszero(times) { break }
                }
                mstore(output, 0) // Zeroize the slot after the string.
                let resultLength := sub(output, add(result, 0x20))
                mstore(result, resultLength) // Store the length.
                // Allocate the memory.
                mstore(0x40, add(result, add(resultLength, 0x20)))
            }
        }
    }

    /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive).
    /// `start` and `end` are byte offsets.
    function slice(string memory subject, uint256 start, uint256 end)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            if iszero(gt(subjectLength, end)) { end := subjectLength }
            if iszero(gt(subjectLength, start)) { start := subjectLength }
            if lt(start, end) {
                result := mload(0x40)
                let resultLength := sub(end, start)
                mstore(result, resultLength)
                subject := add(subject, start)
                let w := not(0x1f)
                // Copy the `subject` one word at a time, backwards.
                for { let o := and(add(resultLength, 0x1f), w) } 1 {} {
                    mstore(add(result, o), mload(add(subject, o)))
                    o := add(o, w) // `sub(o, 0x20)`.
                    if iszero(o) { break }
                }
                // Zeroize the slot after the string.
                mstore(add(add(result, 0x20), resultLength), 0)
                // Allocate memory for the length and the bytes,
                // rounded up to a multiple of 32.
                mstore(0x40, add(result, and(add(resultLength, 0x3f), w)))
            }
        }
    }

    /// @dev Returns a copy of `subject` sliced from `start` to the end of the string.
    /// `start` is a byte offset.
    function slice(string memory subject, uint256 start)
        internal
        pure
        returns (string memory result)
    {
        result = slice(subject, start, uint256(int256(-1)));
    }

    /// @dev Returns all the indices of `search` in `subject`.
    /// The indices are byte offsets.
    function indicesOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256[] memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            let searchLength := mload(search)

            if iszero(gt(searchLength, subjectLength)) {
                subject := add(subject, 0x20)
                search := add(search, 0x20)
                result := add(mload(0x40), 0x20)

                let subjectStart := subject
                let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1)
                let h := 0
                if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }
                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(search)
                for {} 1 {} {
                    let t := mload(subject)
                    // Whether the first `searchLength % 32` bytes of
                    // `subject` and `search` matches.
                    if iszero(shr(m, xor(t, s))) {
                        if h {
                            if iszero(eq(keccak256(subject, searchLength), h)) {
                                subject := add(subject, 1)
                                if iszero(lt(subject, subjectSearchEnd)) { break }
                                continue
                            }
                        }
                        // Append to `result`.
                        mstore(result, sub(subject, subjectStart))
                        result := add(result, 0x20)
                        // Advance `subject` by `searchLength`.
                        subject := add(subject, searchLength)
                        if searchLength {
                            if iszero(lt(subject, subjectSearchEnd)) { break }
                            continue
                        }
                    }
                    subject := add(subject, 1)
                    if iszero(lt(subject, subjectSearchEnd)) { break }
                }
                let resultEnd := result
                // Assign `result` to the free memory pointer.
                result := mload(0x40)
                // Store the length of `result`.
                mstore(result, shr(5, sub(resultEnd, add(result, 0x20))))
                // Allocate memory for result.
                // We allocate one more word, so this array can be recycled for {split}.
                mstore(0x40, add(resultEnd, 0x20))
            }
        }
    }

    /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string.
    function split(string memory subject, string memory delimiter)
        internal
        pure
        returns (string[] memory result)
    {
        uint256[] memory indices = indicesOf(subject, delimiter);
        /// @solidity memory-safe-assembly
        assembly {
            let w := not(0x1f)
            let indexPtr := add(indices, 0x20)
            let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1)))
            mstore(add(indicesEnd, w), mload(subject))
            mstore(indices, add(mload(indices), 1))
            let prevIndex := 0
            for {} 1 {} {
                let index := mload(indexPtr)
                mstore(indexPtr, 0x60)
                if iszero(eq(index, prevIndex)) {
                    let element := mload(0x40)
                    let elementLength := sub(index, prevIndex)
                    mstore(element, elementLength)
                    // Copy the `subject` one word at a time, backwards.
                    for { let o := and(add(elementLength, 0x1f), w) } 1 {} {
                        mstore(add(element, o), mload(add(add(subject, prevIndex), o)))
                        o := add(o, w) // `sub(o, 0x20)`.
                        if iszero(o) { break }
                    }
                    // Zeroize the slot after the string.
                    mstore(add(add(element, 0x20), elementLength), 0)
                    // Allocate memory for the length and the bytes,
                    // rounded up to a multiple of 32.
                    mstore(0x40, add(element, and(add(elementLength, 0x3f), w)))
                    // Store the `element` into the array.
                    mstore(indexPtr, element)
                }
                prevIndex := add(index, mload(delimiter))
                indexPtr := add(indexPtr, 0x20)
                if iszero(lt(indexPtr, indicesEnd)) { break }
            }
            result := indices
            if iszero(mload(delimiter)) {
                result := add(indices, 0x20)
                mstore(result, sub(mload(indices), 2))
            }
        }
    }

    /// @dev Returns a concatenated string of `a` and `b`.
    /// Cheaper than `string.concat()` and does not de-align the free memory pointer.
    function concat(string memory a, string memory b)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let w := not(0x1f)
            result := mload(0x40)
            let aLength := mload(a)
            // Copy `a` one word at a time, backwards.
            for { let o := and(add(aLength, 0x20), w) } 1 {} {
                mstore(add(result, o), mload(add(a, o)))
                o := add(o, w) // `sub(o, 0x20)`.
                if iszero(o) { break }
            }
            let bLength := mload(b)
            let output := add(result, aLength)
            // Copy `b` one word at a time, backwards.
            for { let o := and(add(bLength, 0x20), w) } 1 {} {
                mstore(add(output, o), mload(add(b, o)))
                o := add(o, w) // `sub(o, 0x20)`.
                if iszero(o) { break }
            }
            let totalLength := add(aLength, bLength)
            let last := add(add(result, 0x20), totalLength)
            // Zeroize the slot after the string.
            mstore(last, 0)
            // Stores the length.
            mstore(result, totalLength)
            // Allocate memory for the length and the bytes,
            // rounded up to a multiple of 32.
            mstore(0x40, and(add(last, 0x1f), w))
        }
    }

    /// @dev Returns a copy of the string in either lowercase or UPPERCASE.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function toCase(string memory subject, bool toUpper)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let length := mload(subject)
            if length {
                result := add(mload(0x40), 0x20)
                subject := add(subject, 1)
                let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff)
                let w := not(0)
                for { let o := length } 1 {} {
                    o := add(o, w)
                    let b := and(0xff, mload(add(subject, o)))
                    mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20)))
                    if iszero(o) { break }
                }
                result := mload(0x40)
                mstore(result, length) // Store the length.
                let last := add(add(result, 0x20), length)
                mstore(last, 0) // Zeroize the slot after the string.
                mstore(0x40, add(last, 0x20)) // Allocate the memory.
            }
        }
    }

    /// @dev Returns a string from a small bytes32 string.
    /// `s` must be null-terminated, or behavior will be undefined.
    function fromSmallString(bytes32 s) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            let n := 0
            for {} byte(n, s) { n := add(n, 1) } {} // Scan for '\0'.
            mstore(result, n)
            let o := add(result, 0x20)
            mstore(o, s)
            mstore(add(o, n), 0)
            mstore(0x40, add(result, 0x40))
        }
    }

    /// @dev Returns the small string, with all bytes after the first null byte zeroized.
    function normalizeSmallString(bytes32 s) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            for {} byte(result, s) { result := add(result, 1) } {} // Scan for '\0'.
            mstore(0x00, s)
            mstore(result, 0x00)
            result := mload(0x00)
        }
    }

    /// @dev Returns the string as a normalized null-terminated small string.
    function toSmallString(string memory s) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(s)
            if iszero(lt(result, 33)) {
                mstore(0x00, 0xec92f9a3) // `TooBigForSmallString()`.
                revert(0x1c, 0x04)
            }
            result := shl(shl(3, sub(32, result)), mload(add(s, result)))
        }
    }

    /// @dev Returns a lowercased copy of the string.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function lower(string memory subject) internal pure returns (string memory result) {
        result = toCase(subject, false);
    }

    /// @dev Returns an UPPERCASED copy of the string.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function upper(string memory subject) internal pure returns (string memory result) {
        result = toCase(subject, true);
    }

    /// @dev Escapes the string to be used within HTML tags.
    function escapeHTML(string memory s) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            let end := add(s, mload(s))
            result := add(mload(0x40), 0x20)
            // Store the bytes of the packed offsets and strides into the scratch space.
            // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6.
            mstore(0x1f, 0x900094)
            mstore(0x08, 0xc0000000a6ab)
            // Store "&quot;&amp;&#39;&lt;&gt;" into the scratch space.
            mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b))
            for {} iszero(eq(s, end)) {} {
                s := add(s, 1)
                let c := and(mload(s), 0xff)
                // Not in `["\"","'","&","<",">"]`.
                if iszero(and(shl(c, 1), 0x500000c400000000)) {
                    mstore8(result, c)
                    result := add(result, 1)
                    continue
                }
                let t := shr(248, mload(c))
                mstore(result, mload(and(t, 0x1f)))
                result := add(result, shr(5, t))
            }
            let last := result
            mstore(last, 0) // Zeroize the slot after the string.
            result := mload(0x40)
            mstore(result, sub(last, add(result, 0x20))) // Store the length.
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
        }
    }

    /// @dev Escapes the string to be used within double-quotes in a JSON.
    /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes.
    function escapeJSON(string memory s, bool addDoubleQuotes)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let end := add(s, mload(s))
            result := add(mload(0x40), 0x20)
            if addDoubleQuotes {
                mstore8(result, 34)
                result := add(1, result)
            }
            // Store "\\u0000" in scratch space.
            // Store "0123456789abcdef" in scratch space.
            // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`.
            // into the scratch space.
            mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672)
            // Bitmask for detecting `["\"","\\"]`.
            let e := or(shl(0x22, 1), shl(0x5c, 1))
            for {} iszero(eq(s, end)) {} {
                s := add(s, 1)
                let c := and(mload(s), 0xff)
                if iszero(lt(c, 0x20)) {
                    if iszero(and(shl(c, 1), e)) {
                        // Not in `["\"","\\"]`.
                        mstore8(result, c)
                        result := add(result, 1)
                        continue
                    }
                    mstore8(result, 0x5c) // "\\".
                    mstore8(add(result, 1), c)
                    result := add(result, 2)
                    continue
                }
                if iszero(and(shl(c, 1), 0x3700)) {
                    // Not in `["\b","\t","\n","\f","\d"]`.
                    mstore8(0x1d, mload(shr(4, c))) // Hex value.
                    mstore8(0x1e, mload(and(c, 15))) // Hex value.
                    mstore(result, mload(0x19)) // "\\u00XX".
                    result := add(result, 6)
                    continue
                }
                mstore8(result, 0x5c) // "\\".
                mstore8(add(result, 1), mload(add(c, 8)))
                result := add(result, 2)
            }
            if addDoubleQuotes {
                mstore8(result, 34)
                result := add(1, result)
            }
            let last := result
            mstore(last, 0) // Zeroize the slot after the string.
            result := mload(0x40)
            mstore(result, sub(last, add(result, 0x20))) // Store the length.
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
        }
    }

    /// @dev Escapes the string to be used within double-quotes in a JSON.
    function escapeJSON(string memory s) internal pure returns (string memory result) {
        result = escapeJSON(s, false);
    }

    /// @dev Returns whether `a` equals `b`.
    function eq(string memory a, string memory b) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b)))
        }
    }

    /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small string.
    function eqs(string memory a, bytes32 b) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            // These should be evaluated on compile time, as far as possible.
            let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`.
            let x := not(or(m, or(b, add(m, and(b, m)))))
            let r := shl(7, iszero(iszero(shr(128, x))))
            r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x))))))
            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
            r := or(r, shl(4, lt(0xffff, shr(r, x))))
            r := or(r, shl(3, lt(0xff, shr(r, x))))
            // forgefmt: disable-next-item
            result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))),
                xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20)))))
        }
    }

    /// @dev Packs a single string with its length into a single word.
    /// Returns `bytes32(0)` if the length is zero or greater than 31.
    function packOne(string memory a) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            // We don't need to zero right pad the string,
            // since this is our own custom non-standard packing scheme.
            result :=
                mul(
                    // Load the length and the bytes.
                    mload(add(a, 0x1f)),
                    // `length != 0 && length < 32`. Abuses underflow.
                    // Assumes that the length is valid and within the block gas limit.
                    lt(sub(mload(a), 1), 0x1f)
                )
        }
    }

    /// @dev Unpacks a string packed using {packOne}.
    /// Returns the empty string if `packed` is `bytes32(0)`.
    /// If `packed` is not an output of {packOne}, the output behavior is undefined.
    function unpackOne(bytes32 packed) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            // Grab the free memory pointer.
            result := mload(0x40)
            // Allocate 2 words (1 for the length, 1 for the bytes).
            mstore(0x40, add(result, 0x40))
            // Zeroize the length slot.
            mstore(result, 0)
            // Store the length and bytes.
            mstore(add(result, 0x1f), packed)
            // Right pad with zeroes.
            mstore(add(add(result, 0x20), mload(result)), 0)
        }
    }

    /// @dev Packs two strings with their lengths into a single word.
    /// Returns `bytes32(0)` if combined length is zero or greater than 30.
    function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            let aLength := mload(a)
            // We don't need to zero right pad the strings,
            // since this is our own custom non-standard packing scheme.
            result :=
                mul(
                    // Load the length and the bytes of `a` and `b`.
                    or(
                        shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))),
                        mload(sub(add(b, 0x1e), aLength))
                    ),
                    // `totalLength != 0 && totalLength < 31`. Abuses underflow.
                    // Assumes that the lengths are valid and within the block gas limit.
                    lt(sub(add(aLength, mload(b)), 1), 0x1e)
                )
        }
    }

    /// @dev Unpacks strings packed using {packTwo}.
    /// Returns the empty strings if `packed` is `bytes32(0)`.
    /// If `packed` is not an output of {packTwo}, the output behavior is undefined.
    function unpackTwo(bytes32 packed)
        internal
        pure
        returns (string memory resultA, string memory resultB)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Grab the free memory pointer.
            resultA := mload(0x40)
            resultB := add(resultA, 0x40)
            // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words.
            mstore(0x40, add(resultB, 0x40))
            // Zeroize the length slots.
            mstore(resultA, 0)
            mstore(resultB, 0)
            // Store the lengths and bytes.
            mstore(add(resultA, 0x1f), packed)
            mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA))))
            // Right pad with zeroes.
            mstore(add(add(resultA, 0x20), mload(resultA)), 0)
            mstore(add(add(resultB, 0x20), mload(resultB)), 0)
        }
    }

    /// @dev Directly returns `a` without copying.
    function directReturn(string memory a) internal pure {
        assembly {
            // Assumes that the string does not start from the scratch space.
            let retStart := sub(a, 0x20)
            let retSize := add(mload(a), 0x40)
            // Right pad with zeroes. Just in case the string is produced
            // by a method that doesn't zero right pad.
            mstore(add(retStart, retSize), 0)
            // Store the return offset.
            mstore(retStart, 0x20)
            // End the transaction, returning the string.
            return(retStart, retSize)
        }
    }
}
// File: solady/auth/Ownable.sol


pragma solidity ^0.8.4;

/// @notice Simple single owner authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
///
/// @dev Note:
/// This implementation does NOT auto-initialize the owner to `msg.sender`.
/// You MUST call the `_initializeOwner` in the constructor / initializer.
///
/// While the ownable portion follows
/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
/// the nomenclature for the 2-step ownership handover may be unique to this codebase.
abstract contract Ownable {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The caller is not authorized to call the function.
    error Unauthorized();

    /// @dev The `newOwner` cannot be the zero address.
    error NewOwnerIsZeroAddress();

    /// @dev The `pendingOwner` does not have a valid handover request.
    error NoHandoverRequest();

    /// @dev Cannot double-initialize.
    error AlreadyInitialized();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ownership is transferred from `oldOwner` to `newOwner`.
    /// This event is intentionally kept the same as OpenZeppelin's Ownable to be
    /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
    /// despite it not being as lightweight as a single argument event.
    event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);

    /// @dev An ownership handover to `pendingOwner` has been requested.
    event OwnershipHandoverRequested(address indexed pendingOwner);

    /// @dev The ownership handover to `pendingOwner` has been canceled.
    event OwnershipHandoverCanceled(address indexed pendingOwner);

    /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
    uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
        0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;

    /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
    uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
        0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;

    /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
    uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
        0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                          STORAGE                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The owner slot is given by:
    /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
    /// It is intentionally chosen to be a high value
    /// to avoid collision with lower slots.
    /// The choice of manual storage layout is to enable compatibility
    /// with both regular and upgradeable contracts.
    bytes32 internal constant _OWNER_SLOT =
        0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;

    /// The ownership handover slot of `newOwner` is given by:
    /// ```
    ///     mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
    ///     let handoverSlot := keccak256(0x00, 0x20)
    /// ```
    /// It stores the expiry timestamp of the two-step ownership handover.
    uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     INTERNAL FUNCTIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
    function _guardInitializeOwner() internal pure virtual returns (bool guard) {}

    /// @dev Initializes the owner directly without authorization guard.
    /// This function must be called upon initialization,
    /// regardless of whether the contract is upgradeable or not.
    /// This is to enable generalization to both regular and upgradeable contracts,
    /// and to save gas in case the initial owner is not the caller.
    /// For performance reasons, this function will not check if there
    /// is an existing owner.
    function _initializeOwner(address newOwner) internal virtual {
        if (_guardInitializeOwner()) {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                if sload(ownerSlot) {
                    mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
                    revert(0x1c, 0x04)
                }
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Store the new value.
                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
            }
        } else {
            /// @solidity memory-safe-assembly
            assembly {
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Store the new value.
                sstore(_OWNER_SLOT, newOwner)
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
            }
        }
    }

    /// @dev Sets the owner directly without authorization guard.
    function _setOwner(address newOwner) internal virtual {
        if (_guardInitializeOwner()) {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                // Store the new value.
                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
            }
        } else {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                // Store the new value.
                sstore(ownerSlot, newOwner)
            }
        }
    }

    /// @dev Throws if the sender is not the owner.
    function _checkOwner() internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // If the caller is not the stored owner, revert.
            if iszero(eq(caller(), sload(_OWNER_SLOT))) {
                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Returns how long a two-step ownership handover is valid for in seconds.
    /// Override to return a different value if needed.
    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
    function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
        return 48 * 3600;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  PUBLIC UPDATE FUNCTIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Allows the owner to transfer the ownership to `newOwner`.
    function transferOwnership(address newOwner) public payable virtual onlyOwner {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(shl(96, newOwner)) {
                mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
                revert(0x1c, 0x04)
            }
        }
        _setOwner(newOwner);
    }

    /// @dev Allows the owner to renounce their ownership.
    function renounceOwnership() public payable virtual onlyOwner {
        _setOwner(address(0));
    }

    /// @dev Request a two-step ownership handover to the caller.
    /// The request will automatically expire in 48 hours (172800 seconds) by default.
    function requestOwnershipHandover() public payable virtual {
        unchecked {
            uint256 expires = block.timestamp + _ownershipHandoverValidFor();
            /// @solidity memory-safe-assembly
            assembly {
                // Compute and set the handover slot to `expires`.
                mstore(0x0c, _HANDOVER_SLOT_SEED)
                mstore(0x00, caller())
                sstore(keccak256(0x0c, 0x20), expires)
                // Emit the {OwnershipHandoverRequested} event.
                log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
            }
        }
    }

    /// @dev Cancels the two-step ownership handover to the caller, if any.
    function cancelOwnershipHandover() public payable virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute and set the handover slot to 0.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, caller())
            sstore(keccak256(0x0c, 0x20), 0)
            // Emit the {OwnershipHandoverCanceled} event.
            log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
        }
    }

    /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
    /// Reverts if there is no existing ownership handover requested by `pendingOwner`.
    function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute and set the handover slot to 0.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, pendingOwner)
            let handoverSlot := keccak256(0x0c, 0x20)
            // If the handover does not exist, or has expired.
            if gt(timestamp(), sload(handoverSlot)) {
                mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
                revert(0x1c, 0x04)
            }
            // Set the handover slot to 0.
            sstore(handoverSlot, 0)
        }
        _setOwner(pendingOwner);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   PUBLIC READ FUNCTIONS                    */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the owner of the contract.
    function owner() public view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := sload(_OWNER_SLOT)
        }
    }

    /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
    function ownershipHandoverExpiresAt(address pendingOwner)
        public
        view
        virtual
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the handover slot.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, pendingOwner)
            // Load the handover slot.
            result := sload(keccak256(0x0c, 0x20))
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         MODIFIERS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Marks a function as only callable by the owner.
    modifier onlyOwner() virtual {
        _checkOwner();
        _;
    }
}
// File: DN404Mirror.sol


pragma solidity ^0.8.0;

/// @title DN404Mirror
/// @notice DN404Mirror provides an interface for interacting with the
/// NFT tokens in a DN404 implementation.
///
/// @author vectorized.eth (@optimizoor)
/// @author Quit (@0xQuit)
/// @author Michael Amadi (@AmadiMichaels)
/// @author cygaar (@0xCygaar)
/// @author Thomas (@0xjustadev)
/// @author Harrison (@PopPunkOnChain)
///
/// @dev Note:
/// - The ERC721 data is stored in the base DN404 contract.
contract DN404Mirror {
    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                           EVENTS                           */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

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

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

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`.
    uint256 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                        CUSTOM ERRORS                       */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Thrown when a call for an NFT function did not originate
    /// from the base DN404 contract.
    error Unauthorized();

    /// @dev Thrown when transferring an NFT to a contract address that
    /// does not implement ERC721Receiver.
    error TransferToNonERC721ReceiverImplementer();

    /// @dev Thrown when linking to the DN404 base contract and the
    /// DN404 supportsInterface check fails or the call reverts.
    error CannotLink();

    /// @dev Thrown when a linkMirrorContract call is received and the
    /// NFT mirror contract has already been linked to a DN404 base contract.
    error AlreadyLinked();

    /// @dev Thrown when retrieving the rootERC20 address when a link has not
    /// been established.
    error NotLinked();

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                          STORAGE                           */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Struct contain the NFT mirror contract storage.
    struct DN404NFTStorage {
        address rootERC20;
        address deployer;
    }

    /// @dev Returns a storage pointer for DN404NFTStorage.
    function _getDN404NFTStorage() internal pure returns (DN404NFTStorage storage $) {
        /// @solidity memory-safe-assembly
        assembly {
            // keccak256(abi.encode(uint256(keccak256("dn404.nft")) - 1)) & ~bytes32(uint256(0xff))
            $.slot := 0xe8cb618a1de8ad2a6a7b358523c369cb09f40cc15da64205134c7e55c6a86700
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                        CONSTRUCTOR                         */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    constructor(address deployer) {
        // For non-proxies, we will store the deployer so that only the deployer can
        // link the root contract.
        _getDN404NFTStorage().deployer = deployer;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                     ERC721 OPERATIONS                      */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the token collection name from the base DN404 contract.
    function name() public view virtual returns (string memory result) {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            mstore(result, 0x06fdde03) // `name()`.
            if iszero(staticcall(gas(), root, add(result, 0x1c), 0x04, 0x00, 0x00)) {
                returndatacopy(result, 0x00, returndatasize())
                revert(result, returndatasize())
            }
            returndatacopy(0x00, 0x00, 0x20)
            returndatacopy(result, mload(0x00), 0x20)
            returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result))
            mstore(0x40, add(add(result, 0x20), mload(result)))
        }
    }

    /// @dev Returns the token collection symbol from the base DN404 contract.
    function symbol() public view virtual returns (string memory result) {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            mstore(result, 0x95d89b41) // `symbol()`.
            if iszero(staticcall(gas(), root, add(result, 0x1c), 0x04, 0x00, 0x00)) {
                returndatacopy(result, 0x00, returndatasize())
                revert(result, returndatasize())
            }
            returndatacopy(0x00, 0x00, 0x20)
            returndatacopy(result, mload(0x00), 0x20)
            returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result))
            mstore(0x40, add(add(result, 0x20), mload(result)))
        }
    }

    /// @dev Returns the Uniform Resource Identifier (URI) for token `id` from the base DN404 contract.
    function tokenURI(uint256 id) public view virtual returns (string memory result) {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            mstore(result, 0xc87b56dd) // `tokenURI()`.
            mstore(add(result, 0x20), id)
            if iszero(staticcall(gas(), root, add(result, 0x1c), 0x24, 0x00, 0x00)) {
                returndatacopy(result, 0x00, returndatasize())
                revert(result, returndatasize())
            }
            returndatacopy(0x00, 0x00, 0x20)
            returndatacopy(result, mload(0x00), 0x20)
            returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result))
            mstore(0x40, add(add(result, 0x20), mload(result)))
        }
    }

    /// @dev Returns the total NFT supply from the base DN404 contract.
    function totalSupply() public view returns (uint256 result) {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0xe2c79281) // `totalNFTSupply()`.
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), root, 0x1c, 0x04, 0x00, 0x20))
            ) {
                returndatacopy(mload(0x40), 0x00, returndatasize())
                revert(mload(0x40), returndatasize())
            }
            result := mload(0x00)
        }
    }

    /// @dev Returns the number of NFT tokens owned by `owner` from the base DN404 contract.
    ///
    /// Requirements:
    /// - `owner` must not be the zero address.
    function balanceOf(address owner) public view virtual returns (uint256 result) {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0xf5b100ea) // `balanceOfNFT(address)`.
            mstore(0x20, shr(96, shl(96, owner)))
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), root, 0x1c, 0x24, 0x00, 0x20))
            ) {
                returndatacopy(mload(0x40), 0x00, returndatasize())
                revert(mload(0x40), returndatasize())
            }
            result := mload(0x00)
        }
    }

    /// @dev Returns the owner of token `id` from the base DN404 contract.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function ownerOf(uint256 id) public view virtual returns (address result) {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x6352211e) // `ownerOf(uint256)`.
            mstore(0x20, id)
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), root, 0x1c, 0x24, 0x00, 0x20))
            ) {
                returndatacopy(mload(0x40), 0x00, returndatasize())
                revert(mload(0x40), returndatasize())
            }
            result := shr(96, shl(96, mload(0x00)))
        }
    }

    /// @dev Sets `spender` as the approved account to manage token `id` in the base DN404 contract.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    /// - The caller must be the owner of the token,
    ///   or an approved operator for the token owner.
    ///
    /// Emits an {Approval} event.
    function approve(address spender, uint256 id) public virtual {
        address root = rootERC20();
        address owner;
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(0x00, 0xd10b6e0c) // `approveNFT(address,uint256,address)`.
            mstore(0x20, shr(96, shl(96, spender)))
            mstore(0x40, id)
            mstore(0x60, caller())
            if iszero(
                and(
                    gt(returndatasize(), 0x1f),
                    call(gas(), root, callvalue(), 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                returndatacopy(m, 0x00, returndatasize())
                revert(m, returndatasize())
            }
            mstore(0x40, m) // Restore the free memory pointer.
            mstore(0x60, 0) // Restore the zero pointer.
            owner := shr(96, shl(96, mload(0x00)))
        }
        emit Approval(owner, spender, id);
    }

    /// @dev Returns the account approved to manage token `id` from the base DN404 contract.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function getApproved(uint256 id) public view virtual returns (address result) {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x081812fc) // `getApproved(uint256)`.
            mstore(0x20, id)
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), root, 0x1c, 0x24, 0x00, 0x20))
            ) {
                returndatacopy(mload(0x40), 0x00, returndatasize())
                revert(mload(0x40), returndatasize())
            }
            result := shr(96, shl(96, mload(0x00)))
        }
    }

    /// @dev Sets whether `operator` is approved to manage the tokens of the caller in the base DN404 contract.
    ///
    /// Emits an {ApprovalForAll} event.
    function setApprovalForAll(address operator, bool approved) public virtual {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(0x00, 0x813500fc) // `setApprovalForAll(address,bool,address)`.
            mstore(0x20, shr(96, shl(96, operator)))
            mstore(0x40, iszero(iszero(approved)))
            mstore(0x60, caller())
            if iszero(
                and(
                    and(eq(mload(0x00), 1), gt(returndatasize(), 0x1f)),
                    call(gas(), root, callvalue(), 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                returndatacopy(m, 0x00, returndatasize())
                revert(m, returndatasize())
            }
            mstore(0x40, m) // Restore the free memory pointer.
            mstore(0x60, 0) // Restore the zero pointer.
        }
        emit ApprovalForAll(msg.sender, operator, approved);
    }

    /// @dev Returns whether `operator` is approved to manage the tokens of `owner` from the base DN404 contract.
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        returns (bool result)
    {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(0x00, 0xe985e9c5) // `isApprovedForAll(address,address)`.
            mstore(0x20, shr(96, shl(96, owner)))
            mstore(0x40, shr(96, shl(96, operator)))
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), root, 0x1c, 0x44, 0x00, 0x20))
            ) {
                returndatacopy(m, 0x00, returndatasize())
                revert(m, returndatasize())
            }
            mstore(0x40, m) // Restore the free memory pointer.
            result := iszero(iszero(mload(0x00)))
        }
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function transferFrom(address from, address to, uint256 id) public virtual {
        address root = rootERC20();
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(m, 0xe5eb36c8) // `transferFromNFT(address,address,uint256,address)`.
            mstore(add(m, 0x20), shr(96, shl(96, from)))
            mstore(add(m, 0x40), shr(96, shl(96, to)))
            mstore(add(m, 0x60), id)
            mstore(add(m, 0x80), caller())
            if iszero(
                and(
                    and(eq(mload(0x00), 1), gt(returndatasize(), 0x1f)),
                    call(gas(), root, callvalue(), add(m, 0x1c), 0x84, 0x00, 0x20)
                )
            ) {
                returndatacopy(m, 0x00, returndatasize())
                revert(m, returndatasize())
            }
        }
        emit Transfer(from, to, id);
    }

    /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`.
    function safeTransferFrom(address from, address to, uint256 id) public payable virtual {
        transferFrom(from, to, id);

        if (_hasCode(to)) _checkOnERC721Received(from, to, id, "");
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    /// - 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 id, bytes calldata data)
        public
        virtual
    {
        transferFrom(from, to, id);

        if (_hasCode(to)) _checkOnERC721Received(from, to, id, data);
    }

    /// @dev Returns true if this contract implements the interface defined by `interfaceId`.
    /// See: https://eips.ethereum.org/EIPS/eip-165
    /// This function call must use less than 30000 gas.
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            let s := shr(224, interfaceId)
            // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f.
            result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f))
        }
    }

    /// @dev Returns if `a` has bytecode of non-zero length.
    function _hasCode(address a) private view returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := extcodesize(a) // Can handle dirty upper bits.
        }
    }

    /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`.
    /// Reverts if the target does not support the function correctly.
    function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data)
        private
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the calldata.
            let m := mload(0x40)
            let onERC721ReceivedSelector := 0x150b7a02
            mstore(m, onERC721ReceivedSelector)
            mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`.
            mstore(add(m, 0x40), shr(96, shl(96, from)))
            mstore(add(m, 0x60), id)
            mstore(add(m, 0x80), 0x80)
            let n := mload(data)
            mstore(add(m, 0xa0), n)
            if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) }
            // Revert if the call reverts.
            if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) {
                if returndatasize() {
                    // Bubble up the revert if the call reverts.
                    returndatacopy(m, 0x00, returndatasize())
                    revert(m, returndatasize())
                }
            }
            // Load the returndata and compare it.
            if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) {
                mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                     MIRROR OPERATIONS                      */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the address of the base DN404 contract.
    function rootERC20() public view returns (address root) {
        root = _getDN404NFTStorage().rootERC20;
        if (root == address(0)) revert NotLinked();
    }

    /// @dev Fallback modifier to execute calls from the base DN404 contract.
    modifier dn404NFTFallback() virtual {
        DN404NFTStorage storage $ = _getDN404NFTStorage();

        uint256 fnSelector = _calldataload(0x00) >> 224;

        // `logTransfer(uint256[])`.
        if (fnSelector == 0x263c69d6) {
            if (msg.sender != $.rootERC20) revert Unauthorized();
            /// @solidity memory-safe-assembly
            assembly {
                // When returndatacopy copies 1 or more out-of-bounds bytes, it reverts.
                returndatacopy(0x00, returndatasize(), lt(calldatasize(), 0x20))
                let o := add(0x24, calldataload(0x04)) // Packed logs offset.
                returndatacopy(0x00, returndatasize(), lt(calldatasize(), o))
                let end := add(o, shl(5, calldataload(sub(o, 0x20))))
                returndatacopy(0x00, returndatasize(), lt(calldatasize(), end))

                for {} iszero(eq(o, end)) { o := add(0x20, o) } {
                    let d := calldataload(o) // Entry in the packed logs.
                    let a := shr(96, d) // The address.
                    let b := and(1, d) // Whether it is a burn.
                    log4(
                        codesize(),
                        0x00,
                        _TRANSFER_EVENT_SIGNATURE,
                        mul(a, b),
                        mul(a, iszero(b)),
                        shr(168, shl(160, d))
                    )
                }
                mstore(0x00, 0x01)
                return(0x00, 0x20)
            }
        }
        // `linkMirrorContract(address)`.
        if (fnSelector == 0x0f4599e5) {
            if ($.deployer != address(0)) {
                if (address(uint160(_calldataload(0x04))) != $.deployer) {
                    revert Unauthorized();
                }
            }
            if ($.rootERC20 != address(0)) revert AlreadyLinked();
            $.rootERC20 = msg.sender;
            /// @solidity memory-safe-assembly
            assembly {
                mstore(0x00, 0x01)
                return(0x00, 0x20)
            }
        }
        _;
    }

    /// @dev Fallback function for calls from base DN404 contract.
    fallback() external payable virtual dn404NFTFallback {}

    receive() external payable virtual {}

    /// @dev Returns the calldata value at `offset`.
    function _calldataload(uint256 offset) private pure returns (uint256 value) {
        /// @solidity memory-safe-assembly
        assembly {
            value := calldataload(offset)
        }
    }
}
// File: solady/utils/LibMap.sol


pragma solidity ^0.8.4;

/// @notice Library for storage of packed unsigned integers.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibMap.sol)
library LibMap {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                          STRUCTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev A uint8 map in storage.
    struct Uint8Map {
        mapping(uint256 => uint256) map;
    }

    /// @dev A uint16 map in storage.
    struct Uint16Map {
        mapping(uint256 => uint256) map;
    }

    /// @dev A uint32 map in storage.
    struct Uint32Map {
        mapping(uint256 => uint256) map;
    }

    /// @dev A uint40 map in storage. Useful for storing timestamps up to 34841 A.D.
    struct Uint40Map {
        mapping(uint256 => uint256) map;
    }

    /// @dev A uint64 map in storage.
    struct Uint64Map {
        mapping(uint256 => uint256) map;
    }

    /// @dev A uint128 map in storage.
    struct Uint128Map {
        mapping(uint256 => uint256) map;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     GETTERS / SETTERS                      */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the uint8 value at `index` in `map`.
    function get(Uint8Map storage map, uint256 index) internal view returns (uint8 result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, map.slot)
            mstore(0x00, shr(5, index))
            result := byte(and(31, not(index)), sload(keccak256(0x00, 0x40)))
        }
    }

    /// @dev Updates the uint8 value at `index` in `map`.
    function set(Uint8Map storage map, uint256 index, uint8 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, map.slot)
            mstore(0x00, shr(5, index))
            let s := keccak256(0x00, 0x40) // Storage slot.
            mstore(0x00, sload(s))
            mstore8(and(31, not(index)), value)
            sstore(s, mload(0x00))
        }
    }

    /// @dev Returns the uint16 value at `index` in `map`.
    function get(Uint16Map storage map, uint256 index) internal view returns (uint16 result) {
        result = uint16(map.map[index >> 4] >> ((index & 15) << 4));
    }

    /// @dev Updates the uint16 value at `index` in `map`.
    function set(Uint16Map storage map, uint256 index, uint16 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, map.slot)
            mstore(0x00, shr(4, index))
            let s := keccak256(0x00, 0x40) // Storage slot.
            let o := shl(4, and(index, 15)) // Storage slot offset (bits).
            let v := sload(s) // Storage slot value.
            let m := 0xffff // Value mask.
            sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value)))))
        }
    }

    /// @dev Returns the uint32 value at `index` in `map`.
    function get(Uint32Map storage map, uint256 index) internal view returns (uint32 result) {
        result = uint32(map.map[index >> 3] >> ((index & 7) << 5));
    }

    /// @dev Updates the uint32 value at `index` in `map`.
    function set(Uint32Map storage map, uint256 index, uint32 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, map.slot)
            mstore(0x00, shr(3, index))
            let s := keccak256(0x00, 0x40) // Storage slot.
            let o := shl(5, and(index, 7)) // Storage slot offset (bits).
            let v := sload(s) // Storage slot value.
            let m := 0xffffffff // Value mask.
            sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value)))))
        }
    }

    /// @dev Returns the uint40 value at `index` in `map`.
    function get(Uint40Map storage map, uint256 index) internal view returns (uint40 result) {
        unchecked {
            result = uint40(map.map[index / 6] >> ((index % 6) * 40));
        }
    }

    /// @dev Updates the uint40 value at `index` in `map`.
    function set(Uint40Map storage map, uint256 index, uint40 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, map.slot)
            mstore(0x00, div(index, 6))
            let s := keccak256(0x00, 0x40) // Storage slot.
            let o := mul(40, mod(index, 6)) // Storage slot offset (bits).
            let v := sload(s) // Storage slot value.
            let m := 0xffffffffff // Value mask.
            sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value)))))
        }
    }

    /// @dev Returns the uint64 value at `index` in `map`.
    function get(Uint64Map storage map, uint256 index) internal view returns (uint64 result) {
        result = uint64(map.map[index >> 2] >> ((index & 3) << 6));
    }

    /// @dev Updates the uint64 value at `index` in `map`.
    function set(Uint64Map storage map, uint256 index, uint64 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, map.slot)
            mstore(0x00, shr(2, index))
            let s := keccak256(0x00, 0x40) // Storage slot.
            let o := shl(6, and(index, 3)) // Storage slot offset (bits).
            let v := sload(s) // Storage slot value.
            let m := 0xffffffffffffffff // Value mask.
            sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value)))))
        }
    }

    /// @dev Returns the uint128 value at `index` in `map`.
    function get(Uint128Map storage map, uint256 index) internal view returns (uint128 result) {
        result = uint128(map.map[index >> 1] >> ((index & 1) << 7));
    }

    /// @dev Updates the uint128 value at `index` in `map`.
    function set(Uint128Map storage map, uint256 index, uint128 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, map.slot)
            mstore(0x00, shr(1, index))
            let s := keccak256(0x00, 0x40) // Storage slot.
            let o := shl(7, and(index, 1)) // Storage slot offset (bits).
            let v := sload(s) // Storage slot value.
            let m := 0xffffffffffffffffffffffffffffffff // Value mask.
            sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value)))))
        }
    }

    /// @dev Returns the value at `index` in `map`.
    function get(mapping(uint256 => uint256) storage map, uint256 index, uint256 bitWidth)
        internal
        view
        returns (uint256 result)
    {
        unchecked {
            uint256 d = _rawDiv(256, bitWidth); // Bucket size.
            uint256 m = (1 << bitWidth) - 1; // Value mask.
            result = (map[_rawDiv(index, d)] >> (_rawMod(index, d) * bitWidth)) & m;
        }
    }

    /// @dev Updates the value at `index` in `map`.
    function set(
        mapping(uint256 => uint256) storage map,
        uint256 index,
        uint256 value,
        uint256 bitWidth
    ) internal {
        unchecked {
            uint256 d = _rawDiv(256, bitWidth); // Bucket size.
            uint256 m = (1 << bitWidth) - 1; // Value mask.
            uint256 o = _rawMod(index, d) * bitWidth; // Storage slot offset (bits).
            map[_rawDiv(index, d)] ^= (((map[_rawDiv(index, d)] >> o) ^ value) & m) << o;
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       BINARY SEARCH                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // The following functions search in the range of [`start`, `end`)
    // (i.e. `start <= index < end`).
    // The range must be sorted in ascending order.
    // `index` precedence: equal to > nearest before > nearest after.
    // An invalid search range will simply return `(found = false, index = start)`.

    /// @dev Returns whether `map` contains `needle`, and the index of `needle`.
    function searchSorted(Uint8Map storage map, uint8 needle, uint256 start, uint256 end)
        internal
        view
        returns (bool found, uint256 index)
    {
        return searchSorted(map.map, needle, start, end, 8);
    }

    /// @dev Returns whether `map` contains `needle`, and the index of `needle`.
    function searchSorted(Uint16Map storage map, uint16 needle, uint256 start, uint256 end)
        internal
        view
        returns (bool found, uint256 index)
    {
        return searchSorted(map.map, needle, start, end, 16);
    }

    /// @dev Returns whether `map` contains `needle`, and the index of `needle`.
    function searchSorted(Uint32Map storage map, uint32 needle, uint256 start, uint256 end)
        internal
        view
        returns (bool found, uint256 index)
    {
        return searchSorted(map.map, needle, start, end, 32);
    }

    /// @dev Returns whether `map` contains `needle`, and the index of `needle`.
    function searchSorted(Uint40Map storage map, uint40 needle, uint256 start, uint256 end)
        internal
        view
        returns (bool found, uint256 index)
    {
        return searchSorted(map.map, needle, start, end, 40);
    }

    /// @dev Returns whether `map` contains `needle`, and the index of `needle`.
    function searchSorted(Uint64Map storage map, uint64 needle, uint256 start, uint256 end)
        internal
        view
        returns (bool found, uint256 index)
    {
        return searchSorted(map.map, needle, start, end, 64);
    }

    /// @dev Returns whether `map` contains `needle`, and the index of `needle`.
    function searchSorted(Uint128Map storage map, uint128 needle, uint256 start, uint256 end)
        internal
        view
        returns (bool found, uint256 index)
    {
        return searchSorted(map.map, needle, start, end, 128);
    }

    /// @dev Returns whether `map` contains `needle`, and the index of `needle`.
    function searchSorted(
        mapping(uint256 => uint256) storage map,
        uint256 needle,
        uint256 start,
        uint256 end,
        uint256 bitWidth
    ) internal view returns (bool found, uint256 index) {
        unchecked {
            if (start >= end) end = start;
            uint256 t;
            uint256 o = start - 1; // Offset to derive the actual index.
            uint256 l = 1; // Low.
            uint256 d = _rawDiv(256, bitWidth); // Bucket size.
            uint256 m = (1 << bitWidth) - 1; // Value mask.
            uint256 h = end - start; // High.
            while (true) {
                index = (l & h) + ((l ^ h) >> 1);
                if (l > h) break;
                t = (map[_rawDiv(index + o, d)] >> (_rawMod(index + o, d) * bitWidth)) & m;
                if (t == needle) break;
                if (needle <= t) h = index - 1;
                else l = index + 1;
            }
            /// @solidity memory-safe-assembly
            assembly {
                m := or(iszero(index), iszero(bitWidth))
                found := iszero(or(xor(t, needle), m))
                index := add(o, xor(index, mul(xor(index, 1), m)))
            }
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      PRIVATE HELPERS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns `x / y`, returning 0 if `y` is zero.
    function _rawDiv(uint256 x, uint256 y) private pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := div(x, y)
        }
    }

    /// @dev Returns `x % y`, returning 0 if `y` is zero.
    function _rawMod(uint256 x, uint256 y) private pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := mod(x, y)
        }
    }
}
// File: DN404.sol


pragma solidity ^0.8.4;


/// @title DN404
/// @notice DN404 is a hybrid ERC20 and ERC721 implementation that mints
/// and burns NFTs based on an account's ERC20 token balance.
///
/// @author vectorized.eth (@optimizoor)
/// @author Quit (@0xQuit)
/// @author Michael Amadi (@AmadiMichaels)
/// @author cygaar (@0xCygaar)
/// @author Thomas (@0xjustadev)
/// @author Harrison (@PopPunkOnChain)
///
/// @dev Note:
/// - The ERC721 data is stored in this base DN404 contract, however a
///   DN404Mirror contract ***MUST*** be deployed and linked during
///   initialization.
abstract contract DN404 {
    using LibMap for *;

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                           EVENTS                           */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Emitted when `amount` tokens is transferred from `from` to `to`.
    event Transfer(address indexed from, address indexed to, uint256 amount);

    /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`.
    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /// @dev Emitted when `target` sets their skipNFT flag to `status`.
    event SkipNFTSet(address indexed target, bool status);

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                        CUSTOM ERRORS                       */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Thrown when attempt to initialize the contract when it has already been initialized.
    error DNAlreadyInitialized();

    /// @dev Thrown when attempting to transfer or burn more tokens than sender's balance.
    error InsufficientBalance();

    /// @dev Thrown when a spender attempts to transfer tokens with an insufficient allowance.
    error InsufficientAllowance();

    /// @dev Thrown when minting an amount of tokens that would overflow the max tokens.
    error InvalidTotalNFTSupply();

    /// @dev Thrown when a call for an NFT function did not originate from the mirror contract.
    error UnauthorizedSender();

    /// @dev Thrown when attempting to transfer tokens to the zero address.
    error TransferToZeroAddress();

    /// @dev Thrown when initializing the contract and mirror address is provided as the zero address.
    error MirrorAddressIsZero();

    /// @dev Thrown when the link call to the mirror contract reverts.
    error LinkMirrorContractFailed();

    /// @dev Thrown when setting an NFT token approval and the caller is not the owner or an approved operator.
    error ApprovalCallerNotOwnerNorApproved();

    /// @dev Thrown when transferring an NFT and the caller is not the owner or an approved operator.
    error TransferCallerNotOwnerNorApproved();

    /// @dev Thrown when transferring an NFT and the from address is not the current owner.
    error TransferFromIncorrectOwner();

    /// @dev Thrown when checking the owner or approved address for an NFT that does not exist.
    error TokenDoesNotExist();

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                         CONSTANTS                          */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Amount of token balance that is equal to one NFT.
    uint256 private constant _WAD = 1000000000000000000;

    /// @dev The maximum tokenId allowed for an NFT.
    uint256 private constant _MAX_TOKEN_ID = 0xffffffff;

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                          STORAGE                           */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Struct containing an address's token data and settings.
    struct AddressData {
        // Set true when address data storage has been initialized.
        bool initialized;
        // If the account should skip NFT minting.
        bool skipNFT;
        // The alias for the address. Zero means absence of an alias.
        uint32 addressAlias;
        // The number of NFT tokens.
        uint32 ownedLength;
        // The token balance in wei.
        uint96 balance;
    }

    /// @dev Struct containing the base token contract storage.
    struct DN404Storage {
        // Current number of address aliases assigned.
        uint32 numAliases;
        // Next tokenId to assign for an NFT mint.
        uint32 nextTokenId;
        // Total supply of minted NFTs.
        uint32 totalNFTSupply;
        // Total supply of tokens.
        uint96 totalTokenSupply;
        // Address of the NFT mirror contract.
        address mirrorERC721;
        // Mapping of a user alias number to their address.
        mapping(uint32 => address) aliasToAddress;
        // Mapping of user operator approvals for NFTs.
        mapping(address => mapping(address => bool)) operatorApprovals;
        // Mapping of NFT token approvals to approved operators.
        mapping(uint256 => address) tokenApprovals;
        // Mapping of user allowances for token spenders.
        mapping(address => mapping(address => uint256)) allowance;
        // Mapping of NFT tokenIds owned by an address.
        mapping(address => LibMap.Uint32Map) owned;
        // Even indices: owner aliases. Odd indices: owned indices.
        LibMap.Uint32Map oo;
        // Mapping of user account AddressData
        mapping(address => AddressData) addressData;
    }

    /// @dev Returns a storage pointer for DN404Storage.
    function _getDN404Storage() internal pure returns (DN404Storage storage $) {
        /// @solidity memory-safe-assembly
        assembly {
            // keccak256(abi.encode(uint256(keccak256("dn404")) - 1)) & ~bytes32(uint256(0xff))
            $.slot := 0x61dd0d320a11019af7688ced18637b1235059a4e8141ed71cfccbe9f2da16600
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                         INITIALIZER                        */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Initializes the DN404 contract with an `initialTokenSupply`, `initialTokenOwner` and `mirror` NFT contract address.
    function _initializeDN404(uint96 initialTokenSupply, address initialSupplyOwner, address mirror)
        internal
        virtual
    {
        DN404Storage storage $ = _getDN404Storage();

        if ($.nextTokenId != 0) revert DNAlreadyInitialized();

        if (mirror == address(0)) revert MirrorAddressIsZero();
        _linkMirrorContract(mirror);

        $.nextTokenId = 1;
        $.mirrorERC721 = mirror;

        if (initialTokenSupply > 0) {
            if (initialSupplyOwner == address(0)) revert TransferToZeroAddress();
            if (initialTokenSupply / _WAD > _MAX_TOKEN_ID - 1) revert InvalidTotalNFTSupply();

            $.totalTokenSupply = initialTokenSupply;
            AddressData storage initialOwnerAddressData = _addressData(initialSupplyOwner);
            initialOwnerAddressData.balance = initialTokenSupply;

            emit Transfer(address(0), initialSupplyOwner, initialTokenSupply);

            _setSkipNFT(initialSupplyOwner, true);
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*               METADATA FUNCTIONS TO OVERRIDE               */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the name of the token.
    function name() public view virtual returns (string memory);

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

    /// @dev Returns the Uniform Resource Identifier (URI) for token `id`.
    function tokenURI(uint256 id) public view virtual returns (string memory);

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                      ERC20 OPERATIONS                      */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the decimals places of the token.
    function decimals() public pure returns (uint8) {
        return 18;
    }

    /// @dev Returns the amount of tokens in existence.
    function totalSupply() public view virtual returns (uint256) {
        return uint256(_getDN404Storage().totalTokenSupply);
    }

    /// @dev Returns the amount of tokens owned by `owner`.
    function balanceOf(address owner) public view virtual returns (uint256) {
        return _getDN404Storage().addressData[owner].balance;
    }

    /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`.
    function allowance(address owner, address spender) public view returns (uint256) {
        return _getDN404Storage().allowance[owner][spender];
    }

    /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
    ///
    /// Emits a {Approval} event.
    function approve(address spender, uint256 amount) public virtual returns (bool) {
        DN404Storage storage $ = _getDN404Storage();

        $.allowance[msg.sender][spender] = amount;

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

        return true;
    }

    /// @dev Transfer `amount` tokens from the caller to `to`.
    ///
    /// Will burn sender NFTs if balance after transfer is less than
    /// the amount required to support the current NFT balance.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Requirements:
    /// - `from` must at least have `amount`.
    ///
    /// Emits a {Transfer} event.
    function transfer(address to, uint256 amount) public virtual returns (bool) {
        _transfer(msg.sender, to, amount);
        return true;
    }

    /// @dev Transfers `amount` tokens from `from` to `to`.
    ///
    /// Note: Does not update the allowance if it is the maximum uint256 value.
    ///
    /// Will burn sender NFTs if balance after transfer is less than
    /// the amount required to support the current NFT balance.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Requirements:
    /// - `from` must at least have `amount`.
    /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`.
    ///
    /// Emits a {Transfer} event.
    function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {
        DN404Storage storage $ = _getDN404Storage();

        uint256 allowed = $.allowance[from][msg.sender];

        if (allowed != type(uint256).max) {
            if (amount > allowed) revert InsufficientAllowance();
            unchecked {
                $.allowance[from][msg.sender] = allowed - amount;
            }
        }

        _transfer(from, to, amount);

        return true;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                 SHARED TRANSFER OPERATIONS                 */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Struct containing packed log data for Transfer events to be emitted by the mirror NFT contract.
    struct _PackedLogs {
        uint256[] logs;
        uint256 offset;
    }

    /// @dev Initiates memory allocation for packed logs with `n` log items.
    function _packedLogsMalloc(uint256 n) private pure returns (_PackedLogs memory p) {
        /// @solidity memory-safe-assembly
        assembly {
            let logs := add(mload(0x40), 0x40) // Offset by 2 words for `_packedLogsSend`.
            mstore(logs, n)
            let offset := add(0x20, logs)
            mstore(0x40, add(offset, shl(5, n)))
            mstore(p, logs)
            mstore(add(0x20, p), offset)
        }
    }

    /// @dev Adds a packed log item to `p` with address `a`, tokenId `id` and burn flag `burnBit`
    function _packedLogsAppend(_PackedLogs memory p, address a, uint256 id, uint256 burnBit)
        private
        pure
    {
        /// @solidity memory-safe-assembly
        assembly {
            let offset := mload(add(0x20, p))
            mstore(offset, or(or(shl(96, a), shl(8, id)), burnBit))
            mstore(add(0x20, p), add(offset, 0x20))
        }
    }

    /// @dev Calls the `mirror` NFT contract to emit Transfer events for packed logs `p`
    function _packedLogsSend(_PackedLogs memory p, address mirror) private {
        /// @solidity memory-safe-assembly
        assembly {
            let logs := mload(p)
            let o := sub(logs, 0x40) // Start of calldata to send.
            mstore(o, 0x263c69d6) // `logTransfer(uint256[])`.
            mstore(add(o, 0x20), 0x20) // Offset of `logs` in the calldata to send.
            let n := add(0x44, shl(5, mload(logs))) // Length of calldata to send.
            if iszero(
                and(
                    and(eq(mload(0x00), 1), gt(returndatasize(), 0x1f)),
                    call(gas(), mirror, 0, add(o, 0x1c), n, 0x00, 0x20)
                )
            ) { revert(0x00, 0x00) }
        }
    }

    /// @dev Struct of temporary variables for transfers.
    struct _TransferTemps {
        uint256 nftAmountToBurn;
        uint256 nftAmountToMint;
        uint256 fromBalance;
        uint256 toBalance;
        uint256 fromOwnedLength;
        uint256 toOwnedLength;
    }

    /// @dev You can override to return a pseudorandom value to skip
    /// taking token IDs from the burned stack probabilistically.
    function _skipBurnedStack(uint256) internal pure virtual returns (bool) {
        return false;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  INTERNAL MINT FUNCTIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Mints `amount` tokens to `to`, increasing the total supply.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Emits a {Transfer} event.
    function _mint(address to, uint256 amount) internal {
        if (to == address(0)) revert TransferToZeroAddress();

        DN404Storage storage $ = _getDN404Storage();

        AddressData storage toAddressData = _addressData(to);

        unchecked {
            uint256 currentTokenSupply = uint256($.totalTokenSupply) + amount;
            if (currentTokenSupply / _WAD > _MAX_TOKEN_ID - 1) revert InvalidTotalNFTSupply();
            $.totalTokenSupply = uint96(currentTokenSupply);

            uint256 toBalance = toAddressData.balance + amount;
            toAddressData.balance = uint96(toBalance);

            if (!toAddressData.skipNFT) {
                LibMap.Uint32Map storage toOwned = $.owned[to];
                uint256 toIndex = toAddressData.ownedLength;
                uint256 toEnd = toBalance / _WAD;
                _PackedLogs memory packedLogs = _packedLogsMalloc(_zeroFloorSub(toEnd, toIndex));

                if (packedLogs.logs.length != 0) {
                    uint256 maxNFTId = $.totalTokenSupply / _WAD;
                    uint32 toAlias = _registerAndResolveAlias(toAddressData, to);
                    uint256 id = $.nextTokenId;
                    $.totalNFTSupply += uint32(packedLogs.logs.length);
                    toAddressData.ownedLength = uint32(toEnd);
                    // Mint loop.
                    do {
                        while ($.oo.get(_ownershipIndex(id)) != 0) {
                            if (++id > maxNFTId) id = 1;
                        }
                        toOwned.set(toIndex, uint32(id));
                        $.oo.set(_ownershipIndex(id), toAlias);
                        $.oo.set(_ownedIndex(id), uint32(toIndex++));
                        _packedLogsAppend(packedLogs, to, id, 0);
                        if (++id > maxNFTId) id = 1;
                    } while (toIndex != toEnd);
                    $.nextTokenId = uint32(id);
                    _packedLogsSend(packedLogs, $.mirrorERC721);
                }
            }
        }
        emit Transfer(address(0), to, amount);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  INTERNAL BURN FUNCTIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Burns `amount` tokens from `from`, reducing the total supply.
    ///
    /// Will burn sender NFTs if balance after transfer is less than
    /// the amount required to support the current NFT balance.
    ///
    /// Emits a {Transfer} event.
    function _burn(address from, uint256 amount) internal {
        DN404Storage storage $ = _getDN404Storage();

        AddressData storage fromAddressData = _addressData(from);

        uint256 fromBalance = fromAddressData.balance;
        if (amount > fromBalance) revert InsufficientBalance();

        uint256 currentTokenSupply = $.totalTokenSupply;

        unchecked {
            fromBalance -= amount;
            fromAddressData.balance = uint96(fromBalance);
            currentTokenSupply -= amount;
            $.totalTokenSupply = uint96(currentTokenSupply);

            LibMap.Uint32Map storage fromOwned = $.owned[from];
            uint256 fromIndex = fromAddressData.ownedLength;
            uint256 nftAmountToBurn = _zeroFloorSub(fromIndex, fromBalance / _WAD);

            if (nftAmountToBurn != 0) {
                $.totalNFTSupply -= uint32(nftAmountToBurn);

                _PackedLogs memory packedLogs = _packedLogsMalloc(nftAmountToBurn);

                uint256 fromEnd = fromIndex - nftAmountToBurn;
                // Burn loop.
                do {
                    uint256 id = fromOwned.get(--fromIndex);
                    $.oo.set(_ownedIndex(id), 0);
                    $.oo.set(_ownershipIndex(id), 0);
                    delete $.tokenApprovals[id];
                    _packedLogsAppend(packedLogs, from, id, 1);
                } while (fromIndex != fromEnd);

                fromAddressData.ownedLength = uint32(fromIndex);
                _packedLogsSend(packedLogs, $.mirrorERC721);
            }
        }
        emit Transfer(from, address(0), amount);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                INTERNAL TRANSFER FUNCTIONS                 */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Moves `amount` of tokens from `from` to `to`.
    ///
    /// Will burn sender NFTs if balance after transfer is less than
    /// the amount required to support the current NFT balance.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Emits a {Transfer} event.
    function _transfer(address from, address to, uint256 amount) internal {
        if (to == address(0)) revert TransferToZeroAddress();

        DN404Storage storage $ = _getDN404Storage();

        AddressData storage fromAddressData = _addressData(from);
        AddressData storage toAddressData = _addressData(to);

        _TransferTemps memory t;
        t.fromOwnedLength = fromAddressData.ownedLength;
        t.toOwnedLength = toAddressData.ownedLength;
        t.fromBalance = fromAddressData.balance;

        if (amount > t.fromBalance) revert InsufficientBalance();

        unchecked {
            t.fromBalance -= amount;
            fromAddressData.balance = uint96(t.fromBalance);
            toAddressData.balance = uint96(t.toBalance = toAddressData.balance + amount);

            t.nftAmountToBurn = _zeroFloorSub(t.fromOwnedLength, t.fromBalance / _WAD);

            if (!toAddressData.skipNFT) {
                t.nftAmountToMint = _zeroFloorSub(t.toBalance / _WAD, t.toOwnedLength);
            }

            _PackedLogs memory packedLogs = _packedLogsMalloc(t.nftAmountToBurn + t.nftAmountToMint);

            if (t.nftAmountToBurn != 0) {
                LibMap.Uint32Map storage fromOwned = $.owned[from];
                uint256 fromIndex = t.fromOwnedLength;
                uint256 fromEnd = fromIndex - t.nftAmountToBurn;
                $.totalNFTSupply -= uint32(t.nftAmountToBurn);
                // Burn loop.
                do {
                    uint256 id = fromOwned.get(--fromIndex);
                    $.oo.set(_ownedIndex(id), 0);
                    $.oo.set(_ownershipIndex(id), 0);
                    delete $.tokenApprovals[id];
                    _packedLogsAppend(packedLogs, from, id, 1);
                } while (fromIndex != fromEnd);
                fromAddressData.ownedLength = uint32(fromIndex);
            }

            if (t.nftAmountToMint != 0) {
                LibMap.Uint32Map storage toOwned = $.owned[to];
                uint256 toIndex = t.toOwnedLength;
                uint256 toEnd = toIndex + t.nftAmountToMint;
                uint32 toAlias = _registerAndResolveAlias(toAddressData, to);
                uint256 maxNFTId = $.totalTokenSupply / _WAD;
                uint256 id = $.nextTokenId;
                $.totalNFTSupply += uint32(t.nftAmountToMint);
                toAddressData.ownedLength = uint32(toEnd);
                // Mint loop.
                do {
                    while ($.oo.get(_ownershipIndex(id)) != 0) {
                        if (++id > maxNFTId) id = 1;
                    }
                    toOwned.set(toIndex, uint32(id));
                    $.oo.set(_ownershipIndex(id), toAlias);
                    $.oo.set(_ownedIndex(id), uint32(toIndex++));
                    _packedLogsAppend(packedLogs, to, id, 0);
                    if (++id > maxNFTId) id = 1;
                } while (toIndex != toEnd);
                $.nextTokenId = uint32(id);
            }

            if (packedLogs.logs.length != 0) {
                _packedLogsSend(packedLogs, $.mirrorERC721);
            }
        }
        emit Transfer(from, to, amount);
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Call must originate from the mirror contract.
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    ///   `msgSender` must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function _transferFromNFT(address from, address to, uint256 id, address msgSender)
        internal
        virtual
    {
        DN404Storage storage $ = _getDN404Storage();

        if (to == address(0)) revert TransferToZeroAddress();

        address owner = $.aliasToAddress[$.oo.get(_ownershipIndex(id))];

        if (from != owner) revert TransferFromIncorrectOwner();

        if (msgSender != from) {
            if (!$.operatorApprovals[from][msgSender]) {
                if (msgSender != $.tokenApprovals[id]) {
                    revert TransferCallerNotOwnerNorApproved();
                }
            }
        }

        AddressData storage fromAddressData = _addressData(from);
        AddressData storage toAddressData = _addressData(to);

        fromAddressData.balance -= uint96(_WAD);

        unchecked {
            toAddressData.balance += uint96(_WAD);

            $.oo.set(_ownershipIndex(id), _registerAndResolveAlias(toAddressData, to));
            delete $.tokenApprovals[id];

            uint256 updatedId = $.owned[from].get(--fromAddressData.ownedLength);
            $.owned[from].set($.oo.get(_ownedIndex(id)), uint32(updatedId));

            uint256 n = toAddressData.ownedLength++;
            $.oo.set(_ownedIndex(updatedId), $.oo.get(_ownedIndex(id)));
            $.owned[to].set(n, uint32(id));
            $.oo.set(_ownedIndex(id), uint32(n));
        }

        emit Transfer(from, to, _WAD);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     SKIP NFT FUNCTIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns true if account `a` will skip NFT minting on token mints and transfers.
    /// Returns false if account `a` will mint NFTs on token mints and transfers.
    function getSkipNFT(address a) public view virtual returns (bool) {
        AddressData storage d = _getDN404Storage().addressData[a];
        return d.initialized ? d.skipNFT : _hasCode(a);
    }

    /// @dev Sets the caller's skipNFT flag to `skipNFT`
    ///
    /// Emits a {SkipNFTSet} event.
    function setSkipNFT(bool skipNFT) public {
        _setSkipNFT(msg.sender, skipNFT);
    }

    /// @dev Internal function to set account `a` skipNFT flag to `state`
    ///
    /// Initializes account `a` AddressData if it is not currently initialized.
    ///
    /// Emits a {SkipNFTSet} event.
    function _setSkipNFT(address a, bool state) internal {
        _addressData(a).skipNFT = state;
        emit SkipNFTSet(a, state);
    }

    /// @dev Returns a storage data pointer for account `a` AddressData
    ///
    /// Initializes account `a` AddressData if it is not currently initialized.
    function _addressData(address a) internal returns (AddressData storage d) {
        DN404Storage storage $ = _getDN404Storage();
        d = $.addressData[a];

        if (!d.initialized) {
            d.initialized = true;
            if (_hasCode(a)) d.skipNFT = true;
        }
    }

    /// @dev Returns if `a` has bytecode of non-zero length.
    function _hasCode(address a) private view returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := extcodesize(a) // Can handle dirty upper bits.
        }
    }

    /// @dev Returns the `addressAlias` of account `to`.
    ///
    /// Assigns and registers the next alias if `to` alias was not previously registered.
    function _registerAndResolveAlias(AddressData storage toAddressData, address to)
        internal
        returns (uint32 addressAlias)
    {
        DN404Storage storage $ = _getDN404Storage();
        addressAlias = toAddressData.addressAlias;
        if (addressAlias == 0) {
            addressAlias = ++$.numAliases;
            toAddressData.addressAlias = addressAlias;
            $.aliasToAddress[addressAlias] = to;
        }
    }

    /// @dev Returns `max(0, x - y)`.
    function _zeroFloorSub(uint256 x, uint256 y) private pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := mul(gt(x, y), sub(x, y))
        }
    }

    /// @dev Returns `i << 1`.
    function _ownershipIndex(uint256 i) private pure returns (uint256) {
        return i << 1;
    }

    /// @dev Returns `(i << 1) + 1`.
    function _ownedIndex(uint256 i) private pure returns (uint256) {
        unchecked {
            return (i << 1) + 1;
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                     MIRROR OPERATIONS                      */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the address of the mirror NFT contract.
    function mirrorERC721() public view returns (address) {
        return _getDN404Storage().mirrorERC721;
    }

    /// @dev Returns the total NFT supply.
    function _totalNFTSupply() internal view virtual returns (uint256) {
        return _getDN404Storage().totalNFTSupply;
    }

    /// @dev Returns `owner` NFT balance.
    function _balanceOfNFT(address owner) internal view virtual returns (uint256) {
        return _getDN404Storage().addressData[owner].ownedLength;
    }

    /// @dev Returns the owner of token `id`.
    /// Returns the zero address instead of reverting if the token does not exist.
    function _ownerAt(uint256 id) internal view virtual returns (address) {
        DN404Storage storage $ = _getDN404Storage();
        return $.aliasToAddress[$.oo.get(_ownershipIndex(id))];
    }

    /// @dev Returns the owner of token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function _ownerOf(uint256 id) internal view virtual returns (address) {
        if (!_exists(id)) revert TokenDoesNotExist();
        return _ownerAt(id);
    }

    /// @dev Returns if token `id` exists.
    function _exists(uint256 id) internal view virtual returns (bool) {
        return _ownerAt(id) != address(0);
    }

    /// @dev Returns the account approved to manage token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function _getApproved(uint256 id) internal view returns (address) {
        if (!_exists(id)) revert TokenDoesNotExist();
        return _getDN404Storage().tokenApprovals[id];
    }

    /// @dev Sets `spender` as the approved account to manage token `id`, using `msgSender`.
    ///
    /// Requirements:
    /// - `msgSender` must be the owner or an approved operator for the token owner.
    function _approveNFT(address spender, uint256 id, address msgSender)
        internal
        returns (address)
    {
        DN404Storage storage $ = _getDN404Storage();

        address owner = $.aliasToAddress[$.oo.get(_ownershipIndex(id))];

        if (msgSender != owner) {
            if (!$.operatorApprovals[owner][msgSender]) {
                revert ApprovalCallerNotOwnerNorApproved();
            }
        }

        $.tokenApprovals[id] = spender;

        return owner;
    }

    /// @dev Approve or remove the `operator` as an operator for `msgSender`,
    /// without authorization checks.
    function _setApprovalForAll(address operator, bool approved, address msgSender)
        internal
        virtual
    {
        _getDN404Storage().operatorApprovals[msgSender][operator] = approved;
    }

    /// @dev Calls the mirror contract to link it to this contract.
    ///
    /// Reverts if the call to the mirror contract reverts.
    function _linkMirrorContract(address mirror) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x0f4599e5) // `linkMirrorContract(address)`.
            mstore(0x20, caller())
            if iszero(
                and(
                    and(eq(mload(0x00), 1), eq(returndatasize(), 0x20)),
                    call(gas(), mirror, 0, 0x1c, 0x24, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0xd125259c) // `LinkMirrorContractFailed()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Fallback modifier to dispatch calls from the mirror NFT contract
    /// to internal functions in this contract.
    modifier dn404Fallback() virtual {
        DN404Storage storage $ = _getDN404Storage();

        uint256 fnSelector = _calldataload(0x00) >> 224;

        // `isApprovedForAll(address,address)`.
        if (fnSelector == 0xe985e9c5) {
            if (msg.sender != $.mirrorERC721) revert UnauthorizedSender();
            if (msg.data.length < 0x44) revert();

            address owner = address(uint160(_calldataload(0x04)));
            address operator = address(uint160(_calldataload(0x24)));

            _return($.operatorApprovals[owner][operator] ? 1 : 0);
        }
        // `ownerOf(uint256)`.
        if (fnSelector == 0x6352211e) {
            if (msg.sender != $.mirrorERC721) revert UnauthorizedSender();
            if (msg.data.length < 0x24) revert();

            uint256 id = _calldataload(0x04);

            _return(uint160(_ownerOf(id)));
        }
        // `transferFromNFT(address,address,uint256,address)`.
        if (fnSelector == 0xe5eb36c8) {
            if (msg.sender != $.mirrorERC721) revert UnauthorizedSender();
            if (msg.data.length < 0x84) revert();

            address from = address(uint160(_calldataload(0x04)));
            address to = address(uint160(_calldataload(0x24)));
            uint256 id = _calldataload(0x44);
            address msgSender = address(uint160(_calldataload(0x64)));

            _transferFromNFT(from, to, id, msgSender);
            _return(1);
        }
        // `setApprovalForAll(address,bool,address)`.
        if (fnSelector == 0x813500fc) {
            if (msg.sender != $.mirrorERC721) revert UnauthorizedSender();
            if (msg.data.length < 0x64) revert();

            address spender = address(uint160(_calldataload(0x04)));
            bool status = _calldataload(0x24) != 0;
            address msgSender = address(uint160(_calldataload(0x44)));

            _setApprovalForAll(spender, status, msgSender);
            _return(1);
        }
        // `approveNFT(address,uint256,address)`.
        if (fnSelector == 0xd10b6e0c) {
            if (msg.sender != $.mirrorERC721) revert UnauthorizedSender();
            if (msg.data.length < 0x64) revert();

            address spender = address(uint160(_calldataload(0x04)));
            uint256 id = _calldataload(0x24);
            address msgSender = address(uint160(_calldataload(0x44)));

            _return(uint160(_approveNFT(spender, id, msgSender)));
        }
        // `getApproved(uint256)`.
        if (fnSelector == 0x081812fc) {
            if (msg.sender != $.mirrorERC721) revert UnauthorizedSender();
            if (msg.data.length < 0x24) revert();

            uint256 id = _calldataload(0x04);

            _return(uint160(_getApproved(id)));
        }
        // `balanceOfNFT(address)`.
        if (fnSelector == 0xf5b100ea) {
            if (msg.sender != $.mirrorERC721) revert UnauthorizedSender();
            if (msg.data.length < 0x24) revert();

            address owner = address(uint160(_calldataload(0x04)));

            _return(_balanceOfNFT(owner));
        }
        // `totalNFTSupply()`.
        if (fnSelector == 0xe2c79281) {
            if (msg.sender != $.mirrorERC721) revert UnauthorizedSender();
            if (msg.data.length < 0x04) revert();

            _return(_totalNFTSupply());
        }
        // `implementsDN404()`.
        if (fnSelector == 0xb7a94eb8) {
            _return(1);
        }
        _;
    }

    /// @dev Fallback function for calls from mirror NFT contract.
    fallback() external payable virtual dn404Fallback {}

    receive() external payable virtual {}

    /// @dev Returns the calldata value at `offset`.
    function _calldataload(uint256 offset) private pure returns (uint256 value) {
        /// @solidity memory-safe-assembly
        assembly {
            value := calldataload(offset)
        }
    }

    /// @dev Executes a return opcode to return `x` and end the current call frame.
    function _return(uint256 x) private pure {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, x)
            return(0x00, 0x20)
        }
    }
}
// File: UpsideDownBears.sol



///         \\_____//               \\_____//
///          //     \,/             \,/     \\
///          \_____,,,\           /,,,_____/
///           \,,,,,,, \         /,,,,,,,,/
///            \,,,,,,,,\ _____ /,,,,,,,,/
///             \,,,,,,,,,,,,,,,,,,,,,,,/
///              \,,,,,,,,_______,,,,,,,,/
///               \,,,\____________/,,,,/
///               /,,\               \,,/
///               |,|          O       |,|
///               |'|                   |,|
///               |,|         *UPSIDE*  |,|
///               |,|        *DOWN*     |,|
///                \,\     *BEARS*     /,/
///                    \__\___________/__/
///                   /,,\     \_/     /,,\
///                  |,,|   \__/|\__/   |,,|
///                 |,,,|       |       |,,,|
///                  \,,,/(,)\\o_o//(,)\,,,/
///                 /,,,___,,,,___,,,,___,,,,\
///                 |,(  )/,,,,,,,,,,,,,\(  ),|
///                  \,,,,/_____________\,,,,/
///                   \__/               \__/



pragma solidity ^0.8.0;





contract UPSIDEDOWNBEARS is DN404, Ownable {
    string private _name;
    string private _symbol;
    string private _baseURI;
    DN404Mirror private _mirror;

    error TransferFailed();

    constructor(
        string memory name_,
        string memory symbol_,
        uint96 initialTokenSupply,
        address initialSupplyOwner,
        address mirrorAddress
    ) {
        _initializeOwner(msg.sender);

        _name = name_;
        _symbol = symbol_;

        _initializeDN404(initialTokenSupply, initialSupplyOwner, address(mirrorAddress));
    }

    function name() public view override returns (string memory) {
        return _name;
    }

    function symbol() public view override returns (string memory) {
        return _symbol;
    }

    function setBaseURI(string calldata baseURI_) public onlyOwner {
        _baseURI = baseURI_;
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        return bytes(_baseURI).length != 0
            ? string(abi.encodePacked(_baseURI, LibString.toString(tokenId)))
            : "";
    }

    function setSkipNFTByOwner(address a, bool state) public onlyOwner {
        _setSkipNFT(a, state);
    }

    function withdraw() external onlyOwner {
        (bool success,) = msg.sender.call{value: address(this).balance}("");
        if (!success) revert TransferFailed();
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint96","name":"initialTokenSupply","type":"uint96"},{"internalType":"address","name":"initialSupplyOwner","type":"address"},{"internalType":"address","name":"mirrorAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"DNAlreadyInitialized","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidTotalNFTSupply","type":"error"},{"inputs":[],"name":"LinkMirrorContractFailed","type":"error"},{"inputs":[],"name":"MirrorAddressIsZero","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnauthorizedSender","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"SkipNFTSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"getSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mirrorERC721","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"skipNFT","type":"bool"}],"name":"setSkipNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"setSkipNFTByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801562000010575f80fd5b50604051620024f6380380620024f68339810160408190526200003391620004af565b6200003e3362000073565b5f6200004b8682620005da565b5060016200005a8582620005da565b5062000068838383620000af565b5050505050620006ec565b6001600160a01b0316638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a35b50565b7f61dd0d320a11019af7688ced18637b1235059a4e8141ed71cfccbe9f2da166008054640100000000900463ffffffff1615620000ff57604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b03821662000127576040516339a84a7b60e01b815260040160405180910390fd5b6200013282620002a9565b805463ffffffff60201b19166401000000001781556001810180546001600160a01b0384166001600160a01b03199091161790556001600160601b03841615620002a3576001600160a01b0383166200019e57604051633a954ecd60e21b815260040160405180910390fd5b620001af600163ffffffff620006a6565b620001cc670de0b6b3a76400006001600160601b038716620006cc565b1115620001ec57604051632cfb9d3360e11b815260040160405180910390fd5b8054600160601b600160c01b0319166c010000000000000000000000006001600160601b038616021781555f6200022384620002dc565b8054600160501b600160b01b0319166a01000000000000000000006001600160601b0388169081029190911782556040519081529091506001600160a01b038516905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3620002a18460016200036c565b505b50505050565b630f4599e55f523360205260205f6024601c5f855af160203d1460015f51141616620000ac5763d125259c5f526004601cfd5b6001600160a01b0381165f9081527f61dd0d320a11019af7688ced18637b1235059a4e8141ed71cfccbe9f2da166086020526040902080547f61dd0d320a11019af7688ced18637b1235059a4e8141ed71cfccbe9f2da166009060ff166200036657815460ff1916600117825562000352833b90565b156200036657815461ff0019166101001782555b50919050565b806200037883620002dc565b80549115156101000261ff001990921691909117905560405181151581526001600160a01b038316907fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d64203939060200160405180910390a25050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112620003f6575f80fd5b81516001600160401b0380821115620004135762000413620003d2565b604051601f8301601f19908116603f011681019082821181831017156200043e576200043e620003d2565b81604052838152602092508660208588010111156200045b575f80fd5b5f91505b838210156200047e57858201830151818301840152908201906200045f565b5f602085830101528094505050505092915050565b80516001600160a01b0381168114620004aa575f80fd5b919050565b5f805f805f60a08688031215620004c4575f80fd5b85516001600160401b0380821115620004db575f80fd5b620004e989838a01620003e6565b96506020880151915080821115620004ff575f80fd5b506200050e88828901620003e6565b604088015190955090506001600160601b03811681146200052d575f80fd5b92506200053d6060870162000493565b91506200054d6080870162000493565b90509295509295909350565b600181811c908216806200056e57607f821691505b6020821081036200036657634e487b7160e01b5f52602260045260245ffd5b601f821115620005d557805f5260205f20601f840160051c81016020851015620005b45750805b601f840160051c820191505b81811015620002a1575f8155600101620005c0565b505050565b81516001600160401b03811115620005f657620005f6620003d2565b6200060e8162000607845462000559565b846200058d565b602080601f83116001811462000644575f84156200062c5750858301515b5f19600386901b1c1916600185901b1785556200069e565b5f85815260208120601f198616915b82811015620006745788860151825594840194600190910190840162000653565b50858210156200069257878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b81810381811115620006c657634e487b7160e01b5f52601160045260245ffd5b92915050565b5f82620006e757634e487b7160e01b5f52601260045260245ffd5b500490565b611dfc80620006fa5f395ff3fe608060405260043610610143575f3560e01c806355f804b3116100b5578063a9059cbb1161006e578063a9059cbb14610672578063c87b56dd14610691578063dd62ed3e146106b0578063f04e283e146106cf578063f2fde38b146106e2578063fee81cf4146106f55761014a565b806355f804b3146105e157806370a0823114610600578063715018a61461061f5780638a834744146106275780638da5cb5b1461064657806395d89b411461065e5761014a565b8063274e430b11610107578063274e430b146105405780632a6a935d1461055f578063313ce5671461057e5780633ccfd60b146105995780634ef41efc146105ad57806354d1f13d146105d95761014a565b806306fdde031461049e578063095ea7b3146104c857806318160ddd146104f757806323b872dd1461051957806325692962146105385761014a565b3661014a57005b5f610153610726565b90505f3560e01c63e985e9c58190036101ed5760018201546001600160a01b0316331461019357604051630101292160e31b815260040160405180910390fd5b60443610156101a0575f80fd5b6004356001600160a01b038181165f908152600385016020908152604080832060243594851684529091529020546101ea9060ff166101df575f6101e2565b60015b60ff1661074a565b50505b80636352211e036102515760018201546001600160a01b0316331461022557604051630101292160e31b815260040160405180910390fd5b6024361015610232575f80fd5b60043561024f61024182610752565b6001600160a01b031661074a565b505b8063e5eb36c8036102bd5760018201546001600160a01b0316331461028957604051630101292160e31b815260040160405180910390fd5b6084361015610296575f80fd5b6004356024356044356064356102ae84848484610788565b6102b8600161074a565b505050505b8063813500fc036103265760018201546001600160a01b031633146102f557604051630101292160e31b815260040160405180910390fd5b6064361015610302575f80fd5b6004356024351515604435610318838383610b3f565b610322600161074a565b5050505b8063d10b6e0c036103865760018201546001600160a01b0316331461035e57604051630101292160e31b815260040160405180910390fd5b606436101561036b575f80fd5b600435602435604435610382610241848484610b86565b5050505b8063081812fc036103dc5760018201546001600160a01b031633146103be57604051630101292160e31b815260040160405180910390fd5b60243610156103cb575f80fd5b6004356103da61024182610c4c565b505b8063f5b100ea036104375760018201546001600160a01b0316331461041457604051630101292160e31b815260040160405180910390fd5b6024361015610421575f80fd5b60043561043561043082610c97565b61074a565b505b8063e2c79281036104875760018201546001600160a01b0316331461046f57604051630101292160e31b815260040160405180910390fd5b600436101561047c575f80fd5b610487610430610cce565b8063b7a94eb80361049c5761049c600161074a565b005b3480156104a9575f80fd5b506104b2610cea565b6040516104bf91906119c3565b60405180910390f35b3480156104d3575f80fd5b506104e76104e2366004611a10565b610d79565b60405190151581526020016104bf565b348015610502575f80fd5b5061050b610deb565b6040519081526020016104bf565b348015610524575f80fd5b506104e7610533366004611a38565b610e0a565b61049c610ea6565b34801561054b575f80fd5b506104e761055a366004611a71565b610ef3565b34801561056a575f80fd5b5061049c610579366004611a99565b610f3d565b348015610589575f80fd5b50604051601281526020016104bf565b3480156105a4575f80fd5b5061049c610f4a565b3480156105b8575f80fd5b506105c1610fb8565b6040516001600160a01b0390911681526020016104bf565b61049c610fd3565b3480156105ec575f80fd5b5061049c6105fb366004611ab2565b61100c565b34801561060b575f80fd5b5061050b61061a366004611a71565b611026565b61049c611060565b348015610632575f80fd5b5061049c610641366004611b1e565b611073565b348015610651575f80fd5b50638b78c6d819546105c1565b348015610669575f80fd5b506104b2611089565b34801561067d575f80fd5b506104e761068c366004611a10565b611098565b34801561069c575f80fd5b506104b26106ab366004611b4f565b6110ad565b3480156106bb575f80fd5b5061050b6106ca366004611b66565b611109565b61049c6106dd366004611a71565b611141565b61049c6106f0366004611a71565b61117b565b348015610700575f80fd5b5061050b61070f366004611a71565b63389a75e1600c9081525f91909152602090205490565b7f61dd0d320a11019af7688ced18637b1235059a4e8141ed71cfccbe9f2da1660090565b805f5260205ff35b5f61075c826111a1565b6107795760405163677510db60e11b815260040160405180910390fd5b610782826111bd565b92915050565b5f610791610726565b90506001600160a01b0384166107ba57604051633a954ecd60e21b815260040160405180910390fd5b5f816002015f6107ef6107cd8760011b90565b600381901c5f90815260078701602052604090205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b039081169150861681146108325760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b0316146108b4576001600160a01b038087165f90815260038401602090815260408083209387168352929052205460ff166108b4575f8481526004830160205260409020546001600160a01b038481169116146108b457604051632ce44b5f60e11b815260040160405180910390fd5b5f6108be87611245565b90505f6108ca87611245565b8254909150670de0b6b3a7640000908390600a906108f9908490600160501b90046001600160601b0316611ba2565b82546101009290920a6001600160601b0381810219909316918316021790915582546bffffffffffffffffffffffff60501b198116670de0b6b3a7640000600160501b928390048416019092160217825550610968600187901b61095d838a6112a3565b600787019190611344565b5f868152600485016020908152604080832080546001600160a01b0319169055845463ffffffff60301b198116600160301b9182900463ffffffff9081165f190181169283029190911787556001600160a01b038d168552600689019093529083206109d79290919061122316565b63ffffffff169050610a3b610a10600189811b01600381901c5f90815260078901602052604090205460e060059290921b919091161c90565b6001600160a01b038b165f90815260068801602052604090209063ffffffff90811690849061134416565b8154600163ffffffff600160301b80840482169283019091160263ffffffff60301b19909216919091178355610aa7610a7783600190811b0190565b60018a811b01600381901c5f90815260078a01602052604090205460059190911b60e0161c600789019190611344565b6001600160a01b0389165f9081526006870160205260409020610acb90828a611344565b610ade6007870160018a811b0183611344565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a7640000604051610b2d91815260200190565b60405180910390a35050505050505050565b81610b48610726565b6001600160a01b039283165f90815260039190910160209081526040808320969094168252949094529220805460ff19169215159290921790915550565b5f80610b90610726565b90505f816002015f610ba56107cd8860011b90565b63ffffffff16815260208101919091526040015f20546001600160a01b03908116915084168114610c17576001600160a01b038082165f90815260038401602090815260408083209388168352929052205460ff16610c17576040516367d9dca160e11b815260040160405180910390fd5b5f8581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b5f610c56826111a1565b610c735760405163677510db60e11b815260040160405180910390fd5b610c7b610726565b5f9283526004016020525060409020546001600160a01b031690565b5f610ca0610726565b6001600160a01b03929092165f9081526008909201602052506040902054600160301b900463ffffffff1690565b5f610cd7610726565b54600160401b900463ffffffff16919050565b60605f8054610cf890611bc2565b80601f0160208091040260200160405190810160405280929190818152602001828054610d2490611bc2565b8015610d6f5780601f10610d4657610100808354040283529160200191610d6f565b820191905f5260205f20905b815481529060010190602001808311610d5257829003601f168201915b5050505050905090565b5f80610d83610726565b335f81815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b5f610df4610726565b54600160601b90046001600160601b0316919050565b5f80610e14610726565b6001600160a01b0386165f90815260058201602090815260408083203384529091529020549091505f198114610e8f5780841115610e65576040516313be252b60e01b815260040160405180910390fd5b6001600160a01b0386165f9081526005830160209081526040808320338452909152902084820390555b610e9a868686611376565b50600195945050505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f80610efd610726565b6001600160a01b0384165f90815260089190910160205260409020805490915060ff16610f2b57823b610f36565b8054610100900460ff165b9392505050565b610f473382611862565b50565b610f526118c6565b6040515f90339047908381818185875af1925050503d805f8114610f91576040519150601f19603f3d011682016040523d82523d5f602084013e610f96565b606091505b5050905080610f47576040516312171d8360e31b815260040160405180910390fd5b5f610fc1610726565b600101546001600160a01b0316919050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6110146118c6565b6002611021828483611c53565b505050565b5f61102f610726565b6001600160a01b03929092165f9081526008909201602052506040902054600160501b90046001600160601b031690565b6110686118c6565b6110715f6118e0565b565b61107b6118c6565b6110858282611862565b5050565b606060018054610cf890611bc2565b5f6110a4338484611376565b50600192915050565b6060600280546110bc90611bc2565b90505f036110d85760405180602001604052805f815250610782565b60026110e38361191d565b6040516020016110f4929190611d0d565b60405160208183030381529060405292915050565b5f611112610726565b6001600160a01b039384165f908152600591909101602090815260408083209490951682529290925250205490565b6111496118c6565b63389a75e1600c52805f526020600c20805442111561116f57636f5e88185f526004601cfd5b5f9055610f47816118e0565b6111836118c6565b8060601b61119857637448fbae5f526004601cfd5b610f47816118e0565b5f806111ac836111bd565b6001600160a01b0316141592915050565b5f806111c7610726565b9050806002015f6111fd6111db8660011b90565b600381901c5f90815260078601602052604090205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b03169392505050565b600381901c5f90815260209290925260409091205460059190911b60e0161c90565b5f8061124f610726565b6001600160a01b0384165f9081526008820160205260409020805490935090915060ff1661129d57815460ff1916600117825561128a833b90565b1561129d57815461ff0019166101001782555b50919050565b5f806112ad610726565b845462010000900463ffffffff16925090505f82900361133d57805481905f906112dc9063ffffffff16611d90565b825463ffffffff8083166101009490940a84810291021990911617909255855462010000820265ffffffff0000199091161786555f908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b826020528160031c5f5260405f206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6001600160a01b03821661139d57604051633a954ecd60e21b815260040160405180910390fd5b5f6113a6610726565b90505f6113b285611245565b90505f6113be85611245565b90506113f36040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b825463ffffffff600160301b808304821660808501528454041660a08301526001600160601b03600160501b909104166040820181905285111561144a57604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905283546001600160601b03808316600160501b9081026bffffffffffffffffffffffff60501b19938416178755855481810483168a016060870181905290921602911617835560808201516114b991670de0b6b3a7640000900480821191030290565b81528154610100900460ff166114fc576114f6670de0b6b3a76400008260600151816114e7576114e7611db2565b048260a0015180821191030290565b60208201525b5f6115438260200151835f01510160408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b82519091501561164f576001600160a01b0388165f908152600686016020526040902060808301518351875463ffffffff600160401b80830482168490039091160263ffffffff60401b1990911617885581035b5f1991909101600381901c5f9081526020849052604081205491929160e0600585901b161c63ffffffff1690506115df6115d482600190811b0190565b60078b01905f611344565b6115ec6115d48260011b90565b5f81815260048a016020908152604090912080546001600160a01b0319169055858101805160089390931b60608f901b176001178352910190528082036115975750855463ffffffff909116600160301b0263ffffffff60301b19909116178555505b6020820151156117ea576001600160a01b0387165f9081526006860160209081526040822060a08501519185015190929082019061168d878c6112a3565b8954602088015163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178c55895463ffffffff60301b1916600160301b86831602178a55919250670de0b6b3a7640000600160601b82046001600160601b03160491640100000000909104165b6117296117078260011b90565b600381901c5f90815260078e01602052604090205460059190911b60e0161c90565b63ffffffff16156117485760010181811115611743575060015b6116fa565b611753868683611344565b61176b6117608260011b90565b60078d019085611344565b611784600182811b01600187019660078e019190611344565b6117ad878e835f8360200151818360081b8560601b171781526020810185602001525050505050565b600101818111156117bc575060015b8385036116fa578a5463ffffffff9091166401000000000267ffffffff0000000019909116178a5550505050505b8051511561180b57600185015461180b9082906001600160a01b031661195f565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8760405161185191815260200190565b60405180910390a350505050505050565b8061186c83611245565b80549115156101000261ff001990921691909117905560405181151581526001600160a01b038316907fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d64203939060200160405180910390a25050565b638b78c6d819543314611071576382b429005f526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b60606080604051019050602081016040525f8152805f19835b928101926030600a8206018453600a900480611936575050819003601f19909101908152919050565b81516040810363263c69d68152602080820152815160051b604401915060205f83601c84015f875af1601f3d1160015f5114161661199b575f80fd5b50505050565b5f5b838110156119bb5781810151838201526020016119a3565b50505f910152565b602081525f82518060208401526119e18160408501602087016119a1565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611a0b575f80fd5b919050565b5f8060408385031215611a21575f80fd5b611a2a836119f5565b946020939093013593505050565b5f805f60608486031215611a4a575f80fd5b611a53846119f5565b9250611a61602085016119f5565b9150604084013590509250925092565b5f60208284031215611a81575f80fd5b610f36826119f5565b80358015158114611a0b575f80fd5b5f60208284031215611aa9575f80fd5b610f3682611a8a565b5f8060208385031215611ac3575f80fd5b823567ffffffffffffffff80821115611ada575f80fd5b818501915085601f830112611aed575f80fd5b813581811115611afb575f80fd5b866020828501011115611b0c575f80fd5b60209290920196919550909350505050565b5f8060408385031215611b2f575f80fd5b611b38836119f5565b9150611b4660208401611a8a565b90509250929050565b5f60208284031215611b5f575f80fd5b5035919050565b5f8060408385031215611b77575f80fd5b611b80836119f5565b9150611b46602084016119f5565b634e487b7160e01b5f52601160045260245ffd5b6001600160601b0382811682821603908082111561133d5761133d611b8e565b600181811c90821680611bd657607f821691505b60208210810361129d57634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b601f82111561102157805f5260205f20601f840160051c81016020851015611c2d5750805b601f840160051c820191505b81811015611c4c575f8155600101611c39565b5050505050565b67ffffffffffffffff831115611c6b57611c6b611bf4565b611c7f83611c798354611bc2565b83611c08565b5f601f841160018114611cb0575f8515611c995750838201355b5f19600387901b1c1916600186901b178355611c4c565b5f83815260208120601f198716915b82811015611cdf5786850135825560209485019460019092019101611cbf565b5086821015611cfb575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f808454611d1a81611bc2565b60018281168015611d325760018114611d4757611d73565b60ff1984168752821515830287019450611d73565b885f526020805f205f5b85811015611d6a5781548a820152908401908201611d51565b50505082870194505b505050508351611d878183602088016119a1565b01949350505050565b5f63ffffffff808316818103611da857611da8611b8e565b6001019392505050565b634e487b7160e01b5f52601260045260245ffdfea2646970667358221220226838afe80950006629333ceb806be82db86c593643dcafbcd8b7e1350e11fe64736f6c6343000818003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000064b3f4c610c88f6a98d5ba561f1ccee703706ce3000000000000000000000000daf8a356267e436acb268c21918550caffadaea0000000000000000000000000000000000000000000000000000000000000001155707369646520446f776e20426561727300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035544420000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405260043610610143575f3560e01c806355f804b3116100b5578063a9059cbb1161006e578063a9059cbb14610672578063c87b56dd14610691578063dd62ed3e146106b0578063f04e283e146106cf578063f2fde38b146106e2578063fee81cf4146106f55761014a565b806355f804b3146105e157806370a0823114610600578063715018a61461061f5780638a834744146106275780638da5cb5b1461064657806395d89b411461065e5761014a565b8063274e430b11610107578063274e430b146105405780632a6a935d1461055f578063313ce5671461057e5780633ccfd60b146105995780634ef41efc146105ad57806354d1f13d146105d95761014a565b806306fdde031461049e578063095ea7b3146104c857806318160ddd146104f757806323b872dd1461051957806325692962146105385761014a565b3661014a57005b5f610153610726565b90505f3560e01c63e985e9c58190036101ed5760018201546001600160a01b0316331461019357604051630101292160e31b815260040160405180910390fd5b60443610156101a0575f80fd5b6004356001600160a01b038181165f908152600385016020908152604080832060243594851684529091529020546101ea9060ff166101df575f6101e2565b60015b60ff1661074a565b50505b80636352211e036102515760018201546001600160a01b0316331461022557604051630101292160e31b815260040160405180910390fd5b6024361015610232575f80fd5b60043561024f61024182610752565b6001600160a01b031661074a565b505b8063e5eb36c8036102bd5760018201546001600160a01b0316331461028957604051630101292160e31b815260040160405180910390fd5b6084361015610296575f80fd5b6004356024356044356064356102ae84848484610788565b6102b8600161074a565b505050505b8063813500fc036103265760018201546001600160a01b031633146102f557604051630101292160e31b815260040160405180910390fd5b6064361015610302575f80fd5b6004356024351515604435610318838383610b3f565b610322600161074a565b5050505b8063d10b6e0c036103865760018201546001600160a01b0316331461035e57604051630101292160e31b815260040160405180910390fd5b606436101561036b575f80fd5b600435602435604435610382610241848484610b86565b5050505b8063081812fc036103dc5760018201546001600160a01b031633146103be57604051630101292160e31b815260040160405180910390fd5b60243610156103cb575f80fd5b6004356103da61024182610c4c565b505b8063f5b100ea036104375760018201546001600160a01b0316331461041457604051630101292160e31b815260040160405180910390fd5b6024361015610421575f80fd5b60043561043561043082610c97565b61074a565b505b8063e2c79281036104875760018201546001600160a01b0316331461046f57604051630101292160e31b815260040160405180910390fd5b600436101561047c575f80fd5b610487610430610cce565b8063b7a94eb80361049c5761049c600161074a565b005b3480156104a9575f80fd5b506104b2610cea565b6040516104bf91906119c3565b60405180910390f35b3480156104d3575f80fd5b506104e76104e2366004611a10565b610d79565b60405190151581526020016104bf565b348015610502575f80fd5b5061050b610deb565b6040519081526020016104bf565b348015610524575f80fd5b506104e7610533366004611a38565b610e0a565b61049c610ea6565b34801561054b575f80fd5b506104e761055a366004611a71565b610ef3565b34801561056a575f80fd5b5061049c610579366004611a99565b610f3d565b348015610589575f80fd5b50604051601281526020016104bf565b3480156105a4575f80fd5b5061049c610f4a565b3480156105b8575f80fd5b506105c1610fb8565b6040516001600160a01b0390911681526020016104bf565b61049c610fd3565b3480156105ec575f80fd5b5061049c6105fb366004611ab2565b61100c565b34801561060b575f80fd5b5061050b61061a366004611a71565b611026565b61049c611060565b348015610632575f80fd5b5061049c610641366004611b1e565b611073565b348015610651575f80fd5b50638b78c6d819546105c1565b348015610669575f80fd5b506104b2611089565b34801561067d575f80fd5b506104e761068c366004611a10565b611098565b34801561069c575f80fd5b506104b26106ab366004611b4f565b6110ad565b3480156106bb575f80fd5b5061050b6106ca366004611b66565b611109565b61049c6106dd366004611a71565b611141565b61049c6106f0366004611a71565b61117b565b348015610700575f80fd5b5061050b61070f366004611a71565b63389a75e1600c9081525f91909152602090205490565b7f61dd0d320a11019af7688ced18637b1235059a4e8141ed71cfccbe9f2da1660090565b805f5260205ff35b5f61075c826111a1565b6107795760405163677510db60e11b815260040160405180910390fd5b610782826111bd565b92915050565b5f610791610726565b90506001600160a01b0384166107ba57604051633a954ecd60e21b815260040160405180910390fd5b5f816002015f6107ef6107cd8760011b90565b600381901c5f90815260078701602052604090205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b039081169150861681146108325760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b0316146108b4576001600160a01b038087165f90815260038401602090815260408083209387168352929052205460ff166108b4575f8481526004830160205260409020546001600160a01b038481169116146108b457604051632ce44b5f60e11b815260040160405180910390fd5b5f6108be87611245565b90505f6108ca87611245565b8254909150670de0b6b3a7640000908390600a906108f9908490600160501b90046001600160601b0316611ba2565b82546101009290920a6001600160601b0381810219909316918316021790915582546bffffffffffffffffffffffff60501b198116670de0b6b3a7640000600160501b928390048416019092160217825550610968600187901b61095d838a6112a3565b600787019190611344565b5f868152600485016020908152604080832080546001600160a01b0319169055845463ffffffff60301b198116600160301b9182900463ffffffff9081165f190181169283029190911787556001600160a01b038d168552600689019093529083206109d79290919061122316565b63ffffffff169050610a3b610a10600189811b01600381901c5f90815260078901602052604090205460e060059290921b919091161c90565b6001600160a01b038b165f90815260068801602052604090209063ffffffff90811690849061134416565b8154600163ffffffff600160301b80840482169283019091160263ffffffff60301b19909216919091178355610aa7610a7783600190811b0190565b60018a811b01600381901c5f90815260078a01602052604090205460059190911b60e0161c600789019190611344565b6001600160a01b0389165f9081526006870160205260409020610acb90828a611344565b610ade6007870160018a811b0183611344565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a7640000604051610b2d91815260200190565b60405180910390a35050505050505050565b81610b48610726565b6001600160a01b039283165f90815260039190910160209081526040808320969094168252949094529220805460ff19169215159290921790915550565b5f80610b90610726565b90505f816002015f610ba56107cd8860011b90565b63ffffffff16815260208101919091526040015f20546001600160a01b03908116915084168114610c17576001600160a01b038082165f90815260038401602090815260408083209388168352929052205460ff16610c17576040516367d9dca160e11b815260040160405180910390fd5b5f8581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b5f610c56826111a1565b610c735760405163677510db60e11b815260040160405180910390fd5b610c7b610726565b5f9283526004016020525060409020546001600160a01b031690565b5f610ca0610726565b6001600160a01b03929092165f9081526008909201602052506040902054600160301b900463ffffffff1690565b5f610cd7610726565b54600160401b900463ffffffff16919050565b60605f8054610cf890611bc2565b80601f0160208091040260200160405190810160405280929190818152602001828054610d2490611bc2565b8015610d6f5780601f10610d4657610100808354040283529160200191610d6f565b820191905f5260205f20905b815481529060010190602001808311610d5257829003601f168201915b5050505050905090565b5f80610d83610726565b335f81815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b5f610df4610726565b54600160601b90046001600160601b0316919050565b5f80610e14610726565b6001600160a01b0386165f90815260058201602090815260408083203384529091529020549091505f198114610e8f5780841115610e65576040516313be252b60e01b815260040160405180910390fd5b6001600160a01b0386165f9081526005830160209081526040808320338452909152902084820390555b610e9a868686611376565b50600195945050505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f80610efd610726565b6001600160a01b0384165f90815260089190910160205260409020805490915060ff16610f2b57823b610f36565b8054610100900460ff165b9392505050565b610f473382611862565b50565b610f526118c6565b6040515f90339047908381818185875af1925050503d805f8114610f91576040519150601f19603f3d011682016040523d82523d5f602084013e610f96565b606091505b5050905080610f47576040516312171d8360e31b815260040160405180910390fd5b5f610fc1610726565b600101546001600160a01b0316919050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6110146118c6565b6002611021828483611c53565b505050565b5f61102f610726565b6001600160a01b03929092165f9081526008909201602052506040902054600160501b90046001600160601b031690565b6110686118c6565b6110715f6118e0565b565b61107b6118c6565b6110858282611862565b5050565b606060018054610cf890611bc2565b5f6110a4338484611376565b50600192915050565b6060600280546110bc90611bc2565b90505f036110d85760405180602001604052805f815250610782565b60026110e38361191d565b6040516020016110f4929190611d0d565b60405160208183030381529060405292915050565b5f611112610726565b6001600160a01b039384165f908152600591909101602090815260408083209490951682529290925250205490565b6111496118c6565b63389a75e1600c52805f526020600c20805442111561116f57636f5e88185f526004601cfd5b5f9055610f47816118e0565b6111836118c6565b8060601b61119857637448fbae5f526004601cfd5b610f47816118e0565b5f806111ac836111bd565b6001600160a01b0316141592915050565b5f806111c7610726565b9050806002015f6111fd6111db8660011b90565b600381901c5f90815260078601602052604090205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b03169392505050565b600381901c5f90815260209290925260409091205460059190911b60e0161c90565b5f8061124f610726565b6001600160a01b0384165f9081526008820160205260409020805490935090915060ff1661129d57815460ff1916600117825561128a833b90565b1561129d57815461ff0019166101001782555b50919050565b5f806112ad610726565b845462010000900463ffffffff16925090505f82900361133d57805481905f906112dc9063ffffffff16611d90565b825463ffffffff8083166101009490940a84810291021990911617909255855462010000820265ffffffff0000199091161786555f908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b826020528160031c5f5260405f206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6001600160a01b03821661139d57604051633a954ecd60e21b815260040160405180910390fd5b5f6113a6610726565b90505f6113b285611245565b90505f6113be85611245565b90506113f36040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b825463ffffffff600160301b808304821660808501528454041660a08301526001600160601b03600160501b909104166040820181905285111561144a57604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905283546001600160601b03808316600160501b9081026bffffffffffffffffffffffff60501b19938416178755855481810483168a016060870181905290921602911617835560808201516114b991670de0b6b3a7640000900480821191030290565b81528154610100900460ff166114fc576114f6670de0b6b3a76400008260600151816114e7576114e7611db2565b048260a0015180821191030290565b60208201525b5f6115438260200151835f01510160408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b82519091501561164f576001600160a01b0388165f908152600686016020526040902060808301518351875463ffffffff600160401b80830482168490039091160263ffffffff60401b1990911617885581035b5f1991909101600381901c5f9081526020849052604081205491929160e0600585901b161c63ffffffff1690506115df6115d482600190811b0190565b60078b01905f611344565b6115ec6115d48260011b90565b5f81815260048a016020908152604090912080546001600160a01b0319169055858101805160089390931b60608f901b176001178352910190528082036115975750855463ffffffff909116600160301b0263ffffffff60301b19909116178555505b6020820151156117ea576001600160a01b0387165f9081526006860160209081526040822060a08501519185015190929082019061168d878c6112a3565b8954602088015163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178c55895463ffffffff60301b1916600160301b86831602178a55919250670de0b6b3a7640000600160601b82046001600160601b03160491640100000000909104165b6117296117078260011b90565b600381901c5f90815260078e01602052604090205460059190911b60e0161c90565b63ffffffff16156117485760010181811115611743575060015b6116fa565b611753868683611344565b61176b6117608260011b90565b60078d019085611344565b611784600182811b01600187019660078e019190611344565b6117ad878e835f8360200151818360081b8560601b171781526020810185602001525050505050565b600101818111156117bc575060015b8385036116fa578a5463ffffffff9091166401000000000267ffffffff0000000019909116178a5550505050505b8051511561180b57600185015461180b9082906001600160a01b031661195f565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8760405161185191815260200190565b60405180910390a350505050505050565b8061186c83611245565b80549115156101000261ff001990921691909117905560405181151581526001600160a01b038316907fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d64203939060200160405180910390a25050565b638b78c6d819543314611071576382b429005f526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b60606080604051019050602081016040525f8152805f19835b928101926030600a8206018453600a900480611936575050819003601f19909101908152919050565b81516040810363263c69d68152602080820152815160051b604401915060205f83601c84015f875af1601f3d1160015f5114161661199b575f80fd5b50505050565b5f5b838110156119bb5781810151838201526020016119a3565b50505f910152565b602081525f82518060208401526119e18160408501602087016119a1565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611a0b575f80fd5b919050565b5f8060408385031215611a21575f80fd5b611a2a836119f5565b946020939093013593505050565b5f805f60608486031215611a4a575f80fd5b611a53846119f5565b9250611a61602085016119f5565b9150604084013590509250925092565b5f60208284031215611a81575f80fd5b610f36826119f5565b80358015158114611a0b575f80fd5b5f60208284031215611aa9575f80fd5b610f3682611a8a565b5f8060208385031215611ac3575f80fd5b823567ffffffffffffffff80821115611ada575f80fd5b818501915085601f830112611aed575f80fd5b813581811115611afb575f80fd5b866020828501011115611b0c575f80fd5b60209290920196919550909350505050565b5f8060408385031215611b2f575f80fd5b611b38836119f5565b9150611b4660208401611a8a565b90509250929050565b5f60208284031215611b5f575f80fd5b5035919050565b5f8060408385031215611b77575f80fd5b611b80836119f5565b9150611b46602084016119f5565b634e487b7160e01b5f52601160045260245ffd5b6001600160601b0382811682821603908082111561133d5761133d611b8e565b600181811c90821680611bd657607f821691505b60208210810361129d57634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b601f82111561102157805f5260205f20601f840160051c81016020851015611c2d5750805b601f840160051c820191505b81811015611c4c575f8155600101611c39565b5050505050565b67ffffffffffffffff831115611c6b57611c6b611bf4565b611c7f83611c798354611bc2565b83611c08565b5f601f841160018114611cb0575f8515611c995750838201355b5f19600387901b1c1916600186901b178355611c4c565b5f83815260208120601f198716915b82811015611cdf5786850135825560209485019460019092019101611cbf565b5086821015611cfb575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f808454611d1a81611bc2565b60018281168015611d325760018114611d4757611d73565b60ff1984168752821515830287019450611d73565b885f526020805f205f5b85811015611d6a5781548a820152908401908201611d51565b50505082870194505b505050508351611d878183602088016119a1565b01949350505050565b5f63ffffffff808316818103611da857611da8611b8e565b6001019392505050565b634e487b7160e01b5f52601260045260245ffdfea2646970667358221220226838afe80950006629333ceb806be82db86c593643dcafbcd8b7e1350e11fe64736f6c63430008180033

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

00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000064b3f4c610c88f6a98d5ba561f1ccee703706ce3000000000000000000000000daf8a356267e436acb268c21918550caffadaea0000000000000000000000000000000000000000000000000000000000000001155707369646520446f776e20426561727300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035544420000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name_ (string): Upside Down Bears
Arg [1] : symbol_ (string): UDB
Arg [2] : initialTokenSupply (uint96): 100000000000000000000
Arg [3] : initialSupplyOwner (address): 0x64b3f4c610C88f6A98D5ba561F1ccEe703706Ce3
Arg [4] : mirrorAddress (address): 0xDaF8a356267e436acB268c21918550CafFAdAeA0

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 0000000000000000000000000000000000000000000000056bc75e2d63100000
Arg [3] : 00000000000000000000000064b3f4c610c88f6a98d5ba561f1ccee703706ce3
Arg [4] : 000000000000000000000000daf8a356267e436acb268c21918550caffadaea0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [6] : 55707369646520446f776e204265617273000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [8] : 5544420000000000000000000000000000000000000000000000000000000000


Deployed Bytecode Sourcemap

138182:1433:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;132868:22;132893:18;:16;:18::i;:::-;132868:43;-1:-1:-1;132924:18:0;136738:20;132968:3;132945:26;133051:10;133037:24;;;133033:380;;133096:14;;;;-1:-1:-1;;;;;133096:14:0;133082:10;:28;133078:61;;133119:20;;-1:-1:-1;;;133119:20:0;;;;;;;;;;;133078:61;133176:4;133158:8;:22;133154:36;;;133182:8;;;133154:36;133253:4;136738:20;-1:-1:-1;;;;;133356:26:0;;;133207:13;133356:26;;;:19;;;:26;;;;;;;;133324:4;136738:20;133356:36;;;;;;;;;;;133348:53;;133356:36;;:44;;133399:1;133356:44;;;133395:1;133356:44;133348:53;;:7;:53::i;:::-;133063:350;;133033:380;133459:10;133473;133459:24;133455:265;;133518:14;;;;-1:-1:-1;;;;;133518:14:0;133504:10;:28;133500:61;;133541:20;;-1:-1:-1;;;133541:20:0;;;;;;;;;;;133500:61;133598:4;133580:8;:22;133576:36;;;133604:8;;;133576:36;133656:4;136738:20;133678:30;133694:12;136738:20;133694:8;:12::i;:::-;-1:-1:-1;;;;;133678:30:0;:7;:30::i;:::-;133485:235;133455:265;133798:10;133812;133798:24;133794:505;;133857:14;;;;-1:-1:-1;;;;;133857:14:0;133843:10;:28;133839:61;;133880:20;;-1:-1:-1;;;133880:20:0;;;;;;;;;;;133839:61;133937:4;133919:8;:22;133915:36;;;133943:8;;;133915:36;134013:4;136738:20;134078:4;136738:20;134127:4;136738:20;134197:4;136738:20;134221:41;136738:20;;;;134221:16;:41::i;:::-;134277:10;134285:1;134277:7;:10::i;:::-;133824:475;;;;133794:505;134368:10;134382;134368:24;134364:454;;134427:14;;;;-1:-1:-1;;;;;134427:14:0;134413:10;:28;134409:61;;134450:20;;-1:-1:-1;;;134450:20:0;;;;;;;;;;;134409:61;134507:4;134489:8;:22;134485:36;;;134513:8;;;134485:36;134586:4;136738:20;134636:4;136738:20;134622:24;;134711:4;136738:20;134735:46;136738:20;134622:24;136738:20;134735:18;:46::i;:::-;134796:10;134804:1;134796:7;:10::i;:::-;134394:424;;;134364:454;134883:10;134897;134883:24;134879:430;;134942:14;;;;-1:-1:-1;;;;;134942:14:0;134928:10;:28;134924:61;;134965:20;;-1:-1:-1;;;134965:20:0;;;;;;;;;;;134924:61;135022:4;135004:8;:22;135000:36;;;135028:8;;;135000:36;135101:4;136738:20;135150:4;136738:20;135220:4;136738:20;135244:53;135260:35;136738:20;;;135260:11;:35::i;135244:53::-;134909:400;;;134879:430;135359:10;135373;135359:24;135355:269;;135418:14;;;;-1:-1:-1;;;;;135418:14:0;135404:10;:28;135400:61;;135441:20;;-1:-1:-1;;;135441:20:0;;;;;;;;;;;135400:61;135498:4;135480:8;:22;135476:36;;;135504:8;;;135476:36;135556:4;136738:20;135578:34;135594:16;136738:20;135594:12;:16::i;135578:34::-;135385:239;135355:269;135675:10;135689;135675:24;135671:285;;135734:14;;;;-1:-1:-1;;;;;135734:14:0;135720:10;:28;135716:61;;135757:20;;-1:-1:-1;;;135757:20:0;;;;;;;;;;;135716:61;135814:4;135796:8;:22;135792:36;;;135820:8;;;135792:36;135891:4;136738:20;135915:29;135923:20;136738;135923:13;:20::i;:::-;135915:7;:29::i;:::-;135701:255;135671:285;136002:10;136016;136002:24;135998:212;;136061:14;;;;-1:-1:-1;;;;;136061:14:0;136047:10;:28;136043:61;;136084:20;;-1:-1:-1;;;136084:20:0;;;;;;;;;;;136043:61;136141:4;136123:8;:22;136119:36;;;136147:8;;;136119:36;136172:26;136180:17;:15;:17::i;136172:26::-;136257:10;136271;136257:24;136253:67;;136298:10;136306:1;136298:7;:10::i;:::-;132857:3482;138773:92;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;109959:275;;;;;;;;;;-1:-1:-1;109959:275:0;;;;;:::i;:::-;;:::i;:::-;;;1272:14:1;;1265:22;1247:41;;1235:2;1220:18;109959:275:0;1107:187:1;109231:131:0;;;;;;;;;;;;;:::i;:::-;;;1445:25:1;;;1433:2;1418:18;109231:131:0;1299:177:1;111594:512:0;;;;;;;;;;-1:-1:-1;111594:512:0;;;;;:::i;:::-;;:::i;63413:630::-;;;:::i;126233:199::-;;;;;;;;;;-1:-1:-1;126233:199:0;;;;;:::i;:::-;;:::i;126544:92::-;;;;;;;;;;-1:-1:-1;126544:92:0;;;;;:::i;:::-;;:::i;109090:76::-;;;;;;;;;;-1:-1:-1;109090:76:0;;109156:2;2497:36:1;;2485:2;2470:18;109090:76:0;2355:184:1;139439:173:0;;;;;;;;;;;;;:::i;129279:111::-;;;;;;;;;;;;;:::i;:::-;;;-1:-1:-1;;;;;2708:32:1;;;2690:51;;2678:2;2663:18;129279:111:0;2544:203:1;64128:466:0;;;:::i;138977:101::-;;;;;;;;;;-1:-1:-1;138977:101:0;;;;;:::i;:::-;;:::i;109431:143::-;;;;;;;;;;-1:-1:-1;109431:143:0;;;;;:::i;:::-;;:::i;63148:102::-;;;:::i;139324:107::-;;;;;;;;;;-1:-1:-1;139324:107:0;;;;;:::i;:::-;;:::i;65853:187::-;;;;;;;;;;-1:-1:-1;;;66004:18:0;65853:187;;138873:96;;;;;;;;;;;;;:::i;110747:150::-;;;;;;;;;;-1:-1:-1;110747:150:0;;;;;:::i;:::-;;:::i;139086:230::-;;;;;;;;;;-1:-1:-1;139086:230:0;;;;;:::i;:::-;;:::i;109672:151::-;;;;;;;;;;-1:-1:-1;109672:151:0;;;;;:::i;:::-;;:::i;64785:724::-;;;;;;:::i;:::-;;:::i;62722:358::-;;;;;;:::i;:::-;;:::i;66146:449::-;;;;;;;;;;-1:-1:-1;66146:449:0;;;;;:::i;:::-;66425:19;66419:4;66412:33;;;66269:14;66459:26;;;;66571:4;66555:21;;66549:28;;66146:449;106322:345;106583:66;;106322:345::o;136869:185::-;137002:1;136996:4;136989:15;137031:4;137025;137018:18;130229:163;130290:7;130315:11;130323:2;130315:7;:11::i;:::-;130310:44;;130335:19;;-1:-1:-1;;;130335:19:0;;;;;;;;;;;130310:44;130372:12;130381:2;130372:8;:12::i;:::-;130365:19;130229:163;-1:-1:-1;;130229:163:0:o;124272:1489::-;124406:22;124431:18;:16;:18::i;:::-;124406:43;-1:-1:-1;;;;;;124466:16:0;;124462:52;;124491:23;;-1:-1:-1;;;124491:23:0;;;;;;;;;;;124462:52;124527:13;124543:1;:16;;:47;124560:29;124569:19;124585:2;128745:1;128740:6;;128655:99;124569:19;91391:1;91382:10;;;91332:13;91374:19;;;124560:4;;;91374:19;;;;;;91413:1;91398:16;;;;;;91374:41;;91258:166;124560:29;124543:47;;;;;;;;;;;;;-1:-1:-1;124543:47:0;;-1:-1:-1;;;;;124543:47:0;;;;-1:-1:-1;124607:13:0;;;;124603:54;;124629:28;;-1:-1:-1;;;124629:28:0;;;;;;;;;;;124603:54;124687:4;-1:-1:-1;;;;;124674:17:0;:9;-1:-1:-1;;;;;124674:17:0;;124670:250;;-1:-1:-1;;;;;124713:25:0;;;;;;;:19;;;:25;;;;;;;;:36;;;;;;;;;;;;124708:201;;124787:20;;;;:16;;;:20;;;;;;-1:-1:-1;;;;;124774:33:0;;;124787:20;;124774:33;124770:124;;124839:35;;-1:-1:-1;;;124839:35:0;;;;;;;;;;;124770:124;124932:35;124970:18;124983:4;124970:12;:18::i;:::-;124932:56;;124999:33;125035:16;125048:2;125035:12;:16::i;:::-;125064:39;;124999:52;;-1:-1:-1;104055:19:0;;125064:39;;:23;;:39;;104055:19;;-1:-1:-1;;;125064:39:0;;-1:-1:-1;;;;;125064:39:0;;:::i;:::-;;;;;;;;-1:-1:-1;;;;;125064:39:0;;;;;;;;;;;;;;;125141:37;;-1:-1:-1;;;;125141:37:0;;104055:19;-1:-1:-1;;;125141:37:0;;;;;;;;;;;;;;-1:-1:-1;125195:74:0;-1:-1:-1;128740:6:0;;;125225:43;125250:13;125265:2;125225:24;:43::i;:::-;125195:4;;;;:74;:8;:74::i;:::-;125291:20;;;;:16;;;:20;;;;;;;;125284:27;;-1:-1:-1;;;;;;125284:27:0;;;125366:29;;-1:-1:-1;;;;125366:29:0;;-1:-1:-1;;;125366:29:0;;;;;;;;-1:-1:-1;;125366:29:0;;;;;;;;;;;;-1:-1:-1;;;;;125348:13:0;;;;125368:27;125348:7;;:13;;;;;;:48;;:13;;125366:29;125348:17;:48;:::i;:::-;125328:68;;;-1:-1:-1;125411:63:0;125429:25;128912:1;128907:6;;;128906:12;91391:1;91382:10;;;91332:13;91374:19;;;125429:4;;;91374:19;;;;;;91398:16;91413:1;91398:16;;;;;;;;91374:41;;91258:166;125429:25;-1:-1:-1;;;;;125411:13:0;;;;;;:7;;;:13;;;;;;:63;;;;;125463:9;;125411:17;:63;:::i;:::-;125503:27;;;;-1:-1:-1;;;125503:27:0;;;;;;;;;;;;-1:-1:-1;;;;125503:27:0;;;;;;;;;125545:59;125554:22;125566:9;128912:1;128907:6;;;128906:12;;128800:137;125554:22;128912:1;128907:6;;;128906:12;91391:1;91382:10;;;91332:13;91374:19;;;125578:4;;;91374:19;;;;;;91413:1;91398:16;;;;;;91374:41;125545:4;;;;:59;:8;:59::i;:::-;-1:-1:-1;;;;;125619:11:0;;;;;;:7;;;:11;;;;;:30;;125635:1;125645:2;125619:15;:30::i;:::-;125664:36;:4;;;128912:1;128907:6;;;128906:12;125697:1;125664:8;:36::i;:::-;125116:596;;125744:2;-1:-1:-1;;;;;125729:24:0;125738:4;-1:-1:-1;;;;;125729:24:0;;104055:19;125729:24;;;;1445:25:1;;1433:2;1418:18;;1299:177;125729:24:0;;;;;;;;124395:1366;;;;124272:1489;;;;:::o;131739:207::-;131930:8;131870:18;:16;:18::i;:::-;-1:-1:-1;;;;;131870:47:0;;;;;;;:36;;;;;:47;;;;;;;;:57;;;;;;;;;;;;:68;;-1:-1:-1;;131870:68:0;;;;;;;;;;;-1:-1:-1;131739:207:0:o;131105:508::-;131210:7;131235:22;131260:18;:16;:18::i;:::-;131235:43;;131291:13;131307:1;:16;;:47;131324:29;131333:19;131349:2;128745:1;128740:6;;128655:99;131324:29;131307:47;;;;;;;;;;;;;-1:-1:-1;131307:47:0;;-1:-1:-1;;;;;131307:47:0;;;;-1:-1:-1;131371:18:0;;;;131367:171;;-1:-1:-1;;;;;131411:26:0;;;;;;;:19;;;:26;;;;;;;;:37;;;;;;;;;;;;131406:121;;131476:35;;-1:-1:-1;;;131476:35:0;;;;;;;;;;;131406:121;131550:20;;;;:16;;;;:20;;;;;;:30;;-1:-1:-1;;;;;131550:30:0;;-1:-1:-1;;;;;;131550:30:0;;;;;;131600:5;-1:-1:-1;131105:508:0;;;;;:::o;130701:184::-;130758:7;130783:11;130791:2;130783:7;:11::i;:::-;130778:44;;130803:19;;-1:-1:-1;;;130803:19:0;;;;;;;;;;;130778:44;130840:18;:16;:18::i;:::-;:37;;;;:33;;:37;;-1:-1:-1;130840:37:0;;;;-1:-1:-1;;;;;130840:37:0;;130701:184::o;129619:153::-;129688:7;129715:18;:16;:18::i;:::-;-1:-1:-1;;;;;129715:37:0;;;;;;;;:30;;;;:37;;-1:-1:-1;129715:37:0;;;:49;-1:-1:-1;;;129715:49:0;;;;;129619:153::o;129442:126::-;129500:7;129527:18;:16;:18::i;:::-;:33;-1:-1:-1;;;129527:33:0;;;;;;-1:-1:-1;129442:126:0:o;138773:92::-;138819:13;138852:5;138845:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;138773:92;:::o;109959:275::-;110033:4;110050:22;110075:18;:16;:18::i;:::-;110118:10;110106:23;;;;:11;;;:23;;;;;;;;-1:-1:-1;;;;;110106:32:0;;;;;;;;;;;;:41;;;110165:37;1445:25:1;;;110106:11:0;;-1:-1:-1;110106:32:0;;110165:37;;1418:18:1;110165:37:0;;;;;;;-1:-1:-1;110222:4:0;;109959:275;-1:-1:-1;;;109959:275:0:o;109231:131::-;109283:7;109318:18;:16;:18::i;:::-;:35;-1:-1:-1;;;109318:35:0;;-1:-1:-1;;;;;109318:35:0;;;-1:-1:-1;109231:131:0:o;111594:512::-;111682:4;111699:22;111724:18;:16;:18::i;:::-;-1:-1:-1;;;;;111773:17:0;;111755:15;111773:17;;;:11;;;:17;;;;;;;;111791:10;111773:29;;;;;;;;111699:43;;-1:-1:-1;;;111819:28:0;;111815:220;;111877:7;111868:6;:16;111864:52;;;111893:23;;-1:-1:-1;;;111893:23:0;;;;;;;;;;;111864:52;-1:-1:-1;;;;;111960:17:0;;;;;;:11;;;:17;;;;;;;;111978:10;111960:29;;;;;;;111992:16;;;111960:48;;111815:220;112047:27;112057:4;112063:2;112067:6;112047:9;:27::i;:::-;-1:-1:-1;112094:4:0;;111594:512;-1:-1:-1;;;;;111594:512:0:o;63413:630::-;63508:15;62338:9;63526:46;;:15;:46;63508:64;;63744:19;63738:4;63731:33;63795:8;63789:4;63782:22;63852:7;63845:4;63839;63829:21;63822:38;64001:8;63954:45;63951:1;63948;63943:67;63644:381;63413:630::o;126233:199::-;126293:4;126310:21;126334:18;:16;:18::i;:::-;-1:-1:-1;;;;;126334:33:0;;;;;;:30;;;;;:33;;;;;126385:13;;126334:33;;-1:-1:-1;126385:13:0;;:39;;127682:14;;126385:39;;;126401:9;;;;;;;126385:39;126378:46;126233:199;-1:-1:-1;;;126233:199:0:o;126544:92::-;126596:32;126608:10;126620:7;126596:11;:32::i;:::-;126544:92;:::o;139439:173::-;66992:13;:11;:13::i;:::-;139507:49:::1;::::0;139490:12:::1;::::0;139507:10:::1;::::0;139530:21:::1;::::0;139490:12;139507:49;139490:12;139507:49;139530:21;139507:10;:49:::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;139489:67;;;139572:7;139567:37;;139588:16;;-1:-1:-1::0;;;139588:16:0::1;;;;;;;;;;;129279:111:::0;129324:7;129351:18;:16;:18::i;:::-;:31;;;-1:-1:-1;;;;;129351:31:0;;129279:111;-1:-1:-1;129279:111:0:o;64128:466::-;64334:19;64328:4;64321:33;64381:8;64375:4;64368:22;64434:1;64427:4;64421;64411:21;64404:32;64567:8;64521:44;64518:1;64515;64510:66;64128:466::o;138977:101::-;66992:13;:11;:13::i;:::-;139051:8:::1;:19;139062:8:::0;;139051;:19:::1;:::i;:::-;;138977:101:::0;;:::o;109431:143::-;109494:7;109521:18;:16;:18::i;:::-;-1:-1:-1;;;;;109521:37:0;;;;;;;;:30;;;;:37;;-1:-1:-1;109521:37:0;;;:45;-1:-1:-1;;;109521:45:0;;-1:-1:-1;;;;;109521:45:0;;109431:143::o;63148:102::-;66992:13;:11;:13::i;:::-;63221:21:::1;63239:1;63221:9;:21::i;:::-;63148:102::o:0;139324:107::-;66992:13;:11;:13::i;:::-;139402:21:::1;139414:1;139417:5;139402:11;:21::i;:::-;139324:107:::0;;:::o;138873:96::-;138921:13;138954:7;138947:14;;;;;:::i;110747:150::-;110817:4;110834:33;110844:10;110856:2;110860:6;110834:9;:33::i;:::-;-1:-1:-1;110885:4:0;110747:150;;;;:::o;139086:230::-;139151:13;139190:8;139184:22;;;;;:::i;:::-;;;139210:1;139184:27;:124;;;;;;;;;;;;;;;;;139251:8;139261:27;139280:7;139261:18;:27::i;:::-;139234:55;;;;;;;;;:::i;:::-;;;;;;;;;;;;;139177:131;139086:230;-1:-1:-1;;139086:230:0:o;109672:151::-;109744:7;109771:18;:16;:18::i;:::-;-1:-1:-1;;;;;109771:35:0;;;;;;;:28;;;;;:35;;;;;;;;:44;;;;;;;;;;-1:-1:-1;109771:44:0;;;109672:151::o;64785:724::-;66992:13;:11;:13::i;:::-;65023:19:::1;65017:4;65010:33;65070:12;65064:4;65057:26;65133:4;65127;65117:21;65241:12;65235:19;65222:11;65219:36;65216:160;;;65288:10;65282:4;65275:24;65356:4;65350;65343:18;65216:160;65455:1;65434:23:::0;;65478::::1;65488:12:::0;65478:9:::1;:23::i;62722:358::-:0;66992:13;:11;:13::i;:::-;62897:8:::1;62893:2;62889:17;62879:153;;62940:10;62934:4;62927:24;63012:4;63006;62999:18;62879:153;63053:19;63063:8;63053:9;:19::i;130444:118::-:0;130504:4;;130528:12;130537:2;130528:8;:12::i;:::-;-1:-1:-1;;;;;130528:26:0;;;;130444:118;-1:-1:-1;;130444:118:0:o;129911:197::-;129972:7;129992:22;130017:18;:16;:18::i;:::-;129992:43;;130053:1;:16;;:47;130070:29;130079:19;130095:2;128745:1;128740:6;;128655:99;130079:19;91391:1;91382:10;;;91332:13;91374:19;;;130070:4;;;91374:19;;;;;;91413:1;91398:16;;;;;;91374:41;;91258:166;130070:29;130053:47;;;;;;;;;;;;;-1:-1:-1;130053:47:0;;-1:-1:-1;;;;;130053:47:0;;129911:197;-1:-1:-1;;;129911:197:0:o;91258:166::-;91391:1;91382:10;;;91332:13;91374:19;;;;;;;;;;;;;91413:1;91398:16;;;;;;91374:41;;91258:166::o;127165:294::-;127216:21;127250:22;127275:18;:16;:18::i;:::-;-1:-1:-1;;;;;127308:16:0;;;;;;:13;;;:16;;;;;127342:13;;127308:16;;-1:-1:-1;127250:43:0;;-1:-1:-1;127342:13:0;;127337:115;;127372:20;;-1:-1:-1;;127372:20:0;127388:4;127372:20;;;127411:11;127420:1;127682:14;;127529:217;127411:11;127407:33;;;127424:16;;-1:-1:-1;;127424:16:0;;;;;127407:33;127239:220;127165:294;;;:::o;127912:452::-;128029:19;128066:22;128091:18;:16;:18::i;:::-;128135:26;;;;;;;;-1:-1:-1;128066:43:0;-1:-1:-1;128135:26:0;128176:17;;;128172:185;;128225:14;;128227:1;;:12;;128225:14;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;128254:41;;;;;-1:-1:-1;;128254:41:0;;;;;;-1:-1:-1;128310:30:0;;;128254:26;128310:16;;:30;;;;;:35;;-1:-1:-1;;;;;128310:35:0;;-1:-1:-1;;;;;;128310:35:0;;;;;;128225:14;-1:-1:-1;128172:185:0;128055:309;127912:452;;;;:::o;91492:542::-;91658:8;91652:4;91645:22;91701:5;91698:1;91694:13;91688:4;91681:27;91747:4;91741;91731:21;91810:1;91803:5;91799:13;91796:1;91792:21;91873:1;91867:8;91921:10;92006:5;92002:1;91999;91995:9;91991:21;91988:1;91984:29;91981:1;91977:37;91974:1;91970:45;91967:1;91960:56;;;;;91492:542;;;:::o;120614:3233::-;-1:-1:-1;;;;;120699:16:0;;120695:52;;120724:23;;-1:-1:-1;;;120724:23:0;;;;;;;;;;;120695:52;120760:22;120785:18;:16;:18::i;:::-;120760:43;;120816:35;120854:18;120867:4;120854:12;:18::i;:::-;120816:56;;120883:33;120919:16;120932:2;120919:12;:16::i;:::-;120883:52;;120948:23;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;120948:23:0;121002:27;;;-1:-1:-1;;;121002:27:0;;;;;120982:17;;;:47;121058:25;;;;121040:15;;;:43;-1:-1:-1;;;;;;;;121110:23:0;;;;121094:13;;;:39;;;121150:22;;121146:56;;;121181:21;;-1:-1:-1;;;121181:21:0;;;;;;;;;;;121146:56;121240:13;;;:23;;;;;;;;;121278:47;;-1:-1:-1;;;;;121278:47:0;;;-1:-1:-1;;;121278:47:0;;;-1:-1:-1;;;;121278:47:0;;;;;;121385:21;;;;;;;:30;;121371:11;;;:44;;;121340:76;;;;;;;;;121467:17;;;;121453:54;;104055:19;;121486:20;128577:8;;;128587:9;;128573:24;;128411:204;121453:54;121433:74;;121529:21;;;;;;;121524:133;;121591:50;104055:19;121605:1;:11;;;:18;;;;;:::i;:::-;;121625:1;:15;;;128577:8;;;128587:9;;128573:24;;128411:204;121591:50;121571:17;;;:70;121524:133;121673:29;121705:56;121743:1;:17;;;121723:1;:17;;;:37;-1:-1:-1;;;;;;;;;;;;;;;;;112849:4:0;112842;112836:11;112832:22;112925:1;112919:4;112912:15;112965:4;112959;112955:15;113016:1;113013;113009:9;113001:6;112997:22;112991:4;112984:36;113044:4;113041:1;113034:15;113084:6;113080:1;113074:4;113070:12;113063:28;;;112659:450;;;;121705:56;121782:17;;121673:88;;-1:-1:-1;121782:22:0;121778:750;;-1:-1:-1;;;;;121862:13:0;;121825:34;121862:13;;;:7;;;:13;;;;;121914:17;;;;121980;;122016:45;;;-1:-1:-1;;;122016:45:0;;;;;;;;;;;;-1:-1:-1;;;;122016:45:0;;;;;;121968:29;;122111:336;-1:-1:-1;;122164:11:0;;;;91391:1;91382:10;;;122137;91374:19;;;;;;;;;;;122164:11;;;91398:16;91413:1;91398:16;;;;91374:41;122137:39;;;;122199:28;122208:15;122220:2;128912:1;128907:6;;;128906:12;;128800:137;122208:15;122199:4;;;;122225:1;122199:8;:28::i;:::-;122250:32;122259:19;122275:2;128745:1;128740:6;;128655:99;122250:32;122312:20;;;;:16;;;:20;;;;;;;;122305:27;;-1:-1:-1;;;;;;122305:27:0;;;113440:12;;;113434:19;;113504:1;113500:10;;;;113492:2;113488:10;;;113485:26;-1:-1:-1;113482:39:0;113467:55;;113557:17;;113536:39;;122425:20;;;122111:336;;-1:-1:-1;122465:47:0;;;;;;-1:-1:-1;;;122465:47:0;-1:-1:-1;;;;122465:47:0;;;;;;-1:-1:-1;121778:750:0;122548:17;;;;:22;122544:1116;;-1:-1:-1;;;;;122626:11:0;;122591:32;122626:11;;;:7;;;:11;;;;;;;122674:15;;;;122734:17;;;;122626:11;;122724:27;;;;122787:43;122812:13;122634:2;122787:24;:43::i;:::-;122868:18;;122984:17;;;;-1:-1:-1;;;;122957:45:0;;122925:13;-1:-1:-1;;;122957:45:0;;;;;;;;;;;;;;;;123021:41;;-1:-1:-1;;;;123021:41:0;-1:-1:-1;;;123021:41:0;;;;;;;122770:60;;-1:-1:-1;104055:19:0;-1:-1:-1;;;122868:18:0;;-1:-1:-1;;;;;122868:18:0;:25;;122925:13;;;;;123112:488;123145:29;123154:19;123170:2;128745:1;128740:6;;128655:99;123154:19;91391:1;91382:10;;;91332:13;91374:19;;;123145:4;;;91374:19;;;;;;91413:1;91398:16;;;;;;91374:41;;91258:166;123145:29;:34;;;123138:121;;123212:4;;:15;;;123208:27;;;-1:-1:-1;123234:1:0;123208:27;123138:121;;;123281:32;:7;123293;123309:2;123281:11;:32::i;:::-;123336:38;123345:19;123361:2;128745:1;128740:6;;128655:99;123345:19;123336:4;;;;123366:7;123336:8;:38::i;:::-;123397:44;128912:1;128907:6;;;128906:12;123430:9;;;;123397:4;;;;:44;:8;:44::i;:::-;123464:40;123482:10;123494:2;123498;123502:1;113450;113444:4;113440:12;113434:19;113513:7;113507:2;113504:1;113500:10;113496:1;113492:2;113488:10;113485:26;113482:39;113474:6;113467:55;113569:4;113561:6;113557:17;113553:1;113547:4;113543:12;113536:39;;113216:377;;;;;123464:40;123531:4;;:15;;;123527:27;;;-1:-1:-1;123553:1:0;123527:27;123593:5;123582:7;:16;123112:488;;123618:26;;;;;;;;-1:-1:-1;;123618:26:0;;;;;;-1:-1:-1;;;;;122544:1116:0;123680:15;;:22;:27;123676:111;;123756:14;;;;123728:43;;123744:10;;-1:-1:-1;;;;;123756:14:0;123728:15;:43::i;:::-;121215:2583;123828:2;-1:-1:-1;;;;;123813:26:0;123822:4;-1:-1:-1;;;;;123813:26:0;;123832:6;123813:26;;;;1445:25:1;;1433:2;1418:18;;1299:177;123813:26:0;;;;;;;;120684:3163;;;;120614:3233;;;:::o;126855:139::-;126945:5;126919:15;126932:1;126919:12;:15::i;:::-;:31;;;;;;;-1:-1:-1;;126919:31:0;;;;;;;;;126966:20;;1272:14:1;;1265:22;1247:41;;-1:-1:-1;;;;;126966:20:0;;;;;1235:2:1;1220:18;126966:20:0;;;;;;;126855:139;;:::o;61643:364::-;-1:-1:-1;;61853:18:0;61843:8;61840:32;61830:159;;61906:10;61900:4;61893:24;61969:4;61963;61956:18;60469:1113;-1:-1:-1;;61436:16:0;;-1:-1:-1;;;;;61282:26:0;;;;;;61396:38;61393:1;;61385:78;61522:27;60469:1113::o;3043:1676::-;3099:17;3551:4;3544;3538:11;3534:22;3527:29;;3652:4;3647:3;3643:14;3637:4;3630:28;3735:1;3730:3;3723:14;3839:3;3871:1;3867:6;4083:5;4065:410;4122:11;;;;4306:2;4320;4310:13;;4302:22;4122:11;4289:36;4414:2;4404:13;;4435:25;4065:410;4435:25;-1:-1:-1;;4505:13:0;;;-1:-1:-1;;4620:14:0;;;4682:19;;;4620:14;3043:1676;-1:-1:-1;3043:1676:0:o;113691:739::-;113859:1;113853:8;113894:4;113888;113884:15;113953:10;113950:1;113943:21;114028:4;114021;114018:1;114014:12;114007:26;114124:4;114118:11;114115:1;114111:19;114105:4;114101:30;114092:39;;114350:4;114344;114341:1;114334:4;114331:1;114327:12;114324:1;114316:6;114309:5;114304:51;114275:4;114257:16;114254:26;114250:1;114243:4;114237:11;114234:18;114230:51;114204:170;114176:236;;114405:4;114399;114392:18;114176:236;;;113691:739;;:::o;14:250:1:-;99:1;109:113;123:6;120:1;117:13;109:113;;;199:11;;;193:18;180:11;;;173:39;145:2;138:10;109:113;;;-1:-1:-1;;256:1:1;238:16;;231:27;14:250::o;269:396::-;418:2;407:9;400:21;381:4;450:6;444:13;493:6;488:2;477:9;473:18;466:34;509:79;581:6;576:2;565:9;561:18;556:2;548:6;544:15;509:79;:::i;:::-;649:2;628:15;-1:-1:-1;;624:29:1;609:45;;;;656:2;605:54;;269:396;-1:-1:-1;;269:396:1:o;670:173::-;738:20;;-1:-1:-1;;;;;787:31:1;;777:42;;767:70;;833:1;830;823:12;767:70;670:173;;;:::o;848:254::-;916:6;924;977:2;965:9;956:7;952:23;948:32;945:52;;;993:1;990;983:12;945:52;1016:29;1035:9;1016:29;:::i;:::-;1006:39;1092:2;1077:18;;;;1064:32;;-1:-1:-1;;;848:254:1:o;1481:328::-;1558:6;1566;1574;1627:2;1615:9;1606:7;1602:23;1598:32;1595:52;;;1643:1;1640;1633:12;1595:52;1666:29;1685:9;1666:29;:::i;:::-;1656:39;;1714:38;1748:2;1737:9;1733:18;1714:38;:::i;:::-;1704:48;;1799:2;1788:9;1784:18;1771:32;1761:42;;1481:328;;;;;:::o;1814:186::-;1873:6;1926:2;1914:9;1905:7;1901:23;1897:32;1894:52;;;1942:1;1939;1932:12;1894:52;1965:29;1984:9;1965:29;:::i;2005:160::-;2070:20;;2126:13;;2119:21;2109:32;;2099:60;;2155:1;2152;2145:12;2170:180;2226:6;2279:2;2267:9;2258:7;2254:23;2250:32;2247:52;;;2295:1;2292;2285:12;2247:52;2318:26;2334:9;2318:26;:::i;2752:592::-;2823:6;2831;2884:2;2872:9;2863:7;2859:23;2855:32;2852:52;;;2900:1;2897;2890:12;2852:52;2940:9;2927:23;2969:18;3010:2;3002:6;2999:14;2996:34;;;3026:1;3023;3016:12;2996:34;3064:6;3053:9;3049:22;3039:32;;3109:7;3102:4;3098:2;3094:13;3090:27;3080:55;;3131:1;3128;3121:12;3080:55;3171:2;3158:16;3197:2;3189:6;3186:14;3183:34;;;3213:1;3210;3203:12;3183:34;3258:7;3253:2;3244:6;3240:2;3236:15;3232:24;3229:37;3226:57;;;3279:1;3276;3269:12;3226:57;3310:2;3302:11;;;;;3332:6;;-1:-1:-1;2752:592:1;;-1:-1:-1;;;;2752:592:1:o;3349:254::-;3414:6;3422;3475:2;3463:9;3454:7;3450:23;3446:32;3443:52;;;3491:1;3488;3481:12;3443:52;3514:29;3533:9;3514:29;:::i;:::-;3504:39;;3562:35;3593:2;3582:9;3578:18;3562:35;:::i;:::-;3552:45;;3349:254;;;;;:::o;3608:180::-;3667:6;3720:2;3708:9;3699:7;3695:23;3691:32;3688:52;;;3736:1;3733;3726:12;3688:52;-1:-1:-1;3759:23:1;;3608:180;-1:-1:-1;3608:180:1:o;3793:260::-;3861:6;3869;3922:2;3910:9;3901:7;3897:23;3893:32;3890:52;;;3938:1;3935;3928:12;3890:52;3961:29;3980:9;3961:29;:::i;:::-;3951:39;;4009:38;4043:2;4032:9;4028:18;4009:38;:::i;4058:127::-;4119:10;4114:3;4110:20;4107:1;4100:31;4150:4;4147:1;4140:15;4174:4;4171:1;4164:15;4190:191;-1:-1:-1;;;;;4317:10:1;;;4305;;;4301:27;;4340:12;;;4337:38;;;4355:18;;:::i;4386:380::-;4465:1;4461:12;;;;4508;;;4529:61;;4583:4;4575:6;4571:17;4561:27;;4529:61;4636:2;4628:6;4625:14;4605:18;4602:38;4599:161;;4682:10;4677:3;4673:20;4670:1;4663:31;4717:4;4714:1;4707:15;4745:4;4742:1;4735:15;4981:127;5042:10;5037:3;5033:20;5030:1;5023:31;5073:4;5070:1;5063:15;5097:4;5094:1;5087:15;5239:518;5341:2;5336:3;5333:11;5330:421;;;5377:5;5374:1;5367:16;5421:4;5418:1;5408:18;5491:2;5479:10;5475:19;5472:1;5468:27;5462:4;5458:38;5527:4;5515:10;5512:20;5509:47;;;-1:-1:-1;5550:4:1;5509:47;5605:2;5600:3;5596:12;5593:1;5589:20;5583:4;5579:31;5569:41;;5660:81;5678:2;5671:5;5668:13;5660:81;;;5737:1;5723:16;;5704:1;5693:13;5660:81;;;5664:3;;5239:518;;;:::o;5933:1198::-;6057:18;6052:3;6049:27;6046:53;;;6079:18;;:::i;:::-;6108:94;6198:3;6158:38;6190:4;6184:11;6158:38;:::i;:::-;6152:4;6108:94;:::i;:::-;6228:1;6253:2;6248:3;6245:11;6270:1;6265:608;;;;6917:1;6934:3;6931:93;;;-1:-1:-1;6990:19:1;;;6977:33;6931:93;-1:-1:-1;;5890:1:1;5886:11;;;5882:24;5878:29;5868:40;5914:1;5910:11;;;5865:57;7037:78;;6238:887;;6265:608;5186:1;5179:14;;;5223:4;5210:18;;-1:-1:-1;;6301:17:1;;;6416:229;6430:7;6427:1;6424:14;6416:229;;;6519:19;;;6506:33;6491:49;;6626:4;6611:20;;;;6579:1;6567:14;;;;6446:12;6416:229;;;6420:3;6673;6664:7;6661:16;6658:159;;;6797:1;6793:6;6787:3;6781;6778:1;6774:11;6770:21;6766:34;6762:39;6749:9;6744:3;6740:19;6727:33;6723:79;6715:6;6708:95;6658:159;;;6860:1;6854:3;6851:1;6847:11;6843:19;6837:4;6830:33;6238:887;;5933:1198;;;:::o;7136:1021::-;7312:3;7341:1;7374:6;7368:13;7404:36;7430:9;7404:36;:::i;:::-;7459:1;7476:17;;;7502:133;;;;7649:1;7644:358;;;;7469:533;;7502:133;-1:-1:-1;;7535:24:1;;7523:37;;7608:14;;7601:22;7589:35;;7580:45;;;-1:-1:-1;7502:133:1;;7644:358;7675:6;7672:1;7665:17;7705:4;7750;7747:1;7737:18;7777:1;7791:165;7805:6;7802:1;7799:13;7791:165;;;7883:14;;7870:11;;;7863:35;7926:16;;;;7820:10;;7791:165;;;7795:3;;;7985:6;7980:3;7976:16;7969:23;;7469:533;;;;;8033:6;8027:13;8049:68;8108:8;8103:3;8096:4;8088:6;8084:17;8049:68;:::i;:::-;8133:18;;7136:1021;-1:-1:-1;;;;7136:1021:1:o;8162:201::-;8200:3;8228:10;8273:2;8266:5;8262:14;8300:2;8291:7;8288:15;8285:41;;8306:18;;:::i;:::-;8355:1;8342:15;;8162:201;-1:-1:-1;;;8162:201:1:o;8368:127::-;8429:10;8424:3;8420:20;8417:1;8410:31;8460:4;8457:1;8450:15;8484:4;8481:1;8474:15

Swarm Source

ipfs://226838afe80950006629333ceb806be82db86c593643dcafbcd8b7e1350e11fe
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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