ETH Price: $3,421.50 (+3.04%)

Token

Fortunata World Pass (FWP)
 

Overview

Max Total Supply

553 FWP

Holders

228

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
chengqt.eth
Balance
14 FWP
0x0bd8c2993520f8aa4075ffcdf3b7b460346faa2e
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

A private group of adventurers and worldbuilders. Membership to Heroic Story: World Pass RPG and all of the benefits that come from holding Fortunata World Pass One. Learn more about the project at: https://www.heroicstory.com/ and https://twitter.com/_heroicstory

# Exchange Pair Price  24H Volume % Volume
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
WorldPassNFT

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 31 : WorldPassNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./interfaces/IWorldPassNFT.sol";
import "@thirdweb-dev/contracts/base/ERC721Base.sol";
import "@thirdweb-dev/contracts/extension/Permissions.sol";
import "@thirdweb-dev/contracts/extension/DefaultOperatorFilterer.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract WorldPassNFT is IWorldPassNFT, ERC721Base, Permissions, DefaultOperatorFilterer {
    using HouseUtil for House;

    bytes32 public constant MINTER_ROLE =
        keccak256("MINTER_ROLE");

    bytes32 public constant ATTRIBUTE_ADMIN_ROLE =
        keccak256("ATTRIBUTE_ADMIN_ROLE");

    string private imageDirURI = "";
    uint256 private maxSupply = 0;
    uint256 private maxHouseSupply = 0;
    mapping(uint256 => TokenData) private tokenDataMap;

    mapping(uint256 => uint256) private houseSupplies;

    /**
     * The token doesn't exist
     */
    error TokenDoesntExist();

    modifier tokenExists(uint256 _tokenId) {
        if (!_exists(_tokenId)) revert TokenDoesntExist();
        _;
    }

    /**
     *  @notice          Constructor for WorldPass contract.
     *
     *  @param _name             Name of contract.
     *  @param _symbol           Token Symbol.
     *  @param _royaltyRecipient Address
     *  @param _royaltyBps       Royalty Bps.
     *  @param _imageDirURI      URI to root dir for WP images. Full image URI is generated in @see _getHouseImageURI()
     *  @param _maxSupply        Max Supply of token (0 => unlimitted; anything else is the exact supply).
     */
    constructor(
        string memory _name,
        string memory _symbol,
        string memory _imageDirURI,
        string memory _contractURI,
        address _royaltyRecipient,
        uint128 _royaltyBps,
        uint256 _maxSupply,
        uint256 _maxHouseSupply
    ) ERC721Base(_name, _symbol, _royaltyRecipient, _royaltyBps) {
        _setupContractURI(_contractURI);
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(MINTER_ROLE, msg.sender);
        _setupRole(ATTRIBUTE_ADMIN_ROLE, msg.sender);
        imageDirURI = _imageDirURI;
        maxSupply = _maxSupply;
        maxHouseSupply = _maxHouseSupply;
    }

    function setTokenHouse(uint256 _tokenId, House _house) public override tokenExists(_tokenId) onlyRole(ATTRIBUTE_ADMIN_ROLE) {
        TokenData memory dataItem = tokenDataMap[_tokenId];

        // Guarantees it will only allow to be set once
        require(!dataItem.__exists, "Can't change House attribute once it's set!");

        require(houseSupplies[uint256(_house)] < maxHouseSupply, "Can't mint more than maxHouseSupply");        

        tokenDataMap[_tokenId] = _initTokenData(_tokenId, _house);
        ++houseSupplies[uint256(_house)];
    }

    function getTokenHouse(uint256 _tokenId) public view override tokenExists(_tokenId) returns (House){
        TokenData memory dataItem = tokenDataMap[_tokenId];

        // default of non-set dataItem's house is going to be first enum val -> Scarred
        return dataItem.house;
    }

    /**
     * A new mint method to include a house param.
     */
    function mintWithHouseTo(address _to, House _house) public virtual override {
        require(_canMint(), "Not authorized to mint.");

        uint256 tokenId = nextTokenIdToMint();

        _safeMint(_to, 1, "");
        setTokenHouse(tokenId, _house);
    }

    /**
     * A new batch mint method to include a house param.
     */
    function batchMintWithHouseTo(
        address _to,
        uint256 _quantity,
        House _house
    ) public virtual override {
        require(_canMint(), "Not authorized to mint.");

        uint256 tokenId = nextTokenIdToMint();

        _safeMint(_to, _quantity, "");

        for (uint256 i = tokenId; i < tokenId + _quantity; i++) {
            setTokenHouse(i, _house);
        }
    }

    /**
     *  @notice         Returns the metadata of an NFT.
     *
     *  @param _tokenId The tokenId of an NFT.
     */
    function tokenURI(uint256 _tokenId)
        public
        view
        virtual
        override
        tokenExists(_tokenId)
        returns (string memory)
    {
        TokenData memory tokenData = tokenDataMap[_tokenId];

        string memory houseAttribute = "";

        if (tokenData.house == House.Scarred) {
            houseAttribute = _getBoolTraitAttributeJson(
                "Scarred",
                true
            );
        } else {
            houseAttribute = _getStringTraitAttributeJson(
                "House",
                tokenData.house.toString()
            );
        }

        return string(
            abi.encodePacked(
                "data:application/json;base64,",
                Base64.encode(
                    abi.encodePacked(
                        '{"name": "',
                        '#', Strings.toString(_tokenId),
                        '", "image": "',
                        _getHouseMediaURI(_tokenId),
                        '.png", "animation_url": "', 
                        _getHouseMediaURI(_tokenId),
                        '.mp4", "attributes": [',
                        houseAttribute,
                        "]}"
                    )
                )
            )
        );
    }

    /**
     *  @notice         Returns the remaining supply for the given house.
     *
     *  @param _house The house to query remaining supply of.
     */
    function getRemainingHouseSupply(House _house) external view returns (uint256) {
        return maxHouseSupply - houseSupplies[uint256(_house)];
    }

    function setImageDirURI(string calldata _imageDirURI) public onlyRole(DEFAULT_ADMIN_ROLE) {
        imageDirURI = _imageDirURI;
    }

    /**
     * Override to limit roles.
     */
    function _canMint() internal view virtual override returns (bool) {
        return hasRole(MINTER_ROLE, msg.sender);
    }

    function _afterTokenTransfers(
        address from,
        address,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual override {
        // in the case of minting
        if (from == address(0)) {
            require(startTokenId + quantity <= maxSupply, "Can't go over max supply!");
        }
    }

    function _initTokenData(uint256 _tokenId, House _house) internal view returns (TokenData memory) {
        require(!tokenDataMap[_tokenId].__exists, "TokenData already exists!");

        TokenData memory result = TokenData({
            house: _house,
            __exists: true
        });

        return result;
    }

    /**
     *  @notice         Returns the WP image of a specific house.
     *
     *  @param _tokenId The tokenId of an NFT.
     */
    function _getHouseMediaURI(uint256 _tokenId) internal view returns (string memory) {
        TokenData memory tokenData = tokenDataMap[_tokenId];

        return string(abi.encodePacked(imageDirURI, Strings.toString(uint(tokenData.house))));
    }

    function _getStringTraitAttributeJson(string memory _name, string memory _value) pure internal returns (string memory) {
        return string(abi.encodePacked(
            '{"trait_type": "', _name, '", "value": "', _value, '"}'
        ));
    }

    function _getBoolTraitAttributeJson(string memory _name, bool _value) pure internal returns (string memory) {
        return string(abi.encodePacked(
            '{"trait_type": "', _name, '", "value": ', _value ? 'true': 'false', '}'
        ));
    }

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public override onlyAllowedOperator(from) {
        super.transferFrom(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId, data);
    }
}

File 2 of 31 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return result;
    }
}

File 3 of 31 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 31 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

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

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

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

File 5 of 31 : ERC721Base.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import { ERC721A } from "../eip/ERC721A.sol";

import "../extension/ContractMetadata.sol";
import "../extension/Multicall.sol";
import "../extension/Ownable.sol";
import "../extension/Royalty.sol";
import "../extension/BatchMintMetadata.sol";

import "../lib/TWStrings.sol";

/**
 *  The `ERC721Base` smart contract implements the ERC721 NFT standard, along with the ERC721A optimization to the standard.
 *  It includes the following additions to standard ERC721 logic:
 *
 *      - Ability to mint NFTs via the provided `mint` function.
 *
 *      - Contract metadata for royalty support on platforms such as OpenSea that use
 *        off-chain information to distribute roaylties.
 *
 *      - Ownership of the contract, with the ability to restrict certain functions to
 *        only be called by the contract's owner.
 *
 *      - Multicall capability to perform multiple actions atomically
 *
 *      - EIP 2981 compliance for royalty support on NFT marketplaces.
 */

contract ERC721Base is ERC721A, ContractMetadata, Multicall, Ownable, Royalty, BatchMintMetadata {
    using TWStrings for uint256;

    /*//////////////////////////////////////////////////////////////
                            Mappings
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => string) private fullURI;

    /*//////////////////////////////////////////////////////////////
                            Constructor
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        address _royaltyRecipient,
        uint128 _royaltyBps
    ) ERC721A(_name, _symbol) {
        _setupOwner(msg.sender);
        _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
    }

    /*//////////////////////////////////////////////////////////////
                            ERC165 Logic
    //////////////////////////////////////////////////////////////*/

    /// @dev See ERC165: https://eips.ethereum.org/EIPS/eip-165
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, IERC165) returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721
            interfaceId == 0x5b5e139f || // ERC165 Interface ID for ERC721Metadata
            interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981
    }

    /*//////////////////////////////////////////////////////////////
                        Overriden ERC721 logic
    //////////////////////////////////////////////////////////////*/

    /**
     *  @notice         Returns the metadata URI for an NFT.
     *  @dev            See `BatchMintMetadata` for handling of metadata in this contract.
     *
     *  @param _tokenId The tokenId of an NFT.
     */
    function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
        string memory fullUriForToken = fullURI[_tokenId];
        if (bytes(fullUriForToken).length > 0) {
            return fullUriForToken;
        }

        string memory batchUri = _getBaseURI(_tokenId);
        return string(abi.encodePacked(batchUri, _tokenId.toString()));
    }

    /*//////////////////////////////////////////////////////////////
                            Minting logic
    //////////////////////////////////////////////////////////////*/

    /**
     *  @notice          Lets an authorized address mint an NFT to a recipient.
     *  @dev             The logic in the `_canMint` function determines whether the caller is authorized to mint NFTs.
     *
     *  @param _to       The recipient of the NFT to mint.
     *  @param _tokenURI The full metadata URI for the NFT minted.
     */
    function mintTo(address _to, string memory _tokenURI) public virtual {
        require(_canMint(), "Not authorized to mint.");
        _setTokenURI(nextTokenIdToMint(), _tokenURI);
        _safeMint(_to, 1, "");
    }

    /**
     *  @notice          Lets an authorized address mint multiple NFTs at once to a recipient.
     *  @dev             The logic in the `_canMint` function determines whether the caller is authorized to mint NFTs.
     *
     *  @param _to       The recipient of the NFT to mint.
     *  @param _quantity The number of NFTs to mint.
     *  @param _baseURI  The baseURI for the `n` number of NFTs minted. The metadata for each NFT is `baseURI/tokenId`
     *  @param _data     Additional data to pass along during the minting of the NFT.
     */
    function batchMintTo(
        address _to,
        uint256 _quantity,
        string memory _baseURI,
        bytes memory _data
    ) public virtual {
        require(_canMint(), "Not authorized to mint.");
        _batchMintMetadata(nextTokenIdToMint(), _quantity, _baseURI);
        _safeMint(_to, _quantity, _data);
    }

    /**
     *  @notice         Lets an owner or approved operator burn the NFT of the given tokenId.
     *  @dev            ERC721A's `_burn(uint256,bool)` internally checks for token approvals.
     *
     *  @param _tokenId The tokenId of the NFT to burn.
     */
    function burn(uint256 _tokenId) external virtual {
        _burn(_tokenId, true);
    }

    /*//////////////////////////////////////////////////////////////
                        Public getters
    //////////////////////////////////////////////////////////////*/

    /// @notice The tokenId assigned to the next new NFT to be minted.
    function nextTokenIdToMint() public view virtual returns (uint256) {
        return _currentIndex;
    }

    /// @notice Returns whether a given address is the owner, or approved to transfer an NFT.
    function isApprovedOrOwner(address _operator, uint256 _tokenId)
        public
        view
        virtual
        returns (bool isApprovedOrOwnerOf)
    {
        address owner = ownerOf(_tokenId);
        isApprovedOrOwnerOf = (_operator == owner ||
            isApprovedForAll(owner, _operator) ||
            getApproved(_tokenId) == _operator);
    }

    /*//////////////////////////////////////////////////////////////
                        Internal (overrideable) functions
    //////////////////////////////////////////////////////////////*/

    function _setTokenURI(uint256 _tokenId, string memory _tokenURI) internal virtual {
        require(bytes(fullURI[_tokenId]).length == 0, "URI already set");
        fullURI[_tokenId] = _tokenURI;
    }

    /// @dev Returns whether contract metadata can be set in the given execution context.
    function _canSetContractURI() internal view virtual override returns (bool) {
        return msg.sender == owner();
    }

    /// @dev Returns whether a token can be minted in the given execution context.
    function _canMint() internal view virtual returns (bool) {
        return msg.sender == owner();
    }

    /// @dev Returns whether owner can be set in the given execution context.
    function _canSetOwner() internal view virtual override returns (bool) {
        return msg.sender == owner();
    }

    /// @dev Returns whether royalty info can be set in the given execution context.
    function _canSetRoyaltyInfo() internal view virtual override returns (bool) {
        return msg.sender == owner();
    }
}

