ETH Price: $2,410.85 (-2.87%)
 

Overview

Max Total Supply

491 DGF

Holders

178

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
1 DGF
0xcd33e2aa93223ecc6cc816d836dce0f3e635732f
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# 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:
DiceNFT

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

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

import "./interfaces/IDiceNFT.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 DiceNFT is IDiceNFT, ERC721Base, Permissions, DefaultOperatorFilterer {
    using MaterialUtil for Material;
    using DiceTypeUtil for DieType;
    using ElementalTypeUtil for ElementalType;
    using Strings for uint256;
    using Strings for uint8;

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

    uint256 public maxTotalSupply;
    uint256 public defaultBoostCount;

    string public imageDirURI;

    mapping(uint256 => uint256) private _boosts;

    mapping(uint256 => DiceMetadata) private _oldTokenIdToMetadata;

    mapping(uint256 => uint256) private _newTokenIdToOldTokenId;

    mapping(uint256 => bool) private _oldTokenIdBurned;

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

    constructor(
        string memory _name,
        string memory _symbol,
        string memory _imageDirURI,
        string memory _contractURI,
        uint256 _defaultBoostCount,
        uint256 _maxSupply,
        address _royaltyRecipient,
        uint128 _royaltyBps
    ) ERC721Base(_name, _symbol, _royaltyRecipient, _royaltyBps) {
        _setupContractURI(_contractURI);
        _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(MINTER_ROLE, msg.sender);
        _setupRole(BOOST_USER_ROLE, msg.sender);
        _setupRole(BOOST_ADMIN_ROLE, msg.sender);
        maxTotalSupply = _maxSupply;
        imageDirURI = _imageDirURI;
        defaultBoostCount = _defaultBoostCount;
    }

    function setOriginalMetadata(
        DiceMetadata[] calldata originalMetadata,
        uint128 _startIndex,
        uint128 _endIndex
    ) public onlyRole(DEFAULT_ADMIN_ROLE) {
        require(
            _startIndex <= _endIndex,
            "Start index should be less than or equal to end index"
        );
        uint128 numberOfItems = _endIndex - _startIndex;
        require(
            originalMetadata.length == numberOfItems,
            "Metadata length does not match index range"
        );

        for (uint256 i = 0; i < numberOfItems; ) {
            _oldTokenIdToMetadata[_startIndex + i] = originalMetadata[i];

            unchecked {
                ++i;
            }
        }
    }

    function resetBoosts(uint256 _newDefaultBoostCount)
        public
        onlyRole(BOOST_ADMIN_ROLE)
    {
        defaultBoostCount = _newDefaultBoostCount;
        for (uint256 i = 0; i < _totalMinted(); i++) {
            _boosts[i] = defaultBoostCount;
        }
    }

    function useBoost(uint256 tokenId, uint256 count)
        public
        tokenExists(tokenId)
        onlyRole(BOOST_USER_ROLE)
    {
        uint256 totalBoosts = _boosts[tokenId];
        require(
            totalBoosts >= count,
            "Requested boost count exceeds the total"
        );

        _boosts[tokenId] = totalBoosts - count;

        emit BoostUpdated(tokenId, _boosts[tokenId]);
    }

    function setBoostCount(uint256 tokenId, uint16 amount)
        public
        tokenExists(tokenId)
        onlyRole(BOOST_ADMIN_ROLE)
    {
        _boosts[tokenId] = amount;

        emit BoostUpdated(tokenId, amount);
    }

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

    function mintTo(address _to, string memory _tokenURI)
        public
        virtual
        override
    {
        revert("Not allowed");
    }

    function batchMintTo(
        address _to,
        uint256 _quantity,
        string memory _baseURI,
        bytes memory _data
    ) public virtual override {
        revert("Not allowed");
    }

    /**
     *  @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 _oldTokenId  Old dice token Id
     */
    function mint(address _to, uint256 _oldTokenId) public virtual {
        require(_canMint(), "Not authorized to mint.");
        require(
            !_oldTokenIdBurned[_oldTokenId],
            "Already claimed old token id"
        );

        uint256 newTokenId = nextTokenIdToMint();
        _safeMint(_to, 1, "");

        _newTokenIdToOldTokenId[newTokenId] = _oldTokenId;
        _boosts[newTokenId] = defaultBoostCount;
        _oldTokenIdBurned[_oldTokenId] = true;
    }

    /**
     *  @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 _oldTokenIds  Old dice token Ids
     */
    function batchMint(address _to, uint256[] calldata _oldTokenIds)
        public
        virtual
    {
        require(_canMint(), "Not authorized to mint.");

        uint256 quantity = _oldTokenIds.length;
        uint256 newTokenId = nextTokenIdToMint();
        _safeMint(_to, quantity, "");

        uint256 oldTokenIndex = 0;
        for (uint256 i = newTokenId; i < newTokenId + quantity; ++i) {
            require(
                !_oldTokenIdBurned[_oldTokenIds[oldTokenIndex]],
                "Already claimed old token id"
            );

            _newTokenIdToOldTokenId[i] = _oldTokenIds[oldTokenIndex];
            _boosts[i] = defaultBoostCount;
            _oldTokenIdBurned[_oldTokenIds[oldTokenIndex]] = true;
            oldTokenIndex++;
        }
    }

    /**
     *  @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)
    {
        DiceMetadata memory _diceMetadata = _oldTokenIdToMetadata[
            _newTokenIdToOldTokenId[_tokenId]
        ];

        string memory attributes;

        // All dice
        // Dice 1
        if (_diceMetadata.amount >= 1) {
            attributes = string(
                abi.encodePacked(
                    attributes,
                    '{"trait_type":"dice ',
                    "1",
                    ' type","value":"',
                    DiceBitmapUtil.getDiceType(_diceMetadata.bitmap, 0).toString(),
                    '"},{"trait_type":"dice ',
                    "1",
                    ' material","value":"',
                    DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 0).toString(),
                    '"},'
                )
            );
        }
        // Dice 2
        if (_diceMetadata.amount >= 2) {
            attributes = string(
                abi.encodePacked(
                    attributes,
                    '{"trait_type":"dice ',
                    "2",
                    ' type","value":"',
                    DiceBitmapUtil.getDiceType(_diceMetadata.bitmap, 1).toString(),
                    '"},{"trait_type":"dice ',
                    "2",
                    ' material","value":"',
                    DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 1).toString(),
                    '"},'
                )
            );
        }
        // Dice 3
        if (_diceMetadata.amount >= 3) {
            attributes = string(
                abi.encodePacked(
                    attributes,
                    '{"trait_type":"dice ',
                    "3",
                    ' type","value":"',
                    DiceBitmapUtil.getDiceType(_diceMetadata.bitmap, 2).toString(),
                    '"},{"trait_type":"dice ',
                    "3",
                    ' material","value":"',
                    DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 2).toString(),
                    '"},'
                )
            );
        }
        // Dice 4
        if (_diceMetadata.amount >= 4) {
            attributes = string(
                abi.encodePacked(
                    attributes,
                    '{"trait_type":"dice ',
                    "4",
                    ' type","value":"',
                    DiceBitmapUtil.getDiceType(_diceMetadata.bitmap, 3).toString(),
                    '"},{"trait_type":"dice ',
                    "4",
                    ' material","value":"',
                    DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 3).toString(),
                    '"},'
                )
            );
        }
        // Dice 5
        if (_diceMetadata.amount >= 5) {
            attributes = string(
                abi.encodePacked(
                    attributes,
                    '{"trait_type":"dice ',
                    "5",
                    ' type","value":"',
                    DiceBitmapUtil.getDiceType(_diceMetadata.bitmap, 4).toString(),
                    '"},{"trait_type":"dice ',
                    "5",
                    ' material","value":"',
                    DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 4).toString(),
                    '"},'
                )
            );
        }
        // Dice 6
        if (_diceMetadata.amount >= 6) {
            attributes = string(
                abi.encodePacked(
                    attributes,
                    '{"trait_type":"dice ',
                    "6",
                    ' type","value":"',
                    DiceBitmapUtil.getDiceType(_diceMetadata.bitmap, 5).toString(),
                    '"},{"trait_type":"dice ',
                    "6",
                    ' material","value":"',
                    DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 5).toString(),
                    '"},'
                )
            );
        }
        // Dice 7
        if (_diceMetadata.amount >= 7) {
            attributes = string(
                abi.encodePacked(
                    attributes,
                    '{"trait_type":"dice ',
                    "7",
                    ' type","value":"',
                    DiceBitmapUtil.getDiceType(_diceMetadata.bitmap, 6).toString(),
                    '"},{"trait_type":"dice ',
                    "7",
                    ' material","value":"',
                    DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 6).toString(),
                    '"},'
                )
            );
        }

        //Add power and Boosts attributes
        attributes = string(
            abi.encodePacked(
                attributes,
                '{"trait_type":"Power","value":',
                _diceMetadata.power.toString(),
                '},',
                '{"trait_type":"Boosts","value":',
                _boosts[_tokenId].toString(),
                '},',
                '{"trait_type":"Element Type","value":"',
                DiceBitmapUtil.getElementType(_diceMetadata.bitmap).toString(),
                '"}'
            )
        );

        return
            string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    Base64.encode(
                        abi.encodePacked(
                            '{"name":"',
                            name(),
                            '","image":"',
                            imageDirURI,
                            "/",
                            _newTokenIdToOldTokenId[_tokenId].toString(),
                            '.jpg","animation_url":"',
                            imageDirURI,
                            "/",
                            _newTokenIdToOldTokenId[_tokenId].toString(),
                            '.mp4","attributes":[',
                            attributes,
                            "]}"
                        )
                    )
                )
            );
    }

    function getDiceBoosts(uint256 _tokenId)
        public
        view
        tokenExists(_tokenId)
        returns (uint256)
    {
        return _boosts[_tokenId];
    }

    function getDiceMaterials(uint256 _tokenId)
        public
        view
        tokenExists(_tokenId)
        returns (string[] memory)
    {
        DiceMetadata memory _diceMetadata = _oldTokenIdToMetadata[
            _newTokenIdToOldTokenId[_tokenId]
        ];

        string[] memory materials = new string[](_diceMetadata.amount);

        if (_diceMetadata.amount >= 1) {
            materials[0] = DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 0).toString();
        }
        if (_diceMetadata.amount >= 2) {
            materials[1] = DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 1).toString();
        }
        if (_diceMetadata.amount >= 3) {
            materials[2] = DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 2).toString();
        }
        if (_diceMetadata.amount >= 4) {
            materials[3] = DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 3).toString();
        }
        if (_diceMetadata.amount >= 5) {
            materials[4] = DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 4).toString();
        }
        if (_diceMetadata.amount >= 6) {
            materials[5] = DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 5).toString();
        }
        if (_diceMetadata.amount >= 7) {
            materials[6] = DiceBitmapUtil.getDiceMaterial(_diceMetadata.bitmap, 6).toString();
        }

        return materials;
    }

    function getDiceMetadata(uint256 _tokenId)
        public
        view
        tokenExists(_tokenId)
        returns (DiceMetadata memory)
    {
        return _oldTokenIdToMetadata[_newTokenIdToOldTokenId[_tokenId]];
    }

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

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

    function _canMint() internal view virtual override returns (bool) {
        return hasRole(MINTER_ROLE, msg.sender);
    }
}

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 : IDiceNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

enum Material {
    Amber,
    Amethyst,
    Ruby,
    Sapphire,
    Spinel,
    Topaz
}

enum DieType {
    D4,
    D6,
    D8,
    D10,
    D12,
    D20
}

enum ElementalType {
    Dark,
    Space,
    Time,
    Psychic,
    Light
}

library MaterialUtil {
    function toString(Material _material)
        internal
        pure
        returns (string memory)
    {
        if (_material == Material.Amber) {
            return "Amber";
        } else if (_material == Material.Amethyst) {
            return "Amethyst";
        } else if (_material == Material.Ruby) {
            return "Ruby";
        } else if (_material == Material.Sapphire) {
            return "Sapphire";
        } else if (_material == Material.Spinel) {
            return "Spinel";
        } else {
            return "Topaz";
        }
    }
}

library DiceTypeUtil {
    function toString(DieType _type) internal pure returns (string memory) {
        if (_type == DieType.D4) {
            return "D4";
        } else if (_type == DieType.D6) {
            return "D6";
        } else if (_type == DieType.D8) {
            return "D8";
        } else if (_type == DieType.D10) {
            return "D10";
        } else if (_type == DieType.D12) {
            return "D12";
        } else {
            return "D20";
        }
    }
}

library ElementalTypeUtil {
    function toString(ElementalType _el) internal pure returns (string memory) {
        if (_el == ElementalType.Dark) {
            return "Dark";
        } else if (_el == ElementalType.Space) {
            return "Space";
        } else if (_el == ElementalType.Time) {
            return "Time";
        } else if (_el == ElementalType.Psychic) {
            return "Psychic";
        } else {
            return "Light";
        }
    }
}

library DiceBitmapUtil {
    function getDiceType(uint48 bitmap, uint8 diceIdx)
        internal
        pure
        returns (DieType)
    {
        // 3 bits type, then 3 bits material. This is repeated 7 times perDiceIdx
        uint256 shiftAmount = diceIdx * 6;
        // 7 as mask, which is 111, to get three bits
        uint8 typeBit = uint8((bitmap & (7 << shiftAmount)) >> shiftAmount);
        return DieType(typeBit);
    }

    function getDiceMaterial(uint48 bitmap, uint8 diceIdx)
        internal
        pure
        returns (Material)
    {
        uint256 shiftAmount = diceIdx * 6 + 3;
        uint8 typeBit = uint8((bitmap & (7 << shiftAmount)) >> shiftAmount);
        return Material(typeBit);
    }

    function getElementType(uint48 bitmap)
        internal
        pure
        returns (ElementalType)
    {
        uint256 shiftAmount = 7 * 6; // after last/7th dice
        uint8 typeBit = uint8((bitmap & (7 << shiftAmount)) >> shiftAmount);
        return ElementalType(typeBit);
    }
}

interface IDiceNFT {
    struct DiceMetadata {
        uint48 bitmap;
        uint8 amount;
        uint8 power;
    }

    event BoostUpdated(uint256 indexed tokenId, uint256 newBoostCount);

    function setOriginalMetadata(
        DiceMetadata[] calldata originalMetadata,
        uint128 _startIndex,
        uint128 _endIndex
    ) external;

    function resetBoosts(uint256 _newDefaultBoostCount) external;

    function useBoost(uint256 tokenId, uint256 count) external;

    function setBoostCount(uint256 tokenId, uint16 boostCount) external;

    function mint(address _to, uint256 _oldTokenId) external;

    function batchMint(address _to, uint256[] calldata _oldTokenIds) external;

    function getDiceBoosts(uint256 _tokenId) external view returns (uint256);

    function getDiceMaterials(uint256 _tokenId)
        external
        view
        returns (string[] memory);

    function getDiceMetadata(uint256 _tokenId)
        external
        view
        returns (DiceMetadata memory);
}

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":"uint256","name":"_defaultBoostCount","type":"uint256"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint128","name":"_royaltyBps","type":"uint128"}],"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":"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":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBoostCount","type":"uint256"}],"name":"BoostUpdated","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":"BOOST_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BOOST_USER_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":"_oldTokenIds","type":"uint256[]"}],"name":"batchMint","outputs":[],"stateMutability":"nonpayable","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":"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":[],"name":"defaultBoostCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint256","name":"_tokenId","type":"uint256"}],"name":"getDiceBoosts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getDiceMaterials","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getDiceMetadata","outputs":[{"components":[{"internalType":"uint48","name":"bitmap","type":"uint48"},{"internalType":"uint8","name":"amount","type":"uint8"},{"internalType":"uint8","name":"power","type":"uint8"}],"internalType":"struct IDiceNFT.DiceMetadata","name":"","type":"tuple"}],"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":"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":[],"name":"imageDirURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[],"name":"maxTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_oldTokenId","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"mintTo","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":"uint256","name":"_newDefaultBoostCount","type":"uint256"}],"name":"resetBoosts","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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"setBoostCount","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":[{"components":[{"internalType":"uint48","name":"bitmap","type":"uint48"},{"internalType":"uint8","name":"amount","type":"uint8"},{"internalType":"uint8","name":"power","type":"uint8"}],"internalType":"struct IDiceNFT.DiceMetadata[]","name":"originalMetadata","type":"tuple[]"},{"internalType":"uint128","name":"_startIndex","type":"uint128"},{"internalType":"uint128","name":"_endIndex","type":"uint128"}],"name":"setOriginalMetadata","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":"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"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"useBoost","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200549e3803806200549e8339810160408190526200003491620005fd565b733cc6cdda760b79bafa08df41ecfa224f810dceb6600189898585838360026200005f83826200077e565b5060036200006e82826200077e565b505060008055506200008033620002bb565b62000095826001600160801b0383166200030d565b5050506daaeb6d7670e522a718067333cd4e3b159050620001df5780156200012d57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200010e57600080fd5b505af115801562000123573d6000803e3d6000fd5b50505050620001df565b6001600160a01b038216156200017e5760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401620000f3565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001c557600080fd5b505af1158015620001da573d6000803e3d6000fd5b505050505b50620001ed905085620003b8565b62000202826001600160801b0383166200030d565b6200020f600033620004a0565b6200023b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620004a0565b620002677f1b86946b493ad8de1d09b85279940beb7cf185ef4f11f1325f0a93dcf6059b7233620004a0565b620002937f56c70e583920e141880af1bd34c25d63c509c3804ca9bc674f5d124a3a7a1efd33620004a0565b60118390556013620002a687826200077e565b50505060129190915550620008aa9350505050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b612710811115620003565760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b604482015260640160405180910390fd5b600a80546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b600060088054620003c990620006ef565b80601f0160208091040260200160405190810160405280929190818152602001828054620003f790620006ef565b8015620004485780601f106200041c5761010080835404028352916020019162000448565b820191906000526020600020905b8154815290600101906020018083116200042a57829003601f168201915b5050505050905081600890816200046091906200077e565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a1681836040516200049492919062000878565b60405180910390a15050565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200052e57818101518382015260200162000514565b50506000910152565b600082601f8301126200054957600080fd5b81516001600160401b0380821115620005665762000566620004fb565b604051601f8301601f19908116603f01168101908282118183101715620005915762000591620004fb565b81604052838152866020858801011115620005ab57600080fd5b620005be84602083016020890162000511565b9695505050505050565b80516001600160a01b0381168114620005e057600080fd5b919050565b80516001600160801b0381168114620005e057600080fd5b600080600080600080600080610100898b0312156200061b57600080fd5b88516001600160401b03808211156200063357600080fd5b620006418c838d0162000537565b995060208b01519150808211156200065857600080fd5b620006668c838d0162000537565b985060408b01519150808211156200067d57600080fd5b6200068b8c838d0162000537565b975060608b0151915080821115620006a257600080fd5b50620006b18b828c0162000537565b9550506080890151935060a08901519250620006d060c08a01620005c8565b9150620006e060e08a01620005e5565b90509295985092959890939650565b600181811c908216806200070457607f821691505b6020821081036200072557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200077957600081815260208120601f850160051c81016020861015620007545750805b601f850160051c820191505b81811015620007755782815560010162000760565b5050505b505050565b81516001600160401b038111156200079a576200079a620004fb565b620007b281620007ab8454620006ef565b846200072b565b602080601f831160018114620007ea5760008415620007d15750858301515b600019600386901b1c1916600185901b17855562000775565b600085815260208120601f198616915b828110156200081b57888601518255948401946001909101908401620007fa565b50858210156200083a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600081518084526200086481602086016020860162000511565b601f01601f19169290920160200192915050565b6040815260006200088d60408301856200084a565b8281036020840152620008a181856200084a565b95945050505050565b614be480620008ba6000396000f3fe608060405234801561001057600080fd5b50600436106103415760003560e01c80635cfcd077116101b8578063938e3d7b11610104578063b24f2d39116100a2578063d53913931161007c578063d5391393146107d8578063d547741f146107ff578063e8a3d48514610812578063e985e9c51461081a57600080fd5b8063b24f2d3914610794578063b88d4fde146107b2578063c87b56dd146107c557600080fd5b8063a217fddf116100de578063a217fddf14610746578063a22cb4651461074e578063a32fa5b314610761578063ac9650d81461077457600080fd5b8063938e3d7b1461071857806395d89b411461072b5780639bcf7a151461073357600080fd5b8063754a81d91161017157806388af98931161014b57806388af98931461069b57806389520899146106bb5780638da5cb5b146106ce57806391d14854146106df57600080fd5b8063754a81d9146106535780637cdc00c61461066157806381d92e6a1461067457600080fd5b80635cfcd077146105b7578063600dd5ea146105ca5780636352211e146105dd57806363b45e2d146105f057806370a08231146105f857806370e995bc1461060b57600080fd5b80632419f51b1161029257806340c10f1911610230578063430c20811161020a578063430c2081146105545780634684d7e9146105675780634cc157df1461057a578063512a9213146105af57600080fd5b806340c10f191461051b57806342842e0e1461052e57806342966c681461054157600080fd5b80632ab4d0521161026c5780632ab4d052146104e45780632f2ff15d146104ed57806336568abe146105005780633b1475a71461051357600080fd5b80632419f51b1461047f578063248a9ca3146104925780632a55205a146104b257600080fd5b80630e0a32d9116102ff57806318160ddd116102d957806318160ddd1461043a5780631848ce3414610446578063198772431461045957806323b872dd1461046c57600080fd5b80630e0a32d9146103e9578063101548ad1461040057806313af40351461042757600080fd5b806275a3171461034657806301f8bd681461035b57806301ffc9a71461036e57806306fdde0314610396578063081812fc146103ab578063095ea7b3146103d6575b600080fd5b610359610354366004613976565b610856565b005b6103596103693660046139c3565b610891565b61038161037c366004613a10565b610936565b60405190151581526020015b60405180910390f35b61039e6109a3565b60405161038d9190613a7d565b6103be6103b9366004613a90565b610a35565b6040516001600160a01b03909116815260200161038d565b6103596103e4366004613aa9565b610a79565b6103f260125481565b60405190815260200161038d565b6103f27f1b86946b493ad8de1d09b85279940beb7cf185ef4f11f1325f0a93dcf6059b7281565b610359610435366004613ad3565b610aff565b600154600054036103f2565b610359610454366004613aee565b610b2f565b610359610467366004613a90565b610c4d565b61035961047a366004613b10565b610cae565b6103f261048d366004613a90565b610e0a565b6103f26104a0366004613a90565b60009081526010602052604090205490565b6104c56104c0366004613aee565b610e78565b604080516001600160a01b03909316835260208301919091520161038d565b6103f260115481565b6103596104fb366004613b4c565b610eb5565b61035961050e366004613b4c565b610f4f565b6000546103f2565b610359610529366004613aa9565b610fb1565b61035961053c366004613b10565b6110de565b61035961054f366004613a90565b61122f565b610381610562366004613aa9565b61123a565b610359610575366004613bc3565b6112b9565b61058d610588366004613a90565b611495565b604080516001600160a01b03909316835261ffff90911660208301520161038d565b61039e611500565b6103596105c5366004613c15565b61158e565b6103596105d8366004613aa9565b6115a7565b6103be6105eb366004613a90565b6115d5565b600c546103f2565b6103f2610606366004613ad3565b6115e7565b61061e610619366004613a90565b611635565b60408051825165ffffffffffff16815260208084015160ff90811691830191909152928201519092169082015260600161038d565b610359610354366004613c86565b6103f261066f366004613a90565b6116d6565b6103f27f56c70e583920e141880af1bd34c25d63c509c3804ca9bc674f5d124a3a7a1efd81565b6106ae6106a9366004613a90565b611713565b60405161038d9190613d03565b6103596106c9366004613d7c565b6119b9565b6009546001600160a01b03166103be565b6103816106ed366004613b4c565b6000918252600f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610359610726366004613e10565b611b27565b61039e611b54565b610359610741366004613e44565b611b63565b6103f2600081565b61035961075c366004613e77565b611b92565b61038161076f366004613b4c565b611c27565b610787610782366004613ea3565b611c7d565b60405161038d9190613ee4565b600a546001600160a01b03811690600160a01b900461ffff1661058d565b6103596107c0366004613f39565b611d71565b61039e6107d3366004613a90565b611ed0565b6103f27f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b61035961080d366004613b4c565b6122ca565b61039e6122e3565b610381610828366004613f94565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b60405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b60448201526064015b60405180910390fd5b8161089b816122f0565b6108b857604051630a14c4b560e41b815260040160405180910390fd5b7f56c70e583920e141880af1bd34c25d63c509c3804ca9bc674f5d124a3a7a1efd6108e3813361231b565b60008481526014602090815260409182902061ffff861690819055915191825285917f9edd168b11b25f5ce7bbb2a97bc664d150a5c9468a2c1056f8d1389e5bfed4e4910160405180910390a250505050565b60006301ffc9a760e01b6001600160e01b03198316148061096757506380ac58cd60e01b6001600160e01b03198316145b806109825750635b5e139f60e01b6001600160e01b03198316145b8061099d57506001600160e01b0319821663152a902d60e11b145b92915050565b6060600280546109b290613fbe565b80601f01602080910402602001604051908101604052809291908181526020018280546109de90613fbe565b8015610a2b5780601f10610a0057610100808354040283529160200191610a2b565b820191906000526020600020905b815481529060010190602001808311610a0e57829003601f168201915b5050505050905090565b6000610a40826122f0565b610a5d576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a84826115d5565b9050806001600160a01b0316836001600160a01b031603610ab85760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614610aef57610ad28133610828565b610aef576040516367d9dca160e11b815260040160405180910390fd5b610afa83838361239b565b505050565b610b076123f7565b610b235760405162461bcd60e51b815260040161088890613ff2565b610b2c81612424565b50565b81610b39816122f0565b610b5657604051630a14c4b560e41b815260040160405180910390fd5b7f1b86946b493ad8de1d09b85279940beb7cf185ef4f11f1325f0a93dcf6059b72610b81813361231b565b60008481526014602052604090205483811015610bf05760405162461bcd60e51b815260206004820152602760248201527f52657175657374656420626f6f737420636f756e74206578636565647320746860448201526619481d1bdd185b60ca1b6064820152608401610888565b610bfa8482614030565b600086815260146020526040908190208290555186917f9edd168b11b25f5ce7bbb2a97bc664d150a5c9468a2c1056f8d1389e5bfed4e491610c3e91815260200190565b60405180910390a25050505050565b7f56c70e583920e141880af1bd34c25d63c509c3804ca9bc674f5d124a3a7a1efd610c78813361231b565b601282905560005b600054811015610afa5760125460008281526014602052604090205580610ca681614043565b915050610c80565b826daaeb6d7670e522a718067333cd4e3b15610df957336001600160a01b03821603610ce457610cdf848484612476565b610e04565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610d33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d57919061405c565b8015610dda5750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dda919061405c565b610df957604051633b79c77360e21b8152336004820152602401610888565b610e04848484612476565b50505050565b6000610e15600c5490565b8210610e535760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610888565b600c8281548110610e6657610e66614079565b90600052602060002001549050919050565b600080600080610e8786611495565b90945084925061ffff169050612710610ea0828761408f565b610eaa91906140a6565b925050509250929050565b600082815260106020526040902054610ece903361231b565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff1615610f415760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610888565b610f4b8282612481565b5050565b336001600160a01b03821614610fa75760405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152606401610888565b610f4b82826124dc565b3360009081527f3ac2ae920192ffec1f2616e363ccfeffb7844a5d9224b2df5eacfefada837607602052604090205460ff166110295760405162461bcd60e51b81526020600482015260176024820152762737ba1030baba3437b934bd32b2103a379036b4b73a1760491b6044820152606401610888565b60008181526017602052604090205460ff16156110885760405162461bcd60e51b815260206004820152601c60248201527f416c726561647920636c61696d6564206f6c6420746f6b656e206964000000006044820152606401610888565b6000805490506110a98360016040518060200160405280600081525061253e565b600090815260166020908152604080832084905560125460148352818420559282526017905220805460ff1916600117905550565b826daaeb6d7670e522a718067333cd4e3b1561122457336001600160a01b0382160361110f57610cdf8484846126e1565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa15801561115e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611182919061405c565b80156112055750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611205919061405c565b61122457604051633b79c77360e21b8152336004820152602401610888565b610e048484846126e1565b610b2c8160016126fc565b600080611246836115d5565b9050806001600160a01b0316846001600160a01b0316148061128d57506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff165b806112b15750836001600160a01b03166112a684610a35565b6001600160a01b0316145b949350505050565b3360009081527f3ac2ae920192ffec1f2616e363ccfeffb7844a5d9224b2df5eacfefada837607602052604090205460ff166113315760405162461bcd60e51b81526020600482015260176024820152762737ba1030baba3437b934bd32b2103a379036b4b73a1760491b6044820152606401610888565b80600061133d60005490565b905061135985836040518060200160405280600081525061253e565b6000815b61136784846140c8565b81101561148c576017600087878581811061138457611384614079565b602090810292909201358352508101919091526040016000205460ff16156113ee5760405162461bcd60e51b815260206004820152601c60248201527f416c726561647920636c61696d6564206f6c6420746f6b656e206964000000006044820152606401610888565b85858381811061140057611400614079565b600084815260166020908152604080832093820295909501359092556012546014909252928320555060019060179088888681811061144157611441614079565b90506020020135815260200190815260200160002060006101000a81548160ff021916908315150217905550818061147890614043565b9250508061148590614043565b905061135d565b50505050505050565b6000818152600b60209081526040808320815180830190925280546001600160a01b0316808352600190910154928201929092528291156114dc57805160208201516114f6565b600a546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b6013805461150d90613fbe565b80601f016020809104026020016040519081016040528092919081815260200182805461153990613fbe565b80156115865780601f1061155b57610100808354040283529160200191611586565b820191906000526020600020905b81548152906001019060200180831161156957829003601f168201915b505050505081565b600061159a813361231b565b6013610e04838583614129565b6115af6123f7565b6115cb5760405162461bcd60e51b815260040161088890613ff2565b610f4b82826128af565b60006115e082612955565b5192915050565b60006001600160a01b038216611610576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b60408051606081018252600080825260208201819052918101919091528161165c816122f0565b61167957604051630a14c4b560e41b815260040160405180910390fd5b600083815260166020908152604080832054835260158252918290208251606081018452905465ffffffffffff8116825260ff600160301b8204811693830193909352600160381b90049091169181019190915291505b50919050565b6000816116e2816122f0565b6116ff57604051630a14c4b560e41b815260040160405180910390fd5b505060009081526014602052604090205490565b60608161171f816122f0565b61173c57604051630a14c4b560e41b815260040160405180910390fd5b6000838152601660209081526040808320548352601582528083208151606081018352905465ffffffffffff8116825260ff600160301b82048116948301859052600160381b909104169181019190915291906001600160401b038111156117a6576117a66138d4565b6040519080825280602002602001820160405280156117d957816020015b60608152602001906001900390816117c45790505b5090506001826020015160ff1610611832576118136117fd83600001516000612a6f565b600581111561180e5761180e6141e8565b612abc565b8160008151811061182657611826614079565b60200260200101819052505b6002826020015160ff1610611872576118536117fd83600001516001612a6f565b8160018151811061186657611866614079565b60200260200101819052505b6003826020015160ff16106118b2576118936117fd83600001516002612a6f565b816002815181106118a6576118a6614079565b60200260200101819052505b6004826020015160ff16106118f2576118d36117fd83600001516003612a6f565b816003815181106118e6576118e6614079565b60200260200101819052505b6005826020015160ff1610611932576119136117fd83600001516004612a6f565b8160048151811061192657611926614079565b60200260200101819052505b6006826020015160ff1610611972576119536117fd83600001516005612a6f565b8160058151811061196657611966614079565b60200260200101819052505b6007826020015160ff16106112b1576119936117fd83600001516006612a6f565b816006815181106119a6576119a6614079565b6020026020010181905250949350505050565b60006119c5813361231b565b816001600160801b0316836001600160801b03161115611a455760405162461bcd60e51b815260206004820152603560248201527f537461727420696e6465782073686f756c64206265206c657373207468616e206044820152740dee440cae2eac2d840e8de40cadcc840d2dcc8caf605b1b6064820152608401610888565b6000611a5184846141fe565b90506001600160801b0381168514611abe5760405162461bcd60e51b815260206004820152602a60248201527f4d65746164617461206c656e67746820646f6573206e6f74206d6174636820696044820152696e6465782072616e676560b01b6064820152608401610888565b60005b816001600160801b031681101561148c57868682818110611ae457611ae4614079565b9050606002016015600083886001600160801b0316611b0391906140c8565b81526020019081526020016000208181611b1d9190614231565b5050600101611ac1565b611b2f6123f7565b611b4b5760405162461bcd60e51b815260040161088890613ff2565b610b2c81612c0c565b6060600380546109b290613fbe565b611b6b6123f7565b611b875760405162461bcd60e51b815260040161088890613ff2565b610afa838383612ce8565b336001600160a01b03831603611bbb5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000828152600f6020908152604080832083805290915281205460ff16611c7457506000828152600f602090815260408083206001600160a01b038516845290915290205460ff1661099d565b50600192915050565b6060816001600160401b03811115611c9757611c976138d4565b604051908082528060200260200182016040528015611cca57816020015b6060815260200190600190039081611cb55790505b50905060005b82811015611d6a57611d3a30858584818110611cee57611cee614079565b9050602002810190611d0091906142b5565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612db192505050565b828281518110611d4c57611d4c614079565b60200260200101819052508080611d6290614043565b915050611cd0565b5092915050565b836daaeb6d7670e522a718067333cd4e3b15611ebd57336001600160a01b03821603611da857611da385858585612ddd565b611ec9565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611df7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1b919061405c565b8015611e9e5750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9e919061405c565b611ebd57604051633b79c77360e21b8152336004820152602401610888565b611ec985858585612ddd565b5050505050565b606081611edc816122f0565b611ef957604051630a14c4b560e41b815260040160405180910390fd5b60008381526016602090815260408083205483526015825291829020825160608082018552915465ffffffffffff8116825260ff600160301b82048116948301859052600160381b909104169381019390935290600111611fb35780611f7d611f6784600001516000612e21565b6005811115611f7857611f786141e8565b612e2f565b611f8f6117fd85600001516000612a6f565b604051602001611fa1939291906142fb565b60405160208183030381529060405290505b6002826020015160ff161061200b5780611fd5611f6784600001516001612e21565b611fe76117fd85600001516001612a6f565b604051602001611ff9939291906143e0565b60405160208183030381529060405290505b6003826020015160ff1610612063578061202d611f6784600001516002612e21565b61203f6117fd85600001516002612a6f565b60405160200161205193929190614448565b60405160208183030381529060405290505b6004826020015160ff16106120bb5780612085611f6784600001516003612e21565b6120976117fd85600001516003612a6f565b6040516020016120a9939291906144b0565b60405160208183030381529060405290505b6005826020015160ff161061211357806120dd611f6784600001516004612e21565b6120ef6117fd85600001516004612a6f565b60405160200161210193929190614518565b60405160208183030381529060405290505b6006826020015160ff161061216b5780612135611f6784600001516005612e21565b6121476117fd85600001516005612a6f565b60405160200161215993929190614580565b60405160208183030381529060405290505b6007826020015160ff16106121c3578061218d611f6784600001516006612e21565b61219f6117fd85600001516006612a6f565b6040516020016121b1939291906145e8565b60405160208183030381529060405290505b806121d4836040015160ff16612f65565b6000878152601460205260409020546121ec90612f65565b6122126121fc8660000151612ff7565b600481111561220d5761220d6141e8565b613013565b6040516020016122259493929190614650565b60405160208183030381529060405290506122a16122416109a3565b60008781526016602052604090205460139061225c90612f65565b60008981526016602052604090205460139061227790612f65565b8660405160200161228d969594939291906147c7565b60405160208183030381529060405261311e565b6040516020016122b191906148d9565b6040516020818303038152906040529350505050919050565b600082815260106020526040902054610fa7903361231b565b6008805461150d90613fbe565b600080548210801561099d575050600090815260046020526040902054600160e01b900460ff161590565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff16610f4b57612359816001600160a01b03166014613270565b612364836020613270565b60405160200161237592919061491e565b60408051601f198184030181529082905262461bcd60e51b825261088891600401613a7d565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061240b6009546001600160a01b031690565b6001600160a01b0316336001600160a01b031614905090565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b610afa83838361340b565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6124e6828261231b565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000546001600160a01b03841661256757604051622e076360e81b815260040160405180910390fd5b826000036125885760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038416600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600490925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b1561269e575b60405182906001600160a01b03881690600090600080516020614b8f833981519152908290a461266760008784806001019550876135e4565b612684576040516368d2bf6b60e11b815260040160405180910390fd5b80821061262e57826000541461269957600080fd5b6126d1565b5b6040516001830192906001600160a01b03881690600090600080516020614b8f833981519152908290a480821061269f575b506000908155610e049085838684565b610afa83838360405180602001604052806000815250611d71565b600061270783612955565b8051909150821561276d576000336001600160a01b038316148061273057506127308233610828565b8061274b57503361274086610a35565b6001600160a01b0316145b90508061276b57604051632ce44b5f60e11b815260040160405180910390fd5b505b6127796000858361239b565b6001600160a01b0380821660008181526005602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b86526004909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b17855591890180845292208054919490911661287757600054821461287757805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b03841690600080516020614b8f833981519152908390a4505060018054810190555050565b6127108111156128f35760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610888565b600a80546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b604080516060810182526000808252602082018190529181019190915281600054811015612a5657600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290612a545780516001600160a01b0316156129eb579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215612a4f579392505050565b6129eb565b505b604051636f96cda160e11b815260040160405180910390fd5b600080612a7d83600661498b565b612a889060036149a7565b60ff90811691506007821b851665ffffffffffff16821c9081166005811115612ab357612ab36141e8565b95945050505050565b60606000826005811115612ad257612ad26141e8565b03612af857505060408051808201909152600581526420b6b132b960d91b602082015290565b6001826005811115612b0c57612b0c6141e8565b03612b35575050604080518082019091526008815267105b595d1a1e5cdd60c21b602082015290565b6002826005811115612b4957612b496141e8565b03612b6e5750506040805180820190915260048152635275627960e01b602082015290565b6003826005811115612b8257612b826141e8565b03612bab575050604080518082019091526008815267536170706869726560c01b602082015290565b6004826005811115612bbf57612bbf6141e8565b03612be657505060408051808201909152600681526514dc1a5b995b60d21b602082015290565b50506040805180820190915260058152642a37b830bd60d91b602082015290565b919050565b600060088054612c1b90613fbe565b80601f0160208091040260200160405190810160405280929190818152602001828054612c4790613fbe565b8015612c945780601f10612c6957610100808354040283529160200191612c94565b820191906000526020600020905b815481529060010190602001808311612c7757829003601f168201915b505050505090508160089081612caa91906149c0565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a168183604051612cdc929190614a7f565b60405180910390a15050565b612710811115612d2c5760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610888565b6040805180820182526001600160a01b0384811680835260208084018681526000898152600b8352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d910160405180910390a3505050565b6060612dd68383604051806060016040528060278152602001614b68602791396136cf565b9392505050565b612de884848461340b565b6001600160a01b0383163b15610e0457612e04848484846135e4565b610e04576040516368d2bf6b60e11b815260040160405180910390fd5b600080612a8883600661498b565b60606000826005811115612e4557612e456141e8565b03612e68575050604080518082019091526002815261110d60f21b602082015290565b6001826005811115612e7c57612e7c6141e8565b03612e9f575050604080518082019091526002815261221b60f11b602082015290565b6002826005811115612eb357612eb36141e8565b03612ed6575050604080518082019091526002815261088760f31b602082015290565b6003826005811115612eea57612eea6141e8565b03612f0e57505060408051808201909152600381526204431360ec1b602082015290565b6004826005811115612f2257612f226141e8565b03612f4657505060408051808201909152600381526222189960e91b602082015290565b505060408051808201909152600381526204432360ec1b602082015290565b60606000612f72836137ac565b60010190506000816001600160401b03811115612f9157612f916138d4565b6040519080825280601f01601f191660200182016040528015612fbb576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612fc557509392505050565b6000602a82811c6007168060048111156112b1576112b16141e8565b60606000826004811115613029576130296141e8565b0361304e5750506040805180820190915260048152634461726b60e01b602082015290565b6001826004811115613062576130626141e8565b03613088575050604080518082019091526005815264537061636560d81b602082015290565b600282600481111561309c5761309c6141e8565b036130c157505060408051808201909152600481526354696d6560e01b602082015290565b60038260048111156130d5576130d56141e8565b036130fd5750506040805180820190915260078152665073796368696360c81b602082015290565b5050604080518082019091526005815264131a59da1d60da1b602082015290565b6060815160000361313d57505060408051602081019091526000815290565b6000604051806060016040528060408152602001614b28604091399050600060038451600261316c91906140c8565b61317691906140a6565b61318190600461408f565b6001600160401b03811115613198576131986138d4565b6040519080825280601f01601f1916602001820160405280156131c2576020820181803683370190505b509050600182016020820185865187015b8082101561322e576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506131d3565b505060038651066001811461324a576002811461325d57613265565b603d6001830353603d6002830353613265565b603d60018303535b509195945050505050565b6060600061327f83600261408f565b61328a9060026140c8565b6001600160401b038111156132a1576132a16138d4565b6040519080825280601f01601f1916602001820160405280156132cb576020820181803683370190505b509050600360fc1b816000815181106132e6576132e6614079565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061331557613315614079565b60200101906001600160f81b031916908160001a905350600061333984600261408f565b6133449060016140c8565b90505b60018111156133bc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061337857613378614079565b1a60f81b82828151811061338e5761338e614079565b60200101906001600160f81b031916908160001a90535060049490941c936133b581614aa4565b9050613347565b508315612dd65760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610888565b600061341682612955565b9050836001600160a01b031681600001516001600160a01b03161461344d5760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b038616148061346b575061346b8533610828565b8061348657503361347b84610a35565b6001600160a01b0316145b9050806134a657604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0384166134cd57604051633a954ecd60e21b815260040160405180910390fd5b6134d96000848761239b565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b429092169190910217835587018084529220805491939091166135ad5760005482146135ad57805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b0316600080516020614b8f83398151915260405160405180910390a4611ec9565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613619903390899088908890600401614abb565b6020604051808303816000875af1925050508015613654575060408051601f3d908101601f1916820190925261365191810190614aee565b60015b6136b2573d808015613682576040519150601f19603f3d011682016040523d82523d6000602084013e613687565b606091505b5080516000036136aa576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60606001600160a01b0384163b6137375760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610888565b600080856001600160a01b0316856040516137529190614b0b565b600060405180830381855af49150503d806000811461378d576040519150601f19603f3d011682016040523d82523d6000602084013e613792565b606091505b50915091506137a2828286613884565b9695505050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106137eb5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613817576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061383557662386f26fc10000830492506010015b6305f5e100831061384d576305f5e100830492506008015b612710831061386157612710830492506004015b60648310613873576064830492506002015b600a831061099d5760010192915050565b60608315613893575081612dd6565b8251156138a35782518084602001fd5b8160405162461bcd60e51b81526004016108889190613a7d565b80356001600160a01b0381168114612c0757600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f8301126138fb57600080fd5b81356001600160401b0380821115613915576139156138d4565b604051601f8301601f19908116603f0116810190828211818310171561393d5761393d6138d4565b8160405283815286602085880101111561395657600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561398957600080fd5b613992836138bd565b915060208301356001600160401b038111156139ad57600080fd5b6139b9858286016138ea565b9150509250929050565b600080604083850312156139d657600080fd5b82359150602083013561ffff811681146139ef57600080fd5b809150509250929050565b6001600160e01b031981168114610b2c57600080fd5b600060208284031215613a2257600080fd5b8135612dd6816139fa565b60005b83811015613a48578181015183820152602001613a30565b50506000910152565b60008151808452613a69816020860160208601613a2d565b601f01601f19169290920160200192915050565b602081526000612dd66020830184613a51565b600060208284031215613aa257600080fd5b5035919050565b60008060408385031215613abc57600080fd5b613ac5836138bd565b946020939093013593505050565b600060208284031215613ae557600080fd5b612dd6826138bd565b60008060408385031215613b0157600080fd5b50508035926020909101359150565b600080600060608486031215613b2557600080fd5b613b2e846138bd565b9250613b3c602085016138bd565b9150604084013590509250925092565b60008060408385031215613b5f57600080fd5b82359150613b6f602084016138bd565b90509250929050565b60008083601f840112613b8a57600080fd5b5081356001600160401b03811115613ba157600080fd5b6020830191508360208260051b8501011115613bbc57600080fd5b9250929050565b600080600060408486031215613bd857600080fd5b613be1846138bd565b925060208401356001600160401b03811115613bfc57600080fd5b613c0886828701613b78565b9497909650939450505050565b60008060208385031215613c2857600080fd5b82356001600160401b0380821115613c3f57600080fd5b818501915085601f830112613c5357600080fd5b813581811115613c6257600080fd5b866020828501011115613c7457600080fd5b60209290920196919550909350505050565b60008060008060808587031215613c9c57600080fd5b613ca5856138bd565b93506020850135925060408501356001600160401b0380821115613cc857600080fd5b613cd4888389016138ea565b93506060870135915080821115613cea57600080fd5b50613cf7878288016138ea565b91505092959194509250565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613d5857603f19888603018452613d46858351613a51565b94509285019290850190600101613d2a565b5092979650505050505050565b80356001600160801b0381168114612c0757600080fd5b60008060008060608587031215613d9257600080fd5b84356001600160401b0380821115613da957600080fd5b818701915087601f830112613dbd57600080fd5b813581811115613dcc57600080fd5b886020606083028501011115613de157600080fd5b602092830196509450613df79187019050613d65565b9150613e0560408601613d65565b905092959194509250565b600060208284031215613e2257600080fd5b81356001600160401b03811115613e3857600080fd5b6112b1848285016138ea565b600080600060608486031215613e5957600080fd5b83359250613b3c602085016138bd565b8015158114610b2c57600080fd5b60008060408385031215613e8a57600080fd5b613e93836138bd565b915060208301356139ef81613e69565b60008060208385031215613eb657600080fd5b82356001600160401b03811115613ecc57600080fd5b613ed885828601613b78565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613d5857603f19888603018452613f27858351613a51565b94509285019290850190600101613f0b565b60008060008060808587031215613f4f57600080fd5b613f58856138bd565b9350613f66602086016138bd565b92506040850135915060608501356001600160401b03811115613f8857600080fd5b613cf7878288016138ea565b60008060408385031215613fa757600080fd5b613fb0836138bd565b9150613b6f602084016138bd565b600181811c90821680613fd257607f821691505b6020821081036116d057634e487b7160e01b600052602260045260246000fd5b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561099d5761099d61401a565b6000600182016140555761405561401a565b5060010190565b60006020828403121561406e57600080fd5b8151612dd681613e69565b634e487b7160e01b600052603260045260246000fd5b808202811582820484141761099d5761099d61401a565b6000826140c357634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561099d5761099d61401a565b601f821115610afa57600081815260208120601f850160051c810160208610156141025750805b601f850160051c820191505b818110156141215782815560010161410e565b505050505050565b6001600160401b03831115614140576141406138d4565b6141548361414e8354613fbe565b836140db565b6000601f84116001811461418857600085156141705750838201355b600019600387901b1c1916600186901b178355611ec9565b600083815260209020601f19861690835b828110156141b95786850135825560209485019460019092019101614199565b50868210156141d65760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052602160045260246000fd5b6001600160801b03828116828216039080821115611d6a57611d6a61401a565b6000813560ff8116811461099d57600080fd5b813565ffffffffffff811680821461424857600080fd5b825465ffffffffffff19811682178455915066ff00000000000061426e6020860161421e565b60301b16808266ffffffffffffff1985161717845567ff000000000000006142986040870161421e565b60381b16826001600160401b031985161782171784555050505050565b6000808335601e198436030181126142cc57600080fd5b8301803591506001600160401b038211156142e657600080fd5b602001915036819003821315613bbc57600080fd5b6000845161430d818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152603160f81b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b7f227d2c7b2274726169745f74797065223a22646963652000000000000000000060259390910192830152603c820152731036b0ba32b934b0b61116113b30b63ab2911d1160611b603d82015283516143c3816051840160208801613a2d565b62089f4b60ea1b6051929091019182015260540195945050505050565b600084516143f2818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152601960f91b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b6000845161445a818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152603360f81b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b600084516144c2818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152600d60fa1b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b6000845161452a818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152603560f81b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b60008451614592818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152601b60f91b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b600084516145fa818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152603760f81b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b60008551614662818460208a01613a2d565b7f7b2274726169745f74797065223a22506f776572222c2276616c7565223a0000908301908152855161469c81601e840160208a01613a2d565b808201915050611f4b60f21b80601e8301527f7b2274726169745f74797065223a22426f6f737473222c2276616c7565223a00602083015285516146e781603f850160208a01613a2d565b603f9201918201527f7b2274726169745f74797065223a22456c656d656e742054797065222c227661604182015265363ab2911d1160d11b60618201528351614737816067840160208801613a2d565b61227d60f01b606792909101918201526069019695505050505050565b6000815461476181613fbe565b60018281168015614779576001811461478e576147bd565b60ff19841687528215158302870194506147bd565b8560005260208060002060005b858110156147b45781548a82015290840190820161479b565b50505082870194505b5050505092915050565b683d913730b6b2911d1160b91b815286516000906147ec816009850160208c01613a2d565b6a11161134b6b0b3b2911d1160a91b6009918401918201526148116014820189614754565b9050602f60f81b808252875161482e816001850160208c01613a2d565b7f2e6a7067222c22616e696d6174696f6e5f75726c223a22000000000000000000600193909101928301526148666018830188614754565b915080825250845161487f816001840160208901613a2d565b732e6d7034222c2261747472696275746573223a5b60601b6001929091019182015283516148b4816015840160208801613a2d565b6148cb601582840101615d7d60f01b815260020190565b9a9950505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161491181601d850160208701613a2d565b91909101601d0192915050565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b81526000835161494e816015850160208801613a2d565b7001034b99036b4b9b9b4b733903937b6329607d1b601591840191820152835161497f816026840160208801613a2d565b01602601949350505050565b60ff8181168382160290811690818114611d6a57611d6a61401a565b60ff818116838216019081111561099d5761099d61401a565b81516001600160401b038111156149d9576149d96138d4565b6149ed816149e78454613fbe565b846140db565b602080601f831160018114614a225760008415614a0a5750858301515b600019600386901b1c1916600185901b178555614121565b600085815260208120601f198616915b82811015614a5157888601518255948401946001909101908401614a32565b5085821015614a6f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614a926040830185613a51565b8281036020840152612ab38185613a51565b600081614ab357614ab361401a565b506000190190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906137a290830184613a51565b600060208284031215614b0057600080fd5b8151612dd6816139fa565b60008251614b1d818460208701613a2d565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220a3c585d4e42c820403608b5ed53d600abfcf481d9e207d93d6b054e6f2fd09f964736f6c6343000811003300000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000419000000000000000000000000c1e8ce1751e55777262d57003240bb52b2ca45d000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000001444696365206f6620476f6f6420466f7274756e65000000000000000000000000000000000000000000000000000000000000000000000000000000000000000344474600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d655563315143654b4d6f516278537a7231366b33765452786942596f4466337731355965716f52317a32587700000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d544e365953334c4148516a785067704c7a427759485558324a3777614b4e51596f76553945583635784754620000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103415760003560e01c80635cfcd077116101b8578063938e3d7b11610104578063b24f2d39116100a2578063d53913931161007c578063d5391393146107d8578063d547741f146107ff578063e8a3d48514610812578063e985e9c51461081a57600080fd5b8063b24f2d3914610794578063b88d4fde146107b2578063c87b56dd146107c557600080fd5b8063a217fddf116100de578063a217fddf14610746578063a22cb4651461074e578063a32fa5b314610761578063ac9650d81461077457600080fd5b8063938e3d7b1461071857806395d89b411461072b5780639bcf7a151461073357600080fd5b8063754a81d91161017157806388af98931161014b57806388af98931461069b57806389520899146106bb5780638da5cb5b146106ce57806391d14854146106df57600080fd5b8063754a81d9146106535780637cdc00c61461066157806381d92e6a1461067457600080fd5b80635cfcd077146105b7578063600dd5ea146105ca5780636352211e146105dd57806363b45e2d146105f057806370a08231146105f857806370e995bc1461060b57600080fd5b80632419f51b1161029257806340c10f1911610230578063430c20811161020a578063430c2081146105545780634684d7e9146105675780634cc157df1461057a578063512a9213146105af57600080fd5b806340c10f191461051b57806342842e0e1461052e57806342966c681461054157600080fd5b80632ab4d0521161026c5780632ab4d052146104e45780632f2ff15d146104ed57806336568abe146105005780633b1475a71461051357600080fd5b80632419f51b1461047f578063248a9ca3146104925780632a55205a146104b257600080fd5b80630e0a32d9116102ff57806318160ddd116102d957806318160ddd1461043a5780631848ce3414610446578063198772431461045957806323b872dd1461046c57600080fd5b80630e0a32d9146103e9578063101548ad1461040057806313af40351461042757600080fd5b806275a3171461034657806301f8bd681461035b57806301ffc9a71461036e57806306fdde0314610396578063081812fc146103ab578063095ea7b3146103d6575b600080fd5b610359610354366004613976565b610856565b005b6103596103693660046139c3565b610891565b61038161037c366004613a10565b610936565b60405190151581526020015b60405180910390f35b61039e6109a3565b60405161038d9190613a7d565b6103be6103b9366004613a90565b610a35565b6040516001600160a01b03909116815260200161038d565b6103596103e4366004613aa9565b610a79565b6103f260125481565b60405190815260200161038d565b6103f27f1b86946b493ad8de1d09b85279940beb7cf185ef4f11f1325f0a93dcf6059b7281565b610359610435366004613ad3565b610aff565b600154600054036103f2565b610359610454366004613aee565b610b2f565b610359610467366004613a90565b610c4d565b61035961047a366004613b10565b610cae565b6103f261048d366004613a90565b610e0a565b6103f26104a0366004613a90565b60009081526010602052604090205490565b6104c56104c0366004613aee565b610e78565b604080516001600160a01b03909316835260208301919091520161038d565b6103f260115481565b6103596104fb366004613b4c565b610eb5565b61035961050e366004613b4c565b610f4f565b6000546103f2565b610359610529366004613aa9565b610fb1565b61035961053c366004613b10565b6110de565b61035961054f366004613a90565b61122f565b610381610562366004613aa9565b61123a565b610359610575366004613bc3565b6112b9565b61058d610588366004613a90565b611495565b604080516001600160a01b03909316835261ffff90911660208301520161038d565b61039e611500565b6103596105c5366004613c15565b61158e565b6103596105d8366004613aa9565b6115a7565b6103be6105eb366004613a90565b6115d5565b600c546103f2565b6103f2610606366004613ad3565b6115e7565b61061e610619366004613a90565b611635565b60408051825165ffffffffffff16815260208084015160ff90811691830191909152928201519092169082015260600161038d565b610359610354366004613c86565b6103f261066f366004613a90565b6116d6565b6103f27f56c70e583920e141880af1bd34c25d63c509c3804ca9bc674f5d124a3a7a1efd81565b6106ae6106a9366004613a90565b611713565b60405161038d9190613d03565b6103596106c9366004613d7c565b6119b9565b6009546001600160a01b03166103be565b6103816106ed366004613b4c565b6000918252600f602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610359610726366004613e10565b611b27565b61039e611b54565b610359610741366004613e44565b611b63565b6103f2600081565b61035961075c366004613e77565b611b92565b61038161076f366004613b4c565b611c27565b610787610782366004613ea3565b611c7d565b60405161038d9190613ee4565b600a546001600160a01b03811690600160a01b900461ffff1661058d565b6103596107c0366004613f39565b611d71565b61039e6107d3366004613a90565b611ed0565b6103f27f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b61035961080d366004613b4c565b6122ca565b61039e6122e3565b610381610828366004613f94565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b60405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b60448201526064015b60405180910390fd5b8161089b816122f0565b6108b857604051630a14c4b560e41b815260040160405180910390fd5b7f56c70e583920e141880af1bd34c25d63c509c3804ca9bc674f5d124a3a7a1efd6108e3813361231b565b60008481526014602090815260409182902061ffff861690819055915191825285917f9edd168b11b25f5ce7bbb2a97bc664d150a5c9468a2c1056f8d1389e5bfed4e4910160405180910390a250505050565b60006301ffc9a760e01b6001600160e01b03198316148061096757506380ac58cd60e01b6001600160e01b03198316145b806109825750635b5e139f60e01b6001600160e01b03198316145b8061099d57506001600160e01b0319821663152a902d60e11b145b92915050565b6060600280546109b290613fbe565b80601f01602080910402602001604051908101604052809291908181526020018280546109de90613fbe565b8015610a2b5780601f10610a0057610100808354040283529160200191610a2b565b820191906000526020600020905b815481529060010190602001808311610a0e57829003601f168201915b5050505050905090565b6000610a40826122f0565b610a5d576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a84826115d5565b9050806001600160a01b0316836001600160a01b031603610ab85760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614610aef57610ad28133610828565b610aef576040516367d9dca160e11b815260040160405180910390fd5b610afa83838361239b565b505050565b610b076123f7565b610b235760405162461bcd60e51b815260040161088890613ff2565b610b2c81612424565b50565b81610b39816122f0565b610b5657604051630a14c4b560e41b815260040160405180910390fd5b7f1b86946b493ad8de1d09b85279940beb7cf185ef4f11f1325f0a93dcf6059b72610b81813361231b565b60008481526014602052604090205483811015610bf05760405162461bcd60e51b815260206004820152602760248201527f52657175657374656420626f6f737420636f756e74206578636565647320746860448201526619481d1bdd185b60ca1b6064820152608401610888565b610bfa8482614030565b600086815260146020526040908190208290555186917f9edd168b11b25f5ce7bbb2a97bc664d150a5c9468a2c1056f8d1389e5bfed4e491610c3e91815260200190565b60405180910390a25050505050565b7f56c70e583920e141880af1bd34c25d63c509c3804ca9bc674f5d124a3a7a1efd610c78813361231b565b601282905560005b600054811015610afa5760125460008281526014602052604090205580610ca681614043565b915050610c80565b826daaeb6d7670e522a718067333cd4e3b15610df957336001600160a01b03821603610ce457610cdf848484612476565b610e04565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610d33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d57919061405c565b8015610dda5750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dda919061405c565b610df957604051633b79c77360e21b8152336004820152602401610888565b610e04848484612476565b50505050565b6000610e15600c5490565b8210610e535760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610888565b600c8281548110610e6657610e66614079565b90600052602060002001549050919050565b600080600080610e8786611495565b90945084925061ffff169050612710610ea0828761408f565b610eaa91906140a6565b925050509250929050565b600082815260106020526040902054610ece903361231b565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff1615610f415760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610888565b610f4b8282612481565b5050565b336001600160a01b03821614610fa75760405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152606401610888565b610f4b82826124dc565b3360009081527f3ac2ae920192ffec1f2616e363ccfeffb7844a5d9224b2df5eacfefada837607602052604090205460ff166110295760405162461bcd60e51b81526020600482015260176024820152762737ba1030baba3437b934bd32b2103a379036b4b73a1760491b6044820152606401610888565b60008181526017602052604090205460ff16156110885760405162461bcd60e51b815260206004820152601c60248201527f416c726561647920636c61696d6564206f6c6420746f6b656e206964000000006044820152606401610888565b6000805490506110a98360016040518060200160405280600081525061253e565b600090815260166020908152604080832084905560125460148352818420559282526017905220805460ff1916600117905550565b826daaeb6d7670e522a718067333cd4e3b1561122457336001600160a01b0382160361110f57610cdf8484846126e1565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa15801561115e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611182919061405c565b80156112055750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611205919061405c565b61122457604051633b79c77360e21b8152336004820152602401610888565b610e048484846126e1565b610b2c8160016126fc565b600080611246836115d5565b9050806001600160a01b0316846001600160a01b0316148061128d57506001600160a01b0380821660009081526007602090815260408083209388168352929052205460ff165b806112b15750836001600160a01b03166112a684610a35565b6001600160a01b0316145b949350505050565b3360009081527f3ac2ae920192ffec1f2616e363ccfeffb7844a5d9224b2df5eacfefada837607602052604090205460ff166113315760405162461bcd60e51b81526020600482015260176024820152762737ba1030baba3437b934bd32b2103a379036b4b73a1760491b6044820152606401610888565b80600061133d60005490565b905061135985836040518060200160405280600081525061253e565b6000815b61136784846140c8565b81101561148c576017600087878581811061138457611384614079565b602090810292909201358352508101919091526040016000205460ff16156113ee5760405162461bcd60e51b815260206004820152601c60248201527f416c726561647920636c61696d6564206f6c6420746f6b656e206964000000006044820152606401610888565b85858381811061140057611400614079565b600084815260166020908152604080832093820295909501359092556012546014909252928320555060019060179088888681811061144157611441614079565b90506020020135815260200190815260200160002060006101000a81548160ff021916908315150217905550818061147890614043565b9250508061148590614043565b905061135d565b50505050505050565b6000818152600b60209081526040808320815180830190925280546001600160a01b0316808352600190910154928201929092528291156114dc57805160208201516114f6565b600a546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b6013805461150d90613fbe565b80601f016020809104026020016040519081016040528092919081815260200182805461153990613fbe565b80156115865780601f1061155b57610100808354040283529160200191611586565b820191906000526020600020905b81548152906001019060200180831161156957829003601f168201915b505050505081565b600061159a813361231b565b6013610e04838583614129565b6115af6123f7565b6115cb5760405162461bcd60e51b815260040161088890613ff2565b610f4b82826128af565b60006115e082612955565b5192915050565b60006001600160a01b038216611610576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b60408051606081018252600080825260208201819052918101919091528161165c816122f0565b61167957604051630a14c4b560e41b815260040160405180910390fd5b600083815260166020908152604080832054835260158252918290208251606081018452905465ffffffffffff8116825260ff600160301b8204811693830193909352600160381b90049091169181019190915291505b50919050565b6000816116e2816122f0565b6116ff57604051630a14c4b560e41b815260040160405180910390fd5b505060009081526014602052604090205490565b60608161171f816122f0565b61173c57604051630a14c4b560e41b815260040160405180910390fd5b6000838152601660209081526040808320548352601582528083208151606081018352905465ffffffffffff8116825260ff600160301b82048116948301859052600160381b909104169181019190915291906001600160401b038111156117a6576117a66138d4565b6040519080825280602002602001820160405280156117d957816020015b60608152602001906001900390816117c45790505b5090506001826020015160ff1610611832576118136117fd83600001516000612a6f565b600581111561180e5761180e6141e8565b612abc565b8160008151811061182657611826614079565b60200260200101819052505b6002826020015160ff1610611872576118536117fd83600001516001612a6f565b8160018151811061186657611866614079565b60200260200101819052505b6003826020015160ff16106118b2576118936117fd83600001516002612a6f565b816002815181106118a6576118a6614079565b60200260200101819052505b6004826020015160ff16106118f2576118d36117fd83600001516003612a6f565b816003815181106118e6576118e6614079565b60200260200101819052505b6005826020015160ff1610611932576119136117fd83600001516004612a6f565b8160048151811061192657611926614079565b60200260200101819052505b6006826020015160ff1610611972576119536117fd83600001516005612a6f565b8160058151811061196657611966614079565b60200260200101819052505b6007826020015160ff16106112b1576119936117fd83600001516006612a6f565b816006815181106119a6576119a6614079565b6020026020010181905250949350505050565b60006119c5813361231b565b816001600160801b0316836001600160801b03161115611a455760405162461bcd60e51b815260206004820152603560248201527f537461727420696e6465782073686f756c64206265206c657373207468616e206044820152740dee440cae2eac2d840e8de40cadcc840d2dcc8caf605b1b6064820152608401610888565b6000611a5184846141fe565b90506001600160801b0381168514611abe5760405162461bcd60e51b815260206004820152602a60248201527f4d65746164617461206c656e67746820646f6573206e6f74206d6174636820696044820152696e6465782072616e676560b01b6064820152608401610888565b60005b816001600160801b031681101561148c57868682818110611ae457611ae4614079565b9050606002016015600083886001600160801b0316611b0391906140c8565b81526020019081526020016000208181611b1d9190614231565b5050600101611ac1565b611b2f6123f7565b611b4b5760405162461bcd60e51b815260040161088890613ff2565b610b2c81612c0c565b6060600380546109b290613fbe565b611b6b6123f7565b611b875760405162461bcd60e51b815260040161088890613ff2565b610afa838383612ce8565b336001600160a01b03831603611bbb5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000828152600f6020908152604080832083805290915281205460ff16611c7457506000828152600f602090815260408083206001600160a01b038516845290915290205460ff1661099d565b50600192915050565b6060816001600160401b03811115611c9757611c976138d4565b604051908082528060200260200182016040528015611cca57816020015b6060815260200190600190039081611cb55790505b50905060005b82811015611d6a57611d3a30858584818110611cee57611cee614079565b9050602002810190611d0091906142b5565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612db192505050565b828281518110611d4c57611d4c614079565b60200260200101819052508080611d6290614043565b915050611cd0565b5092915050565b836daaeb6d7670e522a718067333cd4e3b15611ebd57336001600160a01b03821603611da857611da385858585612ddd565b611ec9565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611df7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1b919061405c565b8015611e9e5750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9e919061405c565b611ebd57604051633b79c77360e21b8152336004820152602401610888565b611ec985858585612ddd565b5050505050565b606081611edc816122f0565b611ef957604051630a14c4b560e41b815260040160405180910390fd5b60008381526016602090815260408083205483526015825291829020825160608082018552915465ffffffffffff8116825260ff600160301b82048116948301859052600160381b909104169381019390935290600111611fb35780611f7d611f6784600001516000612e21565b6005811115611f7857611f786141e8565b612e2f565b611f8f6117fd85600001516000612a6f565b604051602001611fa1939291906142fb565b60405160208183030381529060405290505b6002826020015160ff161061200b5780611fd5611f6784600001516001612e21565b611fe76117fd85600001516001612a6f565b604051602001611ff9939291906143e0565b60405160208183030381529060405290505b6003826020015160ff1610612063578061202d611f6784600001516002612e21565b61203f6117fd85600001516002612a6f565b60405160200161205193929190614448565b60405160208183030381529060405290505b6004826020015160ff16106120bb5780612085611f6784600001516003612e21565b6120976117fd85600001516003612a6f565b6040516020016120a9939291906144b0565b60405160208183030381529060405290505b6005826020015160ff161061211357806120dd611f6784600001516004612e21565b6120ef6117fd85600001516004612a6f565b60405160200161210193929190614518565b60405160208183030381529060405290505b6006826020015160ff161061216b5780612135611f6784600001516005612e21565b6121476117fd85600001516005612a6f565b60405160200161215993929190614580565b60405160208183030381529060405290505b6007826020015160ff16106121c3578061218d611f6784600001516006612e21565b61219f6117fd85600001516006612a6f565b6040516020016121b1939291906145e8565b60405160208183030381529060405290505b806121d4836040015160ff16612f65565b6000878152601460205260409020546121ec90612f65565b6122126121fc8660000151612ff7565b600481111561220d5761220d6141e8565b613013565b6040516020016122259493929190614650565b60405160208183030381529060405290506122a16122416109a3565b60008781526016602052604090205460139061225c90612f65565b60008981526016602052604090205460139061227790612f65565b8660405160200161228d969594939291906147c7565b60405160208183030381529060405261311e565b6040516020016122b191906148d9565b6040516020818303038152906040529350505050919050565b600082815260106020526040902054610fa7903361231b565b6008805461150d90613fbe565b600080548210801561099d575050600090815260046020526040902054600160e01b900460ff161590565b6000828152600f602090815260408083206001600160a01b038516845290915290205460ff16610f4b57612359816001600160a01b03166014613270565b612364836020613270565b60405160200161237592919061491e565b60408051601f198184030181529082905262461bcd60e51b825261088891600401613a7d565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061240b6009546001600160a01b031690565b6001600160a01b0316336001600160a01b031614905090565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b610afa83838361340b565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6124e6828261231b565b6000828152600f602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000546001600160a01b03841661256757604051622e076360e81b815260040160405180910390fd5b826000036125885760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038416600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168b0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168b01811690920217909155858452600490925290912080546001600160e01b0319168317600160a01b42909316929092029190911790558190818501903b1561269e575b60405182906001600160a01b03881690600090600080516020614b8f833981519152908290a461266760008784806001019550876135e4565b612684576040516368d2bf6b60e11b815260040160405180910390fd5b80821061262e57826000541461269957600080fd5b6126d1565b5b6040516001830192906001600160a01b03881690600090600080516020614b8f833981519152908290a480821061269f575b506000908155610e049085838684565b610afa83838360405180602001604052806000815250611d71565b600061270783612955565b8051909150821561276d576000336001600160a01b038316148061273057506127308233610828565b8061274b57503361274086610a35565b6001600160a01b0316145b90508061276b57604051632ce44b5f60e11b815260040160405180910390fd5b505b6127796000858361239b565b6001600160a01b0380821660008181526005602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b86526004909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b17855591890180845292208054919490911661287757600054821461287757805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b03841690600080516020614b8f833981519152908390a4505060018054810190555050565b6127108111156128f35760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610888565b600a80546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b604080516060810182526000808252602082018190529181019190915281600054811015612a5657600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290612a545780516001600160a01b0316156129eb579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215612a4f579392505050565b6129eb565b505b604051636f96cda160e11b815260040160405180910390fd5b600080612a7d83600661498b565b612a889060036149a7565b60ff90811691506007821b851665ffffffffffff16821c9081166005811115612ab357612ab36141e8565b95945050505050565b60606000826005811115612ad257612ad26141e8565b03612af857505060408051808201909152600581526420b6b132b960d91b602082015290565b6001826005811115612b0c57612b0c6141e8565b03612b35575050604080518082019091526008815267105b595d1a1e5cdd60c21b602082015290565b6002826005811115612b4957612b496141e8565b03612b6e5750506040805180820190915260048152635275627960e01b602082015290565b6003826005811115612b8257612b826141e8565b03612bab575050604080518082019091526008815267536170706869726560c01b602082015290565b6004826005811115612bbf57612bbf6141e8565b03612be657505060408051808201909152600681526514dc1a5b995b60d21b602082015290565b50506040805180820190915260058152642a37b830bd60d91b602082015290565b919050565b600060088054612c1b90613fbe565b80601f0160208091040260200160405190810160405280929190818152602001828054612c4790613fbe565b8015612c945780601f10612c6957610100808354040283529160200191612c94565b820191906000526020600020905b815481529060010190602001808311612c7757829003601f168201915b505050505090508160089081612caa91906149c0565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a168183604051612cdc929190614a7f565b60405180910390a15050565b612710811115612d2c5760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b6044820152606401610888565b6040805180820182526001600160a01b0384811680835260208084018681526000898152600b8352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d910160405180910390a3505050565b6060612dd68383604051806060016040528060278152602001614b68602791396136cf565b9392505050565b612de884848461340b565b6001600160a01b0383163b15610e0457612e04848484846135e4565b610e04576040516368d2bf6b60e11b815260040160405180910390fd5b600080612a8883600661498b565b60606000826005811115612e4557612e456141e8565b03612e68575050604080518082019091526002815261110d60f21b602082015290565b6001826005811115612e7c57612e7c6141e8565b03612e9f575050604080518082019091526002815261221b60f11b602082015290565b6002826005811115612eb357612eb36141e8565b03612ed6575050604080518082019091526002815261088760f31b602082015290565b6003826005811115612eea57612eea6141e8565b03612f0e57505060408051808201909152600381526204431360ec1b602082015290565b6004826005811115612f2257612f226141e8565b03612f4657505060408051808201909152600381526222189960e91b602082015290565b505060408051808201909152600381526204432360ec1b602082015290565b60606000612f72836137ac565b60010190506000816001600160401b03811115612f9157612f916138d4565b6040519080825280601f01601f191660200182016040528015612fbb576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612fc557509392505050565b6000602a82811c6007168060048111156112b1576112b16141e8565b60606000826004811115613029576130296141e8565b0361304e5750506040805180820190915260048152634461726b60e01b602082015290565b6001826004811115613062576130626141e8565b03613088575050604080518082019091526005815264537061636560d81b602082015290565b600282600481111561309c5761309c6141e8565b036130c157505060408051808201909152600481526354696d6560e01b602082015290565b60038260048111156130d5576130d56141e8565b036130fd5750506040805180820190915260078152665073796368696360c81b602082015290565b5050604080518082019091526005815264131a59da1d60da1b602082015290565b6060815160000361313d57505060408051602081019091526000815290565b6000604051806060016040528060408152602001614b28604091399050600060038451600261316c91906140c8565b61317691906140a6565b61318190600461408f565b6001600160401b03811115613198576131986138d4565b6040519080825280601f01601f1916602001820160405280156131c2576020820181803683370190505b509050600182016020820185865187015b8082101561322e576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506131d3565b505060038651066001811461324a576002811461325d57613265565b603d6001830353603d6002830353613265565b603d60018303535b509195945050505050565b6060600061327f83600261408f565b61328a9060026140c8565b6001600160401b038111156132a1576132a16138d4565b6040519080825280601f01601f1916602001820160405280156132cb576020820181803683370190505b509050600360fc1b816000815181106132e6576132e6614079565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061331557613315614079565b60200101906001600160f81b031916908160001a905350600061333984600261408f565b6133449060016140c8565b90505b60018111156133bc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061337857613378614079565b1a60f81b82828151811061338e5761338e614079565b60200101906001600160f81b031916908160001a90535060049490941c936133b581614aa4565b9050613347565b508315612dd65760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610888565b600061341682612955565b9050836001600160a01b031681600001516001600160a01b03161461344d5760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b038616148061346b575061346b8533610828565b8061348657503361347b84610a35565b6001600160a01b0316145b9050806134a657604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0384166134cd57604051633a954ecd60e21b815260040160405180910390fd5b6134d96000848761239b565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b429092169190910217835587018084529220805491939091166135ad5760005482146135ad57805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b0316600080516020614b8f83398151915260405160405180910390a4611ec9565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613619903390899088908890600401614abb565b6020604051808303816000875af1925050508015613654575060408051601f3d908101601f1916820190925261365191810190614aee565b60015b6136b2573d808015613682576040519150601f19603f3d011682016040523d82523d6000602084013e613687565b606091505b5080516000036136aa576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60606001600160a01b0384163b6137375760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610888565b600080856001600160a01b0316856040516137529190614b0b565b600060405180830381855af49150503d806000811461378d576040519150601f19603f3d011682016040523d82523d6000602084013e613792565b606091505b50915091506137a2828286613884565b9695505050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106137eb5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613817576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061383557662386f26fc10000830492506010015b6305f5e100831061384d576305f5e100830492506008015b612710831061386157612710830492506004015b60648310613873576064830492506002015b600a831061099d5760010192915050565b60608315613893575081612dd6565b8251156138a35782518084602001fd5b8160405162461bcd60e51b81526004016108889190613a7d565b80356001600160a01b0381168114612c0757600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f8301126138fb57600080fd5b81356001600160401b0380821115613915576139156138d4565b604051601f8301601f19908116603f0116810190828211818310171561393d5761393d6138d4565b8160405283815286602085880101111561395657600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561398957600080fd5b613992836138bd565b915060208301356001600160401b038111156139ad57600080fd5b6139b9858286016138ea565b9150509250929050565b600080604083850312156139d657600080fd5b82359150602083013561ffff811681146139ef57600080fd5b809150509250929050565b6001600160e01b031981168114610b2c57600080fd5b600060208284031215613a2257600080fd5b8135612dd6816139fa565b60005b83811015613a48578181015183820152602001613a30565b50506000910152565b60008151808452613a69816020860160208601613a2d565b601f01601f19169290920160200192915050565b602081526000612dd66020830184613a51565b600060208284031215613aa257600080fd5b5035919050565b60008060408385031215613abc57600080fd5b613ac5836138bd565b946020939093013593505050565b600060208284031215613ae557600080fd5b612dd6826138bd565b60008060408385031215613b0157600080fd5b50508035926020909101359150565b600080600060608486031215613b2557600080fd5b613b2e846138bd565b9250613b3c602085016138bd565b9150604084013590509250925092565b60008060408385031215613b5f57600080fd5b82359150613b6f602084016138bd565b90509250929050565b60008083601f840112613b8a57600080fd5b5081356001600160401b03811115613ba157600080fd5b6020830191508360208260051b8501011115613bbc57600080fd5b9250929050565b600080600060408486031215613bd857600080fd5b613be1846138bd565b925060208401356001600160401b03811115613bfc57600080fd5b613c0886828701613b78565b9497909650939450505050565b60008060208385031215613c2857600080fd5b82356001600160401b0380821115613c3f57600080fd5b818501915085601f830112613c5357600080fd5b813581811115613c6257600080fd5b866020828501011115613c7457600080fd5b60209290920196919550909350505050565b60008060008060808587031215613c9c57600080fd5b613ca5856138bd565b93506020850135925060408501356001600160401b0380821115613cc857600080fd5b613cd4888389016138ea565b93506060870135915080821115613cea57600080fd5b50613cf7878288016138ea565b91505092959194509250565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613d5857603f19888603018452613d46858351613a51565b94509285019290850190600101613d2a565b5092979650505050505050565b80356001600160801b0381168114612c0757600080fd5b60008060008060608587031215613d9257600080fd5b84356001600160401b0380821115613da957600080fd5b818701915087601f830112613dbd57600080fd5b813581811115613dcc57600080fd5b886020606083028501011115613de157600080fd5b602092830196509450613df79187019050613d65565b9150613e0560408601613d65565b905092959194509250565b600060208284031215613e2257600080fd5b81356001600160401b03811115613e3857600080fd5b6112b1848285016138ea565b600080600060608486031215613e5957600080fd5b83359250613b3c602085016138bd565b8015158114610b2c57600080fd5b60008060408385031215613e8a57600080fd5b613e93836138bd565b915060208301356139ef81613e69565b60008060208385031215613eb657600080fd5b82356001600160401b03811115613ecc57600080fd5b613ed885828601613b78565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613d5857603f19888603018452613f27858351613a51565b94509285019290850190600101613f0b565b60008060008060808587031215613f4f57600080fd5b613f58856138bd565b9350613f66602086016138bd565b92506040850135915060608501356001600160401b03811115613f8857600080fd5b613cf7878288016138ea565b60008060408385031215613fa757600080fd5b613fb0836138bd565b9150613b6f602084016138bd565b600181811c90821680613fd257607f821691505b6020821081036116d057634e487b7160e01b600052602260045260246000fd5b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561099d5761099d61401a565b6000600182016140555761405561401a565b5060010190565b60006020828403121561406e57600080fd5b8151612dd681613e69565b634e487b7160e01b600052603260045260246000fd5b808202811582820484141761099d5761099d61401a565b6000826140c357634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561099d5761099d61401a565b601f821115610afa57600081815260208120601f850160051c810160208610156141025750805b601f850160051c820191505b818110156141215782815560010161410e565b505050505050565b6001600160401b03831115614140576141406138d4565b6141548361414e8354613fbe565b836140db565b6000601f84116001811461418857600085156141705750838201355b600019600387901b1c1916600186901b178355611ec9565b600083815260209020601f19861690835b828110156141b95786850135825560209485019460019092019101614199565b50868210156141d65760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052602160045260246000fd5b6001600160801b03828116828216039080821115611d6a57611d6a61401a565b6000813560ff8116811461099d57600080fd5b813565ffffffffffff811680821461424857600080fd5b825465ffffffffffff19811682178455915066ff00000000000061426e6020860161421e565b60301b16808266ffffffffffffff1985161717845567ff000000000000006142986040870161421e565b60381b16826001600160401b031985161782171784555050505050565b6000808335601e198436030181126142cc57600080fd5b8301803591506001600160401b038211156142e657600080fd5b602001915036819003821315613bbc57600080fd5b6000845161430d818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152603160f81b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b7f227d2c7b2274726169745f74797065223a22646963652000000000000000000060259390910192830152603c820152731036b0ba32b934b0b61116113b30b63ab2911d1160611b603d82015283516143c3816051840160208801613a2d565b62089f4b60ea1b6051929091019182015260540195945050505050565b600084516143f2818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152601960f91b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b6000845161445a818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152603360f81b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b600084516144c2818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152600d60fa1b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b6000845161452a818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152603560f81b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b60008451614592818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152601b60f91b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b600084516145fa818460208901613a2d565b7303d913a3930b4ba2fba3cb832911d113234b1b2960651b908301908152603760f81b601482018190526f103a3cb8329116113b30b63ab2911d1160811b60158301528551614363816025850160208a01613a2d565b60008551614662818460208a01613a2d565b7f7b2274726169745f74797065223a22506f776572222c2276616c7565223a0000908301908152855161469c81601e840160208a01613a2d565b808201915050611f4b60f21b80601e8301527f7b2274726169745f74797065223a22426f6f737473222c2276616c7565223a00602083015285516146e781603f850160208a01613a2d565b603f9201918201527f7b2274726169745f74797065223a22456c656d656e742054797065222c227661604182015265363ab2911d1160d11b60618201528351614737816067840160208801613a2d565b61227d60f01b606792909101918201526069019695505050505050565b6000815461476181613fbe565b60018281168015614779576001811461478e576147bd565b60ff19841687528215158302870194506147bd565b8560005260208060002060005b858110156147b45781548a82015290840190820161479b565b50505082870194505b5050505092915050565b683d913730b6b2911d1160b91b815286516000906147ec816009850160208c01613a2d565b6a11161134b6b0b3b2911d1160a91b6009918401918201526148116014820189614754565b9050602f60f81b808252875161482e816001850160208c01613a2d565b7f2e6a7067222c22616e696d6174696f6e5f75726c223a22000000000000000000600193909101928301526148666018830188614754565b915080825250845161487f816001840160208901613a2d565b732e6d7034222c2261747472696275746573223a5b60601b6001929091019182015283516148b4816015840160208801613a2d565b6148cb601582840101615d7d60f01b815260020190565b9a9950505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161491181601d850160208701613a2d565b91909101601d0192915050565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b81526000835161494e816015850160208801613a2d565b7001034b99036b4b9b9b4b733903937b6329607d1b601591840191820152835161497f816026840160208801613a2d565b01602601949350505050565b60ff8181168382160290811690818114611d6a57611d6a61401a565b60ff818116838216019081111561099d5761099d61401a565b81516001600160401b038111156149d9576149d96138d4565b6149ed816149e78454613fbe565b846140db565b602080601f831160018114614a225760008415614a0a5750858301515b600019600386901b1c1916600185901b178555614121565b600085815260208120601f198616915b82811015614a5157888601518255948401946001909101908401614a32565b5085821015614a6f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614a926040830185613a51565b8281036020840152612ab38185613a51565b600081614ab357614ab361401a565b506000190190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906137a290830184613a51565b600060208284031215614b0057600080fd5b8151612dd6816139fa565b60008251614b1d818460208701613a2d565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220a3c585d4e42c820403608b5ed53d600abfcf481d9e207d93d6b054e6f2fd09f964736f6c63430008110033

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

00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000419000000000000000000000000c1e8ce1751e55777262d57003240bb52b2ca45d000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000001444696365206f6620476f6f6420466f7274756e65000000000000000000000000000000000000000000000000000000000000000000000000000000000000000344474600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d655563315143654b4d6f516278537a7231366b33765452786942596f4466337731355965716f52317a32587700000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d544e365953334c4148516a785067704c7a427759485558324a3777614b4e51596f76553945583635784754620000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Dice of Good Fortune
Arg [1] : _symbol (string): DGF
Arg [2] : _imageDirURI (string): ipfs://QmeUc1QCeKMoQbxSzr16k3vTRxiBYoDf3w15YeqoR1z2Xw
Arg [3] : _contractURI (string): ipfs://QmTN6YS3LAHQjxPgpLzBwYHUX2J7waKNQYovU9EX65xGTb
Arg [4] : _defaultBoostCount (uint256): 1
Arg [5] : _maxSupply (uint256): 1049
Arg [6] : _royaltyRecipient (address): 0xc1e8cE1751E55777262d57003240BB52B2Ca45D0
Arg [7] : _royaltyBps (uint128): 1000

-----Encoded View---------------
18 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000419
Arg [6] : 000000000000000000000000c1e8ce1751e55777262d57003240bb52b2ca45d0
Arg [7] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [9] : 44696365206f6620476f6f6420466f7274756e65000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [11] : 4447460000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000035
Arg [13] : 697066733a2f2f516d655563315143654b4d6f516278537a7231366b33765452
Arg [14] : 786942596f4466337731355965716f52317a3258770000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000035
Arg [16] : 697066733a2f2f516d544e365953334c4148516a785067704c7a427759485558
Arg [17] : 324a3777614b4e51596f76553945583635784754620000000000000000000000


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.