File 6 of 31 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./interface/IERC165.sol";

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

File 7 of 31 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v3.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import "./interface/IERC721A.sol";
import "../openzeppelin-presets/token/ERC721/IERC721Receiver.sol";
import "../lib/TWAddress.sol";
import "../openzeppelin-presets/utils/Context.sol";
import "../lib/TWStrings.sol";
import "./ERC165.sol";

/**
 * @dev Implementation of [ERC721](https://eips.ethereum.org/EIPS/eip-721) Non-Fungible Token Standard, including
 * the Metadata extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
 *
 * Assumes that an owner cannot have more than 2^64 - 1 (max value of uint64) of supply.
 *
 * Assumes that the maximum token id cannot exceed 2^256 - 1 (max value of uint256).
 */
contract ERC721A is Context, ERC165, IERC721A {
    using TWAddress for address;
    using TWStrings for uint256;

    // The tokenId of the next token to be minted.
    uint256 internal _currentIndex;

    // The number of tokens burned.
    uint256 internal _burnCounter;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to ownership details
    // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
    mapping(uint256 => TokenOwnership) internal _ownerships;

    // Mapping owner address to address data
    mapping(address => AddressData) private _addressData;

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

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

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

    /**
     * To change the starting tokenId, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
     */
    function totalSupply() public view override returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than _currentIndex - _startTokenId() times
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

    /**
     * Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view returns (uint256) {
        // Counter underflow is impossible as _currentIndex does not decrement,
        // and it is initialized to _startTokenId()
        unchecked {
            return _currentIndex - _startTokenId();
        }
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return uint256(_addressData[owner].balance);
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return uint256(_addressData[owner].numberMinted);
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        return uint256(_addressData[owner].numberBurned);
    }

    /**
     * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(address owner) internal view returns (uint64) {
        return _addressData[owner].aux;
    }

    /**
     * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(address owner, uint64 aux) internal {
        _addressData[owner].aux = aux;
    }

    /**
     * Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around in the collection over time.
     */
    function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId() <= curr)
                if (curr < _currentIndex) {
                    TokenOwnership memory ownership = _ownerships[curr];
                    if (!ownership.burned) {
                        if (ownership.addr != address(0)) {
                            return ownership;
                        }
                        // Invariant:
                        // There will always be an ownership that has an address and is not burned
                        // before an ownership that does not have an address and is not burned.
                        // Hence, curr will not underflow.
                        while (true) {
                            curr--;
                            ownership = _ownerships[curr];
                            if (ownership.addr != address(0)) {
                                return ownership;
                            }
                        }
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return _ownershipOf(tokenId).addr;
    }

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

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

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

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

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

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public override {
        address owner = ERC721A.ownerOf(tokenId);
        if (to == owner) revert ApprovalToCurrentOwner();

        if (_msgSender() != owner)
            if (!isApprovedForAll(owner, _msgSender())) {
                revert ApprovalCallerNotOwnerNorApproved();
            }

        _approve(to, tokenId, owner);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId];
    }

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

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

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

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        _transfer(from, to, tokenId);
        if (to.isContract())
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

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

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, quantity, "");
    }

    /**
     * @dev Safely mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement
     *   {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are incredibly unrealistic.
        // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
        unchecked {
            _addressData[to].balance += uint64(quantity);
            _addressData[to].numberMinted += uint64(quantity);

            _ownerships[startTokenId].addr = to;
            _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);

            uint256 updatedIndex = startTokenId;
            uint256 end = updatedIndex + quantity;

            if (to.isContract()) {
                do {
                    emit Transfer(address(0), to, updatedIndex);
                    if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (updatedIndex < end);
                // Reentrancy protection
                if (_currentIndex != startTokenId) revert();
            } else {
                do {
                    emit Transfer(address(0), to, updatedIndex++);
                } while (updatedIndex < end);
            }
            _currentIndex = updatedIndex;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 quantity) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are incredibly unrealistic.
        // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
        unchecked {
            _addressData[to].balance += uint64(quantity);
            _addressData[to].numberMinted += uint64(quantity);

            _ownerships[startTokenId].addr = to;
            _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);

            uint256 updatedIndex = startTokenId;
            uint256 end = updatedIndex + quantity;

            do {
                emit Transfer(address(0), to, updatedIndex++);
            } while (updatedIndex < end);

            _currentIndex = updatedIndex;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) private {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();

        bool isApprovedOrOwner = (_msgSender() == from ||
            isApprovedForAll(from, _msgSender()) ||
            getApproved(tokenId) == _msgSender());

        if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
        unchecked {
            _addressData[from].balance -= 1;
            _addressData[to].balance += 1;

            TokenOwnership storage currSlot = _ownerships[tokenId];
            currSlot.addr = to;
            currSlot.startTimestamp = uint64(block.timestamp);

            // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            TokenOwnership storage nextSlot = _ownerships[nextTokenId];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != _currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev Equivalent to `_burn(tokenId, false)`.
     */
    function _burn(uint256 tokenId) internal virtual {
        _burn(tokenId, false);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        address from = prevOwnership.addr;

        if (approvalCheck) {
            bool isApprovedOrOwner = (_msgSender() == from ||
                isApprovedForAll(from, _msgSender()) ||
                getApproved(tokenId) == _msgSender());

            if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        }

        _beforeTokenTransfers(from, address(0), tokenId, 1);

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

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
        unchecked {
            AddressData storage addressData = _addressData[from];
            addressData.balance -= 1;
            addressData.numberBurned += 1;

            // Keep track of who burned the token, and the timestamp of burning.
            TokenOwnership storage currSlot = _ownerships[tokenId];
            currSlot.addr = from;
            currSlot.startTimestamp = uint64(block.timestamp);
            currSlot.burned = true;

            // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            TokenOwnership storage nextSlot = _ownerships[nextTokenId];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != _currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

        emit Transfer(from, address(0), tokenId);
        _afterTokenTransfers(from, address(0), tokenId, 1);

        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
        unchecked {
            _burnCounter++;
        }
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        address owner
    ) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

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

    /**
     * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
     * And also called before burning one token.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
     * minting.
     * And also called after one token has been burned.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}
}

File 8 of 31 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 9 of 31 : IERC2981.sol
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 10 of 31 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

File 11 of 31 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v3.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import "./IERC721.sol";
import "./IERC721Metadata.sol";

/**
 * @dev Interface of an ERC721A compliant contract.
 */
interface IERC721A is IERC721, IERC721Metadata {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

    /**
     * The token does not exist.
     */
    error ApprovalQueryForNonexistentToken();

    /**
     * The caller cannot approve to their own address.
     */
    error ApproveToCaller();

    /**
     * The caller cannot approve to the current owner.
     */
    error ApprovalToCurrentOwner();

    /**
     * Cannot query the balance for the zero address.
     */
    error BalanceQueryForZeroAddress();

    /**
     * Cannot mint to the zero address.
     */
    error MintToZeroAddress();

    /**
     * The quantity of tokens minted must be more than zero.
     */
    error MintZeroQuantity();

    /**
     * The token does not exist.
     */
    error OwnerQueryForNonexistentToken();

    /**
     * The caller must own the token or be an approved operator.
     */
    error TransferCallerNotOwnerNorApproved();

    /**
     * The token must be owned by `from`.
     */
    error TransferFromIncorrectOwner();

    /**
     * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.
     */
    error TransferToNonERC721ReceiverImplementer();

    /**
     * Cannot transfer to the zero address.
     */
    error TransferToZeroAddress();

    /**
     * The token does not exist.
     */
    error URIQueryForNonexistentToken();

    // Compiler will pack this into a single 256bit word.
    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Keeps track of the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
    }

    // Compiler will pack this into a single 256bit word.
    struct AddressData {
        // Realistically, 2**64-1 is more than enough.
        uint64 balance;
        // Keeps track of mint count with minimal overhead for tokenomics.
        uint64 numberMinted;
        // Keeps track of burn count with minimal overhead for tokenomics.
        uint64 numberBurned;
        // For miscellaneous variable(s) pertaining to the address
        // (e.g. number of whitelist mint slots used).
        // If there are multiple variables, please pack them into a uint64.
        uint64 aux;
    }

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     *
     * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
     */
    function totalSupply() external view returns (uint256);
}

File 12 of 31 : IERC721Metadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
///  Note: the ERC-165 identifier for this interface is 0x5b5e139f.
/* is ERC721 */
interface IERC721Metadata {
    /// @notice A descriptive name for a collection of NFTs in this contract
    function name() external view returns (string memory);

    /// @notice An abbreviated name for NFTs in this contract
    function symbol() external view returns (string memory);

    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
    /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
    ///  3986. The URI may point to a JSON file that conforms to the "ERC721
    ///  Metadata JSON Schema".
    function tokenURI(uint256 _tokenId) external view returns (string memory);
}

File 13 of 31 : BatchMintMetadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
 *  @title   Batch-mint Metadata
 *  @notice  The `BatchMintMetadata` is a contract extension for any base NFT contract. It lets the smart contract
 *           using this extension set metadata for `n` number of NFTs all at once. This is enabled by storing a single
 *           base URI for a batch of `n` NFTs, where the metadata for each NFT in a relevant batch is `baseURI/tokenId`.
 */

contract BatchMintMetadata {
    /// @dev Largest tokenId of each batch of tokens with the same baseURI.
    uint256[] private batchIds;

    /// @dev Mapping from id of a batch of tokens => to base URI for the respective batch of tokens.
    mapping(uint256 => string) private baseURI;

    /**
     *  @notice         Returns the count of batches of NFTs.
     *  @dev            Each batch of tokens has an in ID and an associated `baseURI`.
     *                  See {batchIds}.
     */
    function getBaseURICount() public view returns (uint256) {
        return batchIds.length;
    }

    /**
     *  @notice         Returns the ID for the batch of tokens the given tokenId belongs to.
     *  @dev            See {getBaseURICount}.
     *  @param _index   ID of a token.
     */
    function getBatchIdAtIndex(uint256 _index) public view returns (uint256) {
        if (_index >= getBaseURICount()) {
            revert("Invalid index");
        }
        return batchIds[_index];
    }

    /// @dev Returns the id for the batch of tokens the given tokenId belongs to.
    function _getBatchId(uint256 _tokenId) internal view returns (uint256 batchId, uint256 index) {
        uint256 numOfTokenBatches = getBaseURICount();
        uint256[] memory indices = batchIds;

        for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
            if (_tokenId < indices[i]) {
                index = i;
                batchId = indices[i];

                return (batchId, index);
            }
        }

        revert("Invalid tokenId");
    }

    /// @dev Returns the baseURI for a token. The intended metadata URI for the token is baseURI + tokenId.
    function _getBaseURI(uint256 _tokenId) internal view returns (string memory) {
        uint256 numOfTokenBatches = getBaseURICount();
        uint256[] memory indices = batchIds;

        for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
            if (_tokenId < indices[i]) {
                return baseURI[indices[i]];
            }
        }
        revert("Invalid tokenId");
    }

    /// @dev Sets the base URI for the batch of tokens with the given batchId.
    function _setBaseURI(uint256 _batchId, string memory _baseURI) internal {
        baseURI[_batchId] = _baseURI;
    }

    /// @dev Mints a batch of tokenIds and associates a common baseURI to all those Ids.
    function _batchMintMetadata(
        uint256 _startId,
        uint256 _amountToMint,
        string memory _baseURIForTokens
    ) internal returns (uint256 nextTokenIdToMint, uint256 batchId) {
        batchId = _startId + _amountToMint;
        nextTokenIdToMint = batchId;

        batchIds.push(batchId);

        baseURI[batchId] = _baseURIForTokens;
    }
}

File 14 of 31 : ContractMetadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./interface/IContractMetadata.sol";

/**
 *  @title   Contract Metadata
 *  @notice  Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
 *           for you contract.
 *           Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
 */

abstract contract ContractMetadata is IContractMetadata {
    /// @notice Returns the contract metadata URI.
    string public override contractURI;

    /**
     *  @notice         Lets a contract admin set the URI for contract-level metadata.
     *  @dev            Caller should be authorized to setup contractURI, e.g. contract admin.
     *                  See {_canSetContractURI}.
     *                  Emits {ContractURIUpdated Event}.
     *
     *  @param _uri     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     */
    function setContractURI(string memory _uri) external override {
        if (!_canSetContractURI()) {
            revert("Not authorized");
        }

        _setupContractURI(_uri);
    }

    /// @dev Lets a contract admin set the URI for contract-level metadata.
    function _setupContractURI(string memory _uri) internal {
        string memory prevURI = contractURI;
        contractURI = _uri;

        emit ContractURIUpdated(prevURI, _uri);
    }

    /// @dev Returns whether contract metadata can be set in the given execution context.
    function _canSetContractURI() internal view virtual returns (bool);
}

File 15 of 31 : DefaultOperatorFilterer.sol
// SPDX-License-Identifier: Apache 2.0
// Credits: OpenSea
pragma solidity ^0.8.0;

import { OperatorFilterer } from "./OperatorFilterer.sol";

contract DefaultOperatorFilterer is OperatorFilterer {
    // solhint-disable-next-line
    address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

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

File 16 of 31 : IContractMetadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
 *  Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
 *  for you contract.
 *
 *  Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
 */

interface IContractMetadata {
    /// @dev Returns the metadata URI of the contract.
    function contractURI() external view returns (string memory);

    /**
     *  @dev Sets contract URI for the storefront-level metadata of the contract.
     *       Only module admin can call this function.
     */
    function setContractURI(string calldata _uri) external;

    /// @dev Emitted when the contract URI is updated.
    event ContractURIUpdated(string prevURI, string newURI);
}

File 17 of 31 : IMulticall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
interface IMulticall {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     */
    function multicall(bytes[] calldata data) external returns (bytes[] memory results);
}

File 18 of 31 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: Apache 2.0
// Credit: OpenSea
pragma solidity ^0.8.0;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);

    function register(address registrant) external;

    function registerAndSubscribe(address registrant, address subscription) external;

    function registerAndCopyEntries(address registrant, address registrantToCopy) external;

    function updateOperator(
        address registrant,
        address operator,
        bool filtered
    ) external;

    function updateOperators(
        address registrant,
        address[] calldata operators,
        bool filtered
    ) external;

    function updateCodeHash(
        address registrant,
        bytes32 codehash,
        bool filtered
    ) external;

    function updateCodeHashes(
        address registrant,
        bytes32[] calldata codeHashes,
        bool filtered
    ) external;

    function subscribe(address registrant, address registrantToSubscribe) external;

    function unsubscribe(address registrant, bool copyExistingEntries) external;

    function subscriptionOf(address addr) external returns (address registrant);

    function subscribers(address registrant) external returns (address[] memory);

    function subscriberAt(address registrant, uint256 index) external returns (address);

    function copyEntriesOf(address registrant, address registrantToCopy) external;

    function isOperatorFiltered(address registrant, address operator) external returns (bool);

    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);

    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);

    function filteredOperators(address addr) external returns (address[] memory);

    function filteredCodeHashes(address addr) external returns (bytes32[] memory);

    function filteredOperatorAt(address registrant, uint256 index) external returns (address);

    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);

    function isRegistered(address addr) external returns (bool);

    function codeHashOf(address addr) external returns (bytes32);
}

File 19 of 31 : IOwnable.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
 *  Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading
 *  who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses
 *  information about who the contract's owner is.
 */

interface IOwnable {
    /// @dev Returns the owner of the contract.
    function owner() external view returns (address);

    /// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin.
    function setOwner(address _newOwner) external;

    /// @dev Emitted when a new Owner is set.
    event OwnerUpdated(address indexed prevOwner, address indexed newOwner);
}

File 20 of 31 : IPermissions.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IPermissions {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 21 of 31 : IRoyalty.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "../../eip/interface/IERC2981.sol";

/**
 *  Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading
 *  the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic
 *  that uses information about royalty fees, if desired.
 *
 *  The `Royalty` contract is ERC2981 compliant.
 */

interface IRoyalty is IERC2981 {
    struct RoyaltyInfo {
        address recipient;
        uint256 bps;
    }

    /// @dev Returns the royalty recipient and fee bps.
    function getDefaultRoyaltyInfo() external view returns (address, uint16);

    /// @dev Lets a module admin update the royalty bps and recipient.
    function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external;

    /// @dev Lets a module admin set the royalty recipient for a particular token Id.
    function setRoyaltyInfoForToken(
        uint256 tokenId,
        address recipient,
        uint256 bps
    ) external;

    /// @dev Returns the royalty recipient for a particular token Id.
    function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16);

    /// @dev Emitted when royalty info is updated.
    event DefaultRoyalty(address indexed newRoyaltyRecipient, uint256 newRoyaltyBps);

    /// @dev Emitted when royalty recipient for tokenId is set
    event RoyaltyForToken(uint256 indexed tokenId, address indexed royaltyRecipient, uint256 royaltyBps);
}

File 22 of 31 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)

pragma solidity ^0.8.0;

import "../lib/TWAddress.sol";
import "./interface/IMulticall.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
contract Multicall is IMulticall {
    /**
     *  @notice Receives and executes a batch of function calls on this contract.
     *  @dev Receives and executes a batch of function calls on this contract.
     *
     *  @param data The bytes data that makes up the batch of function calls to execute.
     *  @return results The bytes data that makes up the result of the batch of function calls executed.
     */
    function multicall(bytes[] calldata data) external virtual override returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = TWAddress.functionDelegateCall(address(this), data[i]);
        }
        return results;
    }
}

File 23 of 31 : OperatorFilterer.sol
// SPDX-License-Identifier: Apache 2.0
// Credit: OpenSea
pragma solidity ^0.8.0;

import { IOperatorFilterRegistry } from "./interface/IOperatorFilterRegistry.sol";

abstract contract OperatorFilterer {
    error OperatorNotAllowed(address operator);

    // solhint-disable-next-line
    IOperatorFilterRegistry constant operatorFilterRegistry =
        IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);

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

    modifier onlyAllowedOperator(address from) virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(operatorFilterRegistry).code.length > 0) {
            // Allow spending tokens from addresses with balance
            // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
            // from an EOA.
            if (from == msg.sender) {
                _;
                return;
            }
            if (
                !(operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender) &&
                    operatorFilterRegistry.isOperatorAllowed(address(this), from))
            ) {
                revert OperatorNotAllowed(msg.sender);
            }
        }
        _;
    }
}

File 24 of 31 : Ownable.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./interface/IOwnable.sol";

/**
 *  @title   Ownable
 *  @notice  Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading
 *           who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses
 *           information about who the contract's owner is.
 */

abstract contract Ownable is IOwnable {
    /// @dev Owner of the contract (purpose: OpenSea compatibility)
    address private _owner;

    /// @dev Reverts if caller is not the owner.
    modifier onlyOwner() {
        if (msg.sender != _owner) {
            revert("Not authorized");
        }
        _;
    }

    /**
     *  @notice Returns the owner of the contract.
     */
    function owner() public view override returns (address) {
        return _owner;
    }

    /**
     *  @notice Lets an authorized wallet set a new owner for the contract.
     *  @param _newOwner The address to set as the new owner of the contract.
     */
    function setOwner(address _newOwner) external override {
        if (!_canSetOwner()) {
            revert("Not authorized");
        }
        _setupOwner(_newOwner);
    }

    /// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin.
    function _setupOwner(address _newOwner) internal {
        address _prevOwner = _owner;
        _owner = _newOwner;

        emit OwnerUpdated(_prevOwner, _newOwner);
    }

    /// @dev Returns whether owner can be set in the given execution context.
    function _canSetOwner() internal view virtual returns (bool);
}

File 25 of 31 : Permissions.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./interface/IPermissions.sol";
import "../lib/TWStrings.sol";

/**
 *  @title   Permissions
 *  @dev     This contracts provides extending-contracts with role-based access control mechanisms
 */
contract Permissions is IPermissions {
    /// @dev Map from keccak256 hash of a role => a map from address => whether address has role.
    mapping(bytes32 => mapping(address => bool)) private _hasRole;

    /// @dev Map from keccak256 hash of a role to role admin. See {getRoleAdmin}.
    mapping(bytes32 => bytes32) private _getRoleAdmin;

    /// @dev Default admin role for all roles. Only accounts with this role can grant/revoke other roles.
    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /// @dev Modifier that checks if an account has the specified role; reverts otherwise.
    modifier onlyRole(bytes32 role) {
        _checkRole(role, msg.sender);
        _;
    }

    /**
     *  @notice         Checks whether an account has a particular role.
     *  @dev            Returns `true` if `account` has been granted `role`.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account for which the role is being checked.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _hasRole[role][account];
    }

    /**
     *  @notice         Checks whether an account has a particular role;
     *                  role restrictions can be swtiched on and off.
     *
     *  @dev            Returns `true` if `account` has been granted `role`.
     *                  Role restrictions can be swtiched on and off:
     *                      - If address(0) has ROLE, then the ROLE restrictions
     *                        don't apply.
     *                      - If address(0) does not have ROLE, then the ROLE
     *                        restrictions will apply.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account for which the role is being checked.
     */
    function hasRoleWithSwitch(bytes32 role, address account) public view returns (bool) {
        if (!_hasRole[role][address(0)]) {
            return _hasRole[role][account];
        }

        return true;
    }

    /**
     *  @notice         Returns the admin role that controls the specified role.
     *  @dev            See {grantRole} and {revokeRole}.
     *                  To change a role's admin, use {_setRoleAdmin}.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     */
    function getRoleAdmin(bytes32 role) external view override returns (bytes32) {
        return _getRoleAdmin[role];
    }

    /**
     *  @notice         Grants a role to an account, if not previously granted.
     *  @dev            Caller must have admin role for the `role`.
     *                  Emits {RoleGranted Event}.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account to which the role is being granted.
     */
    function grantRole(bytes32 role, address account) public virtual override {
        _checkRole(_getRoleAdmin[role], msg.sender);
        if (_hasRole[role][account]) {
            revert("Can only grant to non holders");
        }
        _setupRole(role, account);
    }

    /**
     *  @notice         Revokes role from an account.
     *  @dev            Caller must have admin role for the `role`.
     *                  Emits {RoleRevoked Event}.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account from which the role is being revoked.
     */
    function revokeRole(bytes32 role, address account) public virtual override {
        _checkRole(_getRoleAdmin[role], msg.sender);
        _revokeRole(role, account);
    }

    /**
     *  @notice         Revokes role from the account.
     *  @dev            Caller must have the `role`, with caller being the same as `account`.
     *                  Emits {RoleRevoked Event}.
     *
     *  @param role     keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
     *  @param account  Address of the account from which the role is being revoked.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        if (msg.sender != account) {
            revert("Can only renounce for self");
        }
        _revokeRole(role, account);
    }

    /// @dev Sets `adminRole` as `role`'s admin role.
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = _getRoleAdmin[role];
        _getRoleAdmin[role] = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /// @dev Sets up `role` for `account`
    function _setupRole(bytes32 role, address account) internal virtual {
        _hasRole[role][account] = true;
        emit RoleGranted(role, account, msg.sender);
    }

    /// @dev Revokes `role` from `account`
    function _revokeRole(bytes32 role, address account) internal virtual {
        _checkRole(role, account);
        delete _hasRole[role][account];
        emit RoleRevoked(role, account, msg.sender);
    }

    /// @dev Checks `role` for `account`. Reverts with a message including the required role.
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!_hasRole[role][account]) {
            revert(
                string(
                    abi.encodePacked(
                        "Permissions: account ",
                        TWStrings.toHexString(uint160(account), 20),
                        " is missing role ",
                        TWStrings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /// @dev Checks `role` for `account`. Reverts with a message including the required role.
    function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual {
        if (!hasRoleWithSwitch(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "Permissions: account ",
                        TWStrings.toHexString(uint160(account), 20),
                        " is missing role ",
                        TWStrings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }
}

File 26 of 31 : Royalty.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./interface/IRoyalty.sol";

/**
 *  @title   Royalty
 *  @notice  Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading
 *           the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic
 *           that uses information about royalty fees, if desired.
 *
 *  @dev     The `Royalty` contract is ERC2981 compliant.
 */

abstract contract Royalty is IRoyalty {
    /// @dev The (default) address that receives all royalty value.
    address private royaltyRecipient;

    /// @dev The (default) % of a sale to take as royalty (in basis points).
    uint16 private royaltyBps;

    /// @dev Token ID => royalty recipient and bps for token
    mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken;

    /**
     *  @notice   View royalty info for a given token and sale price.
     *  @dev      Returns royalty amount and recipient for `tokenId` and `salePrice`.
     *  @param tokenId          The tokenID of the NFT for which to query royalty info.
     *  @param salePrice        Sale price of the token.
     *
     *  @return receiver        Address of royalty recipient account.
     *  @return royaltyAmount   Royalty amount calculated at current royaltyBps value.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        virtual
        override
        returns (address receiver, uint256 royaltyAmount)
    {
        (address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId);
        receiver = recipient;
        royaltyAmount = (salePrice * bps) / 10_000;
    }

    /**
     *  @notice          View royalty info for a given token.
     *  @dev             Returns royalty recipient and bps for `_tokenId`.
     *  @param _tokenId  The tokenID of the NFT for which to query royalty info.
     */
    function getRoyaltyInfoForToken(uint256 _tokenId) public view override returns (address, uint16) {
        RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId];

        return
            royaltyForToken.recipient == address(0)
                ? (royaltyRecipient, uint16(royaltyBps))
                : (royaltyForToken.recipient, uint16(royaltyForToken.bps));
    }

    /**
     *  @notice Returns the defualt royalty recipient and BPS for this contract's NFTs.
     */
    function getDefaultRoyaltyInfo() external view override returns (address, uint16) {
        return (royaltyRecipient, uint16(royaltyBps));
    }

    /**
     *  @notice         Updates default royalty recipient and bps.
     *  @dev            Caller should be authorized to set royalty info.
     *                  See {_canSetRoyaltyInfo}.
     *                  Emits {DefaultRoyalty Event}; See {_setupDefaultRoyaltyInfo}.
     *
     *  @param _royaltyRecipient   Address to be set as default royalty recipient.
     *  @param _royaltyBps         Updated royalty bps.
     */
    function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override {
        if (!_canSetRoyaltyInfo()) {
            revert("Not authorized");
        }

        _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
    }

    /// @dev Lets a contract admin update the default royalty recipient and bps.
    function _setupDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) internal {
        if (_royaltyBps > 10_000) {
            revert("Exceeds max bps");
        }

        royaltyRecipient = _royaltyRecipient;
        royaltyBps = uint16(_royaltyBps);

        emit DefaultRoyalty(_royaltyRecipient, _royaltyBps);
    }

    /**
     *  @notice         Updates default royalty recipient and bps for a particular token.
     *  @dev            Sets royalty info for `_tokenId`. Caller should be authorized to set royalty info.
     *                  See {_canSetRoyaltyInfo}.
     *                  Emits {RoyaltyForToken Event}; See {_setupRoyaltyInfoForToken}.
     *
     *  @param _recipient   Address to be set as royalty recipient for given token Id.
     *  @param _bps         Updated royalty bps for the token Id.
     */
    function setRoyaltyInfoForToken(
        uint256 _tokenId,
        address _recipient,
        uint256 _bps
    ) external override {
        if (!_canSetRoyaltyInfo()) {
            revert("Not authorized");
        }

        _setupRoyaltyInfoForToken(_tokenId, _recipient, _bps);
    }

    /// @dev Lets a contract admin set the royalty recipient and bps for a particular token Id.
    function _setupRoyaltyInfoForToken(
        uint256 _tokenId,
        address _recipient,
        uint256 _bps
    ) internal {
        if (_bps > 10_000) {
            revert("Exceeds max bps");
        }

        royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps });

        emit RoyaltyForToken(_tokenId, _recipient, _bps);
    }

    /// @dev Returns whether royalty info can be set in the given execution context.
    function _canSetRoyaltyInfo() internal view virtual returns (bool);
}

File 27 of 31 : TWAddress.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.0;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 28 of 31 : TWStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library TWStrings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

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

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

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

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

File 29 of 31 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 30 of 31 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 31 of 31 : IWorldPassNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

enum House {
    Scarred,
    Arms,
    Hearts,
    Sight,
    Hearing,
    Shadows
}

library HouseUtil {
    function toString(House _house) internal pure returns (string memory) {
        if (_house == House.Arms) {
            return "Arms";
        } else if (_house == House.Hearts) {
            return "Hearts";
        } else if (_house == House.Sight) {
            return "Sight";
        } else if (_house == House.Hearing) {
            return "Hearing";
        } else if (_house == House.Shadows) {
            return "Shadows";
        } else {
            return "Scarred";
        }
    }
}

interface IWorldPassNFT {
    struct TokenData {
        bool __exists;

        House house;
    }

    function setTokenHouse(uint256 _tokenId, House _house) external;

    function getTokenHouse(uint256 _tokenId) external view returns (House);

    function getRemainingHouseSupply(House _house) external view returns (uint256);

    function mintWithHouseTo(address _to, House _house) external;

    function batchMintWithHouseTo(
        address _to,
        uint256 _quantity,
        House _house
    ) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_imageDirURI","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint128","name":"_royaltyBps","type":"uint128"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_maxHouseSupply","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TokenDoesntExist","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"prevURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRoyaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"newRoyaltyBps","type":"uint256"}],"name":"DefaultRoyalty","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"royaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"royaltyBps","type":"uint256"}],"name":"RoyaltyForToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ATTRIBUTE_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"string","name":"_baseURI","type":"string"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"batchMintTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"enum House","name":"_house","type":"uint8"}],"name":"batchMintWithHouseTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseURICount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getBatchIdAtIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDefaultRoyaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum House","name":"_house","type":"uint8"}],"name":"getRemainingHouseSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getRoyaltyInfoForToken","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getTokenHouse","outputs":[{"internalType":"enum House","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRoleWithSwitch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"isApprovedOrOwnerOf","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"mintTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"enum House","name":"_house","type":"uint8"}],"name":"mintWithHouseTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenIdToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint256","name":"_royaltyBps","type":"uint256"}],"name":"setDefaultRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_imageDirURI","type":"string"}],"name":"setImageDirURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_bps","type":"uint256"}],"name":"setRoyaltyInfoForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"enum House","name":"_house","type":"uint8"}],"name":"setTokenHouse","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_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":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a0604052600060809081526011906200001a90826200057d565b50600060125560006013553480156200003257600080fd5b506040516200463238038062004632833981016040819052620000559162000735565b733cc6cdda760b79bafa08df41ecfa224f810dceb6600189898787838360026200008083826200057d565b5060036200008f82826200057d565b50506000805550620000a13362000298565b620000b6826001600160801b038316620002ea565b5050506daaeb6d7670e522a718067333cd4e3b159050620002005780156200014e57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200012f57600080fd5b505af115801562000144573d6000803e3d6000fd5b5050505062000200565b6001600160a01b038216156200019f5760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af29039060440162000114565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001e657600080fd5b505af1158015620001fb573d6000803e3d6000fd5b505050505b506200020e90508562000395565b6200021b6000336200047d565b620002477f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6336200047d565b620002737f3af1099fc864d047a7917182cc02a091821f7870c44bb46e1a7ecc4914894c65336200047d565b60116200028187826200057d565b506012919091556013555062000886945050505050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b612710811115620003335760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b604482015260640160405180910390fd5b600a80546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b600060088054620003a690620004ee565b80601f0160208091040260200160405190810160405280929190818152602001828054620003d490620004ee565b8015620004255780601f10620003f95761010080835404028352916020019162000425565b820191906000526020600020905b8154815290600101906020018083116200040757829003601f168201915b5050505050905081600890816200043d91906200057d565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a1681836040516200047192919062000854565b60405180910390a15050565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200050357607f821691505b6020821081036200052457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200057857600081815260208120601f850160051c81016020861015620005535750805b601f850160051c820191505b8181101562000574578281556001016200055f565b5050505b505050565b81516001600160401b03811115620005995762000599620004d8565b620005b181620005aa8454620004ee565b846200052a565b602080601f831160018114620005e95760008415620005d05750858301515b600019600386901b1c1916600185901b17855562000574565b600085815260208120601f198616915b828110156200061a57888601518255948401946001909101908401620005f9565b5085821015620006395787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60005b83811015620006665781810151838201526020016200064c565b50506000910152565b600082601f8301126200068157600080fd5b81516001600160401b03808211156200069e576200069e620004d8565b604051601f8301601f19908116603f01168101908282118183101715620006c957620006c9620004d8565b81604052838152866020858801011115620006e357600080fd5b620006f684602083016020890162000649565b9695505050505050565b80516001600160a01b03811681146200071857600080fd5b919050565b80516001600160801b03811681146200071857600080fd5b600080600080600080600080610100898b0312156200075357600080fd5b88516001600160401b03808211156200076b57600080fd5b620007798c838d016200066f565b995060208b01519150808211156200079057600080fd5b6200079e8c838d016200066f565b985060408b0151915080821115620007b557600080fd5b620007c38c838d016200066f565b975060608b0151915080821115620007da57600080fd5b50620007e98b828c016200066f565b955050620007fa60808a0162000700565b93506200080a60a08a016200071d565b60c08a015160e0909a0151989b979a5095989497939692505050565b600081518084526200084081602086016020860162000649565b601f01601f19169290920160200192915050565b60408152600062000869604083018562000826565b82810360208401526200087d818562000826565b95945050505050565b613d9c80620008966000396000f3fe608060405234801561001057600080fd5b50600436106102895760003560e01c806363b45e2d1161015c578063a32fa5b3116100ce578063c87b56dd11610087578063c87b56dd14610639578063d53913931461064c578063d547741f14610673578063d66f1ce014610686578063e8a3d48514610699578063e985e9c5146106a157600080fd5b8063a32fa5b3146105af578063a74641e8146105c2578063ac9650d8146105d5578063b24f2d39146105f5578063b571410e14610613578063b88d4fde1461062657600080fd5b806391d148541161012057806391d148541461052d578063938e3d7b1461056657806395d89b41146105795780639bcf7a1514610581578063a217fddf14610594578063a22cb4651461059c57600080fd5b806363b45e2d146104c757806370a08231146104cf578063754a81d9146104e25780638b465f87146104f55780638da5cb5b1461051c57600080fd5b80632f2ff15d11610200578063430c2081116101b9578063430c20811461043357806346a87945146104465780634cc157df146104595780635cfcd0771461048e578063600dd5ea146104a15780636352211e146104b457600080fd5b80632f2ff15d146103bf5780633133dbac146103d257806336568abe146103f25780633b1475a71461040557806342842e0e1461040d57806342966c681461042057600080fd5b806313af40351161025257806313af40351461031e57806318160ddd1461033157806323b872dd146103475780632419f51b1461035a578063248a9ca31461036d5780632a55205a1461038d57600080fd5b806275a3171461028e57806301ffc9a7146102a357806306fdde03146102cb578063081812fc146102e0578063095ea7b31461030b575b600080fd5b6102a161029c366004613022565b6106dd565b005b6102b66102b1366004613085565b61073b565b60405190151581526020015b60405180910390f35b6102d36107a8565b6040516102c291906130f2565b6102f36102ee366004613105565b61083a565b6040516001600160a01b0390911681526020016102c2565b6102a161031936600461311e565b61087e565b6102a161032c366004613148565b610904565b600154600054035b6040519081526020016102c2565b6102a1610355366004613163565b610934565b610339610368366004613105565b610a90565b61033961037b366004613105565b60009081526010602052604090205490565b6103a061039b36600461319f565b610afe565b604080516001600160a01b0390931683526020830191909152016102c2565b6102a16103cd3660046131c1565b610b3b565b6103e56103e0366004613105565b610bd1565b6040516102c29190613203565b6102a16104003660046131c1565b610c60565b600054610339565b6102a161041b366004613163565b610cc2565b6102a161042e366004613105565b610e13565b6102b661044136600461311e565b610e1e565b61033961045436600461323a565b610e9d565b61046c610467366004613105565b610ed1565b604080516001600160a01b03909316835261ffff9091166020830152016102c2565b6102a161049c366004613255565b610f3c565b6102a16104af36600461311e565b610f55565b6102f36104c2366004613105565b610f83565b600c54610339565b6103396104dd366004613148565b610f95565b6102a16104f03660046132c6565b610fe3565b6103397f3af1099fc864d047a7917182cc02a091821f7870c44bb46e1a7ecc4914894c6581565b6009546001600160a01b03166102f3565b6102b661053b3660046131c1565b6000918252600f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6102a1610574366004613343565b611027565b6102d3611054565b6102a161058f366004613377565b611063565b610339600081565b6102a16105aa3660046133aa565b611092565b6102b66105bd3660046131c1565b611127565b6102a16105d03660046133e1565b61117d565b6105e86105e3366004613404565b6113a9565b6040516102c29190613466565b600a546001600160a01b03811690600160a01b900461ffff1661046c565b6102a16106213660046134c8565b61149d565b6102a1610634366004613504565b611517565b6102d3610647366004613105565b61166f565b6103397f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102a16106813660046131c1565b611806565b6102a161069436600461355f565b61181f565b6102d361186e565b6102b66106af366004613589565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6106e56118fc565b61070a5760405162461bcd60e51b8152600401610701906135b3565b60405180910390fd5b61071c61071660005490565b82611931565b610737826001604051806020016040528060008152506119a3565b5050565b60006301ffc9a760e01b6001600160e01b03198316148061076c57506380ac58cd60e01b6001600160e01b03198316145b806107875750635b5e139f60e01b6001600160e01b03198316145b806107a257506001600160e01b0319821663152a902d60e11b145b92915050565b6060600280546107b7906135ea565b80601f01602080910402602001604051908101604052809291908181526020018280546107e3906135ea565b80156108305780601f1061080557610100808354040283529160200191610830565b820191906000526020600020905b81548152906001019060200180831161081357829003601f168201915b5050505050905090565b600061084582611b48565b610862576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061088982610f83565b9050806001600160a01b0316836001600160a01b0316036108bd5760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216146108f4576108d781336106af565b6108f4576040516367d9dca160e11b815260040160405180910390fd5b6108ff838383611b73565b505050565b61090c611bcf565b6109285760405162461bcd60e51b81526004016107019061361e565b61093181611bfc565b50565b826daaeb6d7670e522a718067333cd4e3b15610a7f57336001600160a01b0382160361096a57610965848484611c4e565b610a8a565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd9190613646565b8015610a605750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610a3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a609190613646565b610a7f57604051633b79c77360e21b8152336004820152602401610701565b610a8a848484611c4e565b50505050565b6000610a9b600c5490565b8210610ad95760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610701565b600c8281548110610aec57610aec613663565b90600052602060002001549050919050565b600080600080610b0d86610ed1565b90945084925061ffff169050612710610b26828761368f565b610b3091906136a6565b925050509250929050565b600082815260106020526040902054610b549033611c59565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff1615610bc75760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610701565b6107378282611cd9565b600081610bdd81611b48565b610bfa57604051631d6fa32560e31b815260040160405180910390fd5b60008381526014602090815260408083208151808301909252805460ff808216151584529293919291840191610100909104166005811115610c3e57610c3e6131ed565b6005811115610c4f57610c4f6131ed565b905250602001519250505b50919050565b336001600160a01b03821614610cb85760405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152606401610701565b6107378282611d34565b826daaeb6d7670e522a718067333cd4e3b15610e0857336001600160a01b03821603610cf357610965848484611d96565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610d42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d669190613646565b8015610de95750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610dc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de99190613646565b610e0857604051633b79c77360e21b8152336004820152602401610701565b610a8a848484611d96565b610931816001611db1565b600080610e2a83610f83565b9050806001600160a01b0316846001600160a01b03161480610e7157506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff165b80610e955750836001600160a01b0316610e8a8461083a565b6001600160a01b0316145b949350505050565b600060156000836005811115610eb557610eb56131ed565b8152602001908152602001600020546013546107a291906136c8565b6000818152600b60209081526040808320815180830190925280546001600160a01b031680835260019091015492820192909252829115610f185780516020820151610f32565b600a546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b6000610f488133611c59565b6011610a8a838583613729565b610f5d611bcf565b610f795760405162461bcd60e51b81526004016107019061361e565b6107378282611f72565b6000610f8e82612018565b5192915050565b60006001600160a01b038216610fbe576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b610feb6118fc565b6110075760405162461bcd60e51b8152600401610701906135b3565b61101a61101360005490565b8484612132565b5050610a8a8484836119a3565b61102f611bcf565b61104b5760405162461bcd60e51b81526004016107019061361e565b61093181612196565b6060600380546107b7906135ea565b61106b611bcf565b6110875760405162461bcd60e51b81526004016107019061361e565b6108ff838383612272565b336001600160a01b038316036110bb5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000828152600f6020908152604080832083805290915281205460ff1661117457506000828152600f602090815260408083206001600160a01b038516845290915290205460ff166107a2565b50600192915050565b8161118781611b48565b6111a457604051631d6fa32560e31b815260040160405180910390fd5b7f3af1099fc864d047a7917182cc02a091821f7870c44bb46e1a7ecc4914894c656111cf8133611c59565b60008481526014602090815260408083208151808301909252805460ff808216151584529293919291840191610100909104166005811115611213576112136131ed565b6005811115611224576112246131ed565b90525080519091501561128d5760405162461bcd60e51b815260206004820152602b60248201527f43616e2774206368616e676520486f75736520617474726962757465206f6e6360448201526a652069742773207365742160a81b6064820152608401610701565b601354601560008660058111156112a6576112a66131ed565b8152602001908152602001600020541061130e5760405162461bcd60e51b815260206004820152602360248201527f43616e2774206d696e74206d6f7265207468616e206d6178486f757365537570604482015262706c7960e81b6064820152608401610701565b611318858561233b565b60008681526014602090815260409091208251815490151560ff19821681178355928401519192839161ff001990911661ffff1990911617610100836005811115611365576113656131ed565b021790555090505060156000856005811115611383576113836131ed565b81526020019081526020016000206000815461139e906137e8565b909155505050505050565b6060816001600160401b038111156113c3576113c3612f80565b6040519080825280602002602001820160405280156113f657816020015b60608152602001906001900390816113e15790505b50905060005b82811015611496576114663085858481811061141a5761141a613663565b905060200281019061142c9190613801565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123e092505050565b82828151811061147857611478613663565b6020026020010181905250808061148e906137e8565b9150506113fc565b5092915050565b6114a56118fc565b6114c15760405162461bcd60e51b8152600401610701906135b3565b6000805490506114e18484604051806020016040528060008152506119a3565b805b6114ed848361384e565b811015611510576114fe818461117d565b80611508816137e8565b9150506114e3565b5050505050565b836daaeb6d7670e522a718067333cd4e3b1561166357336001600160a01b0382160361154e576115498585858561240c565b611510565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa15801561159d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c19190613646565b80156116445750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611620573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116449190613646565b61166357604051633b79c77360e21b8152336004820152602401610701565b6115108585858561240c565b60608161167b81611b48565b61169857604051631d6fa32560e31b815260040160405180910390fd5b60008381526014602090815260408083208151808301909252805460ff8082161515845292939192918401916101009091041660058111156116dc576116dc6131ed565b60058111156116ed576116ed6131ed565b90525060408051602081019091526000808252919250908260200151600581111561171a5761171a6131ed565b03611750576117496040518060400160405280600781526020016614d8d85c9c995960ca1b8152506001612450565b9050611797565b61179460405180604001604052806005815260200164486f75736560d81b81525061178f8460200151600581111561178a5761178a6131ed565b6124c1565b612611565b90505b6117dd6117a386612626565b6117ac876126b8565b6117b5886126b8565b846040516020016117c99493929190613861565b604051602081830303815290604052612759565b6040516020016117ed9190613950565b6040516020818303038152906040529350505050919050565b600082815260106020526040902054610cb89033611c59565b6118276118fc565b6118435760405162461bcd60e51b8152600401610701906135b3565b600080549050611864836001604051806020016040528060008152506119a3565b6108ff818361117d565b6008805461187b906135ea565b80601f01602080910402602001604051908101604052809291908181526020018280546118a7906135ea565b80156118f45780601f106118c9576101008083540402835291602001916118f4565b820191906000526020600020905b8154815290600101906020018083116118d757829003601f168201915b505050505081565b3360009081527f3ac2ae920192ffec1f2616e363ccfeffb7844a5d9224b2df5eacfefada837607602052604090205460ff1690565b6000828152600e60205260409020805461194a906135ea565b15905061198b5760405162461bcd60e51b815260206004820152600f60248201526e15549248185b1c9958591e481cd95d608a1b6044820152606401610701565b6000828152600e602052604090206108ff8282613995565b6000546001600160a01b0384166119cc57604051622e076360e81b815260040160405180910390fd5b826000036119ed5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038416600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600490925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b15611b03575b60405182906001600160a01b03881690600090600080516020613d47833981519152908290a4611acc60008784806001019550876128ab565b611ae9576040516368d2bf6b60e11b815260040160405180910390fd5b808210611a93578260005414611afe57600080fd5b611b36565b5b6040516001830192906001600160a01b03881690600090600080516020613d47833981519152908290a4808210611b04575b506000908155610a8a90858386612996565b60008054821080156107a2575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000611be36009546001600160a01b031690565b6001600160a01b0316336001600160a01b031614905090565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b6108ff8383836129ff565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff1661073757611c97816001600160a01b03166014612be0565b611ca2836020612be0565b604051602001611cb3929190613a54565b60408051601f198184030181529082905262461bcd60e51b8252610701916004016130f2565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611d3e8282611c59565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6108ff83838360405180602001604052806000815250611517565b6000611dbc83612018565b80519091508215611e22576000336001600160a01b0383161480611de55750611de582336106af565b80611e00575033611df58661083a565b6001600160a01b0316145b905080611e2057604051632ce44b5f60e11b815260040160405180910390fd5b505b611e2e60008583611b73565b6001600160a01b0380821660008181526005602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b86526004909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b178555918901808452922080549194909116611f2c576000548214611f2c57805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b03841690600080516020613d47833981519152908390a4611f64816000866001612996565b505060018054810190555050565b612710811115611fb65760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610701565b600a80546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b60408051606081018252600080825260208201819052918101919091528160005481101561211957600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161515918101829052906121175780516001600160a01b0316156120ae579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215612112579392505050565b6120ae565b505b604051636f96cda160e11b815260040160405180910390fd5b60008061213f848661384e565b600c8054600181019091557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7018190556000818152600d6020526040902090925082915061218d8482613995565b50935093915050565b6000600880546121a5906135ea565b80601f01602080910402602001604051908101604052809291908181526020018280546121d1906135ea565b801561221e5780601f106121f35761010080835404028352916020019161221e565b820191906000526020600020905b81548152906001019060200180831161220157829003601f168201915b5050505050905081600890816122349190613995565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a168183604051612266929190613ac1565b60405180910390a15050565b6127108111156122b65760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610701565b6040805180820182526001600160a01b0384811680835260208084018681526000898152600b8352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d910160405180910390a3505050565b604080518082019091526000808252602082015260008381526014602052604090205460ff16156123ae5760405162461bcd60e51b815260206004820152601960248201527f546f6b656e4461746120616c72656164792065786973747321000000000000006044820152606401610701565b600060405180604001604052806001151581526020018460058111156123d6576123d66131ed565b9052949350505050565b60606124058383604051806060016040528060278152602001613d2060279139612d7b565b9392505050565b6124178484846129ff565b6001600160a01b0383163b15610a8a57612433848484846128ab565b610a8a576040516368d2bf6b60e11b815260040160405180910390fd5b6060828261247b576040518060400160405280600581526020016466616c736560d81b815250612499565b604051806040016040528060048152602001637472756560e01b8152505b6040516020016124aa929190613aef565b604051602081830303815290604052905092915050565b606060018260058111156124d7576124d76131ed565b036124fc57505060408051808201909152600481526341726d7360e01b602082015290565b6002826005811115612510576125106131ed565b0361253757505060408051808201909152600681526548656172747360d01b602082015290565b600382600581111561254b5761254b6131ed565b0361257157505060408051808201909152600581526414da59da1d60da1b602082015290565b6004826005811115612585576125856131ed565b036125ad57505060408051808201909152600781526648656172696e6760c81b602082015290565b60058260058111156125c1576125c16131ed565b036125e9575050604080518082019091526007815266536861646f777360c81b602082015290565b505060408051808201909152600781526614d8d85c9c995960ca1b602082015290565b919050565b606082826040516020016124aa929190613b61565b6060600061263383612e58565b60010190506000816001600160401b0381111561265257612652612f80565b6040519080825280601f01601f19166020018201604052801561267c576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461268657509392505050565b60008181526014602090815260408083208151808301909252805460ff808216151584526060959484019161010090041660058111156126fa576126fa6131ed565b600581111561270b5761270b6131ed565b81525050905060116127318260200151600581111561272c5761272c6131ed565b612626565b604051602001612742929190613bd5565b604051602081830303815290604052915050919050565b6060815160000361277857505060408051602081019091526000815290565b6000604051806060016040528060408152602001613ce060409139905060006003845160026127a7919061384e565b6127b191906136a6565b6127bc90600461368f565b6001600160401b038111156127d3576127d3612f80565b6040519080825280601f01601f1916602001820160405280156127fd576020820181803683370190505b509050600182016020820185865187015b80821015612869576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f811685015184535060018301925061280e565b50506003865106600181146128855760028114612898576128a0565b603d6001830353603d60028303536128a0565b603d60018303535b509195945050505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906128e0903390899088908890600401613c5c565b6020604051808303816000875af192505050801561291b575060408051601f3d908101601f1916820190925261291891810190613c8f565b60015b612979573d808015612949576040519150601f19603f3d011682016040523d82523d6000602084013e61294e565b606091505b508051600003612971576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6001600160a01b038416610a8a576012546129b1828461384e565b1115610a8a5760405162461bcd60e51b815260206004820152601960248201527f43616e277420676f206f766572206d617820737570706c7921000000000000006044820152606401610701565b6000612a0a82612018565b9050836001600160a01b031681600001516001600160a01b031614612a415760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480612a5f5750612a5f85336106af565b80612a7a575033612a6f8461083a565b6001600160a01b0316145b905080612a9a57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038416612ac157604051633a954ecd60e21b815260040160405180910390fd5b612acd60008487611b73565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116612ba1576000548214612ba157805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b0316600080516020613d4783398151915260405160405180910390a46115108585856001612996565b60606000612bef83600261368f565b612bfa90600261384e565b6001600160401b03811115612c1157612c11612f80565b6040519080825280601f01601f191660200182016040528015612c3b576020820181803683370190505b509050600360fc1b81600081518110612c5657612c56613663565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612c8557612c85613663565b60200101906001600160f81b031916908160001a9053506000612ca984600261368f565b612cb490600161384e565b90505b6001811115612d2c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612ce857612ce8613663565b1a60f81b828281518110612cfe57612cfe613663565b60200101906001600160f81b031916908160001a90535060049490941c93612d2581613cac565b9050612cb7565b5083156124055760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610701565b60606001600160a01b0384163b612de35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610701565b600080856001600160a01b031685604051612dfe9190613cc3565b600060405180830381855af49150503d8060008114612e39576040519150601f19603f3d011682016040523d82523d6000602084013e612e3e565b606091505b5091509150612e4e828286612f30565b9695505050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612e975772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612ec3576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612ee157662386f26fc10000830492506010015b6305f5e1008310612ef9576305f5e100830492506008015b6127108310612f0d57612710830492506004015b60648310612f1f576064830492506002015b600a83106107a25760010192915050565b60608315612f3f575081612405565b825115612f4f5782518084602001fd5b8160405162461bcd60e51b815260040161070191906130f2565b80356001600160a01b038116811461260c57600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112612fa757600080fd5b81356001600160401b0380821115612fc157612fc1612f80565b604051601f8301601f19908116603f01168101908282118183101715612fe957612fe9612f80565b8160405283815286602085880101111561300257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561303557600080fd5b61303e83612f69565b915060208301356001600160401b0381111561305957600080fd5b61306585828601612f96565b9150509250929050565b6001600160e01b03198116811461093157600080fd5b60006020828403121561309757600080fd5b81356124058161306f565b60005b838110156130bd5781810151838201526020016130a5565b50506000910152565b600081518084526130de8160208601602086016130a2565b601f01601f19169290920160200192915050565b60208152600061240560208301846130c6565b60006020828403121561311757600080fd5b5035919050565b6000806040838503121561313157600080fd5b61313a83612f69565b946020939093013593505050565b60006020828403121561315a57600080fd5b61240582612f69565b60008060006060848603121561317857600080fd5b61318184612f69565b925061318f60208501612f69565b9150604084013590509250925092565b600080604083850312156131b257600080fd5b50508035926020909101359150565b600080604083850312156131d457600080fd5b823591506131e460208401612f69565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b602081016006831061322557634e487b7160e01b600052602160045260246000fd5b91905290565b80356006811061260c57600080fd5b60006020828403121561324c57600080fd5b6124058261322b565b6000806020838503121561326857600080fd5b82356001600160401b038082111561327f57600080fd5b818501915085601f83011261329357600080fd5b8135818111156132a257600080fd5b8660208285010111156132b457600080fd5b60209290920196919550909350505050565b600080600080608085870312156132dc57600080fd5b6132e585612f69565b93506020850135925060408501356001600160401b038082111561330857600080fd5b61331488838901612f96565b9350606087013591508082111561332a57600080fd5b5061333787828801612f96565b91505092959194509250565b60006020828403121561335557600080fd5b81356001600160401b0381111561336b57600080fd5b610e9584828501612f96565b60008060006060848603121561338c57600080fd5b8335925061318f60208501612f69565b801515811461093157600080fd5b600080604083850312156133bd57600080fd5b6133c683612f69565b915060208301356133d68161339c565b809150509250929050565b600080604083850312156133f457600080fd5b823591506131e46020840161322b565b6000806020838503121561341757600080fd5b82356001600160401b038082111561342e57600080fd5b818501915085601f83011261344257600080fd5b81358181111561345157600080fd5b8660208260051b85010111156132b457600080fd5b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156134bb57603f198886030184526134a98583516130c6565b9450928501929085019060010161348d565b5092979650505050505050565b6000806000606084860312156134dd57600080fd5b6134e684612f69565b9250602084013591506134fb6040850161322b565b90509250925092565b6000806000806080858703121561351a57600080fd5b61352385612f69565b935061353160208601612f69565b92506040850135915060608501356001600160401b0381111561355357600080fd5b61333787828801612f96565b6000806040838503121561357257600080fd5b61357b83612f69565b91506131e46020840161322b565b6000806040838503121561359c57600080fd5b6135a583612f69565b91506131e460208401612f69565b60208082526017908201527f4e6f7420617574686f72697a656420746f206d696e742e000000000000000000604082015260600190565b600181811c908216806135fe57607f821691505b602082108103610c5a57634e487b7160e01b600052602260045260246000fd5b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60006020828403121561365857600080fd5b81516124058161339c565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176107a2576107a2613679565b6000826136c357634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156107a2576107a2613679565b601f8211156108ff57600081815260208120601f850160051c810160208610156137025750805b601f850160051c820191505b818110156137215782815560010161370e565b505050505050565b6001600160401b0383111561374057613740612f80565b6137548361374e83546135ea565b836136db565b6000601f84116001811461378857600085156137705750838201355b600019600387901b1c1916600186901b178355611510565b600083815260209020601f19861690835b828110156137b95786850135825560209485019460019092019101613799565b50868210156137d65760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6000600182016137fa576137fa613679565b5060010190565b6000808335601e1984360301811261381857600080fd5b8301803591506001600160401b0382111561383257600080fd5b60200191503681900382131561384757600080fd5b9250929050565b808201808211156107a2576107a2613679565b693d913730b6b2911d101160b11b8152602360f81b600a820152845160009061389181600b850160208a016130a2565b6c1116101134b6b0b3b2911d101160991b600b9184019182015285516138be816018840160208a016130a2565b7f2e706e67222c2022616e696d6174696f6e5f75726c223a2022000000000000006018929091019182015284516138fc8160318401602089016130a2565b752e6d7034222c202261747472696275746573223a205b60501b6031929091019182015283516139338160478401602088016130a2565b615d7d60f01b604792909101918201526049019695505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161398881601d8501602087016130a2565b91909101601d0192915050565b81516001600160401b038111156139ae576139ae612f80565b6139c2816139bc84546135ea565b846136db565b602080601f8311600181146139f757600084156139df5750858301515b600019600386901b1c1916600185901b178555613721565b600085815260208120601f198616915b82811015613a2657888601518255948401946001909101908401613a07565b5085821015613a445787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b815260008351613a848160158501602088016130a2565b7001034b99036b4b9b9b4b733903937b6329607d1b6015918401918201528351613ab58160268401602088016130a2565b01602601949350505050565b604081526000613ad460408301856130c6565b8281036020840152613ae681856130c6565b95945050505050565b6f3d913a3930b4ba2fba3cb832911d101160811b81528251600090613b1b8160108501602088016130a2565b6b0111610113b30b63ab2911d160a51b6010918401918201528351613b4781601c8401602088016130a2565b607d60f81b601c9290910191820152601d01949350505050565b6f3d913a3930b4ba2fba3cb832911d101160811b81528251600090613b8d8160108501602088016130a2565b6c111610113b30b63ab2911d101160991b6010918401918201528351613bba81601d8401602088016130a2565b61227d60f01b601d9290910191820152601f01949350505050565b6000808454613be3816135ea565b60018281168015613bfb5760018114613c1057613c3f565b60ff1984168752821515830287019450613c3f565b8860005260208060002060005b85811015613c365781548a820152908401908201613c1d565b50505082870194505b505050508351613c538183602088016130a2565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612e4e908301846130c6565b600060208284031215613ca157600080fd5b81516124058161306f565b600081613cbb57613cbb613679565b506000190190565b60008251613cd58184602087016130a2565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122085e20e869fc828e232b99afd01fd0bf4a42b6dbf83b591e7ba89fb4cd1ca7aea64736f6c6343000811003300000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000c1e8ce1751e55777262d57003240bb52b2ca45d000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000041900000000000000000000000000000000000000000000000000000000000000d20000000000000000000000000000000000000000000000000000000000000014466f7274756e61746120576f726c642050617373000000000000000000000000000000000000000000000000000000000000000000000000000000000000000346575000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d65466a53787039614134446b6650657833575678715453425142377656425a43547a75587933645162576f462f000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d5148374b63727759315345424e793678654a316f74703651633136763534786e4368517131727150557943370000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102895760003560e01c806363b45e2d1161015c578063a32fa5b3116100ce578063c87b56dd11610087578063c87b56dd14610639578063d53913931461064c578063d547741f14610673578063d66f1ce014610686578063e8a3d48514610699578063e985e9c5146106a157600080fd5b8063a32fa5b3146105af578063a74641e8146105c2578063ac9650d8146105d5578063b24f2d39146105f5578063b571410e14610613578063b88d4fde1461062657600080fd5b806391d148541161012057806391d148541461052d578063938e3d7b1461056657806395d89b41146105795780639bcf7a1514610581578063a217fddf14610594578063a22cb4651461059c57600080fd5b806363b45e2d146104c757806370a08231146104cf578063754a81d9146104e25780638b465f87146104f55780638da5cb5b1461051c57600080fd5b80632f2ff15d11610200578063430c2081116101b9578063430c20811461043357806346a87945146104465780634cc157df146104595780635cfcd0771461048e578063600dd5ea146104a15780636352211e146104b457600080fd5b80632f2ff15d146103bf5780633133dbac146103d257806336568abe146103f25780633b1475a71461040557806342842e0e1461040d57806342966c681461042057600080fd5b806313af40351161025257806313af40351461031e57806318160ddd1461033157806323b872dd146103475780632419f51b1461035a578063248a9ca31461036d5780632a55205a1461038d57600080fd5b806275a3171461028e57806301ffc9a7146102a357806306fdde03146102cb578063081812fc146102e0578063095ea7b31461030b575b600080fd5b6102a161029c366004613022565b6106dd565b005b6102b66102b1366004613085565b61073b565b60405190151581526020015b60405180910390f35b6102d36107a8565b6040516102c291906130f2565b6102f36102ee366004613105565b61083a565b6040516001600160a01b0390911681526020016102c2565b6102a161031936600461311e565b61087e565b6102a161032c366004613148565b610904565b600154600054035b6040519081526020016102c2565b6102a1610355366004613163565b610934565b610339610368366004613105565b610a90565b61033961037b366004613105565b60009081526010602052604090205490565b6103a061039b36600461319f565b610afe565b604080516001600160a01b0390931683526020830191909152016102c2565b6102a16103cd3660046131c1565b610b3b565b6103e56103e0366004613105565b610bd1565b6040516102c29190613203565b6102a16104003660046131c1565b610c60565b600054610339565b6102a161041b366004613163565b610cc2565b6102a161042e366004613105565b610e13565b6102b661044136600461311e565b610e1e565b61033961045436600461323a565b610e9d565b61046c610467366004613105565b610ed1565b604080516001600160a01b03909316835261ffff9091166020830152016102c2565b6102a161049c366004613255565b610f3c565b6102a16104af36600461311e565b610f55565b6102f36104c2366004613105565b610f83565b600c54610339565b6103396104dd366004613148565b610f95565b6102a16104f03660046132c6565b610fe3565b6103397f3af1099fc864d047a7917182cc02a091821f7870c44bb46e1a7ecc4914894c6581565b6009546001600160a01b03166102f3565b6102b661053b3660046131c1565b6000918252600f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6102a1610574366004613343565b611027565b6102d3611054565b6102a161058f366004613377565b611063565b610339600081565b6102a16105aa3660046133aa565b611092565b6102b66105bd3660046131c1565b611127565b6102a16105d03660046133e1565b61117d565b6105e86105e3366004613404565b6113a9565b6040516102c29190613466565b600a546001600160a01b03811690600160a01b900461ffff1661046c565b6102a16106213660046134c8565b61149d565b6102a1610634366004613504565b611517565b6102d3610647366004613105565b61166f565b6103397f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102a16106813660046131c1565b611806565b6102a161069436600461355f565b61181f565b6102d361186e565b6102b66106af366004613589565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6106e56118fc565b61070a5760405162461bcd60e51b8152600401610701906135b3565b60405180910390fd5b61071c61071660005490565b82611931565b610737826001604051806020016040528060008152506119a3565b5050565b60006301ffc9a760e01b6001600160e01b03198316148061076c57506380ac58cd60e01b6001600160e01b03198316145b806107875750635b5e139f60e01b6001600160e01b03198316145b806107a257506001600160e01b0319821663152a902d60e11b145b92915050565b6060600280546107b7906135ea565b80601f01602080910402602001604051908101604052809291908181526020018280546107e3906135ea565b80156108305780601f1061080557610100808354040283529160200191610830565b820191906000526020600020905b81548152906001019060200180831161081357829003601f168201915b5050505050905090565b600061084582611b48565b610862576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061088982610f83565b9050806001600160a01b0316836001600160a01b0316036108bd5760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216146108f4576108d781336106af565b6108f4576040516367d9dca160e11b815260040160405180910390fd5b6108ff838383611b73565b505050565b61090c611bcf565b6109285760405162461bcd60e51b81526004016107019061361e565b61093181611bfc565b50565b826daaeb6d7670e522a718067333cd4e3b15610a7f57336001600160a01b0382160361096a57610965848484611c4e565b610a8a565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd9190613646565b8015610a605750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610a3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a609190613646565b610a7f57604051633b79c77360e21b8152336004820152602401610701565b610a8a848484611c4e565b50505050565b6000610a9b600c5490565b8210610ad95760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610701565b600c8281548110610aec57610aec613663565b90600052602060002001549050919050565b600080600080610b0d86610ed1565b90945084925061ffff169050612710610b26828761368f565b610b3091906136a6565b925050509250929050565b600082815260106020526040902054610b549033611c59565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff1615610bc75760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610701565b6107378282611cd9565b600081610bdd81611b48565b610bfa57604051631d6fa32560e31b815260040160405180910390fd5b60008381526014602090815260408083208151808301909252805460ff808216151584529293919291840191610100909104166005811115610c3e57610c3e6131ed565b6005811115610c4f57610c4f6131ed565b905250602001519250505b50919050565b336001600160a01b03821614610cb85760405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152606401610701565b6107378282611d34565b826daaeb6d7670e522a718067333cd4e3b15610e0857336001600160a01b03821603610cf357610965848484611d96565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610d42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d669190613646565b8015610de95750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610dc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de99190613646565b610e0857604051633b79c77360e21b8152336004820152602401610701565b610a8a848484611d96565b610931816001611db1565b600080610e2a83610f83565b9050806001600160a01b0316846001600160a01b03161480610e7157506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff165b80610e955750836001600160a01b0316610e8a8461083a565b6001600160a01b0316145b949350505050565b600060156000836005811115610eb557610eb56131ed565b8152602001908152602001600020546013546107a291906136c8565b6000818152600b60209081526040808320815180830190925280546001600160a01b031680835260019091015492820192909252829115610f185780516020820151610f32565b600a546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b6000610f488133611c59565b6011610a8a838583613729565b610f5d611bcf565b610f795760405162461bcd60e51b81526004016107019061361e565b6107378282611f72565b6000610f8e82612018565b5192915050565b60006001600160a01b038216610fbe576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b610feb6118fc565b6110075760405162461bcd60e51b8152600401610701906135b3565b61101a61101360005490565b8484612132565b5050610a8a8484836119a3565b61102f611bcf565b61104b5760405162461bcd60e51b81526004016107019061361e565b61093181612196565b6060600380546107b7906135ea565b61106b611bcf565b6110875760405162461bcd60e51b81526004016107019061361e565b6108ff838383612272565b336001600160a01b038316036110bb5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000828152600f6020908152604080832083805290915281205460ff1661117457506000828152600f602090815260408083206001600160a01b038516845290915290205460ff166107a2565b50600192915050565b8161118781611b48565b6111a457604051631d6fa32560e31b815260040160405180910390fd5b7f3af1099fc864d047a7917182cc02a091821f7870c44bb46e1a7ecc4914894c656111cf8133611c59565b60008481526014602090815260408083208151808301909252805460ff808216151584529293919291840191610100909104166005811115611213576112136131ed565b6005811115611224576112246131ed565b90525080519091501561128d5760405162461bcd60e51b815260206004820152602b60248201527f43616e2774206368616e676520486f75736520617474726962757465206f6e6360448201526a652069742773207365742160a81b6064820152608401610701565b601354601560008660058111156112a6576112a66131ed565b8152602001908152602001600020541061130e5760405162461bcd60e51b815260206004820152602360248201527f43616e2774206d696e74206d6f7265207468616e206d6178486f757365537570604482015262706c7960e81b6064820152608401610701565b611318858561233b565b60008681526014602090815260409091208251815490151560ff19821681178355928401519192839161ff001990911661ffff1990911617610100836005811115611365576113656131ed565b021790555090505060156000856005811115611383576113836131ed565b81526020019081526020016000206000815461139e906137e8565b909155505050505050565b6060816001600160401b038111156113c3576113c3612f80565b6040519080825280602002602001820160405280156113f657816020015b60608152602001906001900390816113e15790505b50905060005b82811015611496576114663085858481811061141a5761141a613663565b905060200281019061142c9190613801565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123e092505050565b82828151811061147857611478613663565b6020026020010181905250808061148e906137e8565b9150506113fc565b5092915050565b6114a56118fc565b6114c15760405162461bcd60e51b8152600401610701906135b3565b6000805490506114e18484604051806020016040528060008152506119a3565b805b6114ed848361384e565b811015611510576114fe818461117d565b80611508816137e8565b9150506114e3565b5050505050565b836daaeb6d7670e522a718067333cd4e3b1561166357336001600160a01b0382160361154e576115498585858561240c565b611510565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa15801561159d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c19190613646565b80156116445750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611620573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116449190613646565b61166357604051633b79c77360e21b8152336004820152602401610701565b6115108585858561240c565b60608161167b81611b48565b61169857604051631d6fa32560e31b815260040160405180910390fd5b60008381526014602090815260408083208151808301909252805460ff8082161515845292939192918401916101009091041660058111156116dc576116dc6131ed565b60058111156116ed576116ed6131ed565b90525060408051602081019091526000808252919250908260200151600581111561171a5761171a6131ed565b03611750576117496040518060400160405280600781526020016614d8d85c9c995960ca1b8152506001612450565b9050611797565b61179460405180604001604052806005815260200164486f75736560d81b81525061178f8460200151600581111561178a5761178a6131ed565b6124c1565b612611565b90505b6117dd6117a386612626565b6117ac876126b8565b6117b5886126b8565b846040516020016117c99493929190613861565b604051602081830303815290604052612759565b6040516020016117ed9190613950565b6040516020818303038152906040529350505050919050565b600082815260106020526040902054610cb89033611c59565b6118276118fc565b6118435760405162461bcd60e51b8152600401610701906135b3565b600080549050611864836001604051806020016040528060008152506119a3565b6108ff818361117d565b6008805461187b906135ea565b80601f01602080910402602001604051908101604052809291908181526020018280546118a7906135ea565b80156118f45780601f106118c9576101008083540402835291602001916118f4565b820191906000526020600020905b8154815290600101906020018083116118d757829003601f168201915b505050505081565b3360009081527f3ac2ae920192ffec1f2616e363ccfeffb7844a5d9224b2df5eacfefada837607602052604090205460ff1690565b6000828152600e60205260409020805461194a906135ea565b15905061198b5760405162461bcd60e51b815260206004820152600f60248201526e15549248185b1c9958591e481cd95d608a1b6044820152606401610701565b6000828152600e602052604090206108ff8282613995565b6000546001600160a01b0384166119cc57604051622e076360e81b815260040160405180910390fd5b826000036119ed5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038416600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600490925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b15611b03575b60405182906001600160a01b03881690600090600080516020613d47833981519152908290a4611acc60008784806001019550876128ab565b611ae9576040516368d2bf6b60e11b815260040160405180910390fd5b808210611a93578260005414611afe57600080fd5b611b36565b5b6040516001830192906001600160a01b03881690600090600080516020613d47833981519152908290a4808210611b04575b506000908155610a8a90858386612996565b60008054821080156107a2575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000611be36009546001600160a01b031690565b6001600160a01b0316336001600160a01b031614905090565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b6108ff8383836129ff565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff1661073757611c97816001600160a01b03166014612be0565b611ca2836020612be0565b604051602001611cb3929190613a54565b60408051601f198184030181529082905262461bcd60e51b8252610701916004016130f2565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611d3e8282611c59565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6108ff83838360405180602001604052806000815250611517565b6000611dbc83612018565b80519091508215611e22576000336001600160a01b0383161480611de55750611de582336106af565b80611e00575033611df58661083a565b6001600160a01b0316145b905080611e2057604051632ce44b5f60e11b815260040160405180910390fd5b505b611e2e60008583611b73565b6001600160a01b0380821660008181526005602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b86526004909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b178555918901808452922080549194909116611f2c576000548214611f2c57805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b03841690600080516020613d47833981519152908390a4611f64816000866001612996565b505060018054810190555050565b612710811115611fb65760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610701565b600a80546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b60408051606081018252600080825260208201819052918101919091528160005481101561211957600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161515918101829052906121175780516001600160a01b0316156120ae579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215612112579392505050565b6120ae565b505b604051636f96cda160e11b815260040160405180910390fd5b60008061213f848661384e565b600c8054600181019091557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7018190556000818152600d6020526040902090925082915061218d8482613995565b50935093915050565b6000600880546121a5906135ea565b80601f01602080910402602001604051908101604052809291908181526020018280546121d1906135ea565b801561221e5780601f106121f35761010080835404028352916020019161221e565b820191906000526020600020905b81548152906001019060200180831161220157829003601f168201915b5050505050905081600890816122349190613995565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a168183604051612266929190613ac1565b60405180910390a15050565b6127108111156122b65760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610701565b6040805180820182526001600160a01b0384811680835260208084018681526000898152600b8352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d910160405180910390a3505050565b604080518082019091526000808252602082015260008381526014602052604090205460ff16156123ae5760405162461bcd60e51b815260206004820152601960248201527f546f6b656e4461746120616c72656164792065786973747321000000000000006044820152606401610701565b600060405180604001604052806001151581526020018460058111156123d6576123d66131ed565b9052949350505050565b60606124058383604051806060016040528060278152602001613d2060279139612d7b565b9392505050565b6124178484846129ff565b6001600160a01b0383163b15610a8a57612433848484846128ab565b610a8a576040516368d2bf6b60e11b815260040160405180910390fd5b6060828261247b576040518060400160405280600581526020016466616c736560d81b815250612499565b604051806040016040528060048152602001637472756560e01b8152505b6040516020016124aa929190613aef565b604051602081830303815290604052905092915050565b606060018260058111156124d7576124d76131ed565b036124fc57505060408051808201909152600481526341726d7360e01b602082015290565b6002826005811115612510576125106131ed565b0361253757505060408051808201909152600681526548656172747360d01b602082015290565b600382600581111561254b5761254b6131ed565b0361257157505060408051808201909152600581526414da59da1d60da1b602082015290565b6004826005811115612585576125856131ed565b036125ad57505060408051808201909152600781526648656172696e6760c81b602082015290565b60058260058111156125c1576125c16131ed565b036125e9575050604080518082019091526007815266536861646f777360c81b602082015290565b505060408051808201909152600781526614d8d85c9c995960ca1b602082015290565b919050565b606082826040516020016124aa929190613b61565b6060600061263383612e58565b60010190506000816001600160401b0381111561265257612652612f80565b6040519080825280601f01601f19166020018201604052801561267c576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461268657509392505050565b60008181526014602090815260408083208151808301909252805460ff808216151584526060959484019161010090041660058111156126fa576126fa6131ed565b600581111561270b5761270b6131ed565b81525050905060116127318260200151600581111561272c5761272c6131ed565b612626565b604051602001612742929190613bd5565b604051602081830303815290604052915050919050565b6060815160000361277857505060408051602081019091526000815290565b6000604051806060016040528060408152602001613ce060409139905060006003845160026127a7919061384e565b6127b191906136a6565b6127bc90600461368f565b6001600160401b038111156127d3576127d3612f80565b6040519080825280601f01601f1916602001820160405280156127fd576020820181803683370190505b509050600182016020820185865187015b80821015612869576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f811685015184535060018301925061280e565b50506003865106600181146128855760028114612898576128a0565b603d6001830353603d60028303536128a0565b603d60018303535b509195945050505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906128e0903390899088908890600401613c5c565b6020604051808303816000875af192505050801561291b575060408051601f3d908101601f1916820190925261291891810190613c8f565b60015b612979573d808015612949576040519150601f19603f3d011682016040523d82523d6000602084013e61294e565b606091505b508051600003612971576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6001600160a01b038416610a8a576012546129b1828461384e565b1115610a8a5760405162461bcd60e51b815260206004820152601960248201527f43616e277420676f206f766572206d617820737570706c7921000000000000006044820152606401610701565b6000612a0a82612018565b9050836001600160a01b031681600001516001600160a01b031614612a415760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480612a5f5750612a5f85336106af565b80612a7a575033612a6f8461083a565b6001600160a01b0316145b905080612a9a57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038416612ac157604051633a954ecd60e21b815260040160405180910390fd5b612acd60008487611b73565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116612ba1576000548214612ba157805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b0316600080516020613d4783398151915260405160405180910390a46115108585856001612996565b60606000612bef83600261368f565b612bfa90600261384e565b6001600160401b03811115612c1157612c11612f80565b6040519080825280601f01601f191660200182016040528015612c3b576020820181803683370190505b509050600360fc1b81600081518110612c5657612c56613663565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612c8557612c85613663565b60200101906001600160f81b031916908160001a9053506000612ca984600261368f565b612cb490600161384e565b90505b6001811115612d2c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612ce857612ce8613663565b1a60f81b828281518110612cfe57612cfe613663565b60200101906001600160f81b031916908160001a90535060049490941c93612d2581613cac565b9050612cb7565b5083156124055760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610701565b60606001600160a01b0384163b612de35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610701565b600080856001600160a01b031685604051612dfe9190613cc3565b600060405180830381855af49150503d8060008114612e39576040519150601f19603f3d011682016040523d82523d6000602084013e612e3e565b606091505b5091509150612e4e828286612f30565b9695505050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612e975772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612ec3576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612ee157662386f26fc10000830492506010015b6305f5e1008310612ef9576305f5e100830492506008015b6127108310612f0d57612710830492506004015b60648310612f1f576064830492506002015b600a83106107a25760010192915050565b60608315612f3f575081612405565b825115612f4f5782518084602001fd5b8160405162461bcd60e51b815260040161070191906130f2565b80356001600160a01b038116811461260c57600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112612fa757600080fd5b81356001600160401b0380821115612fc157612fc1612f80565b604051601f8301601f19908116603f01168101908282118183101715612fe957612fe9612f80565b8160405283815286602085880101111561300257600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561303557600080fd5b61303e83612f69565b915060208301356001600160401b0381111561305957600080fd5b61306585828601612f96565b9150509250929050565b6001600160e01b03198116811461093157600080fd5b60006020828403121561309757600080fd5b81356124058161306f565b60005b838110156130bd5781810151838201526020016130a5565b50506000910152565b600081518084526130de8160208601602086016130a2565b601f01601f19169290920160200192915050565b60208152600061240560208301846130c6565b60006020828403121561311757600080fd5b5035919050565b6000806040838503121561313157600080fd5b61313a83612f69565b946020939093013593505050565b60006020828403121561315a57600080fd5b61240582612f69565b60008060006060848603121561317857600080fd5b61318184612f69565b925061318f60208501612f69565b9150604084013590509250925092565b600080604083850312156131b257600080fd5b50508035926020909101359150565b600080604083850312156131d457600080fd5b823591506131e460208401612f69565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b602081016006831061322557634e487b7160e01b600052602160045260246000fd5b91905290565b80356006811061260c57600080fd5b60006020828403121561324c57600080fd5b6124058261322b565b6000806020838503121561326857600080fd5b82356001600160401b038082111561327f57600080fd5b818501915085601f83011261329357600080fd5b8135818111156132a257600080fd5b8660208285010111156132b457600080fd5b60209290920196919550909350505050565b600080600080608085870312156132dc57600080fd5b6132e585612f69565b93506020850135925060408501356001600160401b038082111561330857600080fd5b61331488838901612f96565b9350606087013591508082111561332a57600080fd5b5061333787828801612f96565b91505092959194509250565b60006020828403121561335557600080fd5b81356001600160401b0381111561336b57600080fd5b610e9584828501612f96565b60008060006060848603121561338c57600080fd5b8335925061318f60208501612f69565b801515811461093157600080fd5b600080604083850312156133bd57600080fd5b6133c683612f69565b915060208301356133d68161339c565b809150509250929050565b600080604083850312156133f457600080fd5b823591506131e46020840161322b565b6000806020838503121561341757600080fd5b82356001600160401b038082111561342e57600080fd5b818501915085601f83011261344257600080fd5b81358181111561345157600080fd5b8660208260051b85010111156132b457600080fd5b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156134bb57603f198886030184526134a98583516130c6565b9450928501929085019060010161348d565b5092979650505050505050565b6000806000606084860312156134dd57600080fd5b6134e684612f69565b9250602084013591506134fb6040850161322b565b90509250925092565b6000806000806080858703121561351a57600080fd5b61352385612f69565b935061353160208601612f69565b92506040850135915060608501356001600160401b0381111561355357600080fd5b61333787828801612f96565b6000806040838503121561357257600080fd5b61357b83612f69565b91506131e46020840161322b565b6000806040838503121561359c57600080fd5b6135a583612f69565b91506131e460208401612f69565b60208082526017908201527f4e6f7420617574686f72697a656420746f206d696e742e000000000000000000604082015260600190565b600181811c908216806135fe57607f821691505b602082108103610c5a57634e487b7160e01b600052602260045260246000fd5b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60006020828403121561365857600080fd5b81516124058161339c565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176107a2576107a2613679565b6000826136c357634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156107a2576107a2613679565b601f8211156108ff57600081815260208120601f850160051c810160208610156137025750805b601f850160051c820191505b818110156137215782815560010161370e565b505050505050565b6001600160401b0383111561374057613740612f80565b6137548361374e83546135ea565b836136db565b6000601f84116001811461378857600085156137705750838201355b600019600387901b1c1916600186901b178355611510565b600083815260209020601f19861690835b828110156137b95786850135825560209485019460019092019101613799565b50868210156137d65760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6000600182016137fa576137fa613679565b5060010190565b6000808335601e1984360301811261381857600080fd5b8301803591506001600160401b0382111561383257600080fd5b60200191503681900382131561384757600080fd5b9250929050565b808201808211156107a2576107a2613679565b693d913730b6b2911d101160b11b8152602360f81b600a820152845160009061389181600b850160208a016130a2565b6c1116101134b6b0b3b2911d101160991b600b9184019182015285516138be816018840160208a016130a2565b7f2e706e67222c2022616e696d6174696f6e5f75726c223a2022000000000000006018929091019182015284516138fc8160318401602089016130a2565b752e6d7034222c202261747472696275746573223a205b60501b6031929091019182015283516139338160478401602088016130a2565b615d7d60f01b604792909101918201526049019695505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161398881601d8501602087016130a2565b91909101601d0192915050565b81516001600160401b038111156139ae576139ae612f80565b6139c2816139bc84546135ea565b846136db565b602080601f8311600181146139f757600084156139df5750858301515b600019600386901b1c1916600185901b178555613721565b600085815260208120601f198616915b82811015613a2657888601518255948401946001909101908401613a07565b5085821015613a445787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b815260008351613a848160158501602088016130a2565b7001034b99036b4b9b9b4b733903937b6329607d1b6015918401918201528351613ab58160268401602088016130a2565b01602601949350505050565b604081526000613ad460408301856130c6565b8281036020840152613ae681856130c6565b95945050505050565b6f3d913a3930b4ba2fba3cb832911d101160811b81528251600090613b1b8160108501602088016130a2565b6b0111610113b30b63ab2911d160a51b6010918401918201528351613b4781601c8401602088016130a2565b607d60f81b601c9290910191820152601d01949350505050565b6f3d913a3930b4ba2fba3cb832911d101160811b81528251600090613b8d8160108501602088016130a2565b6c111610113b30b63ab2911d101160991b6010918401918201528351613bba81601d8401602088016130a2565b61227d60f01b601d9290910191820152601f01949350505050565b6000808454613be3816135ea565b60018281168015613bfb5760018114613c1057613c3f565b60ff1984168752821515830287019450613c3f565b8860005260208060002060005b85811015613c365781548a820152908401908201613c1d565b50505082870194505b505050508351613c538183602088016130a2565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612e4e908301846130c6565b600060208284031215613ca157600080fd5b81516124058161306f565b600081613cbb57613cbb613679565b506000190190565b60008251613cd58184602087016130a2565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122085e20e869fc828e232b99afd01fd0bf4a42b6dbf83b591e7ba89fb4cd1ca7aea64736f6c63430008110033

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

00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000c1e8ce1751e55777262d57003240bb52b2ca45d000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000041900000000000000000000000000000000000000000000000000000000000000d20000000000000000000000000000000000000000000000000000000000000014466f7274756e61746120576f726c642050617373000000000000000000000000000000000000000000000000000000000000000000000000000000000000000346575000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d65466a53787039614134446b6650657833575678715453425142377656425a43547a75587933645162576f462f000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d5148374b63727759315345424e793678654a316f74703651633136763534786e4368517131727150557943370000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Fortunata World Pass
Arg [1] : _symbol (string): FWP
Arg [2] : _imageDirURI (string): ipfs://QmeFjSxp9aA4DkfPex3WVxqTSBQB7vVBZCTzuXy3dQbWoF/
Arg [3] : _contractURI (string): ipfs://QmQH7KcrwY1SEBNy6xeJ1otp6Qc16v54xnChQq1rqPUyC7
Arg [4] : _royaltyRecipient (address): 0xc1e8cE1751E55777262d57003240BB52B2Ca45D0
Arg [5] : _royaltyBps (uint128): 1000
Arg [6] : _maxSupply (uint256): 1049
Arg [7] : _maxHouseSupply (uint256): 210

-----Encoded View---------------
18 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [4] : 000000000000000000000000c1e8ce1751e55777262d57003240bb52b2ca45d0
Arg [5] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000419
Arg [7] : 00000000000000000000000000000000000000000000000000000000000000d2
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [9] : 466f7274756e61746120576f726c642050617373000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [11] : 4657500000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000036
Arg [13] : 697066733a2f2f516d65466a53787039614134446b6650657833575678715453
Arg [14] : 425142377656425a43547a75587933645162576f462f00000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000035
Arg [16] : 697066733a2f2f516d5148374b63727759315345424e793678654a316f747036
Arg [17] : 51633136763534786e4368517131727150557943370000000000000000000000


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.